web/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php
changeset 194 32102edaa81b
parent 136 bde1974c263b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
    36 
    36 
    37 		foreach ($dataArr as $dstr) {
    37 		foreach ($dataArr as $dstr) {
    38 			$matches = array();
    38 			$matches = array();
    39 
    39 
    40 			// Skip this line.
    40 			// Skip this line.
    41 			if (strpos($dstr, "@") === 0)
    41 			if ($dstr[0] == "@")
    42 				continue;
    42 				continue;
    43 
    43 
    44 			preg_match("/\& ([^ ]+) .*/i", $dstr, $matches);
    44 			preg_match("/(\&|#) ([^ ]+) .*/i", $dstr, $matches);
    45 
    45 
    46 			if (!empty($matches[1]))
    46 			if (!empty($matches[2]))
    47 				$returnData[] = utf8_encode(trim($matches[1]));
    47 				$returnData[] = utf8_encode(trim($matches[2]));
    48 		}
    48 		}
    49 
    49 
    50 		return $returnData;
    50 		return $returnData;
    51 	}
    51 	}
    52 
    52 
    80 
    80 
    81 		foreach($dataArr as $dstr) {
    81 		foreach($dataArr as $dstr) {
    82 			$matches = array();
    82 			$matches = array();
    83 
    83 
    84 			// Skip this line.
    84 			// Skip this line.
    85 			if (strpos($dstr, "@") === 0)
    85 			if ($dstr[0] == "@")
    86 				continue;
    86 				continue;
    87 
    87 
    88 			preg_match("/\&[^:]+:(.*)/i", $dstr, $matches);
    88 			preg_match("/\&[^:]+:(.*)/i", $dstr, $matches);
    89 
    89 
    90 			if (!empty($matches[1])) {
    90 			if (!empty($matches[1])) {
   101 	}
   101 	}
   102 
   102 
   103 	function _getCMD($lang) {
   103 	function _getCMD($lang) {
   104 		$this->_tmpfile = tempnam($this->_config['PSpellShell.tmp'], "tinyspell");
   104 		$this->_tmpfile = tempnam($this->_config['PSpellShell.tmp'], "tinyspell");
   105 
   105 
   106 		if(preg_match("#win#i", php_uname()))
   106 		$file = $this->_tmpfile;
   107 			return $this->_config['PSpellShell.aspell'] . " -a --lang=". escapeshellarg($lang) . " --encoding=utf-8 -H < " . $this->_tmpfile . " 2>&1";
   107 		$lang = preg_replace("/[^-_a-z]/", "", strtolower($lang));
       
   108 		$bin  = $this->_config['PSpellShell.aspell'];
   108 
   109 
   109 		return "cat ". $this->_tmpfile ." | " . $this->_config['PSpellShell.aspell'] . " -a --encoding=utf-8 -H --lang=". escapeshellarg($lang);
   110 		if (preg_match("#win#i", php_uname()))
       
   111 			return "$bin -a --lang=$lang --encoding=utf-8 -H < $file 2>&1";
       
   112 
       
   113 		return "cat $file | $bin -a --lang=$lang --encoding=utf-8 -H";
   110 	}
   114 	}
   111 }
   115 }
   112 
   116 
   113 ?>
   117 ?>