$matches = array();
// Skip this line.
- if (strpos($dstr, "@") === 0)
+ if ($dstr[0] == "@")
continue;
- preg_match("/\& ([^ ]+) .*/i", $dstr, $matches);
+ preg_match("/(\&|#) ([^ ]+) .*/i", $dstr, $matches);
- if (!empty($matches[1]))
- $returnData[] = utf8_encode(trim($matches[1]));
+ if (!empty($matches[2]))
+ $returnData[] = utf8_encode(trim($matches[2]));
}
return $returnData;
$matches = array();
// Skip this line.
- if (strpos($dstr, "@") === 0)
+ if ($dstr[0] == "@")
continue;
preg_match("/\&[^:]+:(.*)/i", $dstr, $matches);
function _getCMD($lang) {
$this->_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";
+ $file = $this->_tmpfile;
+ $lang = preg_replace("/[^-_a-z]/", "", strtolower($lang));
+ $bin = $this->_config['PSpellShell.aspell'];
- return "cat ". $this->_tmpfile ." | " . $this->_config['PSpellShell.aspell'] . " -a --encoding=utf-8 -H --lang=". escapeshellarg($lang);
+ if (preg_match("#win#i", php_uname()))
+ return "$bin -a --lang=$lang --encoding=utf-8 -H < $file 2>&1";
+
+ return "cat $file | $bin -a --lang=$lang --encoding=utf-8 -H";
}
}