Ignore:
Timestamp:
04/01/10 15:44:55 (14 years ago)
Author:
nathalie.silva
Message:

Ticket #891 - Aceita agora todas as tags HTML. Até 3 sugestões por palavra. Nathalie

File:
1 edited

Legend:

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

    r2387 r2405  
    4040// User-configurable list of allowed HTML tags and attributes. 
    4141// Thanks to Jake Olefsky for this little addition 
    42 $allowed_html = '<strong><small><p><br><a><b><u><i><img><code><ul><ol><li>'; 
     42//$allowed_html = '<strong><small><p><br><a><b><u><i><img><code><ul><ol><li>';  //Removed. Accept alll HTML tags. 
    4343 
    4444// Set the max number of suggestions to return at a time. 
    45 define('MAX_SUGGESTIONS', 10); 
     45define('MAX_SUGGESTIONS', 3); 
    4646 
    4747// Set whether to use a personal dictionary. 
    48 $usePersonalDict = true; 
     48$usePersonalDict = false; 
    4949 
    5050//Set whether users are allowed to update the personal dictionary. 
    51 $editablePersonalDict = true; 
     51$editablePersonalDict = false; 
    5252 
    5353// If using a personal dictionary, set the path to it.  Default is in the 
     
    161161        $retVal = ""; 
    162162 
    163         //$string = stripslashes_custom($string); //we only need to strip slashes if magic quotes are on 
    164  
    165         $string = remove_word_junk($string);         
    166  
    167         //make all the returns in the text look the same 
     163        $string = stripslashes_custom($string); //we only need to strip slashes if magic quotes are on 
     164 
     165        $string = remove_word_junk($string); 
     166 
     167        //make all the returns in the text look the same 
    168168        $string = preg_replace("/\r?\n/", "\n", $string); 
    169169    
     
    199199                                {                                         
    200200                                        $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]); 
     201                                        $words[$i][$j] = str_replace($tmpWord, "<span " . $onClick . " id=\"" . $varName . "_" . $misspelledCount . "_" . $tmpWord . "\" class=\"highlight\">" . stripslashes($tmpWord) . " </span>", $words[$i][$j]); 
    202202                                        $misspelledCount++; 
    203203                                }  
     
    233233        // Concatenate all the words/tags/etc. back into a string and append it to the result. 
    234234        $string .= implode('', $words); 
    235          
    236         //remove comments from around all html tags except for <a> because we don't want the links to be clickable 
     235 
     236        $string = preg_replace("/<!--</i", "<", $string);  //Retira os comentários das tags HTML 
     237        $string = preg_replace("/>-->/i", ">", $string); 
     238         
     239        ////Function Removed from the original. Accept alll HTML tags. 
     240        //remove comments from around all html tags except for <a> because we don't want the links to be clickable 
    237241        //but we want the html to be rendered in the div for preview purposes. 
    238         $string = preg_replace("/<!--<br( [^>]*)?>-->/i", "<br />", $string); 
     242        /*$string = preg_replace("/<!--<br( [^>]*)?>-->/i", "<br />", $string); 
    239243        $string = preg_replace("/<!--<p( [^>]*)?>-->/i", "<p>", $string); 
    240244        $string = preg_replace("/<!--<\/p>-->/i", "</p>", $string); 
     
    252256        $string = preg_replace("/<!--<\/li>-->/i", "</li>", $string); 
    253257        $string = preg_replace("/<!--<img (?:[^>]+ )?src=\"?([^\"]*)\"?[^>]*>-->/i", "<img src=\"\\1\" />", $string); 
    254  
     258<<<<<<< .mine 
     259 
     260        $string = preg_replace("/<!--<table( [^>]*)?>-->/i", "<table border=\"\\\" >", $string); 
     261        $string = preg_replace("/<!--<\/table>-->/i", "</table>", $string); 
     262        $string = preg_replace("/<!--<td( [^>]*)?>-->/i", "<td>", $string); 
     263        $string = preg_replace("/<!--<\/td>-->/i", "</td>", $string); 
     264        $string = preg_replace("/<!--<tbody( [^>]*)?>-->/i", "<tbody>", $string); 
     265        $string = preg_replace("/<!--<\/tbody>-->/i", "</tbody>", $string); 
     266        $string = preg_replace("/<!--<tr( [^>]*)?>-->/i", "<tr>", $string); 
     267        $string = preg_replace("/<!--<\/tr>-->/i", "</tr>", $string);*/ 
     268                 
    255269        $cp->set_data(utf8_encode($string));  //return value - string containing all the markup for the misspelled words. 
    256270 
     
    431445        $string = preg_replace("/\r?\n/", " ", $string); 
    432446        $string = stripslashes_custom($string); //we only need to strip slashes if magic quotes are on 
    433         $string = strip_tags($string, $allowed_html); 
     447        //$string = strip_tags($string, $allowed_html); //Removed. Accept all HTML tags. 
    434448        $string = preg_replace('{&lt;/?span.*?&gt;}i', '', $string); 
    435         $string = html_entity_decode($string); 
     449        $string = html_entity_decode($string); 
     450 
    436451        $cp->set_data($string); //the return value 
     452       
    437453         
    438454} // end switchText 
Note: See TracChangeset for help on using the changeset viewer.