/** * Makes your instance global. * * <b>You MUST call this method with the $var = &LiveUser_Admin::singleton() syntax. * Without the ampersand (&) in front of the method name, you will not get * a reference, you will get a copy.</b> * * @access public * @param array liveuser conf array * @param string two letters language code * @return object Returns an object of either LiveUser or PEAR_Error type * @see LiveUser_Admin::LiveUser_Admin */ function &singleton($conf, $lang) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($conf, $lang)); if (!isset($instances[$signature])) { $obj =& LiveUser_Admin::LiveUser_Admin($conf, $lang); if (PEAR::isError($obj)) { return $obj; } $instances[$signature] =& $obj; } return $instances[$signature]; }