当前位置: 首页>>代码示例>>PHP>>正文


PHP Reply::pkeyGet方法代码示例

本文整理汇总了PHP中Reply::pkeyGet方法的典型用法代码示例。如果您正苦于以下问题:PHP Reply::pkeyGet方法的具体用法?PHP Reply::pkeyGet怎么用?PHP Reply::pkeyGet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Reply的用法示例。


在下文中一共展示了Reply::pkeyGet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _inScope

 protected function _inScope($profile)
 {
     $scope = is_null($this->scope) ? self::defaultScope() : $this->getScope();
     if ($scope === 0 && !$this->getProfile()->isPrivateStream()) {
         // Not scoping, so it is public.
         return !$this->isHiddenSpam($profile);
     }
     // If there's scope, anon cannot be in scope
     if (empty($profile)) {
         return false;
     }
     // Author is always in scope
     if ($this->profile_id == $profile->id) {
         return true;
     }
     // Only for users on this site
     if ($scope & Notice::SITE_SCOPE && !$profile->isLocal()) {
         return false;
     }
     // Only for users mentioned in the notice
     if ($scope & Notice::ADDRESSEE_SCOPE) {
         $reply = Reply::pkeyGet(array('notice_id' => $this->id, 'profile_id' => $profile->id));
         if (!$reply instanceof Reply) {
             return false;
         }
     }
     // Only for members of the given group
     if ($scope & Notice::GROUP_SCOPE) {
         // XXX: just query for the single membership
         $groups = $this->getGroups();
         $foundOne = false;
         foreach ($groups as $group) {
             if ($profile->isMember($group)) {
                 $foundOne = true;
                 break;
             }
         }
         if (!$foundOne) {
             return false;
         }
     }
     if ($scope & Notice::FOLLOWER_SCOPE || $this->getProfile()->isPrivateStream()) {
         if (!Subscription::exists($profile, $this->getProfile())) {
             return false;
         }
     }
     return !$this->isHiddenSpam($profile);
 }
开发者ID:a780201,项目名称:gnu-social,代码行数:48,代码来源:Notice.php

示例2: _inScope

 protected function _inScope($profile)
 {
     if (!is_null($this->scope)) {
         $scope = $this->scope;
     } else {
         $scope = self::defaultScope();
     }
     // If there's no scope, anyone (even anon) is in scope.
     if ($scope == 0) {
         // Not private
         return !$this->isHiddenSpam($profile);
     } else {
         // Private, somehow
         // If there's scope, anon cannot be in scope
         if (empty($profile)) {
             return false;
         }
         // Author is always in scope
         if ($this->profile_id == $profile->id) {
             return true;
         }
         // Only for users on this site
         if ($scope & Notice::SITE_SCOPE) {
             $user = $profile->getUser();
             if (empty($user)) {
                 return false;
             }
         }
         // Only for users mentioned in the notice
         if ($scope & Notice::ADDRESSEE_SCOPE) {
             $repl = Reply::pkeyGet(array('notice_id' => $this->id, 'profile_id' => $profile->id));
             if (empty($repl)) {
                 return false;
             }
         }
         // Only for members of the given group
         if ($scope & Notice::GROUP_SCOPE) {
             // XXX: just query for the single membership
             $groups = $this->getGroups();
             $foundOne = false;
             foreach ($groups as $group) {
                 if ($profile->isMember($group)) {
                     $foundOne = true;
                     break;
                 }
             }
             if (!$foundOne) {
                 return false;
             }
         }
         // Only for followers of the author
         $author = null;
         if ($scope & Notice::FOLLOWER_SCOPE) {
             try {
                 $author = $this->getProfile();
             } catch (Exception $e) {
                 return false;
             }
             if (!Subscription::exists($profile, $author)) {
                 return false;
             }
         }
         return !$this->isHiddenSpam($profile);
     }
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:65,代码来源:Notice.php


注:本文中的Reply::pkeyGet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。