Commit d7e814a6 authored by alexpott's avatar alexpott

Issue #2401113 by kim.pepper, larowlan: Update Zend Feed to latest stable

parent f562cc9b
......@@ -4,7 +4,7 @@
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "9f93d739d3134a5fb76d650043b3ba89",
"hash": "461047a83f0f5554064bfe97e2a673fb",
"packages": [
{
"name": "doctrine/annotations",
......@@ -2440,27 +2440,27 @@
},
{
"name": "zendframework/zend-escaper",
"version": "2.2.6",
"version": "2.3.3",
"target-dir": "Zend/Escaper",
"source": {
"type": "git",
"url": "https://github.com/zendframework/Component_ZendEscaper.git",
"reference": "80abc4bc1f48b9fe8ed603aaa9eebd6e6f30fd0f"
"reference": "c24949840766a544489bfc303714e1f332341010"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/Component_ZendEscaper/zipball/80abc4bc1f48b9fe8ed603aaa9eebd6e6f30fd0f",
"reference": "80abc4bc1f48b9fe8ed603aaa9eebd6e6f30fd0f",
"url": "https://api.github.com/repos/zendframework/Component_ZendEscaper/zipball/c24949840766a544489bfc303714e1f332341010",
"reference": "c24949840766a544489bfc303714e1f332341010",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
"php": ">=5.3.23"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev",
"dev-develop": "2.3-dev"
"dev-master": "2.3-dev",
"dev-develop": "2.4-dev"
}
},
"autoload": {
......@@ -2472,33 +2472,43 @@
"license": [
"BSD-3-Clause"
],
"homepage": "https://github.com/zendframework/zf2",
"keywords": [
"escaper",
"zf2"
],
"time": "2014-01-04 13:00:13"
"time": "2014-09-16 22:58:11"
},
{
"name": "zendframework/zend-feed",
"version": "2.2.6",
"version": "2.3.3",
"target-dir": "Zend/Feed",
"source": {
"type": "git",
"url": "https://github.com/zendframework/Component_ZendFeed.git",
"reference": "8acb562d99dd0786d25c990530980d2d92b67b35"
"reference": "a89550818b56ae9607a97a63c7d2728a9eb6c6a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/Component_ZendFeed/zipball/8acb562d99dd0786d25c990530980d2d92b67b35",
"reference": "8acb562d99dd0786d25c990530980d2d92b67b35",
"url": "https://api.github.com/repos/zendframework/Component_ZendFeed/zipball/a89550818b56ae9607a97a63c7d2728a9eb6c6a9",
"reference": "a89550818b56ae9607a97a63c7d2728a9eb6c6a9",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"php": ">=5.3.23",
"zendframework/zend-escaper": "self.version",
"zendframework/zend-stdlib": "self.version"
},
"require-dev": {
"zendframework/zend-cache": "self.version",
"zendframework/zend-db": "self.version",
"zendframework/zend-http": "self.version",
"zendframework/zend-servicemanager": "self.version",
"zendframework/zend-validator": "self.version"
},
"suggest": {
"zendframework/zend-cache": "Zend\\Cache component",
"zendframework/zend-db": "Zend\\Db component",
"zendframework/zend-http": "Zend\\Http for PubSubHubbub, and optionally for use with Zend\\Feed\\Reader",
"zendframework/zend-servicemanager": "Zend\\ServiceManager component, for default/recommended ExtensionManager implementations",
"zendframework/zend-validator": "Zend\\Validator component"
......@@ -2506,8 +2516,8 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev",
"dev-develop": "2.3-dev"
"dev-master": "2.3-dev",
"dev-develop": "2.4-dev"
}
},
"autoload": {
......@@ -2520,39 +2530,46 @@
"BSD-3-Clause"
],
"description": "provides functionality for consuming RSS and Atom feeds",
"homepage": "https://github.com/zendframework/zf2",
"keywords": [
"feed",
"zf2"
],
"time": "2014-01-04 13:00:14"
"time": "2014-09-16 22:58:11"
},
{
"name": "zendframework/zend-stdlib",
"version": "2.2.6",
"version": "2.3.3",
"target-dir": "Zend/Stdlib",
"source": {
"type": "git",
"url": "https://github.com/zendframework/Component_ZendStdlib.git",
"reference": "e646729f2274f4552b6a92e38d8e458efe08ebc5"
"reference": "fa33e6647f830d0d2a1cb451efcdfe1bb9a66c33"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/Component_ZendStdlib/zipball/e646729f2274f4552b6a92e38d8e458efe08ebc5",
"reference": "e646729f2274f4552b6a92e38d8e458efe08ebc5",
"url": "https://api.github.com/repos/zendframework/Component_ZendStdlib/zipball/fa33e6647f830d0d2a1cb451efcdfe1bb9a66c33",
"reference": "fa33e6647f830d0d2a1cb451efcdfe1bb9a66c33",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
"php": ">=5.3.23"
},
"require-dev": {
"zendframework/zend-eventmanager": "self.version",
"zendframework/zend-serializer": "self.version",
"zendframework/zend-servicemanager": "self.version"
},
"suggest": {
"zendframework/zend-eventmanager": "To support aggregate hydrator usage",
"zendframework/zend-serializer": "Zend\\Serializer component",
"zendframework/zend-servicemanager": "To support hydrator plugin manager usage"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev",
"dev-develop": "2.3-dev"
"dev-master": "2.3-dev",
"dev-develop": "2.4-dev"
}
},
"autoload": {
......@@ -2564,11 +2581,12 @@
"license": [
"BSD-3-Clause"
],
"homepage": "https://github.com/zendframework/zf2",
"keywords": [
"stdlib",
"zf2"
],
"time": "2014-01-04 13:00:28"
"time": "2014-09-16 22:58:11"
}
],
"packages-dev": [],
......
......@@ -90,7 +90,7 @@ public function fetch(FeedInterface $feed) {
return FALSE;
}
$feed->source_string = $response->getBody(TRUE);
$feed->source_string = (string) $response->getBody();
$feed->setEtag($response->getHeader('ETag'));
$feed->setLastModified(strtotime($response->getHeader('Last-Modified')));
$feed->http_headers = $response->getHeaders();
......
This diff is collapsed.
# CONTRIBUTING
Please don't open pull requests against this repository, please use https://github.com/zendframework/zf2.
\ No newline at end of file
......@@ -368,7 +368,6 @@ protected function isUtf8($string)
*/
protected function convertEncoding($string, $to, $from)
{
$result = '';
if (function_exists('iconv')) {
$result = iconv($from, $to, $string);
} elseif (function_exists('mb_convert_encoding')) {
......
......@@ -6,6 +6,7 @@
"zf2",
"escaper"
],
"homepage": "https://github.com/zendframework/zf2",
"autoload": {
"psr-0": {
"Zend\\Escaper\\": ""
......@@ -13,12 +14,12 @@
},
"target-dir": "Zend/Escaper",
"require": {
"php": ">=5.3.3"
"php": ">=5.3.23"
},
"extra": {
"branch-alias": {
"dev-master": "2.2-dev",
"dev-develop": "2.3-dev"
"dev-master": "2.3-dev",
"dev-develop": "2.4-dev"
}
}
}
# CONTRIBUTING
Please don't open pull requests against this repository, please use https://github.com/zendframework/zf2.
\ No newline at end of file
......@@ -95,7 +95,7 @@ public static function getHttpClient()
/**
* Simple mechanism to delete the entire singleton HTTP Client instance
* which forces an new instantiation for subsequent requests.
* which forces a new instantiation for subsequent requests.
*
* @return void
*/
......
......@@ -24,7 +24,7 @@ class Feed extends Extension\AbstractFeed
public function getUpdatePeriod()
{
$name = 'updatePeriod';
$period = $this->_getData($name);
$period = $this->getData($name);
if ($period === null) {
$this->data[$name] = 'daily';
......@@ -52,7 +52,7 @@ public function getUpdatePeriod()
public function getUpdateFrequency()
{
$name = 'updateFrequency';
$freq = $this->_getData($name, 'number');
$freq = $this->getData($name, 'number');
if (!$freq || $freq < 1) {
$this->data[$name] = 1;
......@@ -70,7 +70,7 @@ public function getUpdateFrequency()
public function getUpdateFrequencyAsTicks()
{
$name = 'updateFrequency';
$freq = $this->_getData($name, 'number');
$freq = $this->getData($name, 'number');
if (!$freq || $freq < 1) {
$this->data[$name] = 1;
......@@ -107,7 +107,7 @@ public function getUpdateFrequencyAsTicks()
*/
public function getUpdateBase()
{
$updateBase = $this->_getData('updateBase');
$updateBase = $this->getData('updateBase');
$date = null;
if ($updateBase) {
$date = DateTime::createFromFormat(DateTime::W3C, $updateBase);
......@@ -122,7 +122,7 @@ public function getUpdateBase()
* @param string $type
* @return mixed|null
*/
private function _getData($name, $type = 'string')
private function getData($name, $type = 'string')
{
if (array_key_exists($name, $this->data)) {
return $this->data[$name];
......
......@@ -383,7 +383,6 @@ protected function indexEntries()
{
if ($this->getType() == Reader\Reader::TYPE_ATOM_10 ||
$this->getType() == Reader\Reader::TYPE_ATOM_03) {
$entries = array();
$entries = $this->xpath->evaluate('//atom:entry');
foreach ($entries as $index => $entry) {
......
......@@ -675,8 +675,6 @@ public function getCategories()
*/
protected function indexEntries()
{
$entries = array();
if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) {
$entries = $this->xpath->evaluate('//item');
} else {
......
......@@ -192,7 +192,6 @@ public static function import($uri, $etag = null, $lastModified = null)
{
$cache = self::getCache();
$feed = null;
$responseXml = '';
$client = self::getHttpClient();
$client->resetParameters();
$headers = new ZendHttp\Headers();
......@@ -266,7 +265,7 @@ public static function import($uri, $etag = null, $lastModified = null)
* HTTP client implementations.
*
* @param string $uri
* @param Http\Client $client
* @param Http\ClientInterface $client
* @return self
* @throws Exception\RuntimeException if response is not an Http\ResponseInterface
*/
......@@ -299,6 +298,11 @@ public static function importRemoteFeed($uri, Http\ClientInterface $client)
*/
public static function importString($string)
{
$trimmed = trim($string);
if (!is_string($string) || empty($trimmed)) {
throw new Exception\InvalidArgumentException('Only non empty strings are allowed as input');
}
$libxmlErrflag = libxml_use_internal_errors(true);
$oldValue = libxml_disable_entity_loader(true);
$dom = new DOMDocument;
......
......@@ -287,7 +287,6 @@ protected function _validateTagUri($id)
{
if (preg_match('/^tag:(?P<name>.*),(?P<date>\d{4}-?\d{0,2}-?\d{0,2}):(?P<specific>.*)(.*:)*$/', $id, $matches)) {
$dvalid = false;
$nvalid = false;
$date = $matches['date'];
$d6 = strtotime($date);
if ((strlen($date) == 4) && $date <= date('Y')) {
......
......@@ -530,7 +530,7 @@ public function getCommentFeedLinks()
}
/**
* Add a entry category
* Add an entry category
*
* @param array $category
* @throws Exception\InvalidArgumentException
......
......@@ -60,7 +60,7 @@ public function __call($method, $args)
* Get the named extension
*
* @param string $name
* @return Extension\AbstractEntry|Extension\AbstractFeed
* @return Extension\AbstractRenderer
*/
public function get($name)
{
......
......@@ -291,7 +291,6 @@ protected function _validateTagUri($id)
{
if (preg_match('/^tag:(?P<name>.*),(?P<date>\d{4}-?\d{0,2}-?\d{0,2}):(?P<specific>.*)(.*:)*$/', $id, $matches)) {
$dvalid = false;
$nvalid = false;
$date = $matches['date'];
$d6 = strtotime($date);
if ((strlen($date) == 4) && $date <= date('Y')) {
......@@ -353,7 +352,6 @@ protected function _setContent(DOMDocument $dom, DOMElement $root)
*/
protected function _loadXhtml($content)
{
$xhtml = '';
if (class_exists('tidy', false)) {
$tidy = new \tidy;
$config = array(
......
......@@ -6,6 +6,7 @@
"zf2",
"feed"
],
"homepage": "https://github.com/zendframework/zf2",
"autoload": {
"psr-0": {
"Zend\\Feed\\": ""
......@@ -13,19 +14,28 @@
},
"target-dir": "Zend/Feed",
"require": {
"php": ">=5.3.3",
"php": ">=5.3.23",
"zendframework/zend-escaper": "self.version",
"zendframework/zend-stdlib": "self.version"
},
"require-dev": {
"zendframework/zend-db": "self.version",
"zendframework/zend-cache": "self.version",
"zendframework/zend-http": "self.version",
"zendframework/zend-servicemanager": "self.version",
"zendframework/zend-validator": "self.version"
},
"suggest": {
"zendframework/zend-cache": "Zend\\Cache component",
"zendframework/zend-db": "Zend\\Db component",
"zendframework/zend-http": "Zend\\Http for PubSubHubbub, and optionally for use with Zend\\Feed\\Reader",
"zendframework/zend-servicemanager": "Zend\\ServiceManager component, for default/recommended ExtensionManager implementations",
"zendframework/zend-validator": "Zend\\Validator component"
},
"extra": {
"branch-alias": {
"dev-master": "2.2-dev",
"dev-develop": "2.3-dev"
"dev-master": "2.3-dev",
"dev-develop": "2.4-dev"
}
}
}
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace Zend\Stdlib\ArrayObject;
use ArrayAccess;
use Countable;
use IteratorAggregate;
use Serializable;
use Zend\Stdlib\Exception;
/**
* ArrayObject
*
* This ArrayObject is a rewrite of the implementation to fix
* issues with php's implementation of ArrayObject where you
* are unable to unset multi-dimensional arrays because you
* need to fetch the properties / lists as references.
*/
abstract class PhpReferenceCompatibility implements IteratorAggregate, ArrayAccess, Serializable, Countable
{
/**
* Properties of the object have their normal functionality
* when accessed as list (var_dump, foreach, etc.).
*/
const STD_PROP_LIST = 1;
/**
* Entries can be accessed as properties (read and write).
*/
const ARRAY_AS_PROPS = 2;
/**
* @var array
*/
protected $storage;
/**
* @var int
*/
protected $flag;
/**
* @var string
*/
protected $iteratorClass;
/**
* @var array
*/
protected $protectedProperties;
/**
* Constructor
*
* @param array $input
* @param int $flags
* @param string $iteratorClass
*/
public function __construct($input = array(), $flags = self::STD_PROP_LIST, $iteratorClass = 'ArrayIterator')
{
$this->setFlags($flags);
$this->storage = $input;
$this->setIteratorClass($iteratorClass);
$this->protectedProperties = array_keys(get_object_vars($this));
}
/**
* Returns whether the requested key exists
*
* @param mixed $key
* @return bool
*/
public function __isset($key)
{
if ($this->flag == self::ARRAY_AS_PROPS) {
return $this->offsetExists($key);
}
if (in_array($key, $this->protectedProperties)) {
throw new Exception\InvalidArgumentException('$key is a protected property, use a different key');
}
return isset($this->$key);
}
/**
* Sets the value at the specified key to value
*
* @param mixed $key
* @param mixed $value
* @return void
*/
public function __set($key, $value)
{
if ($this->flag == self::ARRAY_AS_PROPS) {
return $this->offsetSet($key, $value);
}
if (in_array($key, $this->protectedProperties)) {
throw new Exception\InvalidArgumentException('$key is a protected property, use a different key');
}
$this->$key = $value;
}
/**
* Unsets the value at the specified key
*
* @param mixed $key
* @return void
*/
public function __unset($key)
{
if ($this->flag == self::ARRAY_AS_PROPS) {
return $this->offsetUnset($key);
}
if (in_array($key, $this->protectedProperties)) {
throw new Exception\InvalidArgumentException('$key is a protected property, use a different key');
}
unset($this->$key);
}
/**
* Returns the value at the specified key by reference
*
* @param mixed $key
* @return mixed
*/
public function &__get($key)
{
$ret = null;
if ($this->flag == self::ARRAY_AS_PROPS) {
$ret =& $this->offsetGet($key);
return $ret;
}
if (in_array($key, $this->protectedProperties)) {
throw new Exception\InvalidArgumentException('$key is a protected property, use a different key');
}
return $this->$key;
}
/**
* Appends the value
*
* @param mixed $value
* @return void
*/
public function append($value)
{
$this->storage[] = $value;
}
/**
* Sort the entries by value
*
* @return void
*/
public function asort()
{
asort($this->storage);
}
/**
* Get the number of public properties in the ArrayObject
*
* @return int
*/
public function count()
{
return count($this->storage);
}
/**
* Exchange the array for another one.
*
* @param array|ArrayObject $data
* @return array
*/
public function exchangeArray($data)
{
if (!is_array($data) && !is_object($data)) {
throw new Exception\InvalidArgumentException('Passed variable is not an array or object, using empty array instead');
}
if (is_object($data) && ($data instanceof self || $data instanceof \ArrayObject)) {
$data = $data->getArrayCopy();
}
if (!is_array($data)) {
$data = (array) $data;
}
$storage = $this->storage;
$this->storage = $data;
return $storage;
}
/**
* Creates a copy of the ArrayObject.
*
* @return array
*/
public function getArrayCopy()
{
return $this->storage;
}
/**
* Gets the behavior flags.
*
* @return int
*/
public function getFlags()
{
return $this->flag;
}
/**
* Create a new iterator from an ArrayObject instance
*
* @return \Iterator
*/
public function getIterator()
{
$class = $this->iteratorClass;
return new $class($this->storage);
}
/**
* Gets the iterator classname for the ArrayObject.
*
* @return string
*/
public function getIteratorClass()
{
return $this->iteratorClass;
}
/**
* Sort the entries by key
*
* @return void
*/
public function ksort()
{
ksort($this->storage);
}
/**
* Sort an array using a case insensitive "natural order" algorithm
*
* @return void
*/
public function natcasesort()
{
natcasesort($this->storage);
}
/**
* Sort entries using a "natural order" algorithm
*
* @return void
*/
public function natsort()
{