Changeset 430


Ignore:
Timestamp:
Oct 31, 2013 9:21:07 PM (11 years ago)
Author:
anonymous
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.1dev/lib/SpellCheck.inc.php

    r429 r430  
    202202        // http://stackoverflow.com/questions/790596/split-a-text-into-single-words
    203203        $words = preg_split("/((^\p{P}+)|(\p{P}*\s+\p{P}*)|[\p{Pd}—–-]+|(\p{P}+$))/", $string);
    204         // Remove non-word elements.
    205         $words = preg_grep('/\w+/', $words);
    206 
    207204        if (is_array($words) && !empty($words)) {
     205            // Remove non-word elements.
     206            $words = preg_grep('/\w+/', $words);
     207            $words = array_map('strip_tags', $words);
    208208            foreach ($words as $i => $word) {
    209209                if (!$this->check($word)) {
     
    238238        // http://stackoverflow.com/questions/790596/split-a-text-into-single-words
    239239        $words = preg_split("/((^\p{P}+)|(\p{P}*\s+\p{P}*)|[\p{Pd}—–-]+|(\p{P}+$))/", $string);
    240         // Remove non-word elements.
    241         $check_words = preg_grep('/\w+/', $words);
    242 
    243         if (is_array($check_words) && !empty($check_words)) {
    244             foreach ($check_words as $i => $word) {
     240        if (is_array($words) && !empty($words)) {
     241            // Remove non-word elements.
     242            $words = preg_grep('/\w+/', $words);
     243            $words = array_map('strip_tags', $words);
     244            foreach ($words as $i => $word) {
    245245                if (!$this->check($word)) {
    246246                    $errors[] = $word;
     
    271271        // http://stackoverflow.com/questions/790596/split-a-text-into-single-words
    272272        $words = preg_split("/((^\p{P}+)|(\p{P}*\s+\p{P}*)|[\p{Pd}—–-]+|(\p{P}+$))/", $string);
    273         $check_words = preg_grep('/\w+/', $words);
    274273        $cnt = 0;
    275         if (is_array($check_words) && !empty($check_words)) {
    276             foreach ($check_words as $i => $word) {
     274        if (is_array($words) && !empty($words)) {
     275            $words = preg_grep('/\w+/', $words);
     276            foreach ($words as $i => $word) {
    277277                if (!$this->check($word)) {
    278278                    $footnote = $show_footnote ? '<sup style="color:#999;">' . ++$cnt . '</sup>' : '';
     
    300300        <?php
    301301       
    302         $form_words = array_values($this->getStringSuggestions(getFormData($form_name)));
     302        $form_words = $this->getStringSuggestions(getFormData($form_name));
    303303        if (is_array($form_words) && !empty($form_words)) {
    304304            ?><ol><?php
     305            $j = 1;
    305306            foreach ($form_words as $i => $words) {
    306307                ?>
    307308                <li>
    308                 <label style="color:#999;"><sub style="vertical-align:text-top;"><?php echo $i + 1; ?></sub></label>
     309                <label style="color:#999;"><sub style="vertical-align:text-top;"><?php echo $j++; ?></sub></label>
    309310                <select name="spelling_suggestions[<?php echo $form_name ?>][<?php echo $i ?>]" onchange="document.forms[0].elements['spelling_corrections[<?php echo $form_name ?>][<?php echo $i ?>]'].value = this.value;">
    310311                <?php $original_word = array_shift($words); ?>
Note: See TracChangeset for help on using the changeset viewer.