From f4f6291ec16bd2fe368f868e667ea2071c514098 Mon Sep 17 00:00:00 2001 From: alecpl Date: Thu, 24 Jun 2010 13:27:43 +0000 Subject: - Use built-in spellchecker instead of a PHP files of spellchecker plugin in TinyMCE --- .../plugins/spellchecker/classes/PSpellShell.php | 112 --------------------- 1 file changed, 112 deletions(-) delete mode 100755 program/js/tiny_mce/plugins/spellchecker/classes/PSpellShell.php (limited to 'program/js/tiny_mce/plugins/spellchecker/classes/PSpellShell.php') diff --git a/program/js/tiny_mce/plugins/spellchecker/classes/PSpellShell.php b/program/js/tiny_mce/plugins/spellchecker/classes/PSpellShell.php deleted file mode 100755 index 0bc57de7e..000000000 --- a/program/js/tiny_mce/plugins/spellchecker/classes/PSpellShell.php +++ /dev/null @@ -1,112 +0,0 @@ -_getCMD($lang); - - if ($fh = fopen($this->_tmpfile, "w")) { - fwrite($fh, "!\n"); - - foreach($words as $key => $value) - fwrite($fh, "^" . $value . "\n"); - - fclose($fh); - } else - $this->throwError("PSpell support was not found."); - - $data = shell_exec($cmd); - @unlink($this->_tmpfile); - - $returnData = array(); - $dataArr = preg_split("/[\r\n]/", $data, -1, PREG_SPLIT_NO_EMPTY); - - foreach ($dataArr as $dstr) { - $matches = array(); - - // Skip this line. - if (strpos($dstr, "@") === 0) - continue; - - preg_match("/\& ([^ ]+) .*/i", $dstr, $matches); - - if (!empty($matches[1])) - $returnData[] = utf8_encode(trim($matches[1])); - } - - return $returnData; - } - - /** - * Returns suggestions of for a specific word. - * - * @param {String} $lang Language code like sv or en. - * @param {String} $word Specific word to get suggestions for. - * @return {Array} Array of suggestions for the specified word. - */ - function &getSuggestions($lang, $word) { - $cmd = $this->_getCMD($lang); - - if (function_exists("mb_convert_encoding")) - $word = mb_convert_encoding($word, "ISO-8859-1", mb_detect_encoding($word, "UTF-8")); - else - $word = utf8_encode($word); - - if ($fh = fopen($this->_tmpfile, "w")) { - fwrite($fh, "!\n"); - fwrite($fh, "^$word\n"); - fclose($fh); - } else - $this->throwError("Error opening tmp file."); - - $data = shell_exec($cmd); - @unlink($this->_tmpfile); - - $returnData = array(); - $dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY); - - foreach($dataArr as $dstr) { - $matches = array(); - - // Skip this line. - if (strpos($dstr, "@") === 0) - continue; - - preg_match("/\&[^:]+:(.*)/i", $dstr, $matches); - - if (!empty($matches[1])) { - $words = array_slice(explode(',', $matches[1]), 0, 10); - - for ($i=0; $i_tmpfile = tempnam($this->_config['PSpellShell.tmp'], "tinyspell"); - - if(preg_match("#win#i", php_uname())) - return $this->_config['PSpellShell.aspell'] . " -a --lang=". escapeshellarg($lang) . " --encoding=utf-8 -H < " . $this->_tmpfile . " 2>&1"; - - return "cat ". $this->_tmpfile ." | " . $this->_config['PSpellShell.aspell'] . " -a --encoding=utf-8 -H --lang=". escapeshellarg($lang); - } -} - -?> -- cgit v1.2.3