Source for file PrefManager2.php
Documentation is available at PrefManager2.php
* Used for error handling.
require_once('PEAR/ErrorStack.php');
define('AUTH_PREFMANAGER2_CONTAINER_NOT_FOUND', -1 );
define('AUTH_PREFMANAGER2_NOT_IMPLEMENTED', -2 );
define('AUTH_PREFMANAGER2_DB_NO_DSN', -3 );
define('AUTH_PREFMANAGER2_DB_CONNECT_FAILED', -4 );
define('AUTH_PREFMANAGER2_DB_QUERY_FAILED', -5 );
* Internationalised error messages
if (!isset ($GLOBALS['_Auth_PrefManager2']['err'])) {
$GLOBALS['_Auth_PrefManager2']['err'] = array (
* Auth_PrefManager allows you to store and retrieve preferences from
* data containers, selecting the default value if none exists for the
* user you have specified.
* @author Jon Wood <jon@jellybob.co.uk>
* @author Paul M. Jones <pmjones@ciaweb.net>
* @package Auth_PrefManager2
* @category Authentication
* @todo Add caching support.
* Creates an instance of PrefManager, with the options specified, and data
* access being done by the specified container.
* If your using a custom container you can include it before calling
* the factory method and it will be used without any further setup.
* @param string $container The container to use.
* @param array $options An associative array of options to pass to the
* @return Auth_PrefManager2 A container, ready to use.
* @throws AUTH_PREFMANAGER2_CONTAINER_NOT_FOUND
function &factory($container, $options = array ())
$class = " Auth_PrefManager2_Container_${container}";
$file = " Auth/PrefManager2/Container/${container}.php";
if (!isset ($options['debug'])) {
$options['debug'] = false;
$obj = & new $class($options);
$include = include_once($file);
$include = @include_once($file);
$class = " Auth_PrefManager2_Container_${container}";
$obj = & new $class($options);
// Something went wrong if we havn't returned by now.
array ('container' => $container,
* Returns a concrete PrefManager container, making use of an existing one if
* @param string $container The container to use.
* @param array $options An associative array of options to pass to the
* @return Auth_PrefManager2 A container, ready to use.
* @throws AUTH_PREFMANAGER2_CONTAINER_NOT_FOUND
function &singleton($container, $options = array ())
$hash = serialize(array ($container, $options));
if (!isset ($instances[$hash])) {
return $instances[$hash];
* Throws an error, using the current locale if it exists, or en if it doesn't.
* @param int $code The error code.
* @param string $level The level of the error.
* @param array $params Any other information to include with the error.
function _throwError($code, $level = 'error', $params = array (), $repackage = null )
//$locale = isset($this->_errorMessages['_Auth_PrefManager2']['en']) ? $this->locale : 'en';
PEAR_ErrorStack ::staticPush ('Auth_PrefManager2',
$GLOBALS['_Auth_PrefManager2']['err'][$locale][$code],
Documentation generated on Mon, 11 Mar 2019 13:54:06 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|