Beispiel #1
0
 /**
  * Warning! This can only be called on hook 'init' or later
  */
 public static function isAdmin()
 {
     /**
      * is_admin() will return false when trying to access wp-login.php.
      * is_admin() will return true when trying to make an ajax request.
      * is_admin() will return true for calls to load-scripts.php and load-styles.php.
      * is_admin() is not intended to be used for security checks. It will return true
      * whenever the current URL is for a page on the admin side of WordPress. It does
      * not check if the user is logged in, nor if the user even has access to the page
      * being requested. It is a convenience function for plugins and themes to use for
      * various purposes, but it is not suitable for validating secured requests.
      *
      * Good to know.
      */
     $logger = PostmanUtils::$logger = new PostmanLogger('PostmanUtils');
     if ($logger->isTrace()) {
         $logger->trace('calling current_user_can');
     }
     return current_user_can(Postman::MANAGE_POSTMAN_CAPABILITY_NAME) && is_admin();
 }
Beispiel #2
0
 public static function staticInit()
 {
     PostmanUtils::$logger = new PostmanLogger('PostmanUtils');
     PostmanUtils::$emailValidator = new Postman_Zend_Validate_EmailAddress();
 }