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