Ignore:
Timestamp:
05/09/05 16:15:58 (14 years ago)
Author:
niko
Message:

#204 part 2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/SpellChecker/spell-check-logic.php

    r117 r137  
    4848<link rel="stylesheet" type="text/css" media="all" href="spell-check-style.css" />'; 
    4949 
     50// Lets define some values outside the condition below, in case we have an empty  
     51// document.                                                                      
     52$textarray = array(); 
     53$varlines = '<script type="text/javascript">var suggested_words = { '; 
     54$infolines = 'var spellcheck_info = {'; 
     55$counter = 0; 
     56$suggest_count = 0; 
     57 
    5058if (trim($text) != "") 
    5159{ 
     
    7078        $textlines = count($textarray); 
    7179 
    72         $varlines = '<script type="text/javascript">var suggested_words = { '; 
    73         $infolines = 'var spellcheck_info = {'; 
    74  
    7580        $lineindex = -1; 
    7681        $poscorrect = 0; 
    77         $counter = 0; 
    78         $suggest_count = 0; 
    7982        foreach ($returnarray as $key=>$value) 
    8083        { 
     
    128131            } 
    129132         } 
    130         $infolines .= '"Language Used":"'.$lang.'",'; 
    131         $infolines .= '"Mispelled words":"'.$counter.'",'; 
    132         $infolines .= '"Total words suggested":"'.$suggest_count.'",'; 
    133         $infolines .= '"Total Lines Checked":"'.$returnlines.'"'; 
    134         $infolines .= '};'; 
    135         $varlines = substr($varlines, 0, strlen($varlines) - 1); 
    136         echo $varlines.'};'.$infolines.'</script>'; 
    137133     } 
    138134     else 
    139135     { 
     136       // This one isnt used for anything at the moment! 
    140137       $return = 'failed to open!'; 
    141138     } 
    142  
    143139} 
    144  
     140$infolines .= '"Language Used":"'.$lang.'",'; 
     141$infolines .= '"Mispelled words":"'.$counter.'",'; 
     142$infolines .= '"Total words suggested":"'.$suggest_count.'",'; 
     143$infolines .= '"Total Lines Checked":"'.$returnlines.'"'; 
     144$infolines .= '};'; 
     145$varlines = substr($varlines, 0, strlen($varlines) - 1); 
     146echo $varlines.'};'.$infolines.'</script>'; 
    145147 
    146148echo '</head> 
     
    153155 
    154156$dictionaries = str_replace(chr(10),",", shell_exec($aspelldictionaries)); 
     157if(ereg(",$",$dictionaries)) 
     158  $dictionaries = ereg_replace(",$","",$dictionaries); 
    155159echo '<div id="HA-spellcheck-dictionaries">'.$dictionaries.'</div>'; 
    156160 
    157161echo '</body></html>'; 
    158 //echo '<div id="HA-spellcheck-dictionaries">en_US,es,fr</div></body></html>'; 
    159162?> 
Note: See TracChangeset for help on using the changeset viewer.