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


PHP Fave::stream方法代码示例

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


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

示例1: getNotices

 protected function getNotices()
 {
     // is this our own stream?
     $own = $this->scoped instanceof Profile ? $this->target->getID() === $this->scoped->getID() : false;
     $stream = Fave::stream($this->target->getID(), 0, $this->limit, $own);
     return $stream->fetchAll();
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:favoritesrss.php

示例2: getNotices

 /**
  * Get notices
  *
  * @param integer $limit max number of notices to return
  *
  * @return array notices
  */
 function getNotices($limit = 0)
 {
     $notice = Fave::stream($this->user->id, 0, $limit, $false);
     $notices = array();
     while ($notice->fetch()) {
         $notices[] = clone $notice;
     }
     return $notices;
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:16,代码来源:favoritesrss.php

示例3: prepare

 /**
  * Prepare the object
  *
  * Check the input values and initialize the object.
  * Shows an error page on bad input.
  *
  * @param array $args $_REQUEST data
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     $nickname = common_canonical_nickname($this->arg('nickname'));
     $this->user = User::getKV('nickname', $nickname);
     if (!$this->user) {
         // TRANS: Client error displayed when trying to display favourite notices for a non-existing user.
         $this->clientError(_('No such user.'));
     }
     $this->page = $this->trimmed('page');
     if (!$this->page) {
         $this->page = 1;
     }
     common_set_returnto($this->selfUrl());
     $cur = common_current_user();
     // Show imported/gateway notices as well as local if
     // the user is looking at their own favorites, otherwise not.
     $this->notice = Fave::stream($this->user->id, ($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, !empty($cur) && $cur->id == $this->user->id);
     if (empty($this->notice)) {
         // TRANS: Server error displayed when favourite notices could not be retrieved from the database.
         $this->serverError(_('Could not retrieve favorite notices.'));
     }
     if ($this->page > 1 && $this->notice->N == 0) {
         // TRANS: Client error when page not found (404)
         $this->clientError(_('No such page.'), 404);
     }
     return true;
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:38,代码来源:showfavorites.php

示例4: favoriteNotices

 function favoriteNotices($own = false, $offset = 0, $limit = NOTICES_PER_PAGE, $since_id = 0, $max_id = 0)
 {
     $ids = Fave::stream($this->id, $offset, $limit, $own, $since_id, $max_id);
     return Notice::getStreamByIds($ids);
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:5,代码来源:User.php

示例5: hasFave

 function hasFave($notice)
 {
     $cache = common_memcache();
     // XXX: Kind of a hack.
     if (!empty($cache)) {
         // This is the stream of favorite notices, in rev chron
         // order. This forces it into cache.
         $ids = Fave::stream($this->id, 0, NOTICE_CACHE_WINDOW);
         // If it's in the list, then it's a fave
         if (in_array($notice->id, $ids)) {
             return true;
         }
         // If we're not past the end of the cache window,
         // then the cache has all available faves, so this one
         // is not a fave.
         if (count($ids) < NOTICE_CACHE_WINDOW) {
             return false;
         }
         // Otherwise, cache doesn't have all faves;
         // fall through to the default
     }
     $fave = Fave::pkeyGet(array('user_id' => $this->id, 'notice_id' => $notice->id));
     return is_null($fave) ? false : true;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:24,代码来源:Profile.php

示例6: favoriteNotices

 function favoriteNotices($own = false, $offset = 0, $limit = NOTICES_PER_PAGE, $since_id = 0, $max_id = 0)
 {
     return Fave::stream($this->id, $offset, $limit, $own, $since_id, $max_id);
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:4,代码来源:User.php

示例7: getNotices

 /**
  * Get notices
  *
  * @return array notices
  */
 function getNotices()
 {
     $notices = array();
     common_debug("since id = " . $this->since_id . " max id = " . $this->max_id);
     $notice = Fave::stream($this->target->id, ($this->page - 1) * $this->count, $this->count, !empty($this->auth_user) && $this->auth_user->id == $this->target->id, $this->since_id, $this->max_id);
     while ($notice->fetch()) {
         $notices[] = clone $notice;
     }
     return $notices;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:15,代码来源:apitimelinefavorites.php


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