| | |
| | | |
| | | /* |
| | | +-----------------------------------------------------------------------+ |
| | | | program/include/rcube_spellchecker.php | |
| | | | | |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2011, Kolab Systems AG | |
| | | | Copyright (C) 2008-2011, The Roundcube Dev Team | |
| | |
| | | | | |
| | | | PURPOSE: | |
| | | | Spellchecking using different backends | |
| | | | | |
| | | +-----------------------------------------------------------------------+ |
| | | | Author: Aleksander Machniak <machniak@kolabsys.com> | |
| | | | Author: Thomas Bruederli <roundcube@gmail.com> | |
| | | +-----------------------------------------------------------------------+ |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * Helper class for spellchecking with Googielspell and PSpell support. |
| | |
| | | private $lang; |
| | | private $rc; |
| | | private $error; |
| | | private $separator = '/[\s\r\n\t\(\)\/\[\]{}<>\\"]+|[:;?!,\.]([^\w]|$)/'; |
| | | private $separator = '/[\s\r\n\t\(\)\/\[\]{}<>\\"]+|[:;?!,\.](?=\W|$)/'; |
| | | private $options = array(); |
| | | private $dict; |
| | | private $have_dict; |
| | | |
| | | |
| | | // default settings |
| | | const GOOGLE_HOST = 'ssl://www.google.com'; |
| | | const GOOGLE_HOST = 'ssl://spell.roundcube.net'; |
| | | const GOOGLE_PORT = 443; |
| | | const MAX_SUGGESTIONS = 10; |
| | | |
| | |
| | | |
| | | $gtext = '<?xml version="1.0" encoding="utf-8" ?>' |
| | | .'<spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1">' |
| | | .'<text>' . $gtext . '</text>' |
| | | .'<text>' . htmlspecialchars($gtext) . '</text>' |
| | | .'</spellrequest>'; |
| | | |
| | | $store = ''; |
| | |
| | | |
| | | private function html2text($text) |
| | | { |
| | | $h2t = new html2text($text, false, true, 0); |
| | | $h2t = new rcube_html2text($text, false, true, 0); |
| | | return $h2t->get_text(); |
| | | } |
| | | |
| | |
| | | |
| | | if (empty($plugin['abort'])) { |
| | | $dict = array(); |
| | | $this->rc->db->query( |
| | | $sql_result = $this->rc->db->query( |
| | | "SELECT data FROM ".$this->rc->db->table_name('dictionary') |
| | | ." WHERE user_id ". ($plugin['userid'] ? "= ".$this->rc->db->quote($plugin['userid']) : "IS NULL") |
| | | ." AND " . $this->rc->db->quoteIdentifier('language') . " = ?", |