示例#1
0
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         $prefs = Preferences::getInstance();
         if (!$prefs) {
             die_error('get Preferences failed', __FILE__, __LINE__);
         }
         $mods_enable = $prefs->get('general', 'module_enable');
         if (!in_array('UserDB', $mods_enable)) {
             die_error(_('UserDB module must be enabled'), __FILE__, __LINE__);
         }
         $mod_app_name = 'UserDB_' . $prefs->get('UserDB', 'enable');
         self::$instance = new $mod_app_name();
     }
     return self::$instance;
 }
示例#2
0
文件: db.php 项目: jimby/Bootsdev
 public static function getInstance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }