本文整理匯總了PHP中Posts::createRow方法的典型用法代碼示例。如果您正苦於以下問題:PHP Posts::createRow方法的具體用法?PHP Posts::createRow怎麽用?PHP Posts::createRow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Posts
的用法示例。
在下文中一共展示了Posts::createRow方法的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();
}