Changeset 2387 for sandbox/expressoMail1_2/corretor_ortografico
- Timestamp:
- 03/30/10 13:37:51 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/expressoMail1_2/corretor_ortografico/spell_checker/spell_checker.php
r2375 r2387 136 136 } // end showSuggestions 137 137 138 138 139 139 /************************************************************* 140 140 * spellCheck($string) … … 186 186 for($j=0; $j<$numWords; $j++) 187 187 { 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. 193 198 if(!pspell_check($pspell_link, $tmpWord)) 194 { 195 196 $words[$i][$j] = str_replace($tmpWord, "<span " . $onClick . " id=\"" . $varName . "_" . $misspelledCount . "_" . $tmpWord . "\" class=\"highlight\">" . stripslashes($tmpWord) . "</span>", $words[$i][$j]); 197 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 } 199 204 200 205 $words[$i][$j] = str_replace("\n", "<br />", $words[$i][$j]); //replace any breaks with <br />'s, for html display 206 201 207 }//end for $j 202 208 }//end if … … 246 252 $string = preg_replace("/<!--<\/li>-->/i", "</li>", $string); 247 253 $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. 250 256 251 257 } // end spellCheck
Note: See TracChangeset
for help on using the changeset viewer.