web/wp-includes/js/tinymce/plugins/spellchecker/classes/EnchantSpell.php
changeset 194 32102edaa81b
parent 136 bde1974c263b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
    46 	 * @param String $word Specific word to get suggestions for.
    46 	 * @param String $word Specific word to get suggestions for.
    47 	 * @return Array of suggestions for the specified word.
    47 	 * @return Array of suggestions for the specified word.
    48 	 */
    48 	 */
    49 	function &getSuggestions($lang, $word) {
    49 	function &getSuggestions($lang, $word) {
    50 		$r = enchant_broker_init();
    50 		$r = enchant_broker_init();
    51 		$suggs = array();
       
    52 
    51 
    53 		if (enchant_broker_dict_exists($r,$lang)) {
    52 		if (enchant_broker_dict_exists($r,$lang)) {
    54 			$d = enchant_broker_request_dict($r, $lang);
    53 			$d = enchant_broker_request_dict($r, $lang);
    55 			$suggs = enchant_dict_suggest($d, $word);
    54 			$suggs = enchant_dict_suggest($d, $word);
    56 
    55 
       
    56 			// enchant_dict_suggest() sometimes returns NULL
       
    57 			if (!is_array($suggs))
       
    58 				$suggs = array();
       
    59 
    57 			enchant_broker_free_dict($d);
    60 			enchant_broker_free_dict($d);
    58 		} else {
    61 		} else {
       
    62 			$suggs = array();
       
    63 		}
    59 
    64 
    60 		}
       
    61 		enchant_broker_free($r);
    65 		enchant_broker_free($r);
    62 
    66 
    63 		return $suggs;
    67 		return $suggs;
    64 	}
    68 	}
    65 }
    69 }