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:
@ -17,7 +17,7 @@
|
||||
* @package Zend_Feed
|
||||
* @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: Abstract.php 16205 2009-06-21 19:08:45Z thomas $
|
||||
* @version $Id: Abstract.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ require_once 'Zend/Feed/Element.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
|
||||
*/
|
||||
abstract class Zend_Feed_Abstract extends Zend_Feed_Element implements Iterator
|
||||
abstract class Zend_Feed_Abstract extends Zend_Feed_Element implements Iterator, Countable
|
||||
{
|
||||
/**
|
||||
* Current index on the collection of feed entries for the
|
||||
@ -77,7 +77,7 @@ abstract class Zend_Feed_Abstract extends Zend_Feed_Element implements Iterator
|
||||
$client->setUri($uri);
|
||||
$response = $client->request('GET');
|
||||
if ($response->getStatus() !== 200) {
|
||||
/**
|
||||
/**
|
||||
* @see Zend_Feed_Exception
|
||||
*/
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
@ -123,8 +123,8 @@ abstract class Zend_Feed_Abstract extends Zend_Feed_Element implements Iterator
|
||||
$php_errormsg = '(error message not available)';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* @see Zend_Feed_Exception
|
||||
*/
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @package Zend_Feed
|
||||
* @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 16205 2009-06-21 19:08:45Z thomas $
|
||||
* @version $Id: Atom.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@ class Zend_Feed_Atom extends Zend_Feed_Abstract
|
||||
// Try to find a single <entry> instead.
|
||||
$element = $this->_element->getElementsByTagName($this->_entryElementName)->item(0);
|
||||
if (!$element) {
|
||||
/**
|
||||
/**
|
||||
* @see Zend_Feed_Exception
|
||||
*/
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
@ -376,7 +376,7 @@ class Zend_Feed_Atom extends Zend_Feed_Abstract
|
||||
public function send()
|
||||
{
|
||||
if (headers_sent()) {
|
||||
/**
|
||||
/**
|
||||
* @see Zend_Feed_Exception
|
||||
*/
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @package Zend_Feed
|
||||
* @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: Builder.php 16205 2009-06-21 19:08:45Z thomas $
|
||||
* @version $Id: Builder.php 19055 2009-11-19 19:45:10Z padraic $
|
||||
*/
|
||||
|
||||
|
||||
@ -212,7 +212,7 @@ class Zend_Feed_Builder implements Zend_Feed_Builder_Interface
|
||||
* @throws Zend_Feed_Builder_Exception
|
||||
* @return void
|
||||
*/
|
||||
private function _createHeader(array $data)
|
||||
protected function _createHeader(array $data)
|
||||
{
|
||||
$mandatories = array('title', 'link', 'charset');
|
||||
foreach ($mandatories as $mandatory) {
|
||||
@ -340,7 +340,7 @@ class Zend_Feed_Builder implements Zend_Feed_Builder_Interface
|
||||
* @throws Zend_Feed_Builder_Exception
|
||||
* @return void
|
||||
*/
|
||||
private function _createEntries(array $data)
|
||||
protected function _createEntries(array $data)
|
||||
{
|
||||
foreach ($data as $row) {
|
||||
$mandatories = array('title', 'link', 'description');
|
||||
@ -395,4 +395,4 @@ class Zend_Feed_Builder implements Zend_Feed_Builder_Interface
|
||||
$this->_entries[] = $entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @package Zend_Feed
|
||||
* @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: Itunes.php 16205 2009-06-21 19:08:45Z thomas $
|
||||
* @version $Id: Itunes.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -112,10 +112,10 @@ class Zend_Feed_Builder_Header_Itunes extends ArrayObject
|
||||
public function setOwner($name = '', $email = '')
|
||||
{
|
||||
if (!empty($email)) {
|
||||
/**
|
||||
* @see Zend_Validate_EmailAddress
|
||||
*/
|
||||
require_once 'Zend/Validate/EmailAddress.php';
|
||||
/**
|
||||
* @see Zend_Validate_EmailAddress
|
||||
*/
|
||||
require_once 'Zend/Validate/EmailAddress.php';
|
||||
$validate = new Zend_Validate_EmailAddress();
|
||||
if (!$validate->isValid($email)) {
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @package Zend_Feed
|
||||
* @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: Element.php 16205 2009-06-21 19:08:45Z thomas $
|
||||
* @version $Id: Element.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -204,14 +204,16 @@ class Zend_Feed_Element implements ArrayAccess
|
||||
if (!$nodes) {
|
||||
if (strpos($var, ':') !== false) {
|
||||
list($ns, $elt) = explode(':', $var, 2);
|
||||
$node = $this->_element->ownerDocument->createElementNS(Zend_Feed::lookupNamespace($ns), $var, $val);
|
||||
$node = $this->_element->ownerDocument->createElementNS(Zend_Feed::lookupNamespace($ns),
|
||||
$var, htmlspecialchars($val, ENT_NOQUOTES, 'UTF-8'));
|
||||
$this->_element->appendChild($node);
|
||||
} else {
|
||||
$node = $this->_element->ownerDocument->createElement($var, $val);
|
||||
$node = $this->_element->ownerDocument->createElement($var,
|
||||
htmlspecialchars($val, ENT_NOQUOTES, 'UTF-8'));
|
||||
$this->_element->appendChild($node);
|
||||
}
|
||||
} elseif (count($nodes) > 1) {
|
||||
/**
|
||||
/**
|
||||
* @see Zend_Feed_Exception
|
||||
*/
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
@ -382,7 +384,8 @@ class Zend_Feed_Element implements ArrayAccess
|
||||
|
||||
if (strpos($offset, ':') !== false) {
|
||||
list($ns, $attr) = explode(':', $offset, 2);
|
||||
return $this->_element->setAttributeNS(Zend_Feed::lookupNamespace($ns), $attr, $value);
|
||||
// DOMElement::setAttributeNS() requires $qualifiedName to have a prefix
|
||||
return $this->_element->setAttributeNS(Zend_Feed::lookupNamespace($ns), $offset, $value);
|
||||
} else {
|
||||
return $this->_element->setAttribute($offset, $value);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @package Zend_Feed
|
||||
* @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: Abstract.php 16205 2009-06-21 19:08:45Z thomas $
|
||||
* @version $Id: Abstract.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ abstract class Zend_Feed_Entry_Abstract extends Zend_Feed_Element
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @see Zend_Feed_Exception
|
||||
*/
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
@ -102,7 +102,7 @@ abstract class Zend_Feed_Entry_Abstract extends Zend_Feed_Element
|
||||
|
||||
$element = $doc->getElementsByTagName($this->_rootElement)->item(0);
|
||||
if (!$element) {
|
||||
/**
|
||||
/**
|
||||
* @see Zend_Feed_Exception
|
||||
*/
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @package Zend_Feed
|
||||
* @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 16205 2009-06-21 19:08:45Z thomas $
|
||||
* @version $Id: Atom.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -37,10 +37,10 @@ require_once 'Zend/Feed/Entry/Abstract.php';
|
||||
*/
|
||||
class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
|
||||
{
|
||||
/**
|
||||
* Content-Type
|
||||
*/
|
||||
const CONTENT_TYPE = 'application/atom+xml';
|
||||
/**
|
||||
* Content-Type
|
||||
*/
|
||||
const CONTENT_TYPE = 'application/atom+xml';
|
||||
|
||||
/**
|
||||
* Root XML element for Atom entries.
|
||||
@ -267,7 +267,7 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
|
||||
|
||||
foreach ($links as $link) {
|
||||
if (empty($link['rel'])) {
|
||||
continue;
|
||||
$link['rel'] = 'alternate'; // see Atom 1.0 spec
|
||||
}
|
||||
if ($rel == $link['rel']) {
|
||||
return $link['href'];
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @package Zend_Feed
|
||||
* @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 16205 2009-06-21 19:08:45Z thomas $
|
||||
* @version $Id: Rss.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -98,7 +98,7 @@ class Zend_Feed_Entry_Rss extends Zend_Feed_Entry_Abstract
|
||||
return parent::__isset($var);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Overwrites parent::_call method to enable read access
|
||||
* to content:encoded element.
|
||||
|
@ -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: Reader.php 17391 2009-08-05 11:27:52Z padraic $
|
||||
* @version $Id: Reader.php 19120 2009-11-20 17:58:59Z padraic $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -34,6 +34,11 @@ require_once 'Zend/Feed/Reader/Feed/Rss.php';
|
||||
*/
|
||||
require_once 'Zend/Feed/Reader/Feed/Atom.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Feed_Reader_FeedSet
|
||||
*/
|
||||
require_once 'Zend/Feed/Reader/FeedSet.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Feed_Reader
|
||||
@ -42,20 +47,20 @@ require_once 'Zend/Feed/Reader/Feed/Atom.php';
|
||||
*/
|
||||
class Zend_Feed_Reader
|
||||
{
|
||||
/**
|
||||
* Namespace constants
|
||||
*/
|
||||
const NAMESPACE_ATOM_03 = 'http://purl.org/atom/ns#';
|
||||
/**
|
||||
* Namespace constants
|
||||
*/
|
||||
const NAMESPACE_ATOM_03 = 'http://purl.org/atom/ns#';
|
||||
const NAMESPACE_ATOM_10 = 'http://www.w3.org/2005/Atom';
|
||||
const NAMESPACE_RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
|
||||
const NAMESPACE_RSS_090 = 'http://my.netscape.com/rdf/simple/0.9/';
|
||||
const NAMESPACE_RSS_10 = 'http://purl.org/rss/1.0/';
|
||||
|
||||
/**
|
||||
* Feed type constants
|
||||
*/
|
||||
const TYPE_ANY = 'any';
|
||||
const TYPE_ATOM_03 = 'atom-03';
|
||||
* Feed type constants
|
||||
*/
|
||||
const TYPE_ANY = 'any';
|
||||
const TYPE_ATOM_03 = 'atom-03';
|
||||
const TYPE_ATOM_10 = 'atom-10';
|
||||
const TYPE_ATOM_ANY = 'atom';
|
||||
const TYPE_RSS_090 = 'rss-090';
|
||||
@ -208,13 +213,13 @@ class Zend_Feed_Reader
|
||||
}
|
||||
|
||||
/**
|
||||
* Import a feed by providing a URL
|
||||
*
|
||||
* @param string $url The URL to the feed
|
||||
* Import a feed by providing a URL
|
||||
*
|
||||
* @param string $url The URL to the feed
|
||||
* @param string $etag OPTIONAL Last received ETag for this resource
|
||||
* @param string $lastModified OPTIONAL Last-Modified value for this resource
|
||||
* @return Zend_Feed_Reader_Feed_Interface
|
||||
*/
|
||||
* @return Zend_Feed_Reader_FeedInterface
|
||||
*/
|
||||
public static function import($uri, $etag = null, $lastModified = null)
|
||||
{
|
||||
$cache = self::getCache();
|
||||
@ -288,8 +293,8 @@ class Zend_Feed_Reader
|
||||
* Import a feed by providing a Zend_Feed_Abstract object
|
||||
*
|
||||
* @param Zend_Feed_Abstract $feed A fully instantiated Zend_Feed object
|
||||
* @return Zend_Feed_Reader_Feed_Interface
|
||||
*/
|
||||
* @return Zend_Feed_Reader_FeedInterface
|
||||
*/
|
||||
public static function importFeed(Zend_Feed_Abstract $feed)
|
||||
{
|
||||
$dom = $feed->getDOM()->ownerDocument;
|
||||
@ -298,7 +303,7 @@ class Zend_Feed_Reader
|
||||
if (substr($type, 0, 3) == 'rss') {
|
||||
$reader = new Zend_Feed_Reader_Feed_Rss($dom, $type);
|
||||
} else {
|
||||
$reader = new Zend_Feed_Reader_Feed_Atom($dom, $type);
|
||||
$reader = new Zend_Feed_Reader_Feed_Atom($dom, $type);
|
||||
}
|
||||
|
||||
return $reader;
|
||||
@ -308,7 +313,7 @@ class Zend_Feed_Reader
|
||||
* Import a feed froma string
|
||||
*
|
||||
* @param string $string
|
||||
* @return Zend_Feed_Reader_Feed_Interface
|
||||
* @return Zend_Feed_Reader_FeedInterface
|
||||
*/
|
||||
public static function importString($string)
|
||||
{
|
||||
@ -321,9 +326,9 @@ class Zend_Feed_Reader
|
||||
// Build error message
|
||||
$error = libxml_get_last_error();
|
||||
if ($error && $error->message) {
|
||||
$errormsg = "DOMDocument cannot parse XML: {$error->message}";
|
||||
$errormsg = "DOMDocument cannot parse XML: {$error->message}";
|
||||
} else {
|
||||
$errormsg = "DOMDocument cannot parse XML: Please check the XML document's validity";
|
||||
$errormsg = "DOMDocument cannot parse XML: Please check the XML document's validity";
|
||||
}
|
||||
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
@ -336,8 +341,12 @@ class Zend_Feed_Reader
|
||||
|
||||
if (substr($type, 0, 3) == 'rss') {
|
||||
$reader = new Zend_Feed_Reader_Feed_Rss($dom, $type);
|
||||
} elseif (substr($type, 0, 4) == 'atom') {
|
||||
$reader = new Zend_Feed_Reader_Feed_Atom($dom, $type);
|
||||
} else {
|
||||
$reader = new Zend_Feed_Reader_Feed_Atom($dom, $type);
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
throw new Zend_Feed_Exception('The URI used does not point to a '
|
||||
. 'valid Atom, RSS or RDF feed that Zend_Feed_Reader can parse.');
|
||||
}
|
||||
return $reader;
|
||||
}
|
||||
@ -378,40 +387,26 @@ class Zend_Feed_Reader
|
||||
throw new Zend_Feed_Exception("Failed to access $uri, got response code " . $response->getStatus());
|
||||
}
|
||||
$responseHtml = $response->getBody();
|
||||
@ini_set('track_errors', 1);
|
||||
$libxml_errflag = libxml_use_internal_errors(true);
|
||||
$dom = new DOMDocument;
|
||||
$status = @$dom->loadHTML($responseHtml);
|
||||
@ini_restore('track_errors');
|
||||
$status = $dom->loadHTML($responseHtml);
|
||||
libxml_use_internal_errors($libxml_errflag);
|
||||
if (!$status) {
|
||||
if (!isset($php_errormsg)) {
|
||||
if (function_exists('xdebug_is_enabled')) {
|
||||
$php_errormsg = '(error message not available, when XDebug is running)';
|
||||
} else {
|
||||
$php_errormsg = '(error message not available)';
|
||||
}
|
||||
// Build error message
|
||||
$error = libxml_get_last_error();
|
||||
if ($error && $error->message) {
|
||||
$errormsg = "DOMDocument cannot parse HTML: {$error->message}";
|
||||
} else {
|
||||
$errormsg = "DOMDocument cannot parse HTML: Please check the XML document's validity";
|
||||
}
|
||||
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg");
|
||||
throw new Zend_Feed_Exception($errormsg);
|
||||
}
|
||||
$feedLinks = new stdClass;
|
||||
$feedSet = new Zend_Feed_Reader_FeedSet;
|
||||
$links = $dom->getElementsByTagName('link');
|
||||
foreach ($links as $link) {
|
||||
if (strtolower($link->getAttribute('rel')) !== 'alternate'
|
||||
|| !$link->getAttribute('type') || !$link->getAttribute('href')) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($feedLinks->rss) && $link->getAttribute('type') == 'application/rss+xml') {
|
||||
$feedLinks->rss = $link->getAttribute('href');
|
||||
} elseif(!isset($feedLinks->atom) && $link->getAttribute('type') == 'application/atom+xml') {
|
||||
$feedLinks->atom = $link->getAttribute('href');
|
||||
} elseif(!isset($feedLinks->rdf) && $link->getAttribute('type') == 'application/rdf+xml') {
|
||||
$feedLinks->rdf = $link->getAttribute('href');
|
||||
}
|
||||
if (isset($feedLinks->rss) && isset($feedLinks->atom) && isset($feedLinks->rdf)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $feedLinks;
|
||||
$feedSet->addLinks($links, $uri);
|
||||
return $feedSet;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
|
@ -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'];
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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
|
||||
|
@ -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)');
|
||||
|
@ -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
|
||||
{
|
||||
/**
|
||||
|
@ -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];
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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
|
||||
{
|
||||
/**
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
{
|
||||
/**
|
||||
|
@ -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
|
||||
*
|
||||
*/
|
||||
|
@ -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
|
||||
*
|
||||
*/
|
||||
|
@ -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
|
||||
*
|
||||
*/
|
||||
|
148
libs/Zend/Feed/Reader/FeedSet.php
Normal file
148
libs/Zend/Feed/Reader/FeedSet.php
Normal 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);
|
||||
}
|
||||
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
* @package Zend_Feed
|
||||
* @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 16205 2009-06-21 19:08:45Z thomas $
|
||||
* @version $Id: Rss.php 19133 2009-11-20 19:44:09Z padraic $
|
||||
*/
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@ class Zend_Feed_Rss extends Zend_Feed_Abstract
|
||||
// Find the base channel element and create an alias to it.
|
||||
$rdfTags = $this->_element->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'RDF');
|
||||
if ($rdfTags->length != 0) {
|
||||
$this->_element = $rdfTags->item(0);
|
||||
$this->_element = $rdfTags->item(0);
|
||||
} else {
|
||||
$this->_element = $this->_element->getElementsByTagName('channel')->item(0);
|
||||
}
|
||||
@ -147,11 +147,11 @@ class Zend_Feed_Rss extends Zend_Feed_Abstract
|
||||
$channel->appendChild($description);
|
||||
|
||||
$pubdate = isset($array->lastUpdate) ? $array->lastUpdate : time();
|
||||
$pubdate = $this->_element->createElement('pubDate', gmdate('r', $pubdate));
|
||||
$pubdate = $this->_element->createElement('pubDate', date(DATE_RSS, $pubdate));
|
||||
$channel->appendChild($pubdate);
|
||||
|
||||
if (isset($array->published)) {
|
||||
$lastBuildDate = $this->_element->createElement('lastBuildDate', gmdate('r', $array->published));
|
||||
$lastBuildDate = $this->_element->createElement('lastBuildDate', date(DATE_RSS, $array->published));
|
||||
$channel->appendChild($lastBuildDate);
|
||||
}
|
||||
|
||||
@ -411,6 +411,9 @@ class Zend_Feed_Rss extends Zend_Feed_Abstract
|
||||
|
||||
if (isset($dataentry->guid)) {
|
||||
$guid = $this->_element->createElement('guid', $dataentry->guid);
|
||||
if (!Zend_Uri::check($dataentry->guid)) {
|
||||
$guid->setAttribute('isPermaLink', 'false');
|
||||
}
|
||||
$item->appendChild($guid);
|
||||
}
|
||||
|
||||
@ -425,7 +428,7 @@ class Zend_Feed_Rss extends Zend_Feed_Abstract
|
||||
}
|
||||
|
||||
$pubdate = isset($dataentry->lastUpdate) ? $dataentry->lastUpdate : time();
|
||||
$pubdate = $this->_element->createElement('pubDate', gmdate('r', $pubdate));
|
||||
$pubdate = $this->_element->createElement('pubDate', date(DATE_RSS, $pubdate));
|
||||
$item->appendChild($pubdate);
|
||||
|
||||
if (isset($dataentry->category)) {
|
||||
|
Reference in New Issue
Block a user