import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -17,7 +17,7 @@
|
||||
* @package Zend_Feed
|
||||
* @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: Builder.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
* @version $Id: Builder.php 15382 2009-05-07 13:28:14Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -354,6 +354,9 @@ class Zend_Feed_Builder implements Zend_Feed_Builder_Interface
|
||||
}
|
||||
}
|
||||
$entry = new Zend_Feed_Builder_Entry($row['title'], $row['link'], $row['description']);
|
||||
if (isset($row['author'])) {
|
||||
$entry->setAuthor($row['author']);
|
||||
}
|
||||
if (isset($row['guid'])) {
|
||||
$entry->setId($row['guid']);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @package Zend_Feed
|
||||
* @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: Entry.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
* @version $Id: Entry.php 15382 2009-05-07 13:28:14Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -101,6 +101,18 @@ class Zend_Feed_Builder_Entry extends ArrayObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the author of the entry
|
||||
*
|
||||
* @param string $author
|
||||
* @return Zend_Feed_Builder_Entry
|
||||
*/
|
||||
public function setAuthor($author)
|
||||
{
|
||||
$this->offsetSet('author', $author);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the id/guid of the entry
|
||||
*
|
||||
|
@ -17,15 +17,9 @@
|
||||
* @package Zend_Feed
|
||||
* @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: Header.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
* @version $Id: Header.php 13891 2009-01-31 11:41:00Z yoshida@zend.co.jp $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Loader
|
||||
*/
|
||||
require_once 'Zend/Loader.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Feed_Builder_Header_Itunes
|
||||
*/
|
||||
@ -175,7 +169,10 @@ class Zend_Feed_Builder_Header extends ArrayObject
|
||||
*/
|
||||
public function setEmail($email)
|
||||
{
|
||||
Zend_Loader::loadClass('Zend_Validate_EmailAddress');
|
||||
/**
|
||||
* @see Zend_Validate_EmailAddress
|
||||
*/
|
||||
require_once 'Zend/Validate/EmailAddress.php';
|
||||
$validate = new Zend_Validate_EmailAddress();
|
||||
if (!$validate->isValid($email)) {
|
||||
/**
|
||||
@ -246,7 +243,10 @@ class Zend_Feed_Builder_Header extends ArrayObject
|
||||
*/
|
||||
public function setWebmaster($webmaster)
|
||||
{
|
||||
Zend_Loader::loadClass('Zend_Validate_EmailAddress');
|
||||
/**
|
||||
* @see Zend_Validate_EmailAddress
|
||||
*/
|
||||
require_once 'Zend/Validate/EmailAddress.php';
|
||||
$validate = new Zend_Validate_EmailAddress();
|
||||
if (!$validate->isValid($webmaster)) {
|
||||
/**
|
||||
@ -269,7 +269,10 @@ class Zend_Feed_Builder_Header extends ArrayObject
|
||||
*/
|
||||
public function setTtl($ttl)
|
||||
{
|
||||
Zend_Loader::loadClass('Zend_Validate_Int');
|
||||
/**
|
||||
* @see Zend_Validate_Int
|
||||
*/
|
||||
require_once 'Zend/Validate/Int.php';
|
||||
$validate = new Zend_Validate_Int();
|
||||
if (!$validate->isValid($ttl)) {
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @package Zend_Feed
|
||||
* @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: Itunes.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
* @version $Id: Itunes.php 13891 2009-01-31 11:41:00Z yoshida@zend.co.jp $
|
||||
*/
|
||||
|
||||
|
||||
@ -112,7 +112,10 @@ class Zend_Feed_Builder_Header_Itunes extends ArrayObject
|
||||
public function setOwner($name = '', $email = '')
|
||||
{
|
||||
if (!empty($email)) {
|
||||
Zend_Loader::loadClass('Zend_Validate_EmailAddress');
|
||||
/**
|
||||
* @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-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Atom.php 10383 2008-07-24 19:46:15Z matthew $
|
||||
* @version $Id: Atom.php 13890 2009-01-31 10:10:30Z yoshida@zend.co.jp $
|
||||
*/
|
||||
|
||||
|
||||
@ -37,6 +37,11 @@ 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';
|
||||
|
||||
/**
|
||||
* Root XML element for Atom entries.
|
||||
*
|
||||
@ -71,7 +76,7 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
|
||||
// Look for link rel="edit" in the entry object.
|
||||
$deleteUri = $this->link('edit');
|
||||
if (!$deleteUri) {
|
||||
/**
|
||||
/**
|
||||
* @see Zend_Feed_Exception
|
||||
*/
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
@ -99,7 +104,7 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
|
||||
continue;
|
||||
// Error
|
||||
default:
|
||||
/**
|
||||
/**
|
||||
* @see Zend_Feed_Exception
|
||||
*/
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
@ -136,7 +141,7 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
|
||||
// entry object and PUT.
|
||||
$editUri = $this->link('edit');
|
||||
if (!$editUri) {
|
||||
/**
|
||||
/**
|
||||
* @see Zend_Feed_Exception
|
||||
*/
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
@ -147,16 +152,16 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
|
||||
$client->setUri($editUri);
|
||||
if (Zend_Feed::getHttpMethodOverride()) {
|
||||
$client->setHeaders(array('X-HTTP-Method-Override: PUT',
|
||||
'Content-Type: application/atom+xml'));
|
||||
'Content-Type: ' . self::CONTENT_TYPE));
|
||||
$client->setRawData($this->saveXML());
|
||||
$response = $client->request('POST');
|
||||
} else {
|
||||
$client->setHeaders('Content-Type', 'application/atom+xml');
|
||||
$client->setHeaders('Content-Type', self::CONTENT_TYPE);
|
||||
$client->setRawData($this->saveXML());
|
||||
$response = $client->request('PUT');
|
||||
}
|
||||
if ($response->getStatus() !== 200) {
|
||||
/**
|
||||
/**
|
||||
* @see Zend_Feed_Exception
|
||||
*/
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
@ -164,7 +169,7 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
|
||||
}
|
||||
} else {
|
||||
if ($postUri === null) {
|
||||
/**
|
||||
/**
|
||||
* @see Zend_Feed_Exception
|
||||
*/
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
@ -172,11 +177,12 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
|
||||
}
|
||||
$client = Zend_Feed::getHttpClient();
|
||||
$client->setUri($postUri);
|
||||
$client->setHeaders('Content-Type', self::CONTENT_TYPE);
|
||||
$client->setRawData($this->saveXML());
|
||||
$response = $client->request('POST');
|
||||
|
||||
if ($response->getStatus() !== 201) {
|
||||
/**
|
||||
/**
|
||||
* @see Zend_Feed_Exception
|
||||
*/
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
@ -201,7 +207,7 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @see Zend_Feed_Exception
|
||||
*/
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
@ -210,7 +216,7 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
|
||||
|
||||
$newEntry = $newEntry->getElementsByTagName($this->_rootElement)->item(0);
|
||||
if (!$newEntry) {
|
||||
/**
|
||||
/**
|
||||
* @see Zend_Feed_Exception
|
||||
*/
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @package Zend_Feed
|
||||
* @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 11654 2008-10-03 16:03:35Z yoshida@zend.co.jp $
|
||||
* @version $Id: Rss.php 15382 2009-05-07 13:28:14Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -80,9 +80,14 @@ class Zend_Feed_Rss extends Zend_Feed_Abstract
|
||||
parent::__wakeup();
|
||||
|
||||
// Find the base channel element and create an alias to it.
|
||||
$this->_element = $this->_element->getElementsByTagName('channel')->item(0);
|
||||
$rdfTags = $this->_element->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'RDF');
|
||||
if ($rdfTags->length != 0) {
|
||||
$this->_element = $rdfTags->item(0);
|
||||
} else {
|
||||
$this->_element = $this->_element->getElementsByTagName('channel')->item(0);
|
||||
}
|
||||
if (!$this->_element) {
|
||||
/**
|
||||
/**
|
||||
* @see Zend_Feed_Exception
|
||||
*/
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
@ -147,6 +152,7 @@ class Zend_Feed_Rss extends Zend_Feed_Abstract
|
||||
|
||||
if (isset($array->published)) {
|
||||
$lastBuildDate = $this->_element->createElement('lastBuildDate', gmdate('r', $array->published));
|
||||
$channel->appendChild($lastBuildDate);
|
||||
}
|
||||
|
||||
$editor = '';
|
||||
@ -169,11 +175,17 @@ class Zend_Feed_Rss extends Zend_Feed_Abstract
|
||||
$channel->appendChild($copyright);
|
||||
}
|
||||
|
||||
if (isset($array->category)) {
|
||||
$category = $this->_element->createElement('category', $array->category);
|
||||
$channel->appendChild($category);
|
||||
}
|
||||
|
||||
if (!empty($array->image)) {
|
||||
$image = $this->_element->createElement('image');
|
||||
$url = $this->_element->createElement('url', $array->image);
|
||||
$image->appendChild($url);
|
||||
$imagetitle = $this->_element->createElement('title', $array->title);
|
||||
$imagetitle = $this->_element->createElement('title');
|
||||
$imagetitle->appendChild($this->_element->createCDATASection($array->title));
|
||||
$image->appendChild($imagetitle);
|
||||
$imagelink = $this->_element->createElement('link', $array->link);
|
||||
$image->appendChild($imagelink);
|
||||
@ -203,6 +215,11 @@ class Zend_Feed_Rss extends Zend_Feed_Abstract
|
||||
$channel->appendChild($cloud);
|
||||
}
|
||||
|
||||
if (isset($array->ttl)) {
|
||||
$ttl = $this->_element->createElement('ttl', $array->ttl);
|
||||
$channel->appendChild($ttl);
|
||||
}
|
||||
|
||||
if (isset($array->rating)) {
|
||||
$rating = $this->_element->createElement('rating', $array->rating);
|
||||
$channel->appendChild($rating);
|
||||
@ -384,6 +401,11 @@ class Zend_Feed_Rss extends Zend_Feed_Abstract
|
||||
$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);
|
||||
|
||||
@ -489,7 +511,7 @@ class Zend_Feed_Rss extends Zend_Feed_Abstract
|
||||
public function send()
|
||||
{
|
||||
if (headers_sent()) {
|
||||
/**
|
||||
/**
|
||||
* @see Zend_Feed_Exception
|
||||
*/
|
||||
require_once 'Zend/Feed/Exception.php';
|
||||
|
Reference in New Issue
Block a user