本文整理汇总了PHP中Posts::getByLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Posts::getByLink方法的具体用法?PHP Posts::getByLink怎么用?PHP Posts::getByLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Posts
的用法示例。
在下文中一共展示了Posts::getByLink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateFeed
/**
* Add feed to system
*
* @param Feed $feed
*/
private function updateFeed(Feed $feed)
{
require_once 'Ifphp/models/Posts.php';
$feedSource = Zend_Feed_Reader::import($feed->url);
$posts = new Posts();
$tdate = $feedSource->current()->getDateModified();
$tdate = new Zend_Date($tdate);
while ($feedSource->valid() && $tdate->toValue() > $feed->lastPing && !$posts->getByLink($feedSource->current()->getPermaLink())) {
$tdate = $feedSource->current()->getDateModified();
$tdate = new Zend_Date($tdate);
$defaultFilterChain = new Zend_Filter();
$defaultFilterChain->addFilter(new Ifphp_Filter_XSSClean());
$defaultFilterChain->addFilter(new Zend_Filter_StringTrim());
$defaultFilterChain->addFilter(new Zend_Filter_StripTags());
$post = $posts->createRow();
$post->title = $defaultFilterChain->filter($feedSource->current()->getTitle());
$post->description = $defaultFilterChain->filter($feedSource->current()->getDescription());
$post->feedId = $defaultFilterChain->filter($feed->id);
$post->link = $defaultFilterChain->filter($feedSource->current()->getPermaLink());
$post->publishDate = $tdate->toValue();
$post->save();
Ifphp_Controller_Front::getInstance()->getPluginBroker()->addPost($post, $feed);
$feedSource->next();
}
$feed->lastPing = time();
$feed->save();
}
示例2: updateFeedPosts
/**
* Get the latest posts from a feed
*
* @param Feed $feed
*/
protected function updateFeedPosts(Feed $feed)
{
$feedSource = Zend_Feed_Reader::import($feed->url);
$posts = new Posts();
$tdate = $feedSource->current()->getDateModified();
$tdate = new Zend_Date($tdate);
$defaultFilterChain = new Zend_Filter();
$defaultFilterChain->addFilter(new Ifphp_Filter_XSSClean());
$defaultFilterChain->addFilter(new Zend_Filter_StringTrim());
$defaultFilterChain->addFilter(new Zend_Filter_StripTags());
$defaultFilterChain->addFilter(new Zend_Filter_HtmlEntities(array('quotestyle' => ENT_QUOTES, 'charset' => 'UTF-8')));
$defaultFilterChain->addFilter(new Ifphp_Filter_HtmlEntityNames());
while ($feedSource->valid() && $tdate->toValue() > $feed->lastPing && !$posts->getByLink($feedSource->current()->getPermaLink())) {
$tdate = $feedSource->current()->getDateModified();
$tdate = new Zend_Date($tdate);
$post = $posts->createRow();
$post->title = $defaultFilterChain->filter($feedSource->current()->getTitle());
$post->description = $defaultFilterChain->filter($feedSource->current()->getDescription());
$post->feedId = $defaultFilterChain->filter($feed->id);
$post->link = $defaultFilterChain->filter($feedSource->current()->getPermaLink());
$post->publishDate = $tdate->toValue();
$post->save();
Ifphp_Controller_Front::getInstance()->getPluginBroker()->addPost($post, $feed);
$feedSource->next();
}
$feed->lastPing = time();
$feed->save();
}