Ignore:
Timestamp:
03/30/10 13:37:51 (14 years ago)
Author:
paula.franceschini
Message:

Ticket #891 - correção da acentuação do corretor ortográfico

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/expressoMail1_2/corretor_ortografico/spell_checker/spell_checker.php

    r2375 r2387  
    136136} // end showSuggestions 
    137137 
    138  
     138  
    139139/************************************************************* 
    140140 * spellCheck($string) 
     
    186186                        for($j=0; $j<$numWords; $j++) 
    187187                        { 
    188                                 //preg_match("/[A-Z']{1,16}/i", $words[$i][$j], $tmp); //get the word that is in the array slot $i 
    189                                 $tmp = split(" ", $words[$i][$j]); 
    190                                 $tmpWord = utf8_encode($tmp[0]); //should only have one element in the array anyway, so it's just assign it to $tmpWord 
    191                                  
    192                                 //And we replace the word in the array with the span that highlights it and gives it an onClick parameter to show the suggestions. 
     188                                $word = utf8_decode($words[$i][$j]); 
     189 
     190                                $reg_expr = utf8_decode('A-ZáàâãÀéÚêëíìïîóòÎõöúùûÌÜÿçñÁÀÂÃÄÉÈÊËÍÌÏÎÓÒÔÕÖÚÙÛÜÝÇÑ'); 
     191 
     192                                preg_match("/[$reg_expr]*/i", $word , $tmp); //get the word that is in the array slot $i 
     193 
     194                                $tmpWord = $tmp[0]; //should only have one element in the array anyway, so it's just assign it to $tmpWord 
     195                                $words[$i][$j] = utf8_decode($words[$i][$j]); 
     196 
     197                                //And we replace the word in the array with the span that highlights it and gives it an onClick parameter to show the suggestions. 
    193198                                if(!pspell_check($pspell_link, $tmpWord)) 
    194                                 { 
    195                                         $onClick = "onclick=\"setCurrentObject(" . $varName . "); showSuggestions('" . addslashes($tmpWord) . "', '" . $varName . "_" . $misspelledCount . "_" . addslashes($tmpWord) . "'); return false;\""; 
    196                                         $words[$i][$j] = str_replace($tmpWord, "<span " . $onClick . " id=\"" . $varName . "_" . $misspelledCount . "_" . $tmpWord . "\" class=\"highlight\">" . stripslashes($tmpWord) . "</span>", $words[$i][$j]);  
    197                                         $misspelledCount++; 
    198                                 } 
     199                                {                                         
     200                                        $onClick = "onclick=\"setCurrentObject(" . $varName . "); showSuggestions('" . addslashes($tmpWord) . "', '" . $varName . "_" . $misspelledCount . "_" . addslashes($tmpWord) . "'); return false;\""; 
     201                                        $words[$i][$j] = str_replace($tmpWord, "<span " . $onClick . " id=\"" . $varName . "_" . $misspelledCount . "_" . $tmpWord . "\" class=\"highlight\">" . stripslashes($tmpWord) . "</span>", $words[$i][$j]); 
     202                                        $misspelledCount++; 
     203                                }  
    199204                                 
    200205                                $words[$i][$j] = str_replace("\n", "<br />", $words[$i][$j]); //replace any breaks with <br />'s, for html display 
     206                                
    201207                        }//end for $j 
    202208                }//end if 
     
    246252        $string = preg_replace("/<!--<\/li>-->/i", "</li>", $string); 
    247253        $string = preg_replace("/<!--<img (?:[^>]+ )?src=\"?([^\"]*)\"?[^>]*>-->/i", "<img src=\"\\1\" />", $string); 
    248                  
    249         $cp->set_data($string);  //return value - string containing all the markup for the misspelled words. 
     254 
     255        $cp->set_data(utf8_encode($string));  //return value - string containing all the markup for the misspelled words. 
    250256 
    251257} // end spellCheck 
Note: See TracChangeset for help on using the changeset viewer.