本文整理汇总了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);
}
示例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);
}
}