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


PHP Subscription::exists方法代码示例

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


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

示例1: handle

 /**
  * Handle the request
  *
  * Check the format and show the user info
  *
  * @return void
  */
 protected function handle()
 {
     parent::handle();
     if (empty($this->profile_a) || empty($this->profile_b)) {
         $this->clientError(_('Two valid IDs or nick names must be supplied.'), 400);
     }
     $result = Subscription::exists($this->profile_a, $this->profile_b);
     switch ($this->format) {
         case 'xml':
             $this->initDocument('xml');
             $this->element('friends', null, $result);
             $this->endDocument('xml');
             break;
         case 'json':
             $this->initDocument('json');
             print json_encode($result);
             $this->endDocument('json');
             break;
         default:
             break;
     }
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:29,代码来源:apifriendshipsexists.php

示例2: onEndUnsubscribe

 public function onEndUnsubscribe($subscriber, $other)
 {
     if (!Subscription::exists($subscriber, $other)) {
         $notif = new QvitterNotification();
         $notif->to_profile_id = $other->id;
         $notif->from_profile_id = $subscriber->id;
         $notif->ntype = 'follow';
         $notif->delete();
     }
     return true;
 }
开发者ID:GreenLunar,项目名称:qvitter,代码行数:11,代码来源:QvitterPlugin.php

示例3: do_main

 function do_main()
 {
     $iSubscriptionType = SubscriptionEvent::subTypes('Folder');
     if (!Subscription::exists($this->oUser->getId(), $this->oFolder->getId(), $iSubscriptionType)) {
         $_SESSION['KTErrorMessage'][] = _kt("You were not subscribed to that folder");
     } else {
         $oSubscription =& Subscription::getByIDs($this->oUser->getId(), $this->oFolder->getId(), $iSubscriptionType);
         $res = $oSubscription->delete();
         if ($res) {
             $_SESSION['KTInfoMessage'][] = _kt("You have been unsubscribed from this folder");
         } else {
             $_SESSION['KTErrorMessage'][] = _kt("There was a problem unsubscribing you from this folder");
         }
     }
     controllerRedirect('browse', 'fFolderId=' . $this->oFolder->getId());
     exit(0);
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:17,代码来源:KTSubscriptions.php

示例4: _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

示例5: isSubscribed

 /**
  * Checks if the user is subscribed to the document
  *
  * @author KnowledgeTree Team
  * @access public
  * @return bool $result TRUE if subscribed | FALSE if not
  */
 public function isSubscribed()
 {
     $subscriptionType = SubscriptionEvent::subTypes('Document');
     $user = $this->ktapi->get_user();
     $document = $this->document;
     $result = Subscription::exists($user->getId(), $document->getId(), $subscriptionType);
     return $result;
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:15,代码来源:KTAPIDocument.inc.php

示例6: block

 function block($other)
 {
     // Add a new block record
     // no blocking (and thus unsubbing from) yourself
     if ($this->id == $other->id) {
         common_log(LOG_WARNING, sprintf("Profile ID %d (%s) tried to block themself.", $this->id, $this->nickname));
         return false;
     }
     $block = new Profile_block();
     // Begin a transaction
     $block->query('BEGIN');
     $block->blocker = $this->id;
     $block->blocked = $other->id;
     $result = $block->insert();
     if (!$result) {
         common_log_db_error($block, 'INSERT', __FILE__);
         return false;
     }
     $self = $this->getProfile();
     if (Subscription::exists($other, $self)) {
         Subscription::cancel($other, $self);
     }
     if (Subscription::exists($self, $other)) {
         Subscription::cancel($self, $other);
     }
     $block->query('COMMIT');
     return true;
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:28,代码来源:User.php

示例7: isSubscribed

 /**
  * Is this profile subscribed to another profile?
  *
  * @param Profile $other
  * @return boolean
  */
 function isSubscribed($other)
 {
     return Subscription::exists($this, $other);
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:10,代码来源:Profile.php

示例8: canRead

 function canRead(Notice $notice)
 {
     if ($notice->scope & Notice::SITE_SCOPE) {
         $user = $this->getUser();
         if (empty($user)) {
             return false;
         }
     }
     if ($notice->scope & Notice::ADDRESSEE_SCOPE) {
         $replies = $notice->getReplies();
         if (!in_array($this->id, $replies)) {
             $groups = $notice->getGroups();
             $foundOne = false;
             foreach ($groups as $group) {
                 if ($this->isMember($group)) {
                     $foundOne = true;
                     break;
                 }
             }
             if (!$foundOne) {
                 return false;
             }
         }
     }
     if ($notice->scope & Notice::FOLLOWER_SCOPE) {
         $author = $notice->getProfile();
         if (!Subscription::exists($this, $author)) {
             return false;
         }
     }
     return true;
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:32,代码来源:Profile.php

示例9: _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

示例10: isSubscribed

 /**
  * Determines whether the currently logged on user is subscribed
  *
  * @author KnowledgeTree Team
  * @access public
  * @return boolean
  */
 public function isSubscribed()
 {
     $subscriptionType = SubscriptionEvent::subTypes('Folder');
     $user = $this->ktapi->get_user();
     $folder = $this->folder;
     $result = Subscription::exists($user->getId(), $folder->getId(), $subscriptionType);
     return $result;
 }
开发者ID:jpbauer,项目名称:knowledgetree,代码行数:15,代码来源:KTAPIFolder.inc.php

示例11: _inScope

 protected function _inScope($profile)
 {
     // If there's no scope, anyone (even anon) is in scope.
     if ($this->scope == 0) {
         return true;
     }
     // 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 ($this->scope & Notice::SITE_SCOPE) {
         $user = $profile->getUser();
         if (empty($user)) {
             return false;
         }
     }
     // Only for users mentioned in the notice
     if ($this->scope & Notice::ADDRESSEE_SCOPE) {
         // XXX: just query for the single reply
         $replies = $this->getReplies();
         if (!in_array($profile->id, $replies)) {
             return false;
         }
     }
     // Only for members of the given group
     if ($this->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
     if ($this->scope & Notice::FOLLOWER_SCOPE) {
         $author = $this->getProfile();
         if (!Subscription::exists($profile, $author)) {
             return false;
         }
     }
     return true;
 }
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:53,代码来源:Notice.php


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