Ignore:
Timestamp:
Jun 3, 2006 7:47:48 PM (18 years ago)
Author:
scdev
Message:

Q - Merged branches/2.0singleton into trunk. Completed updating classes to use singleton methods. Implemented tests. Fixed some bugs. Changed some interfaces.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/SpellCheck.inc.php

    r42 r136  
    6262    function SpellCheck($params)
    6363    {
     64        $app =& App::getInstance();
     65
    6466        if (!is_array($params) || empty($params)) {
    6567            trigger_error('SpellCheck parameters not set properly', E_USER_ERROR);
     
    7577        if ('' != $this->getParam('personal_wordlist')) {
    7678            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__);
    7880            } else {
    7981                pspell_config_personal($this->_pspell_cfg_handle, $this->getParam('personal_wordlist'));
    8082                $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__);
    8284            }
    8385        }
     
    9496    function setParam($params)
    9597    {
     98        $app =& App::getInstance();
     99
    96100        if (isset($params) && is_array($params)) {
    97101            // Merge new parameters with old overriding only those passed.
    98102            $this->_params = array_merge($this->_params, $params);
    99103        } 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__);
    101105        }
    102106    }
     
    111115    function getParam($param)
    112116    {
     117        $app =& App::getInstance();
     118   
    113119        if (isset($this->_params[$param])) {
    114120            return $this->_params[$param];
    115121        } 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__);
    117123            return null;
    118124        }
     
    184190    function add($word)
    185191    {
     192        $app =& App::getInstance();
     193
    186194        if ($this->_use_personal_wordlist) {
    187195            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__);
    189197                return true;
    190198            } 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__);
    192200                return false;
    193201            }
     
    207215    function save()
    208216    {
     217        $app =& App::getInstance();
     218
    209219        if ($this->_use_personal_wordlist) {
    210220            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__);
    212222                return true;
    213223            } 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__);
    215225                return false;
    216226            }
Note: See TracChangeset for help on using the changeset viewer.