import v2.0.0.0_RC3 | 2012-07-01

https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
2019-07-17 22:31:04 +02:00
parent 38c146901c
commit 2f397f01f7
2677 changed files with 296182 additions and 45159 deletions

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Atom.php 16966 2009-07-22 15:22:18Z padraic $
* @version $Id: Atom.php 19193 2009-11-23 16:11:15Z padraic $
*/
/**
@ -76,7 +76,7 @@ class Zend_Feed_Reader_Entry_Atom extends Zend_Feed_Reader_EntryAbstract impleme
$this->_extensions['Thread_Entry'] = new $threadClass($entry, $entryKey, $type);
}
/**
/**
* Get the specified author
*
* @param int $index
@ -295,7 +295,7 @@ class Zend_Feed_Reader_Entry_Atom extends Zend_Feed_Reader_EntryAbstract impleme
return $this->_data['commentcount'];
}
$commentcount = $this->getExtension('Thread')>getCommentCount();
$commentcount = $this->getExtension('Thread')->getCommentCount();
if (!$commentcount) {
$commentcount = $this->getExtension('Atom')->getCommentCount();

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Rss.php 16966 2009-07-22 15:22:18Z padraic $
* @version $Id: Rss.php 18367 2009-09-22 14:55:59Z padraic $
*/
/**
@ -255,19 +255,19 @@ class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_EntryAbstract implemen
) {
$dateModified = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/pubDate)');
if ($dateModified) {
$date = new Zend_Date();
try {
$date->set($dateModified, Zend_Date::RFC_822);
} catch (Zend_Date_Exception $e) {
$dateStandards = array(Zend_Date::RSS, Zend_Date::RFC_822,
Zend_Date::RFC_2822, Zend_Date::DATES);
$date = new Zend_Date;
foreach ($dateStandards as $standard) {
try {
$date->set($dateModified, Zend_Date::RFC_2822);
$date->set($dateModified, $standard);
break;
} catch (Zend_Date_Exception $e) {
try {
$date->set($dateModified, Zend_Date::DATES);
} catch (Zend_Date_Exception $e) {
if ($standard == Zend_Date::DATES) {
require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception(
'Could not load date due to unrecognised format (should follow RFC 822 or 2822): '
'Could not load date due to unrecognised'
.' format (should follow RFC 822 or 2822):'
. $e->getMessage()
);
}
@ -335,7 +335,6 @@ class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_EntryAbstract implemen
/**
* Get the entry enclosure
* TODO: Is this supported by RSS? Could delegate to Atom Extension if not.
* @return string
*/
public function getEnclosure()
@ -357,6 +356,10 @@ class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_EntryAbstract implemen
}
}
if (!$enclosure) {
$enclosure = $this->getExtension('Atom')->getEnclosure();
}
$this->_data['enclosure'] = $enclosure;
return $this->_data['enclosure'];

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: EntryAbstract.php 16966 2009-07-22 15:22:18Z padraic $
* @version $Id: EntryAbstract.php 19042 2009-11-19 15:23:34Z padraic $
*/
/**
@ -118,6 +118,9 @@ abstract class Zend_Feed_Reader_EntryAbstract
public function getEncoding()
{
$assumed = $this->getDomDocument()->encoding;
if (empty($assumed)) {
$assumed = 'UTF-8';
}
return $assumed;
}
@ -134,7 +137,7 @@ abstract class Zend_Feed_Reader_EntryAbstract
return $dom->saveXml();
}
/**
/**
* Get the entry type
*
* @return string
@ -154,7 +157,7 @@ abstract class Zend_Feed_Reader_EntryAbstract
return $this->_xpath;
}
/**
/**
* Set the XPath query
*
* @param DOMXPath $xpath

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Entry.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: Entry.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -34,6 +34,11 @@ require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
*/
require_once 'Zend/Date.php';
/**
* @see Zend_Uri
*/
require_once 'Zend/Uri.php';
/**
* @category Zend
* @package Zend_Feed_Reader
@ -43,7 +48,7 @@ require_once 'Zend/Date.php';
class Zend_Feed_Reader_Extension_Atom_Entry
extends Zend_Feed_Reader_Extension_EntryAbstract
{
/**
/**
* Get the specified author
*
* @param int $index
@ -264,6 +269,34 @@ class Zend_Feed_Reader_Extension_Atom_Entry
return $this->_data['id'];
}
/**
* Get the base URI of the feed (if set).
*
* @return string|null
*/
public function getBaseUrl()
{
if (array_key_exists('baseUrl', $this->_data)) {
return $this->_data['baseUrl'];
}
$baseUrl = $this->_xpath->evaluate('string('
. $this->getXpathPrefix() . '/@xml:base[1]'
. ')');
if (!$baseUrl) {
$baseUrl = $this->_xpath->evaluate('string(//@xml:base[1])');
}
if (!$baseUrl) {
$baseUrl = null;
}
$this->_data['baseUrl'] = $baseUrl;
return $this->_data['baseUrl'];
}
/**
* Get a specific link
*
@ -303,7 +336,7 @@ class Zend_Feed_Reader_Extension_Atom_Entry
if ($list->length) {
foreach ($list as $link) {
$links[] = $link->value;
$links[] = $this->_absolutiseUri($link->value);
}
}
@ -392,6 +425,7 @@ class Zend_Feed_Reader_Extension_Atom_Entry
if ($list->length) {
$link = $list->item(0)->value;
$link = $this->_absolutiseUri($link);
}
$this->_data['commentlink'] = $link;
@ -418,6 +452,7 @@ class Zend_Feed_Reader_Extension_Atom_Entry
if ($list->length) {
$link = $list->item(0)->value;
$link = $this->_absolutiseUri($link);
}
$this->_data['commentfeedlink'] = $link;
@ -425,6 +460,23 @@ class Zend_Feed_Reader_Extension_Atom_Entry
return $this->_data['commentfeedlink'];
}
/**
* Attempt to absolutise the URI, i.e. if a relative URI apply the
* xml:base value as a prefix to turn into an absolute URI.
*/
protected function _absolutiseUri($link)
{
if (!Zend_Uri::check($link)) {
if (!is_null($this->getBaseUrl())) {
$link = $this->getBaseUrl() . $link;
if (!Zend_Uri::check($link)) {
$link = null;
}
}
}
return $link;
}
/**
* Get an author entry
*

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Feed.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: Feed.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -29,13 +29,18 @@ require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php';
*/
require_once 'Zend/Date.php';
/**
* @see Zend_Uri
*/
require_once 'Zend/Uri.php';
/**
* @category Zend
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_Extension_Atom_Feed
class Zend_Feed_Reader_Extension_Atom_Feed
extends Zend_Feed_Reader_Extension_FeedAbstract
{
/**
@ -240,7 +245,7 @@ class Zend_Feed_Reader_Extension_Atom_Feed
return $this->_data['generator'];
}
/**
/**
* Get the feed ID
*
* @return string|null
@ -294,6 +299,27 @@ class Zend_Feed_Reader_Extension_Atom_Feed
return $this->_data['language'];
}
/**
* Get the base URI of the feed (if set).
*
* @return string|null
*/
public function getBaseUrl()
{
if (array_key_exists('baseUrl', $this->_data)) {
return $this->_data['baseUrl'];
}
$baseUrl = $this->_xpath->evaluate('string(//@xml:base[1])');
if (!$baseUrl) {
$baseUrl = null;
}
$this->_data['baseUrl'] = $baseUrl;
return $this->_data['baseUrl'];
}
/**
* Get a link to the source website
*
@ -305,10 +331,16 @@ class Zend_Feed_Reader_Extension_Atom_Feed
return $this->_data['link'];
}
$link = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:link/@href)');
$link = null;
if (!$link) {
$link = null;
$list = $this->_xpath->query(
$this->getXpathPrefix() . '/atom:link[@rel="alternate"]/@href' . '|' .
$this->getXpathPrefix() . '/atom:link[not(@rel)]/@href'
);
if ($list->length) {
$link = $list->item(0)->nodeValue;
$link = $this->_absolutiseUri($link);
}
$this->_data['link'] = $link;
@ -329,9 +361,7 @@ class Zend_Feed_Reader_Extension_Atom_Feed
$link = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:link[@rel="self"]/@href)');
if (!$link) {
$link = null;
}
$link = $this->_absolutiseUri($link);
$this->_data['feedlink'] = $link;
@ -360,7 +390,7 @@ class Zend_Feed_Reader_Extension_Atom_Feed
return $this->_data['title'];
}
/**
/**
* Get an author entry in RSS format
*
* @param DOMElement $element
@ -399,12 +429,29 @@ class Zend_Feed_Reader_Extension_Atom_Feed
return null;
}
/**
* Attempt to absolutise the URI, i.e. if a relative URI apply the
* xml:base value as a prefix to turn into an absolute URI.
*/
protected function _absolutiseUri($link)
{
if (!Zend_Uri::check($link)) {
if (!is_null($this->getBaseUrl())) {
$link = $this->getBaseUrl() . $link;
if (!Zend_Uri::check($link)) {
$link = null;
}
}
}
return $link;
}
/**
* Register the default namespaces for the current feed format
*/
protected function _registerNamespaces()
{
if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10
if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10
|| $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03
) {
return; // pre-registered at Feed level

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Entry.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: Entry.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -35,13 +35,13 @@ require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_Extension_Content_Entry
class Zend_Feed_Reader_Extension_Content_Entry
extends Zend_Feed_Reader_Extension_EntryAbstract
{
public function getContent()
{
if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10
if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10
&& $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090
) {
$content = $this->_xpath->evaluate('string('.$this->getXpathPrefix().'/content:encoded)');

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Feed.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: Feed.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -30,7 +30,7 @@ require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php';
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_Extension_CreativeCommons_Feed
class Zend_Feed_Reader_Extension_CreativeCommons_Feed
extends Zend_Feed_Reader_Extension_FeedAbstract
{
/**

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Entry.php 16711 2009-07-14 16:10:54Z matthew $
* @version $Id: Entry.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -40,7 +40,7 @@ require_once 'Zend/Date.php';
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_Extension_DublinCore_Entry
class Zend_Feed_Reader_Extension_DublinCore_Entry
extends Zend_Feed_Reader_Extension_EntryAbstract
{
/**
@ -87,7 +87,7 @@ class Zend_Feed_Reader_Extension_DublinCore_Entry
if ($list->length) {
foreach ($list as $author) {
if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_20
if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_20
&& preg_match("/\(([^\)]+)\)/", $author->nodeValue, $matches, PREG_OFFSET_CAPTURE)
) {
$authors[] = $matches[1][0];

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Feed.php 16711 2009-07-14 16:10:54Z matthew $
* @version $Id: Feed.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -35,10 +35,10 @@ require_once 'Zend/Date.php';
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_Extension_DublinCore_Feed
class Zend_Feed_Reader_Extension_DublinCore_Feed
extends Zend_Feed_Reader_Extension_FeedAbstract
{
/**
/**
* Get a single author
*
* @param int $index

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: EntryAbstract.php 16711 2009-07-14 16:10:54Z matthew $
* @version $Id: EntryAbstract.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -89,11 +89,11 @@ abstract class Zend_Feed_Reader_Extension_EntryAbstract
$this->_data['type'] = Zend_Feed_Reader::detectType($feed);
}
// set the XPath query prefix for the entry being queried
if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_10
if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_10
|| $this->getType() == Zend_Feed_Reader::TYPE_RSS_090
) {
$this->setXpathPrefix('//rss:item[' . ($this->_entryKey+1) . ']');
} elseif ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10
} elseif ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10
|| $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03
) {
$this->setXpathPrefix('//atom:entry[' . ($this->_entryKey+1) . ']');
@ -123,7 +123,7 @@ abstract class Zend_Feed_Reader_Extension_EntryAbstract
return $assumed;
}
/**
/**
* Get the entry type
*
* @return string
@ -178,8 +178,8 @@ abstract class Zend_Feed_Reader_Extension_EntryAbstract
/**
* Set the XPath prefix
*
* @param string $prefix
*
* @param string $prefix
* @return Zend_Feed_Reader_Extension_EntryAbstract
*/
public function setXpathPrefix($prefix)
@ -190,7 +190,7 @@ abstract class Zend_Feed_Reader_Extension_EntryAbstract
/**
* Register XML namespaces
*
*
* @return void
*/
protected abstract function _registerNamespaces();

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FeedAbstract.php 16711 2009-07-14 16:10:54Z matthew $
* @version $Id: FeedAbstract.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -43,7 +43,7 @@ require_once 'Zend/Feed/Reader/Entry/Rss.php';
*/
abstract class Zend_Feed_Reader_Extension_FeedAbstract
{
/**
/**
* Parsed feed data
*
* @var array
@ -141,8 +141,8 @@ abstract class Zend_Feed_Reader_Extension_FeedAbstract
/**
* Get the XPath prefix
*
* @return string
*
* @return string
*/
public function getXpathPrefix()
{

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Entry.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: Entry.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -35,7 +35,7 @@ require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_Extension_Slash_Entry
class Zend_Feed_Reader_Extension_Slash_Entry
extends Zend_Feed_Reader_Extension_EntryAbstract
{
/**

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Feed.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: Feed.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -32,7 +32,7 @@ require_once 'Zend/Date.php';
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_Extension_Syndication_Feed
class Zend_Feed_Reader_Extension_Syndication_Feed
extends Zend_Feed_Reader_Extension_FeedAbstract
{
/**
@ -57,7 +57,7 @@ class Zend_Feed_Reader_Extension_Syndication_Feed
case 'yearly':
return $period;
default:
throw new Zend_Feed_Exception("Feed specified invalid update period: '$period'."
throw new Zend_Feed_Exception("Feed specified invalid update period: '$period'."
. " Must be one of hourly, daily, weekly or yearly"
);
}
@ -100,13 +100,13 @@ class Zend_Feed_Reader_Extension_Syndication_Feed
switch ($period)
{
//intentional fall through
case 'yearly':
case 'yearly':
$ticks *= 52; //TODO: fix generalisation, how?
case 'weekly':
case 'weekly':
$ticks *= 7;
case 'daily':
case 'daily':
$ticks *= 24;
case 'hourly':
case 'hourly':
$ticks *= 3600;
break;
default: //Never arrive here, exception thrown in getPeriod()

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Entry.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: Entry.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -30,12 +30,12 @@ require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_Extension_Thread_Entry
class Zend_Feed_Reader_Extension_Thread_Entry
extends Zend_Feed_Reader_Extension_EntryAbstract
{
/**
* Get the "in-reply-to" value
*
*
* @return string
*/
public function getInReplyTo()

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Entry.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: Entry.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -35,7 +35,7 @@ require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php';
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_Extension_WellFormedWeb_Entry
class Zend_Feed_Reader_Extension_WellFormedWeb_Entry
extends Zend_Feed_Reader_Extension_EntryAbstract
{
/**

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Atom.php 16963 2009-07-22 14:39:31Z padraic $
* @version $Id: Atom.php 19044 2009-11-19 16:44:24Z padraic $
*/
/**
@ -41,9 +41,8 @@ class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract
/**
* Constructor
*
* @param Zend_Feed_Abstract $feed
* @param DOMDocument $dom
* @param string $type
* @param string $xpath
*/
public function __construct(DomDocument $dom, $type = null)
{
@ -196,7 +195,7 @@ class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract
return $this->_data['generator'];
}
/**
/**
* Get the feed ID
*
* @return string|null
@ -240,6 +239,24 @@ class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract
return $this->_data['language'];
}
/**
* Get a link to the source website
*
* @return string|null
*/
public function getBaseUrl()
{
if (array_key_exists('baseUrl', $this->_data)) {
return $this->_data['baseUrl'];
}
$baseUrl = $this->getExtension('Atom')->getBaseUrl();
$this->_data['baseUrl'] = $baseUrl;
return $this->_data['baseUrl'];
}
/**
* Get a link to the source website
*
@ -294,7 +311,7 @@ class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract
return $this->_data['title'];
}
/**
/**
* Read all entries to the internal entries array
*
*/

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Rss.php 16963 2009-07-22 14:39:31Z padraic $
* @version $Id: Rss.php 19044 2009-11-19 16:44:24Z padraic $
*/
/**
@ -51,9 +51,8 @@ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract
/**
* Constructor
*
* @param Zend_Feed_Abstract $feed
* @param DOMDocument $dom
* @param string $type
* @param string $xpath
*/
public function __construct(DomDocument $dom, $type = null)
{
@ -74,7 +73,7 @@ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract
}
}
/**
/**
* Get a single author
*
* @param int $index
@ -170,7 +169,7 @@ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract
return $this->_data['copyright'];
}
/**
/**
* Get the feed creation date
*
* @return string|null
@ -201,19 +200,19 @@ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract
$dateModified = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)');
}
if ($dateModified) {
$date = new Zend_Date();
try {
$date->set($dateModified, Zend_Date::RFC_822);
} catch (Zend_Date_Exception $e) {
$dateStandards = array(Zend_Date::RSS, Zend_Date::RFC_822,
Zend_Date::RFC_2822, Zend_Date::DATES);
$date = new Zend_Date;
foreach ($dateStandards as $standard) {
try {
$date->set($dateModified, Zend_Date::RFC_2822);
$date->set($dateModified, $standard);
break;
} catch (Zend_Date_Exception $e) {
try {
$date->set($dateModified, Zend_Date::DATES);
} catch (Zend_Date_Exception $e) {
if ($standard == Zend_Date::DATES) {
require_once 'Zend/Feed/Exception.php';
throw new Zend_Feed_Exception(
'Could not load date due to unrecognised format (should follow RFC 822 or 2822): '
'Could not load date due to unrecognised'
.' format (should follow RFC 822 or 2822):'
. $e->getMessage()
);
}
@ -493,7 +492,7 @@ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract
return $this->_data['title'];
}
/**
/**
* Read all entries to the internal entries array
*
*/

View File

@ -16,7 +16,7 @@
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FeedAbstract.php 16966 2009-07-22 15:22:18Z padraic $
* @version $Id: FeedAbstract.php 19044 2009-11-19 16:44:24Z padraic $
*/
/**
@ -48,7 +48,7 @@ require_once 'Zend/Feed/Reader/FeedInterface.php';
*/
abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInterface
{
/**
/**
* Parsed feed data
*
* @var array
@ -106,7 +106,7 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt
$this->_loadExtensions();
}
/**
/**
* Get the number of feed entries.
* Required by the Iterator interface.
*
@ -117,10 +117,10 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt
return count($this->_entries);
}
/**
/**
* Return the current entry
*
* @return Zend_Feed_Reader_Entry_Interface
* @return Zend_Feed_Reader_EntryInterface
*/
public function current()
{
@ -153,6 +153,9 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt
public function getEncoding()
{
$assumed = $this->getDomDocument()->encoding;
if (empty($assumed)) {
$assumed = 'UTF-8';
}
return $assumed;
}
@ -196,7 +199,7 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt
return $this->_data['type'];
}
/**
/**
* Return the current feed key
*
* @return unknown
@ -206,7 +209,7 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt
return $this->_entriesKey;
}
/**
/**
* Move the feed pointer forward
*
*/

View File

@ -0,0 +1,148 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FeedSet.php 19105 2009-11-20 17:13:54Z padraic $
*/
/**
* @see Zend_Feed_Reader
*/
require_once 'Zend/Feed/Reader.php';
/**
* @see Zend_Uri
*/
require_once 'Zend/Uri.php';
/**
* @category Zend
* @package Zend_Feed_Reader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Feed_Reader_FeedSet extends ArrayObject
{
public $rss = null;
public $rdf = null;
public $atom = null;
/**
* Import a DOMNodeList from any document containing a set of links
* for alternate versions of a document, which will normally refer to
* RSS/RDF/Atom feeds for the current document.
*
* All such links are stored internally, however the first instance of
* each RSS, RDF or Atom type has its URI stored as a public property
* as a shortcut where the use case is simply to get a quick feed ref.
*
* Note that feeds are not loaded at this point, but will be lazy
* loaded automatically when each links 'feed' array key is accessed.
*
* @param DOMNodeList $links
* @param string $uri
* @return void
*/
public function addLinks(DOMNodeList $links, $uri)
{
foreach ($links as $link) {
if (strtolower($link->getAttribute('rel')) !== 'alternate'
|| !$link->getAttribute('type') || !$link->getAttribute('href')) {
continue;
}
if (!isset($this->rss) && $link->getAttribute('type') == 'application/rss+xml') {
$this->rss = $this->_absolutiseUri(trim($link->getAttribute('href')), $uri);
} elseif(!isset($this->atom) && $link->getAttribute('type') == 'application/atom+xml') {
$this->atom = $this->_absolutiseUri(trim($link->getAttribute('href')), $uri);
} elseif(!isset($this->rdf) && $link->getAttribute('type') == 'application/rdf+xml') {
$this->rdf = $this->_absolutiseUri(trim($link->getAttribute('href')), $uri);
}
$this[] = new self(array(
'rel' => 'alternate',
'type' => $link->getAttribute('type'),
'href' => $this->_absolutiseUri(trim($link->getAttribute('href')), $uri),
));
}
}
/**
* Attempt to turn a relative URI into an absolute URI
*/
protected function _absolutiseUri($link, $uri = null)
{
if (!Zend_Uri::check($link)) {
if (!is_null($uri)) {
$uri = Zend_Uri::factory($uri);
if ($link[0] !== '/') {
$link = $uri->getPath() . '/' . $link;
}
$link = $uri->getScheme() . '://' . $uri->getHost() . '/' . $this->_canonicalizePath($link);
if (!Zend_Uri::check($link)) {
$link = null;
}
}
}
return $link;
}
/**
* Canonicalize relative path
*/
protected function _canonicalizePath($path)
{
$parts = array_filter(explode('/', $path));
$absolutes = array();
foreach ($parts as $part) {
if ('.' == $part) {
continue;
}
if ('..' == $part) {
array_pop($absolutes);
} else {
$absolutes[] = $part;
}
}
return implode('/', $absolutes);
}
/**
* Supports lazy loading of feeds using Zend_Feed_Reader::import() but
* delegates any other operations to the parent class.
*
* @param string $offset
* @return mixed
* @uses Zend_Feed_Reader
*/
public function offsetGet($offset)
{
if ($offset == 'feed' && !$this->offsetExists('feed')) {
if (!$this->offsetExists('href')) {
return null;
}
$feed = Zend_Feed_Reader::import($this->offsetGet('href'));
$this->offsetSet('feed', $feed);
return $feed;
}
return parent::offsetGet($offset);
}
}