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


PHP Notice::publicStream方法代码示例

本文整理汇总了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;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:16,代码来源:publicrss.php

示例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);
     }
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:51,代码来源:twitapistatuses.php

示例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;
 }
开发者ID:himmelex,项目名称:NTW,代码行数:26,代码来源:public.php

示例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');
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:19,代码来源:public.php

示例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;
 }
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:14,代码来源:apitimelinepublic.php

示例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();
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:12,代码来源:publicrss.php


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