Viewing file: spellcheck.inc.php (1.86 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/*
############################################################################
# DWmail
# - version 4.0
# - Copyright (c) 2003-2006 Dominion Web Design
# - http://www.dominion-web.com/products/dwmail/
############################################################################
#
# The contents of this file are subject to the DWmail License version
# 2.2 ('License'). You may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.dominion-web.com/products/dwmail/license.php
# Software distributed under the License is distributed on an "AS IS" basis,
# without warranty of any kind, either express or implied.
#
# This code is Copyright (c) 2003-2006 Dominion Web Design.
# All rights reserved.
#
# This software may not be redistributed outside the terms of the
# license agreement.
#
############################################################################
*/
class SpellChecker {
var $_dict;
var $_ignorelength;
var $_encoding;
var $_pspell_cfg_handle;
var $_pspell_handle;
function SpellChecker($dict = 'en', $encoding = 'iso8859-1', $ignorelength = '3') {
$this->_dict = $dict;
$this->_ignorelength = $ignorelength;
$this->_encoding = $encoding;
$this->_pspell_cfg_handle = pspell_config_create($this->_dict, '', '', $this->_encoding);
pspell_config_ignore($this->_pspell_cfg_handle, $this->_ignorelength);
pspell_config_mode($this->_pspell_cfg_handle, PSPELL_FAST);
}
function OpenDictionary() {
$this->_pspell_handle = pspell_new_config($this->_pspell_cfg_handle);
}
function check($word) {
return pspell_check($this->_pspell_handle, $word);
}
function suggest($word) {
return pspell_suggest($this->_pspell_handle, $word);
}
function close() {
pspell_clear_session($this->_pspell_handle);
}
}
?>
|