-
+ 5EC71CF0214B6B1C64091C78CB6B868FFC410EC4A8D4057D74AA517AC3D1B5AEBE6C929277C2329B1D9934E4930D71951EC344089808F7DBD228540C1BD05C7Emp-wp/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php(0 . 0)(1 . 81)
122680 <?php
122681 /**
122682 * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
122683 *
122684 * @package MCManager.includes
122685 * @author Moxiecode
122686 */
122687
122688 class PSpell extends SpellChecker {
122689 /**
122690 * Spellchecks an array of words.
122691 *
122692 * @param {String} $lang Language code like sv or en.
122693 * @param {Array} $words Array of words to spellcheck.
122694 * @return {Array} Array of misspelled words.
122695 */
122696 function &checkWords($lang, $words) {
122697 $plink = $this->_getPLink($lang);
122698
122699 $outWords = array();
122700 foreach ($words as $word) {
122701 if (!pspell_check($plink, trim($word)))
122702 $outWords[] = utf8_encode($word);
122703 }
122704
122705 return $outWords;
122706 }
122707
122708 /**
122709 * Returns suggestions of for a specific word.
122710 *
122711 * @param {String} $lang Language code like sv or en.
122712 * @param {String} $word Specific word to get suggestions for.
122713 * @return {Array} Array of suggestions for the specified word.
122714 */
122715 function &getSuggestions($lang, $word) {
122716 $words = pspell_suggest($this->_getPLink($lang), $word);
122717
122718 for ($i=0; $i<count($words); $i++)
122719 $words[$i] = utf8_encode($words[$i]);
122720
122721 return $words;
122722 }
122723
122724 /**
122725 * Opens a link for pspell.
122726 */
122727 function &_getPLink($lang) {
122728 // Check for native PSpell support
122729 if (!function_exists("pspell_new"))
122730 $this->throwError("PSpell support not found in PHP installation.");
122731
122732 // Setup PSpell link
122733 $plink = pspell_new(
122734 $lang,
122735 $this->_config['PSpell.spelling'],
122736 $this->_config['PSpell.jargon'],
122737 $this->_config['PSpell.encoding'],
122738 $this->_config['PSpell.mode']
122739 );
122740
122741 // Setup PSpell link
122742 /* if (!$plink) {
122743 $pspellConfig = pspell_config_create(
122744 $lang,
122745 $this->_config['PSpell.spelling'],
122746 $this->_config['PSpell.jargon'],
122747 $this->_config['PSpell.encoding']
122748 );
122749
122750 $plink = pspell_new_config($pspell_config);
122751 }*/
122752
122753 if (!$plink)
122754 $this->throwError("No PSpell link found opened.");
122755
122756 return $plink;
122757 }
122758 }
122759
122760 ?>