From d9344fc349e8c5765898c90bf5061e56cd21c8a0 Mon Sep 17 00:00:00 2001 From: svncommit Date: Tue, 15 Apr 2008 21:22:00 +0000 Subject: HTML editing fixes, upgrade to TinyMCE v3.0.6 --- .../spellchecker/classes/TinyGoogleSpell.class.php | 107 ------------------ .../spellchecker/classes/TinyPspell.class.php | 64 ----------- .../spellchecker/classes/TinyPspellShell.class.php | 121 --------------------- 3 files changed, 292 deletions(-) delete mode 100644 program/js/tiny_mce/plugins/spellchecker/classes/TinyGoogleSpell.class.php delete mode 100644 program/js/tiny_mce/plugins/spellchecker/classes/TinyPspell.class.php delete mode 100644 program/js/tiny_mce/plugins/spellchecker/classes/TinyPspellShell.class.php (limited to 'program/js/tiny_mce/plugins/spellchecker/classes') diff --git a/program/js/tiny_mce/plugins/spellchecker/classes/TinyGoogleSpell.class.php b/program/js/tiny_mce/plugins/spellchecker/classes/TinyGoogleSpell.class.php deleted file mode 100644 index 7be929731..000000000 --- a/program/js/tiny_mce/plugins/spellchecker/classes/TinyGoogleSpell.class.php +++ /dev/null @@ -1,107 +0,0 @@ -lang = $lang; - $this->spellurl = $config['googlespell.url']; - } - - // Returns array with bad words or false if failed. - function checkWords($word_array) { - $words = array (); - $wordstr = implode(' ', $word_array); - - $matches = $this->_getMatches($wordstr); - - for ($i = 0; $i < count($matches); $i++) - $words[] = $this->unhtmlentities(mb_substr($wordstr, $matches[$i][1], $matches[$i][2], "UTF-8")); - - return $words; - } - - function unhtmlentities($string) { - $string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string); - $string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string); - - $trans_tbl = get_html_translation_table(HTML_ENTITIES); - $trans_tbl = array_flip($trans_tbl); - - return strtr($string, $trans_tbl); - } - - // Returns array with suggestions or false if failed. - function getSuggestion($word) { - $sug = array (); - - $matches = $this->_getMatches($word); - - if (count($matches) > 0) - $sug = explode("\t", utf8_encode($this->unhtmlentities($matches[0][4]))); - - return $sug; - } - - function _xmlChars($string) { - $trans = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES); - - foreach ($trans as $k => $v) - $trans[$k] = "&#" . ord($k) . ";"; - - return strtr($string, $trans); - } - - function _getMatches($word_list) { - $url = $this->spellurl . "&" . $this->lang; - - $path = preg_replace("/^https?:\/\//i", "", $url); - - // Setup XML request - $xml = '' . $word_list . ''; - - $header = "POST " . $path . " HTTP/1.0 \r\n"; - $header .= "MIME-Version: 1.0 \r\n"; - $header .= "Content-type: application/PTI26 \r\n"; - $header .= "Content-length: " . strlen($xml) . " \r\n"; - $header .= "Content-transfer-encoding: text \r\n"; - $header .= "Request-number: 1 \r\n"; - $header .= "Document-type: Request \r\n"; - $header .= "Interface-Version: Test 1.4 \r\n"; - $header .= "Connection: close \r\n\r\n"; - $header .= $xml; - //$this->_debugData($xml); - - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); - $xml = curl_exec($ch); - curl_close($ch); - - //$this->_debugData($xml); - - // Grab and parse content - preg_match_all('/([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER); - - return $matches; - } - - function _debugData($data) { - $fh = @ fopen("debug.log", 'a+'); - @ fwrite($fh, $data); - @ fclose($fh); - } -} - -// Setup classname, should be the same as the name of the spellchecker class -$spellCheckerConfig['class'] = "TinyGoogleSpell"; -?> diff --git a/program/js/tiny_mce/plugins/spellchecker/classes/TinyPspell.class.php b/program/js/tiny_mce/plugins/spellchecker/classes/TinyPspell.class.php deleted file mode 100644 index 21fb19448..000000000 --- a/program/js/tiny_mce/plugins/spellchecker/classes/TinyPspell.class.php +++ /dev/null @@ -1,64 +0,0 @@ -lang = $lang; - $this->mode = $mode; - $this->plink = false; - $this->errorMsg = array(); - - if (!function_exists("pspell_new")) { - $this->errorMsg[] = "PSpell not found."; - return; - } - - $this->plink = pspell_new($this->lang, $this->spelling, $this->jargon, $this->encoding, $this->mode); - } - - // Returns array with bad words or false if failed. - function checkWords($wordArray) { - if (!$this->plink) { - $this->errorMsg[] = "No PSpell link found for checkWords."; - return array(); - } - - $wordError = array(); - foreach($wordArray as $word) { - if(!pspell_check($this->plink, trim($word))) - $wordError[] = $word; - } - - return $wordError; - } - - // Returns array with suggestions or false if failed. - function getSuggestion($word) { - if (!$this->plink) { - $this->errorMsg[] = "No PSpell link found for getSuggestion."; - return array(); - } - - return pspell_suggest($this->plink, $word); - } -} - -// Setup classname, should be the same as the name of the spellchecker class -$spellCheckerConfig['class'] = "TinyPspell"; - -?> \ No newline at end of file diff --git a/program/js/tiny_mce/plugins/spellchecker/classes/TinyPspellShell.class.php b/program/js/tiny_mce/plugins/spellchecker/classes/TinyPspellShell.class.php deleted file mode 100644 index 348cac3d8..000000000 --- a/program/js/tiny_mce/plugins/spellchecker/classes/TinyPspellShell.class.php +++ /dev/null @@ -1,121 +0,0 @@ -lang = $lang; - $this->mode = $mode; - $this->error = false; - $this->errorMsg = array(); - - $this->tmpfile = tempnam($config['tinypspellshell.tmp'], "tinyspell"); - - if(preg_match("#win#i",php_uname())) - $this->cmd = $config['tinypspellshell.aspell'] . " -a --lang=". $this->lang." --encoding=utf-8 -H < $this->tmpfile 2>&1"; - else - $this->cmd = "cat ". $this->tmpfile ." | " . $config['tinypspellshell.aspell'] . " -a --encoding=utf-8 -H --lang=". $this->lang; - } - - // Returns array with bad words or false if failed. - function checkWords($wordArray) { - if ($fh = fopen($this->tmpfile, "w")) { - fwrite($fh, "!\n"); - foreach($wordArray as $key => $value) - fwrite($fh, "^" . $value . "\n"); - fclose($fh); - } else { - $this->errorMsg[] = "PSpell not found."; - return array(); - } - - $data = shell_exec($this->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])) - $returnData[] = $matches[1]; - } - - return $returnData; - } - - // Returns array with suggestions or false if failed. - function getSuggestion($word) { - 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 - die("Error opening tmp file."); - - $data = shell_exec($this->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])) { - // For some reason, the exec version seems to add commas? - $returnData[] = str_replace(",", "", $matches[1]); - } - } - return $returnData; - } - - function _debugData($data) { - $fh = @fopen("debug.log", 'a+'); - @fwrite($fh, $data); - @fclose($fh); - } - -} - -// Setup classname, should be the same as the name of the spellchecker class -$spellCheckerConfig['class'] = "TinyPspellShell"; - -?> \ No newline at end of file -- cgit v1.2.3