예제 #1
0
 public function is_locked($postId = null)
 {
     if (!$postId) {
         $postId = get_the_ID();
     }
     $currentLang = $this->settings->get_current_language();
     $locale = $currentLang ? $currentLang->locale : null;
     $globalLock = $this->settings->get_global_enable($locale);
     $postUnlocked = PostMetaBox::post_is_unlocked($postId);
     return $postUnlocked ? false : $globalLock;
 }
예제 #2
0
 /**
  * Check if the current request is authenticated
  *
  * @return bool
  */
 public function is_authenticated($postId = null)
 {
     if (!$postId) {
         $postId = get_the_ID();
     }
     $this->service = $this->get_oauth_service();
     if ($user = $this->get_wa_user()) {
         if ($postId && !PostMetaBox::post_is_unlocked($postId)) {
             $postRequiredRole = PostMetaBox::post_required_role($postId);
             if (!empty($postRequiredRole) && !in_array($postRequiredRole, $user->roles)) {
                 return false;
             }
         }
         return true;
     }
     return false;
 }