Changeset 136 for trunk/lib/SpellCheck.inc.php
- Timestamp:
- Jun 3, 2006 7:47:48 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/SpellCheck.inc.php
r42 r136 62 62 function SpellCheck($params) 63 63 { 64 $app =& App::getInstance(); 65 64 66 if (!is_array($params) || empty($params)) { 65 67 trigger_error('SpellCheck parameters not set properly', E_USER_ERROR); … … 75 77 if ('' != $this->getParam('personal_wordlist')) { 76 78 if (!is_writable(dirname($this->getParam('personal_wordlist'))) || !is_writable($this->getParam('personal_wordlist'))) { 77 App::logMsg(sprintf('Personal wordlist file not writable: %s', $this->getParam('personal_wordlist')), LOG_WARNING, __FILE__, __LINE__);79 $app->logMsg(sprintf('Personal wordlist file not writable: %s', $this->getParam('personal_wordlist')), LOG_WARNING, __FILE__, __LINE__); 78 80 } else { 79 81 pspell_config_personal($this->_pspell_cfg_handle, $this->getParam('personal_wordlist')); 80 82 $this->_use_personal_wordlist = true; 81 App::logMsg(sprintf('Using personal wordlist: %s', $this->getParam('personal_wordlist')), LOG_DEBUG, __FILE__, __LINE__);83 $app->logMsg(sprintf('Using personal wordlist: %s', $this->getParam('personal_wordlist')), LOG_DEBUG, __FILE__, __LINE__); 82 84 } 83 85 } … … 94 96 function setParam($params) 95 97 { 98 $app =& App::getInstance(); 99 96 100 if (isset($params) && is_array($params)) { 97 101 // Merge new parameters with old overriding only those passed. 98 102 $this->_params = array_merge($this->_params, $params); 99 103 } else { 100 App::logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);104 $app->logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__); 101 105 } 102 106 } … … 111 115 function getParam($param) 112 116 { 117 $app =& App::getInstance(); 118 113 119 if (isset($this->_params[$param])) { 114 120 return $this->_params[$param]; 115 121 } else { 116 App::logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);122 $app->logMsg(sprintf('Parameter is not set: %s', $param), LOG_NOTICE, __FILE__, __LINE__); 117 123 return null; 118 124 } … … 184 190 function add($word) 185 191 { 192 $app =& App::getInstance(); 193 186 194 if ($this->_use_personal_wordlist) { 187 195 if (pspell_add_to_personal($this->_pspell_handle, $word)) { 188 App::logMsg(sprintf('Added "%s" to personal wordlist: %s', $word, $this->getParam('personal_wordlist')), LOG_DEBUG, __FILE__, __LINE__);196 $app->logMsg(sprintf('Added "%s" to personal wordlist: %s', $word, $this->getParam('personal_wordlist')), LOG_DEBUG, __FILE__, __LINE__); 189 197 return true; 190 198 } else { 191 App::logMsg(sprintf('Failed adding "%s" to personal wordlist: %s', $word, $this->getParam('personal_wordlist')), LOG_WARNING, __FILE__, __LINE__);199 $app->logMsg(sprintf('Failed adding "%s" to personal wordlist: %s', $word, $this->getParam('personal_wordlist')), LOG_WARNING, __FILE__, __LINE__); 192 200 return false; 193 201 } … … 207 215 function save() 208 216 { 217 $app =& App::getInstance(); 218 209 219 if ($this->_use_personal_wordlist) { 210 220 if (pspell_save_wordlist($this->_pspell_handle)) { 211 App::logMsg(sprintf('Saved personal wordlist: %s', $this->getParam('personal_wordlist')), LOG_DEBUG, __FILE__, __LINE__);221 $app->logMsg(sprintf('Saved personal wordlist: %s', $this->getParam('personal_wordlist')), LOG_DEBUG, __FILE__, __LINE__); 212 222 return true; 213 223 } else { 214 App::logMsg(sprintf('Failed saving personal wordlist: %s', $this->getParam('personal_wordlist')), LOG_ERR, __FILE__, __LINE__);224 $app->logMsg(sprintf('Failed saving personal wordlist: %s', $this->getParam('personal_wordlist')), LOG_ERR, __FILE__, __LINE__); 215 225 return false; 216 226 }
Note: See TracChangeset
for help on using the changeset viewer.