本文整理汇总了PHP中Zend_Feed::registerNamespace方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Feed::registerNamespace方法的具体用法?PHP Zend_Feed::registerNamespace怎么用?PHP Zend_Feed::registerNamespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Feed
的用法示例。
在下文中一共展示了Zend_Feed::registerNamespace方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateData
public function updateData()
{
$feed_url = $this->getProperty('feed_url');
Zend_Feed::registerNamespace('gr', 'http://www.google.com/schemas/reader/atom/');
if (!($feed = new Zend_Feed_Atom($feed_url))) {
return 0;
}
$result = $this->processItems($feed);
// Clear up to free memory
unset($feed);
// Mark as updated (could have been with errors)
$this->markUpdated();
return $result;
}
示例2: __construct
public function __construct($xml = null)
{
if ($xml) {
// first, lets find the cmis namespace to use
$sx = new SimpleXMLElement($xml);
$namespaces = $sx->getDocNamespaces();
$ns = isset($namespaces['cmis']) ? $namespaces['cmis'] : 'http://docs.oasis-open.org/ns/cmis/core/200901';
// go through the XML and pull out the things we're interested in
Zend_Feed::registerNamespace('cmis', $ns);
// 'http://www.cmis.org/2008/05');
$this->rawXml = $xml;
$feed = Zend_Feed::importString($this->rawXml);
foreach ($feed as $item) {
$this->loadFromFeed($item);
}
}
}
示例3: __construct
function __construct($xml)
{
parent::__construct();
if ($xml) {
// first, lets find the cmis namespace to use
$sx = new SimpleXMLElement($xml);
$namespaces = $sx->getDocNamespaces();
$ns = isset($namespaces['cmis']) ? $namespaces['cmis'] : 'http://docs.oasis-open.org/ns/cmis/core/200901';
// go through the entries and create some objects
Zend_Feed::registerNamespace('cmis', $ns);
// 'http://www.cmis.org/2008/05');
$this->rawXml = $xml;
$feed = Zend_Feed::importString($this->rawXml);
foreach ($feed as $entry) {
$obj = new SeaMistObject();
$obj->loadFromFeed($entry);
$this[] = $obj;
}
}
}
示例4: _mapFeedEntries
/**
* Generate the entries of the feed when working in write mode
*
* The following nodes are constructed for each feed entry
* <item>
* <title>entry title</title>
* <link>url to feed entry</link>
* <guid>url to feed entry</guid>
* <description>short text</description>
* <content:encoded>long version, can contain html</content:encoded>
* </item>
*
* @param DOMElement $root the root node to use
* @param array $array the data to use
* @return void
*/
protected function _mapFeedEntries(DOMElement $root, $array)
{
Zend_Feed::registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/');
foreach ($array as $dataentry) {
$item = $this->_element->createElement('item');
$title = $this->_element->createElement('title');
$title->appendChild($this->_element->createCDATASection($dataentry->title));
$item->appendChild($title);
if (isset($dataentry->author)) {
$author = $this->_element->createElement('author', $dataentry->author);
$item->appendChild($author);
}
$link = $this->_element->createElement('link', $dataentry->link);
$item->appendChild($link);
if (isset($dataentry->guid)) {
$guid = $this->_element->createElement('guid', $dataentry->guid);
if (!Zend_Uri::check($dataentry->guid)) {
$guid->setAttribute('isPermaLink', 'false');
}
$item->appendChild($guid);
}
$description = $this->_element->createElement('description');
$description->appendChild($this->_element->createCDATASection($dataentry->description));
$item->appendChild($description);
if (isset($dataentry->content)) {
$content = $this->_element->createElement('content:encoded');
$content->appendChild($this->_element->createCDATASection($dataentry->content));
$item->appendChild($content);
}
$pubdate = isset($dataentry->lastUpdate) ? $dataentry->lastUpdate : time();
$pubdate = $this->_element->createElement('pubDate', date(DATE_RSS, $pubdate));
$item->appendChild($pubdate);
if (isset($dataentry->category)) {
foreach ($dataentry->category as $category) {
$node = $this->_element->createElement('category', $category['term']);
if (isset($category['scheme'])) {
$node->setAttribute('domain', $category['scheme']);
}
$item->appendChild($node);
}
}
if (isset($dataentry->source)) {
$source = $this->_element->createElement('source', $dataentry->source['title']);
$source->setAttribute('url', $dataentry->source['url']);
$item->appendChild($source);
}
if (isset($dataentry->comments)) {
$comments = $this->_element->createElement('comments', $dataentry->comments);
$item->appendChild($comments);
}
if (isset($dataentry->commentRss)) {
$comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/', 'wfw:commentRss', $dataentry->commentRss);
$item->appendChild($comments);
}
if (isset($dataentry->enclosure)) {
foreach ($dataentry->enclosure as $enclosure) {
$node = $this->_element->createElement('enclosure');
$node->setAttribute('url', $enclosure['url']);
if (isset($enclosure['type'])) {
$node->setAttribute('type', $enclosure['type']);
}
if (isset($enclosure['length'])) {
$node->setAttribute('length', $enclosure['length']);
}
$item->appendChild($node);
}
}
$root->appendChild($item);
}
}
示例5: createEvent
/**
* Creates an event on the authenticated user's default calendar with the
* specified event details.
*
* @param Zend_Http_Client $client The authenticated client object
* @param string $title The event title
* @param string $desc The detailed description of the event
* @param string $startDate The start date of the event in YYYY-MM-DD format
* @param string $startTime The start time of the event in HH:MM 24hr format
* @param string $endTime The end time of the event in HH:MM 24hr format
* @param string $tzOffset The offset from GMT/UTC in [+-]DD format (eg -08)
* @return void
*/
function createEvent($client, $title = 'Tennis with Beth', $desc = 'Meet for a quick lesson', $where = 'On the courts', $startDate = '2008-01-20', $startTime = '10:00', $endDate = '2008-01-20', $endTime = '11:00', $tzOffset = '-08')
{
$gdataCal = new Zend_Gdata_Calendar($client);
Zend_Feed::registerNamespace('gd', 'http://schemas.google.com/g/2005');
$newEntry = new Zend_Feed_EntryAtom();
$newEntry->title = trim($title);
$newEntry->{'gd:where'}['valueString'] = $where;
$newEntry->content = $desc;
$newEntry->content['type'] = 'text';
$when = $newEntry->{'gd:when'};
$when['startTime'] = "{$startDate}T{$startTime}:00.000{$tzOffset}:00";
$when['endTime'] = "{$endDate}T{$endTime}:00.000{$tzOffset}:00";
$gdataCal->post($newEntry->saveXML());
}