本文整理汇总了PHP中Feed::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Feed::set方法的具体用法?PHP Feed::set怎么用?PHP Feed::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Feed
的用法示例。
在下文中一共展示了Feed::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setParam
/**
* Set a feed param
*
* @param \SimpleXMLElement $element
* @param \Nekland\Bundle\FeedBundle\Feed $feed
* @return void
*/
protected function setParam(\SimpleXMLElement $element, Feed $feed)
{
if (count($element) === 0) {
$feed->set($element->getName(), (string) $element);
} else {
$feed->set($element->getName(), $this->extractParam($element));
}
}
示例2: subscribeFeed
public function subscribeFeed($feedlink, $options = array())
{
if ($this->countSubscriptions() >= SUBSCRUBE_LIMIT) {
$msg = sprintf('SUBSCRIBE LIMIT: %s(%s) %s', $this->data['Member']['username'], $this->id, $feedlink);
CakeLog::write(LOG_WARNING, $msg);
return false;
}
$Feed = new Feed();
$feed = $Feed->findByFeedlink($feedlink);
if ($feed) {
// subscribed..
$Feed->set($feed);
} elseif (isset($options['quick'])) {
$data = array('feedlink' => $feedlink, 'link' => $feedlink, 'title' => $options['title'], 'description' => '');
$Feed->set($data);
$Feed->save();
$Feed->createCrawlStatus();
} else {
$feeddata = FeedUtils::getFeed($feedlink);
if (!$feeddata) {
return false;
}
$data = array('subscribers_count' => 0, 'feedlink' => $feedlink, 'link' => $feeddata->get_permalink() ? $feeddata->get_permalink() : '', 'title' => $feeddata->get_title() ? $feeddata->get_title() : '');
$Feed->set($data);
$Feed->save();
$Feed->createCrawlStatus();
}
unset($options['quick']);
unset($options['title']);
$conditions = array();
$conditions[] = es('Subscription.member_id = %s', $this->id);
$conditions[] = es('Subscription.feed_id = %s', $Feed->id);
$sub = $this->Subscription->find($conditions);
if ($sub) {
return $sub;
}
$data = array('member_id' => $this->id, 'feed_id' => $Feed->id, 'has_unread' => true);
$data = array_merge($data, $options);
$this->Subscription->create($data);
return $this->Subscription->save();
}