Ignore:
Timestamp:
Jun 7, 2006 8:41:19 PM (18 years ago)
Author:
scdev
Message:

Q - decided to use standard instantiation for Prefs and Cache instead of singleton methods.

File:
1 edited

Legend:

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

    r152 r153  
    1414// Load preferences for the user's session.
    1515require_once 'codebase/lib/Prefs.inc.php';
    16 $prefs =& Prefs::getInstance('my-namespace');
     16$prefs = new Prefs('my-namespace');
    1717$prefs->setParam(array(
    1818    'persistent' => $auth->isLoggedIn(),
     
    7474            $this->setParam(array('create_table' => $app->getParam('db_create_tables')));
    7575        }
    76     }
    77 
    78     /**
    79      * This method enforces the singleton pattern for this class.
    80      *
    81      * @return  object  Reference to the global Prefs object.
    82      * @access  public
    83      * @static
    84      */
    85     function &getInstance($namespace='')
    86     {
    87         static $instances = array();
    88 
    89         if (!array_key_exists($namespace, $instances)) {
    90             $instances[$namespace] = new Prefs($namespace);
    91         }
    92 
    93         return $instances[$namespace];
    9476    }
    9577
Note: See TracChangeset for help on using the changeset viewer.