HTML_QuickForm_Rule_Spelling
[ class tree: HTML_QuickForm_Rule_Spelling ] [ index: HTML_QuickForm_Rule_Spelling ] [ all elements ]

Source for file Pspell.php

Documentation is available at Pspell.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3.  
  4. /**
  5.  * Pspell 'driver' for HTML_QuickForm_Rule_Spelling
  6.  *
  7.  * PHP Versions 4 and 5
  8.  *
  9.  * @category    HTML
  10.  * @package     HTML_QuickForm_Rule_Spelling
  11.  * @author      David Sanders (shangxiao@php.net)
  12.  * @license     http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  13.  * @version     Release: 0.2.0
  14.  * @link        http://pear.php.net/package/HTML_QuickForm_Rule_Spelling
  15.  */
  16. {
  17.     /**
  18.      * Pspell config id
  19.      * 
  20.      * @var int 
  21.      * @access private
  22.      */
  23.     var $_pspell_link;
  24.  
  25.     /**
  26.      * Constructor
  27.      *
  28.      * @access public
  29.      */
  30.     function HTML_QuickForm_Rule_Spelling_Pspell($pspell_config = null)
  31.     {
  32.         if (is_null($pspell_config)) {
  33.             $pspell_config = pspell_config_create('en');
  34.             if ($pspell_config === false{
  35.                 PEAR::raiseError('Error creating pspell config');
  36.                 return;
  37.             }
  38.         }
  39.  
  40.         $this->_pspell_link = pspell_new_config($pspell_config);
  41.     }
  42.  
  43.     /**
  44.      * Check the presence of word in the dictionary
  45.      *
  46.      * @access public
  47.      * @param $word Word to check
  48.      * @return bool 
  49.      */
  50.     function check($word)
  51.     {
  52.         return pspell_check($this->_pspell_link$word);
  53.     }
  54.  
  55.     /**
  56.      * Generate a list of suggested words from a certain word
  57.      *
  58.      * @access public
  59.      * @param $word Word to generate suggestion list from
  60.      * @return array 
  61.      */
  62.     function suggest($word)
  63.     {
  64.         return pspell_suggest($this->_pspell_link$word);
  65.     }
  66.  
  67.     /**
  68.      * Add a word to the dictionary
  69.      *
  70.      * @access public
  71.      * @param $word Word to add to dictionary
  72.      * @return bool 
  73.      */
  74.     function add($word)
  75.     {
  76.         return pspell_add_to_personal($this->_pspell_link$word);
  77.     }
  78.  
  79.     /**
  80.      * Save dictionary
  81.      *
  82.      * @access public
  83.      * @return bool 
  84.      */
  85.     function save()
  86.     {
  87.         return pspell_save_wordlist($this->_pspell_link);
  88.     }
  89. }
  90.  
  91. ?>

Documentation generated on Mon, 11 Mar 2019 15:11:00 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.