Esempio n. 1
0
 public static function getInstance($identifier = 0)
 {
     // Find the user id
     if (empty($identifier) and function_exists('wp_get_current_user')) {
         $user = wp_get_current_user();
         $id = $user->ID;
     } else {
         if (!is_numeric($identifier)) {
             if (!($id = MUserHelper::getUserId($identifier))) {
                 MError::raiseWarning('SOME_ERROR_CODE', MText::sprintf('MLIB_USER_ERROR_ID_NOT_EXISTS', $identifier));
                 $retval = false;
                 return $retval;
             }
         } else {
             $id = $identifier;
         }
     }
     if (empty(self::$instances[$id])) {
         $user = new MUser($id);
         self::$instances[$id] = $user;
     }
     return self::$instances[$id];
 }