本文整理汇总了PHP中Notice::publicStream方法的典型用法代码示例。如果您正苦于以下问题:PHP Notice::publicStream方法的具体用法?PHP Notice::publicStream怎么用?PHP Notice::publicStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notice
的用法示例。
在下文中一共展示了Notice::publicStream方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNotices
/**
* Get notices
*
* @param integer $limit max number of notices to return
*
* @return array notices
*/
function getNotices($limit = 0)
{
$notices = array();
$notice = Notice::publicStream(0, $limit == 0 ? 48 : $limit);
while ($notice->fetch()) {
$notices[] = clone $notice;
}
return $notices;
}
示例2: public_timeline
function public_timeline($args, $apidata)
{
parent::handle($args);
$sitename = common_config('site', 'name');
$title = sprintf(_("%s public timeline"), $sitename);
$taguribase = common_config('integration', 'taguri');
$id = "tag:{$taguribase}:PublicTimeline";
$link = common_root_url();
$subtitle = sprintf(_("%s updates from everyone!"), $sitename);
// Number of public statuses to return by default -- Twitter sends 20
$MAX_PUBSTATUSES = 20;
// FIXME: To really live up to the spec we need to build a list
// of notices by users who have custom avatars, so fix this SQL -- Zach
$page = $this->arg('page');
$since_id = $this->arg('since_id');
$before_id = $this->arg('before_id');
// NOTE: page, since_id, and before_id are extensions to Twitter API -- TB
if (!$page) {
$page = 1;
}
if (!$since_id) {
$since_id = 0;
}
if (!$before_id) {
$before_id = 0;
}
$since = strtotime($this->arg('since'));
$notice = Notice::publicStream(($page - 1) * $MAX_PUBSTATUSES, $MAX_PUBSTATUSES, $since_id, $before_id, $since);
if ($notice) {
switch ($apidata['content-type']) {
case 'xml':
$this->show_xml_timeline($notice);
break;
case 'rss':
$this->show_rss_timeline($notice, $title, $link, $subtitle);
break;
case 'atom':
$selfuri = common_root_url() . 'api/statuses/public_timeline.atom';
$this->show_atom_timeline($notice, $title, $id, $link, $subtitle, null, $selfuri);
break;
case 'json':
$this->show_json_timeline($notice);
break;
default:
$this->clientError(_('API method not found!'), $code = 404);
break;
}
} else {
$this->serverError(_('Couldn\'t find any statuses.'), $code = 503);
}
}
示例3: prepare
/**
* Read and validate arguments
*
* @param array $args URL parameters
*
* @return boolean success value
*/
function prepare($args)
{
parent::prepare($args);
$this->page = $this->arg('page') ? $this->arg('page') + 0 : 1;
if ($this->page > MAX_PUBLIC_PAGE) {
$this->clientError(sprintf(_("Beyond the page limit (%s)."), MAX_PUBLIC_PAGE));
}
common_set_returnto($this->selfUrl());
$this->notice = Notice::publicStream(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
if (!$this->notice) {
$this->serverError(_('Could not retrieve public stream.'));
return;
}
if ($this->page > 1 && $this->notice->N == 0) {
// TRANS: Server error when page not found (404)
$this->serverError(_('您访问的网页不存在'), $code = 404);
}
return true;
}
示例4: showContent
/**
* Fill the content area
*
* Shows a list of the notices in the public stream, with some pagination
* controls.
*
* @return void
*/
function showContent()
{
$notice = Notice::publicStream(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
if (!$notice) {
$this->serverError(_('Could not retrieve public stream.'));
return;
}
$nl = new NoticeList($notice, $this);
$cnt = $nl->show();
$this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE, $this->page, 'public');
}
示例5: getNotices
/**
* Get notices
*
* @return array notices
*/
function getNotices()
{
$notices = array();
$notice = Notice::publicStream(($this->page - 1) * $this->count, $this->count, $this->since_id, $this->max_id);
while ($notice->fetch()) {
$notices[] = clone $notice;
}
return $notices;
}
示例6: getNotices
/**
* Get notices
*
* @param integer $limit max number of notices to return
*
* @return array notices
*/
protected function getNotices()
{
$stream = Notice::publicStream(0, $this->limit);
return $stream->fetchAll();
}