本文整理汇总了PHP中content::fetchUpcomingStories方法的典型用法代码示例。如果您正苦于以下问题:PHP content::fetchUpcomingStories方法的具体用法?PHP content::fetchUpcomingStories怎么用?PHP content::fetchUpcomingStories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类content
的用法示例。
在下文中一共展示了content::fetchUpcomingStories方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build
function build($action = 'TopStories', $mode = 'rss')
{
require_once PATH_CORE . '/classes/content.class.php';
$cObj = new content($this->db);
// if $mode is rss, then echo the output
// if $mode is api, then return the query
switch ($action) {
default:
// do nothing
break;
case 'TopStories':
$this->feedTitle = SITE_TITLE . ' Top Stories';
$this->feedDescription = ' Top rated stories from ' . SITE_TITLE;
$this->feedUrl = $this->baseUrl;
$this->feedRssUrl = $this->baseUrl . '?p=rss&action=TopStories';
$query = $cObj->fetchUpcomingStories('', RSS_NUMBER_STORIES);
break;
}
// output the xml feed
if ($mode == 'rss') {
$code = $this->createXML($this->feedTitle, $this->feedUrl, $this->feedRssUrl, $this->feedDescription, $query);
return $code;
} else {
return $query;
}
}
示例2: postNextTopStory
function postNextTopStory()
{
// only post one story every three hours
$tstamp = $this->statusObj->getState('lastTwitterPost');
if (!isset($_GET['test']) and time() - $tstamp < 60 * TWITTER_INTERVAL_MINUTES) {
return;
}
//echo 'continuing';
require_once PATH_CORE . '/classes/content.class.php';
$cObj = new content($this->db);
require_once PATH_CORE . '/classes/log.class.php';
$logObj = new log($this->db);
$topStories = $cObj->fetchUpcomingStories();
$uid = 1;
while ($data = $this->db->readQ($topStories)) {
if (!$this->checkLog($uid, $data->siteContentId) and $data->score >= TWITTER_SCORE_THRESHOLD) {
// post to twitter
$result = $this->update($data->siteContentId, $data->title);
if ($result) {
$logItem = $logObj->serialize(0, $uid, 'postTwitter', $data->siteContentId);
$logObj->add($logItem);
$this->statusObj->setState('lastTwitterPost', time());
}
// only do one at a time
return;
}
}
}