Changeset 4985 for trunk/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php
- Timestamp:
- 03/07/2007 04:26:26 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php
r4747 r4985 6 6 * 7 7 */ 8 8 9 9 10 class TinyPspellShell { … … 28 29 29 30 $this->tmpfile = tempnam($config['tinypspellshell.tmp'], "tinyspell"); 30 $this->cmd = "cat ". $this->tmpfile ." | " . $config['tinypspellshell.aspell'] . " -a --lang=". $this->lang; 31 32 if(preg_match("#win#i",php_uname())) 33 $this->cmd = $config['tinypspellshell.aspell'] . " -a --lang=". $this->lang." --encoding=utf-8 -H < $this->tmpfile 2>&1"; 34 else 35 $this->cmd = "cat ". $this->tmpfile ." | " . $config['tinypspellshell.aspell'] . " -a --encoding=utf-8 -H --lang=". $this->lang; 31 36 } 32 37 … … 37 42 foreach($wordArray as $key => $value) 38 43 fwrite($fh, "^" . $value . "\n"); 39 40 44 fclose($fh); 41 45 } else { … … 45 49 46 50 $data = shell_exec($this->cmd); 47 @unlink($this->tmpfile); 51 @unlink($this->tmpfile); 52 48 53 $returnData = array(); 49 54 $dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY); … … 67 72 // Returns array with suggestions or false if failed. 68 73 function getSuggestion($word) { 74 if (function_exists("mb_convert_encoding")) 75 $word = mb_convert_encoding($word, "ISO-8859-1", mb_detect_encoding($word, "UTF-8")); 76 else 77 $word = utf8_encode($word); 78 69 79 if ($fh = fopen($this->tmpfile, "w")) { 70 80 fwrite($fh, "!\n"); … … 72 82 fclose($fh); 73 83 } else 74 wp_die("Error opening tmp file.");84 die("Error opening tmp file."); 75 85 76 86 $data = shell_exec($this->cmd); 77 @unlink($this->tmpfile); 87 88 @unlink($this->tmpfile); 89 78 90 $returnData = array(); 79 91 $dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY); … … 95 107 return $returnData; 96 108 } 109 110 function _debugData($data) { 111 $fh = @fopen("debug.log", 'a+'); 112 @fwrite($fh, $data); 113 @fclose($fh); 114 } 115 97 116 } 98 117
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)