| +-----------------------------------------------------------------------+ $Id$ */ if (!extension_loaded('pspell')) { raise_error(array( 'code' => 500, 'file' => __FILE__, 'message' => "Pspell extension not available"), true, false); header('HTTP/1.1 404 Not Found'); exit; } $data = file_get_contents('php://input'); $xml = simplexml_load_string($data); $text = (string)$xml->text; $words = preg_split('/[ !"#$%&()*+\\,-.\/\n:;<=>?@\[\]^_{|}]+/', $text, NULL, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_OFFSET_CAPTURE ); $plink = pspell_new(get_input_value('lang', RCUBE_INPUT_GET), null, null, 'utf-8'); $out = ''; foreach ($words as $w) { $word = $w[0]; $pos = $w[1]; $len = strlen($word); if ($plink && !pspell_check($plink, $word)) { $suggestions = pspell_suggest($plink, $word); $out .= ''; $out .= implode("\t", $suggestions); $out .= ''; } } $out .= ''; header("Content-Type: text/xml"); echo $out; exit; ?>