From e9a268085af7215d4269a283998905b1543b2adc Mon Sep 17 00:00:00 2001 From: thomas Date: Tue, 28 Apr 2009 10:23:49 +0000 Subject: [PATCH 001/238] [DOCUMENTATION] English: - fixed title tags git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@15234 44c647ce-9c0f-0410-b52a-842ac1e357ba --- .coveralls.yml | 3 + .gitattributes | 6 + .gitignore | 14 + .php_cs | 43 ++ .travis.yml | 35 ++ CONTRIBUTING.md | 229 ++++++++ LICENSE.txt | 27 + README.md | 10 + composer.json | 48 ++ phpunit.xml.dist | 36 ++ phpunit.xml.travis | 36 ++ src/Abstract.php | 259 +++++++++ src/Atom.php | 390 +++++++++++++ src/Builder.php | 395 +++++++++++++ src/Builder/Entry.php | 285 ++++++++++ src/Builder/Exception.php | 40 ++ src/Builder/Header.php | 423 ++++++++++++++ src/Builder/Header/Itunes.php | 288 ++++++++++ src/Builder/Interface.php | 52 ++ src/Element.php | 408 ++++++++++++++ src/Entry/Abstract.php | 124 +++++ src/Entry/Atom.php | 280 ++++++++++ src/Entry/Rss.php | 122 ++++ src/Exception.php | 42 ++ src/Rss.php | 520 ++++++++++++++++++ test/AllTests.php | 83 +++ test/ArrayAccessTest.php | 99 ++++ test/AtomEntryOnlyTest.php | 65 +++ test/AtomPublishingTest.php | 148 +++++ test/CountTest.php | 52 ++ test/ElementTest.php | 92 ++++ test/Entry/RssTest.php | 80 +++ test/ImportTest.php | 446 +++++++++++++++ test/IteratorTest.php | 124 +++++ .../AtomPublishingTest-before-update.xml | 7 + .../AtomPublishingTest-created-entry.xml | 15 + .../AtomPublishingTest-expected-update.xml | 7 + .../AtomPublishingTest-updated-entry.xml | 18 + test/_files/AtomTestGoogle.xml | 148 +++++ test/_files/AtomTestMozillazine.xml | 213 +++++++ test/_files/AtomTestOReilly.xml | 214 +++++++ test/_files/AtomTestPlanetPHP.xml | 125 +++++ test/_files/AtomTestSample1.xml | 22 + test/_files/AtomTestSample2.xml | 15 + test/_files/AtomTestSample3.xml | 17 + test/_files/AtomTestSample4.xml | 31 ++ test/_files/RssTest091Sample1.xml | 50 ++ test/_files/RssTest092Sample1.xml | 103 ++++ test/_files/RssTest100Sample1.xml | 62 +++ test/_files/RssTest100Sample2.xml | 67 +++ test/_files/RssTest200Sample1.xml | 41 ++ test/_files/RssTestCNN.xml | 80 +++ test/_files/RssTestHarvardLaw.xml | 142 +++++ test/_files/RssTestPlanetPHP.xml | 126 +++++ test/_files/RssTestSlashdot.xml | 178 ++++++ test/_files/TestAtomFeed.xml | 34 ++ test/_files/TestAtomFeedEntryOnly.xml | 1 + test/_files/TestAtomFeedNamespaced.xml | 34 ++ .../_files/TestFeedEntryRssContentEncoded.xml | 61 ++ test/bootstrap.php | 34 ++ 60 files changed, 7149 insertions(+) create mode 100644 .coveralls.yml create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .php_cs create mode 100644 .travis.yml create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE.txt create mode 100644 README.md create mode 100644 composer.json create mode 100644 phpunit.xml.dist create mode 100644 phpunit.xml.travis create mode 100644 src/Abstract.php create mode 100644 src/Atom.php create mode 100644 src/Builder.php create mode 100644 src/Builder/Entry.php create mode 100644 src/Builder/Exception.php create mode 100644 src/Builder/Header.php create mode 100644 src/Builder/Header/Itunes.php create mode 100644 src/Builder/Interface.php create mode 100644 src/Element.php create mode 100644 src/Entry/Abstract.php create mode 100644 src/Entry/Atom.php create mode 100644 src/Entry/Rss.php create mode 100644 src/Exception.php create mode 100644 src/Rss.php create mode 100644 test/AllTests.php create mode 100644 test/ArrayAccessTest.php create mode 100644 test/AtomEntryOnlyTest.php create mode 100644 test/AtomPublishingTest.php create mode 100644 test/CountTest.php create mode 100644 test/ElementTest.php create mode 100644 test/Entry/RssTest.php create mode 100644 test/ImportTest.php create mode 100644 test/IteratorTest.php create mode 100644 test/_files/AtomPublishingTest-before-update.xml create mode 100644 test/_files/AtomPublishingTest-created-entry.xml create mode 100644 test/_files/AtomPublishingTest-expected-update.xml create mode 100644 test/_files/AtomPublishingTest-updated-entry.xml create mode 100644 test/_files/AtomTestGoogle.xml create mode 100644 test/_files/AtomTestMozillazine.xml create mode 100644 test/_files/AtomTestOReilly.xml create mode 100644 test/_files/AtomTestPlanetPHP.xml create mode 100644 test/_files/AtomTestSample1.xml create mode 100644 test/_files/AtomTestSample2.xml create mode 100644 test/_files/AtomTestSample3.xml create mode 100644 test/_files/AtomTestSample4.xml create mode 100644 test/_files/RssTest091Sample1.xml create mode 100644 test/_files/RssTest092Sample1.xml create mode 100644 test/_files/RssTest100Sample1.xml create mode 100644 test/_files/RssTest100Sample2.xml create mode 100644 test/_files/RssTest200Sample1.xml create mode 100644 test/_files/RssTestCNN.xml create mode 100644 test/_files/RssTestHarvardLaw.xml create mode 100644 test/_files/RssTestPlanetPHP.xml create mode 100644 test/_files/RssTestSlashdot.xml create mode 100644 test/_files/TestAtomFeed.xml create mode 100644 test/_files/TestAtomFeedEntryOnly.xml create mode 100644 test/_files/TestAtomFeedNamespaced.xml create mode 100644 test/_files/TestFeedEntryRssContentEncoded.xml create mode 100644 test/bootstrap.php diff --git a/.coveralls.yml b/.coveralls.yml new file mode 100644 index 00000000..53bda829 --- /dev/null +++ b/.coveralls.yml @@ -0,0 +1,3 @@ +coverage_clover: clover.xml +json_path: coveralls-upload.json +src_dir: src diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..85dc9a8c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +/test export-ignore +/vendor export-ignore +.gitattributes export-ignore +.gitignore export-ignore +.travis.yml export-ignore +.php_cs export-ignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..4cac0a21 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +.buildpath +.DS_Store +.idea +.project +.settings/ +.*.sw* +.*.un~ +nbproject +tmp/ + +clover.xml +coveralls-upload.json +phpunit.xml +vendor diff --git a/.php_cs b/.php_cs new file mode 100644 index 00000000..bf4b799f --- /dev/null +++ b/.php_cs @@ -0,0 +1,43 @@ +notPath('TestAsset') + ->notPath('_files') + ->filter(function (SplFileInfo $file) { + if (strstr($file->getPath(), 'compatibility')) { + return false; + } + }); +$config = Symfony\CS\Config\Config::create(); +$config->level(null); +$config->fixers( + array( + 'braces', + 'duplicate_semicolon', + 'elseif', + 'empty_return', + 'encoding', + 'eof_ending', + 'function_call_space', + 'function_declaration', + 'indentation', + 'join_function', + 'line_after_namespace', + 'linefeed', + 'lowercase_keywords', + 'parenthesis', + 'multiple_use', + 'method_argument_space', + 'object_operator', + 'php_closing_tag', + 'psr0', + 'remove_lines_between_uses', + 'short_tag', + 'standardize_not_equal', + 'trailing_spaces', + 'unused_use', + 'visibility', + 'whitespacy_lines', + ) +); +$config->finder($finder); +return $config; diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..fe909ecb --- /dev/null +++ b/.travis.yml @@ -0,0 +1,35 @@ +sudo: false + +language: php + +matrix: + fast_finish: true + include: + - php: 5.5 + - php: 5.6 + env: + - EXECUTE_TEST_COVERALLS=true + - EXECUTE_CS_CHECK=true + - php: 7 + - php: hhvm + allow_failures: + - php: 7 + - php: hhvm + +notifications: + irc: "irc.freenode.org#zftalk.dev" + email: false + +before_install: + - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi + +install: + - composer install --no-interaction --prefer-source + +script: + - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/phpunit -c phpunit.xml.travis --coverage-clover clover.xml ; fi + - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then ./vendor/bin/phpunit -c phpunit.xml.travis ; fi + - if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/php-cs-fixer fix -v --diff --dry-run --config-file=.php_cs ; fi + +after_script: + - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/coveralls ; fi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..e964373f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,229 @@ +# CONTRIBUTING + +## RESOURCES + +If you wish to contribute to Zend Framework, please be sure to +read/subscribe to the following resources: + + - [Coding Standards](https://github.com/zendframework/zf2/wiki/Coding-Standards) + - [Contributor's Guide](http://framework.zend.com/participate/contributor-guide) + - ZF Contributor's mailing list: + Archives: http://zend-framework-community.634137.n4.nabble.com/ZF-Contributor-f680267.html + Subscribe: zf-contributors-subscribe@lists.zend.com + - ZF Contributor's IRC channel: + #zftalk.dev on Freenode.net + +If you are working on new features or refactoring [create a proposal](https://github.com/zendframework/zend-feed/issues/new). + +## Reporting Potential Security Issues + +If you have encountered a potential security vulnerability, please **DO NOT** report it on the public +issue tracker: send it to us at [zf-security@zend.com](mailto:zf-security@zend.com) instead. +We will work with you to verify the vulnerability and patch it as soon as possible. + +When reporting issues, please provide the following information: + +- Component(s) affected +- A description indicating how to reproduce the issue +- A summary of the security vulnerability and impact + +We request that you contact us via the email address above and give the project +contributors a chance to resolve the vulnerability and issue a new release prior +to any public exposure; this helps protect users and provides them with a chance +to upgrade and/or update in order to protect their applications. + +For sensitive email communications, please use [our PGP key](http://framework.zend.com/zf-security-pgp-key.asc). + +## RUNNING TESTS + +> ### Note: testing versions prior to 2.4 +> +> This component originates with Zend Framework 2. During the lifetime of ZF2, +> testing infrastructure migrated from PHPUnit 3 to PHPUnit 4. In most cases, no +> changes were necessary. However, due to the migration, tests may not run on +> versions < 2.4. As such, you may need to change the PHPUnit dependency if +> attempting a fix on such a version. + +To run tests: + +- Clone the repository: + + ```console + $ git clone git@github.com:zendframework/zend-feed.git + $ cd + ``` + +- Install dependencies via composer: + + ```console + $ curl -sS https://getcomposer.org/installer | php -- + $ ./composer.phar install + ``` + + If you don't have `curl` installed, you can also download `composer.phar` from https://getcomposer.org/ + +- Run the tests via `phpunit` and the provided PHPUnit config, like in this example: + + ```console + $ ./vendor/bin/phpunit + ``` + +You can turn on conditional tests with the phpunit.xml file. +To do so: + + - Copy `phpunit.xml.dist` file to `phpunit.xml` + - Edit `phpunit.xml` to enable any specific functionality you + want to test, as well as to provide test values to utilize. + +## Running Coding Standards Checks + +This component uses [php-cs-fixer](http://cs.sensiolabs.org/) for coding +standards checks, and provides configuration for our selected checks. +`php-cs-fixer` is installed by default via Composer. + +To run checks only: + +```console +$ ./vendor/bin/php-cs-fixer fix . -v --diff --dry-run --config-file=.php_cs +``` + +To have `php-cs-fixer` attempt to fix problems for you, omit the `--dry-run` +flag: + +```console +$ ./vendor/bin/php-cs-fixer fix . -v --diff --config-file=.php_cs +``` + +If you allow php-cs-fixer to fix CS issues, please re-run the tests to ensure +they pass, and make sure you add and commit the changes after verification. + +## Recommended Workflow for Contributions + +Your first step is to establish a public repository from which we can +pull your work into the master repository. We recommend using +[GitHub](https://github.com), as that is where the component is already hosted. + +1. Setup a [GitHub account](http://github.com/), if you haven't yet +2. Fork the repository (http://github.com/zendframework/zend-feed) +3. Clone the canonical repository locally and enter it. + + ```console + $ git clone git://github.com:zendframework/zend-feed.git + $ cd zend-feed + ``` + +4. Add a remote to your fork; substitute your GitHub username in the command + below. + + ```console + $ git remote add {username} git@github.com:{username}/zend-feed.git + $ git fetch {username} + ``` + +### Keeping Up-to-Date + +Periodically, you should update your fork or personal repository to +match the canonical ZF repository. Assuming you have setup your local repository +per the instructions above, you can do the following: + + +```console +$ git checkout master +$ git fetch origin +$ git rebase origin/master +# OPTIONALLY, to keep your remote up-to-date - +$ git push {username} master:master +``` + +If you're tracking other branches -- for example, the "develop" branch, where +new feature development occurs -- you'll want to do the same operations for that +branch; simply substitute "develop" for "master". + +### Working on a patch + +We recommend you do each new feature or bugfix in a new branch. This simplifies +the task of code review as well as the task of merging your changes into the +canonical repository. + +A typical workflow will then consist of the following: + +1. Create a new local branch based off either your master or develop branch. +2. Switch to your new local branch. (This step can be combined with the + previous step with the use of `git checkout -b`.) +3. Do some work, commit, repeat as necessary. +4. Push the local branch to your remote repository. +5. Send a pull request. + +The mechanics of this process are actually quite trivial. Below, we will +create a branch for fixing an issue in the tracker. + +```console +$ git checkout -b hotfix/9295 +Switched to a new branch 'hotfix/9295' +``` + +... do some work ... + + +```console +$ git commit +``` + +... write your log message ... + + +```console +$ git push {username} hotfix/9295:hotfix/9295 +Counting objects: 38, done. +Delta compression using up to 2 threads. +Compression objects: 100% (18/18), done. +Writing objects: 100% (20/20), 8.19KiB, done. +Total 20 (delta 12), reused 0 (delta 0) +To ssh://git@github.com/{username}/zend-feed.git + b5583aa..4f51698 HEAD -> master +``` + +To send a pull request, you have two options. + +If using GitHub, you can do the pull request from there. Navigate to +your repository, select the branch you just created, and then select the +"Pull Request" button in the upper right. Select the user/organization +"zendframework" as the recipient. + +If using your own repository - or even if using GitHub - you can use `git +format-patch` to create a patchset for us to apply; in fact, this is +**recommended** for security-related patches. If you use `format-patch`, please +send the patches as attachments to: + +- zf-devteam@zend.com for patches without security implications +- zf-security@zend.com for security patches + +#### What branch to issue the pull request against? + +Which branch should you issue a pull request against? + +- For fixes against the stable release, issue the pull request against the + "master" branch. +- For new features, or fixes that introduce new elements to the public API (such + as new public methods or properties), issue the pull request against the + "develop" branch. + +### Branch Cleanup + +As you might imagine, if you are a frequent contributor, you'll start to +get a ton of branches both locally and on your remote. + +Once you know that your changes have been accepted to the master +repository, we suggest doing some cleanup of these branches. + +- Local branch cleanup + + ```console + $ git branch -d + ``` + +- Remote branch removal + + ```console + $ git push {username} : + ``` diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 00000000..6eab5aa1 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,27 @@ +Copyright (c) 2005-2015, Zend Technologies USA, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Zend Technologies USA, Inc. nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..cffad17e --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# zend-feed + +`Zend\Feed` provides functionality for consuming RSS and Atom feeds. It provides +a natural syntax for accessing elements of feeds, feed attributes, and entry +attributes. `Zend\Feed` also has extensive support for modifying feed and entry +structure with the same natural syntax, and turning the result back into XML. + + +- File issues at https://github.com/zendframework/zend-feed/issues +- Documentation is at http://framework.zend.com/manual/current/en/index.html#zend-feed diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..aa98667b --- /dev/null +++ b/composer.json @@ -0,0 +1,48 @@ +{ + "name": "zendframework/zend-feed", + "description": "Zend\\Feed component", + "license": "BSD-3-Clause", + "keywords": [ + "zf2", + "feed" + ], + "homepage": "https://github.com/zendframework/zend-feed", + "autoload": { + "psr-4": { + "Zend\\Feed\\": "src/" + } + }, + "require": { + "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", + "fabpot/php-cs-fixer": "1.7.*", + "satooshi/php-coveralls": "dev-master", + "phpunit/PHPUnit": "~4.0" + }, + "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.4-dev", + "dev-develop": "2.5-dev" + } + }, + "autoload-dev": { + "psr-4": { + "ZendTest\\Feed\\": "test/" + } + } +} \ No newline at end of file diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 00000000..d0a2191f --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,36 @@ + + + + + ./test/ + + + + + + disable + + + + + + ./src + + + + + + + + + + + + + diff --git a/phpunit.xml.travis b/phpunit.xml.travis new file mode 100644 index 00000000..d0a2191f --- /dev/null +++ b/phpunit.xml.travis @@ -0,0 +1,36 @@ + + + + + ./test/ + + + + + + disable + + + + + + ./src + + + + + + + + + + + + + diff --git a/src/Abstract.php b/src/Abstract.php new file mode 100644 index 00000000..1f7768cd --- /dev/null +++ b/src/Abstract.php @@ -0,0 +1,259 @@ +setUri($uri); + $response = $client->request('GET'); + if ($response->getStatus() !== 200) { + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); + } + $this->_element = $response->getBody(); + $this->__wakeup(); + } elseif ($string !== null) { + // Retrieve the feed from $string + $this->_element = $string; + $this->__wakeup(); + } else { + // Generate the feed from the array + $header = $builder->getHeader(); + $this->_element = new DOMDocument('1.0', $header['charset']); + $root = $this->_mapFeedHeaders($header); + $this->_mapFeedEntries($root, $builder->getEntries()); + $this->_element = $root; + $this->_buildEntryCache(); + } + } + + + /** + * Load the feed as an XML DOMDocument object + * + * @return void + * @throws Zend_Feed_Exception + */ + public function __wakeup() + { + @ini_set('track_errors', 1); + $doc = new DOMDocument; + $status = @$doc->loadXML($this->_element); + @ini_restore('track_errors'); + + if (!$status) { + // prevent the class to generate an undefined variable notice (ZF-2590) + 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)'; + } + } + + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg"); + } + + $this->_element = $doc; + } + + + /** + * Prepare for serialiation + * + * @return array + */ + public function __sleep() + { + $this->_element = $this->saveXML(); + + return array('_element'); + } + + + /** + * Cache the individual feed elements so they don't need to be + * searched for on every operation. + * + * @return void + */ + protected function _buildEntryCache() + { + $this->_entries = array(); + foreach ($this->_element->childNodes as $child) { + if ($child->localName == $this->_entryElementName) { + $this->_entries[] = $child; + } + } + } + + + /** + * Get the number of entries in this feed object. + * + * @return integer Entry count. + */ + public function count() + { + return count($this->_entries); + } + + + /** + * Required by the Iterator interface. + * + * @return void + */ + public function rewind() + { + $this->_entryIndex = 0; + } + + + /** + * Required by the Iterator interface. + * + * @return mixed The current row, or null if no rows. + */ + public function current() + { + return new $this->_entryClassName( + null, + $this->_entries[$this->_entryIndex]); + } + + + /** + * Required by the Iterator interface. + * + * @return mixed The current row number (starts at 0), or NULL if no rows + */ + public function key() + { + return $this->_entryIndex; + } + + + /** + * Required by the Iterator interface. + * + * @return mixed The next row, or null if no more rows. + */ + public function next() + { + ++$this->_entryIndex; + } + + + /** + * Required by the Iterator interface. + * + * @return boolean Whether the iteration is valid + */ + public function valid() + { + return 0 <= $this->_entryIndex && $this->_entryIndex < $this->count(); + } + + /** + * Generate the header of the feed when working in write mode + * + * @param array $array the data to use + * @return DOMElement root node + */ + abstract protected function _mapFeedHeaders($array); + + /** + * Generate the entries of the feed when working in write mode + * + * @param DOMElement $root the root node to use + * @param array $array the data to use + * @return DOMElement root node + */ + abstract protected function _mapFeedEntries(DOMElement $root, $array); + + /** + * Send feed to a http client with the correct header + * + * @throws Zend_Feed_Exception if headers have already been sent + * @return void + */ + abstract public function send(); +} diff --git a/src/Atom.php b/src/Atom.php new file mode 100644 index 00000000..b02d0398 --- /dev/null +++ b/src/Atom.php @@ -0,0 +1,390 @@ + + * elements). + * + * @var string + */ + protected $_entryElementName = 'entry'; + + /** + * The default namespace for Atom feeds. + * + * @var string + */ + protected $_defaultNamespace = 'atom'; + + + /** + * Override Zend_Feed_Abstract to set up the $_element and $_entries aliases. + * + * @return void + * @throws Zend_Feed_Exception + */ + public function __wakeup() + { + parent::__wakeup(); + + // Find the base feed element and create an alias to it. + $element = $this->_element->getElementsByTagName('feed')->item(0); + if (!$element) { + // Try to find a single instead. + $element = $this->_element->getElementsByTagName($this->_entryElementName)->item(0); + if (!$element) { + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('No root or <' . $this->_entryElementName + . '> element found, cannot parse feed.'); + } + + $doc = new DOMDocument($this->_element->version, + $this->_element->actualEncoding); + $feed = $doc->appendChild($doc->createElement('feed')); + $feed->appendChild($doc->importNode($element, true)); + $element = $feed; + } + + $this->_element = $element; + + // Find the entries and save a pointer to them for speed and + // simplicity. + $this->_buildEntryCache(); + } + + + /** + * Easy access to tags keyed by "rel" attributes. + * + * If $elt->link() is called with no arguments, we will attempt to + * return the value of the tag(s) like all other + * method-syntax attribute access. If an argument is passed to + * link(), however, then we will return the "href" value of the + * first tag that has a "rel" attribute matching $rel: + * + * $elt->link(): returns the value of the link tag. + * $elt->link('self'): returns the href from the first in the entry. + * + * @param string $rel The "rel" attribute to look for. + * @return mixed + */ + public function link($rel = null) + { + if ($rel === null) { + return parent::__call('link', null); + } + + // index link tags by their "rel" attribute. + $links = parent::__get('link'); + if (!is_array($links)) { + if ($links instanceof Zend_Feed_Element) { + $links = array($links); + } else { + return $links; + } + } + + foreach ($links as $link) { + if (empty($link['rel'])) { + continue; + } + if ($rel == $link['rel']) { + return $link['href']; + } + } + + return null; + } + + + /** + * Make accessing some individual elements of the feed easier. + * + * Special accessors 'entry' and 'entries' are provided so that if + * you wish to iterate over an Atom feed's entries, you can do so + * using foreach ($feed->entries as $entry) or foreach + * ($feed->entry as $entry). + * + * @param string $var The property to access. + * @return mixed + */ + public function __get($var) + { + switch ($var) { + case 'entry': + // fall through to the next case + case 'entries': + return $this; + + default: + return parent::__get($var); + } + } + + /** + * Generate the header of the feed when working in write mode + * + * @param array $array the data to use + * @return DOMElement root node + */ + protected function _mapFeedHeaders($array) + { + $feed = $this->_element->createElement('feed'); + $feed->setAttribute('xmlns', 'http://www.w3.org/2005/Atom'); + + $id = $this->_element->createElement('id', $array->link); + $feed->appendChild($id); + + $title = $this->_element->createElement('title'); + $title->appendChild($this->_element->createCDATASection($array->title)); + $feed->appendChild($title); + + if (isset($array->author)) { + $author = $this->_element->createElement('author'); + $name = $this->_element->createElement('name', $array->author); + $author->appendChild($name); + if (isset($array->email)) { + $email = $this->_element->createElement('email', $array->email); + $author->appendChild($email); + } + $feed->appendChild($author); + } + + $updated = isset($array->lastUpdate) ? $array->lastUpdate : time(); + $updated = $this->_element->createElement('updated', date(DATE_ATOM, $updated)); + $feed->appendChild($updated); + + if (isset($array->published)) { + $published = $this->_element->createElement('published', date(DATE_ATOM, $array->published)); + $feed->appendChild($published); + } + + $link = $this->_element->createElement('link'); + $link->setAttribute('rel', 'self'); + $link->setAttribute('href', $array->link); + if (isset($array->language)) { + $link->setAttribute('hreflang', $array->language); + } + $feed->appendChild($link); + + if (isset($array->description)) { + $subtitle = $this->_element->createElement('subtitle'); + $subtitle->appendChild($this->_element->createCDATASection($array->description)); + $feed->appendChild($subtitle); + } + + if (isset($array->copyright)) { + $copyright = $this->_element->createElement('rights', $array->copyright); + $feed->appendChild($copyright); + } + + if (isset($array->image)) { + $image = $this->_element->createElement('logo', $array->image); + $feed->appendChild($image); + } + + $generator = !empty($array->generator) ? $array->generator : 'Zend_Feed'; + $generator = $this->_element->createElement('generator', $generator); + $feed->appendChild($generator); + + return $feed; + } + + /** + * Generate the entries of the feed when working in write mode + * + * The following nodes are constructed for each feed entry + * + * url to feed entry + * entry title + * last update + * + * short text + * long version, can contain html + * + * + * @param array $array the data to use + * @param DOMElement $root the root node to use + * @return void + */ + protected function _mapFeedEntries(DOMElement $root, $array) + { + foreach ($array as $dataentry) { + $entry = $this->_element->createElement('entry'); + + $id = $this->_element->createElement('id', isset($dataentry->guid) ? $dataentry->guid : $dataentry->link); + $entry->appendChild($id); + + $title = $this->_element->createElement('title'); + $title->appendChild($this->_element->createCDATASection($dataentry->title)); + $entry->appendChild($title); + + $updated = isset($dataentry->lastUpdate) ? $dataentry->lastUpdate : time(); + $updated = $this->_element->createElement('updated', date(DATE_ATOM, $updated)); + $entry->appendChild($updated); + + $link = $this->_element->createElement('link'); + $link->setAttribute('rel', 'alternate'); + $link->setAttribute('href', $dataentry->link); + $entry->appendChild($link); + + $summary = $this->_element->createElement('summary'); + $summary->appendChild($this->_element->createCDATASection($dataentry->description)); + $entry->appendChild($summary); + + if (isset($dataentry->content)) { + $content = $this->_element->createElement('content'); + $content->setAttribute('type', 'html'); + $content->appendChild($this->_element->createCDATASection($dataentry->content)); + $entry->appendChild($content); + } + + if (isset($dataentry->category)) { + foreach ($dataentry->category as $category) { + $node = $this->_element->createElement('category'); + $node->setAttribute('term', $category['term']); + if (isset($category['scheme'])) { + $node->setAttribute('scheme', $category['scheme']); + } + $entry->appendChild($node); + } + } + + if (isset($dataentry->source)) { + $source = $this->_element->createElement('source'); + $title = $this->_element->createElement('title', $dataentry->source['title']); + $source->appendChild($title); + $link = $this->_element->createElement('link', $dataentry->source['title']); + $link->setAttribute('rel', 'alternate'); + $link->setAttribute('href', $dataentry->source['url']); + $source->appendChild($link); + } + + if (isset($dataentry->enclosure)) { + foreach ($dataentry->enclosure as $enclosure) { + $node = $this->_element->createElement('link'); + $node->setAttribute('rel', 'enclosure'); + $node->setAttribute('href', $enclosure['url']); + if (isset($enclosure['type'])) { + $node->setAttribute('type', $enclosure['type']); + } + if (isset($enclosure['length'])) { + $node->setAttribute('length', $enclosure['length']); + } + $entry->appendChild($node); + } + } + + if (isset($dataentry->comments)) { + $comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/', + 'wfw:comment', + $dataentry->comments); + $entry->appendChild($comments); + } + if (isset($dataentry->commentRss)) { + $comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/', + 'wfw:commentRss', + $dataentry->commentRss); + $entry->appendChild($comments); + } + + $root->appendChild($entry); + } + } + + /** + * Override Zend_Feed_Element to allow formated feeds + * + * @return string + */ + public function saveXml() + { + // Return a complete document including XML prologue. + $doc = new DOMDocument($this->_element->ownerDocument->version, + $this->_element->ownerDocument->actualEncoding); + $doc->appendChild($doc->importNode($this->_element, true)); + $doc->formatOutput = true; + + return $doc->saveXML(); + } + + /** + * Send feed to a http client with the correct header + * + * @return void + * @throws Zend_Feed_Exception if headers have already been sent + */ + public function send() + { + if (headers_sent()) { + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Cannot send ATOM because headers have already been sent.'); + } + + header('Content-Type: application/atom+xml; charset=' . $this->_element->ownerDocument->actualEncoding); + + echo $this->saveXML(); + } +} diff --git a/src/Builder.php b/src/Builder.php new file mode 100644 index 00000000..8e305454 --- /dev/null +++ b/src/Builder.php @@ -0,0 +1,395 @@ + + * array( + * 'title' => 'title of the feed', //required + * 'link' => 'canonical url to the feed', //required + * 'lastUpdate' => 'timestamp of the update date', // optional + * 'published' => 'timestamp of the publication date', //optional + * 'charset' => 'charset', // required + * 'description' => 'short description of the feed', //optional + * 'author' => 'author/publisher of the feed', //optional + * 'email' => 'email of the author', //optional + * 'webmaster' => 'email address for person responsible for technical issues' // optional, ignored if atom is used + * 'copyright' => 'copyright notice', //optional + * 'image' => 'url to image', //optional + * 'generator' => 'generator', // optional + * 'language' => 'language the feed is written in', // optional + * 'ttl' => 'how long in minutes a feed can be cached before refreshing', // optional, ignored if atom is used + * 'rating' => 'The PICS rating for the channel.', // optional, ignored if atom is used + * 'cloud' => array( + * 'domain' => 'domain of the cloud, e.g. rpc.sys.com' // required + * 'port' => 'port to connect to' // optional, default to 80 + * 'path' => 'path of the cloud, e.g. /RPC2 //required + * 'registerProcedure' => 'procedure to call, e.g. myCloud.rssPleaseNotify' // required + * 'protocol' => 'protocol to use, e.g. soap or xml-rpc' // required + * ), a cloud to be notified of updates // optional, ignored if atom is used + * 'textInput' => array( + * 'title' => 'the label of the Submit button in the text input area' // required, + * 'description' => 'explains the text input area' // required + * 'name' => 'the name of the text object in the text input area' // required + * 'link' => 'the URL of the CGI script that processes text input requests' // required + * ) // a text input box that can be displayed with the feed // optional, ignored if atom is used + * 'skipHours' => array( + * 'hour in 24 format', // e.g 13 (1pm) + * // up to 24 rows whose value is a number between 0 and 23 + * ) // Hint telling aggregators which hours they can skip // optional, ignored if atom is used + * 'skipDays ' => array( + * 'a day to skip', // e.g Monday + * // up to 7 rows whose value is a Monday, Tuesday, Wednesday, Thursday, Friday, Saturday or Sunday + * ) // Hint telling aggregators which days they can skip // optional, ignored if atom is used + * 'itunes' => array( + * 'author' => 'Artist column' // optional, default to the main author value + * 'owner' => array( + * 'name' => 'name of the owner' // optional, default to main author value + * 'email' => 'email of the owner' // optional, default to main email value + * ) // Owner of the podcast // optional + * 'image' => 'album/podcast art' // optional, default to the main image value + * 'subtitle' => 'short description' // optional, default to the main description value + * 'summary' => 'longer description' // optional, default to the main description value + * 'block' => 'Prevent an episode from appearing (yes|no)' // optional + * 'category' => array( + * array('main' => 'main category', // required + * 'sub' => 'sub category' // optional + * ), + * // up to 3 rows + * ) // 'Category column and in iTunes Music Store Browse' // required + * 'explicit' => 'parental advisory graphic (yes|no|clean)' // optional + * 'keywords' => 'a comma separated list of 12 keywords maximum' // optional + * 'new-feed-url' => 'used to inform iTunes of new feed URL location' // optional + * ) // Itunes extension data // optional, ignored if atom is used + * 'entries' => array( + * array( + * 'title' => 'title of the feed entry', //required + * 'link' => 'url to a feed entry', //required + * 'description' => 'short version of a feed entry', // only text, no html, required + * 'guid' => 'id of the article, if not given link value will used', //optional + * 'content' => 'long version', // can contain html, optional + * 'lastUpdate' => 'timestamp of the publication date', // optional + * 'comments' => 'comments page of the feed entry', // optional + * 'commentRss' => 'the feed url of the associated comments', // optional + * 'source' => array( + * 'title' => 'title of the original source' // required, + * 'url' => 'url of the original source' // required + * ) // original source of the feed entry // optional + * 'category' => array( + * array( + * 'term' => 'first category label' // required, + * 'scheme' => 'url that identifies a categorization scheme' // optional + * ), + * array( + * //data for the second category and so on + * ) + * ) // list of the attached categories // optional + * 'enclosure' => array( + * array( + * 'url' => 'url of the linked enclosure' // required + * 'type' => 'mime type of the enclosure' // optional + * 'length' => 'length of the linked content in octets' // optional + * ), + * array( + * //data for the second enclosure and so on + * ) + * ) // list of the enclosures of the feed entry // optional + * ), + * array( + * //data for the second entry and so on + * ) + * ) + * ); + * + * + * @param array $data + * @return void + */ + public function __construct(array $data) + { + $this->_data = $data; + $this->_createHeader($data); + if (isset($data['entries'])) { + $this->_createEntries($data['entries']); + } + } + + /** + * Returns an instance of Zend_Feed_Builder_Header + * describing the header of the feed + * + * @return Zend_Feed_Builder_Header + */ + public function getHeader() + { + return $this->_header; + } + + /** + * Returns an array of Zend_Feed_Builder_Entry instances + * describing the entries of the feed + * + * @return array of Zend_Feed_Builder_Entry + */ + public function getEntries() + { + return $this->_entries; + } + + /** + * Create the Zend_Feed_Builder_Header instance + * + * @param array $data + * @throws Zend_Feed_Builder_Exception + * @return void + */ + private function _createHeader(array $data) + { + $mandatories = array('title', 'link', 'charset'); + foreach ($mandatories as $mandatory) { + if (!isset($data[$mandatory])) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("$mandatory key is missing"); + } + } + $this->_header = new Zend_Feed_Builder_Header($data['title'], $data['link'], $data['charset']); + if (isset($data['lastUpdate'])) { + $this->_header->setLastUpdate($data['lastUpdate']); + } + if (isset($data['published'])) { + $this->_header->setPublishedDate($data['published']); + } + if (isset($data['description'])) { + $this->_header->setDescription($data['description']); + } + if (isset($data['author'])) { + $this->_header->setAuthor($data['author']); + } + if (isset($data['email'])) { + $this->_header->setEmail($data['email']); + } + if (isset($data['webmaster'])) { + $this->_header->setWebmaster($data['webmaster']); + } + if (isset($data['copyright'])) { + $this->_header->setCopyright($data['copyright']); + } + if (isset($data['image'])) { + $this->_header->setImage($data['image']); + } + if (isset($data['generator'])) { + $this->_header->setGenerator($data['generator']); + } + if (isset($data['language'])) { + $this->_header->setLanguage($data['language']); + } + if (isset($data['ttl'])) { + $this->_header->setTtl($data['ttl']); + } + if (isset($data['rating'])) { + $this->_header->setRating($data['rating']); + } + if (isset($data['cloud'])) { + $mandatories = array('domain', 'path', 'registerProcedure', 'protocol'); + foreach ($mandatories as $mandatory) { + if (!isset($data['cloud'][$mandatory])) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("you have to define $mandatory property of your cloud"); + } + } + $uri_str = 'http://' . $data['cloud']['domain'] . $data['cloud']['path']; + $this->_header->setCloud($uri_str, $data['cloud']['registerProcedure'], $data['cloud']['protocol']); + } + if (isset($data['textInput'])) { + $mandatories = array('title', 'description', 'name', 'link'); + foreach ($mandatories as $mandatory) { + if (!isset($data['textInput'][$mandatory])) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("you have to define $mandatory property of your textInput"); + } + } + $this->_header->setTextInput($data['textInput']['title'], + $data['textInput']['description'], + $data['textInput']['name'], + $data['textInput']['link']); + } + if (isset($data['skipHours'])) { + $this->_header->setSkipHours($data['skipHours']); + } + if (isset($data['skipDays'])) { + $this->_header->setSkipDays($data['skipDays']); + } + if (isset($data['itunes'])) { + $itunes = new Zend_Feed_Builder_Header_Itunes($data['itunes']['category']); + if (isset($data['itunes']['author'])) { + $itunes->setAuthor($data['itunes']['author']); + } + if (isset($data['itunes']['owner'])) { + $name = isset($data['itunes']['owner']['name']) ? $data['itunes']['owner']['name'] : ''; + $email = isset($data['itunes']['owner']['email']) ? $data['itunes']['owner']['email'] : ''; + $itunes->setOwner($name, $email); + } + if (isset($data['itunes']['image'])) { + $itunes->setImage($data['itunes']['image']); + } + if (isset($data['itunes']['subtitle'])) { + $itunes->setSubtitle($data['itunes']['subtitle']); + } + if (isset($data['itunes']['summary'])) { + $itunes->setSummary($data['itunes']['summary']); + } + if (isset($data['itunes']['block'])) { + $itunes->setBlock($data['itunes']['block']); + } + if (isset($data['itunes']['explicit'])) { + $itunes->setExplicit($data['itunes']['explicit']); + } + if (isset($data['itunes']['keywords'])) { + $itunes->setKeywords($data['itunes']['keywords']); + } + if (isset($data['itunes']['new-feed-url'])) { + $itunes->setNewFeedUrl($data['itunes']['new-feed-url']); + } + + $this->_header->setITunes($itunes); + } + } + + /** + * Create the array of article entries + * + * @param array $data + * @throws Zend_Feed_Builder_Exception + * @return void + */ + private function _createEntries(array $data) + { + foreach ($data as $row) { + $mandatories = array('title', 'link', 'description'); + foreach ($mandatories as $mandatory) { + if (!isset($row[$mandatory])) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("$mandatory key is missing"); + } + } + $entry = new Zend_Feed_Builder_Entry($row['title'], $row['link'], $row['description']); + if (isset($row['guid'])) { + $entry->setId($row['guid']); + } + if (isset($row['content'])) { + $entry->setContent($row['content']); + } + if (isset($row['lastUpdate'])) { + $entry->setLastUpdate($row['lastUpdate']); + } + if (isset($row['comments'])) { + $entry->setCommentsUrl($row['comments']); + } + if (isset($row['commentRss'])) { + $entry->setCommentsRssUrl($row['commentRss']); + } + if (isset($row['source'])) { + $mandatories = array('title', 'url'); + foreach ($mandatories as $mandatory) { + if (!isset($row['source'][$mandatory])) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("$mandatory key of source property is missing"); + } + } + $entry->setSource($row['source']['title'], $row['source']['url']); + } + if (isset($row['category'])) { + $entry->setCategories($row['category']); + } + if (isset($row['enclosure'])) { + $entry->setEnclosures($row['enclosure']); + } + + $this->_entries[] = $entry; + } + } +} \ No newline at end of file diff --git a/src/Builder/Entry.php b/src/Builder/Entry.php new file mode 100644 index 00000000..32a4acb9 --- /dev/null +++ b/src/Builder/Entry.php @@ -0,0 +1,285 @@ +offsetSet('title', $title); + $this->offsetSet('link', $link); + $this->offsetSet('description', $description); + $this->setLastUpdate(time()); + } + + /** + * Read only properties accessor + * + * @param string $name property to read + * @return mixed + */ + public function __get($name) + { + if (!$this->offsetExists($name)) { + return NULL; + } + + return $this->offsetGet($name); + } + + /** + * Write properties accessor + * + * @param string $name name of the property to set + * @param mixed $value value to set + * @return void + */ + public function __set($name, $value) + { + $this->offsetSet($name, $value); + } + + /** + * Isset accessor + * + * @param string $key + * @return boolean + */ + public function __isset($key) + { + return $this->offsetExists($key); + } + + /** + * Unset accessor + * + * @param string $key + * @return void + */ + public function __unset($key) + { + if ($this->offsetExists($key)) { + $this->offsetUnset($key); + } + } + + /** + * Sets the id/guid of the entry + * + * @param string $id + * @return Zend_Feed_Builder_Entry + */ + public function setId($id) + { + $this->offsetSet('guid', $id); + return $this; + } + + /** + * Sets the full html content of the entry + * + * @param string $content + * @return Zend_Feed_Builder_Entry + */ + public function setContent($content) + { + $this->offsetSet('content', $content); + return $this; + } + + /** + * Timestamp of the update date + * + * @param int $lastUpdate + * @return Zend_Feed_Builder_Entry + */ + public function setLastUpdate($lastUpdate) + { + $this->offsetSet('lastUpdate', $lastUpdate); + return $this; + } + + /** + * Sets the url of the commented page associated to the entry + * + * @param string $comments + * @return Zend_Feed_Builder_Entry + */ + public function setCommentsUrl($comments) + { + $this->offsetSet('comments', $comments); + return $this; + } + + /** + * Sets the url of the comments feed link + * + * @param string $commentRss + * @return Zend_Feed_Builder_Entry + */ + public function setCommentsRssUrl($commentRss) + { + $this->offsetSet('commentRss', $commentRss); + return $this; + } + + /** + * Defines a reference to the original source + * + * @param string $title + * @param string $url + * @return Zend_Feed_Builder_Entry + */ + public function setSource($title, $url) + { + $this->offsetSet('source', array('title' => $title, + 'url' => $url)); + return $this; + } + + /** + * Sets the categories of the entry + * Format of the array: + * + * array( + * array( + * 'term' => 'first category label', + * 'scheme' => 'url that identifies a categorization scheme' // optional + * ), + * // second category and so one + * ) + * + * + * @param array $categories + * @return Zend_Feed_Builder_Entry + */ + public function setCategories(array $categories) + { + foreach ($categories as $category) { + $this->addCategory($category); + } + return $this; + } + + /** + * Add a category to the entry + * + * @param array $category see Zend_Feed_Builder_Entry::setCategories() for format + * @return Zend_Feed_Builder_Entry + * @throws Zend_Feed_Builder_Exception + */ + public function addCategory(array $category) + { + if (empty($category['term'])) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("you have to define the name of the category"); + } + + if (!$this->offsetExists('category')) { + $categories = array($category); + } else { + $categories = $this->offsetGet('category'); + $categories[] = $category; + } + $this->offsetSet('category', $categories); + return $this; + } + + /** + * Sets the enclosures of the entry + * Format of the array: + * + * array( + * array( + * 'url' => 'url of the linked enclosure', + * 'type' => 'mime type of the enclosure' // optional + * 'length' => 'length of the linked content in octets' // optional + * ), + * // second enclosure and so one + * ) + * + * + * @param array $enclosures + * @return Zend_Feed_Builder_Entry + * @throws Zend_Feed_Builder_Exception + */ + public function setEnclosures(array $enclosures) + { + foreach ($enclosures as $enclosure) { + if (empty($enclosure['url'])) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("you have to supply an url for your enclosure"); + } + $type = isset($enclosure['type']) ? $enclosure['type'] : ''; + $length = isset($enclosure['length']) ? $enclosure['length'] : ''; + $this->addEnclosure($enclosure['url'], $type, $length); + } + return $this; + } + + /** + * Add an enclosure to the entry + * + * @param string $url + * @param string $type + * @param string $length + * @return Zend_Feed_Builder_Entry + */ + public function addEnclosure($url, $type = '', $length = '') + { + if (!$this->offsetExists('enclosure')) { + $enclosure = array(); + } else { + $enclosure = $this->offsetGet('enclosure'); + } + $enclosure[] = array('url' => $url, + 'type' => $type, + 'length' => $length); + $this->offsetSet('enclosure', $enclosure); + return $this; + } +} diff --git a/src/Builder/Exception.php b/src/Builder/Exception.php new file mode 100644 index 00000000..9f43b67f --- /dev/null +++ b/src/Builder/Exception.php @@ -0,0 +1,40 @@ +offsetSet('title', $title); + $this->offsetSet('link', $link); + $this->offsetSet('charset', $charset); + $this->setLastUpdate(time()) + ->setGenerator('Zend_Feed'); + } + + /** + * Read only properties accessor + * + * @param string $name property to read + * @return mixed + */ + public function __get($name) + { + if (!$this->offsetExists($name)) { + return NULL; + } + + return $this->offsetGet($name); + } + + /** + * Write properties accessor + * + * @param string $name name of the property to set + * @param mixed $value value to set + * @return void + */ + public function __set($name, $value) + { + $this->offsetSet($name, $value); + } + + /** + * Isset accessor + * + * @param string $key + * @return boolean + */ + public function __isset($key) + { + return $this->offsetExists($key); + } + + /** + * Unset accessor + * + * @param string $key + * @return void + */ + public function __unset($key) + { + if ($this->offsetExists($key)) { + $this->offsetUnset($key); + } + } + + /** + * Timestamp of the update date + * + * @param int $lastUpdate + * @return Zend_Feed_Builder_Header + */ + public function setLastUpdate($lastUpdate) + { + $this->offsetSet('lastUpdate', $lastUpdate); + return $this; + } + + /** + * Timestamp of the publication date + * + * @param int $published + * @return Zend_Feed_Builder_Header + */ + public function setPublishedDate($published) + { + $this->offsetSet('published', $published); + return $this; + } + + /** + * Short description of the feed + * + * @param string $description + * @return Zend_Feed_Builder_Header + */ + public function setDescription($description) + { + $this->offsetSet('description', $description); + return $this; + } + + /** + * Sets the author of the feed + * + * @param string $author + * @return Zend_Feed_Builder_Header + */ + public function setAuthor($author) + { + $this->offsetSet('author', $author); + return $this; + } + + /** + * Sets the author's email + * + * @param string $email + * @return Zend_Feed_Builder_Header + * @throws Zend_Feed_Builder_Exception + */ + public function setEmail($email) + { + /** + * @see Zend_Validate_EmailAddress + */ + require_once 'Zend/Validate/EmailAddress.php'; + $validate = new Zend_Validate_EmailAddress(); + if (!$validate->isValid($email)) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the email property"); + } + $this->offsetSet('email', $email); + return $this; + } + + /** + * Sets the copyright notice + * + * @param string $copyright + * @return Zend_Feed_Builder_Header + */ + public function setCopyright($copyright) + { + $this->offsetSet('copyright', $copyright); + return $this; + } + + /** + * Sets the image of the feed + * + * @param string $image + * @return Zend_Feed_Builder_Header + */ + public function setImage($image) + { + $this->offsetSet('image', $image); + return $this; + } + + /** + * Sets the generator of the feed + * + * @param string $generator + * @return Zend_Feed_Builder_Header + */ + public function setGenerator($generator) + { + $this->offsetSet('generator', $generator); + return $this; + } + + /** + * Sets the language of the feed + * + * @param string $language + * @return Zend_Feed_Builder_Header + */ + public function setLanguage($language) + { + $this->offsetSet('language', $language); + return $this; + } + + /** + * Email address for person responsible for technical issues + * Ignored if atom is used + * + * @param string $webmaster + * @return Zend_Feed_Builder_Header + * @throws Zend_Feed_Builder_Exception + */ + public function setWebmaster($webmaster) + { + /** + * @see Zend_Validate_EmailAddress + */ + require_once 'Zend/Validate/EmailAddress.php'; + $validate = new Zend_Validate_EmailAddress(); + if (!$validate->isValid($webmaster)) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the webmaster property"); + } + $this->offsetSet('webmaster', $webmaster); + return $this; + } + + /** + * How long in minutes a feed can be cached before refreshing + * Ignored if atom is used + * + * @param int $ttl + * @return Zend_Feed_Builder_Header + * @throws Zend_Feed_Builder_Exception + */ + public function setTtl($ttl) + { + /** + * @see Zend_Validate_Int + */ + require_once 'Zend/Validate/Int.php'; + $validate = new Zend_Validate_Int(); + if (!$validate->isValid($ttl)) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("you have to set an integer value to the ttl property"); + } + $this->offsetSet('ttl', $ttl); + return $this; + } + + /** + * PICS rating for the feed + * Ignored if atom is used + * + * @param string $rating + * @return Zend_Feed_Builder_Header + */ + public function setRating($rating) + { + $this->offsetSet('rating', $rating); + return $this; + } + + /** + * Cloud to be notified of updates of the feed + * Ignored if atom is used + * + * @param string|Zend_Uri_Http $uri + * @param string $procedure procedure to call, e.g. myCloud.rssPleaseNotify + * @param string $protocol protocol to use, e.g. soap or xml-rpc + * @return Zend_Feed_Builder_Header + * @throws Zend_Feed_Builder_Exception + */ + public function setCloud($uri, $procedure, $protocol) + { + if (is_string($uri) && Zend_Uri_Http::check($uri)) { + $uri = Zend_Uri::factory($uri); + } + if (!$uri instanceof Zend_Uri_Http) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception('Passed parameter is not a valid HTTP URI'); + } + if (!$uri->getPort()) { + $uri->setPort(80); + } + $this->offsetSet('cloud', array('uri' => $uri, + 'procedure' => $procedure, + 'protocol' => $protocol)); + return $this; + } + + /** + * A text input box that can be displayed with the feed + * Ignored if atom is used + * + * @param string $title the label of the Submit button in the text input area + * @param string $description explains the text input area + * @param string $name the name of the text object in the text input area + * @param string $link the URL of the CGI script that processes text input requests + * @return Zend_Feed_Builder_Header + */ + public function setTextInput($title, $description, $name, $link) + { + $this->offsetSet('textInput', array('title' => $title, + 'description' => $description, + 'name' => $name, + 'link' => $link)); + return $this; + } + + /** + * Hint telling aggregators which hours they can skip + * Ignored if atom is used + * + * @param array $hours list of hours in 24 format + * @return Zend_Feed_Builder_Header + * @throws Zend_Feed_Builder_Exception + */ + public function setSkipHours(array $hours) + { + if (count($hours) > 24) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("you can not have more than 24 rows in the skipHours property"); + } + foreach ($hours as $hour) { + if ($hour < 0 || $hour > 23) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("$hour has te be between 0 and 23"); + } + } + $this->offsetSet('skipHours', $hours); + return $this; + } + + /** + * Hint telling aggregators which days they can skip + * Ignored if atom is used + * + * @param array $days list of days to skip, e.g. Monday + * @return Zend_Feed_Builder_Header + * @throws Zend_Feed_Builder_Exception + */ + public function setSkipDays(array $days) + { + if (count($days) > 7) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("you can not have more than 7 days in the skipDays property"); + } + $valid = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'); + foreach ($days as $day) { + if (!in_array(strtolower($day), $valid)) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("$day is not a valid day"); + } + } + $this->offsetSet('skipDays', $days); + return $this; + } + + /** + * Sets the iTunes rss extension + * + * @param Zend_Feed_Builder_Header_Itunes $itunes + * @return Zend_Feed_Builder_Header + */ + public function setITunes(Zend_Feed_Builder_Header_Itunes $itunes) + { + $this->offsetSet('itunes', $itunes); + return $this; + } +} diff --git a/src/Builder/Header/Itunes.php b/src/Builder/Header/Itunes.php new file mode 100644 index 00000000..ca193490 --- /dev/null +++ b/src/Builder/Header/Itunes.php @@ -0,0 +1,288 @@ +setCategories($categories); + } + + /** + * Sets the categories column and in iTunes Music Store Browse + * $categories must conform to the following format: + * + * array(array('main' => 'main category', + * 'sub' => 'sub category' // optionnal + * ), + * // up to 3 rows + * ) + * + * + * @param array $categories + * @return Zend_Feed_Builder_Header_Itunes + * @throws Zend_Feed_Builder_Exception + */ + public function setCategories(array $categories) + { + $nb = count($categories); + if (0 === $nb) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("you have to set at least one itunes category"); + } + if ($nb > 3) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("you have to set at most three itunes categories"); + } + foreach ($categories as $i => $category) { + if (empty($category['main'])) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("you have to set the main category (category #$i)"); + } + } + $this->offsetSet('category', $categories); + return $this; + } + + /** + * Sets the artist value, default to the feed's author value + * + * @param string $author + * @return Zend_Feed_Builder_Header_Itunes + */ + public function setAuthor($author) + { + $this->offsetSet('author', $author); + return $this; + } + + /** + * Sets the owner of the postcast + * + * @param string $name default to the feed's author value + * @param string $email default to the feed's email value + * @return Zend_Feed_Builder_Header_Itunes + * @throws Zend_Feed_Builder_Exception + */ + public function setOwner($name = '', $email = '') + { + if (!empty($email)) { + /** + * @see Zend_Validate_EmailAddress + */ + require_once 'Zend/Validate/EmailAddress.php'; + $validate = new Zend_Validate_EmailAddress(); + if (!$validate->isValid($email)) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the itunes owner's email property"); + } + } + $this->offsetSet('owner', array('name' => $name, 'email' => $email)); + return $this; + } + + /** + * Sets the album/podcast art picture + * Default to the feed's image value + * + * @param string $image + * @return Zend_Feed_Builder_Header_Itunes + */ + public function setImage($image) + { + $this->offsetSet('image', $image); + return $this; + } + + /** + * Sets the short description of the podcast + * Default to the feed's description + * + * @param string $subtitle + * @return Zend_Feed_Builder_Header_Itunes + */ + public function setSubtitle($subtitle) + { + $this->offsetSet('subtitle', $subtitle); + return $this; + } + + /** + * Sets the longer description of the podcast + * Default to the feed's description + * + * @param string $summary + * @return Zend_Feed_Builder_Header_Itunes + */ + public function setSummary($summary) + { + $this->offsetSet('summary', $summary); + return $this; + } + + /** + * Prevent a feed from appearing + * + * @param string $block can be 'yes' or 'no' + * @return Zend_Feed_Builder_Header_Itunes + * @throws Zend_Feed_Builder_Exception + */ + public function setBlock($block) + { + $block = strtolower($block); + if (!in_array($block, array('yes', 'no'))) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("you have to set yes or no to the itunes block property"); + } + $this->offsetSet('block', $block); + return $this; + } + + /** + * Configuration of the parental advisory graphic + * + * @param string $explicit can be 'yes', 'no' or 'clean' + * @return Zend_Feed_Builder_Header_Itunes + * @throws Zend_Feed_Builder_Exception + */ + public function setExplicit($explicit) + { + $explicit = strtolower($explicit); + if (!in_array($explicit, array('yes', 'no', 'clean'))) { + /** + * @see Zend_Feed_Builder_Exception + */ + require_once 'Zend/Feed/Builder/Exception.php'; + throw new Zend_Feed_Builder_Exception("you have to set yes, no or clean to the itunes explicit property"); + } + $this->offsetSet('explicit', $explicit); + return $this; + } + + /** + * Sets a comma separated list of 12 keywords maximum + * + * @param string $keywords + * @return Zend_Feed_Builder_Header_Itunes + */ + public function setKeywords($keywords) + { + $this->offsetSet('keywords', $keywords); + return $this; + } + + /** + * Sets the new feed URL location + * + * @param string $url + * @return Zend_Feed_Builder_Header_Itunes + */ + public function setNewFeedUrl($url) + { + $this->offsetSet('new_feed_url', $url); + return $this; + } + + /** + * Read only properties accessor + * + * @param string $name property to read + * @return mixed + */ + public function __get($name) + { + if (!$this->offsetExists($name)) { + return NULL; + } + + return $this->offsetGet($name); + } + + /** + * Write properties accessor + * + * @param string $name name of the property to set + * @param mixed $value value to set + * @return void + */ + public function __set($name, $value) + { + $this->offsetSet($name, $value); + } + + /** + * Isset accessor + * + * @param string $key + * @return boolean + */ + public function __isset($key) + { + return $this->offsetExists($key); + } + + /** + * Unset accessor + * + * @param string $key + * @return void + */ + public function __unset($key) + { + if ($this->offsetExists($key)) { + $this->offsetUnset($key); + } + } + +} \ No newline at end of file diff --git a/src/Builder/Interface.php b/src/Builder/Interface.php new file mode 100644 index 00000000..26a41fc9 --- /dev/null +++ b/src/Builder/Interface.php @@ -0,0 +1,52 @@ +_element = $element; + } + + + /** + * Get a DOM representation of the element + * + * Returns the underlying DOM object, which can then be + * manipulated with full DOM methods. + * + * @return DOMDocument + */ + public function getDOM() + { + return $this->_element; + } + + + /** + * Update the object from a DOM element + * + * Take a DOMElement object, which may be originally from a call + * to getDOM() or may be custom created, and use it as the + * DOM tree for this Zend_Feed_Element. + * + * @param DOMElement $element + * @return void + */ + public function setDOM(DOMElement $element) + { + $this->_element = $this->_element->ownerDocument->importNode($element, true); + } + + /** + * Set the parent element of this object to another + * Zend_Feed_Element. + * + * @param Zend_Feed_Element $element + * @return void + */ + public function setParent(Zend_Feed_Element $element) + { + $this->_parentElement = $element; + $this->_appended = false; + } + + + /** + * Appends this element to its parent if necessary. + * + * @return void + */ + protected function ensureAppended() + { + if (!$this->_appended) { + $this->_parentElement->getDOM()->appendChild($this->_element); + $this->_appended = true; + $this->_parentElement->ensureAppended(); + } + } + + + /** + * Get an XML string representation of this element + * + * Returns a string of this element's XML, including the XML + * prologue. + * + * @return string + */ + public function saveXml() + { + // Return a complete document including XML prologue. + $doc = new DOMDocument($this->_element->ownerDocument->version, + $this->_element->ownerDocument->actualEncoding); + $doc->appendChild($doc->importNode($this->_element, true)); + return $doc->saveXML(); + } + + + /** + * Get the XML for only this element + * + * Returns a string of this element's XML without prologue. + * + * @return string + */ + public function saveXmlFragment() + { + return $this->_element->ownerDocument->saveXML($this->_element); + } + + + /** + * Map variable access onto the underlying entry representation. + * + * Get-style access returns a Zend_Feed_Element representing the + * child element accessed. To get string values, use method syntax + * with the __call() overriding. + * + * @param string $var The property to access. + * @return mixed + */ + public function __get($var) + { + $nodes = $this->_children($var); + $length = count($nodes); + + if ($length == 1) { + return new Zend_Feed_Element($nodes[0]); + } elseif ($length > 1) { + return array_map(create_function('$e', 'return new Zend_Feed_Element($e);'), $nodes); + } else { + // When creating anonymous nodes for __set chaining, don't + // call appendChild() on them. Instead we pass the current + // element to them as an extra reference; the child is + // then responsible for appending itself when it is + // actually set. This way "if ($foo->bar)" doesn't create + // a phantom "bar" element in our tree. + if (strpos($var, ':') !== false) { + list($ns, $elt) = explode(':', $var, 2); + $node = $this->_element->ownerDocument->createElementNS(Zend_Feed::lookupNamespace($ns), $elt); + } else { + $node = $this->_element->ownerDocument->createElement($var); + } + $node = new self($node); + $node->setParent($this); + return $node; + } + } + + + /** + * Map variable sets onto the underlying entry representation. + * + * @param string $var The property to change. + * @param string $val The property's new value. + * @return void + * @throws Zend_Feed_Exception + */ + public function __set($var, $val) + { + $this->ensureAppended(); + + $nodes = $this->_children($var); + if (!$nodes) { + if (strpos($var, ':') !== false) { + list($ns, $elt) = explode(':', $var, 2); + $node = $this->_element->ownerDocument->createElementNS(Zend_Feed::lookupNamespace($ns), $var, $val); + $this->_element->appendChild($node); + } else { + $node = $this->_element->ownerDocument->createElement($var, $val); + $this->_element->appendChild($node); + } + } elseif (count($nodes) > 1) { + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Cannot set the value of multiple tags simultaneously.'); + } else { + $nodes[0]->nodeValue = $val; + } + } + + + /** + * Map isset calls onto the underlying entry representation. + * + * @param string $var + * @return boolean + */ + public function __isset($var) + { + // Look for access of the form {ns:var}. We don't use + // _children() here because we can break out of the loop + // immediately once we find something. + if (strpos($var, ':') !== false) { + list($ns, $elt) = explode(':', $var, 2); + foreach ($this->_element->childNodes as $child) { + if ($child->localName == $elt && $child->prefix == $ns) { + return true; + } + } + } else { + foreach ($this->_element->childNodes as $child) { + if ($child->localName == $var) { + return true; + } + } + } + } + + + /** + * Get the value of an element with method syntax. + * + * Map method calls to get the string value of the requested + * element. If there are multiple elements that match, this will + * return an array of those objects. + * + * @param string $var The element to get the string value of. + * @param mixed $unused This parameter is not used. + * @return mixed The node's value, null, or an array of nodes. + */ + public function __call($var, $unused) + { + $nodes = $this->_children($var); + + if (!$nodes) { + return null; + } elseif (count($nodes) > 1) { + return $nodes; + } else { + return $nodes[0]->nodeValue; + } + } + + + /** + * Remove all children matching $var. + * + * @param string $var + * @return void + */ + public function __unset($var) + { + $nodes = $this->_children($var); + foreach ($nodes as $node) { + $parent = $node->parentNode; + $parent->removeChild($node); + } + } + + + /** + * Returns the nodeValue of this element when this object is used + * in a string context. + * + * @return string + */ + public function __toString() + { + return $this->_element->nodeValue; + } + + + /** + * Finds children with tagnames matching $var + * + * Similar to SimpleXML's children() method. + * + * @param string $var Tagname to match, can be either namespace:tagName or just tagName. + * @return array + */ + protected function _children($var) + { + $found = array(); + + // Look for access of the form {ns:var}. + if (strpos($var, ':') !== false) { + list($ns, $elt) = explode(':', $var, 2); + foreach ($this->_element->childNodes as $child) { + if ($child->localName == $elt && $child->prefix == $ns) { + $found[] = $child; + } + } + } else { + foreach ($this->_element->childNodes as $child) { + if ($child->localName == $var) { + $found[] = $child; + } + } + } + + return $found; + } + + + /** + * Required by the ArrayAccess interface. + * + * @param string $offset + * @return boolean + */ + public function offsetExists($offset) + { + if (strpos($offset, ':') !== false) { + list($ns, $attr) = explode(':', $offset, 2); + return $this->_element->hasAttributeNS(Zend_Feed::lookupNamespace($ns), $attr); + } else { + return $this->_element->hasAttribute($offset); + } + } + + + /** + * Required by the ArrayAccess interface. + * + * @param string $offset + * @return string + */ + public function offsetGet($offset) + { + if (strpos($offset, ':') !== false) { + list($ns, $attr) = explode(':', $offset, 2); + return $this->_element->getAttributeNS(Zend_Feed::lookupNamespace($ns), $attr); + } else { + return $this->_element->getAttribute($offset); + } + } + + + /** + * Required by the ArrayAccess interface. + * + * @param string $offset + * @param string $value + * @return string + */ + public function offsetSet($offset, $value) + { + $this->ensureAppended(); + + if (strpos($offset, ':') !== false) { + list($ns, $attr) = explode(':', $offset, 2); + return $this->_element->setAttributeNS(Zend_Feed::lookupNamespace($ns), $attr, $value); + } else { + return $this->_element->setAttribute($offset, $value); + } + } + + + /** + * Required by the ArrayAccess interface. + * + * @param string $offset + * @return boolean + */ + public function offsetUnset($offset) + { + if (strpos($offset, ':') !== false) { + list($ns, $attr) = explode(':', $offset, 2); + return $this->_element->removeAttributeNS(Zend_Feed::lookupNamespace($ns), $attr); + } else { + return $this->_element->removeAttribute($offset); + } + } + +} diff --git a/src/Entry/Abstract.php b/src/Entry/Abstract.php new file mode 100644 index 00000000..11633147 --- /dev/null +++ b/src/Entry/Abstract.php @@ -0,0 +1,124 @@ +loadXML($element); + @ini_restore('track_errors'); + + if (!$status) { + // prevent the class to generate an undefined variable notice (ZF-2590) + 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)'; + } + } + + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg"); + } + + $element = $doc->getElementsByTagName($this->_rootElement)->item(0); + if (!$element) { + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('No root <' . $this->_rootElement . '> element found, cannot parse feed.'); + } + } else { + $doc = new DOMDocument('1.0', 'utf-8'); + if ($this->_rootNamespace !== null) { + $element = $doc->createElementNS(Zend_Feed::lookupNamespace($this->_rootNamespace), $this->_rootElement); + } else { + $element = $doc->createElement($this->_rootElement); + } + } + } + + parent::__construct($element); + } + +} diff --git a/src/Entry/Atom.php b/src/Entry/Atom.php new file mode 100644 index 00000000..31e37a07 --- /dev/null +++ b/src/Entry/Atom.php @@ -0,0 +1,280 @@ +link('edit'); + if (!$deleteUri) { + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Cannot delete entry; no link rel="edit" is present.'); + } + + // DELETE + $client = Zend_Feed::getHttpClient(); + do { + $client->setUri($deleteUri); + if (Zend_Feed::getHttpMethodOverride()) { + $client->setHeader('X-HTTP-Method-Override', 'DELETE'); + $response = $client->request('POST'); + } else { + $response = $client->request('DELETE'); + } + $httpStatus = $response->getStatus(); + switch ((int) $httpStatus / 100) { + // Success + case 2: + return true; + // Redirect + case 3: + $deleteUri = $response->getHeader('Location'); + continue; + // Error + default: + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception("Expected response code 2xx, got $httpStatus"); + } + } while (true); + } + + + /** + * Save a new or updated Atom entry. + * + * Save is used to either create new entries or to save changes to + * existing ones. If we have a link rel="edit", we are changing + * an existing entry. In this case we re-serialize the entry and + * PUT it to the edit URI, checking for a 200 OK result. + * + * For posting new entries, you must specify the $postUri + * parameter to save() to tell the object where to post itself. + * We use $postUri and POST the serialized entry there, checking + * for a 201 Created response. If the insert is successful, we + * then parse the response from the POST to get any values that + * the server has generated: an id, an updated time, and its new + * link rel="edit". + * + * @param string $postUri Location to POST for creating new entries. + * @return void + * @throws Zend_Feed_Exception + */ + public function save($postUri = null) + { + if ($this->id()) { + // If id is set, look for link rel="edit" in the + // entry object and PUT. + $editUri = $this->link('edit'); + if (!$editUri) { + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Cannot edit entry; no link rel="edit" is present.'); + } + + $client = Zend_Feed::getHttpClient(); + $client->setUri($editUri); + if (Zend_Feed::getHttpMethodOverride()) { + $client->setHeaders(array('X-HTTP-Method-Override: PUT', + 'Content-Type: ' . self::CONTENT_TYPE)); + $client->setRawData($this->saveXML()); + $response = $client->request('POST'); + } else { + $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'; + throw new Zend_Feed_Exception('Expected response code 200, got ' . $response->getStatus()); + } + } else { + if ($postUri === null) { + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('PostURI must be specified to save new entries.'); + } + $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'; + throw new Zend_Feed_Exception('Expected response code 201, got ' + . $response->getStatus()); + } + } + + // Update internal properties using $client->responseBody; + @ini_set('track_errors', 1); + $newEntry = new DOMDocument; + $status = @$newEntry->loadXML($response->getBody()); + @ini_restore('track_errors'); + + if (!$status) { + // prevent the class to generate an undefined variable notice (ZF-2590) + 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)'; + } + } + + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('XML cannot be parsed: ' . $php_errormsg); + } + + $newEntry = $newEntry->getElementsByTagName($this->_rootElement)->item(0); + if (!$newEntry) { + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('No root element found in server response:' + . "\n\n" . $client->responseBody); + } + + if ($this->_element->parentNode) { + $oldElement = $this->_element; + $this->_element = $oldElement->ownerDocument->importNode($newEntry, true); + $oldElement->parentNode->replaceChild($this->_element, $oldElement); + } else { + $this->_element = $newEntry; + } + } + + + /** + * Easy access to tags keyed by "rel" attributes. + * + * If $elt->link() is called with no arguments, we will attempt to + * return the value of the tag(s) like all other + * method-syntax attribute access. If an argument is passed to + * link(), however, then we will return the "href" value of the + * first tag that has a "rel" attribute matching $rel: + * + * $elt->link(): returns the value of the link tag. + * $elt->link('self'): returns the href from the first in the entry. + * + * @param string $rel The "rel" attribute to look for. + * @return mixed + */ + public function link($rel = null) + { + if ($rel === null) { + return parent::__call('link', null); + } + + // index link tags by their "rel" attribute. + $links = parent::__get('link'); + if (!is_array($links)) { + if ($links instanceof Zend_Feed_Element) { + $links = array($links); + } else { + return $links; + } + } + + foreach ($links as $link) { + if (empty($link['rel'])) { + continue; + } + if ($rel == $link['rel']) { + return $link['href']; + } + } + + return null; + } + +} diff --git a/src/Entry/Rss.php b/src/Entry/Rss.php new file mode 100644 index 00000000..b2d72501 --- /dev/null +++ b/src/Entry/Rss.php @@ -0,0 +1,122 @@ +_element->lookupPrefix('http://purl.org/rss/1.0/modules/content/'); + return parent::__get("$prefix:encoded"); + default: + return parent::__get($var); + } + } + + /** + * Overwrites parent::_set method to enable write access + * to content:encoded element. + * + * @param string $var The property to change. + * @param string $val The property's new value. + * @return void + */ + public function __set($var, $value) + { + switch ($var) { + case 'content': + parent::__set('content:encoded', $value); + break; + default: + parent::__set($var, $value); + } + } + + /** + * Overwrites parent::_isset method to enable access + * to content:encoded element. + * + * @param string $var + * @return boolean + */ + public function __isset($var) + { + switch ($var) { + case 'content': + // don't use other callback to prevent invalid returned value + return $this->content() !== null; + default: + return parent::__isset($var); + } + } + + /** + * Overwrites parent::_call method to enable read access + * to content:encoded element. + * Please note that method-style write access is not currently supported + * by parent method, consequently this method doesn't as well. + * + * @param string $var The element to get the string value of. + * @param mixed $unused This parameter is not used. + * @return mixed The node's value, null, or an array of nodes. + */ + public function __call($var, $unused) + { + switch ($var) { + case 'content': + $prefix = $this->_element->lookupPrefix('http://purl.org/rss/1.0/modules/content/'); + return parent::__call("$prefix:encoded", $unused); + default: + return parent::__call($var, $unused); + } + } +} diff --git a/src/Exception.php b/src/Exception.php new file mode 100644 index 00000000..45a554ea --- /dev/null +++ b/src/Exception.php @@ -0,0 +1,42 @@ +s). + * + * @var string + */ + protected $_entryElementName = 'item'; + + /** + * The default namespace for RSS channels. + * + * @var string + */ + protected $_defaultNamespace = 'rss'; + + /** + * Override Zend_Feed_Abstract to set up the $_element and $_entries aliases. + * + * @return void + * @throws Zend_Feed_Exception + */ + public function __wakeup() + { + parent::__wakeup(); + + // Find the base channel element and create an alias to it. + if ($this->_element->firstChild->nodeName == 'rdf:RDF') { + $this->_element = $this->_element->firstChild; + } else { + $this->_element = $this->_element->getElementsByTagName('channel')->item(0); + } + if (!$this->_element) { + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('No root element found, cannot parse channel.'); + } + + // Find the entries and save a pointer to them for speed and + // simplicity. + $this->_buildEntryCache(); + } + + + /** + * Make accessing some individual elements of the channel easier. + * + * Special accessors 'item' and 'items' are provided so that if + * you wish to iterate over an RSS channel's items, you can do so + * using foreach ($channel->items as $item) or foreach + * ($channel->item as $item). + * + * @param string $var The property to access. + * @return mixed + */ + public function __get($var) + { + switch ($var) { + case 'item': + // fall through to the next case + case 'items': + return $this; + + default: + return parent::__get($var); + } + } + + /** + * Generate the header of the feed when working in write mode + * + * @param array $array the data to use + * @return DOMElement root node + */ + protected function _mapFeedHeaders($array) + { + $channel = $this->_element->createElement('channel'); + + $title = $this->_element->createElement('title'); + $title->appendChild($this->_element->createCDATASection($array->title)); + $channel->appendChild($title); + + $link = $this->_element->createElement('link', $array->link); + $channel->appendChild($link); + + $desc = isset($array->description) ? $array->description : ''; + $description = $this->_element->createElement('description'); + $description->appendChild($this->_element->createCDATASection($desc)); + $channel->appendChild($description); + + $pubdate = isset($array->lastUpdate) ? $array->lastUpdate : time(); + $pubdate = $this->_element->createElement('pubDate', gmdate('r', $pubdate)); + $channel->appendChild($pubdate); + + if (isset($array->published)) { + $lastBuildDate = $this->_element->createElement('lastBuildDate', gmdate('r', $array->published)); + $channel->appendChild($lastBuildDate); + } + + $editor = ''; + if (!empty($array->email)) { + $editor .= $array->email; + } + if (!empty($array->author)) { + $editor .= ' (' . $array->author . ')'; + } + if (!empty($editor)) { + $author = $this->_element->createElement('managingEditor', ltrim($editor)); + $channel->appendChild($author); + } + if (isset($array->webmaster)) { + $channel->appendChild($this->_element->createElement('webMaster', $array->webmaster)); + } + + if (!empty($array->copyright)) { + $copyright = $this->_element->createElement('copyright', $array->copyright); + $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'); + $imagetitle->appendChild($this->_element->createCDATASection($array->title)); + $image->appendChild($imagetitle); + $imagelink = $this->_element->createElement('link', $array->link); + $image->appendChild($imagelink); + + $channel->appendChild($image); + } + + $generator = !empty($array->generator) ? $array->generator : 'Zend_Feed'; + $generator = $this->_element->createElement('generator', $generator); + $channel->appendChild($generator); + + if (!empty($array->language)) { + $language = $this->_element->createElement('language', $array->language); + $channel->appendChild($language); + } + + $doc = $this->_element->createElement('docs', 'http://blogs.law.harvard.edu/tech/rss'); + $channel->appendChild($doc); + + if (isset($array->cloud)) { + $cloud = $this->_element->createElement('cloud'); + $cloud->setAttribute('domain', $array->cloud['uri']->getHost()); + $cloud->setAttribute('port', $array->cloud['uri']->getPort()); + $cloud->setAttribute('path', $array->cloud['uri']->getPath()); + $cloud->setAttribute('registerProcedure', $array->cloud['procedure']); + $cloud->setAttribute('protocol', $array->cloud['protocol']); + $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); + } + + if (isset($array->textInput)) { + $textinput = $this->_element->createElement('textInput'); + $textinput->appendChild($this->_element->createElement('title', $array->textInput['title'])); + $textinput->appendChild($this->_element->createElement('description', $array->textInput['description'])); + $textinput->appendChild($this->_element->createElement('name', $array->textInput['name'])); + $textinput->appendChild($this->_element->createElement('link', $array->textInput['link'])); + $channel->appendChild($textinput); + } + + if (isset($array->skipHours)) { + $skipHours = $this->_element->createElement('skipHours'); + foreach ($array->skipHours as $hour) { + $skipHours->appendChild($this->_element->createElement('hour', $hour)); + } + $channel->appendChild($skipHours); + } + + if (isset($array->skipDays)) { + $skipDays = $this->_element->createElement('skipDays'); + foreach ($array->skipDays as $day) { + $skipDays->appendChild($this->_element->createElement('day', $day)); + } + $channel->appendChild($skipDays); + } + + if (isset($array->itunes)) { + $this->_buildiTunes($channel, $array); + } + + return $channel; + } + + /** + * Adds the iTunes extensions to a root node + * + * @param DOMElement $root + * @param array $array + * @return void + */ + private function _buildiTunes(DOMElement $root, $array) + { + /* author node */ + $author = ''; + if (isset($array->itunes->author)) { + $author = $array->itunes->author; + } elseif (isset($array->author)) { + $author = $array->author; + } + if (!empty($author)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:author', $author); + $root->appendChild($node); + } + + /* owner node */ + $author = ''; + $email = ''; + if (isset($array->itunes->owner)) { + if (isset($array->itunes->owner['name'])) { + $author = $array->itunes->owner['name']; + } + if (isset($array->itunes->owner['email'])) { + $email = $array->itunes->owner['email']; + } + } + if (empty($author) && isset($array->author)) { + $author = $array->author; + } + if (empty($email) && isset($array->email)) { + $email = $array->email; + } + if (!empty($author) || !empty($email)) { + $owner = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:owner'); + if (!empty($author)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:name', $author); + $owner->appendChild($node); + } + if (!empty($email)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:email', $email); + $owner->appendChild($node); + } + $root->appendChild($owner); + } + $image = ''; + if (isset($array->itunes->image)) { + $image = $array->itunes->image; + } elseif (isset($array->image)) { + $image = $array->image; + } + if (!empty($image)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:image'); + $node->setAttribute('href', $image); + $root->appendChild($node); + } + $subtitle = ''; + if (isset($array->itunes->subtitle)) { + $subtitle = $array->itunes->subtitle; + } elseif (isset($array->description)) { + $subtitle = $array->description; + } + if (!empty($subtitle)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:subtitle', $subtitle); + $root->appendChild($node); + } + $summary = ''; + if (isset($array->itunes->summary)) { + $summary = $array->itunes->summary; + } elseif (isset($array->description)) { + $summary = $array->description; + } + if (!empty($summary)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:summary', $summary); + $root->appendChild($node); + } + if (isset($array->itunes->block)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:block', $array->itunes->block); + $root->appendChild($node); + } + if (isset($array->itunes->explicit)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:explicit', $array->itunes->explicit); + $root->appendChild($node); + } + if (isset($array->itunes->keywords)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:keywords', $array->itunes->keywords); + $root->appendChild($node); + } + if (isset($array->itunes->new_feed_url)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:new-feed-url', $array->itunes->new_feed_url); + $root->appendChild($node); + } + if (isset($array->itunes->category)) { + foreach ($array->itunes->category as $i => $category) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); + $node->setAttribute('text', $category['main']); + $root->appendChild($node); + $add_end_category = false; + if (!empty($category['sub'])) { + $add_end_category = true; + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); + $node->setAttribute('text', $category['sub']); + $root->appendChild($node); + } + if ($i > 0 || $add_end_category) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); + $root->appendChild($node); + } + } + } + } + + /** + * Generate the entries of the feed when working in write mode + * + * The following nodes are constructed for each feed entry + * + * entry title + * url to feed entry + * url to feed entry + * short text + * long version, can contain html + * + * + * @param DOMElement $root the root node to use + * @param array $array the data to use + * @return void + */ + protected function _mapFeedEntries(DOMElement $root, $array) + { + Zend_Feed::registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/'); + + foreach ($array as $dataentry) { + $item = $this->_element->createElement('item'); + + $title = $this->_element->createElement('title'); + $title->appendChild($this->_element->createCDATASection($dataentry->title)); + $item->appendChild($title); + + $link = $this->_element->createElement('link', $dataentry->link); + $item->appendChild($link); + + if (isset($dataentry->guid)) { + $guid = $this->_element->createElement('guid', $dataentry->guid); + $item->appendChild($guid); + } + + $description = $this->_element->createElement('description'); + $description->appendChild($this->_element->createCDATASection($dataentry->description)); + $item->appendChild($description); + + if (isset($dataentry->content)) { + $content = $this->_element->createElement('content:encoded'); + $content->appendChild($this->_element->createCDATASection($dataentry->content)); + $item->appendChild($content); + } + + $pubdate = isset($dataentry->lastUpdate) ? $dataentry->lastUpdate : time(); + $pubdate = $this->_element->createElement('pubDate', gmdate('r', $pubdate)); + $item->appendChild($pubdate); + + if (isset($dataentry->category)) { + foreach ($dataentry->category as $category) { + $node = $this->_element->createElement('category', $category['term']); + if (isset($category['scheme'])) { + $node->setAttribute('domain', $category['scheme']); + } + $item->appendChild($node); + } + } + + if (isset($dataentry->source)) { + $source = $this->_element->createElement('source', $dataentry->source['title']); + $source->setAttribute('url', $dataentry->source['url']); + $item->appendChild($source); + } + + if (isset($dataentry->comments)) { + $comments = $this->_element->createElement('comments', $dataentry->comments); + $item->appendChild($comments); + } + if (isset($dataentry->commentRss)) { + $comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/', + 'wfw:commentRss', + $dataentry->commentRss); + $item->appendChild($comments); + } + + + if (isset($dataentry->enclosure)) { + foreach ($dataentry->enclosure as $enclosure) { + $node = $this->_element->createElement('enclosure'); + $node->setAttribute('url', $enclosure['url']); + if (isset($enclosure['type'])) { + $node->setAttribute('type', $enclosure['type']); + } + if (isset($enclosure['length'])) { + $node->setAttribute('length', $enclosure['length']); + } + $item->appendChild($node); + } + } + + $root->appendChild($item); + } + } + + /** + * Override Zend_Feed_Element to include root node + * + * @return string + */ + public function saveXml() + { + // Return a complete document including XML prologue. + $doc = new DOMDocument($this->_element->ownerDocument->version, + $this->_element->ownerDocument->actualEncoding); + $root = $doc->createElement('rss'); + + // Use rss version 2.0 + $root->setAttribute('version', '2.0'); + + // Content namespace + $root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:content', 'http://purl.org/rss/1.0/modules/content/'); + $root->appendChild($doc->importNode($this->_element, true)); + + // Append root node + $doc->appendChild($root); + + // Format output + $doc->formatOutput = true; + + return $doc->saveXML(); + } + + /** + * Send feed to a http client with the correct header + * + * @return void + * @throws Zend_Feed_Exception if headers have already been sent + */ + public function send() + { + if (headers_sent()) { + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Cannot send RSS because headers have already been sent.'); + } + + header('Content-Type: application/rss+xml; charset=' . $this->_element->ownerDocument->actualEncoding); + + echo $this->saveXml(); + } + +} diff --git a/test/AllTests.php b/test/AllTests.php new file mode 100644 index 00000000..0d61b140 --- /dev/null +++ b/test/AllTests.php @@ -0,0 +1,83 @@ +addTestSuite('Zend_Feed_ArrayAccessTest'); + $suite->addTestSuite('Zend_Feed_AtomEntryOnlyTest'); + $suite->addTestSuite('Zend_Feed_AtomPublishingTest'); + $suite->addTestSuite('Zend_Feed_CountTest'); + $suite->addTestSuite('Zend_Feed_ElementTest'); + $suite->addTestSuite('Zend_Feed_ImportTest'); + $suite->addTestSuite('Zend_Feed_IteratorTest'); + $suite->addTestSuite('Zend_Feed_Entry_RssTest'); + + return $suite; + } +} + +if (PHPUnit_MAIN_METHOD == 'Zend_Feed_AllTests::main') { + Zend_Feed_AllTests::main(); +} diff --git a/test/ArrayAccessTest.php b/test/ArrayAccessTest.php new file mode 100644 index 00000000..05e02927 --- /dev/null +++ b/test/ArrayAccessTest.php @@ -0,0 +1,99 @@ +_feed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); + $this->_nsfeed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeedNamespaced.xml'); + } + + public function testExists() + { + $this->assertFalse(isset($this->_feed[-1]), 'Negative array access should fail'); + $this->assertTrue(isset($this->_feed['version']), 'Feed version should be set'); + + $this->assertFalse(isset($this->_nsfeed[-1]), 'Negative array access should fail'); + $this->assertTrue(isset($this->_nsfeed['version']), 'Feed version should be set'); + } + + public function testGet() + { + $this->assertEquals($this->_feed['version'], '1.0', 'Feed version should be 1.0'); + $this->assertEquals($this->_nsfeed['version'], '1.0', 'Feed version should be 1.0'); + } + + public function testSet() + { + $this->_feed['category'] = 'tests'; + $this->assertTrue(isset($this->_feed['category']), 'Feed category should be set'); + $this->assertEquals($this->_feed['category'], 'tests', 'Feed category should be tests'); + + $this->_nsfeed['atom:category'] = 'tests'; + $this->assertTrue(isset($this->_nsfeed['atom:category']), 'Feed category should be set'); + $this->assertEquals($this->_nsfeed['atom:category'], 'tests', 'Feed category should be tests'); + + // Changing an existing index. + $oldEntry = $this->_feed['version']; + $this->_feed['version'] = '1.1'; + $this->assertTrue($oldEntry != $this->_feed['version'], 'Version should have changed'); + } + + public function testUnset() + { + $feed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); + unset($feed['version']); + $this->assertFalse(isset($feed['version']), 'Version should be unset'); + $this->assertEquals('', $feed['version'], 'Version should be equal to the empty string'); + + $nsfeed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeedNamespaced.xml'); + unset($nsfeed['version']); + $this->assertFalse(isset($nsfeed['version']), 'Version should be unset'); + $this->assertEquals('', $nsfeed['version'], 'Version should be equal to the empty string'); + } + +} diff --git a/test/AtomEntryOnlyTest.php b/test/AtomEntryOnlyTest.php new file mode 100644 index 00000000..90096453 --- /dev/null +++ b/test/AtomEntryOnlyTest.php @@ -0,0 +1,65 @@ +assertEquals(1, $feed->count(), 'The entry-only feed should report one entry.'); + + foreach ($feed as $entry); + $this->assertEquals('Zend_Feed_Entry_Atom', get_class($entry), + 'The single entry should be an instance of Zend_Feed_Entry_Atom'); + + $this->assertEquals('1', $entry->id(), 'The single entry should have id 1'); + $this->assertEquals('Bug', $entry->title(), 'The entry\'s title should be "Bug"'); + } + +} diff --git a/test/AtomPublishingTest.php b/test/AtomPublishingTest.php new file mode 100644 index 00000000..6738736c --- /dev/null +++ b/test/AtomPublishingTest.php @@ -0,0 +1,148 @@ +_uri = 'http://fubar.com/myFeed'; + } + + public function tearDown() + { + Zend_Feed::setHttpClient(new Zend_Http_Client()); + } + + public function testPost() + { + Zend_Feed::setHttpClient(new TestClient()); + + $entry = new Zend_Feed_Entry_Atom(); + + /* Give the entry its initial values. */ + $entry->title = 'Entry 1'; + $entry->content = '1.1'; + $entry->content['type'] = 'text'; + + /* Do the initial post. The base feed URI is the same as the + * POST URI, so just supply save() with that. */ + $entry->save($this->_uri); + + /* $entry will be filled in with any elements returned by the + * server (id, updated, link rel="edit", etc). */ + $this->assertEquals('1', $entry->id(), 'Expected id to be 1'); + $this->assertEquals('Entry 1', $entry->title(), 'Expected title to be "Entry 1"'); + $this->assertEquals('1.1', $entry->content(), 'Expected content to be "1.1"'); + $this->assertEquals('text', $entry->content['type'], 'Expected content/type to be "text"'); + $this->assertEquals('2005-05-23T16:26:00-08:00', $entry->updated(), 'Expected updated date of 2005-05-23T16:26:00-08:00'); + $this->assertEquals('http://fubar.com/myFeed/1/1/', $entry->link('edit'), 'Expected edit URI of http://fubar.com/myFeed/1/1/'); + } + + public function testEdit() + { + Zend_Feed::setHttpClient(new TestClient()); + $contents = file_get_contents(dirname(__FILE__) . '/_files/AtomPublishingTest-before-update.xml'); + + /* The base feed URI is the same as the POST URI, so just supply the + * Zend_Feed_Entry_Atom object with that. */ + $entry = new Zend_Feed_Entry_Atom($this->_uri, $contents); + + /* Initial state. */ + $this->assertEquals('2005-05-23T16:26:00-08:00', $entry->updated(), 'Initial state of updated timestamp does not match'); + $this->assertEquals('http://fubar.com/myFeed/1/1/', $entry->link('edit'), 'Initial state of edit link does not match'); + + /* Just change the entry's properties directly. */ + $entry->content = '1.2'; + + /* Then save the changes. */ + $entry->save(); + + /* New state. */ + $this->assertEquals('1.2', $entry->content(), 'Content change did not stick'); + $this->assertEquals('2005-05-23T16:27:00-08:00', $entry->updated(), 'New updated link is not correct'); + $this->assertEquals('http://fubar.com/myFeed/1/2/', $entry->link('edit'), 'New edit link is not correct'); + } +} + +/** + * A test wrapper around Zend_Http_Client, not actually performing + * the request. + * + */ +class TestClient extends Zend_Http_Client +{ + public function request($method = null) + { + $code = 400; + $body = ''; + + switch ($method) { + case self::POST: + $code = 201; + $body = file_get_contents(dirname(__FILE__) . '/_files/AtomPublishingTest-created-entry.xml'); + break; + + case self::PUT: + $doc1 = new DOMDocument(); + $doc1->load(dirname(__FILE__) . '/_files/AtomPublishingTest-expected-update.xml'); + $doc2 = new DOMDocument(); + $doc2->loadXML($this->raw_post_data); + if ($doc1->saveXml() == $doc2->saveXml()) { + $code = 200; + $body = file_get_contents(dirname(__FILE__) . '/_files/AtomPublishingTest-updated-entry.xml'); + } + break; + + default: + break; + } + + return new Zend_Http_Response($code, array(), $body); + } +} diff --git a/test/CountTest.php b/test/CountTest.php new file mode 100644 index 00000000..79a7bd9a --- /dev/null +++ b/test/CountTest.php @@ -0,0 +1,52 @@ +assertEquals($f->count(), 2, 'Feed count should be 2'); + } + +} diff --git a/test/ElementTest.php b/test/ElementTest.php new file mode 100644 index 00000000..381d6455 --- /dev/null +++ b/test/ElementTest.php @@ -0,0 +1,92 @@ +author->name['last'] = 'hagenbuch'; + $e->author->name['first'] = 'chuck'; + $e->author->name->{'chuck:url'} = 'marina.horde.org'; + + $e->author->title['foo'] = 'bar'; + if ($e->pants()) { + $this->fail(' does not exist, it should not have a true value'); + // This should not create an element in the actual tree. + } + if ($e->pants()) { + $this->fail(' should not have been created by testing for it'); + // This should not create an element in the actual tree. + } + + $xml = $e->saveXml(); + + $this->assertFalse(strpos($xml, 'pants'), ' should not be in the xml output'); + $this->assertTrue(strpos($xml, 'marina.horde.org') !== false, 'the url attribute should be set'); + } + + public function testStrings() + { + $xml = " + Using C++ Intrinsic Functions for Pipelined Text Processing + http://www.oreillynet.com/pub/wlg/8356 + + +
+ A good C++ programming technique that has almost no published material available on the WWW relates to using the special pipeline instructions in modern CPUs for faster text processing. Here's example code using C++ intrinsic functions to give a fourfold speed increase for a UTF-8 to UTF-16 converter compared to the original C/C++ code. +
+
+ Rick Jelliffe + 2005-11-07T08:15:57-08:00 +
"; + + $entry = new Zend_Feed_Entry_Atom('uri', $xml); + + $this->assertTrue($entry->summary instanceof Zend_Feed_Element, '__get access should return an Zend_Feed_Element instance'); + $this->assertFalse($entry->summary() instanceof Zend_Feed_Element, 'method access should not return an Zend_Feed_Element instance'); + $this->assertTrue(is_string($entry->summary()), 'method access should return a string'); + $this->assertFalse(is_string($entry->summary), '__get access should not return a string'); + } + +} diff --git a/test/Entry/RssTest.php b/test/Entry/RssTest.php new file mode 100644 index 00000000..70ef87fb --- /dev/null +++ b/test/Entry/RssTest.php @@ -0,0 +1,80 @@ +assertType('Zend_Feed_Rss', $feed); + + $item = $feed->current(); + $this->assertType('Zend_Feed_Entry_Rss', $item); + + $this->assertTrue(isset($item->content)); + $this->assertContains( + 'http://framework.zend.com/fisheye/changelog/Zend_Framework/?cs=7757', + $item->content->__toString() + ); + $this->assertContains( + 'http://framework.zend.com/fisheye/changelog/Zend_Framework/?cs=7757', + $item->content() + ); + $item->content = 'foo'; + $this->assertEquals('foo', $item->content->__toString()); + } + + public function testContentEncodedNullIfEmpty() + { + $feed = Zend_Feed::importFile(dirname(__FILE__) . '/../_files/TestFeedEntryRssContentEncoded.xml'); + $this->assertType('Zend_Feed_Rss', $feed); + + $feed->next(); + $item = $feed->current(); + $this->assertType('Zend_Feed_Entry_Rss', $item); + $this->assertFalse(isset($item->content)); + $this->assertNull($item->content()); + // $this->assertNull($item->content); // always return DOMElement Object + } + +} diff --git a/test/ImportTest.php b/test/ImportTest.php new file mode 100644 index 00000000..75b09cd0 --- /dev/null +++ b/test/ImportTest.php @@ -0,0 +1,446 @@ +_adapter = new Zend_Http_Client_Adapter_Test(); + Zend_Feed::setHttpClient(new Zend_Http_Client(null, array('adapter' => $this->_adapter))); + $this->_client = Zend_Feed::getHttpClient(); + $this->_feedDir = dirname(__FILE__) . '/_files'; + } + + /** + * Test an atom feed generated by google's Blogger platform + */ + public function testAtomGoogle() + { + $this->_importAtomValid('AtomTestGoogle.xml'); + } + + /** + * Test an atom feed generated by mozillaZine.org + */ + public function testAtomMozillazine() + { + $this->_importAtomValid('AtomTestMozillazine.xml'); + } + + /** + * Test an atom feed generated by O'Reilly + */ + public function testAtomOReilly() + { + $this->_importAtomValid('AtomTestOReilly.xml'); + } + + /** + * Test an atom feed generated by PlanetPHP + */ + public function testAtomPlanetPHP() + { + $this->_importAtomValid('AtomTestPlanetPHP.xml'); + } + + /** + * Test a small atom feed + */ + public function testAtomSample1() + { + $this->_importAtomValid('AtomTestSample1.xml'); + } + + /** + * Test a small atom feed without any entries + */ + public function testAtomSample2() + { + $this->_importAtomValid('AtomTestSample2.xml'); + } + + /** + * Test an atom feed with a
tag missing + */ + public function testAtomSample3() + { + $this->_importInvalid('AtomTestSample3.xml'); + } + + /** + * Test an atom feed with links within entries + */ + public function testAtomSample4() + { + $this->_importAtomValid('AtomTestSample4.xml'); + } + + /** + * Test a RSS feed generated by UserLand Frontier v9.5 + */ + public function testRssHarvardLaw() + { + $this->_importRssValid('RssTestHarvardLaw.xml'); + } + + /** + * Test a RSS feed generated by PlanetPHP + */ + public function testRssPlanetPHP() + { + $this->_importRssValid('RssTestPlanetPHP.xml'); + } + + /** + * Test a RSS feed generated by Slashdot + */ + public function testRssSlashdot() + { + $this->_importRssValid('RssTestSlashdot.xml'); + } + + /** + * Test a RSS feed generated by CNN + */ + public function testRssCNN() + { + $this->_importRssValid('RssTestCNN.xml'); + } + + /** + * Test a valid RSS 0.91 sample + */ + public function testRss091Sample1() + { + $this->_importRssValid('RssTest091Sample1.xml'); + } + + /** + * Test a valid RSS 0.91 sample + */ + public function testRss092Sample1() + { + $this->_importRssValid('RssTest092Sample1.xml'); + } + + /** + * Test a valid RSS 1.0 sample + */ + public function testRss100Sample1() + { + $feed = $this->_importRssValid('RssTest100Sample1.xml'); + $this->assertEquals(2, $feed->count()); + } + + /** + * Test a valid RSS 1.0 sample with some extensions in it + */ + public function testRss100Sample2() + { + $feed = $this->_importRssValid('RssTest100Sample2.xml'); + $this->assertEquals(1, $feed->count()); + } + + /** + * Test a valid RSS 2.0 sample + */ + public function testRss200Sample1() + { + $this->_importRssValid('RssTest200Sample1.xml'); + } + + /** + * Test the import of a RSS feed from an array + */ + public function testRssImportFullArray() + { + $feed = Zend_Feed::importArray($this->_getFullArray(), 'rss'); + $this->assertType('Zend_Feed_Rss', $feed); + } + + /** + * Test the import of a RSS feed from an array + */ + public function testAtomImportFullArray() + { + $feed = Zend_Feed::importArray($this->_getFullArray(), 'atom'); + } + + /** + * Test the import of a RSS feed from a builder + */ + public function testRssImportFullBuilder() + { + $feed = Zend_Feed::importBuilder(new Zend_Feed_Builder($this->_getFullArray()), 'rss'); + $this->assertType('Zend_Feed_Rss', $feed); + } + + /** + * Test the import of a full iTunes RSS feed from a builder + */ + public function testRssImportFulliTunesBuilder() + { + $array = $this->_getFullArray(); + $array['itunes']['author'] = 'iTunes Author'; + $array['itunes']['owner'] = array('name' => 'iTunes Owner', + 'email' => 'itunes@example.com'); + $array['itunes']['image'] = 'http://www.example/itunes.png'; + $array['itunes']['subtitle'] = 'iTunes subtitle'; + $array['itunes']['summary'] = 'iTunes summary'; + $array['itunes']['explicit'] = 'clean'; + $array['itunes']['block'] = 'no'; + $array['itunes']['new-feed-url'] = 'http://www.example/itunes.xml'; + $feed = Zend_Feed::importBuilder(new Zend_Feed_Builder($array), 'rss'); + $this->assertType('Zend_Feed_Rss', $feed); + } + + /** + * Test the import of an Atom feed from a builder + */ + public function testAtomImportFullBuilder() + { + $feed = Zend_Feed::importBuilder(new Zend_Feed_Builder($this->_getFullArray()), 'atom'); + + } + + /** + * Test the import of an Atom feed from a builder + */ + public function testAtomImportFullBuilderValid() + { + $feed = Zend_Feed::importBuilder(new Zend_Feed_Builder($this->_getFullArray()), 'atom'); + + $feed = Zend_Feed::importString($feed->saveXml()); + $this->assertType('Zend_Feed_Atom', $feed); + } + + /** + * Check the validity of the builder import (rss) + */ + public function testRssImportFullBuilderValid() + { + $feed = Zend_Feed::importBuilder(new Zend_Feed_Builder($this->_getFullArray()), 'rss'); + $this->assertType('Zend_Feed_Rss', $feed); + $feed = Zend_Feed::importString($feed->saveXml()); + $this->assertType('Zend_Feed_Rss', $feed); + } + + /** + * Test the return of a link() call (atom) + */ + public function testAtomGetLink() + { + $feed = Zend_Feed::importBuilder(new Zend_Feed_Builder($this->_getFullArray()), 'atom'); + $this->assertType('Zend_Feed_Atom', $feed); + $feed = Zend_Feed::importString($feed->saveXml()); + $this->assertType('Zend_Feed_Atom', $feed); + $href = $feed->link('self'); + $this->assertEquals('http://www.example.com', $href); + } + + /** + * Imports an invalid feed and ensure everything works as expected + * even if XDebug is running (ZF-2590). + */ + public function testImportInvalidIsXdebugAware() + { + if (!function_exists('xdebug_is_enabled')) { + $this->markTestIncomplete('XDebug not installed'); + } + + $response = new Zend_Http_Response(200, array(), ''); + $this->_adapter->setResponse($response); + + try { + $feed = Zend_Feed::import('http://localhost'); + $this->fail('Expected Zend_Feed_Exception not thrown'); + } catch (Zend_Feed_Exception $e) { + $this->assertType('Zend_Feed_Exception', $e); + $this->assertRegExp('/(XDebug is running|Empty string)/', $e->getMessage()); + } + } + + /** + * Returns the array used by Zend_Feed::importArray + * and Zend_Feed::importBuilder tests + * + * @return array + */ + protected function _getFullArray() + { + $array = array('title' => 'Title of the feed', + 'link' => 'http://www.example.com', + 'description' => 'Description of the feed', + 'author' => 'Olivier Sirven', + 'email' => 'olivier@elma.fr', + 'webmaster' => 'olivier@elma.fr', + 'charset' => 'iso-8859-15', + 'lastUpdate' => time(), + 'published' => strtotime('2007-02-27'), + 'copyright' => 'Common Creative', + 'image' => 'http://www.example/images/icon.png', + 'language' => 'en', + 'ttl' => 60, + 'rating' => ' (PICS-1.1 "http://www.gcf.org/v2.5" labels + on "1994.11.05T08:15-0500" + exp "1995.12.31T23:59-0000" + for "http://www.greatdocs.com/foo.html" + by "George Sanderson, Jr." + ratings (suds 0.5 density 0 color/hue 1))', + 'cloud' => array('domain' => 'rpc.sys.com', + 'path' => '/rpc', + 'registerProcedure' => 'webServices.pingMe', + 'protocol' => 'xml-rpc'), + 'textInput' => array('title' => 'subscribe', + 'description' => 'enter your email address to subscribe by mail', + 'name' => 'email', + 'link' => 'http://www.example.com/subscribe'), + 'skipHours' => array(1, 13, 17), + 'skipDays' => array('Saturday', 'Sunday'), + 'itunes' => array('block' => 'no', + 'keywords' => 'example,itunes,podcast', + 'category' => array(array('main' => 'Technology', + 'sub' => 'Gadgets'), + array('main' => 'Music'))), + 'entries' => array(array('guid' => time(), + 'title' => 'First article', + 'link' => 'http://www.example.com', + 'description' => 'First article description', + 'content' => 'First article content', + 'lastUpdate' => time(), + 'comments' => 'http://www.example.com/#comments', + 'commentRss' => 'http://www.example.com/comments.xml', + 'source' => array('title' => 'Original title', + 'url' => 'http://www.domain.com'), + 'category' => array(array('term' => 'test category', + 'scheme' => 'http://www.example.com/scheme'), + array('term' => 'another category') + ), + 'enclosure' => array(array('url' => 'http://www.example.com/podcast.mp3', + 'type' => 'audio/mpeg', + 'length' => '12216320' + ), + array('url' => 'http://www.example.com/podcast2.mp3', + 'type' => 'audio/mpeg', + 'length' => '1221632' + ) + ) + ), + array('title' => 'Second article', + 'link' => 'http://www.example.com/two', + 'description' => 'Second article description', + 'content' => 'Second article content', + 'lastUpdate' => time(), + 'comments' => 'http://www.example.com/two/#comments', + 'category' => array(array('term' => 'test category')), + ) + ) + ); + return $array; + } + + /** + * Import an invalid atom feed + */ + protected function _importAtomValid($filename) + { + $response = new Zend_Http_Response(200, array(), file_get_contents("$this->_feedDir/$filename")); + $this->_adapter->setResponse($response); + + $feed = Zend_Feed::import('http://localhost'); + $this->assertType('Zend_Feed_Atom', $feed); + } + + /** + * Import a valid rss feed + */ + protected function _importRssValid($filename) + { + $response = new Zend_Http_Response(200, array(), file_get_contents("$this->_feedDir/$filename")); + $this->_adapter->setResponse($response); + + $feed = Zend_Feed::import('http://localhost'); + $this->assertType('Zend_Feed_Rss', $feed); + return $feed; + } + + /** + * Imports an invalid feed + */ + protected function _importInvalid($filename) + { + $response = new Zend_Http_Response(200, array(), file_get_contents("$this->_feedDir/$filename")); + $this->_adapter->setResponse($response); + + try { + $feed = Zend_Feed::import('http://localhost'); + $this->fail('Expected Zend_Feed_Exception not thrown'); + } catch (Zend_Feed_Exception $e) { + $this->assertType('Zend_Feed_Exception', $e); + } + } +} diff --git a/test/IteratorTest.php b/test/IteratorTest.php new file mode 100644 index 00000000..db4b325c --- /dev/null +++ b/test/IteratorTest.php @@ -0,0 +1,124 @@ +_feed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); + $this->_nsfeed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeedNamespaced.xml'); + } + + public function testRewind() + { + $times = 0; + foreach ($this->_feed as $f) { + ++$times; + } + + $times2 = 0; + foreach ($this->_feed as $f) { + ++$times2; + } + + $this->assertEquals($times, $times2, 'Feed should have the same number of iterations multiple times through'); + + $times = 0; + foreach ($this->_nsfeed as $f) { + ++$times; + } + + $times2 = 0; + foreach ($this->_nsfeed as $f) { + ++$times2; + } + + $this->assertEquals($times, $times2, 'Feed should have the same number of iterations multiple times through'); + } + + public function testCurrent() + { + foreach ($this->_feed as $f) { + $this->assertType('Zend_Feed_Entry_Atom', $f, 'Each feed entry should be an instance of Zend_Feed_Entry_Atom'); + break; + } + + foreach ($this->_nsfeed as $f) { + $this->assertType('Zend_Feed_Entry_Atom', $f, 'Each feed entry should be an instance of Zend_Feed_Entry_Atom'); + break; + } + } + + public function testKey() + { + $keys = array(); + foreach ($this->_feed as $k => $f) { + $keys[] = $k; + } + $this->assertEquals($keys, array(0, 1), 'Feed should have keys 0 and 1'); + + $keys = array(); + foreach ($this->_nsfeed as $k => $f) { + $keys[] = $k; + } + $this->assertEquals($keys, array(0, 1), 'Feed should have keys 0 and 1'); + } + + public function testNext() + { + $last = null; + foreach ($this->_feed as $current) { + $this->assertFalse($last === $current, 'Iteration should produce a new object each entry'); + $last = $current; + } + + $last = null; + foreach ($this->_nsfeed as $current) { + $this->assertFalse($last === $current, 'Iteration should produce a new object each entry'); + $last = $current; + } + } + +} diff --git a/test/_files/AtomPublishingTest-before-update.xml b/test/_files/AtomPublishingTest-before-update.xml new file mode 100644 index 00000000..cd6591d5 --- /dev/null +++ b/test/_files/AtomPublishingTest-before-update.xml @@ -0,0 +1,7 @@ + + 1 + + 2005-05-23T16:26:00-08:00 + Entry 1 + 1.2 + diff --git a/test/_files/AtomPublishingTest-created-entry.xml b/test/_files/AtomPublishingTest-created-entry.xml new file mode 100644 index 00000000..e8e8e810 --- /dev/null +++ b/test/_files/AtomPublishingTest-created-entry.xml @@ -0,0 +1,15 @@ + + + 1 + + 2005-05-23T16:26:00-08:00 + Entry 1 + 1.1 + diff --git a/test/_files/AtomPublishingTest-expected-update.xml b/test/_files/AtomPublishingTest-expected-update.xml new file mode 100644 index 00000000..cd6591d5 --- /dev/null +++ b/test/_files/AtomPublishingTest-expected-update.xml @@ -0,0 +1,7 @@ + + 1 + + 2005-05-23T16:26:00-08:00 + Entry 1 + 1.2 + diff --git a/test/_files/AtomPublishingTest-updated-entry.xml b/test/_files/AtomPublishingTest-updated-entry.xml new file mode 100644 index 00000000..629dc7cb --- /dev/null +++ b/test/_files/AtomPublishingTest-updated-entry.xml @@ -0,0 +1,18 @@ + + + 1 + + 2005-05-23T16:27:00-08:00 + Entry 1 + 1.2 + diff --git a/test/_files/AtomTestGoogle.xml b/test/_files/AtomTestGoogle.xml new file mode 100644 index 00000000..669ff221 --- /dev/null +++ b/test/_files/AtomTestGoogle.xml @@ -0,0 +1,148 @@ + + + + + + +Official Google Blog +Googler insights into product and technology news and our culture. + +tag:blogger.com,1999:blog-10861780 +2006-01-12T19:55:20Z +Blogger + +
This is an Atom formatted XML site feed. It is intended to be viewed in a Newsreader or syndicated to another site. Please visit the Blogger Help for more info.
+
+true + + + +A Googler + +2006-01-12T11:53:00-08:00 +2006-01-12T19:55:20Z +2006-01-11T03:07:43Z + +tag:blogger.com,1999:blog-10861780.post-113694886327994245 +Your Google homepage, to go + +
+ +
+
Anyone who's ever tried to browse the web on their cell phone knows that it isn't always the best user experience. That's why I'm excited to tell you about Google Mobile Personalized Home. We've designed a way for you to view the things that you really care about, from your Gmail inbox to news headlines, weather, stock quotes, and feeds (Atom or RSS). The interface is optimized for small screens, and we've arranged things so you don't have to click on a bunch of links to locate what you're after -– your personalized content appears on top, right where it should be. Give it a try, and let us know how you like it.
+
+false +
+ + + +A Googler + +2006-01-12T09:15:00-08:00 +2006-01-12T17:18:46Z +2006-01-03T20:50:32Z + +tag:blogger.com,1999:blog-10861780.post-113632143275337066 +Many Minis + +
+ +
+
Today is the one year anniversary of the Google Mini, Google's solution for website and corporate network search, and to celebrate we thought we'd announce a few more of them. The standard Mini lets you search up to 100,000 documents. Now organizations that constantly crank out new content can opt for either of two new Minis: one searches up to 200,000 documents, and another that can manage up to 300,000. All three deliver the same easy setup, intuitive interface and fast, relevant results that the Mini is already bringing to thousands of websites and corporate networks. You're growing, and the Mini is growing with you.
+
+false +
+ + + +A Googler + +2006-01-10T12:49:00-08:00 +2006-01-10T21:02:47Z +2005-12-31T01:44:54Z + +tag:blogger.com,1999:blog-10861780.post-113599349496410640 +Google Earth in a Mac world (PC too) + +
+ +
+
We feel like proud parents around here. Our eldest, Google Earth for the PC, is officially leaving beta status today, and we couldn't be more pleased. For those of you who downloaded early, upgrade to the latest and discover Google Earth all over again.
+
And we have a brand new member of the family -- Google Earth for Macintosh. We're happy to finally have some good news for the, ahem, vocal Mac enthusiasts we've been hearing from. Let's just say that we have gotten more than a few "requests" for a Mac version of Google Earth. They've gone something like this:
+
1) "When is it coming out? Your website says that you are working on it."
+
2) "You know, Mac users are very heavy graphics/mapping/visualization/design/ architecture/education/real estate/geocaching/social-geo-video-networking fans who would certainly use Google Earth a lot."
+
3) "So when is it coming out?"
+
We heard you loud and clear. The Mac version runs on OS X 10.4 and up. Happy travels throughout Google Earth, whether you're on a Mac or a PC.
+
+false +
+ + + +A Googler + +2006-01-09T22:16:00-08:00 +2006-01-11T20:30:26Z +2005-12-31T18:25:16Z + +tag:blogger.com,1999:blog-10861780.post-113605351620153422 +A new year for Google Video +<span class="byline-author">Posted by Sanjay Raman, Google Video Team</span><br /><br />Till now, Google Video has been about watching videos and clips online, which is really convenient for videos <a href="http://video.google.com/videoplay?docid=-3496860874967925614&q=fastfocus">like this</a>. But wouldn't it be awesome to watch that episode of <span style="font-style: italic;"><a href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCSI">CSI</a></span> that you missed when even your trusty DVR failed you? This is one reason we've launched the Google Video store, where you can rent or buy from such well-known media partners as <a href="http://video.google.com/cbs.html">CBS</a>, the <a href="http://video.google.com/nba.html">NBA</a>, The <a href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCharlie_Rose">Charlie Rose Show</a>, and <a href="http://video.google.com/videosearch?q=Sony+BMG">SONY BMG</a>.<br /><br />We’re not only about mainstream content, though -– we have thousands of titles available (and more coming every day) from every imaginable type of producer, including <a href="http://video.google.com/videosearch?q=1896+tsar+nicholas&so=0">this 1896 clip</a> of the coronation of Tsar Nicholas II – one of the earliest known moving images. We’re especially pleased to offer such quality indie features as Ben Rekhi’s <span style="font-style: italic;"><a href="http://video.google.com/videoplay?docid=-1607114503824678810&q=waterborne ">Waterborne</a></span> (Drops Entertainment) and Lerone Wilson’s <span style="font-style: italic;"><a href="http://video.google.com/videoplay?docid=-4929215594503422280&q=aardvark%27d ">Aardvark’d: 12 Weeks with Geeks</a></span> (Boondoggle Films).<br /><br />When we launched our <a href="https://upload.video.google.com">Upload Program</a> earlier this year, people sent in a huge number of free and compelling videos. But since there's a ton of video that can't be offered for free, we built the <a href="http://video.google.com/">Google Video store</a> to give content owners the option to charge for downloads if they'd like. This means producers large and small can distribute their great content in an easy, secure way. Some of your favorite prime time and classic TV shows, sports, music videos, and documentaries are at your fingertips. Want to see how Shaq scored 30 points last night? Download and watch it (and every <a href="http://video.google.com/nba.html">NBA</a> game for the rest of the season) through Google Video.<br /><br />You can play all the videos you download using the all-new Google Video Player. We're especially pleased about the thumbnail navigation for browsing an entire video so you can play any portion with a single click. And there's another thing: if the content is not copy-protected, you can take your favorite videos with you on your <a href="http://www.apple.com/ipod/">iPod</a> or <a href="http://www.us.playstation.com/psp.aspx">PSP</a> -- our "to go" option.<br /><br />Since it's so early in the year, here's a resolution we intend to keep: make sure new features and content continue to roll out, so that you think Google Video is one of the best ways to find video on the web.<br /><br />These video providers are getting us off to a great start:<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Daquarius">Aquarius Health Care Media</a></span>: A leading producer and distributor of healthcare-related videos will pilot with Google Video using a variety of titles covering SIDS, diabetes, and blindness, among other health issues.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=ardustry">Ardustry Home Entertainment</a></span>: Offers substantial libraries of theatrical motion pictures, television series, documentaries and reality programming, music and sports specials, lifestyle titles, and a wide array of “how-to†products.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=bluehighways">BlueHighways TV</a></span>: Programming service that explores the people, stories, traditions and cultures of America. Discovering the sights and sounds of communities across the country with an up-close, laid-back programming style, BlueHighways TV presents a collage of remarkable music, folklore and information for audiences interested in all aspects of American life and heritage. Programming includes <span style="font-style: italic;">Reno's Old Time Music Festival,</span> <span style="font-style: italic;">American Journeys,</span> <span style="font-style: italic;">Stan Hitchcock's Heart to Heart,</span> and <span style="font-style: italic;">Gospel Sampler</span>.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dcaretalk">CareTALK</a></span>: A multimedia brand dedicated to consumer-directed health care offering programming and tools to help modern family caregivers; initially offering 10-20 hours of health and caregiving-related content (10-20 minutes in length).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/cbs.html">CBS</a>: Includes prime time hits such as <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCSI">CSI</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3Dncis">NCIS</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DSurvivor_Guatemala">Survivor: Guatemala</a>, and The Amazing Race (available spring ’06), as well as classics like <a style="font-style: italic;" href="http://video.google.com/videosearch?q=I+Love+Lucy">I Love Lucy</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DTwilight_Zone">Twilight Zone</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DBrady_Bunch">Brady Bunch</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=Have+Gun+Will+Travel">Have Gun Will Travel</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DMacGyver">MacGyver</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DStar_Trek_Deep_Space_Nine">Star Trek: Deep Space Nine</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DStar_Trek_Voyager">Star Trek: Voyager</a>, and My Three Sons (coming soon).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCharlie_Rose">The Charlie Rose Show</a>: Includes interviews with Henry Kissinger, Oliver Stone, Quentin Tarantino, Martha Stewart, Martin Scorsese, Harrison Ford, Dan Rather, Charles M. Schulz, Steve Jobs, Jay Leno, Tom Brokaw, and others.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Cine+Excel&so=0">Cine Excel</a>: Independent producer will trial on Google Video with 3 DVD movie titles: <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=6833548605067650376&q=Cine+Excel">Bikini Hotel </a>(1997), <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=-9198267889833807992&q=Cine+Excel">Tao of Karate</a> (short-film, 1998) and <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=8241854949946868864&q=Cine+Excel">Karate Wars</a> (1998).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=classic+media">Classic Media</a>: Classic Media owns and manages some of the world's most recognizable family properties across all media including feature film, television, home video and consumer products. The company's extensive library features a diverse collection of popular animated and live-action characters. For lentaries are at your fingertips. Want to see how Shaq scored 30 points last night? Download and watch it (and every <a href="http://video.google.com/nba.html">NBA</a> game for the rest of the season) through Google Video.<br /><br />You can play all the videos you download using the all-new Google Video Player. We're especially pleased about the thumbnail navigation for browsing an entire video so you can play any portion with a single click. And there's another thing: if the content is not copy-protected, you can take your favorite videos with you on your <a href="http://www.apple.com/ipod/">iPod</a> or <a href="http://www.us.playstation.com/psp.aspx">PSP</a> -- our "to go" option.<br /><br />Since it's so early in the year, here's a resolution we intend to keep: make sure new features and content continue to roll out, so that you think Google Video is one of the best ways to find video on the web.<br /><br />These video providers are getting us off to a great start:<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Daquarius">Aquarius Health Care Media</a></span>: A leading producer and distributor of healthcare-related videos will pilot with Google Video using a variety of titles covering SIDS, diabetes, and blindness, among other health issues.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=ardustry">Ardustry Home Entertainment</a></span>: Offers substantial libraries of theatrical motion pictures, television series, documentaries and reality programming, music and sports specials, lifestyle titles, and a wide array of “how-to†products.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=bluehighways">BlueHighways TV</a></span>: Programming service that explores the people, stories, traditions and cultures of America. Discovering the sights and sounds of communities across the country with an up-close, laid-back programming style, BlueHighways TV presents a collage of remarkable music, folklore and information for audiences interested in all aspects of American life and heritage. Programming includes <span style="font-style: italic;">Reno's Old Time Music Festival,</span> <span style="font-style: italic;">American Journeys,</span> <span style="font-style: italic;">Stan Hitchcock's Heart to Heart,</span> and <span style="font-style: italic;">Gospel Sampler</span>.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dcaretalk">CareTALK</a></span>: A multimedia brand dedicated to consumer-directed health care offering programming and tools to help modern family caregivers; initially offering 10-20 hours of health and caregiving-related content (10-20 minutes in length).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/cbs.html">CBS</a>: Includes prime time hits such as <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCSI">CSI</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3Dncis">NCIS</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DSurvivor_Guatemala">Survivor: Guatemala</a>, and The Amazing Race (available spring ’06), as well as classics like <a style="font-style: italic;" href="http://video.google.com/videosearch?q=I+Love+Lucy">I Love Lucy</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DTwilight_Zone">Twilight Zone</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DBrady_Bunch">Brady Bunch</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=Have+Gun+Will+Travel">Have Gun Will Travel</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DMacGyver">MacGyver</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DStar_Trek_Deep_Space_Nine">Star Trek: Deep Space Nine</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DStar_Trek_Voyager">Star Trek: Voyager</a>, and My Three Sons (coming soon).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCharlie_Rose">The Charlie Rose Show</a>: Includes interviews with Henry Kissinger, Oliver Stone, Quentin Tarantino, Martha Stewart, Martin Scorsese, Harrison Ford, Dan Rather, Charles M. Schulz, Steve Jobs, Jay Leno, Tom Brokaw, and others.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Cine+Excel&so=0">Cine Excel</a>: Independent producer will trial on Google Video with 3 DVD movie titles: <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=6833548605067650376&q=Cine+Excel">Bikini Hotel </a>(1997), <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=-9198267889833807992&q=Cine+Excel">Tao of Karate</a> (short-film, 1998) and <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=8241854949946868864&q=Cine+Excel">Karate Wars</a> (1998).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=classic+media">Classic Media</a>: Classic Media owns and manages some of the world's most recognizable family properties across all media including feature film, television, home video and consumer products. The company's extensive library features a diverse collection of popular animated and live-action characters. For launch we will have <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=2700527067868455741&q=classic+media">Rocky &amp; Bullwinkle</a>, <span style="font-style: italic;">Casper</span>, <span style="font-style: italic;">Wendy</span>, <span style="font-style: italic;">Richie Rich</span>, <span style="font-style: italic;">Herman & Katnip</span>, <span style="font-style: italic;">Baby Huey</span>, <span style="font-style: italic;">Little Audrey</span>, <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=-3466783103686653836&q=Mighty+Hercules">Mighty Hercules</a>, <span style="font-style: italic;">Little Lulu</span>, and <span style="font-style: italic;">Felix the Cat</span>.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=clearvue">CLEARVUE & SVE</a>: A leading provider of educational K-12 educational video content. They sell DVDs and run a subscription media-on-demand website with video, audio, and images. CLEARVUE &amp; SVE primarily serves large clients such as schools, school districts or entire states. Leveraging Google Video, they have embarked on a new and bold strategy to target individual customers directly. Among the hundreds of videos you will find on Google, topics vary from classic children's literature to detailed explanations about the workings of the human body.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dechelon">Echelon Home Entertainment 2</a></span>: Focuses on independently produced films made by filmmakers from around the world which offer a unique perspective to the traditional genres: drama, action, thriller, comedy, family, animation, classic, B&W, foreign.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dimage_entertainment">Egami Media</a></span>: A subsidiary of Image Entertainment and a leading independent licensee, producer and distributor of home entertainment programming with over 3,000 titles released in North America. Highlighted content in Google Video includes live concert programs include <span style="font-style: italic;">Kiss: Rock the Nation: Live!</span>, <span style="font-style: italic;">Chick Corea: Rendezvous in New York</span>, <span style="font-style: italic;">Roy Orbison: Black & White Night</span>, and dozens more. Other titles include IMAX programs from MacGillivray Freeman, stand-up comedy and independent, foreign and silent film classics.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dfashion_tv">Fashion TV</a>: The only 24 hours a day, 7 days a week fashion, beauty and style TV station worldwide provides glamorous entertainment with emphasis on the latest trends. Google Video content includes fashion show clips and behind the scenes footage from many fashion shows.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dgetty_images">Getty Images' Archive Films Collection</a>: A diverse collection of short clips that capture personalities, moments and eras throughout history -- selected from vintage newsreels and educational film, as well as contemporary news and events from around the world.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dgreencine">GreenCine.com</a>: Feature length independent films, documentaries and classic titles, including works by legendary Polish director Andrzej Wajda (<span style="font-style: italic;">Zemsta</span>) and award-winning actor-director Caveh Zahedi (<span style="font-style: italic;">In the Bathtub of the World</span>).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=HDNet&so=0">HDNet</a>: Co-founded by Mark Cuban, HDNet has agreed to make select original programming from its library available for the launch of Google's first commercial video offering. The programs to be made available come from HDNet's ever growing library of original content including the <span style="font-style: italic;">HDNet World Report</span>, a groundbreaking series featuring news in HD from around the globe; <span style="font-style: italic;">True Music</span>, a popular weekly music series highlighting up-and-coming bands; <span style="font-style: italic;">Higher Definition</span>, a celebrity interview series hosted by Robert Wilonsky; <span style="font-style: italic;">Young, Beautiful and Trying to Make it in Hollywood</span>, following actresses through the hectic process of getting hired in Hollywood; and <span style="font-style: italic;">Deadline</span>, delivering current events and news from around the world from an irreverent point of view.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=heretv">here!</a>: Gay and lesbian U.S. television network featuring original movies and series and film library (independent and foreign films, documentaries and shorts).<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=hollywood+licensing">Hollywood Licensing's HilariousDownloads.com</a></span>: Hollywood Licensing is the entertainment licensing agency which represents the best and most extensive library of hilarious videos in the world. Tapping into a library boasting tens of thousands of clips, they have custom produced 20 packages of funny themes a celebrity interview series hosted by Robert Wilonsky; <span style="font-style: italic;">Young, Beautiful and Trying to Make it in Hollywood</span>, following actresses through the hectic process of getting hired in Hollywood; and <span style="font-style: italic;">Deadline</span>, delivering current events and news from around the world from an irreverent point of view.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=heretv">here!</a>: Gay and lesbian U.S. television network featuring original movies and series and film library (independent and foreign films, documentaries and shorts).<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=hollywood+licensing">Hollywood Licensing's HilariousDownloads.com</a></span>: Hollywood Licensing is the entertainment licensing agency which represents the best and most extensive library of hilarious videos in the world. Tapping into a library boasting tens of thousands of clips, they have custom produced 20 packages of funny themes for Google Video. For example, if you think that your recent home improvements was nothing but a miserable experience, wait until you see a bucket of wet plaster land on a man's face, a house collapsing or a door falling of its hinges for no particular reason.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Ditn">ITN</a>: One of the world's leading news producers, providing news programming for the main commercial broadcasters in the U.K. and its combined news broadcasts reach over two-thirds of the U.K. population. The company has a strong reputation for the creative and innovative use of modern technology, winning the Royal Television Society's 2004 Innovation Award.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Diwatchnow">iWatchNow.com</a>: Titles include Night of the Living Dead (George Romero), The Chronicles of Narnia: The Lion, Witch, and the Wardrobe (original animated film BBC from1979), The Man Who Knew Too Much (Hitchcock), the hard-to-find Comedy's Dirtiest Dozen (with Chris Rock and Tim Allen), and The Little Shop of Horrors (1960).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=kantola&so=0">Kantola Productions</a>: Captures unique speaking events given by well-known experts at Stanford University. Topics focus on innovative and practical business advice, such as How Leaders Boost Productivity by John H. (Jack) Zenger and <span style="font-style: italic;">Mastery of Speaking as a Leader</span> by Terry Pearce.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dlime">LIME</a></span>: “Healthy Living with a Twist†offers entertaining and revealing programming focused on a greener, healthier, more balanced lifestyle. Programming features inspiration from leading experts, authors, and pop culture icons and covers topics including the environment and sustainability, personal growth, alternative health, healthy foods, and business ethics.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=mediazone.com&so=0">MediaZone.com</a>: Programming covers sporting events, TV episodes, movies, how-to programs. Content includes <span style="font-style: italic;">The Rugby Channel presents ‘The Best Tries of 2004’</span> and <span style="font-style: italic;">The All Blacks of New Zealand Vs. Springboks of South Africa</span>.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dtwi+nobel">Nobel Video Library</a>: A library focused on the achievements of individual Nobel Laureate. The series was developed to introduce students to the work of the laureates as well as to support classroom discussion regarding important issues addressed by Nobel Prize winners in recent decades.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=open+championship&so=0">Open Championship</a>: Official programs from the classic golf tournament, the British Open, such as<span style="font-style: italic;"> </span><span style="font-style: italic;">Reflections: Past Open Champions</span>.<br /><br />•<a style="font-weight: bold;" href="http://video.google.com/videosearch?q=plum+tv"> Plum TV</a>: Provides highly localized programming to the nation’s most influential consumers, and strives to be an incubator of groundbreaking new television programming. Each Plum TV station shares branding which links each station as a network, but still provides original programming customized to reflect each community. Plum TV’s programming includes regionally-focused feature pieces, tourist information (weather, traffic reports, restaurant reviews, retail and lodging information), a real estate show, local news and specially targeted entertainment for each community’s interests.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=porchlight+entertainment">PorchLight Entertainment</a>: Porchlight produces family-oriented motion pictures and TV specials. Google Video will offer 36 titles including <span style="font-style: italic;">Enough Already</span> and <span style="font-style: italic;">Role of a Lifetime</span>.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=SOFA+Entertainment&so=0">SOFA Entertainment</a>: Represents pop culture at its best. Featuring several titles from the classic <span style="font-style: italic;">The Ed Sullivan Show</span> along with documentaries, feature films and music programming. SOFA Entertainment truly offers something for everyone. Some highlights include <span style="font-style: italic;">The Very Best of The Ed Sullivan Show - Vol. 1 & Vol. 2.</span><br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Sony+BMG">SONY BMG MUSIC ENTERTAINMENT</a>: The lineup of launch videos includes offerings from some of SONY BMG's largest global superstar artists, including Christina Aguilera, Beyonce, Kenny Chesney, Destiny's Child, Kelly Clarkson, Alicia Keys, Lil' Flip, Jessica Simpson, Shakira, System of a Down, Switchfoot, Usher, and many more.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Tai+Seng&so=0">Tai Seng Entertainment</a>: The definitive Asian cinema powerhouse. Known as the best source for Hong Kong films, Tai Seng also releases cinematic masterpieces from all over the Asia region in a variety of languages. Tai Seng brings to your home the best in class from high-octane action to bone-crushing martial arts, from chilling horror to lush swordplay epics. We are proud to showcase with Google some of Asia's biggest hits like Johnnie To's <span style="font-style: italic;">Running On Karma</span>, Korea's sensuously emotional drama <span style="font-style: italic;">Addicted</span>, martial arts Master Yuen Wo Ping's highly acclaimed <span style="font-style: italic;">Tai Chi Master</span>, and Michelle Yeoh's violently elegant <span style="font-style: italic;">Butterfly Sword</span>.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Teen+Kids+news">Teen Kids News</a>: A dynamic television news program for teens and pre-teens, by teens. The half-hour weekly program provides 10 eyewitness news segments to students in a way that's educational as well as entertaining. Thirty shows with kids reporting on camera are available on Google Video.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Trinity+Broadcasting+&so=0">Trinity Broadcasting Network</a>: The world's largest religious network and America's most watched faith channel, TBN offers 24 hours of commercial-free inspirational programming that appeal to people in a wide variety of Protestant, Catholic and Messianic Jewish denominations. <span style="font-style: italic;">The Praise the Lord Program</span> is the only live two-hour Christian program in the world. The program brings the highest caliber of guests from well-known celebrities to laypersons for interview, as well as, singers, musicians, evangelists and the coverage of revivals and crusades from around the world. This award-winning program has been on each week night for over 30 years.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videoplay?docid=8592392906577495616&q=in_label%3Aowner%3Dunion">Union</a>: Offers the best of breed from the world of action sports, including snow, skate, bmx, moto, and surfing. Union is owned by Quiksilver Entertainment, Inc. and Global Media Ventures, LLC.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=wilderness+films+india">WFIL</a>: Wilderness Films India Ltd. is a leading producer and library of stock footage captured in India and across Asia. WFIL will offer 100 hours of high quality video, both free and for sale, on Google Video. Topics vary from helicopter skiing in the Himalaya, broadcast coverage of an Everest climb, and rare wildlife such as the takin and the clouded leopard to imagery spanning India's art, culture, technology, peoples, cities, and rural areas.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=wgbh+boston">WGBH</a>: WGBH Boston is America's preeminent public broadcasting producer, the source of fully one-third of PBS's prime-time lineup, along with some of public television's best-known lifestyle shows and children's programs and many public radio favorites. Programming available includes <span style="font-style: italic;">Nova</span>, <span style="font-style: italic;">La Plaza</span> (the longest running Latino program in the country), <span style="font-style: italic;">Thinking Big</span>, and <span style="font-style: italic;">Basic Black</span>. WGBH is the number one producer of Web sites on pbs.org, one of the most trafficked dot-org Web sites in the world. WGBH is a pioneer in educational multimedia and in technologies and services that make media accessible to the 36 million Americans who rely on captioning or video descriptions. WGBH has been recognized with hundreds of honors: Emmys, Peabodys, duPont-Columbia Awards.even two Oscars. In 2002, WGBH was honored with a special institutional Peabody Award for 50 years of excellence.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=WheelsTV&so=0">WheelsTV</a>: Serves both the general audience and the enthusiast with a wide spectrum of vehicle-based entertainment, news and information. WheelsTV Network, WheelsTV On Demand and WheelsTV.net have been developed by the producers of multi-awarding winning automotive programming for Discovery, PBS, Speedvision, Fox and Outdoor Life Networks including <span style="font-style: italic;">Wild About Wheels</span>, <span style="font-style: italic;">Wheels</span>, and <span style="font-style: italic;">Motor Trend Television</span>. WheelsTV Network’s valuable consumer programs include <span style="font-style: italic;">Top 200™ New Vehicle Test Drives</span>. With <span style="font-style: italic;">Top 200</span> on Google, consumers will be able to download virtual test drives of the best selling and most exciting cars on the road today, saving time and money.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dtwi">Wimbledon</a>: Official programs from the Wimbledon Tennis Championships such as <span style="font-style: italic;">Legends of Wimbledon: Bjorn Borg</span>. +false + + + + +A Googler + +2006-01-09T06:27:00-08:00 +2006-01-09T14:30:23Z +2005-12-18T23:47:55Z + +tag:blogger.com,1999:blog-10861780.post-113494967528450491 +The 2006 Anita Borg Scholarships + +
+ +
+
The wonderfully-named Dr. Anita Borg (1949 - 2003) was a rebel with a cause: ensuring that technology itself has positive outcomes, and dismantling barriers that keep women and minorities from entering computing and technology fields. Today the Anita Borg Institute for Women and Technology carries on her vision. And because Google shares that passion, we are pleased to sponsor the 2006 Anita Borg Scholarship program. We are inspired by the past scholarship recipients -- and in hopes of finding more, the program is expanded this year to accept applications from students entering their senior year of undergraduate study as well as those enrolled in a graduate program. Last year we awarded 23 scholarships; this year we'd like to do more.
+
Tell your friends, or apply yourself - the deadline is January 20.
+
+false +
+ + + +A Googler + +2006-01-06T16:51:00-08:00 +2006-01-07T00:54:51Z +2005-12-31T18:24:44Z + +tag:blogger.com,1999:blog-10861780.post-113605348414874975 +Make your computer just work +<span class="byline-author">Posted by Jesse Savage, Google Pack team</span><br /> <br />So you bought a new PC for yourself or a relative during the holidays. There was the initial excitement about its speed and the nice screen – and then it came time to actually get it running. Which meant embarking on some real work -– downloading a browser, a couple of multimedia players, a PDF reader, a toolbar, and maybe something for voice and instant messaging. Don’t forget the anti-spyware and anti-virus apps – you’ve got to have those. Hours, maybe even days, go by. How many wizards have you clicked through, not to mention license agreements and preference pickers? And then you have to ask: did I get everything? And how am I going to keep all of this up to date?<br /> <br />This was the experience both Sergey and Larry had a year ago. And they’re computer guys, after all. Which led them to ask more of us to make it easier for everyone. So we created the <a href="http://pack.google.com">Google Pack</a> -- a one-stop software package that helps you discover, install, and maintain a wide range of essential PC programs. It’s yours today – and it’s something we hope you find to be painless, easy, and even fun (if computer setup can ever be called that). And it’s free. <br /> <br />We worked with a number of technology companies to identify products that are the best of their type to create <a href="http://www.google.com/support/pack">this suite</a>. (We didn’t pay them, and they aren’t paying us.) For PC users running Windows XP, it downloads in minutes and installs in just a few clicks. There’s only one license agreement – and no wizards. And there’s a new tool called the <a href="http://www.google.com/support/pack/bin/answer.py?answer=30252&topic=8326/">Google Updater</a> that keeps all the software in the Google Pack current. Even if you already have some of the software in the Pack, you can use the Google Updater to update and manage it.<br /> <br />There’s one more thing in the Pack that we think you’ll like. The Pack team asked people what kind of screensavers they like best. They kept saying, “I want my own photos as a screensaver, why can’t I do that?†Good question -- lots of people have trouble with this. So we made the <a href="http://www.google.com/support/pack/bin/answer.py?answer=28076&topic=8315">Google Pack Screensaver</a>, which is the easiest possible way to make your photos into an animated photo collage. And now the question for you is: what will you do with all that time you've saved? +false + + + + +A Googler + +2005-12-30T17:18:00-08:00 +2006-01-05T21:52:34Z +2005-12-31T01:31:39Z + +tag:blogger.com,1999:blog-10861780.post-113599269991367646 +A year of Google blogging + +
+ +
+
This is the 201st post to be published on the Google Blog in 2005. In closing out the first full year of our company-wide effort to share news and views, we thought you might be interested in a few factoids. Since we've had Google Analytics running on this blog since June, some of these numbers reflect only half a year. In that time, 4.3 million unique visitors have generated 8.7 million pageviews. Readers have come from all over the world, not just English-speaking countries: 53,001 visitors from Turkey have stopped by, for example; so have 155,691 from France, 29,614 from Thailand and 8,233 from Peru.
+
The most popular posts? Here are a few that have yielded scores of backlinks:

- Our explanation of "Googlebombing"
- A celebration of email and Gmail
- Google Earth's partnership with National Geographic about Africa
+
Several on Google Book Search (formerly known as Google Print), including:
- Preserving public domain books
- Our statement on the Authors' Guild suit
- and Eric Schmidt's op-ed about Book Search.

During the year, we've published 38 how-to tips, announced 77 new products and services, and addressed policy questions and legal matters 17 times. We've featured 11 guest bloggers. Forty posts have illuminated something about day to day life at Google; 19 have offered some international perspective.

In 2006, we'll keep up the Google Blog with more posts, more bloggers, and even more topics. Meanwhile, we really appreciate your interest and feedback, now visible through "Links to this post." We know some of you would like to offer comments directly, and we would like that too, when we can add resources to the blog crew. Meanwhile, our best to you and yours for the New Year.
+
+false +
+
diff --git a/test/_files/AtomTestMozillazine.xml b/test/_files/AtomTestMozillazine.xml new file mode 100644 index 00000000..2fa18ece --- /dev/null +++ b/test/_files/AtomTestMozillazine.xml @@ -0,0 +1,213 @@ + + + mozillaZine.org + + 2006-01-23T04:04:45-08:00 + Your Source for Daily Mozilla News and Advocacy + tag:mozillazine.org,2004:1 + Copyright (c) 2004, The Mozillazine Organization + + Minutes of the mozilla.org Staff Meeting of Monday 9th January 2006 + + 2006-01-22T20:04:42-08:00 + 2006-01-22T20:04:42-08:00 + 2006-01-22T20:04:42-08:00 + tag:mozillazine.org,2004:article7935 + + mozillaZine.org + + + The minutes of the mozilla.org staff meeting held on Monday 9th January 2006 are now online. Issues discussed include Firefox 1.5.0.1 release schedule, Thunderbird 1.5 release and Marketing.

]]> + Talkback

]]> +
+
+ + + Minutes of the mozilla.org Staff Meeting of Wednesday 4th January 2006 + + 2006-01-12T09:29:47-08:00 + 2006-01-12T09:29:47-08:00 + 2006-01-12T09:29:47-08:00 + tag:mozillazine.org,2004:article7895 + + mozillaZine.org + + + The minutes of the mozilla.org staff meeting held on Wednesday 4th January 2006 are now available. Issues discussed include Upcoming Releases, Marketing, Thunderbird, 1.9 Roadmap, Firefox 2 Process and Calendar.

+

The minutes have been posted to the new mozilla.dev.general newsgroup, which is accessible via news.mozilla.org. The previously announced newsgroup migration is in progress. Once mozilla.dev.planning is created, minutes will be posted there.

]]> + Talkback

]]> +
+
+ + + Thunderbird 1.5 Released + + 2006-01-11T18:19:13-08:00 + 2006-01-11T18:19:13-08:00 + 2006-01-11T18:19:13-08:00 + tag:mozillazine.org,2004:article7892 + + mozillaZine.org + + + Scott MacGregor writes: "The final release of Mozilla Thunderbird 1.5 is now available for download from getthunderbird.com. Users of RC1 should see the update soon. If you are using RC2, then you already have 1.5 final."

+

"Thunderbird 1.5 introduces several new features including a software update system, spell check as you type, built in phishing detector, auto save as draft, and support for deleting attachments from email messages. Message filtering has also been improved with new filter actions for replying and forwarding. Saved search folders can now search folders across multiple accounts."

+

"More details can be found in the Mozilla Thunderbird 1.5 Release Notes, and the support forum staff is available for questions. "

+

"I wanted to thank everyone in the mozillaZine community who helped test the alphas, the betas, and the release candidates that went into this release. Thank you for trusting Thunderbird with your email throughout the development and release cycle for 1.5. I'm looking forward to working with all of you on 2.0 and beyond!"

]]> + Talkback

]]> +
+
+ + + Firefox Smoketest Day Planned for January 6, 2006 + + 2006-01-04T14:14:20-08:00 + 2006-01-04T14:14:20-08:00 + 2006-01-04T14:14:20-08:00 + tag:mozillazine.org,2004:article7859 + + mozillaZine.org + + + The Mozilla QA team has announced a community test day with focus on smoketesting nightly Firefox 1.5.0.1 builds.

+

Litmus tool will be used for this testing event. There is a FAQ posted on the QA community wiki that will have specific instructions on how this testing day will run.

]]> + Talkback

]]> +
+
+ + + Camino 1.0 Beta 2 Released + + 2006-01-02T15:23:18-08:00 + 2006-01-02T15:23:18-08:00 + 2006-01-02T15:23:18-08:00 + tag:mozillazine.org,2004:article7850 + + mozillaZine.org + + + Camino 1.0 beta 2 has been released. This latest version of the native Mac OS X browser is replacing 0.8.4 as the stable Camino release on all systems 10.2+. See the Camino 1.0 Beta 2 Release Notes for more details.

]]> + Talkback

]]> +
+
+ + + Mozilla Newsgroups Migration Scheduled + + 2006-01-02T15:07:27-08:00 + 2006-01-02T15:07:27-08:00 + 2006-01-02T15:07:27-08:00 + tag:mozillazine.org,2004:article7849 + + mozillaZine.org + + + Frank Wein has announced that the migration and reorganization of Mozilla newsgroups will take place in January 2006. As announced earlier, the new newsgroups will be hosted by Giganews. Access to the news server news.mozilla.org will remain free. The new groups will only be propogated to news.mozilla.org, Giganews Servers and Google Groups in an effort to combat news spam. For more information, refer to the FAQ and the list of new newsgroups. +

]]> + Talkback

]]> +
+
+ + + Mozilla Thunderbird 1.5 Release Candidate 2 Available + + 2005-12-21T13:58:07-08:00 + 2005-12-21T13:58:07-08:00 + 2005-12-21T13:58:07-08:00 + tag:mozillazine.org,2004:article7823 + + mozillaZine.org + + + Scott MacGregor writes: "The second release candidate of Mozilla Thunderbird 1.5 is now available for download. Mozilla Thunderbird 1.5 RC2 is intended to allow testers to ensure that there are no last-minute problems with the Thunderbird 1.5 code. "

+

"RC2 contains several key bug fixes that were identified during the RC1 testing cycle. There are no new features or enchancements from RC1. Users of Thunderbird 1.5 RC1 will be offered RC 2 through the software update system."

+

"Thunderbird 1.5 RC2 can be downloaded from the Thunderbird 1.5 RC2 Release Notes page, or the Thunderbird 1.5rc2 directory on ftp.mozilla.org. More details can be found in the Release Notes."

+

"I'd like to single out all of the folks who participated in our QA testing day and our localization testing day. We wouldn't have been able to release RC2 before the holidays without all the volunteers who pitched in. Thank you!"

]]> + Talkback

]]> +
+
+ + + Interview with Mike Beltzner + + 2005-12-20T23:00:29-08:00 + 2005-12-20T23:00:29-08:00 + 2005-12-20T23:00:29-08:00 + tag:mozillazine.org,2004:article7820 + + mozillaZine.org + + + David Tenser has posted an interview with Mozilla Foundation's User Experience Lead, Mike Beltzner. The interview was conducted over instant messaging sessions during the last week of November. Mike talks about usability studies, design of the Mozilla Developer Central, and the new bookmark system planned for Firefox 2.

]]> + Talkback

]]> +
+
+ + + Gecko 1.9 Trunk and 1.8 Branch Management Plan Posted + + 2005-12-20T18:08:36-08:00 + 2005-12-20T18:08:36-08:00 + 2005-12-20T18:08:36-08:00 + tag:mozillazine.org,2004:article7819 + + mozillaZine.org + + + Brendan Eich has posted a draft plan for Gecko 1.9 Trunk and 1.8 Branch Management, including a FAQ at the mozilla wiki. Comments should be directed as followups to the newsgroup post. +

]]> + Talkback

]]> +
+
+ + + Minutes of the mozilla.org Staff Meeting of Monday 12th December 2005 + + 2005-12-20T18:04:08-08:00 + 2005-12-20T18:04:08-08:00 + 2005-12-20T18:04:08-08:00 + tag:mozillazine.org,2004:article7818 + + mozillaZine.org + + + The minutes of the mozilla.org staff meeting held on Monday 12th December 2005 are now online. Issues discussed include Firefox Summit, Engineering, Upgrading, Awards and Newsgroups reorganisation

]]> + Talkback

]]> +
+
+ + + Minutes of the mozilla.org Staff Meeting of Monday 5th December 2005 + + 2005-12-20T18:02:08-08:00 + 2005-12-20T18:02:08-08:00 + 2005-12-20T18:02:08-08:00 + tag:mozillazine.org,2004:article7817 + + mozillaZine.org + + + The minutes of the mozilla.org staff meeting held on Monday 5th December 2005 are now online. Issues discussed include Firefox Summit and Engineering.

]]> + Talkback

]]> +
+
+ + + SeaMonkey 1.0 Beta Released + + 2005-12-20T17:41:12-08:00 + 2005-12-20T17:41:12-08:00 + 2005-12-20T17:41:12-08:00 + tag:mozillazine.org,2004:article7815 + + mozillaZine.org + + + Robert Kaiser writes: "Today, the SeaMonkey Council announces a new developer release, SeaMonkey 1.0 Beta. Compared to the Alpha version released in September, SeaMonkey 1.0 Beta enhances the product with new features like tab drag and drop, but also is the first release branded with the new SeaMonkey logo, which was unveiled earlier this month."

+

"The SeaMonkey 1.0 Beta Release Notes have more information about this test version. All the builds are available from the SeaMonkey 1.0b directory on ftp.mozilla.org."

]]> + Talkback

]]> +
+
+ +
diff --git a/test/_files/AtomTestOReilly.xml b/test/_files/AtomTestOReilly.xml new file mode 100644 index 00000000..bc9645ee --- /dev/null +++ b/test/_files/AtomTestOReilly.xml @@ -0,0 +1,214 @@ + + + + +weblogs.oreilly.com + +The O'Reilly Network Weblogs +Copyright 2005, O'Reilly Media, Inc. +http://weblogs.oreilly.com/ +2006-01-23T09:16:40-08:00 + +O'Reilly Media, Inc. + +no + + + Delightful Javascript Libs -- LGPL, Too. + http://www.oreillynet.com/pub/wlg/9085 + + +
+ Here are some fundamental, well made JS goodies: Vectorgraphics Library, Drag'nDrop & DHTML Library, Tooltips with JavaScript Lib, and Rotate Image Lib. A pleasure to work with, and LGPL'ed. Also check out the JS Online Function Grapher. +
+
+ Sid Steward + 2006-01-23T09:16:40-08:00 +
+ + + Web 2.0: Simple division? + http://www.oreillynet.com/pub/wlg/9084 + + +
+ There's been a lot of talk about the revolutionary change Web 2.0 promises, and it's time to look at the architecture that's leading to that change: a greater split between client and server logic. +
+
+ Simon St. Laurent + 2006-01-23T08:15:34-08:00 +
+ + + Don't Give us your Tired Your Poor + http://www.oreillynet.com/pub/wlg/9083 + + +
+ Give us your vibrant, exciting, cool, open source Java submissions for this year's OSCON. +
+
+ Daniel H. Steinberg + 2006-01-23T07:45:36-08:00 +
+ + + Cutting Through the Patent Thicket + http://www.oreillynet.com/pub/wlg/9082 + + +
+ Good succinct summary of the anti-patent argument, including how VC's look at patents and get duped by them. +
+
+ Damien Stolarz + 2006-01-23T00:45:30-08:00 +
+ + + The addslashes() Versus mysql_real_escape_string() Debate + http://www.oreillynet.com/pub/wlg/9081 + + +
+ Last month, I discussed Google's XSS Vulnerability and provided an example that demonstrates it. I was hoping to highlight why character encoding consistency is important, but apparently the addslashes() versus mysql_real_escape_string() debate continues. +
+
+ Chris Shiflett + 2006-01-22T22:45:11-08:00 +
+ + + RPM Rollback in Fedora Core 4/5 + http://www.oreillynet.com/pub/wlg/9080 + + +
+ Fedora's yum/rpm system includes a little-known capability: it can rollback a system to a previously-installed state. +
+
+ Chris Tyler + 2006-01-22T13:15:12-08:00 +
+ + + Shifting Gears: Switching to Django + http://www.oreillynet.com/pub/wlg/9075 + + +
+ I've been using TurboGears since its public debut around September of last year. I believe it has incredible potential, but I'm finding myself needing something a little different. That something is Django. +
+
+ Jeremy Jones + 2006-01-22T12:15:19-08:00 +
+ + + Are We In A Productivity Crisis? + http://www.oreillynet.com/pub/wlg/9079 + + +
+ Are we in a new kind of productivity crisis, one in which there is not too little productivity, but too much? +
+
+ Spencer Critchley + 2006-01-22T09:45:58-08:00 +
+ + + What Happens When You Edit an Image Stored Outside of iPhoto 6 + http://www.oreillynet.com/pub/wlg/9078 + + +
+ Is the edited image stored inside or outside of your iPhoto 6 library? +
+
+ Derrick Story + 2006-01-22T07:45:58-08:00 +
+ + + Building emacs22 on Mac OS X + http://www.oreillynet.com/pub/wlg/9074 + + +
+ Emacs 22 is Mac OS X aware, and can be built either as a Carbon .app double-clickable, or as a typical X11 program. Problem is, the information about how to build it is pretty scattered. Here's what works for me. +
+
+ Chris Adamson + 2006-01-21T19:45:53-08:00 +
+ + + hip to bash web2.0, are we? + http://www.oreillynet.com/pub/wlg/9034 + + +
+ It's hip to take some "diggs" at Web 2.0. +
+
+ Timothy M. O'Brien + 2006-01-21T15:46:26-08:00 +
+ + + My New Game Development Course at Tufts + http://www.oreillynet.com/pub/wlg/9076 + + +
+ I am teaching a new course at the Tufts University, "Introduction to Game Development," this semester. +
+
+ Ming Chow + 2006-01-21T12:46:56-08:00 +
+ + + Tune in to Radio Babylon + http://www.oreillynet.com/pub/wlg/9073 + + +
+ Hardware hacks we'd like to see in iPods, #1 +
+
+ Giles Turnbull + 2006-01-20T14:15:54-08:00 +
+ + + A resource for Google maphacks and mashers now at Maphacks,net + http://www.oreillynet.com/pub/wlg/9072 + + +
+ +
+
+ Glenn Letham + 2006-01-20T12:16:05-08:00 +
+ + + UK film studio on the hunt for Google earth programmers + http://www.oreillynet.com/pub/wlg/9071 + + +
+ +
+
+ Glenn Letham + 2006-01-20T11:47:03-08:00 +
+ +
+ diff --git a/test/_files/AtomTestPlanetPHP.xml b/test/_files/AtomTestPlanetPHP.xml new file mode 100644 index 00000000..762f0101 --- /dev/null +++ b/test/_files/AtomTestPlanetPHP.xml @@ -0,0 +1,125 @@ + +Planet PHPPeople blogging about PHPhttp://www.planet-php.net/ + Planet PHP Aggregator + 2006-01-23T16:40:00ZeZ components in Gentoo LinuxSebastian Bergmannhttp://www.sebastian-bergmann.de/blog/archives/565-guid.html2006-01-23T16:40:00Z2006-01-23T16:40:00ZeZ components, which provide an enterprise ready general purpose PHP platform, are now available through Gentoo Linux's portage system:
wopr-mobile ~ # emerge -vp ezc-eZcomponents
+
+These are the packages that I would merge, in order:
+
+Calculating dependencies ...done!
+[ebuild  N    ] app-admin/php-toolkit-1.0-r2  0 kB
+[ebuild  N    ] dev-lang/php-5.1.2  0 kB [3]
+[ebuild  N    ] dev-php/PEAR-PEAR-1.4.6  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Base-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Database-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-PhpGenerator-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Configuration-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-ImageAnalysis-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Archive-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Translation-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Cache-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-ConsoleTools-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-PersistentObject-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-ImageConversion-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Mail-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-UserInput-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Debug-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-EventLog-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Execution-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-eZcomponents-1.0_rc1  0 kB [2]
+
+Total size of downloads: 0 kB
+Portage overlays:
+ [1] /usr/local/overlay/personal
+ [2] /usr/local/overlay/cvs
+ [3] /usr/local/overlay/php/testing
+ [4] /usr/local/overlay/php/experimental
+ [5] /usr/local/overlay/gentopia
+ [6] /usr/local/overlay/xgl
+ ]]>
PHP InsecurityChris Shifletthttp://shiflett.org/archive/1852006-01-23T16:15:00Z2006-01-23T16:15:00ZAndrew van der Stock has written a strong criticism of PHP's insecurity. Andrew is a seasoned security expert and a major contributor to OWASP, and he states:

+
After writing PHP forum software for three years now, I've come to the conclusion that it is basically impossible for normal programmers to write secure PHP code. It takes far too much effort.
+

He continues, citing specific areas where he thinks PHP is weak and asserting that "PHP must now mature and take on a proper security architecture."

+

Many of the insecure features he cites (register_globals, magic_quotes_gpc, and safe_mode) are slated to be removed in PHP 6, but his core complaint seems to revolve around the fact that PHP makes too much power too easily accessible, often granting developers more power and flexibility than they realize (e.g., wrappers).

+

Aside from minor language features like taint mode, I don't see what other platforms offer to help prevent inexperienced developers from writing insecure code. Anyone care to enlighten me? :-)

+ Posted Mon, 23 Jan 2006 16:15:56 GMT in Chris Shiflett: The PHP Blog
+ [ +   + + Discuss +   + | +   + + Tag +   + | +   + + Digg +   + | +   + + Furl +   + | +   + + Cosmos +   + ] +

]]>
Beta release of mobile webmail client (MIMP)Horde Newshttp://janschneider.de/cweb/home/index,channel,25,story,255.html2006-01-23T10:01:00Z2006-01-23T10:01:00ZMeet me at php|tekThinkPHP /dev/blog - PHPhttp://blog.thinkphp.de/archives/81-guid.html2006-01-22T22:34:00Z2006-01-22T22:34:00Zphp|tek, the next conference from the php|arch +guys around Marco Tabini who already organized the php|cruise and php|tropics +conferences, will be from April 26th to 28th at Orlando, Florida. As +you can read on the recently published schedule +I'll hold two talks. The first talk will be about PHP on the command +line, showing PHP's strength beyond the web which can be helpful to +build, deploy and scale your web-application and even for building apps +completely independent from anything on the web. My second talk will be +about PHP's reflection API. In that session I'll give an introduction +into the API and show how to use it to build modular, dynamic +applications.

+

If you're in reachable distance you should take the chance to listen and meet PHP developers from all over the world. (Hint: Till January 31st you can get early-bird rates!)

johannes

]]>
Quick LookupJohn Coxhttp://wyome.com/index.php?module=articles&func=display&ptid=10&catid=29-31&aid=5072006-01-22T19:23:00Z2006-01-22T19:23:00ZQuick lookup is a very nice little reference tool for lookups of web development documentation. It installs as a simple bookmark which can be changed to your sidebar for look ups of php / css / javascript / mysql documentation. It has a limited scope of features (which isn't a bad thing in my mind):

+

* Multiple tabs
+* PHP / MySQL / CSS / JS reference (MySQL is 55% complete)
+* Examples
+* Search as you type
+* Fast results
+* Remembers your last tab on your revisit
+* Access keys, [alt + (p, m, j, c)]
+

+

I did a cursory install, and it appears to be pretty fast. I think it might be better as part of the Web Developer Extension for Firefox, but as is, I can see the uses.

+ ]]>
mysql_real_escape_string() versus Prepared StatementsIlia Alshanetskyhttp://ilia.ws/archives/103-guid.html2006-01-22T18:03:00Z2006-01-22T18:03:00ZChris has written a compelling piece about how the use of addslashes() for string escaping in MySQL queries can lead to SQL injection through the abuse of multibyte character sets. In his example he relies on addslashes() to convert an invalid multibyte sequence into a valid one, which also has an embedded ' that is not escaped. And in an ironic twist, the function intended to protect against SQL injection is used to actually trigger it.

+The problem demonstrated, actually goes a bit further, which even makes the prescribed escaping mechanism, mysql_real_escape_string() prone to the same kind of issues affecting addslashes(). The main advantage of the mysql_real_escape_string() over addslashes() lies in the fact that it takes character set into account and thus is able to determine how to properly escape the data. For example, if GBK character set is being used, it will not convert an invalid multibyte sequence 0xbf27 (¿’) into 0xbf5c27 (¿\’ or in GBK a single valid multibyte character followed by a single quote). To determine the proper escaping methodology mysql_real_escape_string() needs to know the character set used, which is normally retrieved from the database connection cursor. Herein lies the “trick”. In MySQL there are two ways to change the character set, you can do it by changing in MySQL configuration file (my.cnf) by doing:

CODE:
[client]
+default-character-set=GBK


+Or you can change on a per-connection basis, which is a common practice done by people without admin level access to the server via the following query:

CODE:
SET CHARACTER SET 'GBK'


+The problem with the latter, is that while it most certainly modified the charset it didnÂ’t let the escaping facilities know about it. Which means that mysql_real_escape_string() still works on the basis of the default charset, which if set to latin1 (common default) will make the function work in a manner identical to addslashes() for our purposes. Another word, 0xbf27 will be converted to 0xbf5c27 facilitating the SQL injection. Here is a brief proof of concept.

PHP:

<?php

+$c 
= mysql_connect("localhost", "user", "pass");
mysql_select_db("database", $c);

// change our character set
mysql_query("SET CHARACTER SET 'gbk'", $c);

// create demo table
mysql_query("CREATE TABLE users (
+    username VARCHAR(32) PRIMARY KEY,
+    password VARCHAR(32)
+) CHARACTER SET 'GBK'"
, $c);
mysql_query("INSERT INTO users VALUES('foo','bar'), ('baz','test')", $c);

// now the exploit code
$_POST['username'] = chr(0xbf) . chr(0x27) . ' OR username = username /*'; 
$_POST['password'] = 'anything'; 

Truncated by Planet PHP, read more at the original (another 2694 bytes)

]]>
The addslashes() Versus mysql_real_escape_string() DebateChris Shifletthttp://shiflett.org/archive/1842006-01-22T04:15:00Z2006-01-22T04:15:00ZLast month, I discussed Google's XSS Vulnerability and provided an example that demonstrates it. I was hoping to highlight why character encoding consistency is important, but apparently the addslashes() versus mysql_real_escape_string() debate continues. Demonstrating Google's XSS vulnerability was pretty easy. Demonstrating an SQL injection attack that is immune to addslashes() is a bit more involved, but still pretty straightforward.

+

In GBK, 0xbf27 is not a valid multi-byte character, but 0xbf5c is. Interpreted as single-byte characters, 0xbf27 is 0xbf (¿) followed by 0x27 ('), and 0xbf5c is 0xbf (¿) followed by 0x5c (\).

+

How does this help? If I want to attempt an SQL injection attack against a MySQL database, having single quotes escaped with a backslash is a bummer. If you're using addslashes(), however, I'm in luck. All I need to do is inject something like 0xbf27, and addslashes() modifies this to become 0xbf5c27, a valid multi-byte character followed by a single quote. In other words, I can successfully inject a single quote despite your escaping. That's because 0xbf5c is considered to be a single character, not two. Oops, there goes the backslash.

+

I'm going to use MySQL 5.0 and PHP's mysqli extension for this demonstration. If you want to try this yourself, make sure you're using GBK. I just changed /etc/my.cnf, but that's because I'm testing locally:

+
[client]
+default-character-set=GBK
+

Create a table called users:

+
CREATE TABLE users
+(
+    username VARCHAR(32) CHARACTER SET GBK,
+    password VARCHAR(32) CHARACTER SET GBK,
+    PRIMARY KEY (username)
+);
+
+

The following script mimics a situation where only addslashes() is used to escape the data being used in a query:

+
<?php 

$mysql 
= array();

$db = mysqli_init();
$db->real_connect('localhost', 'myuser', 'mypass', 'mydb');

$_POST['username'] = chr(0xbf) .
                     
chr(0x27) .
                     
' OR username = username /*';
$_POST['password'] = 'guess';

$mysql['username'] = addslashes($_POST['username']);
$mysql['password'] = addslashes($_POST

Truncated by Planet PHP, read more at the original (another 4165 bytes)

]]>
PHP ConferencesJason E. Sweathttp://blog.casey-sweat.us/?p=692006-01-22T04:04:00Z2006-01-22T04:04:00ZBack from NorwayTobias Schlitthttp://www.schlitt.info/applications/blog/index.php?/archives/407-guid.html2006-01-22T00:30:00Z2006-01-22T00:30:00ZNorway is a somewhat strange country. When I got there - 2 weeks ago to work with Amos, Derick, Fred and Ray on the eZ components - it had the expected amount of snow. A few days later, there was nothing anymore. We had positive celsius values and the weather was really crappy... until Monday. Since then it has been snowing all the time and yesterday we left when it looked like this:

+ +

pict1285.jpg

+ +

Nice to watch, but not real fun to walk onto. :) Anyway, it's been another great stay in Skien, where the eZ headquarter is and I'm pretty much looking forward to our summer conference, where we plan to have the complete eZ team there and lots of people from the PHP world. Thanks for the great time, folks!

+ + ]]>
Solar 0.10.0 ReleasedPaul M. Joneshttp://paul-m-jones.com/blog/?p=1922006-01-21T21:44:00Z2006-01-21T21:44:00Z
diff --git a/test/_files/AtomTestSample1.xml b/test/_files/AtomTestSample1.xml new file mode 100644 index 00000000..40aa3671 --- /dev/null +++ b/test/_files/AtomTestSample1.xml @@ -0,0 +1,22 @@ + + + + Example Feed + Insert witty or insightful remark here + + 2003-12-13T18:30:02Z + + John Doe + johndoe@example.com + + urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 + + + Atom-Powered Robots Run Amok + + urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a + 2003-12-13T18:30:02Z + Some text. + + + \ No newline at end of file diff --git a/test/_files/AtomTestSample2.xml b/test/_files/AtomTestSample2.xml new file mode 100644 index 00000000..7a7a6285 --- /dev/null +++ b/test/_files/AtomTestSample2.xml @@ -0,0 +1,15 @@ + + + + Example Atom Feed + 2006-01-23T23:04:33Z + + http://www.example.com + + + John Doe + John@Example.com + http://www.example.com + + + \ No newline at end of file diff --git a/test/_files/AtomTestSample3.xml b/test/_files/AtomTestSample3.xml new file mode 100644 index 00000000..0accba88 --- /dev/null +++ b/test/_files/AtomTestSample3.xml @@ -0,0 +1,17 @@ + + + + Example Atom Feed + 2006-01-23T23:04:33Z + + http://www.example.com + + + John Doe + John@Example.com + http://www.example.com + + + + + \ No newline at end of file diff --git a/test/_files/AtomTestSample4.xml b/test/_files/AtomTestSample4.xml new file mode 100644 index 00000000..8af5593f --- /dev/null +++ b/test/_files/AtomTestSample4.xml @@ -0,0 +1,31 @@ + + + + http://www.example.com + Example Atom Feed + 2006-01-23T23:04:33Z + + + + John Doe + John@Example.com + http://www.example.com + + + + tag:www.example.com,2006-01-23:/post/1234 + Mars Attacks Pluto Probe + 2006-01-23T23:04:33Z + In upheaval of the tenuous peace between Earth and Mars over the last century, it has been confirmed that a rogue Martian fighter ship suddenly attacked Earth's 2006 probe to Pluto today. Martian delegates have been dispatched to Earth in an effort to quell the political firestorm that has ensued. + + + + + tag:www.example.com,2006-01-23:/post/1235 + Quake Rocks Io + 2006-01-23T23:04:33Z + A strong tremor rocked Io this afternoon, and officials are saying that no one has been found alive on Io since the quake. + + + + \ No newline at end of file diff --git a/test/_files/RssTest091Sample1.xml b/test/_files/RssTest091Sample1.xml new file mode 100644 index 00000000..65788c3d --- /dev/null +++ b/test/_files/RssTest091Sample1.xml @@ -0,0 +1,50 @@ + + + + WriteTheWeb + http://writetheweb.com + News for web users that write back + en-us + Copyright 2000, WriteTheWeb team. + editor@writetheweb.com + webmaster@writetheweb.com + + WriteTheWeb + http://writetheweb.com/images/mynetscape88.gif + http://writetheweb.com + 88 + 31 + News for web users that write back + + + Giving the world a pluggable Gnutella + http://writetheweb.com/read.php?item=24 + WorldOS is a framework on which to build programs that work like Freenet or Gnutella -allowing distributed applications using peer-to-peer routing. + + + Syndication discussions hot up + http://writetheweb.com/read.php?item=23 + After a period of dormancy, the Syndication mailing list has become active again, with contributions from leaders in traditional media and Web syndication. + + + Personal web server integrates file sharing and messaging + http://writetheweb.com/read.php?item=22 + The Magi Project is an innovative project to create a combined personal web server and messaging system that enables the sharing and synchronization of information across desktop, laptop and palmtop devices. + + + Syndication and Metadata + http://writetheweb.com/read.php?item=21 + RSS is probably the best known metadata format around. RDF is probably one of the least understood. In this essay, published on my O'Reilly Network weblog, I argue that the next generation of RSS should be based on RDF. + + + UK bloggers get organised + http://writetheweb.com/read.php?item=20 + Looks like the weblogs scene is gathering pace beyond the shores of the US. There's now a UK-specific page on weblogs.com, and a mailing list at egroups. + + + Yournamehere.com more important than anything + http://writetheweb.com/read.php?item=19 + Whatever you're publishing on the web, your site name is the most valuable asset you have, according to Carl Steadman. + + + diff --git a/test/_files/RssTest092Sample1.xml b/test/_files/RssTest092Sample1.xml new file mode 100644 index 00000000..5d75c352 --- /dev/null +++ b/test/_files/RssTest092Sample1.xml @@ -0,0 +1,103 @@ + + + + + Dave Winer: Grateful Dead + http://www.scripting.com/blog/categories/gratefulDead.html + A high-fidelity Grateful Dead song every day. This is where we're experimenting with enclosures on RSS news items that download when you're not using your computer. If it works (it will) it will be the end of the Click-And-Wait multimedia experience on the Internet. + Fri, 13 Apr 2001 19:23:02 GMT + http://backend.userland.com/rss092 + dave@userland.com (Dave Winer) + dave@userland.com (Dave Winer) + + + It's been a few days since I added a song to the Grateful Dead channel. Now that there are all these new Radio users, many of whom are tuned into this channel (it's #16 on the hotlist of upstreaming Radio users, there's no way of knowing how many non-upstreaming users are subscribing, have to do something about this..). Anyway, tonight's song is a live version of Weather Report Suite from Dick's Picks Volume 7. It's wistful music. Of course a beautiful song, oft-quoted here on Scripting News. <i>A little change, the wind and rain.</i> + + + + + Kevin Drennan started a <a href="http://deadend.editthispage.com/">Grateful Dead Weblog</a>. Hey it's cool, he even has a <a href="http://deadend.editthispage.com/directory/61">directory</a>. <i>A Frontier 7 feature.</i> + Scripting News + + + <a href="http://arts.ucsc.edu/GDead/AGDL/other1.html">The Other One</a>, live instrumental, One From The Vault. Very rhythmic very spacy, you can listen to it many times, and enjoy something new every time. + + + + This is a test of a change I just made. Still diggin.. + + + The HTML rendering almost <a href="http://validator.w3.org/check/referer">validates</a>. Close. Hey I wonder if anyone has ever published a style guide for ALT attributes on images? What are you supposed to say in the ALT attribute? I sure don't know. If you're blind send me an email if u cn rd ths. + + + <a href="http://www.cs.cmu.edu/~mleone/gdead/dead-lyrics/Franklin's_Tower.txt">Franklin's Tower</a>, a live version from One From The Vault. + + + + Moshe Weitzman says Shakedown Street is what I'm lookin for for tonight. I'm listening right now. It's one of my favorites. "Don't tell me this town ain't got no heart." Too bright. I like the jazziness of Weather Report Suite. Dreamy and soft. How about The Other One? "Spanish lady come to me.." + Scripting News + + + <a href="http://www.scripting.com/mp3s/youWinAgain.mp3">The news is out</a>, all over town..<p> +You've been seen, out runnin round. <p> +The lyrics are <a href="http://www.cs.cmu.edu/~mleone/gdead/dead-lyrics/You_Win_Again.txt">here</a>, short and sweet. <p> +<i>You win again!</i> + + + + + <a href="http://www.getlyrics.com/lyrics/grateful-dead/wake-of-the-flood/07.htm">Weather Report Suite</a>: "Winter rain, now tell me why, summers fade, and roses die? The answer came. The wind and rain. Golden hills, now veiled in grey, summer leaves have blown away. Now what remains? The wind and rain." + + + + <a href="http://arts.ucsc.edu/gdead/agdl/darkstar.html">Dark Star</a> crashes, pouring its light into ashes. + + + + DaveNet: <a href="http://davenet.userland.com/2001/01/21/theUsBlues">The U.S. Blues</a>. + + + Still listening to the US Blues. <i>"Wave that flag, wave it wide and high.."</i> Mistake made in the 60s. We gave our country to the assholes. Ah ah. Let's take it back. Hey I'm still a hippie. <i>"You could call this song The United States Blues."</i> + + + <a href="http://www.sixties.com/html/garcia_stack_0.html"><img src="http://www.scripting.com/images/captainTripsSmall.gif" height="51" width="42" border="0" hspace="10" vspace="10" align="right"></a>In celebration of today's inauguration, after hearing all those great patriotic songs, America the Beautiful, even The Star Spangled Banner made my eyes mist up. It made my choice of Grateful Dead song of the night realllly easy. Here are the <a href="http://searchlyrics2.homestead.com/gd_usblues.html">lyrics</a>. Click on the audio icon to the left to give it a listen. "Red and white, blue suede shoes, I'm Uncle Sam, how do you do?" It's a different kind of patriotic music, but man I love my country and I love Jerry and the band. <i>I truly do!</i> + + + + Grateful Dead: "Tennessee, Tennessee, ain't no place I'd rather be." + + + + Ed Cone: "Had a nice Deadhead experience with my wife, who never was one but gets the vibe and knows and likes a lot of the music. Somehow she made it to the age of 40 without ever hearing Wharf Rat. We drove to Jersey and back over Christmas with the live album commonly known as Skull and Roses in the CD player much of the way, and it was cool to see her discover one the band's finest moments. That song is unique and underappreciated. Fun to hear that disc again after a few years off -- you get Jerry as blues-guitar hero on Big Railroad Blues and a nice version of Bertha." + + + + <a href="http://arts.ucsc.edu/GDead/AGDL/fotd.html">Tonight's Song</a>: "If I get home before daylight I just might get some sleep tonight." + + + + <a href="http://arts.ucsc.edu/GDead/AGDL/uncle.html">Tonight's song</a>: "Come hear Uncle John's Band by the river side. Got some things to talk about here beside the rising tide." + + + + <a href="http://www.cs.cmu.edu/~mleone/gdead/dead-lyrics/Me_and_My_Uncle.txt">Me and My Uncle</a>: "I loved my uncle, God rest his soul, taught me good, Lord, taught me all I know. Taught me so well, I grabbed that gold and I left his dead ass there by the side of the road." + + + + + Truckin, like the doo-dah man, once told me gotta play your hand. Sometimes the cards ain't worth a dime, if you don't lay em down. + + + + Two-Way-Web: <a href="http://www.thetwowayweb.com/payloadsForRss">Payloads for RSS</a>. "When I started talking with Adam late last year, he wanted me to think about high quality video on the Internet, and I totally didn't want to hear about it." + + + A touch of gray, kinda suits you anyway.. + + + + <a href="http://www.sixties.com/html/garcia_stack_0.html"><img src="http://www.scripting.com/images/captainTripsSmall.gif" height="51" width="42" border="0" hspace="10" vspace="10" align="right"></a>In celebration of today's inauguration, after hearing all those great patriotic songs, America the Beautiful, even The Star Spangled Banner made my eyes mist up. It made my choice of Grateful Dead song of the night realllly easy. Here are the <a href="http://searchlyrics2.homestead.com/gd_usblues.html">lyrics</a>. Click on the audio icon to the left to give it a listen. "Red and white, blue suede shoes, I'm Uncle Sam, how do you do?" It's a different kind of patriotic music, but man I love my country and I love Jerry and the band. <i>I truly do!</i> + + + + \ No newline at end of file diff --git a/test/_files/RssTest100Sample1.xml b/test/_files/RssTest100Sample1.xml new file mode 100644 index 00000000..cd884501 --- /dev/null +++ b/test/_files/RssTest100Sample1.xml @@ -0,0 +1,62 @@ + + + + + + XML.com + http://xml.com/pub + + XML.com features a rich mix of information and services + for the XML community. + + + + + + + + + + + + + + + + + XML.com + http://www.xml.com + http://xml.com/universal/images/xml_tiny.gif + + + + Processing Inclusions with XSLT + http://xml.com/pub/2000/08/09/xslt/xslt.html + + Processing document inclusions with general XML tools can be + problematic. This article proposes a way of preserving inclusion + information through SAX-based processing. + + + + + Putting RDF to Work + http://xml.com/pub/2000/08/09/rdfdb/index.html + + Tool and API support for the Resource Description Framework + is slowly coming of age. Edd Dumbill takes a look at RDFDB, + one of the most exciting new RDF toolkits. + + + + + Search XML.com + Search XML.com's XML collection + s + http://search.xml.com + + + \ No newline at end of file diff --git a/test/_files/RssTest100Sample2.xml b/test/_files/RssTest100Sample2.xml new file mode 100644 index 00000000..5b4cbc46 --- /dev/null +++ b/test/_files/RssTest100Sample2.xml @@ -0,0 +1,67 @@ + + + + + + Meerkat + http://meerkat.oreillynet.com + Meerkat: An Open Wire Service + The O'Reilly Network + Rael Dornfest (mailto:rael@oreilly.com) + Copyright © 2000 O'Reilly & Associates, Inc. + 2000-01-01T12:00+00:00 + hourly + 2 + 2000-01-01T12:00+00:00 + + + + + + + + + + + + + + + Meerkat Powered! + http://meerkat.oreillynet.com/icons/meerkat-powered.jpg + http://meerkat.oreillynet.com + + + + XML: A Disruptive Technology + http://c.moreover.com/click/here.pl?r123 + + XML is placing increasingly heavy loads on the existing technical + infrastructure of the Internet. + + The O'Reilly Network + Simon St.Laurent (mailto:simonstl@simonstl.com) + Copyright © 2000 O'Reilly & Associates, Inc. + XML + XML.com + NASDAQ + XML + + + + Search Meerkat + Search Meerkat's RSS Database... + s + http://meerkat.oreillynet.com/ + search + regex + + + \ No newline at end of file diff --git a/test/_files/RssTest200Sample1.xml b/test/_files/RssTest200Sample1.xml new file mode 100644 index 00000000..7eedaf81 --- /dev/null +++ b/test/_files/RssTest200Sample1.xml @@ -0,0 +1,41 @@ + + + + Liftoff News + http://liftoff.msfc.nasa.gov/ + Liftoff to Space Exploration. + en-us + Tue, 10 Jun 2003 04:00:00 GMT + Tue, 10 Jun 2003 09:41:01 GMT + http://blogs.law.harvard.edu/tech/rss + Weblog Editor 2.0 + editor@example.com + webmaster@example.com + + Star City + http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp + How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia's <a href="http://howe.iki.rssi.ru/GCTC/gctc_e.htm">Star City</a>. + Tue, 03 Jun 2003 09:39:21 GMT + http://liftoff.msfc.nasa.gov/2003/06/03.html#item573 + + + Sky watchers in Europe, Asia, and parts of Alaska and Canada will experience a <a href="http://science.nasa.gov/headlines/y2003/30may_solareclipse.htm">partial eclipse of the Sun</a> on Saturday, May 31st. + Fri, 30 May 2003 11:06:42 GMT + http://liftoff.msfc.nasa.gov/2003/05/30.html#item572 + + + The Engine That Does More + http://liftoff.msfc.nasa.gov/news/2003/news-VASIMR.asp + Before man travels to Mars, NASA hopes to design new engines that will let us fly through the Solar System more quickly. The proposed VASIMR engine would do that. + Tue, 27 May 2003 08:37:32 GMT + http://liftoff.msfc.nasa.gov/2003/05/27.html#item571 + + + Astronauts' Dirty Laundry + http://liftoff.msfc.nasa.gov/news/2003/news-laundry.asp + Compared to earlier spacecraft, the International Space Station has many luxuries, but laundry facilities are not one of them. Instead, astronauts have other options. + Tue, 20 May 2003 08:56:02 GMT + http://liftoff.msfc.nasa.gov/2003/05/20.html#item570 + + + \ No newline at end of file diff --git a/test/_files/RssTestCNN.xml b/test/_files/RssTestCNN.xml new file mode 100644 index 00000000..b7992aa0 --- /dev/null +++ b/test/_files/RssTestCNN.xml @@ -0,0 +1,80 @@ + + + +CNN.com +http://www.cnn.com/rssclick/?section=cnn_topstories +CNN.com delivers up-to-the-minute news and information on the latest top stories, weather, entertainment, politics and more. +en-us +© 2006 Cable News Network LP, LLLP. +Mon, 23 Jan 2006 15:11:09 EST +5 + +CNN.com +http://www.cnn.com/rssclick/?section=cnn_topstories +http://i.cnn.net/cnn/.element/img/1.0/logo/cnn.logo.rss.gif +144 +33 +CNN.com delivers up-to-the-minute news and information on the latest top stories, weather, entertainment, politics and more. + + +Court ruling could lead to BlackBerry shutdown +http://www.cnn.com/rssclick/money/2006/01/23/technology/rim/index.htm?section=cnn_topstories +BlackBerry maker Research in Motion was dealt a setback today when the U.S. Supreme Court turned down a request to review a major patent infringement ruling against the company. Research In Motion (RIM) had petitioned the Supreme Court to review a federal appeals court ruling that could lead to a shutdown of most U.S. BlackBerry sales and service. +Mon, 23 Jan 2006 15:09:23 EST + + +Ford owners not told how to reduce fire risk +http://www.cnn.com/rssclick/2006/US/01/23/ford.fires/index.html?section=cnn_topstories +The parents of three sisters burned to death in a rear-end crash are asking Ford Motor Co. to install the same gas tank protective devices in regular models as it did for its police cars. +Mon, 23 Jan 2006 12:30:45 EST + + +Ford cutting up to 30,000 jobs +http://www.cnn.com/rssclick/money/2006/01/23/news/companies/ford_closings/index.htm?section=cnn_topstories +Ford will close 14 manufacturing plants in North America and cut up to 30,000 jobs in the coming years to try to stem losses and adjust to a new, significantly lower market share. "If we build it, they'll buy it. That's business as usual and it's wrong," said Ford Chairman and CEO Bill Ford . "Our product plans for too long have been defined by our capacity. That's why we must reduce capacity in North America." +Mon, 23 Jan 2006 11:56:19 EST + + +Bush rejects warrantless wiretaps furor +http://www.cnn.com/rssclick/2006/POLITICS/01/23/bush.ap/index.html?section=cnn_topstories +Read full story for latest details. +Mon, 23 Jan 2006 14:25:26 EST + + +Rescuers dig for survivors in collapsed Nairobi building +http://www.cnn.com/rssclick/2006/WORLD/africa/01/23/kenya.building/index.html?section=cnn_topstories +Rescuers are desperately trying to dig out construction workers trapped under the rubble of a five-story building that collapsed today in Nairobi, Kenya. At least 60 people are injured. It was unclear if any workers had died. Witnesses told news agencies they had seen between four and eight bodies but police have given no official death toll yet. Dozens of rescuers dug into the rubble with their bare hands while the injured were taken to hospitals in cars. +Mon, 23 Jan 2006 15:06:36 EST + + +DNA frees man 24 years into 130-year sentence +http://www.cnn.com/rssclick/2006/LAW/01/23/dna.exoneration.ap/index.html?section=cnn_topstories +Read full story for latest details. +Mon, 23 Jan 2006 14:05:16 EST + + +School nurse crisis putting kids at risk +http://www.cnn.com/rssclick/2006/HEALTH/01/23/btsc.cohen/index.html?section=cnn_topstories +A few months ago, I was interviewing a principal at a Chicago, Illinois, public elementary school, when from outside her office came the sounds of a child coughing. +Mon, 23 Jan 2006 12:54:40 EST + + +Russia: Britain used 'rock' to spy +http://www.cnn.com/rssclick/2006/WORLD/europe/01/23/uk.russia.row/index.html?section=cnn_topstories +British official say they are "concerned and surprised" at allegations by a Russian state TV program that UK diplomats used a transmitter embedded in a fake rock as part of a high-tech spying operation in Moscow, news agencies report. +Mon, 23 Jan 2006 14:21:29 EST + + +Buttafuocos plan TV reunion with Amy Fisher +http://www.cnn.com/rssclick/2006/SHOWBIZ/TV/01/23/people.fisher.buttafuoco.reunion.ap/index.html?section=cnn_topstories +Read full story for latest details. +Mon, 23 Jan 2006 13:31:06 EST + + +Could you love the 'world's worst dog'? +http://www.cnn.com/rssclick/2006/SHOWBIZ/books/01/23/books.marley.me.ap/index.html?section=cnn_topstories +Read full story for latest details. +Mon, 23 Jan 2006 12:35:01 EST + + + diff --git a/test/_files/RssTestHarvardLaw.xml b/test/_files/RssTestHarvardLaw.xml new file mode 100644 index 00000000..842ba27a --- /dev/null +++ b/test/_files/RssTestHarvardLaw.xml @@ -0,0 +1,142 @@ + + + + + Really Simple Syndication + http://blogs.law.harvard.edu/tech/ + RSS Advisory Board announcements and RSS news + http://creativecommons.org/licenses/by-sa/1.0/ + en-us + Sat, 21 Jan 2006 05:00:00 GMT + Sun, 22 Jan 2006 02:01:58 GMT + http://backend.userland.com/rss + UserLand Frontier v9.5 + rssUpdates + rcade@yahoo.com + rcade@yahoo.com + + Simple Syndication in Communist China + http://english.peopledaily.com.cn/rss/rss.html + The English language edition of <a href="http://english.peopledaily.com.cn/">People's Daily</a>, the official newspaper of the Communist Party of China, offers <a href="http://english.peopledaily.com.cn/rss/rss.html">18 RSS 2.0 newsfeeds</a>.<br> +<br> +In addition to feeds on current events in news, business, sports, and +other areas, the paper devotes feeds to party leaders such as Chinese +President <a href="http://english.people.com.cn/rss/hujintao.xml">Hu Jintao</a> and Premier <a href="http://english.peopledaily.com.cn/rss/rss.html">Wen Jiabao</a>.<br> +<br> +Outside observers of China often look to <span style="font-style: italic;">People's Daily</span> for clues about the inner workings of the government, as described in <a href="http://en.wikipedia.org/wiki/People%27s_Daily">Wikipedia</a>:<br> +<p style="margin-left: 40px;">Newspaper articles in the <span style="font-style: italic;">People's Daily</span> are often not read for +content, so much as placement. A large number of articles devoted to a +political figure or idea is often taken as a sign that that official is +rising.</p><br><br><div style="margin-left: 40px;">In addition, editorials in the <i>People's Daily</i> are also still regarded as fairly authoritative statements of government policy.<br> +</div> + Rogers Cadenhead + http://blogs.law.harvard.edu/tech/2005/07/10#a852 + http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=852&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2005%2F07%2F10%23a852 + + + RSS Takes Flight at NASA + http://www.nasa.gov/rss/ + The National Aeronautics and Space Administration makes extensive use +of RSS 2.0 to provide news, photographs, and press releases on upcoming +missions and other space-related topics.<br> +<br> +People looking ahead to the planned July 13 launch of the space shuttle Discovery can subscribe to a <a href="http://www.nasa.gov/rss/rtf_news.rss">Return to Flight RSS feed</a>.<br> +<br> +NASA's RSS information page also includes an interesting demonstration of an RSS viewer created in Macromedia Flash.<br> + Rogers Cadenhead + http://blogs.law.harvard.edu/tech/2005/07/09#a851 + http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=851&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2005%2F07%2F09%23a851 + + + RSS Usage Skyrockets in the U.S. + http://blogs.law.harvard.edu/tech/2005/01/04#a821 + Six million Americans get news and information from RSS aggregators, according to a <a href="http://www.pewinternet.org/pdfs/PIP_blogging_data.pdf">nationwide telephone survey</a> conducted by the Pew Internet and American Life Project in November.<br> +<br> +The project, an ongoing survey of the 120 million Americans using the +Internet, found that 5 percent follow their favorite sources through +RSS syndication. "This is a first-time measurement from our surveys and +is an indicator that this application is gaining an impressive +foothold."<br> +<br> +The survey also found that 27 percent of those polled are weblog +readers, a 58 percent jump in the 9 months since the preceding poll was +conducted.<br> + Rogers Cadenhead + http://blogs.law.harvard.edu/tech/2005/01/04#a821 + http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=821&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2005%2F01%2F04%23a821 + + + Added link to encoding examples in RSS 2.0 spec + http://blogs.law.harvard.edu/tech/2004/06/19#a683 + <P>We added a link to a page of <A href="http://blogs.law.harvard.edu/tech/encodingDescriptions">encoding examples</A> for descriptions, <A href="http://blogs.law.harvard.edu/tech/rss#hrelementsOfLtitemgt">under</A> Elements of &lt;item>. The change is also <A href="http://blogs.law.harvard.edu/tech/rssChangeNotes#61904Dw">noted</A> on the Change Notes page.</P> + Dave Winer + http://blogs.law.harvard.edu/tech/2004/06/19#a683 + http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=683&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F06%2F19%23a683 + + + Proposed clarification for RSS 2.0 spec (revised) + http://blogs.law.harvard.edu/tech/2004/06/15#a648 + <P>Here's a revised proposal for a clarification to the RSS 2.0 spec.</P> +<P>Under <A href="http://blogs.law.harvard.edu/tech/rss#hrelementsOfLtitemgt">Elements of &lt;item></A>, replace the lead paragraph with the following.<BR></P> +<BLOCKQUOTE> +<P>A channel may contain any number of &lt;item>s. An item may represent a "story" -- much like a story in a newspaper or magazine; if so its description is a synopsis of the story, and the link points to the full story. An item may also be complete in itself, if so, the description contains the text (entity-encoded HTML is allowed<FONT color=green><B>; see <A style="COLOR: green" href="http://blogs.law.harvard.edu/tech/encodingDescriptions">examples</A></B></FONT>), and the link and title may be omitted. All elements of an item are optional, however at least one of title or description must be present.</P></BLOCKQUOTE> +<P><STRONG>Notes</STRONG>: The new text is in green. The word examples links to a <A href="http://blogs.law.harvard.edu/tech/encodingDescriptions">page</A> of examples of encodings. We'd like to make the changes to the spec early next week.&nbsp;&nbsp;If you have concerns about this change, please post a comment below, and we will review them before making the change. Thanks to everyone who has participated in the discussion thus far.</P> + Andrew Grumet + http://blogs.law.harvard.edu/tech/2004/06/15#a648 + http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=648&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F06%2F15%23a648 + + + Proposed clarification for RSS 2.0 spec + http://blogs.law.harvard.edu/tech/2004/06/04#a553 + <P>Requesting comments on a couple of proposed clarifications to the <A href="http://blogs.law.harvard.edu/tech/rss#hrelementsOfLtitemgt">RSS 2.0 spec</A>.</P> +<P>1. Under Elements of &lt;item>, replace the lead paragraph with the following. The new text is highlighted in green.</P> +<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"> +<P>A channel may contain any number of &lt;item>s. An item may represent a "story" -- much like a story in a newspaper or magazine; if so its description is a synopsis of the story, and the link points to the full story. An item may also be complete in itself, if so, the description contains the text, and the link and title may be omitted. <B><FONT color=green>Either way, &lt;description> contains entity-encoded HTML</FONT>.</B> All elements of an item are optional, however at least one of title or description must be present.</P></BLOCKQUOTE> +<P>2. Immediately following that section, a link to a <A href="http://blogs.law.harvard.edu/tech/encodingDescriptions">page of examples</A>, authored by Nick Bradbury, author of the FeedDemon aggregator.</P> +<P><STRONG>Notes: </STRONG>We believe aggregators already assume the&nbsp;item-level description contains entity-encoded HTML.&nbsp; We'd like to make the changes to the spec early next week and if there are no deal-stoppers, we will. Please comment below. Off-topic and personal comments will be deleted.</P> +<P><STRONG>Thanks to:</STRONG> Nick Bradbury, Brent Simmons, Greg Reinacker, Jake Savin, Dare Obasanjo, Matt Mullenweg for their help working out this proposed clarification.</P> + Dave Winer + http://blogs.law.harvard.edu/tech/2004/06/04#a553 + http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=553&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F06%2F04%23a553 + + + RSS documentation updates + http://blogs.law.harvard.edu/tech/2004/05/31#a550 + If you're not tracking this site's <A href="http://blogs.law.harvard.edu/tech/rssChangeNotes">change notes page</A>, you might have missed a few minor edits to the documentation for RSS 2.0:<BR> +<UL> +<LI>The <A href="http://cyber.law.harvard.edu/blogs/gems/tech/rss2sample.xml">RSS 2.0 sample file</A> has been updated. +<LI>An <A href="http://blogs.law.harvard.edu/tech/rssChangeNotes#53104Dw">encoding issue</A> has been fixed on the <A href="http://blogs.law.harvard.edu/tech/skipHoursDays">skipHours and skipDays</A> page. </LI></UL>Suggestions for further improvements to the documentation are encouraged.<BR><BR> + Rogers Cadenhead + http://blogs.law.harvard.edu/tech/2004/05/31#a550 + http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=550&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F05%2F31%23a550 + + + The role of the advisory board + http://blogs.law.harvard.edu/tech/2004/05/18#a540 + There's been some confusion about the role of the advisory board. The purpose of this post to try to clear it up.<BR><BR>1. It's got a very conservative mission, to answer questions about RSS, to help people use it, to promote its use. It's basically a support function. <BR><BR>2. Anyone can extend RSS through namespaces. We suggest that people look first to see if there is a core element that already does what they need to do, and if so, use that instead of inventing a new one. That will keep the work of aggregator developers to a minimum, keep the barriers to entry low, help keep the market competitive. Competition should be based on features, performance and price, not compatibility. Compatibility should be easy.<BR><BR>3. Emphatically, this group is not a standards organization. It does not own RSS, or the spec, it has no more or less authority than any other group of people who wish to promote RSS. + Dave Winer + http://blogs.law.harvard.edu/tech/2004/05/18#a540 + http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=540&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F05%2F18%23a540 + + + Why are dates RFC 822? + http://blogs.law.harvard.edu/tech/2004/05/16#a534 + <P>Gene Saunders writes: "Why does RSS 2.0 use RFC 822 instead of the (infinitely more modern) RFC 2822?"</P> +<P>Here's why we went with RFC 822:</P> +<P>1. Any scripting software that was used in Internet applications would already have to deal with RFC 822 dates, since that was the format used in email. For most app developers, I imagined, they already had library routines that dealt with 822 format dates. The script environment I was using certainly did. Over the years I've never heard a complaint that people were unable to process 822 dates. <img src="http://static.userland.com/shortcuts/images/qbullets/sidesmiley.gif"></P> +<P>2. 822 dates are not only machine readable, they are also human readable. One of the <A href="http://davenet.scripting.com/2000/09/02/whatToDoAboutRss#rssIsAboutSimplicity">goals</A> of RSS was to be non-intimidating for non-technical users -- they should be able to look at a file and make sense of what's there, where ever possible. </P> +<P>3. Believe it or not, the decision was made in 1997, seven years ago. RSS is a venerable institution, so its anachronisms should be appreciated&nbsp;as one respects a fine wine or an elder statesman, or a format that spawned an incredible market.</P> + Dave Winer + http://blogs.law.harvard.edu/tech/2004/05/16#a534 + http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=534&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F05%2F16%23a534 + + + Speed Meets Feed in Download Tool + http://blogs.law.harvard.edu/tech/2004/03/15#a519 + <A href="http://www.wired.com/news/infostructure/0,1377,62651,00.html">Wired</A>: "A demo publishing system launched Friday by a popular programmer and blogger merges two of this season's hottest tech fads -- RSS news syndication and BitTorrent file sharing -- to create a cheap publishing system for what its author calls 'big media objects.' The hybrid system is meant to eliminate both the publisher's need for fat bandwidth, and the consumer's need to wait through a grueling download." + Dave Winer + http://blogs.law.harvard.edu/tech/2004/03/15#a519 + http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=519&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F03%2F15%23a519 + + + \ No newline at end of file diff --git a/test/_files/RssTestPlanetPHP.xml b/test/_files/RssTestPlanetPHP.xml new file mode 100644 index 00000000..762f9877 --- /dev/null +++ b/test/_files/RssTestPlanetPHP.xml @@ -0,0 +1,126 @@ + + +Planet PHPhttp://planet-php.netPeople blogging about PHPeneZ components in Gentoo Linux - Sebastian Bergmannhttp://www.sebastian-bergmann.de/blog/archives/565-eZ-components-in-Gentoo-Linux.htmlMon, 23 Jan 2006 16:40:00 +0000eZ components, which provide an enterprise ready general purpose PHP platform, are now available through Gentoo Linux's portage system:
wopr-mobile ~ # emerge -vp ezc-eZcomponents
+
+These are the packages that I would merge, in order:
+
+Calculating dependencies ...done!
+[ebuild  N    ] app-admin/php-toolkit-1.0-r2  0 kB
+[ebuild  N    ] dev-lang/php-5.1.2  0 kB [3]
+[ebuild  N    ] dev-php/PEAR-PEAR-1.4.6  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Base-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Database-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-PhpGenerator-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Configuration-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-ImageAnalysis-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Archive-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Translation-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Cache-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-ConsoleTools-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-PersistentObject-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-ImageConversion-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Mail-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-UserInput-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Debug-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-EventLog-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-Execution-1.0_rc1  0 kB [2]
+[ebuild  N    ] dev-php5/ezc-eZcomponents-1.0_rc1  0 kB [2]
+
+Total size of downloads: 0 kB
+Portage overlays:
+ [1] /usr/local/overlay/personal
+ [2] /usr/local/overlay/cvs
+ [3] /usr/local/overlay/php/testing
+ [4] /usr/local/overlay/php/experimental
+ [5] /usr/local/overlay/gentopia
+ [6] /usr/local/overlay/xgl
+ ]]>
PHP Insecurity - Chris Shifletthttp://shiflett.org/archive/185Mon, 23 Jan 2006 16:15:56 +0000Andrew van der Stock has written a strong criticism of PHP's insecurity. Andrew is a seasoned security expert and a major contributor to OWASP, and he states:

+
After writing PHP forum software for three years now, I've come to the conclusion that it is basically impossible for normal programmers to write secure PHP code. It takes far too much effort.
+

He continues, citing specific areas where he thinks PHP is weak and asserting that "PHP must now mature and take on a proper security architecture."

+

Many of the insecure features he cites (register_globals, magic_quotes_gpc, and safe_mode) are slated to be removed in PHP 6, but his core complaint seems to revolve around the fact that PHP makes too much power too easily accessible, often granting developers more power and flexibility than they realize (e.g., wrappers).

+

Aside from minor language features like taint mode, I don't see what other platforms offer to help prevent inexperienced developers from writing insecure code. Anyone care to enlighten me? :-)

+ Posted Mon, 23 Jan 2006 16:15:56 GMT in Chris Shiflett: The PHP Blog
+ [ +   + + Discuss +   + | +   + + Tag +   + | +   + + Digg +   + | +   + + Furl +   + | +   + + Cosmos +   + ] +

]]>
Beta release of mobile webmail client (MIMP) - Horde Newshttp://janschneider.de/cweb/home/index,channel,25,story,255.htmlMon, 23 Jan 2006 10:01:16 +0000Meet me at php|tek - ThinkPHP /dev/blog - PHPhttp://blog.thinkphp.de/archives/81-Meet-me-at-phptek.htmlSun, 22 Jan 2006 22:34:00 +0000php|tek, the next conference from the php|arch +guys around Marco Tabini who already organized the php|cruise and php|tropics +conferences, will be from April 26th to 28th at Orlando, Florida. As +you can read on the recently published schedule +I'll hold two talks. The first talk will be about PHP on the command +line, showing PHP's strength beyond the web which can be helpful to +build, deploy and scale your web-application and even for building apps +completely independent from anything on the web. My second talk will be +about PHP's reflection API. In that session I'll give an introduction +into the API and show how to use it to build modular, dynamic +applications.

+

If you're in reachable distance you should take the chance to listen and meet PHP developers from all over the world. (Hint: Till January 31st you can get early-bird rates!)

johannes

]]>
Quick Lookup - John Coxhttp://wyome.com/index.php?module=articles&func=display&ptid=10&catid=29-31&aid=507Sun, 22 Jan 2006 19:23:31 +0000Quick lookup is a very nice little reference tool for lookups of web development documentation. It installs as a simple bookmark which can be changed to your sidebar for look ups of php / css / javascript / mysql documentation. It has a limited scope of features (which isn't a bad thing in my mind):

+

* Multiple tabs
+* PHP / MySQL / CSS / JS reference (MySQL is 55% complete)
+* Examples
+* Search as you type
+* Fast results
+* Remembers your last tab on your revisit
+* Access keys, [alt + (p, m, j, c)]
+

+

I did a cursory install, and it appears to be pretty fast. I think it might be better as part of the Web Developer Extension for Firefox, but as is, I can see the uses.

+ ]]>
mysql_real_escape_string() versus Prepared Statements - Ilia Alshanetskyhttp://ilia.ws/archives/103-mysql_real_escape_string-versus-Prepared-Statements.htmlSun, 22 Jan 2006 18:03:59 +0000Chris has written a compelling piece about how the use of addslashes() for string escaping in MySQL queries can lead to SQL injection through the abuse of multibyte character sets. In his example he relies on addslashes() to convert an invalid multibyte sequence into a valid one, which also has an embedded ' that is not escaped. And in an ironic twist, the function intended to protect against SQL injection is used to actually trigger it.

+The problem demonstrated, actually goes a bit further, which even makes the prescribed escaping mechanism, mysql_real_escape_string() prone to the same kind of issues affecting addslashes(). The main advantage of the mysql_real_escape_string() over addslashes() lies in the fact that it takes character set into account and thus is able to determine how to properly escape the data. For example, if GBK character set is being used, it will not convert an invalid multibyte sequence 0xbf27 (¿’) into 0xbf5c27 (¿\’ or in GBK a single valid multibyte character followed by a single quote). To determine the proper escaping methodology mysql_real_escape_string() needs to know the character set used, which is normally retrieved from the database connection cursor. Herein lies the “trick”. In MySQL there are two ways to change the character set, you can do it by changing in MySQL configuration file (my.cnf) by doing:

CODE:
[client]
+default-character-set=GBK


+Or you can change on a per-connection basis, which is a common practice done by people without admin level access to the server via the following query:

CODE:
SET CHARACTER SET 'GBK'


+The problem with the latter, is that while it most certainly modified the charset it didnÂ’t let the escaping facilities know about it. Which means that mysql_real_escape_string() still works on the basis of the default charset, which if set to latin1 (common default) will make the function work in a manner identical to addslashes() for our purposes. Another word, 0xbf27 will be converted to 0xbf5c27 facilitating the SQL injection. Here is a brief proof of concept.

PHP:

<?php

+$c 
= mysql_connect("localhost", "user", "pass");
mysql_select_db("database", $c);

// change our character set
mysql_query("SET CHARACTER SET 'gbk'", $c);

// create demo table
mysql_query("CREATE TABLE users (
+    username VARCHAR(32) PRIMARY KEY,
+    password VARCHAR(32)
+) CHARACTER SET 'GBK'"
, $c);
mysql_query("INSERT INTO users VALUES('foo','bar'), ('baz','test')", $c);

// now the exploit code
$_POST['username'] = chr(0xbf) . chr(0x27) . ' OR username = username /*'; 
$_POST['password'] = 'anything'; 

Truncated by Planet PHP, read more at the original (another 2694 bytes)

]]>
The addslashes() Versus mysql_real_escape_string() Debate - Chris Shifletthttp://shiflett.org/archive/184Sun, 22 Jan 2006 04:15:58 +0000Last month, I discussed Google's XSS Vulnerability and provided an example that demonstrates it. I was hoping to highlight why character encoding consistency is important, but apparently the addslashes() versus mysql_real_escape_string() debate continues. Demonstrating Google's XSS vulnerability was pretty easy. Demonstrating an SQL injection attack that is immune to addslashes() is a bit more involved, but still pretty straightforward.

+

In GBK, 0xbf27 is not a valid multi-byte character, but 0xbf5c is. Interpreted as single-byte characters, 0xbf27 is 0xbf (¿) followed by 0x27 ('), and 0xbf5c is 0xbf (¿) followed by 0x5c (\).

+

How does this help? If I want to attempt an SQL injection attack against a MySQL database, having single quotes escaped with a backslash is a bummer. If you're using addslashes(), however, I'm in luck. All I need to do is inject something like 0xbf27, and addslashes() modifies this to become 0xbf5c27, a valid multi-byte character followed by a single quote. In other words, I can successfully inject a single quote despite your escaping. That's because 0xbf5c is considered to be a single character, not two. Oops, there goes the backslash.

+

I'm going to use MySQL 5.0 and PHP's mysqli extension for this demonstration. If you want to try this yourself, make sure you're using GBK. I just changed /etc/my.cnf, but that's because I'm testing locally:

+
[client]
+default-character-set=GBK
+

Create a table called users:

+
CREATE TABLE users
+(
+    username VARCHAR(32) CHARACTER SET GBK,
+    password VARCHAR(32) CHARACTER SET GBK,
+    PRIMARY KEY (username)
+);
+
+

The following script mimics a situation where only addslashes() is used to escape the data being used in a query:

+
<?php 

$mysql 
= array();

$db = mysqli_init();
$db->real_connect('localhost', 'myuser', 'mypass', 'mydb');

$_POST['username'] = chr(0xbf) .
                     
chr(0x27) .
                     
' OR username = username /*';
$_POST['password'] = 'guess';

$mysql['username'] = addslashes($_POST['username']);
$mysql['password'] = addslashes($_POST

Truncated by Planet PHP, read more at the original (another 4165 bytes)

]]>
PHP Conferences - Jason E. Sweathttp://blog.casey-sweat.us/?p=69Sun, 22 Jan 2006 04:04:14 +0000Back from Norway - Tobias Schlitthttp://www.schlitt.info/applications/blog/index.php?/archives/407-Back-from-Norway.htmlSun, 22 Jan 2006 00:30:57 +0000Norway is a somewhat strange country. When I got there - 2 weeks ago to work with Amos, Derick, Fred and Ray on the eZ components - it had the expected amount of snow. A few days later, there was nothing anymore. We had positive celsius values and the weather was really crappy... until Monday. Since then it has been snowing all the time and yesterday we left when it looked like this:

+ +

pict1285.jpg

+ +

Nice to watch, but not real fun to walk onto. :) Anyway, it's been another great stay in Skien, where the eZ headquarter is and I'm pretty much looking forward to our summer conference, where we plan to have the complete eZ team there and lots of people from the PHP world. Thanks for the great time, folks!

+ + ]]>
Solar 0.10.0 Released - Paul M. Joneshttp://paul-m-jones.com/blog/?p=192Sat, 21 Jan 2006 21:44:43 +0000
diff --git a/test/_files/RssTestSlashdot.xml b/test/_files/RssTestSlashdot.xml new file mode 100644 index 00000000..2ae85d9a --- /dev/null +++ b/test/_files/RssTestSlashdot.xml @@ -0,0 +1,178 @@ + + + + Slashdot + http://slashdot.org/ + News for nerds, stuff that matters + en-us + Copyright 1997-2005, OSTG - Open Source Technology Group, Inc. All Rights Reserved. + 2006-01-23T20:11:00+00:00 + OSTG + pater@slashdot.org + Technology + hourly + 1 + 1970-01-01T00:00+00:00 + + + + + + + + + + + + + + + + + + + Slashdot + http://images.slashdot.org/topics/topicslashdot.gif + http://slashdot.org/ + + + Interview with Mark Spencer of Asterisk + http://rss.slashdot.org/Slashdot/slashdot?m=3264 + comforteagle writes "OSDir has published an interview with Mark Spencer of Asterisk and Gaim about why and how he got started coding up the software platform PBX system and how it has become much more than -just- another phone system. He also shares his insights for the opportunities within the telecom industry for open source."<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3264"/> + ScuttleMonkey + 2006-01-23T19:47:00+00:00 + communications + ripe-for-open-source + mainpage + 15 + 15,13,11,6,2,1,1 + http://slashdot.org/article.pl?sid=06/01/23/1517205&from=rss + + + The Adobe Photoshop Elements Crafts Book + http://rss.slashdot.org/Slashdot/slashdot?m=3263 + Sdurham writes "Adobe Photoshop and its many siblings have long been a staple of artists, photographers, and programmers interested in doing serious image manipulation. Increasingly, Photoshop's younger sister Photoshop Elements comes prepackaged with digital cameras. Yet many of the users of these cameras lack the time or patience to tackle the steep learning curve of the Photoshop family and are left asking "How do I do ... ?". Elizabeth Bulger's The Adobe Photoshop Elements Crafts Book attempts to bridge the gap between Photoshop skill level and personal creativity by stepping the reader through 14 different craft projects. In doing so, Bulger tries to provide the basic Photoshop Elements skills necessary for readers to pursue their own projects after finishing the book." Read the rest of Sdurham's review.<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3263"/> + samzenpus + 2006-01-23T18:54:00+00:00 + books + update-your-prom-pictures + books + 18 + 18,15,9,5,3,1,0 + http://books.slashdot.org/article.pl?sid=06/01/23/1411250&from=rss + + + Supreme Court spurns RIM + http://rss.slashdot.org/Slashdot/slashdot?m=3262 + l2718 writes "NTP has just won the latest round in its court battle against Research in Motion (makers of the Blackberry). Today's Order List from the US Supreme Court includes a denial of certiorary for RIM's appeal. This follows the Circuit Court of Appeals' denial of review en banc we have covered previously. As sometimes happens, the court nevertheless accepted amicus curiae briefs from several groups, including Intel and the Canadian government." The potential impact of this may mean the shutdown of Blackberry's network. I hope the crackberry addicts have lots of methadone onhand. +<p><a href="http://rss.slashdot.org/~c/Slashdot/slashdot?a=fYMCju"><img src="http://rss.slashdot.org/~c/Slashdot/slashdot?i=fYMCju" border="0"></img></a></p><img src="http://rss.slashdot.org/Slashdot/slashdot?g=3262"/> + Hemos + 2006-01-23T18:22:00+00:00 + patents + good-bye-black-berry + yro + 138 + 138,131,116,73,15,9,5 + http://yro.slashdot.org/article.pl?sid=06/01/23/1744258&from=rss + + + Adult Entertainment Antes Up In DRM War + http://rss.slashdot.org/Slashdot/slashdot?m=3261 + At the recent adult entertainment awards, host Greg Fitzsimmons highlighted the deep relationship between the internet and pornography stating "'The Internet was completely funded by porn,' he said [...] And if it wasn't for the Internet, he added, 'you guys would be completely out of business.' The audience, packed with porn actors and adult entertainment moguls like Jenna Jameson and Larry Flynt, roared with laughter." Now it appears that the adult entertainment industry has chosen to ante up in the DRM battle as well. Some companies have chosen to take sides, like Digital Playground who will be supporting Sony's Blu-Ray. Others, like Vivid Entertainment, seem to think that the answer is diversity and will be supporting both Blu-Ray and HD-DVD.<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3261"/> + ScuttleMonkey + 2006-01-23T17:37:00+00:00 + media + can't-we-all-just-get-along + hardware + 152 + 152,146,124,84,34,17,12 + http://hardware.slashdot.org/article.pl?sid=06/01/23/1544235&from=rss + + + Slashdot Index Code Update + http://rss.slashdot.org/Slashdot/slashdot?m=3259 + For years now Slashdot has posted what we call "Sectional Content". That is to say, stories that we think are good, but since we try to keep the Slashdot Main Page to around 15 stories per day, some stuff just gets put into the sections. This content is mostly lost to readers who simply don't know it exists. Today we're deploying new code to help you find that content (and alternatively, to disable it).<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3259"/> + CmdrTaco + 2006-01-23T17:00:00+00:00 + slashdot + zomg-you-got-some-ajax-in-our-ui + mainpage + 247 + 247,231,192,142,41,21,14 + http://slashdot.org/article.pl?sid=06/01/19/175253&from=rss + + + IE7 Leaked + http://rss.slashdot.org/Slashdot/slashdot?m=3260 + lju writes "IE7 has been leaked according to pcpro. From the article: '...last Friday it was revealed that a build of the new browser - version 5299 - along with numerous screenshots, was available online.' " +<p><a href="http://rss.slashdot.org/~c/Slashdot/slashdot?a=jVTbOh"><img src="http://rss.slashdot.org/~c/Slashdot/slashdot?i=jVTbOh" border="0"></img></a></p><img src="http://rss.slashdot.org/Slashdot/slashdot?g=3260"/> + CmdrTaco + 2006-01-23T16:41:00+00:00 + microsoft + hate-when-that-happens + it + 265 + 265,257,202,137,52,31,19 + http://it.slashdot.org/article.pl?sid=06/01/23/152211&from=rss + + + The Future of e-Commerce and e-Information? + http://rss.slashdot.org/Slashdot/slashdot?m=3257 + An anonymous reader writes "The Washington Post has an interesting article on what they label 'The Coming Tug of War Over the Internet. From the article: 'Do you prefer to search for information online with Google or Yahoo? What about bargain shopping -- do you go to Amazon or eBay? Many of us make these kinds of decisions several times a day, based on who knows what -- maybe you don't like bidding, or maybe Google's clean white search page suits you better than Yahoo's colorful clutter. But the nation's largest telephone companies have a new business plan, and if it comes to pass you may one day discover that Yahoo suddenly responds much faster to your inquiries, overriding your affinity for Google. Or that Amazon's Web site seems sluggish compared with eBay's.'" Seems like the idea of the 2-tier internet is really catching on with the market-droids.<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3257"/> + ScuttleMonkey + 2006-01-23T15:46:00+00:00 + biz + bad-for-the-internet-good-for-business + yro + 159 + 159,157,140,90,25,16,10 + http://yro.slashdot.org/article.pl?sid=06/01/23/1450249&from=rss + + + MacWorld MacBook Only a Prototype? + http://rss.slashdot.org/Slashdot/slashdot?m=3256 + mahju writes "Hard Mac is reporting that Apple's, unoffical, response in Paris to the the lack of information on battery life, is that the MacBook Pro that were demoed at Mac World SF are only prototypes and the final versions are still under development. " +<p><a href="http://rss.slashdot.org/~c/Slashdot/slashdot?a=qEOB5Q"><img src="http://rss.slashdot.org/~c/Slashdot/slashdot?i=qEOB5Q" border="0"></img></a></p><img src="http://rss.slashdot.org/Slashdot/slashdot?g=3256"/> + CmdrTaco + 2006-01-23T14:12:00+00:00 + intel + well-thats-not-surprising + apple + 160 + 160,150,136,102,35,21,14 + http://apple.slashdot.org/article.pl?sid=06/01/23/1333220&from=rss + + + Has Microsoft 'Solved' Spam? + http://rss.slashdot.org/Slashdot/slashdot?m=3254 + MsWillow writes to tell us the Seattle PI is running a story looking back at Bill Gates promise to have the spam problem "solved" in two years. Well, it looks like time is up, and the verdict is -- an emphatic "maybe". From the article: "Microsoft says it sees things differently. To "solve" the problem for consumers in the short run doesn't require eliminating spam entirely, said Ryan Hamlin, the general manager who oversees the company's anti-spam programs. Rather, he said, the idea is to contain it to the point that its impact on in-boxes is minor. In that way, Hamlin said, Gates' prediction has come true for people using the right tactics and advanced filtering technology."<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3254"/> + ScuttleMonkey + 2006-01-23T13:37:00+00:00 + spam + depends-on-your-definition-of-solved + it + 283 + 283,277,240,152,57,27,15 + http://it.slashdot.org/article.pl?sid=06/01/23/0340241&from=rss + + + World of Warcraft AQ Gates Open! + http://rss.slashdot.org/Slashdot/slashdot?m=3255 + Tayman writes "Wow...who didn't see this one coming? The players on the World of Warcraft Medivh server opened the gates to AQ. What happened next? The server crashed repeatedly. Why create content the servers can't handle? The very first time I read about this patch, I knew the servers would crash. The more people who open the gates, the more angry customers Blizzard will have in my opinion. With 5million+ subscribers, you would think Blizzard would have the best servers/connection money can buy. Although, I'm sure it's more complicated than simply plugging in a few ram chips and faster processors though. Most of the people involved in the raid are having a great time though. Could this be the most epic battle ever introduced to the mmorpg market? All signs point to yes. Let's see how long the mobs will respawn. Hopefully, the people of the Medivh server haven't seen anything yet. Either way, I would hate to be a network admin for Blizzard atm. ^_^ Here are some pics of the event. Thanks go out to all of those who took these pics. World of Warcraft AQ Pics Check out MMORPG Veteran to keep up with the events as they unfold." Update: 01/23 13:44 GMT by Z : Additionally, brandor wrote in with a link to some video of the event.<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3255"/> + Hemos + 2006-01-23T13:33:00+00:00 + rpg + of-course-it-will-blow-up + games + 330 + 330,313,258,158,46,27,20 + http://games.slashdot.org/article.pl?sid=06/01/23/1244201&from=rss + + + Search Slashdot + Search Slashdot stories + query + http://slashdot.org/search.pl + + + diff --git a/test/_files/TestAtomFeed.xml b/test/_files/TestAtomFeed.xml new file mode 100644 index 00000000..69afce7a --- /dev/null +++ b/test/_files/TestAtomFeed.xml @@ -0,0 +1,34 @@ + + + Atom Example + This is a simple Atom Feed made by XML_Feed_Writer. + + + + 4 + 3 + 2 + 2005-04-25T00:00:00+02:00 + + 1 + + The Item Title + 2004-09-25T16:03:00+02:00 + 2005-12-25T16:03:00+01:00 + + David Coallier + + Testing something before releasing + + + 2 + + Second item added to the builder/feeded.. + 2004-01-04T00:00:00+01:00 + 1970-01-01T01:00:00+01:00 + + David Coallier + + Jaws project, visit the website for infos... + + diff --git a/test/_files/TestAtomFeedEntryOnly.xml b/test/_files/TestAtomFeedEntryOnly.xml new file mode 100644 index 00000000..9088137d --- /dev/null +++ b/test/_files/TestAtomFeedEntryOnly.xml @@ -0,0 +1 @@ +1Bug1BuggyLong time debugging2005-09-152005-09-18RESOLVEDnormalP2FIXEDexample@example.comThe bug has been fixed. diff --git a/test/_files/TestAtomFeedNamespaced.xml b/test/_files/TestAtomFeedNamespaced.xml new file mode 100644 index 00000000..02d0ee25 --- /dev/null +++ b/test/_files/TestAtomFeedNamespaced.xml @@ -0,0 +1,34 @@ + + + Atom Example + This is a simple Atom Feed made by XML_Feed_Writer. + + + + 4 + 3 + 2 + 2005-04-25T00:00:00+02:00 + + 1 + + The Item Title + 2004-09-25T16:03:00+02:00 + 2005-12-25T16:03:00+01:00 + + David Coallier + + Testing something before releasing + + + 2 + + Second item added to the builder/feeded.. + 2004-01-04T00:00:00+01:00 + 1970-01-01T01:00:00+01:00 + + David Coallier + + Jaws project, visit the website for infos... + + diff --git a/test/_files/TestFeedEntryRssContentEncoded.xml b/test/_files/TestFeedEntryRssContentEncoded.xml new file mode 100644 index 00000000..baa70a73 --- /dev/null +++ b/test/_files/TestFeedEntryRssContentEncoded.xml @@ -0,0 +1,61 @@ + + + + + Zend Framework IT + http://www.zend-framework.it + Just another Zend Framework (Italian) weblog. + Sun, 03 Feb 2008 21:07:35 +0000 + http://wordpress.org/?v=2.3.1 + en + + Zend_Service_Technorati promosso in Core + http://www.zend-framework.it/2008/02/03/zend_service_technorati-promosso-in-core/ + http://www.zend-framework.it/2008/02/03/zend_service_technorati-promosso-in-core/#comments + Sun, 03 Feb 2008 21:06:15 +0000 + weppos + + + + + http://www.zend-framework.it/2008/02/03/zend_service_technorati-promosso-in-core/ + + Il commit r7757 ha ufficialmente decretato la promozione nella core library di un componente al quale sono molto affezionato: Zend_Service_Technorati.
+Non solo si tratta della prima libreria completamente proposta e sviluppata dal sottoscritto, ma è anche un lavoro che mi ha visto occupato per diversi giorni nel tentativo di risolvere i vari problemi di inconsistenza delle API di Technorati, come dimostra il ticket #ZF-2334. (more…)

+]]>
+ http://www.zend-framework.it/2008/02/03/zend_service_technorati-promosso-in-core/feed/ +
+ + Proposta per la struttura predefinita di un nuovo progetto Zend Framework + http://www.zend-framework.it/2008/02/02/proposta-per-la-struttura-predefinita-di-un-nuovo-progetto-zend-framework/ + http://www.zend-framework.it/2008/02/02/proposta-per-la-struttura-predefinita-di-un-nuovo-progetto-zend-framework/#comments + Sat, 02 Feb 2008 14:21:15 +0000 + weppos + + + http://www.zend-framework.it/2008/02/02/proposta-per-la-struttura-predefinita-di-un-nuovo-progetto-zend-framework/ + + + http://www.zend-framework.it/2008/02/02/proposta-per-la-struttura-predefinita-di-un-nuovo-progetto-zend-framework/feed/ + + + Installare Zend Framework via PEAR + http://www.zend-framework.it/2008/01/29/installare-zend-framework-via-pear/ + http://www.zend-framework.it/2008/01/29/installare-zend-framework-via-pear/#comments + Tue, 29 Jan 2008 08:42:37 +0000 + weppos + + + + http://www.zend-framework.it/2008/01/29/installare-zend-framework-via-pear/ + + Introduzione a PEAR +

Chiunque programmi in PHP avrà sentito parlare, prima o poi, di PEAR.
+PEAR è un enorme repository di librerie PHP. Vi si trovano applicazioni complete, librerie complete ma, ahimè, anche molti componenti abbandonati sul nascere.

+

PEAR offre un eccellente sistema di packaging che consente di installare facilmente una libreria parte del repository ufficiale o una qualsiasi libreria su un altro repository che sia compatibile con gli standard definiti.
+Per chi programma in altri linguaggi, questo sistema è molto simile al concetto di GEM in Ruby o ai moduli di PERL. (more…)

+]]>
+ http://www.zend-framework.it/2008/01/29/installare-zend-framework-via-pear/feed/ +
+
+
diff --git a/test/bootstrap.php b/test/bootstrap.php new file mode 100644 index 00000000..e055f5c6 --- /dev/null +++ b/test/bootstrap.php @@ -0,0 +1,34 @@ + Date: Wed, 6 May 2009 14:18:30 +0000 Subject: [PATCH 002/238] Zend_Feed: fixed rss1.0/RDF feed parsing problem. Closes [ZF-405]. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@15360 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Rss.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Rss.php b/src/Rss.php index 69dc1908..ed60ea28 100644 --- a/src/Rss.php +++ b/src/Rss.php @@ -80,9 +80,10 @@ public function __wakeup() parent::__wakeup(); // Find the base channel element and create an alias to it. - if ($this->_element->firstChild->nodeName == 'rdf:RDF') { - $this->_element = $this->_element->firstChild; - } else { + $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) { From 964823a2f69a5d4a42ab80d7dc89767d38f5e75b Mon Sep 17 00:00:00 2001 From: alexander Date: Thu, 7 May 2009 13:26:32 +0000 Subject: [PATCH 003/238] Zend_Feed: fix for 'importArray() - no support for item author element'. Closes [ZF-5611]. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@15381 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Builder.php | 3 +++ src/Builder/Entry.php | 12 ++++++++++++ src/Rss.php | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/src/Builder.php b/src/Builder.php index 8e305454..af166768 100644 --- a/src/Builder.php +++ b/src/Builder.php @@ -354,6 +354,9 @@ private function _createEntries(array $data) } } $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']); } diff --git a/src/Builder/Entry.php b/src/Builder/Entry.php index 32a4acb9..57718267 100644 --- a/src/Builder/Entry.php +++ b/src/Builder/Entry.php @@ -101,6 +101,18 @@ public function __unset($key) } } + /** + * 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 * diff --git a/src/Rss.php b/src/Rss.php index ed60ea28..5078d26e 100644 --- a/src/Rss.php +++ b/src/Rss.php @@ -401,6 +401,11 @@ protected function _mapFeedEntries(DOMElement $root, $array) $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); From 1603fe1c0ea82dff3018332447d5116aad640f1a Mon Sep 17 00:00:00 2001 From: thomas Date: Sun, 21 Jun 2009 19:08:45 +0000 Subject: [PATCH 004/238] [ZF-6295] Generic: - fixed license date (partitial) git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16205 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Abstract.php | 4 ++-- src/Atom.php | 4 ++-- src/Builder.php | 4 ++-- src/Builder/Entry.php | 4 ++-- src/Builder/Exception.php | 4 ++-- src/Builder/Header.php | 4 ++-- src/Builder/Header/Itunes.php | 4 ++-- src/Builder/Interface.php | 4 ++-- src/Element.php | 4 ++-- src/Entry/Abstract.php | 4 ++-- src/Entry/Atom.php | 4 ++-- src/Entry/Rss.php | 4 ++-- src/Exception.php | 4 ++-- src/Rss.php | 4 ++-- 14 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/Abstract.php b/src/Abstract.php index 1f7768cd..11e4fadf 100644 --- a/src/Abstract.php +++ b/src/Abstract.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -37,7 +37,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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 diff --git a/src/Atom.php b/src/Atom.php index b02d0398..a083bf2e 100644 --- a/src/Atom.php +++ b/src/Atom.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -44,7 +44,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Atom extends Zend_Feed_Abstract diff --git a/src/Builder.php b/src/Builder.php index af166768..5139d59e 100644 --- a/src/Builder.php +++ b/src/Builder.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -44,7 +44,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Builder implements Zend_Feed_Builder_Interface diff --git a/src/Builder/Entry.php b/src/Builder/Entry.php index 57718267..0a218d14 100644 --- a/src/Builder/Entry.php +++ b/src/Builder/Entry.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -29,7 +29,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Builder_Entry extends ArrayObject diff --git a/src/Builder/Exception.php b/src/Builder/Exception.php index 9f43b67f..c5fedeb1 100644 --- a/src/Builder/Exception.php +++ b/src/Builder/Exception.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -32,7 +32,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Builder_Exception extends Zend_Feed_Exception diff --git a/src/Builder/Header.php b/src/Builder/Header.php index 06f06a8b..f6b45c4d 100644 --- a/src/Builder/Header.php +++ b/src/Builder/Header.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -39,7 +39,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Builder_Header extends ArrayObject diff --git a/src/Builder/Header/Itunes.php b/src/Builder/Header/Itunes.php index ca193490..52c91771 100644 --- a/src/Builder/Header/Itunes.php +++ b/src/Builder/Header/Itunes.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -28,7 +28,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Builder_Header_Itunes extends ArrayObject diff --git a/src/Builder/Interface.php b/src/Builder/Interface.php index 26a41fc9..f03f0f23 100644 --- a/src/Builder/Interface.php +++ b/src/Builder/Interface.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -29,7 +29,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Feed_Builder_Interface diff --git a/src/Element.php b/src/Element.php index c6716b06..9ea45dc2 100644 --- a/src/Element.php +++ b/src/Element.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -26,7 +26,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Element implements ArrayAccess diff --git a/src/Entry/Abstract.php b/src/Entry/Abstract.php index 11633147..d6573bc1 100644 --- a/src/Entry/Abstract.php +++ b/src/Entry/Abstract.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -38,7 +38,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Entry_Abstract extends Zend_Feed_Element diff --git a/src/Entry/Atom.php b/src/Entry/Atom.php index 31e37a07..414e6e17 100644 --- a/src/Entry/Atom.php +++ b/src/Entry/Atom.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -32,7 +32,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Entry_Atom extends Zend_Feed_Entry_Abstract diff --git a/src/Entry/Rss.php b/src/Entry/Rss.php index b2d72501..96c66df4 100644 --- a/src/Entry/Rss.php +++ b/src/Entry/Rss.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -32,7 +32,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Entry_Rss extends Zend_Feed_Entry_Abstract diff --git a/src/Exception.php b/src/Exception.php index 45a554ea..ec8ca949 100644 --- a/src/Exception.php +++ b/src/Exception.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -34,7 +34,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Exception extends Zend_Exception diff --git a/src/Rss.php b/src/Rss.php index 5078d26e..c825cb58 100644 --- a/src/Rss.php +++ b/src/Rss.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -43,7 +43,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Rss extends Zend_Feed_Abstract From bb233bbe421697e6867f61dd84d9f962ae91ac17 Mon Sep 17 00:00:00 2001 From: thomas Date: Sun, 21 Jun 2009 20:34:55 +0000 Subject: [PATCH 005/238] [ZF-6295] Generic: - fixed license date (partitial) THE LAST COMMIT... HONESTLY :-) git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16225 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/AllTests.php | 4 ++-- test/ArrayAccessTest.php | 4 ++-- test/AtomEntryOnlyTest.php | 4 ++-- test/AtomPublishingTest.php | 4 ++-- test/CountTest.php | 4 ++-- test/ElementTest.php | 4 ++-- test/Entry/RssTest.php | 4 ++-- test/ImportTest.php | 4 ++-- test/IteratorTest.php | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/test/AllTests.php b/test/AllTests.php index 0d61b140..0bede6d9 100644 --- a/test/AllTests.php +++ b/test/AllTests.php @@ -16,7 +16,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -51,7 +51,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_AllTests diff --git a/test/ArrayAccessTest.php b/test/ArrayAccessTest.php index 05e02927..95fed006 100644 --- a/test/ArrayAccessTest.php +++ b/test/ArrayAccessTest.php @@ -16,7 +16,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -38,7 +38,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_ArrayAccessTest extends PHPUnit_Framework_TestCase diff --git a/test/AtomEntryOnlyTest.php b/test/AtomEntryOnlyTest.php index 90096453..9e54e517 100644 --- a/test/AtomEntryOnlyTest.php +++ b/test/AtomEntryOnlyTest.php @@ -16,7 +16,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -42,7 +42,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_AtomEntryOnlyTest extends PHPUnit_Framework_TestCase diff --git a/test/AtomPublishingTest.php b/test/AtomPublishingTest.php index 6738736c..bac17380 100644 --- a/test/AtomPublishingTest.php +++ b/test/AtomPublishingTest.php @@ -16,7 +16,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -42,7 +42,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_AtomPublishingTest extends PHPUnit_Framework_TestCase diff --git a/test/CountTest.php b/test/CountTest.php index 79a7bd9a..3d8a1acb 100644 --- a/test/CountTest.php +++ b/test/CountTest.php @@ -16,7 +16,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -37,7 +37,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_CountTest extends PHPUnit_Framework_TestCase diff --git a/test/ElementTest.php b/test/ElementTest.php index 381d6455..021a7a42 100644 --- a/test/ElementTest.php +++ b/test/ElementTest.php @@ -16,7 +16,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -37,7 +37,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_ElementTest extends PHPUnit_Framework_TestCase diff --git a/test/Entry/RssTest.php b/test/Entry/RssTest.php index 70ef87fb..a78fd1c0 100644 --- a/test/Entry/RssTest.php +++ b/test/Entry/RssTest.php @@ -16,7 +16,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -37,7 +37,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Entry_RssTest extends PHPUnit_Framework_TestCase diff --git a/test/ImportTest.php b/test/ImportTest.php index 75b09cd0..91244523 100644 --- a/test/ImportTest.php +++ b/test/ImportTest.php @@ -16,7 +16,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -52,7 +52,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_ImportTest extends PHPUnit_Framework_TestCase diff --git a/test/IteratorTest.php b/test/IteratorTest.php index db4b325c..b2f2e5b1 100644 --- a/test/IteratorTest.php +++ b/test/IteratorTest.php @@ -16,7 +16,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -37,7 +37,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_IteratorTest extends PHPUnit_Framework_TestCase From 1f43fb18153693bb645ad291d1885ad64ecbe045 Mon Sep 17 00:00:00 2001 From: matthew Date: Tue, 14 Jul 2009 18:11:26 +0000 Subject: [PATCH 006/238] [REVIEW] Promoted Zend_Feed_Reader to trunk git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16718 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader.php | 690 +++++ src/Reader/Entry/Abstract.php | 215 ++ src/Reader/Entry/Atom.php | 355 +++ src/Reader/Entry/Interface.php | 139 + src/Reader/Entry/Rss.php | 625 ++++ src/Reader/Extension/Atom/Entry.php | 479 +++ src/Reader/Extension/Atom/Feed.php | 441 +++ src/Reader/Extension/Content/Entry.php | 64 + .../Extension/CreativeCommons/Entry.php | 97 + src/Reader/Extension/CreativeCommons/Feed.php | 89 + src/Reader/Extension/DublinCore/Entry.php | 232 ++ src/Reader/Extension/DublinCore/Feed.php | 265 ++ src/Reader/Extension/EntryAbstract.php | 197 ++ src/Reader/Extension/FeedAbstract.php | 166 ++ src/Reader/Extension/Slash/Entry.php | 144 + src/Reader/Extension/Syndication/Feed.php | 168 ++ src/Reader/Extension/Thread/Entry.php | 91 + src/Reader/Extension/WellFormedWeb/Entry.php | 73 + src/Reader/Feed/Abstract.php | 260 ++ src/Reader/Feed/Atom.php | 337 +++ src/Reader/Feed/Interface.php | 115 + src/Reader/Feed/Rss.php | 544 ++++ test/AllTests.php | 29 + test/Reader/Entry/AtomTest.php | 226 ++ test/Reader/Entry/RssTest.php | 2563 +++++++++++++++++ .../Entry/_files/Atom/author/plain/atom03.xml | 45 + .../Entry/_files/Atom/author/plain/atom10.xml | 45 + .../_files/Atom/content/plain/atom03.xml | 6 + .../_files/Atom/content/plain/atom10.xml | 6 + .../_files/Atom/datecreated/plain/atom03.xml | 6 + .../_files/Atom/datecreated/plain/atom10.xml | 6 + .../_files/Atom/datemodified/plain/atom03.xml | 6 + .../_files/Atom/datemodified/plain/atom10.xml | 6 + .../_files/Atom/description/plain/atom03.xml | 6 + .../_files/Atom/description/plain/atom10.xml | 6 + .../Entry/_files/Atom/id/plain/atom03.xml | 6 + .../Entry/_files/Atom/id/plain/atom10.xml | 6 + .../Entry/_files/Atom/link/plain/atom03.xml | 6 + .../Entry/_files/Atom/link/plain/atom10.xml | 6 + .../Entry/_files/Atom/links/plain/atom03.xml | 7 + .../Entry/_files/Atom/links/plain/atom10.xml | 7 + .../Entry/_files/Atom/title/plain/atom03.xml | 6 + .../Entry/_files/Atom/title/plain/atom10.xml | 6 + .../_files/Rss/author/plain/dc10/rss090.xml | 12 + .../_files/Rss/author/plain/dc10/rss091.xml | 10 + .../_files/Rss/author/plain/dc10/rss092.xml | 10 + .../_files/Rss/author/plain/dc10/rss093.xml | 10 + .../_files/Rss/author/plain/dc10/rss094.xml | 10 + .../_files/Rss/author/plain/dc10/rss10.xml | 12 + .../_files/Rss/author/plain/dc10/rss20.xml | 10 + .../_files/Rss/author/plain/dc11/rss090.xml | 12 + .../_files/Rss/author/plain/dc11/rss091.xml | 10 + .../_files/Rss/author/plain/dc11/rss092.xml | 10 + .../_files/Rss/author/plain/dc11/rss093.xml | 10 + .../_files/Rss/author/plain/dc11/rss094.xml | 10 + .../_files/Rss/author/plain/dc11/rss10.xml | 12 + .../_files/Rss/author/plain/dc11/rss20.xml | 10 + .../_files/Rss/author/plain/none/rss090.xml | 9 + .../_files/Rss/author/plain/none/rss091.xml | 7 + .../_files/Rss/author/plain/none/rss092.xml | 7 + .../_files/Rss/author/plain/none/rss093.xml | 7 + .../_files/Rss/author/plain/none/rss094.xml | 7 + .../_files/Rss/author/plain/none/rss10.xml | 9 + .../_files/Rss/author/plain/none/rss20.xml | 7 + .../Entry/_files/Rss/author/plain/rss090.xml | 9 + .../Entry/_files/Rss/author/plain/rss091.xml | 7 + .../Entry/_files/Rss/author/plain/rss092.xml | 7 + .../Entry/_files/Rss/author/plain/rss093.xml | 7 + .../Entry/_files/Rss/author/plain/rss094.xml | 7 + .../Entry/_files/Rss/author/plain/rss10.xml | 9 + .../Entry/_files/Rss/author/plain/rss20.xml | 9 + .../Rss/commentcount/plain/atom10/rss090.xml | 12 + .../Rss/commentcount/plain/atom10/rss091.xml | 10 + .../Rss/commentcount/plain/atom10/rss092.xml | 10 + .../Rss/commentcount/plain/atom10/rss093.xml | 10 + .../Rss/commentcount/plain/atom10/rss094.xml | 10 + .../Rss/commentcount/plain/atom10/rss10.xml | 12 + .../Rss/commentcount/plain/atom10/rss20.xml | 10 + .../Rss/commentcount/plain/none/rss090.xml | 9 + .../Rss/commentcount/plain/none/rss091.xml | 7 + .../Rss/commentcount/plain/none/rss092.xml | 7 + .../Rss/commentcount/plain/none/rss093.xml | 7 + .../Rss/commentcount/plain/none/rss094.xml | 7 + .../Rss/commentcount/plain/none/rss10.xml | 9 + .../Rss/commentcount/plain/none/rss20.xml | 7 + .../Rss/commentcount/plain/slash10/rss090.xml | 11 + .../Rss/commentcount/plain/slash10/rss091.xml | 9 + .../Rss/commentcount/plain/slash10/rss092.xml | 9 + .../Rss/commentcount/plain/slash10/rss093.xml | 9 + .../Rss/commentcount/plain/slash10/rss094.xml | 9 + .../Rss/commentcount/plain/slash10/rss10.xml | 11 + .../Rss/commentcount/plain/slash10/rss20.xml | 9 + .../commentcount/plain/thread10/rss090.xml | 11 + .../commentcount/plain/thread10/rss091.xml | 9 + .../commentcount/plain/thread10/rss092.xml | 9 + .../commentcount/plain/thread10/rss093.xml | 9 + .../commentcount/plain/thread10/rss094.xml | 9 + .../Rss/commentcount/plain/thread10/rss10.xml | 11 + .../Rss/commentcount/plain/thread10/rss20.xml | 9 + .../commentfeedlink/plain/atom10/rss090.xml | 11 + .../commentfeedlink/plain/atom10/rss091.xml | 9 + .../commentfeedlink/plain/atom10/rss092.xml | 9 + .../commentfeedlink/plain/atom10/rss093.xml | 9 + .../commentfeedlink/plain/atom10/rss094.xml | 9 + .../commentfeedlink/plain/atom10/rss10.xml | 11 + .../commentfeedlink/plain/atom10/rss20.xml | 9 + .../Rss/commentfeedlink/plain/none/rss090.xml | 9 + .../Rss/commentfeedlink/plain/none/rss091.xml | 7 + .../Rss/commentfeedlink/plain/none/rss092.xml | 7 + .../Rss/commentfeedlink/plain/none/rss093.xml | 7 + .../Rss/commentfeedlink/plain/none/rss094.xml | 7 + .../Rss/commentfeedlink/plain/none/rss10.xml | 9 + .../Rss/commentfeedlink/plain/none/rss20.xml | 7 + .../commentfeedlink/plain/thread10/rss090.xml | 11 + .../commentfeedlink/plain/thread10/rss091.xml | 9 + .../commentfeedlink/plain/thread10/rss092.xml | 9 + .../commentfeedlink/plain/thread10/rss093.xml | 9 + .../commentfeedlink/plain/thread10/rss094.xml | 9 + .../commentfeedlink/plain/thread10/rss10.xml | 11 + .../commentfeedlink/plain/thread10/rss20.xml | 9 + .../plain/wellformedweb/rss090.xml | 11 + .../plain/wellformedweb/rss091.xml | 9 + .../plain/wellformedweb/rss092.xml | 9 + .../plain/wellformedweb/rss093.xml | 9 + .../plain/wellformedweb/rss094.xml | 9 + .../plain/wellformedweb/rss10.xml | 11 + .../plain/wellformedweb/rss20.xml | 9 + .../Rss/commentlink/plain/atom10/rss090.xml | 11 + .../Rss/commentlink/plain/atom10/rss091.xml | 9 + .../Rss/commentlink/plain/atom10/rss092.xml | 9 + .../Rss/commentlink/plain/atom10/rss093.xml | 9 + .../Rss/commentlink/plain/atom10/rss094.xml | 9 + .../Rss/commentlink/plain/atom10/rss10.xml | 11 + .../Rss/commentlink/plain/atom10/rss20.xml | 9 + .../Rss/commentlink/plain/none/rss090.xml | 9 + .../Rss/commentlink/plain/none/rss091.xml | 7 + .../Rss/commentlink/plain/none/rss092.xml | 7 + .../Rss/commentlink/plain/none/rss093.xml | 7 + .../Rss/commentlink/plain/none/rss094.xml | 7 + .../Rss/commentlink/plain/none/rss10.xml | 9 + .../Rss/commentlink/plain/none/rss20.xml | 7 + .../_files/Rss/commentlink/plain/rss091.xml | 8 + .../_files/Rss/commentlink/plain/rss092.xml | 8 + .../_files/Rss/commentlink/plain/rss093.xml | 8 + .../_files/Rss/commentlink/plain/rss094.xml | 8 + .../_files/Rss/commentlink/plain/rss20.xml | 8 + .../Rss/content/plain/description/rss090.xml | 11 + .../Rss/content/plain/description/rss091.xml | 9 + .../Rss/content/plain/description/rss092.xml | 9 + .../Rss/content/plain/description/rss093.xml | 9 + .../Rss/content/plain/description/rss094.xml | 9 + .../Rss/content/plain/description/rss10.xml | 11 + .../Rss/content/plain/description/rss20.xml | 9 + .../_files/Rss/content/plain/none/rss090.xml | 9 + .../_files/Rss/content/plain/none/rss091.xml | 7 + .../_files/Rss/content/plain/none/rss092.xml | 7 + .../_files/Rss/content/plain/none/rss093.xml | 7 + .../_files/Rss/content/plain/none/rss094.xml | 7 + .../_files/Rss/content/plain/none/rss10.xml | 9 + .../_files/Rss/content/plain/none/rss20.xml | 7 + .../Entry/_files/Rss/content/plain/rss090.xml | 11 + .../Entry/_files/Rss/content/plain/rss091.xml | 9 + .../Entry/_files/Rss/content/plain/rss092.xml | 9 + .../Entry/_files/Rss/content/plain/rss093.xml | 9 + .../Entry/_files/Rss/content/plain/rss094.xml | 9 + .../Entry/_files/Rss/content/plain/rss10.xml | 11 + .../Entry/_files/Rss/content/plain/rss20.xml | 9 + .../Rss/datemodified/plain/atom10/rss090.xml | 11 + .../Rss/datemodified/plain/atom10/rss091.xml | 9 + .../Rss/datemodified/plain/atom10/rss092.xml | 9 + .../Rss/datemodified/plain/atom10/rss093.xml | 9 + .../Rss/datemodified/plain/atom10/rss094.xml | 9 + .../Rss/datemodified/plain/atom10/rss10.xml | 11 + .../Rss/datemodified/plain/atom10/rss20.xml | 9 + .../Rss/datemodified/plain/dc10/rss090.xml | 11 + .../Rss/datemodified/plain/dc10/rss091.xml | 9 + .../Rss/datemodified/plain/dc10/rss092.xml | 9 + .../Rss/datemodified/plain/dc10/rss093.xml | 9 + .../Rss/datemodified/plain/dc10/rss094.xml | 9 + .../Rss/datemodified/plain/dc10/rss10.xml | 11 + .../Rss/datemodified/plain/dc10/rss20.xml | 9 + .../Rss/datemodified/plain/dc11/rss090.xml | 11 + .../Rss/datemodified/plain/dc11/rss091.xml | 9 + .../Rss/datemodified/plain/dc11/rss092.xml | 9 + .../Rss/datemodified/plain/dc11/rss093.xml | 9 + .../Rss/datemodified/plain/dc11/rss094.xml | 9 + .../Rss/datemodified/plain/dc11/rss10.xml | 11 + .../Rss/datemodified/plain/dc11/rss20.xml | 9 + .../Rss/datemodified/plain/none/rss090.xml | 9 + .../Rss/datemodified/plain/none/rss091.xml | 7 + .../Rss/datemodified/plain/none/rss092.xml | 7 + .../Rss/datemodified/plain/none/rss093.xml | 7 + .../Rss/datemodified/plain/none/rss094.xml | 7 + .../Rss/datemodified/plain/none/rss10.xml | 9 + .../Rss/datemodified/plain/none/rss20.xml | 7 + .../_files/Rss/datemodified/plain/rss20.xml | 8 + .../Rss/description/plain/dc10/rss090.xml | 11 + .../Rss/description/plain/dc10/rss091.xml | 9 + .../Rss/description/plain/dc10/rss092.xml | 9 + .../Rss/description/plain/dc10/rss093.xml | 9 + .../Rss/description/plain/dc10/rss094.xml | 9 + .../Rss/description/plain/dc10/rss10.xml | 11 + .../Rss/description/plain/dc10/rss20.xml | 9 + .../Rss/description/plain/dc11/rss090.xml | 11 + .../Rss/description/plain/dc11/rss091.xml | 9 + .../Rss/description/plain/dc11/rss092.xml | 9 + .../Rss/description/plain/dc11/rss093.xml | 9 + .../Rss/description/plain/dc11/rss094.xml | 9 + .../Rss/description/plain/dc11/rss10.xml | 11 + .../Rss/description/plain/dc11/rss20.xml | 9 + .../Rss/description/plain/none/rss090.xml | 9 + .../Rss/description/plain/none/rss091.xml | 7 + .../Rss/description/plain/none/rss092.xml | 7 + .../Rss/description/plain/none/rss093.xml | 7 + .../Rss/description/plain/none/rss094.xml | 7 + .../Rss/description/plain/none/rss10.xml | 9 + .../Rss/description/plain/none/rss20.xml | 7 + .../_files/Rss/description/plain/rss090.xml | 10 + .../_files/Rss/description/plain/rss091.xml | 8 + .../_files/Rss/description/plain/rss092.xml | 8 + .../_files/Rss/description/plain/rss093.xml | 8 + .../_files/Rss/description/plain/rss094.xml | 8 + .../_files/Rss/description/plain/rss10.xml | 10 + .../_files/Rss/description/plain/rss20.xml | 8 + .../Entry/_files/Rss/id/plain/dc10/rss090.xml | 11 + .../Entry/_files/Rss/id/plain/dc10/rss091.xml | 9 + .../Entry/_files/Rss/id/plain/dc10/rss092.xml | 9 + .../Entry/_files/Rss/id/plain/dc10/rss093.xml | 9 + .../Entry/_files/Rss/id/plain/dc10/rss094.xml | 9 + .../Entry/_files/Rss/id/plain/dc10/rss10.xml | 11 + .../Entry/_files/Rss/id/plain/dc10/rss20.xml | 9 + .../Entry/_files/Rss/id/plain/dc11/rss090.xml | 11 + .../Entry/_files/Rss/id/plain/dc11/rss091.xml | 9 + .../Entry/_files/Rss/id/plain/dc11/rss092.xml | 9 + .../Entry/_files/Rss/id/plain/dc11/rss093.xml | 9 + .../Entry/_files/Rss/id/plain/dc11/rss094.xml | 9 + .../Entry/_files/Rss/id/plain/dc11/rss10.xml | 11 + .../Entry/_files/Rss/id/plain/dc11/rss20.xml | 9 + .../Entry/_files/Rss/id/plain/none/rss090.xml | 9 + .../Entry/_files/Rss/id/plain/none/rss091.xml | 7 + .../Entry/_files/Rss/id/plain/none/rss092.xml | 7 + .../Entry/_files/Rss/id/plain/none/rss093.xml | 7 + .../Entry/_files/Rss/id/plain/none/rss094.xml | 7 + .../Entry/_files/Rss/id/plain/none/rss10.xml | 9 + .../Entry/_files/Rss/id/plain/none/rss20.xml | 7 + .../Entry/_files/Rss/id/plain/rss090.xml | 9 + .../Entry/_files/Rss/id/plain/rss091.xml | 7 + .../Entry/_files/Rss/id/plain/rss092.xml | 7 + .../Entry/_files/Rss/id/plain/rss093.xml | 7 + .../Entry/_files/Rss/id/plain/rss094.xml | 7 + .../Entry/_files/Rss/id/plain/rss10.xml | 9 + .../Entry/_files/Rss/id/plain/rss20.xml | 8 + .../_files/Rss/id/plain/title/rss090.xml | 11 + .../_files/Rss/id/plain/title/rss091.xml | 9 + .../_files/Rss/id/plain/title/rss092.xml | 9 + .../_files/Rss/id/plain/title/rss093.xml | 9 + .../_files/Rss/id/plain/title/rss094.xml | 9 + .../Entry/_files/Rss/id/plain/title/rss10.xml | 11 + .../Entry/_files/Rss/id/plain/title/rss20.xml | 9 + .../_files/Rss/link/plain/none/rss090.xml | 9 + .../_files/Rss/link/plain/none/rss091.xml | 7 + .../_files/Rss/link/plain/none/rss092.xml | 7 + .../_files/Rss/link/plain/none/rss093.xml | 7 + .../_files/Rss/link/plain/none/rss094.xml | 7 + .../_files/Rss/link/plain/none/rss10.xml | 9 + .../_files/Rss/link/plain/none/rss20.xml | 7 + .../Entry/_files/Rss/link/plain/rss090.xml | 10 + .../Entry/_files/Rss/link/plain/rss091.xml | 8 + .../Entry/_files/Rss/link/plain/rss092.xml | 8 + .../Entry/_files/Rss/link/plain/rss093.xml | 8 + .../Entry/_files/Rss/link/plain/rss094.xml | 8 + .../Entry/_files/Rss/link/plain/rss10.xml | 10 + .../Entry/_files/Rss/link/plain/rss20.xml | 8 + .../_files/Rss/links/plain/none/rss090.xml | 9 + .../_files/Rss/links/plain/none/rss091.xml | 7 + .../_files/Rss/links/plain/none/rss092.xml | 7 + .../_files/Rss/links/plain/none/rss093.xml | 7 + .../_files/Rss/links/plain/none/rss094.xml | 7 + .../_files/Rss/links/plain/none/rss10.xml | 9 + .../_files/Rss/links/plain/none/rss20.xml | 7 + .../Entry/_files/Rss/links/plain/rss090.xml | 11 + .../Entry/_files/Rss/links/plain/rss091.xml | 9 + .../Entry/_files/Rss/links/plain/rss092.xml | 9 + .../Entry/_files/Rss/links/plain/rss093.xml | 9 + .../Entry/_files/Rss/links/plain/rss094.xml | 9 + .../Entry/_files/Rss/links/plain/rss10.xml | 11 + .../Entry/_files/Rss/links/plain/rss20.xml | 9 + .../_files/Rss/title/plain/dc10/rss090.xml | 11 + .../_files/Rss/title/plain/dc10/rss091.xml | 9 + .../_files/Rss/title/plain/dc10/rss092.xml | 9 + .../_files/Rss/title/plain/dc10/rss093.xml | 9 + .../_files/Rss/title/plain/dc10/rss094.xml | 9 + .../_files/Rss/title/plain/dc10/rss10.xml | 11 + .../_files/Rss/title/plain/dc10/rss20.xml | 9 + .../_files/Rss/title/plain/dc11/rss090.xml | 11 + .../_files/Rss/title/plain/dc11/rss091.xml | 9 + .../_files/Rss/title/plain/dc11/rss092.xml | 9 + .../_files/Rss/title/plain/dc11/rss093.xml | 9 + .../_files/Rss/title/plain/dc11/rss094.xml | 9 + .../_files/Rss/title/plain/dc11/rss10.xml | 11 + .../_files/Rss/title/plain/dc11/rss20.xml | 9 + .../_files/Rss/title/plain/none/rss090.xml | 9 + .../_files/Rss/title/plain/none/rss091.xml | 7 + .../_files/Rss/title/plain/none/rss092.xml | 7 + .../_files/Rss/title/plain/none/rss093.xml | 7 + .../_files/Rss/title/plain/none/rss094.xml | 7 + .../_files/Rss/title/plain/none/rss10.xml | 9 + .../_files/Rss/title/plain/none/rss20.xml | 7 + .../Entry/_files/Rss/title/plain/rss090.xml | 10 + .../Entry/_files/Rss/title/plain/rss091.xml | 8 + .../Entry/_files/Rss/title/plain/rss092.xml | 8 + .../Entry/_files/Rss/title/plain/rss093.xml | 8 + .../Entry/_files/Rss/title/plain/rss094.xml | 8 + .../Entry/_files/Rss/title/plain/rss10.xml | 10 + .../Entry/_files/Rss/title/plain/rss20.xml | 8 + test/Reader/Feed/AtomTest.php | 283 ++ test/Reader/Feed/RssTest.php | 2169 ++++++++++++++ .../Feed/_files/Atom/author/plain/atom03.xml | 45 + .../Feed/_files/Atom/author/plain/atom10.xml | 45 + .../_files/Atom/copyright/plain/atom03.xml | 4 + .../_files/Atom/copyright/plain/atom10.xml | 4 + .../_files/Atom/datecreated/plain/atom03.xml | 4 + .../_files/Atom/datecreated/plain/atom10.xml | 4 + .../_files/Atom/datemodified/plain/atom03.xml | 4 + .../_files/Atom/datemodified/plain/atom10.xml | 4 + .../_files/Atom/description/plain/atom03.xml | 4 + .../_files/Atom/description/plain/atom10.xml | 4 + .../_files/Atom/feedlink/plain/atom03.xml | 4 + .../_files/Atom/feedlink/plain/atom10.xml | 4 + .../_files/Atom/generator/plain/atom03.xml | 4 + .../_files/Atom/generator/plain/atom10.xml | 4 + .../Feed/_files/Atom/id/plain/atom03.xml | 4 + .../Feed/_files/Atom/id/plain/atom10.xml | 4 + .../_files/Atom/language/plain/atom03.xml | 4 + .../_files/Atom/language/plain/atom10.xml | 4 + .../Feed/_files/Atom/link/plain/atom03.xml | 4 + .../Feed/_files/Atom/link/plain/atom10.xml | 4 + .../Feed/_files/Atom/title/plain/atom03.xml | 4 + .../Feed/_files/Atom/title/plain/atom10.xml | 4 + .../_files/Rss/author/plain/atom10/rss090.xml | 16 + .../_files/Rss/author/plain/atom10/rss091.xml | 14 + .../_files/Rss/author/plain/atom10/rss092.xml | 14 + .../_files/Rss/author/plain/atom10/rss093.xml | 14 + .../_files/Rss/author/plain/atom10/rss094.xml | 14 + .../_files/Rss/author/plain/atom10/rss10.xml | 16 + .../_files/Rss/author/plain/atom10/rss20.xml | 14 + .../_files/Rss/author/plain/dc10/rss090.xml | 12 + .../_files/Rss/author/plain/dc10/rss091.xml | 10 + .../_files/Rss/author/plain/dc10/rss092.xml | 10 + .../_files/Rss/author/plain/dc10/rss093.xml | 10 + .../_files/Rss/author/plain/dc10/rss094.xml | 10 + .../_files/Rss/author/plain/dc10/rss10.xml | 12 + .../_files/Rss/author/plain/dc10/rss20.xml | 10 + .../_files/Rss/author/plain/dc11/rss090.xml | 12 + .../_files/Rss/author/plain/dc11/rss091.xml | 10 + .../_files/Rss/author/plain/dc11/rss092.xml | 10 + .../_files/Rss/author/plain/dc11/rss093.xml | 10 + .../_files/Rss/author/plain/dc11/rss094.xml | 10 + .../_files/Rss/author/plain/dc11/rss10.xml | 12 + .../_files/Rss/author/plain/dc11/rss20.xml | 10 + .../_files/Rss/author/plain/none/rss090.xml | 9 + .../_files/Rss/author/plain/none/rss091.xml | 7 + .../_files/Rss/author/plain/none/rss092.xml | 7 + .../_files/Rss/author/plain/none/rss093.xml | 7 + .../_files/Rss/author/plain/none/rss094.xml | 7 + .../_files/Rss/author/plain/none/rss10.xml | 9 + .../_files/Rss/author/plain/none/rss20.xml | 7 + .../Feed/_files/Rss/author/plain/rss090.xml | 11 + .../Feed/_files/Rss/author/plain/rss091.xml | 9 + .../Feed/_files/Rss/author/plain/rss092.xml | 9 + .../Feed/_files/Rss/author/plain/rss093.xml | 9 + .../Feed/_files/Rss/author/plain/rss094.xml | 9 + .../Feed/_files/Rss/author/plain/rss10.xml | 11 + .../Feed/_files/Rss/author/plain/rss20.xml | 9 + .../Rss/copyright/plain/dc10/rss090.xml | 9 + .../Rss/copyright/plain/dc10/rss091.xml | 7 + .../Rss/copyright/plain/dc10/rss092.xml | 7 + .../Rss/copyright/plain/dc10/rss093.xml | 7 + .../Rss/copyright/plain/dc10/rss094.xml | 7 + .../_files/Rss/copyright/plain/dc10/rss10.xml | 9 + .../_files/Rss/copyright/plain/dc10/rss20.xml | 7 + .../Rss/copyright/plain/dc11/rss090.xml | 9 + .../Rss/copyright/plain/dc11/rss091.xml | 7 + .../Rss/copyright/plain/dc11/rss092.xml | 7 + .../Rss/copyright/plain/dc11/rss093.xml | 7 + .../Rss/copyright/plain/dc11/rss094.xml | 7 + .../_files/Rss/copyright/plain/dc11/rss10.xml | 9 + .../_files/Rss/copyright/plain/dc11/rss20.xml | 7 + .../Rss/copyright/plain/none/rss090.xml | 7 + .../Rss/copyright/plain/none/rss091.xml | 5 + .../Rss/copyright/plain/none/rss092.xml | 5 + .../Rss/copyright/plain/none/rss093.xml | 5 + .../Rss/copyright/plain/none/rss094.xml | 5 + .../_files/Rss/copyright/plain/none/rss10.xml | 7 + .../_files/Rss/copyright/plain/none/rss20.xml | 5 + .../_files/Rss/copyright/plain/rss090.xml | 7 + .../_files/Rss/copyright/plain/rss091.xml | 6 + .../_files/Rss/copyright/plain/rss092.xml | 6 + .../_files/Rss/copyright/plain/rss093.xml | 6 + .../_files/Rss/copyright/plain/rss094.xml | 6 + .../Feed/_files/Rss/copyright/plain/rss10.xml | 7 + .../Feed/_files/Rss/copyright/plain/rss20.xml | 6 + .../Rss/datemodified/plain/atom10/rss090.xml | 9 + .../Rss/datemodified/plain/atom10/rss091.xml | 7 + .../Rss/datemodified/plain/atom10/rss092.xml | 7 + .../Rss/datemodified/plain/atom10/rss093.xml | 7 + .../Rss/datemodified/plain/atom10/rss094.xml | 7 + .../Rss/datemodified/plain/atom10/rss10.xml | 9 + .../Rss/datemodified/plain/atom10/rss20.xml | 7 + .../Rss/datemodified/plain/dc10/rss090.xml | 9 + .../Rss/datemodified/plain/dc10/rss091.xml | 7 + .../Rss/datemodified/plain/dc10/rss092.xml | 7 + .../Rss/datemodified/plain/dc10/rss093.xml | 7 + .../Rss/datemodified/plain/dc10/rss094.xml | 7 + .../Rss/datemodified/plain/dc10/rss10.xml | 9 + .../Rss/datemodified/plain/dc10/rss20.xml | 7 + .../Rss/datemodified/plain/dc11/rss090.xml | 9 + .../Rss/datemodified/plain/dc11/rss091.xml | 7 + .../Rss/datemodified/plain/dc11/rss092.xml | 7 + .../Rss/datemodified/plain/dc11/rss093.xml | 7 + .../Rss/datemodified/plain/dc11/rss094.xml | 7 + .../Rss/datemodified/plain/dc11/rss10.xml | 9 + .../Rss/datemodified/plain/dc11/rss20.xml | 7 + .../Rss/datemodified/plain/none/rss090.xml | 7 + .../Rss/datemodified/plain/none/rss091.xml | 5 + .../Rss/datemodified/plain/none/rss092.xml | 5 + .../Rss/datemodified/plain/none/rss093.xml | 5 + .../Rss/datemodified/plain/none/rss094.xml | 5 + .../Rss/datemodified/plain/none/rss10.xml | 7 + .../Rss/datemodified/plain/none/rss20.xml | 5 + .../_files/Rss/datemodified/plain/rss20.xml | 6 + .../Rss/description/plain/dc10/rss090.xml | 9 + .../Rss/description/plain/dc10/rss091.xml | 7 + .../Rss/description/plain/dc10/rss092.xml | 7 + .../Rss/description/plain/dc10/rss093.xml | 7 + .../Rss/description/plain/dc10/rss094.xml | 7 + .../Rss/description/plain/dc10/rss10.xml | 9 + .../Rss/description/plain/dc10/rss20.xml | 7 + .../Rss/description/plain/dc11/rss090.xml | 9 + .../Rss/description/plain/dc11/rss091.xml | 7 + .../Rss/description/plain/dc11/rss092.xml | 7 + .../Rss/description/plain/dc11/rss093.xml | 7 + .../Rss/description/plain/dc11/rss094.xml | 7 + .../Rss/description/plain/dc11/rss10.xml | 9 + .../Rss/description/plain/dc11/rss20.xml | 7 + .../Rss/description/plain/none/rss090.xml | 7 + .../Rss/description/plain/none/rss091.xml | 5 + .../Rss/description/plain/none/rss092.xml | 5 + .../Rss/description/plain/none/rss093.xml | 5 + .../Rss/description/plain/none/rss094.xml | 5 + .../Rss/description/plain/none/rss10.xml | 7 + .../Rss/description/plain/none/rss20.xml | 5 + .../_files/Rss/description/plain/rss090.xml | 8 + .../_files/Rss/description/plain/rss091.xml | 6 + .../_files/Rss/description/plain/rss092.xml | 6 + .../_files/Rss/description/plain/rss093.xml | 6 + .../_files/Rss/description/plain/rss094.xml | 6 + .../_files/Rss/description/plain/rss10.xml | 8 + .../_files/Rss/description/plain/rss20.xml | 6 + .../_files/Rss/feedlink/plain/none/rss090.xml | 8 + .../_files/Rss/feedlink/plain/none/rss091.xml | 6 + .../_files/Rss/feedlink/plain/none/rss092.xml | 6 + .../_files/Rss/feedlink/plain/none/rss093.xml | 6 + .../_files/Rss/feedlink/plain/none/rss094.xml | 6 + .../_files/Rss/feedlink/plain/none/rss10.xml | 8 + .../_files/Rss/feedlink/plain/none/rss20.xml | 6 + .../Feed/_files/Rss/feedlink/plain/rss090.xml | 9 + .../Feed/_files/Rss/feedlink/plain/rss091.xml | 7 + .../Feed/_files/Rss/feedlink/plain/rss092.xml | 7 + .../Feed/_files/Rss/feedlink/plain/rss093.xml | 7 + .../Feed/_files/Rss/feedlink/plain/rss094.xml | 7 + .../Feed/_files/Rss/feedlink/plain/rss10.xml | 9 + .../Feed/_files/Rss/feedlink/plain/rss20.xml | 7 + .../Rss/generator/plain/none/rss090.xml | 8 + .../Rss/generator/plain/none/rss091.xml | 6 + .../Rss/generator/plain/none/rss092.xml | 6 + .../Rss/generator/plain/none/rss093.xml | 6 + .../Rss/generator/plain/none/rss094.xml | 6 + .../_files/Rss/generator/plain/none/rss10.xml | 8 + .../_files/Rss/generator/plain/none/rss20.xml | 6 + .../_files/Rss/generator/plain/rss090.xml | 9 + .../_files/Rss/generator/plain/rss091.xml | 7 + .../_files/Rss/generator/plain/rss092.xml | 7 + .../_files/Rss/generator/plain/rss093.xml | 7 + .../_files/Rss/generator/plain/rss094.xml | 7 + .../Feed/_files/Rss/generator/plain/rss10.xml | 9 + .../Feed/_files/Rss/generator/plain/rss20.xml | 6 + .../_files/Rss/language/plain/dc10/rss090.xml | 9 + .../_files/Rss/language/plain/dc10/rss091.xml | 7 + .../_files/Rss/language/plain/dc10/rss092.xml | 7 + .../_files/Rss/language/plain/dc10/rss093.xml | 7 + .../_files/Rss/language/plain/dc10/rss094.xml | 7 + .../_files/Rss/language/plain/dc10/rss10.xml | 9 + .../_files/Rss/language/plain/dc10/rss20.xml | 7 + .../_files/Rss/language/plain/dc11/rss090.xml | 9 + .../_files/Rss/language/plain/dc11/rss091.xml | 7 + .../_files/Rss/language/plain/dc11/rss092.xml | 7 + .../_files/Rss/language/plain/dc11/rss093.xml | 7 + .../_files/Rss/language/plain/dc11/rss094.xml | 7 + .../_files/Rss/language/plain/dc11/rss10.xml | 9 + .../_files/Rss/language/plain/dc11/rss20.xml | 7 + .../_files/Rss/language/plain/none/rss090.xml | 7 + .../_files/Rss/language/plain/none/rss091.xml | 5 + .../_files/Rss/language/plain/none/rss092.xml | 5 + .../_files/Rss/language/plain/none/rss093.xml | 5 + .../_files/Rss/language/plain/none/rss094.xml | 5 + .../_files/Rss/language/plain/none/rss10.xml | 7 + .../_files/Rss/language/plain/none/rss20.xml | 5 + .../_files/Rss/language/plain/rdf/rss10.xml | 9 + .../Feed/_files/Rss/language/plain/rss090.xml | 7 + .../Feed/_files/Rss/language/plain/rss091.xml | 6 + .../Feed/_files/Rss/language/plain/rss092.xml | 6 + .../Feed/_files/Rss/language/plain/rss093.xml | 6 + .../Feed/_files/Rss/language/plain/rss094.xml | 6 + .../Feed/_files/Rss/language/plain/rss10.xml | 7 + .../Feed/_files/Rss/language/plain/rss20.xml | 6 + .../_files/Rss/link/plain/none/rss090.xml | 7 + .../_files/Rss/link/plain/none/rss091.xml | 5 + .../_files/Rss/link/plain/none/rss092.xml | 5 + .../_files/Rss/link/plain/none/rss093.xml | 5 + .../_files/Rss/link/plain/none/rss094.xml | 5 + .../Feed/_files/Rss/link/plain/none/rss10.xml | 7 + .../Feed/_files/Rss/link/plain/none/rss20.xml | 5 + .../Feed/_files/Rss/link/plain/rss090.xml | 8 + .../Feed/_files/Rss/link/plain/rss091.xml | 6 + .../Feed/_files/Rss/link/plain/rss092.xml | 6 + .../Feed/_files/Rss/link/plain/rss093.xml | 6 + .../Feed/_files/Rss/link/plain/rss094.xml | 6 + .../Feed/_files/Rss/link/plain/rss10.xml | 8 + .../Feed/_files/Rss/link/plain/rss20.xml | 6 + .../_files/Rss/title/plain/atom10/rss090.xml | 9 + .../_files/Rss/title/plain/atom10/rss091.xml | 7 + .../_files/Rss/title/plain/atom10/rss092.xml | 7 + .../_files/Rss/title/plain/atom10/rss093.xml | 7 + .../_files/Rss/title/plain/atom10/rss094.xml | 7 + .../_files/Rss/title/plain/atom10/rss10.xml | 9 + .../_files/Rss/title/plain/atom10/rss20.xml | 7 + .../_files/Rss/title/plain/dc10/rss090.xml | 9 + .../_files/Rss/title/plain/dc10/rss091.xml | 7 + .../_files/Rss/title/plain/dc10/rss092.xml | 7 + .../_files/Rss/title/plain/dc10/rss093.xml | 7 + .../_files/Rss/title/plain/dc10/rss094.xml | 7 + .../_files/Rss/title/plain/dc10/rss10.xml | 9 + .../_files/Rss/title/plain/dc10/rss20.xml | 7 + .../_files/Rss/title/plain/dc11/rss090.xml | 9 + .../_files/Rss/title/plain/dc11/rss091.xml | 7 + .../_files/Rss/title/plain/dc11/rss092.xml | 7 + .../_files/Rss/title/plain/dc11/rss093.xml | 7 + .../_files/Rss/title/plain/dc11/rss094.xml | 7 + .../_files/Rss/title/plain/dc11/rss10.xml | 9 + .../_files/Rss/title/plain/dc11/rss20.xml | 7 + .../_files/Rss/title/plain/none/rss090.xml | 7 + .../_files/Rss/title/plain/none/rss091.xml | 5 + .../_files/Rss/title/plain/none/rss092.xml | 5 + .../_files/Rss/title/plain/none/rss093.xml | 5 + .../_files/Rss/title/plain/none/rss094.xml | 5 + .../_files/Rss/title/plain/none/rss10.xml | 7 + .../_files/Rss/title/plain/none/rss20.xml | 5 + .../Feed/_files/Rss/title/plain/rss090.xml | 8 + .../Feed/_files/Rss/title/plain/rss091.xml | 6 + .../Feed/_files/Rss/title/plain/rss092.xml | 6 + .../Feed/_files/Rss/title/plain/rss093.xml | 6 + .../Feed/_files/Rss/title/plain/rss094.xml | 6 + .../Feed/_files/Rss/title/plain/rss10.xml | 8 + .../Feed/_files/Rss/title/plain/rss20.xml | 6 + .../Integration/H-OnlineComAtom10Test.php | 186 ++ test/Reader/Integration/LautDeRdfTest.php | 186 ++ .../Integration/WordpressAtom10Test.php | 190 ++ .../Integration/WordpressRss2DcAtomTest.php | 194 ++ .../_files/h-online.com-atom10.xml | 584 ++++ .../Reader/Integration/_files/laut.de-rdf.xml | 426 +++ .../Integration/_files/wordpress-atom10.xml | 726 +++++ .../_files/wordpress-rss2-dc-atom.xml | 700 +++++ .../_files/My/Extension/JungleBooks/Entry.php | 27 + .../_files/My/Extension/JungleBooks/Feed.php | 25 + test/Reader/_files/Reader/atom03.xml | 3 + test/Reader/_files/Reader/atom10.xml | 3 + test/Reader/_files/Reader/rss090.xml | 7 + test/Reader/_files/Reader/rss091.xml | 5 + test/Reader/_files/Reader/rss092.xml | 5 + test/Reader/_files/Reader/rss093.xml | 5 + test/Reader/_files/Reader/rss094.xml | 5 + test/Reader/_files/Reader/rss10.xml | 7 + test/Reader/_files/Reader/rss20.xml | 5 + test/ReaderTest.php | 156 + 585 files changed, 18952 insertions(+) create mode 100644 src/Reader.php create mode 100644 src/Reader/Entry/Abstract.php create mode 100644 src/Reader/Entry/Atom.php create mode 100644 src/Reader/Entry/Interface.php create mode 100644 src/Reader/Entry/Rss.php create mode 100644 src/Reader/Extension/Atom/Entry.php create mode 100644 src/Reader/Extension/Atom/Feed.php create mode 100644 src/Reader/Extension/Content/Entry.php create mode 100644 src/Reader/Extension/CreativeCommons/Entry.php create mode 100644 src/Reader/Extension/CreativeCommons/Feed.php create mode 100644 src/Reader/Extension/DublinCore/Entry.php create mode 100644 src/Reader/Extension/DublinCore/Feed.php create mode 100644 src/Reader/Extension/EntryAbstract.php create mode 100644 src/Reader/Extension/FeedAbstract.php create mode 100644 src/Reader/Extension/Slash/Entry.php create mode 100644 src/Reader/Extension/Syndication/Feed.php create mode 100644 src/Reader/Extension/Thread/Entry.php create mode 100644 src/Reader/Extension/WellFormedWeb/Entry.php create mode 100644 src/Reader/Feed/Abstract.php create mode 100644 src/Reader/Feed/Atom.php create mode 100644 src/Reader/Feed/Interface.php create mode 100644 src/Reader/Feed/Rss.php create mode 100644 test/Reader/Entry/AtomTest.php create mode 100644 test/Reader/Entry/RssTest.php create mode 100644 test/Reader/Entry/_files/Atom/author/plain/atom03.xml create mode 100644 test/Reader/Entry/_files/Atom/author/plain/atom10.xml create mode 100644 test/Reader/Entry/_files/Atom/content/plain/atom03.xml create mode 100644 test/Reader/Entry/_files/Atom/content/plain/atom10.xml create mode 100644 test/Reader/Entry/_files/Atom/datecreated/plain/atom03.xml create mode 100644 test/Reader/Entry/_files/Atom/datecreated/plain/atom10.xml create mode 100644 test/Reader/Entry/_files/Atom/datemodified/plain/atom03.xml create mode 100644 test/Reader/Entry/_files/Atom/datemodified/plain/atom10.xml create mode 100644 test/Reader/Entry/_files/Atom/description/plain/atom03.xml create mode 100644 test/Reader/Entry/_files/Atom/description/plain/atom10.xml create mode 100644 test/Reader/Entry/_files/Atom/id/plain/atom03.xml create mode 100644 test/Reader/Entry/_files/Atom/id/plain/atom10.xml create mode 100644 test/Reader/Entry/_files/Atom/link/plain/atom03.xml create mode 100644 test/Reader/Entry/_files/Atom/link/plain/atom10.xml create mode 100644 test/Reader/Entry/_files/Atom/links/plain/atom03.xml create mode 100644 test/Reader/Entry/_files/Atom/links/plain/atom10.xml create mode 100644 test/Reader/Entry/_files/Atom/title/plain/atom03.xml create mode 100644 test/Reader/Entry/_files/Atom/title/plain/atom10.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/dc10/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/dc10/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/dc10/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/dc10/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/dc10/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/dc10/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/dc10/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/dc11/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/dc11/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/dc11/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/dc11/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/dc11/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/dc11/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/dc11/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/none/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/none/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/none/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/none/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/none/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/none/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/none/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/author/plain/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/none/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/none/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/none/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/none/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/none/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/none/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/none/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/none/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/none/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/none/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/none/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/none/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/none/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/none/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/commentlink/plain/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/description/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/description/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/description/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/description/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/description/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/description/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/description/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/none/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/none/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/none/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/none/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/none/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/none/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/none/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/content/plain/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/none/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/none/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/none/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/none/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/none/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/none/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/none/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/dc10/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/dc10/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/dc10/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/dc10/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/dc10/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/dc10/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/dc10/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/dc11/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/dc11/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/dc11/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/dc11/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/dc11/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/dc11/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/dc11/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/none/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/none/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/none/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/none/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/none/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/none/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/none/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/description/plain/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/dc10/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/dc10/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/dc10/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/dc10/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/dc10/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/dc10/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/dc10/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/dc11/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/dc11/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/dc11/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/dc11/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/dc11/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/dc11/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/dc11/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/none/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/none/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/none/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/none/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/none/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/none/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/none/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/title/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/title/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/title/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/title/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/title/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/title/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/id/plain/title/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/link/plain/none/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/link/plain/none/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/link/plain/none/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/link/plain/none/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/link/plain/none/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/link/plain/none/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/link/plain/none/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/link/plain/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/link/plain/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/link/plain/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/link/plain/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/link/plain/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/link/plain/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/link/plain/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/links/plain/none/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/links/plain/none/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/links/plain/none/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/links/plain/none/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/links/plain/none/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/links/plain/none/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/links/plain/none/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/links/plain/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/links/plain/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/links/plain/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/links/plain/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/links/plain/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/links/plain/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/links/plain/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/dc10/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/dc10/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/dc10/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/dc10/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/dc10/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/dc10/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/dc10/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/dc11/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/dc11/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/dc11/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/dc11/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/dc11/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/dc11/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/dc11/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/none/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/none/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/none/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/none/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/none/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/none/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/none/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/title/plain/rss20.xml create mode 100644 test/Reader/Feed/AtomTest.php create mode 100644 test/Reader/Feed/RssTest.php create mode 100644 test/Reader/Feed/_files/Atom/author/plain/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/author/plain/atom10.xml create mode 100644 test/Reader/Feed/_files/Atom/copyright/plain/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/copyright/plain/atom10.xml create mode 100644 test/Reader/Feed/_files/Atom/datecreated/plain/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/datecreated/plain/atom10.xml create mode 100644 test/Reader/Feed/_files/Atom/datemodified/plain/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/datemodified/plain/atom10.xml create mode 100644 test/Reader/Feed/_files/Atom/description/plain/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/description/plain/atom10.xml create mode 100644 test/Reader/Feed/_files/Atom/feedlink/plain/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/feedlink/plain/atom10.xml create mode 100644 test/Reader/Feed/_files/Atom/generator/plain/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/generator/plain/atom10.xml create mode 100644 test/Reader/Feed/_files/Atom/id/plain/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/id/plain/atom10.xml create mode 100644 test/Reader/Feed/_files/Atom/language/plain/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/language/plain/atom10.xml create mode 100644 test/Reader/Feed/_files/Atom/link/plain/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/link/plain/atom10.xml create mode 100644 test/Reader/Feed/_files/Atom/title/plain/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/title/plain/atom10.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/atom10/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/atom10/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/atom10/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/atom10/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/atom10/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/atom10/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/atom10/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/dc10/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/dc10/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/dc10/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/dc10/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/dc10/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/dc10/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/dc10/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/dc11/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/dc11/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/dc11/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/dc11/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/dc11/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/dc11/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/dc11/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/none/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/none/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/none/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/none/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/none/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/none/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/none/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/author/plain/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/none/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/none/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/none/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/none/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/none/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/none/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/none/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/copyright/plain/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/none/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/none/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/none/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/none/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/none/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/none/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/none/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/dc10/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/dc10/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/dc10/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/dc10/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/dc10/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/dc10/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/dc10/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/dc11/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/dc11/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/dc11/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/dc11/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/dc11/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/dc11/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/dc11/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/none/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/none/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/none/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/none/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/none/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/none/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/none/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/description/plain/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/feedlink/plain/none/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/feedlink/plain/none/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/feedlink/plain/none/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/feedlink/plain/none/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/feedlink/plain/none/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/feedlink/plain/none/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/feedlink/plain/none/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/feedlink/plain/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/feedlink/plain/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/feedlink/plain/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/feedlink/plain/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/feedlink/plain/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/feedlink/plain/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/feedlink/plain/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/generator/plain/none/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/generator/plain/none/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/generator/plain/none/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/generator/plain/none/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/generator/plain/none/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/generator/plain/none/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/generator/plain/none/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/generator/plain/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/generator/plain/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/generator/plain/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/generator/plain/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/generator/plain/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/generator/plain/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/generator/plain/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/dc10/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/dc10/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/dc10/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/dc10/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/dc10/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/dc10/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/dc10/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/dc11/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/dc11/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/dc11/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/dc11/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/dc11/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/dc11/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/dc11/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/none/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/none/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/none/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/none/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/none/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/none/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/none/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/rdf/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/language/plain/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/link/plain/none/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/link/plain/none/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/link/plain/none/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/link/plain/none/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/link/plain/none/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/link/plain/none/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/link/plain/none/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/link/plain/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/link/plain/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/link/plain/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/link/plain/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/link/plain/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/link/plain/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/link/plain/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/atom10/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/atom10/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/atom10/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/atom10/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/atom10/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/atom10/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/atom10/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/dc10/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/dc10/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/dc10/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/dc10/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/dc10/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/dc10/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/dc10/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/dc11/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/dc11/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/dc11/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/dc11/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/dc11/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/dc11/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/dc11/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/none/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/none/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/none/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/none/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/none/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/none/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/none/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/title/plain/rss20.xml create mode 100644 test/Reader/Integration/H-OnlineComAtom10Test.php create mode 100644 test/Reader/Integration/LautDeRdfTest.php create mode 100644 test/Reader/Integration/WordpressAtom10Test.php create mode 100644 test/Reader/Integration/WordpressRss2DcAtomTest.php create mode 100644 test/Reader/Integration/_files/h-online.com-atom10.xml create mode 100644 test/Reader/Integration/_files/laut.de-rdf.xml create mode 100644 test/Reader/Integration/_files/wordpress-atom10.xml create mode 100644 test/Reader/Integration/_files/wordpress-rss2-dc-atom.xml create mode 100644 test/Reader/_files/My/Extension/JungleBooks/Entry.php create mode 100644 test/Reader/_files/My/Extension/JungleBooks/Feed.php create mode 100644 test/Reader/_files/Reader/atom03.xml create mode 100644 test/Reader/_files/Reader/atom10.xml create mode 100644 test/Reader/_files/Reader/rss090.xml create mode 100644 test/Reader/_files/Reader/rss091.xml create mode 100644 test/Reader/_files/Reader/rss092.xml create mode 100644 test/Reader/_files/Reader/rss093.xml create mode 100644 test/Reader/_files/Reader/rss094.xml create mode 100644 test/Reader/_files/Reader/rss10.xml create mode 100644 test/Reader/_files/Reader/rss20.xml create mode 100644 test/ReaderTest.php diff --git a/src/Reader.php b/src/Reader.php new file mode 100644 index 00000000..5037e208 --- /dev/null +++ b/src/Reader.php @@ -0,0 +1,690 @@ + array( + 'DublinCore_Feed', + 'Atom_Feed' + ), + 'entry' => array( + 'Content_Entry', + 'DublinCore_Entry', + 'Atom_Entry' + ), + 'core' => array( + 'DublinCore_Feed', + 'Atom_Feed', + 'Content_Entry', + 'DublinCore_Entry', + 'Atom_Entry' + ) + ); + + /** + * Get the Feed cache + * + * @return Zend_Cache_Core + */ + public static function getCache() + { + return self::$_cache; + } + + /** + * Set the feed cache + * + * @param Zend_Cache_Core $cache + * @return void + */ + public static function setCache(Zend_Cache_Core $cache) + { + self::$_cache = $cache; + } + + /** + * Set the HTTP client instance + * + * Sets the HTTP client object to use for retrieving the feeds. + * + * @param Zend_Http_Client $httpClient + * @return void + */ + public static function setHttpClient(Zend_Http_Client $httpClient) + { + self::$_httpClient = $httpClient; + } + + + /** + * Gets the HTTP client object. If none is set, a new Zend_Http_Client will be used. + * + * @return Zend_Http_Client_Abstract + */ + public static function getHttpClient() + { + if (!self::$_httpClient instanceof Zend_Http_Client) { + /** + * @see Zend_Http_Client + */ + require_once 'Zend/Http/Client.php'; + self::$_httpClient = new Zend_Http_Client(); + } + + return self::$_httpClient; + } + + /** + * Toggle using POST instead of PUT and DELETE HTTP methods + * + * Some feed implementations do not accept PUT and DELETE HTTP + * methods, or they can't be used because of proxies or other + * measures. This allows turning on using POST where PUT and + * DELETE would normally be used; in addition, an + * X-Method-Override header will be sent with a value of PUT or + * DELETE as appropriate. + * + * @param boolean $override Whether to override PUT and DELETE. + * @return void + */ + public static function setHttpMethodOverride($override = true) + { + self::$_httpMethodOverride = $override; + } + + /** + * Get the HTTP override state + * + * @return boolean + */ + public static function getHttpMethodOverride() + { + return self::$_httpMethodOverride; + } + + /** + * Set the flag indicating whether or not to use HTTP conditional GET + * + * @param bool $bool + * @return void + */ + public static function useHttpConditionalGet($bool = true) + { + self::$_httpConditionalGet = $bool; + } + + /** + * 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 + */ + public static function import($uri, $etag = null, $lastModified = null) + { + $cache = self::getCache(); + $feed = null; + $responseXml = ''; + $client = self::getHttpClient(); + $client->resetParameters(); + $client->setHeaders('If-None-Match', null); + $client->setHeaders('If-Modified-Since', null); + $client->setUri($uri); + $cacheId = 'Zend_Feed_Reader_' . md5($uri); + + if (self::$_httpConditionalGet && $cache) { + $data = $cache->load($cacheId); + if ($data) { + if (is_null($etag)) { + $etag = $cache->load($cacheId.'_etag'); + } + if (is_null($lastModified)) { + $lastModified = $cache->load($cacheId.'_lastmodified');; + } + if ($etag) { + $client->setHeaders('If-None-Match', $etag); + } + if ($lastModified) { + $client->setHeaders('If-Modified-Since', $lastModified); + } + } + $response = $client->request('GET'); + if ($response->getStatus() !== 200 || $response->getStatus() !== 304) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); + } + if ($response->getStatus() == 304) { + $responseXml = $data; + } else { + $responseXml = $response->getBody(); + $cache->save($responseXml, $cacheId); + if ($response->getHeader('ETag')) { + $cache->save($response->getHeader('ETag'), $cacheId.'_etag'); + } + if ($response->getHeader('Last-Modified')) { + $cache->save($response->getHeader('Last-Modified'), $cacheId.'_lastmodified'); + } + } + return self::importString($responseXml); + } elseif ($cache) { + $data = $cache->load($cacheId); + if ($data !== false) { + return self::importString($data); + } + $response = $client->request('GET'); + if ($response->getStatus() !== 200) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); + } + $responseXml = $response->getBody(); + $cache->save($responseXml, $cacheId); + return self::importString($responseXml); + } else { + $response = $client->request('GET'); + if ($response->getStatus() !== 200) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); + } + return self::importString($response->getBody()); + } + } + + /** + * 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 + */ + public static function importFeed(Zend_Feed_Abstract $feed) + { + $dom = $feed->getDOM()->ownerDocument; + $type = self::detectType($dom); + self::_registerCoreExtensions(); + 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); + } + + return $reader; + } + + /** + * Import a feed froma string + * + * @param string $string + * @return Zend_Feed_Reader_Feed_Interface + */ + public static function importString($string) + { + @ini_set('track_errors', 1); + $dom = new DOMDocument; + $status = @$dom->loadXML($string); + @ini_restore('track_errors'); + + 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)'; + } + } + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg"); + } + + $type = self::detectType($dom); + + self::_registerCoreExtensions(); + + 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); + } + return $reader; + } + + /** + * Imports a feed from a file located at $filename. + * + * @param string $filename + * @throws Zend_Feed_Exception + * @return Zend_Feed_Reader_FeedInterface + */ + public static function importFile($filename) + { + @ini_set('track_errors', 1); + $feed = @file_get_contents($filename); + @ini_restore('track_errors'); + if ($feed === false) { + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception("File could not be loaded: $php_errormsg"); + } + return self::importString($feed); + } + + public static function findFeedLinks($uri) + { + // Get the HTTP response from $uri and save the contents + $client = self::getHttpClient(); + $client->setUri($uri); + $response = $client->request(); + if ($response->getStatus() !== 200) { + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception("Failed to access $uri, got response code " . $response->getStatus()); + } + $responseHtml = $response->getBody(); + @ini_set('track_errors', 1); + $dom = new DOMDocument; + $status = @$dom->loadHTML($responseHtml); + @ini_restore('track_errors'); + 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)'; + } + } + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg"); + } + $feedLinks = new stdClass; + $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; + } + + /** + * Detect the feed type of the provided feed + * + * @param Zend_Feed_Abstract $feed A fully instantiated Zend_Feed object + * @return string + */ + public static function detectType($feed) + { + if ($feed instanceof Zend_Feed_Reader_Feed_Interface) { + $dom = $feed->getDomDocument(); + } elseif($feed instanceof DomDocument) { + $dom = $feed; + } elseif(is_string($feed) && !empty($feed)) { + @ini_set('track_errors', 1); + $dom = new DOMDocument; + $status = @$doc->loadXML($string); + @ini_restore('track_errors'); + 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)'; + } + } + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg"); + } + } else { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid object/scalar provided: must be of type Zend_Feed_Reader_Feed_Interface, DomDocument or string'); + } + $xpath = new DOMXPath($dom); + + if ($xpath->query('/rss')->length) { + $type = self::TYPE_RSS_ANY; + $version = $xpath->evaluate('string(/rss/@version)'); + + if (strlen($version) > 0) { + switch($version) { + case '2.0': + $type = self::TYPE_RSS_20; + break; + + case '0.94': + $type = self::TYPE_RSS_094; + break; + + case '0.93': + $type = self::TYPE_RSS_093; + break; + + case '0.92': + $type = self::TYPE_RSS_092; + break; + + case '0.91': + $type = self::TYPE_RSS_091; + break; + } + } + + return $type; + } + + $xpath->registerNamespace('rdf', self::NAMESPACE_RDF); + + if ($xpath->query('/rdf:RDF')->length) { + $xpath->registerNamespace('rss', self::NAMESPACE_RSS_10); + + if ($xpath->query('/rdf:RDF/rss:channel')->length + || $xpath->query('/rdf:RDF/rss:image')->length + || $xpath->query('/rdf:RDF/rss:item')->length + || $xpath->query('/rdf:RDF/rss:textinput')->length + ) { + return self::TYPE_RSS_10; + } + + $xpath->registerNamespace('rss', self::NAMESPACE_RSS_090); + + if ($xpath->query('/rdf:RDF/rss:channel')->length + || $xpath->query('/rdf:RDF/rss:image')->length + || $xpath->query('/rdf:RDF/rss:item')->length + || $xpath->query('/rdf:RDF/rss:textinput')->length + ) { + return self::TYPE_RSS_090; + } + } + + $type = self::TYPE_ATOM_ANY; + $xpath->registerNamespace('atom', self::NAMESPACE_ATOM_10); + + if ($xpath->query('//atom:feed')->length) { + return self::TYPE_ATOM_10; + } + + $xpath->registerNamespace('atom', self::NAMESPACE_ATOM_03); + + if ($xpath->query('//atom:feed')->length) { + return self::TYPE_ATOM_03; + } + + return self::TYPE_ANY; + } + + /** + * Set plugin loader for use with Extensions + * + * @param Zend_Loader_PluginLoader_Interface $loader + */ + public static function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader) + { + self::$_pluginLoader = $loader; + } + + /** + * Get plugin loader for use with Extensions + * + * @return Zend_Loader_PluginLoader_Interface $loader + */ + public static function getPluginLoader() + { + if (!isset(self::$_pluginLoader)) { + require_once 'Zend/Loader/PluginLoader.php'; + self::$_pluginLoader = new Zend_Loader_PluginLoader(array( + 'Zend_Feed_Reader_Extension_' => 'Zend/Feed/Reader/Extension/', + )); + } + return self::$_pluginLoader; + } + + /** + * Add prefix path for loading Extensions + * + * @param string $prefix + * @param string $path + * @return void + */ + public static function addPrefixPath($prefix, $path) + { + $prefix = rtrim($prefix, '_'); + $path = rtrim($path, DIRECTORY_SEPARATOR); + self::$_pluginLoader->addPrefixPath($prefix, $path); + } + + /** + * Add multiple Extension prefix paths at once + * + * @param array $spec + * @return void + */ + public static function addPrefixPaths(array $spec) + { + if (isset($spec['prefix']) && isset($spec['path'])) { + self::addPrefixPath($spec['prefix'], $spec['path']); + } + foreach ($spec as $prefixPath) { + if (isset($prefixPath['prefix']) && isset($prefixPath['path'])) { + self::addPrefixPath($prefixPath['prefix'], $prefixPath['path']); + } + } + } + + /** + * Register an Extension by name + * + * @param string $name + * @return void + * @throws Zend_Feed_Exception if unable to resolve Extension class + */ + public static function registerExtension($name) + { + $feedName = $name . '_Feed'; + $entryName = $name . '_Entry'; + if (self::isRegistered($name)) { + if (self::getPluginLoader()->isLoaded($feedName) || + self::getPluginLoader()->isLoaded($entryName)) { + return; + } + } + try { + self::getPluginLoader()->load($feedName); + self::$_extensions['feed'][] = $feedName; + } catch (Zend_Loader_PluginLoader_Exception $e) { + } + try { + self::getPluginLoader()->load($entryName); + self::$_extensions['entry'][] = $entryName; + } catch (Zend_Loader_PluginLoader_Exception $e) { + } + if (!self::getPluginLoader()->isLoaded($feedName) + && !self::getPluginLoader()->isLoaded($entryName) + ) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Could not load extension: ' . $name + . 'using Plugin Loader. Check prefix paths are configured and extension exists.'); + } + } + + /** + * Is a given named Extension registered? + * + * @param string $extensionName + * @return boolean + */ + public static function isRegistered($extensionName) + { + $feedName = $extensionName . '_Feed'; + $entryName = $extensionName . '_Entry'; + if (in_array($feedName, self::$_extensions['feed']) + || in_array($entryName, self::$_extensions['entry']) + ) { + return true; + } + return false; + } + + /** + * Get a list of extensions + * + * @return array + */ + public static function getExtensions() + { + return self::$_extensions; + } + + /** + * Reset class state to defaults + * + * @return void + */ + public static function reset() + { + self::$_cache = null; + self::$_httpClient = null; + self::$_httpMethodOverride = false; + self::$_httpConditionalGet = false; + self::$_pluginLoader = null; + self::$_prefixPaths = array(); + self::$_extensions = array( + 'feed' => array( + 'DublinCore_Feed', + 'Atom_Feed' + ), + 'entry' => array( + 'Content_Entry', + 'DublinCore_Entry', + 'Atom_Entry' + ), + 'core' => array( + 'DublinCore_Feed', + 'Atom_Feed', + 'Content_Entry', + 'DublinCore_Entry', + 'Atom_Entry' + ) + ); + } + + /** + * Register core (default) extensions + * + * @return void + */ + protected static function _registerCoreExtensions() + { + self::registerExtension('DublinCore'); + self::registerExtension('Content'); + self::registerExtension('Atom'); + self::registerExtension('Slash'); + self::registerExtension('WellFormedWeb'); + self::registerExtension('Thread'); + } +} diff --git a/src/Reader/Entry/Abstract.php b/src/Reader/Entry/Abstract.php new file mode 100644 index 00000000..7bcbc51b --- /dev/null +++ b/src/Reader/Entry/Abstract.php @@ -0,0 +1,215 @@ +_entry = $entry; + $this->_entryKey = $entryKey; + $this->_domDocument = $entry->ownerDocument; + if ($type !== null) { + $this->_data['type'] = $type; + } else { + $this->_data['type'] = Zend_Feed_Reader::detectType($feed); + } + $this->_loadExtensions(); + } + + /** + * Get the DOM + * + * @return DOMDocument + */ + public function getDomDocument() + { + return $this->_domDocument; + } + + /** + * Get the entry element + * + * @return Zend_Feed_Entry_Interface + */ + public function getEntryElement() + { + return $this->_entry; + } + + /** + * Get the Entry's encoding + * + * @return string + */ + public function getEncoding() + { + $assumed = $this->getDomDocument()->encoding; + return $assumed; + } + + /** + * Get the entry type + * + * @return string + */ + public function getType() + { + return $this->_data['type']; + } + + /** + * Get the XPath query object + * + * @return DOMXPath + */ + public function getXpath() + { + return $this->_xpath; + } + + /** + * Set the XPath query + * + * @param DOMXPath $xpath + * @return Zend_Feed_Reader_Entry_Abstract + */ + public function setXpath(DOMXPath $xpath) + { + $this->_xpath = $xpath; + return $this; + } + + /** + * Serialize the entry to an array + * + * @return array + */ + public function toArray() + { + return $this->_data; + } + + /** + * Get registered extensions + * + * @return array + */ + public function getExtensions() + { + return $this->_extensions; + } + + /** + * Method overloading: call given method on first extension implementing it + * + * @param string $method + * @param array $args + * @return mixed + * @throws Zend_Feed_Exception if no extensions implements the method + */ + public function __call($method, $args) + { + foreach ($this->_extensions as $extension) { + if (method_exists($extension, $method)) { + return call_user_func_array(array($extension, $method), $args); + } + } + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Method: ' . $method + . 'does not exist and could not be located on a registered Extension'); + } + + /** + * Load extensions from Zend_Feed_Reader + * + * @return void + */ + protected function _loadExtensions() + { + $all = Zend_Feed_Reader::getExtensions(); + $feed = $all['entry']; + foreach ($feed as $extension) { + if (in_array($extension, $all['core'])) { + continue; + } + $className = Zend_Feed_Reader::getPluginLoader()->getClassName($extension); + $this->_extensions[$className] = new $className( + $this->getEntryElement(), $this->_entryKey, $this->_data['type'] + ); + } + } +} diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php new file mode 100644 index 00000000..1b5cb49c --- /dev/null +++ b/src/Reader/Entry/Atom.php @@ -0,0 +1,355 @@ +_xpathQuery = '//atom:entry[' . ($this->_entryKey + 1) . ']'; + $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Entry'); + + $this->_atom = new $atomClass($entry, $entryKey, $type); + + $threadClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Thread_Entry'); + $this->_thread = new $threadClass($entry, $entryKey, $type); + } + + /** + * Get the specified author + * + * @param int $index + * @return string|null + */ + public function getAuthor($index = 0) + { + $authors = $this->getAuthors(); + + if (isset($authors[$index])) { + return $authors[$index]; + } + + return null; + } + + /** + * Get an array with feed authors + * + * @return array + */ + public function getAuthors() + { + if (array_key_exists('authors', $this->_data)) { + return $this->_data['authors']; + } + + $people = $this->_atom->getAuthors(); + + $this->_data['authors'] = $people; + + return $this->_data['authors']; + } + + /** + * Get the entry content + * + * @return string + */ + public function getContent() + { + if (array_key_exists('content', $this->_data)) { + return $this->_data['content']; + } + + $content = $this->_atom->getContent(); + + $this->_data['content'] = $content; + + return $this->_data['content']; + } + + /** + * Get the entry creation date + * + * @return string + */ + public function getDateCreated() + { + if (array_key_exists('datecreated', $this->_data)) { + return $this->_data['datecreated']; + } + + $dateCreated = $this->_atom->getDateCreated(); + + $this->_data['datecreated'] = $dateCreated; + + return $this->_data['datecreated']; + } + + /** + * Get the entry modification date + * + * @return string + */ + public function getDateModified() + { + if (array_key_exists('datemodified', $this->_data)) { + return $this->_data['datemodified']; + } + + $dateModified = $this->_atom->getDateModified(); + + $this->_data['datemodified'] = $dateModified; + + return $this->_data['datemodified']; + } + + /** + * Get the entry description + * + * @return string + */ + public function getDescription() + { + if (array_key_exists('description', $this->_data)) { + return $this->_data['description']; + } + + $description = $this->_atom->getDescription(); + + $this->_data['description'] = $description; + + return $this->_data['description']; + } + + /** + * Get the entry ID + * + * @return string + */ + public function getId() + { + if (array_key_exists('id', $this->_data)) { + return $this->_data['id']; + } + + $id = $this->_atom->getId(); + + $this->_data['id'] = $id; + + return $this->_data['id']; + } + + /** + * Get a specific link + * + * @param int $index + * @return string + */ + public function getLink($index = 0) + { + if (!array_key_exists('links', $this->_data)) { + $this->getLinks(); + } + + if (isset($this->_data['links'][$index])) { + return $this->_data['links'][$index]; + } + + return null; + } + + /** + * Get all links + * + * @return array + */ + public function getLinks() + { + if (array_key_exists('links', $this->_data)) { + return $this->_data['links']; + } + + $links = $this->_atom->getLinks(); + + $this->_data['links'] = $links; + + return $this->_data['links']; + } + + /** + * Get a permalink to the entry + * + * @return string + */ + public function getPermalink() + { + return $this->getLink(0); + } + + /** + * Get the entry title + * + * @return string + */ + public function getTitle() + { + if (array_key_exists('title', $this->_data)) { + return $this->_data['title']; + } + + $title = $this->_atom->getTitle(); + + $this->_data['title'] = $title; + + return $this->_data['title']; + } + + /** + * Get the number of comments/replies for current entry + * + * @return integer + */ + public function getCommentCount() + { + if (array_key_exists('commentcount', $this->_data)) { + return $this->_data['commentcount']; + } + + $commentcount = $this->_thread->getCommentCount(); + + if (!$commentcount) { + $commentcount = $this->_atom->getCommentCount(); + } + + $this->_data['commentcount'] = $commentcount; + + return $this->_data['commentcount']; + } + + /** + * Returns a URI pointing to the HTML page where comments can be made on this entry + * + * @return string + */ + public function getCommentLink() + { + if (array_key_exists('commentlink', $this->_data)) { + return $this->_data['commentlink']; + } + + $commentlink = $this->_atom->getCommentLink(); + + $this->_data['commentlink'] = $commentlink; + + return $this->_data['commentlink']; + } + + /** + * Returns a URI pointing to a feed of all comments for this entry + * + * @return string + */ + public function getCommentFeedLink() + { + if (array_key_exists('commentfeedlink', $this->_data)) { + return $this->_data['commentfeedlink']; + } + + $commentfeedlink = $this->_atom->getCommentFeedLink(); + + $this->_data['commentfeedlink'] = $commentfeedlink; + + return $this->_data['commentfeedlink']; + } + + /** + * Set the XPath query (incl. on all Extensions) + * + * @param DOMXPath $xpath + */ + public function setXpath(DOMXPath $xpath) + { + parent::setXpath($xpath); + $this->_atom->setXpath($this->_xpath); + $this->_thread->setXpath($this->_xpath); + foreach ($this->_extensions as $extension) { + $extension->setXpath($this->_xpath); + } + } +} diff --git a/src/Reader/Entry/Interface.php b/src/Reader/Entry/Interface.php new file mode 100644 index 00000000..02df0d57 --- /dev/null +++ b/src/Reader/Entry/Interface.php @@ -0,0 +1,139 @@ +_xpathQueryRss = '//item[' . ($this->_entryKey+1) . ']'; + $this->_xpathQueryRdf = '//rss:item[' . ($this->_entryKey+1) . ']'; + + $pluginLoader = Zend_Feed_Reader::getPluginLoader(); + + $dublinCoreClass = $pluginLoader->getClassName('DublinCore_Entry'); + $this->_dc = new $dublinCoreClass($entry, $entryKey, $type); + + $contentClass = $pluginLoader->getClassName('Content_Entry'); + $this->_content = new $contentClass($entry, $entryKey, $type); + + $atomClass = $pluginLoader->getClassName('Atom_Entry'); + $this->_atom = new $atomClass($entry, $entryKey, $type); + + $wfwClass = $pluginLoader->getClassName('WellFormedWeb_Entry'); + $this->_wfw = new $wfwClass($entry, $entryKey, $type); + + $slashClass = $pluginLoader->getClassName('Slash_Entry'); + $this->_slash = new $slashClass($entry, $entryKey, $type); + + $threadClass = $pluginLoader->getClassName('Thread_Entry'); + $this->_thread = new $threadClass($entry, $entryKey, $type); + } + + /** + * Get an author entry + * + * @param DOMElement $element + * @return string + */ + public function getAuthor($index = 0) + { + $authors = $this->getAuthors(); + + if (isset($authors[$index])) { + return $authors[$index]; + } + + return null; + } + + /** + * Get an array with feed authors + * + * @return array + */ + public function getAuthors() + { + if (array_key_exists('authors', $this->_data)) { + return $this->_data['authors']; + } + + $authors = array(); + // @todo: create a list from all potential sources rather than from alternatives + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $list = $this->_xpath->evaluate($this->_xpathQueryRss.'//author'); + } else { + $list = $this->_xpath->evaluate($this->_xpathQueryRdf.'//rss:author'); + } + if (!$list->length) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $list = $this->_xpath->query('//author'); + } else { + $list = $this->_xpath->query('//rss:author'); + } + } + + if ($list->length) { + foreach ($list as $author) { + if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_20 + && preg_match("/\(([^\)]+)\)/", $author->nodeValue, $matches, PREG_OFFSET_CAPTURE) + ) { + // source name from RSS 2.0 + // format "joe@example.com (Joe Bloggs)" + $authors[] = $matches[1][0]; + } else { + $authors[] = $author->nodeValue; + } + } + + $authors = array_unique($authors); + } + + if (empty($authors)) { + $authors = $this->_dc->getAuthors(); + } + + if (empty($authors)) { + $authors = $this->_atom->getAuthors(); + } + + $this->_data['authors'] = $authors; + + return $this->_data['authors']; + } + + /** + * Get the entry content + * + * @return string + */ + public function getContent() + { + if (array_key_exists('content', $this->_data)) { + return $this->_data['content']; + } + + $content = $this->_content->getContent(); + + if (!$content) { + $content = $this->getDescription(); + } + + if (empty($content)) { + $content = $this->_atom->getContent(); + } + + $this->_data['content'] = $content; + + return $this->_data['content']; + } + + /** + * Get the entry's date of creation + * + * @return string + */ + public function getDateCreated() + { + return $this->getDateModified(); + } + + /** + * Get the entry's date of modification + * + * @return string + */ + public function getDateModified() + { + if (array_key_exists('datemodified', $this->_data)) { + return $this->_data['datemodified']; + } + + $dateModified = null; + $date = null; + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 + && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + ) { + $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) { + try { + $date->set($dateModified, Zend_Date::RFC_2822); + } catch (Zend_Date_Exception $e) { + 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): ' + . $e->getMessage() + ); + } + } + } + } + + if (!$date) { + $date = $this->_dc->getDate(); + } + + if (!$date) { + $date = $this->_atom->getDateModified(); + } + + if (!$date) { + $date = null; + } + + $this->_data['datemodified'] = $date; + + return $this->_data['datemodified']; + } + + /** + * Get the entry description + * + * @return string + */ + public function getDescription() + { + if (array_key_exists('description', $this->_data)) { + return $this->_data['description']; + } + + $description = null; + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 + && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + ) { + $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/description)'); + } else { + $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRdf.'/rss:description)'); + } + + if (!$description) { + $description = $this->_dc->getDescription(); + } + + if (empty($description)) { + $description = $this->_atom->getDescription(); + } + + if (!$description) { + $description = null; + } else { + $description = html_entity_decode($description, ENT_QUOTES, $this->getEncoding()); + } + + $this->_data['description'] = $description; + + return $this->_data['description']; + } + + /** + * Get the entry ID + * + * @return string + */ + public function getId() + { + if (array_key_exists('id', $this->_data)) { + return $this->_data['id']; + } + + $id = null; + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 + && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + ) { + $id = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/guid)'); + } + + if (!$id) { + $id = $this->_dc->getId(); + } + + if (empty($id)) { + $id = $this->_atom->getId(); + } + + if (!$id) { + if ($this->getPermalink()) { + $id = $this->getPermalink(); + } elseif ($this->getTitle()) { + $id = $this->getTitle(); + } else { + $id = null; + } + } + + $this->_data['id'] = $id; + + return $this->_data['id']; + } + + /** + * Get a specific link + * + * @param int $index + * @return string + */ + public function getLink($index = 0) + { + if (!array_key_exists('links', $this->_data)) { + $this->getLinks(); + } + + if (isset($this->_data['links'][$index])) { + return $this->_data['links'][$index]; + } + + return null; + } + + /** + * Get all links + * + * @return array + */ + public function getLinks() + { + if (array_key_exists('links', $this->_data)) { + return $this->_data['links']; + } + + $links = array(); + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $list = $this->_xpath->query($this->_xpathQueryRss.'//link'); + } else { + $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:link'); + } + + if (!$list->length) { + $links = $this->_atom->getLinks(); + } else { + foreach ($list as $link) { + $links[] = $link->nodeValue; + } + } + + $this->_data['links'] = $links; + + return $this->_data['links']; + } + + /** + * Get a permalink to the entry + * + * @return string + */ + public function getPermalink() + { + return $this->getLink(0); + } + + /** + * Get the entry title + * + * @return string + */ + public function getTitle() + { + if (array_key_exists('title', $this->_data)) { + return $this->_data['title']; + } + + $title = null; + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 + && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + ) { + $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/title)'); + } else { + $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRdf.'/rss:title)'); + } + + if (!$title) { + $title = $this->_dc->getTitle(); + } + + if (!$title) { + $title = $this->_atom->getTitle(); + } + + if (!$title) { + $title = null; + } + + $this->_data['title'] = $title; + + return $this->_data['title']; + } + + /** + * Get the number of comments/replies for current entry + * + * @return string|null + */ + public function getCommentCount() + { + if (array_key_exists('commentcount', $this->_data)) { + return $this->_data['commentcount']; + } + + $commentcount = $this->_slash->getCommentCount(); + + if (!$commentcount) { + $commentcount = $this->_thread->getCommentCount(); + } + + if (!$commentcount) { + $commentcount = $this->_atom->getCommentCount(); + } + + if (!$commentcount) { + $commentcount = null; + } + + $this->_data['commentcount'] = $commentcount; + + return $this->_data['commentcount']; + } + + /** + * Returns a URI pointing to the HTML page where comments can be made on this entry + * + * @return string + */ + public function getCommentLink() + { + if (array_key_exists('commentlink', $this->_data)) { + return $this->_data['commentlink']; + } + + $commentlink = null; + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 + && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + ) { + $commentlink = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/comments)'); + } + + if (!$commentlink) { + $commentlink = $this->_atom->getCommentLink(); + } + + if (!$commentlink) { + $commentlink = null; + } + + $this->_data['commentlink'] = $commentlink; + + return $this->_data['commentlink']; + } + + /** + * Returns a URI pointing to a feed of all comments for this entry + * + * @return string + */ + public function getCommentFeedLink() + { + if (array_key_exists('commentfeedlink', $this->_data)) { + return $this->_data['commentfeedlink']; + } + + $commentfeedlink = $this->_wfw->getCommentFeedLink(); + + if (!$commentfeedlink) { + $commentfeedlink = $this->_atom->getCommentFeedLink('rss'); + } + + if (!$commentfeedlink) { + $commentfeedlink = $this->_atom->getCommentFeedLink('rdf'); + } + + if (!$commentfeedlink) { + $commentfeedlink = null; + } + + $this->_data['commentfeedlink'] = $commentfeedlink; + + return $this->_data['commentfeedlink']; + } + + /** + * Set the XPath query (incl. on all Extensions) + * + * @param DOMXPath $xpath + */ + public function setXpath(DOMXPath $xpath) + { + parent::setXpath($xpath); + $this->_dc->setXpath($this->_xpath); + $this->_content->setXpath($this->_xpath); + $this->_atom->setXpath($this->_xpath); + $this->_slash->setXpath($this->_xpath); + $this->_wfw->setXpath($this->_xpath); + $this->_thread->setXpath($this->_xpath); + foreach ($this->_extensions as $extension) { + $extension->setXpath($this->_xpath); + } + } +} diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php new file mode 100644 index 00000000..2f3423b5 --- /dev/null +++ b/src/Reader/Extension/Atom/Entry.php @@ -0,0 +1,479 @@ +getAuthors(); + + if (isset($authors[$index])) { + return $authors[$index]; + } + + return null; + } + + /** + * Get an array with feed authors + * + * @return array + */ + public function getAuthors() + { + if (array_key_exists('authors', $this->_data)) { + return $this->_data['authors']; + } + + $authors = $this->_xpath->query( + $this->getXpathPrefix() . '//atom:author' . '|' + . $this->getXpathPrefix(). '//atom:contributor' + ); + + if (!$authors->length) { + $authors = $this->_xpath->query( + '//atom:author' . '|' . '//atom:contributor' + ); + } + + $people = array(); + + if ($authors->length) { + foreach ($authors as $author) { + $author = $this->_getAuthor($author); + + if (!empty($author)) { + $people[] = $author; + } + } + } + + $people = array_unique($people); + + $this->_data['authors'] = $people; + + return $this->_data['authors']; + } + + /** + * Get the entry content + * + * @return string + */ + public function getContent() + { + if (array_key_exists('content', $this->_data)) { + return $this->_data['content']; + } + + $content = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:content)'); + + if ($content) { + $content = html_entity_decode($content, ENT_QUOTES, $this->getEncoding()); + } + + if (!$content) { + $content = $this->getDescription(); + } + + $this->_data['content'] = $content; + + return $this->_data['content']; + } + + /** + * Get the entry creation date + * + * @return string + */ + public function getDateCreated() + { + if (array_key_exists('datecreated', $this->_data)) { + return $this->_data['datecreated']; + } + + $date = null; + + if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { + $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:created)'); + } else { + $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:published)'); + } + + if ($dateCreated) { + $date = new Zend_Date; + $date->set($dateCreated, Zend_Date::ISO_8601); + } + + $this->_data['datecreated'] = $date; + + return $this->_data['datecreated']; + } + + /** + * Get the entry modification date + * + * @return string + */ + public function getDateModified() + { + if (array_key_exists('datemodified', $this->_data)) { + return $this->_data['datemodified']; + } + + $date = null; + + if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { + $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)'); + } else { + $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)'); + } + + if ($dateModified) { + $date = new Zend_Date; + $date->set($dateModified, Zend_Date::ISO_8601); + } + + $this->_data['datemodified'] = $date; + + return $this->_data['datemodified']; + } + + /** + * Get the entry description + * + * @return string + */ + public function getDescription() + { + if (array_key_exists('description', $this->_data)) { + return $this->_data['description']; + } + + $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:summary)'); + + if (!$description) { + $description = null; + } else { + $description = html_entity_decode($description, ENT_QUOTES, $this->getEncoding()); + } + + $this->_data['description'] = $description; + + return $this->_data['description']; + } + + /** + * Get the entry ID + * + * @return string + */ + public function getId() + { + if (array_key_exists('id', $this->_data)) { + return $this->_data['id']; + } + + $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:id)'); + + if (!$id) { + if ($this->getPermalink()) { + $id = $this->getPermalink(); + } elseif ($this->getTitle()) { + $id = $this->getTitle(); + } else { + $id = null; + } + } + + $this->_data['id'] = $id; + + return $this->_data['id']; + } + + /** + * Get a specific link + * + * @param int $index + * @return string + */ + public function getLink($index = 0) + { + if (!array_key_exists('links', $this->_data)) { + $this->getLinks(); + } + + if (isset($this->_data['links'][$index])) { + return $this->_data['links'][$index]; + } + + return null; + } + + /** + * Get all links + * + * @return array + */ + public function getLinks() + { + if (array_key_exists('links', $this->_data)) { + return $this->_data['links']; + } + + $links = array(); + + $list = $this->_xpath->query( + $this->getXpathPrefix() . '//atom:link[@rel="alternate"]/@href' . '|' . + $this->getXpathPrefix() . '//atom:link[not(@rel)]/@href' + ); + + if ($list->length) { + foreach ($list as $link) { + $links[] = $link->value; + } + } + + $this->_data['links'] = $links; + + return $this->_data['links']; + } + + /** + * Get a permalink to the entry + * + * @return string + */ + public function getPermalink() + { + return $this->getLink(0); + } + + /** + * Get the entry title + * + * @return string + */ + public function getTitle() + { + if (array_key_exists('title', $this->_data)) { + return $this->_data['title']; + } + + $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:title)'); + + if (!$title) { + $title = null; + } else { + $title = html_entity_decode($title, ENT_QUOTES, $this->getEncoding()); + } + + $this->_data['title'] = $title; + + return $this->_data['title']; + } + + /** + * Get the number of comments/replies for current entry + * + * @return integer + */ + public function getCommentCount() + { + if (array_key_exists('commentcount', $this->_data)) { + return $this->_data['commentcount']; + } + + $count = null; + + $this->_xpath->registerNamespace('thread10', 'http://purl.org/syndication/thread/1.0'); + $list = $this->_xpath->query( + $this->getXpathPrefix() . '//atom:link[@rel="replies"]/@thread10:count' + ); + + if ($list->length) { + $count = $list->item(0)->value; + } + + $this->_data['commentcount'] = $count; + + return $this->_data['commentcount']; + } + + /** + * Returns a URI pointing to the HTML page where comments can be made on this entry + * + * @return string + */ + public function getCommentLink() + { + if (array_key_exists('commentlink', $this->_data)) { + return $this->_data['commentlink']; + } + + $link = null; + + $list = $this->_xpath->query( + $this->getXpathPrefix() . '//atom:link[@rel="replies" and @type="text/html"]/@href' + ); + + if ($list->length) { + $link = $list->item(0)->value; + } + + $this->_data['commentlink'] = $link; + + return $this->_data['commentlink']; + } + + /** + * Returns a URI pointing to a feed of all comments for this entry + * + * @return string + */ + public function getCommentFeedLink($type = 'atom') + { + if (array_key_exists('commentfeedlink', $this->_data)) { + return $this->_data['commentfeedlink']; + } + + $link = null; + + $list = $this->_xpath->query( + $this->getXpathPrefix() . '//atom:link[@rel="replies" and @type="application/'.$type.'+xml"]/@href' + ); + + if ($list->length) { + $link = $list->item(0)->value; + } + + $this->_data['commentfeedlink'] = $link; + + return $this->_data['commentfeedlink']; + } + + /** + * Get an author entry + * + * @param DOMElement $element + * @return string + */ + protected function _getAuthor(DOMElement $element) + { + $email = null; + $name = null; + $uri = null; + + $emailNode = $element->getElementsByTagName('email'); + $nameNode = $element->getElementsByTagName('name'); + $uriNode = $element->getElementsByTagName('uri'); + + if ($emailNode->length) { + $email = $emailNode->item(0)->nodeValue; + } + + if ($nameNode->length) { + $name = $nameNode->item(0)->nodeValue; + } + + if ($uriNode->length) { + $uri = $uriNode->item(0)->nodeValue; + } + + if (!empty($email)) { + return $email . (empty($name) ? '' : ' (' . $name . ')'); + } else if (!empty($name)) { + return $name; + } else if (!empty($uri)) { + return $uri; + } + + return null; + } + + /** + * Register the default namespaces for the current feed format + */ + protected function _registerNamespaces() + { + if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 + || $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03 + ) { + return; // pre-registered at Feed level + } + $atomDetected = $this->_getAtomType(); + switch ($atomDetected) { + case Zend_Feed_Reader::TYPE_ATOM_03: + $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03); + break; + default: + $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10); + break; + } + } + + /** + * Detect the presence of any Atom namespaces in use + */ + protected function _getAtomType() + { + $nslist = $this->getDomDocument()->documentElement->attributes; + if (!$nslist->length) { + return null; + } + foreach ($nslist as $ns) { + if ($ns->value == Zend_Feed_Reader::NAMESPACE_ATOM_10) { + return Zend_Feed_Reader::TYPE_ATOM_10; + } + if ($ns->value == Zend_Feed_Reader::NAMESPACE_ATOM_03) { + return Zend_Feed_Reader::TYPE_ATOM_03; + } + } + } +} diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php new file mode 100644 index 00000000..b9f03e46 --- /dev/null +++ b/src/Reader/Extension/Atom/Feed.php @@ -0,0 +1,441 @@ +getAuthors(); + + if (isset($authors[$index])) { + return $authors[$index]; + } + + return null; + } + + /** + * Get an array with feed authors + * + * @return array + */ + public function getAuthors() + { + if (array_key_exists('authors', $this->_data)) { + return $this->_data['authors']; + } + + $authors = $this->_xpath->query('//atom:author'); + $contributors = $this->_xpath->query('//atom:contributor'); + + $people = array(); + + if ($authors->length) { + foreach ($authors as $author) { + $author = $this->_getAuthor($author); + + if (!empty($author)) { + $people[] = $author; + } + } + } + + if ($contributors->length) { + foreach ($contributors as $contributor) { + $contributor = $this->_getAuthor($contributor); + + if (!empty($contributor)) { + $people[] = $contributor; + } + } + } + + if (empty($people)) { + $people = null; + } else { + $people = array_unique($people); + } + + $this->_data['authors'] = $people; + + return $this->_data['authors']; + } + + /** + * Get the copyright entry + * + * @return string|null + */ + public function getCopyright() + { + if (array_key_exists('copyright', $this->_data)) { + return $this->_data['copyright']; + } + + $copyright = null; + + if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { + $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:copyright)'); + } else { + $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:rights)'); + } + + if (!$copyright) { + $copyright = null; + } + + $this->_data['copyright'] = $copyright; + + return $this->_data['copyright']; + } + + /** + * Get the feed creation date + * + * @return Zend_Date|null + */ + public function getDateCreated() + { + if (array_key_exists('datecreated', $this->_data)) { + return $this->_data['datecreated']; + } + + $date = null; + + if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { + $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:created)'); + } else { + $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:published)'); + } + + if ($dateCreated) { + $date = new Zend_Date; + $date->set($dateCreated, Zend_Date::ISO_8601); + } + + $this->_data['datecreated'] = $date; + + return $this->_data['datecreated']; + } + + /** + * Get the feed modification date + * + * @return Zend_Date|null + */ + public function getDateModified() + { + if (array_key_exists('datemodified', $this->_data)) { + return $this->_data['datemodified']; + } + + $date = null; + + if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { + $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)'); + } else { + $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)'); + } + + if ($dateModified) { + $date = new Zend_Date; + $date->set($dateModified, Zend_Date::ISO_8601); + } + + $this->_data['datemodified'] = $date; + + return $this->_data['datemodified']; + } + + /** + * Get the feed description + * + * @return string|null + */ + public function getDescription() + { + if (array_key_exists('description', $this->_data)) { + return $this->_data['description']; + } + + $description = null; + + if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { + $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:tagline)'); // TODO: Is this the same as subtitle? + } else { + $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:subtitle)'); + } + + if (!$description) { + $description = null; + } + + $this->_data['description'] = $description; + + return $this->_data['description']; + } + + /** + * Get the feed generator entry + * + * @return string|null + */ + public function getGenerator() + { + if (array_key_exists('generator', $this->_data)) { + return $this->_data['generator']; + } + // TODO: Add uri support + $generator = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:generator)'); + + if (!$generator) { + $generator = null; + } else { + $generator = html_entity_decode($generator, ENT_QUOTES, $this->getEncoding()); + } + + $this->_data['generator'] = $generator; + + return $this->_data['generator']; + } + + /** + * Get the feed ID + * + * @return string|null + */ + public function getId() + { + if (array_key_exists('id', $this->_data)) { + return $this->_data['id']; + } + + $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:id)'); + + if (!$id) { + if ($this->getLink()) { + $id = $this->getLink(); + } elseif ($this->getTitle()) { + $id = $this->getTitle(); + } else { + $id = null; + } + } + + $this->_data['id'] = $id; + + return $this->_data['id']; + } + + /** + * Get the feed language + * + * @return string|null + */ + public function getLanguage() + { + if (array_key_exists('language', $this->_data)) { + return $this->_data['language']; + } + + $language = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:lang)'); + + if (!$language) { + $language = $this->_xpath->evaluate('string(//@xml:lang[1])'); + } + + if (!$language) { + $language = null; + } + + $this->_data['language'] = $language; + + return $this->_data['language']; + } + + /** + * Get a link to the source website + * + * @return string|null + */ + public function getLink() + { + if (array_key_exists('link', $this->_data)) { + return $this->_data['link']; + } + + $link = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:link/@href)'); + + if (!$link) { + $link = null; + } + + $this->_data['link'] = $link; + + return $this->_data['link']; + } + + /** + * Get a link to the feed's XML Url + * + * @return string|null + */ + public function getFeedLink() + { + if (array_key_exists('feedlink', $this->_data)) { + return $this->_data['feedlink']; + } + + $link = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:link[@rel="self"]/@href)'); + + if (!$link) { + $link = null; + } + + $this->_data['feedlink'] = $link; + + return $this->_data['feedlink']; + } + + /** + * Get the feed title + * + * @return string|null + */ + public function getTitle() + { + if (array_key_exists('title', $this->_data)) { + return $this->_data['title']; + } + + $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:title)'); + + if (!$title) { + $title = null; + } + + $this->_data['title'] = $title; + + return $this->_data['title']; + } + + /** + * Get an author entry in RSS format + * + * @param DOMElement $element + * @return string + */ + protected function _getAuthor(DOMElement $element) + { + $email = null; + $name = null; + $uri = null; + + $emailNode = $element->getElementsByTagName('email'); + $nameNode = $element->getElementsByTagName('name'); + $uriNode = $element->getElementsByTagName('uri'); + + if ($emailNode->length) { + $email = $emailNode->item(0)->nodeValue; + } + + if ($nameNode->length) { + $name = $nameNode->item(0)->nodeValue; + } + + if ($uriNode->length) { + $uri = $uriNode->item(0)->nodeValue; + } + + if (!empty($email)) { + return $email . (empty($name) ? '' : ' (' . $name . ')'); + } else if (!empty($name)) { + return $name; + } else if (!empty($uri)) { + return $uri; + } + + return null; + } + + /** + * Register the default namespaces for the current feed format + */ + protected function _registerNamespaces() + { + if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 + || $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03 + ) { + return; // pre-registered at Feed level + } + $atomDetected = $this->_getAtomType(); + switch ($atomDetected) { + case Zend_Feed_Reader::TYPE_ATOM_03: + $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03); + break; + default: + $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10); + break; + } + } + + /** + * Detect the presence of any Atom namespaces in use + */ + protected function _getAtomType() + { + $nslist = $this->getDomDocument()->documentElement->attributes; + if (!$nslist->length) { + return null; + } + foreach ($nslist as $ns) { + if ($ns->value == Zend_Feed_Reader::NAMESPACE_ATOM_10) { + return Zend_Feed_Reader::TYPE_ATOM_10; + } + if ($ns->value == Zend_Feed_Reader::NAMESPACE_ATOM_03) { + return Zend_Feed_Reader::TYPE_ATOM_03; + } + } + } +} diff --git a/src/Reader/Extension/Content/Entry.php b/src/Reader/Extension/Content/Entry.php new file mode 100644 index 00000000..14e18322 --- /dev/null +++ b/src/Reader/Extension/Content/Entry.php @@ -0,0 +1,64 @@ +getType() !== Zend_Feed_Reader::TYPE_RSS_10 + && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + ) { + $content = $this->_xpath->evaluate('string('.$this->getXpathPrefix().'/content:encoded)'); + } else { + $content = $this->_xpath->evaluate('string('.$this->getXpathPrefix().'/content:encoded)'); + } + if ($content) { + $content = html_entity_decode($content, ENT_QUOTES, $this->getEncoding()); + } + return $content; + } + + /** + * Register RSS Content Module namespace + */ + protected function _registerNamespaces() + { + $this->_xpath->registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/'); + } +} diff --git a/src/Reader/Extension/CreativeCommons/Entry.php b/src/Reader/Extension/CreativeCommons/Entry.php new file mode 100644 index 00000000..e754e762 --- /dev/null +++ b/src/Reader/Extension/CreativeCommons/Entry.php @@ -0,0 +1,97 @@ +getLicenses(); + + if (isset($licenses[$index])) { + return $licenses[$index]; + } + + return null; + } + + /** + * Get the entry licenses + * + * @return array + */ + public function getLicenses() + { + $name = 'licenses'; + if (array_key_exists($name, $this->_data)) { + return $this->_data[$name]; + } + + $licenses = array(); + $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//cc:license'); + + if ($list->length) { + foreach ($list as $license) { + $licenses[] = $license->nodeValue; + } + + $licenses = array_unique($licenses); + } else { + $cc = new Zend_Feed_Reader_Extension_CreativeCommons_Feed( + $this->_domDocument, $this->_data['type'], $this->_xpath + ); + $licenses = $cc->getLicenses(); + } + + $this->_data[$name] = $licenses; + + return $this->_data[$name]; + } + + /** + * Register Creative Commons namespaces + * + */ + protected function _registerNamespaces() + { + $this->_xpath->registerNamespace('cc', 'http://backend.userland.com/creativeCommonsRssModule'); + } +} diff --git a/src/Reader/Extension/CreativeCommons/Feed.php b/src/Reader/Extension/CreativeCommons/Feed.php new file mode 100644 index 00000000..67042518 --- /dev/null +++ b/src/Reader/Extension/CreativeCommons/Feed.php @@ -0,0 +1,89 @@ +getLicenses(); + + if (isset($licenses[$index])) { + return $licenses[$index]; + } + + return null; + } + + /** + * Get the entry licenses + * + * @return array + */ + public function getLicenses() + { + $name = 'licenses'; + if (array_key_exists($name, $this->_data)) { + return $this->_data[$name]; + } + + $licenses = array(); + $list = $this->_xpath->evaluate('channel/cc:license'); + + if ($list->length) { + foreach ($list as $license) { + $licenses[] = $license->nodeValue; + } + + $licenses = array_unique($licenses); + } + + $this->_data[$name] = $licenses; + + return $this->_data[$name]; + } + + /** + * Register Creative Commons namespaces + * + * @return void + */ + protected function _registerNamespaces() + { + $this->_xpath->registerNamespace('cc', 'http://backend.userland.com/creativeCommonsRssModule'); + } +} diff --git a/src/Reader/Extension/DublinCore/Entry.php b/src/Reader/Extension/DublinCore/Entry.php new file mode 100644 index 00000000..441d0e58 --- /dev/null +++ b/src/Reader/Extension/DublinCore/Entry.php @@ -0,0 +1,232 @@ +getAuthors(); + + if (isset($authors[$index])) { + return $authors[$index]; + } + + return null; + } + + /** + * Get an array with feed authors + * + * @return array + */ + public function getAuthors() + { + if (array_key_exists('authors', $this->_data)) { + return $this->_data['authors']; + } + + $authors = array(); + $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc11:creator'); + + if (!$list->length) { + $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc10:creator'); + } + if (!$list->length) { + $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc11:publisher'); + + if (!$list->length) { + $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc10:publisher'); + } + } + + if ($list->length) { + foreach ($list as $author) { + if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_20 + && preg_match("/\(([^\)]+)\)/", $author->nodeValue, $matches, PREG_OFFSET_CAPTURE) + ) { + $authors[] = $matches[1][0]; + } else { + $authors[] = $author->nodeValue; + } + } + + $authors = array_unique($authors); + } + + $this->_data['authors'] = $authors; + + return $this->_data['authors']; + } + + /** + * Get the entry content + * + * @return string + */ + public function getContent() + { + return $this->getDescription(); + } + + /** + * Get the entry description + * + * @return string + */ + public function getDescription() + { + if (array_key_exists('description', $this->_data)) { + return $this->_data['description']; + } + + $description = null; + $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:description)'); + + if (!$description) { + $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:description)'); + } + + if (!$description) { + $description = null; + } + + $this->_data['description'] = $description; + + return $this->_data['description']; + } + + /** + * Get the entry ID + * + * @return string + */ + public function getId() + { + if (array_key_exists('id', $this->_data)) { + return $this->_data['id']; + } + + $id = null; + $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:identifier)'); + + if (!$id) { + $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:identifier)'); + } + + $this->_data['id'] = $id; + + return $this->_data['id']; + } + + /** + * Get the entry title + * + * @return string + */ + public function getTitle() + { + if (array_key_exists('title', $this->_data)) { + return $this->_data['title']; + } + + $title = null; + $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:title)'); + + if (!$title) { + $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:title)'); + } + + if (!$title) { + $title = null; + } + + $this->_data['title'] = $title; + + return $this->_data['title']; + } + + /** + * + * + * @return Zend_Date|null + */ + public function getDate() + { + if (array_key_exists('date', $this->_data)) { + return $this->_data['date']; + } + + $d = null; + $date = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:date)'); + + if (!$date) { + $date = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:date)'); + } + + if ($date) { + $d = new Zend_Date; + $d->set($date, Zend_Date::ISO_8601); + } + + $this->_data['date'] = $d; + + return $this->_data['date']; + } + + /** + * Register DC namespaces + * + * @return void + */ + protected function _registerNamespaces() + { + $this->_xpath->registerNamespace('dc10', 'http://purl.org/dc/elements/1.0/'); + $this->_xpath->registerNamespace('dc11', 'http://purl.org/dc/elements/1.1/'); + } +} diff --git a/src/Reader/Extension/DublinCore/Feed.php b/src/Reader/Extension/DublinCore/Feed.php new file mode 100644 index 00000000..6ba99c25 --- /dev/null +++ b/src/Reader/Extension/DublinCore/Feed.php @@ -0,0 +1,265 @@ +getAuthors(); + + if (isset($authors[$index])) { + return $authors[$index]; + } + + return null; + } + + /** + * Get an array with feed authors + * + * @return array + */ + public function getAuthors() + { + if (array_key_exists('authors', $this->_data)) { + return $this->_data['authors']; + } + + $authors = array(); + $list = $this->_xpath->query('//dc11:creator'); + + if (!$list->length) { + $list = $this->_xpath->query('//dc10:creator'); + } + if (!$list->length) { + $list = $this->_xpath->query('//dc11:publisher'); + + if (!$list->length) { + $list = $this->_xpath->query('//dc10:publisher'); + } + } + + foreach ($list as $authorObj) { + $authors[] = $authorObj->nodeValue; + } + + if (!empty($authors)) { + $authors = array_unique($authors); + } + + $this->_data['authors'] = $authors; + + return $this->_data['authors']; + } + + /** + * Get the copyright entry + * + * @return string|null + */ + public function getCopyright() + { + if (array_key_exists('copyright', $this->_data)) { + return $this->_data['copyright']; + } + + $copyright = null; + $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:rights)'); + + if (!$copyright) { + $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:rights)'); + } + + if (!$copyright) { + $copyright = null; + } + + $this->_data['copyright'] = $copyright; + + return $this->_data['copyright']; + } + + /** + * Get the feed description + * + * @return string|null + */ + public function getDescription() + { + if (array_key_exists('description', $this->_data)) { + return $this->_data['description']; + } + + $description = null; + $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:description)'); + + if (!$description) { + $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:description)'); + } + + if (!$description) { + $description = null; + } + + $this->_data['description'] = $description; + + return $this->_data['description']; + } + + /** + * Get the feed ID + * + * @return string|null + */ + public function getId() + { + if (array_key_exists('id', $this->_data)) { + return $this->_data['id']; + } + + $id = null; + $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:identifier)'); + + if (!$id) { + $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:identifier)'); + } + + $this->_data['id'] = $id; + + return $this->_data['id']; + } + + /** + * Get the feed language + * + * @return string|null + */ + public function getLanguage() + { + if (array_key_exists('language', $this->_data)) { + return $this->_data['language']; + } + + $language = null; + $language = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:language)'); + + if (!$language) { + $language = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:language)'); + } + + if (!$language) { + $language = null; + } + + $this->_data['language'] = $language; + + return $this->_data['language']; + } + + /** + * Get the feed title + * + * @return string|null + */ + public function getTitle() + { + if (array_key_exists('title', $this->_data)) { + return $this->_data['title']; + } + + $title = null; + $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:title)'); + + if (!$title) { + $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:title)'); + } + + if (!$title) { + $title = null; + } + + $this->_data['title'] = $title; + + return $this->_data['title']; + } + + /** + * + * + * @return Zend_Date|null + */ + public function getDate() + { + if (array_key_exists('date', $this->_data)) { + return $this->_data['date']; + } + + $d = null; + $date = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:date)'); + + if (!$date) { + $date = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:date)'); + } + + if ($date) { + $d = new Zend_Date; + $d->set($date, Zend_Date::ISO_8601); + } + + $this->_data['date'] = $d; + + return $this->_data['date']; + } + + /** + * Register the default namespaces for the current feed format + * + * @return void + */ + protected function _registerNamespaces() + { + $this->_xpath->registerNamespace('dc10', 'http://purl.org/dc/elements/1.0/'); + $this->_xpath->registerNamespace('dc11', 'http://purl.org/dc/elements/1.1/'); + } +} diff --git a/src/Reader/Extension/EntryAbstract.php b/src/Reader/Extension/EntryAbstract.php new file mode 100644 index 00000000..249259e7 --- /dev/null +++ b/src/Reader/Extension/EntryAbstract.php @@ -0,0 +1,197 @@ +_entry = $entry; + $this->_entryKey = $entryKey; + $this->_domDocument = $entry->ownerDocument; + + if (!is_null($type)) { + $this->_data['type'] = $type; + } else { + $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 + || $this->getType() == Zend_Feed_Reader::TYPE_RSS_090 + ) { + $this->setXpathPrefix('//rss:item[' . ($this->_entryKey+1) . ']'); + } elseif ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 + || $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03 + ) { + $this->setXpathPrefix('//atom:entry[' . ($this->_entryKey+1) . ']'); + } else { + $this->setXpathPrefix('//item[' . ($this->_entryKey+1) . ']'); + } + } + + /** + * Get the DOM + * + * @return DOMDocument + */ + public function getDomDocument() + { + return $this->_domDocument; + } + + /** + * Get the Entry's encoding + * + * @return string + */ + public function getEncoding() + { + $assumed = $this->getDomDocument()->encoding; + return $assumed; + } + + /** + * Get the entry type + * + * @return string + */ + public function getType() + { + return $this->_data['type']; + } + + /** + * Set the XPath query + * + * @param DOMXPath $xpath + * @return Zend_Feed_Reader_Extension_EntryAbstract + */ + public function setXpath(DOMXPath $xpath) + { + $this->_xpath = $xpath; + $this->_registerNamespaces(); + return $this; + } + + /** + * Get the XPath query object + * + * @return DOMXPath + */ + public function getXpath() + { + return $this->_xpath; + } + + /** + * Serialize the entry to an array + * + * @return array + */ + public function toArray() + { + return $this->_data; + } + + /** + * Get the XPath prefix + * + * @return string + */ + public function getXpathPrefix() + { + return $this->_xpathPrefix; + } + + /** + * Set the XPath prefix + * + * @param string $prefix + * @return Zend_Feed_Reader_Extension_EntryAbstract + */ + public function setXpathPrefix($prefix) + { + $this->_xpathPrefix = $prefix; + return $this; + } + + /** + * Register XML namespaces + * + * @return void + */ + protected abstract function _registerNamespaces(); +} diff --git a/src/Reader/Extension/FeedAbstract.php b/src/Reader/Extension/FeedAbstract.php new file mode 100644 index 00000000..c82e8ae0 --- /dev/null +++ b/src/Reader/Extension/FeedAbstract.php @@ -0,0 +1,166 @@ +_domDocument = $dom; + + if ($type !== null) { + $this->_data['type'] = $type; + } else { + $this->_data['type'] = Zend_Feed_Reader::detectType($dom); + } + + if ($xpath !== null) { + $this->_xpath = $xpath; + } else { + $this->_xpath = new DOMXPath($this->_domDocument); + } + + $this->_registerNamespaces(); + } + + /** + * Get the DOM + * + * @return DOMDocument + */ + public function getDomDocument() + { + return $this->_domDocument; + } + + /** + * Get the Feed's encoding + * + * @return string + */ + public function getEncoding() + { + $assumed = $this->getDomDocument()->encoding; + return $assumed; + } + + /** + * Get the feed type + * + * @return string + */ + public function getType() + { + return $this->_data['type']; + } + + + /** + * Return the feed as an array + * + * @return array + */ + public function toArray() // untested + { + return $this->_data; + } + + /** + * Get the XPath prefix + * + * @return string + */ + public function getXpathPrefix() + { + return $this->_xpathPrefix; + } + + /** + * Set the XPath prefix + * + * @return Zend_Feed_Reader_Feed_Atom + */ + public function setXpathPrefix($prefix) + { + $this->_xpathPrefix = $prefix; + } + + /** + * Register the default namespaces for the current feed format + */ + abstract protected function _registerNamespaces(); +} diff --git a/src/Reader/Extension/Slash/Entry.php b/src/Reader/Extension/Slash/Entry.php new file mode 100644 index 00000000..5556db1a --- /dev/null +++ b/src/Reader/Extension/Slash/Entry.php @@ -0,0 +1,144 @@ +_getData('section'); + } + + /** + * Get the entry department + * + * @return string|null + */ + public function getDepartment() + { + return $this->_getData('department'); + } + + /** + * Get the entry hit_parade + * + * @return array + */ + public function getHitParade() + { + $name = 'hit_parade'; + + if (isset($this->_data[$name])) { + return $this->_data[$name]; + } + + $stringParade = $this->_getData($name); + $hitParade = array(); + + if (!empty($stringParade)) { + $stringParade = explode(',', $stringParade); + + foreach ($stringParade as $hit) + $hitParade[] = $hit + 0; //cast to integer + } + + $this->_data[$name] = $hitParade; + return $hitParade; + } + + /** + * Get the entry comments + * + * @return int + */ + public function getCommentCount() + { + $name = 'comments'; + + if (isset($this->_data[$name])) { + return $this->_data[$name]; + } + + $comments = $this->_getData($name, 'string'); + + if (!$comments) { + $this->_data[$name] = null; + return $this->_data[$name]; + } + + return $comments; + } + + /** + * Get the entry data specified by name + * @param string $name + * @param string $type + * + * @return mixed|null + */ + protected function _getData($name, $type = 'string') + { + if (array_key_exists($name, $this->_data)) { + return $this->_data[$name]; + } + + $data = $this->_xpath->evaluate($type . '(' . $this->getXpathPrefix() . '/slash10:' . $name . ')'); + + if (!$data) { + $data = null; + } + + $this->_data[$name] = $data; + + return $data; + } + + /** + * Register Slash namespaces + * + * @return void + */ + protected function _registerNamespaces() + { + $this->_xpath->registerNamespace('slash10', 'http://purl.org/rss/1.0/modules/slash/'); + } +} diff --git a/src/Reader/Extension/Syndication/Feed.php b/src/Reader/Extension/Syndication/Feed.php new file mode 100644 index 00000000..22223d79 --- /dev/null +++ b/src/Reader/Extension/Syndication/Feed.php @@ -0,0 +1,168 @@ +_getData($name); + + if ($period === null) { + $this->_data[$name] = 'daily'; + return 'daily'; //Default specified by spec + } + + switch ($period) + { + case 'hourly': + case 'daily': + case 'weekly': + case 'yearly': + return $period; + default: + throw new Zend_Feed_Exception("Feed specified invalid update period: '$period'." + . " Must be one of hourly, daily, weekly or yearly" + ); + } + } + + /** + * Get update frequency + * @return int + */ + public function getUpdateFrequency() + { + $name = 'updateFrequency'; + $freq = $this->_getData($name, 'number'); + + if (!$freq || $freq < 1) { + $this->_data[$name] = 1; + return 1; + } + + return $freq; + } + + /** + * Get update frequency as ticks + * @return int + */ + public function getUpdateFrequencyAsTicks() + { + $name = 'updateFrequency'; + $freq = $this->_getData($name, 'number'); + + if (!$freq || $freq < 1) { + $this->_data[$name] = 1; + $freq = 1; + } + + $period = $this->getUpdatePeriod(); + $ticks = 1; + + switch ($period) + { + //intentional fall through + case 'yearly': + $ticks *= 52; //TODO: fix generalisation, how? + case 'weekly': + $ticks *= 7; + case 'daily': + $ticks *= 24; + case 'hourly': + $ticks *= 3600; + break; + default: //Never arrive here, exception thrown in getPeriod() + break; + } + + return $ticks / $freq; + } + + /** + * Get update base + * + * @return Zend_Date|null + */ + public function getUpdateBase() + { + $updateBase = $this->_getData('updateBase'); + $date = null; + if ($updateBase) { + $date = new Zend_Date; + $date->set($updateBase, Zend_Date::W3C); + } + return $date; + } + + /** + * Get the entry data specified by name + * + * @param string $name + * @param string $type + * @return mixed|null + */ + private function _getData($name, $type = 'string') + { + if (array_key_exists($name, $this->_data)) { + return $this->_data[$name]; + } + + $data = $this->_xpath->evaluate($type . '(' . $this->getXpathPrefix() . '/syn10:' . $name . ')'); + + if (!$data) { + $data = null; + } + + $this->_data[$name] = $data; + + return $data; + } + + /** + * Register Syndication namespaces + * + * @return void + */ + protected function _registerNamespaces() + { + $this->_xpath->registerNamespace('syn10', 'http://purl.org/rss/1.0/modules/syndication/'); + } +} diff --git a/src/Reader/Extension/Thread/Entry.php b/src/Reader/Extension/Thread/Entry.php new file mode 100644 index 00000000..6f32a8a8 --- /dev/null +++ b/src/Reader/Extension/Thread/Entry.php @@ -0,0 +1,91 @@ +_getData('total'); + } + + /** + * Get the entry data specified by name + * + * @param string $name + * @param string $type + * @return mixed|null + */ + protected function _getData($name) + { + if (array_key_exists($name, $this->_data)) { + return $this->_data[$name]; + } + + $data = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/thread10:' . $name . ')'); + + if (!$data) { + $data = null; + } + + $this->_data[$name] = $data; + + return $data; + } + + /** + * Register Atom Thread Extension 1.0 namespace + * + * @return void + */ + protected function _registerNamespaces() + { + $this->_xpath->registerNamespace('thread10', 'http://purl.org/syndication/thread/1.0'); + } +} diff --git a/src/Reader/Extension/WellFormedWeb/Entry.php b/src/Reader/Extension/WellFormedWeb/Entry.php new file mode 100644 index 00000000..e3ef613c --- /dev/null +++ b/src/Reader/Extension/WellFormedWeb/Entry.php @@ -0,0 +1,73 @@ +_data)) { + return $this->_data[$name]; + } + + $data = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/wfw:' . $name . ')'); + + if (!$data) { + $data = null; + } + + $this->_data[$name] = $data; + + return $data; + } + + /** + * Register Slash namespaces + * + * @return void + */ + protected function _registerNamespaces() + { + $this->_xpath->registerNamespace('wfw', 'http://wellformedweb.org/CommentAPI/'); + } +} diff --git a/src/Reader/Feed/Abstract.php b/src/Reader/Feed/Abstract.php new file mode 100644 index 00000000..181e20df --- /dev/null +++ b/src/Reader/Feed/Abstract.php @@ -0,0 +1,260 @@ +_domDocument = $domDocument; + $this->_xpath = new DOMXPath($this->_domDocument); + + if ($type !== null) { + $this->_data['type'] = $type; + } else { + $this->_data['type'] = Zend_Feed_Reader::detectType($this->_domDocument); + } + $this->_registerNamespaces(); + $this->_indexEntries(); + $this->_loadExtensions(); + } + + /** + * Get the number of feed entries. + * Required by the Iterator interface. + * + * @return int + */ + public function count() + { + return count($this->_entries); + } + + /** + * Return the current entry + * + * @return Zend_Feed_Reader_Entry_Interface + */ + public function current() + { + if (substr($this->getType(), 0, 3) == 'rss') { + $reader = new Zend_Feed_Reader_Entry_Rss($this->_entries[$this->key()], $this->key(), $this->getType()); + } else { + $reader = new Zend_Feed_Reader_Entry_Atom($this->_entries[$this->key()], $this->key(), $this->getType()); + } + + $reader->setXpath($this->_xpath); + + return $reader; + } + + /** + * Get the DOM + * + * @return DOMDocument + */ + public function getDomDocument() + { + return $this->_domDocument; + } + + /** + * Get the Feed's encoding + * + * @return string + */ + public function getEncoding() + { + $assumed = $this->getDomDocument()->encoding; + return $assumed; + } + + /** + * Get the feed type + * + * @return string + */ + public function getType() + { + return $this->_data['type']; + } + + /** + * Return the current feed key + * + * @return unknown + */ + public function key() + { + return $this->_entriesKey; + } + + /** + * Move the feed pointer forward + * + */ + public function next() + { + ++$this->_entriesKey; + } + + /** + * Reset the pointer in the feed object + * + */ + public function rewind() + { + $this->_entriesKey = 0; + } + + /** + * Return the feed as an array + * + * @return array + */ + public function toArray() // untested + { + return $this->_data; + } + + /** + * Check to see if the iterator is still valid + * + * @return boolean + */ + public function valid() + { + return 0 <= $this->_entriesKey && $this->_entriesKey < $this->count(); + } + + public function getExtensions() + { + return $this->_extensions; + } + + public function __call($method, $args) + { + foreach ($this->_extensions as $extension) { + if (method_exists($extension, $method)) { + return call_user_func_array(array($extension, $method), $args); + } + } + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Method: ' . $method + . 'does not exist and could not be located on a registered Extension'); + } + + protected function _loadExtensions() + { + $all = Zend_Feed_Reader::getExtensions(); + $feed = $all['feed']; + foreach ($feed as $extension) { + if (in_array($extension, $all['core'])) { + continue; + } + $className = Zend_Feed_Reader::getPluginLoader()->getClassName($extension); + $this->_extensions[$className] = new $className( + $this->getDomDocument(), $this->_data['type'], $this->_xpath + ); + } + } + + /** + * Read all entries to the internal entries array + * + */ + abstract protected function _indexEntries(); + + /** + * Register the default namespaces for the current feed format + * + */ + abstract protected function _registerNamespaces(); +} diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php new file mode 100644 index 00000000..aaa4637d --- /dev/null +++ b/src/Reader/Feed/Atom.php @@ -0,0 +1,337 @@ +getClassName('Atom_Feed'); + $this->_atom = new $atomClass($dom, $this->_data['type'], $this->_xpath); + $this->_atom->setXpathPrefix('/atom:feed'); + foreach ($this->_extensions as $extension) { + $extension->setXpathPrefix('/atom:feed'); + } + } + + /** + * Get a single author + * + * @param int $index + * @return string|null + */ + public function getAuthor($index = 0) + { + $authors = $this->getAuthors(); + + if (isset($authors[$index])) { + return $authors[$index]; + } + + return null; + } + + /** + * Get an array with feed authors + * + * @return array + */ + public function getAuthors() + { + if (array_key_exists('authors', $this->_data)) { + return $this->_data['authors']; + } + + $people = $this->_atom->getAuthors(); + + $this->_data['authors'] = $people; + + return $this->_data['authors']; + } + + /** + * Get the copyright entry + * + * @return string|null + */ + public function getCopyright() + { + if (array_key_exists('copyright', $this->_data)) { + return $this->_data['copyright']; + } + + $copyright = $this->_atom->getCopyright(); + + if (!$copyright) { + $copyright = null; + } + + $this->_data['copyright'] = $copyright; + + return $this->_data['copyright']; + } + + /** + * Get the feed creation date + * + * @return string|null + */ + public function getDateCreated() + { + if (array_key_exists('datecreated', $this->_data)) { + return $this->_data['datecreated']; + } + + $dateCreated = $this->_atom->getDateCreated(); + + if (!$dateCreated) { + $dateCreated = null; + } + + $this->_data['datecreated'] = $dateCreated; + + return $this->_data['datecreated']; + } + + /** + * Get the feed modification date + * + * @return string|null + */ + public function getDateModified() + { + if (array_key_exists('datemodified', $this->_data)) { + return $this->_data['datemodified']; + } + + $dateModified = $this->_atom->getDateModified(); + + if (!$dateModified) { + $dateModified = null; + } + + $this->_data['datemodified'] = $dateModified; + + return $this->_data['datemodified']; + } + + /** + * Get the feed description + * + * @return string|null + */ + public function getDescription() + { + if (array_key_exists('description', $this->_data)) { + return $this->_data['description']; + } + + $description = $this->_atom->getDescription(); + + if (!$description) { + $description = null; + } + + $this->_data['description'] = $description; + + return $this->_data['description']; + } + + /** + * Get the feed generator entry + * + * @return string|null + */ + public function getGenerator() + { + if (array_key_exists('generator', $this->_data)) { + return $this->_data['generator']; + } + + $generator = $this->_atom->getGenerator(); + + $this->_data['generator'] = $generator; + + return $this->_data['generator']; + } + + /** + * Get the feed ID + * + * @return string|null + */ + public function getId() + { + if (array_key_exists('id', $this->_data)) { + return $this->_data['id']; + } + + $id = $this->_atom->getId(); + + $this->_data['id'] = $id; + + return $this->_data['id']; + } + + /** + * Get the feed language + * + * @return string|null + */ + public function getLanguage() + { + if (array_key_exists('language', $this->_data)) { + return $this->_data['language']; + } + + $language = $this->_atom->getLanguage(); + + if (!$language) { + $language = $this->_xpath->evaluate('string(//@xml:lang[1])'); + } + + if (!$language) { + $language = null; + } + + $this->_data['language'] = $language; + + return $this->_data['language']; + } + + /** + * Get a link to the source website + * + * @return string|null + */ + public function getLink() + { + if (array_key_exists('link', $this->_data)) { + return $this->_data['link']; + } + + $link = $this->_atom->getLink(); + + $this->_data['link'] = $link; + + return $this->_data['link']; + } + + /** + * Get a link to the feed's XML Url + * + * @return string|null + */ + public function getFeedLink() + { + if (array_key_exists('feedlink', $this->_data)) { + return $this->_data['feedlink']; + } + + $link = $this->_atom->getFeedLink(); + + $this->_data['feedlink'] = $link; + + return $this->_data['feedlink']; + } + + /** + * Get the feed title + * + * @return string|null + */ + public function getTitle() + { + if (array_key_exists('title', $this->_data)) { + return $this->_data['title']; + } + + $title = $this->_atom->getTitle(); + + $this->_data['title'] = $title; + + return $this->_data['title']; + } + + /** + * Read all entries to the internal entries array + * + */ + protected function _indexEntries() + { + if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 || + $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03) { + $entries = array(); + $entries = $this->_xpath->evaluate('//atom:entry'); + + foreach($entries as $index=>$entry) { + $this->_entries[$index] = $entry; + } + } + } + + /** + * Register the default namespaces for the current feed format + * + */ + protected function _registerNamespaces() + { + switch ($this->_data['type']) { + case Zend_Feed_Reader::TYPE_ATOM_03: + $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03); + break; + case Zend_Feed_Reader::TYPE_ATOM_10: + default: + $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10); + } + } +} diff --git a/src/Reader/Feed/Interface.php b/src/Reader/Feed/Interface.php new file mode 100644 index 00000000..72bb226c --- /dev/null +++ b/src/Reader/Feed/Interface.php @@ -0,0 +1,115 @@ +getClassName('DublinCore_Feed'); + $this->_dc = new $dublinCoreClass($dom, $this->_data['type'], $this->_xpath); + $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Feed'); + $this->_atom = new $atomClass($dom, $this->_data['type'], $this->_xpath); + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $xpathPrefix = '/rss/channel'; + } else { + $xpathPrefix = '/rdf:RDF/rss:channel'; + } + $this->_dc->setXpathPrefix($xpathPrefix); + $this->_atom->setXpathPrefix($xpathPrefix); + foreach ($this->_extensions as $extension) { + $extension->setXpathPrefix($xpathPrefix); + } + } + + /** + * Get a single author + * + * @param int $index + * @return string|null + */ + public function getAuthor($index = 0) + { + $authors = $this->getAuthors(); + + if (isset($authors[$index])) { + return $authors[$index]; + } + + return null; + } + + /** + * Get an array with feed authors + * + * @return array + */ + public function getAuthors() + { + if (array_key_exists('authors', $this->_data)) { + return $this->_data['authors']; + } + + $authors = array(); + + if (empty($authors)) { + $authors = $this->_dc->getAuthors(); + } + + if (empty($authors)) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $list = $this->_xpath->query('//author'); + } else { + $list = $this->_xpath->query('//rss:author'); + } + + foreach ($list as $authorObj) { + $authors[] = $authorObj->nodeValue; + } + } + + if (empty($authors)) { + $authors = $this->_atom->getAuthors(); + } + + if (empty($authors)) { + $authors = null; + } else { + $authors = array_unique($authors); + } + + $this->_data['authors'] = $authors; + + return $this->_data['authors']; + } + + /** + * Get the copyright entry + * + * @return string|null + */ + public function getCopyright() + { + if (array_key_exists('copyright', $this->_data)) { + return $this->_data['copyright']; + } + + $copyright = null; + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $copyright = $this->_xpath->evaluate('string(/rss/channel/copyright)'); + } + + if (!$copyright && !is_null($this->_dc)) { + $copyright = $this->_dc->getCopyright(); + } + + if (empty($copyright)) { + $copyright = $this->_atom->getCopyright(); + } + + if (!$copyright) { + $copyright = null; + } + + $this->_data['copyright'] = $copyright; + + return $this->_data['copyright']; + } + + /** + * Get the feed creation date + * + * @return string|null + */ + public function getDateCreated() + { + return $this->getDateModified(); + } + + /** + * Get the feed modification date + * + * @return Zend_Date + */ + public function getDateModified() + { + if (array_key_exists('datemodified', $this->_data)) { + return $this->_data['datemodified']; + } + + $dateModified = null; + $date = null; + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $dateModified = $this->_xpath->evaluate('string(/rss/channel/pubDate)'); + if (!$dateModified) { + $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) { + try { + $date->set($dateModified, Zend_Date::RFC_2822); + } catch (Zend_Date_Exception $e) { + 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): ' + .$e->getMessage() + ); + } + } + } + } + + if (!$date) { + $date = $this->_dc->getDate(); + } + + if (!$date) { + $date = $this->_atom->getDateModified(); + } + + if (!$date) { + $date = null; + } + + $this->_data['datemodified'] = $date; + + return $this->_data['datemodified']; + } + + /** + * Get the feed description + * + * @return string|null + */ + public function getDescription() + { + if (array_key_exists('description', $this->_data)) { + return $this->_data['description']; + } + + $description = null; + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $description = $this->_xpath->evaluate('string(/rss/channel/description)'); + } else { + $description = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:description)'); + } + + if (!$description && !is_null($this->_dc)) { + $description = $this->_dc->getDescription(); + } + + if (empty($description)) { + $description = $this->_atom->getDescription(); + } + + if (!$description) { + $description = null; + } + + $this->_data['description'] = $description; + + return $this->_data['description']; + } + + /** + * Get the feed ID + * + * @return string|null + */ + public function getId() + { + if (array_key_exists('id', $this->_data)) { + return $this->_data['id']; + } + + $id = null; + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $id = $this->_xpath->evaluate('string(/rss/channel/guid)'); + } + + if (!$id && !is_null($this->_dc)) { + $id = $this->_dc->getId(); + } + + if (empty($id)) { + $id = $this->_atom->getId(); + } + + if (!$id) { + if ($this->getLink()) { + $id = $this->getLink(); + } elseif ($this->getTitle()) { + $id = $this->getTitle(); + } else { + $id = null; + } + } + + $this->_data['id'] = $id; + + return $this->_data['id']; + } + + /** + * Get the feed language + * + * @return string|null + */ + public function getLanguage() + { + if (array_key_exists('language', $this->_data)) { + return $this->_data['language']; + } + + $language = null; + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $language = $this->_xpath->evaluate('string(/rss/channel/language)'); + } + + if (!$language && !is_null($this->_dc)) { + $language = $this->_dc->getLanguage(); + } + + if (empty($language)) { + $language = $this->_atom->getLanguage(); + } + + if (!$language) { + $language = $this->_xpath->evaluate('string(//@xml:lang[1])'); + } + + if (!$language) { + $language = null; + } + + $this->_data['language'] = $language; + + return $this->_data['language']; + } + + /** + * Get a link to the feed + * + * @return string|null + */ + public function getLink() + { + if (array_key_exists('link', $this->_data)) { + return $this->_data['link']; + } + + $link = null; + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $link = $this->_xpath->evaluate('string(/rss/channel/link)'); + } else { + $link = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:link)'); + } + + if (empty($link)) { + $link = $this->_atom->getLink(); + } + + if (!$link) { + $link = null; + } + + $this->_data['link'] = $link; + + return $this->_data['link']; + } + + /** + * Get a link to the feed XML + * + * @return string|null + */ + public function getFeedLink() + { + if (array_key_exists('feedlink', $this->_data)) { + return $this->_data['feedlink']; + } + + $link = null; + + $link = $this->_atom->getFeedLink(); + + if (!$link) { + $link = null; + } + + $this->_data['feedlink'] = $link; + + return $this->_data['feedlink']; + } + + /** + * Get the feed generator entry + * + * @return string|null + */ + public function getGenerator() + { + if (array_key_exists('generator', $this->_data)) { + return $this->_data['generator']; + } + + $generator = null; + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $generator = $this->_xpath->evaluate('string(/rss/channel/generator)'); + } + + if (!$generator) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $generator = $this->_xpath->evaluate('string(/rss/channel/atom:generator)'); + } else { + $generator = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/atom:generator)'); + } + if ($generator) { + $generator = html_entity_decode($generator, ENT_QUOTES, $this->getEncoding()); + } + } + + if (empty($generator)) { + $generator = $this->_atom->getGenerator(); + } + + if (!$generator) { + $generator = null; + } + + $this->_data['generator'] = $generator; + + return $this->_data['generator']; + } + + /** + * Get the feed title + * + * @return string|null + */ + public function getTitle() + { + if (array_key_exists('title', $this->_data)) { + return $this->_data['title']; + } + + $title = null; + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $title = $this->_xpath->evaluate('string(/rss/channel/title)'); + } else { + $title = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:title)'); + } + + if (!$title && !is_null($this->_dc)) { + $title = $this->_dc->getTitle(); + } + + if (!$title) { + $title = $this->_atom->getTitle(); + } + + if (!$title) { + $title = null; + } + + $this->_data['title'] = $title; + + return $this->_data['title']; + } + + /** + * Read all entries to the internal entries array + * + */ + protected function _indexEntries() + { + $entries = array(); + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $entries = $this->_xpath->evaluate('//item'); + } else { + $entries = $this->_xpath->evaluate('//rss:item'); + } + + foreach($entries as $index=>$entry) { + $this->_entries[$index] = $entry; + } + } + + /** + * Register the default namespaces for the current feed format + * + */ + protected function _registerNamespaces() + { + switch ($this->_data['type']) { + case Zend_Feed_Reader::TYPE_RSS_10: + $this->_xpath->registerNamespace('rdf', Zend_Feed_Reader::NAMESPACE_RDF); + $this->_xpath->registerNamespace('rss', Zend_Feed_Reader::NAMESPACE_RSS_10); + break; + + case Zend_Feed_Reader::TYPE_RSS_090: + $this->_xpath->registerNamespace('rdf', Zend_Feed_Reader::NAMESPACE_RDF); + $this->_xpath->registerNamespace('rss', Zend_Feed_Reader::NAMESPACE_RSS_090); + break; + } + } +} diff --git a/test/AllTests.php b/test/AllTests.php index 0bede6d9..32309b14 100644 --- a/test/AllTests.php +++ b/test/AllTests.php @@ -46,6 +46,16 @@ require_once 'Zend/Feed/IteratorTest.php'; require_once 'Zend/Feed/Entry/RssTest.php'; +require_once 'Zend/Feed/ReaderTest.php'; +require_once 'Zend/Feed/Reader/Feed/RssTest.php'; +require_once 'Zend/Feed/Reader/Entry/RssTest.php'; +require_once 'Zend/Feed/Reader/Feed/AtomTest.php'; +require_once 'Zend/Feed/Reader/Entry/AtomTest.php'; + +require_once 'Zend/Feed/Reader/Integration/WordpressRss2DcAtomTest.php'; +require_once 'Zend/Feed/Reader/Integration/WordpressAtom10Test.php'; +require_once 'Zend/Feed/Reader/Integration/LautDeRdfTest.php'; +require_once 'Zend/Feed/Reader/Integration/H-OnlineComAtom10Test.php'; /** * @category Zend @@ -74,6 +84,25 @@ public static function suite() $suite->addTestSuite('Zend_Feed_IteratorTest'); $suite->addTestSuite('Zend_Feed_Entry_RssTest'); + /* Zend_Feed_Reader tests */ + // Base parent class + $suite->addTestSuite('Zend_Feed_ReaderTest'); + // RSS - Feed Level + $suite->addTestSuite('Zend_Feed_Reader_Feed_RssTest'); + // RSS - Item Level + $suite->addTestSuite('Zend_Feed_Reader_Entry_RssTest'); + // ATOM - Feed Level + $suite->addTestSuite('Zend_Feed_Reader_Feed_AtomTest'); + // ATOM - Item Level + $suite->addTestSuite('Zend_Feed_Reader_Entry_AtomTest'); + /** + * Real World Feed Tests + */ + $suite->addTestSuite('Zend_Feed_Reader_Integration_WordpressRss2DcAtomTest'); + $suite->addTestSuite('Zend_Feed_Reader_Integration_WordpressAtom10Test'); + $suite->addTestSuite('Zend_Feed_Reader_Integration_LautDeRdfTest'); + $suite->addTestSuite('Zend_Feed_Reader_Integration_HOnlineComAtom10Test'); + return $suite; } } diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php new file mode 100644 index 00000000..ff634473 --- /dev/null +++ b/test/Reader/Entry/AtomTest.php @@ -0,0 +1,226 @@ +_feedSamplePath = dirname(__FILE__) . '/_files/Atom'; + } + + /** + * Get Id (Unencoded Text) + */ + public function testGetsIdFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/id/plain/atom03.xml') + ); + $entry = $feed->current(); + $this->assertEquals('1', $entry->getId()); + } + + public function testGetsIdFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/id/plain/atom10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('1', $entry->getId()); + } + + /** + * Get creation date (Unencoded Text) + */ + public function testGetsDateCreatedFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom03.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $entry->getDateCreated()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateCreatedFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $entry->getDateCreated()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + /** + * Get modification date (Unencoded Text) + */ + public function testGetsDateModifiedFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom03.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + /** + * Get Title (Unencoded Text) + */ + public function testGetsTitleFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/title/plain/atom03.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/title/plain/atom10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + /** + * Get Authors (Unencoded Text) + */ + public function testGetsAuthorsFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/author/plain/atom03.xml') + ); + + $authors = array( + 0 => 'joe@example.com (Joe Bloggs)', + 1 => 'Joe Bloggs', + 3 => 'joe@example.com', + 4 => 'http://www.example.com', + 6 => 'jane@example.com (Jane Bloggs)' + ); + + $entry = $feed->current(); + $this->assertEquals($authors, $entry->getAuthors()); + } + + public function testGetsAuthorsFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/author/plain/atom10.xml') + ); + + $authors = array( + 0 => 'joe@example.com (Joe Bloggs)', + 1 => 'Joe Bloggs', + 3 => 'joe@example.com', + 4 => 'http://www.example.com', + 6 => 'jane@example.com (Jane Bloggs)' + ); + + $entry = $feed->current(); + $this->assertEquals($authors, $entry->getAuthors()); + } + + /** + * Get Author (Unencoded Text) + */ + public function testGetsAuthorFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/author/plain/atom03.xml') + ); + $entry = $feed->current(); + $this->assertEquals('joe@example.com (Joe Bloggs)', $entry->getAuthor()); + } + + public function testGetsAuthorFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/author/plain/atom10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('joe@example.com (Joe Bloggs)', $entry->getAuthor()); + } + + /** + * Get Description (Unencoded Text) + */ + public function testGetsDescriptionFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/description/plain/atom03.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/description/plain/atom10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + /** + * Get Content (Unencoded Text) + */ + public function testGetsContentFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/content/plain/atom03.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Content', $entry->getContent()); + } + + public function testGetsContentFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/content/plain/atom10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Content', $entry->getContent()); + } + + /** + * Get Link (Unencoded Text) + */ + public function testGetsLinkFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/link/plain/atom03.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry', $entry->getLink()); + } + + public function testGetsLinkFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/link/plain/atom10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry', $entry->getLink()); + } +} diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php new file mode 100644 index 00000000..397df192 --- /dev/null +++ b/test/Reader/Entry/RssTest.php @@ -0,0 +1,2563 @@ +_feedSamplePath = dirname(__FILE__) . '/_files/Rss'; + } + + /** + * Get Id (Unencoded Text) + */ + public function testGetsIdFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/1', $entry->getId()); + } + + public function testGetsIdFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getId()); + } + + public function testGetsIdFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getId()); + } + + public function testGetsIdFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getId()); + } + + public function testGetsIdFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getId()); + } + + public function testGetsIdFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getId()); + } + + public function testGetsIdFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getId()); + } + + // DC 1.0 + + public function testGetsIdFromRss20_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/1', $entry->getId()); + } + + public function testGetsIdFromRss094_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/1', $entry->getId()); + } + + public function testGetsIdFromRss093_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/1', $entry->getId()); + } + + public function testGetsIdFromRss092_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/1', $entry->getId()); + } + + public function testGetsIdFromRss091_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/1', $entry->getId()); + } + + public function testGetsIdFromRss10_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/1', $entry->getId()); + } + + public function testGetsIdFromRss090_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/1', $entry->getId()); + } + + // DC 1.1 + + public function testGetsIdFromRss20_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/1', $entry->getId()); + } + + public function testGetsIdFromRss094_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/1', $entry->getId()); + } + + public function testGetsIdFromRss093_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/1', $entry->getId()); + } + + public function testGetsIdFromRss092_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/1', $entry->getId()); + } + + public function testGetsIdFromRss091_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/1', $entry->getId()); + } + + public function testGetsIdFromRss10_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/1', $entry->getId()); + } + + public function testGetsIdFromRss090_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/1', $entry->getId()); + } + + // Missing Id (but alternates to Title) + + public function testGetsIdFromRss20_Title() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/title/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getId()); + } + + public function testGetsIdFromRss094_Title() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/title/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getId()); + } + + public function testGetsIdFromRss093_Title() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/title/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getId()); + } + + public function testGetsIdFromRss092_Title() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/title/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getId()); + } + + public function testGetsIdFromRss091_Title() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/title/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getId()); + } + + public function testGetsIdFromRss10_Title() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/title/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getId()); + } + + public function testGetsIdFromRss090_Title() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/title/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getId()); + } + + // Missing Any Id + + public function testGetsIdFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/none/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getId()); + } + + public function testGetsIdFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/none/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getId()); + } + + public function testGetsIdFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/none/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getId()); + } + + public function testGetsIdFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/none/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getId()); + } + + public function testGetsIdFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/none/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getId()); + } + + public function testGetsIdFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/none/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getId()); + } + + public function testGetsIdFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/none/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getId()); + } + + /** + * Get Title (Unencoded Text) + */ + public function testGetsTitleFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + // DC 1.0 + + public function testGetsTitleFromRss20_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss094_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss093_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss092_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss091_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss10_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss090_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + // DC 1.1 + + public function testGetsTitleFromRss20_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss094_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss093_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss092_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss091_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss10_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + public function testGetsTitleFromRss090_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + // Missing Title + + public function testGetsTitleFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/none/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getTitle()); + } + + public function testGetsTitleFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/none/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getTitle()); + } + + public function testGetsTitleFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/none/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getTitle()); + } + + public function testGetsTitleFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/none/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getTitle()); + } + + public function testGetsTitleFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/none/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getTitle()); + } + + public function testGetsTitleFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/none/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getTitle()); + } + + public function testGetsTitleFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/none/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getTitle()); + } + + /** + * Get Authors (Unencoded Text) + */ + public function testGetsAuthorsFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), $entry->getAuthors()); + } + + // DC 1.0 + + public function testGetsAuthorsFromRss20_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss094_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss093_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss092_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss091_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss10_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss090_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + } + + // DC 1.1 + + public function testGetsAuthorsFromRss20_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss094_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss093_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss092_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss091_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss10_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss090_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + } + + // Missing Author + + public function testGetsAuthorsFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), $entry->getAuthors()); + } + + public function testGetsAuthorsFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), $entry->getAuthors()); + } + + + /** + * Get Author (Unencoded Text) + */ + public function testGetsAuthorFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Joe Bloggs', $entry->getAuthor()); + } + + public function testGetsAuthorFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getAuthor()); + } + + public function testGetsAuthorFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getAuthor()); + } + + public function testGetsAuthorFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getAuthor()); + } + + public function testGetsAuthorFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getAuthor()); + } + + public function testGetsAuthorFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getAuthor()); + } + + public function testGetsAuthorFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getAuthor()); + } + + // DC 1.0 + + public function testGetsAuthorFromRss20_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Joe Bloggs', $entry->getAuthor()); + } + + public function testGetsAuthorFromRss094_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Jane Bloggs', $entry->getAuthor(1)); + } + + public function testGetsAuthorFromRss093_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Joe Bloggs', $entry->getAuthor()); + } + + public function testGetsAuthorFromRss092_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Jane Bloggs', $entry->getAuthor(1)); + } + + public function testGetsAuthorFromRss091_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Joe Bloggs', $entry->getAuthor()); + } + + public function testGetsAuthorFromRss10_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Jane Bloggs', $entry->getAuthor(1)); + } + + public function testGetsAuthorFromRss090_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Joe Bloggs', $entry->getAuthor()); + } + + // DC 1.1 + + public function testGetsAuthorFromRss20_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Jane Bloggs', $entry->getAuthor(1)); + } + + public function testGetsAuthorFromRss094_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Joe Bloggs', $entry->getAuthor()); + } + + public function testGetsAuthorFromRss093_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Jane Bloggs', $entry->getAuthor(1)); + } + + public function testGetsAuthorFromRss092_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Joe Bloggs', $entry->getAuthor()); + } + + public function testGetsAuthorFromRss091_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Jane Bloggs', $entry->getAuthor(1)); + } + + public function testGetsAuthorFromRss10_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Joe Bloggs', $entry->getAuthor()); + } + + public function testGetsAuthorFromRss090_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Jane Bloggs', $entry->getAuthor(1)); + } + + // Missing Id + + public function testGetsAuthorFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getAuthor()); + } + + public function testGetsAuthorFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getAuthor()); + } + + public function testGetsAuthorFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getAuthor()); + } + + public function testGetsAuthorFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getAuthor()); + } + + public function testGetsAuthorFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getAuthor()); + } + + public function testGetsAuthorFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getAuthor()); + } + + public function testGetsAuthorFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getAuthor()); + } + + /** + * Get Description (Unencoded Text) + */ + public function testGetsDescriptionFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + // DC 1.0 + + public function testGetsDescriptionFromRss20_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss094_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss093_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss092_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss091_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss10_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss090_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + // DC 1.1 + + public function testGetsDescriptionFromRss20_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss094_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss093_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss092_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss091_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss10_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + public function testGetsDescriptionFromRss090_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + // Missing Description + + public function testGetsDescriptionFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/none/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getDescription()); + } + + public function testGetsDescriptionFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/none/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getDescription()); + } + + public function testGetsDescriptionFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/none/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getDescription()); + } + + public function testGetsDescriptionFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/none/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getDescription()); + } + + public function testGetsDescriptionFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/none/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getDescription()); + } + + public function testGetsDescriptionFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/none/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getDescription()); + } + + public function testGetsDescriptionFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/none/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getDescription()); + } + + /** + * Get Content (Unencoded Text) + */ + public function testGetsContentFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Content', $entry->getContent()); + } + + public function testGetsContentFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Content', $entry->getContent()); + } + + public function testGetsContentFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Content', $entry->getContent()); + } + + public function testGetsContentFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Content', $entry->getContent()); + } + + public function testGetsContentFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Content', $entry->getContent()); + } + + public function testGetsContentFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Content', $entry->getContent()); + } + + public function testGetsContentFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Content', $entry->getContent()); + } + + // Revert to Description if no Content + + public function testGetsContentFromRss20_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/description/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getContent()); + } + + public function testGetsContentFromRss094_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/description/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getContent()); + } + + public function testGetsContentFromRss093_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/description/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getContent()); + } + + public function testGetsContentFromRss092_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/description/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getContent()); + } + + public function testGetsContentFromRss091_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/description/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getContent()); + } + + public function testGetsContentFromRss10_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/description/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getContent()); + } + + public function testGetsContentFromRss090_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/description/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Entry Description', $entry->getContent()); + } + + // Missing Content and Description + + public function testGetsContentFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/none/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getContent()); + } + + public function testGetsContentFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/none/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getContent()); + } + + public function testGetsContentFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/none/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getContent()); + } + + public function testGetsContentFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/none/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getContent()); + } + + public function testGetsContentFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/none/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getContent()); + } + + public function testGetsContentFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/none/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getContent()); + } + + public function testGetsContentFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/content/plain/none/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getContent()); + } + + /** + * Get Link (Unencoded Text) + */ + public function testGetsLinkFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry', $entry->getLink()); + } + + public function testGetsLinkFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry', $entry->getLink()); + } + + public function testGetsLinkFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry', $entry->getLink()); + } + + public function testGetsLinkFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry', $entry->getLink()); + } + + public function testGetsLinkFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry', $entry->getLink()); + } + + public function testGetsLinkFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry', $entry->getLink()); + } + + public function testGetsLinkFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry', $entry->getLink()); + } + + // Missing Link + + public function testGetsLinkFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/none/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getLink()); + } + + public function testGetsLinkFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/none/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getLink()); + } + + public function testGetsLinkFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/none/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getLink()); + } + + public function testGetsLinkFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/none/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getLink()); + } + + public function testGetsLinkFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/none/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getLink()); + } + + public function testGetsLinkFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/none/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getLink()); + } + + public function testGetsLinkFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/none/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getLink()); + } + + /** + * Get DateModified (Unencoded Text) + */ + public function testGetsDateModifiedFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + // DC 1.0 + + public function testGetsDateModifiedFromRss20_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss094_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss093_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss092_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss091_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss10_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss090_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + // DC 1.1 + + public function testGetsDateModifiedFromRss20_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss094_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss093_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss092_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss091_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss10_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss090_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + // Missing DateModified + + public function testGetsDateModifiedFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getDateModified()); + } + + public function testGetsDateModifiedFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getDateModified()); + } + + public function testGetsDateModifiedFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getDateModified()); + } + + public function testGetsDateModifiedFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getDateModified()); + } + + public function testGetsDateModifiedFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getDateModified()); + } + + public function testGetsDateModifiedFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getDateModified()); + } + + public function testGetsDateModifiedFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getDateModified()); + } + + /** + * Get CommentCount (Unencoded Text) + */ + + // Slash 1.0 + + public function testGetsCommentCountFromRss20_Slash10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss094_Slash10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss093_Slash10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss092_Slash10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss091_Slash10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss10_Slash10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss090_Slash10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + // Atom Threaded 1.0 + + public function testGetsCommentCountFromRss20_Thread10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss094_Thread10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss093_Thread10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss092_Thread10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss091_Thread10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss10_Thread10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss090_Thread10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + // Atom 1.0 (Threaded 1.0 atom:link attribute) + + public function testGetsCommentCountFromRss20_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss094_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss093_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss092_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss091_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss10_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss090_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('321', $entry->getCommentCount()); + } + + // Missing Any CommentCount + + public function testGetsCommentCountFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentCount()); + } + + public function testGetsCommentCountFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentCount()); + } + + /** + * Get CommentLink (Unencoded Text) + */ + + public function testGetsCommentLinkFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/comments', $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/comments', $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/comments', $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/comments', $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/comments', $entry->getCommentLink()); + } + + // Atom 1.0 + + public function testGetsCommentLinkFromRss20_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/comments', $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromRss094_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/comments', $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromRss093_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/comments', $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromRss092_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/comments', $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromRss091_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/comments', $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromRss10_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/comments', $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromRss090_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/comments', $entry->getCommentLink()); + } + + // Missing Any CommentLink + + public function testGetsCommentLinkFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentLink()); + } + + /** + * Get CommentFeedLink (Unencoded Text) + */ + + // Atom 1.0 + + public function testGetsCommentFeedLinkFromRss20_WellFormedWeb10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry/321/feed/rss/', $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss094_WellFormedWeb10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry/321/feed/rss/', $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss093_WellFormedWeb10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry/321/feed/rss/', $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss092_WellFormedWeb10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry/321/feed/rss/', $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss091_WellFormedWeb10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry/321/feed/rss/', $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss10_WellFormedWeb10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry/321/feed/rss/', $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss090_WellFormedWeb10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry/321/feed/rss/', $entry->getCommentFeedLink()); + } + + // Atom 1.0 + + public function testGetsCommentFeedLinkFromRss20_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry/321/feed/rss/', $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss094_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry/321/feed/rss/', $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss093_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry/321/feed/rss/', $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss092_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry/321/feed/rss/', $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss091_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry/321/feed/rss/', $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss10_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry/321/feed/rss/', $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss090_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry/321/feed/rss/', $entry->getCommentFeedLink()); + } + + // Missing Any CommentFeedLink + + public function testGetsCommentFeedLinkFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentFeedLink()); + } + + public function testGetsCommentFeedLinkFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getCommentFeedLink()); + } + +} diff --git a/test/Reader/Entry/_files/Atom/author/plain/atom03.xml b/test/Reader/Entry/_files/Atom/author/plain/atom03.xml new file mode 100644 index 00000000..597e58d7 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/author/plain/atom03.xml @@ -0,0 +1,45 @@ + + + + + Joe Bloggs + http://www.example.com + joe@example.com + + + Joe Bloggs + http://www.example.com + + + + Joe Bloggs + + + + + + http://www.example.com + joe@example.com + + + + http://www.example.com + + + + + + joe@example.com + + + + + + + + Jane Bloggs + http://www.example.com + jane@example.com + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Atom/author/plain/atom10.xml b/test/Reader/Entry/_files/Atom/author/plain/atom10.xml new file mode 100644 index 00000000..82821adb --- /dev/null +++ b/test/Reader/Entry/_files/Atom/author/plain/atom10.xml @@ -0,0 +1,45 @@ + + + + + Joe Bloggs + http://www.example.com + joe@example.com + + + Joe Bloggs + http://www.example.com + + + + Joe Bloggs + + + + + + http://www.example.com + joe@example.com + + + + http://www.example.com + + + + + + joe@example.com + + + + + + + + Jane Bloggs + http://www.example.com + jane@example.com + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Atom/content/plain/atom03.xml b/test/Reader/Entry/_files/Atom/content/plain/atom03.xml new file mode 100644 index 00000000..f6d509d7 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/content/plain/atom03.xml @@ -0,0 +1,6 @@ + + + + Entry Content + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Atom/content/plain/atom10.xml b/test/Reader/Entry/_files/Atom/content/plain/atom10.xml new file mode 100644 index 00000000..f30eb6a6 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/content/plain/atom10.xml @@ -0,0 +1,6 @@ + + + + Entry Content + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Atom/datecreated/plain/atom03.xml b/test/Reader/Entry/_files/Atom/datecreated/plain/atom03.xml new file mode 100644 index 00000000..4c3c9691 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/datecreated/plain/atom03.xml @@ -0,0 +1,6 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Entry/_files/Atom/datecreated/plain/atom10.xml b/test/Reader/Entry/_files/Atom/datecreated/plain/atom10.xml new file mode 100644 index 00000000..95a7fe7e --- /dev/null +++ b/test/Reader/Entry/_files/Atom/datecreated/plain/atom10.xml @@ -0,0 +1,6 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Entry/_files/Atom/datemodified/plain/atom03.xml b/test/Reader/Entry/_files/Atom/datemodified/plain/atom03.xml new file mode 100644 index 00000000..747b8da2 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/datemodified/plain/atom03.xml @@ -0,0 +1,6 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Entry/_files/Atom/datemodified/plain/atom10.xml b/test/Reader/Entry/_files/Atom/datemodified/plain/atom10.xml new file mode 100644 index 00000000..ef300c58 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/datemodified/plain/atom10.xml @@ -0,0 +1,6 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Entry/_files/Atom/description/plain/atom03.xml b/test/Reader/Entry/_files/Atom/description/plain/atom03.xml new file mode 100644 index 00000000..b8b01e83 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/description/plain/atom03.xml @@ -0,0 +1,6 @@ + + + + Entry Description + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Atom/description/plain/atom10.xml b/test/Reader/Entry/_files/Atom/description/plain/atom10.xml new file mode 100644 index 00000000..232da70b --- /dev/null +++ b/test/Reader/Entry/_files/Atom/description/plain/atom10.xml @@ -0,0 +1,6 @@ + + + + Entry Description + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Atom/id/plain/atom03.xml b/test/Reader/Entry/_files/Atom/id/plain/atom03.xml new file mode 100644 index 00000000..4382b535 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/id/plain/atom03.xml @@ -0,0 +1,6 @@ + + + + 1 + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Atom/id/plain/atom10.xml b/test/Reader/Entry/_files/Atom/id/plain/atom10.xml new file mode 100644 index 00000000..a724682f --- /dev/null +++ b/test/Reader/Entry/_files/Atom/id/plain/atom10.xml @@ -0,0 +1,6 @@ + + + + 1 + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Atom/link/plain/atom03.xml b/test/Reader/Entry/_files/Atom/link/plain/atom03.xml new file mode 100644 index 00000000..eba50722 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/link/plain/atom03.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Atom/link/plain/atom10.xml b/test/Reader/Entry/_files/Atom/link/plain/atom10.xml new file mode 100644 index 00000000..2eb1029a --- /dev/null +++ b/test/Reader/Entry/_files/Atom/link/plain/atom10.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Atom/links/plain/atom03.xml b/test/Reader/Entry/_files/Atom/links/plain/atom03.xml new file mode 100644 index 00000000..406c8b6e --- /dev/null +++ b/test/Reader/Entry/_files/Atom/links/plain/atom03.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Atom/links/plain/atom10.xml b/test/Reader/Entry/_files/Atom/links/plain/atom10.xml new file mode 100644 index 00000000..f8d8ba53 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/links/plain/atom10.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Atom/title/plain/atom03.xml b/test/Reader/Entry/_files/Atom/title/plain/atom03.xml new file mode 100644 index 00000000..6625a335 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/title/plain/atom03.xml @@ -0,0 +1,6 @@ + + + + Entry Title + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Atom/title/plain/atom10.xml b/test/Reader/Entry/_files/Atom/title/plain/atom10.xml new file mode 100644 index 00000000..06dbcc99 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/title/plain/atom10.xml @@ -0,0 +1,6 @@ + + + + Entry Title + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/dc10/rss090.xml b/test/Reader/Entry/_files/Rss/author/plain/dc10/rss090.xml new file mode 100644 index 00000000..68e35c21 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/dc10/rss090.xml @@ -0,0 +1,12 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/dc10/rss091.xml b/test/Reader/Entry/_files/Rss/author/plain/dc10/rss091.xml new file mode 100644 index 00000000..a8ccda60 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/dc10/rss091.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/dc10/rss092.xml b/test/Reader/Entry/_files/Rss/author/plain/dc10/rss092.xml new file mode 100644 index 00000000..323729fd --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/dc10/rss092.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/dc10/rss093.xml b/test/Reader/Entry/_files/Rss/author/plain/dc10/rss093.xml new file mode 100644 index 00000000..84a68f2f --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/dc10/rss093.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/dc10/rss094.xml b/test/Reader/Entry/_files/Rss/author/plain/dc10/rss094.xml new file mode 100644 index 00000000..cfa540ad --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/dc10/rss094.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/dc10/rss10.xml b/test/Reader/Entry/_files/Rss/author/plain/dc10/rss10.xml new file mode 100644 index 00000000..8c8e8263 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/dc10/rss10.xml @@ -0,0 +1,12 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/dc10/rss20.xml b/test/Reader/Entry/_files/Rss/author/plain/dc10/rss20.xml new file mode 100644 index 00000000..4ad1c11b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/dc10/rss20.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/dc11/rss090.xml b/test/Reader/Entry/_files/Rss/author/plain/dc11/rss090.xml new file mode 100644 index 00000000..54e026b1 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/dc11/rss090.xml @@ -0,0 +1,12 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/dc11/rss091.xml b/test/Reader/Entry/_files/Rss/author/plain/dc11/rss091.xml new file mode 100644 index 00000000..1d7236c3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/dc11/rss091.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/dc11/rss092.xml b/test/Reader/Entry/_files/Rss/author/plain/dc11/rss092.xml new file mode 100644 index 00000000..578d70f0 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/dc11/rss092.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/dc11/rss093.xml b/test/Reader/Entry/_files/Rss/author/plain/dc11/rss093.xml new file mode 100644 index 00000000..bbb90371 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/dc11/rss093.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/dc11/rss094.xml b/test/Reader/Entry/_files/Rss/author/plain/dc11/rss094.xml new file mode 100644 index 00000000..e61e7607 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/dc11/rss094.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/dc11/rss10.xml b/test/Reader/Entry/_files/Rss/author/plain/dc11/rss10.xml new file mode 100644 index 00000000..0fbb88ed --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/dc11/rss10.xml @@ -0,0 +1,12 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/dc11/rss20.xml b/test/Reader/Entry/_files/Rss/author/plain/dc11/rss20.xml new file mode 100644 index 00000000..a38aa4b5 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/dc11/rss20.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/none/rss090.xml b/test/Reader/Entry/_files/Rss/author/plain/none/rss090.xml new file mode 100644 index 00000000..57814153 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/none/rss090.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/none/rss091.xml b/test/Reader/Entry/_files/Rss/author/plain/none/rss091.xml new file mode 100644 index 00000000..04d999e3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/none/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/none/rss092.xml b/test/Reader/Entry/_files/Rss/author/plain/none/rss092.xml new file mode 100644 index 00000000..8b31a074 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/none/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/none/rss093.xml b/test/Reader/Entry/_files/Rss/author/plain/none/rss093.xml new file mode 100644 index 00000000..31d61445 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/none/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/none/rss094.xml b/test/Reader/Entry/_files/Rss/author/plain/none/rss094.xml new file mode 100644 index 00000000..e375a1d9 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/none/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/none/rss10.xml b/test/Reader/Entry/_files/Rss/author/plain/none/rss10.xml new file mode 100644 index 00000000..0ab6cc5b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/none/rss10.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/none/rss20.xml b/test/Reader/Entry/_files/Rss/author/plain/none/rss20.xml new file mode 100644 index 00000000..8ace034d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/none/rss20.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/rss090.xml b/test/Reader/Entry/_files/Rss/author/plain/rss090.xml new file mode 100644 index 00000000..57814153 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/rss090.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/rss091.xml b/test/Reader/Entry/_files/Rss/author/plain/rss091.xml new file mode 100644 index 00000000..04d999e3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/rss092.xml b/test/Reader/Entry/_files/Rss/author/plain/rss092.xml new file mode 100644 index 00000000..8b31a074 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/rss093.xml b/test/Reader/Entry/_files/Rss/author/plain/rss093.xml new file mode 100644 index 00000000..31d61445 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/rss094.xml b/test/Reader/Entry/_files/Rss/author/plain/rss094.xml new file mode 100644 index 00000000..e375a1d9 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/rss10.xml b/test/Reader/Entry/_files/Rss/author/plain/rss10.xml new file mode 100644 index 00000000..0ab6cc5b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/rss10.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/author/plain/rss20.xml b/test/Reader/Entry/_files/Rss/author/plain/rss20.xml new file mode 100644 index 00000000..610f00c7 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/author/plain/rss20.xml @@ -0,0 +1,9 @@ + + + + + joe@example.com (Joe Bloggs) + jane@example.com (Jane Bloggs) + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss090.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss090.xml new file mode 100644 index 00000000..0da7845b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss090.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss091.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss091.xml new file mode 100644 index 00000000..3c78d2cb --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss091.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss092.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss092.xml new file mode 100644 index 00000000..4a795171 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss092.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss093.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss093.xml new file mode 100644 index 00000000..8f967bbd --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss093.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss094.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss094.xml new file mode 100644 index 00000000..c2b4c2fc --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss094.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss10.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss10.xml new file mode 100644 index 00000000..b8d328ea --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss10.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss20.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss20.xml new file mode 100644 index 00000000..2a4a2455 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/atom10/rss20.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss090.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss090.xml new file mode 100644 index 00000000..57814153 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss090.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss091.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss091.xml new file mode 100644 index 00000000..04d999e3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss092.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss092.xml new file mode 100644 index 00000000..8b31a074 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss093.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss093.xml new file mode 100644 index 00000000..31d61445 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss094.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss094.xml new file mode 100644 index 00000000..e375a1d9 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss10.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss10.xml new file mode 100644 index 00000000..0ab6cc5b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss10.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss20.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss20.xml new file mode 100644 index 00000000..8ace034d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/none/rss20.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss090.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss090.xml new file mode 100644 index 00000000..bb459c17 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss090.xml @@ -0,0 +1,11 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss091.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss091.xml new file mode 100644 index 00000000..83b6de8d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss091.xml @@ -0,0 +1,9 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss092.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss092.xml new file mode 100644 index 00000000..592e1ccd --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss092.xml @@ -0,0 +1,9 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss093.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss093.xml new file mode 100644 index 00000000..af9fe941 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss093.xml @@ -0,0 +1,9 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss094.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss094.xml new file mode 100644 index 00000000..58907c49 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss094.xml @@ -0,0 +1,9 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss10.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss10.xml new file mode 100644 index 00000000..74d2bb0e --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss10.xml @@ -0,0 +1,11 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss20.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss20.xml new file mode 100644 index 00000000..a5b53433 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/slash10/rss20.xml @@ -0,0 +1,9 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss090.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss090.xml new file mode 100644 index 00000000..9dff7795 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss090.xml @@ -0,0 +1,11 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss091.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss091.xml new file mode 100644 index 00000000..fe911dda --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss091.xml @@ -0,0 +1,9 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss092.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss092.xml new file mode 100644 index 00000000..46c514a4 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss092.xml @@ -0,0 +1,9 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss093.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss093.xml new file mode 100644 index 00000000..a3f457a5 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss093.xml @@ -0,0 +1,9 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss094.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss094.xml new file mode 100644 index 00000000..df01c1bd --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss094.xml @@ -0,0 +1,9 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss10.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss10.xml new file mode 100644 index 00000000..0edd662e --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss10.xml @@ -0,0 +1,11 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss20.xml b/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss20.xml new file mode 100644 index 00000000..447b3cd7 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentcount/plain/thread10/rss20.xml @@ -0,0 +1,9 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss090.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss090.xml new file mode 100644 index 00000000..3138f2de --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss090.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss091.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss091.xml new file mode 100644 index 00000000..510fc983 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss091.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss092.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss092.xml new file mode 100644 index 00000000..3646e105 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss092.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss093.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss093.xml new file mode 100644 index 00000000..c1ac68a3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss093.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss094.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss094.xml new file mode 100644 index 00000000..dc39e980 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss094.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss10.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss10.xml new file mode 100644 index 00000000..05581877 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss10.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss20.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss20.xml new file mode 100644 index 00000000..b892ba5f --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/atom10/rss20.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss090.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss090.xml new file mode 100644 index 00000000..57814153 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss090.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss091.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss091.xml new file mode 100644 index 00000000..04d999e3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss092.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss092.xml new file mode 100644 index 00000000..8b31a074 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss093.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss093.xml new file mode 100644 index 00000000..31d61445 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss094.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss094.xml new file mode 100644 index 00000000..e375a1d9 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss10.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss10.xml new file mode 100644 index 00000000..0ab6cc5b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss10.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss20.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss20.xml new file mode 100644 index 00000000..8ace034d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/none/rss20.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss090.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss090.xml new file mode 100644 index 00000000..9dff7795 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss090.xml @@ -0,0 +1,11 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss091.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss091.xml new file mode 100644 index 00000000..fe911dda --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss091.xml @@ -0,0 +1,9 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss092.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss092.xml new file mode 100644 index 00000000..46c514a4 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss092.xml @@ -0,0 +1,9 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss093.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss093.xml new file mode 100644 index 00000000..a3f457a5 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss093.xml @@ -0,0 +1,9 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss094.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss094.xml new file mode 100644 index 00000000..df01c1bd --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss094.xml @@ -0,0 +1,9 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss10.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss10.xml new file mode 100644 index 00000000..f267af16 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss10.xml @@ -0,0 +1,11 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss20.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss20.xml new file mode 100644 index 00000000..447b3cd7 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/thread10/rss20.xml @@ -0,0 +1,9 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss090.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss090.xml new file mode 100644 index 00000000..e9b17e30 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss090.xml @@ -0,0 +1,11 @@ + + + + + http://www.example.com/entry/321/feed/rss/ + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss091.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss091.xml new file mode 100644 index 00000000..6790a65f --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss091.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/entry/321/feed/rss/ + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss092.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss092.xml new file mode 100644 index 00000000..a246decf --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss092.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/entry/321/feed/rss/ + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss093.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss093.xml new file mode 100644 index 00000000..dc135d77 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss093.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/entry/321/feed/rss/ + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss094.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss094.xml new file mode 100644 index 00000000..064a99ad --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss094.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/entry/321/feed/rss/ + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss10.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss10.xml new file mode 100644 index 00000000..ad848d87 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss10.xml @@ -0,0 +1,11 @@ + + + + + http://www.example.com/entry/321/feed/rss/ + + + diff --git a/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss20.xml b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss20.xml new file mode 100644 index 00000000..8dbf7226 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentfeedlink/plain/wellformedweb/rss20.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/entry/321/feed/rss/ + + + diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss090.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss090.xml new file mode 100644 index 00000000..748cdc26 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss090.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss091.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss091.xml new file mode 100644 index 00000000..d5e6d1dd --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss091.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss092.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss092.xml new file mode 100644 index 00000000..d5573c5a --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss092.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss093.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss093.xml new file mode 100644 index 00000000..ff8a1d31 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss093.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss094.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss094.xml new file mode 100644 index 00000000..1cb3cecc --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss094.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss10.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss10.xml new file mode 100644 index 00000000..0e0c4d5c --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss10.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss20.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss20.xml new file mode 100644 index 00000000..d9bd4aba --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/atom10/rss20.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss090.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss090.xml new file mode 100644 index 00000000..57814153 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss090.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss091.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss091.xml new file mode 100644 index 00000000..04d999e3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss092.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss092.xml new file mode 100644 index 00000000..8b31a074 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss093.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss093.xml new file mode 100644 index 00000000..31d61445 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss094.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss094.xml new file mode 100644 index 00000000..e375a1d9 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss10.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss10.xml new file mode 100644 index 00000000..0ab6cc5b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss10.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss20.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss20.xml new file mode 100644 index 00000000..8ace034d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/none/rss20.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/rss091.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/rss091.xml new file mode 100644 index 00000000..e894ea50 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/rss091.xml @@ -0,0 +1,8 @@ + + + + + http://www.example.com/comments + + + diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/rss092.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/rss092.xml new file mode 100644 index 00000000..1bbad33a --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/rss092.xml @@ -0,0 +1,8 @@ + + + + + http://www.example.com/comments + + + diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/rss093.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/rss093.xml new file mode 100644 index 00000000..ee1e64a0 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/rss093.xml @@ -0,0 +1,8 @@ + + + + + http://www.example.com/comments + + + diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/rss094.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/rss094.xml new file mode 100644 index 00000000..ecb37067 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/rss094.xml @@ -0,0 +1,8 @@ + + + + + http://www.example.com/comments + + + diff --git a/test/Reader/Entry/_files/Rss/commentlink/plain/rss20.xml b/test/Reader/Entry/_files/Rss/commentlink/plain/rss20.xml new file mode 100644 index 00000000..c1eabeaa --- /dev/null +++ b/test/Reader/Entry/_files/Rss/commentlink/plain/rss20.xml @@ -0,0 +1,8 @@ + + + + + http://www.example.com/comments + + + diff --git a/test/Reader/Entry/_files/Rss/content/plain/description/rss090.xml b/test/Reader/Entry/_files/Rss/content/plain/description/rss090.xml new file mode 100644 index 00000000..c2918646 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/description/rss090.xml @@ -0,0 +1,11 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/description/rss091.xml b/test/Reader/Entry/_files/Rss/content/plain/description/rss091.xml new file mode 100644 index 00000000..5af9974f --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/description/rss091.xml @@ -0,0 +1,9 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/description/rss092.xml b/test/Reader/Entry/_files/Rss/content/plain/description/rss092.xml new file mode 100644 index 00000000..65760fa0 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/description/rss092.xml @@ -0,0 +1,9 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/description/rss093.xml b/test/Reader/Entry/_files/Rss/content/plain/description/rss093.xml new file mode 100644 index 00000000..2a2dba03 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/description/rss093.xml @@ -0,0 +1,9 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/description/rss094.xml b/test/Reader/Entry/_files/Rss/content/plain/description/rss094.xml new file mode 100644 index 00000000..c4f07852 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/description/rss094.xml @@ -0,0 +1,9 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/description/rss10.xml b/test/Reader/Entry/_files/Rss/content/plain/description/rss10.xml new file mode 100644 index 00000000..941d89c3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/description/rss10.xml @@ -0,0 +1,11 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/description/rss20.xml b/test/Reader/Entry/_files/Rss/content/plain/description/rss20.xml new file mode 100644 index 00000000..c6664ac9 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/description/rss20.xml @@ -0,0 +1,9 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/none/rss090.xml b/test/Reader/Entry/_files/Rss/content/plain/none/rss090.xml new file mode 100644 index 00000000..57814153 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/none/rss090.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/none/rss091.xml b/test/Reader/Entry/_files/Rss/content/plain/none/rss091.xml new file mode 100644 index 00000000..04d999e3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/none/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/none/rss092.xml b/test/Reader/Entry/_files/Rss/content/plain/none/rss092.xml new file mode 100644 index 00000000..8b31a074 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/none/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/none/rss093.xml b/test/Reader/Entry/_files/Rss/content/plain/none/rss093.xml new file mode 100644 index 00000000..31d61445 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/none/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/none/rss094.xml b/test/Reader/Entry/_files/Rss/content/plain/none/rss094.xml new file mode 100644 index 00000000..e375a1d9 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/none/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/none/rss10.xml b/test/Reader/Entry/_files/Rss/content/plain/none/rss10.xml new file mode 100644 index 00000000..0ab6cc5b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/none/rss10.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/none/rss20.xml b/test/Reader/Entry/_files/Rss/content/plain/none/rss20.xml new file mode 100644 index 00000000..8ace034d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/none/rss20.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/rss090.xml b/test/Reader/Entry/_files/Rss/content/plain/rss090.xml new file mode 100644 index 00000000..deb85415 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/rss090.xml @@ -0,0 +1,11 @@ + + + + + Entry Content + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/rss091.xml b/test/Reader/Entry/_files/Rss/content/plain/rss091.xml new file mode 100644 index 00000000..b596e9ab --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/rss091.xml @@ -0,0 +1,9 @@ + + + + + Entry Content + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/rss092.xml b/test/Reader/Entry/_files/Rss/content/plain/rss092.xml new file mode 100644 index 00000000..fcbc3e3c --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/rss092.xml @@ -0,0 +1,9 @@ + + + + + Entry Content + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/rss093.xml b/test/Reader/Entry/_files/Rss/content/plain/rss093.xml new file mode 100644 index 00000000..a3c1d5fd --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/rss093.xml @@ -0,0 +1,9 @@ + + + + + Entry Content + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/rss094.xml b/test/Reader/Entry/_files/Rss/content/plain/rss094.xml new file mode 100644 index 00000000..9f3653ab --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/rss094.xml @@ -0,0 +1,9 @@ + + + + + Entry Content + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/rss10.xml b/test/Reader/Entry/_files/Rss/content/plain/rss10.xml new file mode 100644 index 00000000..be080266 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/rss10.xml @@ -0,0 +1,11 @@ + + + + + Entry Content + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/content/plain/rss20.xml b/test/Reader/Entry/_files/Rss/content/plain/rss20.xml new file mode 100644 index 00000000..4600c620 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/content/plain/rss20.xml @@ -0,0 +1,9 @@ + + + + + Entry Content + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss090.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss090.xml new file mode 100644 index 00000000..9db7fd7d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss090.xml @@ -0,0 +1,11 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss091.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss091.xml new file mode 100644 index 00000000..3ea5f105 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss091.xml @@ -0,0 +1,9 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss092.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss092.xml new file mode 100644 index 00000000..28a22f96 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss092.xml @@ -0,0 +1,9 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss093.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss093.xml new file mode 100644 index 00000000..8c2a573c --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss093.xml @@ -0,0 +1,9 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss094.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss094.xml new file mode 100644 index 00000000..770aa0f5 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss094.xml @@ -0,0 +1,9 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss10.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss10.xml new file mode 100644 index 00000000..75e8f22a --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss10.xml @@ -0,0 +1,11 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss20.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss20.xml new file mode 100644 index 00000000..8e25d37d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/atom10/rss20.xml @@ -0,0 +1,9 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss090.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss090.xml new file mode 100644 index 00000000..c54b103a --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss090.xml @@ -0,0 +1,11 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss091.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss091.xml new file mode 100644 index 00000000..8d460b07 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss091.xml @@ -0,0 +1,9 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss092.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss092.xml new file mode 100644 index 00000000..2f6bf523 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss092.xml @@ -0,0 +1,9 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss093.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss093.xml new file mode 100644 index 00000000..e4744b7e --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss093.xml @@ -0,0 +1,9 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss094.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss094.xml new file mode 100644 index 00000000..c049daf3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss094.xml @@ -0,0 +1,9 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss10.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss10.xml new file mode 100644 index 00000000..4763d18d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss10.xml @@ -0,0 +1,11 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss20.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss20.xml new file mode 100644 index 00000000..c5c82b67 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/dc10/rss20.xml @@ -0,0 +1,9 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss090.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss090.xml new file mode 100644 index 00000000..cf4c825f --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss090.xml @@ -0,0 +1,11 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss091.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss091.xml new file mode 100644 index 00000000..06a1efff --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss091.xml @@ -0,0 +1,9 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss092.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss092.xml new file mode 100644 index 00000000..d9faf9f2 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss092.xml @@ -0,0 +1,9 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss093.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss093.xml new file mode 100644 index 00000000..f2a5fedd --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss093.xml @@ -0,0 +1,9 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss094.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss094.xml new file mode 100644 index 00000000..95ec4259 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss094.xml @@ -0,0 +1,9 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss10.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss10.xml new file mode 100644 index 00000000..608b8b9a --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss10.xml @@ -0,0 +1,11 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss20.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss20.xml new file mode 100644 index 00000000..7e95d8ae --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/dc11/rss20.xml @@ -0,0 +1,9 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss090.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss090.xml new file mode 100644 index 00000000..57814153 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss090.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss091.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss091.xml new file mode 100644 index 00000000..04d999e3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss092.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss092.xml new file mode 100644 index 00000000..8b31a074 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss093.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss093.xml new file mode 100644 index 00000000..31d61445 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss094.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss094.xml new file mode 100644 index 00000000..e375a1d9 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss10.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss10.xml new file mode 100644 index 00000000..0ab6cc5b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss10.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss20.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss20.xml new file mode 100644 index 00000000..8ace034d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/none/rss20.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/rss20.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/rss20.xml new file mode 100644 index 00000000..527c94b2 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/rss20.xml @@ -0,0 +1,8 @@ + + + + + Sat, 07 Mar 2009 08:03:50 +0000 + + + diff --git a/test/Reader/Entry/_files/Rss/description/plain/dc10/rss090.xml b/test/Reader/Entry/_files/Rss/description/plain/dc10/rss090.xml new file mode 100644 index 00000000..0399f878 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/dc10/rss090.xml @@ -0,0 +1,11 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/dc10/rss091.xml b/test/Reader/Entry/_files/Rss/description/plain/dc10/rss091.xml new file mode 100644 index 00000000..47148987 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/dc10/rss091.xml @@ -0,0 +1,9 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/dc10/rss092.xml b/test/Reader/Entry/_files/Rss/description/plain/dc10/rss092.xml new file mode 100644 index 00000000..1b5e129a --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/dc10/rss092.xml @@ -0,0 +1,9 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/dc10/rss093.xml b/test/Reader/Entry/_files/Rss/description/plain/dc10/rss093.xml new file mode 100644 index 00000000..63e562d0 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/dc10/rss093.xml @@ -0,0 +1,9 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/dc10/rss094.xml b/test/Reader/Entry/_files/Rss/description/plain/dc10/rss094.xml new file mode 100644 index 00000000..e647d4bc --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/dc10/rss094.xml @@ -0,0 +1,9 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/dc10/rss10.xml b/test/Reader/Entry/_files/Rss/description/plain/dc10/rss10.xml new file mode 100644 index 00000000..26d899f8 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/dc10/rss10.xml @@ -0,0 +1,11 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/dc10/rss20.xml b/test/Reader/Entry/_files/Rss/description/plain/dc10/rss20.xml new file mode 100644 index 00000000..08bff72e --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/dc10/rss20.xml @@ -0,0 +1,9 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/dc11/rss090.xml b/test/Reader/Entry/_files/Rss/description/plain/dc11/rss090.xml new file mode 100644 index 00000000..c2918646 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/dc11/rss090.xml @@ -0,0 +1,11 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/dc11/rss091.xml b/test/Reader/Entry/_files/Rss/description/plain/dc11/rss091.xml new file mode 100644 index 00000000..5af9974f --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/dc11/rss091.xml @@ -0,0 +1,9 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/dc11/rss092.xml b/test/Reader/Entry/_files/Rss/description/plain/dc11/rss092.xml new file mode 100644 index 00000000..65760fa0 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/dc11/rss092.xml @@ -0,0 +1,9 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/dc11/rss093.xml b/test/Reader/Entry/_files/Rss/description/plain/dc11/rss093.xml new file mode 100644 index 00000000..2a2dba03 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/dc11/rss093.xml @@ -0,0 +1,9 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/dc11/rss094.xml b/test/Reader/Entry/_files/Rss/description/plain/dc11/rss094.xml new file mode 100644 index 00000000..c4f07852 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/dc11/rss094.xml @@ -0,0 +1,9 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/dc11/rss10.xml b/test/Reader/Entry/_files/Rss/description/plain/dc11/rss10.xml new file mode 100644 index 00000000..941d89c3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/dc11/rss10.xml @@ -0,0 +1,11 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/dc11/rss20.xml b/test/Reader/Entry/_files/Rss/description/plain/dc11/rss20.xml new file mode 100644 index 00000000..c6664ac9 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/dc11/rss20.xml @@ -0,0 +1,9 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/none/rss090.xml b/test/Reader/Entry/_files/Rss/description/plain/none/rss090.xml new file mode 100644 index 00000000..57814153 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/none/rss090.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/none/rss091.xml b/test/Reader/Entry/_files/Rss/description/plain/none/rss091.xml new file mode 100644 index 00000000..04d999e3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/none/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/none/rss092.xml b/test/Reader/Entry/_files/Rss/description/plain/none/rss092.xml new file mode 100644 index 00000000..8b31a074 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/none/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/none/rss093.xml b/test/Reader/Entry/_files/Rss/description/plain/none/rss093.xml new file mode 100644 index 00000000..31d61445 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/none/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/none/rss094.xml b/test/Reader/Entry/_files/Rss/description/plain/none/rss094.xml new file mode 100644 index 00000000..e375a1d9 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/none/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/none/rss10.xml b/test/Reader/Entry/_files/Rss/description/plain/none/rss10.xml new file mode 100644 index 00000000..0ab6cc5b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/none/rss10.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/none/rss20.xml b/test/Reader/Entry/_files/Rss/description/plain/none/rss20.xml new file mode 100644 index 00000000..8ace034d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/none/rss20.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/rss090.xml b/test/Reader/Entry/_files/Rss/description/plain/rss090.xml new file mode 100644 index 00000000..08c37dbb --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/rss090.xml @@ -0,0 +1,10 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/rss091.xml b/test/Reader/Entry/_files/Rss/description/plain/rss091.xml new file mode 100644 index 00000000..bbfba4e6 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/rss091.xml @@ -0,0 +1,8 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/rss092.xml b/test/Reader/Entry/_files/Rss/description/plain/rss092.xml new file mode 100644 index 00000000..cb1d8367 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/rss092.xml @@ -0,0 +1,8 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/rss093.xml b/test/Reader/Entry/_files/Rss/description/plain/rss093.xml new file mode 100644 index 00000000..6007bef3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/rss093.xml @@ -0,0 +1,8 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/rss094.xml b/test/Reader/Entry/_files/Rss/description/plain/rss094.xml new file mode 100644 index 00000000..ced02b99 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/rss094.xml @@ -0,0 +1,8 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/rss10.xml b/test/Reader/Entry/_files/Rss/description/plain/rss10.xml new file mode 100644 index 00000000..95668d47 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/rss10.xml @@ -0,0 +1,10 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/description/plain/rss20.xml b/test/Reader/Entry/_files/Rss/description/plain/rss20.xml new file mode 100644 index 00000000..31d1e218 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/description/plain/rss20.xml @@ -0,0 +1,8 @@ + + + + + Entry Description + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/dc10/rss090.xml b/test/Reader/Entry/_files/Rss/id/plain/dc10/rss090.xml new file mode 100644 index 00000000..124a3f0e --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/dc10/rss090.xml @@ -0,0 +1,11 @@ + + + + + http://www.example.com/1 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/dc10/rss091.xml b/test/Reader/Entry/_files/Rss/id/plain/dc10/rss091.xml new file mode 100644 index 00000000..7e44ca88 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/dc10/rss091.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/1 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/dc10/rss092.xml b/test/Reader/Entry/_files/Rss/id/plain/dc10/rss092.xml new file mode 100644 index 00000000..b74ab66d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/dc10/rss092.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/1 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/dc10/rss093.xml b/test/Reader/Entry/_files/Rss/id/plain/dc10/rss093.xml new file mode 100644 index 00000000..67a32177 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/dc10/rss093.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/1 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/dc10/rss094.xml b/test/Reader/Entry/_files/Rss/id/plain/dc10/rss094.xml new file mode 100644 index 00000000..4c7175a6 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/dc10/rss094.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/1 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/dc10/rss10.xml b/test/Reader/Entry/_files/Rss/id/plain/dc10/rss10.xml new file mode 100644 index 00000000..c6cb3b3b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/dc10/rss10.xml @@ -0,0 +1,11 @@ + + + + + http://www.example.com/1 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/dc10/rss20.xml b/test/Reader/Entry/_files/Rss/id/plain/dc10/rss20.xml new file mode 100644 index 00000000..fda4aa1f --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/dc10/rss20.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/1 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/dc11/rss090.xml b/test/Reader/Entry/_files/Rss/id/plain/dc11/rss090.xml new file mode 100644 index 00000000..bbc8851c --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/dc11/rss090.xml @@ -0,0 +1,11 @@ + + + + + http://www.example.com/1 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/dc11/rss091.xml b/test/Reader/Entry/_files/Rss/id/plain/dc11/rss091.xml new file mode 100644 index 00000000..4daf0e8e --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/dc11/rss091.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/1 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/dc11/rss092.xml b/test/Reader/Entry/_files/Rss/id/plain/dc11/rss092.xml new file mode 100644 index 00000000..db934138 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/dc11/rss092.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/1 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/dc11/rss093.xml b/test/Reader/Entry/_files/Rss/id/plain/dc11/rss093.xml new file mode 100644 index 00000000..35129efb --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/dc11/rss093.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/1 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/dc11/rss094.xml b/test/Reader/Entry/_files/Rss/id/plain/dc11/rss094.xml new file mode 100644 index 00000000..cb77dbf5 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/dc11/rss094.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/1 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/dc11/rss10.xml b/test/Reader/Entry/_files/Rss/id/plain/dc11/rss10.xml new file mode 100644 index 00000000..b0e9c5bc --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/dc11/rss10.xml @@ -0,0 +1,11 @@ + + + + + http://www.example.com/1 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/dc11/rss20.xml b/test/Reader/Entry/_files/Rss/id/plain/dc11/rss20.xml new file mode 100644 index 00000000..7d3c4b20 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/dc11/rss20.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/1 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/none/rss090.xml b/test/Reader/Entry/_files/Rss/id/plain/none/rss090.xml new file mode 100644 index 00000000..57814153 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/none/rss090.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/none/rss091.xml b/test/Reader/Entry/_files/Rss/id/plain/none/rss091.xml new file mode 100644 index 00000000..04d999e3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/none/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/none/rss092.xml b/test/Reader/Entry/_files/Rss/id/plain/none/rss092.xml new file mode 100644 index 00000000..8b31a074 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/none/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/none/rss093.xml b/test/Reader/Entry/_files/Rss/id/plain/none/rss093.xml new file mode 100644 index 00000000..31d61445 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/none/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/none/rss094.xml b/test/Reader/Entry/_files/Rss/id/plain/none/rss094.xml new file mode 100644 index 00000000..e375a1d9 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/none/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/none/rss10.xml b/test/Reader/Entry/_files/Rss/id/plain/none/rss10.xml new file mode 100644 index 00000000..0ab6cc5b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/none/rss10.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/none/rss20.xml b/test/Reader/Entry/_files/Rss/id/plain/none/rss20.xml new file mode 100644 index 00000000..8ace034d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/none/rss20.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/rss090.xml b/test/Reader/Entry/_files/Rss/id/plain/rss090.xml new file mode 100644 index 00000000..57814153 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/rss090.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/rss091.xml b/test/Reader/Entry/_files/Rss/id/plain/rss091.xml new file mode 100644 index 00000000..04d999e3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/rss092.xml b/test/Reader/Entry/_files/Rss/id/plain/rss092.xml new file mode 100644 index 00000000..8b31a074 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/rss093.xml b/test/Reader/Entry/_files/Rss/id/plain/rss093.xml new file mode 100644 index 00000000..31d61445 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/rss094.xml b/test/Reader/Entry/_files/Rss/id/plain/rss094.xml new file mode 100644 index 00000000..e375a1d9 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/rss10.xml b/test/Reader/Entry/_files/Rss/id/plain/rss10.xml new file mode 100644 index 00000000..0ab6cc5b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/rss10.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/rss20.xml b/test/Reader/Entry/_files/Rss/id/plain/rss20.xml new file mode 100644 index 00000000..c80f7520 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/rss20.xml @@ -0,0 +1,8 @@ + + + + + http://www.example.com/1 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/title/rss090.xml b/test/Reader/Entry/_files/Rss/id/plain/title/rss090.xml new file mode 100644 index 00000000..3d074545 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/title/rss090.xml @@ -0,0 +1,11 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/title/rss091.xml b/test/Reader/Entry/_files/Rss/id/plain/title/rss091.xml new file mode 100644 index 00000000..bf84a7d8 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/title/rss091.xml @@ -0,0 +1,9 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/title/rss092.xml b/test/Reader/Entry/_files/Rss/id/plain/title/rss092.xml new file mode 100644 index 00000000..343a78de --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/title/rss092.xml @@ -0,0 +1,9 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/title/rss093.xml b/test/Reader/Entry/_files/Rss/id/plain/title/rss093.xml new file mode 100644 index 00000000..7ff5e6d8 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/title/rss093.xml @@ -0,0 +1,9 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/title/rss094.xml b/test/Reader/Entry/_files/Rss/id/plain/title/rss094.xml new file mode 100644 index 00000000..32e9ddc3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/title/rss094.xml @@ -0,0 +1,9 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/title/rss10.xml b/test/Reader/Entry/_files/Rss/id/plain/title/rss10.xml new file mode 100644 index 00000000..66e290d2 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/title/rss10.xml @@ -0,0 +1,11 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/id/plain/title/rss20.xml b/test/Reader/Entry/_files/Rss/id/plain/title/rss20.xml new file mode 100644 index 00000000..017ee3cb --- /dev/null +++ b/test/Reader/Entry/_files/Rss/id/plain/title/rss20.xml @@ -0,0 +1,9 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/link/plain/none/rss090.xml b/test/Reader/Entry/_files/Rss/link/plain/none/rss090.xml new file mode 100644 index 00000000..57814153 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/link/plain/none/rss090.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/link/plain/none/rss091.xml b/test/Reader/Entry/_files/Rss/link/plain/none/rss091.xml new file mode 100644 index 00000000..04d999e3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/link/plain/none/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/link/plain/none/rss092.xml b/test/Reader/Entry/_files/Rss/link/plain/none/rss092.xml new file mode 100644 index 00000000..8b31a074 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/link/plain/none/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/link/plain/none/rss093.xml b/test/Reader/Entry/_files/Rss/link/plain/none/rss093.xml new file mode 100644 index 00000000..31d61445 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/link/plain/none/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/link/plain/none/rss094.xml b/test/Reader/Entry/_files/Rss/link/plain/none/rss094.xml new file mode 100644 index 00000000..e375a1d9 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/link/plain/none/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/link/plain/none/rss10.xml b/test/Reader/Entry/_files/Rss/link/plain/none/rss10.xml new file mode 100644 index 00000000..0ab6cc5b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/link/plain/none/rss10.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/link/plain/none/rss20.xml b/test/Reader/Entry/_files/Rss/link/plain/none/rss20.xml new file mode 100644 index 00000000..8ace034d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/link/plain/none/rss20.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/link/plain/rss090.xml b/test/Reader/Entry/_files/Rss/link/plain/rss090.xml new file mode 100644 index 00000000..f629a31b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/link/plain/rss090.xml @@ -0,0 +1,10 @@ + + + + + http://www.example.com/entry + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/link/plain/rss091.xml b/test/Reader/Entry/_files/Rss/link/plain/rss091.xml new file mode 100644 index 00000000..3b3718c0 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/link/plain/rss091.xml @@ -0,0 +1,8 @@ + + + + + http://www.example.com/entry + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/link/plain/rss092.xml b/test/Reader/Entry/_files/Rss/link/plain/rss092.xml new file mode 100644 index 00000000..37c3483f --- /dev/null +++ b/test/Reader/Entry/_files/Rss/link/plain/rss092.xml @@ -0,0 +1,8 @@ + + + + + http://www.example.com/entry + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/link/plain/rss093.xml b/test/Reader/Entry/_files/Rss/link/plain/rss093.xml new file mode 100644 index 00000000..87bca96a --- /dev/null +++ b/test/Reader/Entry/_files/Rss/link/plain/rss093.xml @@ -0,0 +1,8 @@ + + + + + http://www.example.com/entry + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/link/plain/rss094.xml b/test/Reader/Entry/_files/Rss/link/plain/rss094.xml new file mode 100644 index 00000000..6d989581 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/link/plain/rss094.xml @@ -0,0 +1,8 @@ + + + + + http://www.example.com/entry + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/link/plain/rss10.xml b/test/Reader/Entry/_files/Rss/link/plain/rss10.xml new file mode 100644 index 00000000..5b9faeeb --- /dev/null +++ b/test/Reader/Entry/_files/Rss/link/plain/rss10.xml @@ -0,0 +1,10 @@ + + + + + http://www.example.com/entry + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/link/plain/rss20.xml b/test/Reader/Entry/_files/Rss/link/plain/rss20.xml new file mode 100644 index 00000000..6b58de28 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/link/plain/rss20.xml @@ -0,0 +1,8 @@ + + + + + http://www.example.com/entry + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/links/plain/none/rss090.xml b/test/Reader/Entry/_files/Rss/links/plain/none/rss090.xml new file mode 100644 index 00000000..57814153 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/links/plain/none/rss090.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/links/plain/none/rss091.xml b/test/Reader/Entry/_files/Rss/links/plain/none/rss091.xml new file mode 100644 index 00000000..04d999e3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/links/plain/none/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/links/plain/none/rss092.xml b/test/Reader/Entry/_files/Rss/links/plain/none/rss092.xml new file mode 100644 index 00000000..8b31a074 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/links/plain/none/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/links/plain/none/rss093.xml b/test/Reader/Entry/_files/Rss/links/plain/none/rss093.xml new file mode 100644 index 00000000..31d61445 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/links/plain/none/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/links/plain/none/rss094.xml b/test/Reader/Entry/_files/Rss/links/plain/none/rss094.xml new file mode 100644 index 00000000..e375a1d9 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/links/plain/none/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/links/plain/none/rss10.xml b/test/Reader/Entry/_files/Rss/links/plain/none/rss10.xml new file mode 100644 index 00000000..0ab6cc5b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/links/plain/none/rss10.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/links/plain/none/rss20.xml b/test/Reader/Entry/_files/Rss/links/plain/none/rss20.xml new file mode 100644 index 00000000..8ace034d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/links/plain/none/rss20.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/links/plain/rss090.xml b/test/Reader/Entry/_files/Rss/links/plain/rss090.xml new file mode 100644 index 00000000..dad0c290 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/links/plain/rss090.xml @@ -0,0 +1,11 @@ + + + + + http://www.example.com/entry + http://www.example.com/entry2 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/links/plain/rss091.xml b/test/Reader/Entry/_files/Rss/links/plain/rss091.xml new file mode 100644 index 00000000..54025361 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/links/plain/rss091.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/entry + http://www.example.com/entry2 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/links/plain/rss092.xml b/test/Reader/Entry/_files/Rss/links/plain/rss092.xml new file mode 100644 index 00000000..ff8bc7d3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/links/plain/rss092.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/entry + http://www.example.com/entry2 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/links/plain/rss093.xml b/test/Reader/Entry/_files/Rss/links/plain/rss093.xml new file mode 100644 index 00000000..f141e4f7 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/links/plain/rss093.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/entry + http://www.example.com/entry2 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/links/plain/rss094.xml b/test/Reader/Entry/_files/Rss/links/plain/rss094.xml new file mode 100644 index 00000000..130e9df8 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/links/plain/rss094.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/entry + http://www.example.com/entry2 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/links/plain/rss10.xml b/test/Reader/Entry/_files/Rss/links/plain/rss10.xml new file mode 100644 index 00000000..0ec0f34f --- /dev/null +++ b/test/Reader/Entry/_files/Rss/links/plain/rss10.xml @@ -0,0 +1,11 @@ + + + + + http://www.example.com/entry + http://www.example.com/entry2 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/links/plain/rss20.xml b/test/Reader/Entry/_files/Rss/links/plain/rss20.xml new file mode 100644 index 00000000..66a155fb --- /dev/null +++ b/test/Reader/Entry/_files/Rss/links/plain/rss20.xml @@ -0,0 +1,9 @@ + + + + + http://www.example.com/entry + http://www.example.com/entry2 + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/dc10/rss090.xml b/test/Reader/Entry/_files/Rss/title/plain/dc10/rss090.xml new file mode 100644 index 00000000..ac8b9ea9 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/dc10/rss090.xml @@ -0,0 +1,11 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/dc10/rss091.xml b/test/Reader/Entry/_files/Rss/title/plain/dc10/rss091.xml new file mode 100644 index 00000000..000e1404 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/dc10/rss091.xml @@ -0,0 +1,9 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/dc10/rss092.xml b/test/Reader/Entry/_files/Rss/title/plain/dc10/rss092.xml new file mode 100644 index 00000000..19b09aa4 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/dc10/rss092.xml @@ -0,0 +1,9 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/dc10/rss093.xml b/test/Reader/Entry/_files/Rss/title/plain/dc10/rss093.xml new file mode 100644 index 00000000..d4358320 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/dc10/rss093.xml @@ -0,0 +1,9 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/dc10/rss094.xml b/test/Reader/Entry/_files/Rss/title/plain/dc10/rss094.xml new file mode 100644 index 00000000..f6705f18 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/dc10/rss094.xml @@ -0,0 +1,9 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/dc10/rss10.xml b/test/Reader/Entry/_files/Rss/title/plain/dc10/rss10.xml new file mode 100644 index 00000000..7f15ef3d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/dc10/rss10.xml @@ -0,0 +1,11 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/dc10/rss20.xml b/test/Reader/Entry/_files/Rss/title/plain/dc10/rss20.xml new file mode 100644 index 00000000..55666231 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/dc10/rss20.xml @@ -0,0 +1,9 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/dc11/rss090.xml b/test/Reader/Entry/_files/Rss/title/plain/dc11/rss090.xml new file mode 100644 index 00000000..3d074545 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/dc11/rss090.xml @@ -0,0 +1,11 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/dc11/rss091.xml b/test/Reader/Entry/_files/Rss/title/plain/dc11/rss091.xml new file mode 100644 index 00000000..bf84a7d8 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/dc11/rss091.xml @@ -0,0 +1,9 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/dc11/rss092.xml b/test/Reader/Entry/_files/Rss/title/plain/dc11/rss092.xml new file mode 100644 index 00000000..343a78de --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/dc11/rss092.xml @@ -0,0 +1,9 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/dc11/rss093.xml b/test/Reader/Entry/_files/Rss/title/plain/dc11/rss093.xml new file mode 100644 index 00000000..7ff5e6d8 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/dc11/rss093.xml @@ -0,0 +1,9 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/dc11/rss094.xml b/test/Reader/Entry/_files/Rss/title/plain/dc11/rss094.xml new file mode 100644 index 00000000..32e9ddc3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/dc11/rss094.xml @@ -0,0 +1,9 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/dc11/rss10.xml b/test/Reader/Entry/_files/Rss/title/plain/dc11/rss10.xml new file mode 100644 index 00000000..66e290d2 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/dc11/rss10.xml @@ -0,0 +1,11 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/dc11/rss20.xml b/test/Reader/Entry/_files/Rss/title/plain/dc11/rss20.xml new file mode 100644 index 00000000..017ee3cb --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/dc11/rss20.xml @@ -0,0 +1,9 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/none/rss090.xml b/test/Reader/Entry/_files/Rss/title/plain/none/rss090.xml new file mode 100644 index 00000000..57814153 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/none/rss090.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/none/rss091.xml b/test/Reader/Entry/_files/Rss/title/plain/none/rss091.xml new file mode 100644 index 00000000..04d999e3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/none/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/none/rss092.xml b/test/Reader/Entry/_files/Rss/title/plain/none/rss092.xml new file mode 100644 index 00000000..8b31a074 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/none/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/none/rss093.xml b/test/Reader/Entry/_files/Rss/title/plain/none/rss093.xml new file mode 100644 index 00000000..31d61445 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/none/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/none/rss094.xml b/test/Reader/Entry/_files/Rss/title/plain/none/rss094.xml new file mode 100644 index 00000000..e375a1d9 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/none/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/none/rss10.xml b/test/Reader/Entry/_files/Rss/title/plain/none/rss10.xml new file mode 100644 index 00000000..0ab6cc5b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/none/rss10.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/none/rss20.xml b/test/Reader/Entry/_files/Rss/title/plain/none/rss20.xml new file mode 100644 index 00000000..8ace034d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/none/rss20.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/rss090.xml b/test/Reader/Entry/_files/Rss/title/plain/rss090.xml new file mode 100644 index 00000000..120da2a6 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/rss090.xml @@ -0,0 +1,10 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/rss091.xml b/test/Reader/Entry/_files/Rss/title/plain/rss091.xml new file mode 100644 index 00000000..d1818650 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/rss091.xml @@ -0,0 +1,8 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/rss092.xml b/test/Reader/Entry/_files/Rss/title/plain/rss092.xml new file mode 100644 index 00000000..57b71b1d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/rss092.xml @@ -0,0 +1,8 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/rss093.xml b/test/Reader/Entry/_files/Rss/title/plain/rss093.xml new file mode 100644 index 00000000..990fbaf3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/rss093.xml @@ -0,0 +1,8 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/rss094.xml b/test/Reader/Entry/_files/Rss/title/plain/rss094.xml new file mode 100644 index 00000000..d1af2a75 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/rss094.xml @@ -0,0 +1,8 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/rss10.xml b/test/Reader/Entry/_files/Rss/title/plain/rss10.xml new file mode 100644 index 00000000..75045d5e --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/rss10.xml @@ -0,0 +1,10 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/title/plain/rss20.xml b/test/Reader/Entry/_files/Rss/title/plain/rss20.xml new file mode 100644 index 00000000..056d3f8c --- /dev/null +++ b/test/Reader/Entry/_files/Rss/title/plain/rss20.xml @@ -0,0 +1,8 @@ + + + + + Entry Title + + + \ No newline at end of file diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php new file mode 100644 index 00000000..527aecfd --- /dev/null +++ b/test/Reader/Feed/AtomTest.php @@ -0,0 +1,283 @@ +_feedSamplePath = dirname(__FILE__) . '/_files/Atom'; + } + + /** + * Get Title (Unencoded Text) + */ + public function testGetsTitleFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/atom03.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/atom10.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + /** + * Get Authors (Unencoded Text) + */ + public function testGetsAuthorArrayFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/atom03.xml') + ); + + $authors = array( + 0 => 'joe@example.com (Joe Bloggs)', + 1 => 'Joe Bloggs', + 3 => 'joe@example.com', + 4 => 'http://www.example.com', + 6 => 'jane@example.com (Jane Bloggs)' + ); + + $this->assertEquals($authors, $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/atom10.xml') + ); + + $authors = array( + 0 => 'joe@example.com (Joe Bloggs)', + 1 => 'Joe Bloggs', + 3 => 'joe@example.com', + 4 => 'http://www.example.com', + 6 => 'jane@example.com (Jane Bloggs)' + ); + + $this->assertEquals($authors, $feed->getAuthors()); + } + + /** + * Get Single Author (Unencoded Text) + */ + public function testGetsSingleAuthorFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/atom03.xml') + ); + + $this->assertEquals('joe@example.com (Joe Bloggs)', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/atom10.xml') + ); + + $this->assertEquals('joe@example.com (Joe Bloggs)', $feed->getAuthor()); + } + + /** + * Get creation date (Unencoded Text) + */ + public function testGetsDateCreatedFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom03.xml') + ); + + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateCreated()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateCreatedFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom10.xml') + ); + + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateCreated()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + /** + * Get modification date (Unencoded Text) + */ + public function testGetsDateModifiedFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom03.xml') + ); + + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom10.xml') + ); + + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + /** + * Get Generator (Unencoded Text) + */ + public function testGetsGeneratorFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/generator/plain/atom03.xml') + ); + $this->assertEquals('Zend_Feed', $feed->getGenerator()); + } + + public function testGetsGeneratorFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/generator/plain/atom10.xml') + ); + $this->assertEquals('Zend_Feed', $feed->getGenerator()); + } + + /** + * Get Copyright (Unencoded Text) + */ + public function testGetsCopyrightFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/atom03.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/atom10.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + /** + * Get Description (Unencoded Text) + */ + public function testGetsDescriptionFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/atom03.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/atom10.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + /** + * Get Id (Unencoded Text) + */ + public function testGetsIdFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/atom03.xml') + ); + $this->assertEquals('123', $feed->getId()); + } + + public function testGetsIdFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/plain/atom10.xml') + ); + $this->assertEquals('123', $feed->getId()); + } + + /** + * Get Language (Unencoded Text) + */ + public function testGetsLanguageFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/atom03.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/atom10.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + /** + * Get Link (Unencoded Text) + */ + public function testGetsLinkFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/atom03.xml') + ); + $this->assertEquals('http://www.example.com', $feed->getLink()); + } + + public function testGetsLinkFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/atom10.xml') + ); + $this->assertEquals('http://www.example.com', $feed->getLink()); + } + + /** + * Get Feed Link (Unencoded Text) + */ + public function testGetsFeedLinkFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom03.xml') + ); + $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); + } + + public function testGetsFeedLinkFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom10.xml') + ); + $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); + } + + /** + * Implements Countable + */ + + public function testCountableInterface() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/atom10.xml') + ); + $this->assertEquals(0, count($feed)); + } +} diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php new file mode 100644 index 00000000..93f00cb5 --- /dev/null +++ b/test/Reader/Feed/RssTest.php @@ -0,0 +1,2169 @@ +_feedSamplePath = dirname(__FILE__) . '/_files/Rss'; + } + + /** + * Get Title (Unencoded Text) + */ + public function testGetsTitleFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/rss20.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/rss094.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/rss093.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/rss092.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/rss091.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/rss10.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/rss090.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + // DC 1.0 + + public function testGetsTitleFromRss20_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss20.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss094_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss094.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss093_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss093.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss092_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss092.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss091_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss091.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss10_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss10.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss090_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss090.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + // DC 1.1 + + public function testGetsTitleFromRss20_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss20.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss094_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss094.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss093_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss093.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss092_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss092.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss091_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss091.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss10_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss10.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss090_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss090.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + // Atom 1.0 + + public function testGetsTitleFromRss20_atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss20.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss094_atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss094.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss093_atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss093.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss092_atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss092.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss091_atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss091.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss10_atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss10.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + public function testGetsTitleFromRss090_atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss090.xml') + ); + $this->assertEquals('My Title', $feed->getTitle()); + } + + // Missing Title + + public function testGetsTitleFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/none/rss20.xml') + ); + $this->assertEquals(null, $feed->getTitle()); + } + + public function testGetsTitleFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/none/rss094.xml') + ); + $this->assertEquals(null, $feed->getTitle()); + } + + public function testGetsTitleFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/none/rss093.xml') + ); + $this->assertEquals(null, $feed->getTitle()); + } + + public function testGetsTitleFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/none/rss092.xml') + ); + $this->assertEquals(null, $feed->getTitle()); + } + + public function testGetsTitleFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/none/rss091.xml') + ); + $this->assertEquals(null, $feed->getTitle()); + } + + public function testGetsTitleFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/none/rss10.xml') + ); + $this->assertEquals(null, $feed->getTitle()); + } + + public function testGetsTitleFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/plain/none/rss090.xml') + ); + $this->assertEquals(null, $feed->getTitle()); + } + + /** + * Get Authors (Unencoded Text) + */ + public function testGetsAuthorArrayFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + // DC 1.0 + + public function testGetsAuthorArrayFromRss20_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss094_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss093_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss092_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss091_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss10_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss090_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + // DC 1.1 + + public function testGetsAuthorArrayFromRss20_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss094_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss093_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss092_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss091_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss10_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss090_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + // Atom 1.0 + + public function testGetsAuthorArrayFromRss20_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss20.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss094_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss094.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss093_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss093.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss092_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss092.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss091_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss091.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss10_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss10.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss090_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss090.xml') + ); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + } + + // Missing Authors + + public function testGetsAuthorArrayFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss20.xml') + ); + $this->assertEquals(null, $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss094.xml') + ); + $this->assertEquals(null, $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss093.xml') + ); + $this->assertEquals(null, $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss092.xml') + ); + $this->assertEquals(null, $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss091.xml') + ); + $this->assertEquals(null, $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss10.xml') + ); + $this->assertEquals(null, $feed->getAuthors()); + } + + public function testGetsAuthorArrayFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss090.xml') + ); + $this->assertEquals(null, $feed->getAuthors()); + } + + /** + * Get Single Author (Unencoded Text) + */ + public function testGetsSingleAuthorFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + // DC 1.0 + + public function testGetsSingleAuthorFromRss20_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss094_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss093_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss092_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss091_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss10_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss090_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + // DC 1.1 + + public function testGetsSingleAuthorFromRss20_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss094_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss093_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss092_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss091_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss10_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss090_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') + ); + $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + } + + // Missing Author + + public function testGetsSingleAuthorFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss20.xml') + ); + $this->assertEquals(null, $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss094.xml') + ); + $this->assertEquals(null, $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss093.xml') + ); + $this->assertEquals(null, $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss092.xml') + ); + $this->assertEquals(null, $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss091.xml') + ); + $this->assertEquals(null, $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss10.xml') + ); + $this->assertEquals(null, $feed->getAuthor()); + } + + public function testGetsSingleAuthorFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/plain/none/rss090.xml') + ); + $this->assertEquals(null, $feed->getAuthor()); + } + + /** + * Get Copyright (Unencoded Text) + */ + public function testGetsCopyrightFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/rss20.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/rss094.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/rss093.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/rss092.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/rss091.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/rss10.xml') + ); + $this->assertEquals(null, $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/rss090.xml') + ); + $this->assertEquals(null, $feed->getCopyright()); + } + + // DC 1.0 + + public function testGetsCopyrightFromRss20_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss20.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss094_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss094.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss093_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss093.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss092_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss092.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss091_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss091.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss10_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss10.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss090_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss090.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + // DC 1.1 + + public function testGetsCopyrightFromRss20_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss20.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss094_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss094.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss093_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss093.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss092_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss092.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss091_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss091.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss10_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss10.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss090_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss090.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + // Missing Copyright + + public function testGetsCopyrightFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss20.xml') + ); + $this->assertEquals(null, $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss094.xml') + ); + $this->assertEquals(null, $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss093.xml') + ); + $this->assertEquals(null, $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss092.xml') + ); + $this->assertEquals(null, $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss091.xml') + ); + $this->assertEquals(null, $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss10.xml') + ); + $this->assertEquals(null, $feed->getCopyright()); + } + + public function testGetsCopyrightFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss090.xml') + ); + $this->assertEquals(null, $feed->getCopyright()); + } + + /** + * Get Description (Unencoded Text) + */ + public function testGetsDescriptionFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/rss20.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/rss094.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/rss093.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/rss092.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/rss091.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/rss10.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/rss090.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + // DC 1.0 + + public function testGetsDescriptionFromRss20_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss20.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss094_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss094.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss093_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss093.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss092_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss092.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss091_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss091.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss10_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss10.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss090_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss090.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + // DC 1.1 + + public function testGetsDescriptionFromRss20_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss20.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss094_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss094.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss093_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss093.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss092_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss092.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss091_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss091.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss10_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss10.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + public function testGetsDescriptionFromRss090_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss090.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + // Missing Description + + public function testGetsDescriptionFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/none/rss20.xml') + ); + $this->assertEquals(null, $feed->getDescription()); + } + + public function testGetsDescriptionFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/none/rss094.xml') + ); + $this->assertEquals(null, $feed->getDescription()); + } + + public function testGetsDescriptionFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/none/rss093.xml') + ); + $this->assertEquals(null, $feed->getDescription()); + } + + public function testGetsDescriptionFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/none/rss092.xml') + ); + $this->assertEquals(null, $feed->getDescription()); + } + + public function testGetsDescriptionFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/none/rss091.xml') + ); + $this->assertEquals(null, $feed->getDescription()); + } + + public function testGetsDescriptionFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/none/rss10.xml') + ); + $this->assertEquals(null, $feed->getDescription()); + } + + public function testGetsDescriptionFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/plain/none/rss090.xml') + ); + $this->assertEquals(null, $feed->getDescription()); + } + + /** + * Get Language (Unencoded Text) + */ + public function testGetsLanguageFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/rss20.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/rss094.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/rss093.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/rss092.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/rss091.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/rss10.xml') + ); + $this->assertEquals(null, $feed->getLanguage()); + } + + public function testGetsLanguageFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/rss090.xml') + ); + $this->assertEquals(null, $feed->getLanguage()); + } + + // DC 1.0 + + public function testGetsLanguageFromRss20_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss20.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromRss094_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss094.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromRss093_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss093.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromRss092_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss092.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromRss091_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss091.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromRss10_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss10.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromRss090_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss090.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + // DC 1.1 + + public function testGetsLanguageFromRss20_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss20.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromRss094_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss094.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromRss093_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss093.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromRss092_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss092.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromRss091_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss091.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromRss10_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss10.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + public function testGetsLanguageFromRss090_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss090.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + // Other + + public function testGetsLanguageFromRss10_XmlLang() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/rdf/rss10.xml') + ); + $this->assertEquals('en', $feed->getLanguage()); + } + + // Missing Language + + public function testGetsLanguageFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/none/rss20.xml') + ); + $this->assertEquals(null, $feed->getLanguage()); + } + + public function testGetsLanguageFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/none/rss094.xml') + ); + $this->assertEquals(null, $feed->getLanguage()); + } + + public function testGetsLanguageFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/none/rss093.xml') + ); + $this->assertEquals(null, $feed->getLanguage()); + } + + public function testGetsLanguageFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/none/rss092.xml') + ); + $this->assertEquals(null, $feed->getLanguage()); + } + + public function testGetsLanguageFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/none/rss091.xml') + ); + $this->assertEquals(null, $feed->getLanguage()); + } + + public function testGetsLanguageFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/none/rss10.xml') + ); + $this->assertEquals(null, $feed->getLanguage()); + } + + public function testGetsLanguageFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/plain/none/rss090.xml') + ); + $this->assertEquals(null, $feed->getLanguage()); + } + + /** + * Get Link (Unencoded Text) + */ + public function testGetsLinkFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/rss20.xml') + ); + $this->assertEquals('http://www.example.com', $feed->getLink()); + } + + public function testGetsLinkFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/rss094.xml') + ); + $this->assertEquals('http://www.example.com', $feed->getLink()); + } + + public function testGetsLinkFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/rss093.xml') + ); + $this->assertEquals('http://www.example.com', $feed->getLink()); + } + + public function testGetsLinkFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/rss092.xml') + ); + $this->assertEquals('http://www.example.com', $feed->getLink()); + } + + public function testGetsLinkFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/rss091.xml') + ); + $this->assertEquals('http://www.example.com', $feed->getLink()); + } + + public function testGetsLinkFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/rss10.xml') + ); + $this->assertEquals('http://www.example.com', $feed->getLink()); + } + + public function testGetsLinkFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/rss090.xml') + ); + $this->assertEquals('http://www.example.com', $feed->getLink()); + } + + // Missing Link + + public function testGetsLinkFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/none/rss20.xml') + ); + $this->assertEquals(null, $feed->getLink()); + } + + public function testGetsLinkFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/none/rss094.xml') + ); + $this->assertEquals(null, $feed->getLink()); + } + + public function testGetsLinkFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/none/rss093.xml') + ); + $this->assertEquals(null, $feed->getLink()); + } + + public function testGetsLinkFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/none/rss092.xml') + ); + $this->assertEquals(null, $feed->getLink()); + } + + public function testGetsLinkFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/none/rss091.xml') + ); + $this->assertEquals(null, $feed->getLink()); + } + + public function testGetsLinkFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/none/rss10.xml') + ); + $this->assertEquals(null, $feed->getLink()); + } + + public function testGetsLinkFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/none/rss090.xml') + ); + $this->assertEquals(null, $feed->getLink()); + } + + /** + * Implements Countable + */ + + public function testCountableInterface() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/none/rss090.xml') + ); + $this->assertEquals(0, count($feed)); + } + + /** + * Get Feed Link (Unencoded Text) + */ + public function testGetsFeedLinkFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss20.xml') + ); + $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); + } + + public function testGetsFeedLinkFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss094.xml') + ); + $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); + } + + public function testGetsFeedLinkFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss093.xml') + ); + $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); + } + + public function testGetsFeedLinkFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss092.xml') + ); + $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); + } + + public function testGetsFeedLinkFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss091.xml') + ); + $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); + } + + public function testGetsFeedLinkFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss10.xml') + ); + $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); + } + + public function testGetsFeedLinkFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss090.xml') + ); + $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); + } + + // Missing Feed Link + + public function testGetsFeedLinkFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss20.xml') + ); + $this->assertEquals(null, $feed->getFeedLink()); + } + + public function testGetsFeedLinkFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss094.xml') + ); + $this->assertEquals(null, $feed->getFeedLink()); + } + + public function testGetsFeedLinkFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss093.xml') + ); + $this->assertEquals(null, $feed->getFeedLink()); + } + + public function testGetsFeedLinkFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss092.xml') + ); + $this->assertEquals(null, $feed->getFeedLink()); + } + + public function testGetsFeedLinkFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss091.xml') + ); + $this->assertEquals(null, $feed->getFeedLink()); + } + + public function testGetsFeedLinkFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss10.xml') + ); + $this->assertEquals(null, $feed->getFeedLink()); + } + + public function testGetsFeedLinkFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss090.xml') + ); + $this->assertEquals(null, $feed->getFeedLink()); + } + + /** + * Get Generator (Unencoded Text) + */ + public function testGetsGeneratorFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/generator/plain/rss20.xml') + ); + $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); + } + + public function testGetsGeneratorFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/generator/plain/rss094.xml') + ); + $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); + } + + public function testGetsGeneratorFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/generator/plain/rss093.xml') + ); + $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); + } + + public function testGetsGeneratorFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/generator/plain/rss092.xml') + ); + $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); + } + + public function testGetsGeneratorFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/generator/plain/rss091.xml') + ); + $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); + } + + public function testGetsGeneratorFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/generator/plain/rss10.xml') + ); + $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); + } + + public function testGetsGeneratorFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/generator/plain/rss090.xml') + ); + $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); + } + + // Missing Generator + + public function testGetsGeneratorFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss20.xml') + ); + $this->assertEquals(null, $feed->getGenerator()); + } + + public function testGetsGeneratorFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss094.xml') + ); + $this->assertEquals(null, $feed->getGenerator()); + } + + public function testGetsGeneratorFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss093.xml') + ); + $this->assertEquals(null, $feed->getGenerator()); + } + + public function testGetsGeneratorFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss092.xml') + ); + $this->assertEquals(null, $feed->getGenerator()); + } + + public function testGetsGeneratorFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss091.xml') + ); + $this->assertEquals(null, $feed->getGenerator()); + } + + public function testGetsGeneratorFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss10.xml') + ); + $this->assertEquals(null, $feed->getGenerator()); + } + + public function testGetsGeneratorFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss090.xml') + ); + $this->assertEquals(null, $feed->getGenerator()); + } + + /** + * Get Date Modified (Unencoded Text) + */ + public function testGetsDateModifiedFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + // DC 1.0 + + public function testGetsDateModifiedFromRss20_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss20.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss094_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss094.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss093_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss093.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss092_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss092.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss091_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss091.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss10_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss10.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss090_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss090.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + // DC 1.1 + + public function testGetsDateModifiedFromRss20_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss20.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss094_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss094.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss093_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss093.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss092_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss092.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss091_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss091.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss10_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss10.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss090_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss090.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + // Atom 1.0 + + public function testGetsDateModifiedFromRss20_atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss20.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss094_atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss094.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss093_atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss093.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss092_atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss092.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss091_atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss091.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss10_atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss10.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + public function testGetsDateModifiedFromRss090_atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss090.xml') + ); + $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + + // Missing DateModified + + public function testGetsDateModifiedFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss20.xml') + ); + $this->assertEquals(null, $feed->getDateModified()); + } + + public function testGetsDateModifiedFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss094.xml') + ); + $this->assertEquals(null, $feed->getDateModified()); + } + + public function testGetsDateModifiedFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss093.xml') + ); + $this->assertEquals(null, $feed->getDateModified()); + } + + public function testGetsDateModifiedFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss092.xml') + ); + $this->assertEquals(null, $feed->getDateModified()); + } + + public function testGetsDateModifiedFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss091.xml') + ); + $this->assertEquals(null, $feed->getDateModified()); + } + + public function testGetsDateModifiedFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss10.xml') + ); + $this->assertEquals(null, $feed->getDateModified()); + } + + public function testGetsDateModifiedFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss090.xml') + ); + $this->assertEquals(null, $feed->getDateModified()); + } + + +} diff --git a/test/Reader/Feed/_files/Atom/author/plain/atom03.xml b/test/Reader/Feed/_files/Atom/author/plain/atom03.xml new file mode 100644 index 00000000..b048f9da --- /dev/null +++ b/test/Reader/Feed/_files/Atom/author/plain/atom03.xml @@ -0,0 +1,45 @@ + + + + + Joe Bloggs + http://www.example.com + joe@example.com + + + Joe Bloggs + http://www.example.com + + + + Joe Bloggs + + + + + + http://www.example.com + joe@example.com + + + + http://www.example.com + + + + + + joe@example.com + + + + + + + + Jane Bloggs + http://www.example.com + jane@example.com + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Atom/author/plain/atom10.xml b/test/Reader/Feed/_files/Atom/author/plain/atom10.xml new file mode 100644 index 00000000..9032ac95 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/author/plain/atom10.xml @@ -0,0 +1,45 @@ + + + + + Joe Bloggs + http://www.example.com + joe@example.com + + + Joe Bloggs + http://www.example.com + + + + Joe Bloggs + + + + + + http://www.example.com + joe@example.com + + + + http://www.example.com + + + + + + joe@example.com + + + + + + + + Jane Bloggs + http://www.example.com + jane@example.com + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Atom/copyright/plain/atom03.xml b/test/Reader/Feed/_files/Atom/copyright/plain/atom03.xml new file mode 100644 index 00000000..f38134da --- /dev/null +++ b/test/Reader/Feed/_files/Atom/copyright/plain/atom03.xml @@ -0,0 +1,4 @@ + + + Copyright 2008 + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Atom/copyright/plain/atom10.xml b/test/Reader/Feed/_files/Atom/copyright/plain/atom10.xml new file mode 100644 index 00000000..c4fa4bf7 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/copyright/plain/atom10.xml @@ -0,0 +1,4 @@ + + + Copyright 2008 + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Atom/datecreated/plain/atom03.xml b/test/Reader/Feed/_files/Atom/datecreated/plain/atom03.xml new file mode 100644 index 00000000..a1121f4b --- /dev/null +++ b/test/Reader/Feed/_files/Atom/datecreated/plain/atom03.xml @@ -0,0 +1,4 @@ + + + 2009-03-07T08:03:50Z + diff --git a/test/Reader/Feed/_files/Atom/datecreated/plain/atom10.xml b/test/Reader/Feed/_files/Atom/datecreated/plain/atom10.xml new file mode 100644 index 00000000..9689fdaf --- /dev/null +++ b/test/Reader/Feed/_files/Atom/datecreated/plain/atom10.xml @@ -0,0 +1,4 @@ + + + 2009-03-07T08:03:50Z + diff --git a/test/Reader/Feed/_files/Atom/datemodified/plain/atom03.xml b/test/Reader/Feed/_files/Atom/datemodified/plain/atom03.xml new file mode 100644 index 00000000..1a5ee9d2 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/datemodified/plain/atom03.xml @@ -0,0 +1,4 @@ + + + 2009-03-07T08:03:50Z + diff --git a/test/Reader/Feed/_files/Atom/datemodified/plain/atom10.xml b/test/Reader/Feed/_files/Atom/datemodified/plain/atom10.xml new file mode 100644 index 00000000..e40fbcde --- /dev/null +++ b/test/Reader/Feed/_files/Atom/datemodified/plain/atom10.xml @@ -0,0 +1,4 @@ + + + 2009-03-07T08:03:50Z + diff --git a/test/Reader/Feed/_files/Atom/description/plain/atom03.xml b/test/Reader/Feed/_files/Atom/description/plain/atom03.xml new file mode 100644 index 00000000..90148a0a --- /dev/null +++ b/test/Reader/Feed/_files/Atom/description/plain/atom03.xml @@ -0,0 +1,4 @@ + + + My Description + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Atom/description/plain/atom10.xml b/test/Reader/Feed/_files/Atom/description/plain/atom10.xml new file mode 100644 index 00000000..150153d1 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/description/plain/atom10.xml @@ -0,0 +1,4 @@ + + + My Description + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Atom/feedlink/plain/atom03.xml b/test/Reader/Feed/_files/Atom/feedlink/plain/atom03.xml new file mode 100644 index 00000000..18cdf254 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/feedlink/plain/atom03.xml @@ -0,0 +1,4 @@ + + + + diff --git a/test/Reader/Feed/_files/Atom/feedlink/plain/atom10.xml b/test/Reader/Feed/_files/Atom/feedlink/plain/atom10.xml new file mode 100644 index 00000000..cd40d7fb --- /dev/null +++ b/test/Reader/Feed/_files/Atom/feedlink/plain/atom10.xml @@ -0,0 +1,4 @@ + + + + diff --git a/test/Reader/Feed/_files/Atom/generator/plain/atom03.xml b/test/Reader/Feed/_files/Atom/generator/plain/atom03.xml new file mode 100644 index 00000000..4ad408de --- /dev/null +++ b/test/Reader/Feed/_files/Atom/generator/plain/atom03.xml @@ -0,0 +1,4 @@ + + + Zend_Feed + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Atom/generator/plain/atom10.xml b/test/Reader/Feed/_files/Atom/generator/plain/atom10.xml new file mode 100644 index 00000000..5baa4976 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/generator/plain/atom10.xml @@ -0,0 +1,4 @@ + + + Zend_Feed + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Atom/id/plain/atom03.xml b/test/Reader/Feed/_files/Atom/id/plain/atom03.xml new file mode 100644 index 00000000..52a5eefd --- /dev/null +++ b/test/Reader/Feed/_files/Atom/id/plain/atom03.xml @@ -0,0 +1,4 @@ + + + 123 + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Atom/id/plain/atom10.xml b/test/Reader/Feed/_files/Atom/id/plain/atom10.xml new file mode 100644 index 00000000..0d01f356 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/id/plain/atom10.xml @@ -0,0 +1,4 @@ + + + 123 + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Atom/language/plain/atom03.xml b/test/Reader/Feed/_files/Atom/language/plain/atom03.xml new file mode 100644 index 00000000..236873b4 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/language/plain/atom03.xml @@ -0,0 +1,4 @@ + + + en-GB + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Atom/language/plain/atom10.xml b/test/Reader/Feed/_files/Atom/language/plain/atom10.xml new file mode 100644 index 00000000..8992d2e3 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/language/plain/atom10.xml @@ -0,0 +1,4 @@ + + + en-GB + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Atom/link/plain/atom03.xml b/test/Reader/Feed/_files/Atom/link/plain/atom03.xml new file mode 100644 index 00000000..8f0b1c9d --- /dev/null +++ b/test/Reader/Feed/_files/Atom/link/plain/atom03.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Atom/link/plain/atom10.xml b/test/Reader/Feed/_files/Atom/link/plain/atom10.xml new file mode 100644 index 00000000..18683bf9 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/link/plain/atom10.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Atom/title/plain/atom03.xml b/test/Reader/Feed/_files/Atom/title/plain/atom03.xml new file mode 100644 index 00000000..b4e1d6f4 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/title/plain/atom03.xml @@ -0,0 +1,4 @@ + + + My Title + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Atom/title/plain/atom10.xml b/test/Reader/Feed/_files/Atom/title/plain/atom10.xml new file mode 100644 index 00000000..c132bd25 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/title/plain/atom10.xml @@ -0,0 +1,4 @@ + + + My Title + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/atom10/rss090.xml b/test/Reader/Feed/_files/Rss/author/plain/atom10/rss090.xml new file mode 100644 index 00000000..c54ad25a --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/atom10/rss090.xml @@ -0,0 +1,16 @@ + + + + + + Joe Bloggs + + + Jane Bloggs + + + + diff --git a/test/Reader/Feed/_files/Rss/author/plain/atom10/rss091.xml b/test/Reader/Feed/_files/Rss/author/plain/atom10/rss091.xml new file mode 100644 index 00000000..854eb523 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/atom10/rss091.xml @@ -0,0 +1,14 @@ + + + + + + Joe Bloggs + + + Jane Bloggs + + + + diff --git a/test/Reader/Feed/_files/Rss/author/plain/atom10/rss092.xml b/test/Reader/Feed/_files/Rss/author/plain/atom10/rss092.xml new file mode 100644 index 00000000..68835bdc --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/atom10/rss092.xml @@ -0,0 +1,14 @@ + + + + + + Joe Bloggs + + + Jane Bloggs + + + + diff --git a/test/Reader/Feed/_files/Rss/author/plain/atom10/rss093.xml b/test/Reader/Feed/_files/Rss/author/plain/atom10/rss093.xml new file mode 100644 index 00000000..39bfb532 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/atom10/rss093.xml @@ -0,0 +1,14 @@ + + + + + + Joe Bloggs + + + Jane Bloggs + + + + diff --git a/test/Reader/Feed/_files/Rss/author/plain/atom10/rss094.xml b/test/Reader/Feed/_files/Rss/author/plain/atom10/rss094.xml new file mode 100644 index 00000000..f20b0c4e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/atom10/rss094.xml @@ -0,0 +1,14 @@ + + + + + + Joe Bloggs + + + Jane Bloggs + + + + diff --git a/test/Reader/Feed/_files/Rss/author/plain/atom10/rss10.xml b/test/Reader/Feed/_files/Rss/author/plain/atom10/rss10.xml new file mode 100644 index 00000000..c11eb555 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/atom10/rss10.xml @@ -0,0 +1,16 @@ + + + + + + Joe Bloggs + + + Jane Bloggs + + + + diff --git a/test/Reader/Feed/_files/Rss/author/plain/atom10/rss20.xml b/test/Reader/Feed/_files/Rss/author/plain/atom10/rss20.xml new file mode 100644 index 00000000..ce9bc241 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/atom10/rss20.xml @@ -0,0 +1,14 @@ + + + + + + Joe Bloggs + + + Jane Bloggs + + + + diff --git a/test/Reader/Feed/_files/Rss/author/plain/dc10/rss090.xml b/test/Reader/Feed/_files/Rss/author/plain/dc10/rss090.xml new file mode 100644 index 00000000..68e35c21 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/dc10/rss090.xml @@ -0,0 +1,12 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/dc10/rss091.xml b/test/Reader/Feed/_files/Rss/author/plain/dc10/rss091.xml new file mode 100644 index 00000000..a8ccda60 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/dc10/rss091.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/dc10/rss092.xml b/test/Reader/Feed/_files/Rss/author/plain/dc10/rss092.xml new file mode 100644 index 00000000..323729fd --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/dc10/rss092.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/dc10/rss093.xml b/test/Reader/Feed/_files/Rss/author/plain/dc10/rss093.xml new file mode 100644 index 00000000..84a68f2f --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/dc10/rss093.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/dc10/rss094.xml b/test/Reader/Feed/_files/Rss/author/plain/dc10/rss094.xml new file mode 100644 index 00000000..cfa540ad --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/dc10/rss094.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/dc10/rss10.xml b/test/Reader/Feed/_files/Rss/author/plain/dc10/rss10.xml new file mode 100644 index 00000000..8c8e8263 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/dc10/rss10.xml @@ -0,0 +1,12 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/dc10/rss20.xml b/test/Reader/Feed/_files/Rss/author/plain/dc10/rss20.xml new file mode 100644 index 00000000..4ad1c11b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/dc10/rss20.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/dc11/rss090.xml b/test/Reader/Feed/_files/Rss/author/plain/dc11/rss090.xml new file mode 100644 index 00000000..54e026b1 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/dc11/rss090.xml @@ -0,0 +1,12 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/dc11/rss091.xml b/test/Reader/Feed/_files/Rss/author/plain/dc11/rss091.xml new file mode 100644 index 00000000..1d7236c3 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/dc11/rss091.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/dc11/rss092.xml b/test/Reader/Feed/_files/Rss/author/plain/dc11/rss092.xml new file mode 100644 index 00000000..578d70f0 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/dc11/rss092.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/dc11/rss093.xml b/test/Reader/Feed/_files/Rss/author/plain/dc11/rss093.xml new file mode 100644 index 00000000..bbb90371 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/dc11/rss093.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/dc11/rss094.xml b/test/Reader/Feed/_files/Rss/author/plain/dc11/rss094.xml new file mode 100644 index 00000000..e61e7607 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/dc11/rss094.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/dc11/rss10.xml b/test/Reader/Feed/_files/Rss/author/plain/dc11/rss10.xml new file mode 100644 index 00000000..0fbb88ed --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/dc11/rss10.xml @@ -0,0 +1,12 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/dc11/rss20.xml b/test/Reader/Feed/_files/Rss/author/plain/dc11/rss20.xml new file mode 100644 index 00000000..a38aa4b5 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/dc11/rss20.xml @@ -0,0 +1,10 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/none/rss090.xml b/test/Reader/Feed/_files/Rss/author/plain/none/rss090.xml new file mode 100644 index 00000000..57814153 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/none/rss090.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/none/rss091.xml b/test/Reader/Feed/_files/Rss/author/plain/none/rss091.xml new file mode 100644 index 00000000..04d999e3 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/none/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/none/rss092.xml b/test/Reader/Feed/_files/Rss/author/plain/none/rss092.xml new file mode 100644 index 00000000..8b31a074 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/none/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/none/rss093.xml b/test/Reader/Feed/_files/Rss/author/plain/none/rss093.xml new file mode 100644 index 00000000..31d61445 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/none/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/none/rss094.xml b/test/Reader/Feed/_files/Rss/author/plain/none/rss094.xml new file mode 100644 index 00000000..e375a1d9 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/none/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/none/rss10.xml b/test/Reader/Feed/_files/Rss/author/plain/none/rss10.xml new file mode 100644 index 00000000..0ab6cc5b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/none/rss10.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/none/rss20.xml b/test/Reader/Feed/_files/Rss/author/plain/none/rss20.xml new file mode 100644 index 00000000..8ace034d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/none/rss20.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/rss090.xml b/test/Reader/Feed/_files/Rss/author/plain/rss090.xml new file mode 100644 index 00000000..585ca637 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/rss090.xml @@ -0,0 +1,11 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/rss091.xml b/test/Reader/Feed/_files/Rss/author/plain/rss091.xml new file mode 100644 index 00000000..c50d4aa2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/rss091.xml @@ -0,0 +1,9 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/rss092.xml b/test/Reader/Feed/_files/Rss/author/plain/rss092.xml new file mode 100644 index 00000000..7435c462 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/rss092.xml @@ -0,0 +1,9 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/rss093.xml b/test/Reader/Feed/_files/Rss/author/plain/rss093.xml new file mode 100644 index 00000000..f6fdf869 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/rss093.xml @@ -0,0 +1,9 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/rss094.xml b/test/Reader/Feed/_files/Rss/author/plain/rss094.xml new file mode 100644 index 00000000..ce138129 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/rss094.xml @@ -0,0 +1,9 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/rss10.xml b/test/Reader/Feed/_files/Rss/author/plain/rss10.xml new file mode 100644 index 00000000..4d751a71 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/rss10.xml @@ -0,0 +1,11 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/author/plain/rss20.xml b/test/Reader/Feed/_files/Rss/author/plain/rss20.xml new file mode 100644 index 00000000..73fd9080 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/author/plain/rss20.xml @@ -0,0 +1,9 @@ + + + + + Joe Bloggs + Jane Bloggs + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss090.xml b/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss090.xml new file mode 100644 index 00000000..90ceb847 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss090.xml @@ -0,0 +1,9 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss091.xml b/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss091.xml new file mode 100644 index 00000000..3f543e8e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss091.xml @@ -0,0 +1,7 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss092.xml b/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss092.xml new file mode 100644 index 00000000..243bda56 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss092.xml @@ -0,0 +1,7 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss093.xml b/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss093.xml new file mode 100644 index 00000000..731b4b56 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss093.xml @@ -0,0 +1,7 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss094.xml b/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss094.xml new file mode 100644 index 00000000..6f331763 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss094.xml @@ -0,0 +1,7 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss10.xml b/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss10.xml new file mode 100644 index 00000000..7817ee8f --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss10.xml @@ -0,0 +1,9 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss20.xml b/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss20.xml new file mode 100644 index 00000000..034df375 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/dc10/rss20.xml @@ -0,0 +1,7 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss090.xml b/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss090.xml new file mode 100644 index 00000000..7dcef6bf --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss090.xml @@ -0,0 +1,9 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss091.xml b/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss091.xml new file mode 100644 index 00000000..009f2b13 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss091.xml @@ -0,0 +1,7 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss092.xml b/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss092.xml new file mode 100644 index 00000000..a3cde924 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss092.xml @@ -0,0 +1,7 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss093.xml b/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss093.xml new file mode 100644 index 00000000..fd979613 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss093.xml @@ -0,0 +1,7 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss094.xml b/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss094.xml new file mode 100644 index 00000000..18472d60 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss094.xml @@ -0,0 +1,7 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss10.xml b/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss10.xml new file mode 100644 index 00000000..2313a8c3 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss10.xml @@ -0,0 +1,9 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss20.xml b/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss20.xml new file mode 100644 index 00000000..a25587a1 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/dc11/rss20.xml @@ -0,0 +1,7 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/none/rss090.xml b/test/Reader/Feed/_files/Rss/copyright/plain/none/rss090.xml new file mode 100644 index 00000000..3cec664b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/none/rss090.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/none/rss091.xml b/test/Reader/Feed/_files/Rss/copyright/plain/none/rss091.xml new file mode 100644 index 00000000..259a7e27 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/none/rss091.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/none/rss092.xml b/test/Reader/Feed/_files/Rss/copyright/plain/none/rss092.xml new file mode 100644 index 00000000..72ed43e2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/none/rss092.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/none/rss093.xml b/test/Reader/Feed/_files/Rss/copyright/plain/none/rss093.xml new file mode 100644 index 00000000..1fb8f89e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/none/rss093.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/none/rss094.xml b/test/Reader/Feed/_files/Rss/copyright/plain/none/rss094.xml new file mode 100644 index 00000000..30d48447 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/none/rss094.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/none/rss10.xml b/test/Reader/Feed/_files/Rss/copyright/plain/none/rss10.xml new file mode 100644 index 00000000..67f28b9d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/none/rss10.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/none/rss20.xml b/test/Reader/Feed/_files/Rss/copyright/plain/none/rss20.xml new file mode 100644 index 00000000..c60501ea --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/none/rss20.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/rss090.xml b/test/Reader/Feed/_files/Rss/copyright/plain/rss090.xml new file mode 100644 index 00000000..3cec664b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/rss090.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/rss091.xml b/test/Reader/Feed/_files/Rss/copyright/plain/rss091.xml new file mode 100644 index 00000000..ab4271a7 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/rss091.xml @@ -0,0 +1,6 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/rss092.xml b/test/Reader/Feed/_files/Rss/copyright/plain/rss092.xml new file mode 100644 index 00000000..3449a0d4 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/rss092.xml @@ -0,0 +1,6 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/rss093.xml b/test/Reader/Feed/_files/Rss/copyright/plain/rss093.xml new file mode 100644 index 00000000..c8cb4af8 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/rss093.xml @@ -0,0 +1,6 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/rss094.xml b/test/Reader/Feed/_files/Rss/copyright/plain/rss094.xml new file mode 100644 index 00000000..2f23632d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/rss094.xml @@ -0,0 +1,6 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/rss10.xml b/test/Reader/Feed/_files/Rss/copyright/plain/rss10.xml new file mode 100644 index 00000000..67f28b9d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/rss10.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/copyright/plain/rss20.xml b/test/Reader/Feed/_files/Rss/copyright/plain/rss20.xml new file mode 100644 index 00000000..e5e78f0d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/copyright/plain/rss20.xml @@ -0,0 +1,6 @@ + + + + Copyright 2008 + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss090.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss090.xml new file mode 100644 index 00000000..8435e417 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss090.xml @@ -0,0 +1,9 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss091.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss091.xml new file mode 100644 index 00000000..6a72b129 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss091.xml @@ -0,0 +1,7 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss092.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss092.xml new file mode 100644 index 00000000..c98df897 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss092.xml @@ -0,0 +1,7 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss093.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss093.xml new file mode 100644 index 00000000..857ee970 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss093.xml @@ -0,0 +1,7 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss094.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss094.xml new file mode 100644 index 00000000..9fb28087 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss094.xml @@ -0,0 +1,7 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss10.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss10.xml new file mode 100644 index 00000000..fe9e6490 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss10.xml @@ -0,0 +1,9 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss20.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss20.xml new file mode 100644 index 00000000..8f55b3f5 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/atom10/rss20.xml @@ -0,0 +1,7 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss090.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss090.xml new file mode 100644 index 00000000..96b513f8 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss090.xml @@ -0,0 +1,9 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss091.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss091.xml new file mode 100644 index 00000000..920d4513 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss091.xml @@ -0,0 +1,7 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss092.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss092.xml new file mode 100644 index 00000000..be7ace96 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss092.xml @@ -0,0 +1,7 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss093.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss093.xml new file mode 100644 index 00000000..c0e67a6d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss093.xml @@ -0,0 +1,7 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss094.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss094.xml new file mode 100644 index 00000000..4c8a82da --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss094.xml @@ -0,0 +1,7 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss10.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss10.xml new file mode 100644 index 00000000..af11177b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss10.xml @@ -0,0 +1,9 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss20.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss20.xml new file mode 100644 index 00000000..777d88e6 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/dc10/rss20.xml @@ -0,0 +1,7 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss090.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss090.xml new file mode 100644 index 00000000..da0a1a95 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss090.xml @@ -0,0 +1,9 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss091.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss091.xml new file mode 100644 index 00000000..9f9e85fd --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss091.xml @@ -0,0 +1,7 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss092.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss092.xml new file mode 100644 index 00000000..75ec5ec9 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss092.xml @@ -0,0 +1,7 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss093.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss093.xml new file mode 100644 index 00000000..e8d44a4a --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss093.xml @@ -0,0 +1,7 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss094.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss094.xml new file mode 100644 index 00000000..1a47cf8a --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss094.xml @@ -0,0 +1,7 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss10.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss10.xml new file mode 100644 index 00000000..c481fbda --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss10.xml @@ -0,0 +1,9 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss20.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss20.xml new file mode 100644 index 00000000..e87b1626 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/dc11/rss20.xml @@ -0,0 +1,7 @@ + + + + 2009-03-07T08:03:50Z + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss090.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss090.xml new file mode 100644 index 00000000..3cec664b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss090.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss091.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss091.xml new file mode 100644 index 00000000..259a7e27 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss091.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss092.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss092.xml new file mode 100644 index 00000000..72ed43e2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss092.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss093.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss093.xml new file mode 100644 index 00000000..1fb8f89e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss093.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss094.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss094.xml new file mode 100644 index 00000000..30d48447 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss094.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss10.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss10.xml new file mode 100644 index 00000000..34dd52da --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss10.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss20.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss20.xml new file mode 100644 index 00000000..c60501ea --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/none/rss20.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/rss20.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/rss20.xml new file mode 100644 index 00000000..5d22fe6e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/rss20.xml @@ -0,0 +1,6 @@ + + + + Sat, 07 Mar 2009 08:03:50 +0000 + + diff --git a/test/Reader/Feed/_files/Rss/description/plain/dc10/rss090.xml b/test/Reader/Feed/_files/Rss/description/plain/dc10/rss090.xml new file mode 100644 index 00000000..8cfb1c68 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/dc10/rss090.xml @@ -0,0 +1,9 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/dc10/rss091.xml b/test/Reader/Feed/_files/Rss/description/plain/dc10/rss091.xml new file mode 100644 index 00000000..2e29c3d5 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/dc10/rss091.xml @@ -0,0 +1,7 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/dc10/rss092.xml b/test/Reader/Feed/_files/Rss/description/plain/dc10/rss092.xml new file mode 100644 index 00000000..1d9a8865 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/dc10/rss092.xml @@ -0,0 +1,7 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/dc10/rss093.xml b/test/Reader/Feed/_files/Rss/description/plain/dc10/rss093.xml new file mode 100644 index 00000000..c89b10c5 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/dc10/rss093.xml @@ -0,0 +1,7 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/dc10/rss094.xml b/test/Reader/Feed/_files/Rss/description/plain/dc10/rss094.xml new file mode 100644 index 00000000..532d7414 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/dc10/rss094.xml @@ -0,0 +1,7 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/dc10/rss10.xml b/test/Reader/Feed/_files/Rss/description/plain/dc10/rss10.xml new file mode 100644 index 00000000..0b1c12bb --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/dc10/rss10.xml @@ -0,0 +1,9 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/dc10/rss20.xml b/test/Reader/Feed/_files/Rss/description/plain/dc10/rss20.xml new file mode 100644 index 00000000..11dd6289 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/dc10/rss20.xml @@ -0,0 +1,7 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/dc11/rss090.xml b/test/Reader/Feed/_files/Rss/description/plain/dc11/rss090.xml new file mode 100644 index 00000000..8d9040f2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/dc11/rss090.xml @@ -0,0 +1,9 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/dc11/rss091.xml b/test/Reader/Feed/_files/Rss/description/plain/dc11/rss091.xml new file mode 100644 index 00000000..2b0e79f5 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/dc11/rss091.xml @@ -0,0 +1,7 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/dc11/rss092.xml b/test/Reader/Feed/_files/Rss/description/plain/dc11/rss092.xml new file mode 100644 index 00000000..03bafab9 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/dc11/rss092.xml @@ -0,0 +1,7 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/dc11/rss093.xml b/test/Reader/Feed/_files/Rss/description/plain/dc11/rss093.xml new file mode 100644 index 00000000..67409856 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/dc11/rss093.xml @@ -0,0 +1,7 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/dc11/rss094.xml b/test/Reader/Feed/_files/Rss/description/plain/dc11/rss094.xml new file mode 100644 index 00000000..80973553 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/dc11/rss094.xml @@ -0,0 +1,7 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/dc11/rss10.xml b/test/Reader/Feed/_files/Rss/description/plain/dc11/rss10.xml new file mode 100644 index 00000000..ff142bbd --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/dc11/rss10.xml @@ -0,0 +1,9 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/dc11/rss20.xml b/test/Reader/Feed/_files/Rss/description/plain/dc11/rss20.xml new file mode 100644 index 00000000..a72cf2da --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/dc11/rss20.xml @@ -0,0 +1,7 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/none/rss090.xml b/test/Reader/Feed/_files/Rss/description/plain/none/rss090.xml new file mode 100644 index 00000000..3cec664b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/none/rss090.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/none/rss091.xml b/test/Reader/Feed/_files/Rss/description/plain/none/rss091.xml new file mode 100644 index 00000000..259a7e27 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/none/rss091.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/none/rss092.xml b/test/Reader/Feed/_files/Rss/description/plain/none/rss092.xml new file mode 100644 index 00000000..72ed43e2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/none/rss092.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/none/rss093.xml b/test/Reader/Feed/_files/Rss/description/plain/none/rss093.xml new file mode 100644 index 00000000..1fb8f89e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/none/rss093.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/none/rss094.xml b/test/Reader/Feed/_files/Rss/description/plain/none/rss094.xml new file mode 100644 index 00000000..30d48447 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/none/rss094.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/none/rss10.xml b/test/Reader/Feed/_files/Rss/description/plain/none/rss10.xml new file mode 100644 index 00000000..67f28b9d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/none/rss10.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/none/rss20.xml b/test/Reader/Feed/_files/Rss/description/plain/none/rss20.xml new file mode 100644 index 00000000..c60501ea --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/none/rss20.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/rss090.xml b/test/Reader/Feed/_files/Rss/description/plain/rss090.xml new file mode 100644 index 00000000..7b488320 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/rss090.xml @@ -0,0 +1,8 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/rss091.xml b/test/Reader/Feed/_files/Rss/description/plain/rss091.xml new file mode 100644 index 00000000..cc68fb4b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/rss091.xml @@ -0,0 +1,6 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/rss092.xml b/test/Reader/Feed/_files/Rss/description/plain/rss092.xml new file mode 100644 index 00000000..1bf7d27c --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/rss092.xml @@ -0,0 +1,6 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/rss093.xml b/test/Reader/Feed/_files/Rss/description/plain/rss093.xml new file mode 100644 index 00000000..a763d3f2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/rss093.xml @@ -0,0 +1,6 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/rss094.xml b/test/Reader/Feed/_files/Rss/description/plain/rss094.xml new file mode 100644 index 00000000..dc1db0fb --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/rss094.xml @@ -0,0 +1,6 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/rss10.xml b/test/Reader/Feed/_files/Rss/description/plain/rss10.xml new file mode 100644 index 00000000..17565226 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/rss10.xml @@ -0,0 +1,8 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/description/plain/rss20.xml b/test/Reader/Feed/_files/Rss/description/plain/rss20.xml new file mode 100644 index 00000000..ae9b934e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/description/plain/rss20.xml @@ -0,0 +1,6 @@ + + + + My Description + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss090.xml b/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss090.xml new file mode 100644 index 00000000..4eab29c2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss090.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss091.xml b/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss091.xml new file mode 100644 index 00000000..81c090da --- /dev/null +++ b/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss091.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss092.xml b/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss092.xml new file mode 100644 index 00000000..a4b9c6cb --- /dev/null +++ b/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss092.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss093.xml b/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss093.xml new file mode 100644 index 00000000..998ef757 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss093.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss094.xml b/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss094.xml new file mode 100644 index 00000000..4fb02a8b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss094.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss10.xml b/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss10.xml new file mode 100644 index 00000000..87774bad --- /dev/null +++ b/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss10.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss20.xml b/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss20.xml new file mode 100644 index 00000000..db102b5d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/feedlink/plain/none/rss20.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/feedlink/plain/rss090.xml b/test/Reader/Feed/_files/Rss/feedlink/plain/rss090.xml new file mode 100644 index 00000000..004bfd6c --- /dev/null +++ b/test/Reader/Feed/_files/Rss/feedlink/plain/rss090.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/test/Reader/Feed/_files/Rss/feedlink/plain/rss091.xml b/test/Reader/Feed/_files/Rss/feedlink/plain/rss091.xml new file mode 100644 index 00000000..fcbbeb65 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/feedlink/plain/rss091.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/test/Reader/Feed/_files/Rss/feedlink/plain/rss092.xml b/test/Reader/Feed/_files/Rss/feedlink/plain/rss092.xml new file mode 100644 index 00000000..b60f7fc3 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/feedlink/plain/rss092.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/test/Reader/Feed/_files/Rss/feedlink/plain/rss093.xml b/test/Reader/Feed/_files/Rss/feedlink/plain/rss093.xml new file mode 100644 index 00000000..a6e77af2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/feedlink/plain/rss093.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/test/Reader/Feed/_files/Rss/feedlink/plain/rss094.xml b/test/Reader/Feed/_files/Rss/feedlink/plain/rss094.xml new file mode 100644 index 00000000..99690d2d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/feedlink/plain/rss094.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/test/Reader/Feed/_files/Rss/feedlink/plain/rss10.xml b/test/Reader/Feed/_files/Rss/feedlink/plain/rss10.xml new file mode 100644 index 00000000..a2954c27 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/feedlink/plain/rss10.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/test/Reader/Feed/_files/Rss/feedlink/plain/rss20.xml b/test/Reader/Feed/_files/Rss/feedlink/plain/rss20.xml new file mode 100644 index 00000000..7a618962 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/feedlink/plain/rss20.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/test/Reader/Feed/_files/Rss/generator/plain/none/rss090.xml b/test/Reader/Feed/_files/Rss/generator/plain/none/rss090.xml new file mode 100644 index 00000000..4eab29c2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/generator/plain/none/rss090.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/generator/plain/none/rss091.xml b/test/Reader/Feed/_files/Rss/generator/plain/none/rss091.xml new file mode 100644 index 00000000..81c090da --- /dev/null +++ b/test/Reader/Feed/_files/Rss/generator/plain/none/rss091.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/generator/plain/none/rss092.xml b/test/Reader/Feed/_files/Rss/generator/plain/none/rss092.xml new file mode 100644 index 00000000..a4b9c6cb --- /dev/null +++ b/test/Reader/Feed/_files/Rss/generator/plain/none/rss092.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/generator/plain/none/rss093.xml b/test/Reader/Feed/_files/Rss/generator/plain/none/rss093.xml new file mode 100644 index 00000000..998ef757 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/generator/plain/none/rss093.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/generator/plain/none/rss094.xml b/test/Reader/Feed/_files/Rss/generator/plain/none/rss094.xml new file mode 100644 index 00000000..4fb02a8b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/generator/plain/none/rss094.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/generator/plain/none/rss10.xml b/test/Reader/Feed/_files/Rss/generator/plain/none/rss10.xml new file mode 100644 index 00000000..87774bad --- /dev/null +++ b/test/Reader/Feed/_files/Rss/generator/plain/none/rss10.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/generator/plain/none/rss20.xml b/test/Reader/Feed/_files/Rss/generator/plain/none/rss20.xml new file mode 100644 index 00000000..db102b5d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/generator/plain/none/rss20.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/generator/plain/rss090.xml b/test/Reader/Feed/_files/Rss/generator/plain/rss090.xml new file mode 100644 index 00000000..802065be --- /dev/null +++ b/test/Reader/Feed/_files/Rss/generator/plain/rss090.xml @@ -0,0 +1,9 @@ + + + + Zend_Feed_Writer + + diff --git a/test/Reader/Feed/_files/Rss/generator/plain/rss091.xml b/test/Reader/Feed/_files/Rss/generator/plain/rss091.xml new file mode 100644 index 00000000..3cd9b7e5 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/generator/plain/rss091.xml @@ -0,0 +1,7 @@ + + + + Zend_Feed_Writer + + diff --git a/test/Reader/Feed/_files/Rss/generator/plain/rss092.xml b/test/Reader/Feed/_files/Rss/generator/plain/rss092.xml new file mode 100644 index 00000000..57d489cb --- /dev/null +++ b/test/Reader/Feed/_files/Rss/generator/plain/rss092.xml @@ -0,0 +1,7 @@ + + + + Zend_Feed_Writer + + diff --git a/test/Reader/Feed/_files/Rss/generator/plain/rss093.xml b/test/Reader/Feed/_files/Rss/generator/plain/rss093.xml new file mode 100644 index 00000000..1f5be0a4 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/generator/plain/rss093.xml @@ -0,0 +1,7 @@ + + + + Zend_Feed_Writer + + diff --git a/test/Reader/Feed/_files/Rss/generator/plain/rss094.xml b/test/Reader/Feed/_files/Rss/generator/plain/rss094.xml new file mode 100644 index 00000000..28cf90ea --- /dev/null +++ b/test/Reader/Feed/_files/Rss/generator/plain/rss094.xml @@ -0,0 +1,7 @@ + + + + Zend_Feed_Writer + + diff --git a/test/Reader/Feed/_files/Rss/generator/plain/rss10.xml b/test/Reader/Feed/_files/Rss/generator/plain/rss10.xml new file mode 100644 index 00000000..39e4cf6e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/generator/plain/rss10.xml @@ -0,0 +1,9 @@ + + + + Zend_Feed_Writer + + diff --git a/test/Reader/Feed/_files/Rss/generator/plain/rss20.xml b/test/Reader/Feed/_files/Rss/generator/plain/rss20.xml new file mode 100644 index 00000000..d691c60d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/generator/plain/rss20.xml @@ -0,0 +1,6 @@ + + + + Zend_Feed_Writer + + diff --git a/test/Reader/Feed/_files/Rss/language/plain/dc10/rss090.xml b/test/Reader/Feed/_files/Rss/language/plain/dc10/rss090.xml new file mode 100644 index 00000000..bb022764 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/dc10/rss090.xml @@ -0,0 +1,9 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/dc10/rss091.xml b/test/Reader/Feed/_files/Rss/language/plain/dc10/rss091.xml new file mode 100644 index 00000000..9335a6c1 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/dc10/rss091.xml @@ -0,0 +1,7 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/dc10/rss092.xml b/test/Reader/Feed/_files/Rss/language/plain/dc10/rss092.xml new file mode 100644 index 00000000..dfbff1f3 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/dc10/rss092.xml @@ -0,0 +1,7 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/dc10/rss093.xml b/test/Reader/Feed/_files/Rss/language/plain/dc10/rss093.xml new file mode 100644 index 00000000..2e5c1421 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/dc10/rss093.xml @@ -0,0 +1,7 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/dc10/rss094.xml b/test/Reader/Feed/_files/Rss/language/plain/dc10/rss094.xml new file mode 100644 index 00000000..5958ca15 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/dc10/rss094.xml @@ -0,0 +1,7 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/dc10/rss10.xml b/test/Reader/Feed/_files/Rss/language/plain/dc10/rss10.xml new file mode 100644 index 00000000..9bc44bb9 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/dc10/rss10.xml @@ -0,0 +1,9 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/dc10/rss20.xml b/test/Reader/Feed/_files/Rss/language/plain/dc10/rss20.xml new file mode 100644 index 00000000..8323e8ee --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/dc10/rss20.xml @@ -0,0 +1,7 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/dc11/rss090.xml b/test/Reader/Feed/_files/Rss/language/plain/dc11/rss090.xml new file mode 100644 index 00000000..8491246f --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/dc11/rss090.xml @@ -0,0 +1,9 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/dc11/rss091.xml b/test/Reader/Feed/_files/Rss/language/plain/dc11/rss091.xml new file mode 100644 index 00000000..e871513f --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/dc11/rss091.xml @@ -0,0 +1,7 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/dc11/rss092.xml b/test/Reader/Feed/_files/Rss/language/plain/dc11/rss092.xml new file mode 100644 index 00000000..095ac721 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/dc11/rss092.xml @@ -0,0 +1,7 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/dc11/rss093.xml b/test/Reader/Feed/_files/Rss/language/plain/dc11/rss093.xml new file mode 100644 index 00000000..1698bd2e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/dc11/rss093.xml @@ -0,0 +1,7 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/dc11/rss094.xml b/test/Reader/Feed/_files/Rss/language/plain/dc11/rss094.xml new file mode 100644 index 00000000..83914a3e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/dc11/rss094.xml @@ -0,0 +1,7 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/dc11/rss10.xml b/test/Reader/Feed/_files/Rss/language/plain/dc11/rss10.xml new file mode 100644 index 00000000..ecc20dbc --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/dc11/rss10.xml @@ -0,0 +1,9 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/dc11/rss20.xml b/test/Reader/Feed/_files/Rss/language/plain/dc11/rss20.xml new file mode 100644 index 00000000..9dbd49a2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/dc11/rss20.xml @@ -0,0 +1,7 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/none/rss090.xml b/test/Reader/Feed/_files/Rss/language/plain/none/rss090.xml new file mode 100644 index 00000000..3cec664b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/none/rss090.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/none/rss091.xml b/test/Reader/Feed/_files/Rss/language/plain/none/rss091.xml new file mode 100644 index 00000000..259a7e27 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/none/rss091.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/none/rss092.xml b/test/Reader/Feed/_files/Rss/language/plain/none/rss092.xml new file mode 100644 index 00000000..72ed43e2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/none/rss092.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/none/rss093.xml b/test/Reader/Feed/_files/Rss/language/plain/none/rss093.xml new file mode 100644 index 00000000..1fb8f89e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/none/rss093.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/none/rss094.xml b/test/Reader/Feed/_files/Rss/language/plain/none/rss094.xml new file mode 100644 index 00000000..30d48447 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/none/rss094.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/none/rss10.xml b/test/Reader/Feed/_files/Rss/language/plain/none/rss10.xml new file mode 100644 index 00000000..67f28b9d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/none/rss10.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/none/rss20.xml b/test/Reader/Feed/_files/Rss/language/plain/none/rss20.xml new file mode 100644 index 00000000..c60501ea --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/none/rss20.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/rdf/rss10.xml b/test/Reader/Feed/_files/Rss/language/plain/rdf/rss10.xml new file mode 100644 index 00000000..2051d36b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/rdf/rss10.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/rss090.xml b/test/Reader/Feed/_files/Rss/language/plain/rss090.xml new file mode 100644 index 00000000..3cec664b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/rss090.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/rss091.xml b/test/Reader/Feed/_files/Rss/language/plain/rss091.xml new file mode 100644 index 00000000..612ed25c --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/rss091.xml @@ -0,0 +1,6 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/rss092.xml b/test/Reader/Feed/_files/Rss/language/plain/rss092.xml new file mode 100644 index 00000000..4f08019c --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/rss092.xml @@ -0,0 +1,6 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/rss093.xml b/test/Reader/Feed/_files/Rss/language/plain/rss093.xml new file mode 100644 index 00000000..dbace46b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/rss093.xml @@ -0,0 +1,6 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/rss094.xml b/test/Reader/Feed/_files/Rss/language/plain/rss094.xml new file mode 100644 index 00000000..d152c626 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/rss094.xml @@ -0,0 +1,6 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/rss10.xml b/test/Reader/Feed/_files/Rss/language/plain/rss10.xml new file mode 100644 index 00000000..67f28b9d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/rss10.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/language/plain/rss20.xml b/test/Reader/Feed/_files/Rss/language/plain/rss20.xml new file mode 100644 index 00000000..75e94e4d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/language/plain/rss20.xml @@ -0,0 +1,6 @@ + + + + en-GB + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/link/plain/none/rss090.xml b/test/Reader/Feed/_files/Rss/link/plain/none/rss090.xml new file mode 100644 index 00000000..3cec664b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/link/plain/none/rss090.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/link/plain/none/rss091.xml b/test/Reader/Feed/_files/Rss/link/plain/none/rss091.xml new file mode 100644 index 00000000..259a7e27 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/link/plain/none/rss091.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/link/plain/none/rss092.xml b/test/Reader/Feed/_files/Rss/link/plain/none/rss092.xml new file mode 100644 index 00000000..72ed43e2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/link/plain/none/rss092.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/link/plain/none/rss093.xml b/test/Reader/Feed/_files/Rss/link/plain/none/rss093.xml new file mode 100644 index 00000000..1fb8f89e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/link/plain/none/rss093.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/link/plain/none/rss094.xml b/test/Reader/Feed/_files/Rss/link/plain/none/rss094.xml new file mode 100644 index 00000000..30d48447 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/link/plain/none/rss094.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/link/plain/none/rss10.xml b/test/Reader/Feed/_files/Rss/link/plain/none/rss10.xml new file mode 100644 index 00000000..67f28b9d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/link/plain/none/rss10.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/link/plain/none/rss20.xml b/test/Reader/Feed/_files/Rss/link/plain/none/rss20.xml new file mode 100644 index 00000000..c60501ea --- /dev/null +++ b/test/Reader/Feed/_files/Rss/link/plain/none/rss20.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/link/plain/rss090.xml b/test/Reader/Feed/_files/Rss/link/plain/rss090.xml new file mode 100644 index 00000000..d891d3ac --- /dev/null +++ b/test/Reader/Feed/_files/Rss/link/plain/rss090.xml @@ -0,0 +1,8 @@ + + + + http://www.example.com + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/link/plain/rss091.xml b/test/Reader/Feed/_files/Rss/link/plain/rss091.xml new file mode 100644 index 00000000..cc8d59ad --- /dev/null +++ b/test/Reader/Feed/_files/Rss/link/plain/rss091.xml @@ -0,0 +1,6 @@ + + + + http://www.example.com + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/link/plain/rss092.xml b/test/Reader/Feed/_files/Rss/link/plain/rss092.xml new file mode 100644 index 00000000..4a109b0c --- /dev/null +++ b/test/Reader/Feed/_files/Rss/link/plain/rss092.xml @@ -0,0 +1,6 @@ + + + + http://www.example.com + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/link/plain/rss093.xml b/test/Reader/Feed/_files/Rss/link/plain/rss093.xml new file mode 100644 index 00000000..510d4ffc --- /dev/null +++ b/test/Reader/Feed/_files/Rss/link/plain/rss093.xml @@ -0,0 +1,6 @@ + + + + http://www.example.com + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/link/plain/rss094.xml b/test/Reader/Feed/_files/Rss/link/plain/rss094.xml new file mode 100644 index 00000000..28873451 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/link/plain/rss094.xml @@ -0,0 +1,6 @@ + + + + http://www.example.com + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/link/plain/rss10.xml b/test/Reader/Feed/_files/Rss/link/plain/rss10.xml new file mode 100644 index 00000000..d160c51c --- /dev/null +++ b/test/Reader/Feed/_files/Rss/link/plain/rss10.xml @@ -0,0 +1,8 @@ + + + + http://www.example.com + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/link/plain/rss20.xml b/test/Reader/Feed/_files/Rss/link/plain/rss20.xml new file mode 100644 index 00000000..7a64a43a --- /dev/null +++ b/test/Reader/Feed/_files/Rss/link/plain/rss20.xml @@ -0,0 +1,6 @@ + + + + http://www.example.com + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/atom10/rss090.xml b/test/Reader/Feed/_files/Rss/title/plain/atom10/rss090.xml new file mode 100644 index 00000000..50d10907 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/atom10/rss090.xml @@ -0,0 +1,9 @@ + + + + My Title + + diff --git a/test/Reader/Feed/_files/Rss/title/plain/atom10/rss091.xml b/test/Reader/Feed/_files/Rss/title/plain/atom10/rss091.xml new file mode 100644 index 00000000..8d2e066b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/atom10/rss091.xml @@ -0,0 +1,7 @@ + + + + My Title + + diff --git a/test/Reader/Feed/_files/Rss/title/plain/atom10/rss092.xml b/test/Reader/Feed/_files/Rss/title/plain/atom10/rss092.xml new file mode 100644 index 00000000..3558f669 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/atom10/rss092.xml @@ -0,0 +1,7 @@ + + + + My Title + + diff --git a/test/Reader/Feed/_files/Rss/title/plain/atom10/rss093.xml b/test/Reader/Feed/_files/Rss/title/plain/atom10/rss093.xml new file mode 100644 index 00000000..6d642f2f --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/atom10/rss093.xml @@ -0,0 +1,7 @@ + + + + My Title + + diff --git a/test/Reader/Feed/_files/Rss/title/plain/atom10/rss094.xml b/test/Reader/Feed/_files/Rss/title/plain/atom10/rss094.xml new file mode 100644 index 00000000..d4dc23d4 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/atom10/rss094.xml @@ -0,0 +1,7 @@ + + + + My Title + + diff --git a/test/Reader/Feed/_files/Rss/title/plain/atom10/rss10.xml b/test/Reader/Feed/_files/Rss/title/plain/atom10/rss10.xml new file mode 100644 index 00000000..f6b2dd3b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/atom10/rss10.xml @@ -0,0 +1,9 @@ + + + + My Title + + diff --git a/test/Reader/Feed/_files/Rss/title/plain/atom10/rss20.xml b/test/Reader/Feed/_files/Rss/title/plain/atom10/rss20.xml new file mode 100644 index 00000000..1566812d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/atom10/rss20.xml @@ -0,0 +1,7 @@ + + + + My Title + + diff --git a/test/Reader/Feed/_files/Rss/title/plain/dc10/rss090.xml b/test/Reader/Feed/_files/Rss/title/plain/dc10/rss090.xml new file mode 100644 index 00000000..2cdf962c --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/dc10/rss090.xml @@ -0,0 +1,9 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/dc10/rss091.xml b/test/Reader/Feed/_files/Rss/title/plain/dc10/rss091.xml new file mode 100644 index 00000000..faf1d232 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/dc10/rss091.xml @@ -0,0 +1,7 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/dc10/rss092.xml b/test/Reader/Feed/_files/Rss/title/plain/dc10/rss092.xml new file mode 100644 index 00000000..59a7758b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/dc10/rss092.xml @@ -0,0 +1,7 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/dc10/rss093.xml b/test/Reader/Feed/_files/Rss/title/plain/dc10/rss093.xml new file mode 100644 index 00000000..99349c47 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/dc10/rss093.xml @@ -0,0 +1,7 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/dc10/rss094.xml b/test/Reader/Feed/_files/Rss/title/plain/dc10/rss094.xml new file mode 100644 index 00000000..39904014 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/dc10/rss094.xml @@ -0,0 +1,7 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/dc10/rss10.xml b/test/Reader/Feed/_files/Rss/title/plain/dc10/rss10.xml new file mode 100644 index 00000000..a5dc896f --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/dc10/rss10.xml @@ -0,0 +1,9 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/dc10/rss20.xml b/test/Reader/Feed/_files/Rss/title/plain/dc10/rss20.xml new file mode 100644 index 00000000..dac8c0bf --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/dc10/rss20.xml @@ -0,0 +1,7 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/dc11/rss090.xml b/test/Reader/Feed/_files/Rss/title/plain/dc11/rss090.xml new file mode 100644 index 00000000..960245dc --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/dc11/rss090.xml @@ -0,0 +1,9 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/dc11/rss091.xml b/test/Reader/Feed/_files/Rss/title/plain/dc11/rss091.xml new file mode 100644 index 00000000..1e509945 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/dc11/rss091.xml @@ -0,0 +1,7 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/dc11/rss092.xml b/test/Reader/Feed/_files/Rss/title/plain/dc11/rss092.xml new file mode 100644 index 00000000..cc0bacef --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/dc11/rss092.xml @@ -0,0 +1,7 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/dc11/rss093.xml b/test/Reader/Feed/_files/Rss/title/plain/dc11/rss093.xml new file mode 100644 index 00000000..c25ed842 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/dc11/rss093.xml @@ -0,0 +1,7 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/dc11/rss094.xml b/test/Reader/Feed/_files/Rss/title/plain/dc11/rss094.xml new file mode 100644 index 00000000..a6747668 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/dc11/rss094.xml @@ -0,0 +1,7 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/dc11/rss10.xml b/test/Reader/Feed/_files/Rss/title/plain/dc11/rss10.xml new file mode 100644 index 00000000..dda2bf6c --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/dc11/rss10.xml @@ -0,0 +1,9 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/dc11/rss20.xml b/test/Reader/Feed/_files/Rss/title/plain/dc11/rss20.xml new file mode 100644 index 00000000..9a3772e2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/dc11/rss20.xml @@ -0,0 +1,7 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/none/rss090.xml b/test/Reader/Feed/_files/Rss/title/plain/none/rss090.xml new file mode 100644 index 00000000..3cec664b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/none/rss090.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/none/rss091.xml b/test/Reader/Feed/_files/Rss/title/plain/none/rss091.xml new file mode 100644 index 00000000..259a7e27 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/none/rss091.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/none/rss092.xml b/test/Reader/Feed/_files/Rss/title/plain/none/rss092.xml new file mode 100644 index 00000000..72ed43e2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/none/rss092.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/none/rss093.xml b/test/Reader/Feed/_files/Rss/title/plain/none/rss093.xml new file mode 100644 index 00000000..1fb8f89e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/none/rss093.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/none/rss094.xml b/test/Reader/Feed/_files/Rss/title/plain/none/rss094.xml new file mode 100644 index 00000000..30d48447 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/none/rss094.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/none/rss10.xml b/test/Reader/Feed/_files/Rss/title/plain/none/rss10.xml new file mode 100644 index 00000000..67f28b9d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/none/rss10.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/none/rss20.xml b/test/Reader/Feed/_files/Rss/title/plain/none/rss20.xml new file mode 100644 index 00000000..c60501ea --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/none/rss20.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/rss090.xml b/test/Reader/Feed/_files/Rss/title/plain/rss090.xml new file mode 100644 index 00000000..57409267 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/rss090.xml @@ -0,0 +1,8 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/rss091.xml b/test/Reader/Feed/_files/Rss/title/plain/rss091.xml new file mode 100644 index 00000000..2c92eda2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/rss091.xml @@ -0,0 +1,6 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/rss092.xml b/test/Reader/Feed/_files/Rss/title/plain/rss092.xml new file mode 100644 index 00000000..2427847d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/rss092.xml @@ -0,0 +1,6 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/rss093.xml b/test/Reader/Feed/_files/Rss/title/plain/rss093.xml new file mode 100644 index 00000000..77545238 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/rss093.xml @@ -0,0 +1,6 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/rss094.xml b/test/Reader/Feed/_files/Rss/title/plain/rss094.xml new file mode 100644 index 00000000..94649395 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/rss094.xml @@ -0,0 +1,6 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/rss10.xml b/test/Reader/Feed/_files/Rss/title/plain/rss10.xml new file mode 100644 index 00000000..7f0821c8 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/rss10.xml @@ -0,0 +1,8 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/title/plain/rss20.xml b/test/Reader/Feed/_files/Rss/title/plain/rss20.xml new file mode 100644 index 00000000..e369a43a --- /dev/null +++ b/test/Reader/Feed/_files/Rss/title/plain/rss20.xml @@ -0,0 +1,6 @@ + + + + My Title + + \ No newline at end of file diff --git a/test/Reader/Integration/H-OnlineComAtom10Test.php b/test/Reader/Integration/H-OnlineComAtom10Test.php new file mode 100644 index 00000000..a93aef24 --- /dev/null +++ b/test/Reader/Integration/H-OnlineComAtom10Test.php @@ -0,0 +1,186 @@ +_feedSamplePath = dirname(__FILE__) . '/_files/h-online.com-atom10.xml'; + } + + public function testGetsTitle() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('The H - news feed', $feed->getTitle()); + } + + public function testGetsAuthors() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals(array('The H'), $feed->getAuthors()); + } + + public function testGetsSingleAuthor() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('The H', $feed->getAuthor()); + } + + public function testGetsCopyright() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals(null, $feed->getCopyright()); + } + + public function testGetsDescription() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('Technology news', $feed->getDescription()); + } + + public function testGetsLanguage() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals(null, $feed->getLanguage()); + } + + public function testGetsLink() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('http://www.h-online.com', $feed->getLink()); + } + + public function testGetsEncoding() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('UTF-8', $feed->getEncoding()); + } + + public function testGetsEntryCount() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals(60, $feed->count()); + } + + /** + * Entry level testing + */ + + public function testGetsEntryId() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('http://www.h-online.com/security/McAfee-update-brings-systems-down-again--/news/113689/from/rss', $entry->getId()); + } + + public function testGetsEntryTitle() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('McAfee update brings systems down again', $entry->getTitle()); + } + + public function testGetsEntryAuthors() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals(array('The H'), $entry->getAuthors()); + } + + public function testGetsEntrySingleAuthor() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('The H', $entry->getAuthor()); + } + + public function testGetsEntryDescription() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + /** + * Note: "’" is not the same as "'" - don't replace in error + */ + $this->assertEquals('A McAfee signature update is currently causing system failures and a lot of overtime for administrators', $entry->getDescription()); + } + + public function testGetsEntryContent() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('A McAfee signature update is currently causing system failures and a lot of overtime for administrators', $entry->getContent()); + } + + public function testGetsEntryLinks() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals(array('http://www.h-online.com/security/McAfee-update-brings-systems-down-again--/news/113689/from/rss'), $entry->getLinks()); + } + + public function testGetsEntryLink() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('http://www.h-online.com/security/McAfee-update-brings-systems-down-again--/news/113689/from/rss', $entry->getLink()); + } + + public function testGetsEntryPermaLink() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('http://www.h-online.com/security/McAfee-update-brings-systems-down-again--/news/113689/from/rss', + $entry->getPermaLink()); + } + + public function testGetsEntryEncoding() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('UTF-8', $entry->getEncoding()); + } + +} diff --git a/test/Reader/Integration/LautDeRdfTest.php b/test/Reader/Integration/LautDeRdfTest.php new file mode 100644 index 00000000..e6300534 --- /dev/null +++ b/test/Reader/Integration/LautDeRdfTest.php @@ -0,0 +1,186 @@ +_feedSamplePath = dirname(__FILE__) . '/_files/laut.de-rdf.xml'; + } + + /** + * Feed level testing + */ + + public function testGetsTitle() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('laut.de - news', $feed->getTitle()); + } + + public function testGetsAuthors() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals(array('laut.de'), $feed->getAuthors()); + } + + public function testGetsSingleAuthor() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('laut.de', $feed->getAuthor()); + } + + public function testGetsCopyright() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('Copyright © 2004 laut.de', $feed->getCopyright()); + } + + public function testGetsDescription() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('laut.de: aktuelle News', $feed->getDescription()); + } + + public function testGetsLanguage() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals(null, $feed->getLanguage()); + } + + public function testGetsLink() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('http://www.laut.de', $feed->getLink()); + } + + public function testGetsEncoding() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('ISO-8859-1', $feed->getEncoding()); + } + + + + /** + * Entry level testing + */ + + public function testGetsEntryId() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('http://www.laut.de/vorlaut/news/2009/07/04/22426/index.htm', $entry->getId()); + } + + public function testGetsEntryTitle() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('Angelika Express: MySpace-Aus wegen Sido-Werbung', $entry->getTitle()); + } + + public function testGetsEntryAuthors() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals(array('laut.de'), $entry->getAuthors()); + } + + public function testGetsEntrySingleAuthor() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('laut.de', $entry->getAuthor()); + } + + // Technically, the next two tests should not pass. However the source feed has an encoding + // problem - it's stated as ISO-8859-1 but sent as UTF-8. The result is that a) it's + // broken itself, or b) We should consider a fix in the future for similar feeds such + // as using a more limited XML based decoding method (not html_entity_decode()) + + public function testGetsEntryDescription() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('Schon länger haderten die Kölner mit der Plattform des "fiesen Rupert Murdoch". Das Fass zum Überlaufen brachte aber ein Werbebanner von Deutschrapper Sido.', $entry->getDescription()); + } + + public function testGetsEntryContent() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('Schon länger haderten die Kölner mit der Plattform des "fiesen Rupert Murdoch". Das Fass zum Überlaufen brachte aber ein Werbebanner von Deutschrapper Sido.', $entry->getContent()); + } + + public function testGetsEntryLinks() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals(array('http://www.laut.de/vorlaut/news/2009/07/04/22426/index.htm'), $entry->getLinks()); + } + + public function testGetsEntryLink() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('http://www.laut.de/vorlaut/news/2009/07/04/22426/index.htm', $entry->getLink()); + } + + public function testGetsEntryPermaLink() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('http://www.laut.de/vorlaut/news/2009/07/04/22426/index.htm', + $entry->getPermaLink()); + } + + public function testGetsEntryEncoding() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('ISO-8859-1', $entry->getEncoding()); + } + +} diff --git a/test/Reader/Integration/WordpressAtom10Test.php b/test/Reader/Integration/WordpressAtom10Test.php new file mode 100644 index 00000000..dc0732e1 --- /dev/null +++ b/test/Reader/Integration/WordpressAtom10Test.php @@ -0,0 +1,190 @@ +_feedSamplePath = dirname(__FILE__) . '/_files/wordpress-atom10.xml'; + } + + public function testGetsTitle() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('Norm 2782', $feed->getTitle()); + } + + public function testGetsAuthors() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals(array('norm2782'), $feed->getAuthors()); + } + + public function testGetsSingleAuthor() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('norm2782', $feed->getAuthor()); + } + + public function testGetsCopyright() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals(null, $feed->getCopyright()); + } + + public function testGetsDescription() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('Why are you here?', $feed->getDescription()); + } + + public function testGetsLanguage() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('en', $feed->getLanguage()); + } + + public function testGetsLink() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('http://www.norm2782.com', $feed->getLink()); + } + + public function testGetsEncoding() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('UTF-8', $feed->getEncoding()); + } + + public function testGetsEntryCount() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals(10, $feed->count()); + } + + /** + * Entry level testing + */ + + public function testGetsEntryId() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('http://www.norm2782.com/?p=114', $entry->getId()); + } + + public function testGetsEntryTitle() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + /** + * Note: The three dots below is actually a single Unicode character + * called the "three dot leader". Don't replace in error! + */ + $this->assertEquals('Wth… reading books?', $entry->getTitle()); + } + + public function testGetsEntryAuthors() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals(array('norm2782'), $entry->getAuthors()); + } + + public function testGetsEntrySingleAuthor() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('norm2782', $entry->getAuthor()); + } + + public function testGetsEntryDescription() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + /** + * Note: "’" is not the same as "'" - don't replace in error + */ + $this->assertEquals('Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.'."\n\n".'Agile Software Development with Scrum, by Ken Schwaber and Mike Beedle'."\n".'Domain-Driven Design: Tackling Complexity in the [...]', $entry->getDescription()); + } + + public function testGetsEntryContent() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('

Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

'."\n\n".''."\n".'

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

'."\n", $entry->getContent()); + } + + public function testGetsEntryLinks() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals(array('http://www.norm2782.com/2009/03/wth-reading-books/'), $entry->getLinks()); + } + + public function testGetsEntryLink() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('http://www.norm2782.com/2009/03/wth-reading-books/', $entry->getLink()); + } + + public function testGetsEntryPermaLink() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('http://www.norm2782.com/2009/03/wth-reading-books/', + $entry->getPermaLink()); + } + + public function testGetsEntryEncoding() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('UTF-8', $entry->getEncoding()); + } + +} diff --git a/test/Reader/Integration/WordpressRss2DcAtomTest.php b/test/Reader/Integration/WordpressRss2DcAtomTest.php new file mode 100644 index 00000000..d2b804c6 --- /dev/null +++ b/test/Reader/Integration/WordpressRss2DcAtomTest.php @@ -0,0 +1,194 @@ +_feedSamplePath = dirname(__FILE__) . '/_files/wordpress-rss2-dc-atom.xml'; + } + + /** + * Feed level testing + */ + + public function testGetsTitle() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('Norm 2782', $feed->getTitle()); + } + + public function testGetsAuthors() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals(array('norm2782'), $feed->getAuthors()); + } + + public function testGetsSingleAuthor() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('norm2782', $feed->getAuthor()); + } + + public function testGetsCopyright() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals(null, $feed->getCopyright()); + } + + public function testGetsDescription() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('Why are you here?', $feed->getDescription()); + } + + public function testGetsLanguage() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('en', $feed->getLanguage()); + } + + public function testGetsLink() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('http://www.norm2782.com', $feed->getLink()); + } + + public function testGetsEncoding() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('UTF-8', $feed->getEncoding()); + } + + public function testGetsEntryCount() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals(10, $feed->count()); + } + + /** + * Entry level testing + */ + + public function testGetsEntryId() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('http://www.norm2782.com/?p=114', $entry->getId()); + } + + public function testGetsEntryTitle() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + /** + * Note: The three dots below is actually a single Unicode character + * called the "three dot leader". Don't replace in error! + */ + $this->assertEquals('Wth… reading books?', $entry->getTitle()); + } + + public function testGetsEntryAuthors() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals(array('norm2782'), $entry->getAuthors()); + } + + public function testGetsEntrySingleAuthor() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('norm2782', $entry->getAuthor()); + } + + public function testGetsEntryDescription() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + /** + * Note: "’" is not the same as "'" - don't replace in error + */ + $this->assertEquals('Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.'."\n\n".'Agile Software Development with Scrum, by Ken Schwaber and Mike Beedle'."\n".'Domain-Driven Design: Tackling Complexity in the [...]', $entry->getDescription()); + } + + public function testGetsEntryContent() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('

Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

'."\n".''."\n".'

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

'."\n", $entry->getContent()); + } + + public function testGetsEntryLinks() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals(array('http://www.norm2782.com/2009/03/wth-reading-books/'), $entry->getLinks()); + } + + public function testGetsEntryLink() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('http://www.norm2782.com/2009/03/wth-reading-books/', $entry->getLink()); + } + + public function testGetsEntryPermaLink() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('http://www.norm2782.com/2009/03/wth-reading-books/', + $entry->getPermaLink()); + } + + public function testGetsEntryEncoding() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('UTF-8', $entry->getEncoding()); + } + +} diff --git a/test/Reader/Integration/_files/h-online.com-atom10.xml b/test/Reader/Integration/_files/h-online.com-atom10.xml new file mode 100644 index 00000000..bd008ef9 --- /dev/null +++ b/test/Reader/Integration/_files/h-online.com-atom10.xml @@ -0,0 +1,584 @@ + + + + +The H - news feed +Technology news + + +2009-07-04T20:31:10+02:00 + +The H + +http://www.h-online.com/security/McAfee-update-brings-systems-down-again--/news/113689/from/rss + + + McAfee update brings systems down again + + A McAfee signature update is currently causing system failures and a lot of overtime for administrators + http://www.h-online.com/security/McAfee-update-brings-systems-down-again--/news/113689/from/rss + 2009-07-04T20:31:10+02:00 + + + + + + The H Week + + This week, The H reported on several new major releases, including Firefox 3.5, Python 3.1, NetBeans 6.7, PHP 5.3.0, VirtualBox 3.0 and PostgreSQL 8.4, and covered the result of Stallman's open letter criticising Debian's use of Mono + http://www.h-online.com/news/The-H-Week--/113687/from/rss + 2009-07-04T09:34:53+02:00 + + + + + GNOME and KDE developer conference begins on Gran Canaria + + The Gran Canaria Desktop Summit 2009 is the first time that the KDE and GNOME communities are co-locating their annual GUADEC and Akademy conferences + http://www.h-online.com/open/GNOME-and-KDE-developer-conference-begins-on-Gran-Canaria--/news/113688/from/rss + 2009-07-03T17:08:07+02:00 + + + + + + XHTML 2 to be discontinued + + The W3C announced yesterday that it will discontinue its work on XHTML 2 and will instead focus exclusively on (X)HTML 5 as a successor of current web standards + http://www.h-online.com/open/XHTML-2-to-be-discontinued--/news/113686/from/rss + 2009-07-03T15:14:56+02:00 + + + + + No mandatory audio and video codecs in HTML 5 + + Some members of the WHATWG reject Ogg Theora, and H.264 is subject to licence fees, so Ian Hickson has decided to eliminate all reference to mandatory audio/video codecs from the HTML 5 specification + http://www.h-online.com/open/No-mandatory-audio-and-video-codecs-in-HTML-5--/news/113685/from/rss + 2009-07-03T13:01:43+02:00 + + + + + + "Luxembourg attacks" on AES encryption + + Although the attacks don't affect the practical security of AES, they represent substantial cryptological progress + http://www.h-online.com/security/Luxembourg-attacks-on-AES-encryption--/news/113684/from/rss + 2009-07-03T17:17:04+02:00 + + + + + Fluendo releases DVD player for Linux + + Fluendo has released its own DVD player for Linux built on the open source GStreamer multimedia framework + http://www.h-online.com/open/Fluendo-releases-DVD-player-for-Linux--/news/113683/from/rss + 2009-07-03T11:40:42+02:00 + + + + + + No more updates for Python 3.0 + + The Python developers have announced that there will be no additional maintenance or security update releases for version 3.0 of the Python scripting language + http://www.h-online.com/open/No-more-updates-for-Python-3-0--/news/113682/from/rss + 2009-07-03T10:30:33+02:00 + + + + + GNOME 2.26.3 released + + The GNOME release team have announced the availability of the final update to GNOME 2.26 + http://www.h-online.com/open/GNOME-2-26-3-released--/news/113679/from/rss + 2009-07-03T16:13:50+02:00 + + + + + + Alledged critical security vulnerability in iPhone SMS application + + According to US media reports, Apple is working on an update for the iPhone to fix a critical vulnerability in its texting application + http://www.h-online.com/security/Alledged-critical-security-vulnerability-in-iPhone-SMS-application--/news/113680/from/rss + 2009-07-03T14:29:51+02:00 + + + + + Hard times for NeoOffice + + The developers of the free open source NeoOffice office suite for Mac OS X have announced that, due to very low donation levels this year, they will be forced to make severe cutbacks + http://www.h-online.com/open/Hard-times-for-NeoOffice--/news/113678/from/rss + 2009-07-02T17:42:53+02:00 + + + + + + Study shows rise in spam botnets + + According to MessageLabs, June 2009 saw a worldwide increase in spam being sent via botnets to 83.2 per cent, up from only 57.6 per cent in May + http://www.h-online.com/security/Study-shows-rise-in-spam-botnets--/news/113677/from/rss + 2009-07-03T17:05:01+02:00 + + + + + MD6 hash algorithm withdrawn from SHA-3 competition + + MD6 was, despite its relative slowness, one of the favourites. The reasons given for the withdrawal by lead developer Ron Rivest surprised even those in the know + http://www.h-online.com/security/MD6-hash-algorithm-withdrawn-from-SHA-3-competition--/news/113676/from/rss + 2009-07-02T17:03:50+02:00 + + + + + + Ubuntu to continue using Mono + + The Ubuntu Technical Board has clarified that the use of the Mono stack implementation is not considered to be a problem and that it, and applications based on it, will continue to be included with the default Ubuntu installation set + http://www.h-online.com/open/Ubuntu-to-continue-using-Mono--/news/113674/from/rss + 2009-07-02T17:01:17+02:00 + + + + + WordPress themes must be GPL + + WordPress themes are derivative works and should be licensed under the GPL say WordPress developers after consulting the Software Freedom Law Center + http://www.h-online.com/open/WordPress-themes-must-be-GPL--/news/113675/from/rss + 2009-07-02T15:37:30+02:00 + + + + + + Google Update no longer runs continuously + + To address concerns from users, the Google Update open source software installer and auto-updater for Windows now uses the Windows Task Scheduler to only run at periodic intervals + http://www.h-online.com/open/Google-Update-no-longer-runs-continuously--/news/113673/from/rss + 2009-07-02T14:20:03+02:00 + + + + + Kernel Log - Coming in 2.6.31 - Part 1: New Wi-Fi drivers and other network-related changes + + Linux 2.6.31 will include a new Wi-Fi driver for Intel chips and will be WPAN-capable in accordance with IEEE 802.15.4. The developers have also improved support for Ralink Wi-Fi components and for newer power saving technologies + http://www.h-online.com/open/Kernel-Log-Coming-in-2-6-31-Part-1-New-Wi-Fi-drivers-and-other-network-related-changes--/news/113670/from/rss + 2009-07-02T17:40:56+02:00 + + + + + + AACS LA reduces copy protection charges for Blu-ray Discs + + The reduced charges are primarily intended to benefit small studios and pressing companies that have yet to release any Blu-ray versions of their films due to the high cost + http://www.h-online.com/security/AACS-LA-reduces-copy-protection-charges-for-Blu-ray-Discs--/news/113672/from/rss + 2009-07-02T17:02:44+02:00 + + + + + SourceForge.net: four billion served + + SourceForge Inc. has announced that its SourceForge.net software site has served its four billionth download. The four billionth application was downloaded on the 8th of June from PortableApps.com + http://www.h-online.com/open/SourceForge-net-four-billion-served--/news/113668/from/rss + 2009-07-03T09:05:26+02:00 + + + + + + Apple's iDisk sealed + + A hole has been closed in Apple's iDisk storage system after a vulnerability allowing unauthorised access was discovered + http://www.h-online.com/security/Apple-s-iDisk-sealed--/news/113669/from/rss + 2009-07-02T11:02:56+02:00 + + + + + Red Hat Enterprise Linux 5.4 beta with KVM + + Apart from offering a range of new features and new and improved drivers, the beta is the first version of RHEL 5.4 to support KVM (Kernel-based Virtual Machine) virtualisation + http://www.h-online.com/open/Red-Hat-Enterprise-Linux-5-4-beta-with-KVM--/news/113667/from/rss + 2009-07-02T10:34:57+02:00 + + + + + + Mercurial 1.3 released + + The distributed version control system is updated and adds experimental support for subrepositories and better local sharing + http://www.h-online.com/open/Mercurial-1-3-released--/news/113666/from/rss + 2009-07-03T09:05:48+02:00 + + + + + CMS Made Simple 1.6 released + + CMS Made Simple, an open source Content Management System, has been updated to version 1.6. The primary focus of the release was the complete re-working of the content permissions system + http://www.h-online.com/open/CMS-Made-Simple-1-6-released--/news/113665/from/rss + 2009-07-01T16:09:52+02:00 + + + + + + KDE 4.3.0 release candidate available + + The KDE developers have announced the availability of the first release candidate of KDE 4.3.0 + http://www.h-online.com/open/KDE-4-3-0-release-candidate-available--/news/113663/from/rss + 2009-07-01T15:22:54+02:00 + + + + + JavaScript Tested + + Two sets of JavaScript unit tests have been released, one by Microsoft and one by Google, to help developers who are implementing the language + http://www.h-online.com/open/JavaScript-Tested--/news/113664/from/rss + 2009-07-01T15:14:12+02:00 + + + + + + Firefox 3.5 already downloaded more than 4 million times + + Less than 24 hours since it was released, Firefox 3.5 has already been downloaded more than four million times and is currently being downloaded approximately 77 times every second + http://www.h-online.com/open/Firefox-3-5-already-downloaded-more-than-4-million-times--/news/113661/from/rss + 2009-07-01T14:34:01+02:00 + + + + + PostgreSQL 8.4 now available + + 16 months of development brings faster database restoration, new SQL functionality and conformance and more + http://www.h-online.com/open/PostgreSQL-8-4-now-available--/news/113662/from/rss + 2009-07-01T14:31:39+02:00 + + + + + + Debian - Mono is not in our default installation + + Debian have responded to Richard Stallman's claim that the project is including Mono in the default installation of the GNU/Linux distribution + http://www.h-online.com/open/Debian-Mono-is-not-in-our-default-installation--/news/113660/from/rss + 2009-07-01T12:47:28+02:00 + + + + + Kaspersky tightens up anti-virus engine + + Kaspersky has fixed its malware detection problem in its 2010 products via an automatic update. The cause of the detection problems that allowed malware to be overlooked seems to have been even more severe than was initially apparent + http://www.h-online.com/security/Kaspersky-tightens-up-anti-virus-engine--/news/113656/from/rss + 2009-07-01T12:02:04+02:00 + + + + + + Security updates for VMWare-ESX + + VMWare updates ESX Server to close a vulnerability in its Kerberos implementation + http://www.h-online.com/security/Security-updates-for-VMWare-ESX--/news/113659/from/rss + 2009-07-01T11:29:20+02:00 + + + + + The new Maven 2.2.0 requires Java 5 + + The new version of the free Java build tool should bring greater stability and fixes a number of less critical bugs + http://www.h-online.com/open/The-new-Maven-2-2-0-requires-Java-5--/news/113658/from/rss + 2009-07-01T11:23:20+02:00 + + + + + + Cash machine cracking presentation cancelled + + Juniper Networks has withdrawn a presentation at the Black Hat conference entitled "Jackpotting Automated Teller Machines" after a cash machine manufacturer intervened + http://www.h-online.com/security/Cash-machine-cracking-presentation-cancelled--/news/113657/from/rss + 2009-07-01T11:14:34+02:00 + + + + + PCLinuxOS 2009.2 released + + The PCLinuxOS developers have released version 2009.2 of the free PCLinuxOS and PCLinuxOS GNOME distributions + http://www.h-online.com/open/PCLinuxOS-2009-2-released--/news/113655/from/rss + 2009-07-01T10:19:52+02:00 + + + + + + UK presents cyber-security strategy + + According to Gordon Brown, the internet today is as important to the UK as the seas were in the 19th century and the air was in the 20th + http://www.h-online.com/security/UK-presents-cyber-security-strategy--/news/113654/from/rss + 2009-06-30T18:05:50+02:00 + + + + + Firefox 3.5 now available + + Mozilla has released version 3.5 of their open source Firefox web browser, code named "Shiretoko", which includes the new Trace Monkey JavaScript engine and is based on version 1.91 of the Gecko layout engine + http://www.h-online.com/open/Firefox-3-5-now-available--/news/113653/from/rss + 2009-06-30T18:49:21+02:00 + + + + + + Swatting phreaker swatted and heading to jail + + A 19-year-old American has been sentenced to eleven years in prison for placing faked phone calls that dispatched special police units to the homes of unwitting families + http://www.h-online.com/security/Swatting-phreaker-swatted-and-heading-to-jail--/news/113652/from/rss + 2009-06-30T17:03:08+02:00 + + + + + VirtualBox 3.0 released + + Sun Microsystems has announced the released of version 3.0 of its open source VirtualBox desktop virtualisation application for x86 hardware which now includes experimental support for Direct3D 8 & 9 in applications for Windows guests + http://www.h-online.com/open/VirtualBox-3-0-released--/news/113651/from/rss + 2009-06-30T16:35:07+02:00 + + + + + + MilePost Compiler: AI optimises machine code + + A GCC-based compiler developed by the MilePost project automatically learns how to translate source code into efficient binary code + http://www.h-online.com/open/MilePost-Compiler-AI-optimises-machine-code--/news/113650/from/rss + 2009-06-30T16:27:51+02:00 + + + + + PHP 5.3.0 released + + The PHP development team have announced the release version 5.3.0 of PHP. The new version includes several fundamental new extensions, as well as a number of other new features + http://www.h-online.com/open/PHP-5-3-0-released--/news/113649/from/rss + 2009-06-30T15:59:07+02:00 + + + + + + Yellow Dog Linux 6.2 released + + With 6.2, the developers have mainly focused on fine-tuning the existing functionality of the Linux distribution designed particularly for PowerPCs and PS3s. Xfce has been added as a further desktop environment choice + http://www.h-online.com/open/Yellow-Dog-Linux-6-2-released--/news/113648/from/rss + 2009-06-30T13:55:55+02:00 + + + + + Once again HP has to close a hole in OpenView Network Node Manager + + HP has released updates for the OpenView Network Node Manager (NNM) to close a remotely exploitable hole in rping + http://www.h-online.com/security/Once-again-HP-has-to-close-a-hole-in-OpenView-Network-Node-Manager--/news/113647/from/rss + 2009-06-30T12:49:56+02:00 + + + + + + Palm Pre 1.0.4 update fixes security issues + + Palm has released version 1.0.4 of its Pre mobile phone software to address several security issues with the Palm webOS + http://www.h-online.com/security/Palm-Pre-1-0-4-update-fixes-security-issues--/news/113645/from/rss + 2009-06-30T12:27:25+02:00 + + + + + Mono 2.4.2 with ASP.NET MVC support + + The latest maintenance release of the cross platform, open source .NET development framework is the first to incorporate Microsoft's ASP.NET MVC framework + http://www.h-online.com/open/Mono-2-4-2-with-ASP-NET-MVC-support--/news/113644/from/rss + 2009-06-30T11:56:58+02:00 + + + + + + openSUSE 11.2 Milestone 3 released + + The third milestone release includes the latest Linux kernel and several updates to the included applications + http://www.h-online.com/open/openSUSE-11-2-Milestone-3-released--/news/113643/from/rss + 2009-06-30T10:49:51+02:00 + + + + + Tiny Core Linux 2.1 arrives + + Tiny Core founder Robert Shingledecker has announced the release of version 2.1 of Tiny Core Linux and Micro Core Linux + http://www.h-online.com/open/Tiny-Core-Linux-2-1-arrives--/news/113642/from/rss + 2009-06-30T10:00:45+02:00 + + + + + + NetBeans 6.7 released - focuses on Maven and Kenai integration + + NetBeans 6.7 has now been released by Sun Microsystems. The H looks at what's new in the latest version + http://www.h-online.com/open/NetBeans-6-7-released-focuses-on-Maven-and-Kenai-integration--/news/113640/from/rss + 2009-06-29T16:30:16+02:00 + + + + + Linux developers want to circumvent VFATs patent problem + + Linux developer Andrew Tridgell has presented the second of two patches designed to work around Microsoft's FAT file naming patents + http://www.h-online.com/open/Linux-developers-want-to-circumvent-VFATs-patent-problem--/news/113641/from/rss + 2009-06-29T15:57:56+02:00 + + + + + + 15 years of FreeDOS + + Originally released on the 28th of June 1994, FreeDOS, a free open source DOS clone, is now 15 years old + http://www.h-online.com/open/15-years-of-FreeDOS--/news/113639/from/rss + 2009-06-29T15:02:42+02:00 + + + + + Lost+Found: Bug reports, eBay, anti-debugging and asterisks + + Too short for news, too good to lose; lost+found is a round up of useful security information. Today, Bug reports, eBay, anti-debugging and asterisks + http://www.h-online.com/security/Lost-Found-Bug-reports-eBay-anti-debugging-and-asterisks--/news/113638/from/rss + 2009-06-29T12:54:25+02:00 + + + + + + Fennec updates for Windows Mobile & Maemo released + + The Mozilla developers have released a second beta for Nokia's N810 Internet Tablets and a second alpha for the Windows Mobile 6 platform, of their Fennec mobile web browser, focusing on performance and user experience improvements + http://www.h-online.com/open/Fennec-updates-for-Windows-Mobile-Maemo-released--/news/113637/from/rss + 2009-06-29T14:26:11+02:00 + + + + + New version of Tor fixes two security issues + + The developers of the anonymity service have released version 0.2.0.35 and the first release candidate of 0.2.1.16, fixing DoS vulnerabilities and a DNS spoofing hole + http://www.h-online.com/security/New-version-of-Tor-fixes-two-security-issues--/news/113636/from/rss + 2009-06-29T13:36:04+02:00 + + + + + + Roadmap for Ruby 1.9.2 + + While Ruby 1.9.2 isn't due until the end of this year, details from a Japanese Ruby conference reveal what to expect in this next version of the dynamic scripting language + http://www.h-online.com/open/Roadmap-for-Ruby-1-9-2--/news/113635/from/rss + 2009-06-29T11:16:00+02:00 + + + + + Second update for Debian 5.0 "Lenny" released + + The Debian project developers have announced the release of the second update to Debian 5.0, which includes a new version of the debian-installer and addresses several bugs and security issues + http://www.h-online.com/open/Second-update-for-Debian-5-0-Lenny-released--/news/113634/from/rss + 2009-06-29T10:59:33+02:00 + + + + + + Python 3.1 released + + The renovation of the Python language continues with the production release of Python 3.1 + http://www.h-online.com/open/Python-3-1-released--/news/113633/from/rss + 2009-06-29T14:26:41+02:00 + + + + + Stallman says "Don't depend on Mono" + + Richard Stallman has added to the protests about Mono, saying free software such as GNU/Linux should not depend on the Microsoft designed framework + http://www.h-online.com/open/Stallman-says-Don-t-depend-on-Mono--/news/113631/from/rss + 2009-06-29T09:42:56+02:00 + + + + + + The H Week + + LinuxTag and 2 Kernel Logs, SCO still not dead, open-source and public institutions, Mozilla 3.5 'real soon', new open source benchmarks, TLD redirections criticised, another Twitter hack and the increasing importance of security updates + http://www.h-online.com/news/The-H-Week--/113632/from/rss + 2009-06-29T09:18:02+02:00 + + + + + LiMux: Munich Linux (R)evolution has its Imitators + + Munich city council's switch to Linux and other open-source software is proceeding with great enthusiasm. Although other local authorities have now followed suit, Microsoft won't leave the field without a fight + http://www.h-online.com/open/LiMux-Munich-Linux-R-evolution-has-its-Imitators--/news/113629/from/rss + 2009-06-27T19:02:10+02:00 + + + + + + Fedora 12 to be named Constantine + + The next version of the Fedora Project's Linux distribution, Fedora 12, will be named "Constantine" + http://www.h-online.com/open/Fedora-12-to-be-named-Constantine--/news/113630/from/rss + 2009-06-27T17:21:12+02:00 + + + + + Free extension for secure browsing + + A free browser extension for Internet Explorer and Firefox from anti-virus manufacturer Finjan, called SecureBrowsing, alerts users of dangerous URLs in Google Search and other popular sites + http://www.h-online.com/security/Free-extension-for-secure-browsing--/news/113627/from/rss + 2009-06-26T15:08:58+02:00 + + + + + + Hole in VLC Media Player + + Secunia says a hole in the Windows binary version of VLC media player is "highly critical" + http://www.h-online.com/security/Hole-in-VLC-Media-Player--/news/113628/from/rss + 2009-06-26T14:39:30+02:00 + + + diff --git a/test/Reader/Integration/_files/laut.de-rdf.xml b/test/Reader/Integration/_files/laut.de-rdf.xml new file mode 100644 index 00000000..fddbe289 --- /dev/null +++ b/test/Reader/Integration/_files/laut.de-rdf.xml @@ -0,0 +1,426 @@ + + + + + +laut.de - news +http://www.laut.de + +laut.de: aktuelle News +laut.de +Copyright © 2004 laut.de + +2009-07-04T21:01:02+01:00 +hourly +6 +2004-02-10T17:10:15+01:00 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +laut.de +http://www.laut.de +http://www.laut.de/partner/allgemein/logo.gif + + + + + http://www.laut.de/vorlaut/news/2009/07/04/22426/index.htm + + 2009-07-04T13:28:09+01:00 + text/html + de + laut.de + laut.de. Alle Rechte vorbehalten. + Angelika Express: MySpace-Aus wegen Sido-Werbung + + Angelika Express + MySpace-Aus wegen Sido-Werbung + http://www.laut.de/vorlaut/news/2009/07/04/22426/index.htm + Schon länger haderten die Kölner mit der Plattform des "fiesen Rupert Murdoch". Das Fass zum Ãœberlaufen brachte aber ein Werbebanner von Deutschrapper Sido. + + + + + http://www.laut.de/vorlaut/news/2009/07/03/22424/index.htm + 2009-07-03T14:50:08+01:00 + text/html + de + laut.de + laut.de. Alle Rechte vorbehalten. + + Michael Jackson: Video der letzten Probe veröffentlicht + Michael Jackson + Video der letzten Probe veröffentlicht + http://www.laut.de/vorlaut/news/2009/07/03/22424/index.htm + Konzertveranstalter AEG Live veröffentlicht ein Video, das Michael Jackson kurz vor seinem Tod beim Proben zeigt. Exfrau Debbie Rowe will unterdessen um das Sorgerecht ihrer Kinder kämpfen. + + + + http://www.laut.de/vorlaut/news/2009/07/03/22423/index.htm + 2009-07-03T11:46:40+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + Lady Gaga: "Bin wie Andy Warhol" + Lady Gaga + "Bin wie Andy Warhol" + http://www.laut.de/vorlaut/news/2009/07/03/22423/index.htm + Im Interview zieht Trash-Popperin Gaga Parallelen zwischen sich und Pop Art-Ikone Andy Warhol und erklärt: "Ich mache seelenlosen Elektropop." + + + + + + http://www.laut.de/vorlaut/news/2009/07/03/22414/index.htm + 2009-07-03T15:28:47+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + Tom Waits: Sänger lässt den Teufel raus + Tom Waits + Sänger lässt den Teufel raus + http://www.laut.de/vorlaut/news/2009/07/03/22414/index.htm + Tom Waits übernimmt im neuen Terry Gilliam-Film die Rolle des Teufels. Ein veröffentlichtes Statement offenbart Details über die Zusammenarbeit. + + + + + + http://www.laut.de/vorlaut/news/2009/07/03/22409/index.htm + 2009-07-03T11:46:40+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + Tonspion KW26: Free-Mp3s der Woche + Tonspion KW26 + Free-Mp3s der Woche + http://www.laut.de/vorlaut/news/2009/07/03/22409/index.htm + In Kooperation mit Tonspion scannen wir für euch jede Woche die spannendsten Mp3-Downloads. Alles für lau, alles ziemlich super. + + + + + + http://www.laut.de/vorlaut/news/2009/07/03/22408/index.htm + 2009-07-03T11:46:40+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + Festivalsommer: Die Highlights der Saison (4) + Festivalsommer + Die Highlights der Saison (4) + http://www.laut.de/vorlaut/news/2009/07/03/22408/index.htm + Wir lenken eure Aufmerksamkeit regelmäßig auf spektakuläre Line-Ups, die schönsten Locations und coolsten Open-Airs des Sommers. Diesmal empfehlen wir einen Ausflug in die schwäbische Provinz (Obstwiesenfestival) und eine Reise ans Mittelmeer (Benicàssim Festival). + + + + + + http://www.laut.de/vorlaut/news/2009/07/02/22410/index.htm + 2009-07-03T11:46:40+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + Three Strikes Out: Neuer Gesetzentwurf spaltet Frankreich + Three Strikes Out + Neuer Gesetzentwurf spaltet Frankreich + http://www.laut.de/vorlaut/news/2009/07/02/22410/index.htm + Sarkozys Plan, Musik-Piraten automatisiert vom Internet auszuschließen, schmetterte das Verfassungsgericht ab. Nun legt die Regierung nach, und Verfassungsschützer melden erneut Bedenken an. + + + + + + http://www.laut.de/vorlaut/news/2009/07/02/22405/index.htm + 2009-07-03T11:46:40+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + Michael Jackson: Abschiedskonzert ersetzt Aufbahrung + Michael Jackson + Abschiedskonzert ersetzt Aufbahrung + http://www.laut.de/vorlaut/news/2009/07/02/22405/index.htm + In seinem Testament regelt Michael Jackson u.a. das Sorgerecht für die Kinder. An Stelle der Aufbahrung seines Leichnams in Neverland soll nun in Los Angeles ein Abschiedskonzert stattfinden. + + + + + + http://www.laut.de/vorlaut/news/2009/07/02/22404/index.htm + 2009-07-03T11:46:40+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + Ausgehbefehl: Rifforkane und Jazzmoves + Ausgehbefehl + Rifforkane und Jazzmoves + http://www.laut.de/vorlaut/news/2009/07/02/22404/index.htm + Da wackelt das Skelett: The Dillinger Escape Plan brechen einen Orkan vom Zaun, Guru's Jazzmatazz und Roy Ayers bringens gemeinsam, und die Cold War Kids arbeiten gegen den Indie-Mainstream. + + + + + + http://www.laut.de/vorlaut/news/2009/07/02/22413/index.htm + 2009-07-03T11:46:40+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + Björn Kleinhenz: Album für krankes Kaninchen + Björn Kleinhenz + Album für krankes Kaninchen + http://www.laut.de/vorlaut/news/2009/07/02/22413/index.htm + Hängende Löffel im Hause Kleinhenz: Der Hase ist malade und benötigt eine kostenintensive OP. Zu diesem Zweck spendet Kleinhenz den kompletten Erlös aus dem Online-Verkauf seines neuen Albums seinem Kaninchen Humle. + + + + + + http://www.laut.de/vorlaut/news/2009/07/01/22384/index.htm + 2009-07-01T12:56:34+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + Kraftwerk: Twitter erinnert Hütter an die Stasi + Kraftwerk + Twitter erinnert Hütter an die Stasi + http://www.laut.de/vorlaut/news/2009/07/01/22384/index.htm + In zwei seiner raren Interviews sprach Kraftwerk-Gründer Ralf Hütter über den Ausstieg von Florian Schneider und die Entwicklung der neuen Medien. + + + + + + http://www.laut.de/vorlaut/news/2009/07/01/22400/index.htm + 2009-07-02T15:37:45+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + U2: Zwei Jacko-Songs zum Tourstart + U2 + Zwei Jacko-Songs zum Tourstart + http://www.laut.de/vorlaut/news/2009/07/01/22400/index.htm + 90.000 Zuschauer wurden gestern Abend Zeuge des U2-Auftaktkonzerts in Barcelona. Als besondere Ãœberraschung würdigte die Band den verstorbenen Michael Jackson. + + + + + + http://www.laut.de/vorlaut/news/2009/07/01/22392/index.htm + 2009-07-02T15:36:13+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + D. Matthews Band: laut.de verlost exklusive Tickets + D. Matthews Band + laut.de verlost exklusive Tickets + http://www.laut.de/vorlaut/news/2009/07/01/22392/index.htm + Für das Akustik-Set von Dave Matthews und seinem Gitarrist Tim Reynolds in Hamburg gibt es keinen offiziellen Ticket-Verkauf. Ihr könnt trotzdem dabei sein! + + + + + + http://www.laut.de/vorlaut/news/2009/07/01/22385/index.htm + 2009-07-01T14:29:34+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + Michael Jackson: Aufbahrung auf Neverland-Ranch + Michael Jackson + Aufbahrung auf Neverland-Ranch + http://www.laut.de/vorlaut/news/2009/07/01/22385/index.htm + Am Freitag sollen die sterblichen Ãœberreste von Michael Jackson aufgebahrt werden, damit seine Fans Abschied von ihm nehmen können. + + + + + + http://www.laut.de/vorlaut/news/2009/07/01/22386/index.htm + 2009-07-02T14:42:03+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + Pirate Bay-Verkauf: Piraten wollen nicht mehr rauben + Pirate Bay-Verkauf + Piraten wollen nicht mehr rauben + http://www.laut.de/vorlaut/news/2009/07/01/22386/index.htm + Bis August soll der Verkauf von Pirate Bay unter Dach und Fach sein. Quo Vadis? Angeblich in Richtung Legalität und einer verstärkten Konzentration auf politische Aktivitäten. + + + + + + http://www.laut.de/vorlaut/news/2009/06/30/22372/index.htm + 2009-07-01T12:56:34+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + Michael Jackson: Die Geier kreisen schon + Michael Jackson + Die Geier kreisen schon + http://www.laut.de/vorlaut/news/2009/06/30/22372/index.htm + Michael Jacksons Tod ruft nicht nur trauernde Fans, sondern auch eine Menge Geschäftsleute auf den Plan, die die neu erlangte Popularität des Stars nutzen wollen. + + + + + + http://www.laut.de/vorlaut/news/2009/06/30/22368/index.htm + 2009-06-30T13:44:11+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + Rammstein: Zusatzkonzerte nach Ticket-Ansturm + Rammstein + Zusatzkonzerte nach Ticket-Ansturm + http://www.laut.de/vorlaut/news/2009/06/30/22368/index.htm + Rammsteins Versuch, den Second Hand-Markt für Konzerttickets auszutrocknen, ist offenbar gescheitert. + + + + + + http://www.laut.de/vorlaut/news/2009/06/29/22361/index.htm + 2009-06-30T12:08:22+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + Michael Jackson: Familie ordnet zweite Autopsie an + Michael Jackson + Familie ordnet zweite Autopsie an + http://www.laut.de/vorlaut/news/2009/06/29/22361/index.htm + Auch vier Tage nach Michael Jacksons Tod ist die Todesursache völlig unklar. Eine zweite Autopsie soll Klarheit schaffen. + + + + + + http://www.laut.de/vorlaut/news/2009/06/29/22360/index.htm + 2009-07-01T11:47:35+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + Glastonbury: Blur, Springsteen und die Schweinegrippe + Glastonbury + Blur, Springsteen und die Schweinegrippe + http://www.laut.de/vorlaut/news/2009/06/29/22360/index.htm + Neben Blur, Bruce Springsteen und Neil Young fand sich am Wochenende ein ungebetener Gast in Glastonbury ein: der Schweinegrippe-Erreger H1N1. + + + + + + http://www.laut.de/vorlaut/news/2009/06/29/22359/index.htm + 2009-06-30T12:08:22+01:00 + text/html + de + laut.de + + laut.de. Alle Rechte vorbehalten. + Vorchecking: Neue Platten auf einen Blick + Vorchecking + Neue Platten auf einen Blick + http://www.laut.de/vorlaut/news/2009/06/29/22359/index.htm + Frisch aus der Redaktionssitzung: Was geht, was nicht? Die Neuerscheinungen für den kommenden Freitag im Ãœberblick. + + + + + + diff --git a/test/Reader/Integration/_files/wordpress-atom10.xml b/test/Reader/Integration/_files/wordpress-atom10.xml new file mode 100644 index 00000000..1f2c99e6 --- /dev/null +++ b/test/Reader/Integration/_files/wordpress-atom10.xml @@ -0,0 +1,726 @@ + + Norm 2782 + Why are you here? + + 2009-03-07T08:03:50Z + WordPress + + + http://www.norm2782.com/feed/atom/ + + + + + norm2782 + http://www.norm2782.com + + <![CDATA[Wth… reading books?]]> + + http://www.norm2782.com/?p=114 + 2009-03-07T08:03:50Z + 2009-03-02T08:09:33Z + + Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

+ + +

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[My first few weeks in New Zealand]]> + + http://www.norm2782.com/?p=105 + 2009-02-18T03:30:07Z + 2009-02-15T03:29:21Z + + It’s been a while since my last blog post. Things have been quite hectic for me these last few weeks. There was my final week at Angry Bytes, followed by a pre-NZ party and then my trip to New Zealand. Currently New Zealand looks pretty much the same as the Netherlands, seeing as I’m locked away in an office most of my time.

+ +


+My adventure into Kiwi-land started with a long and interesting trip to San Francisco. The interesting part was my new book: Domain Driven Design: Tackling Complexity in the Heart of Software, by Eric Evans. This book, combined with KLM’s excellent on-board service made my flight to SF a breeze.

+

It was only 2PM when I arrived in SF, so I had to wait another 4 hours before my flight to Auckland even boarded. The waiting wasn’t too bad. It was great to get out into the sun and to grab some decent food and coffee. Didn’t get to see much of SF though, which was too bad.

+

SF Airport

+

The flight to Auckland wasn’t that flawless unfortunately. There were some technical problems with the airplane, which caused quite a bit of a delay. Because of this delay I had to run to catch my flight to Dunedin. The flight was all set to go and was waiting for me… I barely made it in time!

+ +

Flying to Dunedin

+

When I got to Dunedin I was welcomed by Jesse, Tracey and Lindsay. It was great to meet them in person. The first order of business for me was to get some coffee, because I only got roughly 3 hours of sleep on my way there. After a little tour of Abbey College (that’s where I’m staying) it was time for our first meeting. No time for sleep! Finally, after dinner at Abbey, I decided it was time to get some sleep. When I woke up the next day, the jet-lag was no more!

+

My Room

+

Abbey is a great place to stay by the way. It’s not far from the office or from the city center. The people who are staying there are great as well. Just check out the site. Abbey’s got it all!

+ +

View from my room

+

So what am I doing here in NZ? We’re currently working on writing the software for the PBRF initiative. It has already taken a lot of late hours, and it will probably take a lot more. It will be worth it though! After that, we’ll be working on a great and exciting cutting-edge open-source project. Unfortunately I can’t say a lot more at this point, but you can rest assured that it includes the latest Zend Framework technologies.

+

My Desk

+

Seeing as I don’t have internet-access at Abbey College yet, I’ve got lots of time for other activities. I’ve finished reading the better part of my Domain Driven Design book and I’ve ordered Martin Fowler’s Patterns Of Enterprise Application Architecture, which should arrive this week. I’ve also bought myself a brand new bicycle so I can get around. Cycling here is a bit more dangerous than in the Netherlands though… it definitely brings back memories from my bicycling trip in Scotland! There are lots more things on my todo list: winery tour, surfing, snowboarding, skydiving, bungee-jumping, renting/buying a Harley… six months in NZ is not going to be enough time!

+ +

Me!

+

Well, that’s my first NZ blog-post. There will definitely be more of these! Let’s hope they fix my internet soon… See my Flickr photo-stream for more pictures.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Properties in PHP – revisited]]> + + http://www.norm2782.com/?p=94 + 2009-01-14T10:47:25Z + 2009-01-14T10:47:25Z + + A while ago I was daydreaming about native property support in PHP. Unfortunately it will be a while before PHP itself will support this natively and an even longer while before shared hosting providers will upgrade to a newer version of PHP.

+ +

So what’s the big deal about those properties? In short, they make a developers life easier by allowing the developer to code no more than needed at that moment. And lets face it… less code is better! In this post we’ll see that it’s not impossible to enjoy properties in PHP today. As with a lot of good things, it does come with a small price though…

+


+Lets have a look at a use-case to demonstrate where properties will not only save you time, but it will also save your sanity. In this example we’re modeling a Person class. In the beginning of the project, the requirements for the Person class are quite simple: a Person has an age and a name. In the simplest form we can code that as follows:

+
+<?php
+class Person
+{
+    public $age;
+
+    public $name;
+}
+
+
+

This look easy enough, and it is. It even works like a charm and it’s possibly the fastest implementation for the Person class.

+

But, pesky as they are, the client suddenly wants some logic added to our Person class! A Person suddenly can’t be younger than 21 years old. This poses a problem. To add logic to our Person class, we would have to switch the public age attribute with a pair of getters and setters:

+
+<?php
+class Person
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+

Technically this works like a charm, however it will force me to go through my entire application and switch all references from the public attribute to the getter and setter. Not an ideal situation. One possible solution is to do things the Java way: just create all getters and setters up-front so you don’t have to do so afterwards. Even though this works fine, it’s in violation of our mission to write no more code than we actually need at the moment of writing.

+ +

The solution? Properties! But wait… PHP doesn’t support those, remember? Luckily we still have magic methods. It’s nowhere near as nice as a native solution, but at least it helps us write no more code than we need at the moment we’re first writing our code:

+
+<?php
+abstract class ModelAbstract
+{
+    public function __get($key)
+    {
+        $method = 'get' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        return $this->$method();
+    }
+
+    public function __set($key, $value)
+    {
+        $method = 'set' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        $this->$method($value);
+    }
+}
+
+

We’ll take a look at what this does exactly later. The important thing to note is that we can now do the following:

+
+<?php
+class Person extends ModelAbstract
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+$person = new Person();
+
+try {
+    $person->age = 10;
+} catch (Exception $e) {
+    // Will print "You need to be at least 21 years or older!"
+    echo $e->getMessage();
+}
+
+
+

With this construction in place, we can safely switch from a public attribute to getters and setters, without changing the rest of the application code. The only real downside to this – aside from the minor speed impact – is the fact that you have to subclass ModelAbstract to make this work. Luckily it’s not a lot of code, so should there be a big need to get rid of the ModelAbstract inheritance it’s not a big disaster to do some copy/paste work.

+

This method works by assuming you have get- and set methods that have the same name as the property you’re trying to access. When there’s a public attribute, it will use that. If there’s no public attribute, it will fall back to __get or __set and the logic will take it from there.

+

All of this is just a proof-of-concept of implementing properties in PHP and of the way I want to be using properties to access data the data in my objects. Please comment your experiences with this approach or similar approaches. I’m curious to see how practical this solution would be in a real-life situation.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Filters for Zend_Paginator]]> + + http://www.norm2782.com/?p=72 + 2009-01-14T08:23:19Z + 2009-01-13T12:57:53Z + + Zend_Paginator has a new feature! It is now possible to add a filter to your Paginator object which acts on the data retrieved from the adapter. This filter can be any instance of Zend_Filter_Interface, including a filter-chain. If a filter(-chain) is set, the raw data from the adapter will be passed to the filter() method.

+ +


+So why would you want to apply filters to your result set? Usually my domain models don’t inherit from Zend_Db_Table_Row but that is the data type I get from the Paginator when I use the DbTableSelect adapter (wrapped in a nice Zend_Db_Table_Rowset). Instead, I would like to load my rows into my models and preferably without using the Paginator abilities or having to apply weird hacks. Previously this was only possible (in a sane way) by subclassing an adapter so it could return a collection of model objects instead of a rowset. With the new filter support you can just inject a filter to do this for you.

+

Lets have a look at an example. In this example I want to list all my users from the database. I’ll grab the name of the user from the row and inject it into a User object.

+
+<?php
+class User
+{
+    private $_name = '';
+
+    public function getName()
+    {
+        return $this->_name;
+    }
+
+    public function setName($name)
+    {
+        $this->_name = $name;
+    }
+}
+
+class UserFilter implements Zend_Filter_Interface
+{
+    public function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new UserFilter());
+
+        return $paginator;
+    }
+}
+
+$paginator = MyModel::getUserPaginator();
+$items = $paginator->getCurrentItems();
+
+foreach ($items as $user) {
+    echo 'Current name: ' . $user->getName() . '<br />' . PHP_EOL;
+}
+
+
+

To simplify adding a simple filter to your paginator I’ve also added Zend_Filter_Callback. This allows you to specify a callback method that does the same as the filter in the previous example.

+
+<?php
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new Zend_Filter_Callback(
+            array('MyModel', 'filter'))
+        );
+
+        return $paginator;
+    }
+
+    public static function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+

The callback also accepts object instead of a static reference to a class. Internally it uses call_user_func to execute the filter() method, so any notation that works there, works with the Callback filter.

+

Enjoy!

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[ZF-3239]]> + + http://www.norm2782.com/?p=68 + 2009-01-11T09:53:20Z + 2009-01-07T11:48:31Z + + Zend_Db_Table_Select users, rejoice! I’ve just committed a patch for ZF-3239 in revision 13530. This should be a relief for those of you who have been implementing workarounds for those “No table has been specified for the FROM clause” exceptions.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[New in-ear earphones]]> + + http://www.norm2782.com/?p=53 + 2009-01-03T18:51:43Z + 2009-01-03T15:49:19Z + + Just got myself the Sennheiser CX 300 II Precision in-ear earphones. Check ‘em out by clicking the read more link!

+ +


+cx300

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Seven Things – Tagged by Pádraic]]> + + http://www.norm2782.com/?p=44 + 2009-01-03T11:47:19Z + 2009-01-03T10:14:38Z + + Well, this was bound to happen: I got tagged by Pádraic because I’m working on Zend_Feed_Reader with him. Luckily I’ve just setup this new blog, so here we go!

+ +

Did you know that…

+
    +
  • Every bit of PHP I know is self-taught
  • +
  • My programming adventure started out with Visual Basic 3 back in 1993. I was just 8 years old back then and had no clue what I was doing.
  • +
  • My left foot is actually a few millimeter bigger than my right foot.
  • +
  • I used to have long hair (almost reached my ass). I cut it off in the summer of ‘08 for various reasons, one of which was 100 euro.
  • +
  • I bought my Harley Davidson before I even had my drivers license.
  • +
  • My whisky collection (only single malts ;) ) keeps growing instead of shrinking
  • + +
  • While I use a Mac, with an Apple Cinema Display and an Apple keyboard… I have an HTC Touch with Windows Mobile and I’m stuck with it for at least a few more months.
  • +
+

Now it’s my turn to start tagging!

+
    +
  • Stefan Koopmanschap – For not being tagged yet and having said so on Twitter
  • +
  • Maurice Fonk – For being my co-worker and for not having finished Madoqua yet
  • + +
  • Geoffrey Bachelet – For the great party in Paris
  • +
  • Wade Arnold – For doing a great job on Zend_AMF and having the same WordPress theme as me.
  • +
  • Kana Yeh – For being the coolest PHP girl in the Netherlands (that I know of)
  • +
  • Matthew Ratzloff – For his great help on Zend_Paginator
  • + +
  • And one more here…
  • +
+

As for the rules:

+
    +
  • Link your original tagger(s), and list these rules on your blog.
  • +
  • Share seven facts about yourself in the post – some random, some wierd.
  • +
  • Tag seven people at the end of your post by leaving their names and the links to their blogs.
  • +
  • Let them know they’ve been tagged by leaving a comment on their blogs and/or Twitter.
  • + +
+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[AMF Server class for WordPress]]> + + http://www.norm2782.com/?p=27 + 2009-01-06T15:00:54Z + 2009-01-02T14:49:42Z + + After browsing through WordPress’ code I quickly found that there’s no sane way to create AMF support as a WP plugin. At least not for someone who hasn’t done any old-skool procedural PHP in years. Instead of writing a plugin, I decided to write a standalone server script. It’s still very basic and currently setup to work for me. To get it working for your WP setup you should probably make some minor modifications. Click the read more link to check out the code. I’ve released it under the generous BSD license, so knock yourself out! Use it at your own risk… I’m not going to support it. Any updates will be posted in this post. Also, please note that I haven’t tested it yet. If you access the script directly it should output “Zend Amf Endpoint” just fine, but that’s all I can guarantee at this point ;)

+ +

+
+<?php
+/**
+ * BSD LICENSE
+ *
+ * Copyright (c) 2009, norm2782
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of norm2782 nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * Set production mode.
+ * If set to false, exceptions will bubble through to the Flex frontend
+ *
+ * @var bool
+ */
+$production = false;
+
+/**
+ * Determine the absolute path of the AMF server
+ *
+ * @var string
+ */
+define('ABSPATH', dirname(__FILE__) . '/');
+
+/**
+ * One directory below docroot. Your config file and library dir should be here.
+ *
+ * @var string
+ */
+define('SUBPATH', dirname(ABSPATH));
+
+/**
+ * You should make sure Zend Framework is in your include path
+ */
+set_include_path(
+    implode(PATH_SEPARATOR, array(
+        SUBPATH . '/library',
+        get_include_path()
+    ))
+);
+
+/**
+ * Include the WordPress config file
+ */
+$configFile = SUBPATH . '/wp-config.php';
+
+if (!file_exists($configFile)) {
+    throw new Exception('WordPress config file was not found!');
+}
+
+require_once $configFile;
+
+/**
+ * No need to config more stuff from this point on
+ */
+
+/**
+ * @see Zend_Amf_Server
+ */
+require_once 'Zend/Amf/Server.php';
+
+/**
+ * @see Zend_Db_Adapter_Pdo_Mysql
+ */
+require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
+
+/**
+ * @see Zend_Paginator
+ */
+require_once 'Zend/Paginator.php';
+
+/**
+ * @see Zend_Paginator_Adapter_DbSelect
+ */
+require_once 'Zend/Paginator/Adapter/DbSelect.php';
+
+/**
+ * Simple class to expose wordpress data through AMF
+ *
+ * @author norm2782
+ */
+class Wp_Amf_Gateway
+{
+    /**
+     * Database adapter
+     *
+     * @var Zend_Db_Adapter_Pdo_Mysql
+     */
+    private $_db = null;
+
+    /**
+     * WordPress table prefix
+     *
+     * @var string
+     */
+    private $_prefix = null;
+
+    /**
+     * Constructor
+     *
+     * @param array $dbConfig
+     * @param string $prefix
+     * @return void
+     */
+    public function __construct(array $dbConfig, $prefix)
+    {
+        $this->_db = new Zend_Db_Adapter_Pdo_Mysql($dbConfig);
+        $this->_db->query('SET NAMES `utf8`');
+
+        $this->_prefix = $prefix;
+    }
+
+    /**
+     * Get paginated results for the provided query
+     *
+     * @param Zend_Db_Select $select
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    private function _getPaginated(Zend_Db_Select $select, $page, $itemsPerPage)
+    {
+        $paginator = new Zend_Paginator(
+            new Zend_Paginator_Adapter_DbSelect($select)
+        );
+
+        $paginator->setCurrentPageNumber($page)
+                  ->setItemCountPerPage($itemsPerPage);
+
+        return array(
+            'info'  => $paginator->getPages(),
+            'items' => $paginator->getCurrentItems()
+        );
+    }
+
+    /**
+     * Get the comments for the specified post ID
+     *
+     * @param int $postId
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getCommentsForPost($postId, $page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'comments')
+                                      ->where('comment_post_ID = ?', $postId);
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+
+    /**
+     * Get the meta data for the specified post ID
+     *
+     * @param $postId
+     * @return unknown_type
+     */
+    public function getMetaForPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'postmeta')
+                                      ->where('post_id = ?', $postId);
+
+        return $this->_db->fetchAll($select);
+    }
+
+    /**
+     * Get a post by specifying its ID
+     *
+     * @param int $postId
+     * @return array
+     */
+    public function getPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts')
+                                      ->where('ID = ?', $postId);
+
+        return $this->_db->fetchOne($select);
+    }
+
+    /**
+     * Get posts per page
+     *
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getPosts($page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts');
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+}
+
+/**
+ * Pass the values from wp-config.php to the Wp_Amf_Gateway class.
+ */
+$gateway = new Wp_Amf_Gateway(
+    array(
+        'host'     => DB_HOST,
+        'username' => DB_USER,
+        'password' => DB_PASSWORD,
+        'dbname'   => DB_NAME
+    ),
+    $table_prefix
+);
+
+$server = new Zend_Amf_Server();
+$server->setProduction($production)
+       ->setClass($gateway)
+       ->handle();
+
+
+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Flex frontend]]> + + http://www.norm2782.com/?p=22 + 2009-01-02T09:27:20Z + 2009-01-01T23:29:35Z + + I was planning on writing a quick Flex frontend for this blog, but it appears WordPress only offers the posts themselves as RSS feed. If I get real bored (which I doubt, unfortunately) I’ll have a look and see if I can create a Zend_AMF plugin for WordPress that allows me to retrieve virtually all data from my WordPress install. Would be cool :D

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Properties in PHP]]> + + http://www.norm2782.com/?p=8 + 2009-01-02T15:13:15Z + 2009-01-01T23:02:54Z + + A while ago Dynom from #php_bnl pointed me to an interesting entry on the PHP 5.3 wiki page. In the “Future PHP releases” sections there’s an entry called “29. “real†properties with attached getters and setters”. Personally I can’t wait for this. Hopefully it will look something like ActionScript 3’s properties:

+
+<?php
+class Bar
+{
+    private $_foo = 'foo';
+
+    public function get foo()
+    {
+        return $this->_foo;
+    }
+
+    public function set foo($fooString)
+    {
+        $this->_foo = $fooString;
+    }
+}
+
+$bar = new Bar();
+$bar->foo = 'baz';
+echo $bar->foo; // prints baz
+
+
+]]>
+ + + 0 +
+
diff --git a/test/Reader/Integration/_files/wordpress-rss2-dc-atom.xml b/test/Reader/Integration/_files/wordpress-rss2-dc-atom.xml new file mode 100644 index 00000000..3d1fdfae --- /dev/null +++ b/test/Reader/Integration/_files/wordpress-rss2-dc-atom.xml @@ -0,0 +1,700 @@ + + + + + Norm 2782 + + http://www.norm2782.com + Why are you here? + Sat, 07 Mar 2009 08:03:50 +0000 + http://wordpress.org/?v=2.8 + en + hourly + 1 + + Wth… reading books? + http://www.norm2782.com/2009/03/wth-reading-books/ + http://www.norm2782.com/2009/03/wth-reading-books/#comments + Mon, 02 Mar 2009 08:09:33 +0000 + norm2782 + + + + + + http://www.norm2782.com/?p=114 + + Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

+ +

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

+]]>
+ http://www.norm2782.com/2009/03/wth-reading-books/feed/ + 0 +
+ + My first few weeks in New Zealand + http://www.norm2782.com/2009/02/my-first-few-weeks-in-new-zealand/ + http://www.norm2782.com/2009/02/my-first-few-weeks-in-new-zealand/#comments + Sun, 15 Feb 2009 03:29:21 +0000 + norm2782 + + + + http://www.norm2782.com/?p=105 + + It’s been a while since my last blog post. Things have been quite hectic for me these last few weeks. There was my final week at Angry Bytes, followed by a pre-NZ party and then my trip to New Zealand. Currently New Zealand looks pretty much the same as the Netherlands, seeing as I’m locked away in an office most of my time.

+


+My adventure into Kiwi-land started with a long and interesting trip to San Francisco. The interesting part was my new book: Domain Driven Design: Tackling Complexity in the Heart of Software, by Eric Evans. This book, combined with KLM’s excellent on-board service made my flight to SF a breeze.

+

It was only 2PM when I arrived in SF, so I had to wait another 4 hours before my flight to Auckland even boarded. The waiting wasn’t too bad. It was great to get out into the sun and to grab some decent food and coffee. Didn’t get to see much of SF though, which was too bad.

+

SF Airport

+

The flight to Auckland wasn’t that flawless unfortunately. There were some technical problems with the airplane, which caused quite a bit of a delay. Because of this delay I had to run to catch my flight to Dunedin. The flight was all set to go and was waiting for me… I barely made it in time!

+

Flying to Dunedin

+

When I got to Dunedin I was welcomed by Jesse, Tracey and Lindsay. It was great to meet them in person. The first order of business for me was to get some coffee, because I only got roughly 3 hours of sleep on my way there. After a little tour of Abbey College (that’s where I’m staying) it was time for our first meeting. No time for sleep! Finally, after dinner at Abbey, I decided it was time to get some sleep. When I woke up the next day, the jet-lag was no more!

+

My Room

+

Abbey is a great place to stay by the way. It’s not far from the office or from the city center. The people who are staying there are great as well. Just check out the site. Abbey’s got it all!

+

View from my room

+

So what am I doing here in NZ? We’re currently working on writing the software for the PBRF initiative. It has already taken a lot of late hours, and it will probably take a lot more. It will be worth it though! After that, we’ll be working on a great and exciting cutting-edge open-source project. Unfortunately I can’t say a lot more at this point, but you can rest assured that it includes the latest Zend Framework technologies.

+

My Desk

+

Seeing as I don’t have internet-access at Abbey College yet, I’ve got lots of time for other activities. I’ve finished reading the better part of my Domain Driven Design book and I’ve ordered Martin Fowler’s Patterns Of Enterprise Application Architecture, which should arrive this week. I’ve also bought myself a brand new bicycle so I can get around. Cycling here is a bit more dangerous than in the Netherlands though… it definitely brings back memories from my bicycling trip in Scotland! There are lots more things on my todo list: winery tour, surfing, snowboarding, skydiving, bungee-jumping, renting/buying a Harley… six months in NZ is not going to be enough time!

+

Me!

+

Well, that’s my first NZ blog-post. There will definitely be more of these! Let’s hope they fix my internet soon… See my Flickr photo-stream for more pictures.

+]]>
+ http://www.norm2782.com/2009/02/my-first-few-weeks-in-new-zealand/feed/ + 0 +
+ + Properties in PHP – revisited + http://www.norm2782.com/2009/01/properties-in-php-revisited/ + http://www.norm2782.com/2009/01/properties-in-php-revisited/#comments + Wed, 14 Jan 2009 10:47:25 +0000 + norm2782 + + + + http://www.norm2782.com/?p=94 + + A while ago I was daydreaming about native property support in PHP. Unfortunately it will be a while before PHP itself will support this natively and an even longer while before shared hosting providers will upgrade to a newer version of PHP.

+

So what’s the big deal about those properties? In short, they make a developers life easier by allowing the developer to code no more than needed at that moment. And lets face it… less code is better! In this post we’ll see that it’s not impossible to enjoy properties in PHP today. As with a lot of good things, it does come with a small price though…

+


+Lets have a look at a use-case to demonstrate where properties will not only save you time, but it will also save your sanity. In this example we’re modeling a Person class. In the beginning of the project, the requirements for the Person class are quite simple: a Person has an age and a name. In the simplest form we can code that as follows:

+
+<?php
+class Person
+{
+    public $age;
+
+    public $name;
+}
+
+

This look easy enough, and it is. It even works like a charm and it’s possibly the fastest implementation for the Person class.

+

But, pesky as they are, the client suddenly wants some logic added to our Person class! A Person suddenly can’t be younger than 21 years old. This poses a problem. To add logic to our Person class, we would have to switch the public age attribute with a pair of getters and setters:

+
+<?php
+class Person
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+

Technically this works like a charm, however it will force me to go through my entire application and switch all references from the public attribute to the getter and setter. Not an ideal situation. One possible solution is to do things the Java way: just create all getters and setters up-front so you don’t have to do so afterwards. Even though this works fine, it’s in violation of our mission to write no more code than we actually need at the moment of writing.

+

The solution? Properties! But wait… PHP doesn’t support those, remember? Luckily we still have magic methods. It’s nowhere near as nice as a native solution, but at least it helps us write no more code than we need at the moment we’re first writing our code:

+
+<?php
+abstract class ModelAbstract
+{
+    public function __get($key)
+    {
+        $method = 'get' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        return $this->$method();
+    }
+
+    public function __set($key, $value)
+    {
+        $method = 'set' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        $this->$method($value);
+    }
+}
+
+

We’ll take a look at what this does exactly later. The important thing to note is that we can now do the following:

+
+<?php
+class Person extends ModelAbstract
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+$person = new Person();
+
+try {
+    $person->age = 10;
+} catch (Exception $e) {
+    // Will print "You need to be at least 21 years or older!"
+    echo $e->getMessage();
+}
+
+

With this construction in place, we can safely switch from a public attribute to getters and setters, without changing the rest of the application code. The only real downside to this – aside from the minor speed impact – is the fact that you have to subclass ModelAbstract to make this work. Luckily it’s not a lot of code, so should there be a big need to get rid of the ModelAbstract inheritance it’s not a big disaster to do some copy/paste work.

+

This method works by assuming you have get- and set methods that have the same name as the property you’re trying to access. When there’s a public attribute, it will use that. If there’s no public attribute, it will fall back to __get or __set and the logic will take it from there.

+

All of this is just a proof-of-concept of implementing properties in PHP and of the way I want to be using properties to access data the data in my objects. Please comment your experiences with this approach or similar approaches. I’m curious to see how practical this solution would be in a real-life situation.

+]]>
+ http://www.norm2782.com/2009/01/properties-in-php-revisited/feed/ + 0 +
+ + Filters for Zend_Paginator + http://www.norm2782.com/2009/01/filters-for-zend_paginator/ + http://www.norm2782.com/2009/01/filters-for-zend_paginator/#comments + Tue, 13 Jan 2009 12:57:53 +0000 + norm2782 + + + + http://www.norm2782.com/?p=72 + + Zend_Paginator has a new feature! It is now possible to add a filter to your Paginator object which acts on the data retrieved from the adapter. This filter can be any instance of Zend_Filter_Interface, including a filter-chain. If a filter(-chain) is set, the raw data from the adapter will be passed to the filter() method.

+


+So why would you want to apply filters to your result set? Usually my domain models don’t inherit from Zend_Db_Table_Row but that is the data type I get from the Paginator when I use the DbTableSelect adapter (wrapped in a nice Zend_Db_Table_Rowset). Instead, I would like to load my rows into my models and preferably without using the Paginator abilities or having to apply weird hacks. Previously this was only possible (in a sane way) by subclassing an adapter so it could return a collection of model objects instead of a rowset. With the new filter support you can just inject a filter to do this for you.

+

Lets have a look at an example. In this example I want to list all my users from the database. I’ll grab the name of the user from the row and inject it into a User object.

+
+<?php
+class User
+{
+    private $_name = '';
+
+    public function getName()
+    {
+        return $this->_name;
+    }
+
+    public function setName($name)
+    {
+        $this->_name = $name;
+    }
+}
+
+class UserFilter implements Zend_Filter_Interface
+{
+    public function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new UserFilter());
+
+        return $paginator;
+    }
+}
+
+$paginator = MyModel::getUserPaginator();
+$items = $paginator->getCurrentItems();
+
+foreach ($items as $user) {
+    echo 'Current name: ' . $user->getName() . '<br />' . PHP_EOL;
+}
+
+

To simplify adding a simple filter to your paginator I’ve also added Zend_Filter_Callback. This allows you to specify a callback method that does the same as the filter in the previous example.

+
+<?php
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new Zend_Filter_Callback(
+            array('MyModel', 'filter'))
+        );
+
+        return $paginator;
+    }
+
+    public static function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+

The callback also accepts object instead of a static reference to a class. Internally it uses call_user_func to execute the filter() method, so any notation that works there, works with the Callback filter.

+

Enjoy!

+]]>
+ http://www.norm2782.com/2009/01/filters-for-zend_paginator/feed/ + 0 +
+ + ZF-3239 + http://www.norm2782.com/2009/01/zf-3239/ + http://www.norm2782.com/2009/01/zf-3239/#comments + Wed, 07 Jan 2009 11:48:31 +0000 + norm2782 + + + + http://www.norm2782.com/?p=68 + + Zend_Db_Table_Select users, rejoice! I’ve just committed a patch for ZF-3239 in revision 13530. This should be a relief for those of you who have been implementing workarounds for those “No table has been specified for the FROM clause” exceptions.

+]]>
+ http://www.norm2782.com/2009/01/zf-3239/feed/ + 0 +
+ + New in-ear earphones + http://www.norm2782.com/2009/01/new-in-ear-earphones/ + http://www.norm2782.com/2009/01/new-in-ear-earphones/#comments + Sat, 03 Jan 2009 15:49:19 +0000 + norm2782 + + + http://www.norm2782.com/?p=53 + + Just got myself the Sennheiser CX 300 II Precision in-ear earphones. Check ‘em out by clicking the read more link!

+


+cx300

+]]>
+ http://www.norm2782.com/2009/01/new-in-ear-earphones/feed/ + 0 +
+ + Seven Things – Tagged by Pádraic + http://www.norm2782.com/2009/01/seven-things-tagged-by-padraic/ + http://www.norm2782.com/2009/01/seven-things-tagged-by-padraic/#comments + Sat, 03 Jan 2009 10:14:38 +0000 + norm2782 + + + http://www.norm2782.com/?p=44 + + Well, this was bound to happen: I got tagged by Pádraic because I’m working on Zend_Feed_Reader with him. Luckily I’ve just setup this new blog, so here we go!

+

Did you know that…

+
    +
  • Every bit of PHP I know is self-taught
  • +
  • My programming adventure started out with Visual Basic 3 back in 1993. I was just 8 years old back then and had no clue what I was doing.
  • +
  • My left foot is actually a few millimeter bigger than my right foot.
  • +
  • I used to have long hair (almost reached my ass). I cut it off in the summer of ‘08 for various reasons, one of which was 100 euro.
  • +
  • I bought my Harley Davidson before I even had my drivers license.
  • +
  • My whisky collection (only single malts ;) ) keeps growing instead of shrinking
  • +
  • While I use a Mac, with an Apple Cinema Display and an Apple keyboard… I have an HTC Touch with Windows Mobile and I’m stuck with it for at least a few more months.
  • +
+

Now it’s my turn to start tagging!

+
    +
  • Stefan Koopmanschap – For not being tagged yet and having said so on Twitter
  • +
  • Maurice Fonk – For being my co-worker and for not having finished Madoqua yet
  • +
  • Geoffrey Bachelet – For the great party in Paris
  • +
  • Wade Arnold – For doing a great job on Zend_AMF and having the same WordPress theme as me.
  • +
  • Kana Yeh – For being the coolest PHP girl in the Netherlands (that I know of)
  • +
  • Matthew Ratzloff – For his great help on Zend_Paginator
  • +
  • And one more here…
  • +
+

As for the rules:

+
    +
  • Link your original tagger(s), and list these rules on your blog.
  • +
  • Share seven facts about yourself in the post – some random, some wierd.
  • +
  • Tag seven people at the end of your post by leaving their names and the links to their blogs.
  • +
  • Let them know they’ve been tagged by leaving a comment on their blogs and/or Twitter.
  • +
+]]>
+ http://www.norm2782.com/2009/01/seven-things-tagged-by-padraic/feed/ + 0 +
+ + AMF Server class for WordPress + http://www.norm2782.com/2009/01/amf-server-class-for-wordpress/ + http://www.norm2782.com/2009/01/amf-server-class-for-wordpress/#comments + Fri, 02 Jan 2009 14:49:42 +0000 + norm2782 + + + + + http://www.norm2782.com/?p=27 + + After browsing through WordPress’ code I quickly found that there’s no sane way to create AMF support as a WP plugin. At least not for someone who hasn’t done any old-skool procedural PHP in years. Instead of writing a plugin, I decided to write a standalone server script. It’s still very basic and currently setup to work for me. To get it working for your WP setup you should probably make some minor modifications. Click the read more link to check out the code. I’ve released it under the generous BSD license, so knock yourself out! Use it at your own risk… I’m not going to support it. Any updates will be posted in this post. Also, please note that I haven’t tested it yet. If you access the script directly it should output “Zend Amf Endpoint” just fine, but that’s all I can guarantee at this point ;)

+

+
+<?php
+/**
+ * BSD LICENSE
+ *
+ * Copyright (c) 2009, norm2782
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of norm2782 nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * Set production mode.
+ * If set to false, exceptions will bubble through to the Flex frontend
+ *
+ * @var bool
+ */
+$production = false;
+
+/**
+ * Determine the absolute path of the AMF server
+ *
+ * @var string
+ */
+define('ABSPATH', dirname(__FILE__) . '/');
+
+/**
+ * One directory below docroot. Your config file and library dir should be here.
+ *
+ * @var string
+ */
+define('SUBPATH', dirname(ABSPATH));
+
+/**
+ * You should make sure Zend Framework is in your include path
+ */
+set_include_path(
+    implode(PATH_SEPARATOR, array(
+        SUBPATH . '/library',
+        get_include_path()
+    ))
+);
+
+/**
+ * Include the WordPress config file
+ */
+$configFile = SUBPATH . '/wp-config.php';
+
+if (!file_exists($configFile)) {
+    throw new Exception('WordPress config file was not found!');
+}
+
+require_once $configFile;
+
+/**
+ * No need to config more stuff from this point on
+ */
+
+/**
+ * @see Zend_Amf_Server
+ */
+require_once 'Zend/Amf/Server.php';
+
+/**
+ * @see Zend_Db_Adapter_Pdo_Mysql
+ */
+require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
+
+/**
+ * @see Zend_Paginator
+ */
+require_once 'Zend/Paginator.php';
+
+/**
+ * @see Zend_Paginator_Adapter_DbSelect
+ */
+require_once 'Zend/Paginator/Adapter/DbSelect.php';
+
+/**
+ * Simple class to expose wordpress data through AMF
+ *
+ * @author norm2782
+ */
+class Wp_Amf_Gateway
+{
+    /**
+     * Database adapter
+     *
+     * @var Zend_Db_Adapter_Pdo_Mysql
+     */
+    private $_db = null;
+
+    /**
+     * WordPress table prefix
+     *
+     * @var string
+     */
+    private $_prefix = null;
+
+    /**
+     * Constructor
+     *
+     * @param array $dbConfig
+     * @param string $prefix
+     * @return void
+     */
+    public function __construct(array $dbConfig, $prefix)
+    {
+        $this->_db = new Zend_Db_Adapter_Pdo_Mysql($dbConfig);
+        $this->_db->query('SET NAMES `utf8`');
+
+        $this->_prefix = $prefix;
+    }
+
+    /**
+     * Get paginated results for the provided query
+     *
+     * @param Zend_Db_Select $select
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    private function _getPaginated(Zend_Db_Select $select, $page, $itemsPerPage)
+    {
+        $paginator = new Zend_Paginator(
+            new Zend_Paginator_Adapter_DbSelect($select)
+        );
+
+        $paginator->setCurrentPageNumber($page)
+                  ->setItemCountPerPage($itemsPerPage);
+
+        return array(
+            'info'  => $paginator->getPages(),
+            'items' => $paginator->getCurrentItems()
+        );
+    }
+
+    /**
+     * Get the comments for the specified post ID
+     *
+     * @param int $postId
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getCommentsForPost($postId, $page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'comments')
+                                      ->where('comment_post_ID = ?', $postId);
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+
+    /**
+     * Get the meta data for the specified post ID
+     *
+     * @param $postId
+     * @return unknown_type
+     */
+    public function getMetaForPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'postmeta')
+                                      ->where('post_id = ?', $postId);
+
+        return $this->_db->fetchAll($select);
+    }
+
+    /**
+     * Get a post by specifying its ID
+     *
+     * @param int $postId
+     * @return array
+     */
+    public function getPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts')
+                                      ->where('ID = ?', $postId);
+
+        return $this->_db->fetchOne($select);
+    }
+
+    /**
+     * Get posts per page
+     *
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getPosts($page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts');
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+}
+
+/**
+ * Pass the values from wp-config.php to the Wp_Amf_Gateway class.
+ */
+$gateway = new Wp_Amf_Gateway(
+    array(
+        'host'     => DB_HOST,
+        'username' => DB_USER,
+        'password' => DB_PASSWORD,
+        'dbname'   => DB_NAME
+    ),
+    $table_prefix
+);
+
+$server = new Zend_Amf_Server();
+$server->setProduction($production)
+       ->setClass($gateway)
+       ->handle();
+
+]]>
+ http://www.norm2782.com/2009/01/amf-server-class-for-wordpress/feed/ + 0 +
+ + Flex frontend + http://www.norm2782.com/2009/01/flex-frontend/ + http://www.norm2782.com/2009/01/flex-frontend/#comments + Thu, 01 Jan 2009 23:29:35 +0000 + norm2782 + + + + http://www.norm2782.com/?p=22 + + I was planning on writing a quick Flex frontend for this blog, but it appears WordPress only offers the posts themselves as RSS feed. If I get real bored (which I doubt, unfortunately) I’ll have a look and see if I can create a Zend_AMF plugin for WordPress that allows me to retrieve virtually all data from my WordPress install. Would be cool :D

+]]>
+ http://www.norm2782.com/2009/01/flex-frontend/feed/ + 0 +
+ + Properties in PHP + http://www.norm2782.com/2009/01/properties-in-php/ + http://www.norm2782.com/2009/01/properties-in-php/#comments + Thu, 01 Jan 2009 23:02:54 +0000 + norm2782 + + + + http://www.norm2782.com/?p=8 + + A while ago Dynom from #php_bnl pointed me to an interesting entry on the PHP 5.3 wiki page. In the “Future PHP releases” sections there’s an entry called “29. “real†properties with attached getters and setters”. Personally I can’t wait for this. Hopefully it will look something like ActionScript 3’s properties:

+
+<?php
+class Bar
+{
+    private $_foo = 'foo';
+
+    public function get foo()
+    {
+        return $this->_foo;
+    }
+
+    public function set foo($fooString)
+    {
+        $this->_foo = $fooString;
+    }
+}
+
+$bar = new Bar();
+$bar->foo = 'baz';
+echo $bar->foo; // prints baz
+
+]]>
+ http://www.norm2782.com/2009/01/properties-in-php/feed/ + 0 +
+
+
diff --git a/test/Reader/_files/My/Extension/JungleBooks/Entry.php b/test/Reader/_files/My/Extension/JungleBooks/Entry.php new file mode 100644 index 00000000..d02bb1e5 --- /dev/null +++ b/test/Reader/_files/My/Extension/JungleBooks/Entry.php @@ -0,0 +1,27 @@ +_data['isbn'])) { + return $this->_data['isbn']; + } + $isbn = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/jungle:isbn)'); + if (!$isbn) { + $isbn = null; + } + $this->_data['isbn'] = $title; + return $this->_data['isbn']; + } + + protected function _registerNamespaces() + { + $this->_xpath->registerNamespace('jungle', 'http://example.com/junglebooks/rss/module/1.0/'); + } +} diff --git a/test/Reader/_files/My/Extension/JungleBooks/Feed.php b/test/Reader/_files/My/Extension/JungleBooks/Feed.php new file mode 100644 index 00000000..8d94c855 --- /dev/null +++ b/test/Reader/_files/My/Extension/JungleBooks/Feed.php @@ -0,0 +1,25 @@ +_data['dayPopular'])) { + return $this->_data['dayPopular']; + } + $dayPopular = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/jungle:dayPopular)'); + if (!$dayPopular) { + $dayPopular = null; + } + $this->_data['dayPopular'] = $dayPopular; + return $this->_data['dayPopular']; + } + + protected function _registerNamespaces() + { + $this->_xpath->registerNamespace('jungle', 'http://example.com/junglebooks/rss/module/1.0/'); + } +} diff --git a/test/Reader/_files/Reader/atom03.xml b/test/Reader/_files/Reader/atom03.xml new file mode 100644 index 00000000..071f83a0 --- /dev/null +++ b/test/Reader/_files/Reader/atom03.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/test/Reader/_files/Reader/atom10.xml b/test/Reader/_files/Reader/atom10.xml new file mode 100644 index 00000000..4b990551 --- /dev/null +++ b/test/Reader/_files/Reader/atom10.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/test/Reader/_files/Reader/rss090.xml b/test/Reader/_files/Reader/rss090.xml new file mode 100644 index 00000000..72b79748 --- /dev/null +++ b/test/Reader/_files/Reader/rss090.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/_files/Reader/rss091.xml b/test/Reader/_files/Reader/rss091.xml new file mode 100644 index 00000000..8f866b38 --- /dev/null +++ b/test/Reader/_files/Reader/rss091.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/_files/Reader/rss092.xml b/test/Reader/_files/Reader/rss092.xml new file mode 100644 index 00000000..d03fff2c --- /dev/null +++ b/test/Reader/_files/Reader/rss092.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/_files/Reader/rss093.xml b/test/Reader/_files/Reader/rss093.xml new file mode 100644 index 00000000..8b784f6c --- /dev/null +++ b/test/Reader/_files/Reader/rss093.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/_files/Reader/rss094.xml b/test/Reader/_files/Reader/rss094.xml new file mode 100644 index 00000000..02422130 --- /dev/null +++ b/test/Reader/_files/Reader/rss094.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/_files/Reader/rss10.xml b/test/Reader/_files/Reader/rss10.xml new file mode 100644 index 00000000..6f9c76f2 --- /dev/null +++ b/test/Reader/_files/Reader/rss10.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/_files/Reader/rss20.xml b/test/Reader/_files/Reader/rss20.xml new file mode 100644 index 00000000..c60501ea --- /dev/null +++ b/test/Reader/_files/Reader/rss20.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/ReaderTest.php b/test/ReaderTest.php new file mode 100644 index 00000000..bc04442c --- /dev/null +++ b/test/ReaderTest.php @@ -0,0 +1,156 @@ +_feedSamplePath = dirname(__FILE__) . '/Reader/_files'; + } + + public function teadDown() + { + Zend_Feed_Reader::reset(); + } + + public function testDetectsFeedIsRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/Reader/rss20.xml')); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_20, $type); + } + + public function testDetectsFeedIsRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/Reader/rss094.xml')); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_094, $type); + } + + public function testDetectsFeedIsRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/Reader/rss093.xml')); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_093, $type); + } + + public function testDetectsFeedIsRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/Reader/rss092.xml')); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_092, $type); + } + + public function testDetectsFeedIsRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/Reader/rss091.xml')); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_091, $type); + } + + public function testDetectsFeedIsRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/Reader/rss10.xml')); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_10, $type); + } + + public function testDetectsFeedIsRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/Reader/rss090.xml')); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_090, $type); + } + + public function testDetectsFeedIsAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/Reader/atom10.xml')); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_ATOM_10, $type); + } + + public function testDetectsFeedIsAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/Reader/atom03.xml')); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_ATOM_03, $type); + } + + public function testGetEncoding() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents(dirname(__FILE__) . '/Reader/Entry/_files/Atom/title/plain/atom10.xml') + ); + + $this->assertEquals('utf-8', $feed->getEncoding()); + $this->assertEquals('utf-8', $feed->current()->getEncoding()); + } + + public function testImportsFile() + { + try { + $feed = Zend_Feed_Reader::importFile( + dirname(__FILE__) . '/Reader/Entry/_files/Atom/title/plain/atom10.xml' + ); + } catch(Exception $e) { + $this->fail($e->getMessage()); + } + } + + public function testImportsUri() + { + try { + $feed = Zend_Feed_Reader::import('http://www.planet-php.net/rdf/'); + } catch(Exception $e) { + $this->fail($e->getMessage()); + } + } + + public function testGetsFeedLinksAsValueObject() + { + try { + $links = Zend_Feed_Reader::findFeedLinks('http://www.planet-php.net'); + } catch(Exception $e) { + $this->fail($e->getMessage()); + } + $this->assertEquals('http://www.planet-php.org/rss/', $links->rss); + } + + public function testAddsPrefixPath() + { + Zend_Feed_Reader::addPrefixPath('A_B_C', '/A/B/C'); + $prefixPaths = Zend_Feed_Reader::getPluginLoader()->getPaths(); + $this->assertEquals('/A/B/C/', $prefixPaths['A_B_C_'][0]); + } + + public function testRegistersUserExtension() + { + try { + Zend_Feed_Reader::addPrefixPath('My_FeedReader_Extension',dirname(__FILE__) . '/Reader/_files/My/Extension'); + Zend_Feed_Reader::registerExtension('JungleBooks'); + } catch(Exception $e) { + $this->fail($e->getMessage()); + } + $this->assertTrue(Zend_Feed_Reader::isRegistered('JungleBooks')); + } + + /*public function testCanApplyHttpConditionalGetRequest() + { + + }*/ + +} From 8edafbf3e4ad0c77115ae20177b16135f02e4f1f Mon Sep 17 00:00:00 2001 From: padraic Date: Wed, 15 Jul 2009 18:30:07 +0000 Subject: [PATCH 007/238] Small patch to fix Zend_Feed_Reader resets when testing git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16740 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader.php | 30 +++++++++++++++--------------- test/ReaderTest.php | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Reader.php b/src/Reader.php index 5037e208..0b81860d 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -198,8 +198,8 @@ public static function getHttpMethodOverride() /** * Set the flag indicating whether or not to use HTTP conditional GET - * - * @param bool $bool + * + * @param bool $bool * @return void */ public static function useHttpConditionalGet($bool = true) @@ -546,22 +546,22 @@ public static function getPluginLoader() /** * Add prefix path for loading Extensions - * - * @param string $prefix - * @param string $path + * + * @param string $prefix + * @param string $path * @return void */ public static function addPrefixPath($prefix, $path) { $prefix = rtrim($prefix, '_'); $path = rtrim($path, DIRECTORY_SEPARATOR); - self::$_pluginLoader->addPrefixPath($prefix, $path); + self::getPluginLoader()->addPrefixPath($prefix, $path); } /** * Add multiple Extension prefix paths at once - * - * @param array $spec + * + * @param array $spec * @return void */ public static function addPrefixPaths(array $spec) @@ -578,8 +578,8 @@ public static function addPrefixPaths(array $spec) /** * Register an Extension by name - * - * @param string $name + * + * @param string $name * @return void * @throws Zend_Feed_Exception if unable to resolve Extension class */ @@ -614,8 +614,8 @@ public static function registerExtension($name) /** * Is a given named Extension registered? - * - * @param string $extensionName + * + * @param string $extensionName * @return boolean */ public static function isRegistered($extensionName) @@ -632,7 +632,7 @@ public static function isRegistered($extensionName) /** * Get a list of extensions - * + * * @return array */ public static function getExtensions() @@ -642,7 +642,7 @@ public static function getExtensions() /** * Reset class state to defaults - * + * * @return void */ public static function reset() @@ -675,7 +675,7 @@ public static function reset() /** * Register core (default) extensions - * + * * @return void */ protected static function _registerCoreExtensions() diff --git a/test/ReaderTest.php b/test/ReaderTest.php index bc04442c..99642ec8 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -13,7 +13,7 @@ public function setup() $this->_feedSamplePath = dirname(__FILE__) . '/Reader/_files'; } - public function teadDown() + public function tearDown() { Zend_Feed_Reader::reset(); } From 2882b0cbf560aab316a581a13975127506feaed4 Mon Sep 17 00:00:00 2001 From: norm2782 Date: Fri, 17 Jul 2009 02:52:37 +0000 Subject: [PATCH 008/238] Adding Enclosure support to Atom and RSS. Adding Podcast extension. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16792 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader.php | 1 + src/Reader/Entry/Atom.php | 18 ++ src/Reader/Entry/Interface.php | 17 +- src/Reader/Entry/Rss.php | 45 ++- src/Reader/Extension/Atom/Entry.php | 31 +- src/Reader/Extension/Podcast/Entry.php | 202 ++++++++++++ src/Reader/Extension/Podcast/Feed.php | 293 ++++++++++++++++++ test/Reader/Entry/AtomTest.php | 33 ++ test/Reader/Entry/RssTest.php | 27 ++ .../_files/Atom/enclosure/plain/atom03.xml | 6 + .../_files/Atom/enclosure/plain/atom10.xml | 6 + .../_files/Rss/enclosure/plain/rss10.xml | 9 + .../_files/Rss/enclosure/plain/rss20.xml | 8 + test/Reader/Integration/PodcastRss2Test.php | 254 +++++++++++++++ test/Reader/Integration/_files/podcast.xml | 92 ++++++ 15 files changed, 1022 insertions(+), 20 deletions(-) create mode 100644 src/Reader/Extension/Podcast/Entry.php create mode 100644 src/Reader/Extension/Podcast/Feed.php create mode 100644 test/Reader/Entry/_files/Atom/enclosure/plain/atom03.xml create mode 100644 test/Reader/Entry/_files/Atom/enclosure/plain/atom10.xml create mode 100644 test/Reader/Entry/_files/Rss/enclosure/plain/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/enclosure/plain/rss20.xml create mode 100644 test/Reader/Integration/PodcastRss2Test.php create mode 100644 test/Reader/Integration/_files/podcast.xml diff --git a/src/Reader.php b/src/Reader.php index 0b81860d..91647669 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -686,5 +686,6 @@ protected static function _registerCoreExtensions() self::registerExtension('Slash'); self::registerExtension('WellFormedWeb'); self::registerExtension('Thread'); + self::registerExtension('Podcast'); } } diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index 1b5cb49c..2236c53a 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -197,6 +197,24 @@ public function getDescription() return $this->_data['description']; } + /** + * Get the entry enclosure + * + * @return string + */ + public function getEnclosure() + { + if (array_key_exists('enclosure', $this->_data)) { + return $this->_data['enclosure']; + } + + $enclosure = $this->_atom->getEnclosure(); + + $this->_data['enclosure'] = $enclosure; + + return $this->_data['enclosure']; + } + /** * Get the entry ID * diff --git a/src/Reader/Entry/Interface.php b/src/Reader/Entry/Interface.php index 02df0d57..39392334 100644 --- a/src/Reader/Entry/Interface.php +++ b/src/Reader/Entry/Interface.php @@ -27,16 +27,6 @@ */ interface Zend_Feed_Reader_Entry_Interface { - /** - * Constructor - * - * @param Zend_Feed_Entry_Abstract $entry - * @param int $entryKey - * @param string $type - * @return void - */ - public function __construct(DOMElement $entry, $entryKey, $type = null); - /** * Get the specified author * @@ -80,6 +70,13 @@ public function getDateModified(); */ public function getDescription(); + /** + * Get the entry enclosure + * + * @return stdClass + */ + public function getEnclosure(); + /** * Get the entry ID * diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index f695240e..b9c2ca30 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -214,7 +214,7 @@ public function getAuthors() 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) ) { // source name from RSS 2.0 @@ -269,7 +269,7 @@ public function getContent() /** * Get the entry's date of creation - * + * * @return string */ public function getDateCreated() @@ -279,7 +279,7 @@ public function getDateCreated() /** * Get the entry's date of modification - * + * * @return string */ public function getDateModified() @@ -291,7 +291,7 @@ public function getDateModified() $dateModified = null; $date = null; - 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 ) { $dateModified = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/pubDate)'); @@ -343,7 +343,7 @@ public function getDescription() $description = null; - 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 ) { $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/description)'); @@ -370,6 +370,35 @@ public function getDescription() return $this->_data['description']; } + /** + * Get the entry enclosure + * + * @return string + */ + public function getEnclosure() + { + if (array_key_exists('enclosure', $this->_data)) { + return $this->_data['enclosure']; + } + + $enclosure = null; + + if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_20) { + $nodeList = $this->_xpath->query($this->_xpathQueryRss . '/enclosure'); + + if ($nodeList->length > 0) { + $enclosure = new stdClass(); + $enclosure->url = $nodeList->item(0)->getAttribute('url'); + $enclosure->length = $nodeList->item(0)->getAttribute('length'); + $enclosure->type = $nodeList->item(0)->getAttribute('type'); + } + } + + $this->_data['enclosure'] = $enclosure; + + return $this->_data['enclosure']; + } + /** * Get the entry ID * @@ -383,7 +412,7 @@ public function getId() $id = null; - 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 ) { $id = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/guid)'); @@ -487,7 +516,7 @@ public function getTitle() $title = null; - 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 ) { $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/title)'); @@ -555,7 +584,7 @@ public function getCommentLink() $commentlink = null; - 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 ) { $commentlink = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/comments)'); diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 2f3423b5..f794415a 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -40,7 +40,7 @@ * @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_Entry +class Zend_Feed_Reader_Extension_Atom_Entry extends Zend_Feed_Reader_Extension_EntryAbstract { /** @@ -209,6 +209,33 @@ public function getDescription() return $this->_data['description']; } + /** + * Get the entry enclosure + * + * @return string + */ + public function getEnclosure() + { + if (array_key_exists('enclosure', $this->_data)) { + return $this->_data['enclosure']; + } + + $enclosure = null; + + $nodeList = $this->_xpath->query($this->getXpathPrefix() . '/atom:link[@rel="enclosure"]'); + + if ($nodeList->length > 0) { + $enclosure = new stdClass(); + $enclosure->url = $nodeList->item(0)->getAttribute('href'); + $enclosure->length = $nodeList->item(0)->getAttribute('length'); + $enclosure->type = $nodeList->item(0)->getAttribute('type'); + } + + $this->_data['enclosure'] = $enclosure; + + return $this->_data['enclosure']; + } + /** * Get the entry ID * @@ -442,7 +469,7 @@ protected function _getAuthor(DOMElement $element) */ 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 diff --git a/src/Reader/Extension/Podcast/Entry.php b/src/Reader/Extension/Podcast/Entry.php new file mode 100644 index 00000000..b93193c5 --- /dev/null +++ b/src/Reader/Extension/Podcast/Entry.php @@ -0,0 +1,202 @@ +_data['author'])) { + return $this->_data['author']; + } + + $author = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:author)'); + + if (!$author) { + $author = null; + } + + $this->_data['author'] = $author; + + return $this->_data['author']; + } + + /** + * Get the entry block + * + * @return string + */ + public function getBlock() + { + if (isset($this->_data['block'])) { + return $this->_data['block']; + } + + $block = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:block)'); + + if (!$block) { + $block = null; + } + + $this->_data['block'] = $block; + + return $this->_data['block']; + } + + /** + * Get the entry duration + * + * @return string + */ + public function getDuration() + { + if (isset($this->_data['duration'])) { + return $this->_data['duration']; + } + + $duration = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:duration)'); + + if (!$duration) { + $duration = null; + } + + $this->_data['duration'] = $duration; + + return $this->_data['duration']; + } + + /** + * Get the entry explicit + * + * @return string + */ + public function getExplicit() + { + if (isset($this->_data['explicit'])) { + return $this->_data['explicit']; + } + + $explicit = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:explicit)'); + + if (!$explicit) { + $explicit = null; + } + + $this->_data['explicit'] = $explicit; + + return $this->_data['explicit']; + } + + /** + * Get the entry keywords + * + * @return string + */ + public function getKeywords() + { + if (isset($this->_data['keywords'])) { + return $this->_data['keywords']; + } + + $keywords = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)'); + + if (!$keywords) { + $keywords = null; + } + + $this->_data['keywords'] = $keywords; + + return $this->_data['keywords']; + } + + /** + * Get the entry subtitle + * + * @return string + */ + public function getSubtitle() + { + if (isset($this->_data['subtitle'])) { + return $this->_data['subtitle']; + } + + $subtitle = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:subtitle)'); + + if (!$subtitle) { + $subtitle = null; + } + + $this->_data['subtitle'] = $subtitle; + + return $this->_data['subtitle']; + } + + /** + * Get the entry summary + * + * @return string + */ + public function getSummary() + { + if (isset($this->_data['summary'])) { + return $this->_data['summary']; + } + + $summary = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:summary)'); + + if (!$summary) { + $summary = null; + } + + $this->_data['summary'] = $summary; + + return $this->_data['summary']; + } + + /** + * Register iTunes namespace + * + */ + protected function _registerNamespaces() + { + $this->_xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); + } +} \ No newline at end of file diff --git a/src/Reader/Extension/Podcast/Feed.php b/src/Reader/Extension/Podcast/Feed.php new file mode 100644 index 00000000..ae747d81 --- /dev/null +++ b/src/Reader/Extension/Podcast/Feed.php @@ -0,0 +1,293 @@ +_data['author'])) { + return $this->_data['author']; + } + + $author = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:author)'); + + if (!$author) { + $author = null; + } + + $this->_data['author'] = $author; + + return $this->_data['author']; + } + + /** + * Get the entry block + * + * @return string + */ + public function getBlock() + { + if (isset($this->_data['block'])) { + return $this->_data['block']; + } + + $block = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:block)'); + + if (!$block) { + $block = null; + } + + $this->_data['block'] = $block; + + return $this->_data['block']; + } + + /** + * Get the entry category + * + * @return string + */ + public function getCategories() + { + if (isset($this->_data['categories'])) { + return $this->_data['categories']; + } + + $categoryList = $this->_xpath->query($this->getXpathPrefix() . '/itunes:category'); + + $categories = array(); + + if ($categoryList->length > 0) { + foreach ($categoryList as $node) { + $children = null; + + if ($node->childNodes->length > 0) { + $children = array(); + + foreach ($node->childNodes as $childNode) { + if (!($childNode instanceof DOMText)) { + $children[$childNode->getAttribute('text')] = null; + } + } + } + + $categories[$node->getAttribute('text')] = $children; + } + } + + + if (!$categories) { + $categories = null; + } + + $this->_data['categories'] = $categories; + + return $this->_data['categories']; + } + + /** + * Get the entry explicit + * + * @return string + */ + public function getExplicit() + { + if (isset($this->_data['explicit'])) { + return $this->_data['explicit']; + } + + $explicit = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:explicit)'); + + if (!$explicit) { + $explicit = null; + } + + $this->_data['explicit'] = $explicit; + + return $this->_data['explicit']; + } + + /** + * Get the entry image + * + * @return string + */ + public function getImage() + { + if (isset($this->_data['image'])) { + return $this->_data['image']; + } + + $image = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:image/@href)'); + + if (!$image) { + $image = null; + } + + $this->_data['image'] = $image; + + return $this->_data['image']; + } + + /** + * Get the entry keywords + * + * @return string + */ + public function getKeywords() + { + if (isset($this->_data['keywords'])) { + return $this->_data['keywords']; + } + + $keywords = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)'); + + if (!$keywords) { + $keywords = null; + } + + $this->_data['keywords'] = $keywords; + + return $this->_data['keywords']; + } + + /** + * Get the entry's new feed url + * + * @return string + */ + public function getNewFeedUrl() + { + if (isset($this->_data['new-feed-url'])) { + return $this->_data['new-feed-url']; + } + + $newFeedUrl = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:new-feed-url)'); + + if (!$newFeedUrl) { + $newFeedUrl = null; + } + + $this->_data['new-feed-url'] = $newFeedUrl; + + return $this->_data['new-feed-url']; + } + + /** + * Get the entry owner + * + * @return string + */ + public function getOwner() + { + if (isset($this->_data['owner'])) { + return $this->_data['owner']; + } + + $owner = null; + + $email = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:owner/itunes:email)'); + $name = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:owner/itunes:name)'); + + if (!empty($email)) { + $owner = $email . (empty($name) ? '' : ' (' . $name . ')'); + } else if (!empty($name)) { + $owner = $name; + } + + if (!$owner) { + $owner = null; + } + + $this->_data['owner'] = $owner; + + return $this->_data['owner']; + } + + /** + * Get the entry subtitle + * + * @return string + */ + public function getSubtitle() + { + if (isset($this->_data['subtitle'])) { + return $this->_data['subtitle']; + } + + $subtitle = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:subtitle)'); + + if (!$subtitle) { + $subtitle = null; + } + + $this->_data['subtitle'] = $subtitle; + + return $this->_data['subtitle']; + } + + /** + * Get the entry summary + * + * @return string + */ + public function getSummary() + { + if (isset($this->_data['summary'])) { + return $this->_data['summary']; + } + + $summary = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:summary)'); + + if (!$summary) { + $summary = null; + } + + $this->_data['summary'] = $summary; + + return $this->_data['summary']; + } + + /** + * Register iTunes namespace + * + */ + protected function _registerNamespaces() + { + $this->_xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); + } +} \ No newline at end of file diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index ff634473..e959a0be 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -182,6 +182,39 @@ public function testGetsDescriptionFromAtom10() $this->assertEquals('Entry Description', $entry->getDescription()); } + /** + * Get enclosure + */ + public function testGetsEnclosureFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/enclosure/plain/atom03.xml') + ); + $entry = $feed->current(); + + $expected = new stdClass(); + $expected->url = 'http://www.example.org/myaudiofile.mp3'; + $expected->length = '1234'; + $expected->type = 'audio/mpeg'; + + $this->assertEquals($expected, $entry->getEnclosure()); + } + + public function testGetsEnclosureFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/enclosure/plain/atom10.xml') + ); + $entry = $feed->current(); + + $expected = new stdClass(); + $expected->url = 'http://www.example.org/myaudiofile.mp3'; + $expected->length = '1234'; + $expected->type = 'audio/mpeg'; + + $this->assertEquals($expected, $entry->getEnclosure()); + } + /** * Get Content (Unencoded Text) */ diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index 397df192..0604a971 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -1384,6 +1384,33 @@ public function testGetsDescriptionFromRss090_None() $this->assertEquals(null, $entry->getDescription()); } + /** + * Get enclosure + */ + public function testGetsEnclosureFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/enclosure/plain/rss20.xml') + ); + $entry = $feed->current(); + + $expected = new stdClass(); + $expected->url = 'http://www.scripting.com/mp3s/weatherReportSuite.mp3'; + $expected->length = '12216320'; + $expected->type = 'audio/mpeg'; + + $this->assertEquals($expected, $entry->getEnclosure()); + } + + public function testGetsEnclosureFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/enclosure/plain/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getEnclosure()); + } + /** * Get Content (Unencoded Text) */ diff --git a/test/Reader/Entry/_files/Atom/enclosure/plain/atom03.xml b/test/Reader/Entry/_files/Atom/enclosure/plain/atom03.xml new file mode 100644 index 00000000..5206e58d --- /dev/null +++ b/test/Reader/Entry/_files/Atom/enclosure/plain/atom03.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Atom/enclosure/plain/atom10.xml b/test/Reader/Entry/_files/Atom/enclosure/plain/atom10.xml new file mode 100644 index 00000000..b309cb99 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/enclosure/plain/atom10.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/enclosure/plain/rss10.xml b/test/Reader/Entry/_files/Rss/enclosure/plain/rss10.xml new file mode 100644 index 00000000..7193be64 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/enclosure/plain/rss10.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/enclosure/plain/rss20.xml b/test/Reader/Entry/_files/Rss/enclosure/plain/rss20.xml new file mode 100644 index 00000000..48bfbd34 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/enclosure/plain/rss20.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/test/Reader/Integration/PodcastRss2Test.php b/test/Reader/Integration/PodcastRss2Test.php new file mode 100644 index 00000000..780e8935 --- /dev/null +++ b/test/Reader/Integration/PodcastRss2Test.php @@ -0,0 +1,254 @@ +_feedSamplePath = dirname(__FILE__) . '/_files/podcast.xml'; + } + + /** + * Feed level testing + */ + + public function testGetsNewFeedUrl() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('http://newlocation.com/example.rss', $feed->getNewFeedUrl()); + } + + public function testGetsOwner() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('john.doe@example.com (John Doe)', $feed->getOwner()); + } + + public function testGetsCategories() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals(array( + 'Technology' => array( + 'Gadgets' => null + ), + 'TV & Film' => null + ), $feed->getCategories()); + } + + public function testGetsTitle() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('All About Everything', $feed->getTitle()); + } + + public function testGetsCastAuthor() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('John Doe', $feed->getCastAuthor()); + } + + public function testGetsFeedBlock() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('no', $feed->getBlock()); + } + + public function testGetsCopyright() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('â„— & © 2005 John Doe & Family', $feed->getCopyright()); + } + + public function testGetsDescription() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('All About Everything is a show about everything. + Each week we dive into any subject known to man and talk + about it as much as we can. Look for our Podcast in the + iTunes Store', $feed->getDescription()); + } + + public function testGetsLanguage() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('en-us', $feed->getLanguage()); + } + + public function testGetsLink() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('http://www.example.com/podcasts/everything/index.html', $feed->getLink()); + } + + public function testGetsEncoding() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('UTF-8', $feed->getEncoding()); + } + + public function testGetsFeedExplicit() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('yes', $feed->getExplicit()); + } + + public function testGetsEntryCount() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals(3, $feed->count()); + } + + public function testGetsImage() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $this->assertEquals('http://example.com/podcasts/everything/AllAboutEverything.jpg', $feed->getImage()); + } + + /** + * Entry level testing + */ + + public function testGetsEntryBlock() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('yes', $entry->getBlock()); + } + + public function testGetsEntryId() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('http://example.com/podcasts/archive/aae20050615.m4a', $entry->getId()); + } + + public function testGetsEntryTitle() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('Shake Shake Shake Your Spices', $entry->getTitle()); + } + + public function testGetsEntryCastAuthor() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('John Doe', $entry->getCastAuthor()); + } + + public function testGetsEntryExplicit() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('no', $entry->getExplicit()); + } + + public function testGetsSubtitle() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('A short primer on table spices + ', $entry->getSubtitle()); + } + + public function testGetsSummary() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('This week we talk about salt and pepper + shakers, comparing and contrasting pour rates, + construction materials, and overall aesthetics. Come and + join the party!', $entry->getSummary()); + } + + public function testGetsDuration() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('7:04', $entry->getDuration()); + } + + public function testGetsKeywords() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('salt, pepper, shaker, exciting + ', $entry->getKeywords()); + } + + public function testGetsEntryEncoding() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + $this->assertEquals('UTF-8', $entry->getEncoding()); + } + + public function testGetsEnclosure() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath) + ); + $entry = $feed->current(); + + $expected = new stdClass(); + $expected->url = 'http://example.com/podcasts/everything/AllAboutEverythingEpisode3.m4a'; + $expected->length = '8727310'; + $expected->type = 'audio/x-m4a'; + + $this->assertEquals($expected, $entry->getEnclosure()); + } +} diff --git a/test/Reader/Integration/_files/podcast.xml b/test/Reader/Integration/_files/podcast.xml new file mode 100644 index 00000000..4abb75a8 --- /dev/null +++ b/test/Reader/Integration/_files/podcast.xml @@ -0,0 +1,92 @@ + + + + + All About Everything + http://www.example.com/podcasts/everything/index.html + en-us + ℗ & © 2005 John Doe & Family + yes + no + A show about everything + John Doe + All About Everything is a show about everything. + Each week we dive into any subject known to man and talk + about it as much as we can. Look for our Podcast in the + iTunes Store + All About Everything is a show about everything. + Each week we dive into any subject known to man and talk + about it as much as we can. Look for our Podcast in the + iTunes Store + + John Doe + john.doe@example.com + + http://newlocation.com/example.rss + + + + + + + + Shake Shake Shake Your Spices + no + John Doe + yes + A short primer on table spices + + This week we talk about salt and pepper + shakers, comparing and contrasting pour rates, + construction materials, and overall aesthetics. Come and + join the party! + + http://example.com/podcasts/archive/aae20050615.m4a + Wed, 15 Jun 2005 19:00:00 GMT + 7:04 + salt, pepper, shaker, exciting + + + + + Socket Wrench Shootout + Jane Doe + Comparing socket wrenches is fun! + + This week we talk about metric vs. old + english socket wrenches. Which one is better? Do you + really need both? Get all of your answers here. + + + http://example.com/podcasts/archive/aae20050608.mp3 + Wed, 8 Jun 2005 19:00:00 GMT + 4:34 + metric, socket, wrenches, tool + + + + + Red, Whine, & Blue + Various + Red + Blue != Purple + This week we talk about surviving in a Red + state if you are a Blue person. Or vice versa. + + + http://example.com/podcasts/archive/aae20050601.mp3 + Wed, 1 Jun 2005 19:00:00 GMT + 3:59 + politics, red, blue, state + + + + + \ No newline at end of file From 79f0a4a1d9e0edca1b3646e972c8521e1f86110f Mon Sep 17 00:00:00 2001 From: norm2782 Date: Fri, 17 Jul 2009 03:15:19 +0000 Subject: [PATCH 009/238] Renamed Zend_Feed_Reader_Entry_Abstract to Zend_Feed_Reader_Entry_EntryAbstract. Renamed Zend_Feed_Reader_Feed_Abstract to Zend_Feed_Reader_Feed_FeedAbstract git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16793 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Entry/Atom.php | 6 +++--- src/Reader/Entry/{Abstract.php => EntryAbstract.php} | 4 ++-- src/Reader/Entry/Rss.php | 6 +++--- src/Reader/Extension/Content/Entry.php | 2 +- src/Reader/Feed/Atom.php | 6 +++--- src/Reader/Feed/{Abstract.php => FeedAbstract.php} | 2 +- src/Reader/Feed/Rss.php | 6 +++--- 7 files changed, 16 insertions(+), 16 deletions(-) rename src/Reader/Entry/{Abstract.php => EntryAbstract.php} (97%) rename src/Reader/Feed/{Abstract.php => FeedAbstract.php} (98%) diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index 2236c53a..37b07187 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -30,9 +30,9 @@ require_once 'Zend/Feed/Reader/Entry/Interface.php'; /** - * @see Zend_Feed_Reader_Entry_Abstract + * @see Zend_Feed_Reader_Entry_EntryAbstract */ -require_once 'Zend/Feed/Reader/Entry/Abstract.php'; +require_once 'Zend/Feed/Reader/Entry/EntryAbstract.php'; /** * @see Zend_Feed_Reader_Extension_Atom_Entry @@ -45,7 +45,7 @@ * @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_Entry_Atom extends Zend_Feed_Reader_Entry_Abstract implements Zend_Feed_Reader_Entry_Interface +class Zend_Feed_Reader_Entry_Atom extends Zend_Feed_Reader_Entry_EntryAbstract implements Zend_Feed_Reader_Entry_Interface { /** * XPath query diff --git a/src/Reader/Entry/Abstract.php b/src/Reader/Entry/EntryAbstract.php similarity index 97% rename from src/Reader/Entry/Abstract.php rename to src/Reader/Entry/EntryAbstract.php index 7bcbc51b..ef49b00f 100644 --- a/src/Reader/Entry/Abstract.php +++ b/src/Reader/Entry/EntryAbstract.php @@ -25,7 +25,7 @@ * @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_Reader_Entry_Abstract +abstract class Zend_Feed_Reader_Entry_EntryAbstract { /** * Feed entry data @@ -145,7 +145,7 @@ public function getXpath() * Set the XPath query * * @param DOMXPath $xpath - * @return Zend_Feed_Reader_Entry_Abstract + * @return Zend_Feed_Reader_Entry_EntryAbstract */ public function setXpath(DOMXPath $xpath) { diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index b9c2ca30..8deb4109 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -30,9 +30,9 @@ require_once 'Zend/Feed/Reader/Entry/Interface.php'; /** - * @see Zend_Feed_Reader_Entry_Abstract + * @see Zend_Feed_Reader_Entry_EntryAbstract */ -require_once 'Zend/Feed/Reader/Entry/Abstract.php'; +require_once 'Zend/Feed/Reader/Entry/EntryAbstract.php'; /** * @see Zend_Feed_Reader_Extension_DublinCore_Entry @@ -75,7 +75,7 @@ * @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_Entry_Rss extends Zend_Feed_Reader_Entry_Abstract implements Zend_Feed_Reader_Entry_Interface +class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_Entry_EntryAbstract implements Zend_Feed_Reader_Entry_Interface { /** * Dublin Core object diff --git a/src/Reader/Extension/Content/Entry.php b/src/Reader/Extension/Content/Entry.php index 14e18322..4d275424 100644 --- a/src/Reader/Extension/Content/Entry.php +++ b/src/Reader/Extension/Content/Entry.php @@ -25,7 +25,7 @@ require_once 'Zend/Feed/Reader.php'; /** - * @see Zend_Feed_Reader_Entry_Abstract + * @see Zend_Feed_Reader_Entry_EntryAbstract */ require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index aaa4637d..43d5f939 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -20,9 +20,9 @@ */ /** - * @see Zend_Feed_Reader_Feed_Abstract + * @see Zend_Feed_Reader_Feed_FeedAbstract */ -require_once 'Zend/Feed/Reader/Feed/Abstract.php'; +require_once 'Zend/Feed/Reader/Feed/FeedAbstract.php'; /** * @see Zend_Feed_Reader_Extension_Atom_Feed @@ -35,7 +35,7 @@ * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_Feed_Abstract +class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_Feed_FeedAbstract { /** diff --git a/src/Reader/Feed/Abstract.php b/src/Reader/Feed/FeedAbstract.php similarity index 98% rename from src/Reader/Feed/Abstract.php rename to src/Reader/Feed/FeedAbstract.php index 181e20df..1d39acbf 100644 --- a/src/Reader/Feed/Abstract.php +++ b/src/Reader/Feed/FeedAbstract.php @@ -46,7 +46,7 @@ * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class Zend_Feed_Reader_Feed_Abstract implements Zend_Feed_Reader_Feed_Interface +abstract class Zend_Feed_Reader_Feed_FeedAbstract implements Zend_Feed_Reader_Feed_Interface { /** * Parsed feed data diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index c7ea9093..4f8c6b57 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -20,9 +20,9 @@ */ /** - * @see Zend_Feed_Reader_Feed_Abstract + * @see Zend_Feed_Reader_Feed_FeedAbstract */ -require_once 'Zend/Feed/Reader/Feed/Abstract.php'; +require_once 'Zend/Feed/Reader/Feed/FeedAbstract.php'; /** * @see Zend_feed_Reader_Extension_Atom_Feed @@ -45,7 +45,7 @@ * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_Feed_Abstract +class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_Feed_FeedAbstract { /** * Atom feed From 7ab249d1ca1d5d2615f508337896751889c66c5b Mon Sep 17 00:00:00 2001 From: matthew Date: Fri, 17 Jul 2009 15:55:45 +0000 Subject: [PATCH 010/238] [TESTS] Test updates to correct issues found running entire suite git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16804 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Reader/Entry/AtomTest.php | 4 ++++ test/Reader/Entry/RssTest.php | 4 ++++ test/Reader/Feed/AtomTest.php | 4 ++++ test/Reader/Feed/RssTest.php | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index e959a0be..18413121 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -10,6 +10,10 @@ class Zend_Feed_Reader_Entry_AtomTest extends PHPUnit_Framework_TestCase public function setup() { + if (Zend_Registry::isRegistered('Zend_Locale')) { + $registry = Zend_Registry::getInstance(); + unset($registry['Zend_Locale']); + } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Atom'; } diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index 0604a971..ff1cd19c 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -10,6 +10,10 @@ class Zend_Feed_Reader_Entry_RssTest extends PHPUnit_Framework_TestCase public function setup() { + if (Zend_Registry::isRegistered('Zend_Locale')) { + $registry = Zend_Registry::getInstance(); + unset($registry['Zend_Locale']); + } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Rss'; } diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 527aecfd..9c1288a6 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -10,6 +10,10 @@ class Zend_Feed_Reader_Feed_AtomTest extends PHPUnit_Framework_TestCase public function setup() { + if (Zend_Registry::isRegistered('Zend_Locale')) { + $registry = Zend_Registry::getInstance(); + unset($registry['Zend_Locale']); + } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Atom'; } diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index 93f00cb5..e619ab62 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -10,6 +10,10 @@ class Zend_Feed_Reader_Feed_RssTest extends PHPUnit_Framework_TestCase public function setup() { + if (Zend_Registry::isRegistered('Zend_Locale')) { + $registry = Zend_Registry::getInstance(); + unset($registry['Zend_Locale']); + } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Rss'; } From 1fc988c7e05d9f2bae6990802d59dbda210596fc Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 18 Jul 2009 02:13:56 +0000 Subject: [PATCH 011/238] Should fix certain feeds in RSS which are not following one of RFC822/RFC2822 for dates (reported by Kawsar Saiyeed) git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16824 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Entry/Rss.php | 14 +++++++++----- src/Reader/Feed/Rss.php | 15 ++++++++++----- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index 8deb4109..2dabd07c 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -303,11 +303,15 @@ public function getDateModified() try { $date->set($dateModified, Zend_Date::RFC_2822); } catch (Zend_Date_Exception $e) { - 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): ' - . $e->getMessage() - ); + try { + $date->set($dateModified, Zend_Date::DATES); + } catch (Zend_Date_Exception $e) { + 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): ' + . $e->getMessage() + ); + } } } } diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 4f8c6b57..f3953722 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -223,11 +223,16 @@ public function getDateModified() try { $date->set($dateModified, Zend_Date::RFC_2822); } catch (Zend_Date_Exception $e) { - 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): ' - .$e->getMessage() - ); + try { + $date->set($dateModified, Zend_Date::DATES); + } catch (Zend_Date_Exception $e) { + 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): ' + . $e->getMessage() + ); + } + } } } } From 99fcdef311bf76b5f32697a95e727ccea699e615 Mon Sep 17 00:00:00 2001 From: shahar Date: Sat, 18 Jul 2009 18:44:44 +0000 Subject: [PATCH 012/238] Fixing syntax error introduced in CS 16824 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16838 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Feed/Rss.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index f3953722..80d590df 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -233,7 +233,6 @@ public function getDateModified() ); } } - } } } } From 0c3d1ac207b398150eaf7c6f1da4f560d75b6ae2 Mon Sep 17 00:00:00 2001 From: matthew Date: Sun, 19 Jul 2009 13:38:36 +0000 Subject: [PATCH 013/238] [TESTS] Audit of full test suite Completed full audit of test suite, and tests now run with changes. Output buffering is now disabled by default, which allows tests to run with much less memory, and report in real-time. There are a number of failures and errors still, and I have a list I will be working on and/or delegating to the appropriate component authors. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16852 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/ReaderTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/ReaderTest.php b/test/ReaderTest.php index 99642ec8..07d1e260 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -113,6 +113,13 @@ public function testImportsFile() public function testImportsUri() { + if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + ) { + $this->markTestSkipped('testImportsUri() requires a network connection'); + return; + } + try { $feed = Zend_Feed_Reader::import('http://www.planet-php.net/rdf/'); } catch(Exception $e) { @@ -122,6 +129,13 @@ public function testImportsUri() public function testGetsFeedLinksAsValueObject() { + if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + ) { + $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); + return; + } + try { $links = Zend_Feed_Reader::findFeedLinks('http://www.planet-php.net'); } catch(Exception $e) { From b3859e7334af0eb8b06f70c5bc50a889a5d3bd2c Mon Sep 17 00:00:00 2001 From: padraic Date: Tue, 21 Jul 2009 23:15:29 +0000 Subject: [PATCH 014/238] Patched Zend_Feed_Reader to resolve a problem similar to Zend_Feed's as described by ZF-7305 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16938 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Reader.php b/src/Reader.php index 91647669..925093c9 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -312,21 +312,22 @@ public static function importFeed(Zend_Feed_Abstract $feed) */ public static function importString($string) { - @ini_set('track_errors', 1); + $libxml_errflag = libxml_use_internal_errors(true); $dom = new DOMDocument; - $status = @$dom->loadXML($string); - @ini_restore('track_errors'); + $status = $dom->loadXML($string); + 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 XML: {$error->message}"; + } else { + $errormsg = "DOMDocument cannot parse XML: 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); } $type = self::detectType($dom); From 637c8fdd61bae2d158bfb841e17d3f9c7832ca45 Mon Sep 17 00:00:00 2001 From: padraic Date: Wed, 22 Jul 2009 11:57:25 +0000 Subject: [PATCH 015/238] All interfaces and abstract classes renamed to namespace friendly terms. Paths of interfaces/abstracts files updated in source Zend_Feed_Reader::importFeed() now checks for the updated interface type correctly git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16953 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader.php | 4 +- src/Reader/Entry/Atom.php | 10 +- src/Reader/Entry/Rss.php | 10 +- src/Reader/EntryAbstract.php | 215 ++++++++++++++++++++++++++++ src/Reader/EntryInterface.php | 136 ++++++++++++++++++ src/Reader/Feed/Atom.php | 6 +- src/Reader/Feed/Rss.php | 6 +- src/Reader/FeedAbstract.php | 260 ++++++++++++++++++++++++++++++++++ src/Reader/FeedInterface.php | 115 +++++++++++++++ 9 files changed, 744 insertions(+), 18 deletions(-) create mode 100644 src/Reader/EntryAbstract.php create mode 100644 src/Reader/EntryInterface.php create mode 100644 src/Reader/FeedAbstract.php create mode 100644 src/Reader/FeedInterface.php diff --git a/src/Reader.php b/src/Reader.php index 925093c9..50d11eeb 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -422,7 +422,7 @@ public static function findFeedLinks($uri) */ public static function detectType($feed) { - if ($feed instanceof Zend_Feed_Reader_Feed_Interface) { + if ($feed instanceof Zend_Feed_Reader_FeedInterface) { $dom = $feed->getDomDocument(); } elseif($feed instanceof DomDocument) { $dom = $feed; @@ -444,7 +444,7 @@ public static function detectType($feed) } } else { require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid object/scalar provided: must be of type Zend_Feed_Reader_Feed_Interface, DomDocument or string'); + throw new Zend_Feed_Exception('Invalid object/scalar provided: must be of type Zend_Feed_Reader_FeedInterface, DomDocument or string'); } $xpath = new DOMXPath($dom); diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index 37b07187..23a0f234 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -25,14 +25,14 @@ require_once 'Zend/Feed/Reader.php'; /** - * @see Zend_Feed_Reader_Entry_Interface + * @see Zend_Feed_Reader_EntryInterface */ -require_once 'Zend/Feed/Reader/Entry/Interface.php'; +require_once 'Zend/Feed/Reader/EntryInterface.php'; /** - * @see Zend_Feed_Reader_Entry_EntryAbstract + * @see Zend_Feed_Reader_EntryAbstract */ -require_once 'Zend/Feed/Reader/Entry/EntryAbstract.php'; +require_once 'Zend/Feed/Reader/EntryAbstract.php'; /** * @see Zend_Feed_Reader_Extension_Atom_Entry @@ -45,7 +45,7 @@ * @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_Entry_Atom extends Zend_Feed_Reader_Entry_EntryAbstract implements Zend_Feed_Reader_Entry_Interface +class Zend_Feed_Reader_Entry_Atom extends Zend_Feed_Reader_EntryAbstract implements Zend_Feed_Reader_EntryInterface { /** * XPath query diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index 2dabd07c..2db89763 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -25,14 +25,14 @@ require_once 'Zend/Feed/Reader.php'; /** - * @see Zend_Feed_Reader_Entry_Interface + * @see Zend_Feed_Reader_EntryInterface */ -require_once 'Zend/Feed/Reader/Entry/Interface.php'; +require_once 'Zend/Feed/Reader/EntryInterface.php'; /** - * @see Zend_Feed_Reader_Entry_EntryAbstract + * @see Zend_Feed_Reader_EntryAbstract */ -require_once 'Zend/Feed/Reader/Entry/EntryAbstract.php'; +require_once 'Zend/Feed/Reader/EntryAbstract.php'; /** * @see Zend_Feed_Reader_Extension_DublinCore_Entry @@ -75,7 +75,7 @@ * @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_Entry_Rss extends Zend_Feed_Reader_Entry_EntryAbstract implements Zend_Feed_Reader_Entry_Interface +class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_EntryAbstract implements Zend_Feed_Reader_EntryInterface { /** * Dublin Core object diff --git a/src/Reader/EntryAbstract.php b/src/Reader/EntryAbstract.php new file mode 100644 index 00000000..659b2b96 --- /dev/null +++ b/src/Reader/EntryAbstract.php @@ -0,0 +1,215 @@ +_entry = $entry; + $this->_entryKey = $entryKey; + $this->_domDocument = $entry->ownerDocument; + if ($type !== null) { + $this->_data['type'] = $type; + } else { + $this->_data['type'] = Zend_Feed_Reader::detectType($feed); + } + $this->_loadExtensions(); + } + + /** + * Get the DOM + * + * @return DOMDocument + */ + public function getDomDocument() + { + return $this->_domDocument; + } + + /** + * Get the entry element + * + * @return Zend_Feed_Entry_Interface + */ + public function getEntryElement() + { + return $this->_entry; + } + + /** + * Get the Entry's encoding + * + * @return string + */ + public function getEncoding() + { + $assumed = $this->getDomDocument()->encoding; + return $assumed; + } + + /** + * Get the entry type + * + * @return string + */ + public function getType() + { + return $this->_data['type']; + } + + /** + * Get the XPath query object + * + * @return DOMXPath + */ + public function getXpath() + { + return $this->_xpath; + } + + /** + * Set the XPath query + * + * @param DOMXPath $xpath + * @return Zend_Feed_Reader_Entry_EntryAbstract + */ + public function setXpath(DOMXPath $xpath) + { + $this->_xpath = $xpath; + return $this; + } + + /** + * Serialize the entry to an array + * + * @return array + */ + public function toArray() + { + return $this->_data; + } + + /** + * Get registered extensions + * + * @return array + */ + public function getExtensions() + { + return $this->_extensions; + } + + /** + * Method overloading: call given method on first extension implementing it + * + * @param string $method + * @param array $args + * @return mixed + * @throws Zend_Feed_Exception if no extensions implements the method + */ + public function __call($method, $args) + { + foreach ($this->_extensions as $extension) { + if (method_exists($extension, $method)) { + return call_user_func_array(array($extension, $method), $args); + } + } + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Method: ' . $method + . 'does not exist and could not be located on a registered Extension'); + } + + /** + * Load extensions from Zend_Feed_Reader + * + * @return void + */ + protected function _loadExtensions() + { + $all = Zend_Feed_Reader::getExtensions(); + $feed = $all['entry']; + foreach ($feed as $extension) { + if (in_array($extension, $all['core'])) { + continue; + } + $className = Zend_Feed_Reader::getPluginLoader()->getClassName($extension); + $this->_extensions[$className] = new $className( + $this->getEntryElement(), $this->_entryKey, $this->_data['type'] + ); + } + } +} diff --git a/src/Reader/EntryInterface.php b/src/Reader/EntryInterface.php new file mode 100644 index 00000000..db3d26dc --- /dev/null +++ b/src/Reader/EntryInterface.php @@ -0,0 +1,136 @@ +_domDocument = $domDocument; + $this->_xpath = new DOMXPath($this->_domDocument); + + if ($type !== null) { + $this->_data['type'] = $type; + } else { + $this->_data['type'] = Zend_Feed_Reader::detectType($this->_domDocument); + } + $this->_registerNamespaces(); + $this->_indexEntries(); + $this->_loadExtensions(); + } + + /** + * Get the number of feed entries. + * Required by the Iterator interface. + * + * @return int + */ + public function count() + { + return count($this->_entries); + } + + /** + * Return the current entry + * + * @return Zend_Feed_Reader_Entry_Interface + */ + public function current() + { + if (substr($this->getType(), 0, 3) == 'rss') { + $reader = new Zend_Feed_Reader_Entry_Rss($this->_entries[$this->key()], $this->key(), $this->getType()); + } else { + $reader = new Zend_Feed_Reader_Entry_Atom($this->_entries[$this->key()], $this->key(), $this->getType()); + } + + $reader->setXpath($this->_xpath); + + return $reader; + } + + /** + * Get the DOM + * + * @return DOMDocument + */ + public function getDomDocument() + { + return $this->_domDocument; + } + + /** + * Get the Feed's encoding + * + * @return string + */ + public function getEncoding() + { + $assumed = $this->getDomDocument()->encoding; + return $assumed; + } + + /** + * Get the feed type + * + * @return string + */ + public function getType() + { + return $this->_data['type']; + } + + /** + * Return the current feed key + * + * @return unknown + */ + public function key() + { + return $this->_entriesKey; + } + + /** + * Move the feed pointer forward + * + */ + public function next() + { + ++$this->_entriesKey; + } + + /** + * Reset the pointer in the feed object + * + */ + public function rewind() + { + $this->_entriesKey = 0; + } + + /** + * Return the feed as an array + * + * @return array + */ + public function toArray() // untested + { + return $this->_data; + } + + /** + * Check to see if the iterator is still valid + * + * @return boolean + */ + public function valid() + { + return 0 <= $this->_entriesKey && $this->_entriesKey < $this->count(); + } + + public function getExtensions() + { + return $this->_extensions; + } + + public function __call($method, $args) + { + foreach ($this->_extensions as $extension) { + if (method_exists($extension, $method)) { + return call_user_func_array(array($extension, $method), $args); + } + } + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Method: ' . $method + . 'does not exist and could not be located on a registered Extension'); + } + + protected function _loadExtensions() + { + $all = Zend_Feed_Reader::getExtensions(); + $feed = $all['feed']; + foreach ($feed as $extension) { + if (in_array($extension, $all['core'])) { + continue; + } + $className = Zend_Feed_Reader::getPluginLoader()->getClassName($extension); + $this->_extensions[$className] = new $className( + $this->getDomDocument(), $this->_data['type'], $this->_xpath + ); + } + } + + /** + * Read all entries to the internal entries array + * + */ + abstract protected function _indexEntries(); + + /** + * Register the default namespaces for the current feed format + * + */ + abstract protected function _registerNamespaces(); +} diff --git a/src/Reader/FeedInterface.php b/src/Reader/FeedInterface.php new file mode 100644 index 00000000..f8fc6d71 --- /dev/null +++ b/src/Reader/FeedInterface.php @@ -0,0 +1,115 @@ + Date: Wed, 22 Jul 2009 11:59:30 +0000 Subject: [PATCH 016/238] Removed relocated interface/abstract class files (see commit 16953) git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16954 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Entry/EntryAbstract.php | 215 ------------------------ src/Reader/Entry/Interface.php | 136 --------------- src/Reader/Feed/FeedAbstract.php | 260 ----------------------------- src/Reader/Feed/Interface.php | 115 ------------- 4 files changed, 726 deletions(-) delete mode 100644 src/Reader/Entry/EntryAbstract.php delete mode 100644 src/Reader/Entry/Interface.php delete mode 100644 src/Reader/Feed/FeedAbstract.php delete mode 100644 src/Reader/Feed/Interface.php diff --git a/src/Reader/Entry/EntryAbstract.php b/src/Reader/Entry/EntryAbstract.php deleted file mode 100644 index ef49b00f..00000000 --- a/src/Reader/Entry/EntryAbstract.php +++ /dev/null @@ -1,215 +0,0 @@ -_entry = $entry; - $this->_entryKey = $entryKey; - $this->_domDocument = $entry->ownerDocument; - if ($type !== null) { - $this->_data['type'] = $type; - } else { - $this->_data['type'] = Zend_Feed_Reader::detectType($feed); - } - $this->_loadExtensions(); - } - - /** - * Get the DOM - * - * @return DOMDocument - */ - public function getDomDocument() - { - return $this->_domDocument; - } - - /** - * Get the entry element - * - * @return Zend_Feed_Entry_Interface - */ - public function getEntryElement() - { - return $this->_entry; - } - - /** - * Get the Entry's encoding - * - * @return string - */ - public function getEncoding() - { - $assumed = $this->getDomDocument()->encoding; - return $assumed; - } - - /** - * Get the entry type - * - * @return string - */ - public function getType() - { - return $this->_data['type']; - } - - /** - * Get the XPath query object - * - * @return DOMXPath - */ - public function getXpath() - { - return $this->_xpath; - } - - /** - * Set the XPath query - * - * @param DOMXPath $xpath - * @return Zend_Feed_Reader_Entry_EntryAbstract - */ - public function setXpath(DOMXPath $xpath) - { - $this->_xpath = $xpath; - return $this; - } - - /** - * Serialize the entry to an array - * - * @return array - */ - public function toArray() - { - return $this->_data; - } - - /** - * Get registered extensions - * - * @return array - */ - public function getExtensions() - { - return $this->_extensions; - } - - /** - * Method overloading: call given method on first extension implementing it - * - * @param string $method - * @param array $args - * @return mixed - * @throws Zend_Feed_Exception if no extensions implements the method - */ - public function __call($method, $args) - { - foreach ($this->_extensions as $extension) { - if (method_exists($extension, $method)) { - return call_user_func_array(array($extension, $method), $args); - } - } - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Method: ' . $method - . 'does not exist and could not be located on a registered Extension'); - } - - /** - * Load extensions from Zend_Feed_Reader - * - * @return void - */ - protected function _loadExtensions() - { - $all = Zend_Feed_Reader::getExtensions(); - $feed = $all['entry']; - foreach ($feed as $extension) { - if (in_array($extension, $all['core'])) { - continue; - } - $className = Zend_Feed_Reader::getPluginLoader()->getClassName($extension); - $this->_extensions[$className] = new $className( - $this->getEntryElement(), $this->_entryKey, $this->_data['type'] - ); - } - } -} diff --git a/src/Reader/Entry/Interface.php b/src/Reader/Entry/Interface.php deleted file mode 100644 index 39392334..00000000 --- a/src/Reader/Entry/Interface.php +++ /dev/null @@ -1,136 +0,0 @@ -_domDocument = $domDocument; - $this->_xpath = new DOMXPath($this->_domDocument); - - if ($type !== null) { - $this->_data['type'] = $type; - } else { - $this->_data['type'] = Zend_Feed_Reader::detectType($this->_domDocument); - } - $this->_registerNamespaces(); - $this->_indexEntries(); - $this->_loadExtensions(); - } - - /** - * Get the number of feed entries. - * Required by the Iterator interface. - * - * @return int - */ - public function count() - { - return count($this->_entries); - } - - /** - * Return the current entry - * - * @return Zend_Feed_Reader_Entry_Interface - */ - public function current() - { - if (substr($this->getType(), 0, 3) == 'rss') { - $reader = new Zend_Feed_Reader_Entry_Rss($this->_entries[$this->key()], $this->key(), $this->getType()); - } else { - $reader = new Zend_Feed_Reader_Entry_Atom($this->_entries[$this->key()], $this->key(), $this->getType()); - } - - $reader->setXpath($this->_xpath); - - return $reader; - } - - /** - * Get the DOM - * - * @return DOMDocument - */ - public function getDomDocument() - { - return $this->_domDocument; - } - - /** - * Get the Feed's encoding - * - * @return string - */ - public function getEncoding() - { - $assumed = $this->getDomDocument()->encoding; - return $assumed; - } - - /** - * Get the feed type - * - * @return string - */ - public function getType() - { - return $this->_data['type']; - } - - /** - * Return the current feed key - * - * @return unknown - */ - public function key() - { - return $this->_entriesKey; - } - - /** - * Move the feed pointer forward - * - */ - public function next() - { - ++$this->_entriesKey; - } - - /** - * Reset the pointer in the feed object - * - */ - public function rewind() - { - $this->_entriesKey = 0; - } - - /** - * Return the feed as an array - * - * @return array - */ - public function toArray() // untested - { - return $this->_data; - } - - /** - * Check to see if the iterator is still valid - * - * @return boolean - */ - public function valid() - { - return 0 <= $this->_entriesKey && $this->_entriesKey < $this->count(); - } - - public function getExtensions() - { - return $this->_extensions; - } - - public function __call($method, $args) - { - foreach ($this->_extensions as $extension) { - if (method_exists($extension, $method)) { - return call_user_func_array(array($extension, $method), $args); - } - } - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Method: ' . $method - . 'does not exist and could not be located on a registered Extension'); - } - - protected function _loadExtensions() - { - $all = Zend_Feed_Reader::getExtensions(); - $feed = $all['feed']; - foreach ($feed as $extension) { - if (in_array($extension, $all['core'])) { - continue; - } - $className = Zend_Feed_Reader::getPluginLoader()->getClassName($extension); - $this->_extensions[$className] = new $className( - $this->getDomDocument(), $this->_data['type'], $this->_xpath - ); - } - } - - /** - * Read all entries to the internal entries array - * - */ - abstract protected function _indexEntries(); - - /** - * Register the default namespaces for the current feed format - * - */ - abstract protected function _registerNamespaces(); -} diff --git a/src/Reader/Feed/Interface.php b/src/Reader/Feed/Interface.php deleted file mode 100644 index 72bb226c..00000000 --- a/src/Reader/Feed/Interface.php +++ /dev/null @@ -1,115 +0,0 @@ - Date: Wed, 22 Jul 2009 12:43:46 +0000 Subject: [PATCH 017/238] Added extended DOM methods to Feed level API with tests git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16956 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/FeedAbstract.php | 30 + test/AllTests.php | 3 + test/Reader/Entry/_files/Common/atom.xml | 726 ++++++++++++++++++ test/Reader/Entry/_files/Common/rss.xml | 700 +++++++++++++++++ test/Reader/Feed/CommonTest.php | 64 ++ test/Reader/Feed/_files/Common/atom.xml | 726 ++++++++++++++++++ .../_files/Common/atom_rewrittenbydom.xml | 722 +++++++++++++++++ test/Reader/Feed/_files/Common/rss.xml | 700 +++++++++++++++++ 8 files changed, 3671 insertions(+) create mode 100644 test/Reader/Entry/_files/Common/atom.xml create mode 100644 test/Reader/Entry/_files/Common/rss.xml create mode 100644 test/Reader/Feed/CommonTest.php create mode 100644 test/Reader/Feed/_files/Common/atom.xml create mode 100644 test/Reader/Feed/_files/Common/atom_rewrittenbydom.xml create mode 100644 test/Reader/Feed/_files/Common/rss.xml diff --git a/src/Reader/FeedAbstract.php b/src/Reader/FeedAbstract.php index ce1f7ae6..e6171592 100644 --- a/src/Reader/FeedAbstract.php +++ b/src/Reader/FeedAbstract.php @@ -156,6 +156,36 @@ public function getEncoding() return $assumed; } + /** + * Get feed as xml + * + * @return string + */ + public function saveXml() + { + return $this->getDomDocument()->saveXml(); + } + + /** + * Get the DOMElement representing the items/feed element + * + * @return DOMElement + */ + public function getElement() + { + return $this->getDomDocument()->documentElement; + } + + /** + * Get the DOMXPath object for this feed + * + * @return DOMXPath + */ + public function getXpath() + { + return $this->_xpath; + } + /** * Get the feed type * diff --git a/test/AllTests.php b/test/AllTests.php index 32309b14..d4e6bcdd 100644 --- a/test/AllTests.php +++ b/test/AllTests.php @@ -51,6 +51,7 @@ require_once 'Zend/Feed/Reader/Entry/RssTest.php'; require_once 'Zend/Feed/Reader/Feed/AtomTest.php'; require_once 'Zend/Feed/Reader/Entry/AtomTest.php'; +require_once 'Zend/Feed/Reader/Feed/CommonTest.php'; require_once 'Zend/Feed/Reader/Integration/WordpressRss2DcAtomTest.php'; require_once 'Zend/Feed/Reader/Integration/WordpressAtom10Test.php'; @@ -95,6 +96,8 @@ public static function suite() $suite->addTestSuite('Zend_Feed_Reader_Feed_AtomTest'); // ATOM - Item Level $suite->addTestSuite('Zend_Feed_Reader_Entry_AtomTest'); + // COMMON - Feed Level + $suite->addTestSuite('Zend_Feed_Reader_Feed_CommonTest'); /** * Real World Feed Tests */ diff --git a/test/Reader/Entry/_files/Common/atom.xml b/test/Reader/Entry/_files/Common/atom.xml new file mode 100644 index 00000000..1f2c99e6 --- /dev/null +++ b/test/Reader/Entry/_files/Common/atom.xml @@ -0,0 +1,726 @@ + + Norm 2782 + Why are you here? + + 2009-03-07T08:03:50Z + WordPress + + + http://www.norm2782.com/feed/atom/ + + + + + norm2782 + http://www.norm2782.com + + <![CDATA[Wth… reading books?]]> + + http://www.norm2782.com/?p=114 + 2009-03-07T08:03:50Z + 2009-03-02T08:09:33Z + + Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

+ + +

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[My first few weeks in New Zealand]]> + + http://www.norm2782.com/?p=105 + 2009-02-18T03:30:07Z + 2009-02-15T03:29:21Z + + It’s been a while since my last blog post. Things have been quite hectic for me these last few weeks. There was my final week at Angry Bytes, followed by a pre-NZ party and then my trip to New Zealand. Currently New Zealand looks pretty much the same as the Netherlands, seeing as I’m locked away in an office most of my time.

+ +


+My adventure into Kiwi-land started with a long and interesting trip to San Francisco. The interesting part was my new book: Domain Driven Design: Tackling Complexity in the Heart of Software, by Eric Evans. This book, combined with KLM’s excellent on-board service made my flight to SF a breeze.

+

It was only 2PM when I arrived in SF, so I had to wait another 4 hours before my flight to Auckland even boarded. The waiting wasn’t too bad. It was great to get out into the sun and to grab some decent food and coffee. Didn’t get to see much of SF though, which was too bad.

+

SF Airport

+

The flight to Auckland wasn’t that flawless unfortunately. There were some technical problems with the airplane, which caused quite a bit of a delay. Because of this delay I had to run to catch my flight to Dunedin. The flight was all set to go and was waiting for me… I barely made it in time!

+ +

Flying to Dunedin

+

When I got to Dunedin I was welcomed by Jesse, Tracey and Lindsay. It was great to meet them in person. The first order of business for me was to get some coffee, because I only got roughly 3 hours of sleep on my way there. After a little tour of Abbey College (that’s where I’m staying) it was time for our first meeting. No time for sleep! Finally, after dinner at Abbey, I decided it was time to get some sleep. When I woke up the next day, the jet-lag was no more!

+

My Room

+

Abbey is a great place to stay by the way. It’s not far from the office or from the city center. The people who are staying there are great as well. Just check out the site. Abbey’s got it all!

+ +

View from my room

+

So what am I doing here in NZ? We’re currently working on writing the software for the PBRF initiative. It has already taken a lot of late hours, and it will probably take a lot more. It will be worth it though! After that, we’ll be working on a great and exciting cutting-edge open-source project. Unfortunately I can’t say a lot more at this point, but you can rest assured that it includes the latest Zend Framework technologies.

+

My Desk

+

Seeing as I don’t have internet-access at Abbey College yet, I’ve got lots of time for other activities. I’ve finished reading the better part of my Domain Driven Design book and I’ve ordered Martin Fowler’s Patterns Of Enterprise Application Architecture, which should arrive this week. I’ve also bought myself a brand new bicycle so I can get around. Cycling here is a bit more dangerous than in the Netherlands though… it definitely brings back memories from my bicycling trip in Scotland! There are lots more things on my todo list: winery tour, surfing, snowboarding, skydiving, bungee-jumping, renting/buying a Harley… six months in NZ is not going to be enough time!

+ +

Me!

+

Well, that’s my first NZ blog-post. There will definitely be more of these! Let’s hope they fix my internet soon… See my Flickr photo-stream for more pictures.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Properties in PHP – revisited]]> + + http://www.norm2782.com/?p=94 + 2009-01-14T10:47:25Z + 2009-01-14T10:47:25Z + + A while ago I was daydreaming about native property support in PHP. Unfortunately it will be a while before PHP itself will support this natively and an even longer while before shared hosting providers will upgrade to a newer version of PHP.

+ +

So what’s the big deal about those properties? In short, they make a developers life easier by allowing the developer to code no more than needed at that moment. And lets face it… less code is better! In this post we’ll see that it’s not impossible to enjoy properties in PHP today. As with a lot of good things, it does come with a small price though…

+


+Lets have a look at a use-case to demonstrate where properties will not only save you time, but it will also save your sanity. In this example we’re modeling a Person class. In the beginning of the project, the requirements for the Person class are quite simple: a Person has an age and a name. In the simplest form we can code that as follows:

+
+<?php
+class Person
+{
+    public $age;
+
+    public $name;
+}
+
+
+

This look easy enough, and it is. It even works like a charm and it’s possibly the fastest implementation for the Person class.

+

But, pesky as they are, the client suddenly wants some logic added to our Person class! A Person suddenly can’t be younger than 21 years old. This poses a problem. To add logic to our Person class, we would have to switch the public age attribute with a pair of getters and setters:

+
+<?php
+class Person
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+

Technically this works like a charm, however it will force me to go through my entire application and switch all references from the public attribute to the getter and setter. Not an ideal situation. One possible solution is to do things the Java way: just create all getters and setters up-front so you don’t have to do so afterwards. Even though this works fine, it’s in violation of our mission to write no more code than we actually need at the moment of writing.

+ +

The solution? Properties! But wait… PHP doesn’t support those, remember? Luckily we still have magic methods. It’s nowhere near as nice as a native solution, but at least it helps us write no more code than we need at the moment we’re first writing our code:

+
+<?php
+abstract class ModelAbstract
+{
+    public function __get($key)
+    {
+        $method = 'get' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        return $this->$method();
+    }
+
+    public function __set($key, $value)
+    {
+        $method = 'set' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        $this->$method($value);
+    }
+}
+
+

We’ll take a look at what this does exactly later. The important thing to note is that we can now do the following:

+
+<?php
+class Person extends ModelAbstract
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+$person = new Person();
+
+try {
+    $person->age = 10;
+} catch (Exception $e) {
+    // Will print "You need to be at least 21 years or older!"
+    echo $e->getMessage();
+}
+
+
+

With this construction in place, we can safely switch from a public attribute to getters and setters, without changing the rest of the application code. The only real downside to this – aside from the minor speed impact – is the fact that you have to subclass ModelAbstract to make this work. Luckily it’s not a lot of code, so should there be a big need to get rid of the ModelAbstract inheritance it’s not a big disaster to do some copy/paste work.

+

This method works by assuming you have get- and set methods that have the same name as the property you’re trying to access. When there’s a public attribute, it will use that. If there’s no public attribute, it will fall back to __get or __set and the logic will take it from there.

+

All of this is just a proof-of-concept of implementing properties in PHP and of the way I want to be using properties to access data the data in my objects. Please comment your experiences with this approach or similar approaches. I’m curious to see how practical this solution would be in a real-life situation.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Filters for Zend_Paginator]]> + + http://www.norm2782.com/?p=72 + 2009-01-14T08:23:19Z + 2009-01-13T12:57:53Z + + Zend_Paginator has a new feature! It is now possible to add a filter to your Paginator object which acts on the data retrieved from the adapter. This filter can be any instance of Zend_Filter_Interface, including a filter-chain. If a filter(-chain) is set, the raw data from the adapter will be passed to the filter() method.

+ +


+So why would you want to apply filters to your result set? Usually my domain models don’t inherit from Zend_Db_Table_Row but that is the data type I get from the Paginator when I use the DbTableSelect adapter (wrapped in a nice Zend_Db_Table_Rowset). Instead, I would like to load my rows into my models and preferably without using the Paginator abilities or having to apply weird hacks. Previously this was only possible (in a sane way) by subclassing an adapter so it could return a collection of model objects instead of a rowset. With the new filter support you can just inject a filter to do this for you.

+

Lets have a look at an example. In this example I want to list all my users from the database. I’ll grab the name of the user from the row and inject it into a User object.

+
+<?php
+class User
+{
+    private $_name = '';
+
+    public function getName()
+    {
+        return $this->_name;
+    }
+
+    public function setName($name)
+    {
+        $this->_name = $name;
+    }
+}
+
+class UserFilter implements Zend_Filter_Interface
+{
+    public function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new UserFilter());
+
+        return $paginator;
+    }
+}
+
+$paginator = MyModel::getUserPaginator();
+$items = $paginator->getCurrentItems();
+
+foreach ($items as $user) {
+    echo 'Current name: ' . $user->getName() . '<br />' . PHP_EOL;
+}
+
+
+

To simplify adding a simple filter to your paginator I’ve also added Zend_Filter_Callback. This allows you to specify a callback method that does the same as the filter in the previous example.

+
+<?php
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new Zend_Filter_Callback(
+            array('MyModel', 'filter'))
+        );
+
+        return $paginator;
+    }
+
+    public static function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+

The callback also accepts object instead of a static reference to a class. Internally it uses call_user_func to execute the filter() method, so any notation that works there, works with the Callback filter.

+

Enjoy!

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[ZF-3239]]> + + http://www.norm2782.com/?p=68 + 2009-01-11T09:53:20Z + 2009-01-07T11:48:31Z + + Zend_Db_Table_Select users, rejoice! I’ve just committed a patch for ZF-3239 in revision 13530. This should be a relief for those of you who have been implementing workarounds for those “No table has been specified for the FROM clause” exceptions.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[New in-ear earphones]]> + + http://www.norm2782.com/?p=53 + 2009-01-03T18:51:43Z + 2009-01-03T15:49:19Z + + Just got myself the Sennheiser CX 300 II Precision in-ear earphones. Check ‘em out by clicking the read more link!

+ +


+cx300

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Seven Things – Tagged by Pádraic]]> + + http://www.norm2782.com/?p=44 + 2009-01-03T11:47:19Z + 2009-01-03T10:14:38Z + + Well, this was bound to happen: I got tagged by Pádraic because I’m working on Zend_Feed_Reader with him. Luckily I’ve just setup this new blog, so here we go!

+ +

Did you know that…

+
    +
  • Every bit of PHP I know is self-taught
  • +
  • My programming adventure started out with Visual Basic 3 back in 1993. I was just 8 years old back then and had no clue what I was doing.
  • +
  • My left foot is actually a few millimeter bigger than my right foot.
  • +
  • I used to have long hair (almost reached my ass). I cut it off in the summer of ‘08 for various reasons, one of which was 100 euro.
  • +
  • I bought my Harley Davidson before I even had my drivers license.
  • +
  • My whisky collection (only single malts ;) ) keeps growing instead of shrinking
  • + +
  • While I use a Mac, with an Apple Cinema Display and an Apple keyboard… I have an HTC Touch with Windows Mobile and I’m stuck with it for at least a few more months.
  • +
+

Now it’s my turn to start tagging!

+
    +
  • Stefan Koopmanschap – For not being tagged yet and having said so on Twitter
  • +
  • Maurice Fonk – For being my co-worker and for not having finished Madoqua yet
  • + +
  • Geoffrey Bachelet – For the great party in Paris
  • +
  • Wade Arnold – For doing a great job on Zend_AMF and having the same WordPress theme as me.
  • +
  • Kana Yeh – For being the coolest PHP girl in the Netherlands (that I know of)
  • +
  • Matthew Ratzloff – For his great help on Zend_Paginator
  • + +
  • And one more here…
  • +
+

As for the rules:

+
    +
  • Link your original tagger(s), and list these rules on your blog.
  • +
  • Share seven facts about yourself in the post – some random, some wierd.
  • +
  • Tag seven people at the end of your post by leaving their names and the links to their blogs.
  • +
  • Let them know they’ve been tagged by leaving a comment on their blogs and/or Twitter.
  • + +
+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[AMF Server class for WordPress]]> + + http://www.norm2782.com/?p=27 + 2009-01-06T15:00:54Z + 2009-01-02T14:49:42Z + + After browsing through WordPress’ code I quickly found that there’s no sane way to create AMF support as a WP plugin. At least not for someone who hasn’t done any old-skool procedural PHP in years. Instead of writing a plugin, I decided to write a standalone server script. It’s still very basic and currently setup to work for me. To get it working for your WP setup you should probably make some minor modifications. Click the read more link to check out the code. I’ve released it under the generous BSD license, so knock yourself out! Use it at your own risk… I’m not going to support it. Any updates will be posted in this post. Also, please note that I haven’t tested it yet. If you access the script directly it should output “Zend Amf Endpoint” just fine, but that’s all I can guarantee at this point ;)

+ +

+
+<?php
+/**
+ * BSD LICENSE
+ *
+ * Copyright (c) 2009, norm2782
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of norm2782 nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * Set production mode.
+ * If set to false, exceptions will bubble through to the Flex frontend
+ *
+ * @var bool
+ */
+$production = false;
+
+/**
+ * Determine the absolute path of the AMF server
+ *
+ * @var string
+ */
+define('ABSPATH', dirname(__FILE__) . '/');
+
+/**
+ * One directory below docroot. Your config file and library dir should be here.
+ *
+ * @var string
+ */
+define('SUBPATH', dirname(ABSPATH));
+
+/**
+ * You should make sure Zend Framework is in your include path
+ */
+set_include_path(
+    implode(PATH_SEPARATOR, array(
+        SUBPATH . '/library',
+        get_include_path()
+    ))
+);
+
+/**
+ * Include the WordPress config file
+ */
+$configFile = SUBPATH . '/wp-config.php';
+
+if (!file_exists($configFile)) {
+    throw new Exception('WordPress config file was not found!');
+}
+
+require_once $configFile;
+
+/**
+ * No need to config more stuff from this point on
+ */
+
+/**
+ * @see Zend_Amf_Server
+ */
+require_once 'Zend/Amf/Server.php';
+
+/**
+ * @see Zend_Db_Adapter_Pdo_Mysql
+ */
+require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
+
+/**
+ * @see Zend_Paginator
+ */
+require_once 'Zend/Paginator.php';
+
+/**
+ * @see Zend_Paginator_Adapter_DbSelect
+ */
+require_once 'Zend/Paginator/Adapter/DbSelect.php';
+
+/**
+ * Simple class to expose wordpress data through AMF
+ *
+ * @author norm2782
+ */
+class Wp_Amf_Gateway
+{
+    /**
+     * Database adapter
+     *
+     * @var Zend_Db_Adapter_Pdo_Mysql
+     */
+    private $_db = null;
+
+    /**
+     * WordPress table prefix
+     *
+     * @var string
+     */
+    private $_prefix = null;
+
+    /**
+     * Constructor
+     *
+     * @param array $dbConfig
+     * @param string $prefix
+     * @return void
+     */
+    public function __construct(array $dbConfig, $prefix)
+    {
+        $this->_db = new Zend_Db_Adapter_Pdo_Mysql($dbConfig);
+        $this->_db->query('SET NAMES `utf8`');
+
+        $this->_prefix = $prefix;
+    }
+
+    /**
+     * Get paginated results for the provided query
+     *
+     * @param Zend_Db_Select $select
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    private function _getPaginated(Zend_Db_Select $select, $page, $itemsPerPage)
+    {
+        $paginator = new Zend_Paginator(
+            new Zend_Paginator_Adapter_DbSelect($select)
+        );
+
+        $paginator->setCurrentPageNumber($page)
+                  ->setItemCountPerPage($itemsPerPage);
+
+        return array(
+            'info'  => $paginator->getPages(),
+            'items' => $paginator->getCurrentItems()
+        );
+    }
+
+    /**
+     * Get the comments for the specified post ID
+     *
+     * @param int $postId
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getCommentsForPost($postId, $page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'comments')
+                                      ->where('comment_post_ID = ?', $postId);
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+
+    /**
+     * Get the meta data for the specified post ID
+     *
+     * @param $postId
+     * @return unknown_type
+     */
+    public function getMetaForPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'postmeta')
+                                      ->where('post_id = ?', $postId);
+
+        return $this->_db->fetchAll($select);
+    }
+
+    /**
+     * Get a post by specifying its ID
+     *
+     * @param int $postId
+     * @return array
+     */
+    public function getPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts')
+                                      ->where('ID = ?', $postId);
+
+        return $this->_db->fetchOne($select);
+    }
+
+    /**
+     * Get posts per page
+     *
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getPosts($page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts');
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+}
+
+/**
+ * Pass the values from wp-config.php to the Wp_Amf_Gateway class.
+ */
+$gateway = new Wp_Amf_Gateway(
+    array(
+        'host'     => DB_HOST,
+        'username' => DB_USER,
+        'password' => DB_PASSWORD,
+        'dbname'   => DB_NAME
+    ),
+    $table_prefix
+);
+
+$server = new Zend_Amf_Server();
+$server->setProduction($production)
+       ->setClass($gateway)
+       ->handle();
+
+
+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Flex frontend]]> + + http://www.norm2782.com/?p=22 + 2009-01-02T09:27:20Z + 2009-01-01T23:29:35Z + + I was planning on writing a quick Flex frontend for this blog, but it appears WordPress only offers the posts themselves as RSS feed. If I get real bored (which I doubt, unfortunately) I’ll have a look and see if I can create a Zend_AMF plugin for WordPress that allows me to retrieve virtually all data from my WordPress install. Would be cool :D

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Properties in PHP]]> + + http://www.norm2782.com/?p=8 + 2009-01-02T15:13:15Z + 2009-01-01T23:02:54Z + + A while ago Dynom from #php_bnl pointed me to an interesting entry on the PHP 5.3 wiki page. In the “Future PHP releases” sections there’s an entry called “29. “real†properties with attached getters and setters”. Personally I can’t wait for this. Hopefully it will look something like ActionScript 3’s properties:

+
+<?php
+class Bar
+{
+    private $_foo = 'foo';
+
+    public function get foo()
+    {
+        return $this->_foo;
+    }
+
+    public function set foo($fooString)
+    {
+        $this->_foo = $fooString;
+    }
+}
+
+$bar = new Bar();
+$bar->foo = 'baz';
+echo $bar->foo; // prints baz
+
+
+]]>
+ + + 0 +
+
diff --git a/test/Reader/Entry/_files/Common/rss.xml b/test/Reader/Entry/_files/Common/rss.xml new file mode 100644 index 00000000..3d1fdfae --- /dev/null +++ b/test/Reader/Entry/_files/Common/rss.xml @@ -0,0 +1,700 @@ + + + + + Norm 2782 + + http://www.norm2782.com + Why are you here? + Sat, 07 Mar 2009 08:03:50 +0000 + http://wordpress.org/?v=2.8 + en + hourly + 1 + + Wth… reading books? + http://www.norm2782.com/2009/03/wth-reading-books/ + http://www.norm2782.com/2009/03/wth-reading-books/#comments + Mon, 02 Mar 2009 08:09:33 +0000 + norm2782 + + + + + + http://www.norm2782.com/?p=114 + + Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

+ +

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

+]]>
+ http://www.norm2782.com/2009/03/wth-reading-books/feed/ + 0 +
+ + My first few weeks in New Zealand + http://www.norm2782.com/2009/02/my-first-few-weeks-in-new-zealand/ + http://www.norm2782.com/2009/02/my-first-few-weeks-in-new-zealand/#comments + Sun, 15 Feb 2009 03:29:21 +0000 + norm2782 + + + + http://www.norm2782.com/?p=105 + + It’s been a while since my last blog post. Things have been quite hectic for me these last few weeks. There was my final week at Angry Bytes, followed by a pre-NZ party and then my trip to New Zealand. Currently New Zealand looks pretty much the same as the Netherlands, seeing as I’m locked away in an office most of my time.

+


+My adventure into Kiwi-land started with a long and interesting trip to San Francisco. The interesting part was my new book: Domain Driven Design: Tackling Complexity in the Heart of Software, by Eric Evans. This book, combined with KLM’s excellent on-board service made my flight to SF a breeze.

+

It was only 2PM when I arrived in SF, so I had to wait another 4 hours before my flight to Auckland even boarded. The waiting wasn’t too bad. It was great to get out into the sun and to grab some decent food and coffee. Didn’t get to see much of SF though, which was too bad.

+

SF Airport

+

The flight to Auckland wasn’t that flawless unfortunately. There were some technical problems with the airplane, which caused quite a bit of a delay. Because of this delay I had to run to catch my flight to Dunedin. The flight was all set to go and was waiting for me… I barely made it in time!

+

Flying to Dunedin

+

When I got to Dunedin I was welcomed by Jesse, Tracey and Lindsay. It was great to meet them in person. The first order of business for me was to get some coffee, because I only got roughly 3 hours of sleep on my way there. After a little tour of Abbey College (that’s where I’m staying) it was time for our first meeting. No time for sleep! Finally, after dinner at Abbey, I decided it was time to get some sleep. When I woke up the next day, the jet-lag was no more!

+

My Room

+

Abbey is a great place to stay by the way. It’s not far from the office or from the city center. The people who are staying there are great as well. Just check out the site. Abbey’s got it all!

+

View from my room

+

So what am I doing here in NZ? We’re currently working on writing the software for the PBRF initiative. It has already taken a lot of late hours, and it will probably take a lot more. It will be worth it though! After that, we’ll be working on a great and exciting cutting-edge open-source project. Unfortunately I can’t say a lot more at this point, but you can rest assured that it includes the latest Zend Framework technologies.

+

My Desk

+

Seeing as I don’t have internet-access at Abbey College yet, I’ve got lots of time for other activities. I’ve finished reading the better part of my Domain Driven Design book and I’ve ordered Martin Fowler’s Patterns Of Enterprise Application Architecture, which should arrive this week. I’ve also bought myself a brand new bicycle so I can get around. Cycling here is a bit more dangerous than in the Netherlands though… it definitely brings back memories from my bicycling trip in Scotland! There are lots more things on my todo list: winery tour, surfing, snowboarding, skydiving, bungee-jumping, renting/buying a Harley… six months in NZ is not going to be enough time!

+

Me!

+

Well, that’s my first NZ blog-post. There will definitely be more of these! Let’s hope they fix my internet soon… See my Flickr photo-stream for more pictures.

+]]>
+ http://www.norm2782.com/2009/02/my-first-few-weeks-in-new-zealand/feed/ + 0 +
+ + Properties in PHP – revisited + http://www.norm2782.com/2009/01/properties-in-php-revisited/ + http://www.norm2782.com/2009/01/properties-in-php-revisited/#comments + Wed, 14 Jan 2009 10:47:25 +0000 + norm2782 + + + + http://www.norm2782.com/?p=94 + + A while ago I was daydreaming about native property support in PHP. Unfortunately it will be a while before PHP itself will support this natively and an even longer while before shared hosting providers will upgrade to a newer version of PHP.

+

So what’s the big deal about those properties? In short, they make a developers life easier by allowing the developer to code no more than needed at that moment. And lets face it… less code is better! In this post we’ll see that it’s not impossible to enjoy properties in PHP today. As with a lot of good things, it does come with a small price though…

+


+Lets have a look at a use-case to demonstrate where properties will not only save you time, but it will also save your sanity. In this example we’re modeling a Person class. In the beginning of the project, the requirements for the Person class are quite simple: a Person has an age and a name. In the simplest form we can code that as follows:

+
+<?php
+class Person
+{
+    public $age;
+
+    public $name;
+}
+
+

This look easy enough, and it is. It even works like a charm and it’s possibly the fastest implementation for the Person class.

+

But, pesky as they are, the client suddenly wants some logic added to our Person class! A Person suddenly can’t be younger than 21 years old. This poses a problem. To add logic to our Person class, we would have to switch the public age attribute with a pair of getters and setters:

+
+<?php
+class Person
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+

Technically this works like a charm, however it will force me to go through my entire application and switch all references from the public attribute to the getter and setter. Not an ideal situation. One possible solution is to do things the Java way: just create all getters and setters up-front so you don’t have to do so afterwards. Even though this works fine, it’s in violation of our mission to write no more code than we actually need at the moment of writing.

+

The solution? Properties! But wait… PHP doesn’t support those, remember? Luckily we still have magic methods. It’s nowhere near as nice as a native solution, but at least it helps us write no more code than we need at the moment we’re first writing our code:

+
+<?php
+abstract class ModelAbstract
+{
+    public function __get($key)
+    {
+        $method = 'get' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        return $this->$method();
+    }
+
+    public function __set($key, $value)
+    {
+        $method = 'set' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        $this->$method($value);
+    }
+}
+
+

We’ll take a look at what this does exactly later. The important thing to note is that we can now do the following:

+
+<?php
+class Person extends ModelAbstract
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+$person = new Person();
+
+try {
+    $person->age = 10;
+} catch (Exception $e) {
+    // Will print "You need to be at least 21 years or older!"
+    echo $e->getMessage();
+}
+
+

With this construction in place, we can safely switch from a public attribute to getters and setters, without changing the rest of the application code. The only real downside to this – aside from the minor speed impact – is the fact that you have to subclass ModelAbstract to make this work. Luckily it’s not a lot of code, so should there be a big need to get rid of the ModelAbstract inheritance it’s not a big disaster to do some copy/paste work.

+

This method works by assuming you have get- and set methods that have the same name as the property you’re trying to access. When there’s a public attribute, it will use that. If there’s no public attribute, it will fall back to __get or __set and the logic will take it from there.

+

All of this is just a proof-of-concept of implementing properties in PHP and of the way I want to be using properties to access data the data in my objects. Please comment your experiences with this approach or similar approaches. I’m curious to see how practical this solution would be in a real-life situation.

+]]>
+ http://www.norm2782.com/2009/01/properties-in-php-revisited/feed/ + 0 +
+ + Filters for Zend_Paginator + http://www.norm2782.com/2009/01/filters-for-zend_paginator/ + http://www.norm2782.com/2009/01/filters-for-zend_paginator/#comments + Tue, 13 Jan 2009 12:57:53 +0000 + norm2782 + + + + http://www.norm2782.com/?p=72 + + Zend_Paginator has a new feature! It is now possible to add a filter to your Paginator object which acts on the data retrieved from the adapter. This filter can be any instance of Zend_Filter_Interface, including a filter-chain. If a filter(-chain) is set, the raw data from the adapter will be passed to the filter() method.

+


+So why would you want to apply filters to your result set? Usually my domain models don’t inherit from Zend_Db_Table_Row but that is the data type I get from the Paginator when I use the DbTableSelect adapter (wrapped in a nice Zend_Db_Table_Rowset). Instead, I would like to load my rows into my models and preferably without using the Paginator abilities or having to apply weird hacks. Previously this was only possible (in a sane way) by subclassing an adapter so it could return a collection of model objects instead of a rowset. With the new filter support you can just inject a filter to do this for you.

+

Lets have a look at an example. In this example I want to list all my users from the database. I’ll grab the name of the user from the row and inject it into a User object.

+
+<?php
+class User
+{
+    private $_name = '';
+
+    public function getName()
+    {
+        return $this->_name;
+    }
+
+    public function setName($name)
+    {
+        $this->_name = $name;
+    }
+}
+
+class UserFilter implements Zend_Filter_Interface
+{
+    public function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new UserFilter());
+
+        return $paginator;
+    }
+}
+
+$paginator = MyModel::getUserPaginator();
+$items = $paginator->getCurrentItems();
+
+foreach ($items as $user) {
+    echo 'Current name: ' . $user->getName() . '<br />' . PHP_EOL;
+}
+
+

To simplify adding a simple filter to your paginator I’ve also added Zend_Filter_Callback. This allows you to specify a callback method that does the same as the filter in the previous example.

+
+<?php
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new Zend_Filter_Callback(
+            array('MyModel', 'filter'))
+        );
+
+        return $paginator;
+    }
+
+    public static function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+

The callback also accepts object instead of a static reference to a class. Internally it uses call_user_func to execute the filter() method, so any notation that works there, works with the Callback filter.

+

Enjoy!

+]]>
+ http://www.norm2782.com/2009/01/filters-for-zend_paginator/feed/ + 0 +
+ + ZF-3239 + http://www.norm2782.com/2009/01/zf-3239/ + http://www.norm2782.com/2009/01/zf-3239/#comments + Wed, 07 Jan 2009 11:48:31 +0000 + norm2782 + + + + http://www.norm2782.com/?p=68 + + Zend_Db_Table_Select users, rejoice! I’ve just committed a patch for ZF-3239 in revision 13530. This should be a relief for those of you who have been implementing workarounds for those “No table has been specified for the FROM clause” exceptions.

+]]>
+ http://www.norm2782.com/2009/01/zf-3239/feed/ + 0 +
+ + New in-ear earphones + http://www.norm2782.com/2009/01/new-in-ear-earphones/ + http://www.norm2782.com/2009/01/new-in-ear-earphones/#comments + Sat, 03 Jan 2009 15:49:19 +0000 + norm2782 + + + http://www.norm2782.com/?p=53 + + Just got myself the Sennheiser CX 300 II Precision in-ear earphones. Check ‘em out by clicking the read more link!

+


+cx300

+]]>
+ http://www.norm2782.com/2009/01/new-in-ear-earphones/feed/ + 0 +
+ + Seven Things – Tagged by Pádraic + http://www.norm2782.com/2009/01/seven-things-tagged-by-padraic/ + http://www.norm2782.com/2009/01/seven-things-tagged-by-padraic/#comments + Sat, 03 Jan 2009 10:14:38 +0000 + norm2782 + + + http://www.norm2782.com/?p=44 + + Well, this was bound to happen: I got tagged by Pádraic because I’m working on Zend_Feed_Reader with him. Luckily I’ve just setup this new blog, so here we go!

+

Did you know that…

+
    +
  • Every bit of PHP I know is self-taught
  • +
  • My programming adventure started out with Visual Basic 3 back in 1993. I was just 8 years old back then and had no clue what I was doing.
  • +
  • My left foot is actually a few millimeter bigger than my right foot.
  • +
  • I used to have long hair (almost reached my ass). I cut it off in the summer of ‘08 for various reasons, one of which was 100 euro.
  • +
  • I bought my Harley Davidson before I even had my drivers license.
  • +
  • My whisky collection (only single malts ;) ) keeps growing instead of shrinking
  • +
  • While I use a Mac, with an Apple Cinema Display and an Apple keyboard… I have an HTC Touch with Windows Mobile and I’m stuck with it for at least a few more months.
  • +
+

Now it’s my turn to start tagging!

+
    +
  • Stefan Koopmanschap – For not being tagged yet and having said so on Twitter
  • +
  • Maurice Fonk – For being my co-worker and for not having finished Madoqua yet
  • +
  • Geoffrey Bachelet – For the great party in Paris
  • +
  • Wade Arnold – For doing a great job on Zend_AMF and having the same WordPress theme as me.
  • +
  • Kana Yeh – For being the coolest PHP girl in the Netherlands (that I know of)
  • +
  • Matthew Ratzloff – For his great help on Zend_Paginator
  • +
  • And one more here…
  • +
+

As for the rules:

+
    +
  • Link your original tagger(s), and list these rules on your blog.
  • +
  • Share seven facts about yourself in the post – some random, some wierd.
  • +
  • Tag seven people at the end of your post by leaving their names and the links to their blogs.
  • +
  • Let them know they’ve been tagged by leaving a comment on their blogs and/or Twitter.
  • +
+]]>
+ http://www.norm2782.com/2009/01/seven-things-tagged-by-padraic/feed/ + 0 +
+ + AMF Server class for WordPress + http://www.norm2782.com/2009/01/amf-server-class-for-wordpress/ + http://www.norm2782.com/2009/01/amf-server-class-for-wordpress/#comments + Fri, 02 Jan 2009 14:49:42 +0000 + norm2782 + + + + + http://www.norm2782.com/?p=27 + + After browsing through WordPress’ code I quickly found that there’s no sane way to create AMF support as a WP plugin. At least not for someone who hasn’t done any old-skool procedural PHP in years. Instead of writing a plugin, I decided to write a standalone server script. It’s still very basic and currently setup to work for me. To get it working for your WP setup you should probably make some minor modifications. Click the read more link to check out the code. I’ve released it under the generous BSD license, so knock yourself out! Use it at your own risk… I’m not going to support it. Any updates will be posted in this post. Also, please note that I haven’t tested it yet. If you access the script directly it should output “Zend Amf Endpoint” just fine, but that’s all I can guarantee at this point ;)

+

+
+<?php
+/**
+ * BSD LICENSE
+ *
+ * Copyright (c) 2009, norm2782
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of norm2782 nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * Set production mode.
+ * If set to false, exceptions will bubble through to the Flex frontend
+ *
+ * @var bool
+ */
+$production = false;
+
+/**
+ * Determine the absolute path of the AMF server
+ *
+ * @var string
+ */
+define('ABSPATH', dirname(__FILE__) . '/');
+
+/**
+ * One directory below docroot. Your config file and library dir should be here.
+ *
+ * @var string
+ */
+define('SUBPATH', dirname(ABSPATH));
+
+/**
+ * You should make sure Zend Framework is in your include path
+ */
+set_include_path(
+    implode(PATH_SEPARATOR, array(
+        SUBPATH . '/library',
+        get_include_path()
+    ))
+);
+
+/**
+ * Include the WordPress config file
+ */
+$configFile = SUBPATH . '/wp-config.php';
+
+if (!file_exists($configFile)) {
+    throw new Exception('WordPress config file was not found!');
+}
+
+require_once $configFile;
+
+/**
+ * No need to config more stuff from this point on
+ */
+
+/**
+ * @see Zend_Amf_Server
+ */
+require_once 'Zend/Amf/Server.php';
+
+/**
+ * @see Zend_Db_Adapter_Pdo_Mysql
+ */
+require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
+
+/**
+ * @see Zend_Paginator
+ */
+require_once 'Zend/Paginator.php';
+
+/**
+ * @see Zend_Paginator_Adapter_DbSelect
+ */
+require_once 'Zend/Paginator/Adapter/DbSelect.php';
+
+/**
+ * Simple class to expose wordpress data through AMF
+ *
+ * @author norm2782
+ */
+class Wp_Amf_Gateway
+{
+    /**
+     * Database adapter
+     *
+     * @var Zend_Db_Adapter_Pdo_Mysql
+     */
+    private $_db = null;
+
+    /**
+     * WordPress table prefix
+     *
+     * @var string
+     */
+    private $_prefix = null;
+
+    /**
+     * Constructor
+     *
+     * @param array $dbConfig
+     * @param string $prefix
+     * @return void
+     */
+    public function __construct(array $dbConfig, $prefix)
+    {
+        $this->_db = new Zend_Db_Adapter_Pdo_Mysql($dbConfig);
+        $this->_db->query('SET NAMES `utf8`');
+
+        $this->_prefix = $prefix;
+    }
+
+    /**
+     * Get paginated results for the provided query
+     *
+     * @param Zend_Db_Select $select
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    private function _getPaginated(Zend_Db_Select $select, $page, $itemsPerPage)
+    {
+        $paginator = new Zend_Paginator(
+            new Zend_Paginator_Adapter_DbSelect($select)
+        );
+
+        $paginator->setCurrentPageNumber($page)
+                  ->setItemCountPerPage($itemsPerPage);
+
+        return array(
+            'info'  => $paginator->getPages(),
+            'items' => $paginator->getCurrentItems()
+        );
+    }
+
+    /**
+     * Get the comments for the specified post ID
+     *
+     * @param int $postId
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getCommentsForPost($postId, $page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'comments')
+                                      ->where('comment_post_ID = ?', $postId);
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+
+    /**
+     * Get the meta data for the specified post ID
+     *
+     * @param $postId
+     * @return unknown_type
+     */
+    public function getMetaForPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'postmeta')
+                                      ->where('post_id = ?', $postId);
+
+        return $this->_db->fetchAll($select);
+    }
+
+    /**
+     * Get a post by specifying its ID
+     *
+     * @param int $postId
+     * @return array
+     */
+    public function getPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts')
+                                      ->where('ID = ?', $postId);
+
+        return $this->_db->fetchOne($select);
+    }
+
+    /**
+     * Get posts per page
+     *
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getPosts($page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts');
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+}
+
+/**
+ * Pass the values from wp-config.php to the Wp_Amf_Gateway class.
+ */
+$gateway = new Wp_Amf_Gateway(
+    array(
+        'host'     => DB_HOST,
+        'username' => DB_USER,
+        'password' => DB_PASSWORD,
+        'dbname'   => DB_NAME
+    ),
+    $table_prefix
+);
+
+$server = new Zend_Amf_Server();
+$server->setProduction($production)
+       ->setClass($gateway)
+       ->handle();
+
+]]>
+ http://www.norm2782.com/2009/01/amf-server-class-for-wordpress/feed/ + 0 +
+ + Flex frontend + http://www.norm2782.com/2009/01/flex-frontend/ + http://www.norm2782.com/2009/01/flex-frontend/#comments + Thu, 01 Jan 2009 23:29:35 +0000 + norm2782 + + + + http://www.norm2782.com/?p=22 + + I was planning on writing a quick Flex frontend for this blog, but it appears WordPress only offers the posts themselves as RSS feed. If I get real bored (which I doubt, unfortunately) I’ll have a look and see if I can create a Zend_AMF plugin for WordPress that allows me to retrieve virtually all data from my WordPress install. Would be cool :D

+]]>
+ http://www.norm2782.com/2009/01/flex-frontend/feed/ + 0 +
+ + Properties in PHP + http://www.norm2782.com/2009/01/properties-in-php/ + http://www.norm2782.com/2009/01/properties-in-php/#comments + Thu, 01 Jan 2009 23:02:54 +0000 + norm2782 + + + + http://www.norm2782.com/?p=8 + + A while ago Dynom from #php_bnl pointed me to an interesting entry on the PHP 5.3 wiki page. In the “Future PHP releases” sections there’s an entry called “29. “real†properties with attached getters and setters”. Personally I can’t wait for this. Hopefully it will look something like ActionScript 3’s properties:

+
+<?php
+class Bar
+{
+    private $_foo = 'foo';
+
+    public function get foo()
+    {
+        return $this->_foo;
+    }
+
+    public function set foo($fooString)
+    {
+        $this->_foo = $fooString;
+    }
+}
+
+$bar = new Bar();
+$bar->foo = 'baz';
+echo $bar->foo; // prints baz
+
+]]>
+ http://www.norm2782.com/2009/01/properties-in-php/feed/ + 0 +
+
+
diff --git a/test/Reader/Feed/CommonTest.php b/test/Reader/Feed/CommonTest.php new file mode 100644 index 00000000..973a7c4e --- /dev/null +++ b/test/Reader/Feed/CommonTest.php @@ -0,0 +1,64 @@ +_feedSamplePath = dirname(__FILE__) . '/_files/Common'; + } + + /** + * Check DOM Retrieval and Information Methods + */ + public function testGetsDomDocumentObject() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom.xml') + ); + $this->assertTrue($feed->getDomDocument() instanceof DOMDocument); + } + + public function testGetsDomXpathObject() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom.xml') + ); + $this->assertTrue($feed->getXpath() instanceof DOMXPath); + } + + public function testGetsXpathPrefixString() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom.xml') + ); + $this->assertTrue($feed->getXpathPrefix() == '/atom:feed'); + } + + public function testGetsDomElementObject() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom.xml') + ); + $this->assertTrue($feed->getElement() instanceof DOMElement); + } + + public function testSaveXmlOutputsXmlStringForFeed() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom.xml') + ); + $this->assertEquals($feed->saveXml(), file_get_contents($this->_feedSamplePath.'/atom_rewrittenbydom.xml')); + } + + +} diff --git a/test/Reader/Feed/_files/Common/atom.xml b/test/Reader/Feed/_files/Common/atom.xml new file mode 100644 index 00000000..1f2c99e6 --- /dev/null +++ b/test/Reader/Feed/_files/Common/atom.xml @@ -0,0 +1,726 @@ + + Norm 2782 + Why are you here? + + 2009-03-07T08:03:50Z + WordPress + + + http://www.norm2782.com/feed/atom/ + + + + + norm2782 + http://www.norm2782.com + + <![CDATA[Wth… reading books?]]> + + http://www.norm2782.com/?p=114 + 2009-03-07T08:03:50Z + 2009-03-02T08:09:33Z + + Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

+ + +

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[My first few weeks in New Zealand]]> + + http://www.norm2782.com/?p=105 + 2009-02-18T03:30:07Z + 2009-02-15T03:29:21Z + + It’s been a while since my last blog post. Things have been quite hectic for me these last few weeks. There was my final week at Angry Bytes, followed by a pre-NZ party and then my trip to New Zealand. Currently New Zealand looks pretty much the same as the Netherlands, seeing as I’m locked away in an office most of my time.

+ +


+My adventure into Kiwi-land started with a long and interesting trip to San Francisco. The interesting part was my new book: Domain Driven Design: Tackling Complexity in the Heart of Software, by Eric Evans. This book, combined with KLM’s excellent on-board service made my flight to SF a breeze.

+

It was only 2PM when I arrived in SF, so I had to wait another 4 hours before my flight to Auckland even boarded. The waiting wasn’t too bad. It was great to get out into the sun and to grab some decent food and coffee. Didn’t get to see much of SF though, which was too bad.

+

SF Airport

+

The flight to Auckland wasn’t that flawless unfortunately. There were some technical problems with the airplane, which caused quite a bit of a delay. Because of this delay I had to run to catch my flight to Dunedin. The flight was all set to go and was waiting for me… I barely made it in time!

+ +

Flying to Dunedin

+

When I got to Dunedin I was welcomed by Jesse, Tracey and Lindsay. It was great to meet them in person. The first order of business for me was to get some coffee, because I only got roughly 3 hours of sleep on my way there. After a little tour of Abbey College (that’s where I’m staying) it was time for our first meeting. No time for sleep! Finally, after dinner at Abbey, I decided it was time to get some sleep. When I woke up the next day, the jet-lag was no more!

+

My Room

+

Abbey is a great place to stay by the way. It’s not far from the office or from the city center. The people who are staying there are great as well. Just check out the site. Abbey’s got it all!

+ +

View from my room

+

So what am I doing here in NZ? We’re currently working on writing the software for the PBRF initiative. It has already taken a lot of late hours, and it will probably take a lot more. It will be worth it though! After that, we’ll be working on a great and exciting cutting-edge open-source project. Unfortunately I can’t say a lot more at this point, but you can rest assured that it includes the latest Zend Framework technologies.

+

My Desk

+

Seeing as I don’t have internet-access at Abbey College yet, I’ve got lots of time for other activities. I’ve finished reading the better part of my Domain Driven Design book and I’ve ordered Martin Fowler’s Patterns Of Enterprise Application Architecture, which should arrive this week. I’ve also bought myself a brand new bicycle so I can get around. Cycling here is a bit more dangerous than in the Netherlands though… it definitely brings back memories from my bicycling trip in Scotland! There are lots more things on my todo list: winery tour, surfing, snowboarding, skydiving, bungee-jumping, renting/buying a Harley… six months in NZ is not going to be enough time!

+ +

Me!

+

Well, that’s my first NZ blog-post. There will definitely be more of these! Let’s hope they fix my internet soon… See my Flickr photo-stream for more pictures.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Properties in PHP – revisited]]> + + http://www.norm2782.com/?p=94 + 2009-01-14T10:47:25Z + 2009-01-14T10:47:25Z + + A while ago I was daydreaming about native property support in PHP. Unfortunately it will be a while before PHP itself will support this natively and an even longer while before shared hosting providers will upgrade to a newer version of PHP.

+ +

So what’s the big deal about those properties? In short, they make a developers life easier by allowing the developer to code no more than needed at that moment. And lets face it… less code is better! In this post we’ll see that it’s not impossible to enjoy properties in PHP today. As with a lot of good things, it does come with a small price though…

+


+Lets have a look at a use-case to demonstrate where properties will not only save you time, but it will also save your sanity. In this example we’re modeling a Person class. In the beginning of the project, the requirements for the Person class are quite simple: a Person has an age and a name. In the simplest form we can code that as follows:

+
+<?php
+class Person
+{
+    public $age;
+
+    public $name;
+}
+
+
+

This look easy enough, and it is. It even works like a charm and it’s possibly the fastest implementation for the Person class.

+

But, pesky as they are, the client suddenly wants some logic added to our Person class! A Person suddenly can’t be younger than 21 years old. This poses a problem. To add logic to our Person class, we would have to switch the public age attribute with a pair of getters and setters:

+
+<?php
+class Person
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+

Technically this works like a charm, however it will force me to go through my entire application and switch all references from the public attribute to the getter and setter. Not an ideal situation. One possible solution is to do things the Java way: just create all getters and setters up-front so you don’t have to do so afterwards. Even though this works fine, it’s in violation of our mission to write no more code than we actually need at the moment of writing.

+ +

The solution? Properties! But wait… PHP doesn’t support those, remember? Luckily we still have magic methods. It’s nowhere near as nice as a native solution, but at least it helps us write no more code than we need at the moment we’re first writing our code:

+
+<?php
+abstract class ModelAbstract
+{
+    public function __get($key)
+    {
+        $method = 'get' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        return $this->$method();
+    }
+
+    public function __set($key, $value)
+    {
+        $method = 'set' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        $this->$method($value);
+    }
+}
+
+

We’ll take a look at what this does exactly later. The important thing to note is that we can now do the following:

+
+<?php
+class Person extends ModelAbstract
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+$person = new Person();
+
+try {
+    $person->age = 10;
+} catch (Exception $e) {
+    // Will print "You need to be at least 21 years or older!"
+    echo $e->getMessage();
+}
+
+
+

With this construction in place, we can safely switch from a public attribute to getters and setters, without changing the rest of the application code. The only real downside to this – aside from the minor speed impact – is the fact that you have to subclass ModelAbstract to make this work. Luckily it’s not a lot of code, so should there be a big need to get rid of the ModelAbstract inheritance it’s not a big disaster to do some copy/paste work.

+

This method works by assuming you have get- and set methods that have the same name as the property you’re trying to access. When there’s a public attribute, it will use that. If there’s no public attribute, it will fall back to __get or __set and the logic will take it from there.

+

All of this is just a proof-of-concept of implementing properties in PHP and of the way I want to be using properties to access data the data in my objects. Please comment your experiences with this approach or similar approaches. I’m curious to see how practical this solution would be in a real-life situation.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Filters for Zend_Paginator]]> + + http://www.norm2782.com/?p=72 + 2009-01-14T08:23:19Z + 2009-01-13T12:57:53Z + + Zend_Paginator has a new feature! It is now possible to add a filter to your Paginator object which acts on the data retrieved from the adapter. This filter can be any instance of Zend_Filter_Interface, including a filter-chain. If a filter(-chain) is set, the raw data from the adapter will be passed to the filter() method.

+ +


+So why would you want to apply filters to your result set? Usually my domain models don’t inherit from Zend_Db_Table_Row but that is the data type I get from the Paginator when I use the DbTableSelect adapter (wrapped in a nice Zend_Db_Table_Rowset). Instead, I would like to load my rows into my models and preferably without using the Paginator abilities or having to apply weird hacks. Previously this was only possible (in a sane way) by subclassing an adapter so it could return a collection of model objects instead of a rowset. With the new filter support you can just inject a filter to do this for you.

+

Lets have a look at an example. In this example I want to list all my users from the database. I’ll grab the name of the user from the row and inject it into a User object.

+
+<?php
+class User
+{
+    private $_name = '';
+
+    public function getName()
+    {
+        return $this->_name;
+    }
+
+    public function setName($name)
+    {
+        $this->_name = $name;
+    }
+}
+
+class UserFilter implements Zend_Filter_Interface
+{
+    public function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new UserFilter());
+
+        return $paginator;
+    }
+}
+
+$paginator = MyModel::getUserPaginator();
+$items = $paginator->getCurrentItems();
+
+foreach ($items as $user) {
+    echo 'Current name: ' . $user->getName() . '<br />' . PHP_EOL;
+}
+
+
+

To simplify adding a simple filter to your paginator I’ve also added Zend_Filter_Callback. This allows you to specify a callback method that does the same as the filter in the previous example.

+
+<?php
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new Zend_Filter_Callback(
+            array('MyModel', 'filter'))
+        );
+
+        return $paginator;
+    }
+
+    public static function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+

The callback also accepts object instead of a static reference to a class. Internally it uses call_user_func to execute the filter() method, so any notation that works there, works with the Callback filter.

+

Enjoy!

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[ZF-3239]]> + + http://www.norm2782.com/?p=68 + 2009-01-11T09:53:20Z + 2009-01-07T11:48:31Z + + Zend_Db_Table_Select users, rejoice! I’ve just committed a patch for ZF-3239 in revision 13530. This should be a relief for those of you who have been implementing workarounds for those “No table has been specified for the FROM clause” exceptions.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[New in-ear earphones]]> + + http://www.norm2782.com/?p=53 + 2009-01-03T18:51:43Z + 2009-01-03T15:49:19Z + + Just got myself the Sennheiser CX 300 II Precision in-ear earphones. Check ‘em out by clicking the read more link!

+ +


+cx300

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Seven Things – Tagged by Pádraic]]> + + http://www.norm2782.com/?p=44 + 2009-01-03T11:47:19Z + 2009-01-03T10:14:38Z + + Well, this was bound to happen: I got tagged by Pádraic because I’m working on Zend_Feed_Reader with him. Luckily I’ve just setup this new blog, so here we go!

+ +

Did you know that…

+
    +
  • Every bit of PHP I know is self-taught
  • +
  • My programming adventure started out with Visual Basic 3 back in 1993. I was just 8 years old back then and had no clue what I was doing.
  • +
  • My left foot is actually a few millimeter bigger than my right foot.
  • +
  • I used to have long hair (almost reached my ass). I cut it off in the summer of ‘08 for various reasons, one of which was 100 euro.
  • +
  • I bought my Harley Davidson before I even had my drivers license.
  • +
  • My whisky collection (only single malts ;) ) keeps growing instead of shrinking
  • + +
  • While I use a Mac, with an Apple Cinema Display and an Apple keyboard… I have an HTC Touch with Windows Mobile and I’m stuck with it for at least a few more months.
  • +
+

Now it’s my turn to start tagging!

+
    +
  • Stefan Koopmanschap – For not being tagged yet and having said so on Twitter
  • +
  • Maurice Fonk – For being my co-worker and for not having finished Madoqua yet
  • + +
  • Geoffrey Bachelet – For the great party in Paris
  • +
  • Wade Arnold – For doing a great job on Zend_AMF and having the same WordPress theme as me.
  • +
  • Kana Yeh – For being the coolest PHP girl in the Netherlands (that I know of)
  • +
  • Matthew Ratzloff – For his great help on Zend_Paginator
  • + +
  • And one more here…
  • +
+

As for the rules:

+
    +
  • Link your original tagger(s), and list these rules on your blog.
  • +
  • Share seven facts about yourself in the post – some random, some wierd.
  • +
  • Tag seven people at the end of your post by leaving their names and the links to their blogs.
  • +
  • Let them know they’ve been tagged by leaving a comment on their blogs and/or Twitter.
  • + +
+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[AMF Server class for WordPress]]> + + http://www.norm2782.com/?p=27 + 2009-01-06T15:00:54Z + 2009-01-02T14:49:42Z + + After browsing through WordPress’ code I quickly found that there’s no sane way to create AMF support as a WP plugin. At least not for someone who hasn’t done any old-skool procedural PHP in years. Instead of writing a plugin, I decided to write a standalone server script. It’s still very basic and currently setup to work for me. To get it working for your WP setup you should probably make some minor modifications. Click the read more link to check out the code. I’ve released it under the generous BSD license, so knock yourself out! Use it at your own risk… I’m not going to support it. Any updates will be posted in this post. Also, please note that I haven’t tested it yet. If you access the script directly it should output “Zend Amf Endpoint” just fine, but that’s all I can guarantee at this point ;)

+ +

+
+<?php
+/**
+ * BSD LICENSE
+ *
+ * Copyright (c) 2009, norm2782
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of norm2782 nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * Set production mode.
+ * If set to false, exceptions will bubble through to the Flex frontend
+ *
+ * @var bool
+ */
+$production = false;
+
+/**
+ * Determine the absolute path of the AMF server
+ *
+ * @var string
+ */
+define('ABSPATH', dirname(__FILE__) . '/');
+
+/**
+ * One directory below docroot. Your config file and library dir should be here.
+ *
+ * @var string
+ */
+define('SUBPATH', dirname(ABSPATH));
+
+/**
+ * You should make sure Zend Framework is in your include path
+ */
+set_include_path(
+    implode(PATH_SEPARATOR, array(
+        SUBPATH . '/library',
+        get_include_path()
+    ))
+);
+
+/**
+ * Include the WordPress config file
+ */
+$configFile = SUBPATH . '/wp-config.php';
+
+if (!file_exists($configFile)) {
+    throw new Exception('WordPress config file was not found!');
+}
+
+require_once $configFile;
+
+/**
+ * No need to config more stuff from this point on
+ */
+
+/**
+ * @see Zend_Amf_Server
+ */
+require_once 'Zend/Amf/Server.php';
+
+/**
+ * @see Zend_Db_Adapter_Pdo_Mysql
+ */
+require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
+
+/**
+ * @see Zend_Paginator
+ */
+require_once 'Zend/Paginator.php';
+
+/**
+ * @see Zend_Paginator_Adapter_DbSelect
+ */
+require_once 'Zend/Paginator/Adapter/DbSelect.php';
+
+/**
+ * Simple class to expose wordpress data through AMF
+ *
+ * @author norm2782
+ */
+class Wp_Amf_Gateway
+{
+    /**
+     * Database adapter
+     *
+     * @var Zend_Db_Adapter_Pdo_Mysql
+     */
+    private $_db = null;
+
+    /**
+     * WordPress table prefix
+     *
+     * @var string
+     */
+    private $_prefix = null;
+
+    /**
+     * Constructor
+     *
+     * @param array $dbConfig
+     * @param string $prefix
+     * @return void
+     */
+    public function __construct(array $dbConfig, $prefix)
+    {
+        $this->_db = new Zend_Db_Adapter_Pdo_Mysql($dbConfig);
+        $this->_db->query('SET NAMES `utf8`');
+
+        $this->_prefix = $prefix;
+    }
+
+    /**
+     * Get paginated results for the provided query
+     *
+     * @param Zend_Db_Select $select
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    private function _getPaginated(Zend_Db_Select $select, $page, $itemsPerPage)
+    {
+        $paginator = new Zend_Paginator(
+            new Zend_Paginator_Adapter_DbSelect($select)
+        );
+
+        $paginator->setCurrentPageNumber($page)
+                  ->setItemCountPerPage($itemsPerPage);
+
+        return array(
+            'info'  => $paginator->getPages(),
+            'items' => $paginator->getCurrentItems()
+        );
+    }
+
+    /**
+     * Get the comments for the specified post ID
+     *
+     * @param int $postId
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getCommentsForPost($postId, $page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'comments')
+                                      ->where('comment_post_ID = ?', $postId);
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+
+    /**
+     * Get the meta data for the specified post ID
+     *
+     * @param $postId
+     * @return unknown_type
+     */
+    public function getMetaForPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'postmeta')
+                                      ->where('post_id = ?', $postId);
+
+        return $this->_db->fetchAll($select);
+    }
+
+    /**
+     * Get a post by specifying its ID
+     *
+     * @param int $postId
+     * @return array
+     */
+    public function getPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts')
+                                      ->where('ID = ?', $postId);
+
+        return $this->_db->fetchOne($select);
+    }
+
+    /**
+     * Get posts per page
+     *
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getPosts($page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts');
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+}
+
+/**
+ * Pass the values from wp-config.php to the Wp_Amf_Gateway class.
+ */
+$gateway = new Wp_Amf_Gateway(
+    array(
+        'host'     => DB_HOST,
+        'username' => DB_USER,
+        'password' => DB_PASSWORD,
+        'dbname'   => DB_NAME
+    ),
+    $table_prefix
+);
+
+$server = new Zend_Amf_Server();
+$server->setProduction($production)
+       ->setClass($gateway)
+       ->handle();
+
+
+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Flex frontend]]> + + http://www.norm2782.com/?p=22 + 2009-01-02T09:27:20Z + 2009-01-01T23:29:35Z + + I was planning on writing a quick Flex frontend for this blog, but it appears WordPress only offers the posts themselves as RSS feed. If I get real bored (which I doubt, unfortunately) I’ll have a look and see if I can create a Zend_AMF plugin for WordPress that allows me to retrieve virtually all data from my WordPress install. Would be cool :D

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Properties in PHP]]> + + http://www.norm2782.com/?p=8 + 2009-01-02T15:13:15Z + 2009-01-01T23:02:54Z + + A while ago Dynom from #php_bnl pointed me to an interesting entry on the PHP 5.3 wiki page. In the “Future PHP releases” sections there’s an entry called “29. “real†properties with attached getters and setters”. Personally I can’t wait for this. Hopefully it will look something like ActionScript 3’s properties:

+
+<?php
+class Bar
+{
+    private $_foo = 'foo';
+
+    public function get foo()
+    {
+        return $this->_foo;
+    }
+
+    public function set foo($fooString)
+    {
+        $this->_foo = $fooString;
+    }
+}
+
+$bar = new Bar();
+$bar->foo = 'baz';
+echo $bar->foo; // prints baz
+
+
+]]>
+ + + 0 +
+
diff --git a/test/Reader/Feed/_files/Common/atom_rewrittenbydom.xml b/test/Reader/Feed/_files/Common/atom_rewrittenbydom.xml new file mode 100644 index 00000000..fd9da5f0 --- /dev/null +++ b/test/Reader/Feed/_files/Common/atom_rewrittenbydom.xml @@ -0,0 +1,722 @@ + + + Norm 2782 + Why are you here? + + 2009-03-07T08:03:50Z + WordPress + + + http://www.norm2782.com/feed/atom/ + + + + + norm2782 + http://www.norm2782.com + + <![CDATA[Wth… reading books?]]> + + http://www.norm2782.com/?p=114 + 2009-03-07T08:03:50Z + 2009-03-02T08:09:33Z + + Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

+ + +

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[My first few weeks in New Zealand]]> + + http://www.norm2782.com/?p=105 + 2009-02-18T03:30:07Z + 2009-02-15T03:29:21Z + + It’s been a while since my last blog post. Things have been quite hectic for me these last few weeks. There was my final week at Angry Bytes, followed by a pre-NZ party and then my trip to New Zealand. Currently New Zealand looks pretty much the same as the Netherlands, seeing as I’m locked away in an office most of my time.

+ +


+My adventure into Kiwi-land started with a long and interesting trip to San Francisco. The interesting part was my new book: Domain Driven Design: Tackling Complexity in the Heart of Software, by Eric Evans. This book, combined with KLM’s excellent on-board service made my flight to SF a breeze.

+

It was only 2PM when I arrived in SF, so I had to wait another 4 hours before my flight to Auckland even boarded. The waiting wasn’t too bad. It was great to get out into the sun and to grab some decent food and coffee. Didn’t get to see much of SF though, which was too bad.

+

SF Airport

+

The flight to Auckland wasn’t that flawless unfortunately. There were some technical problems with the airplane, which caused quite a bit of a delay. Because of this delay I had to run to catch my flight to Dunedin. The flight was all set to go and was waiting for me… I barely made it in time!

+ +

Flying to Dunedin

+

When I got to Dunedin I was welcomed by Jesse, Tracey and Lindsay. It was great to meet them in person. The first order of business for me was to get some coffee, because I only got roughly 3 hours of sleep on my way there. After a little tour of Abbey College (that’s where I’m staying) it was time for our first meeting. No time for sleep! Finally, after dinner at Abbey, I decided it was time to get some sleep. When I woke up the next day, the jet-lag was no more!

+

My Room

+

Abbey is a great place to stay by the way. It’s not far from the office or from the city center. The people who are staying there are great as well. Just check out the site. Abbey’s got it all!

+ +

View from my room

+

So what am I doing here in NZ? We’re currently working on writing the software for the PBRF initiative. It has already taken a lot of late hours, and it will probably take a lot more. It will be worth it though! After that, we’ll be working on a great and exciting cutting-edge open-source project. Unfortunately I can’t say a lot more at this point, but you can rest assured that it includes the latest Zend Framework technologies.

+

My Desk

+

Seeing as I don’t have internet-access at Abbey College yet, I’ve got lots of time for other activities. I’ve finished reading the better part of my Domain Driven Design book and I’ve ordered Martin Fowler’s Patterns Of Enterprise Application Architecture, which should arrive this week. I’ve also bought myself a brand new bicycle so I can get around. Cycling here is a bit more dangerous than in the Netherlands though… it definitely brings back memories from my bicycling trip in Scotland! There are lots more things on my todo list: winery tour, surfing, snowboarding, skydiving, bungee-jumping, renting/buying a Harley… six months in NZ is not going to be enough time!

+ +

Me!

+

Well, that’s my first NZ blog-post. There will definitely be more of these! Let’s hope they fix my internet soon… See my Flickr photo-stream for more pictures.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Properties in PHP – revisited]]> + + http://www.norm2782.com/?p=94 + 2009-01-14T10:47:25Z + 2009-01-14T10:47:25Z + + A while ago I was daydreaming about native property support in PHP. Unfortunately it will be a while before PHP itself will support this natively and an even longer while before shared hosting providers will upgrade to a newer version of PHP.

+ +

So what’s the big deal about those properties? In short, they make a developers life easier by allowing the developer to code no more than needed at that moment. And lets face it… less code is better! In this post we’ll see that it’s not impossible to enjoy properties in PHP today. As with a lot of good things, it does come with a small price though…

+


+Lets have a look at a use-case to demonstrate where properties will not only save you time, but it will also save your sanity. In this example we’re modeling a Person class. In the beginning of the project, the requirements for the Person class are quite simple: a Person has an age and a name. In the simplest form we can code that as follows:

+
+<?php
+class Person
+{
+    public $age;
+
+    public $name;
+}
+
+
+

This look easy enough, and it is. It even works like a charm and it’s possibly the fastest implementation for the Person class.

+

But, pesky as they are, the client suddenly wants some logic added to our Person class! A Person suddenly can’t be younger than 21 years old. This poses a problem. To add logic to our Person class, we would have to switch the public age attribute with a pair of getters and setters:

+
+<?php
+class Person
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+

Technically this works like a charm, however it will force me to go through my entire application and switch all references from the public attribute to the getter and setter. Not an ideal situation. One possible solution is to do things the Java way: just create all getters and setters up-front so you don’t have to do so afterwards. Even though this works fine, it’s in violation of our mission to write no more code than we actually need at the moment of writing.

+ +

The solution? Properties! But wait… PHP doesn’t support those, remember? Luckily we still have magic methods. It’s nowhere near as nice as a native solution, but at least it helps us write no more code than we need at the moment we’re first writing our code:

+
+<?php
+abstract class ModelAbstract
+{
+    public function __get($key)
+    {
+        $method = 'get' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        return $this->$method();
+    }
+
+    public function __set($key, $value)
+    {
+        $method = 'set' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        $this->$method($value);
+    }
+}
+
+

We’ll take a look at what this does exactly later. The important thing to note is that we can now do the following:

+
+<?php
+class Person extends ModelAbstract
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+$person = new Person();
+
+try {
+    $person->age = 10;
+} catch (Exception $e) {
+    // Will print "You need to be at least 21 years or older!"
+    echo $e->getMessage();
+}
+
+
+

With this construction in place, we can safely switch from a public attribute to getters and setters, without changing the rest of the application code. The only real downside to this – aside from the minor speed impact – is the fact that you have to subclass ModelAbstract to make this work. Luckily it’s not a lot of code, so should there be a big need to get rid of the ModelAbstract inheritance it’s not a big disaster to do some copy/paste work.

+

This method works by assuming you have get- and set methods that have the same name as the property you’re trying to access. When there’s a public attribute, it will use that. If there’s no public attribute, it will fall back to __get or __set and the logic will take it from there.

+

All of this is just a proof-of-concept of implementing properties in PHP and of the way I want to be using properties to access data the data in my objects. Please comment your experiences with this approach or similar approaches. I’m curious to see how practical this solution would be in a real-life situation.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Filters for Zend_Paginator]]> + + http://www.norm2782.com/?p=72 + 2009-01-14T08:23:19Z + 2009-01-13T12:57:53Z + + Zend_Paginator has a new feature! It is now possible to add a filter to your Paginator object which acts on the data retrieved from the adapter. This filter can be any instance of Zend_Filter_Interface, including a filter-chain. If a filter(-chain) is set, the raw data from the adapter will be passed to the filter() method.

+ +


+So why would you want to apply filters to your result set? Usually my domain models don’t inherit from Zend_Db_Table_Row but that is the data type I get from the Paginator when I use the DbTableSelect adapter (wrapped in a nice Zend_Db_Table_Rowset). Instead, I would like to load my rows into my models and preferably without using the Paginator abilities or having to apply weird hacks. Previously this was only possible (in a sane way) by subclassing an adapter so it could return a collection of model objects instead of a rowset. With the new filter support you can just inject a filter to do this for you.

+

Lets have a look at an example. In this example I want to list all my users from the database. I’ll grab the name of the user from the row and inject it into a User object.

+
+<?php
+class User
+{
+    private $_name = '';
+
+    public function getName()
+    {
+        return $this->_name;
+    }
+
+    public function setName($name)
+    {
+        $this->_name = $name;
+    }
+}
+
+class UserFilter implements Zend_Filter_Interface
+{
+    public function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new UserFilter());
+
+        return $paginator;
+    }
+}
+
+$paginator = MyModel::getUserPaginator();
+$items = $paginator->getCurrentItems();
+
+foreach ($items as $user) {
+    echo 'Current name: ' . $user->getName() . '<br />' . PHP_EOL;
+}
+
+
+

To simplify adding a simple filter to your paginator I’ve also added Zend_Filter_Callback. This allows you to specify a callback method that does the same as the filter in the previous example.

+
+<?php
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new Zend_Filter_Callback(
+            array('MyModel', 'filter'))
+        );
+
+        return $paginator;
+    }
+
+    public static function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+

The callback also accepts object instead of a static reference to a class. Internally it uses call_user_func to execute the filter() method, so any notation that works there, works with the Callback filter.

+

Enjoy!

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[ZF-3239]]> + + http://www.norm2782.com/?p=68 + 2009-01-11T09:53:20Z + 2009-01-07T11:48:31Z + + Zend_Db_Table_Select users, rejoice! I’ve just committed a patch for ZF-3239 in revision 13530. This should be a relief for those of you who have been implementing workarounds for those “No table has been specified for the FROM clause” exceptions.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[New in-ear earphones]]> + + http://www.norm2782.com/?p=53 + 2009-01-03T18:51:43Z + 2009-01-03T15:49:19Z + + Just got myself the Sennheiser CX 300 II Precision in-ear earphones. Check ‘em out by clicking the read more link!

+ +


+cx300

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Seven Things – Tagged by Pádraic]]> + + http://www.norm2782.com/?p=44 + 2009-01-03T11:47:19Z + 2009-01-03T10:14:38Z + + Well, this was bound to happen: I got tagged by Pádraic because I’m working on Zend_Feed_Reader with him. Luckily I’ve just setup this new blog, so here we go!

+ +

Did you know that…

+
    +
  • Every bit of PHP I know is self-taught
  • +
  • My programming adventure started out with Visual Basic 3 back in 1993. I was just 8 years old back then and had no clue what I was doing.
  • +
  • My left foot is actually a few millimeter bigger than my right foot.
  • +
  • I used to have long hair (almost reached my ass). I cut it off in the summer of ‘08 for various reasons, one of which was 100 euro.
  • +
  • I bought my Harley Davidson before I even had my drivers license.
  • +
  • My whisky collection (only single malts ;) ) keeps growing instead of shrinking
  • + +
  • While I use a Mac, with an Apple Cinema Display and an Apple keyboard… I have an HTC Touch with Windows Mobile and I’m stuck with it for at least a few more months.
  • +
+

Now it’s my turn to start tagging!

+
    +
  • Stefan Koopmanschap – For not being tagged yet and having said so on Twitter
  • +
  • Maurice Fonk – For being my co-worker and for not having finished Madoqua yet
  • + +
  • Geoffrey Bachelet – For the great party in Paris
  • +
  • Wade Arnold – For doing a great job on Zend_AMF and having the same WordPress theme as me.
  • +
  • Kana Yeh – For being the coolest PHP girl in the Netherlands (that I know of)
  • +
  • Matthew Ratzloff – For his great help on Zend_Paginator
  • + +
  • And one more here…
  • +
+

As for the rules:

+
    +
  • Link your original tagger(s), and list these rules on your blog.
  • +
  • Share seven facts about yourself in the post – some random, some wierd.
  • +
  • Tag seven people at the end of your post by leaving their names and the links to their blogs.
  • +
  • Let them know they’ve been tagged by leaving a comment on their blogs and/or Twitter.
  • + +
+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[AMF Server class for WordPress]]> + + http://www.norm2782.com/?p=27 + 2009-01-06T15:00:54Z + 2009-01-02T14:49:42Z + + After browsing through WordPress’ code I quickly found that there’s no sane way to create AMF support as a WP plugin. At least not for someone who hasn’t done any old-skool procedural PHP in years. Instead of writing a plugin, I decided to write a standalone server script. It’s still very basic and currently setup to work for me. To get it working for your WP setup you should probably make some minor modifications. Click the read more link to check out the code. I’ve released it under the generous BSD license, so knock yourself out! Use it at your own risk… I’m not going to support it. Any updates will be posted in this post. Also, please note that I haven’t tested it yet. If you access the script directly it should output “Zend Amf Endpoint” just fine, but that’s all I can guarantee at this point ;)

+ +

+
+<?php
+/**
+ * BSD LICENSE
+ *
+ * Copyright (c) 2009, norm2782
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of norm2782 nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * Set production mode.
+ * If set to false, exceptions will bubble through to the Flex frontend
+ *
+ * @var bool
+ */
+$production = false;
+
+/**
+ * Determine the absolute path of the AMF server
+ *
+ * @var string
+ */
+define('ABSPATH', dirname(__FILE__) . '/');
+
+/**
+ * One directory below docroot. Your config file and library dir should be here.
+ *
+ * @var string
+ */
+define('SUBPATH', dirname(ABSPATH));
+
+/**
+ * You should make sure Zend Framework is in your include path
+ */
+set_include_path(
+    implode(PATH_SEPARATOR, array(
+        SUBPATH . '/library',
+        get_include_path()
+    ))
+);
+
+/**
+ * Include the WordPress config file
+ */
+$configFile = SUBPATH . '/wp-config.php';
+
+if (!file_exists($configFile)) {
+    throw new Exception('WordPress config file was not found!');
+}
+
+require_once $configFile;
+
+/**
+ * No need to config more stuff from this point on
+ */
+
+/**
+ * @see Zend_Amf_Server
+ */
+require_once 'Zend/Amf/Server.php';
+
+/**
+ * @see Zend_Db_Adapter_Pdo_Mysql
+ */
+require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
+
+/**
+ * @see Zend_Paginator
+ */
+require_once 'Zend/Paginator.php';
+
+/**
+ * @see Zend_Paginator_Adapter_DbSelect
+ */
+require_once 'Zend/Paginator/Adapter/DbSelect.php';
+
+/**
+ * Simple class to expose wordpress data through AMF
+ *
+ * @author norm2782
+ */
+class Wp_Amf_Gateway
+{
+    /**
+     * Database adapter
+     *
+     * @var Zend_Db_Adapter_Pdo_Mysql
+     */
+    private $_db = null;
+
+    /**
+     * WordPress table prefix
+     *
+     * @var string
+     */
+    private $_prefix = null;
+
+    /**
+     * Constructor
+     *
+     * @param array $dbConfig
+     * @param string $prefix
+     * @return void
+     */
+    public function __construct(array $dbConfig, $prefix)
+    {
+        $this->_db = new Zend_Db_Adapter_Pdo_Mysql($dbConfig);
+        $this->_db->query('SET NAMES `utf8`');
+
+        $this->_prefix = $prefix;
+    }
+
+    /**
+     * Get paginated results for the provided query
+     *
+     * @param Zend_Db_Select $select
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    private function _getPaginated(Zend_Db_Select $select, $page, $itemsPerPage)
+    {
+        $paginator = new Zend_Paginator(
+            new Zend_Paginator_Adapter_DbSelect($select)
+        );
+
+        $paginator->setCurrentPageNumber($page)
+                  ->setItemCountPerPage($itemsPerPage);
+
+        return array(
+            'info'  => $paginator->getPages(),
+            'items' => $paginator->getCurrentItems()
+        );
+    }
+
+    /**
+     * Get the comments for the specified post ID
+     *
+     * @param int $postId
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getCommentsForPost($postId, $page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'comments')
+                                      ->where('comment_post_ID = ?', $postId);
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+
+    /**
+     * Get the meta data for the specified post ID
+     *
+     * @param $postId
+     * @return unknown_type
+     */
+    public function getMetaForPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'postmeta')
+                                      ->where('post_id = ?', $postId);
+
+        return $this->_db->fetchAll($select);
+    }
+
+    /**
+     * Get a post by specifying its ID
+     *
+     * @param int $postId
+     * @return array
+     */
+    public function getPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts')
+                                      ->where('ID = ?', $postId);
+
+        return $this->_db->fetchOne($select);
+    }
+
+    /**
+     * Get posts per page
+     *
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getPosts($page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts');
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+}
+
+/**
+ * Pass the values from wp-config.php to the Wp_Amf_Gateway class.
+ */
+$gateway = new Wp_Amf_Gateway(
+    array(
+        'host'     => DB_HOST,
+        'username' => DB_USER,
+        'password' => DB_PASSWORD,
+        'dbname'   => DB_NAME
+    ),
+    $table_prefix
+);
+
+$server = new Zend_Amf_Server();
+$server->setProduction($production)
+       ->setClass($gateway)
+       ->handle();
+
+
+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Flex frontend]]> + + http://www.norm2782.com/?p=22 + 2009-01-02T09:27:20Z + 2009-01-01T23:29:35Z + + I was planning on writing a quick Flex frontend for this blog, but it appears WordPress only offers the posts themselves as RSS feed. If I get real bored (which I doubt, unfortunately) I’ll have a look and see if I can create a Zend_AMF plugin for WordPress that allows me to retrieve virtually all data from my WordPress install. Would be cool :D

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Properties in PHP]]> + + http://www.norm2782.com/?p=8 + 2009-01-02T15:13:15Z + 2009-01-01T23:02:54Z + + A while ago Dynom from #php_bnl pointed me to an interesting entry on the PHP 5.3 wiki page. In the “Future PHP releases” sections there’s an entry called “29. “real†properties with attached getters and setters”. Personally I can’t wait for this. Hopefully it will look something like ActionScript 3’s properties:

+
+<?php
+class Bar
+{
+    private $_foo = 'foo';
+
+    public function get foo()
+    {
+        return $this->_foo;
+    }
+
+    public function set foo($fooString)
+    {
+        $this->_foo = $fooString;
+    }
+}
+
+$bar = new Bar();
+$bar->foo = 'baz';
+echo $bar->foo; // prints baz
+
+
+]]>
+ + + 0 +
+
diff --git a/test/Reader/Feed/_files/Common/rss.xml b/test/Reader/Feed/_files/Common/rss.xml new file mode 100644 index 00000000..3d1fdfae --- /dev/null +++ b/test/Reader/Feed/_files/Common/rss.xml @@ -0,0 +1,700 @@ + + + + + Norm 2782 + + http://www.norm2782.com + Why are you here? + Sat, 07 Mar 2009 08:03:50 +0000 + http://wordpress.org/?v=2.8 + en + hourly + 1 + + Wth… reading books? + http://www.norm2782.com/2009/03/wth-reading-books/ + http://www.norm2782.com/2009/03/wth-reading-books/#comments + Mon, 02 Mar 2009 08:09:33 +0000 + norm2782 + + + + + + http://www.norm2782.com/?p=114 + + Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

+ +

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

+]]>
+ http://www.norm2782.com/2009/03/wth-reading-books/feed/ + 0 +
+ + My first few weeks in New Zealand + http://www.norm2782.com/2009/02/my-first-few-weeks-in-new-zealand/ + http://www.norm2782.com/2009/02/my-first-few-weeks-in-new-zealand/#comments + Sun, 15 Feb 2009 03:29:21 +0000 + norm2782 + + + + http://www.norm2782.com/?p=105 + + It’s been a while since my last blog post. Things have been quite hectic for me these last few weeks. There was my final week at Angry Bytes, followed by a pre-NZ party and then my trip to New Zealand. Currently New Zealand looks pretty much the same as the Netherlands, seeing as I’m locked away in an office most of my time.

+


+My adventure into Kiwi-land started with a long and interesting trip to San Francisco. The interesting part was my new book: Domain Driven Design: Tackling Complexity in the Heart of Software, by Eric Evans. This book, combined with KLM’s excellent on-board service made my flight to SF a breeze.

+

It was only 2PM when I arrived in SF, so I had to wait another 4 hours before my flight to Auckland even boarded. The waiting wasn’t too bad. It was great to get out into the sun and to grab some decent food and coffee. Didn’t get to see much of SF though, which was too bad.

+

SF Airport

+

The flight to Auckland wasn’t that flawless unfortunately. There were some technical problems with the airplane, which caused quite a bit of a delay. Because of this delay I had to run to catch my flight to Dunedin. The flight was all set to go and was waiting for me… I barely made it in time!

+

Flying to Dunedin

+

When I got to Dunedin I was welcomed by Jesse, Tracey and Lindsay. It was great to meet them in person. The first order of business for me was to get some coffee, because I only got roughly 3 hours of sleep on my way there. After a little tour of Abbey College (that’s where I’m staying) it was time for our first meeting. No time for sleep! Finally, after dinner at Abbey, I decided it was time to get some sleep. When I woke up the next day, the jet-lag was no more!

+

My Room

+

Abbey is a great place to stay by the way. It’s not far from the office or from the city center. The people who are staying there are great as well. Just check out the site. Abbey’s got it all!

+

View from my room

+

So what am I doing here in NZ? We’re currently working on writing the software for the PBRF initiative. It has already taken a lot of late hours, and it will probably take a lot more. It will be worth it though! After that, we’ll be working on a great and exciting cutting-edge open-source project. Unfortunately I can’t say a lot more at this point, but you can rest assured that it includes the latest Zend Framework technologies.

+

My Desk

+

Seeing as I don’t have internet-access at Abbey College yet, I’ve got lots of time for other activities. I’ve finished reading the better part of my Domain Driven Design book and I’ve ordered Martin Fowler’s Patterns Of Enterprise Application Architecture, which should arrive this week. I’ve also bought myself a brand new bicycle so I can get around. Cycling here is a bit more dangerous than in the Netherlands though… it definitely brings back memories from my bicycling trip in Scotland! There are lots more things on my todo list: winery tour, surfing, snowboarding, skydiving, bungee-jumping, renting/buying a Harley… six months in NZ is not going to be enough time!

+

Me!

+

Well, that’s my first NZ blog-post. There will definitely be more of these! Let’s hope they fix my internet soon… See my Flickr photo-stream for more pictures.

+]]>
+ http://www.norm2782.com/2009/02/my-first-few-weeks-in-new-zealand/feed/ + 0 +
+ + Properties in PHP – revisited + http://www.norm2782.com/2009/01/properties-in-php-revisited/ + http://www.norm2782.com/2009/01/properties-in-php-revisited/#comments + Wed, 14 Jan 2009 10:47:25 +0000 + norm2782 + + + + http://www.norm2782.com/?p=94 + + A while ago I was daydreaming about native property support in PHP. Unfortunately it will be a while before PHP itself will support this natively and an even longer while before shared hosting providers will upgrade to a newer version of PHP.

+

So what’s the big deal about those properties? In short, they make a developers life easier by allowing the developer to code no more than needed at that moment. And lets face it… less code is better! In this post we’ll see that it’s not impossible to enjoy properties in PHP today. As with a lot of good things, it does come with a small price though…

+


+Lets have a look at a use-case to demonstrate where properties will not only save you time, but it will also save your sanity. In this example we’re modeling a Person class. In the beginning of the project, the requirements for the Person class are quite simple: a Person has an age and a name. In the simplest form we can code that as follows:

+
+<?php
+class Person
+{
+    public $age;
+
+    public $name;
+}
+
+

This look easy enough, and it is. It even works like a charm and it’s possibly the fastest implementation for the Person class.

+

But, pesky as they are, the client suddenly wants some logic added to our Person class! A Person suddenly can’t be younger than 21 years old. This poses a problem. To add logic to our Person class, we would have to switch the public age attribute with a pair of getters and setters:

+
+<?php
+class Person
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+

Technically this works like a charm, however it will force me to go through my entire application and switch all references from the public attribute to the getter and setter. Not an ideal situation. One possible solution is to do things the Java way: just create all getters and setters up-front so you don’t have to do so afterwards. Even though this works fine, it’s in violation of our mission to write no more code than we actually need at the moment of writing.

+

The solution? Properties! But wait… PHP doesn’t support those, remember? Luckily we still have magic methods. It’s nowhere near as nice as a native solution, but at least it helps us write no more code than we need at the moment we’re first writing our code:

+
+<?php
+abstract class ModelAbstract
+{
+    public function __get($key)
+    {
+        $method = 'get' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        return $this->$method();
+    }
+
+    public function __set($key, $value)
+    {
+        $method = 'set' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        $this->$method($value);
+    }
+}
+
+

We’ll take a look at what this does exactly later. The important thing to note is that we can now do the following:

+
+<?php
+class Person extends ModelAbstract
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+$person = new Person();
+
+try {
+    $person->age = 10;
+} catch (Exception $e) {
+    // Will print "You need to be at least 21 years or older!"
+    echo $e->getMessage();
+}
+
+

With this construction in place, we can safely switch from a public attribute to getters and setters, without changing the rest of the application code. The only real downside to this – aside from the minor speed impact – is the fact that you have to subclass ModelAbstract to make this work. Luckily it’s not a lot of code, so should there be a big need to get rid of the ModelAbstract inheritance it’s not a big disaster to do some copy/paste work.

+

This method works by assuming you have get- and set methods that have the same name as the property you’re trying to access. When there’s a public attribute, it will use that. If there’s no public attribute, it will fall back to __get or __set and the logic will take it from there.

+

All of this is just a proof-of-concept of implementing properties in PHP and of the way I want to be using properties to access data the data in my objects. Please comment your experiences with this approach or similar approaches. I’m curious to see how practical this solution would be in a real-life situation.

+]]>
+ http://www.norm2782.com/2009/01/properties-in-php-revisited/feed/ + 0 +
+ + Filters for Zend_Paginator + http://www.norm2782.com/2009/01/filters-for-zend_paginator/ + http://www.norm2782.com/2009/01/filters-for-zend_paginator/#comments + Tue, 13 Jan 2009 12:57:53 +0000 + norm2782 + + + + http://www.norm2782.com/?p=72 + + Zend_Paginator has a new feature! It is now possible to add a filter to your Paginator object which acts on the data retrieved from the adapter. This filter can be any instance of Zend_Filter_Interface, including a filter-chain. If a filter(-chain) is set, the raw data from the adapter will be passed to the filter() method.

+


+So why would you want to apply filters to your result set? Usually my domain models don’t inherit from Zend_Db_Table_Row but that is the data type I get from the Paginator when I use the DbTableSelect adapter (wrapped in a nice Zend_Db_Table_Rowset). Instead, I would like to load my rows into my models and preferably without using the Paginator abilities or having to apply weird hacks. Previously this was only possible (in a sane way) by subclassing an adapter so it could return a collection of model objects instead of a rowset. With the new filter support you can just inject a filter to do this for you.

+

Lets have a look at an example. In this example I want to list all my users from the database. I’ll grab the name of the user from the row and inject it into a User object.

+
+<?php
+class User
+{
+    private $_name = '';
+
+    public function getName()
+    {
+        return $this->_name;
+    }
+
+    public function setName($name)
+    {
+        $this->_name = $name;
+    }
+}
+
+class UserFilter implements Zend_Filter_Interface
+{
+    public function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new UserFilter());
+
+        return $paginator;
+    }
+}
+
+$paginator = MyModel::getUserPaginator();
+$items = $paginator->getCurrentItems();
+
+foreach ($items as $user) {
+    echo 'Current name: ' . $user->getName() . '<br />' . PHP_EOL;
+}
+
+

To simplify adding a simple filter to your paginator I’ve also added Zend_Filter_Callback. This allows you to specify a callback method that does the same as the filter in the previous example.

+
+<?php
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new Zend_Filter_Callback(
+            array('MyModel', 'filter'))
+        );
+
+        return $paginator;
+    }
+
+    public static function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+

The callback also accepts object instead of a static reference to a class. Internally it uses call_user_func to execute the filter() method, so any notation that works there, works with the Callback filter.

+

Enjoy!

+]]>
+ http://www.norm2782.com/2009/01/filters-for-zend_paginator/feed/ + 0 +
+ + ZF-3239 + http://www.norm2782.com/2009/01/zf-3239/ + http://www.norm2782.com/2009/01/zf-3239/#comments + Wed, 07 Jan 2009 11:48:31 +0000 + norm2782 + + + + http://www.norm2782.com/?p=68 + + Zend_Db_Table_Select users, rejoice! I’ve just committed a patch for ZF-3239 in revision 13530. This should be a relief for those of you who have been implementing workarounds for those “No table has been specified for the FROM clause” exceptions.

+]]>
+ http://www.norm2782.com/2009/01/zf-3239/feed/ + 0 +
+ + New in-ear earphones + http://www.norm2782.com/2009/01/new-in-ear-earphones/ + http://www.norm2782.com/2009/01/new-in-ear-earphones/#comments + Sat, 03 Jan 2009 15:49:19 +0000 + norm2782 + + + http://www.norm2782.com/?p=53 + + Just got myself the Sennheiser CX 300 II Precision in-ear earphones. Check ‘em out by clicking the read more link!

+


+cx300

+]]>
+ http://www.norm2782.com/2009/01/new-in-ear-earphones/feed/ + 0 +
+ + Seven Things – Tagged by Pádraic + http://www.norm2782.com/2009/01/seven-things-tagged-by-padraic/ + http://www.norm2782.com/2009/01/seven-things-tagged-by-padraic/#comments + Sat, 03 Jan 2009 10:14:38 +0000 + norm2782 + + + http://www.norm2782.com/?p=44 + + Well, this was bound to happen: I got tagged by Pádraic because I’m working on Zend_Feed_Reader with him. Luckily I’ve just setup this new blog, so here we go!

+

Did you know that…

+
    +
  • Every bit of PHP I know is self-taught
  • +
  • My programming adventure started out with Visual Basic 3 back in 1993. I was just 8 years old back then and had no clue what I was doing.
  • +
  • My left foot is actually a few millimeter bigger than my right foot.
  • +
  • I used to have long hair (almost reached my ass). I cut it off in the summer of ‘08 for various reasons, one of which was 100 euro.
  • +
  • I bought my Harley Davidson before I even had my drivers license.
  • +
  • My whisky collection (only single malts ;) ) keeps growing instead of shrinking
  • +
  • While I use a Mac, with an Apple Cinema Display and an Apple keyboard… I have an HTC Touch with Windows Mobile and I’m stuck with it for at least a few more months.
  • +
+

Now it’s my turn to start tagging!

+
    +
  • Stefan Koopmanschap – For not being tagged yet and having said so on Twitter
  • +
  • Maurice Fonk – For being my co-worker and for not having finished Madoqua yet
  • +
  • Geoffrey Bachelet – For the great party in Paris
  • +
  • Wade Arnold – For doing a great job on Zend_AMF and having the same WordPress theme as me.
  • +
  • Kana Yeh – For being the coolest PHP girl in the Netherlands (that I know of)
  • +
  • Matthew Ratzloff – For his great help on Zend_Paginator
  • +
  • And one more here…
  • +
+

As for the rules:

+
    +
  • Link your original tagger(s), and list these rules on your blog.
  • +
  • Share seven facts about yourself in the post – some random, some wierd.
  • +
  • Tag seven people at the end of your post by leaving their names and the links to their blogs.
  • +
  • Let them know they’ve been tagged by leaving a comment on their blogs and/or Twitter.
  • +
+]]>
+ http://www.norm2782.com/2009/01/seven-things-tagged-by-padraic/feed/ + 0 +
+ + AMF Server class for WordPress + http://www.norm2782.com/2009/01/amf-server-class-for-wordpress/ + http://www.norm2782.com/2009/01/amf-server-class-for-wordpress/#comments + Fri, 02 Jan 2009 14:49:42 +0000 + norm2782 + + + + + http://www.norm2782.com/?p=27 + + After browsing through WordPress’ code I quickly found that there’s no sane way to create AMF support as a WP plugin. At least not for someone who hasn’t done any old-skool procedural PHP in years. Instead of writing a plugin, I decided to write a standalone server script. It’s still very basic and currently setup to work for me. To get it working for your WP setup you should probably make some minor modifications. Click the read more link to check out the code. I’ve released it under the generous BSD license, so knock yourself out! Use it at your own risk… I’m not going to support it. Any updates will be posted in this post. Also, please note that I haven’t tested it yet. If you access the script directly it should output “Zend Amf Endpoint” just fine, but that’s all I can guarantee at this point ;)

+

+
+<?php
+/**
+ * BSD LICENSE
+ *
+ * Copyright (c) 2009, norm2782
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of norm2782 nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * Set production mode.
+ * If set to false, exceptions will bubble through to the Flex frontend
+ *
+ * @var bool
+ */
+$production = false;
+
+/**
+ * Determine the absolute path of the AMF server
+ *
+ * @var string
+ */
+define('ABSPATH', dirname(__FILE__) . '/');
+
+/**
+ * One directory below docroot. Your config file and library dir should be here.
+ *
+ * @var string
+ */
+define('SUBPATH', dirname(ABSPATH));
+
+/**
+ * You should make sure Zend Framework is in your include path
+ */
+set_include_path(
+    implode(PATH_SEPARATOR, array(
+        SUBPATH . '/library',
+        get_include_path()
+    ))
+);
+
+/**
+ * Include the WordPress config file
+ */
+$configFile = SUBPATH . '/wp-config.php';
+
+if (!file_exists($configFile)) {
+    throw new Exception('WordPress config file was not found!');
+}
+
+require_once $configFile;
+
+/**
+ * No need to config more stuff from this point on
+ */
+
+/**
+ * @see Zend_Amf_Server
+ */
+require_once 'Zend/Amf/Server.php';
+
+/**
+ * @see Zend_Db_Adapter_Pdo_Mysql
+ */
+require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
+
+/**
+ * @see Zend_Paginator
+ */
+require_once 'Zend/Paginator.php';
+
+/**
+ * @see Zend_Paginator_Adapter_DbSelect
+ */
+require_once 'Zend/Paginator/Adapter/DbSelect.php';
+
+/**
+ * Simple class to expose wordpress data through AMF
+ *
+ * @author norm2782
+ */
+class Wp_Amf_Gateway
+{
+    /**
+     * Database adapter
+     *
+     * @var Zend_Db_Adapter_Pdo_Mysql
+     */
+    private $_db = null;
+
+    /**
+     * WordPress table prefix
+     *
+     * @var string
+     */
+    private $_prefix = null;
+
+    /**
+     * Constructor
+     *
+     * @param array $dbConfig
+     * @param string $prefix
+     * @return void
+     */
+    public function __construct(array $dbConfig, $prefix)
+    {
+        $this->_db = new Zend_Db_Adapter_Pdo_Mysql($dbConfig);
+        $this->_db->query('SET NAMES `utf8`');
+
+        $this->_prefix = $prefix;
+    }
+
+    /**
+     * Get paginated results for the provided query
+     *
+     * @param Zend_Db_Select $select
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    private function _getPaginated(Zend_Db_Select $select, $page, $itemsPerPage)
+    {
+        $paginator = new Zend_Paginator(
+            new Zend_Paginator_Adapter_DbSelect($select)
+        );
+
+        $paginator->setCurrentPageNumber($page)
+                  ->setItemCountPerPage($itemsPerPage);
+
+        return array(
+            'info'  => $paginator->getPages(),
+            'items' => $paginator->getCurrentItems()
+        );
+    }
+
+    /**
+     * Get the comments for the specified post ID
+     *
+     * @param int $postId
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getCommentsForPost($postId, $page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'comments')
+                                      ->where('comment_post_ID = ?', $postId);
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+
+    /**
+     * Get the meta data for the specified post ID
+     *
+     * @param $postId
+     * @return unknown_type
+     */
+    public function getMetaForPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'postmeta')
+                                      ->where('post_id = ?', $postId);
+
+        return $this->_db->fetchAll($select);
+    }
+
+    /**
+     * Get a post by specifying its ID
+     *
+     * @param int $postId
+     * @return array
+     */
+    public function getPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts')
+                                      ->where('ID = ?', $postId);
+
+        return $this->_db->fetchOne($select);
+    }
+
+    /**
+     * Get posts per page
+     *
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getPosts($page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts');
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+}
+
+/**
+ * Pass the values from wp-config.php to the Wp_Amf_Gateway class.
+ */
+$gateway = new Wp_Amf_Gateway(
+    array(
+        'host'     => DB_HOST,
+        'username' => DB_USER,
+        'password' => DB_PASSWORD,
+        'dbname'   => DB_NAME
+    ),
+    $table_prefix
+);
+
+$server = new Zend_Amf_Server();
+$server->setProduction($production)
+       ->setClass($gateway)
+       ->handle();
+
+]]>
+ http://www.norm2782.com/2009/01/amf-server-class-for-wordpress/feed/ + 0 +
+ + Flex frontend + http://www.norm2782.com/2009/01/flex-frontend/ + http://www.norm2782.com/2009/01/flex-frontend/#comments + Thu, 01 Jan 2009 23:29:35 +0000 + norm2782 + + + + http://www.norm2782.com/?p=22 + + I was planning on writing a quick Flex frontend for this blog, but it appears WordPress only offers the posts themselves as RSS feed. If I get real bored (which I doubt, unfortunately) I’ll have a look and see if I can create a Zend_AMF plugin for WordPress that allows me to retrieve virtually all data from my WordPress install. Would be cool :D

+]]>
+ http://www.norm2782.com/2009/01/flex-frontend/feed/ + 0 +
+ + Properties in PHP + http://www.norm2782.com/2009/01/properties-in-php/ + http://www.norm2782.com/2009/01/properties-in-php/#comments + Thu, 01 Jan 2009 23:02:54 +0000 + norm2782 + + + + http://www.norm2782.com/?p=8 + + A while ago Dynom from #php_bnl pointed me to an interesting entry on the PHP 5.3 wiki page. In the “Future PHP releases” sections there’s an entry called “29. “real†properties with attached getters and setters”. Personally I can’t wait for this. Hopefully it will look something like ActionScript 3’s properties:

+
+<?php
+class Bar
+{
+    private $_foo = 'foo';
+
+    public function get foo()
+    {
+        return $this->_foo;
+    }
+
+    public function set foo($fooString)
+    {
+        $this->_foo = $fooString;
+    }
+}
+
+$bar = new Bar();
+$bar->foo = 'baz';
+echo $bar->foo; // prints baz
+
+]]>
+ http://www.norm2782.com/2009/01/properties-in-php/feed/ + 0 +
+
+
From 6231b69cd6c22911604214f81bc7b34978a9476c Mon Sep 17 00:00:00 2001 From: padraic Date: Wed, 22 Jul 2009 12:52:21 +0000 Subject: [PATCH 018/238] Added extended DOM methods to Feed level API with tests git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16958 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/EntryAbstract.php | 16 ++++++++++++++-- test/AllTests.php | 3 +++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Reader/EntryAbstract.php b/src/Reader/EntryAbstract.php index 659b2b96..f4e36aa3 100644 --- a/src/Reader/EntryAbstract.php +++ b/src/Reader/EntryAbstract.php @@ -103,9 +103,9 @@ public function getDomDocument() /** * Get the entry element * - * @return Zend_Feed_Entry_Interface + * @return DOMElement */ - public function getEntryElement() + public function getElement() { return $this->_entry; } @@ -121,6 +121,18 @@ public function getEncoding() return $assumed; } + /** + * Get entry as xml + * + * @return string + */ + public function saveXml() + { + $dom = new DOMDocument(); + $dom->importNode($this->getElement(), true); + return $dom->saveXml(); + } + /** * Get the entry type * diff --git a/test/AllTests.php b/test/AllTests.php index d4e6bcdd..0576453a 100644 --- a/test/AllTests.php +++ b/test/AllTests.php @@ -52,6 +52,7 @@ require_once 'Zend/Feed/Reader/Feed/AtomTest.php'; require_once 'Zend/Feed/Reader/Entry/AtomTest.php'; require_once 'Zend/Feed/Reader/Feed/CommonTest.php'; +require_once 'Zend/Feed/Reader/Entry/CommonTest.php'; require_once 'Zend/Feed/Reader/Integration/WordpressRss2DcAtomTest.php'; require_once 'Zend/Feed/Reader/Integration/WordpressAtom10Test.php'; @@ -98,6 +99,8 @@ public static function suite() $suite->addTestSuite('Zend_Feed_Reader_Entry_AtomTest'); // COMMON - Feed Level $suite->addTestSuite('Zend_Feed_Reader_Feed_CommonTest'); + // COMMON - Entry Level + $suite->addTestSuite('Zend_Feed_Reader_Entry_CommonTest'); /** * Real World Feed Tests */ From 1c9110c2c050e61060bca9d507633aef9de42f73 Mon Sep 17 00:00:00 2001 From: padraic Date: Wed, 22 Jul 2009 13:03:31 +0000 Subject: [PATCH 019/238] Added extended DOM methods to Entry level API with tests git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16961 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/EntryAbstract.php | 7 +- test/Reader/Entry/CommonTest.php | 69 +++++++++++++++++++ .../_files/Common/atom_rewrittenbydom.xml | 30 ++++++++ 3 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 test/Reader/Entry/CommonTest.php create mode 100644 test/Reader/Entry/_files/Common/atom_rewrittenbydom.xml diff --git a/src/Reader/EntryAbstract.php b/src/Reader/EntryAbstract.php index f4e36aa3..a507262b 100644 --- a/src/Reader/EntryAbstract.php +++ b/src/Reader/EntryAbstract.php @@ -128,8 +128,9 @@ public function getEncoding() */ public function saveXml() { - $dom = new DOMDocument(); - $dom->importNode($this->getElement(), true); + $dom = new DOMDocument('1.0', $this->getEncoding()); + $entry = $dom->importNode($this->getElement(), true); + $dom->appendChild($entry); return $dom->saveXml(); } @@ -220,7 +221,7 @@ protected function _loadExtensions() } $className = Zend_Feed_Reader::getPluginLoader()->getClassName($extension); $this->_extensions[$className] = new $className( - $this->getEntryElement(), $this->_entryKey, $this->_data['type'] + $this->getElement(), $this->_entryKey, $this->_data['type'] ); } } diff --git a/test/Reader/Entry/CommonTest.php b/test/Reader/Entry/CommonTest.php new file mode 100644 index 00000000..c604ca73 --- /dev/null +++ b/test/Reader/Entry/CommonTest.php @@ -0,0 +1,69 @@ +_feedSamplePath = dirname(__FILE__) . '/_files/Common'; + } + + /** + * Check DOM Retrieval and Information Methods + */ + public function testGetsDomDocumentObject() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom.xml') + ); + $entry = $feed->current(); + $this->assertTrue($entry->getDomDocument() instanceof DOMDocument); + } + + public function testGetsDomXpathObject() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom.xml') + ); + $entry = $feed->current(); + $this->assertTrue($entry->getXpath() instanceof DOMXPath); + } + + public function testGetsXpathPrefixString() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom.xml') + ); + $entry = $feed->current(); + $this->assertEquals('//atom:entry[1]', $entry->getXpathPrefix()); + } + + public function testGetsDomElementObject() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom.xml') + ); + $entry = $feed->current(); + $this->assertTrue($entry->getElement() instanceof DOMElement); + } + + public function testSaveXmlOutputsXmlStringForEntry() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom.xml') + ); + $entry = $feed->current(); + $this->assertEquals($entry->saveXml(), file_get_contents($this->_feedSamplePath.'/atom_rewrittenbydom.xml')); + } + + +} diff --git a/test/Reader/Entry/_files/Common/atom_rewrittenbydom.xml b/test/Reader/Entry/_files/Common/atom_rewrittenbydom.xml new file mode 100644 index 00000000..5dd145a6 --- /dev/null +++ b/test/Reader/Entry/_files/Common/atom_rewrittenbydom.xml @@ -0,0 +1,30 @@ + + + + norm2782 + http://www.norm2782.com + + <![CDATA[Wth… reading books?]]> + + http://www.norm2782.com/?p=114 + 2009-03-07T08:03:50Z + 2009-03-02T08:09:33Z + + Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

+ + +

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

+]]>
+ + + 0 +
From 0c1ccfe2ea52e2911deffa461f6926cba3c78abc Mon Sep 17 00:00:00 2001 From: padraic Date: Wed, 22 Jul 2009 14:39:31 +0000 Subject: [PATCH 020/238] Added getExtension() to feed level, and refactored internally to use this method in preference to protected vars holding Core Extensions git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16963 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Feed/Atom.php | 32 +++++++---------- src/Reader/Feed/Rss.php | 63 +++++++++++++-------------------- src/Reader/FeedAbstract.php | 10 +++++- test/Reader/Feed/CommonTest.php | 16 +++++++++ 4 files changed, 61 insertions(+), 60 deletions(-) diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index 4f690842..f9080efa 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -38,13 +38,6 @@ class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract { - /** - * Atom feed - * - * @var Zend_Feed_Reader_Feed_Atom - */ - protected $_atom = null; - /** * Constructor * @@ -56,8 +49,7 @@ public function __construct(DomDocument $dom, $type = null) { parent::__construct($dom, $type); $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Feed'); - $this->_atom = new $atomClass($dom, $this->_data['type'], $this->_xpath); - $this->_atom->setXpathPrefix('/atom:feed'); + $this->_extensions['Atom_Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); foreach ($this->_extensions as $extension) { $extension->setXpathPrefix('/atom:feed'); } @@ -91,7 +83,7 @@ public function getAuthors() return $this->_data['authors']; } - $people = $this->_atom->getAuthors(); + $people = $this->getExtension('Atom')->getAuthors(); $this->_data['authors'] = $people; @@ -109,7 +101,7 @@ public function getCopyright() return $this->_data['copyright']; } - $copyright = $this->_atom->getCopyright(); + $copyright = $this->getExtension('Atom')->getCopyright(); if (!$copyright) { $copyright = null; @@ -131,7 +123,7 @@ public function getDateCreated() return $this->_data['datecreated']; } - $dateCreated = $this->_atom->getDateCreated(); + $dateCreated = $this->getExtension('Atom')->getDateCreated(); if (!$dateCreated) { $dateCreated = null; @@ -153,7 +145,7 @@ public function getDateModified() return $this->_data['datemodified']; } - $dateModified = $this->_atom->getDateModified(); + $dateModified = $this->getExtension('Atom')->getDateModified(); if (!$dateModified) { $dateModified = null; @@ -175,7 +167,7 @@ public function getDescription() return $this->_data['description']; } - $description = $this->_atom->getDescription(); + $description = $this->getExtension('Atom')->getDescription(); if (!$description) { $description = null; @@ -197,7 +189,7 @@ public function getGenerator() return $this->_data['generator']; } - $generator = $this->_atom->getGenerator(); + $generator = $this->getExtension('Atom')->getGenerator(); $this->_data['generator'] = $generator; @@ -215,7 +207,7 @@ public function getId() return $this->_data['id']; } - $id = $this->_atom->getId(); + $id = $this->getExtension('Atom')->getId(); $this->_data['id'] = $id; @@ -233,7 +225,7 @@ public function getLanguage() return $this->_data['language']; } - $language = $this->_atom->getLanguage(); + $language = $this->getExtension('Atom')->getLanguage(); if (!$language) { $language = $this->_xpath->evaluate('string(//@xml:lang[1])'); @@ -259,7 +251,7 @@ public function getLink() return $this->_data['link']; } - $link = $this->_atom->getLink(); + $link = $this->getExtension('Atom')->getLink(); $this->_data['link'] = $link; @@ -277,7 +269,7 @@ public function getFeedLink() return $this->_data['feedlink']; } - $link = $this->_atom->getFeedLink(); + $link = $this->getExtension('Atom')->getFeedLink(); $this->_data['feedlink'] = $link; @@ -295,7 +287,7 @@ public function getTitle() return $this->_data['title']; } - $title = $this->_atom->getTitle(); + $title = $this->getExtension('Atom')->getTitle(); $this->_data['title'] = $title; diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 8d5759d7..491b3816 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -47,19 +47,6 @@ */ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract { - /** - * Atom feed - * - * @var Zend_Feed_Reader_Feed_Atom - */ - protected $_atom = null; - - /** - * DC feed - * - * @var Zend_Feed_Reader_Extension_DublinCore_Feed - */ - protected $_dc = null; /** * Constructor @@ -73,17 +60,15 @@ public function __construct(DomDocument $dom, $type = null) parent::__construct($dom, $type); $dublinCoreClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Feed'); - $this->_dc = new $dublinCoreClass($dom, $this->_data['type'], $this->_xpath); + $this->_extensions['DublinCore_Feed'] = new $dublinCoreClass($dom, $this->_data['type'], $this->_xpath); $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Feed'); - $this->_atom = new $atomClass($dom, $this->_data['type'], $this->_xpath); + $this->_extensions['Atom_Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $xpathPrefix = '/rss/channel'; } else { $xpathPrefix = '/rdf:RDF/rss:channel'; } - $this->_dc->setXpathPrefix($xpathPrefix); - $this->_atom->setXpathPrefix($xpathPrefix); foreach ($this->_extensions as $extension) { $extension->setXpathPrefix($xpathPrefix); } @@ -120,7 +105,7 @@ public function getAuthors() $authors = array(); if (empty($authors)) { - $authors = $this->_dc->getAuthors(); + $authors = $this->getExtension('DublinCore')->getAuthors(); } if (empty($authors)) { @@ -136,7 +121,7 @@ public function getAuthors() } if (empty($authors)) { - $authors = $this->_atom->getAuthors(); + $authors = $this->getExtension('Atom')->getAuthors(); } if (empty($authors)) { @@ -168,12 +153,12 @@ public function getCopyright() $copyright = $this->_xpath->evaluate('string(/rss/channel/copyright)'); } - if (!$copyright && !is_null($this->_dc)) { - $copyright = $this->_dc->getCopyright(); + if (!$copyright && !is_null($this->getExtension('DublinCore'))) { + $copyright = $this->getExtension('DublinCore')->getCopyright(); } if (empty($copyright)) { - $copyright = $this->_atom->getCopyright(); + $copyright = $this->getExtension('Atom')->getCopyright(); } if (!$copyright) { @@ -238,11 +223,11 @@ public function getDateModified() } if (!$date) { - $date = $this->_dc->getDate(); + $date = $this->getExtension('DublinCore')->getDate(); } if (!$date) { - $date = $this->_atom->getDateModified(); + $date = $this->getExtension('Atom')->getDateModified(); } if (!$date) { @@ -274,12 +259,12 @@ public function getDescription() $description = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:description)'); } - if (!$description && !is_null($this->_dc)) { - $description = $this->_dc->getDescription(); + if (!$description && !is_null($this->getExtension('DublinCore'))) { + $description = $this->getExtension('DublinCore')->getDescription(); } if (empty($description)) { - $description = $this->_atom->getDescription(); + $description = $this->getExtension('Atom')->getDescription(); } if (!$description) { @@ -309,12 +294,12 @@ public function getId() $id = $this->_xpath->evaluate('string(/rss/channel/guid)'); } - if (!$id && !is_null($this->_dc)) { - $id = $this->_dc->getId(); + if (!$id && !is_null($this->getExtension('DublinCore'))) { + $id = $this->getExtension('DublinCore')->getId(); } if (empty($id)) { - $id = $this->_atom->getId(); + $id = $this->getExtension('Atom')->getId(); } if (!$id) { @@ -350,12 +335,12 @@ public function getLanguage() $language = $this->_xpath->evaluate('string(/rss/channel/language)'); } - if (!$language && !is_null($this->_dc)) { - $language = $this->_dc->getLanguage(); + if (!$language && !is_null($this->getExtension('DublinCore'))) { + $language = $this->getExtension('DublinCore')->getLanguage(); } if (empty($language)) { - $language = $this->_atom->getLanguage(); + $language = $this->getExtension('Atom')->getLanguage(); } if (!$language) { @@ -392,7 +377,7 @@ public function getLink() } if (empty($link)) { - $link = $this->_atom->getLink(); + $link = $this->getExtension('Atom')->getLink(); } if (!$link) { @@ -417,7 +402,7 @@ public function getFeedLink() $link = null; - $link = $this->_atom->getFeedLink(); + $link = $this->getExtension('Atom')->getFeedLink(); if (!$link) { $link = null; @@ -459,7 +444,7 @@ public function getGenerator() } if (empty($generator)) { - $generator = $this->_atom->getGenerator(); + $generator = $this->getExtension('Atom')->getGenerator(); } if (!$generator) { @@ -491,12 +476,12 @@ public function getTitle() $title = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:title)'); } - if (!$title && !is_null($this->_dc)) { - $title = $this->_dc->getTitle(); + if (!$title && !is_null($this->getExtension('DublinCore'))) { + $title = $this->getExtension('DublinCore')->getTitle(); } if (!$title) { - $title = $this->_atom->getTitle(); + $title = $this->getExtension('Atom')->getTitle(); } if (!$title) { diff --git a/src/Reader/FeedAbstract.php b/src/Reader/FeedAbstract.php index e6171592..ed4c97ee 100644 --- a/src/Reader/FeedAbstract.php +++ b/src/Reader/FeedAbstract.php @@ -261,6 +261,14 @@ public function __call($method, $args) . 'does not exist and could not be located on a registered Extension'); } + public function getExtension($name) + { + if (array_key_exists($name . '_Feed', $this->_extensions)) { + return $this->_extensions[$name . '_Feed']; + } + return null; + } + protected function _loadExtensions() { $all = Zend_Feed_Reader::getExtensions(); @@ -270,7 +278,7 @@ protected function _loadExtensions() continue; } $className = Zend_Feed_Reader::getPluginLoader()->getClassName($extension); - $this->_extensions[$className] = new $className( + $this->_extensions[$extension] = new $className( $this->getDomDocument(), $this->_data['type'], $this->_xpath ); } diff --git a/test/Reader/Feed/CommonTest.php b/test/Reader/Feed/CommonTest.php index 973a7c4e..31c15af6 100644 --- a/test/Reader/Feed/CommonTest.php +++ b/test/Reader/Feed/CommonTest.php @@ -60,5 +60,21 @@ public function testSaveXmlOutputsXmlStringForFeed() $this->assertEquals($feed->saveXml(), file_get_contents($this->_feedSamplePath.'/atom_rewrittenbydom.xml')); } + public function testGetsNamedExtension() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom.xml') + ); + $this->assertTrue($feed->getExtension('Atom') instanceof Zend_Feed_Reader_Extension_Atom_Feed); + } + + public function testReturnsNullIfExtensionDoesNotExist() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom.xml') + ); + $this->assertEquals(null, $feed->getExtension('Foo')); + } + } From 435dd14e11315f8057e5ae7697e31caf10b2ae3d Mon Sep 17 00:00:00 2001 From: padraic Date: Wed, 22 Jul 2009 15:22:18 +0000 Subject: [PATCH 021/238] Added getExtension() to entry level, and refactored internally to use this method in preference to protected vars holding Core Extensions git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16966 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Entry/Atom.php | 48 +++++---------- src/Reader/Entry/Rss.php | 101 +++++++++---------------------- src/Reader/EntryAbstract.php | 16 ++++- src/Reader/FeedAbstract.php | 6 ++ test/Reader/Entry/CommonTest.php | 18 ++++++ 5 files changed, 82 insertions(+), 107 deletions(-) diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index 23a0f234..d2556a0a 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -54,20 +54,6 @@ class Zend_Feed_Reader_Entry_Atom extends Zend_Feed_Reader_EntryAbstract impleme */ protected $_xpathQuery = ''; - /** - * Atom Extension object - * - * @var Zend_Feed_Reader_Extension_Atom_Entry - */ - protected $_atom = null; - - /** - * Thread Extension object - * - * @var Zend_Feed_Reader_Extension_Thread_Entry - */ - protected $_thread = null; - /** * Constructor * @@ -82,12 +68,12 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) // Everyone by now should know XPath indices start from 1 not 0 $this->_xpathQuery = '//atom:entry[' . ($this->_entryKey + 1) . ']'; - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Entry'); - $this->_atom = new $atomClass($entry, $entryKey, $type); + $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Entry'); + $this->_extensions['Atom_Entry'] = new $atomClass($entry, $entryKey, $type); $threadClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Thread_Entry'); - $this->_thread = new $threadClass($entry, $entryKey, $type); + $this->_extensions['Thread_Entry'] = new $threadClass($entry, $entryKey, $type); } /** @@ -118,7 +104,7 @@ public function getAuthors() return $this->_data['authors']; } - $people = $this->_atom->getAuthors(); + $people = $this->getExtension('Atom')->getAuthors(); $this->_data['authors'] = $people; @@ -136,7 +122,7 @@ public function getContent() return $this->_data['content']; } - $content = $this->_atom->getContent(); + $content = $this->getExtension('Atom')->getContent(); $this->_data['content'] = $content; @@ -154,7 +140,7 @@ public function getDateCreated() return $this->_data['datecreated']; } - $dateCreated = $this->_atom->getDateCreated(); + $dateCreated = $this->getExtension('Atom')->getDateCreated(); $this->_data['datecreated'] = $dateCreated; @@ -172,7 +158,7 @@ public function getDateModified() return $this->_data['datemodified']; } - $dateModified = $this->_atom->getDateModified(); + $dateModified = $this->getExtension('Atom')->getDateModified(); $this->_data['datemodified'] = $dateModified; @@ -190,7 +176,7 @@ public function getDescription() return $this->_data['description']; } - $description = $this->_atom->getDescription(); + $description = $this->getExtension('Atom')->getDescription(); $this->_data['description'] = $description; @@ -208,7 +194,7 @@ public function getEnclosure() return $this->_data['enclosure']; } - $enclosure = $this->_atom->getEnclosure(); + $enclosure = $this->getExtension('Atom')->getEnclosure(); $this->_data['enclosure'] = $enclosure; @@ -226,7 +212,7 @@ public function getId() return $this->_data['id']; } - $id = $this->_atom->getId(); + $id = $this->getExtension('Atom')->getId(); $this->_data['id'] = $id; @@ -263,7 +249,7 @@ public function getLinks() return $this->_data['links']; } - $links = $this->_atom->getLinks(); + $links = $this->getExtension('Atom')->getLinks(); $this->_data['links'] = $links; @@ -291,7 +277,7 @@ public function getTitle() return $this->_data['title']; } - $title = $this->_atom->getTitle(); + $title = $this->getExtension('Atom')->getTitle(); $this->_data['title'] = $title; @@ -309,10 +295,10 @@ public function getCommentCount() return $this->_data['commentcount']; } - $commentcount = $this->_thread->getCommentCount(); + $commentcount = $this->getExtension('Thread')>getCommentCount(); if (!$commentcount) { - $commentcount = $this->_atom->getCommentCount(); + $commentcount = $this->getExtension('Atom')->getCommentCount(); } $this->_data['commentcount'] = $commentcount; @@ -331,7 +317,7 @@ public function getCommentLink() return $this->_data['commentlink']; } - $commentlink = $this->_atom->getCommentLink(); + $commentlink = $this->getExtension('Atom')->getCommentLink(); $this->_data['commentlink'] = $commentlink; @@ -349,7 +335,7 @@ public function getCommentFeedLink() return $this->_data['commentfeedlink']; } - $commentfeedlink = $this->_atom->getCommentFeedLink(); + $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink(); $this->_data['commentfeedlink'] = $commentfeedlink; @@ -364,8 +350,6 @@ public function getCommentFeedLink() public function setXpath(DOMXPath $xpath) { parent::setXpath($xpath); - $this->_atom->setXpath($this->_xpath); - $this->_thread->setXpath($this->_xpath); foreach ($this->_extensions as $extension) { $extension->setXpath($this->_xpath); } diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index 2db89763..d5c50eba 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -77,47 +77,6 @@ */ class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_EntryAbstract implements Zend_Feed_Reader_EntryInterface { - /** - * Dublin Core object - * - * @var Zend_Feed_Reader_Extension_DublinCore_Entry - */ - protected $_dc = null; - - /** - * Content Module object - * - * @var Zend_Feed_Reader_Extension_Content_Entry - */ - protected $_content = null; - - /** - * Atom Extension object - * - * @var Zend_Feed_Reader_Extension_Atom_Entry - */ - protected $_atom = null; - - /** - * WellFormedWeb Extension object - * - * @var Zend_Feed_Reader_Extension_WellFormedWeb_Entry - */ - protected $_wfw = null; - - /** - * Slash Extension object - * - * @var Zend_Feed_Reader_Extension_Slash_Entry - */ - protected $_slash = null; - - /** - * Atom Threaded Extension object - * - * @var Zend_Feed_Reader_Extension_Thread_Entry - */ - protected $_thread = null; /** * XPath query for RDF @@ -150,22 +109,22 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) $pluginLoader = Zend_Feed_Reader::getPluginLoader(); $dublinCoreClass = $pluginLoader->getClassName('DublinCore_Entry'); - $this->_dc = new $dublinCoreClass($entry, $entryKey, $type); + $this->_extensions['DublinCore_Entry'] = new $dublinCoreClass($entry, $entryKey, $type); $contentClass = $pluginLoader->getClassName('Content_Entry'); - $this->_content = new $contentClass($entry, $entryKey, $type); + $this->_extensions['Content_Entry'] = new $contentClass($entry, $entryKey, $type); $atomClass = $pluginLoader->getClassName('Atom_Entry'); - $this->_atom = new $atomClass($entry, $entryKey, $type); + $this->_extensions['Atom_Entry'] = new $atomClass($entry, $entryKey, $type); $wfwClass = $pluginLoader->getClassName('WellFormedWeb_Entry'); - $this->_wfw = new $wfwClass($entry, $entryKey, $type); + $this->_extensions['WellFormedWeb_Entry'] = new $wfwClass($entry, $entryKey, $type); $slashClass = $pluginLoader->getClassName('Slash_Entry'); - $this->_slash = new $slashClass($entry, $entryKey, $type); + $this->_extensions['Slash_Entry'] = new $slashClass($entry, $entryKey, $type); $threadClass = $pluginLoader->getClassName('Thread_Entry'); - $this->_thread = new $threadClass($entry, $entryKey, $type); + $this->_extensions['Thread_Entry'] = new $threadClass($entry, $entryKey, $type); } /** @@ -229,11 +188,11 @@ public function getAuthors() } if (empty($authors)) { - $authors = $this->_dc->getAuthors(); + $authors = $this->getExtension('DublinCore')->getAuthors(); } if (empty($authors)) { - $authors = $this->_atom->getAuthors(); + $authors = $this->getExtension('Atom')->getAuthors(); } $this->_data['authors'] = $authors; @@ -252,14 +211,14 @@ public function getContent() return $this->_data['content']; } - $content = $this->_content->getContent(); + $content = $this->getExtension('Content')->getContent(); if (!$content) { $content = $this->getDescription(); } if (empty($content)) { - $content = $this->_atom->getContent(); + $content = $this->getExtension('Atom')->getContent(); } $this->_data['content'] = $content; @@ -318,11 +277,11 @@ public function getDateModified() } if (!$date) { - $date = $this->_dc->getDate(); + $date = $this->getExtension('DublinCore')->getDate(); } if (!$date) { - $date = $this->_atom->getDateModified(); + $date = $this->getExtension('Atom')->getDateModified(); } if (!$date) { @@ -356,11 +315,11 @@ public function getDescription() } if (!$description) { - $description = $this->_dc->getDescription(); + $description = $this->getExtension('DublinCore')->getDescription(); } if (empty($description)) { - $description = $this->_atom->getDescription(); + $description = $this->getExtension('Atom')->getDescription(); } if (!$description) { @@ -376,7 +335,7 @@ public function getDescription() /** * Get the entry enclosure - * + * TODO: Is this supported by RSS? Could delegate to Atom Extension if not. * @return string */ public function getEnclosure() @@ -423,11 +382,11 @@ public function getId() } if (!$id) { - $id = $this->_dc->getId(); + $id = $this->getExtension('DublinCore')->getId(); } if (empty($id)) { - $id = $this->_atom->getId(); + $id = $this->getExtension('Atom')->getId(); } if (!$id) { @@ -485,7 +444,7 @@ public function getLinks() } if (!$list->length) { - $links = $this->_atom->getLinks(); + $links = $this->getExtension('Atom')->getLinks(); } else { foreach ($list as $link) { $links[] = $link->nodeValue; @@ -529,11 +488,11 @@ public function getTitle() } if (!$title) { - $title = $this->_dc->getTitle(); + $title = $this->getExtension('DublinCore')->getTitle(); } if (!$title) { - $title = $this->_atom->getTitle(); + $title = $this->getExtension('Atom')->getTitle(); } if (!$title) { @@ -556,14 +515,14 @@ public function getCommentCount() return $this->_data['commentcount']; } - $commentcount = $this->_slash->getCommentCount(); + $commentcount = $this->getExtension('Slash')->getCommentCount(); if (!$commentcount) { - $commentcount = $this->_thread->getCommentCount(); + $commentcount = $this->getExtension('Thread')->getCommentCount(); } if (!$commentcount) { - $commentcount = $this->_atom->getCommentCount(); + $commentcount = $this->getExtension('Atom')->getCommentCount(); } if (!$commentcount) { @@ -595,7 +554,7 @@ public function getCommentLink() } if (!$commentlink) { - $commentlink = $this->_atom->getCommentLink(); + $commentlink = $this->getExtension('Atom')->getCommentLink(); } if (!$commentlink) { @@ -618,14 +577,14 @@ public function getCommentFeedLink() return $this->_data['commentfeedlink']; } - $commentfeedlink = $this->_wfw->getCommentFeedLink(); + $commentfeedlink = $this->getExtension('WellFormedWeb')->getCommentFeedLink(); if (!$commentfeedlink) { - $commentfeedlink = $this->_atom->getCommentFeedLink('rss'); + $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink('rss'); } if (!$commentfeedlink) { - $commentfeedlink = $this->_atom->getCommentFeedLink('rdf'); + $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink('rdf'); } if (!$commentfeedlink) { @@ -645,12 +604,6 @@ public function getCommentFeedLink() public function setXpath(DOMXPath $xpath) { parent::setXpath($xpath); - $this->_dc->setXpath($this->_xpath); - $this->_content->setXpath($this->_xpath); - $this->_atom->setXpath($this->_xpath); - $this->_slash->setXpath($this->_xpath); - $this->_wfw->setXpath($this->_xpath); - $this->_thread->setXpath($this->_xpath); foreach ($this->_extensions as $extension) { $extension->setXpath($this->_xpath); } diff --git a/src/Reader/EntryAbstract.php b/src/Reader/EntryAbstract.php index a507262b..2c04d99f 100644 --- a/src/Reader/EntryAbstract.php +++ b/src/Reader/EntryAbstract.php @@ -186,6 +186,20 @@ public function getExtensions() return $this->_extensions; } + /** + * Return an Extension object with the matching name (postfixed with _Entry) + * + * @param string $name + * @return Zend_Feed_Reader_Extension_EntryAbstract + */ + public function getExtension($name) + { + if (array_key_exists($name . '_Entry', $this->_extensions)) { + return $this->_extensions[$name . '_Entry']; + } + return null; + } + /** * Method overloading: call given method on first extension implementing it * @@ -220,7 +234,7 @@ protected function _loadExtensions() continue; } $className = Zend_Feed_Reader::getPluginLoader()->getClassName($extension); - $this->_extensions[$className] = new $className( + $this->_extensions[$extension] = new $className( $this->getElement(), $this->_entryKey, $this->_data['type'] ); } diff --git a/src/Reader/FeedAbstract.php b/src/Reader/FeedAbstract.php index ed4c97ee..01581657 100644 --- a/src/Reader/FeedAbstract.php +++ b/src/Reader/FeedAbstract.php @@ -261,6 +261,12 @@ public function __call($method, $args) . 'does not exist and could not be located on a registered Extension'); } + /** + * Return an Extension object with the matching name (postfixed with _Feed) + * + * @param string $name + * @return Zend_Feed_Reader_Extension_FeedAbstract + */ public function getExtension($name) { if (array_key_exists($name . '_Feed', $this->_extensions)) { diff --git a/test/Reader/Entry/CommonTest.php b/test/Reader/Entry/CommonTest.php index c604ca73..2560ffd3 100644 --- a/test/Reader/Entry/CommonTest.php +++ b/test/Reader/Entry/CommonTest.php @@ -65,5 +65,23 @@ public function testSaveXmlOutputsXmlStringForEntry() $this->assertEquals($entry->saveXml(), file_get_contents($this->_feedSamplePath.'/atom_rewrittenbydom.xml')); } + public function testGetsNamedExtension() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom.xml') + ); + $entry = $feed->current(); + $this->assertTrue($entry->getExtension('Atom') instanceof Zend_Feed_Reader_Extension_Atom_Entry); + } + + public function testReturnsNullIfExtensionDoesNotExist() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom.xml') + ); + $entry = $feed->current(); + $this->assertEquals(null, $entry->getExtension('Foo')); + } + } From e5240b199a373a86a1951841a408d26e88a74dbe Mon Sep 17 00:00:00 2001 From: mikaelkael Date: Wed, 22 Jul 2009 18:05:45 +0000 Subject: [PATCH 022/238] ZF-7335: add svn:keyword Id for all files without it git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16971 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Extension/Atom/Entry.php | 2 +- src/Reader/Extension/Atom/Feed.php | 2 +- src/Reader/Extension/Content/Entry.php | 2 +- src/Reader/Extension/CreativeCommons/Entry.php | 2 +- src/Reader/Extension/CreativeCommons/Feed.php | 2 +- src/Reader/Extension/Slash/Entry.php | 2 +- src/Reader/Extension/Syndication/Feed.php | 2 +- src/Reader/Extension/Thread/Entry.php | 2 +- src/Reader/Extension/WellFormedWeb/Entry.php | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index f794415a..04e95336 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -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 16514 2009-07-05 19:59:03Z padraic $ + * @version $Id$ */ /** diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index b9f03e46..10b66529 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -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 16514 2009-07-05 19:59:03Z padraic $ + * @version $Id$ */ /** diff --git a/src/Reader/Extension/Content/Entry.php b/src/Reader/Extension/Content/Entry.php index 4d275424..e3f45563 100644 --- a/src/Reader/Extension/Content/Entry.php +++ b/src/Reader/Extension/Content/Entry.php @@ -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 16506 2009-07-05 12:56:06Z padraic $ + * @version $Id$ */ /** diff --git a/src/Reader/Extension/CreativeCommons/Entry.php b/src/Reader/Extension/CreativeCommons/Entry.php index e754e762..5f63618a 100644 --- a/src/Reader/Extension/CreativeCommons/Entry.php +++ b/src/Reader/Extension/CreativeCommons/Entry.php @@ -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 16514 2009-07-05 19:59:03Z padraic $ + * @version $Id$ */ /** diff --git a/src/Reader/Extension/CreativeCommons/Feed.php b/src/Reader/Extension/CreativeCommons/Feed.php index 67042518..e6e8f517 100644 --- a/src/Reader/Extension/CreativeCommons/Feed.php +++ b/src/Reader/Extension/CreativeCommons/Feed.php @@ -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 16528 2009-07-06 12:02:17Z padraic $ + * @version $Id$ */ /** diff --git a/src/Reader/Extension/Slash/Entry.php b/src/Reader/Extension/Slash/Entry.php index 5556db1a..1ad449c3 100644 --- a/src/Reader/Extension/Slash/Entry.php +++ b/src/Reader/Extension/Slash/Entry.php @@ -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 16514 2009-07-05 19:59:03Z padraic $ + * @version $Id$ */ /** diff --git a/src/Reader/Extension/Syndication/Feed.php b/src/Reader/Extension/Syndication/Feed.php index 22223d79..1839f703 100644 --- a/src/Reader/Extension/Syndication/Feed.php +++ b/src/Reader/Extension/Syndication/Feed.php @@ -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 16528 2009-07-06 12:02:17Z padraic $ + * @version $Id$ */ /** diff --git a/src/Reader/Extension/Thread/Entry.php b/src/Reader/Extension/Thread/Entry.php index 6f32a8a8..cef345a5 100644 --- a/src/Reader/Extension/Thread/Entry.php +++ b/src/Reader/Extension/Thread/Entry.php @@ -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 16514 2009-07-05 19:59:03Z padraic $ + * @version $Id$ */ /** diff --git a/src/Reader/Extension/WellFormedWeb/Entry.php b/src/Reader/Extension/WellFormedWeb/Entry.php index e3ef613c..4feb016d 100644 --- a/src/Reader/Extension/WellFormedWeb/Entry.php +++ b/src/Reader/Extension/WellFormedWeb/Entry.php @@ -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 16514 2009-07-05 19:59:03Z padraic $ + * @version $Id$ */ /** From b717562afb760ef01c38a53d2a2509fbba823243 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 31 Jul 2009 20:42:22 +0000 Subject: [PATCH 023/238] Added xpath getter/mutator for low level access at Extension level git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@17329 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Extension/FeedAbstract.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/Reader/Extension/FeedAbstract.php b/src/Reader/Extension/FeedAbstract.php index c82e8ae0..0abbbdc3 100644 --- a/src/Reader/Extension/FeedAbstract.php +++ b/src/Reader/Extension/FeedAbstract.php @@ -139,7 +139,30 @@ public function toArray() // untested return $this->_data; } - /** + /** + * Set the XPath query + * + * @param DOMXPath $xpath + * @return Zend_Feed_Reader_Extension_EntryAbstract + */ + public function setXpath(DOMXPath $xpath) + { + $this->_xpath = $xpath; + $this->_registerNamespaces(); + return $this; + } + + /** + * Get the DOMXPath object + * + * @return string + */ + public function getXpath() + { + return $this->_xpath; + } + + /** * Get the XPath prefix * * @return string From 74f9e1e1b5e36af3e6ac5597642ba53a51b2ae5b Mon Sep 17 00:00:00 2001 From: padraic Date: Wed, 5 Aug 2009 10:48:09 +0000 Subject: [PATCH 024/238] Switched a logical OR to correct AND on conditional GET checks - fixes ZF-7482 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@17390 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Reader.php b/src/Reader.php index 50d11eeb..5fdd82e2 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -244,7 +244,7 @@ public static function import($uri, $etag = null, $lastModified = null) } } $response = $client->request('GET'); - if ($response->getStatus() !== 200 || $response->getStatus() !== 304) { + if ($response->getStatus() !== 200 && $response->getStatus() !== 304) { require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); } From 71dff4bafcd84402e955648902f67a0a9fa2dd8e Mon Sep 17 00:00:00 2001 From: padraic Date: Wed, 5 Aug 2009 13:50:48 +0000 Subject: [PATCH 025/238] Added new Zend_Feed_Reader test case to attempt replication of ZF-7486 (Cannot Replicate) git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@17394 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/ReaderTest.php | 77 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 2 deletions(-) diff --git a/test/ReaderTest.php b/test/ReaderTest.php index 07d1e260..b2e592b2 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -2,6 +2,7 @@ require_once 'PHPUnit/Framework/TestCase.php'; require_once 'Zend/Feed/Reader.php'; +require_once 'Zend/Cache.php'; class Zend_Feed_ReaderTest extends PHPUnit_Framework_TestCase { @@ -162,9 +163,81 @@ public function testRegistersUserExtension() $this->assertTrue(Zend_Feed_Reader::isRegistered('JungleBooks')); } - /*public function testCanApplyHttpConditionalGetRequest() + /** Test condition for ZF-7486 (Could Not Replicate) **/ + public function testRepeatedFeedImportsWithCacheEnabledDirectOrIndirectDoNotCreateARedeclarationOfAbstractClassFatalError() { + if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + ) { + $this->markTestSkipped('testRepeatedFeedImportsDoNotCreateARedeclarationOfAbstractClassFatalError() requires a network connection'); + return; + } + $frontendOptions = array( + 'lifetime' => 7200, + 'automatic_serialization' => true + ); + $backendOptions = array( + 'cache_dir' => $this->_getTempDirectory() + ); + $cache = Zend_Cache::factory('Core','File',$frontendOptions,$backendOptions); + Zend_Feed_Reader::setCache($cache); + $feed = Zend_Feed_Reader::import('http://www.planet-php.net/rss/'); + $cache->save($feed, 'feed1'); + $feed2 = Zend_Feed_Reader::import('http://www.planet-php.net/rdf/'); + $cache->save($feed, 'feed2'); + $feed3 = Zend_Feed_Reader::import('http://www.planet-php.net/atom/'); + $cache->save($feed, 'feed3'); + $feed4 = Zend_Feed_Reader::import('http://www.phpdeveloper.org/feed'); + $cache->save($feed, 'feed4'); + $feedFromCache = $cache->load('feed4'); + $this->assertTrue($feedFromCache instanceof Zend_Feed_Reader_FeedAbstract); + } + + protected function _getTempDirectory() + { + $tmpdir = array(); + foreach (array($_ENV, $_SERVER) as $tab) { + foreach (array('TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot') as $key) { + if (isset($tab[$key])) { + if (($key == 'windir') or ($key == 'SystemRoot')) { + $dir = realpath($tab[$key] . '\\temp'); + } else { + $dir = realpath($tab[$key]); + } + if ($this->_isGoodTmpDir($dir)) { + return $dir; + } + } + } + } + if (function_exists('sys_get_temp_dir')) { + $dir = sys_get_temp_dir(); + if ($this->_isGoodTmpDir($dir)) { + return $dir; + } + } + $tempFile = tempnam(md5(uniqid(rand(), TRUE)), ''); + if ($tempFile) { + $dir = realpath(dirname($tempFile)); + unlink($tempFile); + if ($this->_isGoodTmpDir($dir)) { + return $dir; + } + } + if ($this->_isGoodTmpDir('/tmp')) { + return '/tmp'; + } + if ($this->_isGoodTmpDir('\\temp')) { + return '\\temp'; + } + } - }*/ + protected function _isGoodTmpDir($dir) + { + if (is_readable($dir) && is_writable($dir)) { + return true; + } + return false; + } } From 1449b80ba9e188b2a1e5d3620cf30ef224daf81b Mon Sep 17 00:00:00 2001 From: padraic Date: Wed, 5 Aug 2009 13:54:40 +0000 Subject: [PATCH 026/238] Amended last test case to check default cache is storing/loading right instance git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@17395 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/ReaderTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/ReaderTest.php b/test/ReaderTest.php index b2e592b2..d4211361 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -189,8 +189,11 @@ public function testRepeatedFeedImportsWithCacheEnabledDirectOrIndirectDoNotCrea $cache->save($feed, 'feed3'); $feed4 = Zend_Feed_Reader::import('http://www.phpdeveloper.org/feed'); $cache->save($feed, 'feed4'); - $feedFromCache = $cache->load('feed4'); + $feedXmlFromCache = $cache->load('Zend_Feed_Reader_' . md5('http://www.planet-php.net/rss/')); + $feedFromCache = Zend_Feed_Reader::importString($feedXmlFromCache); $this->assertTrue($feedFromCache instanceof Zend_Feed_Reader_FeedAbstract); + $feedFromCache2 = $cache->load('feed4'); + $this->assertTrue($feedFromCache2 instanceof Zend_Feed_Reader_FeedAbstract); } protected function _getTempDirectory() From a3aef0e96a39b22e4c80b61c3ce9a2bb6fdad011 Mon Sep 17 00:00:00 2001 From: alexander Date: Thu, 13 Aug 2009 18:01:41 +0000 Subject: [PATCH 027/238] Merge cs-17363 back to trunk. [ZF-7581] related. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@17573 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/AllTests.php | 2 +- test/ArrayAccessTest.php | 5 +--- test/AtomEntryOnlyTest.php | 4 +-- test/AtomPublishingTest.php | 4 +-- test/CountTest.php | 4 +-- test/ElementTest.php | 4 +-- test/Entry/RssTest.php | 4 +-- test/ImportTest.php | 4 +-- test/IteratorTest.php | 4 +-- test/Reader/Entry/AtomTest.php | 29 +++++++++++++++++++ test/Reader/Entry/CommonTest.php | 29 +++++++++++++++++++ test/Reader/Entry/RssTest.php | 29 +++++++++++++++++++ test/Reader/Feed/AtomTest.php | 29 +++++++++++++++++++ test/Reader/Feed/CommonTest.php | 29 +++++++++++++++++++ test/Reader/Feed/RssTest.php | 29 +++++++++++++++++++ .../Integration/H-OnlineComAtom10Test.php | 29 +++++++++++++++++++ test/Reader/Integration/LautDeRdfTest.php | 29 +++++++++++++++++++ test/Reader/Integration/PodcastRss2Test.php | 29 +++++++++++++++++++ .../Integration/WordpressAtom10Test.php | 29 +++++++++++++++++++ .../Integration/WordpressRss2DcAtomTest.php | 29 +++++++++++++++++++ .../_files/My/Extension/JungleBooks/Entry.php | 27 +++++++++++++++++ .../_files/My/Extension/JungleBooks/Feed.php | 27 +++++++++++++++++ test/ReaderTest.php | 29 +++++++++++++++++++ 23 files changed, 411 insertions(+), 26 deletions(-) diff --git a/test/AllTests.php b/test/AllTests.php index 0576453a..145d417c 100644 --- a/test/AllTests.php +++ b/test/AllTests.php @@ -1,5 +1,4 @@ Date: Tue, 18 Aug 2009 21:40:09 +0000 Subject: [PATCH 028/238] ZF-7335 : TESTS - add missing svn:keywords git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@17667 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Reader/Entry/CommonTest.php | 2 +- test/Reader/Feed/CommonTest.php | 2 +- test/Reader/Integration/H-OnlineComAtom10Test.php | 2 +- test/Reader/Integration/LautDeRdfTest.php | 2 +- test/Reader/Integration/WordpressAtom10Test.php | 2 +- test/Reader/Integration/WordpressRss2DcAtomTest.php | 2 +- test/Reader/_files/My/Extension/JungleBooks/Entry.php | 2 +- test/Reader/_files/My/Extension/JungleBooks/Feed.php | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/Reader/Entry/CommonTest.php b/test/Reader/Entry/CommonTest.php index c7d9965b..d6cb6a30 100644 --- a/test/Reader/Entry/CommonTest.php +++ b/test/Reader/Entry/CommonTest.php @@ -17,7 +17,7 @@ * @subpackage UnitTests * @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:$ + * @version $Id$ */ require_once 'PHPUnit/Framework/TestCase.php'; diff --git a/test/Reader/Feed/CommonTest.php b/test/Reader/Feed/CommonTest.php index e4f533ea..a416d195 100644 --- a/test/Reader/Feed/CommonTest.php +++ b/test/Reader/Feed/CommonTest.php @@ -17,7 +17,7 @@ * @subpackage UnitTests * @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:$ + * @version $Id$ */ require_once 'PHPUnit/Framework/TestCase.php'; diff --git a/test/Reader/Integration/H-OnlineComAtom10Test.php b/test/Reader/Integration/H-OnlineComAtom10Test.php index 30878cfe..b69554fe 100644 --- a/test/Reader/Integration/H-OnlineComAtom10Test.php +++ b/test/Reader/Integration/H-OnlineComAtom10Test.php @@ -17,7 +17,7 @@ * @subpackage UnitTests * @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:$ + * @version $Id$ */ require_once 'PHPUnit/Framework/TestCase.php'; diff --git a/test/Reader/Integration/LautDeRdfTest.php b/test/Reader/Integration/LautDeRdfTest.php index d271e68c..b49df2a4 100644 --- a/test/Reader/Integration/LautDeRdfTest.php +++ b/test/Reader/Integration/LautDeRdfTest.php @@ -17,7 +17,7 @@ * @subpackage UnitTests * @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:$ + * @version $Id$ */ require_once 'PHPUnit/Framework/TestCase.php'; diff --git a/test/Reader/Integration/WordpressAtom10Test.php b/test/Reader/Integration/WordpressAtom10Test.php index cba9bece..d42a786c 100644 --- a/test/Reader/Integration/WordpressAtom10Test.php +++ b/test/Reader/Integration/WordpressAtom10Test.php @@ -17,7 +17,7 @@ * @subpackage UnitTests * @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:$ + * @version $Id$ */ require_once 'PHPUnit/Framework/TestCase.php'; diff --git a/test/Reader/Integration/WordpressRss2DcAtomTest.php b/test/Reader/Integration/WordpressRss2DcAtomTest.php index 6d8c2dad..5126fa0a 100644 --- a/test/Reader/Integration/WordpressRss2DcAtomTest.php +++ b/test/Reader/Integration/WordpressRss2DcAtomTest.php @@ -17,7 +17,7 @@ * @subpackage UnitTests * @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:$ + * @version $Id$ */ require_once 'PHPUnit/Framework/TestCase.php'; diff --git a/test/Reader/_files/My/Extension/JungleBooks/Entry.php b/test/Reader/_files/My/Extension/JungleBooks/Entry.php index 2913477f..0f3b7697 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Entry.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Entry.php @@ -17,7 +17,7 @@ * @subpackage UnitTests * @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: $ + * @version $Id$ */ require_once 'Zend/Feed/Reader.php'; diff --git a/test/Reader/_files/My/Extension/JungleBooks/Feed.php b/test/Reader/_files/My/Extension/JungleBooks/Feed.php index 2fccceba..2f8af165 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Feed.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Feed.php @@ -17,7 +17,7 @@ * @subpackage UnitTests * @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: $ + * @version $Id$ */ require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; From 065900d9f7302bddbf3dbea54a8c87c44b347abf Mon Sep 17 00:00:00 2001 From: thomas Date: Thu, 20 Aug 2009 12:55:34 +0000 Subject: [PATCH 029/238] [ZF-7316] Code cleaning: - reverted CRLF (Win*) to LF (*nix) - reverted TABS to 4 spaces - erased ending spaces used revision 17680 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@17687 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Abstract.php | 6 ++-- src/Atom.php | 4 +-- src/Builder/Header/Itunes.php | 8 ++--- src/Element.php | 2 +- src/Entry/Abstract.php | 4 +-- src/Entry/Atom.php | 8 ++--- src/Entry/Rss.php | 2 +- src/Reader.php | 36 +++++++++---------- src/Reader/Entry/Atom.php | 2 +- src/Reader/EntryAbstract.php | 4 +-- src/Reader/Extension/Atom/Entry.php | 2 +- src/Reader/Extension/Atom/Feed.php | 8 ++--- src/Reader/Extension/Content/Entry.php | 4 +-- src/Reader/Extension/CreativeCommons/Feed.php | 2 +- src/Reader/Extension/DublinCore/Entry.php | 4 +-- src/Reader/Extension/DublinCore/Feed.php | 4 +-- src/Reader/Extension/EntryAbstract.php | 12 +++---- src/Reader/Extension/FeedAbstract.php | 6 ++-- src/Reader/Extension/Slash/Entry.php | 2 +- src/Reader/Extension/Syndication/Feed.php | 12 +++---- src/Reader/Extension/Thread/Entry.php | 4 +-- src/Reader/Extension/WellFormedWeb/Entry.php | 2 +- src/Reader/Feed/Atom.php | 4 +-- src/Reader/Feed/Rss.php | 6 ++-- src/Reader/FeedAbstract.php | 10 +++--- src/Rss.php | 2 +- 26 files changed, 80 insertions(+), 80 deletions(-) diff --git a/src/Abstract.php b/src/Abstract.php index 11e4fadf..d3737425 100644 --- a/src/Abstract.php +++ b/src/Abstract.php @@ -77,7 +77,7 @@ public function __construct($uri = null, $string = null, Zend_Feed_Builder_Inter $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 @@ public function __wakeup() $php_errormsg = '(error message not available)'; } } - - /** + + /** * @see Zend_Feed_Exception */ require_once 'Zend/Feed/Exception.php'; diff --git a/src/Atom.php b/src/Atom.php index a083bf2e..d884a8b3 100644 --- a/src/Atom.php +++ b/src/Atom.php @@ -89,7 +89,7 @@ public function __wakeup() // Try to find a single 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 @@ public function saveXml() public function send() { if (headers_sent()) { - /** + /** * @see Zend_Feed_Exception */ require_once 'Zend/Feed/Exception.php'; diff --git a/src/Builder/Header/Itunes.php b/src/Builder/Header/Itunes.php index 52c91771..79fca07e 100644 --- a/src/Builder/Header/Itunes.php +++ b/src/Builder/Header/Itunes.php @@ -112,10 +112,10 @@ public function setAuthor($author) 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)) { /** diff --git a/src/Element.php b/src/Element.php index 9ea45dc2..c21c6b0f 100644 --- a/src/Element.php +++ b/src/Element.php @@ -211,7 +211,7 @@ public function __set($var, $val) $this->_element->appendChild($node); } } elseif (count($nodes) > 1) { - /** + /** * @see Zend_Feed_Exception */ require_once 'Zend/Feed/Exception.php'; diff --git a/src/Entry/Abstract.php b/src/Entry/Abstract.php index d6573bc1..374f1f58 100644 --- a/src/Entry/Abstract.php +++ b/src/Entry/Abstract.php @@ -93,7 +93,7 @@ public function __construct($uri = null, $element = null) } } - /** + /** * @see Zend_Feed_Exception */ require_once 'Zend/Feed/Exception.php'; @@ -102,7 +102,7 @@ public function __construct($uri = null, $element = null) $element = $doc->getElementsByTagName($this->_rootElement)->item(0); if (!$element) { - /** + /** * @see Zend_Feed_Exception */ require_once 'Zend/Feed/Exception.php'; diff --git a/src/Entry/Atom.php b/src/Entry/Atom.php index 414e6e17..93aad852 100644 --- a/src/Entry/Atom.php +++ b/src/Entry/Atom.php @@ -37,10 +37,10 @@ */ 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. diff --git a/src/Entry/Rss.php b/src/Entry/Rss.php index 96c66df4..43224264 100644 --- a/src/Entry/Rss.php +++ b/src/Entry/Rss.php @@ -98,7 +98,7 @@ public function __isset($var) return parent::__isset($var); } } - + /** * Overwrites parent::_call method to enable read access * to content:encoded element. diff --git a/src/Reader.php b/src/Reader.php index 5fdd82e2..d741d9ab 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -42,20 +42,20 @@ */ 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 +208,13 @@ public static function useHttpConditionalGet($bool = true) } /** - * 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_Feed_Interface + */ public static function import($uri, $etag = null, $lastModified = null) { $cache = self::getCache(); @@ -289,7 +289,7 @@ public static function import($uri, $etag = null, $lastModified = null) * * @param Zend_Feed_Abstract $feed A fully instantiated Zend_Feed object * @return Zend_Feed_Reader_Feed_Interface - */ + */ public static function importFeed(Zend_Feed_Abstract $feed) { $dom = $feed->getDOM()->ownerDocument; @@ -298,7 +298,7 @@ public static function importFeed(Zend_Feed_Abstract $feed) 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; @@ -321,9 +321,9 @@ public static function importString($string) // 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'; @@ -337,7 +337,7 @@ public static function importString($string) 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; } diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index d2556a0a..86721f93 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -76,7 +76,7 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) $this->_extensions['Thread_Entry'] = new $threadClass($entry, $entryKey, $type); } - /** + /** * Get the specified author * * @param int $index diff --git a/src/Reader/EntryAbstract.php b/src/Reader/EntryAbstract.php index 2c04d99f..94cbe7e4 100644 --- a/src/Reader/EntryAbstract.php +++ b/src/Reader/EntryAbstract.php @@ -134,7 +134,7 @@ public function saveXml() return $dom->saveXml(); } - /** + /** * Get the entry type * * @return string @@ -154,7 +154,7 @@ public function getXpath() return $this->_xpath; } - /** + /** * Set the XPath query * * @param DOMXPath $xpath diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 04e95336..8d270e88 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -43,7 +43,7 @@ class Zend_Feed_Reader_Extension_Atom_Entry extends Zend_Feed_Reader_Extension_EntryAbstract { - /** + /** * Get the specified author * * @param int $index diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index 10b66529..a7e616e5 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -35,7 +35,7 @@ * @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 +240,7 @@ public function getGenerator() return $this->_data['generator']; } - /** + /** * Get the feed ID * * @return string|null @@ -360,7 +360,7 @@ public function getTitle() return $this->_data['title']; } - /** + /** * Get an author entry in RSS format * * @param DOMElement $element @@ -404,7 +404,7 @@ protected function _getAuthor(DOMElement $element) */ 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 diff --git a/src/Reader/Extension/Content/Entry.php b/src/Reader/Extension/Content/Entry.php index e3f45563..956a1c7b 100644 --- a/src/Reader/Extension/Content/Entry.php +++ b/src/Reader/Extension/Content/Entry.php @@ -35,13 +35,13 @@ * @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)'); diff --git a/src/Reader/Extension/CreativeCommons/Feed.php b/src/Reader/Extension/CreativeCommons/Feed.php index e6e8f517..101d6a36 100644 --- a/src/Reader/Extension/CreativeCommons/Feed.php +++ b/src/Reader/Extension/CreativeCommons/Feed.php @@ -30,7 +30,7 @@ * @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 { /** diff --git a/src/Reader/Extension/DublinCore/Entry.php b/src/Reader/Extension/DublinCore/Entry.php index 441d0e58..4f3f13ee 100644 --- a/src/Reader/Extension/DublinCore/Entry.php +++ b/src/Reader/Extension/DublinCore/Entry.php @@ -40,7 +40,7 @@ * @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 @@ public function getAuthors() 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]; diff --git a/src/Reader/Extension/DublinCore/Feed.php b/src/Reader/Extension/DublinCore/Feed.php index 6ba99c25..15f2fcc0 100644 --- a/src/Reader/Extension/DublinCore/Feed.php +++ b/src/Reader/Extension/DublinCore/Feed.php @@ -35,10 +35,10 @@ * @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 diff --git a/src/Reader/Extension/EntryAbstract.php b/src/Reader/Extension/EntryAbstract.php index 249259e7..11ef1b60 100644 --- a/src/Reader/Extension/EntryAbstract.php +++ b/src/Reader/Extension/EntryAbstract.php @@ -89,11 +89,11 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) $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 @@ public function getEncoding() return $assumed; } - /** + /** * Get the entry type * * @return string @@ -178,8 +178,8 @@ public function getXpathPrefix() /** * Set the XPath prefix - * - * @param string $prefix + * + * @param string $prefix * @return Zend_Feed_Reader_Extension_EntryAbstract */ public function setXpathPrefix($prefix) @@ -190,7 +190,7 @@ public function setXpathPrefix($prefix) /** * Register XML namespaces - * + * * @return void */ protected abstract function _registerNamespaces(); diff --git a/src/Reader/Extension/FeedAbstract.php b/src/Reader/Extension/FeedAbstract.php index 0abbbdc3..9897a791 100644 --- a/src/Reader/Extension/FeedAbstract.php +++ b/src/Reader/Extension/FeedAbstract.php @@ -43,7 +43,7 @@ */ abstract class Zend_Feed_Reader_Extension_FeedAbstract { - /** + /** * Parsed feed data * * @var array @@ -164,8 +164,8 @@ public function getXpath() /** * Get the XPath prefix - * - * @return string + * + * @return string */ public function getXpathPrefix() { diff --git a/src/Reader/Extension/Slash/Entry.php b/src/Reader/Extension/Slash/Entry.php index 1ad449c3..b306ac30 100644 --- a/src/Reader/Extension/Slash/Entry.php +++ b/src/Reader/Extension/Slash/Entry.php @@ -35,7 +35,7 @@ * @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 { /** diff --git a/src/Reader/Extension/Syndication/Feed.php b/src/Reader/Extension/Syndication/Feed.php index 1839f703..c927db17 100644 --- a/src/Reader/Extension/Syndication/Feed.php +++ b/src/Reader/Extension/Syndication/Feed.php @@ -32,7 +32,7 @@ * @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 @@ public function getUpdatePeriod() 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 @@ public function getUpdateFrequencyAsTicks() 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() diff --git a/src/Reader/Extension/Thread/Entry.php b/src/Reader/Extension/Thread/Entry.php index cef345a5..13bd9638 100644 --- a/src/Reader/Extension/Thread/Entry.php +++ b/src/Reader/Extension/Thread/Entry.php @@ -30,12 +30,12 @@ * @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() diff --git a/src/Reader/Extension/WellFormedWeb/Entry.php b/src/Reader/Extension/WellFormedWeb/Entry.php index 4feb016d..192504c7 100644 --- a/src/Reader/Extension/WellFormedWeb/Entry.php +++ b/src/Reader/Extension/WellFormedWeb/Entry.php @@ -35,7 +35,7 @@ * @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 { /** diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index f9080efa..5b41434b 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -196,7 +196,7 @@ public function getGenerator() return $this->_data['generator']; } - /** + /** * Get the feed ID * * @return string|null @@ -294,7 +294,7 @@ public function getTitle() return $this->_data['title']; } - /** + /** * Read all entries to the internal entries array * */ diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 491b3816..023711ed 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -74,7 +74,7 @@ public function __construct(DomDocument $dom, $type = null) } } - /** + /** * Get a single author * * @param int $index @@ -170,7 +170,7 @@ public function getCopyright() return $this->_data['copyright']; } - /** + /** * Get the feed creation date * * @return string|null @@ -493,7 +493,7 @@ public function getTitle() return $this->_data['title']; } - /** + /** * Read all entries to the internal entries array * */ diff --git a/src/Reader/FeedAbstract.php b/src/Reader/FeedAbstract.php index 01581657..f769cca0 100644 --- a/src/Reader/FeedAbstract.php +++ b/src/Reader/FeedAbstract.php @@ -48,7 +48,7 @@ */ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInterface { - /** + /** * Parsed feed data * * @var array @@ -106,7 +106,7 @@ public function __construct(DomDocument $domDocument, $type = null) $this->_loadExtensions(); } - /** + /** * Get the number of feed entries. * Required by the Iterator interface. * @@ -117,7 +117,7 @@ public function count() return count($this->_entries); } - /** + /** * Return the current entry * * @return Zend_Feed_Reader_Entry_Interface @@ -196,7 +196,7 @@ public function getType() return $this->_data['type']; } - /** + /** * Return the current feed key * * @return unknown @@ -206,7 +206,7 @@ public function key() return $this->_entriesKey; } - /** + /** * Move the feed pointer forward * */ diff --git a/src/Rss.php b/src/Rss.php index c825cb58..7a2397d5 100644 --- a/src/Rss.php +++ b/src/Rss.php @@ -82,7 +82,7 @@ public function __wakeup() // 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); } From 9a7707628d57ee5c0755f9bb0114437e4ddf339d Mon Sep 17 00:00:00 2001 From: padraic Date: Thu, 17 Sep 2009 18:25:12 +0000 Subject: [PATCH 030/238] Added check to Atom Entry class to accept links with a missing rel attribute as having a default rel of alternate - fixes ZF-5354 when querying a feed's entries git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18183 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Entry/Atom.php | 2 +- test/ArrayAccessTest.php | 10 + test/_files/AtomHOnline.xml | 554 ++++++++++++++++++++++++++++++++++++ 3 files changed, 565 insertions(+), 1 deletion(-) create mode 100644 test/_files/AtomHOnline.xml diff --git a/src/Entry/Atom.php b/src/Entry/Atom.php index 93aad852..f46edab6 100644 --- a/src/Entry/Atom.php +++ b/src/Entry/Atom.php @@ -267,7 +267,7 @@ public function link($rel = null) foreach ($links as $link) { if (empty($link['rel'])) { - continue; + $link['rel'] = 'alternate'; // see Atom 1.0 spec } if ($rel == $link['rel']) { return $link['href']; diff --git a/test/ArrayAccessTest.php b/test/ArrayAccessTest.php index 874632d7..e0b8cdef 100644 --- a/test/ArrayAccessTest.php +++ b/test/ArrayAccessTest.php @@ -93,4 +93,14 @@ public function testUnset() $this->assertEquals('', $nsfeed['version'], 'Version should be equal to the empty string'); } + /** + * @issue ZF-5354 + */ + public function testGetsLinkWithEmptyOrMissingRelAsAlternateRel() + { + $feed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/AtomHOnline.xml'); + $entry = $feed->current(); + $this->assertEquals('http://www.h-online.com/security/Google-acquires-reCAPTCHA--/news/114266/from/rss', $entry->link('alternate')); + } + } diff --git a/test/_files/AtomHOnline.xml b/test/_files/AtomHOnline.xml new file mode 100644 index 00000000..c1d6daa5 --- /dev/null +++ b/test/_files/AtomHOnline.xml @@ -0,0 +1,554 @@ + + + + +The H - news feed +Technology news + + +2009-09-17T17:39:21+02:00 + +The H + +http://www.h-online.com/security/Google-acquires-reCAPTCHA--/news/114266/from/rss + + + Google acquires reCAPTCHA + + Google has announced that it has acquired reCAPTCHA, one of the leading providers of CAPTCHAs which are used in authentication tests + http://www.h-online.com/security/Google-acquires-reCAPTCHA--/news/114266/from/rss + 2009-09-17T17:39:21+02:00 + + + + + Lost+Found: Password shaking, macro viruses and comment spam + + Too short for news, too good to lose; lost+found is a round up of useful security information. Today, Password shaking, macro viruses and comment spam + http://www.h-online.com/security/Lost-Found-Password-shaking-macro-viruses-and-comment-spam--/news/114265/from/rss + 2009-09-17T16:29:59+02:00 + + + + + Free Microsoft tools for detecting security problems + + Microsoft has made two free tools for detecting holes in applications available to developers. For quite some time Redmond's own developers have been using these tools within the Security Development Life cycle + http://www.h-online.com/security/Free-Microsoft-tools-for-detecting-security-problems--/news/114264/from/rss + 2009-09-17T16:00:48+02:00 + + + + + Chatting with a phisher + + After Man-in-the-Middle attacks we now have Chat-in-the-Middle attacks on online banking customers. These pop up a chat window in the browser - and a phisher, posing as a bank representative, starts asking probing questions + http://www.h-online.com/security/Chatting-with-a-phisher--/news/114263/from/rss + 2009-09-17T15:20:05+02:00 + + + + + Noop - a new language for the JVM + + Noop is a new language for the JVM which aims to make coding more productive and reliable by making dependency injection and testing fundamental to the language + http://www.h-online.com/open/Noop-a-new-language-for-the-JVM--/news/114262/from/rss + 2009-09-17T13:14:06+02:00 + + + + + Version 4.2 of OSGi Java component technology available + + Version 4.2 of the OSGi component technology, which is popular in the Java world, is now available to download. Almost all Java EE application servers are based on this specification + http://www.h-online.com/open/Version-4-2-of-OSGi-Java-component-technology-available--/news/114261/from/rss + 2009-09-17T11:53:12+02:00 + + + + + DragonFly BSD 2.4 released + + The DragonFly BSD project has announced the availability of version 2.4 of their FreeBSD fork, a major update that includes several bug fixes, performance improvements and a new 64-bit port + http://www.h-online.com/open/DragonFly-BSD-2-4-released--/news/114260/from/rss + 2009-09-17T11:16:08+02:00 + + + + + Privacy for RFID tags + + Wholesale RFID tagging poses a risk to privacy. A research team has proposed distributing keys as a method of ensuring privacy + http://www.h-online.com/security/Privacy-for-RFID-tags--/news/114259/from/rss + 2009-09-17T09:48:38+02:00 + + + + + Firefox Flash check working + + In one week, ten million Firefox users have responded to Firefox's recently added Adobe Flash checks + http://www.h-online.com/security/Firefox-Flash-check-working--/news/114258/from/rss + 2009-09-17T10:44:58+02:00 + + + + + Nominations open for the Free Software Awards + + The FSF has opened nominations for 2009's Free Software Awards, and is looking for nominations for individuals and projects + http://www.h-online.com/open/Nominations-open-for-the-Free-Software-Awards--/news/114257/from/rss + 2009-09-16T20:06:38+02:00 + + + + + ClarkConnect becomes ClearOS + + The ClearFoundation is hoping to scale new heights with ClearOS [--] the Linux-based small business server, a successor to ClarkConnect, which will now be free to use, with the income stream coming from related services + http://www.h-online.com/open/ClarkConnect-becomes-ClearOS--/news/114256/from/rss + 2009-09-16T18:58:00+02:00 + + + + + GitHub to move to Rackspace + + GitHub co-founder Tom Preston-Werner has announced that the open source code hosting service will be moving its servers from Engine Yard to Rackspace + http://www.h-online.com/open/GitHub-to-move-to-Rackspace--/news/114255/from/rss + 2009-09-16T18:23:09+02:00 + + + + + KOffice 2.1 Beta 2 released + + The KOffice developers have released the second beta of version 2.1 of their open source office suite, which includes a number of bug fixes, new features and performance improvements + http://www.h-online.com/open/KOffice-2-1-Beta-2-released--/news/114253/from/rss + 2009-09-16T16:34:45+02:00 + + + + + MonitoringForge uncovered by GroundWork + + GroundWork has revealed its new community for open source network monitoring and management + http://www.h-online.com/open/MonitoringForge-uncovered-by-GroundWork--/news/114254/from/rss + 2009-09-16T16:32:06+02:00 + + + + + Companies have wrong priorities for security updates + + Although attacks on Windows PCs nowadays almost exclusively exploit vulnerabilities in applications, it takes twice as long for security updates for applications to be installed as it does to plug vulnerabilities in the operating system + http://www.h-online.com/security/Companies-have-wrong-priorities-for-security-updates--/news/114252/from/rss + 2009-09-16T15:07:52+02:00 + + + + + Jaspersoft launches JasperReports Professional Developer Edition + + Open source Business Intelligence software specialist Jaspersoft has announced the immediate availability of a new version of JasperReports Professional and has introduced JasperReports Professional Developer Edition + http://www.h-online.com/open/Jaspersoft-launches-JasperReports-Professional-Developer-Edition--/news/114251/from/rss + 2009-09-16T13:12:54+02:00 + + + + + Google Android 1.6 SDK released + + The Google Android Developers have announced the release of the Android 1.6, code name Donut, software development kit + http://www.h-online.com/open/Google-Android-1-6-SDK-released--/news/114249/from/rss + 2009-09-16T12:30:13+02:00 + + + + + Oracle Enterprise Linux updated + + Oracle updates its RHEL clone, Unbreakable Linux, to keep in step with Red Hat Enterprise Linux + http://www.h-online.com/open/Oracle-Enterprise-Linux-updated--/news/114250/from/rss + 2009-09-16T11:46:25+02:00 + + + + + Terracotta 3.1 supports Hibernate + + Distributed caching for Hibernate queries comes to Terracotta's caching system with version 3.1's new Hibernate plug-in + http://www.h-online.com/open/Terracotta-3-1-supports-Hibernate--/news/114248/from/rss + 2009-09-16T11:30:17+02:00 + + + + + Google Chrome 3.0 released + + Just over one year after Google's Chrome web browser was originally launched, Google has announced the release of Chrome version 3 which includes several bug fixes, improvements and new features + http://www.h-online.com/security/Google-Chrome-3-0-released--/news/114247/from/rss + 2009-09-16T11:18:46+02:00 + + + + + MySpace bring open source MapReduce to .NET + + MySpace have released Quizmt, an implementation of MapReduce algorithms for clustered computing running on Windows and .NET + http://www.h-online.com/open/MySpace-bring-open-source-MapReduce-to-NET--/news/114246/from/rss + 2009-09-17T12:07:01+02:00 + + + + + GNOME Foundation releases first quarterly report + + The GNOME Foundation has released its first quarterly report. The Q2 2009 Quarterly report spans June, July and August and covers several topics, including the projects migration to Git + http://www.h-online.com/open/GNOME-Foundation-releases-first-quarterly-report--/news/114244/from/rss + 2009-09-15T17:29:49+02:00 + + + + + Live video stream of LinuxCon 2009 highlights + + Highlights of the Linux Foundation conference LinuxCon 2009, taking place from the 21st to the 23rd of September are to be available as a live internet broadcast. Keynote speakers include Joe Brockmeier, Bdale Garbee and Mark Shuttleworth + http://www.h-online.com/open/Live-video-stream-of-LinuxCon-2009-highlights--/news/114245/from/rss + 2009-09-15T17:22:22+02:00 + + + + + Anonymous browsing on Android + + A group of developers at the Digital Technology Group at the University of Cambridge have released two Android applications that allow users browse the web anonymously using The Onion Router + http://www.h-online.com/security/Anonymous-browsing-on-Android--/news/114243/from/rss + 2009-09-15T16:25:05+02:00 + + + + + New York Times shows bad banner ad + + Over the weekend, visitors to the newspaper's website were confronted with scareware pop-ups telling them that their PCs had an infection. In order to place their fake banner ad, the scammers had passed themselves off as a well-known company + http://www.h-online.com/security/New-York-Times-shows-bad-banner-ad--/news/114242/from/rss + 2009-09-15T14:31:25+02:00 + + + + + Referential integrity for Berkeley DB + + Oracle has added foreign keys and a C# interface to its free Berkeley DB + http://www.h-online.com/open/Referential-integrity-for-Berkeley-DB--/news/114241/from/rss + 2009-09-15T13:49:10+02:00 + + + + + Horde vulnerabilities fixed + + New versions of the Horde Application Framework, Horde Groupware and various other Horde applications fix two cross-site scripting vulnerabilities and one vulnerability which allows files to be overwritten + http://www.h-online.com/security/Horde-vulnerabilities-fixed--/news/114240/from/rss + 2009-09-15T11:59:43+02:00 + + + + + openSUSE 11.2 Milestone 7 released + + The openSUSE project has released the seventh milestone in the development of openSUSE 11.2, code named Fichte + http://www.h-online.com/open/openSUSE-11-2-Milestone-7-released--/news/114238/from/rss + 2009-09-15T11:51:52+02:00 + + + + + Security updates for Bugzilla + + The developers of the Bugzilla open source bug tracking system have released versions 3.0.9, 3.2.5 and 3.4.2, which fix SQL injection vulnerabilities and remove a means of sniffing out a user's password + http://www.h-online.com/security/Security-updates-for-Bugzilla--/news/114239/from/rss + 2009-09-15T11:12:10+02:00 + + + + + Microsoft says "We are working on our Linux drivers" + + Microsoft's Sam Ramji says the company is working on their Linux Hyper-V drivers and has not abandoned them + http://www.h-online.com/open/Microsoft-says-We-are-working-on-our-Linux-drivers--/news/114237/from/rss + 2009-09-15T09:48:54+02:00 + + + + + The Linux Foundation welcomes ARM + + The microprocessor and microcontroller manufacturer has joined the Linux Foundation. ARM processors are used in a large number of Linux driven mobile devices + http://www.h-online.com/open/The-Linux-Foundation-welcomes-ARM--/news/114236/from/rss + 2009-09-15T12:43:47+02:00 + + + + + CodePlex Foundation founding flawed says legal expert + + Andrew Updegrove, of Gesmer Updegrove LLP, has documented his concerns with the founding of Microsoft's CodePlex Foundation + http://www.h-online.com/open/CodePlex-Foundation-founding-flawed-says-legal-expert--/news/114235/from/rss + 2009-09-14T18:05:10+02:00 + + + + + SystemRescueCd 1.3.0 released + + The SystemRescueCD developers have released version 1.3.0 of their Linux distribution for administering or repairing an operating system and recovering data after a system crash + http://www.h-online.com/open/SystemRescueCd-1-3-0-released--/news/114234/from/rss + 2009-09-14T17:30:13+02:00 + + + + + First Alpha of BeOS-inspired Haiku released + + After eight years of development, the Haiku Project developers have announced the availability of the first official development release of Haiku + http://www.h-online.com/open/First-Alpha-of-BeOS-inspired-Haiku-released--/news/114232/from/rss + 2009-09-14T17:09:46+02:00 + + + + + eyeOS 2.0 rethinks its webtop for 2010 + + In 2010, eyeOS, the webtop operating system, is getting a new desktop, easier collaboration, real time notifications and more + http://www.h-online.com/open/eyeOS-2-0-rethinks-its-webtop-for-2010--/news/114231/from/rss + 2009-09-14T16:44:43+02:00 + + + + + WebKit adds support for WebGL + + The WebKit developers have begun to integrate GPU-accelerated 3D capabilities via WebGL into their open source browser engine + http://www.h-online.com/open/WebKit-adds-support-for-WebGL--/news/114230/from/rss + 2009-09-14T16:13:02+02:00 + + + + + MonoTouch 1.0 released for iPhone developers + + Novell's Mono on iPhone package arrives, with prices ranging from $399 to $3,999 + http://www.h-online.com/open/MonoTouch-1-0-released-for-iPhone-developers--/news/114229/from/rss + 2009-09-14T17:00:13+02:00 + + + + + Survey: Three out of four administrators don't trust anti-virus software + + In a study, 89 per cent of respondents use a standard anti-virus product, but half of them only because it is "better than nothing". The other half felt compelled to use an anti-virus product due to company guidelines + http://www.h-online.com/security/Survey-Three-out-of-four-administrators-don-t-trust-anti-virus-software--/news/114227/from/rss + 2009-09-14T13:51:54+02:00 + + + + + Twitapps.com to close, code to be open sourced + + The Twitter notification by email service will close in the next few weeks, but the code behind it will be released as open source + http://www.h-online.com/open/Twitapps-com-to-close-code-to-be-open-sourced--/news/114228/from/rss + 2009-09-14T12:50:26+02:00 + + + + + Linux Mint 7 XFCE released + + The Mint development team have released Linux Mint 7 XFCE, a Community Edition based on Xfce 4.6 + http://www.h-online.com/open/Linux-Mint-7-XFCE-released--/news/114226/from/rss + 2009-09-14T12:34:12+02:00 + + + + + Botnet discovered on Linux servers + + The servers in question register with dynamic DNS services to distribute malware + http://www.h-online.com/security/Botnet-discovered-on-Linux-servers--/news/114225/from/rss + 2009-09-14T10:52:46+02:00 + + + + + Mozilla releases SeaMonkey 2.0 Beta 2 + + Mozilla has announced the release of version 2.0 beta 2 of their SeaMonkey "all-in-one internet application suite", completing the planned feature set + http://www.h-online.com/open/Mozilla-releases-SeaMonkey-2-0-Beta-2--/news/114224/from/rss + 2009-09-14T11:07:47+02:00 + + + + + Creature comforts for Ubuntu + + Ubuntu's community manager Jono Bacon discusses a number of features designed to make the popular Linux distribution more user-friendly and productive + http://www.h-online.com/open/Creature-comforts-for-Ubuntu--/news/114223/from/rss + 2009-09-14T09:34:09+02:00 + + + + + The H Week + + Linux Kernel 2.6.31 is released, The H looks at Linux and Digital Rights Management, Microsoft confirmed an SMB vulnerability can be exploited to remotely reboot Windows and announced the formation of the new CodePlex Foundation for open source + http://www.h-online.com/news/The-H-Week--/114222/from/rss + 2009-09-12T14:40:15+02:00 + + + + + Apple open source Grand Central + + The engine behind Snow Leopards multi-core support is released as Apache 2.0 licensed open source + http://www.h-online.com/open/Apple-open-source-Grand-Central--/news/114221/from/rss + 2009-09-13T11:01:28+02:00 + + + + + Chrome adds new defence for cross-site scripting attacks + + Google has released Chrome 4.0.207.0 for Mac and Linux into its developer channel, adding a new a reflective XSS filter to defend against cross-site scripting attacks + http://www.h-online.com/security/Chrome-adds-new-defence-for-cross-site-scripting-attacks--/news/114220/from/rss + 2009-09-11T17:09:26+02:00 + + + + + openSUSE planned outage this weekend + + A planned power outage in the projects office in Nuernberg, Germany will take several of its servers off line from the 11th to the 14th of September + http://www.h-online.com/open/openSUSE-planned-outage-this-weekend--/news/114219/from/rss + 2009-09-11T16:07:36+02:00 + + + + + Apple's iPhone 3.1 anti-phishing ineffective? + + According to several reports, the new anti-phishing feature Apple introduced in iPhone OS 3.1 for its mobile version of the Safari web browser is unreliable + http://www.h-online.com/security/Apple-s-iPhone-3-1-anti-phishing-ineffective--/news/114218/from/rss + 2009-09-11T13:25:23+02:00 + + + + + New Google Summer of Code statistics posted + + Google has posted new statistics about its 2005 to 2009 Summer of Code contests which offer university students stipends to write and develop code for various open source projects + http://www.h-online.com/open/New-Google-Summer-of-Code-statistics-posted--/news/114217/from/rss + 2009-09-11T13:11:34+02:00 + + + + + Report says IBM is switching from Microsoft Office to Lotus Symphony + + According to German daily "Handelsblatt", the Lotus office suite has to be installed on all company PCs within the next ten days. Reportedly, some 330,000 employees have already switched + http://www.h-online.com/open/Report-says-IBM-is-switching-from-Microsoft-Office-to-Lotus-Symphony--/news/114216/from/rss + 2009-09-11T12:59:14+02:00 + + + + + VirtualBox 3.0.6 released + + Sun Microsystems has released version 3.0.6, a maintenance update of its open source VirtualBox desktop virtualisation application for x86 hardware + http://www.h-online.com/open/VirtualBox-3-0-6-released--/news/114215/from/rss + 2009-09-11T13:09:42+02:00 + + + + + First update for Apple's Snow Leopard released + + Apple has released Mac OS X 10.6.1 for Snow Leopard and Security Update 2009-005 for 10.4.11 Tiger and 10.5.8 Leopard systems, fixing several bugs and security vulnerabilities + http://www.h-online.com/security/First-update-for-Apple-s-Snow-Leopard-released--/news/114213/from/rss + 2009-09-11T11:39:55+02:00 + + + + + Tornado let loose by Facebook + + Facebook shake up the Python web framework sector by open sourcing Tornado Web Server, the Python server behind the FriendFeed social network aggregator + http://www.h-online.com/open/Tornado-let-loose-by-Facebook--/news/114214/from/rss + 2009-09-14T15:24:28+02:00 + + + + + Survey: "Open Core" least popular open source option + + A survey says that the "Open Core" model for open source licensing trails behind dual licensing and open source with commercial support in terms of acceptability to the enterprise + http://www.h-online.com/open/Survey-Open-Core-least-popular-open-source-option--/news/114212/from/rss + 2009-09-11T10:50:37+02:00 + + + + + Microsoft announces open source foundation + + The new CodePlex Foundation aims to bring together commercial software vendors and the open source community + http://www.h-online.com/open/Microsoft-announces-open-source-foundation--/news/114211/from/rss + 2009-09-11T11:02:35+02:00 + + + + + Four Critical Holes in QuickTime Closed + + The update closes errors which could allow crafted video files to be used to spread infection + http://www.h-online.com/security/Four-Critical-Holes-in-QuickTime-Closed--/news/114209/from/rss + 2009-09-10T15:56:10+02:00 + + + + + Google begins launch of Chrome Extensions + + Extensions for Google Chrome and Chromium are clearly on their way as the feature is now switched on by default in the developer builds of the open source browsers + http://www.h-online.com/open/Google-begins-launch-of-Chrome-Extensions--/news/114208/from/rss + 2009-09-10T14:43:53+02:00 + + + + + iPhone OS 3.1 available + + iPhone OS 3.1 and iPhone OS 3.1.1 for all iPod touch devices are now available for download at iTunes. The new systems come with numerous improvements and functions and close several security holes, some of them critical + http://www.h-online.com/security/iPhone-OS-3-1-available--/news/114207/from/rss + 2009-09-10T12:54:42+02:00 + + + + + Numerous holes in Firefox 3.0 and 3.5 fixed + + Attackers were able to use manipulated websites to infect PCs. The new versions now also warn users if they are using outdated versions of the Flash plug-in + http://www.h-online.com/security/Numerous-holes-in-Firefox-3-0-and-3-5-fixed--/news/114206/from/rss + 2009-09-10T12:18:54+02:00 + + + + + Better query analysis in MySQL Enterprise + + The commercial Enterprise Fall Release 2009 of the open source MySQL database will feature query filtering and analysis using new correlation graphs + http://www.h-online.com/open/Better-query-analysis-in-MySQL-Enterprise--/news/114205/from/rss + 2009-09-10T11:40:38+02:00 + + + From ed39b93f5ebe9d0535ee85b237ea523da70ae9b3 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 18 Sep 2009 18:31:44 +0000 Subject: [PATCH 031/238] Replaced use of gmdate() with date() passing it DATE_RSS constant to produce a valid local date - fixes ZF-6614 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18265 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Rss.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Rss.php b/src/Rss.php index 7a2397d5..c1ef9955 100644 --- a/src/Rss.php +++ b/src/Rss.php @@ -147,11 +147,11 @@ protected function _mapFeedHeaders($array) $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); } @@ -425,7 +425,7 @@ protected function _mapFeedEntries(DOMElement $root, $array) } $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)) { From 5b993e2e37e6299dc1c4116d4f290a2d52fa7c4e Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 18 Sep 2009 20:52:21 +0000 Subject: [PATCH 032/238] Added URLs of feeds as keys to array from Zend_Feed::findFeeds() method - fixes ZF-5903 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18289 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/ImportTest.php | 18 ++++++++++++++++++ test/_files/htmlPage.html | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 test/_files/htmlPage.html diff --git a/test/ImportTest.php b/test/ImportTest.php index ca7d22a2..1b952030 100644 --- a/test/ImportTest.php +++ b/test/ImportTest.php @@ -441,4 +441,22 @@ protected function _importInvalid($filename) $this->assertType('Zend_Feed_Exception', $e); } } + + /** + * @issue ZF-5903 + */ + public function testFindFeedsIncludesUriAsArrayKey() + { + if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + ) { + $this->markTestSkipped('testFindFeedsIncludesUriAsArrayKey() requires a network connection'); + return; + } + Zend_Feed::setHttpClient(new Zend_Http_Client); + $feeds = Zend_Feed::findFeeds('http://www.planet-php.net'); + $this->assertEquals(array( + 'http://www.planet-php.org:80/rss/', 'http://www.planet-php.org:80/rdf/' + ), array_keys($feeds)); + } } diff --git a/test/_files/htmlPage.html b/test/_files/htmlPage.html new file mode 100644 index 00000000..467d534d --- /dev/null +++ b/test/_files/htmlPage.html @@ -0,0 +1,16 @@ + + + + + + + Blog + + + + + + + + From a23be654e741fdad87fa1e0079604296b1d429b4 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 18 Sep 2009 22:15:08 +0000 Subject: [PATCH 033/238] Zend_Feed_Abstract now implements Countable interface - fixes ZF-3848 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18292 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Abstract.php | 2 +- test/CountTest.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Abstract.php b/src/Abstract.php index d3737425..046954af 100644 --- a/src/Abstract.php +++ b/src/Abstract.php @@ -40,7 +40,7 @@ * @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 diff --git a/test/CountTest.php b/test/CountTest.php index 6b331149..c95edb3e 100644 --- a/test/CountTest.php +++ b/test/CountTest.php @@ -47,4 +47,13 @@ public function testCount() $this->assertEquals($f->count(), 2, 'Feed count should be 2'); } + /** + * ZF-3848 + */ + public function testCountableInterface() + { + $f = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); + $this->assertEquals(count($f), 2, 'Feed count should be 2'); + } + } From 1ec53c61a71349735663b80820da9166e40a87dd Mon Sep 17 00:00:00 2001 From: padraic Date: Sun, 20 Sep 2009 13:12:59 +0000 Subject: [PATCH 034/238] Added Zend_Feed_Reader_FeedSet class extending ArrayObject Added support for lazy loading detected feeds from Zend_Feed_Reader::findFeedLinks() method result (FeedSet) Added support for retaining all links detected as a FeedSet Array Object Maintains backwards compatibility with previous API as a "quick method" when other features not required. Implements (among other things) the improvement suggested in ZF-7870 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18318 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader.php | 47 ++++++++++++++++++--------------------------- test/ReaderTest.php | 40 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 28 deletions(-) diff --git a/src/Reader.php b/src/Reader.php index d741d9ab..5c51bf78 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -34,6 +34,11 @@ */ 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 @@ -378,40 +383,26 @@ public static function findFeedLinks($uri) 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); + return $feedSet; } /** diff --git a/test/ReaderTest.php b/test/ReaderTest.php index 2e76cc73..c59f3cef 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -174,6 +174,46 @@ public function testGetsFeedLinksAsValueObject() $this->assertEquals('http://www.planet-php.org/rss/', $links->rss); } + public function testCompilesLinksAsArrayObject() + { + if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + ) { + $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); + return; + } + $links = Zend_Feed_Reader::findFeedLinks('http://www.planet-php.net'); + $this->assertTrue($links instanceof Zend_Feed_Reader_FeedSet); + $this->assertEquals(array( + 'rel' => 'alternate', 'type' => 'application/rss+xml', 'href' => 'http://www.planet-php.org/rss/' + ), (array) $links->getIterator()->current()); + } + + public function testFeedSetLoadsFeedObjectWhenFeedArrayKeyAccessed() + { + if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + ) { + $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); + return; + } + $links = Zend_Feed_Reader::findFeedLinks('http://www.planet-php.net'); + $link = $links->getIterator()->current(); + $this->assertTrue($link['feed'] instanceof Zend_Feed_Reader_Feed_Rss); + } + + public function testZeroCountFeedSetReturnedFromEmptyList() + { + if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + ) { + $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); + return; + } + $links = Zend_Feed_Reader::findFeedLinks('http://www.example.com'); + $this->assertEquals(0, count($links)); + } + public function testAddsPrefixPath() { Zend_Feed_Reader::addPrefixPath('A_B_C', '/A/B/C'); From b896f8399d355bed31e5717b73bcb11f122973f2 Mon Sep 17 00:00:00 2001 From: padraic Date: Sun, 20 Sep 2009 13:24:38 +0000 Subject: [PATCH 035/238] Added Zend_Feed_Reader_FeedSet class git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18319 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/FeedSet.php | 100 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 src/Reader/FeedSet.php diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php new file mode 100644 index 00000000..80ce527f --- /dev/null +++ b/src/Reader/FeedSet.php @@ -0,0 +1,100 @@ +getAttribute('rel')) !== 'alternate' + || !$link->getAttribute('type') || !$link->getAttribute('href')) { + continue; + } + if (!isset($this->rss) && $link->getAttribute('type') == 'application/rss+xml') { + $this->rss = $link->getAttribute('href'); + } elseif(!isset($this->atom) && $link->getAttribute('type') == 'application/atom+xml') { + $this->atom = $link->getAttribute('href'); + } elseif(!isset($this->rdf) && $link->getAttribute('type') == 'application/rdf+xml') { + $this->rdf = $link->getAttribute('href'); + } + $this[] = new self(array( + 'rel' => 'alternate', + 'type' => $link->getAttribute('type'), + 'href' => $link->getAttribute('href'), + )); + } + } + + /** + * 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); + } + +} From 93a12a4921f793be769fa40709c12520abcb76e6 Mon Sep 17 00:00:00 2001 From: padraic Date: Sun, 20 Sep 2009 13:25:52 +0000 Subject: [PATCH 036/238] svn property update git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18320 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/FeedSet.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index 80ce527f..21eb1cc1 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -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: FeedSet.php 18318 2009-09-20 12:55:34Z padraic $ + * @version $Id$ */ /** From de8e759486e4d31ba49292fe3aaa66c0ca50f506 Mon Sep 17 00:00:00 2001 From: padraic Date: Mon, 21 Sep 2009 15:11:06 +0000 Subject: [PATCH 037/238] Added date parsing for the nebulous RSS format (non-standard) - fixes ZF-7908 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18340 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Entry/Rss.php | 16 ++++++++++------ src/Reader/Feed/Rss.php | 16 ++++++++++------ test/Reader/Entry/RssTest.php | 12 ++++++++++++ 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index d5c50eba..26271813 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -263,13 +263,17 @@ public function getDateModified() $date->set($dateModified, Zend_Date::RFC_2822); } catch (Zend_Date_Exception $e) { try { - $date->set($dateModified, Zend_Date::DATES); + $date->set($dateModified, Zend_Date::RSS); } catch (Zend_Date_Exception $e) { - 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): ' - . $e->getMessage() - ); + try { + $date->set($dateModified, Zend_Date::DATES); + } catch (Zend_Date_Exception $e) { + 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): ' + . $e->getMessage() + ); + } } } } diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 023711ed..177ad7d2 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -209,13 +209,17 @@ public function getDateModified() $date->set($dateModified, Zend_Date::RFC_2822); } catch (Zend_Date_Exception $e) { try { - $date->set($dateModified, Zend_Date::DATES); + $date->set($dateModified, Zend_Date::RSS); } catch (Zend_Date_Exception $e) { - 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): ' - . $e->getMessage() - ); + try { + $date->set($dateModified, Zend_Date::DATES); + } catch (Zend_Date_Exception $e) { + 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): ' + . $e->getMessage() + ); + } } } } diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index 46f23296..6b4d72fa 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -1978,6 +1978,18 @@ public function testGetsDateModifiedFromRss090_None() $this->assertEquals(null, $entry->getDateModified()); } + /** + * @issue ZF-7908 + */ + public function testGetsDateModifiedFromRss20_UnrecognisedGmtFormat() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20-zf-7908.xml') + ); + $entry = $feed->current(); + $this->assertEquals('Sunday 11 January 2009 09 55 59 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + } + /** * Get CommentCount (Unencoded Text) */ From dbf3d1db1fdd6ebf1e3d55c0c8ed153b20e52225 Mon Sep 17 00:00:00 2001 From: padraic Date: Mon, 21 Sep 2009 17:17:38 +0000 Subject: [PATCH 038/238] Added missing test rss file (fixes test failure on update) git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18348 44c647ce-9c0f-0410-b52a-842ac1e357ba --- .../Entry/_files/Rss/datemodified/plain/rss20-zf-7908.xml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/rss20-zf-7908.xml diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/rss20-zf-7908.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/rss20-zf-7908.xml new file mode 100644 index 00000000..7d387492 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/rss20-zf-7908.xml @@ -0,0 +1,8 @@ + + + + + Sun, 11 Jan 2009 09:55:59 GMT + + + From aa7df2958c60af9d0f3185faf583f2d2ed147fd4 Mon Sep 17 00:00:00 2001 From: padraic Date: Tue, 22 Sep 2009 11:18:22 +0000 Subject: [PATCH 039/238] Removed Exception based flow control of date parsing in favour of foreach loop/repeat on failure/exception git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18363 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Entry/Rss.php | 30 +++++++++++++----------------- src/Reader/Feed/Rss.php | 30 +++++++++++++----------------- 2 files changed, 26 insertions(+), 34 deletions(-) diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index 26271813..7cbc2059 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -255,25 +255,21 @@ public function getDateModified() ) { $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::RSS); - } catch (Zend_Date_Exception $e) { - try { - $date->set($dateModified, Zend_Date::DATES); - } catch (Zend_Date_Exception $e) { - 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): ' - . $e->getMessage() - ); - } + 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):' + . $e->getMessage() + ); } } } diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 177ad7d2..f1acf28b 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -201,25 +201,21 @@ public function getDateModified() $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::RSS); - } catch (Zend_Date_Exception $e) { - try { - $date->set($dateModified, Zend_Date::DATES); - } catch (Zend_Date_Exception $e) { - 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): ' - . $e->getMessage() - ); - } + 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):' + . $e->getMessage() + ); } } } From 06ca81f5385c85b76b5b174e39225697e538e3ca Mon Sep 17 00:00:00 2001 From: padraic Date: Tue, 22 Sep 2009 11:58:36 +0000 Subject: [PATCH 040/238] Removed TODO tag from Zend_Feed_Reader_Entry_Rss; enclosures supported in RSS 2.0 or delegated to Atom extension (if not detected). git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18364 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Entry/Rss.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index 7cbc2059..0a346322 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -335,7 +335,6 @@ public function getDescription() /** * 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 @@ public function getEnclosure() } } + if (!$enclosure) { + $enclosure = $this->getExtension('Atom')->getEnclosure(); + } + $this->_data['enclosure'] = $enclosure; return $this->_data['enclosure']; From 32a068c1a416022afdbece0f86e72d41b4c75e76 Mon Sep 17 00:00:00 2001 From: padraic Date: Mon, 12 Oct 2009 16:32:30 +0000 Subject: [PATCH 041/238] Added Zend_Feed_Reader support for fetching an array of Pubsubhubbub Hub endpoints using getHubs() method. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18514 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Extension/Atom/Feed.php | 27 ++++ src/Reader/Feed/Atom.php | 18 +++ src/Reader/Feed/Rss.php | 24 +++ test/Reader/Feed/AtomTest.php | 26 ++++ test/Reader/Feed/RssTest.php | 140 ++++++++++++++++++ .../Feed/_files/Atom/hubs/plain/atom03.xml | 5 + .../Feed/_files/Atom/hubs/plain/atom10.xml | 5 + 7 files changed, 245 insertions(+) create mode 100644 test/Reader/Feed/_files/Atom/hubs/plain/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/hubs/plain/atom10.xml diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index a7e616e5..4e2bb1c1 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -338,6 +338,33 @@ public function getFeedLink() return $this->_data['feedlink']; } + /** + * Get an array of any supported Pusubhubbub endpoints + * + * @return array|null + */ + public function getHubs() + { + if (array_key_exists('hubs', $this->_data)) { + return $this->_data['hubs']; + } + $hubs = array(); + $list = $this->_xpath->query($this->getXpathPrefix() + . '//atom:link[@rel="hub"]/@href'); + + if ($list->length) { + foreach ($list as $uri) { + $hubs[] = $uri->nodeValue; + } + } else { + $hubs = null; + } + + $this->_data['hubs'] = $hubs; + + return $this->_data['hubs']; + } + /** * Get the feed title * diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index 5b41434b..620cd295 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -294,6 +294,24 @@ public function getTitle() return $this->_data['title']; } + /** + * Get an array of any supported Pusubhubbub endpoints + * + * @return array|null + */ + public function getHubs() + { + if (array_key_exists('hubs', $this->_data)) { + return $this->_data['hubs']; + } + + $hubs = $this->getExtension('Atom')->getHubs(); + + $this->_data['hubs'] = $hubs; + + return $this->_data['hubs']; + } + /** * Read all entries to the internal entries array * diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index f1acf28b..b95c3c6b 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -493,6 +493,30 @@ public function getTitle() return $this->_data['title']; } + /** + * Get an array of any supported Pusubhubbub endpoints + * + * @return array|null + */ + public function getHubs() + { + if (array_key_exists('hubs', $this->_data)) { + return $this->_data['hubs']; + } + + $hubs = $this->getExtension('Atom')->getHubs(); + + if (empty($hubs)) { + $hubs = null; + } else { + $hubs = array_unique($hubs); + } + + $this->_data['hubs'] = $hubs; + + return $this->_data['hubs']; + } + /** * Read all entries to the internal entries array * diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index b3a5cbe0..02f1b427 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -302,6 +302,32 @@ public function testGetsFeedLinkFromAtom10() $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); } + /** + * Get Pubsubhubbub Hubs + */ + public function testGetsHubsFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/hubs/plain/atom03.xml') + ); + $this->assertEquals(array( + 'http://www.example.com/hub1', + 'http://www.example.com/hub2' + ), $feed->getHubs()); + } + + public function testGetsHubsFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10.xml') + ); + $this->assertEquals(array( + 'http://www.example.com/hub1', + 'http://www.example.com/hub2' + ), $feed->getHubs()); + } + + /** * Implements Countable */ diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index 866821d0..b226dab2 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -2198,5 +2198,145 @@ public function testGetsDateModifiedFromRss090_None() $this->assertEquals(null, $feed->getDateModified()); } + //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& + + /** + * Get Hubs (Unencoded Text) + */ + public function testGetsHubsFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss20.xml') + ); + $this->assertEquals(array( + 'http://www.example.com/hub1', + 'http://www.example.com/hub2' + ), $feed->getHubs()); + } + + public function testGetsHubsFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss094.xml') + ); + $this->assertEquals(array( + 'http://www.example.com/hub1', + 'http://www.example.com/hub2' + ), $feed->getHubs()); + } + + public function testGetsHubsFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss093.xml') + ); + $this->assertEquals(array( + 'http://www.example.com/hub1', + 'http://www.example.com/hub2' + ), $feed->getHubs()); + } + + public function testGetsHubsFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss092.xml') + ); + $this->assertEquals(array( + 'http://www.example.com/hub1', + 'http://www.example.com/hub2' + ), $feed->getHubs()); + } + + public function testGetsHubsFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss091.xml') + ); + $this->assertEquals(array( + 'http://www.example.com/hub1', + 'http://www.example.com/hub2' + ), $feed->getHubs()); + } + + public function testGetsHubsFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss10.xml') + ); + $this->assertEquals(array( + 'http://www.example.com/hub1', + 'http://www.example.com/hub2' + ), $feed->getHubs()); + } + + public function testGetsHubsFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss090.xml') + ); + $this->assertEquals(array( + 'http://www.example.com/hub1', + 'http://www.example.com/hub2' + ), $feed->getHubs()); + } + + // Missing Hubs + + public function testGetsHubsFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss20.xml') + ); + $this->assertEquals(null, $feed->getHubs()); + } + + public function testGetsHubsFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss094.xml') + ); + $this->assertEquals(null, $feed->getHubs()); + } + + public function testGetsHubsFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss093.xml') + ); + $this->assertEquals(null, $feed->getHubs()); + } + + public function testGetsHubsFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss092.xml') + ); + $this->assertEquals(null, $feed->getHubs()); + } + + public function testGetsHubsFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss091.xml') + ); + $this->assertEquals(null, $feed->getHubs()); + } + + public function testGetsHubsFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss10.xml') + ); + $this->assertEquals(null, $feed->getHubs()); + } + + public function testGetsHubsFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss090.xml') + ); + $this->assertEquals(null, $feed->getHubs()); + } + } diff --git a/test/Reader/Feed/_files/Atom/hubs/plain/atom03.xml b/test/Reader/Feed/_files/Atom/hubs/plain/atom03.xml new file mode 100644 index 00000000..d1734bbc --- /dev/null +++ b/test/Reader/Feed/_files/Atom/hubs/plain/atom03.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/test/Reader/Feed/_files/Atom/hubs/plain/atom10.xml b/test/Reader/Feed/_files/Atom/hubs/plain/atom10.xml new file mode 100644 index 00000000..ac8cfb2c --- /dev/null +++ b/test/Reader/Feed/_files/Atom/hubs/plain/atom10.xml @@ -0,0 +1,5 @@ + + + + + From 4ec4da928ae7a5a2853d3bb502fa4d2eeaf352fb Mon Sep 17 00:00:00 2001 From: padraic Date: Mon, 12 Oct 2009 16:39:27 +0000 Subject: [PATCH 042/238] Added RSS test files for Pubsubhubbub getHubs() method at feel level git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18515 44c647ce-9c0f-0410-b52a-842ac1e357ba --- .../Feed/_files/Rss/hubs/plain/atom10/rss090.xml | 10 ++++++++++ .../Feed/_files/Rss/hubs/plain/atom10/rss091.xml | 8 ++++++++ .../Feed/_files/Rss/hubs/plain/atom10/rss092.xml | 8 ++++++++ .../Feed/_files/Rss/hubs/plain/atom10/rss093.xml | 8 ++++++++ .../Feed/_files/Rss/hubs/plain/atom10/rss094.xml | 8 ++++++++ .../Reader/Feed/_files/Rss/hubs/plain/atom10/rss10.xml | 10 ++++++++++ .../Reader/Feed/_files/Rss/hubs/plain/atom10/rss20.xml | 8 ++++++++ test/Reader/Feed/_files/Rss/hubs/plain/none/rss090.xml | 8 ++++++++ test/Reader/Feed/_files/Rss/hubs/plain/none/rss091.xml | 6 ++++++ test/Reader/Feed/_files/Rss/hubs/plain/none/rss092.xml | 6 ++++++ test/Reader/Feed/_files/Rss/hubs/plain/none/rss093.xml | 6 ++++++ test/Reader/Feed/_files/Rss/hubs/plain/none/rss094.xml | 6 ++++++ test/Reader/Feed/_files/Rss/hubs/plain/none/rss10.xml | 8 ++++++++ test/Reader/Feed/_files/Rss/hubs/plain/none/rss20.xml | 6 ++++++ 14 files changed, 106 insertions(+) create mode 100644 test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/hubs/plain/none/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/hubs/plain/none/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/hubs/plain/none/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/hubs/plain/none/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/hubs/plain/none/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/hubs/plain/none/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/hubs/plain/none/rss20.xml diff --git a/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss090.xml b/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss090.xml new file mode 100644 index 00000000..bdadcb31 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss090.xml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss091.xml b/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss091.xml new file mode 100644 index 00000000..5c46a383 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss091.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss092.xml b/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss092.xml new file mode 100644 index 00000000..c1a9ed52 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss092.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss093.xml b/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss093.xml new file mode 100644 index 00000000..f46bc675 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss093.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss094.xml b/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss094.xml new file mode 100644 index 00000000..e79c2fd8 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss094.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss10.xml b/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss10.xml new file mode 100644 index 00000000..fbec0334 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss10.xml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss20.xml b/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss20.xml new file mode 100644 index 00000000..03ace4cf --- /dev/null +++ b/test/Reader/Feed/_files/Rss/hubs/plain/atom10/rss20.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/hubs/plain/none/rss090.xml b/test/Reader/Feed/_files/Rss/hubs/plain/none/rss090.xml new file mode 100644 index 00000000..4eab29c2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/hubs/plain/none/rss090.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/hubs/plain/none/rss091.xml b/test/Reader/Feed/_files/Rss/hubs/plain/none/rss091.xml new file mode 100644 index 00000000..81c090da --- /dev/null +++ b/test/Reader/Feed/_files/Rss/hubs/plain/none/rss091.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/hubs/plain/none/rss092.xml b/test/Reader/Feed/_files/Rss/hubs/plain/none/rss092.xml new file mode 100644 index 00000000..a4b9c6cb --- /dev/null +++ b/test/Reader/Feed/_files/Rss/hubs/plain/none/rss092.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/hubs/plain/none/rss093.xml b/test/Reader/Feed/_files/Rss/hubs/plain/none/rss093.xml new file mode 100644 index 00000000..998ef757 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/hubs/plain/none/rss093.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/hubs/plain/none/rss094.xml b/test/Reader/Feed/_files/Rss/hubs/plain/none/rss094.xml new file mode 100644 index 00000000..4fb02a8b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/hubs/plain/none/rss094.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/hubs/plain/none/rss10.xml b/test/Reader/Feed/_files/Rss/hubs/plain/none/rss10.xml new file mode 100644 index 00000000..87774bad --- /dev/null +++ b/test/Reader/Feed/_files/Rss/hubs/plain/none/rss10.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/hubs/plain/none/rss20.xml b/test/Reader/Feed/_files/Rss/hubs/plain/none/rss20.xml new file mode 100644 index 00000000..db102b5d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/hubs/plain/none/rss20.xml @@ -0,0 +1,6 @@ + + + + + From d7701e3bc2abf848a9b99de6818c3ee2884ba815 Mon Sep 17 00:00:00 2001 From: sgehrig Date: Fri, 16 Oct 2009 11:50:32 +0000 Subject: [PATCH 043/238] ZF-2606 values are run through htmlspecialchars() in __set() also fixed some problem with setting namespaced attributes git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18567 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Element.php | 9 +++-- test/ElementTest.php | 80 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 3 deletions(-) diff --git a/src/Element.php b/src/Element.php index c21c6b0f..1ea12c40 100644 --- a/src/Element.php +++ b/src/Element.php @@ -204,10 +204,12 @@ public function __set($var, $val) 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) { @@ -382,7 +384,8 @@ public function offsetSet($offset, $value) 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); } diff --git a/test/ElementTest.php b/test/ElementTest.php index 1d2721bf..095f2129 100644 --- a/test/ElementTest.php +++ b/test/ElementTest.php @@ -87,4 +87,84 @@ public function testStrings() $this->assertFalse(is_string($entry->summary), '__get access should not return a string'); } + public function testSetNamespacedAttributes() + { + $value = 'value'; + + $e = new Zend_Feed_Entry_Atom(); + $e->test['attr'] = $value; + $e->test['namespace1:attr'] = $value; + $e->test['namespace2:attr'] = $value; + + $this->assertEquals($value, $e->test['attr']); + $this->assertEquals($value, $e->test['namespace1:attr']); + $this->assertEquals($value, $e->test['namespace2:attr']); + } + + public function testUnsetNamespacedAttributes() + { + $value = 'value'; + + $e = new Zend_Feed_Entry_Atom(); + $e->test['attr'] = $value; + $e->test['namespace1:attr'] = $value; + $e->test['namespace2:attr'] = $value; + + $this->assertEquals($value, $e->test['attr']); + $this->assertEquals($value, $e->test['namespace1:attr']); + $this->assertEquals($value, $e->test['namespace2:attr']); + + unset($e->test['attr']); + unset($e->test['namespace1:attr']); + unset($e->test['namespace2:attr']); + + $this->assertEquals('', $e->test['attr']); + $this->assertEquals('', $e->test['namespace1:attr']); + $this->assertEquals('', $e->test['namespace1:attr']); + } + + /** + * @group ZF-2606 + */ + public function testValuesWithXmlSpecialChars() + { + $testAmp = '&'; + $testLt = '<'; + $testGt = '>'; + + $e = new Zend_Feed_Entry_Atom(); + $e->testAmp = $testAmp; + $e->{'namespace1:lt'} = $testLt; + $e->{'namespace1:gt'} = $testGt; + + $this->assertEquals($testAmp, $e->testAmp()); + $this->assertEquals($testLt, $e->{'namespace1:lt'}()); + $this->assertEquals($testGt, $e->{'namespace1:gt'}()); + } + + /** + * @group ZF-2606 + */ + public function testAttributesWithXmlSpecialChars() + { + $testAmp = '&'; + $testLt = '<'; + $testGt = '>'; + $testQuot = '"'; + $testSquot = "'"; + + $e = new Zend_Feed_Entry_Atom(); + $e->test['amp'] = $testAmp; + $e->test['namespace1:lt'] = $testLt; + $e->test['namespace1:gt'] = $testGt; + $e->test['namespace1:quot'] = $testQuot; + $e->test['namespace1:squot'] = $testSquot; + + $this->assertEquals($testAmp, $e->test['amp']); + $this->assertEquals($testLt, $e->test['namespace1:lt']); + $this->assertEquals($testGt, $e->test['namespace1:gt']); + $this->assertEquals($testQuot, $e->test['namespace1:quot']); + $this->assertEquals($testSquot, $e->test['namespace1:squot']); + } + } From 635098bd62127ae808f89bb2c9c2e75c6a14bcae Mon Sep 17 00:00:00 2001 From: padraic Date: Tue, 20 Oct 2009 14:06:59 +0000 Subject: [PATCH 044/238] Added support for Atom specific relative URI parsing for all link elements. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18654 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Extension/Atom/Entry.php | 54 ++++++++++++++- src/Reader/Extension/Atom/Feed.php | 63 ++++++++++++++--- src/Reader/Feed/Atom.php | 18 +++++ test/Reader/Entry/AtomTest.php | 69 +++++++++++++++++++ .../Atom/baseurl/plain/atom10-entrylevel.xml | 6 ++ .../Atom/baseurl/plain/atom10-feedlevel.xml | 7 ++ .../_files/Atom/commentlink/plain/atom03.xml | 6 ++ .../commentlink/plain/atom10-relative.xml | 6 ++ .../_files/Atom/commentlink/plain/atom10.xml | 6 ++ .../_files/Atom/link/plain/atom10-norel.xml | 6 ++ .../Atom/link/plain/atom10-relative.xml | 6 ++ .../Entry/_files/Atom/link/plain/atom10.xml | 4 +- test/Reader/Feed/AtomTest.php | 35 ++++++++++ .../Atom/feedlink/plain/atom10-relative.xml | 5 ++ .../_files/Atom/link/plain/atom10-norel.xml | 4 ++ .../Atom/link/plain/atom10-relative.xml | 5 ++ .../Feed/_files/Atom/link/plain/atom10.xml | 4 +- 17 files changed, 291 insertions(+), 13 deletions(-) create mode 100644 test/Reader/Entry/_files/Atom/baseurl/plain/atom10-entrylevel.xml create mode 100644 test/Reader/Entry/_files/Atom/baseurl/plain/atom10-feedlevel.xml create mode 100644 test/Reader/Entry/_files/Atom/commentlink/plain/atom03.xml create mode 100644 test/Reader/Entry/_files/Atom/commentlink/plain/atom10-relative.xml create mode 100644 test/Reader/Entry/_files/Atom/commentlink/plain/atom10.xml create mode 100644 test/Reader/Entry/_files/Atom/link/plain/atom10-norel.xml create mode 100644 test/Reader/Entry/_files/Atom/link/plain/atom10-relative.xml create mode 100644 test/Reader/Feed/_files/Atom/feedlink/plain/atom10-relative.xml create mode 100644 test/Reader/Feed/_files/Atom/link/plain/atom10-norel.xml create mode 100644 test/Reader/Feed/_files/Atom/link/plain/atom10-relative.xml diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 8d270e88..3ff34592 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -34,6 +34,11 @@ */ require_once 'Zend/Date.php'; +/** + * @see Zend_Uri + */ +require_once 'Zend/Uri.php'; + /** * @category Zend * @package Zend_Feed_Reader @@ -263,6 +268,34 @@ public function getId() 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 @@ public function getLinks() if ($list->length) { foreach ($list as $link) { - $links[] = $link->value; + $links[] = $this->_absolutiseUri($link->value); } } @@ -392,6 +425,7 @@ public function getCommentLink() if ($list->length) { $link = $list->item(0)->value; + $link = $this->_absolutiseUri($link); } $this->_data['commentlink'] = $link; @@ -418,12 +452,30 @@ public function getCommentFeedLink($type = 'atom') if ($list->length) { $link = $list->item(0)->value; + $link = $this->_absolutiseUri($link); } $this->_data['commentfeedlink'] = $link; 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 diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index 4e2bb1c1..a045d119 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -29,6 +29,11 @@ */ require_once 'Zend/Date.php'; +/** + * @see Zend_Uri + */ +require_once 'Zend/Uri.php'; + /** * @category Zend * @package Zend_Feed_Reader @@ -293,6 +298,27 @@ public function getLanguage() 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 @@ public function getLink() return $this->_data['link']; } - $link = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:link/@href)'); - - if (!$link) { - $link = null; + $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 @@ public function getFeedLink() $link = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:link[@rel="self"]/@href)'); - if (!$link) { - $link = null; - } + $link = $this->_absolutiseUri($link); $this->_data['feedlink'] = $link; @@ -354,7 +384,7 @@ public function getHubs() if ($list->length) { foreach ($list as $uri) { - $hubs[] = $uri->nodeValue; + $hubs[] = $this->_absolutiseUri($uri->nodeValue); } } else { $hubs = null; @@ -425,6 +455,23 @@ protected function _getAuthor(DOMElement $element) 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 diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index 620cd295..83247eca 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -239,6 +239,24 @@ public function getLanguage() 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 diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index 51427ebd..4f4db229 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -289,4 +289,73 @@ public function testGetsLinkFromAtom10() $entry = $feed->current(); $this->assertEquals('http://www.example.com/entry', $entry->getLink()); } + + public function testGetsLinkFromAtom10_WithNoRelAttribute() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/link/plain/atom10-norel.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry', $entry->getLink()); + } + + public function testGetsLinkFromAtom10_WithRelativeUrl() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/link/plain/atom10-relative.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry', $entry->getLink()); + } + + /** + * Get Base Uri + */ + public function testGetsBaseUriFromAtom10_FromFeedElement() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/baseurl/plain/atom10-feedlevel.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com', $entry->getBaseUrl()); + } + + public function testGetsBaseUriFromAtom10_FromEntryElement() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/baseurl/plain/atom10-entrylevel.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/', $entry->getBaseUrl()); + } + + /** + * Get Comment HTML Link + */ + public function testGetsCommentLinkFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/commentlink/plain/atom03.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry/comments', $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/commentlink/plain/atom10.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry/comments', $entry->getCommentLink()); + } + + public function testGetsCommentLinkFromAtom10_RelativeLinks() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/commentlink/plain/atom10-relative.xml') + ); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/entry/comments', $entry->getCommentLink()); + } } diff --git a/test/Reader/Entry/_files/Atom/baseurl/plain/atom10-entrylevel.xml b/test/Reader/Entry/_files/Atom/baseurl/plain/atom10-entrylevel.xml new file mode 100644 index 00000000..557aaf9c --- /dev/null +++ b/test/Reader/Entry/_files/Atom/baseurl/plain/atom10-entrylevel.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/Reader/Entry/_files/Atom/baseurl/plain/atom10-feedlevel.xml b/test/Reader/Entry/_files/Atom/baseurl/plain/atom10-feedlevel.xml new file mode 100644 index 00000000..f52d1893 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/baseurl/plain/atom10-feedlevel.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/test/Reader/Entry/_files/Atom/commentlink/plain/atom03.xml b/test/Reader/Entry/_files/Atom/commentlink/plain/atom03.xml new file mode 100644 index 00000000..641512d6 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/commentlink/plain/atom03.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/Reader/Entry/_files/Atom/commentlink/plain/atom10-relative.xml b/test/Reader/Entry/_files/Atom/commentlink/plain/atom10-relative.xml new file mode 100644 index 00000000..f157dfab --- /dev/null +++ b/test/Reader/Entry/_files/Atom/commentlink/plain/atom10-relative.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/Reader/Entry/_files/Atom/commentlink/plain/atom10.xml b/test/Reader/Entry/_files/Atom/commentlink/plain/atom10.xml new file mode 100644 index 00000000..1f54ce03 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/commentlink/plain/atom10.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/Reader/Entry/_files/Atom/link/plain/atom10-norel.xml b/test/Reader/Entry/_files/Atom/link/plain/atom10-norel.xml new file mode 100644 index 00000000..2eb1029a --- /dev/null +++ b/test/Reader/Entry/_files/Atom/link/plain/atom10-norel.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Atom/link/plain/atom10-relative.xml b/test/Reader/Entry/_files/Atom/link/plain/atom10-relative.xml new file mode 100644 index 00000000..a5b22f4a --- /dev/null +++ b/test/Reader/Entry/_files/Atom/link/plain/atom10-relative.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/Reader/Entry/_files/Atom/link/plain/atom10.xml b/test/Reader/Entry/_files/Atom/link/plain/atom10.xml index 2eb1029a..f20a1346 100644 --- a/test/Reader/Entry/_files/Atom/link/plain/atom10.xml +++ b/test/Reader/Entry/_files/Atom/link/plain/atom10.xml @@ -1,6 +1,6 @@ - + - \ No newline at end of file + diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 02f1b427..62ccf19e 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -282,6 +282,33 @@ public function testGetsLinkFromAtom10() ); $this->assertEquals('http://www.example.com', $feed->getLink()); } + + public function testGetsLinkFromAtom10WithNoRelAttribute() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/atom10-norel.xml') + ); + $this->assertEquals('http://www.example.com', $feed->getLink()); + } + + public function testGetsLinkFromAtom10WithRelativeUrl() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/plain/atom10-relative.xml') + ); + $this->assertEquals('http://www.example.com', $feed->getLink()); + } + + /** + * Get Base Uri + */ + public function testGetsBaseUriFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom10-relative.xml') + ); + $this->assertEquals('http://www.example.com/', $feed->getBaseUrl()); + } /** * Get Feed Link (Unencoded Text) @@ -301,6 +328,14 @@ public function testGetsFeedLinkFromAtom10() ); $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); } + + public function testGetsFeedLinkFromAtom10IfRelativeUri() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom10-relative.xml') + ); + $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); + } /** * Get Pubsubhubbub Hubs diff --git a/test/Reader/Feed/_files/Atom/feedlink/plain/atom10-relative.xml b/test/Reader/Feed/_files/Atom/feedlink/plain/atom10-relative.xml new file mode 100644 index 00000000..07fda0fe --- /dev/null +++ b/test/Reader/Feed/_files/Atom/feedlink/plain/atom10-relative.xml @@ -0,0 +1,5 @@ + + + + diff --git a/test/Reader/Feed/_files/Atom/link/plain/atom10-norel.xml b/test/Reader/Feed/_files/Atom/link/plain/atom10-norel.xml new file mode 100644 index 00000000..9bbe0fd6 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/link/plain/atom10-norel.xml @@ -0,0 +1,4 @@ + + + + diff --git a/test/Reader/Feed/_files/Atom/link/plain/atom10-relative.xml b/test/Reader/Feed/_files/Atom/link/plain/atom10-relative.xml new file mode 100644 index 00000000..d75768f0 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/link/plain/atom10-relative.xml @@ -0,0 +1,5 @@ + + + + diff --git a/test/Reader/Feed/_files/Atom/link/plain/atom10.xml b/test/Reader/Feed/_files/Atom/link/plain/atom10.xml index 18683bf9..1903f1fe 100644 --- a/test/Reader/Feed/_files/Atom/link/plain/atom10.xml +++ b/test/Reader/Feed/_files/Atom/link/plain/atom10.xml @@ -1,4 +1,4 @@ - - \ No newline at end of file + + From 1f35520106a33e9842283fc38b7eaa975f8da992 Mon Sep 17 00:00:00 2001 From: alexander Date: Thu, 12 Nov 2009 15:37:56 +0000 Subject: [PATCH 045/238] Remove trailing whitespaces, change tab for spaces, convert CRLF to LF. ZF-7316 related. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18950 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Extension/Atom/Entry.php | 10 +++---- src/Reader/Extension/Atom/Feed.php | 8 +++--- src/Reader/Feed/Atom.php | 2 +- test/ElementTest.php | 20 ++++++------- test/ImportTest.php | 2 +- test/Reader/Entry/AtomTest.php | 14 ++++----- test/Reader/Feed/AtomTest.php | 10 +++---- test/Reader/Feed/RssTest.php | 44 ++++++++++++++--------------- test/ReaderTest.php | 4 +-- 9 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 3ff34592..a7cab966 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -268,7 +268,7 @@ public function getId() return $this->_data['id']; } - + /** * Get the base URI of the feed (if set). * @@ -279,11 +279,11 @@ 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])'); } @@ -291,7 +291,7 @@ public function getBaseUrl() if (!$baseUrl) { $baseUrl = null; } - + $this->_data['baseUrl'] = $baseUrl; return $this->_data['baseUrl']; @@ -459,7 +459,7 @@ public function getCommentFeedLink($type = 'atom') 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. diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index a045d119..c84e9601 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -298,7 +298,7 @@ public function getLanguage() return $this->_data['language']; } - + /** * Get the base URI of the feed (if set). * @@ -332,12 +332,12 @@ public function getLink() } $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); @@ -455,7 +455,7 @@ protected function _getAuthor(DOMElement $element) 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. diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index 83247eca..0d24c5ad 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -239,7 +239,7 @@ public function getLanguage() return $this->_data['language']; } - + /** * Get a link to the source website * diff --git a/test/ElementTest.php b/test/ElementTest.php index 095f2129..680b8457 100644 --- a/test/ElementTest.php +++ b/test/ElementTest.php @@ -67,16 +67,16 @@ public function testIsInitialized() public function testStrings() { $xml = " - Using C++ Intrinsic Functions for Pipelined Text Processing - http://www.oreillynet.com/pub/wlg/8356 - - -
- A good C++ programming technique that has almost no published material available on the WWW relates to using the special pipeline instructions in modern CPUs for faster text processing. Here's example code using C++ intrinsic functions to give a fourfold speed increase for a UTF-8 to UTF-16 converter compared to the original C/C++ code. -
-
- Rick Jelliffe - 2005-11-07T08:15:57-08:00 + Using C++ Intrinsic Functions for Pipelined Text Processing + http://www.oreillynet.com/pub/wlg/8356 + + +
+ A good C++ programming technique that has almost no published material available on the WWW relates to using the special pipeline instructions in modern CPUs for faster text processing. Here's example code using C++ intrinsic functions to give a fourfold speed increase for a UTF-8 to UTF-16 converter compared to the original C/C++ code. +
+
+ Rick Jelliffe + 2005-11-07T08:15:57-08:00
"; $entry = new Zend_Feed_Entry_Atom('uri', $xml); diff --git a/test/ImportTest.php b/test/ImportTest.php index 1b952030..952f1c16 100644 --- a/test/ImportTest.php +++ b/test/ImportTest.php @@ -67,7 +67,7 @@ class Zend_Feed_ImportTest extends PHPUnit_Framework_TestCase public function setUp() { - $this->_adapter = new Zend_Http_Client_Adapter_Test(); + $this->_adapter = new Zend_Http_Client_Adapter_Test(); Zend_Feed::setHttpClient(new Zend_Http_Client(null, array('adapter' => $this->_adapter))); $this->_client = Zend_Feed::getHttpClient(); $this->_feedDir = dirname(__FILE__) . '/_files'; diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index 4f4db229..f1211a30 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -289,7 +289,7 @@ public function testGetsLinkFromAtom10() $entry = $feed->current(); $this->assertEquals('http://www.example.com/entry', $entry->getLink()); } - + public function testGetsLinkFromAtom10_WithNoRelAttribute() { $feed = Zend_Feed_Reader::importString( @@ -298,7 +298,7 @@ public function testGetsLinkFromAtom10_WithNoRelAttribute() $entry = $feed->current(); $this->assertEquals('http://www.example.com/entry', $entry->getLink()); } - + public function testGetsLinkFromAtom10_WithRelativeUrl() { $feed = Zend_Feed_Reader::importString( @@ -307,7 +307,7 @@ public function testGetsLinkFromAtom10_WithRelativeUrl() $entry = $feed->current(); $this->assertEquals('http://www.example.com/entry', $entry->getLink()); } - + /** * Get Base Uri */ @@ -319,7 +319,7 @@ public function testGetsBaseUriFromAtom10_FromFeedElement() $entry = $feed->current(); $this->assertEquals('http://www.example.com', $entry->getBaseUrl()); } - + public function testGetsBaseUriFromAtom10_FromEntryElement() { $feed = Zend_Feed_Reader::importString( @@ -328,7 +328,7 @@ public function testGetsBaseUriFromAtom10_FromEntryElement() $entry = $feed->current(); $this->assertEquals('http://www.example.com/', $entry->getBaseUrl()); } - + /** * Get Comment HTML Link */ @@ -340,7 +340,7 @@ public function testGetsCommentLinkFromAtom03() $entry = $feed->current(); $this->assertEquals('http://www.example.com/entry/comments', $entry->getCommentLink()); } - + public function testGetsCommentLinkFromAtom10() { $feed = Zend_Feed_Reader::importString( @@ -349,7 +349,7 @@ public function testGetsCommentLinkFromAtom10() $entry = $feed->current(); $this->assertEquals('http://www.example.com/entry/comments', $entry->getCommentLink()); } - + public function testGetsCommentLinkFromAtom10_RelativeLinks() { $feed = Zend_Feed_Reader::importString( diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 62ccf19e..1fd69bd1 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -102,7 +102,7 @@ public function testGetsAuthorArrayFromAtom10() $this->assertEquals($authors, $feed->getAuthors()); } - /** + /** * Get Single Author (Unencoded Text) */ public function testGetsSingleAuthorFromAtom03() @@ -282,7 +282,7 @@ public function testGetsLinkFromAtom10() ); $this->assertEquals('http://www.example.com', $feed->getLink()); } - + public function testGetsLinkFromAtom10WithNoRelAttribute() { $feed = Zend_Feed_Reader::importString( @@ -290,7 +290,7 @@ public function testGetsLinkFromAtom10WithNoRelAttribute() ); $this->assertEquals('http://www.example.com', $feed->getLink()); } - + public function testGetsLinkFromAtom10WithRelativeUrl() { $feed = Zend_Feed_Reader::importString( @@ -298,7 +298,7 @@ public function testGetsLinkFromAtom10WithRelativeUrl() ); $this->assertEquals('http://www.example.com', $feed->getLink()); } - + /** * Get Base Uri */ @@ -328,7 +328,7 @@ public function testGetsFeedLinkFromAtom10() ); $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); } - + public function testGetsFeedLinkFromAtom10IfRelativeUri() { $feed = Zend_Feed_Reader::importString( diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index b226dab2..e5318536 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -1942,7 +1942,7 @@ public function testGetsDateModifiedFromRss20() file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } // DC 1.0 @@ -1953,7 +1953,7 @@ public function testGetsDateModifiedFromRss20_Dc10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss20.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss094_Dc10() @@ -1962,7 +1962,7 @@ public function testGetsDateModifiedFromRss094_Dc10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss094.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss093_Dc10() @@ -1971,7 +1971,7 @@ public function testGetsDateModifiedFromRss093_Dc10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss093.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss092_Dc10() @@ -1980,7 +1980,7 @@ public function testGetsDateModifiedFromRss092_Dc10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss092.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss091_Dc10() @@ -1989,7 +1989,7 @@ public function testGetsDateModifiedFromRss091_Dc10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss091.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss10_Dc10() @@ -1998,7 +1998,7 @@ public function testGetsDateModifiedFromRss10_Dc10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss10.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss090_Dc10() @@ -2007,7 +2007,7 @@ public function testGetsDateModifiedFromRss090_Dc10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss090.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } // DC 1.1 @@ -2018,7 +2018,7 @@ public function testGetsDateModifiedFromRss20_Dc11() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss20.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss094_Dc11() @@ -2027,7 +2027,7 @@ public function testGetsDateModifiedFromRss094_Dc11() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss094.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss093_Dc11() @@ -2036,7 +2036,7 @@ public function testGetsDateModifiedFromRss093_Dc11() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss093.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss092_Dc11() @@ -2045,7 +2045,7 @@ public function testGetsDateModifiedFromRss092_Dc11() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss092.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss091_Dc11() @@ -2054,7 +2054,7 @@ public function testGetsDateModifiedFromRss091_Dc11() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss091.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss10_Dc11() @@ -2063,7 +2063,7 @@ public function testGetsDateModifiedFromRss10_Dc11() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss10.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss090_Dc11() @@ -2072,7 +2072,7 @@ public function testGetsDateModifiedFromRss090_Dc11() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss090.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } // Atom 1.0 @@ -2083,7 +2083,7 @@ public function testGetsDateModifiedFromRss20_atom10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss20.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss094_atom10() @@ -2092,7 +2092,7 @@ public function testGetsDateModifiedFromRss094_atom10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss094.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss093_atom10() @@ -2101,7 +2101,7 @@ public function testGetsDateModifiedFromRss093_atom10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss093.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss092_atom10() @@ -2110,7 +2110,7 @@ public function testGetsDateModifiedFromRss092_atom10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss092.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss091_atom10() @@ -2119,7 +2119,7 @@ public function testGetsDateModifiedFromRss091_atom10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss091.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss10_atom10() @@ -2128,7 +2128,7 @@ public function testGetsDateModifiedFromRss10_atom10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss10.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } public function testGetsDateModifiedFromRss090_atom10() @@ -2137,7 +2137,7 @@ public function testGetsDateModifiedFromRss090_atom10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss090.xml') ); $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); } // Missing DateModified diff --git a/test/ReaderTest.php b/test/ReaderTest.php index c59f3cef..bd22c037 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -285,7 +285,7 @@ protected function _getTempDirectory() if (function_exists('sys_get_temp_dir')) { $dir = sys_get_temp_dir(); if ($this->_isGoodTmpDir($dir)) { - return $dir; + return $dir; } } $tempFile = tempnam(md5(uniqid(rand(), TRUE)), ''); @@ -309,7 +309,7 @@ protected function _isGoodTmpDir($dir) if (is_readable($dir) && is_writable($dir)) { return true; } - return false; + return false; } } From 30bc0645a26c6bf58d550575cb87e345f89295e1 Mon Sep 17 00:00:00 2001 From: padraic Date: Wed, 18 Nov 2009 14:02:55 +0000 Subject: [PATCH 046/238] Include in tests a reset of Zend_Date options to ensure ISO formatting is used. The original options are re-entered during teardown to prevent any option leaks into other test suites. Fixes the symptoms (of an unidentified settings leak outside of Zend_Feed_Reader) in ZF-8322. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19017 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Reader/Entry/AtomTest.php | 12 ++++++++++++ test/Reader/Entry/RssTest.php | 12 ++++++++++++ test/Reader/Feed/AtomTest.php | 14 ++++++++++++++ test/Reader/Feed/RssTest.php | 12 ++++++++++++ test/Reader/Integration/H-OnlineComAtom10Test.php | 12 ++++++++++++ test/Reader/Integration/LautDeRdfTest.php | 12 ++++++++++++ test/Reader/Integration/PodcastRss2Test.php | 12 ++++++++++++ test/Reader/Integration/WordpressAtom10Test.php | 12 ++++++++++++ 8 files changed, 98 insertions(+) diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index f1211a30..0455ef33 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -44,6 +44,18 @@ public function setup() unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Atom'; + $this->_options = Zend_Date::setOptions(); + foreach($this->_options as $k=>$v) { + if (is_null($v)) { + unset($this->_options[$k]); + } + } + Zend_Date::setOptions(array('format_type'=>'iso')); + } + + public function teardown() + { + Zend_Date::setOptions($this->_options); } /** diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index 6b4d72fa..89bc8203 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -44,6 +44,18 @@ public function setup() unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Rss'; + $this->_options = Zend_Date::setOptions(); + foreach($this->_options as $k=>$v) { + if (is_null($v)) { + unset($this->_options[$k]); + } + } + Zend_Date::setOptions(array('format_type'=>'iso')); + } + + public function teardown() + { + Zend_Date::setOptions($this->_options); } /** diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 1fd69bd1..02d4befe 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -36,6 +36,8 @@ class Zend_Feed_Reader_Feed_AtomTest extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; + + protected $_options = array(); public function setup() { @@ -44,6 +46,18 @@ public function setup() unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Atom'; + $this->_options = Zend_Date::setOptions(); + foreach($this->_options as $k=>$v) { + if (is_null($v)) { + unset($this->_options[$k]); + } + } + Zend_Date::setOptions(array('format_type'=>'iso')); + } + + public function teardown() + { + Zend_Date::setOptions($this->_options); } /** diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index e5318536..a8f9ba4b 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -44,6 +44,18 @@ public function setup() unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Rss'; + $this->_options = Zend_Date::setOptions(); + foreach($this->_options as $k=>$v) { + if (is_null($v)) { + unset($this->_options[$k]); + } + } + Zend_Date::setOptions(array('format_type'=>'iso')); + } + + public function teardown() + { + Zend_Date::setOptions($this->_options); } /** diff --git a/test/Reader/Integration/H-OnlineComAtom10Test.php b/test/Reader/Integration/H-OnlineComAtom10Test.php index b69554fe..c6e0d118 100644 --- a/test/Reader/Integration/H-OnlineComAtom10Test.php +++ b/test/Reader/Integration/H-OnlineComAtom10Test.php @@ -40,6 +40,18 @@ class Zend_Feed_Reader_Integration_HOnlineComAtom10Test extends PHPUnit_Framewor public function setup() { $this->_feedSamplePath = dirname(__FILE__) . '/_files/h-online.com-atom10.xml'; + $this->_options = Zend_Date::setOptions(); + foreach($this->_options as $k=>$v) { + if (is_null($v)) { + unset($this->_options[$k]); + } + } + Zend_Date::setOptions(array('format_type'=>'iso')); + } + + public function teardown() + { + Zend_Date::setOptions($this->_options); } public function testGetsTitle() diff --git a/test/Reader/Integration/LautDeRdfTest.php b/test/Reader/Integration/LautDeRdfTest.php index b49df2a4..cdf513f4 100644 --- a/test/Reader/Integration/LautDeRdfTest.php +++ b/test/Reader/Integration/LautDeRdfTest.php @@ -40,6 +40,18 @@ class Zend_Feed_Reader_Integration_LautDeRdfTest extends PHPUnit_Framework_TestC public function setup() { $this->_feedSamplePath = dirname(__FILE__) . '/_files/laut.de-rdf.xml'; + $this->_options = Zend_Date::setOptions(); + foreach($this->_options as $k=>$v) { + if (is_null($v)) { + unset($this->_options[$k]); + } + } + Zend_Date::setOptions(array('format_type'=>'iso')); + } + + public function teardown() + { + Zend_Date::setOptions($this->_options); } /** diff --git a/test/Reader/Integration/PodcastRss2Test.php b/test/Reader/Integration/PodcastRss2Test.php index 498ae392..cd600cbf 100644 --- a/test/Reader/Integration/PodcastRss2Test.php +++ b/test/Reader/Integration/PodcastRss2Test.php @@ -41,6 +41,18 @@ class Zend_Feed_Reader_Integration_PodcastRss2Test extends PHPUnit_Framework_Tes public function setup() { $this->_feedSamplePath = dirname(__FILE__) . '/_files/podcast.xml'; + $this->_options = Zend_Date::setOptions(); + foreach($this->_options as $k=>$v) { + if (is_null($v)) { + unset($this->_options[$k]); + } + } + Zend_Date::setOptions(array('format_type'=>'iso')); + } + + public function teardown() + { + Zend_Date::setOptions($this->_options); } /** diff --git a/test/Reader/Integration/WordpressAtom10Test.php b/test/Reader/Integration/WordpressAtom10Test.php index d42a786c..957edea0 100644 --- a/test/Reader/Integration/WordpressAtom10Test.php +++ b/test/Reader/Integration/WordpressAtom10Test.php @@ -40,6 +40,18 @@ class Zend_Feed_Reader_Integration_WordpressAtom10Test extends PHPUnit_Framework public function setup() { $this->_feedSamplePath = dirname(__FILE__) . '/_files/wordpress-atom10.xml'; + $this->_options = Zend_Date::setOptions(); + foreach($this->_options as $k=>$v) { + if (is_null($v)) { + unset($this->_options[$k]); + } + } + Zend_Date::setOptions(array('format_type'=>'iso')); + } + + public function teardown() + { + Zend_Date::setOptions($this->_options); } public function testGetsTitle() From 1ec00f6fb72e6519774a0dca35d1876eb5411ec2 Mon Sep 17 00:00:00 2001 From: padraic Date: Thu, 19 Nov 2009 12:38:15 +0000 Subject: [PATCH 047/238] Trim feed links detected from a website to strip newlines - fixes ZF-8327 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19028 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/FeedSet.php | 8 ++++---- test/ReaderTest.php | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index 21eb1cc1..b4699e40 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -62,16 +62,16 @@ public function addLinks(DOMNodeList $links) continue; } if (!isset($this->rss) && $link->getAttribute('type') == 'application/rss+xml') { - $this->rss = $link->getAttribute('href'); + $this->rss = trim($link->getAttribute('href')); } elseif(!isset($this->atom) && $link->getAttribute('type') == 'application/atom+xml') { - $this->atom = $link->getAttribute('href'); + $this->atom = trim($link->getAttribute('href')); } elseif(!isset($this->rdf) && $link->getAttribute('type') == 'application/rdf+xml') { - $this->rdf = $link->getAttribute('href'); + $this->rdf = trim($link->getAttribute('href')); } $this[] = new self(array( 'rel' => 'alternate', 'type' => $link->getAttribute('type'), - 'href' => $link->getAttribute('href'), + 'href' => trim($link->getAttribute('href')), )); } } diff --git a/test/ReaderTest.php b/test/ReaderTest.php index bd22c037..5b4306ea 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -213,6 +213,26 @@ public function testZeroCountFeedSetReturnedFromEmptyList() $links = Zend_Feed_Reader::findFeedLinks('http://www.example.com'); $this->assertEquals(0, count($links)); } + + /** + * @group ZF-8327 + */ + public function testGetsFeedLinksAndTrimsNewlines() + { + if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + ) { + $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); + return; + } + + try { + $links = Zend_Feed_Reader::findFeedLinks('http://www.infopod.com.br'); + } catch(Exception $e) { + $this->fail($e->getMessage()); + } + $this->assertEquals('http://feeds.feedburner.com/jonnyken/infoblog', $links->rss); + } public function testAddsPrefixPath() { From a39489f659ff931f78b7a26524069b9d8d51692c Mon Sep 17 00:00:00 2001 From: padraic Date: Thu, 19 Nov 2009 13:30:31 +0000 Subject: [PATCH 048/238] Added an exception throw for URLs which do not point to a valid feed. Fixes ZF-8328 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19031 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader.php | 6 +++++- test/ReaderTest.php | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/Reader.php b/src/Reader.php index 5c51bf78..75573f7f 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -341,8 +341,12 @@ public static function importString($string) if (substr($type, 0, 3) == 'rss') { $reader = new Zend_Feed_Reader_Feed_Rss($dom, $type); - } else { + } elseif (substr($type, 0, 4) == 'atom') { $reader = new Zend_Feed_Reader_Feed_Atom($dom, $type); + } else { + 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; } diff --git a/test/ReaderTest.php b/test/ReaderTest.php index 5b4306ea..195fd041 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -156,6 +156,22 @@ public function testImportsUri() $this->fail($e->getMessage()); } } + + /** + * @group ZF-8328 + * @expectedException Zend_Feed_Exception + */ + public function testImportsUriAndThrowsExceptionIfNotAFeed() + { + if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + ) { + $this->markTestSkipped('testImportsUri() requires a network connection'); + return; + } + + $feed = Zend_Feed_Reader::import('http://twitter.com/alganet'); + } public function testGetsFeedLinksAsValueObject() { From 6018978fcbf8a7b264ae2995037d92417bc35158 Mon Sep 17 00:00:00 2001 From: padraic Date: Thu, 19 Nov 2009 15:17:08 +0000 Subject: [PATCH 049/238] Added a default encoding of UTF-8 where one is left undefined in feed - fixes ZF-8213 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19040 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/EntryAbstract.php | 3 + src/Reader/FeedAbstract.php | 3 + test/Reader/Entry/CommonTest.php | 24 + .../_files/Common/atom_noencodingdefined.xml | 726 ++++++++++++++++++ test/Reader/Feed/CommonTest.php | 23 + .../_files/Common/atom_noencodingdefined.xml | 726 ++++++++++++++++++ 6 files changed, 1505 insertions(+) create mode 100644 test/Reader/Entry/_files/Common/atom_noencodingdefined.xml create mode 100644 test/Reader/Feed/_files/Common/atom_noencodingdefined.xml diff --git a/src/Reader/EntryAbstract.php b/src/Reader/EntryAbstract.php index 94cbe7e4..2c1f4a95 100644 --- a/src/Reader/EntryAbstract.php +++ b/src/Reader/EntryAbstract.php @@ -118,6 +118,9 @@ public function getElement() public function getEncoding() { $assumed = $this->getDomDocument()->encoding; + if (empty($assumed)) { + $assumed = 'UTF-8'; + } return $assumed; } diff --git a/src/Reader/FeedAbstract.php b/src/Reader/FeedAbstract.php index f769cca0..925da083 100644 --- a/src/Reader/FeedAbstract.php +++ b/src/Reader/FeedAbstract.php @@ -153,6 +153,9 @@ public function getDomDocument() public function getEncoding() { $assumed = $this->getDomDocument()->encoding; + if (empty($assumed)) { + $assumed = 'UTF-8'; + } return $assumed; } diff --git a/test/Reader/Entry/CommonTest.php b/test/Reader/Entry/CommonTest.php index d6cb6a30..ef39e53f 100644 --- a/test/Reader/Entry/CommonTest.php +++ b/test/Reader/Entry/CommonTest.php @@ -111,6 +111,30 @@ public function testReturnsNullIfExtensionDoesNotExist() $entry = $feed->current(); $this->assertEquals(null, $entry->getExtension('Foo')); } + + /** + * @group ZF-8213 + */ + public function testReturnsEncodingOfFeed() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom.xml') + ); + $entry = $feed->current(); + $this->assertEquals('UTF-8', $entry->getEncoding()); + } + + /** + * @group ZF-8213 + */ + public function testReturnsEncodingOfFeedAsUtf8IfUndefined() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom_noencodingdefined.xml') + ); + $entry = $feed->current(); + $this->assertEquals('UTF-8', $entry->getEncoding()); + } } diff --git a/test/Reader/Entry/_files/Common/atom_noencodingdefined.xml b/test/Reader/Entry/_files/Common/atom_noencodingdefined.xml new file mode 100644 index 00000000..3e31cbaf --- /dev/null +++ b/test/Reader/Entry/_files/Common/atom_noencodingdefined.xml @@ -0,0 +1,726 @@ + + Norm 2782 + Why are you here? + + 2009-03-07T08:03:50Z + WordPress + + + http://www.norm2782.com/feed/atom/ + + + + + norm2782 + http://www.norm2782.com + + <![CDATA[Wth… reading books?]]> + + http://www.norm2782.com/?p=114 + 2009-03-07T08:03:50Z + 2009-03-02T08:09:33Z + + Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

+ + +

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[My first few weeks in New Zealand]]> + + http://www.norm2782.com/?p=105 + 2009-02-18T03:30:07Z + 2009-02-15T03:29:21Z + + It’s been a while since my last blog post. Things have been quite hectic for me these last few weeks. There was my final week at Angry Bytes, followed by a pre-NZ party and then my trip to New Zealand. Currently New Zealand looks pretty much the same as the Netherlands, seeing as I’m locked away in an office most of my time.

+ +


+My adventure into Kiwi-land started with a long and interesting trip to San Francisco. The interesting part was my new book: Domain Driven Design: Tackling Complexity in the Heart of Software, by Eric Evans. This book, combined with KLM’s excellent on-board service made my flight to SF a breeze.

+

It was only 2PM when I arrived in SF, so I had to wait another 4 hours before my flight to Auckland even boarded. The waiting wasn’t too bad. It was great to get out into the sun and to grab some decent food and coffee. Didn’t get to see much of SF though, which was too bad.

+

SF Airport

+

The flight to Auckland wasn’t that flawless unfortunately. There were some technical problems with the airplane, which caused quite a bit of a delay. Because of this delay I had to run to catch my flight to Dunedin. The flight was all set to go and was waiting for me… I barely made it in time!

+ +

Flying to Dunedin

+

When I got to Dunedin I was welcomed by Jesse, Tracey and Lindsay. It was great to meet them in person. The first order of business for me was to get some coffee, because I only got roughly 3 hours of sleep on my way there. After a little tour of Abbey College (that’s where I’m staying) it was time for our first meeting. No time for sleep! Finally, after dinner at Abbey, I decided it was time to get some sleep. When I woke up the next day, the jet-lag was no more!

+

My Room

+

Abbey is a great place to stay by the way. It’s not far from the office or from the city center. The people who are staying there are great as well. Just check out the site. Abbey’s got it all!

+ +

View from my room

+

So what am I doing here in NZ? We’re currently working on writing the software for the PBRF initiative. It has already taken a lot of late hours, and it will probably take a lot more. It will be worth it though! After that, we’ll be working on a great and exciting cutting-edge open-source project. Unfortunately I can’t say a lot more at this point, but you can rest assured that it includes the latest Zend Framework technologies.

+

My Desk

+

Seeing as I don’t have internet-access at Abbey College yet, I’ve got lots of time for other activities. I’ve finished reading the better part of my Domain Driven Design book and I’ve ordered Martin Fowler’s Patterns Of Enterprise Application Architecture, which should arrive this week. I’ve also bought myself a brand new bicycle so I can get around. Cycling here is a bit more dangerous than in the Netherlands though… it definitely brings back memories from my bicycling trip in Scotland! There are lots more things on my todo list: winery tour, surfing, snowboarding, skydiving, bungee-jumping, renting/buying a Harley… six months in NZ is not going to be enough time!

+ +

Me!

+

Well, that’s my first NZ blog-post. There will definitely be more of these! Let’s hope they fix my internet soon… See my Flickr photo-stream for more pictures.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Properties in PHP – revisited]]> + + http://www.norm2782.com/?p=94 + 2009-01-14T10:47:25Z + 2009-01-14T10:47:25Z + + A while ago I was daydreaming about native property support in PHP. Unfortunately it will be a while before PHP itself will support this natively and an even longer while before shared hosting providers will upgrade to a newer version of PHP.

+ +

So what’s the big deal about those properties? In short, they make a developers life easier by allowing the developer to code no more than needed at that moment. And lets face it… less code is better! In this post we’ll see that it’s not impossible to enjoy properties in PHP today. As with a lot of good things, it does come with a small price though…

+


+Lets have a look at a use-case to demonstrate where properties will not only save you time, but it will also save your sanity. In this example we’re modeling a Person class. In the beginning of the project, the requirements for the Person class are quite simple: a Person has an age and a name. In the simplest form we can code that as follows:

+
+<?php
+class Person
+{
+    public $age;
+
+    public $name;
+}
+
+
+

This look easy enough, and it is. It even works like a charm and it’s possibly the fastest implementation for the Person class.

+

But, pesky as they are, the client suddenly wants some logic added to our Person class! A Person suddenly can’t be younger than 21 years old. This poses a problem. To add logic to our Person class, we would have to switch the public age attribute with a pair of getters and setters:

+
+<?php
+class Person
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+

Technically this works like a charm, however it will force me to go through my entire application and switch all references from the public attribute to the getter and setter. Not an ideal situation. One possible solution is to do things the Java way: just create all getters and setters up-front so you don’t have to do so afterwards. Even though this works fine, it’s in violation of our mission to write no more code than we actually need at the moment of writing.

+ +

The solution? Properties! But wait… PHP doesn’t support those, remember? Luckily we still have magic methods. It’s nowhere near as nice as a native solution, but at least it helps us write no more code than we need at the moment we’re first writing our code:

+
+<?php
+abstract class ModelAbstract
+{
+    public function __get($key)
+    {
+        $method = 'get' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        return $this->$method();
+    }
+
+    public function __set($key, $value)
+    {
+        $method = 'set' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        $this->$method($value);
+    }
+}
+
+

We’ll take a look at what this does exactly later. The important thing to note is that we can now do the following:

+
+<?php
+class Person extends ModelAbstract
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+$person = new Person();
+
+try {
+    $person->age = 10;
+} catch (Exception $e) {
+    // Will print "You need to be at least 21 years or older!"
+    echo $e->getMessage();
+}
+
+
+

With this construction in place, we can safely switch from a public attribute to getters and setters, without changing the rest of the application code. The only real downside to this – aside from the minor speed impact – is the fact that you have to subclass ModelAbstract to make this work. Luckily it’s not a lot of code, so should there be a big need to get rid of the ModelAbstract inheritance it’s not a big disaster to do some copy/paste work.

+

This method works by assuming you have get- and set methods that have the same name as the property you’re trying to access. When there’s a public attribute, it will use that. If there’s no public attribute, it will fall back to __get or __set and the logic will take it from there.

+

All of this is just a proof-of-concept of implementing properties in PHP and of the way I want to be using properties to access data the data in my objects. Please comment your experiences with this approach or similar approaches. I’m curious to see how practical this solution would be in a real-life situation.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Filters for Zend_Paginator]]> + + http://www.norm2782.com/?p=72 + 2009-01-14T08:23:19Z + 2009-01-13T12:57:53Z + + Zend_Paginator has a new feature! It is now possible to add a filter to your Paginator object which acts on the data retrieved from the adapter. This filter can be any instance of Zend_Filter_Interface, including a filter-chain. If a filter(-chain) is set, the raw data from the adapter will be passed to the filter() method.

+ +


+So why would you want to apply filters to your result set? Usually my domain models don’t inherit from Zend_Db_Table_Row but that is the data type I get from the Paginator when I use the DbTableSelect adapter (wrapped in a nice Zend_Db_Table_Rowset). Instead, I would like to load my rows into my models and preferably without using the Paginator abilities or having to apply weird hacks. Previously this was only possible (in a sane way) by subclassing an adapter so it could return a collection of model objects instead of a rowset. With the new filter support you can just inject a filter to do this for you.

+

Lets have a look at an example. In this example I want to list all my users from the database. I’ll grab the name of the user from the row and inject it into a User object.

+
+<?php
+class User
+{
+    private $_name = '';
+
+    public function getName()
+    {
+        return $this->_name;
+    }
+
+    public function setName($name)
+    {
+        $this->_name = $name;
+    }
+}
+
+class UserFilter implements Zend_Filter_Interface
+{
+    public function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new UserFilter());
+
+        return $paginator;
+    }
+}
+
+$paginator = MyModel::getUserPaginator();
+$items = $paginator->getCurrentItems();
+
+foreach ($items as $user) {
+    echo 'Current name: ' . $user->getName() . '<br />' . PHP_EOL;
+}
+
+
+

To simplify adding a simple filter to your paginator I’ve also added Zend_Filter_Callback. This allows you to specify a callback method that does the same as the filter in the previous example.

+
+<?php
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new Zend_Filter_Callback(
+            array('MyModel', 'filter'))
+        );
+
+        return $paginator;
+    }
+
+    public static function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+

The callback also accepts object instead of a static reference to a class. Internally it uses call_user_func to execute the filter() method, so any notation that works there, works with the Callback filter.

+

Enjoy!

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[ZF-3239]]> + + http://www.norm2782.com/?p=68 + 2009-01-11T09:53:20Z + 2009-01-07T11:48:31Z + + Zend_Db_Table_Select users, rejoice! I’ve just committed a patch for ZF-3239 in revision 13530. This should be a relief for those of you who have been implementing workarounds for those “No table has been specified for the FROM clause” exceptions.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[New in-ear earphones]]> + + http://www.norm2782.com/?p=53 + 2009-01-03T18:51:43Z + 2009-01-03T15:49:19Z + + Just got myself the Sennheiser CX 300 II Precision in-ear earphones. Check ‘em out by clicking the read more link!

+ +


+cx300

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Seven Things – Tagged by Pádraic]]> + + http://www.norm2782.com/?p=44 + 2009-01-03T11:47:19Z + 2009-01-03T10:14:38Z + + Well, this was bound to happen: I got tagged by Pádraic because I’m working on Zend_Feed_Reader with him. Luckily I’ve just setup this new blog, so here we go!

+ +

Did you know that…

+
    +
  • Every bit of PHP I know is self-taught
  • +
  • My programming adventure started out with Visual Basic 3 back in 1993. I was just 8 years old back then and had no clue what I was doing.
  • +
  • My left foot is actually a few millimeter bigger than my right foot.
  • +
  • I used to have long hair (almost reached my ass). I cut it off in the summer of ‘08 for various reasons, one of which was 100 euro.
  • +
  • I bought my Harley Davidson before I even had my drivers license.
  • +
  • My whisky collection (only single malts ;) ) keeps growing instead of shrinking
  • + +
  • While I use a Mac, with an Apple Cinema Display and an Apple keyboard… I have an HTC Touch with Windows Mobile and I’m stuck with it for at least a few more months.
  • +
+

Now it’s my turn to start tagging!

+
    +
  • Stefan Koopmanschap – For not being tagged yet and having said so on Twitter
  • +
  • Maurice Fonk – For being my co-worker and for not having finished Madoqua yet
  • + +
  • Geoffrey Bachelet – For the great party in Paris
  • +
  • Wade Arnold – For doing a great job on Zend_AMF and having the same WordPress theme as me.
  • +
  • Kana Yeh – For being the coolest PHP girl in the Netherlands (that I know of)
  • +
  • Matthew Ratzloff – For his great help on Zend_Paginator
  • + +
  • And one more here…
  • +
+

As for the rules:

+
    +
  • Link your original tagger(s), and list these rules on your blog.
  • +
  • Share seven facts about yourself in the post – some random, some wierd.
  • +
  • Tag seven people at the end of your post by leaving their names and the links to their blogs.
  • +
  • Let them know they’ve been tagged by leaving a comment on their blogs and/or Twitter.
  • + +
+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[AMF Server class for WordPress]]> + + http://www.norm2782.com/?p=27 + 2009-01-06T15:00:54Z + 2009-01-02T14:49:42Z + + After browsing through WordPress’ code I quickly found that there’s no sane way to create AMF support as a WP plugin. At least not for someone who hasn’t done any old-skool procedural PHP in years. Instead of writing a plugin, I decided to write a standalone server script. It’s still very basic and currently setup to work for me. To get it working for your WP setup you should probably make some minor modifications. Click the read more link to check out the code. I’ve released it under the generous BSD license, so knock yourself out! Use it at your own risk… I’m not going to support it. Any updates will be posted in this post. Also, please note that I haven’t tested it yet. If you access the script directly it should output “Zend Amf Endpoint” just fine, but that’s all I can guarantee at this point ;)

+ +

+
+<?php
+/**
+ * BSD LICENSE
+ *
+ * Copyright (c) 2009, norm2782
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of norm2782 nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * Set production mode.
+ * If set to false, exceptions will bubble through to the Flex frontend
+ *
+ * @var bool
+ */
+$production = false;
+
+/**
+ * Determine the absolute path of the AMF server
+ *
+ * @var string
+ */
+define('ABSPATH', dirname(__FILE__) . '/');
+
+/**
+ * One directory below docroot. Your config file and library dir should be here.
+ *
+ * @var string
+ */
+define('SUBPATH', dirname(ABSPATH));
+
+/**
+ * You should make sure Zend Framework is in your include path
+ */
+set_include_path(
+    implode(PATH_SEPARATOR, array(
+        SUBPATH . '/library',
+        get_include_path()
+    ))
+);
+
+/**
+ * Include the WordPress config file
+ */
+$configFile = SUBPATH . '/wp-config.php';
+
+if (!file_exists($configFile)) {
+    throw new Exception('WordPress config file was not found!');
+}
+
+require_once $configFile;
+
+/**
+ * No need to config more stuff from this point on
+ */
+
+/**
+ * @see Zend_Amf_Server
+ */
+require_once 'Zend/Amf/Server.php';
+
+/**
+ * @see Zend_Db_Adapter_Pdo_Mysql
+ */
+require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
+
+/**
+ * @see Zend_Paginator
+ */
+require_once 'Zend/Paginator.php';
+
+/**
+ * @see Zend_Paginator_Adapter_DbSelect
+ */
+require_once 'Zend/Paginator/Adapter/DbSelect.php';
+
+/**
+ * Simple class to expose wordpress data through AMF
+ *
+ * @author norm2782
+ */
+class Wp_Amf_Gateway
+{
+    /**
+     * Database adapter
+     *
+     * @var Zend_Db_Adapter_Pdo_Mysql
+     */
+    private $_db = null;
+
+    /**
+     * WordPress table prefix
+     *
+     * @var string
+     */
+    private $_prefix = null;
+
+    /**
+     * Constructor
+     *
+     * @param array $dbConfig
+     * @param string $prefix
+     * @return void
+     */
+    public function __construct(array $dbConfig, $prefix)
+    {
+        $this->_db = new Zend_Db_Adapter_Pdo_Mysql($dbConfig);
+        $this->_db->query('SET NAMES `utf8`');
+
+        $this->_prefix = $prefix;
+    }
+
+    /**
+     * Get paginated results for the provided query
+     *
+     * @param Zend_Db_Select $select
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    private function _getPaginated(Zend_Db_Select $select, $page, $itemsPerPage)
+    {
+        $paginator = new Zend_Paginator(
+            new Zend_Paginator_Adapter_DbSelect($select)
+        );
+
+        $paginator->setCurrentPageNumber($page)
+                  ->setItemCountPerPage($itemsPerPage);
+
+        return array(
+            'info'  => $paginator->getPages(),
+            'items' => $paginator->getCurrentItems()
+        );
+    }
+
+    /**
+     * Get the comments for the specified post ID
+     *
+     * @param int $postId
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getCommentsForPost($postId, $page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'comments')
+                                      ->where('comment_post_ID = ?', $postId);
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+
+    /**
+     * Get the meta data for the specified post ID
+     *
+     * @param $postId
+     * @return unknown_type
+     */
+    public function getMetaForPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'postmeta')
+                                      ->where('post_id = ?', $postId);
+
+        return $this->_db->fetchAll($select);
+    }
+
+    /**
+     * Get a post by specifying its ID
+     *
+     * @param int $postId
+     * @return array
+     */
+    public function getPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts')
+                                      ->where('ID = ?', $postId);
+
+        return $this->_db->fetchOne($select);
+    }
+
+    /**
+     * Get posts per page
+     *
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getPosts($page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts');
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+}
+
+/**
+ * Pass the values from wp-config.php to the Wp_Amf_Gateway class.
+ */
+$gateway = new Wp_Amf_Gateway(
+    array(
+        'host'     => DB_HOST,
+        'username' => DB_USER,
+        'password' => DB_PASSWORD,
+        'dbname'   => DB_NAME
+    ),
+    $table_prefix
+);
+
+$server = new Zend_Amf_Server();
+$server->setProduction($production)
+       ->setClass($gateway)
+       ->handle();
+
+
+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Flex frontend]]> + + http://www.norm2782.com/?p=22 + 2009-01-02T09:27:20Z + 2009-01-01T23:29:35Z + + I was planning on writing a quick Flex frontend for this blog, but it appears WordPress only offers the posts themselves as RSS feed. If I get real bored (which I doubt, unfortunately) I’ll have a look and see if I can create a Zend_AMF plugin for WordPress that allows me to retrieve virtually all data from my WordPress install. Would be cool :D

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Properties in PHP]]> + + http://www.norm2782.com/?p=8 + 2009-01-02T15:13:15Z + 2009-01-01T23:02:54Z + + A while ago Dynom from #php_bnl pointed me to an interesting entry on the PHP 5.3 wiki page. In the “Future PHP releases” sections there’s an entry called “29. “real†properties with attached getters and setters”. Personally I can’t wait for this. Hopefully it will look something like ActionScript 3’s properties:

+
+<?php
+class Bar
+{
+    private $_foo = 'foo';
+
+    public function get foo()
+    {
+        return $this->_foo;
+    }
+
+    public function set foo($fooString)
+    {
+        $this->_foo = $fooString;
+    }
+}
+
+$bar = new Bar();
+$bar->foo = 'baz';
+echo $bar->foo; // prints baz
+
+
+]]>
+ + + 0 +
+
diff --git a/test/Reader/Feed/CommonTest.php b/test/Reader/Feed/CommonTest.php index a416d195..a7567577 100644 --- a/test/Reader/Feed/CommonTest.php +++ b/test/Reader/Feed/CommonTest.php @@ -22,6 +22,7 @@ require_once 'PHPUnit/Framework/TestCase.php'; require_once 'Zend/Feed/Reader.php'; +require_once 'Zend/Registry.php'; /** * @category Zend @@ -104,6 +105,28 @@ public function testReturnsNullIfExtensionDoesNotExist() ); $this->assertEquals(null, $feed->getExtension('Foo')); } + + /** + * @group ZF-8213 + */ + public function testReturnsEncodingOfFeed() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom.xml') + ); + $this->assertEquals('UTF-8', $feed->getEncoding()); + } + + /** + * @group ZF-8213 + */ + public function testReturnsEncodingOfFeedAsUtf8IfUndefined() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom_noencodingdefined.xml') + ); + $this->assertEquals('UTF-8', $feed->getEncoding()); + } } diff --git a/test/Reader/Feed/_files/Common/atom_noencodingdefined.xml b/test/Reader/Feed/_files/Common/atom_noencodingdefined.xml new file mode 100644 index 00000000..3e31cbaf --- /dev/null +++ b/test/Reader/Feed/_files/Common/atom_noencodingdefined.xml @@ -0,0 +1,726 @@ + + Norm 2782 + Why are you here? + + 2009-03-07T08:03:50Z + WordPress + + + http://www.norm2782.com/feed/atom/ + + + + + norm2782 + http://www.norm2782.com + + <![CDATA[Wth… reading books?]]> + + http://www.norm2782.com/?p=114 + 2009-03-07T08:03:50Z + 2009-03-02T08:09:33Z + + Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

+ + +

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[My first few weeks in New Zealand]]> + + http://www.norm2782.com/?p=105 + 2009-02-18T03:30:07Z + 2009-02-15T03:29:21Z + + It’s been a while since my last blog post. Things have been quite hectic for me these last few weeks. There was my final week at Angry Bytes, followed by a pre-NZ party and then my trip to New Zealand. Currently New Zealand looks pretty much the same as the Netherlands, seeing as I’m locked away in an office most of my time.

+ +


+My adventure into Kiwi-land started with a long and interesting trip to San Francisco. The interesting part was my new book: Domain Driven Design: Tackling Complexity in the Heart of Software, by Eric Evans. This book, combined with KLM’s excellent on-board service made my flight to SF a breeze.

+

It was only 2PM when I arrived in SF, so I had to wait another 4 hours before my flight to Auckland even boarded. The waiting wasn’t too bad. It was great to get out into the sun and to grab some decent food and coffee. Didn’t get to see much of SF though, which was too bad.

+

SF Airport

+

The flight to Auckland wasn’t that flawless unfortunately. There were some technical problems with the airplane, which caused quite a bit of a delay. Because of this delay I had to run to catch my flight to Dunedin. The flight was all set to go and was waiting for me… I barely made it in time!

+ +

Flying to Dunedin

+

When I got to Dunedin I was welcomed by Jesse, Tracey and Lindsay. It was great to meet them in person. The first order of business for me was to get some coffee, because I only got roughly 3 hours of sleep on my way there. After a little tour of Abbey College (that’s where I’m staying) it was time for our first meeting. No time for sleep! Finally, after dinner at Abbey, I decided it was time to get some sleep. When I woke up the next day, the jet-lag was no more!

+

My Room

+

Abbey is a great place to stay by the way. It’s not far from the office or from the city center. The people who are staying there are great as well. Just check out the site. Abbey’s got it all!

+ +

View from my room

+

So what am I doing here in NZ? We’re currently working on writing the software for the PBRF initiative. It has already taken a lot of late hours, and it will probably take a lot more. It will be worth it though! After that, we’ll be working on a great and exciting cutting-edge open-source project. Unfortunately I can’t say a lot more at this point, but you can rest assured that it includes the latest Zend Framework technologies.

+

My Desk

+

Seeing as I don’t have internet-access at Abbey College yet, I’ve got lots of time for other activities. I’ve finished reading the better part of my Domain Driven Design book and I’ve ordered Martin Fowler’s Patterns Of Enterprise Application Architecture, which should arrive this week. I’ve also bought myself a brand new bicycle so I can get around. Cycling here is a bit more dangerous than in the Netherlands though… it definitely brings back memories from my bicycling trip in Scotland! There are lots more things on my todo list: winery tour, surfing, snowboarding, skydiving, bungee-jumping, renting/buying a Harley… six months in NZ is not going to be enough time!

+ +

Me!

+

Well, that’s my first NZ blog-post. There will definitely be more of these! Let’s hope they fix my internet soon… See my Flickr photo-stream for more pictures.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Properties in PHP – revisited]]> + + http://www.norm2782.com/?p=94 + 2009-01-14T10:47:25Z + 2009-01-14T10:47:25Z + + A while ago I was daydreaming about native property support in PHP. Unfortunately it will be a while before PHP itself will support this natively and an even longer while before shared hosting providers will upgrade to a newer version of PHP.

+ +

So what’s the big deal about those properties? In short, they make a developers life easier by allowing the developer to code no more than needed at that moment. And lets face it… less code is better! In this post we’ll see that it’s not impossible to enjoy properties in PHP today. As with a lot of good things, it does come with a small price though…

+


+Lets have a look at a use-case to demonstrate where properties will not only save you time, but it will also save your sanity. In this example we’re modeling a Person class. In the beginning of the project, the requirements for the Person class are quite simple: a Person has an age and a name. In the simplest form we can code that as follows:

+
+<?php
+class Person
+{
+    public $age;
+
+    public $name;
+}
+
+
+

This look easy enough, and it is. It even works like a charm and it’s possibly the fastest implementation for the Person class.

+

But, pesky as they are, the client suddenly wants some logic added to our Person class! A Person suddenly can’t be younger than 21 years old. This poses a problem. To add logic to our Person class, we would have to switch the public age attribute with a pair of getters and setters:

+
+<?php
+class Person
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+

Technically this works like a charm, however it will force me to go through my entire application and switch all references from the public attribute to the getter and setter. Not an ideal situation. One possible solution is to do things the Java way: just create all getters and setters up-front so you don’t have to do so afterwards. Even though this works fine, it’s in violation of our mission to write no more code than we actually need at the moment of writing.

+ +

The solution? Properties! But wait… PHP doesn’t support those, remember? Luckily we still have magic methods. It’s nowhere near as nice as a native solution, but at least it helps us write no more code than we need at the moment we’re first writing our code:

+
+<?php
+abstract class ModelAbstract
+{
+    public function __get($key)
+    {
+        $method = 'get' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        return $this->$method();
+    }
+
+    public function __set($key, $value)
+    {
+        $method = 'set' . ucfirst($key);
+
+        if (!method_exists($this, $method)) {
+            throw new Exception('No property found for ' . $key);
+        }
+
+        $this->$method($value);
+    }
+}
+
+

We’ll take a look at what this does exactly later. The important thing to note is that we can now do the following:

+
+<?php
+class Person extends ModelAbstract
+{
+    private $_age = null;
+
+    public $name = null;
+
+    public function getAge()
+    {
+        return $this->_age;
+    }
+
+    public function setAge($age)
+    {
+        if ($age < 21) {
+            throw new Exception('You need to be at least 21 years or older!');
+        }
+
+        $this->_age = $age;
+    }
+}
+
+$person = new Person();
+
+try {
+    $person->age = 10;
+} catch (Exception $e) {
+    // Will print "You need to be at least 21 years or older!"
+    echo $e->getMessage();
+}
+
+
+

With this construction in place, we can safely switch from a public attribute to getters and setters, without changing the rest of the application code. The only real downside to this – aside from the minor speed impact – is the fact that you have to subclass ModelAbstract to make this work. Luckily it’s not a lot of code, so should there be a big need to get rid of the ModelAbstract inheritance it’s not a big disaster to do some copy/paste work.

+

This method works by assuming you have get- and set methods that have the same name as the property you’re trying to access. When there’s a public attribute, it will use that. If there’s no public attribute, it will fall back to __get or __set and the logic will take it from there.

+

All of this is just a proof-of-concept of implementing properties in PHP and of the way I want to be using properties to access data the data in my objects. Please comment your experiences with this approach or similar approaches. I’m curious to see how practical this solution would be in a real-life situation.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Filters for Zend_Paginator]]> + + http://www.norm2782.com/?p=72 + 2009-01-14T08:23:19Z + 2009-01-13T12:57:53Z + + Zend_Paginator has a new feature! It is now possible to add a filter to your Paginator object which acts on the data retrieved from the adapter. This filter can be any instance of Zend_Filter_Interface, including a filter-chain. If a filter(-chain) is set, the raw data from the adapter will be passed to the filter() method.

+ +


+So why would you want to apply filters to your result set? Usually my domain models don’t inherit from Zend_Db_Table_Row but that is the data type I get from the Paginator when I use the DbTableSelect adapter (wrapped in a nice Zend_Db_Table_Rowset). Instead, I would like to load my rows into my models and preferably without using the Paginator abilities or having to apply weird hacks. Previously this was only possible (in a sane way) by subclassing an adapter so it could return a collection of model objects instead of a rowset. With the new filter support you can just inject a filter to do this for you.

+

Lets have a look at an example. In this example I want to list all my users from the database. I’ll grab the name of the user from the row and inject it into a User object.

+
+<?php
+class User
+{
+    private $_name = '';
+
+    public function getName()
+    {
+        return $this->_name;
+    }
+
+    public function setName($name)
+    {
+        $this->_name = $name;
+    }
+}
+
+class UserFilter implements Zend_Filter_Interface
+{
+    public function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new UserFilter());
+
+        return $paginator;
+    }
+}
+
+$paginator = MyModel::getUserPaginator();
+$items = $paginator->getCurrentItems();
+
+foreach ($items as $user) {
+    echo 'Current name: ' . $user->getName() . '<br />' . PHP_EOL;
+}
+
+
+

To simplify adding a simple filter to your paginator I’ve also added Zend_Filter_Callback. This allows you to specify a callback method that does the same as the filter in the previous example.

+
+<?php
+class MyModel
+{
+    public static function getUserPaginator()
+    {
+        $userTable = new UserTable();
+        $paginator = Zend_Paginator::factory($userTable->select());
+        $paginator->setFilter(new Zend_Filter_Callback(
+            array('MyModel', 'filter'))
+        );
+
+        return $paginator;
+    }
+
+    public static function filter($rows)
+    {
+        $users = array();
+
+        foreach ($rows as $row) {
+            $user = new User();
+            $user->setName($row->name);
+
+            $users[] = $user;
+        }
+
+        return $rows;
+    }
+}
+
+

The callback also accepts object instead of a static reference to a class. Internally it uses call_user_func to execute the filter() method, so any notation that works there, works with the Callback filter.

+

Enjoy!

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[ZF-3239]]> + + http://www.norm2782.com/?p=68 + 2009-01-11T09:53:20Z + 2009-01-07T11:48:31Z + + Zend_Db_Table_Select users, rejoice! I’ve just committed a patch for ZF-3239 in revision 13530. This should be a relief for those of you who have been implementing workarounds for those “No table has been specified for the FROM clause” exceptions.

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[New in-ear earphones]]> + + http://www.norm2782.com/?p=53 + 2009-01-03T18:51:43Z + 2009-01-03T15:49:19Z + + Just got myself the Sennheiser CX 300 II Precision in-ear earphones. Check ‘em out by clicking the read more link!

+ +


+cx300

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Seven Things – Tagged by Pádraic]]> + + http://www.norm2782.com/?p=44 + 2009-01-03T11:47:19Z + 2009-01-03T10:14:38Z + + Well, this was bound to happen: I got tagged by Pádraic because I’m working on Zend_Feed_Reader with him. Luckily I’ve just setup this new blog, so here we go!

+ +

Did you know that…

+
    +
  • Every bit of PHP I know is self-taught
  • +
  • My programming adventure started out with Visual Basic 3 back in 1993. I was just 8 years old back then and had no clue what I was doing.
  • +
  • My left foot is actually a few millimeter bigger than my right foot.
  • +
  • I used to have long hair (almost reached my ass). I cut it off in the summer of ‘08 for various reasons, one of which was 100 euro.
  • +
  • I bought my Harley Davidson before I even had my drivers license.
  • +
  • My whisky collection (only single malts ;) ) keeps growing instead of shrinking
  • + +
  • While I use a Mac, with an Apple Cinema Display and an Apple keyboard… I have an HTC Touch with Windows Mobile and I’m stuck with it for at least a few more months.
  • +
+

Now it’s my turn to start tagging!

+
    +
  • Stefan Koopmanschap – For not being tagged yet and having said so on Twitter
  • +
  • Maurice Fonk – For being my co-worker and for not having finished Madoqua yet
  • + +
  • Geoffrey Bachelet – For the great party in Paris
  • +
  • Wade Arnold – For doing a great job on Zend_AMF and having the same WordPress theme as me.
  • +
  • Kana Yeh – For being the coolest PHP girl in the Netherlands (that I know of)
  • +
  • Matthew Ratzloff – For his great help on Zend_Paginator
  • + +
  • And one more here…
  • +
+

As for the rules:

+
    +
  • Link your original tagger(s), and list these rules on your blog.
  • +
  • Share seven facts about yourself in the post – some random, some wierd.
  • +
  • Tag seven people at the end of your post by leaving their names and the links to their blogs.
  • +
  • Let them know they’ve been tagged by leaving a comment on their blogs and/or Twitter.
  • + +
+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[AMF Server class for WordPress]]> + + http://www.norm2782.com/?p=27 + 2009-01-06T15:00:54Z + 2009-01-02T14:49:42Z + + After browsing through WordPress’ code I quickly found that there’s no sane way to create AMF support as a WP plugin. At least not for someone who hasn’t done any old-skool procedural PHP in years. Instead of writing a plugin, I decided to write a standalone server script. It’s still very basic and currently setup to work for me. To get it working for your WP setup you should probably make some minor modifications. Click the read more link to check out the code. I’ve released it under the generous BSD license, so knock yourself out! Use it at your own risk… I’m not going to support it. Any updates will be posted in this post. Also, please note that I haven’t tested it yet. If you access the script directly it should output “Zend Amf Endpoint” just fine, but that’s all I can guarantee at this point ;)

+ +

+
+<?php
+/**
+ * BSD LICENSE
+ *
+ * Copyright (c) 2009, norm2782
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of norm2782 nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * Set production mode.
+ * If set to false, exceptions will bubble through to the Flex frontend
+ *
+ * @var bool
+ */
+$production = false;
+
+/**
+ * Determine the absolute path of the AMF server
+ *
+ * @var string
+ */
+define('ABSPATH', dirname(__FILE__) . '/');
+
+/**
+ * One directory below docroot. Your config file and library dir should be here.
+ *
+ * @var string
+ */
+define('SUBPATH', dirname(ABSPATH));
+
+/**
+ * You should make sure Zend Framework is in your include path
+ */
+set_include_path(
+    implode(PATH_SEPARATOR, array(
+        SUBPATH . '/library',
+        get_include_path()
+    ))
+);
+
+/**
+ * Include the WordPress config file
+ */
+$configFile = SUBPATH . '/wp-config.php';
+
+if (!file_exists($configFile)) {
+    throw new Exception('WordPress config file was not found!');
+}
+
+require_once $configFile;
+
+/**
+ * No need to config more stuff from this point on
+ */
+
+/**
+ * @see Zend_Amf_Server
+ */
+require_once 'Zend/Amf/Server.php';
+
+/**
+ * @see Zend_Db_Adapter_Pdo_Mysql
+ */
+require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
+
+/**
+ * @see Zend_Paginator
+ */
+require_once 'Zend/Paginator.php';
+
+/**
+ * @see Zend_Paginator_Adapter_DbSelect
+ */
+require_once 'Zend/Paginator/Adapter/DbSelect.php';
+
+/**
+ * Simple class to expose wordpress data through AMF
+ *
+ * @author norm2782
+ */
+class Wp_Amf_Gateway
+{
+    /**
+     * Database adapter
+     *
+     * @var Zend_Db_Adapter_Pdo_Mysql
+     */
+    private $_db = null;
+
+    /**
+     * WordPress table prefix
+     *
+     * @var string
+     */
+    private $_prefix = null;
+
+    /**
+     * Constructor
+     *
+     * @param array $dbConfig
+     * @param string $prefix
+     * @return void
+     */
+    public function __construct(array $dbConfig, $prefix)
+    {
+        $this->_db = new Zend_Db_Adapter_Pdo_Mysql($dbConfig);
+        $this->_db->query('SET NAMES `utf8`');
+
+        $this->_prefix = $prefix;
+    }
+
+    /**
+     * Get paginated results for the provided query
+     *
+     * @param Zend_Db_Select $select
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    private function _getPaginated(Zend_Db_Select $select, $page, $itemsPerPage)
+    {
+        $paginator = new Zend_Paginator(
+            new Zend_Paginator_Adapter_DbSelect($select)
+        );
+
+        $paginator->setCurrentPageNumber($page)
+                  ->setItemCountPerPage($itemsPerPage);
+
+        return array(
+            'info'  => $paginator->getPages(),
+            'items' => $paginator->getCurrentItems()
+        );
+    }
+
+    /**
+     * Get the comments for the specified post ID
+     *
+     * @param int $postId
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getCommentsForPost($postId, $page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'comments')
+                                      ->where('comment_post_ID = ?', $postId);
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+
+    /**
+     * Get the meta data for the specified post ID
+     *
+     * @param $postId
+     * @return unknown_type
+     */
+    public function getMetaForPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'postmeta')
+                                      ->where('post_id = ?', $postId);
+
+        return $this->_db->fetchAll($select);
+    }
+
+    /**
+     * Get a post by specifying its ID
+     *
+     * @param int $postId
+     * @return array
+     */
+    public function getPost($postId)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts')
+                                      ->where('ID = ?', $postId);
+
+        return $this->_db->fetchOne($select);
+    }
+
+    /**
+     * Get posts per page
+     *
+     * @param int $page
+     * @param int $itemsPerPage
+     * @return array
+     */
+    public function getPosts($page = 1, $itemsPerPage = 10)
+    {
+        $select = $this->_db->select()->from($this->_prefix . 'posts');
+
+        return $this->_getPaginated($select, $page, $itemsPerPage);
+    }
+}
+
+/**
+ * Pass the values from wp-config.php to the Wp_Amf_Gateway class.
+ */
+$gateway = new Wp_Amf_Gateway(
+    array(
+        'host'     => DB_HOST,
+        'username' => DB_USER,
+        'password' => DB_PASSWORD,
+        'dbname'   => DB_NAME
+    ),
+    $table_prefix
+);
+
+$server = new Zend_Amf_Server();
+$server->setProduction($production)
+       ->setClass($gateway)
+       ->handle();
+
+
+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Flex frontend]]> + + http://www.norm2782.com/?p=22 + 2009-01-02T09:27:20Z + 2009-01-01T23:29:35Z + + I was planning on writing a quick Flex frontend for this blog, but it appears WordPress only offers the posts themselves as RSS feed. If I get real bored (which I doubt, unfortunately) I’ll have a look and see if I can create a Zend_AMF plugin for WordPress that allows me to retrieve virtually all data from my WordPress install. Would be cool :D

+]]>
+ + + 0 +
+ + + norm2782 + http://www.norm2782.com + + <![CDATA[Properties in PHP]]> + + http://www.norm2782.com/?p=8 + 2009-01-02T15:13:15Z + 2009-01-01T23:02:54Z + + A while ago Dynom from #php_bnl pointed me to an interesting entry on the PHP 5.3 wiki page. In the “Future PHP releases” sections there’s an entry called “29. “real†properties with attached getters and setters”. Personally I can’t wait for this. Hopefully it will look something like ActionScript 3’s properties:

+
+<?php
+class Bar
+{
+    private $_foo = 'foo';
+
+    public function get foo()
+    {
+        return $this->_foo;
+    }
+
+    public function set foo($fooString)
+    {
+        $this->_foo = $fooString;
+    }
+}
+
+$bar = new Bar();
+$bar->foo = 'baz';
+echo $bar->foo; // prints baz
+
+
+]]>
+ + + 0 +
+
From 4d6915fc26e16be1863735efb5e68e4a060364b8 Mon Sep 17 00:00:00 2001 From: padraic Date: Thu, 19 Nov 2009 16:39:47 +0000 Subject: [PATCH 050/238] Updated docblocks for Interface/Abstract class names - fixes ZF-8141 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19043 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader.php | 6 +++--- src/Reader/Feed/Atom.php | 3 +-- src/Reader/Feed/Rss.php | 3 +-- src/Reader/FeedAbstract.php | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Reader.php b/src/Reader.php index 75573f7f..95ea3e7f 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -218,7 +218,7 @@ public static function useHttpConditionalGet($bool = true) * @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) { @@ -293,7 +293,7 @@ public static function import($uri, $etag = null, $lastModified = null) * 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) { @@ -313,7 +313,7 @@ public static function importFeed(Zend_Feed_Abstract $feed) * Import a feed froma string * * @param string $string - * @return Zend_Feed_Reader_Feed_Interface + * @return Zend_Feed_Reader_FeedInterface */ public static function importString($string) { diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index 0d24c5ad..6b0e968e 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -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) { diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index b95c3c6b..9a708a8d 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -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) { diff --git a/src/Reader/FeedAbstract.php b/src/Reader/FeedAbstract.php index 925da083..0da4326b 100644 --- a/src/Reader/FeedAbstract.php +++ b/src/Reader/FeedAbstract.php @@ -120,7 +120,7 @@ public function count() /** * Return the current entry * - * @return Zend_Feed_Reader_Entry_Interface + * @return Zend_Feed_Reader_EntryInterface */ public function current() { From abe727c77828ebaea18a9a1bf14e6433e13f755f Mon Sep 17 00:00:00 2001 From: padraic Date: Thu, 19 Nov 2009 19:13:09 +0000 Subject: [PATCH 051/238] Added small file include to tests - fixes ZF-8345 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19052 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Reader/Feed/RssTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index a8f9ba4b..6910e719 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -22,6 +22,7 @@ require_once 'PHPUnit/Framework/TestCase.php'; require_once 'Zend/Feed/Reader.php'; +require_once 'Zend/Registry.php'; /** * @category Zend From 22838712916941ccf03ae7d76e413ef7f1aed9a5 Mon Sep 17 00:00:00 2001 From: padraic Date: Thu, 19 Nov 2009 19:40:20 +0000 Subject: [PATCH 052/238] Visibility of Zend_Feed_Builder's _createHeader and _createEntries switched to protected to limit duplicate work necessary in extended versions (they are huge methods to replicate!) - addresses ZF-5644 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19054 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Builder.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Builder.php b/src/Builder.php index 5139d59e..c0043d3f 100644 --- a/src/Builder.php +++ b/src/Builder.php @@ -212,7 +212,7 @@ public function getEntries() * @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 @@ private function _createHeader(array $data) * @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 @@ private function _createEntries(array $data) $this->_entries[] = $entry; } } -} \ No newline at end of file +} From 6a9876faf72037eb6506b38c560284b554fe16b4 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 20 Nov 2009 16:18:44 +0000 Subject: [PATCH 053/238] Updated ZFR unit tests to compare Zend_Date objects and not output. This ensures the tests are not dependent on either locale or Zend_Date formatting options, and reinforced best practice. Fixes ZF-8322. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19101 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Reader/Entry/AtomTest.php | 20 +++--- test/Reader/Entry/RssTest.php | 65 ++++++++++++++----- test/Reader/Feed/AtomTest.php | 21 ++++--- test/Reader/Feed/RssTest.php | 112 +++++++++++++++++++-------------- test/ReaderTest.php | 33 ---------- 5 files changed, 139 insertions(+), 112 deletions(-) diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index 0455ef33..78331754 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -88,8 +88,9 @@ public function testGetsDateCreatedFromAtom03() file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom03.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $entry->getDateCreated()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateCreated())); } public function testGetsDateCreatedFromAtom10() @@ -98,8 +99,9 @@ public function testGetsDateCreatedFromAtom10() file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom10.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $entry->getDateCreated()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateCreated())); } /** @@ -111,8 +113,9 @@ public function testGetsDateModifiedFromAtom03() file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom03.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromAtom10() @@ -121,8 +124,9 @@ public function testGetsDateModifiedFromAtom10() file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom10.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); } /** diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index 89bc8203..fc29a655 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -1792,7 +1792,9 @@ public function testGetsDateModifiedFromRss20() file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); } // DC 1.0 @@ -1803,7 +1805,9 @@ public function testGetsDateModifiedFromRss20_Dc10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss20.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss094_Dc10() @@ -1812,7 +1816,9 @@ public function testGetsDateModifiedFromRss094_Dc10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss094.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss093_Dc10() @@ -1821,7 +1827,9 @@ public function testGetsDateModifiedFromRss093_Dc10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss093.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss092_Dc10() @@ -1830,7 +1838,9 @@ public function testGetsDateModifiedFromRss092_Dc10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss092.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss091_Dc10() @@ -1839,7 +1849,9 @@ public function testGetsDateModifiedFromRss091_Dc10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss091.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss10_Dc10() @@ -1848,7 +1860,9 @@ public function testGetsDateModifiedFromRss10_Dc10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss10.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss090_Dc10() @@ -1857,7 +1871,9 @@ public function testGetsDateModifiedFromRss090_Dc10() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss090.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); } // DC 1.1 @@ -1868,7 +1884,9 @@ public function testGetsDateModifiedFromRss20_Dc11() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss20.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss094_Dc11() @@ -1877,7 +1895,9 @@ public function testGetsDateModifiedFromRss094_Dc11() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss094.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss093_Dc11() @@ -1886,7 +1906,9 @@ public function testGetsDateModifiedFromRss093_Dc11() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss093.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss092_Dc11() @@ -1895,7 +1917,9 @@ public function testGetsDateModifiedFromRss092_Dc11() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss092.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss091_Dc11() @@ -1904,7 +1928,9 @@ public function testGetsDateModifiedFromRss091_Dc11() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss091.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss10_Dc11() @@ -1913,7 +1939,9 @@ public function testGetsDateModifiedFromRss10_Dc11() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss10.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss090_Dc11() @@ -1922,7 +1950,9 @@ public function testGetsDateModifiedFromRss090_Dc11() file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss090.xml') ); $entry = $feed->current(); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); } // Missing DateModified @@ -1999,7 +2029,10 @@ public function testGetsDateModifiedFromRss20_UnrecognisedGmtFormat() file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20-zf-7908.xml') ); $entry = $feed->current(); - $this->assertEquals('Sunday 11 January 2009 09 55 59 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + //$this->assertEquals('Sunday 11 January 2009 09 55 59 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('Sun, 11 Jan 2009 09:55:59 GMT', Zend_Date::RSS); + $this->assertTrue($edate->equals($entry->getDateModified())); } /** diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 02d4befe..0bb7add9 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -145,9 +145,9 @@ public function testGetsDateCreatedFromAtom03() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom03.xml') ); - - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateCreated()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateCreated())); } public function testGetsDateCreatedFromAtom10() @@ -156,8 +156,9 @@ public function testGetsDateCreatedFromAtom10() file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom10.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateCreated()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateCreated())); } /** @@ -169,8 +170,9 @@ public function testGetsDateModifiedFromAtom03() file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom03.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromAtom10() @@ -179,8 +181,9 @@ public function testGetsDateModifiedFromAtom10() file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom10.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } /** diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index 6910e719..0e75eb9b 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -1954,8 +1954,9 @@ public function testGetsDateModifiedFromRss20() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } // DC 1.0 @@ -1965,8 +1966,9 @@ public function testGetsDateModifiedFromRss20_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss20.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss094_Dc10() @@ -1974,8 +1976,9 @@ public function testGetsDateModifiedFromRss094_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss094.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss093_Dc10() @@ -1983,8 +1986,9 @@ public function testGetsDateModifiedFromRss093_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss093.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss092_Dc10() @@ -1992,8 +1996,9 @@ public function testGetsDateModifiedFromRss092_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss092.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss091_Dc10() @@ -2001,8 +2006,9 @@ public function testGetsDateModifiedFromRss091_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss091.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss10_Dc10() @@ -2010,8 +2016,9 @@ public function testGetsDateModifiedFromRss10_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss10.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss090_Dc10() @@ -2019,8 +2026,9 @@ public function testGetsDateModifiedFromRss090_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss090.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } // DC 1.1 @@ -2030,8 +2038,9 @@ public function testGetsDateModifiedFromRss20_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss20.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss094_Dc11() @@ -2039,8 +2048,9 @@ public function testGetsDateModifiedFromRss094_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss094.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss093_Dc11() @@ -2048,8 +2058,9 @@ public function testGetsDateModifiedFromRss093_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss093.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss092_Dc11() @@ -2057,8 +2068,9 @@ public function testGetsDateModifiedFromRss092_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss092.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss091_Dc11() @@ -2066,8 +2078,9 @@ public function testGetsDateModifiedFromRss091_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss091.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss10_Dc11() @@ -2075,8 +2088,9 @@ public function testGetsDateModifiedFromRss10_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss10.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss090_Dc11() @@ -2084,8 +2098,9 @@ public function testGetsDateModifiedFromRss090_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss090.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } // Atom 1.0 @@ -2095,8 +2110,9 @@ public function testGetsDateModifiedFromRss20_atom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss20.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss094_atom10() @@ -2104,8 +2120,9 @@ public function testGetsDateModifiedFromRss094_atom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss094.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss093_atom10() @@ -2113,8 +2130,9 @@ public function testGetsDateModifiedFromRss093_atom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss093.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss092_atom10() @@ -2122,8 +2140,9 @@ public function testGetsDateModifiedFromRss092_atom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss092.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss091_atom10() @@ -2131,8 +2150,9 @@ public function testGetsDateModifiedFromRss091_atom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss091.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss10_atom10() @@ -2140,8 +2160,9 @@ public function testGetsDateModifiedFromRss10_atom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss10.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss090_atom10() @@ -2149,8 +2170,9 @@ public function testGetsDateModifiedFromRss090_atom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss090.xml') ); - $this->assertEquals('Saturday 07 March 2009 08 03 50 +0000', - $feed->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); } // Missing DateModified @@ -2211,8 +2233,6 @@ public function testGetsDateModifiedFromRss090_None() $this->assertEquals(null, $feed->getDateModified()); } - //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& - /** * Get Hubs (Unencoded Text) */ diff --git a/test/ReaderTest.php b/test/ReaderTest.php index 195fd041..5b84fde2 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -268,39 +268,6 @@ public function testRegistersUserExtension() $this->assertTrue(Zend_Feed_Reader::isRegistered('JungleBooks')); } - /** Test condition for ZF-7486 (Could Not Replicate) **/ - public function testRepeatedFeedImportsWithCacheEnabledDirectOrIndirectDoNotCreateARedeclarationOfAbstractClassFatalError() - { - if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - ) { - $this->markTestSkipped('testRepeatedFeedImportsDoNotCreateARedeclarationOfAbstractClassFatalError() requires a network connection'); - return; - } - $frontendOptions = array( - 'lifetime' => 7200, - 'automatic_serialization' => true - ); - $backendOptions = array( - 'cache_dir' => $this->_getTempDirectory() - ); - $cache = Zend_Cache::factory('Core','File',$frontendOptions,$backendOptions); - Zend_Feed_Reader::setCache($cache); - $feed = Zend_Feed_Reader::import('http://www.planet-php.net/rss/'); - $cache->save($feed, 'feed1'); - $feed2 = Zend_Feed_Reader::import('http://www.planet-php.net/rdf/'); - $cache->save($feed, 'feed2'); - $feed3 = Zend_Feed_Reader::import('http://www.planet-php.net/atom/'); - $cache->save($feed, 'feed3'); - $feed4 = Zend_Feed_Reader::import('http://www.phpdeveloper.org/feed'); - $cache->save($feed, 'feed4'); - $feedXmlFromCache = $cache->load('Zend_Feed_Reader_' . md5('http://www.planet-php.net/rss/')); - $feedFromCache = Zend_Feed_Reader::importString($feedXmlFromCache); - $this->assertTrue($feedFromCache instanceof Zend_Feed_Reader_FeedAbstract); - $feedFromCache2 = $cache->load('feed4'); - $this->assertTrue($feedFromCache2 instanceof Zend_Feed_Reader_FeedAbstract); - } - protected function _getTempDirectory() { $tmpdir = array(); From e17d18631cb4bf562d0314da1f946d245d5006f4 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 20 Nov 2009 17:13:54 +0000 Subject: [PATCH 054/238] Added support for locating feed links and returning absolute URLs instead of relatives - fixes ZF-8330 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19105 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader.php | 2 +- src/Reader/FeedSet.php | 32 +++++++++++++++++++++++++++----- test/ReaderTest.php | 20 ++++++++++++++++++++ 3 files changed, 48 insertions(+), 6 deletions(-) diff --git a/src/Reader.php b/src/Reader.php index 95ea3e7f..971032da 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -405,7 +405,7 @@ public static function findFeedLinks($uri) } $feedSet = new Zend_Feed_Reader_FeedSet; $links = $dom->getElementsByTagName('link'); - $feedSet->addLinks($links); + $feedSet->addLinks($links, $uri); return $feedSet; } diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index b4699e40..4a4d3e93 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -24,6 +24,11 @@ */ require_once 'Zend/Feed/Reader.php'; +/** + * @see Zend_Uri + */ +require_once 'Zend/Uri.php'; + /** * @category Zend * @package Zend_Feed_Reader @@ -52,9 +57,10 @@ class Zend_Feed_Reader_FeedSet extends ArrayObject * loaded automatically when each links 'feed' array key is accessed. * * @param DOMNodeList $links + * @param string $uri * @return void */ - public function addLinks(DOMNodeList $links) + public function addLinks(DOMNodeList $links, $uri) { foreach ($links as $link) { if (strtolower($link->getAttribute('rel')) !== 'alternate' @@ -62,19 +68,35 @@ public function addLinks(DOMNodeList $links) continue; } if (!isset($this->rss) && $link->getAttribute('type') == 'application/rss+xml') { - $this->rss = trim($link->getAttribute('href')); + $this->rss = $this->_absolutiseUri(trim($link->getAttribute('href')), $uri); } elseif(!isset($this->atom) && $link->getAttribute('type') == 'application/atom+xml') { - $this->atom = trim($link->getAttribute('href')); + $this->atom = $this->_absolutiseUri(trim($link->getAttribute('href')), $uri); } elseif(!isset($this->rdf) && $link->getAttribute('type') == 'application/rdf+xml') { - $this->rdf = trim($link->getAttribute('href')); + $this->rdf = $this->_absolutiseUri(trim($link->getAttribute('href')), $uri); } $this[] = new self(array( 'rel' => 'alternate', 'type' => $link->getAttribute('type'), - 'href' => trim($link->getAttribute('href')), + '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)) { + $link = rtrim($uri, '/') . '/' . ltrim($link, '/'); + if (!Zend_Uri::check($link)) { + $link = null; + } + } + } + return $link; + } /** * Supports lazy loading of feeds using Zend_Feed_Reader::import() but diff --git a/test/ReaderTest.php b/test/ReaderTest.php index 5b84fde2..8a4ce984 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -249,6 +249,26 @@ public function testGetsFeedLinksAndTrimsNewlines() } $this->assertEquals('http://feeds.feedburner.com/jonnyken/infoblog', $links->rss); } + + /** + * @group ZF-8330 + */ + public function testGetsFeedLinksAndNormalisesRelativeUrls() + { + if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + ) { + $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); + return; + } + + try { + $links = Zend_Feed_Reader::findFeedLinks('http://meiobit.com'); + } catch(Exception $e) { + $this->fail($e->getMessage()); + } + $this->assertEquals('http://meiobit.com/rss.xml', $links->rss); + } public function testAddsPrefixPath() { From 301a71bda3ec6fbaf98a54d87c2b8b6464c76d3a Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 20 Nov 2009 19:41:43 +0000 Subject: [PATCH 055/238] Added to Zend_Feed support for setting a guid element attr of isPermaLink to false when the guid is not a URI. Fixes a validity issue with RSS feeds when generated. Fixes ZF-2639 and ZF-5833 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19132 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Rss.php | 3 +++ test/ImportTest.php | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/Rss.php b/src/Rss.php index c1ef9955..ce919093 100644 --- a/src/Rss.php +++ b/src/Rss.php @@ -411,6 +411,9 @@ protected function _mapFeedEntries(DOMElement $root, $array) if (isset($dataentry->guid)) { $guid = $this->_element->createElement('guid', $dataentry->guid); + if (!Zend_Uri::check($dataentry->guid)) { + $guid->setAttribute('isPermaLink', 'false'); + } $item->appendChild($guid); } diff --git a/test/ImportTest.php b/test/ImportTest.php index 952f1c16..82d2c130 100644 --- a/test/ImportTest.php +++ b/test/ImportTest.php @@ -219,6 +219,17 @@ public function testRssImportFullArray() $feed = Zend_Feed::importArray($this->_getFullArray(), 'rss'); $this->assertType('Zend_Feed_Rss', $feed); } + + /** + * Test the import of a RSS feed from an array + * @group ZF-5833 + */ + public function testRssImportSetsIsPermaLinkAsFalseIfGuidNotAUri() + { + $feed = Zend_Feed::importArray($this->_getFullArray(), 'rss'); + $entry = $feed->current(); + $this->assertEquals('false', $entry->guid['isPermaLink']); + } /** * Test the import of a RSS feed from an array From ea346c77815190bc97f53e6d3d1d548bb85cd647 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 20 Nov 2009 20:00:28 +0000 Subject: [PATCH 056/238] Added patches to fix relative to absolute URIs in findFeedLinks - fixes ZF-8330 (patches courtesy of Jan Sorgalla [jsor]). git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19136 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/FeedSet.php | 28 +++++++++++++++++++++++++++- test/ReaderTest.php | 23 +++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index 4a4d3e93..a214d8f7 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -89,7 +89,13 @@ protected function _absolutiseUri($link, $uri = null) { if (!Zend_Uri::check($link)) { if (!is_null($uri)) { - $link = rtrim($uri, '/') . '/' . ltrim($link, '/'); + $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; } @@ -97,6 +103,26 @@ protected function _absolutiseUri($link, $uri = 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 diff --git a/test/ReaderTest.php b/test/ReaderTest.php index 8a4ce984..842f4f12 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -269,6 +269,29 @@ public function testGetsFeedLinksAndNormalisesRelativeUrls() } $this->assertEquals('http://meiobit.com/rss.xml', $links->rss); } + + /** + * @group ZF-8330 + */ + public function testGetsFeedLinksAndNormalisesRelativeUrlsOnUriWithPath() + { + try { + $currClient = Zend_Feed_Reader::getHttpClient(); + + $testAdapter = new Zend_Http_Client_Adapter_Test(); + $testAdapter->setResponse(new Zend_Http_Response(200, array(), '')); + Zend_Feed_Reader::setHttpClient(new Zend_Http_Client(null, array('adapter' => $testAdapter))); + + $links = Zend_Feed_Reader::findFeedLinks('http://foo/bar'); + + Zend_Feed_Reader::setHttpClient($currClient); + } catch(Exception $e) { + $this->fail($e->getMessage()); + } + + $this->assertEquals('http://foo/test.rss', $links->rss); + $this->assertEquals('http://foo/test.atom', $links->atom); + } public function testAddsPrefixPath() { From 671fc533bbbdca5fb5674c598dc7b5179611e858 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 20 Nov 2009 22:29:02 +0000 Subject: [PATCH 057/238] Added preliminary support for extracting category data from RSS 2.0 feeds. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19147 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Collection.php | 33 ++++++++++++ src/Reader/Collection/Category.php | 53 +++++++++++++++++++ src/Reader/Collection/CollectionAbstract.php | 41 ++++++++++++++ src/Reader/Entry/Rss.php | 38 +++++++++++++ test/Reader/Entry/RssTest.php | 36 ++++++++++++- .../Atom/commentcount/plain/atom10/rss20.xml | 10 ++++ .../Atom/commentcount/plain/none/rss20.xml | 7 +++ .../commentcount/plain/thread10/rss20.xml | 9 ++++ .../_files/Rss/category/plain/none/rss090.xml | 9 ++++ .../_files/Rss/category/plain/none/rss091.xml | 7 +++ .../_files/Rss/category/plain/none/rss092.xml | 7 +++ .../_files/Rss/category/plain/none/rss093.xml | 7 +++ .../_files/Rss/category/plain/none/rss094.xml | 7 +++ .../_files/Rss/category/plain/none/rss10.xml | 9 ++++ .../_files/Rss/category/plain/none/rss20.xml | 7 +++ .../_files/Rss/category/plain/rss090.xml | 12 +++++ .../_files/Rss/category/plain/rss091.xml | 10 ++++ .../_files/Rss/category/plain/rss092.xml | 10 ++++ .../_files/Rss/category/plain/rss093.xml | 10 ++++ .../_files/Rss/category/plain/rss094.xml | 10 ++++ .../Entry/_files/Rss/category/plain/rss10.xml | 12 +++++ .../Entry/_files/Rss/category/plain/rss20.xml | 10 ++++ 22 files changed, 352 insertions(+), 2 deletions(-) create mode 100644 src/Reader/Collection.php create mode 100644 src/Reader/Collection/Category.php create mode 100644 src/Reader/Collection/CollectionAbstract.php create mode 100644 test/Reader/Entry/_files/Atom/commentcount/plain/atom10/rss20.xml create mode 100644 test/Reader/Entry/_files/Atom/commentcount/plain/none/rss20.xml create mode 100644 test/Reader/Entry/_files/Atom/commentcount/plain/thread10/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/none/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/none/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/none/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/none/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/none/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/none/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/none/rss20.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/rss20.xml diff --git a/src/Reader/Collection.php b/src/Reader/Collection.php new file mode 100644 index 00000000..607c46f5 --- /dev/null +++ b/src/Reader/Collection.php @@ -0,0 +1,33 @@ +getIterator() as $element) { + $categories[] = $element['label']; + } + return array_unique($categories); + } + +} diff --git a/src/Reader/Collection/CollectionAbstract.php b/src/Reader/Collection/CollectionAbstract.php new file mode 100644 index 00000000..0c3803e3 --- /dev/null +++ b/src/Reader/Collection/CollectionAbstract.php @@ -0,0 +1,41 @@ +_data['links']; } + + /** + * Get all categories + * + * @return Zend_Feed_Reader_Collection_Category + */ + public function getCategories() + { + if (array_key_exists('categories', $this->_data)) { + return $this->_data['categories']; + } + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $list = $this->_xpath->query($this->_xpathQueryRss.'//category'); + } else { + $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:category'); + } + + if (!$list->length) { + $categoryCollection = new Zend_Feed_Reader_Collection_Category; + } else { + $categoryCollection = new Zend_Feed_Reader_Collection_Category; + foreach ($list as $category) { + $categoryCollection[] = array( + 'term' => $category->nodeValue, + 'scheme' => $category->getAttribute('domain'), + 'label' => $category->nodeValue, + ); + } + } + + $this->_data['categories'] = $categoryCollection; + + return $this->_data['categories']; + } /** * Get a permalink to the entry diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index fc29a655..3ad20ed1 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -36,6 +36,8 @@ class Zend_Feed_Reader_Entry_RssTest extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; + + protected $_expectedCats = array(); public function setup() { @@ -51,6 +53,23 @@ public function setup() } } Zend_Date::setOptions(array('format_type'=>'iso')); + $this->_expectedCats = array( + array( + 'term' => 'topic1', + 'scheme' => 'http://example.com/schema1', + 'label' => 'topic1' + ), + array( + 'term' => 'topic1', + 'scheme' => 'http://example.com/schema2', + 'label' => 'topic1' + ), + array( + 'term' => 'topic2', + 'scheme' => 'http://example.com/schema1', + 'label' => 'topic2' + ) + ); } public function teardown() @@ -2482,7 +2501,7 @@ public function testGetsCommentLinkFromRss090_None() * Get CommentFeedLink (Unencoded Text) */ - // Atom 1.0 + // RSS public function testGetsCommentFeedLinkFromRss20_WellFormedWeb10() { @@ -2676,5 +2695,18 @@ public function testGetsCommentFeedLinkFromRss090_None() $entry = $feed->current(); $this->assertEquals(null, $entry->getCommentFeedLink()); } - + + /** + * Get category data + * @group ZFR001 + */ + public function testGetsCategoriesFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCats, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); + } } diff --git a/test/Reader/Entry/_files/Atom/commentcount/plain/atom10/rss20.xml b/test/Reader/Entry/_files/Atom/commentcount/plain/atom10/rss20.xml new file mode 100644 index 00000000..2a4a2455 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/commentcount/plain/atom10/rss20.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Atom/commentcount/plain/none/rss20.xml b/test/Reader/Entry/_files/Atom/commentcount/plain/none/rss20.xml new file mode 100644 index 00000000..8ace034d --- /dev/null +++ b/test/Reader/Entry/_files/Atom/commentcount/plain/none/rss20.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Atom/commentcount/plain/thread10/rss20.xml b/test/Reader/Entry/_files/Atom/commentcount/plain/thread10/rss20.xml new file mode 100644 index 00000000..447b3cd7 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/commentcount/plain/thread10/rss20.xml @@ -0,0 +1,9 @@ + + + + + 321 + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/none/rss090.xml b/test/Reader/Entry/_files/Rss/category/plain/none/rss090.xml new file mode 100644 index 00000000..57814153 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/none/rss090.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/category/plain/none/rss091.xml b/test/Reader/Entry/_files/Rss/category/plain/none/rss091.xml new file mode 100644 index 00000000..04d999e3 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/none/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/category/plain/none/rss092.xml b/test/Reader/Entry/_files/Rss/category/plain/none/rss092.xml new file mode 100644 index 00000000..8b31a074 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/none/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/category/plain/none/rss093.xml b/test/Reader/Entry/_files/Rss/category/plain/none/rss093.xml new file mode 100644 index 00000000..31d61445 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/none/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/category/plain/none/rss094.xml b/test/Reader/Entry/_files/Rss/category/plain/none/rss094.xml new file mode 100644 index 00000000..e375a1d9 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/none/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/category/plain/none/rss10.xml b/test/Reader/Entry/_files/Rss/category/plain/none/rss10.xml new file mode 100644 index 00000000..0ab6cc5b --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/none/rss10.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/category/plain/none/rss20.xml b/test/Reader/Entry/_files/Rss/category/plain/none/rss20.xml new file mode 100644 index 00000000..8ace034d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/none/rss20.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Entry/_files/Rss/category/plain/rss090.xml b/test/Reader/Entry/_files/Rss/category/plain/rss090.xml new file mode 100644 index 00000000..b3d8b16f --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/rss090.xml @@ -0,0 +1,12 @@ + + + + + topic1 + topic1 + topic2 + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/rss091.xml b/test/Reader/Entry/_files/Rss/category/plain/rss091.xml new file mode 100644 index 00000000..edf559a7 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/rss091.xml @@ -0,0 +1,10 @@ + + + + + topic1 + topic1 + topic2 + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/rss092.xml b/test/Reader/Entry/_files/Rss/category/plain/rss092.xml new file mode 100644 index 00000000..6f5db54a --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/rss092.xml @@ -0,0 +1,10 @@ + + + + + topic1 + topic1 + topic2 + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/rss093.xml b/test/Reader/Entry/_files/Rss/category/plain/rss093.xml new file mode 100644 index 00000000..181bae55 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/rss093.xml @@ -0,0 +1,10 @@ + + + + + topic1 + topic1 + topic2 + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/rss094.xml b/test/Reader/Entry/_files/Rss/category/plain/rss094.xml new file mode 100644 index 00000000..850cb0d1 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/rss094.xml @@ -0,0 +1,10 @@ + + + + + topic1 + topic1 + topic2 + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/rss10.xml b/test/Reader/Entry/_files/Rss/category/plain/rss10.xml new file mode 100644 index 00000000..afd72398 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/rss10.xml @@ -0,0 +1,12 @@ + + + + + topic1 + topic1 + topic2 + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/rss20.xml b/test/Reader/Entry/_files/Rss/category/plain/rss20.xml new file mode 100644 index 00000000..093db1e6 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/rss20.xml @@ -0,0 +1,10 @@ + + + + + topic1 + topic1 + topic2 + + + From b226c7cc938654e92d9041357b31e763c40c0622 Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 21 Nov 2009 01:15:32 +0000 Subject: [PATCH 058/238] Added support for extracting category data from all RSS and RDF feeds. The method getCategories() returns an object of type ArrayObject with three fields per result: term, scheme and label. This actually reflect the Atom 1.0 terminology, so RSS maps the "domain" attr to "scheme", and its nodeValue (the category name) to both "term" and "label" - this will allow both RSS and Atom to support the exact same output result setup via the new Zend_Feed_Reader_Container_* classes. The Container classes are a common method of presenting attribute bundles - in addition to being an ArrayObject, it implements a getValues() method for simple access to the CORE values, i.e. for categories, their name or "label" in Atom parlance. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19151 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Entry/Rss.php | 6 +- src/Reader/Extension/DublinCore/Entry.php | 35 +++++ test/Reader/Entry/RssTest.php | 141 +++++++++++++++++- .../Rss/category/plain/{ => dc10}/rss090.xml | 6 +- .../_files/Rss/category/plain/dc10/rss091.xml | 9 ++ .../_files/Rss/category/plain/dc10/rss092.xml | 9 ++ .../_files/Rss/category/plain/dc10/rss093.xml | 9 ++ .../_files/Rss/category/plain/dc10/rss094.xml | 9 ++ .../_files/Rss/category/plain/dc10/rss10.xml | 12 ++ .../_files/Rss/category/plain/dc11/rss090.xml | 12 ++ .../_files/Rss/category/plain/dc11/rss091.xml | 9 ++ .../_files/Rss/category/plain/dc11/rss092.xml | 9 ++ .../_files/Rss/category/plain/dc11/rss093.xml | 9 ++ .../_files/Rss/category/plain/dc11/rss094.xml | 9 ++ .../_files/Rss/category/plain/dc11/rss10.xml | 12 ++ .../_files/Rss/category/plain/rss091.xml | 10 -- .../_files/Rss/category/plain/rss092.xml | 10 -- .../_files/Rss/category/plain/rss093.xml | 10 -- .../_files/Rss/category/plain/rss094.xml | 10 -- .../Entry/_files/Rss/category/plain/rss10.xml | 12 -- 20 files changed, 289 insertions(+), 59 deletions(-) rename test/Reader/Entry/_files/Rss/category/plain/{ => dc10}/rss090.xml (50%) create mode 100644 test/Reader/Entry/_files/Rss/category/plain/dc10/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/dc10/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/dc10/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/dc10/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/dc10/rss10.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/dc11/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/dc11/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/dc11/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/dc11/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/dc11/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/dc11/rss10.xml delete mode 100644 test/Reader/Entry/_files/Rss/category/plain/rss091.xml delete mode 100644 test/Reader/Entry/_files/Rss/category/plain/rss092.xml delete mode 100644 test/Reader/Entry/_files/Rss/category/plain/rss093.xml delete mode 100644 test/Reader/Entry/_files/Rss/category/plain/rss094.xml delete mode 100644 test/Reader/Entry/_files/Rss/category/plain/rss10.xml diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index b21b96ac..66181f85 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -479,9 +479,7 @@ public function getCategories() $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:category'); } - if (!$list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; - } else { + if ($list->length) { $categoryCollection = new Zend_Feed_Reader_Collection_Category; foreach ($list as $category) { $categoryCollection[] = array( @@ -490,6 +488,8 @@ public function getCategories() 'label' => $category->nodeValue, ); } + } else { + $categoryCollection = $this->getExtension('DublinCore')->getCategories(); } $this->_data['categories'] = $categoryCollection; diff --git a/src/Reader/Extension/DublinCore/Entry.php b/src/Reader/Extension/DublinCore/Entry.php index 4f3f13ee..2356bb77 100644 --- a/src/Reader/Extension/DublinCore/Entry.php +++ b/src/Reader/Extension/DublinCore/Entry.php @@ -103,6 +103,41 @@ public function getAuthors() return $this->_data['authors']; } + + /** + * Get categories (subjects under DC) + * + * @return Zend_Feed_Reader_Collection_Category + */ + public function getCategories() + { + if (array_key_exists('categories', $this->_data)) { + return $this->_data['categories']; + } + + $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc11:subject'); + + if (!$list->length) { + $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc10:subject'); + } + + if ($list->length) { + $categoryCollection = new Zend_Feed_Reader_Collection_Category; + foreach ($list as $category) { + $categoryCollection[] = array( + 'term' => $category->nodeValue, + 'scheme' => null, + 'label' => $category->nodeValue, + ); + } + } else { + $categoryCollection = new Zend_Feed_Reader_Collection_Category; + } + + $this->_data['categories'] = $categoryCollection; + return $this->_data['categories']; + } + /** * Get the entry content diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index 3ad20ed1..eefb618b 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -38,6 +38,7 @@ class Zend_Feed_Reader_Entry_RssTest extends PHPUnit_Framework_TestCase protected $_feedSamplePath = null; protected $_expectedCats = array(); + protected $_expectedCatsRdf = array(); public function setup() { @@ -70,6 +71,18 @@ public function setup() 'label' => 'topic2' ) ); + $this->_expectedCatsRdf = array( + array( + 'term' => 'topic1', + 'scheme' => null, + 'label' => 'topic1' + ), + array( + 'term' => 'topic2', + 'scheme' => null, + 'label' => 'topic2' + ) + ); } public function teardown() @@ -2698,8 +2711,10 @@ public function testGetsCommentFeedLinkFromRss090_None() /** * Get category data - * @group ZFR001 */ + + // RSS 2.0 + public function testGetsCategoriesFromRss20() { $feed = Zend_Feed_Reader::importString( @@ -2709,4 +2724,128 @@ public function testGetsCategoriesFromRss20() $this->assertEquals($this->_expectedCats, (array) $entry->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } + + // DC 1.0 + + public function testGetsCategoriesFromRss090_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss091_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss092_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss093_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss094_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss10_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); + } + + // DC 1.1 + + public function testGetsCategoriesFromRss090_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss091_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss092_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss093_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss094_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss10_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); + } } diff --git a/test/Reader/Entry/_files/Rss/category/plain/rss090.xml b/test/Reader/Entry/_files/Rss/category/plain/dc10/rss090.xml similarity index 50% rename from test/Reader/Entry/_files/Rss/category/plain/rss090.xml rename to test/Reader/Entry/_files/Rss/category/plain/dc10/rss090.xml index b3d8b16f..1c92b582 100644 --- a/test/Reader/Entry/_files/Rss/category/plain/rss090.xml +++ b/test/Reader/Entry/_files/Rss/category/plain/dc10/rss090.xml @@ -1,12 +1,12 @@ - topic1 - topic1 - topic2 + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/dc10/rss091.xml b/test/Reader/Entry/_files/Rss/category/plain/dc10/rss091.xml new file mode 100644 index 00000000..f278d67d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/dc10/rss091.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/dc10/rss092.xml b/test/Reader/Entry/_files/Rss/category/plain/dc10/rss092.xml new file mode 100644 index 00000000..4988e321 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/dc10/rss092.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/dc10/rss093.xml b/test/Reader/Entry/_files/Rss/category/plain/dc10/rss093.xml new file mode 100644 index 00000000..3696e274 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/dc10/rss093.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/dc10/rss094.xml b/test/Reader/Entry/_files/Rss/category/plain/dc10/rss094.xml new file mode 100644 index 00000000..967d9f22 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/dc10/rss094.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/dc10/rss10.xml b/test/Reader/Entry/_files/Rss/category/plain/dc10/rss10.xml new file mode 100644 index 00000000..35719e8d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/dc10/rss10.xml @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/dc11/rss090.xml b/test/Reader/Entry/_files/Rss/category/plain/dc11/rss090.xml new file mode 100644 index 00000000..50f9b574 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/dc11/rss090.xml @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/dc11/rss091.xml b/test/Reader/Entry/_files/Rss/category/plain/dc11/rss091.xml new file mode 100644 index 00000000..256a6c62 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/dc11/rss091.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/dc11/rss092.xml b/test/Reader/Entry/_files/Rss/category/plain/dc11/rss092.xml new file mode 100644 index 00000000..e2d7ce3e --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/dc11/rss092.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/dc11/rss093.xml b/test/Reader/Entry/_files/Rss/category/plain/dc11/rss093.xml new file mode 100644 index 00000000..298caefc --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/dc11/rss093.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/dc11/rss094.xml b/test/Reader/Entry/_files/Rss/category/plain/dc11/rss094.xml new file mode 100644 index 00000000..1cfda251 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/dc11/rss094.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/dc11/rss10.xml b/test/Reader/Entry/_files/Rss/category/plain/dc11/rss10.xml new file mode 100644 index 00000000..89eb512d --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/dc11/rss10.xml @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/rss091.xml b/test/Reader/Entry/_files/Rss/category/plain/rss091.xml deleted file mode 100644 index edf559a7..00000000 --- a/test/Reader/Entry/_files/Rss/category/plain/rss091.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - topic1 - topic1 - topic2 - - - diff --git a/test/Reader/Entry/_files/Rss/category/plain/rss092.xml b/test/Reader/Entry/_files/Rss/category/plain/rss092.xml deleted file mode 100644 index 6f5db54a..00000000 --- a/test/Reader/Entry/_files/Rss/category/plain/rss092.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - topic1 - topic1 - topic2 - - - diff --git a/test/Reader/Entry/_files/Rss/category/plain/rss093.xml b/test/Reader/Entry/_files/Rss/category/plain/rss093.xml deleted file mode 100644 index 181bae55..00000000 --- a/test/Reader/Entry/_files/Rss/category/plain/rss093.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - topic1 - topic1 - topic2 - - - diff --git a/test/Reader/Entry/_files/Rss/category/plain/rss094.xml b/test/Reader/Entry/_files/Rss/category/plain/rss094.xml deleted file mode 100644 index 850cb0d1..00000000 --- a/test/Reader/Entry/_files/Rss/category/plain/rss094.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - topic1 - topic1 - topic2 - - - diff --git a/test/Reader/Entry/_files/Rss/category/plain/rss10.xml b/test/Reader/Entry/_files/Rss/category/plain/rss10.xml deleted file mode 100644 index afd72398..00000000 --- a/test/Reader/Entry/_files/Rss/category/plain/rss10.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - topic1 - topic1 - topic2 - - - From fb05ee69d04a5636bb06df8655dcf71e2e4650b5 Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 21 Nov 2009 12:48:14 +0000 Subject: [PATCH 059/238] Added RSS tests covering cases where no Entry categories exist (i.e. returns empty Container) git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19158 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Reader/Entry/RssTest.php | 75 +++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index eefb618b..49297b6d 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -38,6 +38,7 @@ class Zend_Feed_Reader_Entry_RssTest extends PHPUnit_Framework_TestCase protected $_feedSamplePath = null; protected $_expectedCats = array(); + protected $_expectedCatsRdf = array(); public function setup() @@ -2848,4 +2849,78 @@ public function testGetsCategoriesFromRss10_Dc11() $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } + + // No Categories In Entry + + public function testGetsCategoriesFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/rss20.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), (array) $entry->getCategories()); + $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), (array) $entry->getCategories()); + $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), (array) $entry->getCategories()); + $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), (array) $entry->getCategories()); + $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), (array) $entry->getCategories()); + $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), (array) $entry->getCategories()); + $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), (array) $entry->getCategories()); + $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); + } + + } From ab30147bd19a8e441ceafe6a763cfcdf4b776c23 Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 21 Nov 2009 14:23:15 +0000 Subject: [PATCH 060/238] Zend_Feed_Reader: Adds full support for collecting ALL entry category data from ALL RSS/RDF and Atom feeds. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19159 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Entry/Atom.php | 25 +++++ src/Reader/Entry/Rss.php | 7 ++ src/Reader/Extension/Atom/Entry.php | 46 ++++++++ test/Reader/Entry/AtomTest.php | 104 ++++++++++++++++++ test/Reader/Entry/RssTest.php | 81 ++++++++++++++ .../_files/Atom/category/plain/atom03.xml | 9 ++ .../_files/Atom/category/plain/atom10.xml | 8 ++ .../Atom/category/plain/dc10/atom03.xml | 8 ++ .../Atom/category/plain/dc11/atom03.xml | 8 ++ .../Atom/category/plain/none/atom03.xml | 5 + .../Atom/category/plain/none/atom10.xml | 5 + .../Rss/category/plain/atom10/rss090.xml | 13 +++ .../Rss/category/plain/atom10/rss091.xml | 10 ++ .../Rss/category/plain/atom10/rss092.xml | 10 ++ .../Rss/category/plain/atom10/rss093.xml | 10 ++ .../Rss/category/plain/atom10/rss094.xml | 10 ++ .../Rss/category/plain/atom10/rss10.xml | 13 +++ 17 files changed, 372 insertions(+) create mode 100644 test/Reader/Entry/_files/Atom/category/plain/atom03.xml create mode 100644 test/Reader/Entry/_files/Atom/category/plain/atom10.xml create mode 100644 test/Reader/Entry/_files/Atom/category/plain/dc10/atom03.xml create mode 100644 test/Reader/Entry/_files/Atom/category/plain/dc11/atom03.xml create mode 100644 test/Reader/Entry/_files/Atom/category/plain/none/atom03.xml create mode 100644 test/Reader/Entry/_files/Atom/category/plain/none/atom10.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/atom10/rss090.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/atom10/rss091.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/atom10/rss092.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/atom10/rss093.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/atom10/rss094.xml create mode 100644 test/Reader/Entry/_files/Rss/category/plain/atom10/rss10.xml diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index 86721f93..ad6f0c34 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -74,6 +74,9 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) $threadClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Thread_Entry'); $this->_extensions['Thread_Entry'] = new $threadClass($entry, $entryKey, $type); + + $threadClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Entry'); + $this->_extensions['DublinCore_Entry'] = new $threadClass($entry, $entryKey, $type); } /** @@ -341,6 +344,28 @@ public function getCommentFeedLink() return $this->_data['commentfeedlink']; } + + /** + * Get category data as a Zend_Feed_Reader_Collection_Category object + * + * @return Zend_Feed_Reader_Collection_Category + */ + public function getCategories() + { + if (array_key_exists('categories', $this->_data)) { + return $this->_data['categories']; + } + + $categoryCollection = $this->getExtension('Atom')->getCategories(); + + if (count($categoryCollection) == 0) { + $categoryCollection = $this->getExtension('DublinCore')->getCategories(); + } + + $this->_data['categories'] = $categoryCollection; + + return $this->_data['categories']; + } /** * Set the XPath query (incl. on all Extensions) diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index 66181f85..83dc9d6d 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -69,6 +69,9 @@ */ require_once 'Zend/Date.php'; +/** + * @see Zend_Feed_Reader_Collection_Category + */ require_once 'Zend/Feed/Reader/Collection/Category.php'; /** @@ -491,6 +494,10 @@ public function getCategories() } else { $categoryCollection = $this->getExtension('DublinCore')->getCategories(); } + + if (count($categoryCollection) == 0) { + $categoryCollection = $this->getExtension('Atom')->getCategories(); + } $this->_data['categories'] = $categoryCollection; diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index a7cab966..f9bf7645 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -39,6 +39,11 @@ */ require_once 'Zend/Uri.php'; +/** + * @see Zend_Feed_Reader_Collection_Category + */ +require_once 'Zend/Feed/Reader/Collection/Category.php'; + /** * @category Zend * @package Zend_Feed_Reader @@ -459,6 +464,47 @@ public function getCommentFeedLink($type = 'atom') return $this->_data['commentfeedlink']; } + + /** + * Get all categories + * + * @return Zend_Feed_Reader_Collection_Category + */ + public function getCategories() + { + if (array_key_exists('categories', $this->_data)) { + return $this->_data['categories']; + } + + if ($this->_getAtomType() == Zend_Feed_Reader::TYPE_ATOM_10) { + $list = $this->_xpath->query($this->getXpathPrefix() . '//atom:category'); + } else { + /** + * Since Atom 0.3 did not support categories, it would have used the + * Dublin Core extension. However there is a small possibility Atom 0.3 + * may have been retrofittied to use Atom 1.0 instead. + */ + $this->_xpath->registerNamespace('atom10', Zend_Feed_Reader::NAMESPACE_ATOM_10); + $list = $this->_xpath->query($this->getXpathPrefix() . '//atom10:category'); + } + + if ($list->length) { + $categoryCollection = new Zend_Feed_Reader_Collection_Category; + foreach ($list as $category) { + $categoryCollection[] = array( + 'term' => $category->getAttribute('term'), + 'scheme' => $category->getAttribute('scheme'), + 'label' => html_entity_decode($category->getAttribute('label')) + ); + } + } else { + return new Zend_Feed_Reader_Collection_Category; + } + + $this->_data['categories'] = $categoryCollection; + + return $this->_data['categories']; + } /** * Attempt to absolutise the URI, i.e. if a relative URI apply the diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index 78331754..820c54a5 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -36,6 +36,10 @@ class Zend_Feed_Reader_Entry_AtomTest extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; + + protected $_expectedCats = array(); + + protected $_expectedCatsDc = array(); public function setup() { @@ -51,6 +55,35 @@ public function setup() } } Zend_Date::setOptions(array('format_type'=>'iso')); + $this->_expectedCats = array( + array( + 'term' => 'topic1', + 'scheme' => 'http://example.com/schema1', + 'label' => 'topic1' + ), + array( + 'term' => 'topic1', + 'scheme' => 'http://example.com/schema2', + 'label' => 'topic1' + ), + array( + 'term' => 'cat_dog', + 'scheme' => 'http://example.com/schema1', + 'label' => 'Cat & Dog' + ) + ); + $this->_expectedCatsDc = array( + array( + 'term' => 'topic1', + 'scheme' => null, + 'label' => 'topic1' + ), + array( + 'term' => 'topic2', + 'scheme' => null, + 'label' => 'topic2' + ) + ); } public function teardown() @@ -374,4 +407,75 @@ public function testGetsCommentLinkFromAtom10_RelativeLinks() $entry = $feed->current(); $this->assertEquals('http://www.example.com/entry/comments', $entry->getCommentLink()); } + + /** + * Get category data + */ + + // Atom 1.0 (Atom 0.3 never supported categories except via Atom 1.0/Dublin Core extensions) + + public function testGetsCategoriesFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/atom10.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCats, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromAtom03_Atom10Extension() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/atom03.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCats, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); + } + + // DC 1.0/1.1 for Atom 0.3 + + public function testGetsCategoriesFromAtom03_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc10/atom03.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsDc, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromAtom03_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc11/atom03.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsDc, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); + } + + // No Categories In Entry + + public function testGetsCategoriesFromAtom10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/atom10.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), (array) $entry->getCategories()); + $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromAtom03_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/atom03.xml') + ); + $entry = $feed->current(); + $this->assertEquals(array(), (array) $entry->getCategories()); + $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); + } + } diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index 49297b6d..c22389c2 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -40,6 +40,8 @@ class Zend_Feed_Reader_Entry_RssTest extends PHPUnit_Framework_TestCase protected $_expectedCats = array(); protected $_expectedCatsRdf = array(); + + protected $_expectedCatsAtom = array(); public function setup() { @@ -84,6 +86,23 @@ public function setup() 'label' => 'topic2' ) ); + $this->_expectedCatsAtom = array( + array( + 'term' => 'topic1', + 'scheme' => 'http://example.com/schema1', + 'label' => 'topic1' + ), + array( + 'term' => 'topic1', + 'scheme' => 'http://example.com/schema2', + 'label' => 'topic1' + ), + array( + 'term' => 'cat_dog', + 'scheme' => 'http://example.com/schema1', + 'label' => 'Cat & Dog' + ) + ); } public function teardown() @@ -2850,6 +2869,68 @@ public function testGetsCategoriesFromRss10_Dc11() $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } + // Atom 1.0 + + public function testGetsCategoriesFromRss090_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss090.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsAtom, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss091_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss091.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsAtom, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss092_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss092.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsAtom, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss093_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss093.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsAtom, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss094_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss094.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsAtom, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss10_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss10.xml') + ); + $entry = $feed->current(); + $this->assertEquals($this->_expectedCatsAtom, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); + } + // No Categories In Entry public function testGetsCategoriesFromRss20_None() diff --git a/test/Reader/Entry/_files/Atom/category/plain/atom03.xml b/test/Reader/Entry/_files/Atom/category/plain/atom03.xml new file mode 100644 index 00000000..814feeb4 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/category/plain/atom03.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Atom/category/plain/atom10.xml b/test/Reader/Entry/_files/Atom/category/plain/atom10.xml new file mode 100644 index 00000000..1aa5f997 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/category/plain/atom10.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/test/Reader/Entry/_files/Atom/category/plain/dc10/atom03.xml b/test/Reader/Entry/_files/Atom/category/plain/dc10/atom03.xml new file mode 100644 index 00000000..521c1ab7 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/category/plain/dc10/atom03.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/test/Reader/Entry/_files/Atom/category/plain/dc11/atom03.xml b/test/Reader/Entry/_files/Atom/category/plain/dc11/atom03.xml new file mode 100644 index 00000000..68942d07 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/category/plain/dc11/atom03.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/test/Reader/Entry/_files/Atom/category/plain/none/atom03.xml b/test/Reader/Entry/_files/Atom/category/plain/none/atom03.xml new file mode 100644 index 00000000..8d52ee99 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/category/plain/none/atom03.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/test/Reader/Entry/_files/Atom/category/plain/none/atom10.xml b/test/Reader/Entry/_files/Atom/category/plain/none/atom10.xml new file mode 100644 index 00000000..08dab19c --- /dev/null +++ b/test/Reader/Entry/_files/Atom/category/plain/none/atom10.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/atom10/rss090.xml b/test/Reader/Entry/_files/Rss/category/plain/atom10/rss090.xml new file mode 100644 index 00000000..51c903fb --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/atom10/rss090.xml @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/atom10/rss091.xml b/test/Reader/Entry/_files/Rss/category/plain/atom10/rss091.xml new file mode 100644 index 00000000..450aff76 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/atom10/rss091.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/atom10/rss092.xml b/test/Reader/Entry/_files/Rss/category/plain/atom10/rss092.xml new file mode 100644 index 00000000..694e2f10 --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/atom10/rss092.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/atom10/rss093.xml b/test/Reader/Entry/_files/Rss/category/plain/atom10/rss093.xml new file mode 100644 index 00000000..d331196f --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/atom10/rss093.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/atom10/rss094.xml b/test/Reader/Entry/_files/Rss/category/plain/atom10/rss094.xml new file mode 100644 index 00000000..daa6057f --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/atom10/rss094.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/test/Reader/Entry/_files/Rss/category/plain/atom10/rss10.xml b/test/Reader/Entry/_files/Rss/category/plain/atom10/rss10.xml new file mode 100644 index 00000000..d760bece --- /dev/null +++ b/test/Reader/Entry/_files/Rss/category/plain/atom10/rss10.xml @@ -0,0 +1,13 @@ + + + + + + + + + + From 916ddb946526f22e6de2f677dcf4d87e6e0eb3e0 Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 21 Nov 2009 16:46:40 +0000 Subject: [PATCH 061/238] Zend_Feed_Reader: Add test fixtures for feed level category testing git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19165 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Extension/Atom/Feed.php | 41 +++++++++++++++++++ src/Reader/Extension/DublinCore/Feed.php | 34 +++++++++++++++ src/Reader/Feed/Atom.php | 24 +++++++++++ src/Reader/Feed/Rss.php | 40 ++++++++++++++++++ .../_files/Atom/category/plain/atom03.xml | 10 +++++ .../_files/Atom/category/plain/atom10.xml | 8 ++++ .../Atom/category/plain/dc10/atom03.xml | 8 ++++ .../Atom/category/plain/dc11/atom03.xml | 8 ++++ .../Atom/category/plain/none/atom03.xml | 5 +++ .../Atom/category/plain/none/atom10.xml | 5 +++ .../Rss/category/plain/atom10/rss090.xml | 11 +++++ .../Rss/category/plain/atom10/rss091.xml | 8 ++++ .../Rss/category/plain/atom10/rss092.xml | 8 ++++ .../Rss/category/plain/atom10/rss093.xml | 8 ++++ .../Rss/category/plain/atom10/rss094.xml | 8 ++++ .../Rss/category/plain/atom10/rss10.xml | 11 +++++ .../_files/Rss/category/plain/dc10/rss090.xml | 10 +++++ .../_files/Rss/category/plain/dc10/rss091.xml | 7 ++++ .../_files/Rss/category/plain/dc10/rss092.xml | 7 ++++ .../_files/Rss/category/plain/dc10/rss093.xml | 7 ++++ .../_files/Rss/category/plain/dc10/rss094.xml | 7 ++++ .../_files/Rss/category/plain/dc10/rss10.xml | 10 +++++ .../_files/Rss/category/plain/dc11/rss090.xml | 10 +++++ .../_files/Rss/category/plain/dc11/rss091.xml | 7 ++++ .../_files/Rss/category/plain/dc11/rss092.xml | 7 ++++ .../_files/Rss/category/plain/dc11/rss093.xml | 7 ++++ .../_files/Rss/category/plain/dc11/rss094.xml | 7 ++++ .../_files/Rss/category/plain/dc11/rss10.xml | 12 ++++++ .../_files/Rss/category/plain/none/rss090.xml | 9 ++++ .../_files/Rss/category/plain/none/rss091.xml | 7 ++++ .../_files/Rss/category/plain/none/rss092.xml | 7 ++++ .../_files/Rss/category/plain/none/rss093.xml | 7 ++++ .../_files/Rss/category/plain/none/rss094.xml | 7 ++++ .../_files/Rss/category/plain/none/rss10.xml | 9 ++++ .../_files/Rss/category/plain/none/rss20.xml | 7 ++++ .../Feed/_files/Rss/category/plain/rss20.xml | 10 +++++ 36 files changed, 398 insertions(+) create mode 100644 test/Reader/Feed/_files/Atom/category/plain/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/category/plain/atom10.xml create mode 100644 test/Reader/Feed/_files/Atom/category/plain/dc10/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/category/plain/dc11/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/category/plain/none/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/category/plain/none/atom10.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/atom10/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/atom10/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/atom10/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/atom10/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/atom10/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/atom10/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/dc10/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/dc10/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/dc10/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/dc10/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/dc10/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/dc10/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/dc11/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/dc11/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/dc11/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/dc11/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/dc11/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/dc11/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/none/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/none/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/none/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/none/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/none/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/none/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/none/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/category/plain/rss20.xml diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index c84e9601..9be1c760 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -416,6 +416,47 @@ public function getTitle() return $this->_data['title']; } + + /** + * Get all categories + * + * @return Zend_Feed_Reader_Collection_Category + */ + public function getCategories() + { + if (array_key_exists('categories', $this->_data)) { + return $this->_data['categories']; + } + + if ($this->_getAtomType() == Zend_Feed_Reader::TYPE_ATOM_10) { + $list = $this->_xpath->query($this->getXpathPrefix() . '//atom:category'); + } else { + /** + * Since Atom 0.3 did not support categories, it would have used the + * Dublin Core extension. However there is a small possibility Atom 0.3 + * may have been retrofittied to use Atom 1.0 instead. + */ + $this->_xpath->registerNamespace('atom10', Zend_Feed_Reader::NAMESPACE_ATOM_10); + $list = $this->_xpath->query($this->getXpathPrefix() . '//atom10:category'); + } + + if ($list->length) { + $categoryCollection = new Zend_Feed_Reader_Collection_Category; + foreach ($list as $category) { + $categoryCollection[] = array( + 'term' => $category->getAttribute('term'), + 'scheme' => $category->getAttribute('scheme'), + 'label' => html_entity_decode($category->getAttribute('label')) + ); + } + } else { + return new Zend_Feed_Reader_Collection_Category; + } + + $this->_data['categories'] = $categoryCollection; + + return $this->_data['categories']; + } /** * Get an author entry in RSS format diff --git a/src/Reader/Extension/DublinCore/Feed.php b/src/Reader/Extension/DublinCore/Feed.php index 15f2fcc0..e4329866 100644 --- a/src/Reader/Extension/DublinCore/Feed.php +++ b/src/Reader/Extension/DublinCore/Feed.php @@ -251,6 +251,40 @@ public function getDate() return $this->_data['date']; } + + /** + * Get categories (subjects under DC) + * + * @return Zend_Feed_Reader_Collection_Category + */ + public function getCategories() + { + if (array_key_exists('categories', $this->_data)) { + return $this->_data['categories']; + } + + $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc11:subject'); + + if (!$list->length) { + $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc10:subject'); + } + + if ($list->length) { + $categoryCollection = new Zend_Feed_Reader_Collection_Category; + foreach ($list as $category) { + $categoryCollection[] = array( + 'term' => $category->nodeValue, + 'scheme' => null, + 'label' => $category->nodeValue, + ); + } + } else { + $categoryCollection = new Zend_Feed_Reader_Collection_Category; + } + + $this->_data['categories'] = $categoryCollection; + return $this->_data['categories']; + } /** * Register the default namespaces for the current feed format diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index 6b0e968e..198f3184 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -49,6 +49,8 @@ public function __construct(DomDocument $dom, $type = null) parent::__construct($dom, $type); $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Feed'); $this->_extensions['Atom_Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); + $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Feed'); + $this->_extensions['DublinCore_Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); foreach ($this->_extensions as $extension) { $extension->setXpathPrefix('/atom:feed'); } @@ -328,6 +330,28 @@ public function getHubs() return $this->_data['hubs']; } + + /** + * Get all categories + * + * @return Zend_Feed_Reader_Collection_Category + */ + public function getCategories() + { + if (array_key_exists('categories', $this->_data)) { + return $this->_data['categories']; + } + + $categoryCollection = $this->getExtension('Atom')->getCategories(); + + if (count($categoryCollection) == 0) { + $categoryCollection = $this->getExtension('DublinCore')->getCategories(); + } + + $this->_data['categories'] = $categoryCollection; + + return $this->_data['categories']; + } /** * Read all entries to the internal entries array diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 9a708a8d..f5b2adf3 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -515,6 +515,46 @@ public function getHubs() return $this->_data['hubs']; } + + /** + * Get all categories + * + * @return Zend_Feed_Reader_Collection_Category + */ + public function getCategories() + { + if (array_key_exists('categories', $this->_data)) { + return $this->_data['categories']; + } + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $list = $this->_xpath->query('/rss/channel//category'); + } else { + $list = $this->_xpath->query('/rdf:RDF/rss:channel//rss:category'); + } + + if ($list->length) { + $categoryCollection = new Zend_Feed_Reader_Collection_Category; + foreach ($list as $category) { + $categoryCollection[] = array( + 'term' => $category->nodeValue, + 'scheme' => $category->getAttribute('domain'), + 'label' => $category->nodeValue, + ); + } + } else { + $categoryCollection = $this->getExtension('DublinCore')->getCategories(); + } + + if (count($categoryCollection) == 0) { + $categoryCollection = $this->getExtension('Atom')->getCategories(); + } + + $this->_data['categories'] = $categoryCollection; + + return $this->_data['categories']; + } /** * Read all entries to the internal entries array diff --git a/test/Reader/Feed/_files/Atom/category/plain/atom03.xml b/test/Reader/Feed/_files/Atom/category/plain/atom03.xml new file mode 100644 index 00000000..510b42f8 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/category/plain/atom03.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/test/Reader/Feed/_files/Atom/category/plain/atom10.xml b/test/Reader/Feed/_files/Atom/category/plain/atom10.xml new file mode 100644 index 00000000..6778c92f --- /dev/null +++ b/test/Reader/Feed/_files/Atom/category/plain/atom10.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/test/Reader/Feed/_files/Atom/category/plain/dc10/atom03.xml b/test/Reader/Feed/_files/Atom/category/plain/dc10/atom03.xml new file mode 100644 index 00000000..02c8c7a3 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/category/plain/dc10/atom03.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Atom/category/plain/dc11/atom03.xml b/test/Reader/Feed/_files/Atom/category/plain/dc11/atom03.xml new file mode 100644 index 00000000..8832d688 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/category/plain/dc11/atom03.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Atom/category/plain/none/atom03.xml b/test/Reader/Feed/_files/Atom/category/plain/none/atom03.xml new file mode 100644 index 00000000..8d52ee99 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/category/plain/none/atom03.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/test/Reader/Feed/_files/Atom/category/plain/none/atom10.xml b/test/Reader/Feed/_files/Atom/category/plain/none/atom10.xml new file mode 100644 index 00000000..08dab19c --- /dev/null +++ b/test/Reader/Feed/_files/Atom/category/plain/none/atom10.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/atom10/rss090.xml b/test/Reader/Feed/_files/Rss/category/plain/atom10/rss090.xml new file mode 100644 index 00000000..84f0e76d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/atom10/rss090.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/atom10/rss091.xml b/test/Reader/Feed/_files/Rss/category/plain/atom10/rss091.xml new file mode 100644 index 00000000..b9ece3ca --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/atom10/rss091.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/atom10/rss092.xml b/test/Reader/Feed/_files/Rss/category/plain/atom10/rss092.xml new file mode 100644 index 00000000..36e9ae82 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/atom10/rss092.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/atom10/rss093.xml b/test/Reader/Feed/_files/Rss/category/plain/atom10/rss093.xml new file mode 100644 index 00000000..8d31709c --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/atom10/rss093.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/atom10/rss094.xml b/test/Reader/Feed/_files/Rss/category/plain/atom10/rss094.xml new file mode 100644 index 00000000..4dda35b0 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/atom10/rss094.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/atom10/rss10.xml b/test/Reader/Feed/_files/Rss/category/plain/atom10/rss10.xml new file mode 100644 index 00000000..f9db4b80 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/atom10/rss10.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/dc10/rss090.xml b/test/Reader/Feed/_files/Rss/category/plain/dc10/rss090.xml new file mode 100644 index 00000000..044832d4 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/dc10/rss090.xml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/dc10/rss091.xml b/test/Reader/Feed/_files/Rss/category/plain/dc10/rss091.xml new file mode 100644 index 00000000..e90ad292 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/dc10/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/dc10/rss092.xml b/test/Reader/Feed/_files/Rss/category/plain/dc10/rss092.xml new file mode 100644 index 00000000..7909a2e0 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/dc10/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/dc10/rss093.xml b/test/Reader/Feed/_files/Rss/category/plain/dc10/rss093.xml new file mode 100644 index 00000000..6370b1f1 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/dc10/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/dc10/rss094.xml b/test/Reader/Feed/_files/Rss/category/plain/dc10/rss094.xml new file mode 100644 index 00000000..d31de294 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/dc10/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/dc10/rss10.xml b/test/Reader/Feed/_files/Rss/category/plain/dc10/rss10.xml new file mode 100644 index 00000000..de9cfc8d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/dc10/rss10.xml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/dc11/rss090.xml b/test/Reader/Feed/_files/Rss/category/plain/dc11/rss090.xml new file mode 100644 index 00000000..8b5c4c0e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/dc11/rss090.xml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/dc11/rss091.xml b/test/Reader/Feed/_files/Rss/category/plain/dc11/rss091.xml new file mode 100644 index 00000000..842ff893 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/dc11/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/dc11/rss092.xml b/test/Reader/Feed/_files/Rss/category/plain/dc11/rss092.xml new file mode 100644 index 00000000..0d66d5a0 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/dc11/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/dc11/rss093.xml b/test/Reader/Feed/_files/Rss/category/plain/dc11/rss093.xml new file mode 100644 index 00000000..0100c3bc --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/dc11/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/dc11/rss094.xml b/test/Reader/Feed/_files/Rss/category/plain/dc11/rss094.xml new file mode 100644 index 00000000..83683859 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/dc11/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/dc11/rss10.xml b/test/Reader/Feed/_files/Rss/category/plain/dc11/rss10.xml new file mode 100644 index 00000000..43881624 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/dc11/rss10.xml @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/test/Reader/Feed/_files/Rss/category/plain/none/rss090.xml b/test/Reader/Feed/_files/Rss/category/plain/none/rss090.xml new file mode 100644 index 00000000..57814153 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/none/rss090.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/category/plain/none/rss091.xml b/test/Reader/Feed/_files/Rss/category/plain/none/rss091.xml new file mode 100644 index 00000000..04d999e3 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/none/rss091.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/category/plain/none/rss092.xml b/test/Reader/Feed/_files/Rss/category/plain/none/rss092.xml new file mode 100644 index 00000000..8b31a074 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/none/rss092.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/category/plain/none/rss093.xml b/test/Reader/Feed/_files/Rss/category/plain/none/rss093.xml new file mode 100644 index 00000000..31d61445 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/none/rss093.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/category/plain/none/rss094.xml b/test/Reader/Feed/_files/Rss/category/plain/none/rss094.xml new file mode 100644 index 00000000..e375a1d9 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/none/rss094.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/category/plain/none/rss10.xml b/test/Reader/Feed/_files/Rss/category/plain/none/rss10.xml new file mode 100644 index 00000000..0ab6cc5b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/none/rss10.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/category/plain/none/rss20.xml b/test/Reader/Feed/_files/Rss/category/plain/none/rss20.xml new file mode 100644 index 00000000..8ace034d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/none/rss20.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/category/plain/rss20.xml b/test/Reader/Feed/_files/Rss/category/plain/rss20.xml new file mode 100644 index 00000000..1530bf81 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/category/plain/rss20.xml @@ -0,0 +1,10 @@ + + + + topic1 + topic1 + topic2 + + + + From 4ed4cae0c5e55aef1660f6fcae9173c13296d4cf Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 21 Nov 2009 16:53:41 +0000 Subject: [PATCH 062/238] Zend_Feed_Reader: Added RSS/RDF tests for feed level getCategories() method git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19166 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Reader/Feed/RssTest.php | 301 ++++++++++++++++++++++++++++++++++- 1 file changed, 300 insertions(+), 1 deletion(-) diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index 0e75eb9b..8cfa1b64 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -37,6 +37,12 @@ class Zend_Feed_Reader_Feed_RssTest extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; + + protected $_expectedCats = array(); + + protected $_expectedCatsRdf = array(); + + protected $_expectedCatsAtom = array(); public function setup() { @@ -52,6 +58,52 @@ public function setup() } } Zend_Date::setOptions(array('format_type'=>'iso')); + $this->_expectedCats = array( + array( + 'term' => 'topic1', + 'scheme' => 'http://example.com/schema1', + 'label' => 'topic1' + ), + array( + 'term' => 'topic1', + 'scheme' => 'http://example.com/schema2', + 'label' => 'topic1' + ), + array( + 'term' => 'topic2', + 'scheme' => 'http://example.com/schema1', + 'label' => 'topic2' + ) + ); + $this->_expectedCatsRdf = array( + array( + 'term' => 'topic1', + 'scheme' => null, + 'label' => 'topic1' + ), + array( + 'term' => 'topic2', + 'scheme' => null, + 'label' => 'topic2' + ) + ); + $this->_expectedCatsAtom = array( + array( + 'term' => 'topic1', + 'scheme' => 'http://example.com/schema1', + 'label' => 'topic1' + ), + array( + 'term' => 'topic1', + 'scheme' => 'http://example.com/schema2', + 'label' => 'topic1' + ), + array( + 'term' => 'cat_dog', + 'scheme' => 'http://example.com/schema1', + 'label' => 'Cat & Dog' + ) + ); } public function teardown() @@ -2370,6 +2422,253 @@ public function testGetsHubsFromRss090_None() ); $this->assertEquals(null, $feed->getHubs()); } - + + /** + * Get category data + */ + + // RSS 2.0 + + public function testGetsCategoriesFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/rss20.xml') + ); + $this->assertEquals($this->_expectedCats, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); + } + + // DC 1.0 + + public function testGetsCategoriesFromRss090_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss090.xml') + ); + $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss091_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss091.xml') + ); + $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss092_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss092.xml') + ); + $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss093_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss093.xml') + ); + $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss094_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss094.xml') + ); + $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss10_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss10.xml') + ); + $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); + } + + // DC 1.1 + + public function testGetsCategoriesFromRss090_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss090.xml') + ); + $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss091_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss091.xml') + ); + $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss092_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss092.xml') + ); + $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss093_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss093.xml') + ); + $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss094_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss094.xml') + ); + $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss10_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss10.xml') + ); + $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); + } + + // Atom 1.0 + + public function testGetsCategoriesFromRss090_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss090.xml') + ); + $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss091_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss091.xml') + ); + $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss092_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss092.xml') + ); + $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss093_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss093.xml') + ); + $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss094_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss094.xml') + ); + $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss10_Atom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss10.xml') + ); + $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); + } + + // No Categories In Entry + + public function testGetsCategoriesFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/rss20.xml') + ); + $this->assertEquals(array(), (array) $feed->getCategories()); + $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/rss090.xml') + ); + $this->assertEquals(array(), (array) $feed->getCategories()); + $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/rss091.xml') + ); + $this->assertEquals(array(), (array) $feed->getCategories()); + $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/rss092.xml') + ); + $this->assertEquals(array(), (array) $feed->getCategories()); + $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/rss093.xml') + ); + $this->assertEquals(array(), (array) $feed->getCategories()); + $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/rss094.xml') + ); + $this->assertEquals(array(), (array) $feed->getCategories()); + $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/rss10.xml') + ); + $this->assertEquals(array(), (array) $feed->getCategories()); + $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); + } } From 9290fb66549e55d770481cdb76964a1471ce4a7e Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 21 Nov 2009 17:17:18 +0000 Subject: [PATCH 063/238] Zend_Feed_Reader: Added feed level getCategory() tests for Atom 0.3/1.0 support git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19168 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Reader/Feed/AtomTest.php | 97 +++++++++++++++++++ .../_files/Atom/category/plain/atom10.xml | 6 +- 2 files changed, 100 insertions(+), 3 deletions(-) diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 0bb7add9..82b57970 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -38,6 +38,10 @@ class Zend_Feed_Reader_Feed_AtomTest extends PHPUnit_Framework_TestCase protected $_feedSamplePath = null; protected $_options = array(); + + protected $_expectedCats = array(); + + protected $_expectedCatsDc = array(); public function setup() { @@ -53,6 +57,35 @@ public function setup() } } Zend_Date::setOptions(array('format_type'=>'iso')); + $this->_expectedCats = array( + array( + 'term' => 'topic1', + 'scheme' => 'http://example.com/schema1', + 'label' => 'topic1' + ), + array( + 'term' => 'topic1', + 'scheme' => 'http://example.com/schema2', + 'label' => 'topic1' + ), + array( + 'term' => 'cat_dog', + 'scheme' => 'http://example.com/schema1', + 'label' => 'Cat & Dog' + ) + ); + $this->_expectedCatsDc = array( + array( + 'term' => 'topic1', + 'scheme' => null, + 'label' => 'topic1' + ), + array( + 'term' => 'topic2', + 'scheme' => null, + 'label' => 'topic2' + ) + ); } public function teardown() @@ -391,4 +424,68 @@ public function testCountableInterface() ); $this->assertEquals(0, count($feed)); } + + /** + * Get category data + */ + + // Atom 1.0 (Atom 0.3 never supported categories except via Atom 1.0/Dublin Core extensions) + + public function testGetsCategoriesFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/atom10.xml') + ); + $this->assertEquals($this->_expectedCats, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromAtom03_Atom10Extension() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/atom03.xml') + ); + $this->assertEquals($this->_expectedCats, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); + } + + // DC 1.0/1.1 for Atom 0.3 + + public function testGetsCategoriesFromAtom03_Dc10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc10/atom03.xml') + ); + $this->assertEquals($this->_expectedCatsDc, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromAtom03_Dc11() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/dc11/atom03.xml') + ); + $this->assertEquals($this->_expectedCatsDc, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); + } + + // No Categories In Entry + + public function testGetsCategoriesFromAtom10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/atom10.xml') + ); + $this->assertEquals(array(), (array) $feed->getCategories()); + $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); + } + + public function testGetsCategoriesFromAtom03_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/plain/none/atom03.xml') + ); + $this->assertEquals(array(), (array) $feed->getCategories()); + $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); + } } diff --git a/test/Reader/Feed/_files/Atom/category/plain/atom10.xml b/test/Reader/Feed/_files/Atom/category/plain/atom10.xml index 6778c92f..5229fde2 100644 --- a/test/Reader/Feed/_files/Atom/category/plain/atom10.xml +++ b/test/Reader/Feed/_files/Atom/category/plain/atom10.xml @@ -1,8 +1,8 @@ - - - + + + From b08e28b1101aeebc63c9d64b9e8f37a34d39eb3c Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 21 Nov 2009 17:20:24 +0000 Subject: [PATCH 064/238] Feed and entry level getCategories() method added to interfaces git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19169 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/EntryInterface.php | 7 +++++++ src/Reader/FeedInterface.php | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/Reader/EntryInterface.php b/src/Reader/EntryInterface.php index db3d26dc..4e22e35d 100644 --- a/src/Reader/EntryInterface.php +++ b/src/Reader/EntryInterface.php @@ -133,4 +133,11 @@ public function getCommentLink(); * @return string */ public function getCommentFeedLink(); + + /** + * Get all categories + * + * @return Zend_Feed_Reader_Collection_Category + */ + public function getCategories(); } diff --git a/src/Reader/FeedInterface.php b/src/Reader/FeedInterface.php index f8fc6d71..34f443e5 100644 --- a/src/Reader/FeedInterface.php +++ b/src/Reader/FeedInterface.php @@ -111,5 +111,12 @@ public function getFeedLink(); * @return string|null */ public function getTitle(); + + /** + * Get all categories + * + * @return Zend_Feed_Reader_Collection_Category + */ + public function getCategories(); } From 8bca43a9cf7b2acc25c2f47c37db90eeda456b25 Mon Sep 17 00:00:00 2001 From: padraic Date: Mon, 23 Nov 2009 16:06:52 +0000 Subject: [PATCH 065/238] Corrected a getCommentCount typo that generated an undefined function error - fixes ZF-8195 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19192 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Entry/Atom.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index ad6f0c34..62017c6d 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -298,7 +298,7 @@ public function getCommentCount() return $this->_data['commentcount']; } - $commentcount = $this->getExtension('Thread')>getCommentCount(); + $commentcount = $this->getExtension('Thread')->getCommentCount(); if (!$commentcount) { $commentcount = $this->getExtension('Atom')->getCommentCount(); From c1eb90edad11b7fe856cad075d99cd21ad6de239 Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 28 Nov 2009 11:51:51 +0000 Subject: [PATCH 066/238] Added preliminary Atom 1.0 Source support (fatal error is known) git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19280 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Entry/Atom.php | 18 +++++++++++++++++ src/Reader/EntryAbstract.php | 10 ---------- src/Reader/Extension/Atom/Entry.php | 31 +++++++++++++++++++++++++++++ src/Reader/Feed/Atom.php | 3 ++- src/Reader/FeedAbstract.php | 16 +++++---------- test/AllTests.php | 4 ++++ 6 files changed, 60 insertions(+), 22 deletions(-) diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index 62017c6d..ed55501b 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -366,6 +366,24 @@ public function getCategories() return $this->_data['categories']; } + + /** + * Get source feed metadata from the entry + * + * @return Zend_Feed_Reader_Feed_Atom_Source|null + */ + public function getSource() + { + if (array_key_exists('source', $this->_data)) { + return $this->_data['source']; + } + + $source = $this->getExtension('Atom')->getSource(); + + $this->_data['source'] = $source; + + return $this->_data['source']; + } /** * Set the XPath query (incl. on all Extensions) diff --git a/src/Reader/EntryAbstract.php b/src/Reader/EntryAbstract.php index 2c1f4a95..7cfa9e59 100644 --- a/src/Reader/EntryAbstract.php +++ b/src/Reader/EntryAbstract.php @@ -169,16 +169,6 @@ public function setXpath(DOMXPath $xpath) return $this; } - /** - * Serialize the entry to an array - * - * @return array - */ - public function toArray() - { - return $this->_data; - } - /** * Get registered extensions * diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index f9bf7645..1d2e256f 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -44,6 +44,11 @@ */ require_once 'Zend/Feed/Reader/Collection/Category.php'; +/** + * @see Zend_Feed_Reader_Feed_Atom_Source + */ +require_once 'Zend/Feed/Reader/Feed/Atom/Source.php'; + /** * @category Zend * @package Zend_Feed_Reader @@ -505,6 +510,32 @@ public function getCategories() return $this->_data['categories']; } + + /** + * Get source feed metadata from the entry + * + * @return Zend_Feed_Reader_Feed_Atom_Source|null + */ + public function getSource() + { + if (array_key_exists('source', $this->_data)) { + return $this->_data['source']; + } + + if ($this->_getAtomType() == Zend_Feed_Reader::TYPE_ATOM_10) { + $source = $this->_xpath->query($this->getXpathPrefix() . '/atom:source[1]'); + } else { + $source = null; + } + + if ($source) { + $source = new Zend_Feed_Reader_Feed_Atom_Source($source, $this->getXpathPrefix()); + } + + $this->_data['source'] = $source; + + return $this->_data['source']; + } /** * Attempt to absolutise the URI, i.e. if a relative URI apply the diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index 198f3184..008c3f75 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -44,7 +44,7 @@ class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract * @param DOMDocument $dom * @param string $type */ - public function __construct(DomDocument $dom, $type = null) + public function __construct(DOMDocument $dom, $type = null) { parent::__construct($dom, $type); $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Feed'); @@ -356,6 +356,7 @@ public function getCategories() /** * Read all entries to the internal entries array * + * @return void */ protected function _indexEntries() { diff --git a/src/Reader/FeedAbstract.php b/src/Reader/FeedAbstract.php index 0da4326b..2013e8b6 100644 --- a/src/Reader/FeedAbstract.php +++ b/src/Reader/FeedAbstract.php @@ -29,7 +29,6 @@ */ require_once 'Zend/Feed/Reader/Entry/Atom.php'; - /** * @see Zend_Feed_Reader_Entry_Rss */ @@ -83,6 +82,11 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt */ protected $_xpath = null; + /** + * Array of loaded extensions + * + * @var array + */ protected $_extensions = array(); /** @@ -227,16 +231,6 @@ public function rewind() $this->_entriesKey = 0; } - /** - * Return the feed as an array - * - * @return array - */ - public function toArray() // untested - { - return $this->_data; - } - /** * Check to see if the iterator is still valid * diff --git a/test/AllTests.php b/test/AllTests.php index 145d417c..8fe1569e 100644 --- a/test/AllTests.php +++ b/test/AllTests.php @@ -53,6 +53,8 @@ require_once 'Zend/Feed/Reader/Feed/CommonTest.php'; require_once 'Zend/Feed/Reader/Entry/CommonTest.php'; +require_once 'Zend/Feed/Reader/Feed/AtomSourceTest.php'; + require_once 'Zend/Feed/Reader/Integration/WordpressRss2DcAtomTest.php'; require_once 'Zend/Feed/Reader/Integration/WordpressAtom10Test.php'; require_once 'Zend/Feed/Reader/Integration/LautDeRdfTest.php'; @@ -101,6 +103,8 @@ public static function suite() $suite->addTestSuite('Zend_Feed_Reader_Feed_CommonTest'); // COMMON - Entry Level $suite->addTestSuite('Zend_Feed_Reader_Entry_CommonTest'); + // ATOM - Entry Level (Source Feed Metadata) + $suite->addTestSuite('Zend_Feed_Reader_Feed_AtomSourceTest'); /** * Real World Feed Tests */ From 8d447a2f8fb9ebff26b2a8122e59e2384979fa8b Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 28 Nov 2009 12:28:51 +0000 Subject: [PATCH 067/238] Adding new Atom Source support files git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19281 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Feed/Atom/Source.php | 102 ++++++ test/Reader/Feed/AtomSourceTest.php | 330 ++++++++++++++++++ .../Feed/_files/AtomSource/title/atom10.xml | 8 + 3 files changed, 440 insertions(+) create mode 100644 src/Reader/Feed/Atom/Source.php create mode 100644 test/Reader/Feed/AtomSourceTest.php create mode 100644 test/Reader/Feed/_files/AtomSource/title/atom10.xml diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php new file mode 100644 index 00000000..d87d1e9b --- /dev/null +++ b/src/Reader/Feed/Atom/Source.php @@ -0,0 +1,102 @@ +_domDocument = $source->ownerDocument; + $this->_xpath = new DOMXPath($this->_domDocument); + $this->_data['type'] = $type; + $this->_registerNamespaces(); + $this->_loadExtensions(); + + $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Feed'); + $this->_extensions['Atom_Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); + $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Feed'); + $this->_extensions['DublinCore_Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); + foreach ($this->_extensions as $extension) { + $extension->setXpathPrefix(rtrim($xpathPrefix, '/') . '/atom:source/'); + } + } + + /** + * Since this is not an Entry carrier but a vehicle for Feed metadata, any + * applicable Entry methods are stubbed out and do nothing. + */ + + /** + * @return void + */ + public function count() {} + + /** + * @return void + */ + public function current() {} + + /** + * @return void + */ + public function key() {} + + /** + * @return void + */ + public function next() {} + + /** + * @return void + */ + public function rewind() {} + + /** + * @return void + */ + public function valid() {} + + /** + * @return void + */ + protected function _indexEntries() {} + +} diff --git a/test/Reader/Feed/AtomSourceTest.php b/test/Reader/Feed/AtomSourceTest.php new file mode 100644 index 00000000..03381504 --- /dev/null +++ b/test/Reader/Feed/AtomSourceTest.php @@ -0,0 +1,330 @@ +_feedSamplePath = dirname(__FILE__) . '/_files/AtomSource'; + $this->_options = Zend_Date::setOptions(); + foreach($this->_options as $k=>$v) { + if (is_null($v)) { + unset($this->_options[$k]); + } + } + Zend_Date::setOptions(array('format_type'=>'iso')); + $this->_expectedCats = array( + array( + 'term' => 'topic1', + 'scheme' => 'http://example.com/schema1', + 'label' => 'topic1' + ), + array( + 'term' => 'topic1', + 'scheme' => 'http://example.com/schema2', + 'label' => 'topic1' + ), + array( + 'term' => 'cat_dog', + 'scheme' => 'http://example.com/schema1', + 'label' => 'Cat & Dog' + ) + ); + $this->_expectedCatsDc = array( + array( + 'term' => 'topic1', + 'scheme' => null, + 'label' => 'topic1' + ), + array( + 'term' => 'topic2', + 'scheme' => null, + 'label' => 'topic2' + ) + ); + } + + public function teardown() + { + Zend_Date::setOptions($this->_options); + } + + public function testGetsSourceFromEntry() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/atom10.xml') + ); + $source = $feed->current()->getSource(); + $this->assertTrue($source instanceof Zend_Feed_Reader_Feed_Atom_Source); + } + + /** + * Get Title (Unencoded Text) + */ + + public function testGetsTitleFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/title/atom10.xml') + ); + $source = $feed->current()->getSource(); + $this->assertEquals('My Title', $source->getTitle()); + } + + /** + * Get Authors (Unencoded Text) + */ + + public function testGetsAuthorArrayFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/atom10.xml') + ); + + $authors = array( + 0 => 'joe@example.com (Joe Bloggs)', + 1 => 'Joe Bloggs', + 3 => 'joe@example.com', + 4 => 'http://www.example.com', + 6 => 'jane@example.com (Jane Bloggs)' + ); + + $this->assertEquals($authors, $feed->getAuthors()); + } + + /** + * Get Single Author (Unencoded Text) + */ + + public function testGetsSingleAuthorFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/author/atom10.xml') + ); + + $this->assertEquals('joe@example.com (Joe Bloggs)', $feed->getAuthor()); + } + + /** + * Get creation date (Unencoded Text) + */ + + public function testGetsDateCreatedFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/datecreated/atom10.xml') + ); + + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateCreated())); + } + + /** + * Get modification date (Unencoded Text) + */ + + public function testGetsDateModifiedFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/datemodified/atom10.xml') + ); + + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getDateModified())); + } + + /** + * Get Generator (Unencoded Text) + */ + + public function testGetsGeneratorFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/generator/atom10.xml') + ); + $this->assertEquals('Zend_Feed', $feed->getGenerator()); + } + + /** + * Get Copyright (Unencoded Text) + */ + + public function testGetsCopyrightFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/copyright/atom10.xml') + ); + $this->assertEquals('Copyright 2008', $feed->getCopyright()); + } + + /** + * Get Description (Unencoded Text) + */ + + public function testGetsDescriptionFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/description/atom10.xml') + ); + $this->assertEquals('My Description', $feed->getDescription()); + } + + /** + * Get Id (Unencoded Text) + */ + + public function testGetsIdFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/id/atom10.xml') + ); + $this->assertEquals('123', $feed->getId()); + } + + /** + * Get Language (Unencoded Text) + */ + + public function testGetsLanguageFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/language/atom10.xml') + ); + $this->assertEquals('en-GB', $feed->getLanguage()); + } + + /** + * Get Link (Unencoded Text) + */ + + public function testGetsLinkFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/atom10.xml') + ); + $this->assertEquals('http://www.example.com', $feed->getLink()); + } + + public function testGetsLinkFromAtom10WithNoRelAttribute() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/atom10-norel.xml') + ); + $this->assertEquals('http://www.example.com', $feed->getLink()); + } + + public function testGetsLinkFromAtom10WithRelativeUrl() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/link/atom10-relative.xml') + ); + $this->assertEquals('http://www.example.com', $feed->getLink()); + } + + /** + * Get Base Uri + */ + public function testGetsBaseUriFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/atom10-relative.xml') + ); + $this->assertEquals('http://www.example.com/', $feed->getBaseUrl()); + } + + /** + * Get Feed Link (Unencoded Text) + */ + + public function testGetsFeedLinkFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/atom10.xml') + ); + $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); + } + + public function testGetsFeedLinkFromAtom10IfRelativeUri() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/atom10-relative.xml') + ); + $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); + } + + /** + * Get Pubsubhubbub Hubs + */ + + public function testGetsHubsFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/hubs/atom10.xml') + ); + $this->assertEquals(array( + 'http://www.example.com/hub1', + 'http://www.example.com/hub2' + ), $feed->getHubs()); + } + + /** + * Get category data + */ + + public function testGetsCategoriesFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/atom10.xml') + ); + $this->assertEquals($this->_expectedCats, (array) $feed->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); + } + +} diff --git a/test/Reader/Feed/_files/AtomSource/title/atom10.xml b/test/Reader/Feed/_files/AtomSource/title/atom10.xml new file mode 100644 index 00000000..9ef8cf34 --- /dev/null +++ b/test/Reader/Feed/_files/AtomSource/title/atom10.xml @@ -0,0 +1,8 @@ + + + + + My Title + + + From 3d0f2f8e38cc7afc58bf9da25e4c3a3728d69cab Mon Sep 17 00:00:00 2001 From: beberlei Date: Sat, 28 Nov 2009 14:48:00 +0000 Subject: [PATCH 068/238] Fix Fatal Errors due to wrong require_once hierachy. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19282 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/FeedAbstract.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/Reader/FeedAbstract.php b/src/Reader/FeedAbstract.php index 2013e8b6..456aefcd 100644 --- a/src/Reader/FeedAbstract.php +++ b/src/Reader/FeedAbstract.php @@ -24,16 +24,6 @@ */ require_once 'Zend/Feed/Reader.php'; -/** - * @see Zend_Feed_Reader_Entry_Atom - */ -require_once 'Zend/Feed/Reader/Entry/Atom.php'; - -/** - * @see Zend_Feed_Reader_Entry_Rss - */ -require_once 'Zend/Feed/Reader/Entry/Rss.php'; - /** * @see Zend_feed_Reader_FeedInterface */ From fe50abcba7a84b5a589f069dbc306d2c7d75a223 Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 28 Nov 2009 17:18:29 +0000 Subject: [PATCH 069/238] Zend_Feed_Reader: Updated Atom Source support to correctly detect a source element in an Atom entry git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19286 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Extension/Atom/Entry.php | 18 ++++++++---------- test/Reader/Feed/AtomSourceTest.php | 1 - 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 1d2e256f..64416040 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -521,19 +521,17 @@ public function getSource() if (array_key_exists('source', $this->_data)) { return $this->_data['source']; } - - if ($this->_getAtomType() == Zend_Feed_Reader::TYPE_ATOM_10) { - $source = $this->_xpath->query($this->getXpathPrefix() . '/atom:source[1]'); - } else { - $source = null; - } - if ($source) { - $source = new Zend_Feed_Reader_Feed_Atom_Source($source, $this->getXpathPrefix()); + $source = null; + if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10) { + $list = $this->_xpath->query($this->getXpathPrefix() . '/atom:source[1]'); + if ($list->length) { + $element = $list->item(0); + $source = new Zend_Feed_Reader_Feed_Atom_Source($element, $this->getXpathPrefix()); + } } - + $this->_data['source'] = $source; - return $this->_data['source']; } diff --git a/test/Reader/Feed/AtomSourceTest.php b/test/Reader/Feed/AtomSourceTest.php index 03381504..c420246b 100644 --- a/test/Reader/Feed/AtomSourceTest.php +++ b/test/Reader/Feed/AtomSourceTest.php @@ -22,7 +22,6 @@ require_once 'PHPUnit/Framework/TestCase.php'; require_once 'Zend/Feed/Reader.php'; -require_once 'Zend/Feed/Reader/FeedAbstract.php'; /** * @category Zend From 00a087ea64dec769ab386ca6b3720e3dc05d95bf Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 28 Nov 2009 17:43:33 +0000 Subject: [PATCH 070/238] Zend_Feed_Reader: completed (two errors remaining) unit tests over support API for Atom 1.0 source elements git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19287 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Reader/Feed/AtomSourceTest.php | 78 +++++++------------ .../Feed/_files/AtomSource/author/atom10.xml | 47 +++++++++++ .../_files/AtomSource/category/atom10.xml | 10 +++ .../_files/AtomSource/copyright/atom10.xml | 8 ++ .../_files/AtomSource/datecreated/atom10.xml | 8 ++ .../_files/AtomSource/datemodified/atom10.xml | 8 ++ .../_files/AtomSource/description/atom10.xml | 8 ++ .../_files/AtomSource/feedlink/atom10.xml | 8 ++ .../_files/AtomSource/generator/atom10.xml | 8 ++ .../Feed/_files/AtomSource/hubs/atom10.xml | 9 +++ .../Feed/_files/AtomSource/id/atom10.xml | 8 ++ .../_files/AtomSource/language/atom10.xml | 8 ++ .../Feed/_files/AtomSource/link/atom10.xml | 8 ++ 13 files changed, 166 insertions(+), 50 deletions(-) create mode 100644 test/Reader/Feed/_files/AtomSource/author/atom10.xml create mode 100644 test/Reader/Feed/_files/AtomSource/category/atom10.xml create mode 100644 test/Reader/Feed/_files/AtomSource/copyright/atom10.xml create mode 100644 test/Reader/Feed/_files/AtomSource/datecreated/atom10.xml create mode 100644 test/Reader/Feed/_files/AtomSource/datemodified/atom10.xml create mode 100644 test/Reader/Feed/_files/AtomSource/description/atom10.xml create mode 100644 test/Reader/Feed/_files/AtomSource/feedlink/atom10.xml create mode 100644 test/Reader/Feed/_files/AtomSource/generator/atom10.xml create mode 100644 test/Reader/Feed/_files/AtomSource/hubs/atom10.xml create mode 100644 test/Reader/Feed/_files/AtomSource/id/atom10.xml create mode 100644 test/Reader/Feed/_files/AtomSource/language/atom10.xml create mode 100644 test/Reader/Feed/_files/AtomSource/link/atom10.xml diff --git a/test/Reader/Feed/AtomSourceTest.php b/test/Reader/Feed/AtomSourceTest.php index c420246b..a2b04910 100644 --- a/test/Reader/Feed/AtomSourceTest.php +++ b/test/Reader/Feed/AtomSourceTest.php @@ -124,6 +124,7 @@ public function testGetsAuthorArrayFromAtom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/atom10.xml') ); + $source = $feed->current()->getSource(); $authors = array( 0 => 'joe@example.com (Joe Bloggs)', @@ -133,7 +134,7 @@ public function testGetsAuthorArrayFromAtom10() 6 => 'jane@example.com (Jane Bloggs)' ); - $this->assertEquals($authors, $feed->getAuthors()); + $this->assertEquals($authors, $source->getAuthors()); } /** @@ -145,8 +146,9 @@ public function testGetsSingleAuthorFromAtom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/atom10.xml') ); + $source = $feed->current()->getSource(); - $this->assertEquals('joe@example.com (Joe Bloggs)', $feed->getAuthor()); + $this->assertEquals('joe@example.com (Joe Bloggs)', $source->getAuthor()); } /** @@ -158,10 +160,11 @@ public function testGetsDateCreatedFromAtom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/atom10.xml') ); + $source = $feed->current()->getSource(); $edate = new Zend_Date; $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateCreated())); + $this->assertTrue($edate->equals($source->getDateCreated())); } /** @@ -173,10 +176,11 @@ public function testGetsDateModifiedFromAtom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/atom10.xml') ); + $source = $feed->current()->getSource(); $edate = new Zend_Date; $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); + $this->assertTrue($edate->equals($source->getDateModified())); } /** @@ -188,7 +192,8 @@ public function testGetsGeneratorFromAtom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/atom10.xml') ); - $this->assertEquals('Zend_Feed', $feed->getGenerator()); + $source = $feed->current()->getSource(); + $this->assertEquals('Zend_Feed', $source->getGenerator()); } /** @@ -200,7 +205,8 @@ public function testGetsCopyrightFromAtom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/atom10.xml') ); - $this->assertEquals('Copyright 2008', $feed->getCopyright()); + $source = $feed->current()->getSource(); + $this->assertEquals('Copyright 2008', $source->getCopyright()); } /** @@ -212,7 +218,8 @@ public function testGetsDescriptionFromAtom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/atom10.xml') ); - $this->assertEquals('My Description', $feed->getDescription()); + $source = $feed->current()->getSource(); + $this->assertEquals('My Description', $source->getDescription()); } /** @@ -224,7 +231,8 @@ public function testGetsIdFromAtom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/atom10.xml') ); - $this->assertEquals('123', $feed->getId()); + $source = $feed->current()->getSource(); + $this->assertEquals('123', $source->getId()); } /** @@ -236,7 +244,8 @@ public function testGetsLanguageFromAtom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/atom10.xml') ); - $this->assertEquals('en-GB', $feed->getLanguage()); + $source = $feed->current()->getSource(); + $this->assertEquals('en-GB', $source->getLanguage()); } /** @@ -248,34 +257,8 @@ public function testGetsLinkFromAtom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/atom10.xml') ); - $this->assertEquals('http://www.example.com', $feed->getLink()); - } - - public function testGetsLinkFromAtom10WithNoRelAttribute() - { - $feed = Zend_Feed_Reader::importString( - file_get_contents($this->_feedSamplePath.'/link/atom10-norel.xml') - ); - $this->assertEquals('http://www.example.com', $feed->getLink()); - } - - public function testGetsLinkFromAtom10WithRelativeUrl() - { - $feed = Zend_Feed_Reader::importString( - file_get_contents($this->_feedSamplePath.'/link/atom10-relative.xml') - ); - $this->assertEquals('http://www.example.com', $feed->getLink()); - } - - /** - * Get Base Uri - */ - public function testGetsBaseUriFromAtom10() - { - $feed = Zend_Feed_Reader::importString( - file_get_contents($this->_feedSamplePath.'/feedlink/atom10-relative.xml') - ); - $this->assertEquals('http://www.example.com/', $feed->getBaseUrl()); + $source = $feed->current()->getSource(); + $this->assertEquals('http://www.example.com', $source->getLink()); } /** @@ -287,17 +270,10 @@ public function testGetsFeedLinkFromAtom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/atom10.xml') ); - $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); - } - - public function testGetsFeedLinkFromAtom10IfRelativeUri() - { - $feed = Zend_Feed_Reader::importString( - file_get_contents($this->_feedSamplePath.'/feedlink/atom10-relative.xml') - ); - $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); + $source = $feed->current()->getSource(); + $this->assertEquals('http://www.example.com/feed/atom', $source->getFeedLink()); } - + /** * Get Pubsubhubbub Hubs */ @@ -307,10 +283,11 @@ public function testGetsHubsFromAtom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/atom10.xml') ); + $source = $feed->current()->getSource(); $this->assertEquals(array( 'http://www.example.com/hub1', 'http://www.example.com/hub2' - ), $feed->getHubs()); + ), $source->getHubs()); } /** @@ -322,8 +299,9 @@ public function testGetsCategoriesFromAtom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/atom10.xml') ); - $this->assertEquals($this->_expectedCats, (array) $feed->getCategories()); - $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); + $source = $feed->current()->getSource(); + $this->assertEquals($this->_expectedCats, (array) $source->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($source->getCategories()->getValues())); } } diff --git a/test/Reader/Feed/_files/AtomSource/author/atom10.xml b/test/Reader/Feed/_files/AtomSource/author/atom10.xml new file mode 100644 index 00000000..d5463b66 --- /dev/null +++ b/test/Reader/Feed/_files/AtomSource/author/atom10.xml @@ -0,0 +1,47 @@ + + + + + + Joe Bloggs + http://www.example.com + joe@example.com + + + Joe Bloggs + http://www.example.com + + + + Joe Bloggs + + + + + + http://www.example.com + joe@example.com + + + + http://www.example.com + + + + + + joe@example.com + + + + + + + + Jane Bloggs + http://www.example.com + jane@example.com + + + + diff --git a/test/Reader/Feed/_files/AtomSource/category/atom10.xml b/test/Reader/Feed/_files/AtomSource/category/atom10.xml new file mode 100644 index 00000000..a7bec9d5 --- /dev/null +++ b/test/Reader/Feed/_files/AtomSource/category/atom10.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/test/Reader/Feed/_files/AtomSource/copyright/atom10.xml b/test/Reader/Feed/_files/AtomSource/copyright/atom10.xml new file mode 100644 index 00000000..87132cde --- /dev/null +++ b/test/Reader/Feed/_files/AtomSource/copyright/atom10.xml @@ -0,0 +1,8 @@ + + + + + Copyright 2008 + + + diff --git a/test/Reader/Feed/_files/AtomSource/datecreated/atom10.xml b/test/Reader/Feed/_files/AtomSource/datecreated/atom10.xml new file mode 100644 index 00000000..6621d310 --- /dev/null +++ b/test/Reader/Feed/_files/AtomSource/datecreated/atom10.xml @@ -0,0 +1,8 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Feed/_files/AtomSource/datemodified/atom10.xml b/test/Reader/Feed/_files/AtomSource/datemodified/atom10.xml new file mode 100644 index 00000000..78eb7670 --- /dev/null +++ b/test/Reader/Feed/_files/AtomSource/datemodified/atom10.xml @@ -0,0 +1,8 @@ + + + + + 2009-03-07T08:03:50Z + + + diff --git a/test/Reader/Feed/_files/AtomSource/description/atom10.xml b/test/Reader/Feed/_files/AtomSource/description/atom10.xml new file mode 100644 index 00000000..58616a62 --- /dev/null +++ b/test/Reader/Feed/_files/AtomSource/description/atom10.xml @@ -0,0 +1,8 @@ + + + + + My Description + + + diff --git a/test/Reader/Feed/_files/AtomSource/feedlink/atom10.xml b/test/Reader/Feed/_files/AtomSource/feedlink/atom10.xml new file mode 100644 index 00000000..6b09c8d1 --- /dev/null +++ b/test/Reader/Feed/_files/AtomSource/feedlink/atom10.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/test/Reader/Feed/_files/AtomSource/generator/atom10.xml b/test/Reader/Feed/_files/AtomSource/generator/atom10.xml new file mode 100644 index 00000000..915b5f75 --- /dev/null +++ b/test/Reader/Feed/_files/AtomSource/generator/atom10.xml @@ -0,0 +1,8 @@ + + + + + Zend_Feed + + + diff --git a/test/Reader/Feed/_files/AtomSource/hubs/atom10.xml b/test/Reader/Feed/_files/AtomSource/hubs/atom10.xml new file mode 100644 index 00000000..10627597 --- /dev/null +++ b/test/Reader/Feed/_files/AtomSource/hubs/atom10.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/Reader/Feed/_files/AtomSource/id/atom10.xml b/test/Reader/Feed/_files/AtomSource/id/atom10.xml new file mode 100644 index 00000000..24348e4c --- /dev/null +++ b/test/Reader/Feed/_files/AtomSource/id/atom10.xml @@ -0,0 +1,8 @@ + + + + + 123 + + + diff --git a/test/Reader/Feed/_files/AtomSource/language/atom10.xml b/test/Reader/Feed/_files/AtomSource/language/atom10.xml new file mode 100644 index 00000000..330fc3ed --- /dev/null +++ b/test/Reader/Feed/_files/AtomSource/language/atom10.xml @@ -0,0 +1,8 @@ + + + + + en-GB + + + diff --git a/test/Reader/Feed/_files/AtomSource/link/atom10.xml b/test/Reader/Feed/_files/AtomSource/link/atom10.xml new file mode 100644 index 00000000..cc34600a --- /dev/null +++ b/test/Reader/Feed/_files/AtomSource/link/atom10.xml @@ -0,0 +1,8 @@ + + + + + + + + From ef9d9cb0e8f2aa354ef348263d22bd414a197d1e Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 28 Nov 2009 18:01:31 +0000 Subject: [PATCH 071/238] Zend_Feed_Reader: Fixed trailing forward slash added to Atom 1.0 source elements XPATH query prefix All tests are now back to a passing state. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19288 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Extension/Atom/Entry.php | 2 +- src/Reader/Extension/Atom/Feed.php | 3 ++- src/Reader/Feed/Atom/Source.php | 2 +- test/Reader/Feed/AtomSourceTest.php | 2 -- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 64416040..57e5071b 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -481,7 +481,7 @@ public function getCategories() return $this->_data['categories']; } - if ($this->_getAtomType() == Zend_Feed_Reader::TYPE_ATOM_10) { + if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10) { $list = $this->_xpath->query($this->getXpathPrefix() . '//atom:category'); } else { /** diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index 9be1c760..a47dcea7 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -379,6 +379,7 @@ public function getHubs() return $this->_data['hubs']; } $hubs = array(); + $list = $this->_xpath->query($this->getXpathPrefix() . '//atom:link[@rel="hub"]/@href'); @@ -428,7 +429,7 @@ public function getCategories() return $this->_data['categories']; } - if ($this->_getAtomType() == Zend_Feed_Reader::TYPE_ATOM_10) { + if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10) { $list = $this->_xpath->query($this->getXpathPrefix() . '//atom:category'); } else { /** diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php index d87d1e9b..e2ce9b05 100644 --- a/src/Reader/Feed/Atom/Source.php +++ b/src/Reader/Feed/Atom/Source.php @@ -55,7 +55,7 @@ public function __construct(DOMElement $source, $xpathPrefix, $type = Zend_Feed_ $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Feed'); $this->_extensions['DublinCore_Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); foreach ($this->_extensions as $extension) { - $extension->setXpathPrefix(rtrim($xpathPrefix, '/') . '/atom:source/'); + $extension->setXpathPrefix(rtrim($xpathPrefix, '/') . '/atom:source'); } } diff --git a/test/Reader/Feed/AtomSourceTest.php b/test/Reader/Feed/AtomSourceTest.php index a2b04910..b7d61fe1 100644 --- a/test/Reader/Feed/AtomSourceTest.php +++ b/test/Reader/Feed/AtomSourceTest.php @@ -277,7 +277,6 @@ public function testGetsFeedLinkFromAtom10() /** * Get Pubsubhubbub Hubs */ - public function testGetsHubsFromAtom10() { $feed = Zend_Feed_Reader::importString( @@ -293,7 +292,6 @@ public function testGetsHubsFromAtom10() /** * Get category data */ - public function testGetsCategoriesFromAtom10() { $feed = Zend_Feed_Reader::importString( From b2ef3592a04b815b4403f7ec380df3a85d88bd2c Mon Sep 17 00:00:00 2001 From: padraic Date: Sun, 29 Nov 2009 17:24:27 +0000 Subject: [PATCH 072/238] Zend_Feed_Reader: Improved Atom version detection using DOMNode::isDefaultNamespace() and DOMNode::lookupPrefix() to be far more robust and reliable. Fixes a subtle bug where Atom 0.3 namespace was registered correctly, but only because of the feed type set. In isolation, this would break Atom 0.3 entry parsing. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19291 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader.php | 20 ++++- src/Reader/EntryAbstract.php | 3 + src/Reader/Extension/Atom/Entry.php | 84 +++++++++---------- src/Reader/Extension/Atom/Feed.php | 21 +++-- src/Reader/Extension/EntryAbstract.php | 5 +- test/AllTests.php | 3 + test/Reader/Entry/AtomTest.php | 2 + test/Reader/Entry/CommonTest.php | 1 + test/Reader/Entry/RssTest.php | 1 + .../Entry/_files/Atom/id/plain/atom03.xml | 2 +- test/Reader/Feed/AtomSourceTest.php | 1 + test/Reader/Feed/AtomTest.php | 1 + test/Reader/Feed/CommonTest.php | 1 + test/Reader/Feed/RssTest.php | 1 + .../Integration/H-OnlineComAtom10Test.php | 1 + test/Reader/Integration/LautDeRdfTest.php | 1 + test/Reader/Integration/PodcastRss2Test.php | 1 + .../Integration/WordpressAtom10Test.php | 1 + .../Integration/WordpressRss2DcAtomTest.php | 1 + 19 files changed, 89 insertions(+), 62 deletions(-) diff --git a/src/Reader.php b/src/Reader.php index 971032da..9eae8791 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -62,6 +62,7 @@ class Zend_Feed_Reader const TYPE_ANY = 'any'; const TYPE_ATOM_03 = 'atom-03'; const TYPE_ATOM_10 = 'atom-10'; + const TYPE_ATOM_10_ENTRY = 'atom-10-entry'; const TYPE_ATOM_ANY = 'atom'; const TYPE_RSS_090 = 'rss-090'; const TYPE_RSS_091 = 'rss-091'; @@ -341,6 +342,8 @@ public static function importString($string) if (substr($type, 0, 3) == 'rss') { $reader = new Zend_Feed_Reader_Feed_Rss($dom, $type); + } elseif (substr($type, 8, 5) == 'entry') { + $reader = new Zend_Feed_Reader_Entry_Atom($dom->documentElement, 0, Zend_Feed_Reader::TYPE_ATOM_10); } elseif (substr($type, 0, 4) == 'atom') { $reader = new Zend_Feed_Reader_Feed_Atom($dom, $type); } else { @@ -412,14 +415,14 @@ public static function findFeedLinks($uri) /** * Detect the feed type of the provided feed * - * @param Zend_Feed_Abstract $feed A fully instantiated Zend_Feed object + * @param Zend_Feed_Abstract|DOMDocument|string $feed * @return string */ - public static function detectType($feed) + public static function detectType($feed, $specOnly = false) { if ($feed instanceof Zend_Feed_Reader_FeedInterface) { $dom = $feed->getDomDocument(); - } elseif($feed instanceof DomDocument) { + } elseif($feed instanceof DOMDocument) { $dom = $feed; } elseif(is_string($feed) && !empty($feed)) { @ini_set('track_errors', 1); @@ -439,7 +442,8 @@ public static function detectType($feed) } } else { require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid object/scalar provided: must be of type Zend_Feed_Reader_FeedInterface, DomDocument or string'); + throw new Zend_Feed_Exception('Invalid object/scalar provided: must' + . ' be of type Zend_Feed_Reader_FeedInterface, DomDocument or string'); } $xpath = new DOMXPath($dom); @@ -504,6 +508,14 @@ public static function detectType($feed) if ($xpath->query('//atom:feed')->length) { return self::TYPE_ATOM_10; } + + if ($xpath->query('//atom:entry')->length) { + if ($specOnly == true) { + return self::TYPE_ATOM_10; + } else { + return self::TYPE_ATOM_10_ENTRY; + } + } $xpath->registerNamespace('atom', self::NAMESPACE_ATOM_03); diff --git a/src/Reader/EntryAbstract.php b/src/Reader/EntryAbstract.php index 7cfa9e59..d07f1a04 100644 --- a/src/Reader/EntryAbstract.php +++ b/src/Reader/EntryAbstract.php @@ -154,6 +154,9 @@ public function getType() */ public function getXpath() { + if (!$this->_xpath) { + $this->setXpath(new DOMXPath($this->getDomDocument())); + } return $this->_xpath; } diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 57e5071b..b50d55ee 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -86,13 +86,13 @@ public function getAuthors() return $this->_data['authors']; } - $authors = $this->_xpath->query( + $authors = $this->getXpath()->query( $this->getXpathPrefix() . '//atom:author' . '|' . $this->getXpathPrefix(). '//atom:contributor' ); if (!$authors->length) { - $authors = $this->_xpath->query( + $authors = $this->getXpath()->query( '//atom:author' . '|' . '//atom:contributor' ); } @@ -127,7 +127,7 @@ public function getContent() return $this->_data['content']; } - $content = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:content)'); + $content = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:content)'); if ($content) { $content = html_entity_decode($content, ENT_QUOTES, $this->getEncoding()); @@ -155,10 +155,10 @@ public function getDateCreated() $date = null; - if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { - $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:created)'); + if ($this->_getAtomType() === Zend_Feed_Reader::TYPE_ATOM_03) { + $dateCreated = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:created)'); } else { - $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:published)'); + $dateCreated = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:published)'); } if ($dateCreated) { @@ -184,10 +184,10 @@ public function getDateModified() $date = null; - if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { - $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)'); + if ($this->_getAtomType() === Zend_Feed_Reader::TYPE_ATOM_03) { + $dateModified = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)'); } else { - $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)'); + $dateModified = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)'); } if ($dateModified) { @@ -211,7 +211,7 @@ public function getDescription() return $this->_data['description']; } - $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:summary)'); + $description = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:summary)'); if (!$description) { $description = null; @@ -237,7 +237,7 @@ public function getEnclosure() $enclosure = null; - $nodeList = $this->_xpath->query($this->getXpathPrefix() . '/atom:link[@rel="enclosure"]'); + $nodeList = $this->getXpath()->query($this->getXpathPrefix() . '/atom:link[@rel="enclosure"]'); if ($nodeList->length > 0) { $enclosure = new stdClass(); @@ -262,7 +262,7 @@ public function getId() return $this->_data['id']; } - $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:id)'); + $id = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:id)'); if (!$id) { if ($this->getPermalink()) { @@ -290,12 +290,12 @@ public function getBaseUrl() return $this->_data['baseUrl']; } - $baseUrl = $this->_xpath->evaluate('string(' + $baseUrl = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/@xml:base[1]' . ')'); if (!$baseUrl) { - $baseUrl = $this->_xpath->evaluate('string(//@xml:base[1])'); + $baseUrl = $this->getXpath()->evaluate('string(//@xml:base[1])'); } if (!$baseUrl) { @@ -339,7 +339,7 @@ public function getLinks() $links = array(); - $list = $this->_xpath->query( + $list = $this->getXpath()->query( $this->getXpathPrefix() . '//atom:link[@rel="alternate"]/@href' . '|' . $this->getXpathPrefix() . '//atom:link[not(@rel)]/@href' ); @@ -376,7 +376,7 @@ public function getTitle() return $this->_data['title']; } - $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:title)'); + $title = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:title)'); if (!$title) { $title = null; @@ -402,8 +402,8 @@ public function getCommentCount() $count = null; - $this->_xpath->registerNamespace('thread10', 'http://purl.org/syndication/thread/1.0'); - $list = $this->_xpath->query( + $this->getXpath()->registerNamespace('thread10', 'http://purl.org/syndication/thread/1.0'); + $list = $this->getXpath()->query( $this->getXpathPrefix() . '//atom:link[@rel="replies"]/@thread10:count' ); @@ -429,7 +429,7 @@ public function getCommentLink() $link = null; - $list = $this->_xpath->query( + $list = $this->getXpath()->query( $this->getXpathPrefix() . '//atom:link[@rel="replies" and @type="text/html"]/@href' ); @@ -456,7 +456,7 @@ public function getCommentFeedLink($type = 'atom') $link = null; - $list = $this->_xpath->query( + $list = $this->getXpath()->query( $this->getXpathPrefix() . '//atom:link[@rel="replies" and @type="application/'.$type.'+xml"]/@href' ); @@ -481,16 +481,16 @@ public function getCategories() return $this->_data['categories']; } - if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10) { - $list = $this->_xpath->query($this->getXpathPrefix() . '//atom:category'); + if ($this->_getAtomType() == Zend_Feed_Reader::TYPE_ATOM_10) { + $list = $this->getXpath()->query($this->getXpathPrefix() . '//atom:category'); } else { /** * Since Atom 0.3 did not support categories, it would have used the * Dublin Core extension. However there is a small possibility Atom 0.3 * may have been retrofittied to use Atom 1.0 instead. */ - $this->_xpath->registerNamespace('atom10', Zend_Feed_Reader::NAMESPACE_ATOM_10); - $list = $this->_xpath->query($this->getXpathPrefix() . '//atom10:category'); + $this->getXpath()->registerNamespace('atom10', Zend_Feed_Reader::NAMESPACE_ATOM_10); + $list = $this->getXpath()->query($this->getXpathPrefix() . '//atom10:category'); } if ($list->length) { @@ -523,8 +523,9 @@ public function getSource() } $source = null; + // TODO: Investigate why _getAtomType() fails here. Is it even needed? if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10) { - $list = $this->_xpath->query($this->getXpathPrefix() . '/atom:source[1]'); + $list = $this->getXpath()->query($this->getXpathPrefix() . '/atom:source[1]'); if ($list->length) { $element = $list->item(0); $source = new Zend_Feed_Reader_Feed_Atom_Source($element, $this->getXpathPrefix()); @@ -596,18 +597,12 @@ protected function _getAuthor(DOMElement $element) */ protected function _registerNamespaces() { - if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 - || $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03 - ) { - return; // pre-registered at Feed level - } - $atomDetected = $this->_getAtomType(); - switch ($atomDetected) { + switch ($this->_getAtomType()) { case Zend_Feed_Reader::TYPE_ATOM_03: - $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03); + $this->getXpath()->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03); break; default: - $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10); + $this->getXpath()->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10); break; } } @@ -617,17 +612,16 @@ protected function _registerNamespaces() */ protected function _getAtomType() { - $nslist = $this->getDomDocument()->documentElement->attributes; - if (!$nslist->length) { - return null; - } - foreach ($nslist as $ns) { - if ($ns->value == Zend_Feed_Reader::NAMESPACE_ATOM_10) { - return Zend_Feed_Reader::TYPE_ATOM_10; - } - if ($ns->value == Zend_Feed_Reader::NAMESPACE_ATOM_03) { - return Zend_Feed_Reader::TYPE_ATOM_03; - } + $dom = $this->getDomDocument(); + $prefixAtom03 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_03); + $prefixAtom10 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_10); + if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_10) + || !empty($prefixAtom10)) { + return Zend_Feed_Reader::TYPE_ATOM_10; + } + if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_03) + || !empty($prefixAtom03)) { + return Zend_Feed_Reader::TYPE_ATOM_03; } } } diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index a47dcea7..aa7c545c 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -541,17 +541,16 @@ protected function _registerNamespaces() */ protected function _getAtomType() { - $nslist = $this->getDomDocument()->documentElement->attributes; - if (!$nslist->length) { - return null; - } - foreach ($nslist as $ns) { - if ($ns->value == Zend_Feed_Reader::NAMESPACE_ATOM_10) { - return Zend_Feed_Reader::TYPE_ATOM_10; - } - if ($ns->value == Zend_Feed_Reader::NAMESPACE_ATOM_03) { - return Zend_Feed_Reader::TYPE_ATOM_03; - } + $dom = $this->getDomDocument(); + $prefixAtom03 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_03); + $prefixAtom10 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_10); + if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_10) + || !empty($prefixAtom10)) { + return Zend_Feed_Reader::TYPE_ATOM_10; + } + if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_03) + || !empty($prefixAtom03)) { + return Zend_Feed_Reader::TYPE_ATOM_03; } } } diff --git a/src/Reader/Extension/EntryAbstract.php b/src/Reader/Extension/EntryAbstract.php index 11ef1b60..03534fb8 100644 --- a/src/Reader/Extension/EntryAbstract.php +++ b/src/Reader/Extension/EntryAbstract.php @@ -86,7 +86,7 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) if (!is_null($type)) { $this->_data['type'] = $type; } else { - $this->_data['type'] = Zend_Feed_Reader::detectType($feed); + $this->_data['type'] = Zend_Feed_Reader::detectType($entry->ownerDocument, true); } // set the XPath query prefix for the entry being queried if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_10 @@ -153,6 +153,9 @@ public function setXpath(DOMXPath $xpath) */ public function getXpath() { + if (!$this->_xpath) { + $this->setXpath(new DOMXPath($this->getDomDocument())); + } return $this->_xpath; } diff --git a/test/AllTests.php b/test/AllTests.php index 8fe1569e..73195cfa 100644 --- a/test/AllTests.php +++ b/test/AllTests.php @@ -54,6 +54,7 @@ require_once 'Zend/Feed/Reader/Entry/CommonTest.php'; require_once 'Zend/Feed/Reader/Feed/AtomSourceTest.php'; +require_once 'Zend/Feed/Reader/Entry/AtomStandaloneEntryTest.php'; require_once 'Zend/Feed/Reader/Integration/WordpressRss2DcAtomTest.php'; require_once 'Zend/Feed/Reader/Integration/WordpressAtom10Test.php'; @@ -105,6 +106,8 @@ public static function suite() $suite->addTestSuite('Zend_Feed_Reader_Entry_CommonTest'); // ATOM - Entry Level (Source Feed Metadata) $suite->addTestSuite('Zend_Feed_Reader_Feed_AtomSourceTest'); + // ATOM - Entry Level (Standalone Entry Documents) + $suite->addTestSuite('Zend_Feed_Reader_Entry_AtomStandaloneEntryTest'); /** * Real World Feed Tests */ diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index 820c54a5..a0e19203 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -43,6 +43,7 @@ class Zend_Feed_Reader_Entry_AtomTest extends PHPUnit_Framework_TestCase public function setup() { + Zend_Feed_Reader::reset(); if (Zend_Registry::isRegistered('Zend_Locale')) { $registry = Zend_Registry::getInstance(); unset($registry['Zend_Locale']); @@ -93,6 +94,7 @@ public function teardown() /** * Get Id (Unencoded Text) + * @group ZFR003 */ public function testGetsIdFromAtom03() { diff --git a/test/Reader/Entry/CommonTest.php b/test/Reader/Entry/CommonTest.php index ef39e53f..a23448e0 100644 --- a/test/Reader/Entry/CommonTest.php +++ b/test/Reader/Entry/CommonTest.php @@ -39,6 +39,7 @@ class Zend_Feed_Reader_Entry_CommonTest extends PHPUnit_Framework_TestCase public function setup() { + Zend_Feed_Reader::reset(); if (Zend_Registry::isRegistered('Zend_Locale')) { $registry = Zend_Registry::getInstance(); unset($registry['Zend_Locale']); diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index c22389c2..570c27fa 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -45,6 +45,7 @@ class Zend_Feed_Reader_Entry_RssTest extends PHPUnit_Framework_TestCase public function setup() { + Zend_Feed_Reader::reset(); if (Zend_Registry::isRegistered('Zend_Locale')) { $registry = Zend_Registry::getInstance(); unset($registry['Zend_Locale']); diff --git a/test/Reader/Entry/_files/Atom/id/plain/atom03.xml b/test/Reader/Entry/_files/Atom/id/plain/atom03.xml index 4382b535..a05d311c 100644 --- a/test/Reader/Entry/_files/Atom/id/plain/atom03.xml +++ b/test/Reader/Entry/_files/Atom/id/plain/atom03.xml @@ -3,4 +3,4 @@ 1 - \ No newline at end of file + diff --git a/test/Reader/Feed/AtomSourceTest.php b/test/Reader/Feed/AtomSourceTest.php index b7d61fe1..67a2c46a 100644 --- a/test/Reader/Feed/AtomSourceTest.php +++ b/test/Reader/Feed/AtomSourceTest.php @@ -45,6 +45,7 @@ class Zend_Feed_Reader_Feed_AtomSourceTest extends PHPUnit_Framework_TestCase public function setup() { + Zend_Feed_Reader::reset(); if (Zend_Registry::isRegistered('Zend_Locale')) { $registry = Zend_Registry::getInstance(); unset($registry['Zend_Locale']); diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 82b57970..54dea9f4 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -45,6 +45,7 @@ class Zend_Feed_Reader_Feed_AtomTest extends PHPUnit_Framework_TestCase public function setup() { + Zend_Feed_Reader::reset(); if (Zend_Registry::isRegistered('Zend_Locale')) { $registry = Zend_Registry::getInstance(); unset($registry['Zend_Locale']); diff --git a/test/Reader/Feed/CommonTest.php b/test/Reader/Feed/CommonTest.php index a7567577..c41de33e 100644 --- a/test/Reader/Feed/CommonTest.php +++ b/test/Reader/Feed/CommonTest.php @@ -40,6 +40,7 @@ class Zend_Feed_Reader_Feed_CommonTest extends PHPUnit_Framework_TestCase public function setup() { + Zend_Feed_Reader::reset(); if (Zend_Registry::isRegistered('Zend_Locale')) { $registry = Zend_Registry::getInstance(); unset($registry['Zend_Locale']); diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index 8cfa1b64..573c8d0e 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -46,6 +46,7 @@ class Zend_Feed_Reader_Feed_RssTest extends PHPUnit_Framework_TestCase public function setup() { + Zend_Feed_Reader::reset(); if (Zend_Registry::isRegistered('Zend_Locale')) { $registry = Zend_Registry::getInstance(); unset($registry['Zend_Locale']); diff --git a/test/Reader/Integration/H-OnlineComAtom10Test.php b/test/Reader/Integration/H-OnlineComAtom10Test.php index c6e0d118..7ef6fdf2 100644 --- a/test/Reader/Integration/H-OnlineComAtom10Test.php +++ b/test/Reader/Integration/H-OnlineComAtom10Test.php @@ -39,6 +39,7 @@ class Zend_Feed_Reader_Integration_HOnlineComAtom10Test extends PHPUnit_Framewor public function setup() { + Zend_Feed_Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/h-online.com-atom10.xml'; $this->_options = Zend_Date::setOptions(); foreach($this->_options as $k=>$v) { diff --git a/test/Reader/Integration/LautDeRdfTest.php b/test/Reader/Integration/LautDeRdfTest.php index cdf513f4..084e013b 100644 --- a/test/Reader/Integration/LautDeRdfTest.php +++ b/test/Reader/Integration/LautDeRdfTest.php @@ -39,6 +39,7 @@ class Zend_Feed_Reader_Integration_LautDeRdfTest extends PHPUnit_Framework_TestC public function setup() { + Zend_Feed_Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/laut.de-rdf.xml'; $this->_options = Zend_Date::setOptions(); foreach($this->_options as $k=>$v) { diff --git a/test/Reader/Integration/PodcastRss2Test.php b/test/Reader/Integration/PodcastRss2Test.php index cd600cbf..10ae989e 100644 --- a/test/Reader/Integration/PodcastRss2Test.php +++ b/test/Reader/Integration/PodcastRss2Test.php @@ -40,6 +40,7 @@ class Zend_Feed_Reader_Integration_PodcastRss2Test extends PHPUnit_Framework_Tes public function setup() { + Zend_Feed_Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/podcast.xml'; $this->_options = Zend_Date::setOptions(); foreach($this->_options as $k=>$v) { diff --git a/test/Reader/Integration/WordpressAtom10Test.php b/test/Reader/Integration/WordpressAtom10Test.php index 957edea0..f5581009 100644 --- a/test/Reader/Integration/WordpressAtom10Test.php +++ b/test/Reader/Integration/WordpressAtom10Test.php @@ -39,6 +39,7 @@ class Zend_Feed_Reader_Integration_WordpressAtom10Test extends PHPUnit_Framework public function setup() { + Zend_Feed_Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/wordpress-atom10.xml'; $this->_options = Zend_Date::setOptions(); foreach($this->_options as $k=>$v) { diff --git a/test/Reader/Integration/WordpressRss2DcAtomTest.php b/test/Reader/Integration/WordpressRss2DcAtomTest.php index 5126fa0a..4eeeaaac 100644 --- a/test/Reader/Integration/WordpressRss2DcAtomTest.php +++ b/test/Reader/Integration/WordpressRss2DcAtomTest.php @@ -39,6 +39,7 @@ class Zend_Feed_Reader_Integration_WordpressRss2DcAtomTest extends PHPUnit_Frame public function setup() { + Zend_Feed_Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/wordpress-rss2-dc-atom.xml'; } From cf2da28839eca735dd8c2a89f5a0c73b217fb451 Mon Sep 17 00:00:00 2001 From: padraic Date: Sun, 29 Nov 2009 18:10:14 +0000 Subject: [PATCH 073/238] Zend_Feed_Reader: Switch order of Atom detection to try Atom 0.3 first - allows for cases where Atom 1.0 is an extension but not the actual feed type. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19292 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Extension/Atom/Entry.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index b50d55ee..53653e5d 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -615,13 +615,13 @@ protected function _getAtomType() $dom = $this->getDomDocument(); $prefixAtom03 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_03); $prefixAtom10 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_10); - if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_10) - || !empty($prefixAtom10)) { - return Zend_Feed_Reader::TYPE_ATOM_10; - } if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_03) || !empty($prefixAtom03)) { return Zend_Feed_Reader::TYPE_ATOM_03; } + if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_10) + || !empty($prefixAtom10)) { + return Zend_Feed_Reader::TYPE_ATOM_10; + } } } From 7321baf0db9ab646453aae798d2db20e459bc4ca Mon Sep 17 00:00:00 2001 From: padraic Date: Sun, 29 Nov 2009 19:35:03 +0000 Subject: [PATCH 074/238] Zend_Feed_Reader: Addition of missing Atom Standalone Entry tests - well, doh! git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19293 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Reader/Entry/AtomStandaloneEntryTest.php | 267 ++++++++++++++++++ .../AtomStandaloneEntry/author/atom10.xml | 43 +++ .../AtomStandaloneEntry/category/atom10.xml | 6 + .../commentlink/atom10.xml | 4 + .../AtomStandaloneEntry/content/atom10.xml | 4 + .../datecreated/atom10.xml | 4 + .../datemodified/atom10.xml | 4 + .../description/atom10.xml | 4 + .../AtomStandaloneEntry/enclosure/atom10.xml | 4 + .../_files/AtomStandaloneEntry/id/atom10.xml | 4 + .../AtomStandaloneEntry/link/atom10.xml | 4 + .../AtomStandaloneEntry/links/atom10.xml | 5 + .../AtomStandaloneEntry/title/atom10.xml | 4 + 13 files changed, 357 insertions(+) create mode 100644 test/Reader/Entry/AtomStandaloneEntryTest.php create mode 100644 test/Reader/Entry/_files/AtomStandaloneEntry/author/atom10.xml create mode 100644 test/Reader/Entry/_files/AtomStandaloneEntry/category/atom10.xml create mode 100644 test/Reader/Entry/_files/AtomStandaloneEntry/commentlink/atom10.xml create mode 100644 test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10.xml create mode 100644 test/Reader/Entry/_files/AtomStandaloneEntry/datecreated/atom10.xml create mode 100644 test/Reader/Entry/_files/AtomStandaloneEntry/datemodified/atom10.xml create mode 100644 test/Reader/Entry/_files/AtomStandaloneEntry/description/atom10.xml create mode 100644 test/Reader/Entry/_files/AtomStandaloneEntry/enclosure/atom10.xml create mode 100644 test/Reader/Entry/_files/AtomStandaloneEntry/id/atom10.xml create mode 100644 test/Reader/Entry/_files/AtomStandaloneEntry/link/atom10.xml create mode 100644 test/Reader/Entry/_files/AtomStandaloneEntry/links/atom10.xml create mode 100644 test/Reader/Entry/_files/AtomStandaloneEntry/title/atom10.xml diff --git a/test/Reader/Entry/AtomStandaloneEntryTest.php b/test/Reader/Entry/AtomStandaloneEntryTest.php new file mode 100644 index 00000000..7dc340da --- /dev/null +++ b/test/Reader/Entry/AtomStandaloneEntryTest.php @@ -0,0 +1,267 @@ +_feedSamplePath = dirname(__FILE__) . '/_files/AtomStandaloneEntry'; + $this->_options = Zend_Date::setOptions(); + foreach($this->_options as $k=>$v) { + if (is_null($v)) { + unset($this->_options[$k]); + } + } + Zend_Date::setOptions(array('format_type'=>'iso')); + $this->_expectedCats = array( + array( + 'term' => 'topic1', + 'scheme' => 'http://example.com/schema1', + 'label' => 'topic1' + ), + array( + 'term' => 'topic1', + 'scheme' => 'http://example.com/schema2', + 'label' => 'topic1' + ), + array( + 'term' => 'cat_dog', + 'scheme' => 'http://example.com/schema1', + 'label' => 'Cat & Dog' + ) + ); + $this->_expectedCatsDc = array( + array( + 'term' => 'topic1', + 'scheme' => null, + 'label' => 'topic1' + ), + array( + 'term' => 'topic2', + 'scheme' => null, + 'label' => 'topic2' + ) + ); + } + + public function teardown() + { + Zend_Date::setOptions($this->_options); + } + + public function testReaderImportOfAtomEntryDocumentReturnsEntryClass() + { + $object = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/id/atom10.xml') + ); + $this->assertTrue($object instanceof Zend_Feed_Reader_Entry_Atom); + } + + /** + * Get Id (Unencoded Text) + * @group ZFR002 + */ + public function testGetsIdFromAtom10() + { + $entry = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/id/atom10.xml') + ); + $this->assertEquals('1', $entry->getId()); + } + + /** + * Get creation date (Unencoded Text) + * @group ZFR002 + */ + public function testGetsDateCreatedFromAtom10() + { + $entry = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/datecreated/atom10.xml') + ); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateCreated())); + } + + /** + * Get modification date (Unencoded Text) + * @group ZFR002 + */ + public function testGetsDateModifiedFromAtom10() + { + $entry = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/datemodified/atom10.xml') + ); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($entry->getDateModified())); + } + + /** + * Get Title (Unencoded Text) + * @group ZFR002 + */ + public function testGetsTitleFromAtom10() + { + $entry = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/title/atom10.xml') + ); + $this->assertEquals('Entry Title', $entry->getTitle()); + } + + /** + * Get Authors (Unencoded Text) + * @group ZFR002 + */ + public function testGetsAuthorsFromAtom10() + { + $entry = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/author/atom10.xml') + ); + + $authors = array( + 0 => 'joe@example.com (Joe Bloggs)', + 1 => 'Joe Bloggs', + 3 => 'joe@example.com', + 4 => 'http://www.example.com', + 6 => 'jane@example.com (Jane Bloggs)' + ); + + $this->assertEquals($authors, $entry->getAuthors()); + } + + /** + * Get Author (Unencoded Text) + * @group ZFR002 + */ + public function testGetsAuthorFromAtom10() + { + $entry = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/author/atom10.xml') + ); + $this->assertEquals('joe@example.com (Joe Bloggs)', $entry->getAuthor()); + } + + /** + * Get Description (Unencoded Text) + * @group ZFR002 + */ + public function testGetsDescriptionFromAtom10() + { + $entry = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/description/atom10.xml') + ); + $this->assertEquals('Entry Description', $entry->getDescription()); + } + + /** + * Get enclosure + * @group ZFR002 + */ + public function testGetsEnclosureFromAtom10() + { + $entry = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/enclosure/atom10.xml') + ); + + $expected = new stdClass(); + $expected->url = 'http://www.example.org/myaudiofile.mp3'; + $expected->length = '1234'; + $expected->type = 'audio/mpeg'; + + $this->assertEquals($expected, $entry->getEnclosure()); + } + + /** + * Get Content (Unencoded Text) + * @group ZFR002 + */ + public function testGetsContentFromAtom10() + { + $entry = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/content/atom10.xml') + ); + $this->assertEquals('Entry Content', $entry->getContent()); + } + + /** + * Get Link (Unencoded Text) + * @group ZFR002 + */ + public function testGetsLinkFromAtom10() + { + $entry = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/link/atom10.xml') + ); + $this->assertEquals('http://www.example.com/entry', $entry->getLink()); + } + + /** + * Get Comment HTML Link + * @group ZFR002 + */ + public function testGetsCommentLinkFromAtom10() + { + $entry = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/commentlink/atom10.xml') + ); + $this->assertEquals('http://www.example.com/entry/comments', $entry->getCommentLink()); + } + + /** + * Get category data + * @group ZFR002 + */ + public function testGetsCategoriesFromAtom10() + { + $entry = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/category/atom10.xml') + ); + $this->assertEquals($this->_expectedCats, (array) $entry->getCategories()); + $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); + } + +} diff --git a/test/Reader/Entry/_files/AtomStandaloneEntry/author/atom10.xml b/test/Reader/Entry/_files/AtomStandaloneEntry/author/atom10.xml new file mode 100644 index 00000000..7dc13988 --- /dev/null +++ b/test/Reader/Entry/_files/AtomStandaloneEntry/author/atom10.xml @@ -0,0 +1,43 @@ + + + + Joe Bloggs + http://www.example.com + joe@example.com + + + Joe Bloggs + http://www.example.com + + + + Joe Bloggs + + + + + + http://www.example.com + joe@example.com + + + + http://www.example.com + + + + + + joe@example.com + + + + + + + + Jane Bloggs + http://www.example.com + jane@example.com + + diff --git a/test/Reader/Entry/_files/AtomStandaloneEntry/category/atom10.xml b/test/Reader/Entry/_files/AtomStandaloneEntry/category/atom10.xml new file mode 100644 index 00000000..93493a43 --- /dev/null +++ b/test/Reader/Entry/_files/AtomStandaloneEntry/category/atom10.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/Reader/Entry/_files/AtomStandaloneEntry/commentlink/atom10.xml b/test/Reader/Entry/_files/AtomStandaloneEntry/commentlink/atom10.xml new file mode 100644 index 00000000..7074557f --- /dev/null +++ b/test/Reader/Entry/_files/AtomStandaloneEntry/commentlink/atom10.xml @@ -0,0 +1,4 @@ + + + + diff --git a/test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10.xml b/test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10.xml new file mode 100644 index 00000000..6bc2c678 --- /dev/null +++ b/test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10.xml @@ -0,0 +1,4 @@ + + + Entry Content + diff --git a/test/Reader/Entry/_files/AtomStandaloneEntry/datecreated/atom10.xml b/test/Reader/Entry/_files/AtomStandaloneEntry/datecreated/atom10.xml new file mode 100644 index 00000000..062c253b --- /dev/null +++ b/test/Reader/Entry/_files/AtomStandaloneEntry/datecreated/atom10.xml @@ -0,0 +1,4 @@ + + + 2009-03-07T08:03:50Z + diff --git a/test/Reader/Entry/_files/AtomStandaloneEntry/datemodified/atom10.xml b/test/Reader/Entry/_files/AtomStandaloneEntry/datemodified/atom10.xml new file mode 100644 index 00000000..a0525905 --- /dev/null +++ b/test/Reader/Entry/_files/AtomStandaloneEntry/datemodified/atom10.xml @@ -0,0 +1,4 @@ + + + 2009-03-07T08:03:50Z + diff --git a/test/Reader/Entry/_files/AtomStandaloneEntry/description/atom10.xml b/test/Reader/Entry/_files/AtomStandaloneEntry/description/atom10.xml new file mode 100644 index 00000000..a8e0d5f9 --- /dev/null +++ b/test/Reader/Entry/_files/AtomStandaloneEntry/description/atom10.xml @@ -0,0 +1,4 @@ + + + Entry Description + diff --git a/test/Reader/Entry/_files/AtomStandaloneEntry/enclosure/atom10.xml b/test/Reader/Entry/_files/AtomStandaloneEntry/enclosure/atom10.xml new file mode 100644 index 00000000..c37b0bfa --- /dev/null +++ b/test/Reader/Entry/_files/AtomStandaloneEntry/enclosure/atom10.xml @@ -0,0 +1,4 @@ + + + + diff --git a/test/Reader/Entry/_files/AtomStandaloneEntry/id/atom10.xml b/test/Reader/Entry/_files/AtomStandaloneEntry/id/atom10.xml new file mode 100644 index 00000000..5310e48c --- /dev/null +++ b/test/Reader/Entry/_files/AtomStandaloneEntry/id/atom10.xml @@ -0,0 +1,4 @@ + + + 1 + diff --git a/test/Reader/Entry/_files/AtomStandaloneEntry/link/atom10.xml b/test/Reader/Entry/_files/AtomStandaloneEntry/link/atom10.xml new file mode 100644 index 00000000..0445b029 --- /dev/null +++ b/test/Reader/Entry/_files/AtomStandaloneEntry/link/atom10.xml @@ -0,0 +1,4 @@ + + + + diff --git a/test/Reader/Entry/_files/AtomStandaloneEntry/links/atom10.xml b/test/Reader/Entry/_files/AtomStandaloneEntry/links/atom10.xml new file mode 100644 index 00000000..c9d22da1 --- /dev/null +++ b/test/Reader/Entry/_files/AtomStandaloneEntry/links/atom10.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/test/Reader/Entry/_files/AtomStandaloneEntry/title/atom10.xml b/test/Reader/Entry/_files/AtomStandaloneEntry/title/atom10.xml new file mode 100644 index 00000000..f1e2c134 --- /dev/null +++ b/test/Reader/Entry/_files/AtomStandaloneEntry/title/atom10.xml @@ -0,0 +1,4 @@ + + + Entry Title + From e913392600813fc9a776c9a520e1afb18c87ca45 Mon Sep 17 00:00:00 2001 From: bkarwin Date: Fri, 11 Dec 2009 21:16:39 +0000 Subject: [PATCH 075/238] improve consistent use of TestHelper, code covering filtering, and @group tags git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19582 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/AllTests.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/test/AllTests.php b/test/AllTests.php index 73195cfa..412c01c2 100644 --- a/test/AllTests.php +++ b/test/AllTests.php @@ -20,22 +20,12 @@ * @version $Id$ */ +require_once dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; if (!defined('PHPUnit_MAIN_METHOD')) { define('PHPUnit_MAIN_METHOD', 'Zend_Feed_AllTests::main'); } -/** - * Test helper - */ -require_once dirname(__FILE__) . '/../../TestHelper.php'; - -/** - * Exclude from code coverage report - */ -PHPUnit_Util_Filter::addFileToFilter(__FILE__); - - require_once 'Zend/Feed/ArrayAccessTest.php'; require_once 'Zend/Feed/AtomEntryOnlyTest.php'; require_once 'Zend/Feed/AtomPublishingTest.php'; From b0e0b3d86c121c0e5e600b476d255cd416762860 Mon Sep 17 00:00:00 2001 From: matthew Date: Tue, 15 Dec 2009 18:03:07 +0000 Subject: [PATCH 076/238] ZF-8547: Merge Zend_Exception previous exception support to trunk git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19661 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Entry/Rss.php | 3 ++- src/Reader/Feed/Rss.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index 83dc9d6d..fcef05aa 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -273,7 +273,8 @@ public function getDateModified() throw new Zend_Feed_Exception( 'Could not load date due to unrecognised' .' format (should follow RFC 822 or 2822):' - . $e->getMessage() + . $e->getMessage(), + 0, $e ); } } diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index f5b2adf3..7715506a 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -213,7 +213,8 @@ public function getDateModified() throw new Zend_Feed_Exception( 'Could not load date due to unrecognised' .' format (should follow RFC 822 or 2822):' - . $e->getMessage() + . $e->getMessage(), + 0, $e ); } } From 480a52f5333e5c1cbec83248b5fb3b624b00f397 Mon Sep 17 00:00:00 2001 From: padraic Date: Thu, 17 Dec 2009 21:14:28 +0000 Subject: [PATCH 077/238] Zend_Feed_Reader: Updated all (every last one!) get/setAuthor(s) methods to reflect a more detailed data collection including names, emails and urls. This breaks compatibility with prior mini releases - restoration of the original result format will be detailed in 1.10 migration guide. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19725 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader.php | 20 ++ src/Reader/Collection/Author.php | 51 +++++ src/Reader/Entry/Rss.php | 63 +++--- src/Reader/Extension/Atom/Entry.php | 64 +++--- src/Reader/Extension/Atom/Feed.php | 66 +++--- src/Reader/Extension/DublinCore/Entry.php | 17 +- src/Reader/Extension/DublinCore/Feed.php | 24 ++- src/Reader/Feed/Atom.php | 4 +- src/Reader/Feed/Rss.php | 60 ++++-- test/Reader/Entry/AtomStandaloneEntryTest.php | 15 +- test/Reader/Entry/AtomTest.php | 30 +-- test/Reader/Entry/RssTest.php | 132 ++++++++---- test/Reader/Feed/AtomSourceTest.php | 15 +- test/Reader/Feed/AtomTest.php | 30 +-- test/Reader/Feed/RssTest.php | 189 +++++++++++++----- .../Feed/_files/Rss/author/plain/rss090.xml | 6 +- .../Feed/_files/Rss/author/plain/rss091.xml | 6 +- .../Feed/_files/Rss/author/plain/rss092.xml | 6 +- .../Feed/_files/Rss/author/plain/rss093.xml | 6 +- .../Feed/_files/Rss/author/plain/rss094.xml | 6 +- .../Feed/_files/Rss/author/plain/rss10.xml | 6 +- .../Feed/_files/Rss/author/plain/rss20.xml | 6 +- .../Integration/H-OnlineComAtom10Test.php | 8 +- test/Reader/Integration/LautDeRdfTest.php | 8 +- .../Integration/WordpressAtom10Test.php | 10 +- .../Integration/WordpressRss2DcAtomTest.php | 10 +- 26 files changed, 549 insertions(+), 309 deletions(-) create mode 100644 src/Reader/Collection/Author.php diff --git a/src/Reader.php b/src/Reader.php index 9eae8791..b7dbc21e 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -696,4 +696,24 @@ protected static function _registerCoreExtensions() self::registerExtension('Thread'); self::registerExtension('Podcast'); } + + /** + * Utility method to apply array_unique operation to a multidimensional + * array. + * + * @param array + * @return array + */ + public static function arrayUnique(array $array) + { + foreach ($array as &$value) { + $value = serialize($value); + } + $array = array_unique($array); + foreach ($array as &$value) { + $value = unserialize($value); + } + return $array; + } + } diff --git a/src/Reader/Collection/Author.php b/src/Reader/Collection/Author.php new file mode 100644 index 00000000..86ddb1dd --- /dev/null +++ b/src/Reader/Collection/Author.php @@ -0,0 +1,51 @@ +getIterator() as $element) { + $authors[] = $element['name']; + } + return array_unique($authors); + } + +} diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index fcef05aa..7fe0fd01 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -159,45 +159,50 @@ public function getAuthors() if (array_key_exists('authors', $this->_data)) { return $this->_data['authors']; } - + $authors = array(); - // @todo: create a list from all potential sources rather than from alternatives - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $list = $this->_xpath->evaluate($this->_xpathQueryRss.'//author'); - } else { - $list = $this->_xpath->evaluate($this->_xpathQueryRdf.'//rss:author'); - } - if (!$list->length) { - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $list = $this->_xpath->query('//author'); - } else { - $list = $this->_xpath->query('//rss:author'); + $authors_dc = $this->getExtension('DublinCore')->getAuthors(); + if (!empty($authors_dc)) { + foreach ($authors_dc as $author) { + $authors[] = array( + 'name' => $author['name'] + ); } } - + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 + && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $list = $this->_xpath->query($this->_xpathQueryRss . '//author'); + } else { + $list = $this->_xpath->query($this->_xpathQueryRdf . '//rss:author'); + } if ($list->length) { foreach ($list as $author) { - if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_20 - && preg_match("/\(([^\)]+)\)/", $author->nodeValue, $matches, PREG_OFFSET_CAPTURE) - ) { - // source name from RSS 2.0 - // format "joe@example.com (Joe Bloggs)" - $authors[] = $matches[1][0]; - } else { - $authors[] = $author->nodeValue; - } + $string = trim($author->nodeValue); + $email = null; + $name = null; + $data = array(); + // Pretty rough parsing - but it's a catchall + if (preg_match("/^.*@[^ ]*/", $string, $matches)) { + $data['email'] = trim($matches[0]); + if (preg_match("/\((.*)\)$/", $string, $matches)) { + $data['name'] = $matches[1]; + } + $authors[] = $data; + } } - - $authors = array_unique($authors); } - if (empty($authors)) { - $authors = $this->getExtension('DublinCore')->getAuthors(); + if (count($authors) == 0) { + $authors = $this->getExtension('Atom')->getAuthors(); + } else { + $authors = new Zend_Feed_Reader_Collection_Author( + Zend_Feed_Reader::arrayUnique($authors) + ); } - if (empty($authors)) { - $authors = $this->getExtension('Atom')->getAuthors(); + if (count($authors) == 0) { + $authors = null; } $this->_data['authors'] = $authors; diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 53653e5d..cc97d092 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -86,33 +86,34 @@ public function getAuthors() return $this->_data['authors']; } - $authors = $this->getXpath()->query( - $this->getXpathPrefix() . '//atom:author' . '|' - . $this->getXpathPrefix(). '//atom:contributor' - ); + $authors = array(); + $list = $this->getXpath()->query($this->getXpathPrefix() . '//atom:author'); - if (!$authors->length) { - $authors = $this->getXpath()->query( - '//atom:author' . '|' . '//atom:contributor' - ); + if (!$list->length) { + /** + * TODO: Limit query to feed level els only! + */ + $list = $this->getXpath()->query('//atom:author'); } - $people = array(); - - if ($authors->length) { - foreach ($authors as $author) { + if ($list->length) { + foreach ($list as $author) { $author = $this->_getAuthor($author); - if (!empty($author)) { - $people[] = $author; + $authors[] = $author; } } } - $people = array_unique($people); - - $this->_data['authors'] = $people; + if (count($authors) == 0) { + $authors = null; + } else { + $authors = new Zend_Feed_Reader_Collection_Author( + Zend_Feed_Reader::arrayUnique($authors) + ); + } + $this->_data['authors'] = $authors; return $this->_data['authors']; } @@ -561,35 +562,28 @@ protected function _absolutiseUri($link) */ protected function _getAuthor(DOMElement $element) { - $email = null; - $name = null; - $uri = null; + $author = array(); $emailNode = $element->getElementsByTagName('email'); $nameNode = $element->getElementsByTagName('name'); $uriNode = $element->getElementsByTagName('uri'); - - if ($emailNode->length) { - $email = $emailNode->item(0)->nodeValue; + + if ($emailNode->length && strlen($emailNode->item(0)->nodeValue) > 0) { + $author['email'] = $emailNode->item(0)->nodeValue; } - if ($nameNode->length) { - $name = $nameNode->item(0)->nodeValue; + if ($nameNode->length && strlen($nameNode->item(0)->nodeValue) > 0) { + $author['name'] = $nameNode->item(0)->nodeValue; } - if ($uriNode->length) { - $uri = $uriNode->item(0)->nodeValue; + if ($uriNode->length && strlen($uriNode->item(0)->nodeValue) > 0) { + $author['uri'] = $uriNode->item(0)->nodeValue; } - if (!empty($email)) { - return $email . (empty($name) ? '' : ' (' . $name . ')'); - } else if (!empty($name)) { - return $name; - } else if (!empty($uri)) { - return $uri; + if (empty($author)) { + return null; } - - return null; + return $author; } /** diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index aa7c545c..9c0f5b30 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -34,6 +34,11 @@ */ require_once 'Zend/Uri.php'; +/** + * @see Zend_Feed_Reader_Collection_Author + */ +require_once 'Zend/Feed/Reader/Collection/Author.php'; + /** * @category Zend * @package Zend_Feed_Reader @@ -71,38 +76,28 @@ public function getAuthors() return $this->_data['authors']; } - $authors = $this->_xpath->query('//atom:author'); - $contributors = $this->_xpath->query('//atom:contributor'); + $list = $this->_xpath->query('//atom:author'); - $people = array(); + $authors = array(); - if ($authors->length) { - foreach ($authors as $author) { + if ($list->length) { + foreach ($list as $author) { $author = $this->_getAuthor($author); - if (!empty($author)) { - $people[] = $author; - } - } - } - - if ($contributors->length) { - foreach ($contributors as $contributor) { - $contributor = $this->_getAuthor($contributor); - - if (!empty($contributor)) { - $people[] = $contributor; + $authors[] = $author; } } } - if (empty($people)) { - $people = null; + if (count($authors) == 0) { + $authors = null; } else { - $people = array_unique($people); + $authors = new Zend_Feed_Reader_Collection_Author( + Zend_Feed_Reader::arrayUnique($authors) + ); } - $this->_data['authors'] = $people; + $this->_data['authors'] = $authors; return $this->_data['authors']; } @@ -467,35 +462,28 @@ public function getCategories() */ protected function _getAuthor(DOMElement $element) { - $email = null; - $name = null; - $uri = null; + $author = array(); $emailNode = $element->getElementsByTagName('email'); $nameNode = $element->getElementsByTagName('name'); $uriNode = $element->getElementsByTagName('uri'); - - if ($emailNode->length) { - $email = $emailNode->item(0)->nodeValue; + + if ($emailNode->length && strlen($emailNode->item(0)->nodeValue) > 0) { + $author['email'] = $emailNode->item(0)->nodeValue; } - if ($nameNode->length) { - $name = $nameNode->item(0)->nodeValue; + if ($nameNode->length && strlen($nameNode->item(0)->nodeValue) > 0) { + $author['name'] = $nameNode->item(0)->nodeValue; } - if ($uriNode->length) { - $uri = $uriNode->item(0)->nodeValue; + if ($uriNode->length && strlen($uriNode->item(0)->nodeValue) > 0) { + $author['uri'] = $uriNode->item(0)->nodeValue; } - if (!empty($email)) { - return $email . (empty($name) ? '' : ' (' . $name . ')'); - } else if (!empty($name)) { - return $name; - } else if (!empty($uri)) { - return $uri; + if (empty($author)) { + return null; } - - return null; + return $author; } /** diff --git a/src/Reader/Extension/DublinCore/Entry.php b/src/Reader/Extension/DublinCore/Entry.php index 2356bb77..2adcf340 100644 --- a/src/Reader/Extension/DublinCore/Entry.php +++ b/src/Reader/Extension/DublinCore/Entry.php @@ -87,16 +87,15 @@ public function getAuthors() if ($list->length) { foreach ($list as $author) { - if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_20 - && preg_match("/\(([^\)]+)\)/", $author->nodeValue, $matches, PREG_OFFSET_CAPTURE) - ) { - $authors[] = $matches[1][0]; - } else { - $authors[] = $author->nodeValue; - } + $authors[] = array( + 'name' => $author->nodeValue + ); } - - $authors = array_unique($authors); + $authors = new Zend_Feed_Reader_Collection_Author( + Zend_Feed_Reader::arrayUnique($authors) + ); + } else { + $authors = null; } $this->_data['authors'] = $authors; diff --git a/src/Reader/Extension/DublinCore/Feed.php b/src/Reader/Extension/DublinCore/Feed.php index e4329866..5ea699d8 100644 --- a/src/Reader/Extension/DublinCore/Feed.php +++ b/src/Reader/Extension/DublinCore/Feed.php @@ -29,6 +29,11 @@ */ require_once 'Zend/Date.php'; +/** + * @see Zend_Feed_Reader_Collection_Author + */ +require_once 'Zend/Feed/Reader/Collection/Author.php'; + /** * @category Zend * @package Zend_Feed_Reader @@ -79,13 +84,18 @@ public function getAuthors() $list = $this->_xpath->query('//dc10:publisher'); } } - - foreach ($list as $authorObj) { - $authors[] = $authorObj->nodeValue; - } - - if (!empty($authors)) { - $authors = array_unique($authors); + + if ($list->length) { + foreach ($list as $author) { + $authors[] = array( + 'name' => $author->nodeValue + ); + } + $authors = new Zend_Feed_Reader_Collection_Author( + Zend_Feed_Reader::arrayUnique($authors) + ); + } else { + $authors = null; } $this->_data['authors'] = $authors; diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index 008c3f75..354b1472 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -84,9 +84,9 @@ public function getAuthors() return $this->_data['authors']; } - $people = $this->getExtension('Atom')->getAuthors(); + $authors = $this->getExtension('Atom')->getAuthors(); - $this->_data['authors'] = $people; + $this->_data['authors'] = $authors; return $this->_data['authors']; } diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 7715506a..da7eb330 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -39,6 +39,11 @@ */ require_once 'Zend/Date.php'; +/** + * @see Zend_Feed_Reader_Collection_Author + */ +require_once 'Zend/Feed/Reader/Collection/Author.php'; + /** * @category Zend * @package Zend_Feed_Reader @@ -100,33 +105,54 @@ public function getAuthors() if (array_key_exists('authors', $this->_data)) { return $this->_data['authors']; } - + $authors = array(); - - if (empty($authors)) { - $authors = $this->getExtension('DublinCore')->getAuthors(); - } - - if (empty($authors)) { - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $list = $this->_xpath->query('//author'); - } else { - $list = $this->_xpath->query('//rss:author'); + $authors_dc = $this->getExtension('DublinCore')->getAuthors(); + if (!empty($authors_dc)) { + foreach ($authors_dc as $author) { + $authors[] = array( + 'name' => $author['name'] + ); } + } - foreach ($list as $authorObj) { - $authors[] = $authorObj->nodeValue; + /** + * Technically RSS doesn't specific author element use at the feed level + * but it's supported on a "just in case" basis. + */ + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 + && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $list = $this->_xpath->query('//author'); + } else { + $list = $this->_xpath->query('//rss:author'); + } + if ($list->length) { + foreach ($list as $author) { + $string = trim($author->nodeValue); + $email = null; + $name = null; + $data = array(); + // Pretty rough parsing - but it's a catchall + if (preg_match("/^.*@[^ ]*/", $string, $matches)) { + $data['email'] = trim($matches[0]); + if (preg_match("/\((.*)\)$/", $string, $matches)) { + $data['name'] = $matches[1]; + } + $authors[] = $data; + } } } - if (empty($authors)) { + if (count($authors) == 0) { $authors = $this->getExtension('Atom')->getAuthors(); + } else { + $authors = new Zend_Feed_Reader_Collection_Author( + Zend_Feed_Reader::arrayUnique($authors) + ); } - if (empty($authors)) { + if (count($authors) == 0) { $authors = null; - } else { - $authors = array_unique($authors); } $this->_data['authors'] = $authors; diff --git a/test/Reader/Entry/AtomStandaloneEntryTest.php b/test/Reader/Entry/AtomStandaloneEntryTest.php index 7dc340da..d7d5b446 100644 --- a/test/Reader/Entry/AtomStandaloneEntryTest.php +++ b/test/Reader/Entry/AtomStandaloneEntryTest.php @@ -163,14 +163,15 @@ public function testGetsAuthorsFromAtom10() ); $authors = array( - 0 => 'joe@example.com (Joe Bloggs)', - 1 => 'Joe Bloggs', - 3 => 'joe@example.com', - 4 => 'http://www.example.com', - 6 => 'jane@example.com (Jane Bloggs)' + array('email'=>'joe@example.com','name'=>'Joe Bloggs','uri'=>'http://www.example.com'), + array('name'=>'Joe Bloggs','uri'=>'http://www.example.com'), + array('name'=>'Joe Bloggs'), + array('email'=>'joe@example.com','uri'=>'http://www.example.com'), + array('uri'=>'http://www.example.com'), + array('email'=>'joe@example.com') ); - $this->assertEquals($authors, $entry->getAuthors()); + $this->assertEquals($authors, (array) $entry->getAuthors()); } /** @@ -182,7 +183,7 @@ public function testGetsAuthorFromAtom10() $entry = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/author/atom10.xml') ); - $this->assertEquals('joe@example.com (Joe Bloggs)', $entry->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com','uri'=>'http://www.example.com'), $entry->getAuthor()); } /** diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index a0e19203..7cb06fb2 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -195,15 +195,16 @@ public function testGetsAuthorsFromAtom03() ); $authors = array( - 0 => 'joe@example.com (Joe Bloggs)', - 1 => 'Joe Bloggs', - 3 => 'joe@example.com', - 4 => 'http://www.example.com', - 6 => 'jane@example.com (Jane Bloggs)' + array('email'=>'joe@example.com','name'=>'Joe Bloggs','uri'=>'http://www.example.com'), + array('name'=>'Joe Bloggs','uri'=>'http://www.example.com'), + array('name'=>'Joe Bloggs'), + array('email'=>'joe@example.com','uri'=>'http://www.example.com'), + array('uri'=>'http://www.example.com'), + array('email'=>'joe@example.com') ); $entry = $feed->current(); - $this->assertEquals($authors, $entry->getAuthors()); + $this->assertEquals($authors, (array) $entry->getAuthors()); } public function testGetsAuthorsFromAtom10() @@ -213,15 +214,16 @@ public function testGetsAuthorsFromAtom10() ); $authors = array( - 0 => 'joe@example.com (Joe Bloggs)', - 1 => 'Joe Bloggs', - 3 => 'joe@example.com', - 4 => 'http://www.example.com', - 6 => 'jane@example.com (Jane Bloggs)' + array('email'=>'joe@example.com','name'=>'Joe Bloggs','uri'=>'http://www.example.com'), + array('name'=>'Joe Bloggs','uri'=>'http://www.example.com'), + array('name'=>'Joe Bloggs'), + array('email'=>'joe@example.com','uri'=>'http://www.example.com'), + array('uri'=>'http://www.example.com'), + array('email'=>'joe@example.com') ); $entry = $feed->current(); - $this->assertEquals($authors, $entry->getAuthors()); + $this->assertEquals($authors, (array) $entry->getAuthors()); } /** @@ -233,7 +235,7 @@ public function testGetsAuthorFromAtom03() file_get_contents($this->_feedSamplePath . '/author/plain/atom03.xml') ); $entry = $feed->current(); - $this->assertEquals('joe@example.com (Joe Bloggs)', $entry->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com','uri'=>'http://www.example.com'), $entry->getAuthor()); } public function testGetsAuthorFromAtom10() @@ -242,7 +244,7 @@ public function testGetsAuthorFromAtom10() file_get_contents($this->_feedSamplePath . '/author/plain/atom10.xml') ); $entry = $feed->current(); - $this->assertEquals('joe@example.com (Joe Bloggs)', $entry->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com','uri'=>'http://www.example.com'), $entry->getAuthor()); } /** diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index 570c27fa..6ba0d22e 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -707,7 +707,11 @@ public function testGetsAuthorsFromRss20() file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') ); $entry = $feed->current(); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + $this->assertEquals(array( + array('email'=>'joe@example.com','name'=>'Joe Bloggs'), + array('email'=>'jane@example.com','name'=>'Jane Bloggs') + ), (array) $entry->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()->getValues()); } public function testGetsAuthorsFromRss094() @@ -716,7 +720,7 @@ public function testGetsAuthorsFromRss094() file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') ); $entry = $feed->current(); - $this->assertEquals(array(), $entry->getAuthors()); + $this->assertEquals(null, $entry->getAuthors()); } public function testGetsAuthorsFromRss093() @@ -725,7 +729,7 @@ public function testGetsAuthorsFromRss093() file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') ); $entry = $feed->current(); - $this->assertEquals(array(), $entry->getAuthors()); + $this->assertEquals(null, $entry->getAuthors()); } public function testGetsAuthorsFromRss092() @@ -734,7 +738,7 @@ public function testGetsAuthorsFromRss092() file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') ); $entry = $feed->current(); - $this->assertEquals(array(), $entry->getAuthors()); + $this->assertEquals(null, $entry->getAuthors()); } public function testGetsAuthorsFromRss091() @@ -743,7 +747,7 @@ public function testGetsAuthorsFromRss091() file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') ); $entry = $feed->current(); - $this->assertEquals(array(), $entry->getAuthors()); + $this->assertEquals(null, $entry->getAuthors()); } public function testGetsAuthorsFromRss10() @@ -752,7 +756,7 @@ public function testGetsAuthorsFromRss10() file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') ); $entry = $feed->current(); - $this->assertEquals(array(), $entry->getAuthors()); + $this->assertEquals(null, $entry->getAuthors()); } public function testGetsAuthorsFromRss090() @@ -761,7 +765,7 @@ public function testGetsAuthorsFromRss090() file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') ); $entry = $feed->current(); - $this->assertEquals(array(), $entry->getAuthors()); + $this->assertEquals(null, $entry->getAuthors()); } // DC 1.0 @@ -772,7 +776,10 @@ public function testGetsAuthorsFromRss20_Dc10() file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') ); $entry = $feed->current(); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $entry->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()->getValues()); } public function testGetsAuthorsFromRss094_Dc10() @@ -781,7 +788,10 @@ public function testGetsAuthorsFromRss094_Dc10() file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') ); $entry = $feed->current(); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $entry->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()->getValues()); } public function testGetsAuthorsFromRss093_Dc10() @@ -790,7 +800,10 @@ public function testGetsAuthorsFromRss093_Dc10() file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') ); $entry = $feed->current(); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $entry->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()->getValues()); } public function testGetsAuthorsFromRss092_Dc10() @@ -799,7 +812,10 @@ public function testGetsAuthorsFromRss092_Dc10() file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') ); $entry = $feed->current(); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $entry->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()->getValues()); } public function testGetsAuthorsFromRss091_Dc10() @@ -808,7 +824,10 @@ public function testGetsAuthorsFromRss091_Dc10() file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') ); $entry = $feed->current(); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $entry->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()->getValues()); } public function testGetsAuthorsFromRss10_Dc10() @@ -817,7 +836,10 @@ public function testGetsAuthorsFromRss10_Dc10() file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') ); $entry = $feed->current(); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $entry->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()->getValues()); } public function testGetsAuthorsFromRss090_Dc10() @@ -826,7 +848,10 @@ public function testGetsAuthorsFromRss090_Dc10() file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') ); $entry = $feed->current(); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $entry->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()->getValues()); } // DC 1.1 @@ -837,7 +862,10 @@ public function testGetsAuthorsFromRss20_Dc11() file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') ); $entry = $feed->current(); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $entry->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()->getValues()); } public function testGetsAuthorsFromRss094_Dc11() @@ -846,7 +874,10 @@ public function testGetsAuthorsFromRss094_Dc11() file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') ); $entry = $feed->current(); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $entry->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()->getValues()); } public function testGetsAuthorsFromRss093_Dc11() @@ -855,7 +886,10 @@ public function testGetsAuthorsFromRss093_Dc11() file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') ); $entry = $feed->current(); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $entry->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()->getValues()); } public function testGetsAuthorsFromRss092_Dc11() @@ -864,7 +898,10 @@ public function testGetsAuthorsFromRss092_Dc11() file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') ); $entry = $feed->current(); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $entry->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()->getValues()); } public function testGetsAuthorsFromRss091_Dc11() @@ -873,7 +910,10 @@ public function testGetsAuthorsFromRss091_Dc11() file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') ); $entry = $feed->current(); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $entry->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()->getValues()); } public function testGetsAuthorsFromRss10_Dc11() @@ -882,7 +922,10 @@ public function testGetsAuthorsFromRss10_Dc11() file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') ); $entry = $feed->current(); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $entry->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()->getValues()); } public function testGetsAuthorsFromRss090_Dc11() @@ -891,7 +934,10 @@ public function testGetsAuthorsFromRss090_Dc11() file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') ); $entry = $feed->current(); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $entry->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $entry->getAuthors()->getValues()); } // Missing Author @@ -902,7 +948,7 @@ public function testGetsAuthorsFromRss20_None() file_get_contents($this->_feedSamplePath.'/author/plain/none/rss20.xml') ); $entry = $feed->current(); - $this->assertEquals(array(), $entry->getAuthors()); + $this->assertEquals(null, $entry->getAuthors()); } public function testGetsAuthorsFromRss094_None() @@ -911,7 +957,7 @@ public function testGetsAuthorsFromRss094_None() file_get_contents($this->_feedSamplePath.'/author/plain/none/rss094.xml') ); $entry = $feed->current(); - $this->assertEquals(array(), $entry->getAuthors()); + $this->assertEquals(null, $entry->getAuthors()); } public function testGetsAuthorsFromRss093_None() @@ -920,7 +966,7 @@ public function testGetsAuthorsFromRss093_None() file_get_contents($this->_feedSamplePath.'/author/plain/none/rss093.xml') ); $entry = $feed->current(); - $this->assertEquals(array(), $entry->getAuthors()); + $this->assertEquals(null, $entry->getAuthors()); } public function testGetsAuthorsFromRss092_None() @@ -929,7 +975,7 @@ public function testGetsAuthorsFromRss092_None() file_get_contents($this->_feedSamplePath.'/author/plain/none/rss092.xml') ); $entry = $feed->current(); - $this->assertEquals(array(), $entry->getAuthors()); + $this->assertEquals(null, $entry->getAuthors()); } public function testGetsAuthorsFromRss091_None() @@ -938,7 +984,7 @@ public function testGetsAuthorsFromRss091_None() file_get_contents($this->_feedSamplePath.'/author/plain/none/rss091.xml') ); $entry = $feed->current(); - $this->assertEquals(array(), $entry->getAuthors()); + $this->assertEquals(null, $entry->getAuthors()); } public function testGetsAuthorsFromRss10_None() @@ -947,7 +993,7 @@ public function testGetsAuthorsFromRss10_None() file_get_contents($this->_feedSamplePath.'/author/plain/none/rss10.xml') ); $entry = $feed->current(); - $this->assertEquals(array(), $entry->getAuthors()); + $this->assertEquals(null, $entry->getAuthors()); } public function testGetsAuthorsFromRss090_None() @@ -956,7 +1002,7 @@ public function testGetsAuthorsFromRss090_None() file_get_contents($this->_feedSamplePath.'/author/plain/none/rss090.xml') ); $entry = $feed->current(); - $this->assertEquals(array(), $entry->getAuthors()); + $this->assertEquals(null, $entry->getAuthors()); } @@ -969,7 +1015,7 @@ public function testGetsAuthorFromRss20() file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') ); $entry = $feed->current(); - $this->assertEquals('Joe Bloggs', $entry->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $entry->getAuthor()); } public function testGetsAuthorFromRss094() @@ -1034,7 +1080,7 @@ public function testGetsAuthorFromRss20_Dc10() file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') ); $entry = $feed->current(); - $this->assertEquals('Joe Bloggs', $entry->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $entry->getAuthor()); } public function testGetsAuthorFromRss094_Dc10() @@ -1043,7 +1089,7 @@ public function testGetsAuthorFromRss094_Dc10() file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') ); $entry = $feed->current(); - $this->assertEquals('Jane Bloggs', $entry->getAuthor(1)); + $this->assertEquals(array('name'=>'Jane Bloggs'), $entry->getAuthor(1)); } public function testGetsAuthorFromRss093_Dc10() @@ -1052,7 +1098,7 @@ public function testGetsAuthorFromRss093_Dc10() file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') ); $entry = $feed->current(); - $this->assertEquals('Joe Bloggs', $entry->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $entry->getAuthor()); } public function testGetsAuthorFromRss092_Dc10() @@ -1061,7 +1107,7 @@ public function testGetsAuthorFromRss092_Dc10() file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') ); $entry = $feed->current(); - $this->assertEquals('Jane Bloggs', $entry->getAuthor(1)); + $this->assertEquals(array('name'=>'Jane Bloggs'), $entry->getAuthor(1)); } public function testGetsAuthorFromRss091_Dc10() @@ -1070,7 +1116,7 @@ public function testGetsAuthorFromRss091_Dc10() file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') ); $entry = $feed->current(); - $this->assertEquals('Joe Bloggs', $entry->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $entry->getAuthor()); } public function testGetsAuthorFromRss10_Dc10() @@ -1079,7 +1125,7 @@ public function testGetsAuthorFromRss10_Dc10() file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') ); $entry = $feed->current(); - $this->assertEquals('Jane Bloggs', $entry->getAuthor(1)); + $this->assertEquals(array('name'=>'Jane Bloggs'), $entry->getAuthor(1)); } public function testGetsAuthorFromRss090_Dc10() @@ -1088,7 +1134,7 @@ public function testGetsAuthorFromRss090_Dc10() file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') ); $entry = $feed->current(); - $this->assertEquals('Joe Bloggs', $entry->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $entry->getAuthor()); } // DC 1.1 @@ -1099,7 +1145,7 @@ public function testGetsAuthorFromRss20_Dc11() file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') ); $entry = $feed->current(); - $this->assertEquals('Jane Bloggs', $entry->getAuthor(1)); + $this->assertEquals(array('name'=>'Jane Bloggs'), $entry->getAuthor(1)); } public function testGetsAuthorFromRss094_Dc11() @@ -1108,7 +1154,7 @@ public function testGetsAuthorFromRss094_Dc11() file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') ); $entry = $feed->current(); - $this->assertEquals('Joe Bloggs', $entry->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $entry->getAuthor()); } public function testGetsAuthorFromRss093_Dc11() @@ -1117,7 +1163,7 @@ public function testGetsAuthorFromRss093_Dc11() file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') ); $entry = $feed->current(); - $this->assertEquals('Jane Bloggs', $entry->getAuthor(1)); + $this->assertEquals(array('name'=>'Jane Bloggs'), $entry->getAuthor(1)); } public function testGetsAuthorFromRss092_Dc11() @@ -1126,7 +1172,7 @@ public function testGetsAuthorFromRss092_Dc11() file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') ); $entry = $feed->current(); - $this->assertEquals('Joe Bloggs', $entry->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $entry->getAuthor()); } public function testGetsAuthorFromRss091_Dc11() @@ -1135,7 +1181,7 @@ public function testGetsAuthorFromRss091_Dc11() file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') ); $entry = $feed->current(); - $this->assertEquals('Jane Bloggs', $entry->getAuthor(1)); + $this->assertEquals(array('name'=>'Jane Bloggs'), $entry->getAuthor(1)); } public function testGetsAuthorFromRss10_Dc11() @@ -1144,7 +1190,7 @@ public function testGetsAuthorFromRss10_Dc11() file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') ); $entry = $feed->current(); - $this->assertEquals('Joe Bloggs', $entry->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $entry->getAuthor()); } public function testGetsAuthorFromRss090_Dc11() @@ -1153,7 +1199,7 @@ public function testGetsAuthorFromRss090_Dc11() file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') ); $entry = $feed->current(); - $this->assertEquals('Jane Bloggs', $entry->getAuthor(1)); + $this->assertEquals(array('name'=>'Jane Bloggs'), $entry->getAuthor(1)); } // Missing Id diff --git a/test/Reader/Feed/AtomSourceTest.php b/test/Reader/Feed/AtomSourceTest.php index 67a2c46a..515796a3 100644 --- a/test/Reader/Feed/AtomSourceTest.php +++ b/test/Reader/Feed/AtomSourceTest.php @@ -128,14 +128,15 @@ public function testGetsAuthorArrayFromAtom10() $source = $feed->current()->getSource(); $authors = array( - 0 => 'joe@example.com (Joe Bloggs)', - 1 => 'Joe Bloggs', - 3 => 'joe@example.com', - 4 => 'http://www.example.com', - 6 => 'jane@example.com (Jane Bloggs)' + array('email'=>'joe@example.com','name'=>'Joe Bloggs','uri'=>'http://www.example.com'), + array('name'=>'Joe Bloggs','uri'=>'http://www.example.com'), + array('name'=>'Joe Bloggs'), + array('email'=>'joe@example.com','uri'=>'http://www.example.com'), + array('uri'=>'http://www.example.com'), + array('email'=>'joe@example.com') ); - $this->assertEquals($authors, $source->getAuthors()); + $this->assertEquals($authors, (array) $source->getAuthors()); } /** @@ -149,7 +150,7 @@ public function testGetsSingleAuthorFromAtom10() ); $source = $feed->current()->getSource(); - $this->assertEquals('joe@example.com (Joe Bloggs)', $source->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com','uri'=>'http://www.example.com'), $feed->getAuthor()); } /** diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 54dea9f4..82787636 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -123,14 +123,15 @@ public function testGetsAuthorArrayFromAtom03() ); $authors = array( - 0 => 'joe@example.com (Joe Bloggs)', - 1 => 'Joe Bloggs', - 3 => 'joe@example.com', - 4 => 'http://www.example.com', - 6 => 'jane@example.com (Jane Bloggs)' + array('email'=>'joe@example.com','name'=>'Joe Bloggs','uri'=>'http://www.example.com'), + array('name'=>'Joe Bloggs','uri'=>'http://www.example.com'), + array('name'=>'Joe Bloggs'), + array('email'=>'joe@example.com','uri'=>'http://www.example.com'), + array('uri'=>'http://www.example.com'), + array('email'=>'joe@example.com') ); - $this->assertEquals($authors, $feed->getAuthors()); + $this->assertEquals($authors, (array) $feed->getAuthors()); } public function testGetsAuthorArrayFromAtom10() @@ -140,14 +141,15 @@ public function testGetsAuthorArrayFromAtom10() ); $authors = array( - 0 => 'joe@example.com (Joe Bloggs)', - 1 => 'Joe Bloggs', - 3 => 'joe@example.com', - 4 => 'http://www.example.com', - 6 => 'jane@example.com (Jane Bloggs)' + array('email'=>'joe@example.com','name'=>'Joe Bloggs','uri'=>'http://www.example.com'), + array('name'=>'Joe Bloggs','uri'=>'http://www.example.com'), + array('name'=>'Joe Bloggs'), + array('email'=>'joe@example.com','uri'=>'http://www.example.com'), + array('uri'=>'http://www.example.com'), + array('email'=>'joe@example.com') ); - $this->assertEquals($authors, $feed->getAuthors()); + $this->assertEquals($authors, (array) $feed->getAuthors()); } /** @@ -159,7 +161,7 @@ public function testGetsSingleAuthorFromAtom03() file_get_contents($this->_feedSamplePath.'/author/plain/atom03.xml') ); - $this->assertEquals('joe@example.com (Joe Bloggs)', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com','uri'=>'http://www.example.com'), $feed->getAuthor()); } public function testGetsSingleAuthorFromAtom10() @@ -168,7 +170,7 @@ public function testGetsSingleAuthorFromAtom10() file_get_contents($this->_feedSamplePath.'/author/plain/atom10.xml') ); - $this->assertEquals('joe@example.com (Joe Bloggs)', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com','uri'=>'http://www.example.com'), $feed->getAuthor()); } /** diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index 573c8d0e..bd1ebb15 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -411,7 +411,11 @@ public function testGetsAuthorArrayFromRss20() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('email'=>'joe@example.com','name'=>'Joe Bloggs'), + array('email'=>'jane@example.com','name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss094() @@ -419,7 +423,11 @@ public function testGetsAuthorArrayFromRss094() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('email'=>'joe@example.com','name'=>'Joe Bloggs'), + array('email'=>'jane@example.com','name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss093() @@ -427,7 +435,11 @@ public function testGetsAuthorArrayFromRss093() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('email'=>'joe@example.com','name'=>'Joe Bloggs'), + array('email'=>'jane@example.com','name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss092() @@ -435,7 +447,11 @@ public function testGetsAuthorArrayFromRss092() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('email'=>'joe@example.com','name'=>'Joe Bloggs'), + array('email'=>'jane@example.com','name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss091() @@ -443,7 +459,11 @@ public function testGetsAuthorArrayFromRss091() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('email'=>'joe@example.com','name'=>'Joe Bloggs'), + array('email'=>'jane@example.com','name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss10() @@ -451,7 +471,11 @@ public function testGetsAuthorArrayFromRss10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('email'=>'joe@example.com','name'=>'Joe Bloggs'), + array('email'=>'jane@example.com','name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss090() @@ -459,7 +483,11 @@ public function testGetsAuthorArrayFromRss090() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('email'=>'joe@example.com','name'=>'Joe Bloggs'), + array('email'=>'jane@example.com','name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } // DC 1.0 @@ -469,7 +497,10 @@ public function testGetsAuthorArrayFromRss20_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss094_Dc10() @@ -477,7 +508,10 @@ public function testGetsAuthorArrayFromRss094_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss093_Dc10() @@ -485,7 +519,10 @@ public function testGetsAuthorArrayFromRss093_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss092_Dc10() @@ -493,7 +530,10 @@ public function testGetsAuthorArrayFromRss092_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss091_Dc10() @@ -501,7 +541,10 @@ public function testGetsAuthorArrayFromRss091_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss10_Dc10() @@ -509,7 +552,10 @@ public function testGetsAuthorArrayFromRss10_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss090_Dc10() @@ -517,7 +563,10 @@ public function testGetsAuthorArrayFromRss090_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues());; } // DC 1.1 @@ -527,7 +576,10 @@ public function testGetsAuthorArrayFromRss20_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss094_Dc11() @@ -535,7 +587,10 @@ public function testGetsAuthorArrayFromRss094_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss093_Dc11() @@ -543,7 +598,10 @@ public function testGetsAuthorArrayFromRss093_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss092_Dc11() @@ -551,7 +609,10 @@ public function testGetsAuthorArrayFromRss092_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss091_Dc11() @@ -559,7 +620,10 @@ public function testGetsAuthorArrayFromRss091_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss10_Dc11() @@ -567,7 +631,10 @@ public function testGetsAuthorArrayFromRss10_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss090_Dc11() @@ -575,7 +642,10 @@ public function testGetsAuthorArrayFromRss090_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } // Atom 1.0 @@ -585,7 +655,10 @@ public function testGetsAuthorArrayFromRss20_Atom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss20.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss094_Atom10() @@ -593,7 +666,10 @@ public function testGetsAuthorArrayFromRss094_Atom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss094.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss093_Atom10() @@ -601,7 +677,10 @@ public function testGetsAuthorArrayFromRss093_Atom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss093.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss092_Atom10() @@ -609,7 +688,10 @@ public function testGetsAuthorArrayFromRss092_Atom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss092.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss091_Atom10() @@ -617,7 +699,10 @@ public function testGetsAuthorArrayFromRss091_Atom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss091.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss10_Atom10() @@ -625,7 +710,10 @@ public function testGetsAuthorArrayFromRss10_Atom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss10.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } public function testGetsAuthorArrayFromRss090_Atom10() @@ -633,7 +721,10 @@ public function testGetsAuthorArrayFromRss090_Atom10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss090.xml') ); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') + ), (array) $feed->getAuthors()); + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } // Missing Authors @@ -702,7 +793,7 @@ public function testGetsSingleAuthorFromRss20() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss094() @@ -710,7 +801,7 @@ public function testGetsSingleAuthorFromRss094() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss093() @@ -718,7 +809,7 @@ public function testGetsSingleAuthorFromRss093() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss092() @@ -726,7 +817,7 @@ public function testGetsSingleAuthorFromRss092() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss091() @@ -734,7 +825,7 @@ public function testGetsSingleAuthorFromRss091() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss10() @@ -742,7 +833,7 @@ public function testGetsSingleAuthorFromRss10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss090() @@ -750,7 +841,7 @@ public function testGetsSingleAuthorFromRss090() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); } // DC 1.0 @@ -760,7 +851,7 @@ public function testGetsSingleAuthorFromRss20_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss094_Dc10() @@ -768,7 +859,7 @@ public function testGetsSingleAuthorFromRss094_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss093_Dc10() @@ -776,7 +867,7 @@ public function testGetsSingleAuthorFromRss093_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss092_Dc10() @@ -784,7 +875,7 @@ public function testGetsSingleAuthorFromRss092_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss091_Dc10() @@ -792,7 +883,7 @@ public function testGetsSingleAuthorFromRss091_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss10_Dc10() @@ -800,7 +891,7 @@ public function testGetsSingleAuthorFromRss10_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss090_Dc10() @@ -808,7 +899,7 @@ public function testGetsSingleAuthorFromRss090_Dc10() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); } // DC 1.1 @@ -818,7 +909,7 @@ public function testGetsSingleAuthorFromRss20_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss094_Dc11() @@ -826,7 +917,7 @@ public function testGetsSingleAuthorFromRss094_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss093_Dc11() @@ -834,7 +925,7 @@ public function testGetsSingleAuthorFromRss093_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss092_Dc11() @@ -842,7 +933,7 @@ public function testGetsSingleAuthorFromRss092_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss091_Dc11() @@ -850,7 +941,7 @@ public function testGetsSingleAuthorFromRss091_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss10_Dc11() @@ -858,7 +949,7 @@ public function testGetsSingleAuthorFromRss10_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); } public function testGetsSingleAuthorFromRss090_Dc11() @@ -866,7 +957,7 @@ public function testGetsSingleAuthorFromRss090_Dc11() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') ); - $this->assertEquals('Joe Bloggs', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); } // Missing Author diff --git a/test/Reader/Feed/_files/Rss/author/plain/rss090.xml b/test/Reader/Feed/_files/Rss/author/plain/rss090.xml index 585ca637..f3639834 100644 --- a/test/Reader/Feed/_files/Rss/author/plain/rss090.xml +++ b/test/Reader/Feed/_files/Rss/author/plain/rss090.xml @@ -4,8 +4,8 @@ xmlns="http://my.netscape.com/rdf/simple/0.9/"> - Joe Bloggs - Jane Bloggs + joe@example.com (Joe Bloggs) + jane@example.com (Jane Bloggs) - \ No newline at end of file + diff --git a/test/Reader/Feed/_files/Rss/author/plain/rss091.xml b/test/Reader/Feed/_files/Rss/author/plain/rss091.xml index c50d4aa2..3a704257 100644 --- a/test/Reader/Feed/_files/Rss/author/plain/rss091.xml +++ b/test/Reader/Feed/_files/Rss/author/plain/rss091.xml @@ -2,8 +2,8 @@ - Joe Bloggs - Jane Bloggs + joe@example.com (Joe Bloggs) + jane@example.com (Jane Bloggs) - \ No newline at end of file + diff --git a/test/Reader/Feed/_files/Rss/author/plain/rss092.xml b/test/Reader/Feed/_files/Rss/author/plain/rss092.xml index 7435c462..04a5f236 100644 --- a/test/Reader/Feed/_files/Rss/author/plain/rss092.xml +++ b/test/Reader/Feed/_files/Rss/author/plain/rss092.xml @@ -2,8 +2,8 @@ - Joe Bloggs - Jane Bloggs + joe@example.com (Joe Bloggs) + jane@example.com (Jane Bloggs) - \ No newline at end of file + diff --git a/test/Reader/Feed/_files/Rss/author/plain/rss093.xml b/test/Reader/Feed/_files/Rss/author/plain/rss093.xml index f6fdf869..2abe38f8 100644 --- a/test/Reader/Feed/_files/Rss/author/plain/rss093.xml +++ b/test/Reader/Feed/_files/Rss/author/plain/rss093.xml @@ -2,8 +2,8 @@ - Joe Bloggs - Jane Bloggs + joe@example.com (Joe Bloggs) + jane@example.com (Jane Bloggs) - \ No newline at end of file + diff --git a/test/Reader/Feed/_files/Rss/author/plain/rss094.xml b/test/Reader/Feed/_files/Rss/author/plain/rss094.xml index ce138129..20c763b3 100644 --- a/test/Reader/Feed/_files/Rss/author/plain/rss094.xml +++ b/test/Reader/Feed/_files/Rss/author/plain/rss094.xml @@ -2,8 +2,8 @@ - Joe Bloggs - Jane Bloggs + joe@example.com (Joe Bloggs) + jane@example.com (Jane Bloggs) - \ No newline at end of file + diff --git a/test/Reader/Feed/_files/Rss/author/plain/rss10.xml b/test/Reader/Feed/_files/Rss/author/plain/rss10.xml index 4d751a71..97f61c23 100644 --- a/test/Reader/Feed/_files/Rss/author/plain/rss10.xml +++ b/test/Reader/Feed/_files/Rss/author/plain/rss10.xml @@ -4,8 +4,8 @@ xmlns="http://purl.org/rss/1.0/"> - Joe Bloggs - Jane Bloggs + joe@example.com (Joe Bloggs) + jane@example.com (Jane Bloggs) - \ No newline at end of file + diff --git a/test/Reader/Feed/_files/Rss/author/plain/rss20.xml b/test/Reader/Feed/_files/Rss/author/plain/rss20.xml index 73fd9080..084ae2f5 100644 --- a/test/Reader/Feed/_files/Rss/author/plain/rss20.xml +++ b/test/Reader/Feed/_files/Rss/author/plain/rss20.xml @@ -2,8 +2,8 @@ - Joe Bloggs - Jane Bloggs + joe@example.com (Joe Bloggs) + jane@example.com (Jane Bloggs) - \ No newline at end of file + diff --git a/test/Reader/Integration/H-OnlineComAtom10Test.php b/test/Reader/Integration/H-OnlineComAtom10Test.php index 7ef6fdf2..023e0564 100644 --- a/test/Reader/Integration/H-OnlineComAtom10Test.php +++ b/test/Reader/Integration/H-OnlineComAtom10Test.php @@ -68,7 +68,7 @@ public function testGetsAuthors() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); - $this->assertEquals(array('The H'), $feed->getAuthors()); + $this->assertEquals(array(array('name'=>'The H')), (array) $feed->getAuthors()); } public function testGetsSingleAuthor() @@ -76,7 +76,7 @@ public function testGetsSingleAuthor() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); - $this->assertEquals('The H', $feed->getAuthor()); + $this->assertEquals(array('name'=>'The H'), $feed->getAuthor()); } public function testGetsCopyright() @@ -155,7 +155,7 @@ public function testGetsEntryAuthors() file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); - $this->assertEquals(array('The H'), $entry->getAuthors()); + $this->assertEquals(array(array('name'=>'The H')), (array) $entry->getAuthors()); } public function testGetsEntrySingleAuthor() @@ -164,7 +164,7 @@ public function testGetsEntrySingleAuthor() file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); - $this->assertEquals('The H', $entry->getAuthor()); + $this->assertEquals(array('name'=>'The H'), $entry->getAuthor()); } public function testGetsEntryDescription() diff --git a/test/Reader/Integration/LautDeRdfTest.php b/test/Reader/Integration/LautDeRdfTest.php index 084e013b..412f7f95 100644 --- a/test/Reader/Integration/LautDeRdfTest.php +++ b/test/Reader/Integration/LautDeRdfTest.php @@ -72,7 +72,7 @@ public function testGetsAuthors() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); - $this->assertEquals(array('laut.de'), $feed->getAuthors()); + $this->assertEquals(array(array('name'=>'laut.de')), (array) $feed->getAuthors()); } public function testGetsSingleAuthor() @@ -80,7 +80,7 @@ public function testGetsSingleAuthor() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); - $this->assertEquals('laut.de', $feed->getAuthor()); + $this->assertEquals(array('name'=>'laut.de'), $feed->getAuthor()); } public function testGetsCopyright() @@ -153,7 +153,7 @@ public function testGetsEntryAuthors() file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); - $this->assertEquals(array('laut.de'), $entry->getAuthors()); + $this->assertEquals(array(array('name'=>'laut.de')), (array) $entry->getAuthors()); } public function testGetsEntrySingleAuthor() @@ -162,7 +162,7 @@ public function testGetsEntrySingleAuthor() file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); - $this->assertEquals('laut.de', $entry->getAuthor()); + $this->assertEquals(array('name'=>'laut.de'), $entry->getAuthor()); } // Technically, the next two tests should not pass. However the source feed has an encoding diff --git a/test/Reader/Integration/WordpressAtom10Test.php b/test/Reader/Integration/WordpressAtom10Test.php index f5581009..0db86569 100644 --- a/test/Reader/Integration/WordpressAtom10Test.php +++ b/test/Reader/Integration/WordpressAtom10Test.php @@ -68,7 +68,9 @@ public function testGetsAuthors() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); - $this->assertEquals(array('norm2782'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'norm2782','uri'=>'http://www.norm2782.com') + ), (array) $feed->getAuthors()); } public function testGetsSingleAuthor() @@ -76,7 +78,7 @@ public function testGetsSingleAuthor() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); - $this->assertEquals('norm2782', $feed->getAuthor()); + $this->assertEquals(array('name'=>'norm2782','uri'=>'http://www.norm2782.com'), $feed->getAuthor()); } public function testGetsCopyright() @@ -159,7 +161,7 @@ public function testGetsEntryAuthors() file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); - $this->assertEquals(array('norm2782'), $entry->getAuthors()); + $this->assertEquals(array(array('name'=>'norm2782','uri'=>'http://www.norm2782.com')), (array) $entry->getAuthors()); } public function testGetsEntrySingleAuthor() @@ -168,7 +170,7 @@ public function testGetsEntrySingleAuthor() file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); - $this->assertEquals('norm2782', $entry->getAuthor()); + $this->assertEquals(array('name'=>'norm2782','uri'=>'http://www.norm2782.com'), $entry->getAuthor()); } public function testGetsEntryDescription() diff --git a/test/Reader/Integration/WordpressRss2DcAtomTest.php b/test/Reader/Integration/WordpressRss2DcAtomTest.php index 4eeeaaac..0324da45 100644 --- a/test/Reader/Integration/WordpressRss2DcAtomTest.php +++ b/test/Reader/Integration/WordpressRss2DcAtomTest.php @@ -60,7 +60,9 @@ public function testGetsAuthors() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); - $this->assertEquals(array('norm2782'), $feed->getAuthors()); + $this->assertEquals(array( + array('name'=>'norm2782') + ), (array) $feed->getAuthors()); } public function testGetsSingleAuthor() @@ -68,7 +70,7 @@ public function testGetsSingleAuthor() $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); - $this->assertEquals('norm2782', $feed->getAuthor()); + $this->assertEquals(array('name'=>'norm2782'), $feed->getAuthor()); } public function testGetsCopyright() @@ -151,7 +153,7 @@ public function testGetsEntryAuthors() file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); - $this->assertEquals(array('norm2782'), $entry->getAuthors()); + $this->assertEquals(array(array('name'=>'norm2782')), (array) $entry->getAuthors()); } public function testGetsEntrySingleAuthor() @@ -160,7 +162,7 @@ public function testGetsEntrySingleAuthor() file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); - $this->assertEquals('norm2782', $entry->getAuthor()); + $this->assertEquals(array('name'=>'norm2782'), $entry->getAuthor()); } public function testGetsEntryDescription() From a924e8277bbe70d8b446f882791143a76e75f961 Mon Sep 17 00:00:00 2001 From: padraic Date: Thu, 17 Dec 2009 22:08:56 +0000 Subject: [PATCH 078/238] Zend_Feed_Writer promoted to trunk git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19728 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Writer.php | 274 ++++++ src/Writer/Entry.php | 667 +++++++++++++ .../Exception/InvalidMethodException.php | 41 + src/Writer/Extension/Atom/Renderer/Feed.php | 87 ++ .../Extension/Content/Renderer/Entry.php | 67 ++ .../Extension/DublinCore/Renderer/Entry.php | 67 ++ .../Extension/DublinCore/Renderer/Feed.php | 67 ++ src/Writer/Extension/ITunes/Entry.php | 171 ++++ src/Writer/Extension/ITunes/Feed.php | 255 +++++ .../Extension/ITunes/Renderer/Entry.php | 142 +++ src/Writer/Extension/ITunes/Renderer/Feed.php | 222 +++++ src/Writer/Extension/RendererAbstract.php | 103 ++ src/Writer/Extension/RendererInterface.php | 38 + src/Writer/Extension/Slash/Renderer/Entry.php | 63 ++ .../Extension/Threading/Renderer/Entry.php | 103 ++ .../WellFormedWeb/Renderer/Entry.php | 67 ++ src/Writer/Feed.php | 900 ++++++++++++++++++ src/Writer/Renderer/Entry/Atom.php | 248 +++++ src/Writer/Renderer/Entry/Rss.php | 214 +++++ src/Writer/Renderer/Feed/Atom.php | 348 +++++++ src/Writer/Renderer/Feed/Rss.php | 277 ++++++ src/Writer/Renderer/RendererAbstract.php | 181 ++++ src/Writer/Renderer/RendererInterface.php | 78 ++ test/AllTests.php | 20 + test/Writer/EntryTest.php | 571 +++++++++++ test/Writer/Extension/ITunes/EntryTest.php | 201 ++++ test/Writer/Extension/ITunes/FeedTest.php | 288 ++++++ test/Writer/FeedTest.php | 609 ++++++++++++ test/Writer/Renderer/Entry/AtomTest.php | 247 +++++ test/Writer/Renderer/Entry/RssTest.php | 217 +++++ test/Writer/Renderer/Feed/AtomTest.php | 296 ++++++ test/Writer/Renderer/Feed/RssTest.php | 258 +++++ 32 files changed, 7387 insertions(+) create mode 100644 src/Writer.php create mode 100644 src/Writer/Entry.php create mode 100644 src/Writer/Exception/InvalidMethodException.php create mode 100644 src/Writer/Extension/Atom/Renderer/Feed.php create mode 100644 src/Writer/Extension/Content/Renderer/Entry.php create mode 100644 src/Writer/Extension/DublinCore/Renderer/Entry.php create mode 100644 src/Writer/Extension/DublinCore/Renderer/Feed.php create mode 100644 src/Writer/Extension/ITunes/Entry.php create mode 100644 src/Writer/Extension/ITunes/Feed.php create mode 100644 src/Writer/Extension/ITunes/Renderer/Entry.php create mode 100644 src/Writer/Extension/ITunes/Renderer/Feed.php create mode 100644 src/Writer/Extension/RendererAbstract.php create mode 100644 src/Writer/Extension/RendererInterface.php create mode 100644 src/Writer/Extension/Slash/Renderer/Entry.php create mode 100644 src/Writer/Extension/Threading/Renderer/Entry.php create mode 100644 src/Writer/Extension/WellFormedWeb/Renderer/Entry.php create mode 100644 src/Writer/Feed.php create mode 100644 src/Writer/Renderer/Entry/Atom.php create mode 100644 src/Writer/Renderer/Entry/Rss.php create mode 100644 src/Writer/Renderer/Feed/Atom.php create mode 100644 src/Writer/Renderer/Feed/Rss.php create mode 100644 src/Writer/Renderer/RendererAbstract.php create mode 100644 src/Writer/Renderer/RendererInterface.php create mode 100644 test/Writer/EntryTest.php create mode 100644 test/Writer/Extension/ITunes/EntryTest.php create mode 100644 test/Writer/Extension/ITunes/FeedTest.php create mode 100644 test/Writer/FeedTest.php create mode 100644 test/Writer/Renderer/Entry/AtomTest.php create mode 100644 test/Writer/Renderer/Entry/RssTest.php create mode 100644 test/Writer/Renderer/Feed/AtomTest.php create mode 100644 test/Writer/Renderer/Feed/RssTest.php diff --git a/src/Writer.php b/src/Writer.php new file mode 100644 index 00000000..6dee5a62 --- /dev/null +++ b/src/Writer.php @@ -0,0 +1,274 @@ + array(), + 'feed' => array(), + 'entryRenderer' => array(), + 'feedRenderer' => array() + ); + + /** + * Set plugin loader for use with Extensions + * + * @param Zend_Loader_PluginLoader_Interface + */ + public static function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader) + { + self::$_pluginLoader = $loader; + } + + /** + * Get plugin loader for use with Extensions + * + * @return Zend_Loader_PluginLoader_Interface + */ + public static function getPluginLoader() + { + if (!isset(self::$_pluginLoader)) { + require_once 'Zend/Loader/PluginLoader.php'; + self::$_pluginLoader = new Zend_Loader_PluginLoader(array( + 'Zend_Feed_Writer_Extension_' => 'Zend/Feed/Writer/Extension/', + )); + } + return self::$_pluginLoader; + } + + /** + * Add prefix path for loading Extensions + * + * @param string $prefix + * @param string $path + * @return void + */ + public static function addPrefixPath($prefix, $path) + { + $prefix = rtrim($prefix, '_'); + $path = rtrim($path, DIRECTORY_SEPARATOR); + self::getPluginLoader()->addPrefixPath($prefix, $path); + } + + /** + * Add multiple Extension prefix paths at once + * + * @param array $spec + * @return void + */ + public static function addPrefixPaths(array $spec) + { + if (isset($spec['prefix']) && isset($spec['path'])) { + self::addPrefixPath($spec['prefix'], $spec['path']); + } + foreach ($spec as $prefixPath) { + if (isset($prefixPath['prefix']) && isset($prefixPath['path'])) { + self::addPrefixPath($prefixPath['prefix'], $prefixPath['path']); + } + } + } + + /** + * Register an Extension by name + * + * @param string $name + * @return void + * @throws Zend_Feed_Exception if unable to resolve Extension class + */ + public static function registerExtension($name) + { + $feedName = $name . '_Feed'; + $entryName = $name . '_Entry'; + $feedRendererName = $name . '_Renderer_Feed'; + $entryRendererName = $name . '_Renderer_Entry'; + if (self::isRegistered($name)) { + if (self::getPluginLoader()->isLoaded($feedName) + || self::getPluginLoader()->isLoaded($entryName) + || self::getPluginLoader()->isLoaded($feedRendererName) + || self::getPluginLoader()->isLoaded($entryRendererName)) { + return; + } + } + try { + self::getPluginLoader()->load($feedName); + self::$_extensions['feed'][] = $feedName; + } catch (Zend_Loader_PluginLoader_Exception $e) { + } + try { + self::getPluginLoader()->load($entryName); + self::$_extensions['entry'][] = $entryName; + } catch (Zend_Loader_PluginLoader_Exception $e) { + } + try { + self::getPluginLoader()->load($feedRendererName); + self::$_extensions['feedRenderer'][] = $feedRendererName; + } catch (Zend_Loader_PluginLoader_Exception $e) { + } + try { + self::getPluginLoader()->load($entryRendererName); + self::$_extensions['entryRenderer'][] = $entryRendererName; + } catch (Zend_Loader_PluginLoader_Exception $e) { + } + if (!self::getPluginLoader()->isLoaded($feedName) + && !self::getPluginLoader()->isLoaded($entryName) + && !self::getPluginLoader()->isLoaded($feedRendererName) + && !self::getPluginLoader()->isLoaded($entryRendererName) + ) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Could not load extension: ' . $name + . 'using Plugin Loader. Check prefix paths are configured and extension exists.'); + } + } + + /** + * Is a given named Extension registered? + * + * @param string $extensionName + * @return boolean + */ + public static function isRegistered($extensionName) + { + $feedName = $extensionName . '_Feed'; + $entryName = $extensionName . '_Entry'; + $feedRendererName = $extensionName . '_Renderer_Feed'; + $entryRendererName = $extensionName . '_Renderer_Entry'; + if (in_array($feedName, self::$_extensions['feed']) + || in_array($entryName, self::$_extensions['entry']) + || in_array($feedRendererName, self::$_extensions['feedRenderer']) + || in_array($entryRendererName, self::$_extensions['entryRenderer']) + ) { + return true; + } + return false; + } + + /** + * Get a list of extensions + * + * @return array + */ + public static function getExtensions() + { + return self::$_extensions; + } + + /** + * Reset class state to defaults + * + * @return void + */ + public static function reset() + { + self::$_pluginLoader = null; + self::$_prefixPaths = array(); + self::$_extensions = array( + 'entry' => array(), + 'feed' => array(), + 'entryRenderer' => array(), + 'feedRenderer' => array() + ); + } + + /** + * Register core (default) extensions + * + * @return void + */ + public static function registerCoreExtensions() + { + self::registerExtension('DublinCore'); + self::registerExtension('Content'); + self::registerExtension('Atom'); + self::registerExtension('Slash'); + self::registerExtension('WellFormedWeb'); + self::registerExtension('Threading'); + self::registerExtension('ITunes'); + } + + /** + * Replaces XML special characters with entities. + * + * @param string $string + * @param string $encoding + * @return string + */ + public static function xmlentities($string, $encoding) + { + return str_replace(''', ''', htmlspecialchars( + $string, ENT_QUOTES, $encoding + )); + } + +} diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php new file mode 100644 index 00000000..93c1c110 --- /dev/null +++ b/src/Writer/Entry.php @@ -0,0 +1,667 @@ +_loadExtensions(); + } + + /** + * Set a single author + * + * @param int $index + * @return string|null + */ + public function addAuthor($name, $email = null, $uri = null) + { + $author = array(); + if (is_array($name)) { + if (!array_key_exists('name', $name) || empty($name['name']) || !is_string($name['name'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); + } + $author['name'] = $name['name']; + if (isset($name['email'])) { + if (empty($name['email']) || !is_string($name['email'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); + } + $author['email'] = $name['email']; + } + if (isset($name['uri'])) { + if (empty($name['uri']) || !is_string($name['uri']) || !Zend_Uri::check($name['uri'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); + } + $author['uri'] = $name['uri']; + } + } else { + if (empty($name['name']) || !is_string($name['name'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string value'); + } + $author['name'] = $name; + if (isset($email)) { + if (empty($email) || !is_string($email)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "email" value must be a non-empty string'); + } + $author['email'] = $email; + } + if (isset($uri)) { + if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); + } + $author['uri'] = $uri; + } + } + $this->_data['authors'][] = $author; + } + + /** + * Set an array with feed authors + * + * @return array + */ + public function addAuthors(array $authors) + { + foreach($authors as $author) { + $this->addAuthor($author); + } + } + + /** + * Set the feed character encoding + * + * @return string|null + */ + public function setEncoding($encoding) + { + if (empty($encoding) || !is_string($encoding)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + } + $this->_data['encoding'] = $encoding; + } + + /** + * Get the feed character encoding + * + * @return string|null + */ + public function getEncoding() + { + if (!array_key_exists('encoding', $this->_data)) { + return 'UTF-8'; + } + return $this->_data['encoding']; + } + + /** + * Set the copyright entry + * + * @return string|null + */ + public function setCopyright($copyright) + { + if (empty($copyright) || !is_string($copyright)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + } + $this->_data['copyright'] = $copyright; + } + + /** + * Set the entry's content + * + * @return string|null + */ + public function setContent($content) + { + if (empty($content) || !is_string($content)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + } + $this->_data['content'] = $content; + } + + /** + * Set the feed creation date + * + * @return string|null + */ + public function setDateCreated($date = null) + { + $zdate = null; + if (is_null($date)) { + $zdate = new Zend_Date; + } elseif (ctype_digit($date) && strlen($date) == 10) { + $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); + } elseif ($date instanceof Zend_Date) { + $zdate = $date; + } else { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + } + $this->_data['dateCreated'] = $zdate; + } + + /** + * Set the feed modification date + * + * @return string|null + */ + public function setDateModified($date = null) + { + $zdate = null; + if (is_null($date)) { + $zdate = new Zend_Date; + } elseif (ctype_digit($date) && strlen($date) == 10) { + $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); + } elseif ($date instanceof Zend_Date) { + $zdate = $date; + } else { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + } + $this->_data['dateModified'] = $zdate; + } + + /** + * Set the feed description + * + * @return string|null + */ + public function setDescription($description) + { + if (empty($description) || !is_string($description)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + } + $this->_data['description'] = $description; + } + + /** + * Set the feed ID + * + * @return string|null + */ + public function setId($id) + { + if (empty($id) || !is_string($id)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + } + $this->_data['id'] = $id; + } + + /** + * Set a link to the HTML source of this entry + * + * @return string|null + */ + public function setLink($link) + { + if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + } + $this->_data['link'] = $link; + } + + /** + * Set the number of comments associated with this entry + * + * @return string|null + */ + public function setCommentCount($count) + { + if (empty($count) || !is_numeric($count) || (int) $count < 0) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "count" must be a non-empty integer number'); + } + $this->_data['commentCount'] = (int) $count; + } + + /** + * Set a link to a HTML page containing comments associated with this entry + * + * @return string|null + */ + public function setCommentLink($link) + { + if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); + } + $this->_data['commentLink'] = $link; + } + + /** + * Set a link to an XML feed for any comments associated with this entry + * + * @return string|null + */ + public function setCommentFeedLink(array $link) + { + if (!isset($link['uri']) || !is_string($link['uri']) || !Zend_Uri::check($link['uri'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); + } + if (!isset($link['type']) || !in_array($link['type'], array('atom', 'rss', 'rdf'))) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "type" must be one' + . ' of "atom", "rss" or "rdf"'); + } + if (!isset($this->_data['commentFeedLinks'])) { + $this->_data['commentFeedLinks'] = array(); + } + $this->_data['commentFeedLinks'][] = $link; + } + + /** + * Set a links to an XML feed for any comments associated with this entry. + * Each link is an array with keys "uri" and "type", where type is one of: + * "atom", "rss" or "rdf". + * + * @return string|null + */ + public function setCommentFeedLinks(array $links) + { + foreach ($links as $link) { + $this->setCommentFeedLink($link); + } + } + + /** + * Set the feed title + * + * @return string|null + */ + public function setTitle($title) + { + if (empty($title) || !is_string($title)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + } + $this->_data['title'] = $title; + } + + /** + * Get an array with feed authors + * + * @return array + */ + public function getAuthors() + { + if (!array_key_exists('authors', $this->_data)) { + return null; + } + return $this->_data['authors']; + } + + /** + * Get the entry content + * + * @return string + */ + public function getContent() + { + if (!array_key_exists('content', $this->_data)) { + return null; + } + return $this->_data['content']; + } + + /** + * Get the entry copyright information + * + * @return string + */ + public function getCopyright() + { + if (!array_key_exists('copyright', $this->_data)) { + return null; + } + return $this->_data['copyright']; + } + + /** + * Get the entry creation date + * + * @return string + */ + public function getDateCreated() + { + if (!array_key_exists('dateCreated', $this->_data)) { + return null; + } + return $this->_data['dateCreated']; + } + + /** + * Get the entry modification date + * + * @return string + */ + public function getDateModified() + { + if (!array_key_exists('dateModified', $this->_data)) { + return null; + } + return $this->_data['dateModified']; + } + + /** + * Get the entry description + * + * @return string + */ + public function getDescription() + { + if (!array_key_exists('description', $this->_data)) { + return null; + } + return $this->_data['description']; + } + + /** + * Get the entry ID + * + * @return string + */ + public function getId() + { + if (!array_key_exists('id', $this->_data)) { + return null; + } + return $this->_data['id']; + } + + /** + * Get a link to the HTML source + * + * @return string|null + */ + public function getLink() + { + if (!array_key_exists('link', $this->_data)) { + return null; + } + return $this->_data['link']; + } + + + /** + * Get all links + * + * @return array + */ + public function getLinks() + { + if (!array_key_exists('links', $this->_data)) { + return null; + } + return $this->_data['links']; + } + + /** + * Get the entry title + * + * @return string + */ + public function getTitle() + { + if (!array_key_exists('title', $this->_data)) { + return null; + } + return $this->_data['title']; + } + + /** + * Get the number of comments/replies for current entry + * + * @return integer + */ + public function getCommentCount() + { + if (!array_key_exists('commentCount', $this->_data)) { + return null; + } + return $this->_data['commentCount']; + } + + /** + * Returns a URI pointing to the HTML page where comments can be made on this entry + * + * @return string + */ + public function getCommentLink() + { + if (!array_key_exists('commentLink', $this->_data)) { + return null; + } + return $this->_data['commentLink']; + } + + /** + * Returns an array of URIs pointing to a feed of all comments for this entry + * where the array keys indicate the feed type (atom, rss or rdf). + * + * @return string + */ + public function getCommentFeedLinks() + { + if (!array_key_exists('commentFeedLinks', $this->_data)) { + return null; + } + return $this->_data['commentFeedLinks']; + } + + /** + * Adds an enclosure to the entry. + * + * @param array $enclosures + */ + public function setEnclosure(array $enclosure) + { + if (!isset($enclosure['type'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Enclosure "type" is not set'); + } + if (!isset($enclosure['length'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Enclosure "length" is not set'); + } + if (!isset($enclosure['uri'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Enclosure "uri" is not set'); + } + if (!Zend_Uri::check($enclosure['uri'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Enclosure "uri" is not a valid URI/IRI'); + } + if ((int) $enclosure['length'] <= 0) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Enclosure "length" must be an integer' + . ' indicating the content\'s length in bytes'); + } + $this->_data['enclosure'] = $enclosure; + } + + /** + * Retrieve an array of all enclosures to be added to entry. + * + * @return array + */ + public function getEnclosure() + { + if (!array_key_exists('enclosure', $this->_data)) { + return null; + } + return $this->_data['enclosure']; + } + + /** + * Unset a specific data point + * + * @param string $name + */ + public function remove($name) + { + if (isset($this->_data[$name])) { + unset($this->_data[$name]); + } + } + + /** + * Get registered extensions + * + * @return array + */ + public function getExtensions() + { + return $this->_extensions; + } + + /** + * Return an Extension object with the matching name (postfixed with _Entry) + * + * @param string $name + * @return object + */ + public function getExtension($name) + { + if (array_key_exists($name . '_Entry', $this->_extensions)) { + return $this->_extensions[$name . '_Entry']; + } + return null; + } + + /** + * Set the current feed type being exported to "rss" or "atom". This allows + * other objects to gracefully choose whether to execute or not, depending + * on their appropriateness for the current type, e.g. renderers. + * + * @param string $type + */ + public function setType($type) + { + $this->_type = $type; + } + + /** + * Retrieve the current or last feed type exported. + * + * @return string Value will be "rss" or "atom" + */ + public function getType() + { + return $this->_type; + } + + /** + * Method overloading: call given method on first extension implementing it + * + * @param string $method + * @param array $args + * @return mixed + * @throws Zend_Feed_Exception if no extensions implements the method + */ + public function __call($method, $args) + { + foreach ($this->_extensions as $extension) { + try { + return call_user_func_array(array($extension, $method), $args); + } catch (Zend_Feed_Writer_Exception_InvalidMethodException $e) { + } + } + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Method: ' . $method + . ' does not exist and could not be located on a registered Extension'); + } + + /** + * Load extensions from Zend_Feed_Writer + * + * @return void + */ + protected function _loadExtensions() + { + $all = Zend_Feed_Writer::getExtensions(); + $exts = $all['entry']; + foreach ($exts as $ext) { + $className = Zend_Feed_Writer::getPluginLoader()->getClassName($ext); + $this->_extensions[$ext] = new $className(); + $this->_extensions[$ext]->setEncoding($this->getEncoding()); + } + } + +} diff --git a/src/Writer/Exception/InvalidMethodException.php b/src/Writer/Exception/InvalidMethodException.php new file mode 100644 index 00000000..576e0c0d --- /dev/null +++ b/src/Writer/Exception/InvalidMethodException.php @@ -0,0 +1,41 @@ +getType()) == 'atom') { + return; + } + $this->_appendNamespaces(); + $this->_setFeedLinks($this->_dom, $this->_base); + $this->_setHubs($this->_dom, $this->_base); + } + + protected function _appendNamespaces() + { + $this->getRootElement()->setAttribute('xmlns:atom', + 'http://www.w3.org/2005/Atom'); + } + + protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) + { + $flinks = $this->getDataContainer()->getFeedLinks(); + if(!$flinks || empty($flinks)) { + return; + } + foreach ($flinks as $type => $href) { + $mime = 'application/' . strtolower($type) . '+xml'; + $flink = $dom->createElement('atom:link'); + $root->appendChild($flink); + $flink->setAttribute('rel', 'self'); + $flink->setAttribute('type', $mime); + $flink->setAttribute('href', $href); + } + } + + protected function _setHubs(DOMDocument $dom, DOMElement $root) + { + $hubs = $this->getDataContainer()->getHubs(); + if (!$hubs || empty($hubs)) { + return; + } + foreach ($hubs as $hubUrl) { + $hub = $dom->createElement('atom:link'); + $hub->setAttribute('rel', 'hub'); + $hub->setAttribute('href', $hubUrl); + $root->appendChild($hub); + } + } + +} diff --git a/src/Writer/Extension/Content/Renderer/Entry.php b/src/Writer/Extension/Content/Renderer/Entry.php new file mode 100644 index 00000000..24af995b --- /dev/null +++ b/src/Writer/Extension/Content/Renderer/Entry.php @@ -0,0 +1,67 @@ +getType()) == 'atom') { + return; + } + $this->_appendNamespaces(); + $this->_setContent($this->_dom, $this->_base); + } + + protected function _appendNamespaces() + { + $this->getRootElement()->setAttribute('xmlns:content', + 'http://purl.org/rss/1.0/modules/content/'); + } + + protected function _setContent(DOMDocument $dom, DOMElement $root) + { + $content = $this->getDataContainer()->getContent(); + if (!$content) { + return; + } + $element = $dom->createElement('content:encoded'); + $root->appendChild($element); + $element->nodeValue = htmlentities( + $this->getDataContainer()->getContent(), + ENT_QUOTES, + $this->getDataContainer()->getEncoding() + ); + } + +} diff --git a/src/Writer/Extension/DublinCore/Renderer/Entry.php b/src/Writer/Extension/DublinCore/Renderer/Entry.php new file mode 100644 index 00000000..447b51a0 --- /dev/null +++ b/src/Writer/Extension/DublinCore/Renderer/Entry.php @@ -0,0 +1,67 @@ +getType()) == 'atom') { + return; + } + $this->_appendNamespaces(); + $this->_setAuthors($this->_dom, $this->_base); + } + + protected function _appendNamespaces() + { + $this->getRootElement()->setAttribute('xmlns:dc', + 'http://purl.org/dc/elements/1.1/'); + } + + protected function _setAuthors(DOMDocument $dom, DOMElement $root) + { + $authors = $this->getDataContainer()->getAuthors(); + if (!$authors || empty($authors)) { + return; + } + foreach ($authors as $data) { + $author = $this->_dom->createElement('dc:creator'); + if (array_key_exists('name', $data)) { + $author->nodeValue = $data['name']; + $root->appendChild($author); + } + } + } + +} diff --git a/src/Writer/Extension/DublinCore/Renderer/Feed.php b/src/Writer/Extension/DublinCore/Renderer/Feed.php new file mode 100644 index 00000000..0d2126e1 --- /dev/null +++ b/src/Writer/Extension/DublinCore/Renderer/Feed.php @@ -0,0 +1,67 @@ +getType()) == 'atom') { + return; + } + $this->_appendNamespaces(); + $this->_setAuthors($this->_dom, $this->_base); + } + + protected function _appendNamespaces() + { + $this->getRootElement()->setAttribute('xmlns:dc', + 'http://purl.org/dc/elements/1.1/'); + } + + protected function _setAuthors(DOMDocument $dom, DOMElement $root) + { + $authors = $this->getDataContainer()->getAuthors(); + if (!$authors || empty($authors)) { + return; + } + foreach ($authors as $data) { + $author = $this->_dom->createElement('dc:creator'); + if (array_key_exists('name', $data)) { + $author->nodeValue = $data['name']; + $root->appendChild($author); + } + } + } + +} diff --git a/src/Writer/Extension/ITunes/Entry.php b/src/Writer/Extension/ITunes/Entry.php new file mode 100644 index 00000000..7c24140d --- /dev/null +++ b/src/Writer/Extension/ITunes/Entry.php @@ -0,0 +1,171 @@ +_encoding = $enc; + } + + public function getEncoding() + { + return $this->_encoding; + } + + /** + * Set a block value of "yes" or "no". You may also set an empty string. + * + * @param string + */ + public function setItunesBlock($value) + { + if (!ctype_alpha($value) && strlen($value) > 0) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "block" may only' + . ' contain alphabetic characters'); + } + if (iconv_strlen($value, $this->getEncoding()) > 255) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "block" may only' + . ' contain a maximum of 255 characters'); + } + $this->_data['block'] = $value; + } + + public function addItunesAuthors(array $values) + { + foreach ($values as $value) { + $this->addItunesAuthor($value); + } + } + + public function addItunesAuthor($value) + { + if (iconv_strlen($value, $this->getEncoding()) > 255) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: any "author" may only' + . ' contain a maximum of 255 characters each'); + } + if (!isset($this->_data['authors'])) { + $this->_data['authors'] = array(); + } + $this->_data['authors'][] = $value; + } + + public function setItunesDuration($value) + { + $value = (string) $value; + if (!ctype_digit($value) + && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) + && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "duration" may only' + . ' be of a specified [[HH:]MM:]SS format'); + } + $this->_data['duration'] = $value; + } + + public function setItunesExplicit($value) + { + if (!in_array($value, array('yes','no','clean'))) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "explicit" may only' + . ' be one of "yes", "no" or "clean"'); + } + $this->_data['explicit'] = $value; + } + + public function setItunesKeywords(array $value) + { + if (count($value) > 12) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' + . ' contain a maximum of 12 terms'); + } + $concat = implode(',', $value); + if (iconv_strlen($concat, $this->getEncoding()) > 255) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' + . ' have a concatenated length of 255 chars where terms are delimited' + . ' by a comma'); + } + $this->_data['keywords'] = $value; + } + + public function setItunesSubtitle($value) + { + if (iconv_strlen($value, $this->getEncoding()) > 255) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "subtitle" may only' + . ' contain a maximum of 255 characters'); + } + $this->_data['subtitle'] = $value; + } + + public function setItunesSummary($value) + { + if (iconv_strlen($value, $this->getEncoding()) > 4000) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "summary" may only' + . ' contain a maximum of 4000 characters'); + } + $this->_data['summary'] = $value; + } + + public function __call($method, array $params) + { + $point = lcfirst(substr($method, 9)); + if (!method_exists($this, 'setItunes' . ucfirst($point)) + && !method_exists($this, 'addItunes' . ucfirst($point))) { + require_once 'Zend/Feed/Writer/Exception/InvalidMethodException.php'; + throw new Zend_Feed_Writer_Exception_InvalidMethodException( + 'invalid method: ' . $method + ); + } + if (!array_key_exists($point, $this->_data) || empty($this->_data[$point])) { + return null; + } + return $this->_data[$point]; + } + +} diff --git a/src/Writer/Extension/ITunes/Feed.php b/src/Writer/Extension/ITunes/Feed.php new file mode 100644 index 00000000..a63bf80c --- /dev/null +++ b/src/Writer/Extension/ITunes/Feed.php @@ -0,0 +1,255 @@ +_encoding = $enc; + } + + public function getEncoding() + { + return $this->_encoding; + } + + /** + * Set a block value of "yes" or "no". You may also set an empty string. + * + * @param string + */ + public function setItunesBlock($value) + { + if (!ctype_alpha($value) && strlen($value) > 0) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "block" may only' + . ' contain alphabetic characters'); + } + if (iconv_strlen($value, $this->getEncoding()) > 255) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "block" may only' + . ' contain a maximum of 255 characters'); + } + $this->_data['block'] = $value; + } + + public function addItunesAuthors(array $values) + { + foreach ($values as $value) { + $this->addItunesAuthor($value); + } + } + + public function addItunesAuthor($value) + { + if (iconv_strlen($value, $this->getEncoding()) > 255) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: any "author" may only' + . ' contain a maximum of 255 characters each'); + } + if (!isset($this->_data['authors'])) { + $this->_data['authors'] = array(); + } + $this->_data['authors'][] = $value; + } + + public function setItunesCategories(array $values) + { + if (!isset($this->_data['categories'])) { + $this->_data['categories'] = array(); + } + foreach ($values as $key=>$value) { + if (!is_array($value)) { + if (iconv_strlen($value, $this->getEncoding()) > 255) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: any "category" may only' + . ' contain a maximum of 255 characters each'); + } + $this->_data['categories'][] = $value; + } else { + if (iconv_strlen($key, $this->getEncoding()) > 255) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: any "category" may only' + . ' contain a maximum of 255 characters each'); + } + $this->_data['categories'][$key] = array(); + foreach ($value as $val) { + if (iconv_strlen($val, $this->getEncoding()) > 255) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: any "category" may only' + . ' contain a maximum of 255 characters each'); + } + $this->_data['categories'][$key][] = $val; + } + } + } + } + + public function setItunesImage($value) + { + if (!Zend_Uri::check($value)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "image" may only' + . ' be a valid URI/IRI'); + } + if (!in_array(substr($value, -3), array('jpg','png'))) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "image" may only' + . ' use file extension "jpg" or "png" which must be the last three' + . ' characters of the URI (i.e. no query string or fragment)'); + } + $this->_data['image'] = $value; + } + + public function setItunesDuration($value) + { + $value = (string) $value; + if (!ctype_digit($value) + && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) + && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "duration" may only' + . ' be of a specified [[HH:]MM:]SS format'); + } + $this->_data['duration'] = $value; + } + + public function setItunesExplicit($value) + { + if (!in_array($value, array('yes','no','clean'))) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "explicit" may only' + . ' be one of "yes", "no" or "clean"'); + } + $this->_data['explicit'] = $value; + } + + public function setItunesKeywords(array $value) + { + if (count($value) > 12) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' + . ' contain a maximum of 12 terms'); + } + $concat = implode(',', $value); + if (iconv_strlen($concat, $this->getEncoding()) > 255) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' + . ' have a concatenated length of 255 chars where terms are delimited' + . ' by a comma'); + } + $this->_data['keywords'] = $value; + } + + public function setItunesNewFeedUrl($value) + { + if (!Zend_Uri::check($value)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "newFeedUrl" may only' + . ' be a valid URI/IRI'); + } + $this->_data['newFeedUrl'] = $value; + } + + public function addItunesOwners(array $values) + { + foreach ($values as $value) { + $this->addItunesOwner($value); + } + } + + public function addItunesOwner(array $value) + { + if (!isset($value['name']) || !isset($value['email'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: any "owner" must' + . ' be an array containing keys "name" and "email"'); + } + if (iconv_strlen($value['name'], $this->getEncoding()) > 255 + || iconv_strlen($value['email'], $this->getEncoding()) > 255) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: any "owner" may only' + . ' contain a maximum of 255 characters each for "name" and "email"'); + } + if (!isset($this->_data['owners'])) { + $this->_data['owners'] = array(); + } + $this->_data['owners'][] = $value; + } + + public function setItunesSubtitle($value) + { + if (iconv_strlen($value, $this->getEncoding()) > 255) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "subtitle" may only' + . ' contain a maximum of 255 characters'); + } + $this->_data['subtitle'] = $value; + } + + public function setItunesSummary($value) + { + if (iconv_strlen($value, $this->getEncoding()) > 4000) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "summary" may only' + . ' contain a maximum of 4000 characters'); + } + $this->_data['summary'] = $value; + } + + public function __call($method, array $params) + { + $point = lcfirst(substr($method, 9)); + if (!method_exists($this, 'setItunes' . ucfirst($point)) + && !method_exists($this, 'addItunes' . ucfirst($point))) { + require_once 'Zend/Feed/Writer/Exception/InvalidMethodException.php'; + throw new Zend_Feed_Writer_Exception_InvalidMethodException( + 'invalid method: ' . $method + ); + } + if (!array_key_exists($point, $this->_data) || empty($this->_data[$point])) { + return null; + } + return $this->_data[$point]; + } + +} diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php new file mode 100644 index 00000000..219f001f --- /dev/null +++ b/src/Writer/Extension/ITunes/Renderer/Entry.php @@ -0,0 +1,142 @@ +_appendNamespaces(); + $this->_setAuthors($this->_dom, $this->_base); + $this->_setBlock($this->_dom, $this->_base); + $this->_setDuration($this->_dom, $this->_base); + $this->_setExplicit($this->_dom, $this->_base); + $this->_setKeywords($this->_dom, $this->_base); + $this->_setSubtitle($this->_dom, $this->_base); + $this->_setSummary($this->_dom, $this->_base); + } + + protected function _appendNamespaces() + { + $this->getRootElement()->setAttribute('xmlns:itunes', + 'http://www.itunes.com/dtds/podcast-1.0.dtd'); + } + + protected function _setAuthors(DOMDocument $dom, DOMElement $root) + { + $authors = $this->getDataContainer()->getItunesAuthors(); + if (!$authors || empty($authors)) { + return; + } + foreach ($authors as $author) { + $el = $dom->createElement('itunes:author'); + $el->nodeValue = Zend_Feed_Writer::xmlentities( + $author, $this->getEncoding() + ); + $root->appendChild($el); + } + } + + protected function _setBlock(DOMDocument $dom, DOMElement $root) + { + $block = $this->getDataContainer()->getItunesBlock(); + if (is_null($block)) { + return; + } + $el = $dom->createElement('itunes:block'); + $el->nodeValue = $block; + $root->appendChild($el); + } + + protected function _setDuration(DOMDocument $dom, DOMElement $root) + { + $duration = $this->getDataContainer()->getItunesDuration(); + if (!$duration) { + return; + } + $el = $dom->createElement('itunes:duration'); + $el->nodeValue = $duration; + $root->appendChild($el); + } + + protected function _setExplicit(DOMDocument $dom, DOMElement $root) + { + $explicit = $this->getDataContainer()->getItunesExplicit(); + if (is_null($explicit)) { + return; + } + $el = $dom->createElement('itunes:explicit'); + $el->nodeValue = $explicit; + $root->appendChild($el); + } + + protected function _setKeywords(DOMDocument $dom, DOMElement $root) + { + $keywords = $this->getDataContainer()->getItunesKeywords(); + if (!$keywords || empty($keywords)) { + return; + } + $el = $dom->createElement('itunes:keywords'); + $el->nodeValue = Zend_Feed_Writer::xmlentities( + implode(',', $keywords), $this->getEncoding() + ); + $root->appendChild($el); + } + + protected function _setSubtitle(DOMDocument $dom, DOMElement $root) + { + $subtitle = $this->getDataContainer()->getItunesSubtitle(); + if (!$subtitle) { + return; + } + $el = $dom->createElement('itunes:subtitle'); + $el->nodeValue = Zend_Feed_Writer::xmlentities( + $subtitle, $this->getEncoding() + ); + $root->appendChild($el); + } + + protected function _setSummary(DOMDocument $dom, DOMElement $root) + { + $summary = $this->getDataContainer()->getItunesSummary(); + if (!$summary) { + return; + } + $el = $dom->createElement('itunes:summary'); + $el->nodeValue = Zend_Feed_Writer::xmlentities( + $summary, $this->getEncoding() + ); + $root->appendChild($el); + } + +} diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php new file mode 100644 index 00000000..28843c19 --- /dev/null +++ b/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -0,0 +1,222 @@ +_appendNamespaces(); + $this->_setAuthors($this->_dom, $this->_base); + $this->_setBlock($this->_dom, $this->_base); + $this->_setCategories($this->_dom, $this->_base); + $this->_setImage($this->_dom, $this->_base); + $this->_setDuration($this->_dom, $this->_base); + $this->_setExplicit($this->_dom, $this->_base); + $this->_setKeywords($this->_dom, $this->_base); + $this->_setNewFeedUrl($this->_dom, $this->_base); + $this->_setOwners($this->_dom, $this->_base); + $this->_setSubtitle($this->_dom, $this->_base); + $this->_setSummary($this->_dom, $this->_base); + } + + protected function _appendNamespaces() + { + $this->getRootElement()->setAttribute('xmlns:itunes', + 'http://www.itunes.com/dtds/podcast-1.0.dtd'); + } + + protected function _setAuthors(DOMDocument $dom, DOMElement $root) + { + $authors = $this->getDataContainer()->getItunesAuthors(); + if (!$authors || empty($authors)) { + return; + } + foreach ($authors as $author) { + $el = $dom->createElement('itunes:author'); + $el->nodeValue = Zend_Feed_Writer::xmlentities( + $author, $this->getEncoding() + ); + $root->appendChild($el); + } + } + + protected function _setBlock(DOMDocument $dom, DOMElement $root) + { + $block = $this->getDataContainer()->getItunesBlock(); + if (is_null($block)) { + return; + } + $el = $dom->createElement('itunes:block'); + $el->nodeValue = $block; + $root->appendChild($el); + } + + protected function _setCategories(DOMDocument $dom, DOMElement $root) + { + $cats = $this->getDataContainer()->getItunesCategories(); + if (!$cats || empty($cats)) { + return; + } + foreach ($cats as $key=>$cat) { + if (!is_array($cat)) { + $el = $dom->createElement('itunes:category'); + $el->setAttribute('text', Zend_Feed_Writer::xmlentities( + $cat, $this->getEncoding() + )); + $root->appendChild($el); + } else { + $el = $dom->createElement('itunes:category'); + $el->setAttribute('text', Zend_Feed_Writer::xmlentities( + $key, $this->getEncoding() + )); + $root->appendChild($el); + foreach ($cat as $subcat) { + $el2 = $dom->createElement('itunes:category'); + $el2->setAttribute('text', Zend_Feed_Writer::xmlentities( + $subcat, $this->getEncoding() + )); + $el->appendChild($el2); + } + } + } + } + + protected function _setImage(DOMDocument $dom, DOMElement $root) + { + $image = $this->getDataContainer()->getItunesImage(); + if (!$image) { + return; + } + $el = $dom->createElement('itunes:image'); + $el->setAttribute('href', $image); + $root->appendChild($el); + } + + protected function _setDuration(DOMDocument $dom, DOMElement $root) + { + $duration = $this->getDataContainer()->getItunesDuration(); + if (!$duration) { + return; + } + $el = $dom->createElement('itunes:duration'); + $el->nodeValue = $duration; + $root->appendChild($el); + } + + protected function _setExplicit(DOMDocument $dom, DOMElement $root) + { + $explicit = $this->getDataContainer()->getItunesExplicit(); + if (is_null($explicit)) { + return; + } + $el = $dom->createElement('itunes:explicit'); + $el->nodeValue = $explicit; + $root->appendChild($el); + } + + protected function _setKeywords(DOMDocument $dom, DOMElement $root) + { + $keywords = $this->getDataContainer()->getItunesKeywords(); + if (!$keywords || empty($keywords)) { + return; + } + $el = $dom->createElement('itunes:keywords'); + $el->nodeValue = Zend_Feed_Writer::xmlentities( + implode(',', $keywords), $this->getEncoding() + ); + $root->appendChild($el); + } + + protected function _setNewFeedUrl(DOMDocument $dom, DOMElement $root) + { + $url = $this->getDataContainer()->getItunesNewFeedUrl(); + if (!$url) { + return; + } + $el = $dom->createElement('itunes:new-feed-url'); + $el->nodeValue = Zend_Feed_Writer::xmlentities( + $url, $this->getEncoding() + ); + $root->appendChild($el); + } + + protected function _setOwners(DOMDocument $dom, DOMElement $root) + { + $owners = $this->getDataContainer()->getItunesOwners(); + if (!$owners || empty($owners)) { + return; + } + foreach ($owners as $owner) { + $el = $dom->createElement('itunes:owner'); + $name = $dom->createElement('itunes:name'); + $name->nodeValue = Zend_Feed_Writer::xmlentities( + $owner['name'], $this->getEncoding() + ); + $email = $dom->createElement('itunes:email'); + $email->nodeValue = Zend_Feed_Writer::xmlentities( + $owner['email'], $this->getEncoding() + ); + $root->appendChild($el); + $el->appendChild($name); + $el->appendChild($email); + } + } + + protected function _setSubtitle(DOMDocument $dom, DOMElement $root) + { + $subtitle = $this->getDataContainer()->getItunesSubtitle(); + if (!$subtitle) { + return; + } + $el = $dom->createElement('itunes:subtitle'); + $el->nodeValue = Zend_Feed_Writer::xmlentities( + $subtitle, $this->getEncoding() + ); + $root->appendChild($el); + } + + protected function _setSummary(DOMDocument $dom, DOMElement $root) + { + $summary = $this->getDataContainer()->getItunesSummary(); + if (!$summary) { + return; + } + $el = $dom->createElement('itunes:summary'); + $el->nodeValue = Zend_Feed_Writer::xmlentities( + $summary, $this->getEncoding() + ); + $root->appendChild($el); + } + +} diff --git a/src/Writer/Extension/RendererAbstract.php b/src/Writer/Extension/RendererAbstract.php new file mode 100644 index 00000000..be0e03ae --- /dev/null +++ b/src/Writer/Extension/RendererAbstract.php @@ -0,0 +1,103 @@ +_container = $container; + } + + public function setEncoding($enc) + { + $this->_encoding = $enc; + } + + public function getEncoding() + { + return $this->_encoding; + } + + public function setDomDocument(DOMDocument $dom, DOMElement $base) + { + $this->_dom = $dom; + $this->_base = $base; + } + + public function getDataContainer() + { + return $this->_container; + } + + public function setType($type) + { + $this->_type = $type; + } + + public function getType() + { + return $this->_type; + } + + public function setRootElement(DOMElement $root) + { + $this->_rootElement = $root; + } + + public function getRootElement() + { + return $this->_rootElement; + } + + abstract protected function _appendNamespaces(); + +} diff --git a/src/Writer/Extension/RendererInterface.php b/src/Writer/Extension/RendererInterface.php new file mode 100644 index 00000000..1fe2e8b0 --- /dev/null +++ b/src/Writer/Extension/RendererInterface.php @@ -0,0 +1,38 @@ +getType()) == 'atom') { + return; // RSS 2.0 only + } + $this->_appendNamespaces(); + $this->_setCommentCount($this->_dom, $this->_base); + } + + protected function _appendNamespaces() + { + $this->getRootElement()->setAttribute('xmlns:slash', + 'http://purl.org/rss/1.0/modules/slash/'); + } + + protected function _setCommentCount(DOMDocument $dom, DOMElement $root) + { + $count = $this->getDataContainer()->getCommentCount(); + if (!$count) { + $count = 0; + } + $tcount = $this->_dom->createElement('slash:comments'); + $tcount->nodeValue = $count; + $root->appendChild($tcount); + } + +} diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php new file mode 100644 index 00000000..98e003af --- /dev/null +++ b/src/Writer/Extension/Threading/Renderer/Entry.php @@ -0,0 +1,103 @@ +getType()) == 'rss') { + return; // Atom 1.0 only + } + $this->_appendNamespaces(); + $this->_setCommentLink($this->_dom, $this->_base); + $this->_setCommentFeedLinks($this->_dom, $this->_base); + $this->_setCommentCount($this->_dom, $this->_base); + } + + protected function _appendNamespaces() + { + $this->getRootElement()->setAttribute('xmlns:thr', + 'http://purl.org/syndication/thread/1.0'); + } + + protected function _setCommentLink(DOMDocument $dom, DOMElement $root) + { + $link = $this->getDataContainer()->getCommentLink(); + if (!$link) { + return; + } + $clink = $this->_dom->createElement('link'); + $clink->setAttribute('rel', 'replies'); + $clink->setAttribute('type', 'text/html'); + $clink->setAttribute('href', $link); + $count = $this->getDataContainer()->getCommentCount(); + if (!$count) { + $count = 0; + } + $clink->setAttribute('thr:count', $count); + $root->appendChild($clink); + } + + protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) + { + $links = $this->getDataContainer()->getCommentFeedLinks(); + if (!$links || empty($links)) { + return; + } + foreach ($links as $link) { + $flink = $this->_dom->createElement('link'); + $flink->setAttribute('rel', 'replies'); + $flink->setAttribute('type', 'application/'. $link['type'] .'+xml'); + $flink->setAttribute('href', $link['uri']); + $count = $this->getDataContainer()->getCommentCount(); + if (!$count) { + $count = 0; + } + $flink->setAttribute('thr:count', $count); + $root->appendChild($flink); + } + } + + protected function _setCommentCount(DOMDocument $dom, DOMElement $root) + { + $count = $this->getDataContainer()->getCommentCount(); + if (!$count) { + $count = 0; + } + $tcount = $this->_dom->createElement('thr:total'); + $tcount->nodeValue = $count; + $root->appendChild($tcount); + } + +} diff --git a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php new file mode 100644 index 00000000..00e9eac2 --- /dev/null +++ b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php @@ -0,0 +1,67 @@ +getType()) == 'atom') { + return; // RSS 2.0 only + } + $this->_appendNamespaces(); + $this->_setCommentFeedLinks($this->_dom, $this->_base); + } + + protected function _appendNamespaces() + { + $this->getRootElement()->setAttribute('xmlns:wfw', + 'http://wellformedweb.org/CommentAPI/'); + } + + protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) + { + $links = $this->getDataContainer()->getCommentFeedLinks(); + if (!$links || empty($links)) { + return; + } + foreach ($links as $link) { + if ($link['type'] == 'rss') { + $flink = $this->_dom->createElement('wfw:commentRss'); + $flink->nodeValue = $link['uri']; + $root->appendChild($flink); + } + } + } + +} diff --git a/src/Writer/Feed.php b/src/Writer/Feed.php new file mode 100644 index 00000000..dd511c8f --- /dev/null +++ b/src/Writer/Feed.php @@ -0,0 +1,900 @@ +_loadExtensions(); + } + + /** + * Set a single author + * + * @param int $index + * @return string|null + */ + public function addAuthor($name, $email = null, $uri = null) + { + $author = array(); + if (is_array($name)) { + if (!array_key_exists('name', $name) || empty($name['name']) || !is_string($name['name'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); + } + $author['name'] = $name['name']; + if (isset($name['email'])) { + if (empty($name['email']) || !is_string($name['email'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); + } + $author['email'] = $name['email']; + } + if (isset($name['uri'])) { + if (empty($name['uri']) || !is_string($name['uri']) || !Zend_Uri::check($name['uri'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); + } + $author['uri'] = $name['uri']; + } + } else { + if (empty($name['name']) || !is_string($name['name'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string value'); + } + $author['name'] = $name; + if (isset($email)) { + if (empty($email) || !is_string($email)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "email" value must be a non-empty string'); + } + $author['email'] = $email; + } + if (isset($uri)) { + if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); + } + $author['uri'] = $uri; + } + } + $this->_data['authors'][] = $author; + } + + /** + * Set an array with feed authors + * + * @return array + */ + public function addAuthors(array $authors) + { + foreach($authors as $author) { + $this->addAuthor($author); + } + } + + /** + * Set the copyright entry + * + * @return string|null + */ + public function setCopyright($copyright) + { + if (empty($copyright) || !is_string($copyright)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + } + $this->_data['copyright'] = $copyright; + } + + /** + * Set the feed creation date + * + * @param null|integer|Zend_Date + */ + public function setDateCreated($date = null) + { + $zdate = null; + if (is_null($date)) { + $zdate = new Zend_Date; + } elseif (ctype_digit($date) && strlen($date) == 10) { + $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); + } elseif ($date instanceof Zend_Date) { + $zdate = $date; + } else { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + } + $this->_data['dateCreated'] = $zdate; + } + + /** + * Set the feed modification date + * + * @param null|integer|Zend_Date + */ + public function setDateModified($date = null) + { + $zdate = null; + if (is_null($date)) { + $zdate = new Zend_Date; + } elseif (ctype_digit($date) && strlen($date) == 10) { + $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); + } elseif ($date instanceof Zend_Date) { + $zdate = $date; + } else { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + } + $this->_data['dateModified'] = $zdate; + } + + /** + * Set the feed description + * + * @return string|null + */ + public function setDescription($description) + { + if (empty($description) || !is_string($description)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + } + $this->_data['description'] = $description; + } + + /** + * Set the feed generator entry + * + * @return string|null + */ + public function setGenerator($name, $version = null, $uri = null) + { + if (empty($name) || !is_string($name)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string'); + } + $generator = array('name' => $name); + if (isset($version)) { + if (empty($version) || !is_string($version)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "version" must be a non-empty string'); + } + $generator['version'] = $version; + } + if (isset($uri)) { + if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); + } + $generator['uri'] = $uri; + } + $this->_data['generator'] = $generator; + } + + /** + * Set the feed ID - URI or URN (via PCRE pattern) supported + * + * @return string|null + */ + public function setId($id) + { + if ((empty($id) || !is_string($id) || !Zend_Uri::check($id)) && + !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + } + $this->_data['id'] = $id; + } + + /** + * Set the feed language + * + * @return string|null + */ + public function setLanguage($language) + { + if (empty($language) || !is_string($language)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + } + $this->_data['language'] = $language; + } + + /** + * Set a link to the HTML source + * + * @return string|null + */ + public function setLink($link) + { + if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + } + $this->_data['link'] = $link; + } + + /** + * Set a link to an XML feed for any feed type/version + * + * @return string|null + */ + public function setFeedLink($link, $type) + { + if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "link"" must be a non-empty string and valid URI/IRI'); + } + if (!in_array(strtolower($type), array('rss', 'rdf', 'atom'))) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom'); + } + $this->_data['feedLinks'][strtolower($type)] = $link; + } + + /** + * Set the feed title + * + * @return string|null + */ + public function setTitle($title) + { + if (empty($title) || !is_string($title)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + } + $this->_data['title'] = $title; + } + + /** + * Set the feed character encoding + * + * @param string $encoding + */ + public function setEncoding($encoding) + { + if (empty($encoding) || !is_string($encoding)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + } + $this->_data['encoding'] = $encoding; + } + + /** + * Set the feed's base URL + * + * @param string $url + */ + public function setBaseUrl($url) + { + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "url" array value' + . ' must be a non-empty string and valid URI/IRI'); + } + $this->_data['baseUrl'] = $url; + } + + /** + * Add a Pubsubhubbub hub endpoint URL + * + * @param string $url + */ + public function addHub($url) + { + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "url" array value' + . ' must be a non-empty string and valid URI/IRI'); + } + if (!isset($this->_data['hubs'])) { + $this->_data['hubs'] = array(); + } + $this->_data['hubs'][] = $url; + } + + /** + * Add Pubsubhubbub hub endpoint URLs + * + * @param array $urls + */ + public function addHubs(array $urls) + { + foreach ($urls as $url) { + $this->addHub($url); + } + } + + /** + * Add a feed category + * + * @param string $category + */ + public function addCategory(array $category) + { + if (!isset($category['term'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Each category must be an array and ' + . 'contain at least a "term" element containing the machine ' + . ' readable category name'); + } + if (isset($category['scheme'])) { + if (empty($category['scheme']) || !is_string($category['scheme']) + || !Zend_Uri::check($category['scheme'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('The Atom scheme or RSS domain of' + . ' a category must be a valid URI'); + } + } + if (!isset($this->_data['categories'])) { + $this->_data['categories'] = array(); + } + $this->_data['categories'][] = $category; + } + + /** + * Set an array of feed categories + * + * @param array $categories + */ + public function addCategories(array $categories) + { + foreach ($categories as $category) { + $this->addCategory($category); + } + } + + /** + * Get a single author + * + * @param int $index + * @return string|null + */ + public function getAuthor($index = 0) + { + if (isset($this->_data['authors'][$index])) { + return $this->_data['authors'][$index]; + } else { + return null; + } + } + + /** + * Get an array with feed authors + * + * @return array + */ + public function getAuthors() + { + if (!array_key_exists('authors', $this->_data)) { + return null; + } + return $this->_data['authors']; + } + + /** + * Get the copyright entry + * + * @return string|null + */ + public function getCopyright() + { + if (!array_key_exists('copyright', $this->_data)) { + return null; + } + return $this->_data['copyright']; + } + + /** + * Get the feed creation date + * + * @return string|null + */ + public function getDateCreated() + { + if (!array_key_exists('dateCreated', $this->_data)) { + return null; + } + return $this->_data['dateCreated']; + } + + /** + * Get the feed modification date + * + * @return string|null + */ + public function getDateModified() + { + if (!array_key_exists('dateModified', $this->_data)) { + return null; + } + return $this->_data['dateModified']; + } + + /** + * Get the feed description + * + * @return string|null + */ + public function getDescription() + { + if (!array_key_exists('description', $this->_data)) { + return null; + } + return $this->_data['description']; + } + + /** + * Get the feed generator entry + * + * @return string|null + */ + public function getGenerator() + { + if (!array_key_exists('generator', $this->_data)) { + return null; + } + return $this->_data['generator']; + } + + /** + * Get the feed ID + * + * @return string|null + */ + public function getId() + { + if (!array_key_exists('id', $this->_data)) { + return null; + } + return $this->_data['id']; + } + + /** + * Get the feed language + * + * @return string|null + */ + public function getLanguage() + { + if (!array_key_exists('language', $this->_data)) { + return null; + } + return $this->_data['language']; + } + + /** + * Get a link to the HTML source + * + * @return string|null + */ + public function getLink() + { + if (!array_key_exists('link', $this->_data)) { + return null; + } + return $this->_data['link']; + } + + /** + * Get a link to the XML feed + * + * @return string|null + */ + public function getFeedLinks() + { + if (!array_key_exists('feedLinks', $this->_data)) { + return null; + } + return $this->_data['feedLinks']; + } + + /** + * Get the feed title + * + * @return string|null + */ + public function getTitle() + { + if (!array_key_exists('title', $this->_data)) { + return null; + } + return $this->_data['title']; + } + + /** + * Get the feed character encoding + * + * @return string|null + */ + public function getEncoding() + { + if (!array_key_exists('encoding', $this->_data)) { + return 'UTF-8'; + } + return $this->_data['encoding']; + } + + /** + * Get the feed's base url + * + * @return string|null + */ + public function getBaseUrl() + { + if (!array_key_exists('baseUrl', $this->_data)) { + return null; + } + return $this->_data['baseUrl']; + } + + /** + * Get the URLs used as Pubsubhubbub hubs endpoints + * + * @return string|null + */ + public function getHubs() + { + if (!array_key_exists('hubs', $this->_data)) { + return null; + } + return $this->_data['hubs']; + } + + /** + * Get the feed categories + * + * @return string|null + */ + public function getCategories() + { + if (!array_key_exists('categories', $this->_data)) { + return null; + } + return $this->_data['categories']; + } + + /** + * Resets the instance and deletes all data + * + * @return void + */ + public function reset() + { + $this->_data = array(); + } + + /** + * Creates a new Zend_Feed_Writer_Entry data container for use. This is NOT + * added to the current feed automatically, but is necessary to create a + * container with some initial values preset based on the current feed data. + * + * @return Zend_Feed_Writer_Entry + */ + public function createEntry() + { + $entry = new Zend_Feed_Writer_Entry; + if ($this->getEncoding()) { + $entry->setEncoding($this->getEncoding()); + } + $entry->setType($this->getType()); + return $entry; + } + + /** + * Appends a Zend_Feed_Writer_Entry object representing a new entry/item + * the feed data container's internal group of entries. + * + * @param Zend_Feed_Writer_Entry $entry + */ + public function addEntry(Zend_Feed_Writer_Entry $entry) + { + $this->_entries[] = $entry; + } + + /** + * Removes a specific indexed entry from the internal queue. Entries must be + * added to a feed container in order to be indexed. + * + * @param int $index + */ + public function removeEntry($index) + { + if (isset($this->_entries[$index])) { + unset($this->_entries[$index]); + } + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Undefined index: ' . $index . '. Entry does not exist.'); + } + + /** + * Retrieve a specific indexed entry from the internal queue. Entries must be + * added to a feed container in order to be indexed. + * + * @param int $index + */ + public function getEntry($index = 0) + { + if (isset($this->_entries[$index])) { + return $this->_entries[$index]; + } + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Undefined index: ' . $index . '. Entry does not exist.'); + } + + /** + * Orders all indexed entries by date, thus offering date ordered readable + * content where a parser (or Homo Sapien) ignores the generic rule that + * XML element order is irrelevant and has no intrinsic meaning. + * + * Using this method will alter the original indexation. + * + * @return void + */ + public function orderByDate() + { + /** + * Could do with some improvement for performance perhaps + */ + $timestamp = time(); + $entries = array(); + foreach ($this->_entries as $entry) { + if ($entry->getDateModified()) { + $timestamp = (int) $entry->getDateModified()->get(Zend_Date::TIMESTAMP); + } elseif ($entry->getDateCreated()) { + $timestamp = (int) $entry->getDateCreated()->get(Zend_Date::TIMESTAMP); + } + $entries[$timestamp] = $entry; + } + krsort($entries, SORT_NUMERIC); + $this->_entries = array_values($entries); + } + + /** + * Get the number of feed entries. + * Required by the Iterator interface. + * + * @return int + */ + public function count() + { + return count($this->_entries); + } + + /** + * Return the current entry + * + * @return Zend_Feed_Reader_Entry_Interface + */ + public function current() + { + return $this->_entries[$this->key()]; + } + + /** + * Return the current feed key + * + * @return unknown + */ + public function key() + { + return $this->_entriesKey; + } + + /** + * Move the feed pointer forward + * + * @return void + */ + public function next() + { + ++$this->_entriesKey; + } + + /** + * Reset the pointer in the feed object + * + * @return void + */ + public function rewind() + { + $this->_entriesKey = 0; + } + + /** + * Check to see if the iterator is still valid + * + * @return boolean + */ + public function valid() + { + return 0 <= $this->_entriesKey && $this->_entriesKey < $this->count(); + } + + /** + * Set the current feed type being exported to "rss" or "atom". This allows + * other objects to gracefully choose whether to execute or not, depending + * on their appropriateness for the current type, e.g. renderers. + * + * @param string $type + */ + public function setType($type) + { + $this->_type = $type; + } + + /** + * Retrieve the current or last feed type exported. + * + * @return string Value will be "rss" or "atom" + */ + public function getType() + { + return $this->_type; + } + + /** + * Attempt to build and return the feed resulting from the data set + * + * @param $type The feed type "rss" or "atom" to export as + * @return string + */ + public function export($type, $ignoreExceptions = false) + { + $this->setType(strtolower($type)); + $type = ucfirst($this->getType()); + if ($type !== 'Rss' && $type !== 'Atom') { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid feed type specified: ' . $type . '.' + . ' Should be one of "rss" or "atom".'); + } + $renderClass = 'Zend_Feed_Writer_Renderer_Feed_' . $type; + $renderer = new $renderClass($this); + if ($ignoreExceptions) { + $renderer->ignoreExceptions(); + } + return $renderer->render()->saveXml(); + } + + /** + * Unset a specific data point + * + * @param string $name + */ + public function remove($name) + { + if (isset($this->_data[$name])) { + unset($this->_data[$name]); + } + } + + /** + * Method overloading: call given method on first extension implementing it + * + * @param string $method + * @param array $args + * @return mixed + * @throws Zend_Feed_Exception if no extensions implements the method + */ + public function __call($method, $args) + { + foreach ($this->_extensions as $extension) { + try { + return call_user_func_array(array($extension, $method), $args); + } catch (Zend_Feed_Writer_Exception_InvalidMethodException $e) { + } + } + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Method: ' . $method + . ' does not exist and could not be located on a registered Extension'); + } + + /** + * Load extensions from Zend_Feed_Writer + * + * @return void + */ + protected function _loadExtensions() + { + $all = Zend_Feed_Writer::getExtensions(); + $exts = $all['feed']; + foreach ($exts as $ext) { + $className = Zend_Feed_Writer::getPluginLoader()->getClassName($ext); + $this->_extensions[$ext] = new $className(); + $this->_extensions[$ext]->setEncoding($this->getEncoding()); + } + } + +} diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom.php new file mode 100644 index 00000000..522a8363 --- /dev/null +++ b/src/Writer/Renderer/Entry/Atom.php @@ -0,0 +1,248 @@ +_dom = new DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom->formatOutput = true; + $entry = $this->_dom->createElementNS(Zend_Feed_Writer::NAMESPACE_ATOM_10, 'entry'); + $this->_dom->appendChild($entry); + + $this->_setTitle($this->_dom, $entry); + $this->_setDescription($this->_dom, $entry); + $this->_setDateCreated($this->_dom, $entry); + $this->_setDateModified($this->_dom, $entry); + $this->_setLink($this->_dom, $entry); + $this->_setId($this->_dom, $entry); + $this->_setAuthors($this->_dom, $entry); + $this->_setEnclosure($this->_dom, $entry); + $this->_setContent($this->_dom, $entry); + + foreach ($this->_extensions as $ext) { + $ext->setType($this->getType()); + $ext->setRootElement($this->getRootElement()); + $ext->setDomDocument($this->getDomDocument(), $entry); + $ext->render(); + } + + return $this; + } + + protected function _setTitle(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getTitle()) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Atom 1.0 entry elements MUST contain exactly one' + . ' atom:title element but a title has not been set'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $title = $dom->createElement('title'); + $root->appendChild($title); + $title->setAttribute('type', 'html'); + $cdata = $dom->createCDATASection($this->getDataContainer()->getTitle()); + $title->appendChild($cdata); + } + + protected function _setDescription(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getDescription()) { + return; // unless src content or base64 + } + $subtitle = $dom->createElement('summary'); + $root->appendChild($subtitle); + $subtitle->setAttribute('type', 'html'); + $cdata = $dom->createCDATASection( + $this->getDataContainer()->getDescription() + ); + $subtitle->appendChild($cdata); + } + + protected function _setDateModified(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getDateModified()) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Atom 1.0 entry elements MUST contain exactly one' + . ' atom:updated element but a modification date has not been set'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + + $updated = $dom->createElement('updated'); + $root->appendChild($updated); + $updated->nodeValue = $this->getDataContainer()->getDateModified() + ->get(Zend_Date::ISO_8601); + } + + protected function _setDateCreated(DOMDocument $dom, DOMElement $root) + { + if (!$this->getDataContainer()->getDateCreated()) { + return; + } + $updated = $dom->createElement('published'); + $root->appendChild($updated); + $updated->nodeValue = $this->getDataContainer()->getDateCreated() + ->get(Zend_Date::ISO_8601); + } + + protected function _setAuthors(DOMDocument $dom, DOMElement $root) + { + $authors = $this->_container->getAuthors(); + if ((!$authors || empty($authors))) { + /** + * This will actually trigger an Exception at the feed level if + * a feed level author is not set. + */ + return; + } + foreach ($authors as $data) { + $author = $this->_dom->createElement('author'); + $name = $this->_dom->createElement('name'); + $author->appendChild($name); + $root->appendChild($author); + $name->nodeValue = $data['name']; + if (array_key_exists('email', $data)) { + $email = $this->_dom->createElement('email'); + $author->appendChild($email); + $email->nodeValue = $data['email']; + } + if (array_key_exists('uri', $data)) { + $uri = $this->_dom->createElement('uri'); + $author->appendChild($uri); + $uri->nodeValue = $data['uri']; + } + } + } + + protected function _setEnclosure(DOMDocument $dom, DOMElement $root) + { + $data = $this->_container->getEnclosure(); + if ((!$data || empty($data))) { + return; + } + $enclosure = $this->_dom->createElement('link'); + $enclosure->setAttribute('rel', 'enclosure'); + $enclosure->setAttribute('type', $data['type']); + $enclosure->setAttribute('length', $data['length']); + $enclosure->setAttribute('href', $data['uri']); + $root->appendChild($enclosure); + } + + protected function _setLink(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getLink()) { + return; + } + $link = $dom->createElement('link'); + $root->appendChild($link); + $link->setAttribute('rel', 'alternate'); + $link->setAttribute('type', 'text/html'); + $link->setAttribute('href', $this->getDataContainer()->getLink()); + } + + protected function _setId(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getId() + && !$this->getDataContainer()->getLink()) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Atom 1.0 entry elements MUST contain exactly one ' + . 'atom:id element, or as an alternative, we can use the same ' + . 'value as atom:link however neither a suitable link nor an ' + . 'id have been set'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + + if (!$this->getDataContainer()->getId()) { + $this->getDataContainer()->setId( + $this->getDataContainer()->getLink()); + } + if (!Zend_Uri::check($this->getDataContainer()->getId()) && + !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $this->getDataContainer()->getId())) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Atom 1.0 IDs must be a valid URI/IRI'); + } + $id = $dom->createElement('id'); + $root->appendChild($id); + $id->nodeValue = $this->getDataContainer()->getId(); + } + + protected function _setContent(DOMDocument $dom, DOMElement $root) + { + $content = $this->getDataContainer()->getContent(); + if (!$content && !$this->getDataContainer()->getLink()) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Atom 1.0 entry elements MUST contain exactly one ' + . 'atom:content element, or as an alternative, at least one link ' + . 'with a rel attribute of "alternate" to indicate an alternate ' + . 'method to consume the content.'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $element = $dom->createElement('content'); + $element->setAttribute('type', 'html'); + $cdata = $dom->createCDATASection($content); + $element->appendChild($cdata); + $root->appendChild($element); + } + +} diff --git a/src/Writer/Renderer/Entry/Rss.php b/src/Writer/Renderer/Entry/Rss.php new file mode 100644 index 00000000..e70f8ab7 --- /dev/null +++ b/src/Writer/Renderer/Entry/Rss.php @@ -0,0 +1,214 @@ +_dom = new DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom->formatOutput = true; + $entry = $this->_dom->createElement('item'); + $this->_dom->appendChild($entry); + + $this->_setTitle($this->_dom, $entry); + $this->_setDescription($this->_dom, $entry); + $this->_setDateCreated($this->_dom, $entry); + $this->_setDateModified($this->_dom, $entry); + $this->_setLink($this->_dom, $entry); + $this->_setId($this->_dom, $entry); + $this->_setAuthors($this->_dom, $entry); + $this->_setEnclosure($this->_dom, $entry); + $this->_setCommentLink($this->_dom, $entry); + foreach ($this->_extensions as $ext) { + $ext->setType($this->getType()); + $ext->setRootElement($this->getRootElement()); + $ext->setDomDocument($this->getDomDocument(), $entry); + $ext->render(); + } + + return $this; + } + + protected function _setTitle(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getDescription() + && !$this->getDataContainer()->getTitle()) { + require_once 'Zend/Feed/Exception.php'; + $message = 'RSS 2.0 entry elements SHOULD contain exactly one' + . ' title element but a title has not been set. In addition, there' + . ' is no description as required in the absence of a title.'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $title = $dom->createElement('title'); + $root->appendChild($title); + $title->nodeValue = htmlentities( + $this->getDataContainer()->getTitle(), + ENT_QUOTES, + $this->getDataContainer()->getEncoding() + ); + } + + protected function _setDescription(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getDescription() + && !$this->getDataContainer()->getTitle()) { + require_once 'Zend/Feed/Exception.php'; + $message = 'RSS 2.0 entry elements SHOULD contain exactly one' + . ' description element but a description has not been set. In' + . ' addition, there is no title element as required in the absence' + . ' of a description.'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $subtitle = $dom->createElement('description'); + $root->appendChild($subtitle); + $subtitle->nodeValue = htmlentities( + $this->getDataContainer()->getDescription(), + ENT_QUOTES, + $this->getDataContainer()->getEncoding() + ); + } + + protected function _setDateModified(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getDateModified()) { + return; + } + + $updated = $dom->createElement('pubDate'); + $root->appendChild($updated); + $updated->nodeValue = $this->getDataContainer()->getDateModified() + ->get(Zend_Date::RSS); + } + + protected function _setDateCreated(DOMDocument $dom, DOMElement $root) + { + if (!$this->getDataContainer()->getDateCreated()) { + return; + } + if (!$this->getDataContainer()->getDateModified()) { + $this->getDataContainer()->setDateModified( + $this->getDataContainer()->getDateCreated() + ); + } + } + + protected function _setAuthors(DOMDocument $dom, DOMElement $root) + { + $authors = $this->_container->getAuthors(); + if ((!$authors || empty($authors))) { + return; + } + foreach ($authors as $data) { + $author = $this->_dom->createElement('author'); + $name = $data['name']; + if (array_key_exists('email', $data)) { + $name = $data['email'] . ' (' . $data['name'] . ')'; + } + $author->nodeValue = $name; + $root->appendChild($author); + } + } + + protected function _setEnclosure(DOMDocument $dom, DOMElement $root) + { + $data = $this->_container->getEnclosure(); + if ((!$data || empty($data))) { + return; + } + $enclosure = $this->_dom->createElement('enclosure'); + $enclosure->setAttribute('type', $data['type']); + $enclosure->setAttribute('length', $data['length']); + $enclosure->setAttribute('url', $data['uri']); + $root->appendChild($enclosure); + } + + protected function _setLink(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getLink()) { + return; + } + $link = $dom->createElement('link'); + $root->appendChild($link); + $link->nodeValue = $this->getDataContainer()->getLink(); + } + + protected function _setId(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getId() + && !$this->getDataContainer()->getLink()) { + return; + } + + $id = $dom->createElement('guid'); + $root->appendChild($id); + if (!$this->getDataContainer()->getId()) { + $this->getDataContainer()->setId( + $this->getDataContainer()->getLink()); + } + $id->nodeValue = $this->getDataContainer()->getId(); + if (!Zend_Uri::check($this->getDataContainer()->getId())) { + $id->setAttribute('isPermaLink', 'false'); + } + } + + protected function _setCommentLink(DOMDocument $dom, DOMElement $root) + { + $link = $this->getDataContainer()->getCommentLink(); + if (!$link) { + return; + } + $clink = $this->_dom->createElement('comments'); + $clink->nodeValue = $link; + $root->appendChild($clink); + } + +} diff --git a/src/Writer/Renderer/Feed/Atom.php b/src/Writer/Renderer/Feed/Atom.php new file mode 100644 index 00000000..222c0708 --- /dev/null +++ b/src/Writer/Renderer/Feed/Atom.php @@ -0,0 +1,348 @@ +_container->getEncoding()) { + $this->_container->setEncoding('UTF-8'); + } + $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom->formatOutput = true; + $root = $this->_dom->createElementNS( + Zend_Feed_Writer::NAMESPACE_ATOM_10, 'feed' + ); + $this->setRootElement($root); + $this->_dom->appendChild($root); + $this->_setLanguage($this->_dom, $root); + $this->_setBaseUrl($this->_dom, $root); + $this->_setTitle($this->_dom, $root); + $this->_setDescription($this->_dom, $root); + $this->_setDateCreated($this->_dom, $root); + $this->_setDateModified($this->_dom, $root); + $this->_setGenerator($this->_dom, $root); + $this->_setLink($this->_dom, $root); + $this->_setFeedLinks($this->_dom, $root); + $this->_setId($this->_dom, $root); + $this->_setAuthors($this->_dom, $root); + $this->_setCopyright($this->_dom, $root); + $this->_setCategories($this->_dom, $root); + $this->_setHubs($this->_dom, $root); + + foreach ($this->_extensions as $ext) { + $ext->setType($this->getType()); + $ext->setRootElement($this->getRootElement()); + $ext->setDomDocument($this->getDomDocument(), $root); + $ext->render(); + } + + foreach ($this->_container as $entry) { + if ($this->getDataContainer()->getEncoding()) { + $entry->setEncoding($this->getDataContainer()->getEncoding()); + } + $renderer = new Zend_Feed_Writer_Renderer_Entry_Atom($entry); + if ($this->_ignoreExceptions === true) { + $renderer->ignoreExceptions(); + } + $renderer->setType($this->getType()); + $renderer->setRootElement($this->_dom->documentElement); + $renderer->render(); + $element = $renderer->getElement(); + $imported = $this->_dom->importNode($element, true); + $root->appendChild($imported); + } + return $this; + } + + protected function _setLanguage(DOMDocument $dom, DOMElement $root) + { + if ($this->getDataContainer()->getLanguage()) { + $root->setAttribute('xml:lang', $this->getDataContainer() + ->getLanguage()); + } + } + + protected function _setTitle(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getTitle()) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Atom 1.0 feed elements MUST contain exactly one' + . ' atom:title element but a title has not been set'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + + $title = $dom->createElement('title'); + $root->appendChild($title); + $title->setAttribute('type', 'text'); + $title->nodeValue = $this->getDataContainer()->getTitle(); + } + + protected function _setDescription(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getDescription()) { + return; + } + $subtitle = $dom->createElement('subtitle'); + $root->appendChild($subtitle); + $subtitle->setAttribute('type', 'text'); + $subtitle->nodeValue = $this->getDataContainer()->getDescription(); + } + + protected function _setDateModified(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getDateModified()) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Atom 1.0 feed elements MUST contain exactly one' + . ' atom:updated element but a modification date has not been set'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + + $updated = $dom->createElement('updated'); + $root->appendChild($updated); + $updated->nodeValue = $this->getDataContainer()->getDateModified() + ->get(Zend_Date::ISO_8601); + } + + protected function _setGenerator(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getGenerator()) { + $this->getDataContainer()->setGenerator('Zend_Feed_Writer', + Zend_Version::VERSION, 'http://framework.zend.com'); + } + + $gdata = $this->getDataContainer()->getGenerator(); + $generator = $dom->createElement('generator'); + $root->appendChild($generator); + $generator->nodeValue = $gdata['name']; + if (array_key_exists('uri', $gdata)) { + $generator->setAttribute('uri', $gdata['uri']); + } + if (array_key_exists('version', $gdata)) { + $generator->setAttribute('version', $gdata['version']); + } + } + + protected function _setLink(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getLink()) { + return; + } + $link = $dom->createElement('link'); + $root->appendChild($link); + $link->setAttribute('rel', 'alternate'); + $link->setAttribute('type', 'text/html'); + $link->setAttribute('href', $this->getDataContainer()->getLink()); + } + + protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) + { + $flinks = $this->getDataContainer()->getFeedLinks(); + if(!$flinks || !array_key_exists('atom', $flinks)) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Atom 1.0 feed elements SHOULD contain one atom:link ' + . 'element with a rel attribute value of "self". This is the ' + . 'preferred URI for retrieving Atom Feed Documents representing ' + . 'this Atom feed but a feed link has not been set'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + + foreach ($flinks as $type => $href) { + $mime = 'application/' . strtolower($type) . '+xml'; + $flink = $dom->createElement('link'); + $root->appendChild($flink); + $flink->setAttribute('rel', 'self'); + $flink->setAttribute('type', $mime); + $flink->setAttribute('href', $href); + } + } + + protected function _setAuthors(DOMDocument $dom, DOMElement $root) + { + $authors = $this->_container->getAuthors(); + if (!$authors || empty($authors)) { + /** + * Technically we should defer an exception until we can check + * that all entries contain an author. If any entry is missing + * an author, then a missing feed author element is invalid + */ + return; + } + foreach ($authors as $data) { + $author = $this->_dom->createElement('author'); + $name = $this->_dom->createElement('name'); + $author->appendChild($name); + $root->appendChild($author); + $name->nodeValue = $data['name']; + if (array_key_exists('email', $data)) { + $email = $this->_dom->createElement('email'); + $author->appendChild($email); + $email->nodeValue = $data['email']; + } + if (array_key_exists('uri', $data)) { + $uri = $this->_dom->createElement('uri'); + $author->appendChild($uri); + $uri->nodeValue = $data['uri']; + } + } + } + + protected function _setId(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getId() + && !$this->getDataContainer()->getLink()) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Atom 1.0 feed elements MUST contain exactly one ' + . 'atom:id element, or as an alternative, we can use the same ' + . 'value as atom:link however neither a suitable link nor an ' + . 'id have been set'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + + if (!$this->getDataContainer()->getId()) { + $this->getDataContainer()->setId( + $this->getDataContainer()->getLink()); + } + $id = $dom->createElement('id'); + $root->appendChild($id); + $id->nodeValue = $this->getDataContainer()->getId(); + } + + protected function _setCopyright(DOMDocument $dom, DOMElement $root) + { + $copyright = $this->getDataContainer()->getCopyright(); + if (!$copyright) { + return; + } + $copy = $dom->createElement('rights'); + $root->appendChild($copy); + $copy->nodeValue = $copyright; + } + + protected function _setDateCreated(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getDateCreated()) { + return; + } + if(!$this->getDataContainer()->getDateModified()) { + $this->getDataContainer()->setDateModified( + $this->getDataContainer()->getDateCreated() + ); + } + } + + protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) + { + $baseUrl = $this->getDataContainer()->getBaseUrl(); + if (!$baseUrl) { + return; + } + $root->setAttribute('xml:base', $baseUrl); + } + + protected function _setHubs(DOMDocument $dom, DOMElement $root) + { + $hubs = $this->getDataContainer()->getHubs(); + if (!$hubs) { + return; + } + foreach ($hubs as $hubUrl) { + $hub = $dom->createElement('link'); + $hub->setAttribute('rel', 'hub'); + $hub->setAttribute('href', $hubUrl); + $root->appendChild($hub); + } + } + + protected function _setCategories(DOMDocument $dom, DOMElement $root) + { + $categories = $this->getDataContainer()->getCategories(); + if (!$categories) { + return; + } + foreach ($categories as $cat) { + $category = $dom->createElement('category'); + $category->setAttribute('term', $cat['term']); + if (isset($cat['label'])) { + $category->setAttribute('label', + htmlentities($cat['label'], ENT_QUOTES, $this->getDataContainer()->getEncoding()) + ); + } else { + $category->setAttribute('label', + htmlentities($cat['term'], ENT_QUOTES, $this->getDataContainer()->getEncoding()) + ); + } + if (isset($cat['scheme'])) { + $category->setAttribute('scheme', $cat['scheme']); + } + $root->appendChild($category); + } + } + +} diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php new file mode 100644 index 00000000..abe09a65 --- /dev/null +++ b/src/Writer/Renderer/Feed/Rss.php @@ -0,0 +1,277 @@ +_container->getEncoding()) { + $this->_container->setEncoding('UTF-8'); + } + $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom->formatOutput = true; + $rss = $this->_dom->createElement('rss'); + $this->setRootElement($rss); + $rss->setAttribute('version', '2.0'); + + $channel = $this->_dom->createElement('channel'); + $rss->appendChild($channel); + $this->_dom->appendChild($rss); + $this->_setLanguage($this->_dom, $channel); + $this->_setBaseUrl($this->_dom, $channel); + $this->_setTitle($this->_dom, $channel); + $this->_setDescription($this->_dom, $channel); + $this->_setDateCreated($this->_dom, $channel); + $this->_setDateModified($this->_dom, $channel); + $this->_setGenerator($this->_dom, $channel); + $this->_setLink($this->_dom, $channel); + $this->_setAuthors($this->_dom, $channel); + $this->_setCopyright($this->_dom, $channel); + $this->_setCategories($this->_dom, $channel); + + foreach ($this->_extensions as $ext) { + $ext->setType($this->getType()); + $ext->setRootElement($this->getRootElement()); + $ext->setDomDocument($this->getDomDocument(), $channel); + $ext->render(); + } + + foreach ($this->_container as $entry) { + if ($this->getDataContainer()->getEncoding()) { + $entry->setEncoding($this->getDataContainer()->getEncoding()); + } + $renderer = new Zend_Feed_Writer_Renderer_Entry_Rss($entry); + if ($this->_ignoreExceptions === true) { + $renderer->ignoreExceptions(); + } + $renderer->setType($this->getType()); + $renderer->setRootElement($this->_dom->documentElement); + $renderer->render(); + $element = $renderer->getElement(); + $imported = $this->_dom->importNode($element, true); + $channel->appendChild($imported); + } + return $this; + } + + protected function _setLanguage(DOMDocument $dom, DOMElement $root) + { + $lang = $this->getDataContainer()->getLanguage(); + if (!$lang) { + return; + } + $language = $dom->createElement('language'); + $root->appendChild($language); + $language->nodeValue = $lang; + } + + protected function _setTitle(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getTitle()) { + require_once 'Zend/Feed/Exception.php'; + $message = 'RSS 2.0 feed elements MUST contain exactly one' + . ' title element but a title has not been set'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + + $title = $dom->createElement('title'); + $root->appendChild($title); + $title->nodeValue = htmlentities( + $this->getDataContainer()->getTitle(), + ENT_QUOTES, + $this->getDataContainer()->getEncoding() + ); + } + + protected function _setDescription(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getDescription()) { + require_once 'Zend/Feed/Exception.php'; + $message = 'RSS 2.0 feed elements MUST contain exactly one' + . ' description element but one has not been set'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $subtitle = $dom->createElement('description'); + $root->appendChild($subtitle); + $subtitle->nodeValue = htmlentities( + $this->getDataContainer()->getDescription(), + ENT_QUOTES, + $this->getDataContainer()->getEncoding() + ); + } + + protected function _setDateModified(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getDateModified()) { + return; + } + + $updated = $dom->createElement('pubDate'); + $root->appendChild($updated); + $updated->nodeValue = $this->getDataContainer()->getDateModified() + ->get(Zend_Date::RSS); + } + + protected function _setGenerator(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getGenerator()) { + $this->getDataContainer()->setGenerator('Zend_Feed_Writer', + Zend_Version::VERSION, 'http://framework.zend.com'); + } + + $gdata = $this->getDataContainer()->getGenerator(); + $generator = $dom->createElement('generator'); + $root->appendChild($generator); + $name = $gdata['name']; + if (array_key_exists('version', $gdata)) { + $name .= ' ' . $gdata['version']; + } + if (array_key_exists('uri', $gdata)) { + $name .= ' (' . $gdata['uri'] . ')'; + } + $generator->nodeValue = $name; + } + + protected function _setLink(DOMDocument $dom, DOMElement $root) + { + $value = $this->getDataContainer()->getLink(); + if(!$value) { + require_once 'Zend/Feed/Exception.php'; + $message = 'RSS 2.0 feed elements MUST contain exactly one' + . ' link element but one has not been set'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $link = $dom->createElement('link'); + $root->appendChild($link); + $link->nodeValue = $value; + if (!Zend_Uri::check($value)) { + $link->setAttribute('isPermaLink', 'false'); + } + } + + protected function _setAuthors(DOMDocument $dom, DOMElement $root) + { + $authors = $this->getDataContainer()->getAuthors(); + if (!$authors || empty($authors)) { + return; + } + foreach ($authors as $data) { + $author = $this->_dom->createElement('author'); + $name = $data['name']; + if (array_key_exists('email', $data)) { + $name = $data['email'] . ' (' . $data['name'] . ')'; + } + $author->nodeValue = $name; + $root->appendChild($author); + } + } + + protected function _setCopyright(DOMDocument $dom, DOMElement $root) + { + $copyright = $this->getDataContainer()->getCopyright(); + if (!$copyright) { + return; + } + $copy = $dom->createElement('copyright'); + $root->appendChild($copy); + $copy->nodeValue = $copyright; + } + + protected function _setDateCreated(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getDateCreated()) { + return; + } + if(!$this->getDataContainer()->getDateModified()) { + $this->getDataContainer()->setDateModified( + $this->getDataContainer()->getDateCreated() + ); + } + } + + protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) + { + $baseUrl = $this->getDataContainer()->getBaseUrl(); + if (!$baseUrl) { + return; + } + $root->setAttribute('xml:base', $baseUrl); + } + + protected function _setCategories(DOMDocument $dom, DOMElement $root) + { + $categories = $this->getDataContainer()->getCategories(); + if (!$categories) { + return; + } + foreach ($categories as $cat) { + $category = $dom->createElement('category'); + if (isset($cat['scheme'])) { + $category->setAttribute('domain', $cat['scheme']); + } + $category->nodeValue = $cat['term']; + $root->appendChild($category); + } + } + +} diff --git a/src/Writer/Renderer/RendererAbstract.php b/src/Writer/Renderer/RendererAbstract.php new file mode 100644 index 00000000..c179c3dd --- /dev/null +++ b/src/Writer/Renderer/RendererAbstract.php @@ -0,0 +1,181 @@ +_container = $container; + $this->setType($container->getType()); + $this->_loadExtensions(); + } + + public function saveXml() + { + return $this->getDomDocument()->saveXml(); + } + + public function getDomDocument() + { + return $this->_dom; + } + + public function getElement() + { + return $this->getDomDocument()->documentElement; + } + + public function getDataContainer() + { + return $this->_container; + } + + public function setEncoding($enc) + { + $this->_encoding = $enc; + } + + public function getEncoding() + { + return $this->_encoding; + } + + public function ignoreExceptions($bool = true) + { + if (!is_bool($bool)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: $bool. Should be TRUE or FALSE (defaults to TRUE if null)'); + } + $this->_ignoreExceptions = $bool; + } + + public function getExceptions() + { + return $this->_exceptions; + } + + /** + * Set the current feed type being exported to "rss" or "atom". This allows + * other objects to gracefully choose whether to execute or not, depending + * on their appropriateness for the current type, e.g. renderers. + * + * @param string $type + */ + public function setType($type) + { + $this->_type = $type; + } + + /** + * Retrieve the current or last feed type exported. + * + * @return string Value will be "rss" or "atom" + */ + public function getType() + { + return $this->_type; + } + + /** + * Sets the absolute root element for the XML feed being generated. This + * helps simplify the appending of namespace declarations, but also ensures + * namespaces are added to the root element - not scattered across the entire + * XML file - may assist namespace unsafe parsers and looks pretty ;). + * + * @param DOMElement $root + */ + public function setRootElement(DOMElement $root) + { + $this->_rootElement = $root; + } + + /** + * Retrieve the absolute root element for the XML feed being generated. + * + * @return DOMElement + */ + public function getRootElement() + { + return $this->_rootElement; + } + + /** + * Load extensions from Zend_Feed_Writer + * + * @return void + */ + protected function _loadExtensions() + { + Zend_Feed_Writer::registerCoreExtensions(); + $all = Zend_Feed_Writer::getExtensions(); + if (stripos(get_class($this), 'entry')) { + $exts = $all['entryRenderer']; + } else { + $exts = $all['feedRenderer']; + } + foreach ($exts as $extension) { + $className = Zend_Feed_Writer::getPluginLoader()->getClassName($extension); + $this->_extensions[$extension] = new $className( + $this->getDataContainer() + ); + $this->_extensions[$extension]->setEncoding($this->getEncoding()); + } + } + +} diff --git a/src/Writer/Renderer/RendererInterface.php b/src/Writer/Renderer/RendererInterface.php new file mode 100644 index 00000000..eaa27def --- /dev/null +++ b/src/Writer/Renderer/RendererInterface.php @@ -0,0 +1,78 @@ +addTestSuite('Zend_Feed_Reader_Integration_WordpressAtom10Test'); $suite->addTestSuite('Zend_Feed_Reader_Integration_LautDeRdfTest'); $suite->addTestSuite('Zend_Feed_Reader_Integration_HOnlineComAtom10Test'); + + $suite->addTestSuite('Zend_Feed_Writer_FeedTest'); + $suite->addTestSuite('Zend_Feed_Writer_EntryTest'); + $suite->addTestSuite('Zend_Feed_Writer_Renderer_Feed_AtomTest'); + $suite->addTestSuite('Zend_Feed_Writer_Renderer_Feed_RssTest'); + $suite->addTestSuite('Zend_Feed_Writer_Renderer_Entry_AtomTest'); + $suite->addTestSuite('Zend_Feed_Writer_Renderer_Entry_RssTest'); + + $suite->addTestSuite('Zend_Feed_Writer_Extension_ITunes_EntryTest'); + $suite->addTestSuite('Zend_Feed_Writer_Extension_ITunes_FeedTest'); return $suite; } diff --git a/test/Writer/EntryTest.php b/test/Writer/EntryTest.php new file mode 100644 index 00000000..0c605d78 --- /dev/null +++ b/test/Writer/EntryTest.php @@ -0,0 +1,571 @@ +_feedSamplePath = dirname(__FILE__) . '/_files'; + } + + public function testAddsAuthorName() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->addAuthor('Joe'); + $this->assertEquals(array(array('name'=>'Joe')), $entry->getAuthors()); + } + + public function testAddsAuthorEmail() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->addAuthor('Joe', 'joe@example.com'); + $this->assertEquals(array(array('name'=>'Joe', 'email' => 'joe@example.com')), $entry->getAuthors()); + } + + public function testAddsAuthorUri() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->addAuthor('Joe', null, 'http://www.example.com'); + $this->assertEquals(array(array('name'=>'Joe', 'uri' => 'http://www.example.com')), $entry->getAuthors()); + } + + public function testAddAuthorThrowsExceptionOnInvalidName() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->addAuthor(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddAuthorThrowsExceptionOnInvalidEmail() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->addAuthor('Joe', ''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddAuthorThrowsExceptionOnInvalidUri() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->addAuthor('Joe', null, 'notauri'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddsAuthorNameFromArray() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->addAuthor(array('name'=>'Joe')); + $this->assertEquals(array(array('name'=>'Joe')), $entry->getAuthors()); + } + + public function testAddsAuthorEmailFromArray() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->addAuthor(array('name'=>'Joe','email'=>'joe@example.com')); + $this->assertEquals(array(array('name'=>'Joe', 'email' => 'joe@example.com')), $entry->getAuthors()); + } + + public function testAddsAuthorUriFromArray() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->addAuthor(array('name'=>'Joe','uri'=>'http://www.example.com')); + $this->assertEquals(array(array('name'=>'Joe', 'uri' => 'http://www.example.com')), $entry->getAuthors()); + } + + public function testAddAuthorThrowsExceptionOnInvalidNameFromArray() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->addAuthor(array('name'=>'')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddAuthorThrowsExceptionOnInvalidEmailFromArray() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->addAuthor(array('name'=>'Joe','email'=>'')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddAuthorThrowsExceptionOnInvalidUriFromArray() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->addAuthor(array('name'=>'Joe','uri'=>'notauri')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddAuthorThrowsExceptionIfNameOmittedFromArray() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->addAuthor(array('uri'=>'notauri')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddsAuthorsFromArrayOfAuthors() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->addAuthors(array( + array('name'=>'Joe','uri'=>'http://www.example.com'), + array('name'=>'Jane','uri'=>'http://www.example.com') + )); + $expected = array( + array('name'=>'Joe','uri'=>'http://www.example.com'), + array('name'=>'Jane','uri'=>'http://www.example.com') + ); + $this->assertEquals($expected, $entry->getAuthors()); + } + + public function testAddsEnclosure() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setEnclosure(array( + 'type' => 'audio/mpeg', + 'uri' => 'http://example.com/audio.mp3', + 'length' => '1337' + )); + $expected = array( + 'type' => 'audio/mpeg', + 'uri' => 'http://example.com/audio.mp3', + 'length' => '1337' + ); + $this->assertEquals($expected, $entry->getEnclosure()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testAddsEnclosureThrowsExceptionOnMissingType() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setEnclosure(array( + 'uri' => 'http://example.com/audio.mp3', + 'length' => '1337' + )); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testAddsEnclosureThrowsExceptionOnMissingUri() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setEnclosure(array( + 'type' => 'audio/mpeg', + 'length' => '1337' + )); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testAddsEnclosureThrowsExceptionOnMissingLength() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setEnclosure(array( + 'type' => 'audio/mpeg', + 'uri' => 'http://example.com/audio.mp3' + )); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testAddsEnclosureThrowsExceptionOnNonNumericLength() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setEnclosure(array( + 'type' => 'audio/mpeg', + 'uri' => 'http://example.com/audio.mp3', + 'length' => 'abc' + )); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testAddsEnclosureThrowsExceptionOnNegativeLength() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setEnclosure(array( + 'type' => 'audio/mpeg', + 'uri' => 'http://example.com/audio.mp3', + 'length' => -23 + )); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testAddsEnclosureThrowsExceptionWhenUriIsInvalid() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setEnclosure(array( + 'type' => 'audio/mpeg', + 'uri' => 'http://', + 'length' => '1337' + )); + } + + public function testSetsCopyright() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setCopyright('Copyright (c) 2009 Paddy Brady'); + $this->assertEquals('Copyright (c) 2009 Paddy Brady', $entry->getCopyright()); + } + + public function testSetCopyrightThrowsExceptionOnInvalidParam() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->setCopyright(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testSetsContent() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setContent('I\'m content.'); + $this->assertEquals("I'm content.", $entry->getContent()); + } + + public function testSetContentThrowsExceptionOnInvalidParam() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->setContent(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testSetDateCreatedDefaultsToCurrentTime() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setDateCreated(); + $dateNow = new Zend_Date; + $this->assertTrue($dateNow->isLater($entry->getDateCreated()) || $dateNow->equals($entry->getDateCreated())); + } + + public function testSetDateCreatedUsesGivenUnixTimestamp() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setDateCreated(1234567890); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $this->assertTrue($myDate->equals($entry->getDateCreated())); + } + + public function testSetDateCreatedUsesZendDateObject() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setDateCreated(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $this->assertTrue($myDate->equals($entry->getDateCreated())); + } + + public function testSetDateModifiedDefaultsToCurrentTime() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setDateModified(); + $dateNow = new Zend_Date; + $this->assertTrue($dateNow->isLater($entry->getDateModified()) || $dateNow->equals($entry->getDateModified())); + } + + public function testSetDateModifiedUsesGivenUnixTimestamp() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setDateModified(1234567890); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $this->assertTrue($myDate->equals($entry->getDateModified())); + } + + public function testSetDateModifiedUsesZendDateObject() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setDateModified(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $this->assertTrue($myDate->equals($entry->getDateModified())); + } + + public function testSetDateCreatedThrowsExceptionOnInvalidParameter() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->setDateCreated('abc'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testSetDateModifiedThrowsExceptionOnInvalidParameter() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->setDateModified('abc'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetDateCreatedReturnsNullIfDateNotSet() + { + $entry = new Zend_Feed_Writer_Entry; + $this->assertTrue(is_null($entry->getDateCreated())); + } + + public function testGetDateModifiedReturnsNullIfDateNotSet() + { + $entry = new Zend_Feed_Writer_Entry; + $this->assertTrue(is_null($entry->getDateModified())); + } + + public function testGetCopyrightReturnsNullIfDateNotSet() + { + $entry = new Zend_Feed_Writer_Entry; + $this->assertTrue(is_null($entry->getCopyright())); + } + + public function testGetContentReturnsNullIfDateNotSet() + { + $entry = new Zend_Feed_Writer_Entry; + $this->assertTrue(is_null($entry->getContent())); + } + + public function testSetsDescription() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setDescription('abc'); + $this->assertEquals('abc', $entry->getDescription()); + } + + public function testSetDescriptionThrowsExceptionOnInvalidParameter() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->setDescription(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetDescriptionReturnsNullIfDateNotSet() + { + $entry = new Zend_Feed_Writer_Entry; + $this->assertTrue(is_null($entry->getDescription())); + } + + public function testSetsId() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setId('http://www.example.com/id'); + $this->assertEquals('http://www.example.com/id', $entry->getId()); + } + + public function testSetIdThrowsExceptionOnInvalidParameter() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->setId(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetIdReturnsNullIfDateNotSet() + { + $entry = new Zend_Feed_Writer_Entry; + $this->assertTrue(is_null($entry->getId())); + } + + public function testSetsLink() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setLink('http://www.example.com/id'); + $this->assertEquals('http://www.example.com/id', $entry->getLink()); + } + + public function testSetLinkThrowsExceptionOnEmptyString() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->setLink(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testSetLinkThrowsExceptionOnInvalidUri() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->setLink('http://'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetLinkReturnsNullIfNotSet() + { + $entry = new Zend_Feed_Writer_Entry; + $this->assertTrue(is_null($entry->getLink())); + } + + public function testSetsCommentLink() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setCommentLink('http://www.example.com/id/comments'); + $this->assertEquals('http://www.example.com/id/comments', $entry->getCommentLink()); + } + + public function testSetCommentLinkThrowsExceptionOnEmptyString() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->setCommentLink(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testSetCommentLinkThrowsExceptionOnInvalidUri() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->setCommentLink('http://'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetCommentLinkReturnsNullIfDateNotSet() + { + $entry = new Zend_Feed_Writer_Entry; + $this->assertTrue(is_null($entry->getCommentLink())); + } + + public function testSetsCommentFeedLink() + { + $entry = new Zend_Feed_Writer_Entry; + + $entry->setCommentFeedLink(array('uri'=>'http://www.example.com/id/comments', 'type'=>'rdf')); + $this->assertEquals(array(array('uri'=>'http://www.example.com/id/comments', 'type'=>'rdf')), $entry->getCommentFeedLinks()); + } + + public function testSetCommentFeedLinkThrowsExceptionOnEmptyString() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->setCommentFeedLink(array('uri'=>'', 'type'=>'rdf')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testSetCommentFeedLinkThrowsExceptionOnInvalidUri() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->setCommentFeedLink(array('uri'=>'http://', 'type'=>'rdf')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testSetCommentFeedLinkThrowsExceptionOnInvalidType() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->setCommentFeedLink(array('uri'=>'http://www.example.com/id/comments', 'type'=>'foo')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetCommentFeedLinkReturnsNullIfNoneSet() + { + $entry = new Zend_Feed_Writer_Entry; + $this->assertTrue(is_null($entry->getCommentFeedLinks())); + } + + public function testSetsTitle() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setTitle('abc'); + $this->assertEquals('abc', $entry->getTitle()); + } + + public function testSetTitleThrowsExceptionOnInvalidParameter() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->setTitle(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetTitleReturnsNullIfDateNotSet() + { + $entry = new Zend_Feed_Writer_Entry; + $this->assertTrue(is_null($entry->getTitle())); + } + + public function testSetsCommentCount() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setCommentCount('10'); + $this->assertEquals(10, $entry->getCommentCount()); + } + + public function testSetCommentCountThrowsExceptionOnInvalidEmptyParameter() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->setCommentCount(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testSetCommentCountThrowsExceptionOnInvalidNonIntegerParameter() + { + $entry = new Zend_Feed_Writer_Entry; + try { + $entry->setCommentCount('a'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetCommentCountReturnsNullIfDateNotSet() + { + $entry = new Zend_Feed_Writer_Entry; + $this->assertTrue(is_null($entry->getCommentCount())); + } + +} diff --git a/test/Writer/Extension/ITunes/EntryTest.php b/test/Writer/Extension/ITunes/EntryTest.php new file mode 100644 index 00000000..0f190eae --- /dev/null +++ b/test/Writer/Extension/ITunes/EntryTest.php @@ -0,0 +1,201 @@ +setItunesBlock('yes'); + $this->assertEquals('yes', $entry->getItunesBlock()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetBlockThrowsExceptionOnNonAlphaValue() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setItunesBlock('123'); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetBlockThrowsExceptionIfValueGreaterThan255CharsLength() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setItunesBlock(str_repeat('a', 256)); + } + + public function testAddAuthors() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->addItunesAuthors(array('joe', 'jane')); + $this->assertEquals(array('joe', 'jane'), $entry->getItunesAuthors()); + } + + public function testAddAuthor() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->addItunesAuthor('joe'); + $this->assertEquals(array('joe'), $entry->getItunesAuthors()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testAddAuthorThrowsExceptionIfValueGreaterThan255CharsLength() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->addItunesAuthor(str_repeat('a', 256)); + } + + public function testSetDurationAsSeconds() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setItunesDuration(23); + $this->assertEquals(23, $entry->getItunesDuration()); + } + + public function testSetDurationAsMinutesAndSeconds() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setItunesDuration('23:23'); + $this->assertEquals('23:23', $entry->getItunesDuration()); + } + + public function testSetDurationAsHoursMinutesAndSeconds() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setItunesDuration('23:23:23'); + $this->assertEquals('23:23:23', $entry->getItunesDuration()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetDurationThrowsExceptionOnUnknownFormat() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setItunesDuration('abc'); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetDurationThrowsExceptionOnInvalidSeconds() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setItunesDuration('23:456'); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetDurationThrowsExceptionOnInvalidMinutes() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setItunesDuration('23:234:45'); + } + + public function testSetExplicitToYes() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setItunesExplicit('yes'); + $this->assertEquals('yes', $entry->getItunesExplicit()); + } + + public function testSetExplicitToNo() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setItunesExplicit('no'); + $this->assertEquals('no', $entry->getItunesExplicit()); + } + + public function testSetExplicitToClean() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setItunesExplicit('clean'); + $this->assertEquals('clean', $entry->getItunesExplicit()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetExplicitThrowsExceptionOnUnknownTerm() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setItunesExplicit('abc'); + } + + public function testSetKeywords() + { + $entry = new Zend_Feed_Writer_Entry; + $words = array( + 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12' + ); + $entry->setItunesKeywords($words); + $this->assertEquals($words, $entry->getItunesKeywords()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded() + { + $entry = new Zend_Feed_Writer_Entry; + $words = array( + 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12', 'a13' + ); + $entry->setItunesKeywords($words); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharLength() + { + $entry = new Zend_Feed_Writer_Entry; + $words = array( + str_repeat('a', 253), str_repeat('b', 2) + ); + $entry->setItunesKeywords($words); + } + + public function testSetSubtitle() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setItunesSubtitle('abc'); + $this->assertEquals('abc', $entry->getItunesSubtitle()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetSubtitleThrowsExceptionWhenValueExceeds255Chars() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setItunesSubtitle(str_repeat('a', 256)); + } + + public function testSetSummary() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setItunesSummary('abc'); + $this->assertEquals('abc', $entry->getItunesSummary()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetSummaryThrowsExceptionWhenValueExceeds255Chars() + { + $entry = new Zend_Feed_Writer_Entry; + $entry->setItunesSummary(str_repeat('a', 4001)); + } + +} diff --git a/test/Writer/Extension/ITunes/FeedTest.php b/test/Writer/Extension/ITunes/FeedTest.php new file mode 100644 index 00000000..e596df84 --- /dev/null +++ b/test/Writer/Extension/ITunes/FeedTest.php @@ -0,0 +1,288 @@ +setItunesBlock('yes'); + $this->assertEquals('yes', $feed->getItunesBlock()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetBlockThrowsExceptionOnNonAlphaValue() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesBlock('123'); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetBlockThrowsExceptionIfValueGreaterThan255CharsLength() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesBlock(str_repeat('a', 256)); + } + + public function testAddAuthors() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->addItunesAuthors(array('joe', 'jane')); + $this->assertEquals(array('joe', 'jane'), $feed->getItunesAuthors()); + } + + public function testAddAuthor() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->addItunesAuthor('joe'); + $this->assertEquals(array('joe'), $feed->getItunesAuthors()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testAddAuthorThrowsExceptionIfValueGreaterThan255CharsLength() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->addItunesAuthor(str_repeat('a', 256)); + } + + public function testSetCategories() + { + $feed = new Zend_Feed_Writer_Feed; + $cats = array( + 'cat1', + 'cat2' => array('cat2-1', 'cat2-a&b') + ); + $feed->setItunesCategories($cats); + $this->assertEquals($cats, $feed->getItunesCategories()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetCategoriesThrowsExceptionIfAnyCatNameGreaterThan255CharsLength() + { + $feed = new Zend_Feed_Writer_Feed; + $cats = array( + 'cat1', + 'cat2' => array('cat2-1', str_repeat('a', 256)) + ); + $feed->setItunesCategories($cats); + $this->assertEquals($cats, $feed->getItunesAuthors()); + } + + public function testSetImageAsPngFile() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesImage('http://www.example.com/image.png'); + $this->assertEquals('http://www.example.com/image.png', $feed->getItunesImage()); + } + + public function testSetImageAsJpgFile() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesImage('http://www.example.com/image.jpg'); + $this->assertEquals('http://www.example.com/image.jpg', $feed->getItunesImage()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetImageThrowsExceptionOnInvalidUri() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesImage('http://'); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetImageThrowsExceptionOnInvalidImageExtension() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesImage('http://www.example.com/image.gif'); + } + + public function testSetDurationAsSeconds() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesDuration(23); + $this->assertEquals(23, $feed->getItunesDuration()); + } + + public function testSetDurationAsMinutesAndSeconds() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesDuration('23:23'); + $this->assertEquals('23:23', $feed->getItunesDuration()); + } + + public function testSetDurationAsHoursMinutesAndSeconds() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesDuration('23:23:23'); + $this->assertEquals('23:23:23', $feed->getItunesDuration()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetDurationThrowsExceptionOnUnknownFormat() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesDuration('abc'); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetDurationThrowsExceptionOnInvalidSeconds() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesDuration('23:456'); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetDurationThrowsExceptionOnInvalidMinutes() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesDuration('23:234:45'); + } + + public function testSetExplicitToYes() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesExplicit('yes'); + $this->assertEquals('yes', $feed->getItunesExplicit()); + } + + public function testSetExplicitToNo() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesExplicit('no'); + $this->assertEquals('no', $feed->getItunesExplicit()); + } + + public function testSetExplicitToClean() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesExplicit('clean'); + $this->assertEquals('clean', $feed->getItunesExplicit()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetExplicitThrowsExceptionOnUnknownTerm() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesExplicit('abc'); + } + + public function testSetKeywords() + { + $feed = new Zend_Feed_Writer_Feed; + $words = array( + 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12' + ); + $feed->setItunesKeywords($words); + $this->assertEquals($words, $feed->getItunesKeywords()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded() + { + $feed = new Zend_Feed_Writer_Feed; + $words = array( + 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12', 'a13' + ); + $feed->setItunesKeywords($words); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharLength() + { + $feed = new Zend_Feed_Writer_Feed; + $words = array( + str_repeat('a', 253), str_repeat('b', 2) + ); + $feed->setItunesKeywords($words); + } + + public function testSetNewFeedUrl() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesNewFeedUrl('http://example.com/feed'); + $this->assertEquals('http://example.com/feed', $feed->getItunesNewFeedUrl()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetNewFeedUrlThrowsExceptionOnInvalidUri() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesNewFeedUrl('http://'); + } + + public function testAddOwner() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->addItunesOwner(array('name'=>'joe','email'=>'joe@example.com')); + $this->assertEquals(array(array('name'=>'joe','email'=>'joe@example.com')), $feed->getItunesOwners()); + } + + public function testAddOwners() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->addItunesOwners(array(array('name'=>'joe','email'=>'joe@example.com'))); + $this->assertEquals(array(array('name'=>'joe','email'=>'joe@example.com')), $feed->getItunesOwners()); + } + + public function testSetSubtitle() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesSubtitle('abc'); + $this->assertEquals('abc', $feed->getItunesSubtitle()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetSubtitleThrowsExceptionWhenValueExceeds255Chars() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesSubtitle(str_repeat('a', 256)); + } + + public function testSetSummary() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesSummary('abc'); + $this->assertEquals('abc', $feed->getItunesSummary()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetSummaryThrowsExceptionWhenValueExceeds4000Chars() + { + $feed = new Zend_Feed_Writer_Feed; + $feed->setItunesSummary(str_repeat('a',4001)); + } + +} diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php new file mode 100644 index 00000000..fa301d98 --- /dev/null +++ b/test/Writer/FeedTest.php @@ -0,0 +1,609 @@ +_feedSamplePath = dirname(__FILE__) . '/Writer/_files'; + } + + public function testAddsAuthorName() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->addAuthor('Joe'); + $this->assertEquals(array('name'=>'Joe'), $writer->getAuthor()); + } + + public function testAddsAuthorEmail() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->addAuthor('Joe', 'joe@example.com'); + $this->assertEquals(array('name'=>'Joe', 'email' => 'joe@example.com'), $writer->getAuthor()); + } + + public function testAddsAuthorUri() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->addAuthor('Joe', null, 'http://www.example.com'); + $this->assertEquals(array('name'=>'Joe', 'uri' => 'http://www.example.com'), $writer->getAuthor()); + } + + public function testAddAuthorThrowsExceptionOnInvalidName() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->addAuthor(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddAuthorThrowsExceptionOnInvalidEmail() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->addAuthor('Joe', ''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddAuthorThrowsExceptionOnInvalidUri() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->addAuthor('Joe', null, 'notauri'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddsAuthorNameFromArray() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->addAuthor(array('name'=>'Joe')); + $this->assertEquals(array('name'=>'Joe'), $writer->getAuthor()); + } + + public function testAddsAuthorEmailFromArray() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->addAuthor(array('name'=>'Joe','email'=>'joe@example.com')); + $this->assertEquals(array('name'=>'Joe', 'email' => 'joe@example.com'), $writer->getAuthor()); + } + + public function testAddsAuthorUriFromArray() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->addAuthor(array('name'=>'Joe','uri'=>'http://www.example.com')); + $this->assertEquals(array('name'=>'Joe', 'uri' => 'http://www.example.com'), $writer->getAuthor()); + } + + public function testAddAuthorThrowsExceptionOnInvalidNameFromArray() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->addAuthor(array('name'=>'')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddAuthorThrowsExceptionOnInvalidEmailFromArray() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->addAuthor(array('name'=>'Joe','email'=>'')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddAuthorThrowsExceptionOnInvalidUriFromArray() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->addAuthor(array('name'=>'Joe','uri'=>'notauri')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddAuthorThrowsExceptionIfNameOmittedFromArray() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->addAuthor(array('uri'=>'notauri')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddsAuthorsFromArrayOfAuthors() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->addAuthors(array( + array('name'=>'Joe','uri'=>'http://www.example.com'), + array('name'=>'Jane','uri'=>'http://www.example.com') + )); + $this->assertEquals(array('name'=>'Jane', 'uri' => 'http://www.example.com'), $writer->getAuthor(1)); + } + + public function testSetsCopyright() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setCopyright('Copyright (c) 2009 Paddy Brady'); + $this->assertEquals('Copyright (c) 2009 Paddy Brady', $writer->getCopyright()); + } + + public function testSetCopyrightThrowsExceptionOnInvalidParam() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setCopyright(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testSetDateCreatedDefaultsToCurrentTime() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setDateCreated(); + $dateNow = new Zend_Date; + $this->assertTrue($dateNow->isLater($writer->getDateCreated()) || $dateNow->equals($writer->getDateCreated())); + } + + public function testSetDateCreatedUsesGivenUnixTimestamp() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setDateCreated(1234567890); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $this->assertTrue($myDate->equals($writer->getDateCreated())); + } + + public function testSetDateCreatedUsesZendDateObject() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setDateCreated(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $this->assertTrue($myDate->equals($writer->getDateCreated())); + } + + public function testSetDateModifiedDefaultsToCurrentTime() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setDateModified(); + $dateNow = new Zend_Date; + $this->assertTrue($dateNow->isLater($writer->getDateModified()) || $dateNow->equals($writer->getDateModified())); + } + + public function testSetDateModifiedUsesGivenUnixTimestamp() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setDateModified(1234567890); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $this->assertTrue($myDate->equals($writer->getDateModified())); + } + + public function testSetDateModifiedUsesZendDateObject() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setDateModified(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $this->assertTrue($myDate->equals($writer->getDateModified())); + } + + public function testSetDateCreatedThrowsExceptionOnInvalidParameter() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setDateCreated('abc'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testSetDateModifiedThrowsExceptionOnInvalidParameter() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setDateModified('abc'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetDateCreatedReturnsNullIfDateNotSet() + { + $writer = new Zend_Feed_Writer_Feed; + $this->assertTrue(is_null($writer->getDateCreated())); + } + + public function testGetDateModifiedReturnsNullIfDateNotSet() + { + $writer = new Zend_Feed_Writer_Feed; + $this->assertTrue(is_null($writer->getDateModified())); + } + + public function testGetCopyrightReturnsNullIfDateNotSet() + { + $writer = new Zend_Feed_Writer_Feed; + $this->assertTrue(is_null($writer->getCopyright())); + } + + public function testSetsDescription() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setDescription('abc'); + $this->assertEquals('abc', $writer->getDescription()); + } + + public function testSetDescriptionThrowsExceptionOnInvalidParameter() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setDescription(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetDescriptionReturnsNullIfDateNotSet() + { + $writer = new Zend_Feed_Writer_Feed; + $this->assertTrue(is_null($writer->getDescription())); + } + + public function testSetsId() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setId('http://www.example.com/id'); + $this->assertEquals('http://www.example.com/id', $writer->getId()); + } + + public function testSetsIdAcceptsUrns() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); + $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $writer->getId()); + } + + public function testSetIdThrowsExceptionOnInvalidParameter() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setId(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testSetIdThrowsExceptionOnInvalidUri() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setId('http://'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetIdReturnsNullIfDateNotSet() + { + $writer = new Zend_Feed_Writer_Feed; + $this->assertTrue(is_null($writer->getId())); + } + + public function testSetsLanguage() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setLanguage('abc'); + $this->assertEquals('abc', $writer->getLanguage()); + } + + public function testSetLanguageThrowsExceptionOnInvalidParameter() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setLanguage(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetLanguageReturnsNullIfDateNotSet() + { + $writer = new Zend_Feed_Writer_Feed; + $this->assertTrue(is_null($writer->getLanguage())); + } + + public function testSetsLink() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setLink('http://www.example.com/id'); + $this->assertEquals('http://www.example.com/id', $writer->getLink()); + } + + public function testSetLinkThrowsExceptionOnEmptyString() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setLink(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testSetLinkThrowsExceptionOnInvalidUri() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setLink('http://'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetLinkReturnsNullIfDateNotSet() + { + $writer = new Zend_Feed_Writer_Feed; + $this->assertTrue(is_null($writer->getLink())); + } + + public function testSetsEncoding() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setEncoding('utf-16'); + $this->assertEquals('utf-16', $writer->getEncoding()); + } + + public function testSetEncodingThrowsExceptionOnInvalidParameter() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setEncoding(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetEncodingReturnsUtf8IfNotSet() + { + $writer = new Zend_Feed_Writer_Feed; + $this->assertEquals('UTF-8', $writer->getEncoding()); + } + + public function testSetsTitle() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setTitle('abc'); + $this->assertEquals('abc', $writer->getTitle()); + } + + public function testSetTitleThrowsExceptionOnInvalidParameter() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setTitle(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetTitleReturnsNullIfDateNotSet() + { + $writer = new Zend_Feed_Writer_Feed; + $this->assertTrue(is_null($writer->getTitle())); + } + + public function testSetsGeneratorName() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setGenerator('ZFW'); + $this->assertEquals(array('name'=>'ZFW'), $writer->getGenerator()); + } + + public function testSetsGeneratorVersion() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setGenerator('ZFW', '1.0'); + $this->assertEquals(array('name'=>'ZFW', 'version' => '1.0'), $writer->getGenerator()); + } + + public function testSetsGeneratorUri() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setGenerator('ZFW', null, 'http://www.example.com'); + $this->assertEquals(array('name'=>'ZFW', 'uri' => 'http://www.example.com'), $writer->getGenerator()); + } + + public function testSetsGeneratorThrowsExceptionOnInvalidName() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setGenerator(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testSetsGeneratorThrowsExceptionOnInvalidVersion() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->addAuthor('ZFW', ''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testSetsGeneratorThrowsExceptionOnInvalidUri() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setGenerator('ZFW', null, 'notauri'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetGeneratorReturnsNullIfDateNotSet() + { + $writer = new Zend_Feed_Writer_Feed; + $this->assertTrue(is_null($writer->getGenerator())); + } + + public function testSetsFeedLink() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setFeedLink('http://www.example.com/rss', 'RSS'); + $this->assertEquals(array('rss'=>'http://www.example.com/rss'), $writer->getFeedLinks()); + } + + public function testSetsFeedLinkThrowsExceptionOnInvalidType() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setFeedLink('http://www.example.com/rss', 'abc'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testSetsFeedLinkThrowsExceptionOnInvalidUri() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setFeedLink('http://', 'rss'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetFeedLinksReturnsNullIfNotSet() + { + $writer = new Zend_Feed_Writer_Feed; + $this->assertTrue(is_null($writer->getFeedLinks())); + } + + public function testSetsBaseUrl() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setBaseUrl('http://www.example.com'); + $this->assertEquals('http://www.example.com', $writer->getBaseUrl()); + } + + public function testSetsBaseUrlThrowsExceptionOnInvalidUri() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setBaseUrl('http://'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetBaseUrlReturnsNullIfNotSet() + { + $writer = new Zend_Feed_Writer_Feed; + $this->assertTrue(is_null($writer->getBaseUrl())); + } + + public function testAddsHubUrl() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->addHub('http://www.example.com/hub'); + $this->assertEquals(array('http://www.example.com/hub'), $writer->getHubs()); + } + + public function testAddsManyHubUrls() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->addHubs(array('http://www.example.com/hub', 'http://www.example.com/hub2')); + $this->assertEquals(array('http://www.example.com/hub', 'http://www.example.com/hub2'), $writer->getHubs()); + } + + public function testAddingHubUrlThrowsExceptionOnInvalidUri() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->addHub('http://'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddingHubUrlReturnsNullIfNotSet() + { + $writer = new Zend_Feed_Writer_Feed; + $this->assertTrue(is_null($writer->getHubs())); + } + + public function testCreatesNewEntryDataContainer() + { + $writer = new Zend_Feed_Writer_Feed; + $entry = $writer->createEntry(); + $this->assertTrue($entry instanceof Zend_Feed_Writer_Entry); + } + + public function testAddsCategory() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->addCategory(array('term'=>'cat_dog')); + $this->assertEquals(array(array('term'=>'cat_dog')), $writer->getCategories()); + } + + public function testAddsManyCategories() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->addCategories(array(array('term'=>'cat_dog'),array('term'=>'cat_mouse'))); + $this->assertEquals(array(array('term'=>'cat_dog'),array('term'=>'cat_mouse')), $writer->getCategories()); + } + + public function testAddingCategoryWithoutTermThrowsException() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->addCategory(array('label' => 'Cats & Dogs', 'scheme' => 'http://www.example.com/schema1')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddingCategoryWithInvalidUriAsSchemeThrowsException() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->addCategory(array('term' => 'cat_dog', 'scheme' => 'http://')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetCategoriesReturnsNullIfNotSet() + { + $writer = new Zend_Feed_Writer_Feed; + $this->assertTrue(is_null($writer->getCategories())); + } + + public function testAddsAndOrdersEntriesByDateIfRequested() + { + $writer = new Zend_Feed_Writer_Feed; + $entry = $writer->createEntry(); + $entry->setDateCreated(1234567890); + $entry2 = $writer->createEntry(); + $entry2->setDateCreated(1230000000); + $writer->addEntry($entry); + $writer->addEntry($entry2); + $writer->orderByDate(); + $this->assertEquals(1230000000, $writer->getEntry(1)->getDateCreated()->get(Zend_Date::TIMESTAMP)); + } + +} diff --git a/test/Writer/Renderer/Entry/AtomTest.php b/test/Writer/Renderer/Entry/AtomTest.php new file mode 100644 index 00000000..e42551f6 --- /dev/null +++ b/test/Writer/Renderer/Entry/AtomTest.php @@ -0,0 +1,247 @@ +_validWriter = new Zend_Feed_Writer_Feed; + + $this->_validWriter->setType('atom'); + + $this->_validWriter->setTitle('This is a test feed.'); + $this->_validWriter->setDescription('This is a test description.'); + $this->_validWriter->setDateModified(1234567890); + $this->_validWriter->setLink('http://www.example.com'); + $this->_validWriter->setFeedLink('http://www.example.com/atom', 'atom'); + $this->_validWriter->addAuthor('Joe', 'joe@example.com', 'http://www.example.com/joe'); + $this->_validEntry = $this->_validWriter->createEntry(); + $this->_validEntry->setTitle('This is a test entry.'); + $this->_validEntry->setDescription('This is a test entry description.'); + $this->_validEntry->setDateModified(1234567890); + $this->_validEntry->setDateCreated(1234567000); + $this->_validEntry->setLink('http://www.example.com/1'); + $this->_validEntry->addAuthor('Jane', 'jane@example.com', 'http://www.example.com/jane'); + $this->_validEntry->setContent('This is test entry content.'); + $this->_validWriter->addEntry($this->_validEntry); + } + + public function tearDown() + { + $this->_validWriter = null; + $this->_validEntry = null; + } + + public function testRenderMethodRunsMinimalWriterContainerProperlyBeforeICheckAtomCompliance() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + try { + $renderer->render(); + } catch (Zend_Feed_Exception $e) { + $this->fail('Valid Writer object caused an exception when building which should never happen'); + } + } + + public function testEntryEncodingHasBeenSet() + { + $this->_validWriter->setEncoding('iso-8859-1'); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('iso-8859-1', $entry->getEncoding()); + } + + public function testEntryEncodingDefaultIsUsedIfEncodingNotSetByHand() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('UTF-8', $entry->getEncoding()); + } + + public function testEntryTitleHasBeenSet() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('This is a test entry.', $entry->getTitle()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testFeedTitleIfMissingThrowsException() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validEntry->remove('title'); + $atomFeed->render(); + } + + public function testEntrySummaryDescriptionHasBeenSet() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('This is a test entry description.', $entry->getDescription()); + } + + public function testEntryContentHasBeenSet() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('This is test entry content.', $entry->getContent()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testFeedContentIfMissingThrowsExceptionIfThereIsNoLink() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validEntry->remove('content'); + $this->_validEntry->remove('link'); + $atomFeed->render(); + } + + public function testEntryUpdatedDateHasBeenSet() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals(1234567890, $entry->getDateModified()->get(Zend_Date::TIMESTAMP)); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testFeedUpdatedDateIfMissingThrowsException() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validEntry->remove('dateModified'); + $atomFeed->render(); + } + + public function testEntryPublishedDateHasBeenSet() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals(1234567000, $entry->getDateCreated()->get(Zend_Date::TIMESTAMP)); + } + + public function testEntryIncludesLinkToHtmlVersionOfFeed() + { + $renderer= new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/1', $entry->getLink()); + } + + public function testEntryHoldsAnyAuthorAdded() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $author = $entry->getAuthor(); + $this->assertEquals('jane@example.com (Jane)', $entry->getAuthor()); + } + + public function testEntryHoldsAnyEnclosureAdded() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validEntry->setEnclosure(array( + 'type' => 'audio/mpeg', + 'length' => '1337', + 'uri' => 'http://example.com/audio.mp3' + )); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $enc = $entry->getEnclosure(); + $this->assertEquals('audio/mpeg', $enc->type); + $this->assertEquals('1337', $enc->length); + $this->assertEquals('http://example.com/audio.mp3', $enc->url); + } + + public function testEntryIdHasBeenSet() + { + $this->_validEntry->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $entry->getId()); + } + + public function testFeedIdDefaultIsUsedIfNotSetByHand() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals($entry->getLink(), $entry->getId()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testFeedIdIfMissingThrowsException() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validEntry->remove('id'); + $this->_validEntry->remove('link'); + $atomFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testFeedIdThrowsExceptionIfNotUri() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validEntry->remove('id'); + $this->_validEntry->remove('link'); + $this->_validEntry->setId('not-a-uri'); + $atomFeed->render(); + } + + public function testCommentLinkRendered() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validEntry->setCommentLink('http://www.example.com/id/1'); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/id/1', $entry->getCommentLink()); + } + + public function testCommentCountRendered() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validEntry->setCommentCount(22); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals(22, $entry->getCommentCount()); + } + + public function testCommentFeedLinksRendered() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validEntry->setCommentFeedLinks(array( + array('uri'=>'http://www.example.com/atom/id/1','type'=>'atom'), + array('uri'=>'http://www.example.com/rss/id/1','type'=>'rss'), + )); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + // Skipped over due to ZFR bug (detects Atom in error when RSS requested) + //$this->assertEquals('http://www.example.com/rss/id/1', $entry->getCommentFeedLink('rss')); + $this->assertEquals('http://www.example.com/atom/id/1', $entry->getCommentFeedLink('atom')); + } + +} diff --git a/test/Writer/Renderer/Entry/RssTest.php b/test/Writer/Renderer/Entry/RssTest.php new file mode 100644 index 00000000..3ba4b359 --- /dev/null +++ b/test/Writer/Renderer/Entry/RssTest.php @@ -0,0 +1,217 @@ +_validWriter = new Zend_Feed_Writer_Feed; + + $this->_validWriter->setType('rss'); + + $this->_validWriter->setTitle('This is a test feed.'); + $this->_validWriter->setDescription('This is a test description.'); + $this->_validWriter->setLink('http://www.example.com'); + $this->_validEntry = $this->_validWriter->createEntry(); + $this->_validEntry->setTitle('This is a test entry.'); + $this->_validEntry->setDescription('This is a test entry description.'); + $this->_validEntry->setLink('http://www.example.com/1');; + $this->_validWriter->addEntry($this->_validEntry); + } + + public function tearDown() + { + $this->_validWriter = null; + $this->_validEntry = null; + } + + public function testRenderMethodRunsMinimalWriterContainerProperlyBeforeICheckAtomCompliance() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + try { + $renderer->render(); + } catch (Zend_Feed_Exception $e) { + $this->fail('Valid Writer object caused an exception when building which should never happen'); + } + } + + public function testEntryEncodingHasBeenSet() + { + $this->_validWriter->setEncoding('iso-8859-1'); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('iso-8859-1', $entry->getEncoding()); + } + + public function testEntryEncodingDefaultIsUsedIfEncodingNotSetByHand() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('UTF-8', $entry->getEncoding()); + } + + public function testEntryTitleHasBeenSet() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('This is a test entry.', $entry->getTitle()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testFeedTitleIfMissingThrowsExceptionIfDescriptionAlsoMissing() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validEntry->remove('title'); + $this->_validEntry->remove('description'); + $atomFeed->render(); + } + + public function testEntrySummaryDescriptionHasBeenSet() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('This is a test entry description.', $entry->getDescription()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testFeedDescriptionIfMissingThrowsExceptionIfAlsoNoTitle() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validEntry->remove('description'); + $this->_validEntry->remove('title'); + $atomFeed->render(); + } + + public function testEntryContentHasBeenSet() + { + $this->_validEntry->setContent('This is test entry content.'); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('This is test entry content.', $entry->getContent()); + } + + public function testEntryUpdatedDateHasBeenSet() + { + $this->_validEntry->setDateModified(1234567890); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals(1234567890, $entry->getDateModified()->get(Zend_Date::TIMESTAMP)); + } + + public function testEntryPublishedDateHasBeenSet() + { + $this->_validEntry->setDateCreated(1234567000); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals(1234567000, $entry->getDateCreated()->get(Zend_Date::TIMESTAMP)); + } + + public function testEntryIncludesLinkToHtmlVersionOfFeed() + { + $renderer= new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/1', $entry->getLink()); + } + + public function testEntryHoldsAnyAuthorAdded() + { + $this->_validEntry->addAuthor('Jane', 'jane@example.com', 'http://www.example.com/jane'); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $author = $entry->getAuthor(); + $this->assertEquals('Jane', $entry->getAuthor()); + } + + public function testEntryHoldsAnyEnclosureAdded() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validEntry->setEnclosure(array( + 'type' => 'audio/mpeg', + 'length' => '1337', + 'uri' => 'http://example.com/audio.mp3' + )); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $enc = $entry->getEnclosure(); + $this->assertEquals('audio/mpeg', $enc->type); + $this->assertEquals('1337', $enc->length); + $this->assertEquals('http://example.com/audio.mp3', $enc->url); + } + + public function testEntryIdHasBeenSet() + { + $this->_validEntry->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $entry->getId()); + } + + public function testEntryIdHasBeenSetWithPermaLinkAsFalseWhenNotUri() + { + $this->markTestIncomplete('Untest due to ZFR potential bug'); + } + + public function testFeedIdDefaultIsUsedIfNotSetByHand() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals($entry->getLink(), $entry->getId()); + } + + public function testCommentLinkRendered() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validEntry->setCommentLink('http://www.example.com/id/1'); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('http://www.example.com/id/1', $entry->getCommentLink()); + } + + public function testCommentCountRendered() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validEntry->setCommentCount(22); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals(22, $entry->getCommentCount()); + } + + public function testCommentFeedLinksRendered() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validEntry->setCommentFeedLinks(array( + array('uri'=>'http://www.example.com/atom/id/1','type'=>'atom'), + array('uri'=>'http://www.example.com/rss/id/1','type'=>'rss'), + )); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + // Skipped assertion is because RSS has no facility to show Atom feeds without an extension + $this->assertEquals('http://www.example.com/rss/id/1', $entry->getCommentFeedLink('rss')); + //$this->assertEquals('http://www.example.com/atom/id/1', $entry->getCommentFeedLink('atom')); + } + +} diff --git a/test/Writer/Renderer/Feed/AtomTest.php b/test/Writer/Renderer/Feed/AtomTest.php new file mode 100644 index 00000000..93d442ce --- /dev/null +++ b/test/Writer/Renderer/Feed/AtomTest.php @@ -0,0 +1,296 @@ +_validWriter = new Zend_Feed_Writer_Feed; + $this->_validWriter->setTitle('This is a test feed.'); + $this->_validWriter->setDescription('This is a test description.'); + $this->_validWriter->setDateModified(1234567890); + $this->_validWriter->setLink('http://www.example.com'); + $this->_validWriter->setFeedLink('http://www.example.com/atom', 'atom'); + $this->_validWriter->addAuthor('Joe', 'joe@example.com', 'http://www.example.com/joe'); + + $this->_validWriter->setType('atom'); + } + + public function tearDown() + { + $this->_validWriter = null; + } + + public function testSetsWriterInConstructor() + { + $writer = new Zend_Feed_Writer_Feed; + $feed = new Zend_Feed_Writer_Renderer_Feed_Atom($writer); + $this->assertTrue($feed->getDataContainer() instanceof Zend_Feed_Writer_Feed); + } + + public function testBuildMethodRunsMinimalWriterContainerProperlyBeforeICheckAtomCompliance() + { + $feed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + try { + $feed->render(); + } catch (Zend_Feed_Exception $e) { + $this->fail('Valid Writer object caused an exception when building which should never happen'); + } + } + + public function testFeedEncodingHasBeenSet() + { + $this->_validWriter->setEncoding('iso-8859-1'); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals('iso-8859-1', $feed->getEncoding()); + } + + public function testFeedEncodingDefaultIsUsedIfEncodingNotSetByHand() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals('UTF-8', $feed->getEncoding()); + } + + public function testFeedTitleHasBeenSet() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals('This is a test feed.', $feed->getTitle()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testFeedTitleIfMissingThrowsException() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validWriter->remove('title'); + $atomFeed->render(); + } + + public function testFeedSubtitleHasBeenSet() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals('This is a test description.', $feed->getDescription()); + } + + public function testFeedSubtitleThrowsNoExceptionIfMissing() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validWriter->remove('description'); + $atomFeed->render(); + } + + public function testFeedUpdatedDateHasBeenSet() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals(1234567890, $feed->getDateModified()->get(Zend_Date::TIMESTAMP)); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testFeedUpdatedDateIfMissingThrowsException() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validWriter->remove('dateModified'); + $atomFeed->render(); + } + + public function testFeedGeneratorHasBeenSet() + { + $this->_validWriter->setGenerator('FooFeedBuilder', '1.00', 'http://www.example.com'); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals('FooFeedBuilder', $feed->getGenerator()); + } + + public function testFeedGeneratorIfMissingThrowsNoException() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validWriter->remove('generator'); + $atomFeed->render(); + } + + public function testFeedGeneratorDefaultIsUsedIfGeneratorNotSetByHand() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); + } + + public function testFeedLanguageHasBeenSet() + { + $this->_validWriter->setLanguage('fr'); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals('fr', $feed->getLanguage()); + } + + public function testFeedLanguageIfMissingThrowsNoException() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validWriter->remove('language'); + $atomFeed->render(); + } + + public function testFeedLanguageDefaultIsUsedIfGeneratorNotSetByHand() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals(null, $feed->getLanguage()); + } + + public function testFeedIncludesLinkToHtmlVersionOfFeed() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals('http://www.example.com', $feed->getLink()); + } + + public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsNoExceptionIfIdSet() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validWriter->setId('http://www.example.com'); + $this->_validWriter->remove('link'); + $atomFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsExceptionIfIdMissing() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validWriter->remove('link'); + $atomFeed->render(); + } + + public function testFeedIncludesLinkToXmlAtomWhereTheFeedWillBeAvailable() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals('http://www.example.com/atom', $feed->getFeedLink()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testFeedLinkToXmlAtomWhereTheFeedWillBeAvailableIfMissingThrowsException() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validWriter->remove('feedLinks'); + $atomFeed->render(); + } + + public function testFeedHoldsAnyAuthorAdded() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $author = $feed->getAuthor(); + $this->assertEquals('joe@example.com (Joe)', $feed->getAuthor()); + } + + public function testFeedAuthorIfNotSetThrowsExceptionIfAnyEntriesAlsoAreMissingAuthors() + { + $this->markTestIncomplete('Not yet implemented...'); + } + + public function testFeedAuthorIfNotSetThrowsNoExceptionIfAllEntriesIncludeAtLeastOneAuthor() + { + $this->markTestIncomplete('Not yet implemented...'); + } + + public function testFeedIdHasBeenSet() + { + $this->_validWriter->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $feed->getId()); + } + + public function testFeedIdDefaultOfHtmlLinkIsUsedIfNotSetByHand() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals($feed->getLink(), $feed->getId()); + } + + public function testBaseUrlCanBeSet() + { + $this->_validWriter->setBaseUrl('http://www.example.com/base'); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals('http://www.example.com/base', $feed->getBaseUrl()); + } + + public function testCopyrightCanBeSet() + { + $this->_validWriter->setCopyright('Copyright © 2009 Paddy'); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals('Copyright © 2009 Paddy', $feed->getCopyright()); + } + + public function testCategoriesCanBeSet() + { + $this->_validWriter->addCategories(array( + array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), + array('term'=>'cat_dog2') + )); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $expected = array( + array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), + array('term'=>'cat_dog2', 'label' => 'cat_dog2', 'scheme' => null) + ); + $this->assertEquals($expected, (array) $feed->getCategories()); + } + + /** + * @group ZFW030 + */ + public function testHubsCanBeSet() + { + $this->_validWriter->addHubs( + array('http://www.example.com/hub', 'http://www.example.com/hub2') + ); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $expected = array( + 'http://www.example.com/hub', 'http://www.example.com/hub2' + ); + $this->assertEquals($expected, (array) $feed->getHubs()); + } + +} diff --git a/test/Writer/Renderer/Feed/RssTest.php b/test/Writer/Renderer/Feed/RssTest.php new file mode 100644 index 00000000..15a9546f --- /dev/null +++ b/test/Writer/Renderer/Feed/RssTest.php @@ -0,0 +1,258 @@ +_validWriter = new Zend_Feed_Writer_Feed; + $this->_validWriter->setTitle('This is a test feed.'); + $this->_validWriter->setDescription('This is a test description.'); + $this->_validWriter->setLink('http://www.example.com'); + + $this->_validWriter->setType('rss'); + } + + public function tearDown() + { + $this->_validWriter = null; + } + + public function testSetsWriterInConstructor() + { + $writer = new Zend_Feed_Writer_Feed; + $feed = new Zend_Feed_Writer_Renderer_Feed_Rss($writer); + $this->assertTrue($feed->getDataContainer() instanceof Zend_Feed_Writer_Feed); + } + + public function testBuildMethodRunsMinimalWriterContainerProperlyBeforeICheckRssCompliance() + { + $feed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + try { + $feed->render(); + } catch (Zend_Feed_Exception $e) { + $this->fail('Valid Writer object caused an exception when building which should never happen'); + } + } + + public function testFeedEncodingHasBeenSet() + { + $this->_validWriter->setEncoding('iso-8859-1'); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals('iso-8859-1', $feed->getEncoding()); + } + + public function testFeedEncodingDefaultIsUsedIfEncodingNotSetByHand() + { + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals('UTF-8', $feed->getEncoding()); + } + + public function testFeedTitleHasBeenSet() + { + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals('This is a test feed.', $feed->getTitle()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testFeedTitleIfMissingThrowsException() + { + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validWriter->remove('title'); + $rssFeed->render(); + } + + public function testFeedDescriptionHasBeenSet() + { + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals('This is a test description.', $feed->getDescription()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testFeedDescriptionThrowsExceptionIfMissing() + { + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validWriter->remove('description'); + $rssFeed->render(); + } + + public function testFeedUpdatedDateHasBeenSet() + { + $this->_validWriter->setDateModified(1234567890); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals(1234567890, $feed->getDateModified()->get(Zend_Date::TIMESTAMP)); + } + + public function testFeedUpdatedDateIfMissingThrowsNoException() + { + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validWriter->remove('dateModified'); + $rssFeed->render(); + } + + public function testFeedGeneratorHasBeenSet() + { + $this->_validWriter->setGenerator('FooFeedBuilder', '1.00', 'http://www.example.com'); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals('FooFeedBuilder 1.00 (http://www.example.com)', $feed->getGenerator()); + } + + public function testFeedGeneratorIfMissingThrowsNoException() + { + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validWriter->remove('generator'); + $rssFeed->render(); + } + + public function testFeedGeneratorDefaultIsUsedIfGeneratorNotSetByHand() + { + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals('Zend_Feed_Writer ' . Zend_Version::VERSION . ' (http://framework.zend.com)', $feed->getGenerator()); + } + + public function testFeedLanguageHasBeenSet() + { + $this->_validWriter->setLanguage('fr'); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals('fr', $feed->getLanguage()); + } + + public function testFeedLanguageIfMissingThrowsNoException() + { + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validWriter->remove('language'); + $rssFeed->render(); + } + + public function testFeedLanguageDefaultIsUsedIfGeneratorNotSetByHand() + { + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals(null, $feed->getLanguage()); + } + + public function testFeedIncludesLinkToHtmlVersionOfFeed() + { + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals('http://www.example.com', $feed->getLink()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsException() + { + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validWriter->remove('link'); + $rssFeed->render(); + } + + public function testFeedIncludesLinkToXmlRssWhereTheFeedWillBeAvailable() + { + $this->_validWriter->setFeedLink('http://www.example.com/rss', 'rss'); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals('http://www.example.com/rss', $feed->getFeedLink()); + } + + public function testFeedLinkToXmlRssWhereTheFeedWillBeAvailableIfMissingThrowsNoException() + { + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validWriter->remove('feedLinks'); + $rssFeed->render(); + } + + public function testBaseUrlCanBeSet() + { + $this->_validWriter->setBaseUrl('http://www.example.com/base'); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals('http://www.example.com/base', $feed->getBaseUrl()); + } + + /** + * @group ZFW003 + */ + public function testFeedHoldsAnyAuthorAdded() + { + $this->_validWriter->addAuthor('Joe', 'joe@example.com', 'http://www.example.com/joe'); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $author = $feed->getAuthor(); + $this->assertEquals('Joe', $feed->getAuthor()); + } + + public function testCopyrightCanBeSet() + { + $this->_validWriter->setCopyright('Copyright © 2009 Paddy'); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals('Copyright © 2009 Paddy', $feed->getCopyright()); + } + + public function testCategoriesCanBeSet() + { + $this->_validWriter->addCategories(array( + array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), + array('term'=>'cat_dog2') + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $expected = array( + array('term'=>'cat_dog', 'label' => 'cat_dog', 'scheme' => 'http://example.com/schema1'), + array('term'=>'cat_dog2', 'label' => 'cat_dog2', 'scheme' => null) + ); + $this->assertEquals($expected, (array) $feed->getCategories()); + } + + public function testHubsCanBeSet() + { + $this->_validWriter->addHubs( + array('http://www.example.com/hub', 'http://www.example.com/hub2') + ); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $expected = array( + 'http://www.example.com/hub', 'http://www.example.com/hub2' + ); + $this->assertEquals($expected, (array) $feed->getHubs()); + } + +} From a75a5526871a43ee7b321137cd361b84e1f5945b Mon Sep 17 00:00:00 2001 From: padraic Date: Thu, 17 Dec 2009 22:28:45 +0000 Subject: [PATCH 079/238] Added some CS modifications based on review git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19730 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Writer.php | 37 +++--- src/Writer/Entry.php | 11 +- src/Writer/Extension/Atom/Renderer/Feed.php | 34 ++++- .../Extension/Content/Renderer/Entry.php | 25 +++- .../Extension/DublinCore/Renderer/Entry.php | 25 +++- .../Extension/DublinCore/Renderer/Feed.php | 25 +++- src/Writer/Extension/ITunes/Entry.php | 89 +++++++++++-- src/Writer/Extension/ITunes/Feed.php | 124 ++++++++++++++++-- .../Extension/ITunes/Renderer/Entry.php | 67 +++++++++- src/Writer/Extension/ITunes/Renderer/Feed.php | 95 +++++++++++++- src/Writer/Extension/RendererAbstract.php | 84 +++++++++++- src/Writer/Extension/RendererInterface.php | 25 +++- src/Writer/Extension/Slash/Renderer/Entry.php | 25 +++- .../Extension/Threading/Renderer/Entry.php | 39 +++++- .../WellFormedWeb/Renderer/Entry.php | 25 +++- src/Writer/Feed.php | 8 +- src/Writer/Renderer/Entry/Atom.php | 73 ++++++++++- src/Writer/Renderer/Entry/Rss.php | 80 ++++++++++- src/Writer/Renderer/Feed/Atom.php | 120 ++++++++++++++++- src/Writer/Renderer/Feed/Rss.php | 99 +++++++++++++- src/Writer/Renderer/RendererAbstract.php | 73 ++++++++++- src/Writer/Renderer/RendererInterface.php | 37 +++++- 22 files changed, 1105 insertions(+), 115 deletions(-) diff --git a/src/Writer.php b/src/Writer.php index 6dee5a62..c12a6ff9 100644 --- a/src/Writer.php +++ b/src/Writer.php @@ -76,10 +76,10 @@ class Zend_Feed_Writer * @var array */ protected static $_extensions = array( - 'entry' => array(), - 'feed' => array(), + 'entry' => array(), + 'feed' => array(), 'entryRenderer' => array(), - 'feedRenderer' => array() + 'feedRenderer' => array(), ); /** @@ -155,9 +155,10 @@ public static function registerExtension($name) $entryRendererName = $name . '_Renderer_Entry'; if (self::isRegistered($name)) { if (self::getPluginLoader()->isLoaded($feedName) - || self::getPluginLoader()->isLoaded($entryName) - || self::getPluginLoader()->isLoaded($feedRendererName) - || self::getPluginLoader()->isLoaded($entryRendererName)) { + || self::getPluginLoader()->isLoaded($entryName) + || self::getPluginLoader()->isLoaded($feedRendererName) + || self::getPluginLoader()->isLoaded($entryRendererName) + ) { return; } } @@ -182,9 +183,9 @@ public static function registerExtension($name) } catch (Zend_Loader_PluginLoader_Exception $e) { } if (!self::getPluginLoader()->isLoaded($feedName) - && !self::getPluginLoader()->isLoaded($entryName) - && !self::getPluginLoader()->isLoaded($feedRendererName) - && !self::getPluginLoader()->isLoaded($entryRendererName) + && !self::getPluginLoader()->isLoaded($entryName) + && !self::getPluginLoader()->isLoaded($feedRendererName) + && !self::getPluginLoader()->isLoaded($entryRendererName) ) { require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Could not load extension: ' . $name @@ -205,9 +206,9 @@ public static function isRegistered($extensionName) $feedRendererName = $extensionName . '_Renderer_Feed'; $entryRendererName = $extensionName . '_Renderer_Entry'; if (in_array($feedName, self::$_extensions['feed']) - || in_array($entryName, self::$_extensions['entry']) - || in_array($feedRendererName, self::$_extensions['feedRenderer']) - || in_array($entryRendererName, self::$_extensions['entryRenderer']) + || in_array($entryName, self::$_extensions['entry']) + || in_array($feedRendererName, self::$_extensions['feedRenderer']) + || in_array($entryRendererName, self::$_extensions['entryRenderer']) ) { return true; } @@ -231,13 +232,13 @@ public static function getExtensions() */ public static function reset() { - self::$_pluginLoader = null; - self::$_prefixPaths = array(); - self::$_extensions = array( - 'entry' => array(), - 'feed' => array(), + self::$_pluginLoader = null; + self::$_prefixPaths = array(); + self::$_extensions = array( + 'entry' => array(), + 'feed' => array(), 'entryRenderer' => array(), - 'feedRenderer' => array() + 'feedRenderer' => array(), ); } diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index 93c1c110..a755ccc2 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -82,7 +82,10 @@ public function addAuthor($name, $email = null, $uri = null) { $author = array(); if (is_array($name)) { - if (!array_key_exists('name', $name) || empty($name['name']) || !is_string($name['name'])) { + if (!array_key_exists('name', $name) + || empty($name['name']) + || !is_string($name['name']) + ) { require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); } @@ -95,7 +98,10 @@ public function addAuthor($name, $email = null, $uri = null) $author['email'] = $name['email']; } if (isset($name['uri'])) { - if (empty($name['uri']) || !is_string($name['uri']) || !Zend_Uri::check($name['uri'])) { + if (empty($name['uri']) + || !is_string($name['uri']) + || !Zend_Uri::check($name['uri']) + ) { require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); } @@ -663,5 +669,4 @@ protected function _loadExtensions() $this->_extensions[$ext]->setEncoding($this->getEncoding()); } } - } diff --git a/src/Writer/Extension/Atom/Renderer/Feed.php b/src/Writer/Extension/Atom/Renderer/Feed.php index 200adb0d..db4b3291 100644 --- a/src/Writer/Extension/Atom/Renderer/Feed.php +++ b/src/Writer/Extension/Atom/Renderer/Feed.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -27,13 +27,17 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Writer_Extension_Atom_Renderer_Feed -extends Zend_Feed_Writer_Extension_RendererAbstract + extends Zend_Feed_Writer_Extension_RendererAbstract { - + /** + * Render feed + * + * @return void + */ public function render() { /** @@ -48,12 +52,24 @@ public function render() $this->_setHubs($this->_dom, $this->_base); } + /** + * Append namespaces to root element of feed + * + * @return void + */ protected function _appendNamespaces() { $this->getRootElement()->setAttribute('xmlns:atom', 'http://www.w3.org/2005/Atom'); } + /** + * Set feed link elements + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) { $flinks = $this->getDataContainer()->getFeedLinks(); @@ -61,7 +77,7 @@ protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) return; } foreach ($flinks as $type => $href) { - $mime = 'application/' . strtolower($type) . '+xml'; + $mime = 'application/' . strtolower($type) . '+xml'; $flink = $dom->createElement('atom:link'); $root->appendChild($flink); $flink->setAttribute('rel', 'self'); @@ -70,6 +86,13 @@ protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) } } + /** + * Set PuSH hubs + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setHubs(DOMDocument $dom, DOMElement $root) { $hubs = $this->getDataContainer()->getHubs(); @@ -83,5 +106,4 @@ protected function _setHubs(DOMDocument $dom, DOMElement $root) $root->appendChild($hub); } } - } diff --git a/src/Writer/Extension/Content/Renderer/Entry.php b/src/Writer/Extension/Content/Renderer/Entry.php index 24af995b..d3c91a2c 100644 --- a/src/Writer/Extension/Content/Renderer/Entry.php +++ b/src/Writer/Extension/Content/Renderer/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -27,13 +27,17 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Writer_Extension_Content_Renderer_Entry -extends Zend_Feed_Writer_Extension_RendererAbstract + extends Zend_Feed_Writer_Extension_RendererAbstract { - + /** + * Render entry + * + * @return void + */ public function render() { if (strtolower($this->getType()) == 'atom') { @@ -43,12 +47,24 @@ public function render() $this->_setContent($this->_dom, $this->_base); } + /** + * Append namespaces to root element + * + * @return void + */ protected function _appendNamespaces() { $this->getRootElement()->setAttribute('xmlns:content', 'http://purl.org/rss/1.0/modules/content/'); } + /** + * Set entry content + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setContent(DOMDocument $dom, DOMElement $root) { $content = $this->getDataContainer()->getContent(); @@ -63,5 +79,4 @@ protected function _setContent(DOMDocument $dom, DOMElement $root) $this->getDataContainer()->getEncoding() ); } - } diff --git a/src/Writer/Extension/DublinCore/Renderer/Entry.php b/src/Writer/Extension/DublinCore/Renderer/Entry.php index 447b51a0..90844e6f 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Entry.php +++ b/src/Writer/Extension/DublinCore/Renderer/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -27,13 +27,17 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Writer_Extension_DublinCore_Renderer_Entry -extends Zend_Feed_Writer_Extension_RendererAbstract + extends Zend_Feed_Writer_Extension_RendererAbstract { - + /** + * Render entry + * + * @return void + */ public function render() { if (strtolower($this->getType()) == 'atom') { @@ -43,12 +47,24 @@ public function render() $this->_setAuthors($this->_dom, $this->_base); } + /** + * Append namespaces to entry + * + * @return void + */ protected function _appendNamespaces() { $this->getRootElement()->setAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); } + /** + * Set entry author elements + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->getDataContainer()->getAuthors(); @@ -63,5 +79,4 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) } } } - } diff --git a/src/Writer/Extension/DublinCore/Renderer/Feed.php b/src/Writer/Extension/DublinCore/Renderer/Feed.php index 0d2126e1..0fe3a8f5 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Feed.php +++ b/src/Writer/Extension/DublinCore/Renderer/Feed.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -27,13 +27,17 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Writer_Extension_DublinCore_Renderer_Feed -extends Zend_Feed_Writer_Extension_RendererAbstract + extends Zend_Feed_Writer_Extension_RendererAbstract { - + /** + * Render feed + * + * @return void + */ public function render() { if (strtolower($this->getType()) == 'atom') { @@ -43,12 +47,24 @@ public function render() $this->_setAuthors($this->_dom, $this->_base); } + /** + * Append namespaces to feed element + * + * @return void + */ protected function _appendNamespaces() { $this->getRootElement()->setAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); } + /** + * Set feed authors + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->getDataContainer()->getAuthors(); @@ -63,5 +79,4 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) } } } - } diff --git a/src/Writer/Extension/ITunes/Entry.php b/src/Writer/Extension/ITunes/Entry.php index 7c24140d..3c2dc10b 100644 --- a/src/Writer/Extension/ITunes/Entry.php +++ b/src/Writer/Extension/ITunes/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -22,12 +22,11 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Writer_Extension_ITunes_Entry { - /** * Array of Feed data for rendering by Extension's renderers * @@ -42,11 +41,23 @@ class Zend_Feed_Writer_Extension_ITunes_Entry */ protected $_encoding = 'UTF-8'; + /** + * Set feed encoding + * + * @param string $enc + * @return Zend_Feed_Writer_Extension_ITunes_Entry + */ public function setEncoding($enc) { $this->_encoding = $enc; + return $this; } + /** + * Get feed encoding + * + * @return string + */ public function getEncoding() { return $this->_encoding; @@ -55,7 +66,8 @@ public function getEncoding() /** * Set a block value of "yes" or "no". You may also set an empty string. * - * @param string + * @param string + * @return Zend_Feed_Writer_Extension_ITunes_Entry */ public function setItunesBlock($value) { @@ -72,13 +84,26 @@ public function setItunesBlock($value) $this->_data['block'] = $value; } + /** + * Add authors to itunes entry + * + * @param array $values + * @return Zend_Feed_Writer_Extension_ITunes_Entry + */ public function addItunesAuthors(array $values) { foreach ($values as $value) { $this->addItunesAuthor($value); } + return $this; } + /** + * Add author to itunes entry + * + * @param string $value + * @return Zend_Feed_Writer_Extension_ITunes_Entry + */ public function addItunesAuthor($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { @@ -90,21 +115,36 @@ public function addItunesAuthor($value) $this->_data['authors'] = array(); } $this->_data['authors'][] = $value; + return $this; } + /** + * Set duration + * + * @param int $value + * @return Zend_Feed_Writer_Extension_ITunes_Entry + */ public function setItunesDuration($value) { $value = (string) $value; if (!ctype_digit($value) - && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) - && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value)) { + && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) + && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value) + ) { require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "duration" may only' . ' be of a specified [[HH:]MM:]SS format'); } $this->_data['duration'] = $value; + return $this; } + /** + * Set "explicit" flag + * + * @param bool $value + * @return Zend_Feed_Writer_Extension_ITunes_Entry + */ public function setItunesExplicit($value) { if (!in_array($value, array('yes','no','clean'))) { @@ -113,8 +153,15 @@ public function setItunesExplicit($value) . ' be one of "yes", "no" or "clean"'); } $this->_data['explicit'] = $value; + return $this; } + /** + * Set keywords + * + * @param array $value + * @return Zend_Feed_Writer_Extension_ITunes_Entry + */ public function setItunesKeywords(array $value) { if (count($value) > 12) { @@ -130,8 +177,15 @@ public function setItunesKeywords(array $value) . ' by a comma'); } $this->_data['keywords'] = $value; + return $this; } + /** + * Set subtitle + * + * @param string $value + * @return Zend_Feed_Writer_Extension_ITunes_Entry + */ public function setItunesSubtitle($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { @@ -140,8 +194,15 @@ public function setItunesSubtitle($value) . ' contain a maximum of 255 characters'); } $this->_data['subtitle'] = $value; + return $this; } + /** + * Set summary + * + * @param string $value + * @return Zend_Feed_Writer_Extension_ITunes_Entry + */ public function setItunesSummary($value) { if (iconv_strlen($value, $this->getEncoding()) > 4000) { @@ -150,22 +211,32 @@ public function setItunesSummary($value) . ' contain a maximum of 4000 characters'); } $this->_data['summary'] = $value; + return $this; } + /** + * Overloading to itunes specific setters + * + * @param string $method + * @param array $params + * @return mixed + */ public function __call($method, array $params) { $point = lcfirst(substr($method, 9)); if (!method_exists($this, 'setItunes' . ucfirst($point)) - && !method_exists($this, 'addItunes' . ucfirst($point))) { + && !method_exists($this, 'addItunes' . ucfirst($point)) + ) { require_once 'Zend/Feed/Writer/Exception/InvalidMethodException.php'; throw new Zend_Feed_Writer_Exception_InvalidMethodException( 'invalid method: ' . $method ); } - if (!array_key_exists($point, $this->_data) || empty($this->_data[$point])) { + if (!array_key_exists($point, $this->_data) + || empty($this->_data[$point]) + ) { return null; } return $this->_data[$point]; } - } diff --git a/src/Writer/Extension/ITunes/Feed.php b/src/Writer/Extension/ITunes/Feed.php index a63bf80c..99c675c7 100644 --- a/src/Writer/Extension/ITunes/Feed.php +++ b/src/Writer/Extension/ITunes/Feed.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -22,12 +22,11 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Writer_Extension_ITunes_Feed { - /** * Array of Feed data for rendering by Extension's renderers * @@ -42,11 +41,23 @@ class Zend_Feed_Writer_Extension_ITunes_Feed */ protected $_encoding = 'UTF-8'; + /** + * Set feed encoding + * + * @param string $enc + * @return Zend_Feed_Writer_Extension_ITunes_Feed + */ public function setEncoding($enc) { $this->_encoding = $enc; + return $this; } + /** + * Get feed encoding + * + * @return string + */ public function getEncoding() { return $this->_encoding; @@ -55,7 +66,8 @@ public function getEncoding() /** * Set a block value of "yes" or "no". You may also set an empty string. * - * @param string + * @param string + * @return Zend_Feed_Writer_Extension_ITunes_Feed */ public function setItunesBlock($value) { @@ -70,15 +82,29 @@ public function setItunesBlock($value) . ' contain a maximum of 255 characters'); } $this->_data['block'] = $value; + return $this; } + /** + * Add feed authors + * + * @param array $values + * @return Zend_Feed_Writer_Extension_ITunes_Feed + */ public function addItunesAuthors(array $values) { foreach ($values as $value) { $this->addItunesAuthor($value); } + return $this; } + /** + * Add feed author + * + * @param string $value + * @return Zend_Feed_Writer_Extension_ITunes_Feed + */ public function addItunesAuthor($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { @@ -90,8 +116,15 @@ public function addItunesAuthor($value) $this->_data['authors'] = array(); } $this->_data['authors'][] = $value; + return $this; } + /** + * Set feed categories + * + * @param array $values + * @return Zend_Feed_Writer_Extension_ITunes_Feed + */ public function setItunesCategories(array $values) { if (!isset($this->_data['categories'])) { @@ -122,8 +155,15 @@ public function setItunesCategories(array $values) } } } + return $this; } + /** + * Set feed image (icon) + * + * @param string $value + * @return Zend_Feed_Writer_Extension_ITunes_Feed + */ public function setItunesImage($value) { if (!Zend_Uri::check($value)) { @@ -138,21 +178,36 @@ public function setItunesImage($value) . ' characters of the URI (i.e. no query string or fragment)'); } $this->_data['image'] = $value; + return $this; } + /** + * Set feed cumulative duration + * + * @param string $value + * @return Zend_Feed_Writer_Extension_ITunes_Feed + */ public function setItunesDuration($value) { $value = (string) $value; if (!ctype_digit($value) - && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) - && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value)) { + && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) + && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value) + ) { require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "duration" may only' . ' be of a specified [[HH:]MM:]SS format'); } $this->_data['duration'] = $value; + return $this; } + /** + * Set "explicit" flag + * + * @param bool $value + * @return Zend_Feed_Writer_Extension_ITunes_Feed + */ public function setItunesExplicit($value) { if (!in_array($value, array('yes','no','clean'))) { @@ -161,8 +216,15 @@ public function setItunesExplicit($value) . ' be one of "yes", "no" or "clean"'); } $this->_data['explicit'] = $value; + return $this; } + /** + * Set feed keywords + * + * @param array $value + * @return Zend_Feed_Writer_Extension_ITunes_Feed + */ public function setItunesKeywords(array $value) { if (count($value) > 12) { @@ -178,8 +240,15 @@ public function setItunesKeywords(array $value) . ' by a comma'); } $this->_data['keywords'] = $value; + return $this; } + /** + * Set new feed URL + * + * @param string $value + * @return Zend_Feed_Writer_Extension_ITunes_Feed + */ public function setItunesNewFeedUrl($value) { if (!Zend_Uri::check($value)) { @@ -188,15 +257,29 @@ public function setItunesNewFeedUrl($value) . ' be a valid URI/IRI'); } $this->_data['newFeedUrl'] = $value; + return $this; } + /** + * Add feed owners + * + * @param array $values + * @return Zend_Feed_Writer_Extension_ITunes_Feed + */ public function addItunesOwners(array $values) { foreach ($values as $value) { $this->addItunesOwner($value); } + return $this; } + /** + * Add feed owner + * + * @param string $value + * @return Zend_Feed_Writer_Extension_ITunes_Feed + */ public function addItunesOwner(array $value) { if (!isset($value['name']) || !isset($value['email'])) { @@ -205,7 +288,8 @@ public function addItunesOwner(array $value) . ' be an array containing keys "name" and "email"'); } if (iconv_strlen($value['name'], $this->getEncoding()) > 255 - || iconv_strlen($value['email'], $this->getEncoding()) > 255) { + || iconv_strlen($value['email'], $this->getEncoding()) > 255 + ) { require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: any "owner" may only' . ' contain a maximum of 255 characters each for "name" and "email"'); @@ -214,8 +298,15 @@ public function addItunesOwner(array $value) $this->_data['owners'] = array(); } $this->_data['owners'][] = $value; + return $this; } + /** + * Set feed subtitle + * + * @param string $value + * @return Zend_Feed_Writer_Extension_ITunes_Feed + */ public function setItunesSubtitle($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { @@ -224,8 +315,15 @@ public function setItunesSubtitle($value) . ' contain a maximum of 255 characters'); } $this->_data['subtitle'] = $value; + return $this; } + /** + * Set feed summary + * + * @param string $value + * @return Zend_Feed_Writer_Extension_ITunes_Feed + */ public function setItunesSummary($value) { if (iconv_strlen($value, $this->getEncoding()) > 4000) { @@ -234,13 +332,22 @@ public function setItunesSummary($value) . ' contain a maximum of 4000 characters'); } $this->_data['summary'] = $value; + return $this; } + /** + * Overloading: proxy to internal setters + * + * @param string $method + * @param array $params + * @return mixed + */ public function __call($method, array $params) { $point = lcfirst(substr($method, 9)); if (!method_exists($this, 'setItunes' . ucfirst($point)) - && !method_exists($this, 'addItunes' . ucfirst($point))) { + && !method_exists($this, 'addItunes' . ucfirst($point)) + ) { require_once 'Zend/Feed/Writer/Exception/InvalidMethodException.php'; throw new Zend_Feed_Writer_Exception_InvalidMethodException( 'invalid method: ' . $method @@ -251,5 +358,4 @@ public function __call($method, array $params) } return $this->_data[$point]; } - } diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php index 219f001f..c08ca20b 100644 --- a/src/Writer/Extension/ITunes/Renderer/Entry.php +++ b/src/Writer/Extension/ITunes/Renderer/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -27,13 +27,17 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Writer_Extension_ITunes_Renderer_Entry -extends Zend_Feed_Writer_Extension_RendererAbstract + extends Zend_Feed_Writer_Extension_RendererAbstract { - + /** + * Render entry + * + * @return void + */ public function render() { $this->_appendNamespaces(); @@ -46,12 +50,24 @@ public function render() $this->_setSummary($this->_dom, $this->_base); } + /** + * Append namespaces to entry root + * + * @return void + */ protected function _appendNamespaces() { $this->getRootElement()->setAttribute('xmlns:itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); } + /** + * Set entry authors + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->getDataContainer()->getItunesAuthors(); @@ -67,6 +83,13 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) } } + /** + * Set itunes block + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setBlock(DOMDocument $dom, DOMElement $root) { $block = $this->getDataContainer()->getItunesBlock(); @@ -78,6 +101,13 @@ protected function _setBlock(DOMDocument $dom, DOMElement $root) $root->appendChild($el); } + /** + * Set entry duration + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setDuration(DOMDocument $dom, DOMElement $root) { $duration = $this->getDataContainer()->getItunesDuration(); @@ -89,6 +119,13 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root) $root->appendChild($el); } + /** + * Set explicit flag + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setExplicit(DOMDocument $dom, DOMElement $root) { $explicit = $this->getDataContainer()->getItunesExplicit(); @@ -100,6 +137,13 @@ protected function _setExplicit(DOMDocument $dom, DOMElement $root) $root->appendChild($el); } + /** + * Set entry keywords + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setKeywords(DOMDocument $dom, DOMElement $root) { $keywords = $this->getDataContainer()->getItunesKeywords(); @@ -113,6 +157,13 @@ protected function _setKeywords(DOMDocument $dom, DOMElement $root) $root->appendChild($el); } + /** + * Set entry subtitle + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setSubtitle(DOMDocument $dom, DOMElement $root) { $subtitle = $this->getDataContainer()->getItunesSubtitle(); @@ -126,6 +177,13 @@ protected function _setSubtitle(DOMDocument $dom, DOMElement $root) $root->appendChild($el); } + /** + * Set entry summary + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setSummary(DOMDocument $dom, DOMElement $root) { $summary = $this->getDataContainer()->getItunesSummary(); @@ -138,5 +196,4 @@ protected function _setSummary(DOMDocument $dom, DOMElement $root) ); $root->appendChild($el); } - } diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php index 28843c19..b3d5d6b0 100644 --- a/src/Writer/Extension/ITunes/Renderer/Feed.php +++ b/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -27,13 +27,17 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Writer_Extension_ITunes_Renderer_Feed -extends Zend_Feed_Writer_Extension_RendererAbstract + extends Zend_Feed_Writer_Extension_RendererAbstract { - + /** + * Render feed + * + * @return void + */ public function render() { $this->_appendNamespaces(); @@ -50,12 +54,24 @@ public function render() $this->_setSummary($this->_dom, $this->_base); } + /** + * Append feed namespaces + * + * @return void + */ protected function _appendNamespaces() { $this->getRootElement()->setAttribute('xmlns:itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); } + /** + * Set feed authors + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->getDataContainer()->getItunesAuthors(); @@ -71,6 +87,13 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) } } + /** + * Set feed itunes block + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setBlock(DOMDocument $dom, DOMElement $root) { $block = $this->getDataContainer()->getItunesBlock(); @@ -82,6 +105,13 @@ protected function _setBlock(DOMDocument $dom, DOMElement $root) $root->appendChild($el); } + /** + * Set feed categories + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setCategories(DOMDocument $dom, DOMElement $root) { $cats = $this->getDataContainer()->getItunesCategories(); @@ -112,6 +142,13 @@ protected function _setCategories(DOMDocument $dom, DOMElement $root) } } + /** + * Set feed image (icon) + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setImage(DOMDocument $dom, DOMElement $root) { $image = $this->getDataContainer()->getItunesImage(); @@ -123,6 +160,13 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) $root->appendChild($el); } + /** + * Set feed cumulative duration + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setDuration(DOMDocument $dom, DOMElement $root) { $duration = $this->getDataContainer()->getItunesDuration(); @@ -134,6 +178,13 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root) $root->appendChild($el); } + /** + * Set explicit flag + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setExplicit(DOMDocument $dom, DOMElement $root) { $explicit = $this->getDataContainer()->getItunesExplicit(); @@ -145,6 +196,13 @@ protected function _setExplicit(DOMDocument $dom, DOMElement $root) $root->appendChild($el); } + /** + * Set feed keywords + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setKeywords(DOMDocument $dom, DOMElement $root) { $keywords = $this->getDataContainer()->getItunesKeywords(); @@ -158,6 +216,13 @@ protected function _setKeywords(DOMDocument $dom, DOMElement $root) $root->appendChild($el); } + /** + * Set feed's new URL + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setNewFeedUrl(DOMDocument $dom, DOMElement $root) { $url = $this->getDataContainer()->getItunesNewFeedUrl(); @@ -171,6 +236,13 @@ protected function _setNewFeedUrl(DOMDocument $dom, DOMElement $root) $root->appendChild($el); } + /** + * Set feed owners + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setOwners(DOMDocument $dom, DOMElement $root) { $owners = $this->getDataContainer()->getItunesOwners(); @@ -193,6 +265,13 @@ protected function _setOwners(DOMDocument $dom, DOMElement $root) } } + /** + * Set feed subtitle + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setSubtitle(DOMDocument $dom, DOMElement $root) { $subtitle = $this->getDataContainer()->getItunesSubtitle(); @@ -206,6 +285,13 @@ protected function _setSubtitle(DOMDocument $dom, DOMElement $root) $root->appendChild($el); } + /** + * Set feed summary + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setSummary(DOMDocument $dom, DOMElement $root) { $summary = $this->getDataContainer()->getItunesSummary(); @@ -218,5 +304,4 @@ protected function _setSummary(DOMDocument $dom, DOMElement $root) ); $root->appendChild($el); } - } diff --git a/src/Writer/Extension/RendererAbstract.php b/src/Writer/Extension/RendererAbstract.php index be0e03ae..80df4c1a 100644 --- a/src/Writer/Extension/RendererAbstract.php +++ b/src/Writer/Extension/RendererAbstract.php @@ -30,19 +30,36 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Feed_Writer_Extension_RendererAbstract -implements Zend_Feed_Writer_Extension_RendererInterface + implements Zend_Feed_Writer_Extension_RendererInterface { - + /** + * @var DOMDocument + */ protected $_dom = null; + /** + * @var mixed + */ protected $_entry = null; + /** + * @var DOMElement + */ protected $_base = null; + /** + * @var mixed + */ protected $_container = null; + /** + * @var string + */ protected $_type = null; + /** + * @var DOMElement + */ protected $_rootElement = null; /** @@ -52,52 +69,111 @@ abstract class Zend_Feed_Writer_Extension_RendererAbstract */ protected $_encoding = 'UTF-8'; + /** + * Constructor + * + * @param mixed $container + * @return void + */ public function __construct($container) { $this->_container = $container; } + /** + * Set feed encoding + * + * @param string $enc + * @return Zend_Feed_Writer_Extension_RendererAbstract + */ public function setEncoding($enc) { $this->_encoding = $enc; + return $this; } + /** + * Get feed encoding + * + * @return void + */ public function getEncoding() { return $this->_encoding; } + /** + * Set DOMDocument and DOMElement on which to operate + * + * @param DOMDocument $dom + * @param DOMElement $base + * @return Zend_Feed_Writer_Extension_RendererAbstract + */ public function setDomDocument(DOMDocument $dom, DOMElement $base) { - $this->_dom = $dom; + $this->_dom = $dom; $this->_base = $base; + return $this; } + /** + * Get data container being rendered + * + * @return mixed + */ public function getDataContainer() { return $this->_container; } + /** + * Set feed type + * + * @param string $type + * @return Zend_Feed_Writer_Extension_RendererAbstract + */ public function setType($type) { $this->_type = $type; + return $this; } + /** + * Get feedtype + * + * @return string + */ public function getType() { return $this->_type; } + /** + * Set root element of document + * + * @param DOMElement $root + * @return Zend_Feed_Writer_Extension_RendererAbstract + */ public function setRootElement(DOMElement $root) { $this->_rootElement = $root; + return $this; } + /** + * Get root element + * + * @return DOMElement + */ public function getRootElement() { return $this->_rootElement; } + /** + * Append namespaces to feed + * + * @return void + */ abstract protected function _appendNamespaces(); - } diff --git a/src/Writer/Extension/RendererInterface.php b/src/Writer/Extension/RendererInterface.php index 1fe2e8b0..663b392c 100644 --- a/src/Writer/Extension/RendererInterface.php +++ b/src/Writer/Extension/RendererInterface.php @@ -26,13 +26,34 @@ */ interface Zend_Feed_Writer_Extension_RendererInterface { - + /** + * Constructor + * + * @param mixed $container + * @return void + */ public function __construct($container); + /** + * Set DOMDocument and DOMElement on which to operate + * + * @param DOMDocument $dom + * @param DOMElement $base + * @return void + */ public function setDomDocument(DOMDocument $dom, DOMElement $base); + /** + * Render + * + * @return void + */ public function render(); + /** + * Retrieve container + * + * @return mixed + */ public function getDataContainer(); - } diff --git a/src/Writer/Extension/Slash/Renderer/Entry.php b/src/Writer/Extension/Slash/Renderer/Entry.php index df56e7d2..b761f01a 100644 --- a/src/Writer/Extension/Slash/Renderer/Entry.php +++ b/src/Writer/Extension/Slash/Renderer/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -27,13 +27,17 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Writer_Extension_Slash_Renderer_Entry -extends Zend_Feed_Writer_Extension_RendererAbstract + extends Zend_Feed_Writer_Extension_RendererAbstract { - + /** + * Render entry + * + * @return void + */ public function render() { if (strtolower($this->getType()) == 'atom') { @@ -43,12 +47,24 @@ public function render() $this->_setCommentCount($this->_dom, $this->_base); } + /** + * Append entry namespaces + * + * @return void + */ protected function _appendNamespaces() { $this->getRootElement()->setAttribute('xmlns:slash', 'http://purl.org/rss/1.0/modules/slash/'); } + /** + * Set entry comment count + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setCommentCount(DOMDocument $dom, DOMElement $root) { $count = $this->getDataContainer()->getCommentCount(); @@ -59,5 +75,4 @@ protected function _setCommentCount(DOMDocument $dom, DOMElement $root) $tcount->nodeValue = $count; $root->appendChild($tcount); } - } diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php index 98e003af..7644d1d4 100644 --- a/src/Writer/Extension/Threading/Renderer/Entry.php +++ b/src/Writer/Extension/Threading/Renderer/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -27,13 +27,17 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Writer_Extension_Threading_Renderer_Entry -extends Zend_Feed_Writer_Extension_RendererAbstract + extends Zend_Feed_Writer_Extension_RendererAbstract { - + /** + * Render entry + * + * @return void + */ public function render() { if (strtolower($this->getType()) == 'rss') { @@ -45,12 +49,24 @@ public function render() $this->_setCommentCount($this->_dom, $this->_base); } + /** + * Append entry namespaces + * + * @return void + */ protected function _appendNamespaces() { $this->getRootElement()->setAttribute('xmlns:thr', 'http://purl.org/syndication/thread/1.0'); } + /** + * Set comment link + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setCommentLink(DOMDocument $dom, DOMElement $root) { $link = $this->getDataContainer()->getCommentLink(); @@ -69,6 +85,13 @@ protected function _setCommentLink(DOMDocument $dom, DOMElement $root) $root->appendChild($clink); } + /** + * Set comment feed links + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) { $links = $this->getDataContainer()->getCommentFeedLinks(); @@ -89,6 +112,13 @@ protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) } } + /** + * Set entry comment count + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setCommentCount(DOMDocument $dom, DOMElement $root) { $count = $this->getDataContainer()->getCommentCount(); @@ -99,5 +129,4 @@ protected function _setCommentCount(DOMDocument $dom, DOMElement $root) $tcount->nodeValue = $count; $root->appendChild($tcount); } - } diff --git a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php index 00e9eac2..7e7d8196 100644 --- a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php +++ b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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$ */ @@ -27,13 +27,17 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @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_Writer_Extension_WellFormedWeb_Renderer_Entry -extends Zend_Feed_Writer_Extension_RendererAbstract + extends Zend_Feed_Writer_Extension_RendererAbstract { - + /** + * Render entry + * + * @return void + */ public function render() { if (strtolower($this->getType()) == 'atom') { @@ -43,12 +47,24 @@ public function render() $this->_setCommentFeedLinks($this->_dom, $this->_base); } + /** + * Append entry namespaces + * + * @return void + */ protected function _appendNamespaces() { $this->getRootElement()->setAttribute('xmlns:wfw', 'http://wellformedweb.org/CommentAPI/'); } + /** + * Set entry comment feed links + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) { $links = $this->getDataContainer()->getCommentFeedLinks(); @@ -63,5 +79,4 @@ protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) } } } - } diff --git a/src/Writer/Feed.php b/src/Writer/Feed.php index dd511c8f..ff509f48 100644 --- a/src/Writer/Feed.php +++ b/src/Writer/Feed.php @@ -57,7 +57,6 @@ */ class Zend_Feed_Writer_Feed implements Iterator, Countable { - /** * Contains all Feed level date to append in feed output * @@ -411,8 +410,10 @@ public function addCategory(array $category) . ' readable category name'); } if (isset($category['scheme'])) { - if (empty($category['scheme']) || !is_string($category['scheme']) - || !Zend_Uri::check($category['scheme'])) { + if (empty($category['scheme']) + || !is_string($category['scheme']) + || !Zend_Uri::check($category['scheme']) + ) { require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('The Atom scheme or RSS domain of' . ' a category must be a valid URI'); @@ -896,5 +897,4 @@ protected function _loadExtensions() $this->_extensions[$ext]->setEncoding($this->getEncoding()); } } - } diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom.php index 522a8363..73baead8 100644 --- a/src/Writer/Renderer/Entry/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -31,15 +31,25 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Renderer_Entry_Atom -extends Zend_Feed_Writer_Renderer_RendererAbstract -implements Zend_Feed_Writer_Renderer_RendererInterface + extends Zend_Feed_Writer_Renderer_RendererAbstract + implements Zend_Feed_Writer_Renderer_RendererInterface { - + /** + * Constructor + * + * @param Zend_Feed_Writer_Entry $container + * @return void + */ public function __construct (Zend_Feed_Writer_Entry $container) { parent::__construct($container); } + /** + * Render atom entry + * + * @return Zend_Feed_Writer_Renderer_Entry_Atom + */ public function render() { $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); @@ -67,6 +77,13 @@ public function render() return $this; } + /** + * Set entry title + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setTitle(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getTitle()) { @@ -88,6 +105,13 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) $title->appendChild($cdata); } + /** + * Set entry description + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setDescription(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDescription()) { @@ -102,6 +126,13 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) $subtitle->appendChild($cdata); } + /** + * Set date entry was modified + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setDateModified(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateModified()) { @@ -123,6 +154,13 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) ->get(Zend_Date::ISO_8601); } + /** + * Set date entry was created + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) { if (!$this->getDataContainer()->getDateCreated()) { @@ -134,6 +172,13 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) ->get(Zend_Date::ISO_8601); } + /** + * Set entry authors + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->_container->getAuthors(); @@ -163,6 +208,13 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) } } + /** + * Set entry enclosure + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setEnclosure(DOMDocument $dom, DOMElement $root) { $data = $this->_container->getEnclosure(); @@ -189,6 +241,13 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) $link->setAttribute('href', $this->getDataContainer()->getLink()); } + /** + * Set entry identifier + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setId(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getId() @@ -221,6 +280,13 @@ protected function _setId(DOMDocument $dom, DOMElement $root) $id->nodeValue = $this->getDataContainer()->getId(); } + /** + * Set entry content + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setContent(DOMDocument $dom, DOMElement $root) { $content = $this->getDataContainer()->getContent(); @@ -244,5 +310,4 @@ protected function _setContent(DOMDocument $dom, DOMElement $root) $element->appendChild($cdata); $root->appendChild($element); } - } diff --git a/src/Writer/Renderer/Entry/Rss.php b/src/Writer/Renderer/Entry/Rss.php index e70f8ab7..60f311c1 100644 --- a/src/Writer/Renderer/Entry/Rss.php +++ b/src/Writer/Renderer/Entry/Rss.php @@ -31,15 +31,25 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Renderer_Entry_Rss -extends Zend_Feed_Writer_Renderer_RendererAbstract -implements Zend_Feed_Writer_Renderer_RendererInterface + extends Zend_Feed_Writer_Renderer_RendererAbstract + implements Zend_Feed_Writer_Renderer_RendererInterface { - + /** + * Constructor + * + * @param Zend_Feed_Writer_Entry $container + * @return void + */ public function __construct (Zend_Feed_Writer_Entry $container) { parent::__construct($container); } + /** + * Render RSS entry + * + * @return Zend_Feed_Writer_Renderer_Entry_Rss + */ public function render() { $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); @@ -66,6 +76,13 @@ public function render() return $this; } + /** + * Set entry title + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setTitle(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDescription() @@ -91,6 +108,13 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) ); } + /** + * Set entry description + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setDescription(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDescription() @@ -117,6 +141,13 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) ); } + /** + * Set date entry was last modified + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setDateModified(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateModified()) { @@ -129,6 +160,13 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) ->get(Zend_Date::RSS); } + /** + * Set date entry was created + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) { if (!$this->getDataContainer()->getDateCreated()) { @@ -141,6 +179,13 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) } } + /** + * Set entry authors + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->_container->getAuthors(); @@ -158,6 +203,13 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) } } + /** + * Set entry enclosure + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setEnclosure(DOMDocument $dom, DOMElement $root) { $data = $this->_container->getEnclosure(); @@ -171,6 +223,13 @@ protected function _setEnclosure(DOMDocument $dom, DOMElement $root) $root->appendChild($enclosure); } + /** + * Set link to entry + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setLink(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getLink()) { @@ -181,6 +240,13 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) $link->nodeValue = $this->getDataContainer()->getLink(); } + /** + * Set entry identifier + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setId(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getId() @@ -200,6 +266,13 @@ protected function _setId(DOMDocument $dom, DOMElement $root) } } + /** + * Set link to entry comments + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setCommentLink(DOMDocument $dom, DOMElement $root) { $link = $this->getDataContainer()->getCommentLink(); @@ -210,5 +283,4 @@ protected function _setCommentLink(DOMDocument $dom, DOMElement $root) $clink->nodeValue = $link; $root->appendChild($clink); } - } diff --git a/src/Writer/Renderer/Feed/Atom.php b/src/Writer/Renderer/Feed/Atom.php index 222c0708..02f1bd3e 100644 --- a/src/Writer/Renderer/Feed/Atom.php +++ b/src/Writer/Renderer/Feed/Atom.php @@ -19,14 +19,19 @@ * @version $Id$ */ +/** @see Zend_Feed_Writer_Feed */ require_once 'Zend/Feed/Writer/Feed.php'; +/** @see Zend_Version */ require_once 'Zend/Version.php'; +/** @see Zend_Feed_Writer_Renderer_RendererInterface */ require_once 'Zend/Feed/Writer/Renderer/RendererInterface.php'; +/** @see Zend_Feed_Writer_Renderer_Entry_Atom */ require_once 'Zend/Feed/Writer/Renderer/Entry/Atom.php'; +/** @see Zend_Feed_Writer_Renderer_RendererAbstract */ require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php'; /** @@ -36,15 +41,25 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Renderer_Feed_Atom -extends Zend_Feed_Writer_Renderer_RendererAbstract -implements Zend_Feed_Writer_Renderer_RendererInterface + extends Zend_Feed_Writer_Renderer_RendererAbstract + implements Zend_Feed_Writer_Renderer_RendererInterface { - + /** + * Constructor + * + * @param Zend_Feed_Writer_Feed $container + * @return void + */ public function __construct (Zend_Feed_Writer_Feed $container) { parent::__construct($container); } + /** + * Render Atom feed + * + * @return Zend_Feed_Writer_Renderer_Feed_Atom + */ public function render() { if (!$this->_container->getEncoding()) { @@ -97,6 +112,13 @@ public function render() return $this; } + /** + * Set feed language + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setLanguage(DOMDocument $dom, DOMElement $root) { if ($this->getDataContainer()->getLanguage()) { @@ -105,6 +127,13 @@ protected function _setLanguage(DOMDocument $dom, DOMElement $root) } } + /** + * Set feed title + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setTitle(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getTitle()) { @@ -126,6 +155,13 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) $title->nodeValue = $this->getDataContainer()->getTitle(); } + /** + * Set feed description + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setDescription(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDescription()) { @@ -137,6 +173,13 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) $subtitle->nodeValue = $this->getDataContainer()->getDescription(); } + /** + * Set date feed was last modified + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setDateModified(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateModified()) { @@ -158,6 +201,13 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) ->get(Zend_Date::ISO_8601); } + /** + * Set feed generator string + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setGenerator(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getGenerator()) { @@ -177,6 +227,13 @@ protected function _setGenerator(DOMDocument $dom, DOMElement $root) } } + /** + * Set link to feed + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setLink(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getLink()) { @@ -189,6 +246,13 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) $link->setAttribute('href', $this->getDataContainer()->getLink()); } + /** + * Set feed links + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) { $flinks = $this->getDataContainer()->getFeedLinks(); @@ -217,6 +281,13 @@ protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) } } + /** + * Set feed authors + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->_container->getAuthors(); @@ -247,6 +318,13 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) } } + /** + * Set feed identifier + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setId(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getId() @@ -274,6 +352,13 @@ protected function _setId(DOMDocument $dom, DOMElement $root) $id->nodeValue = $this->getDataContainer()->getId(); } + /** + * Set feed copyright + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setCopyright(DOMDocument $dom, DOMElement $root) { $copyright = $this->getDataContainer()->getCopyright(); @@ -285,6 +370,13 @@ protected function _setCopyright(DOMDocument $dom, DOMElement $root) $copy->nodeValue = $copyright; } + /** + * Set date feed was created + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateCreated()) { @@ -297,6 +389,13 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) } } + /** + * Set base URL to feed links + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) { $baseUrl = $this->getDataContainer()->getBaseUrl(); @@ -306,6 +405,13 @@ protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) $root->setAttribute('xml:base', $baseUrl); } + /** + * Set hubs to which this feed pushes + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setHubs(DOMDocument $dom, DOMElement $root) { $hubs = $this->getDataContainer()->getHubs(); @@ -320,6 +426,13 @@ protected function _setHubs(DOMDocument $dom, DOMElement $root) } } + /** + * Set feed cateories + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setCategories(DOMDocument $dom, DOMElement $root) { $categories = $this->getDataContainer()->getCategories(); @@ -344,5 +457,4 @@ protected function _setCategories(DOMDocument $dom, DOMElement $root) $root->appendChild($category); } } - } diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index abe09a65..09c3ce5c 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -19,14 +19,19 @@ * @version $Id$ */ +/** @see Zend_Feed_Writer_Feed */ require_once 'Zend/Feed/Writer/Feed.php'; +/** @see Zend_Version */ require_once 'Zend/Version.php'; +/** @see Zend_Feed_Writer_Renderer_RendererInterface */ require_once 'Zend/Feed/Writer/Renderer/RendererInterface.php'; +/** @see Zend_Feed_Writer_Renderer_Entry_Rss */ require_once 'Zend/Feed/Writer/Renderer/Entry/Rss.php'; +/** @see Zend_Feed_Writer_Renderer_RendererAbstract */ require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php'; /** @@ -36,15 +41,25 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Renderer_Feed_Rss -extends Zend_Feed_Writer_Renderer_RendererAbstract -implements Zend_Feed_Writer_Renderer_RendererInterface + extends Zend_Feed_Writer_Renderer_RendererAbstract + implements Zend_Feed_Writer_Renderer_RendererInterface { - + /** + * Constructor + * + * @param Zend_Feed_Writer_Feed $container + * @return void + */ public function __construct (Zend_Feed_Writer_Feed $container) { parent::__construct($container); } + /** + * Render RSS feed + * + * @return Zend_Feed_Writer_Renderer_Feed_Rss + */ public function render() { if (!$this->_container->getEncoding()) { @@ -96,6 +111,13 @@ public function render() return $this; } + /** + * Set feed language + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setLanguage(DOMDocument $dom, DOMElement $root) { $lang = $this->getDataContainer()->getLanguage(); @@ -107,6 +129,13 @@ protected function _setLanguage(DOMDocument $dom, DOMElement $root) $language->nodeValue = $lang; } + /** + * Set feed title + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setTitle(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getTitle()) { @@ -131,6 +160,13 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) ); } + /** + * Set feed description + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setDescription(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDescription()) { @@ -154,6 +190,13 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) ); } + /** + * Set date feed was last modified + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setDateModified(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateModified()) { @@ -166,6 +209,13 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) ->get(Zend_Date::RSS); } + /** + * Set feed generator string + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setGenerator(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getGenerator()) { @@ -186,6 +236,13 @@ protected function _setGenerator(DOMDocument $dom, DOMElement $root) $generator->nodeValue = $name; } + /** + * Set link to feed + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setLink(DOMDocument $dom, DOMElement $root) { $value = $this->getDataContainer()->getLink(); @@ -209,6 +266,13 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) } } + /** + * Set feed authors + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->getDataContainer()->getAuthors(); @@ -226,6 +290,13 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) } } + /** + * Set feed copyright + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setCopyright(DOMDocument $dom, DOMElement $root) { $copyright = $this->getDataContainer()->getCopyright(); @@ -237,6 +308,13 @@ protected function _setCopyright(DOMDocument $dom, DOMElement $root) $copy->nodeValue = $copyright; } + /** + * Set date feed was created + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateCreated()) { @@ -249,6 +327,13 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) } } + /** + * Set base URL to feed links + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) { $baseUrl = $this->getDataContainer()->getBaseUrl(); @@ -258,6 +343,13 @@ protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) $root->setAttribute('xml:base', $baseUrl); } + /** + * Set feed categories + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ protected function _setCategories(DOMDocument $dom, DOMElement $root) { $categories = $this->getDataContainer()->getCategories(); @@ -273,5 +365,4 @@ protected function _setCategories(DOMDocument $dom, DOMElement $root) $root->appendChild($category); } } - } diff --git a/src/Writer/Renderer/RendererAbstract.php b/src/Writer/Renderer/RendererAbstract.php index c179c3dd..8bd53b4b 100644 --- a/src/Writer/Renderer/RendererAbstract.php +++ b/src/Writer/Renderer/RendererAbstract.php @@ -19,8 +19,10 @@ * @version $Id$ */ +/** @see Zend_Feed_Writer */ require_once 'Zend/Feed/Writer.php'; +/** @see Zend_Version */ require_once 'Zend/Version.php'; /** @@ -31,15 +33,30 @@ */ class Zend_Feed_Writer_Renderer_RendererAbstract { - + /** + * Extensions + * @var array + */ protected $_extensions = array(); + /** + * @var mixed + */ protected $_container = null; + /** + * @var DOMDocument + */ protected $_dom = null; + /** + * @var bool + */ protected $_ignoreExceptions = false; + /** + * @var array + */ protected $_exceptions = array(); /** @@ -57,8 +74,17 @@ class Zend_Feed_Writer_Renderer_RendererAbstract */ protected $_type = null; + /** + * @var DOMElement + */ protected $_rootElement = null; + /** + * Constructor + * + * @param mixed $container + * @return void + */ public function __construct($container) { $this->_container = $container; @@ -66,36 +92,74 @@ public function __construct($container) $this->_loadExtensions(); } + /** + * Save XML to string + * + * @return string + */ public function saveXml() { return $this->getDomDocument()->saveXml(); } + /** + * Get DOM document + * + * @return DOMDocument + */ public function getDomDocument() { return $this->_dom; } + /** + * Get document element from DOM + * + * @return DOMElement + */ public function getElement() { return $this->getDomDocument()->documentElement; } + /** + * Get data container of items being rendered + * + * @return mixed + */ public function getDataContainer() { return $this->_container; } + /** + * Set feed encoding + * + * @param string $enc + * @return Zend_Feed_Writer_Renderer_RendererAbstract + */ public function setEncoding($enc) { $this->_encoding = $enc; + return $this; } + /** + * Get feed encoding + * + * @return string + */ public function getEncoding() { return $this->_encoding; } + /** + * Indicate whether or not to ignore exceptions + * + * @param bool $bool + * @return Zend_Feed_Writer_Renderer_RendererAbstract + */ public function ignoreExceptions($bool = true) { if (!is_bool($bool)) { @@ -103,8 +167,14 @@ public function ignoreExceptions($bool = true) throw new Zend_Feed_Exception('Invalid parameter: $bool. Should be TRUE or FALSE (defaults to TRUE if null)'); } $this->_ignoreExceptions = $bool; + return $this; } + /** + * Get exception list + * + * @return array + */ public function getExceptions() { return $this->_exceptions; @@ -177,5 +247,4 @@ protected function _loadExtensions() $this->_extensions[$extension]->setEncoding($this->getEncoding()); } } - } diff --git a/src/Writer/Renderer/RendererInterface.php b/src/Writer/Renderer/RendererInterface.php index eaa27def..7b5d8a2c 100644 --- a/src/Writer/Renderer/RendererInterface.php +++ b/src/Writer/Renderer/RendererInterface.php @@ -27,19 +27,53 @@ */ interface Zend_Feed_Writer_Renderer_RendererInterface { - + /** + * Render feed/entry + * + * @return void + */ public function render(); + /** + * Save feed and/or entry to XML and return string + * + * @return string + */ public function saveXml(); + /** + * Get DOM document + * + * @return DOMDocument + */ public function getDomDocument(); + /** + * Get document element from DOM + * + * @return DOMElement + */ public function getElement(); + /** + * Get data container containing feed items + * + * @return mixed + */ public function getDataContainer(); + /** + * Should exceptions be ignored? + * + * @return mixed + */ public function ignoreExceptions(); + /** + * Get list of thrown exceptions + * + * @return array + */ public function getExceptions(); /** @@ -74,5 +108,4 @@ public function setRootElement(DOMElement $root); * @return DOMElement */ public function getRootElement(); - } From 1241159beae5486a0c2e4854cb15ff3ffea63df6 Mon Sep 17 00:00:00 2001 From: bkarwin Date: Sat, 19 Dec 2009 06:35:46 +0000 Subject: [PATCH 080/238] fix comment blocks and tags git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19774 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Writer/EntryTest.php | 32 ++++++++++++++++++++- test/Writer/Extension/ITunes/EntryTest.php | 32 ++++++++++++++++++++- test/Writer/Extension/ITunes/FeedTest.php | 32 ++++++++++++++++++++- test/Writer/FeedTest.php | 32 ++++++++++++++++++++- test/Writer/Renderer/Entry/AtomTest.php | 33 ++++++++++++++++++++-- test/Writer/Renderer/Entry/RssTest.php | 33 ++++++++++++++++++++-- test/Writer/Renderer/Feed/AtomTest.php | 33 ++++++++++++++++++++-- test/Writer/Renderer/Feed/RssTest.php | 33 ++++++++++++++++++++-- 8 files changed, 248 insertions(+), 12 deletions(-) diff --git a/test/Writer/EntryTest.php b/test/Writer/EntryTest.php index 0c605d78..5a7472a8 100644 --- a/test/Writer/EntryTest.php +++ b/test/Writer/EntryTest.php @@ -1,8 +1,38 @@ Date: Sat, 19 Dec 2009 12:57:29 +0000 Subject: [PATCH 081/238] Zend_Feed_Writer: Updated unit tests to reflect changes to Author return type in Zend_Feed_Reader git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19786 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Writer.php | 27 +++++++++++++++++++++---- test/Writer/Renderer/Entry/AtomTest.php | 5 ++++- test/Writer/Renderer/Entry/RssTest.php | 2 +- test/Writer/Renderer/Feed/AtomTest.php | 5 ++++- test/Writer/Renderer/Feed/RssTest.php | 4 ++-- 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/Writer.php b/src/Writer.php index c12a6ff9..c21766db 100644 --- a/src/Writer.php +++ b/src/Writer.php @@ -259,7 +259,9 @@ public static function registerCoreExtensions() } /** - * Replaces XML special characters with entities. + * Replaces XML special characters with entities. This is a generally + * safe XML encoding targeting the <, > and & characters. Quotes are + * left unencoded. It is not suitable for RSS 2.0 character data. * * @param string $string * @param string $encoding @@ -267,9 +269,26 @@ public static function registerCoreExtensions() */ public static function xmlentities($string, $encoding) { - return str_replace(''', ''', htmlspecialchars( - $string, ENT_QUOTES, $encoding - )); + return htmlspecialchars($string, ENT_NOQUOTES, $encoding); + } + + /** + * Replaces the characters <, > and & with hexadecimal entities as + * recommended for textual character data not representing HTML in RSS 2.0. + * Per the published RSS Best Practices Profile this attempts to maximise + * compatibility with various feed parsers/readers. + * + * @param string $string + * @param string $encoding + * @return string + */ + public static function textentities($string, $encoding) + { + return str_replace( + array('&', '<', '>'), + array('&', '<', '>'), + htmlspecialchars($string, ENT_NOQUOTES, $encoding) + ); } } diff --git a/test/Writer/Renderer/Entry/AtomTest.php b/test/Writer/Renderer/Entry/AtomTest.php index 29d9316b..ac7063c5 100644 --- a/test/Writer/Renderer/Entry/AtomTest.php +++ b/test/Writer/Renderer/Entry/AtomTest.php @@ -182,7 +182,10 @@ public function testEntryHoldsAnyAuthorAdded() $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $author = $entry->getAuthor(); - $this->assertEquals('jane@example.com (Jane)', $entry->getAuthor()); + $this->assertEquals(array( + 'name'=>'Jane', + 'email'=>'jane@example.com', + 'uri'=>'http://www.example.com/jane'), $entry->getAuthor()); } public function testEntryHoldsAnyEnclosureAdded() diff --git a/test/Writer/Renderer/Entry/RssTest.php b/test/Writer/Renderer/Entry/RssTest.php index 305692f8..dee23b97 100644 --- a/test/Writer/Renderer/Entry/RssTest.php +++ b/test/Writer/Renderer/Entry/RssTest.php @@ -170,7 +170,7 @@ public function testEntryHoldsAnyAuthorAdded() $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $author = $entry->getAuthor(); - $this->assertEquals('Jane', $entry->getAuthor()); + $this->assertEquals(array('name'=>'Jane'), $entry->getAuthor()); } public function testEntryHoldsAnyEnclosureAdded() diff --git a/test/Writer/Renderer/Feed/AtomTest.php b/test/Writer/Renderer/Feed/AtomTest.php index 9f657c58..a6a9152c 100644 --- a/test/Writer/Renderer/Feed/AtomTest.php +++ b/test/Writer/Renderer/Feed/AtomTest.php @@ -241,7 +241,10 @@ public function testFeedHoldsAnyAuthorAdded() $atomFeed->render(); $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $author = $feed->getAuthor(); - $this->assertEquals('joe@example.com (Joe)', $feed->getAuthor()); + $this->assertEquals(array( + 'email'=>'joe@example.com', + 'name'=>'Joe', + 'uri'=>'http://www.example.com/joe'), $feed->getAuthor()); } public function testFeedAuthorIfNotSetThrowsExceptionIfAnyEntriesAlsoAreMissingAuthors() diff --git a/test/Writer/Renderer/Feed/RssTest.php b/test/Writer/Renderer/Feed/RssTest.php index dd9e7fd8..6040bd5b 100644 --- a/test/Writer/Renderer/Feed/RssTest.php +++ b/test/Writer/Renderer/Feed/RssTest.php @@ -13,7 +13,7 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_Json + * @package Zend_Feed * @subpackage UnitTests * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License @@ -242,7 +242,7 @@ public function testFeedHoldsAnyAuthorAdded() $atomFeed->render(); $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $author = $feed->getAuthor(); - $this->assertEquals('Joe', $feed->getAuthor()); + $this->assertEquals(array('name'=>'Joe'), $feed->getAuthor()); } public function testCopyrightCanBeSet() From 444ee53c5de93200c5b1ae74fb1d3e37b387788a Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 19 Dec 2009 19:32:45 +0000 Subject: [PATCH 082/238] Zend_Feed_Writer: Made changes to implement relevant entity encoding as appropriate to RSS or Atom elements. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19789 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Writer.php | 33 -------- src/Writer/Entry.php | 54 ++++++++++++ .../Extension/Content/Renderer/Entry.php | 7 +- .../Extension/DublinCore/Renderer/Entry.php | 3 +- .../Extension/DublinCore/Renderer/Feed.php | 5 +- .../Extension/ITunes/Renderer/Entry.php | 29 ++++--- src/Writer/Extension/ITunes/Renderer/Feed.php | 44 +++++----- .../WellFormedWeb/Renderer/Entry.php | 3 +- src/Writer/Renderer/Entry/Atom.php | 57 ++++++++++--- src/Writer/Renderer/Entry/Rss.php | 58 +++++++++---- src/Writer/Renderer/Feed/Atom.php | 38 +++++---- src/Writer/Renderer/Feed/Rss.php | 36 ++++---- test/Writer/Renderer/Entry/AtomTest.php | 17 ++++ test/Writer/Renderer/Entry/RssTest.php | 78 ++++++++++++++++- test/Writer/Renderer/Feed/AtomTest.php | 84 ++++++++++++++++++- test/Writer/Renderer/Feed/RssTest.php | 68 +++++++++++++++ 16 files changed, 468 insertions(+), 146 deletions(-) diff --git a/src/Writer.php b/src/Writer.php index c21766db..a1de7688 100644 --- a/src/Writer.php +++ b/src/Writer.php @@ -257,38 +257,5 @@ public static function registerCoreExtensions() self::registerExtension('Threading'); self::registerExtension('ITunes'); } - - /** - * Replaces XML special characters with entities. This is a generally - * safe XML encoding targeting the <, > and & characters. Quotes are - * left unencoded. It is not suitable for RSS 2.0 character data. - * - * @param string $string - * @param string $encoding - * @return string - */ - public static function xmlentities($string, $encoding) - { - return htmlspecialchars($string, ENT_NOQUOTES, $encoding); - } - - /** - * Replaces the characters <, > and & with hexadecimal entities as - * recommended for textual character data not representing HTML in RSS 2.0. - * Per the published RSS Best Practices Profile this attempts to maximise - * compatibility with various feed parsers/readers. - * - * @param string $string - * @param string $encoding - * @return string - */ - public static function textentities($string, $encoding) - { - return str_replace( - array('&', '<', '>'), - array('&', '<', '>'), - htmlspecialchars($string, ENT_NOQUOTES, $encoding) - ); - } } diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index a755ccc2..233d2bb9 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -531,6 +531,60 @@ public function getCommentFeedLinks() return $this->_data['commentFeedLinks']; } + /** + * Add a entry category + * + * @param string $category + */ + public function addCategory(array $category) + { + if (!isset($category['term'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Each category must be an array and ' + . 'contain at least a "term" element containing the machine ' + . ' readable category name'); + } + if (isset($category['scheme'])) { + if (empty($category['scheme']) + || !is_string($category['scheme']) + || !Zend_Uri::check($category['scheme']) + ) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('The Atom scheme or RSS domain of' + . ' a category must be a valid URI'); + } + } + if (!isset($this->_data['categories'])) { + $this->_data['categories'] = array(); + } + $this->_data['categories'][] = $category; + } + + /** + * Set an array of entry categories + * + * @param array $categories + */ + public function addCategories(array $categories) + { + foreach ($categories as $category) { + $this->addCategory($category); + } + } + + /** + * Get the entry categories + * + * @return string|null + */ + public function getCategories() + { + if (!array_key_exists('categories', $this->_data)) { + return null; + } + return $this->_data['categories']; + } + /** * Adds an enclosure to the entry. * diff --git a/src/Writer/Extension/Content/Renderer/Entry.php b/src/Writer/Extension/Content/Renderer/Entry.php index d3c91a2c..467155b3 100644 --- a/src/Writer/Extension/Content/Renderer/Entry.php +++ b/src/Writer/Extension/Content/Renderer/Entry.php @@ -73,10 +73,7 @@ protected function _setContent(DOMDocument $dom, DOMElement $root) } $element = $dom->createElement('content:encoded'); $root->appendChild($element); - $element->nodeValue = htmlentities( - $this->getDataContainer()->getContent(), - ENT_QUOTES, - $this->getDataContainer()->getEncoding() - ); + $cdata = $dom->createCDATASection($content); + $element->appendChild($cdata); } } diff --git a/src/Writer/Extension/DublinCore/Renderer/Entry.php b/src/Writer/Extension/DublinCore/Renderer/Entry.php index 90844e6f..f5b76e23 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Entry.php +++ b/src/Writer/Extension/DublinCore/Renderer/Entry.php @@ -74,7 +74,8 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) foreach ($authors as $data) { $author = $this->_dom->createElement('dc:creator'); if (array_key_exists('name', $data)) { - $author->nodeValue = $data['name']; + $text = $dom->createTextNode($data['name']); + $author->appendChild($text); $root->appendChild($author); } } diff --git a/src/Writer/Extension/DublinCore/Renderer/Feed.php b/src/Writer/Extension/DublinCore/Renderer/Feed.php index 0fe3a8f5..c6556499 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Feed.php +++ b/src/Writer/Extension/DublinCore/Renderer/Feed.php @@ -74,8 +74,9 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) foreach ($authors as $data) { $author = $this->_dom->createElement('dc:creator'); if (array_key_exists('name', $data)) { - $author->nodeValue = $data['name']; - $root->appendChild($author); + $text = $dom->createTextNode($data['name']); + $author->appendChild($text); + $root->appendChild($author); } } } diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php index c08ca20b..4a03cabb 100644 --- a/src/Writer/Extension/ITunes/Renderer/Entry.php +++ b/src/Writer/Extension/ITunes/Renderer/Entry.php @@ -76,9 +76,8 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) } foreach ($authors as $author) { $el = $dom->createElement('itunes:author'); - $el->nodeValue = Zend_Feed_Writer::xmlentities( - $author, $this->getEncoding() - ); + $text = $dom->createTextNode($author); + $el->appendChild($text); $root->appendChild($el); } } @@ -97,7 +96,8 @@ protected function _setBlock(DOMDocument $dom, DOMElement $root) return; } $el = $dom->createElement('itunes:block'); - $el->nodeValue = $block; + $text = $dom->createTextNode($block); + $el->appendChild($text); $root->appendChild($el); } @@ -115,7 +115,8 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root) return; } $el = $dom->createElement('itunes:duration'); - $el->nodeValue = $duration; + $text = $dom->createTextNode($duration); + $el->appendChild($text); $root->appendChild($el); } @@ -133,7 +134,8 @@ protected function _setExplicit(DOMDocument $dom, DOMElement $root) return; } $el = $dom->createElement('itunes:explicit'); - $el->nodeValue = $explicit; + $text = $dom->createTextNode($explicit); + $el->appendChild($text); $root->appendChild($el); } @@ -151,9 +153,8 @@ protected function _setKeywords(DOMDocument $dom, DOMElement $root) return; } $el = $dom->createElement('itunes:keywords'); - $el->nodeValue = Zend_Feed_Writer::xmlentities( - implode(',', $keywords), $this->getEncoding() - ); + $text = $dom->createTextNode(implode(',', $keywords)); + $el->appendChild($text); $root->appendChild($el); } @@ -171,9 +172,8 @@ protected function _setSubtitle(DOMDocument $dom, DOMElement $root) return; } $el = $dom->createElement('itunes:subtitle'); - $el->nodeValue = Zend_Feed_Writer::xmlentities( - $subtitle, $this->getEncoding() - ); + $text = $dom->createTextNode($subtitle); + $el->appendChild($text); $root->appendChild($el); } @@ -191,9 +191,8 @@ protected function _setSummary(DOMDocument $dom, DOMElement $root) return; } $el = $dom->createElement('itunes:summary'); - $el->nodeValue = Zend_Feed_Writer::xmlentities( - $summary, $this->getEncoding() - ); + $text = $dom->createTextNode($summary); + $el->appendChild($text); $root->appendChild($el); } } diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php index b3d5d6b0..31e1be68 100644 --- a/src/Writer/Extension/ITunes/Renderer/Feed.php +++ b/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -80,9 +80,8 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) } foreach ($authors as $author) { $el = $dom->createElement('itunes:author'); - $el->nodeValue = Zend_Feed_Writer::xmlentities( - $author, $this->getEncoding() - ); + $text = $dom->createTextNode($author); + $el->appendChild($text); $root->appendChild($el); } } @@ -101,7 +100,8 @@ protected function _setBlock(DOMDocument $dom, DOMElement $root) return; } $el = $dom->createElement('itunes:block'); - $el->nodeValue = $block; + $text = $dom->createTextNode($block); + $el->appendChild($text); $root->appendChild($el); } @@ -174,7 +174,8 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root) return; } $el = $dom->createElement('itunes:duration'); - $el->nodeValue = $duration; + $text = $dom->createTextNode($duration); + $el->appendChild($text); $root->appendChild($el); } @@ -192,7 +193,8 @@ protected function _setExplicit(DOMDocument $dom, DOMElement $root) return; } $el = $dom->createElement('itunes:explicit'); - $el->nodeValue = $explicit; + $text = $dom->createTextNode($explicit); + $el->appendChild($text); $root->appendChild($el); } @@ -210,9 +212,8 @@ protected function _setKeywords(DOMDocument $dom, DOMElement $root) return; } $el = $dom->createElement('itunes:keywords'); - $el->nodeValue = Zend_Feed_Writer::xmlentities( - implode(',', $keywords), $this->getEncoding() - ); + $text = $dom->createTextNode(implode(',', $keywords)); + $el->appendChild($text); $root->appendChild($el); } @@ -230,9 +231,8 @@ protected function _setNewFeedUrl(DOMDocument $dom, DOMElement $root) return; } $el = $dom->createElement('itunes:new-feed-url'); - $el->nodeValue = Zend_Feed_Writer::xmlentities( - $url, $this->getEncoding() - ); + $text = $dom->createTextNode($url); + $el->appendChild($text); $root->appendChild($el); } @@ -252,13 +252,11 @@ protected function _setOwners(DOMDocument $dom, DOMElement $root) foreach ($owners as $owner) { $el = $dom->createElement('itunes:owner'); $name = $dom->createElement('itunes:name'); - $name->nodeValue = Zend_Feed_Writer::xmlentities( - $owner['name'], $this->getEncoding() - ); + $text = $dom->createTextNode($owner['name']); + $name->appendChild($text); $email = $dom->createElement('itunes:email'); - $email->nodeValue = Zend_Feed_Writer::xmlentities( - $owner['email'], $this->getEncoding() - ); + $text = $dom->createTextNode($owner['email']); + $email->appendChild($text); $root->appendChild($el); $el->appendChild($name); $el->appendChild($email); @@ -279,9 +277,8 @@ protected function _setSubtitle(DOMDocument $dom, DOMElement $root) return; } $el = $dom->createElement('itunes:subtitle'); - $el->nodeValue = Zend_Feed_Writer::xmlentities( - $subtitle, $this->getEncoding() - ); + $text = $dom->createTextNode($subtitle); + $el->appendChild($text); $root->appendChild($el); } @@ -299,9 +296,8 @@ protected function _setSummary(DOMDocument $dom, DOMElement $root) return; } $el = $dom->createElement('itunes:summary'); - $el->nodeValue = Zend_Feed_Writer::xmlentities( - $summary, $this->getEncoding() - ); + $text = $dom->createTextNode($summary); + $el->appendChild($text); $root->appendChild($el); } } diff --git a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php index 7e7d8196..4b962ce1 100644 --- a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php +++ b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php @@ -74,7 +74,8 @@ protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) foreach ($links as $link) { if ($link['type'] == 'rss') { $flink = $this->_dom->createElement('wfw:commentRss'); - $flink->nodeValue = $link['uri']; + $text = $dom->createTextNode($link['uri']); + $flink->appendChild($text); $root->appendChild($flink); } } diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom.php index 73baead8..d82a3eb6 100644 --- a/src/Writer/Renderer/Entry/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -66,6 +66,7 @@ public function render() $this->_setAuthors($this->_dom, $entry); $this->_setEnclosure($this->_dom, $entry); $this->_setContent($this->_dom, $entry); + $this->_setCategories($this->_dom, $entry); foreach ($this->_extensions as $ext) { $ext->setType($this->getType()); @@ -150,8 +151,10 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) $updated = $dom->createElement('updated'); $root->appendChild($updated); - $updated->nodeValue = $this->getDataContainer()->getDateModified() - ->get(Zend_Date::ISO_8601); + $text = $dom->createTextNode( + $this->getDataContainer()->getDateModified()->get(Zend_Date::ISO_8601) + ); + $updated->appendChild($text); } /** @@ -166,10 +169,12 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) if (!$this->getDataContainer()->getDateCreated()) { return; } - $updated = $dom->createElement('published'); - $root->appendChild($updated); - $updated->nodeValue = $this->getDataContainer()->getDateCreated() - ->get(Zend_Date::ISO_8601); + $el = $dom->createElement('published'); + $root->appendChild($el); + $text = $dom->createTextNode( + $this->getDataContainer()->getDateCreated()->get(Zend_Date::ISO_8601) + ); + $el->appendChild($text); } /** @@ -194,16 +199,19 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) $name = $this->_dom->createElement('name'); $author->appendChild($name); $root->appendChild($author); - $name->nodeValue = $data['name']; + $text = $dom->createTextNode($data['name']); + $name->appendChild($text); if (array_key_exists('email', $data)) { $email = $this->_dom->createElement('email'); $author->appendChild($email); - $email->nodeValue = $data['email']; + $text = $dom->createTextNode($data['email']); + $email->appendChild($text); } if (array_key_exists('uri', $data)) { $uri = $this->_dom->createElement('uri'); $author->appendChild($uri); - $uri->nodeValue = $data['uri']; + $text = $dom->createTextNode($data['uri']); + $uri->appendChild($text); } } } @@ -277,7 +285,8 @@ protected function _setId(DOMDocument $dom, DOMElement $root) } $id = $dom->createElement('id'); $root->appendChild($id); - $id->nodeValue = $this->getDataContainer()->getId(); + $text = $dom->createTextNode($this->getDataContainer()->getId()); + $id->appendChild($text); } /** @@ -310,4 +319,32 @@ protected function _setContent(DOMDocument $dom, DOMElement $root) $element->appendChild($cdata); $root->appendChild($element); } + + /** + * Set entry cateories + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setCategories(DOMDocument $dom, DOMElement $root) + { + $categories = $this->getDataContainer()->getCategories(); + if (!$categories) { + return; + } + foreach ($categories as $cat) { + $category = $dom->createElement('category'); + $category->setAttribute('term', $cat['term']); + if (isset($cat['label'])) { + $category->setAttribute('label', $cat['label']); + } else { + $category->setAttribute('label', $cat['term']); + } + if (isset($cat['scheme'])) { + $category->setAttribute('scheme', $cat['scheme']); + } + $root->appendChild($category); + } + } } diff --git a/src/Writer/Renderer/Entry/Rss.php b/src/Writer/Renderer/Entry/Rss.php index 60f311c1..ead29408 100644 --- a/src/Writer/Renderer/Entry/Rss.php +++ b/src/Writer/Renderer/Entry/Rss.php @@ -54,6 +54,7 @@ public function render() { $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; + $this->_dom->substituteEntities = false; $entry = $this->_dom->createElement('item'); $this->_dom->appendChild($entry); @@ -66,6 +67,7 @@ public function render() $this->_setAuthors($this->_dom, $entry); $this->_setEnclosure($this->_dom, $entry); $this->_setCommentLink($this->_dom, $entry); + $this->_setCategories($this->_dom, $entry); foreach ($this->_extensions as $ext) { $ext->setType($this->getType()); $ext->setRootElement($this->getRootElement()); @@ -101,11 +103,8 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) } $title = $dom->createElement('title'); $root->appendChild($title); - $title->nodeValue = htmlentities( - $this->getDataContainer()->getTitle(), - ENT_QUOTES, - $this->getDataContainer()->getEncoding() - ); + $text = $dom->createTextNode($this->getDataContainer()->getTitle()); + $title->appendChild($text); } /** @@ -134,11 +133,8 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) } $subtitle = $dom->createElement('description'); $root->appendChild($subtitle); - $subtitle->nodeValue = htmlentities( - $this->getDataContainer()->getDescription(), - ENT_QUOTES, - $this->getDataContainer()->getEncoding() - ); + $text = $dom->createCDATASection($this->getDataContainer()->getDescription()); + $subtitle->appendChild($text); } /** @@ -156,8 +152,10 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) $updated = $dom->createElement('pubDate'); $root->appendChild($updated); - $updated->nodeValue = $this->getDataContainer()->getDateModified() - ->get(Zend_Date::RSS); + $text = $dom->createTextNode( + $this->getDataContainer()->getDateModified()->get(Zend_Date::RSS) + ); + $updated->appendChild($text); } /** @@ -198,7 +196,8 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) if (array_key_exists('email', $data)) { $name = $data['email'] . ' (' . $data['name'] . ')'; } - $author->nodeValue = $name; + $text = $dom->createTextNode($name); + $author->appendChild($text); $root->appendChild($author); } } @@ -237,7 +236,8 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) } $link = $dom->createElement('link'); $root->appendChild($link); - $link->nodeValue = $this->getDataContainer()->getLink(); + $text = $dom->createTextNode($this->getDataContainer()->getLink()); + $link->appendChild($text); } /** @@ -260,7 +260,8 @@ protected function _setId(DOMDocument $dom, DOMElement $root) $this->getDataContainer()->setId( $this->getDataContainer()->getLink()); } - $id->nodeValue = $this->getDataContainer()->getId(); + $text = $dom->createTextNode($this->getDataContainer()->getId()); + $id->appendChild($text); if (!Zend_Uri::check($this->getDataContainer()->getId())) { $id->setAttribute('isPermaLink', 'false'); } @@ -280,7 +281,32 @@ protected function _setCommentLink(DOMDocument $dom, DOMElement $root) return; } $clink = $this->_dom->createElement('comments'); - $clink->nodeValue = $link; + $text = $dom->createTextNode($link); + $clink->appendChild($text); $root->appendChild($clink); } + + /** + * Set entry categories + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setCategories(DOMDocument $dom, DOMElement $root) + { + $categories = $this->getDataContainer()->getCategories(); + if (!$categories) { + return; + } + foreach ($categories as $cat) { + $category = $dom->createElement('category'); + if (isset($cat['scheme'])) { + $category->setAttribute('domain', $cat['scheme']); + } + $text = $dom->createCDATASection($cat['term']); + $category->appendChild($text); + $root->appendChild($category); + } + } } diff --git a/src/Writer/Renderer/Feed/Atom.php b/src/Writer/Renderer/Feed/Atom.php index 02f1bd3e..4477730c 100644 --- a/src/Writer/Renderer/Feed/Atom.php +++ b/src/Writer/Renderer/Feed/Atom.php @@ -152,7 +152,8 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) $title = $dom->createElement('title'); $root->appendChild($title); $title->setAttribute('type', 'text'); - $title->nodeValue = $this->getDataContainer()->getTitle(); + $text = $dom->createTextNode($this->getDataContainer()->getTitle()); + $title->appendChild($text); } /** @@ -170,7 +171,8 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) $subtitle = $dom->createElement('subtitle'); $root->appendChild($subtitle); $subtitle->setAttribute('type', 'text'); - $subtitle->nodeValue = $this->getDataContainer()->getDescription(); + $text = $dom->createTextNode($this->getDataContainer()->getDescription()); + $subtitle->appendChild($text); } /** @@ -197,8 +199,10 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) $updated = $dom->createElement('updated'); $root->appendChild($updated); - $updated->nodeValue = $this->getDataContainer()->getDateModified() - ->get(Zend_Date::ISO_8601); + $text = $dom->createTextNode( + $this->getDataContainer()->getDateModified()->get(Zend_Date::ISO_8601) + ); + $updated->appendChild($text); } /** @@ -218,7 +222,8 @@ protected function _setGenerator(DOMDocument $dom, DOMElement $root) $gdata = $this->getDataContainer()->getGenerator(); $generator = $dom->createElement('generator'); $root->appendChild($generator); - $generator->nodeValue = $gdata['name']; + $text = $dom->createTextNode($gdata['name']); + $generator->appendChild($text); if (array_key_exists('uri', $gdata)) { $generator->setAttribute('uri', $gdata['uri']); } @@ -304,16 +309,19 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) $name = $this->_dom->createElement('name'); $author->appendChild($name); $root->appendChild($author); - $name->nodeValue = $data['name']; + $text = $dom->createTextNode($data['name']); + $name->appendChild($text); if (array_key_exists('email', $data)) { $email = $this->_dom->createElement('email'); $author->appendChild($email); - $email->nodeValue = $data['email']; + $text = $dom->createTextNode($data['email']); + $email->appendChild($text); } if (array_key_exists('uri', $data)) { $uri = $this->_dom->createElement('uri'); $author->appendChild($uri); - $uri->nodeValue = $data['uri']; + $text = $dom->createTextNode($data['uri']); + $uri->appendChild($text); } } } @@ -349,7 +357,8 @@ protected function _setId(DOMDocument $dom, DOMElement $root) } $id = $dom->createElement('id'); $root->appendChild($id); - $id->nodeValue = $this->getDataContainer()->getId(); + $text = $dom->createTextNode($this->getDataContainer()->getId()); + $id->appendChild($text); } /** @@ -367,7 +376,8 @@ protected function _setCopyright(DOMDocument $dom, DOMElement $root) } $copy = $dom->createElement('rights'); $root->appendChild($copy); - $copy->nodeValue = $copyright; + $text = $dom->createTextNode($copyright); + $copy->appendChild($text); } /** @@ -443,13 +453,9 @@ protected function _setCategories(DOMDocument $dom, DOMElement $root) $category = $dom->createElement('category'); $category->setAttribute('term', $cat['term']); if (isset($cat['label'])) { - $category->setAttribute('label', - htmlentities($cat['label'], ENT_QUOTES, $this->getDataContainer()->getEncoding()) - ); + $category->setAttribute('label', $cat['label']); } else { - $category->setAttribute('label', - htmlentities($cat['term'], ENT_QUOTES, $this->getDataContainer()->getEncoding()) - ); + $category->setAttribute('label', $cat['term']); } if (isset($cat['scheme'])) { $category->setAttribute('scheme', $cat['scheme']); diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index 09c3ce5c..2ef636c6 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -67,6 +67,7 @@ public function render() } $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; + $this->_dom->substituteEntities = false; $rss = $this->_dom->createElement('rss'); $this->setRootElement($rss); $rss->setAttribute('version', '2.0'); @@ -153,11 +154,8 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) $title = $dom->createElement('title'); $root->appendChild($title); - $title->nodeValue = htmlentities( - $this->getDataContainer()->getTitle(), - ENT_QUOTES, - $this->getDataContainer()->getEncoding() - ); + $text = $dom->createTextNode($this->getDataContainer()->getTitle()); + $title->appendChild($text); } /** @@ -183,11 +181,8 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) } $subtitle = $dom->createElement('description'); $root->appendChild($subtitle); - $subtitle->nodeValue = htmlentities( - $this->getDataContainer()->getDescription(), - ENT_QUOTES, - $this->getDataContainer()->getEncoding() - ); + $text = $dom->createTextNode($this->getDataContainer()->getDescription()); + $subtitle->appendChild($text); } /** @@ -205,8 +200,10 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) $updated = $dom->createElement('pubDate'); $root->appendChild($updated); - $updated->nodeValue = $this->getDataContainer()->getDateModified() - ->get(Zend_Date::RSS); + $text = $dom->createTextNode( + $this->getDataContainer()->getDateModified()->get(Zend_Date::RSS) + ); + $updated->appendChild($text); } /** @@ -233,7 +230,8 @@ protected function _setGenerator(DOMDocument $dom, DOMElement $root) if (array_key_exists('uri', $gdata)) { $name .= ' (' . $gdata['uri'] . ')'; } - $generator->nodeValue = $name; + $text = $dom->createTextNode($name); + $generator->appendChild($text); } /** @@ -260,7 +258,8 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) } $link = $dom->createElement('link'); $root->appendChild($link); - $link->nodeValue = $value; + $text = $dom->createTextNode($value); + $link->appendChild($text); if (!Zend_Uri::check($value)) { $link->setAttribute('isPermaLink', 'false'); } @@ -285,7 +284,8 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) if (array_key_exists('email', $data)) { $name = $data['email'] . ' (' . $data['name'] . ')'; } - $author->nodeValue = $name; + $text = $dom->createTextNode($name); + $author->appendChild($text); $root->appendChild($author); } } @@ -305,7 +305,8 @@ protected function _setCopyright(DOMDocument $dom, DOMElement $root) } $copy = $dom->createElement('copyright'); $root->appendChild($copy); - $copy->nodeValue = $copyright; + $text = $dom->createTextNode($copyright); + $copy->appendChild($text); } /** @@ -361,7 +362,8 @@ protected function _setCategories(DOMDocument $dom, DOMElement $root) if (isset($cat['scheme'])) { $category->setAttribute('domain', $cat['scheme']); } - $category->nodeValue = $cat['term']; + $text = $dom->createTextNode($cat['term']); + $category->appendChild($text); $root->appendChild($category); } } diff --git a/test/Writer/Renderer/Entry/AtomTest.php b/test/Writer/Renderer/Entry/AtomTest.php index ac7063c5..ef4fd66f 100644 --- a/test/Writer/Renderer/Entry/AtomTest.php +++ b/test/Writer/Renderer/Entry/AtomTest.php @@ -262,6 +262,23 @@ public function testCommentCountRendered() $this->assertEquals(22, $entry->getCommentCount()); } + public function testCategoriesCanBeSet() + { + $this->_validEntry->addCategories(array( + array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), + array('term'=>'cat_dog2') + )); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $entry = $feed->current(); + $expected = array( + array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), + array('term'=>'cat_dog2', 'label' => 'cat_dog2', 'scheme' => null) + ); + $this->assertEquals($expected, (array) $entry->getCategories()); + } + public function testCommentFeedLinksRendered() { $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); diff --git a/test/Writer/Renderer/Entry/RssTest.php b/test/Writer/Renderer/Entry/RssTest.php index dee23b97..6e5bddb1 100644 --- a/test/Writer/Renderer/Entry/RssTest.php +++ b/test/Writer/Renderer/Entry/RssTest.php @@ -101,13 +101,22 @@ public function testEntryTitleHasBeenSet() /** * @expectedException Zend_Feed_Exception */ - public function testFeedTitleIfMissingThrowsExceptionIfDescriptionAlsoMissing() + public function testEntryTitleIfMissingThrowsExceptionIfDescriptionAlsoMissing() { $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validEntry->remove('title'); $this->_validEntry->remove('description'); $atomFeed->render(); } + + public function testEntryTitleCharDataEncoding() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validEntry->setTitle('<>&\'"áéíóú'); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('<>&\'"áéíóú', $entry->getTitle()); + } public function testEntrySummaryDescriptionHasBeenSet() { @@ -120,7 +129,7 @@ public function testEntrySummaryDescriptionHasBeenSet() /** * @expectedException Zend_Feed_Exception */ - public function testFeedDescriptionIfMissingThrowsExceptionIfAlsoNoTitle() + public function testEntryDescriptionIfMissingThrowsExceptionIfAlsoNoTitle() { $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validEntry->remove('description'); @@ -128,6 +137,15 @@ public function testFeedDescriptionIfMissingThrowsExceptionIfAlsoNoTitle() $atomFeed->render(); } + public function testEntryDescriptionCharDataEncoding() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validEntry->setDescription('<>&\'"áéíóú'); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('<>&\'"áéíóú', $entry->getDescription()); + } + public function testEntryContentHasBeenSet() { $this->_validEntry->setContent('This is test entry content.'); @@ -136,6 +154,15 @@ public function testEntryContentHasBeenSet() $entry = $feed->current(); $this->assertEquals('This is test entry content.', $entry->getContent()); } + + public function testEntryContentCharDataEncoding() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validEntry->setContent('<>&\'"áéíóú'); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('<>&\'"áéíóú', $entry->getContent()); + } public function testEntryUpdatedDateHasBeenSet() { @@ -173,6 +200,16 @@ public function testEntryHoldsAnyAuthorAdded() $this->assertEquals(array('name'=>'Jane'), $entry->getAuthor()); } + public function testEntryAuthorCharDataEncoding() + { + $this->_validEntry->addAuthor('<>&\'"áéíóú', 'jane@example.com', 'http://www.example.com/jane'); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $author = $entry->getAuthor(); + $this->assertEquals(array('name'=>'<>&\'"áéíóú'), $entry->getAuthor()); + } + public function testEntryHoldsAnyEnclosureAdded() { $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); @@ -203,7 +240,7 @@ public function testEntryIdHasBeenSetWithPermaLinkAsFalseWhenNotUri() $this->markTestIncomplete('Untest due to ZFR potential bug'); } - public function testFeedIdDefaultIsUsedIfNotSetByHand() + public function testEntryIdDefaultIsUsedIfNotSetByHand() { $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); @@ -242,5 +279,40 @@ public function testCommentFeedLinksRendered() $this->assertEquals('http://www.example.com/rss/id/1', $entry->getCommentFeedLink('rss')); //$this->assertEquals('http://www.example.com/atom/id/1', $entry->getCommentFeedLink('atom')); } + + public function testCategoriesCanBeSet() + { + $this->_validEntry->addCategories(array( + array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), + array('term'=>'cat_dog2') + )); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $expected = array( + array('term'=>'cat_dog', 'label' => 'cat_dog', 'scheme' => 'http://example.com/schema1'), + array('term'=>'cat_dog2', 'label' => 'cat_dog2', 'scheme' => null) + ); + $this->assertEquals($expected, (array) $entry->getCategories()); + } + + /** + * @group ZFWCHARDATA01 + */ + public function testCategoriesCharDataEncoding() + { + $this->_validEntry->addCategories(array( + array('term'=>'<>&\'"áéíóú', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), + array('term'=>'cat_dog2') + )); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $expected = array( + array('term'=>'<>&\'"áéíóú', 'label' => '<>&\'"áéíóú', 'scheme' => 'http://example.com/schema1'), + array('term'=>'cat_dog2', 'label' => 'cat_dog2', 'scheme' => null) + ); + $this->assertEquals($expected, (array) $entry->getCategories()); + } } diff --git a/test/Writer/Renderer/Feed/AtomTest.php b/test/Writer/Renderer/Feed/AtomTest.php index a6a9152c..8abcfafc 100644 --- a/test/Writer/Renderer/Feed/AtomTest.php +++ b/test/Writer/Renderer/Feed/AtomTest.php @@ -109,6 +109,18 @@ public function testFeedTitleIfMissingThrowsException() $this->_validWriter->remove('title'); $atomFeed->render(); } + + /** + * @group ZFWCHARDATA01 + */ + public function testFeedTitleCharDataEncoding() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validWriter->setTitle('<>&\'"áéíóú'); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals('<>&\'"áéíóú', $feed->getTitle()); + } public function testFeedSubtitleHasBeenSet() { @@ -124,6 +136,18 @@ public function testFeedSubtitleThrowsNoExceptionIfMissing() $this->_validWriter->remove('description'); $atomFeed->render(); } + + /** + * @group ZFWCHARDATA01 + */ + public function testFeedSubtitleCharDataEncoding() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validWriter->setDescription('<>&\'"áéíóú'); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals('<>&\'"áéíóú', $feed->getDescription()); + } public function testFeedUpdatedDateHasBeenSet() { @@ -166,6 +190,18 @@ public function testFeedGeneratorDefaultIsUsedIfGeneratorNotSetByHand() $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); } + + /** + * @group ZFWCHARDATA01 + */ + public function testFeedGeneratorCharDataEncoding() + { + $this->_validWriter->setGenerator('<>&\'"áéíóú', '1.00', 'http://www.example.com'); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals('<>&\'"áéíóú', $feed->getGenerator()); + } public function testFeedLanguageHasBeenSet() { @@ -247,6 +283,26 @@ public function testFeedHoldsAnyAuthorAdded() 'uri'=>'http://www.example.com/joe'), $feed->getAuthor()); } + /** + * @group ZFWCHARDATA01 + */ + public function testFeedAuthorCharDataEncoding() + { + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->_validWriter->remove('authors'); + $this->_validWriter->addAuthor(array( + 'email'=>'<>&\'"áéíóú', + 'name'=>'<>&\'"áéíóú', + 'uri'=>'http://www.example.com/joe')); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $author = $feed->getAuthor(); + $this->assertEquals(array( + 'email'=>'<>&\'"áéíóú', + 'name'=>'<>&\'"áéíóú', + 'uri'=>'http://www.example.com/joe'), $feed->getAuthor()); + } + public function testFeedAuthorIfNotSetThrowsExceptionIfAnyEntriesAlsoAreMissingAuthors() { $this->markTestIncomplete('Not yet implemented...'); @@ -292,6 +348,15 @@ public function testCopyrightCanBeSet() $this->assertEquals('Copyright © 2009 Paddy', $feed->getCopyright()); } + public function testCopyrightCharDataEncoding() + { + $this->_validWriter->setCopyright('<>&\'"áéíóú'); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals('<>&\'"áéíóú', $feed->getCopyright()); + } + public function testCategoriesCanBeSet() { $this->_validWriter->addCategories(array( @@ -308,9 +373,22 @@ public function testCategoriesCanBeSet() $this->assertEquals($expected, (array) $feed->getCategories()); } - /** - * @group ZFW030 - */ + public function testCategoriesCharDataEncoding() + { + $this->_validWriter->addCategories(array( + array('term'=>'cat_dog', 'label' => '<>&\'"áéíóú', 'scheme' => 'http://example.com/schema1'), + array('term'=>'cat_dog2') + )); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $expected = array( + array('term'=>'cat_dog', 'label' => '<>&\'"áéíóú', 'scheme' => 'http://example.com/schema1'), + array('term'=>'cat_dog2', 'label' => 'cat_dog2', 'scheme' => null) + ); + $this->assertEquals($expected, (array) $feed->getCategories()); + } + public function testHubsCanBeSet() { $this->_validWriter->addHubs( diff --git a/test/Writer/Renderer/Feed/RssTest.php b/test/Writer/Renderer/Feed/RssTest.php index 6040bd5b..fd993732 100644 --- a/test/Writer/Renderer/Feed/RssTest.php +++ b/test/Writer/Renderer/Feed/RssTest.php @@ -107,6 +107,18 @@ public function testFeedTitleIfMissingThrowsException() $rssFeed->render(); } + /** + * @group ZFWCHARDATA01 + */ + public function testFeedTitleCharDataEncoding() + { + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validWriter->setTitle('<>&\'"áéíóú'); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals('<>&\'"áéíóú', $feed->getTitle()); + } + public function testFeedDescriptionHasBeenSet() { $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); @@ -124,6 +136,18 @@ public function testFeedDescriptionThrowsExceptionIfMissing() $this->_validWriter->remove('description'); $rssFeed->render(); } + + /** + * @group ZFWCHARDATA01 + */ + public function testFeedDescriptionCharDataEncoding() + { + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validWriter->setDescription('<>&\'"áéíóú'); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals('<>&\'"áéíóú', $feed->getDescription()); + } public function testFeedUpdatedDateHasBeenSet() { @@ -245,6 +269,19 @@ public function testFeedHoldsAnyAuthorAdded() $this->assertEquals(array('name'=>'Joe'), $feed->getAuthor()); } + /** + * @group ZFWCHARDATA01 + */ + public function testFeedAuthorCharDataEncoding() + { + $this->_validWriter->addAuthor('<>&\'"áéíóú', 'joe@example.com', 'http://www.example.com/joe'); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $author = $feed->getAuthor(); + $this->assertEquals(array('name'=>'<>&\'"áéíóú'), $feed->getAuthor()); + } + public function testCopyrightCanBeSet() { $this->_validWriter->setCopyright('Copyright © 2009 Paddy'); @@ -254,6 +291,18 @@ public function testCopyrightCanBeSet() $this->assertEquals('Copyright © 2009 Paddy', $feed->getCopyright()); } + /** + * @group ZFWCHARDATA01 + */ + public function testCopyrightCharDataEncoding() + { + $this->_validWriter->setCopyright('<>&\'"áéíóú'); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals('<>&\'"áéíóú', $feed->getCopyright()); + } + public function testCategoriesCanBeSet() { $this->_validWriter->addCategories(array( @@ -270,6 +319,25 @@ public function testCategoriesCanBeSet() $this->assertEquals($expected, (array) $feed->getCategories()); } + /** + * @group ZFWCHARDATA01 + */ + public function testCategoriesCharDataEncoding() + { + $this->_validWriter->addCategories(array( + array('term'=>'<>&\'"áéíóú', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), + array('term'=>'cat_dog2') + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $expected = array( + array('term'=>'<>&\'"áéíóú', 'label' => '<>&\'"áéíóú', 'scheme' => 'http://example.com/schema1'), + array('term'=>'cat_dog2', 'label' => 'cat_dog2', 'scheme' => null) + ); + $this->assertEquals($expected, (array) $feed->getCategories()); + } + public function testHubsCanBeSet() { $this->_validWriter->addHubs( From b3c79f7fb8d74bba0973786877ee6cb35ca0b2e7 Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 19 Dec 2009 22:45:53 +0000 Subject: [PATCH 083/238] Adding Zend_Feed_Pubsubhubbub promoted to trunk. 7 tests currently fail - WIP for later git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19794 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub.php | 152 ++++ src/Pubsubhubbub/CallbackAbstract.php | 307 +++++++ src/Pubsubhubbub/CallbackInterface.php | 68 ++ src/Pubsubhubbub/Exception.php | 33 + src/Pubsubhubbub/HttpResponse.php | 233 +++++ src/Pubsubhubbub/Model/ModelAbstract.php | 64 ++ src/Pubsubhubbub/Model/Subscription.php | 122 +++ src/Pubsubhubbub/Publisher.php | 417 +++++++++ src/Pubsubhubbub/Subscriber.php | 849 ++++++++++++++++++ src/Pubsubhubbub/Subscriber/Callback.php | 323 +++++++ test/AllTests.php | 4 + test/Pubsubhubbub/AllTests.php | 71 ++ test/Pubsubhubbub/PublisherTest.php | 321 +++++++ test/Pubsubhubbub/PubsubhubbubTest.php | 56 ++ test/Pubsubhubbub/Subscriber/CallbackTest.php | 366 ++++++++ .../Pubsubhubbub/Subscriber/_files/atom10.xml | 4 + test/Pubsubhubbub/SubscriberHttpTest.php | 136 +++ test/Pubsubhubbub/SubscriberTest.php | 352 ++++++++ test/Pubsubhubbub/_files/rss20.xml | 8 + test/Pubsubhubbub/_files/testRawPostData.php | 3 + 20 files changed, 3889 insertions(+) create mode 100644 src/Pubsubhubbub.php create mode 100644 src/Pubsubhubbub/CallbackAbstract.php create mode 100644 src/Pubsubhubbub/CallbackInterface.php create mode 100644 src/Pubsubhubbub/Exception.php create mode 100644 src/Pubsubhubbub/HttpResponse.php create mode 100644 src/Pubsubhubbub/Model/ModelAbstract.php create mode 100644 src/Pubsubhubbub/Model/Subscription.php create mode 100644 src/Pubsubhubbub/Publisher.php create mode 100644 src/Pubsubhubbub/Subscriber.php create mode 100644 src/Pubsubhubbub/Subscriber/Callback.php create mode 100644 test/Pubsubhubbub/AllTests.php create mode 100644 test/Pubsubhubbub/PublisherTest.php create mode 100644 test/Pubsubhubbub/PubsubhubbubTest.php create mode 100644 test/Pubsubhubbub/Subscriber/CallbackTest.php create mode 100644 test/Pubsubhubbub/Subscriber/_files/atom10.xml create mode 100644 test/Pubsubhubbub/SubscriberHttpTest.php create mode 100644 test/Pubsubhubbub/SubscriberTest.php create mode 100644 test/Pubsubhubbub/_files/rss20.xml create mode 100644 test/Pubsubhubbub/_files/testRawPostData.php diff --git a/src/Pubsubhubbub.php b/src/Pubsubhubbub.php new file mode 100644 index 00000000..0675549b --- /dev/null +++ b/src/Pubsubhubbub.php @@ -0,0 +1,152 @@ +getHubs(); + } + + /** + * Allows the external environment to make Zend_Oauth use a specific + * Client instance. + * + * @param Zend_Http_Client $httpClient + * @return void + */ + public static function setHttpClient(Zend_Http_Client $httpClient) + { + self::$httpClient = $httpClient; + } + + /** + * Return the singleton instance of the HTTP Client. Note that + * the instance is reset and cleared of previous parameters GET/POST. + * Headers are NOT reset but handled by this component if applicable. + * + * @return Zend_Http_Client + */ + public static function getHttpClient() + { + if (!isset(self::$httpClient)): + self::$httpClient = new Zend_Http_Client; + else: + self::$httpClient->resetParameters(); + endif; + return self::$httpClient; + } + + /** + * Simple mechanism to delete the entire singleton HTTP Client instance + * which forces an new instantiation for subsequent requests. + * + * @return void + */ + public static function clearHttpClient() + { + self::$httpClient = null; + } + + /** + * RFC 3986 safe url encoding method + * + * @param string $string + * @return string + */ + public static function urlencode($string) + { + $rawencoded = rawurlencode($string); + $rfcencoded = str_replace('%7E', '~', $rawencoded); + return $rfcencoded; + } +} diff --git a/src/Pubsubhubbub/CallbackAbstract.php b/src/Pubsubhubbub/CallbackAbstract.php new file mode 100644 index 00000000..c094e8e2 --- /dev/null +++ b/src/Pubsubhubbub/CallbackAbstract.php @@ -0,0 +1,307 @@ +setConfig($config); + } + } + + /** + * Process any injected configuration options + * + * @param array|Zend_Config $options Options array or Zend_Config instance + * @return Zend_Feed_Pubsubhubbub_CallbackAbstract + */ + public function setConfig($config) + { + if ($config instanceof Zend_Config) { + $config = $config->toArray(); + } elseif (!is_array($config)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' + . 'expected, got ' . gettype($config)); + } + if (array_key_exists('storage', $config)) { + $this->setStorage($config['storage']); + } + return $this; + } + + /** + * Send the response, including all headers. + * If you wish to handle this via Zend_Controller, use the getter methods + * to retrieve any data needed to be set on your HTTP Response object, or + * simply give this object the HTTP Response instance to work with for you! + * + * @return void + */ + public function sendResponse() + { + $this->getHttpResponse()->sendResponse(); + } + + /** + * Sets an instance of Zend_Feed_Pubsubhubbub_Storage_StorageInterface used + * to background save any verification tokens associated with a subscription + * or other. + * + * @param Zend_Feed_Pubsubhubbub_Storage_StorageInterface $storage + * @return Zend_Feed_Pubsubhubbub_CallbackAbstract + */ + public function setStorage(Zend_Feed_Pubsubhubbub_Model_ModelAbstract $storage) + { + $this->_storage = $storage; + return $this; + } + + /** + * Gets an instance of Zend_Feed_Pubsubhubbub_Storage_StorageInterface used + * to background save any verification tokens associated with a subscription + * or other. + * + * @return Zend_Feed_Pubsubhubbub_Model_ModelAbstract + */ + public function getStorage() + { + if ($this->_storage === null) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('No storage object has been' + . ' set that subclasses Zend_Feed_Pubsubhubbub_Model_ModelAbstract'); + } + return $this->_storage; + } + + /** + * An instance of a class handling Http Responses. This is implemented in + * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with + * (i.e. not inherited from) Zend_Controller_Response_Http. + * + * @param Zend_Feed_Pubsubhubbub_HttpResponse|Zend_Controller_Response_Http $httpResponse + * @return Zend_Feed_Pubsubhubbub_CallbackAbstract + */ + public function setHttpResponse($httpResponse) + { + if (!is_object($httpResponse) + || (!$httpResponse instanceof Zend_Feed_Pubsubhubbub_HttpResponse + && !$httpResponse instanceof Zend_Controller_Response_Http) + ) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('HTTP Response object must' + . ' implement one of Zend_Feed_Pubsubhubbub_HttpResponse or' + . ' Zend_Controller_Response_Http'); + } + $this->_httpResponse = $httpResponse; + return $this; + } + + /** + * An instance of a class handling Http Responses. This is implemented in + * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with + * (i.e. not inherited from) Zend_Controller_Response_Http. + * + * @return Zend_Feed_Pubsubhubbub_HttpResponse|Zend_Controller_Response_Http + */ + public function getHttpResponse() + { + if ($this->_httpResponse === null) { + $this->_httpResponse = new Zend_Feed_Pubsubhubbub_HttpResponse; + } + return $this->_httpResponse; + } + + /** + * Sets the number of Subscribers for which any updates are on behalf of. + * In other words, is this class serving one or more subscribers? How many? + * Defaults to 1 if left unchanged. + * + * @param string|int $count + * @return Zend_Feed_Pubsubhubbub_CallbackAbstract + */ + public function setSubscriberCount($count) + { + $count = intval($count); + if ($count <= 0) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Subscriber count must be' + . ' greater than zero'); + } + $this->_subscriberCount = $count; + return $this; + } + + /** + * Gets the number of Subscribers for which any updates are on behalf of. + * In other words, is this class serving one or more subscribers? How many? + * + * @return int + */ + public function getSubscriberCount() + { + return $this->_subscriberCount; + } + + /** + * Attempt to detect the callback URL (specifically the path forward) + */ + protected function _detectCallbackUrl() + { + $callbackUrl = ''; + if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { + $callbackUrl = $_SERVER['HTTP_X_REWRITE_URL']; + } elseif (isset($_SERVER['REQUEST_URI'])) { + $callbackUrl = $_SERVER['REQUEST_URI']; + $scheme = 'http'; + if ($_SERVER['HTTPS'] == 'on') { + $scheme = 'https'; + } + $schemeAndHttpHost = $scheme . '://' . $this->_getHttpHost(); + if (strpos($callbackUrl, $schemeAndHttpHost) === 0) { + $callbackUrl = substr($callbackUrl, strlen($schemeAndHttpHost)); + } + } elseif (isset($_SERVER['ORIG_PATH_INFO'])) { + $callbackUrl= $_SERVER['ORIG_PATH_INFO']; + if (!empty($_SERVER['QUERY_STRING'])) { + $callbackUrl .= '?' . $_SERVER['QUERY_STRING']; + } + } + return $callbackUrl; + } + + /** + * Get the HTTP host + * + * @return string + */ + protected function _getHttpHost() + { + if (!empty($_SERVER['HTTP_HOST'])) { + return $_SERVER['HTTP_HOST']; + } + $scheme = 'http'; + if ($_SERVER['HTTPS'] == 'on') { + $scheme = 'https'; + } + $name = $_SERVER['SERVER_NAME']; + $port = $_SERVER['SERVER_PORT']; + if (($scheme == 'http' && $port == 80) + || ($scheme == 'https' && $port == 443) + ) { + return $name; + } else { + return $name . ':' . $port; + } + } + + /** + * Retrieve a Header value from either $_SERVER or Apache + * + * @param string $header + */ + protected function _getHeader($header) + { + $temp = strtoupper(str_replace('-', '_', $header)); + if (!empty($_SERVER[$temp])) { + return $_SERVER[$temp]; + } + $temp = 'HTTP_' . strtoupper(str_replace('-', '_', $header)); + if (!empty($_SERVER[$temp])) { + return $_SERVER[$temp]; + } + if (function_exists('apache_request_headers')) { + $headers = apache_request_headers(); + if (!empty($headers[$header])) { + return $headers[$header]; + } + } + return false; + } + + /** + * Return the raw body of the request + * + * @return string|false Raw body, or false if not present + */ + protected function _getRawBody() + { + $body = file_get_contents('php://input'); + if (strlen(trim($body)) == 0 && isset($GLOBALS['HTTP_RAW_POST_DATA'])) { + $body = $GLOBALS['HTTP_RAW_POST_DATA']; + } + if (strlen(trim($body)) > 0) { + return $body; + } + return false; + } +} diff --git a/src/Pubsubhubbub/CallbackInterface.php b/src/Pubsubhubbub/CallbackInterface.php new file mode 100644 index 00000000..36d74592 --- /dev/null +++ b/src/Pubsubhubbub/CallbackInterface.php @@ -0,0 +1,68 @@ +sendHeaders(); + echo $this->getBody(); + } + + /** + * Send all headers + * + * Sends any headers specified. If an {@link setHttpResponseCode() HTTP response code} + * has been specified, it is sent with the first header. + * + * @return void + */ + public function sendHeaders() + { + if (count($this->_headers) || (200 != $this->_httpResponseCode)) { + $this->canSendHeaders(true); + } elseif (200 == $this->_httpResponseCode) { + return; + } + $httpCodeSent = false; + foreach ($this->_headers as $header) { + if (!$httpCodeSent && $this->_httpResponseCode) { + header($header['name'] . ': ' . $header['value'], $header['replace'], $this->_httpResponseCode); + $httpCodeSent = true; + } else { + header($header['name'] . ': ' . $header['value'], $header['replace']); + } + } + if (!$httpCodeSent) { + header('HTTP/1.1 ' . $this->_httpResponseCode); + $httpCodeSent = true; + } + } + + /** + * Set a header + * + * If $replace is true, replaces any headers already defined with that + * $name. + * + * @param string $name + * @param string $value + * @param boolean $replace + * @return Zend_Feed_Pubsubhubbub_HttpResponse + */ + public function setHeader($name, $value, $replace = false) + { + $name = $this->_normalizeHeader($name); + $value = (string) $value; + if ($replace) { + foreach ($this->_headers as $key => $header) { + if ($name == $header['name']) { + unset($this->_headers[$key]); + } + } + } + $this->_headers[] = array( + 'name' => $name, + 'value' => $value, + 'replace' => $replace, + ); + + return $this; + } + + /** + * Check if a specific Header is set and return its value + * + * @param string $name + * @return string|null + */ + public function getHeader($name) + { + $name = $this->_normalizeHeader($name); + foreach ($this->_headers as $header) { + if ($header['name'] == $name) { + return $header['value']; + } + } + } + + /** + * Return array of headers; see {@link $_headers} for format + * + * @return array + */ + public function getHeaders() + { + return $this->_headers; + } + + /** + * Can we send headers? + * + * @param boolean $throw Whether or not to throw an exception if headers have been sent; defaults to false + * @return boolean + * @throws Zend_Feed_Pubsubhubbub_Exception + */ + public function canSendHeaders($throw = false) + { + $ok = headers_sent($file, $line); + if ($ok && $throw) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Cannot send headers; headers already sent in ' . $file . ', line ' . $line); + } + return !$ok; + } + + /** + * Set HTTP response code to use with headers + * + * @param int $code + * @return Zend_Feed_Pubsubhubbub_HttpResponse + */ + public function setHttpResponseCode($code) + { + if (!is_int($code) || (100 > $code) || (599 < $code)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid HTTP response' + . ' code:' . $code); + } + $this->_httpResponseCode = $code; + return $this; + } + + /** + * Retrieve HTTP response code + * + * @return int + */ + public function getHttpResponseCode() + { + return $this->_httpResponseCode; + } + + /** + * Set body content + * + * @param string $content + * @return Zend_Feed_Pubsubhubbub_HttpResponse + */ + public function setBody($content) + { + $this->_body = (string) $content; + $this->setHeader('content-length', strlen($content)); + return $this; + } + + /** + * Return the body content + * + * @return string + */ + public function getBody() + { + return $this->_body; + } + + /** + * Normalizes a header name to X-Capitalized-Names + * + * @param string $name + * @return string + */ + protected function _normalizeHeader($name) + { + $filtered = str_replace(array('-', '_'), ' ', (string) $name); + $filtered = ucwords(strtolower($filtered)); + $filtered = str_replace(' ', '-', $filtered); + return $filtered; + } +} diff --git a/src/Pubsubhubbub/Model/ModelAbstract.php b/src/Pubsubhubbub/Model/ModelAbstract.php new file mode 100644 index 00000000..d7eeb1d1 --- /dev/null +++ b/src/Pubsubhubbub/Model/ModelAbstract.php @@ -0,0 +1,64 @@ +_db = new Zend_Db_Table($table); + } else { + $this->_db = $tableGateway; + } + } + +} diff --git a/src/Pubsubhubbub/Model/Subscription.php b/src/Pubsubhubbub/Model/Subscription.php new file mode 100644 index 00000000..439402bc --- /dev/null +++ b/src/Pubsubhubbub/Model/Subscription.php @@ -0,0 +1,122 @@ +_db->find($data['id']); + if ($result) { + $data['created_time'] = $result->current()->created_time; + $this->_db->update( + $data, + $this->_db->getAdapter()->quoteInto('id = ?', $data['id']) + ); + return false; + } + + $this->_db->insert($data); + return true; + } + + /** + * Get subscription by ID/key + * + * @param string $key + * @return array + */ + public function getSubscription($key) + { + if (empty($key) || !is_string($key)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "key"' + .' of "' . $key . '" must be a non-empty string'); + } + $result = $this->_db->find($key); + if ($result) { + return (array) $result->current(); + } + return false; + } + + /** + * Determine if a subscription matching the key exists + * + * @param string $key + * @return bool + */ + public function hasSubscription($key) + { + if (empty($key) || !is_string($key)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "key"' + .' of "' . $key . '" must be a non-empty string'); + } + $result = $this->_db->find($key); + if ($result) { + return true; + } + return false; + } + + /** + * Delete a subscription + * + * @param string $key + * @return bool + */ + public function deleteSubscription($key) + { + $result = $this->_db->find($key); + if ($result) { + $this->_db->delete( + $this->_db->getAdapter()->quoteInto('id = ?', $key) + ); + return true; + } + return false; + } + +} diff --git a/src/Pubsubhubbub/Publisher.php b/src/Pubsubhubbub/Publisher.php new file mode 100644 index 00000000..0b4aa47a --- /dev/null +++ b/src/Pubsubhubbub/Publisher.php @@ -0,0 +1,417 @@ +setConfig($config); + } + } + + /** + * Process any injected configuration options + * + * @param array|Zend_Config $options Options array or Zend_Config instance + * @return Zend_Feed_Pubsubhubbub_Publisher + */ + public function setConfig($config) + { + if ($config instanceof Zend_Config) { + $config = $config->toArray(); + } elseif (!is_array($config)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' + . 'expected, got ' . gettype($config)); + } + if (array_key_exists('hubUrls', $config)) { + $this->addHubUrls($config['hubUrls']); + } + if (array_key_exists('updatedTopicUrls', $config)) { + $this->addUpdatedTopicUrls($config['updatedTopicUrls']); + } + if (array_key_exists('parameters', $config)) { + $this->setParameters($config['parameters']); + } + return $this; + } + + /** + * Add a Hub Server URL supported by Publisher + * + * @param string $url + * @return Zend_Feed_Pubsubhubbub_Publisher + */ + public function addHubUrl($url) + { + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' + .' of "' . $url . '" must be a non-empty string and a valid' + .'URL'); + } + $this->_hubUrls[] = $url; + return $this; + } + + /** + * Add an array of Hub Server URLs supported by Publisher + * + * @param array $urls + * @return Zend_Feed_Pubsubhubbub_Publisher + */ + public function addHubUrls(array $urls) + { + foreach ($urls as $url) { + $this->addHubUrl($url); + } + return $this; + } + + /** + * Remove a Hub Server URL + * + * @param string $url + * @return Zend_Feed_Pubsubhubbub_Publisher + */ + public function removeHubUrl($url) + { + if (!in_array($url, $this->getHubUrls())) { + return $this; + } + $key = array_search($url, $this->_hubUrls); + unset($this->_hubUrls[$key]); + return $this; + } + + /** + * Return an array of unique Hub Server URLs currently available + * + * @return array + */ + public function getHubUrls() + { + $this->_hubUrls = array_unique($this->_hubUrls); + return $this->_hubUrls; + } + + /** + * Add a URL to a topic (Atom or RSS feed) which has been updated + * + * @param string $url + * @return Zend_Feed_Pubsubhubbub_Publisher + */ + public function addUpdatedTopicUrl($url) + { + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' + .' of "' . $url . '" must be a non-empty string and a valid' + .'URL'); + } + $this->_updatedTopicUrls[] = $url; + return $this; + } + + /** + * Add an array of Topic URLs which have been updated + * + * @param array $urls + * @return Zend_Feed_Pubsubhubbub_Publisher + */ + public function addUpdatedTopicUrls(array $urls) + { + foreach ($urls as $url) { + $this->addUpdatedTopicUrl($url); + } + return $this; + } + + /** + * Remove an updated topic URL + * + * @param string $url + * @return Zend_Feed_Pubsubhubbub_Publisher + */ + public function removeUpdatedTopicUrl($url) + { + if (!in_array($url, $this->getUpdatedTopicUrls())) { + return $this; + } + $key = array_search($url, $this->_updatedTopicUrls); + unset($this->_updatedTopicUrls[$key]); + return $this; + } + + /** + * Return an array of unique updated topic URLs currently available + * + * @return array + */ + public function getUpdatedTopicUrls() + { + $this->_updatedTopicUrls = array_unique($this->_updatedTopicUrls); + return $this->_updatedTopicUrls; + } + + /** + * Notifies a single Hub Server URL of changes + * + * @param string $url The Hub Server's URL + * @return void + * @throws Zend_Feed_Pubsubhubbub_Exception Thrown on failure + */ + public function notifyHub($url) + { + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' + .' of "' . $url . '" must be a non-empty string and a valid' + .'URL'); + } + $client = $this->_getHttpClient(); + $client->setUri($url); + $response = $client->request(); + if ($response->getStatus() !== 204) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Notification to Hub Server ' + . 'at "' . $url . '" appears to have failed with a status code of "' + . $response->getStatus() . '" and message "' + . $response->getMessage() . '"'); + } + } + + /** + * Notifies all Hub Server URLs of changes + * + * If a Hub notification fails, certain data will be retained in an + * an array retrieved using getErrors(), if a failure occurs for any Hubs + * the isSuccess() check will return FALSE. This method is designed not + * to needlessly fail with an Exception/Error unless from Zend_Http_Client. + * + * @return void + * @throws Zend_Feed_Pubsubhubbub_Exception Thrown if no hubs attached + */ + public function notifyAll() + { + $client = $this->_getHttpClient(); + $hubs = $this->getHubUrls(); + if (empty($hubs)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('No Hub Server URLs' + . ' have been set so no notifcations can be sent'); + } + $this->_errors = array(); + foreach ($hubs as $url) { + $client->setUri($url); + $response = $client->request(); + if ($response->getStatus() !== 204) { + $this->_errors[] = array( + 'response' => $response, + 'hubUrl' => $url + ); + } + } + } + + /** + * Add an optional parameter to the update notification requests + * + * @param string $name + * @param string|null $value + * @return Zend_Feed_Pubsubhubbub_Publisher + */ + public function setParameter($name, $value = null) + { + if (is_array($name)) { + $this->setParameters($name); + return $this; + } + if (empty($name) || !is_string($name)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' + .' of "' . $name . '" must be a non-empty string'); + } + if ($value === null) { + $this->removeParameter($name); + return $this; + } + if (empty($value) || (!is_string($value) && !is_null($value))) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "value"' + .' of "' . $value . '" must be a non-empty string'); + } + $this->_parameters[$name] = $value; + return $this; + } + + /** + * Add an optional parameter to the update notification requests + * + * @param array $parameters + * @return Zend_Feed_Pubsubhubbub_Publisher + */ + public function setParameters(array $parameters) + { + foreach ($parameters as $name => $value) { + $this->setParameter($name, $value); + } + return $this; + } + + /** + * Remove an optional parameter for the notification requests + * + * @param string $name + * @return Zend_Feed_Pubsubhubbub_Publisher + */ + public function removeParameter($name) + { + if (empty($name) || !is_string($name)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' + .' of "' . $name . '" must be a non-empty string'); + } + if (array_key_exists($name, $this->_parameters)) { + unset($this->_parameters[$name]); + } + return $this; + } + + /** + * Return an array of optional parameters for notification requests + * + * @return array + */ + public function getParameters() + { + return $this->_parameters; + } + + /** + * Returns a boolean indicator of whether the notifications to Hub + * Servers were ALL successful. If even one failed, FALSE is returned. + * + * @return bool + */ + public function isSuccess() + { + if (count($this->_errors) > 0) { + return false; + } + return true; + } + + /** + * Return an array of errors met from any failures, including keys: + * 'response' => the Zend_Http_Response object from the failure + * 'hubUrl' => the URL of the Hub Server whose notification failed + * + * @return array + */ + public function getErrors() + { + return $this->_errors; + } + + /** + * Get a basic prepared HTTP client for use + * + * @return Zend_Http_Client + */ + protected function _getHttpClient() + { + $client = Zend_Feed_Pubsubhubbub::getHttpClient(); + $client->setMethod(Zend_Http_Client::POST); + $client->setConfig(array( + 'useragent' => 'Zend_Feed_Pubsubhubbub_Publisher/' . Zend_Version::VERSION, + )); + $params = array(); + $params[] = 'hub.mode=publish'; + $topics = $this->getUpdatedTopicUrls(); + if (empty($topics)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('No updated topic URLs' + . ' have been set'); + } + foreach ($topics as $topicUrl) { + $params[] = 'hub.url=' . urlencode($topicUrl); + } + $optParams = $this->getParameters(); + foreach ($optParams as $name => $value) { + $params[] = urlencode($name) . '=' . urlencode($value); + } + $paramString = implode('&', $params); + $client->setRawData($paramString); + return $client; + } +} diff --git a/src/Pubsubhubbub/Subscriber.php b/src/Pubsubhubbub/Subscriber.php new file mode 100644 index 00000000..e192f943 --- /dev/null +++ b/src/Pubsubhubbub/Subscriber.php @@ -0,0 +1,849 @@ +setConfig($config); + } + } + + /** + * Process any injected configuration options + * + * @param array|Zend_Config $options Options array or Zend_Config instance + * @return Zend_Feed_Pubsubhubbub_Subscriber + */ + public function setConfig($config) + { + if ($config instanceof Zend_Config) { + $config = $config->toArray(); + } elseif (!is_array($config)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' + . ' expected, got ' . gettype($config)); + } + if (array_key_exists('hubUrls', $config)) { + $this->addHubUrls($config['hubUrls']); + } + if (array_key_exists('callbackUrl', $config)) { + $this->setCallbackUrl($config['callbackUrl']); + } + if (array_key_exists('topicUrl', $config)) { + $this->setTopicUrl($config['topicUrl']); + } + if (array_key_exists('storage', $config)) { + $this->setStorage($config['storage']); + } + if (array_key_exists('leaseSeconds', $config)) { + $this->setLeaseSeconds($config['leaseSeconds']); + } + if (array_key_exists('parameters', $config)) { + $this->setParameters($config['parameters']); + } + if (array_key_exists('authentications', $config)) { + $this->addAuthentications($config['authentications']); + } + if (array_key_exists('usePathParameter', $config)) { + $this->usePathParameter($config['usePathParameter']); + } + if (array_key_exists('preferredVerificationMode', $config)) { + $this->setPreferredVerificationMode( + $config['preferredVerificationMode'] + ); + } + return $this; + } + + /** + * Set the topic URL (RSS or Atom feed) to which the intended (un)subscribe + * event will relate + * + * @param string $url + * @return Zend_Feed_Pubsubhubbub_Subscriber + */ + public function setTopicUrl($url) + { + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' + .' of "' . $url . '" must be a non-empty string and a valid' + .' URL'); + } + $this->_topicUrl = $url; + return $this; + } + + /** + * Set the topic URL (RSS or Atom feed) to which the intended (un)subscribe + * event will relate + * + * @return string + */ + public function getTopicUrl() + { + if (empty($this->_topicUrl)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('A valid Topic (RSS or Atom' + . ' feed) URL MUST be set before attempting any operation'); + } + return $this->_topicUrl; + } + + /** + * Set the number of seconds for which any subscription will remain valid + * + * @param int $seconds + * @return Zend_Feed_Pubsubhubbub_Subscriber + */ + public function setLeaseSeconds($seconds) + { + $seconds = intval($seconds); + if ($seconds <= 0) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Expected lease seconds' + . ' must be an integer greater than zero'); + } + $this->_leaseSeconds = $seconds; + return $this; + } + + /** + * Get the number of lease seconds on subscriptions + * + * @return int + */ + public function getLeaseSeconds() + { + return $this->_leaseSeconds; + } + + /** + * Set the callback URL to be used by Hub Servers when communicating with + * this Subscriber + * + * @param string $url + * @return Zend_Feed_Pubsubhubbub_Subscriber + */ + public function setCallbackUrl($url) + { + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' + . ' of "' . $url . '" must be a non-empty string and a valid' + . ' URL'); + } + $this->_callbackUrl = $url; + return $this; + } + + /** + * Get the callback URL to be used by Hub Servers when communicating with + * this Subscriber + * + * @return string + */ + public function getCallbackUrl() + { + if (empty($this->_callbackUrl)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('A valid Callback URL MUST be' + . ' set before attempting any operation'); + } + return $this->_callbackUrl; + } + + /** + * Set preferred verification mode (sync or async). By default, this + * Subscriber prefers synchronous verification, but does support + * asynchronous if that's the Hub Server's utilised mode. + * + * Zend_Feed_Pubsubhubbub_Subscriber will always send both modes, whose + * order of occurance in the parameter list determines this preference. + * + * @param string $mode Should be 'sync' or 'async' + * @return Zend_Feed_Pubsubhubbub_Subscriber + */ + public function setPreferredVerificationMode($mode) + { + if ($mode !== Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC + && $mode !== Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid preferred' + . ' mode specified: "' . $mode . '" but should be one of' + . ' Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC or' + . ' Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC'); + } + $this->_preferredVerificationMode = $mode; + return $this; + } + + /** + * Get preferred verification mode (sync or async). + * + * @return string + */ + public function getPreferredVerificationMode() + { + return $this->_preferredVerificationMode; + } + + /** + * Add a Hub Server URL supported by Publisher + * + * @param string $url + * @return Zend_Feed_Pubsubhubbub_Subscriber + */ + public function addHubUrl($url) + { + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' + . ' of "' . $url . '" must be a non-empty string and a valid' + . ' URL'); + } + $this->_hubUrls[] = $url; + return $this; + } + + /** + * Add an array of Hub Server URLs supported by Publisher + * + * @param array $urls + * @return Zend_Feed_Pubsubhubbub_Subscriber + */ + public function addHubUrls(array $urls) + { + foreach ($urls as $url) { + $this->addHubUrl($url); + } + return $this; + } + + /** + * Remove a Hub Server URL + * + * @param string $url + * @return Zend_Feed_Pubsubhubbub_Subscriber + */ + public function removeHubUrl($url) + { + if (!in_array($url, $this->getHubUrls())) { + return $this; + } + $key = array_search($url, $this->_hubUrls); + unset($this->_hubUrls[$key]); + return $this; + } + + /** + * Return an array of unique Hub Server URLs currently available + * + * @return array + */ + public function getHubUrls() + { + $this->_hubUrls = array_unique($this->_hubUrls); + return $this->_hubUrls; + } + + /** + * Add authentication credentials for a given URL + * + * @param string $url + * @param array $authentication + * @return Zend_Feed_Pubsubhubbub_Subscriber + */ + public function addAuthentication($url, array $authentication) + { + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' + . ' of "' . $url . '" must be a non-empty string and a valid' + . ' URL'); + } + $this->_authentications[$url] = $authentication; + return $this; + } + + /** + * Add authentication credentials for hub URLs + * + * @param array $authentications + * @return Zend_Feed_Pubsubhubbub_Subscriber + */ + public function addAuthentications(array $authentications) + { + foreach ($authentications as $url => $authentication) { + $this->addAuthentication($url, $authentication); + } + return $this; + } + + /** + * Get all hub URL authentication credentials + * + * @return array + */ + public function getAuthentications() + { + return $this->_authentications; + } + + /** + * Set flag indicating whether or not to use a path parameter + * + * @param bool $bool + * @return Zend_Feed_Pubsubhubbub_Subscriber + */ + public function usePathParameter($bool = true) + { + $this->_usePathParameter = $bool; + return $this; + } + + /** + * Add an optional parameter to the (un)subscribe requests + * + * @param string $name + * @param string|null $value + * @return Zend_Feed_Pubsubhubbub_Subscriber + */ + public function setParameter($name, $value = null) + { + if (is_array($name)) { + $this->setParameters($name); + return $this; + } + if (empty($name) || !is_string($name)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' + . ' of "' . $name . '" must be a non-empty string'); + } + if ($value === null) { + $this->removeParameter($name); + return $this; + } + if (empty($value) || (!is_string($value) && !is_null($value))) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "value"' + . ' of "' . $value . '" must be a non-empty string'); + } + $this->_parameters[$name] = $value; + return $this; + } + + /** + * Add an optional parameter to the (un)subscribe requests + * + * @param string $name + * @param string|null $value + * @return Zend_Feed_Pubsubhubbub_Subscriber + */ + public function setParameters(array $parameters) + { + foreach ($parameters as $name => $value) { + $this->setParameter($name, $value); + } + return $this; + } + + /** + * Remove an optional parameter for the (un)subscribe requests + * + * @param string $name + * @return Zend_Feed_Pubsubhubbub_Subscriber + */ + public function removeParameter($name) + { + if (empty($name) || !is_string($name)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' + . ' of "' . $name . '" must be a non-empty string'); + } + if (array_key_exists($name, $this->_parameters)) { + unset($this->_parameters[$name]); + } + return $this; + } + + /** + * Return an array of optional parameters for (un)subscribe requests + * + * @return array + */ + public function getParameters() + { + return $this->_parameters; + } + + /** + * Sets an instance of Zend_Feed_Pubsubhubbub_Entity used to background + * save any verification tokens associated with a subscription or other. + * + * @param Zend_Feed_Pubsubhubbub_Entity $storage + * @return Zend_Feed_Pubsubhubbub_Subscriber + */ + public function setStorage(Zend_Feed_Pubsubhubbub_Model_ModelAbstract $storage) + { + $this->_storage = $storage; + return $this; + } + + /** + * Gets an instance of Zend_Feed_Pubsubhubbub_Storage_StorageInterface used + * to background save any verification tokens associated with a subscription + * or other. + * + * @return Zend_Feed_Pubsubhubbub_Storage_StorageInterface + */ + public function getStorage() + { + if ($this->_storage === null) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('No storage vehicle ' + . 'has been set.'); + } + return $this->_storage; + } + + /** + * Subscribe to one or more Hub Servers using the stored Hub URLs + * for the given Topic URL (RSS or Atom feed) + * + * @return void + */ + public function subscribeAll() + { + return $this->_doRequest('subscribe'); + } + + /** + * Unsubscribe from one or more Hub Servers using the stored Hub URLs + * for the given Topic URL (RSS or Atom feed) + * + * @return void + */ + public function unsubscribeAll() + { + return $this->_doRequest('unsubscribe'); + } + + /** + * Returns a boolean indicator of whether the notifications to Hub + * Servers were ALL successful. If even one failed, FALSE is returned. + * + * @return bool + */ + public function isSuccess() + { + if (count($this->_errors) > 0) { + return false; + } + return true; + } + + /** + * Return an array of errors met from any failures, including keys: + * 'response' => the Zend_Http_Response object from the failure + * 'hubUrl' => the URL of the Hub Server whose notification failed + * + * @return array + */ + public function getErrors() + { + return $this->_errors; + } + + /** + * Return an array of Hub Server URLs who returned a response indicating + * operation in Asynchronous Verification Mode, i.e. they will not confirm + * any (un)subscription immediately but at a later time (Hubs may be + * doing this as a batch process when load balancing) + * + * @return array + */ + public function getAsyncHubs() + { + return $this->_asyncHubs; + } + + /** + * Executes an (un)subscribe request + * + * @param string $mode + * @return void + */ + protected function _doRequest($mode) + { + $client = $this->_getHttpClient(); + $hubs = $this->getHubUrls(); + if (empty($hubs)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('No Hub Server URLs' + . ' have been set so no subscriptions can be attempted'); + } + $this->_errors = array(); + $this->_asyncHubs = array(); + foreach ($hubs as $url) { + if (array_key_exists($url, $this->_authentications)) { + $auth = $this->_authentications[$url]; + $client->setAuth($auth[0], $auth[1]); + } + $client->setUri($url); + $client->setRawData($this->_getRequestParameters($url, $mode)); + $response = $client->request(); + echo $client->getLastRequest(); + if ($response->getStatus() !== 204 + && $response->getStatus() !== 202 + ) { + $this->_errors[] = array( + 'response' => $response, + 'hubUrl' => $url, + ); + /** + * At first I thought it was needed, but the backend storage will + * allow tracking async without any user interference. It's left + * here in case the user is interested in knowing what Hubs + * are using async verification modes so they may update Models and + * move these to asynchronous processes. + */ + } elseif ($response->getStatus() == 202) { + $this->_asyncHubs[] = array( + 'response' => $response, + 'hubUrl' => $url, + ); + } + } + } + + /** + * Get a basic prepared HTTP client for use + * + * @param string $mode Must be "subscribe" or "unsubscribe" + * @return Zend_Http_Client + */ + protected function _getHttpClient() + { + $client = Zend_Feed_Pubsubhubbub::getHttpClient(); + $client->setMethod(Zend_Http_Client::POST); + $client->setConfig(array('useragent' => 'Zend_Feed_Pubsubhubbub_Subscriber/' + . Zend_Version::VERSION)); + return $client; + } + + /** + * Return a list of standard protocol/optional parameters for addition to + * client's POST body that are specific to the current Hub Server URL + * + * @param string $hubUrl + * @param mode $hubUrl + * @return string + */ + protected function _getRequestParameters($hubUrl, $mode) + { + if (!in_array($mode, array('subscribe', 'unsubscribe'))) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid mode specified: "' + . $mode . '" which should have been "subscribe" or "unsubscribe"'); + } + + $params = array( + 'hub.mode' => $mode, + 'hub.topic' => $this->getTopicUrl(), + ); + + if ($this->getPreferredVerificationMode() + == Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC + ) { + $vmodes = array( + Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC, + Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC, + ); + } else { + $vmodes = array( + Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC, + Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC, + ); + } + $params['hub.verify'] = array(); + foreach($vmodes as $vmode) { + $params['hub.verify'][] = $vmode; + } + + /** + * Establish a persistent verify_token and attach key to callback + * URL's path/querystring + */ + $key = $this->_generateSubscriptionKey($params); + $token = $this->_generateVerifyToken(); + $params['hub.verify_token'] = $token; + + // Note: query string only usable with PuSH 0.2 Hubs + if (!$this->_usePathParameter) { + $params['hub.callback'] = $this->getCallbackUrl() + . '?xhub.subscription=' . Zend_Feed_Pubsubhubbub::urlencode($key); + } else { + $params['hub.callback'] = $this->getCallbackUrl() + . '/' . Zend_Feed_Pubsubhubbub::urlencode($key); + } + if ($mode == 'subscribe' && !is_null($this->getLeaseSeconds())) { + $params['hub.lease_seconds'] = $this->getLeaseSeconds(); + } + + // TODO: hub.secret not currently supported + $optParams = $this->getParameters(); + foreach ($optParams as $name => $value) { + $params[$name] = $value; + } + + // store subscription to storage + $data = array( + 'id' => $key, + 'topic_url' => $params['hub.topic'], + 'hub_url' => $hubUrl, + 'created_time' => time(), + 'last_modified' => time(), + 'lease_seconds' => isset($params['hub.lease_seconds']) ? $params['hub.lease_seconds'] : null, + 'verify_token' => hash('sha256', $params['hub.verify_token']), + 'secret' => null, + 'expiration_time' => isset($params['hub.lease_seconds']) ? time() + $params['hub.lease_seconds'] : null, + 'subscription_state' => Zend_Feed_Pubsubhubbub::SUBSCRIPTION_NOTVERIFIED, + ); + $this->getStorage()->setSubscription($data); + + return $this->_toByteValueOrderedString( + $this->_urlEncode($params) + ); + } + + /** + * Simple helper to generate a verification token used in (un)subscribe + * requests to a Hub Server. Follows no particular method, which means + * it might be improved/changed in future. + * + * @param string $hubUrl The Hub Server URL for which this token will apply + * @return string + */ + protected function _generateVerifyToken() + { + if (!empty($this->_testStaticToken)) { + return $this->_testStaticToken; + } + return uniqid(rand(), true) . time(); + } + + /** + * Simple helper to generate a verification token used in (un)subscribe + * requests to a Hub Server. + * + * @param string $hubUrl The Hub Server URL for which this token will apply + * @return string + */ + protected function _generateSubscriptionKey(array $params) + { + $keyBase = $params['hub.topic'] . $params['hub.callback']; + $key = md5($keyBase); + return $key; + } + + /** + * URL Encode an array of parameters + * + * @param array $params + * @return array + */ + protected function _urlEncode(array $params) + { + $encoded = array(); + foreach ($params as $key => $value) { + if (is_array($value)) { + $ekey = Zend_Feed_Pubsubhubbub::urlencode($key); + $encoded[$ekey] = array(); + foreach ($value as $duplicateKey) { + $encoded[$ekey][] + = Zend_Feed_Pubsubhubbub::urlencode($duplicateKey); + } + } else { + $encoded[Zend_Feed_Pubsubhubbub::urlencode($key)] + = Zend_Feed_Pubsubhubbub::urlencode($value); + } + } + return $encoded; + } + + /** + * Order outgoing parameters + * + * @param array $params + * @return array + */ + protected function _toByteValueOrderedString(array $params) + { + $return = array(); + uksort($params, 'strnatcmp'); + foreach ($params as $key => $value) { + if (is_array($value)) { + foreach ($value as $keyduplicate) { + $return[] = $key . '=' . $keyduplicate; + } + } else { + $return[] = $key . '=' . $value; + } + } + return implode('&', $return); + } + + /** + * This is STRICTLY for testing purposes only... + */ + protected $_testStaticToken = null; + + final public function setTestStaticToken($token) + { + $this->_testStaticToken = (string) $token; + } +} diff --git a/src/Pubsubhubbub/Subscriber/Callback.php b/src/Pubsubhubbub/Subscriber/Callback.php new file mode 100644 index 00000000..1f92a4f0 --- /dev/null +++ b/src/Pubsubhubbub/Subscriber/Callback.php @@ -0,0 +1,323 @@ +_subscriptionKey = $key; + return $this; + } + + /** + * Handle any callback from a Hub Server responding to a subscription or + * unsubscription request. This should be the Hub Server confirming the + * the request prior to taking action on it. + * + * @param array $httpGetData GET data if available and not in $_GET + * @param bool $sendResponseNow Whether to send response now or when asked + * @return void + */ + public function handle(array $httpGetData = null, $sendResponseNow = false) + { + if ($httpGetData === null) { + $httpGetData = $_GET; + } + + /** + * Handle any feed updates (sorry for the mess :P) + * + * This DOES NOT attempt to process a feed update. Feed updates + * SHOULD be validated/processed by an asynchronous process so as + * to avoid holding up responses to the Hub. + */ + if (strtolower($_SERVER['REQUEST_METHOD']) == 'post' + && $this->_hasValidVerifyToken(null, false) + && ($this->_getHeader('Content-Type') == 'application/atom+xml' + || $this->_getHeader('Content-Type') == 'application/rss+xml' + || $this->_getHeader('Content-Type') == 'application/rdf+xml') + ) { + $this->setFeedUpdate($this->_getRawBody()); + $this->getHttpResponse() + ->setHeader('X-Hub-On-Behalf-Of', $this->getSubscriberCount()); + /** + * Handle any (un)subscribe confirmation requests + */ + } elseif ($this->isValidHubVerification($httpGetData)) { + $data = $this->_currentSubscriptionData; + $this->getHttpResponse()->setBody($httpGetData['hub_challenge']); + $data['verified'] = 1; + $this->getStorage()->setSubscription($data); + /** + * Hey, C'mon! We tried everything else! + */ + } else { + $this->getHttpResponse()->setHttpResponseCode(404); + } + if ($sendResponseNow) { + $this->sendResponse(); + } + } + + /** + * Checks validity of the request simply by making a quick pass and + * confirming the presence of all REQUIRED parameters. + * + * @param array $httpGetData + * @return bool + */ + public function isValidHubVerification(array $httpGetData) + { + /** + * As per the specification, the hub.verify_token is OPTIONAL. This + * implementation of Pubsubhubbub considers it REQUIRED and will + * always send a hub.verify_token parameter to be echoed back + * by the Hub Server. Therefore, its absence is considered invalid. + */ + if (strtolower($_SERVER['REQUEST_METHOD']) !== 'get') { + return false; + } + $required = array( + 'hub_mode', + 'hub_topic', + 'hub_challenge', + 'hub_verify_token', + ); + foreach ($required as $key) { + if (!array_key_exists($key, $httpGetData)) { + return false; + } + } + if ($httpGetData['hub_mode'] !== 'subscribe' + && $httpGetData['hub_mode'] !== 'unsubscribe' + ) { + return false; + } + if ($httpGetData['hub_mode'] == 'subscribe' + && !array_key_exists('hub_lease_seconds', $httpGetData) + ) { + return false; + } + if (!Zend_Uri::check($httpGetData['hub_topic'])) { + return false; + } + + /** + * Attempt to retrieve any Verification Token Key attached to Callback + * URL's path by our Subscriber implementation + */ + if (!$this->_hasValidVerifyToken($httpGetData)) { + return false; + } + return true; + } + + /** + * Sets a newly received feed (Atom/RSS) sent by a Hub as an update to a + * Topic we've subscribed to. + * + * @param string $feed + * @return Zend_Feed_Pubsubhubbub_Subscriber_Callback + */ + public function setFeedUpdate($feed) + { + $this->_feedUpdate = $feed; + return $this; + } + + /** + * Check if any newly received feed (Atom/RSS) update was received + * + * @return bool + */ + public function hasFeedUpdate() + { + if (is_null($this->_feedUpdate)) { + return false; + } + return true; + } + + /** + * Gets a newly received feed (Atom/RSS) sent by a Hub as an update to a + * Topic we've subscribed to. + * + * @return string + */ + public function getFeedUpdate() + { + return $this->_feedUpdate; + } + + /** + * Check for a valid verify_token. By default attempts to compare values + * with that sent from Hub, otherwise merely ascertains its existence. + * + * @param array $httpGetData + * @param bool $checkValue + * @return bool + */ + protected function _hasValidVerifyToken(array $httpGetData = null, $checkValue = true) + { + $verifyTokenKey = $this->_detectVerifyTokenKey($httpGetData); + if (empty($verifyTokenKey)) { + return false; + } + $verifyTokenExists = $this->getStorage()->hasSubscription($verifyTokenKey); + if (!$verifyTokenExists) { + return false; + } + if ($checkValue) { + $data = $this->getStorage()->getSubscription($verifyTokenKey); + $verifyToken = $data['verify_token']; + if ($verifyToken !== hash('sha256', $httpGetData['hub_verify_token'])) { + return false; + } + $this->_currentSubscriptionData = $data; + return true; + } + return true; + } + + /** + * Attempt to detect the verification token key. This would be passed in + * the Callback URL (which we are handling with this class!) as a URI + * path part (the last part by convention). + * + * @param null|array $httpGetData + * @return false|string + */ + protected function _detectVerifyTokenKey(array $httpGetData = null) + { + /** + * Available when sub keys encoding in Callback URL path + */ + if (isset($this->_subscriptionKey)) { + return $this->_subscriptionKey; + } + + /** + * Available only if allowed by PuSH 0.2 Hubs + */ + if (is_array($httpGetData) + && isset($httpGetData['xhub_subscription']) + ) { + return $httpGetData['xhub_subscription']; + } + + /** + * Available (possibly) if corrupted in transit and not part of $_GET + */ + $params = $this->_parseQueryString(); + if (isset($params['xhub.subscription'])) { + return rawurldecode($params['xhub.subscription']); + } + + return false; + } + + /** + * Build an array of Query String parameters. + * This bypasses $_GET which munges parameter names and cannot accept + * multiple parameters with the same key. + * + * @return array|void + */ + protected function _parseQueryString() + { + $params = array(); + $queryString = ''; + if (isset($_SERVER['QUERY_STRING'])) { + $queryString = $_SERVER['QUERY_STRING']; + } + if (empty($queryString)) { + return array(); + } + $parts = explode('&', $queryString); + foreach ($parts as $kvpair) { + $pair = explode('=', $kvpair); + $key = rawurldecode($pair[0]); + $value = rawurldecode($pair[1]); + if (isset($params[$key])) { + if (is_array($params[$key])) { + $params[$key][] = $value; + } else { + $params[$key] = array($params[$key], $value); + } + } else { + $params[$key] = $value; + } + } + return $params; + } +} diff --git a/test/AllTests.php b/test/AllTests.php index aef8f9b3..fc414c34 100644 --- a/test/AllTests.php +++ b/test/AllTests.php @@ -61,6 +61,8 @@ require_once 'Zend/Feed/Writer/Extension/ITunes/EntryTest.php'; require_once 'Zend/Feed/Writer/Extension/ITunes/FeedTest.php'; +require_once 'Zend/Feed/Pubsubhubbub/AllTests.php'; + /** * @category Zend * @package Zend_Feed @@ -125,6 +127,8 @@ public static function suite() $suite->addTestSuite('Zend_Feed_Writer_Extension_ITunes_EntryTest'); $suite->addTestSuite('Zend_Feed_Writer_Extension_ITunes_FeedTest'); + + $suite->addTest(Zend_Feed_Pubsubhubbub_AllTests::suite()); return $suite; } diff --git a/test/Pubsubhubbub/AllTests.php b/test/Pubsubhubbub/AllTests.php new file mode 100644 index 00000000..30788d5c --- /dev/null +++ b/test/Pubsubhubbub/AllTests.php @@ -0,0 +1,71 @@ +addTestSuite('Zend_Feed_Pubsubhubbub_PubsubhubbubTest'); + $suite->addTestSuite('Zend_Feed_Pubsubhubbub_PublisherTest'); + $suite->addTestSuite('Zend_Feed_Pubsubhubbub_SubscriberTest'); + $suite->addTestSuite('Zend_Feed_Pubsubhubbub_SubscriberHttpTest'); + $suite->addTestSuite('Zend_Feed_Pubsubhubbub_Subscriber_CallbackTest'); + + return $suite; + } +} + +if (PHPUnit_MAIN_METHOD == 'Zend_Feed_Pubsubhubbub_AllTests::main') { + Zend_Feed_Pubsubhubbub_AllTests::main(); +} diff --git a/test/Pubsubhubbub/PublisherTest.php b/test/Pubsubhubbub/PublisherTest.php new file mode 100644 index 00000000..14b15c05 --- /dev/null +++ b/test/Pubsubhubbub/PublisherTest.php @@ -0,0 +1,321 @@ +_publisher = new Zend_Feed_Pubsubhubbub_Publisher; + } + + public function testAddsHubServerUrl() + { + $this->_publisher->addHubUrl('http://www.example.com/hub'); + $this->assertEquals(array('http://www.example.com/hub'), $this->_publisher->getHubUrls()); + } + + public function testAddsHubServerUrlsFromArray() + { + $this->_publisher->addHubUrls(array( + 'http://www.example.com/hub', 'http://www.example.com/hub2' + )); + $this->assertEquals(array( + 'http://www.example.com/hub', 'http://www.example.com/hub2' + ), $this->_publisher->getHubUrls()); + } + + public function testAddsHubServerUrlsFromArrayUsingSetConfig() + { + $this->_publisher->setConfig(array('hubUrls' => array( + 'http://www.example.com/hub', 'http://www.example.com/hub2' + ))); + $this->assertEquals(array( + 'http://www.example.com/hub', 'http://www.example.com/hub2' + ), $this->_publisher->getHubUrls()); + } + + public function testRemovesHubServerUrl() + { + $this->_publisher->addHubUrls(array( + 'http://www.example.com/hub', 'http://www.example.com/hub2' + )); + $this->_publisher->removeHubUrl('http://www.example.com/hub'); + $this->assertEquals(array( + 1 => 'http://www.example.com/hub2' + ), $this->_publisher->getHubUrls()); + } + + public function testRetrievesUniqueHubServerUrlsOnly() + { + $this->_publisher->addHubUrls(array( + 'http://www.example.com/hub', 'http://www.example.com/hub2', + 'http://www.example.com/hub' + )); + $this->assertEquals(array( + 'http://www.example.com/hub', 'http://www.example.com/hub2' + ), $this->_publisher->getHubUrls()); + } + + public function testThrowsExceptionOnSettingEmptyHubServerUrl() + { + try { + $this->_publisher->addHubUrl(''); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + + public function testThrowsExceptionOnSettingNonStringHubServerUrl() + { + try { + $this->_publisher->addHubUrl(123); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + + public function testThrowsExceptionOnSettingInvalidHubServerUrl() + { + try { + $this->_publisher->addHubUrl('http://'); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + public function testAddsUpdatedTopicUrl() + { + $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); + $this->assertEquals(array('http://www.example.com/topic'), $this->_publisher->getUpdatedTopicUrls()); + } + + public function testAddsUpdatedTopicUrlsFromArray() + { + $this->_publisher->addUpdatedTopicUrls(array( + 'http://www.example.com/topic', 'http://www.example.com/topic2' + )); + $this->assertEquals(array( + 'http://www.example.com/topic', 'http://www.example.com/topic2' + ), $this->_publisher->getUpdatedTopicUrls()); + } + + public function testAddsUpdatedTopicUrlsFromArrayUsingSetConfig() + { + $this->_publisher->setConfig(array('updatedTopicUrls' => array( + 'http://www.example.com/topic', 'http://www.example.com/topic2' + ))); + $this->assertEquals(array( + 'http://www.example.com/topic', 'http://www.example.com/topic2' + ), $this->_publisher->getUpdatedTopicUrls()); + } + + public function testRemovesUpdatedTopicUrl() + { + $this->_publisher->addUpdatedTopicUrls(array( + 'http://www.example.com/topic', 'http://www.example.com/topic2' + )); + $this->_publisher->removeUpdatedTopicUrl('http://www.example.com/topic'); + $this->assertEquals(array( + 1 => 'http://www.example.com/topic2' + ), $this->_publisher->getUpdatedTopicUrls()); + } + + public function testRetrievesUniqueUpdatedTopicUrlsOnly() + { + $this->_publisher->addUpdatedTopicUrls(array( + 'http://www.example.com/topic', 'http://www.example.com/topic2', + 'http://www.example.com/topic' + )); + $this->assertEquals(array( + 'http://www.example.com/topic', 'http://www.example.com/topic2' + ), $this->_publisher->getUpdatedTopicUrls()); + } + + public function testThrowsExceptionOnSettingEmptyUpdatedTopicUrl() + { + try { + $this->_publisher->addUpdatedTopicUrl(''); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + + public function testThrowsExceptionOnSettingNonStringUpdatedTopicUrl() + { + try { + $this->_publisher->addUpdatedTopicUrl(123); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + + public function testThrowsExceptionOnSettingInvalidUpdatedTopicUrl() + { + try { + $this->_publisher->addUpdatedTopicUrl('http://'); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + public function testAddsParameter() + { + $this->_publisher->setParameter('foo', 'bar'); + $this->assertEquals(array('foo'=>'bar'), $this->_publisher->getParameters()); + } + + public function testAddsParametersFromArray() + { + $this->_publisher->setParameters(array( + 'foo' => 'bar', 'boo' => 'baz' + )); + $this->assertEquals(array( + 'foo' => 'bar', 'boo' => 'baz' + ), $this->_publisher->getParameters()); + } + + public function testAddsParametersFromArrayInSingleMethod() + { + $this->_publisher->setParameter(array( + 'foo' => 'bar', 'boo' => 'baz' + )); + $this->assertEquals(array( + 'foo' => 'bar', 'boo' => 'baz' + ), $this->_publisher->getParameters()); + } + + public function testAddsParametersFromArrayUsingSetConfig() + { + $this->_publisher->setConfig(array('parameters' => array( + 'foo' => 'bar', 'boo' => 'baz' + ))); + $this->assertEquals(array( + 'foo' => 'bar', 'boo' => 'baz' + ), $this->_publisher->getParameters()); + } + + public function testRemovesParameter() + { + $this->_publisher->setParameters(array( + 'foo' => 'bar', 'boo' => 'baz' + )); + $this->_publisher->removeParameter('boo'); + $this->assertEquals(array( + 'foo' => 'bar' + ), $this->_publisher->getParameters()); + } + + public function testRemovesParameterIfSetToNull() + { + $this->_publisher->setParameters(array( + 'foo' => 'bar', 'boo' => 'baz' + )); + $this->_publisher->setParameter('boo', null); + $this->assertEquals(array( + 'foo' => 'bar' + ), $this->_publisher->getParameters()); + } + + public function testNotifiesHubWithCorrectParameters() + { + Zend_Feed_Pubsubhubbub::setHttpClient(new Zend_Feed_Pubsubhubbub_PublisherTest_ClientSuccess); + $client = Zend_Feed_Pubsubhubbub::getHttpClient(); + $this->_publisher->addHubUrl('http://www.example.com/hub'); + $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); + $this->_publisher->setParameter('foo', 'bar'); + $this->_publisher->notifyAll(); + $this->assertEquals('hub.mode=publish&hub.url=http%3A%2F%2Fwww.example.com%2Ftopic&foo=bar', $client->getBody()); + } + + public function testNotifiesHubWithCorrectParametersAndMultipleTopics() + { + Zend_Feed_Pubsubhubbub::setHttpClient(new Zend_Feed_Pubsubhubbub_PublisherTest_ClientSuccess); + $client = Zend_Feed_Pubsubhubbub::getHttpClient(); + $this->_publisher->addHubUrl('http://www.example.com/hub'); + $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); + $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic2'); + $this->_publisher->notifyAll(); + $this->assertEquals('hub.mode=publish&hub.url=http%3A%2F%2Fwww.example.com%2Ftopic&hub.url=http%3A%2F%2Fwww.example.com%2Ftopic2', $client->getBody()); + } + + public function testNotifiesHubAndReportsSuccess() + { + Zend_Feed_Pubsubhubbub::setHttpClient(new Zend_Feed_Pubsubhubbub_PublisherTest_ClientSuccess); + $client = Zend_Feed_Pubsubhubbub::getHttpClient(); + $this->_publisher->addHubUrl('http://www.example.com/hub'); + $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); + $this->_publisher->setParameter('foo', 'bar'); + $this->_publisher->notifyAll(); + $this->assertTrue($this->_publisher->isSuccess()); + } + + public function testNotifiesHubAndReportsFail() + { + Zend_Feed_Pubsubhubbub::setHttpClient(new Zend_Feed_Pubsubhubbub_PublisherTest_ClientFail); + $client = Zend_Feed_Pubsubhubbub::getHttpClient(); + $this->_publisher->addHubUrl('http://www.example.com/hub'); + $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); + $this->_publisher->setParameter('foo', 'bar'); + $this->_publisher->notifyAll(); + $this->assertFalse($this->_publisher->isSuccess()); + } + +} + +// Some stubs for what Http_Client would be doing + +class Zend_Feed_Pubsubhubbub_PublisherTest_ClientSuccess extends Zend_Http_Client +{ + public function request($method = null) { + $response = new Zend_Feed_Pubsubhubbub_PublisherTest_ResponseSuccess; + return $response; + } + public function getBody(){return $this->_prepareBody();} +} +class Zend_Feed_Pubsubhubbub_PublisherTest_ClientFail extends Zend_Http_Client +{ + public function request($method = null) { + $response = new Zend_Feed_Pubsubhubbub_PublisherTest_ResponseFail; + return $response; + } + public function getBody(){return $this->_prepareBody();} +} +class Zend_Feed_Pubsubhubbub_PublisherTest_ResponseSuccess +{ + public function getStatus(){return 204;} +} +class Zend_Feed_Pubsubhubbub_PublisherTest_ResponseFail +{ + public function getStatus(){return 404;} +} diff --git a/test/Pubsubhubbub/PubsubhubbubTest.php b/test/Pubsubhubbub/PubsubhubbubTest.php new file mode 100644 index 00000000..7de767c6 --- /dev/null +++ b/test/Pubsubhubbub/PubsubhubbubTest.php @@ -0,0 +1,56 @@ +assertType('Test_Http_Client_Pubsub', Zend_Feed_Pubsubhubbub::getHttpClient()); + } + + public function testCanDetectHubs() + { + $feed = Zend_Feed_Reader::importFile(dirname(__FILE__) . '/_files/rss20.xml'); + $this->assertEquals(array( + 'http://www.example.com/hub', 'http://www.example.com/hub2' + ), Zend_Feed_Pubsubhubbub::detectHubs($feed)); + } + +} + +class Test_Http_Client_Pubsub extends Zend_Http_Client {} diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php new file mode 100644 index 00000000..728aa4dd --- /dev/null +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -0,0 +1,366 @@ +_callback = new Zend_Feed_Pubsubhubbub_Subscriber_Callback; + + $this->_adapter = $this->_getCleanMock( + 'Zend_Db_Adapter_Abstract' + ); + $this->_tableGateway = $this->_getCleanMock( + 'Zend_Db_Table_Abstract' + ); + $this->_rowset = $this->_getCleanMock( + 'Zend_Db_Table_Rowset_Abstract' + ); + + $this->_tableGateway->expects($this->any())->method('getAdapter') + ->will($this->returnValue($this->_adapter)); + $storage = new Zend_Feed_Pubsubhubbub_Model_Subscription($this->_tableGateway); + $this->_callback->setStorage($storage); + + $this->_get = array( + 'hub_mode' => 'subscribe', + 'hub_topic' => 'http://www.example.com/topic', + 'hub_challenge' => 'abc', + 'hub_verify_token' => 'cba', + 'hub_mode' => 'subscribe', + 'hub_lease_seconds' => '1234567' + ); + + $this->_originalServer = $_SERVER; + $_SERVER['REQUEST_METHOD'] = 'get'; + $_SERVER['QUERY_STRING'] = 'xhub.subscription=verifytokenkey'; + } + + public function tearDown() + { + $_SERVER = $this->_originalServer; + } + + + public function testCanSetHttpResponseObject() + { + $this->_callback->setHttpResponse(new Zend_Feed_Pubsubhubbub_HttpResponse); + $this->assertTrue($this->_callback->getHttpResponse() instanceof Zend_Feed_Pubsubhubbub_HttpResponse); + } + + public function testCanUsesDefaultHttpResponseObject() + { + $this->assertTrue($this->_callback->getHttpResponse() instanceof Zend_Feed_Pubsubhubbub_HttpResponse); + } + + public function testThrowsExceptionOnInvalidHttpResponseObjectSet() + { + try { + $this->_callback->setHttpResponse(new stdClass); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + public function testThrowsExceptionIfNonObjectSetAsHttpResponseObject() + { + try { + $this->_callback->setHttpResponse(''); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + public function testCanSetSubscriberCount() + { + $this->_callback->setSubscriberCount('10000'); + $this->assertEquals(10000, $this->_callback->getSubscriberCount()); + } + + public function testDefaultSubscriberCountIsOne() + { + $this->assertEquals(1, $this->_callback->getSubscriberCount()); + } + + public function testThrowsExceptionOnSettingZeroAsSubscriberCount() + { + try { + $this->_callback->setSubscriberCount(0); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + public function testThrowsExceptionOnSettingLessThanZeroAsSubscriberCount() + { + try { + $this->_callback->setSubscriberCount(-1); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntegerAsSubscriberCount() + { + try { + $this->_callback->setSubscriberCount('0aa'); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + + public function testCanSetStorageImplementation() + { + $storage = new Zend_Feed_Pubsubhubbub_Model_ModelAbstract($this->_tableGateway); + $this->_callback->setStorage($storage); + $this->assertThat($this->_callback->getStorage(), $this->identicalTo($storage)); + } + + /** + * @group ZFP001 + */ + public function testValidatesValidHttpGetData() + { + $this->_adapter->expects($this->once()) + ->method('find') + ->with($this->equalTo('verifytokenkey')) + ->will($this->returnValue($this->_rowset)); + $this->_rowset->expects($this->once()) + ->method('current') + ->will($this->returnValue(array( + 'verify_token' => hash('sha256', 'verifytokenkey') + ))); + $this->assertTrue($this->_callback->isValidHubVerification($this->_get)); + } + + public function testReturnsFalseIfHubVerificationNotAGetRequest() + { + $_SERVER['REQUEST_METHOD'] = 'POST'; + $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); + } + + public function testReturnsFalseIfModeMissingFromHttpGetData() + { + unset($this->_get['hub_mode']); + $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); + } + + public function testReturnsFalseIfTopicMissingFromHttpGetData() + { + unset($this->_get['hub_topic']); + $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); + } + + public function testReturnsFalseIfChallengeMissingFromHttpGetData() + { + unset($this->_get['hub_challenge']); + $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); + } + + public function testReturnsFalseIfVerifyTokenMissingFromHttpGetData() + { + unset($this->_get['hub_verify_token']); + $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); + } + + public function testReturnsTrueIfModeSetAsUnsubscribeFromHttpGetData() + { + $this->_get['hub_mode'] = 'unsubscribe'; + $this->assertTrue($this->_callback->isValidHubVerification($this->_get)); + } + + public function testReturnsFalseIfModeNotRecognisedFromHttpGetData() + { + $this->_get['hub_mode'] = 'abc'; + $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); + } + + public function testReturnsFalseIfLeaseSecondsMissedWhenModeIsSubscribeFromHttpGetData() + { + unset($this->_get['hub_lease_seconds']); + $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); + } + + public function testReturnsFalseIfHubTopicInvalidFromHttpGetData() + { + $this->_get['hub_topic'] = 'http://'; + $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); + } + + public function testReturnsFalseIfVerifyTokenRecordDoesNotExistForConfirmRequest() + { + //$this->_callback->setStorage(new Zend_Feed_Pubsubhubbub_Subscriber_CallbackTestStorageHasNot); + $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); + } + + public function testReturnsFalseIfVerifyTokenRecordDoesNotAgreeWithConfirmRequest() + { + //$this->_callback->setStorage(new Zend_Feed_Pubsubhubbub_Subscriber_CallbackTestStorageHasButWrong); + $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); + } + + public function testRespondsToInvalidConfirmationWith404Response() + { + unset($this->_get['hub_mode']); + $this->_callback->handle($this->_get); + $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 404); + } + + public function testRespondsToValidConfirmationWith200Response() + { + $this->_callback->handle($this->_get); + $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 200); + } + + public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() + { + $this->_callback->handle($this->_get); + $this->assertTrue($this->_callback->getHttpResponse()->getBody() == 'abc'); + } + + public function testRespondsToValidFeedUpdateRequestWith200Response() + { + $_SERVER['REQUEST_METHOD'] = 'POST'; + $_SERVER['REQUEST_URI'] = '/some/path/callback/verifytokenkey'; + $_SERVER['CONTENT_TYPE'] = 'application/atom+xml'; + $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); + $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; // dirty alternative to php://input + $this->_callback->handle(array()); + $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 200); + } + + public function testRespondsToInvalidFeedUpdateNotPostWith404Response() + { // yes, this example makes no sense for GET - I know!!! + $_SERVER['REQUEST_METHOD'] = 'GET'; + $_SERVER['REQUEST_URI'] = '/some/path/callback/verifytokenkey'; + $_SERVER['CONTENT_TYPE'] = 'application/atom+xml'; + $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); + $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; + $this->_callback->handle(array()); + $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 404); + } + + public function testRespondsToInvalidFeedUpdateWrongMimeWith404Response() + { + $_SERVER['REQUEST_METHOD'] = 'POST'; + $_SERVER['REQUEST_URI'] = '/some/path/callback/verifytokenkey'; + $_SERVER['CONTENT_TYPE'] = 'application/kml+xml'; + $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); + $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; + $this->_callback->handle(array()); + $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 404); + } + + /** + * As a judgement call, we must respond to any successful request, regardless + * of the wellformedness of any XML payload, by returning a 2xx response code. + * The validation of feeds and their processing must occur outside the Hubbub + * protocol. + */ + public function testRespondsToInvalidFeedUpdateWrongFeedTypeForMimeWith200Response() + { + $_SERVER['REQUEST_METHOD'] = 'POST'; + $_SERVER['REQUEST_URI'] = '/some/path/callback/verifytokenkey'; + $_SERVER['CONTENT_TYPE'] = 'application/rss+xml'; + $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); + $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; + $this->_callback->handle(array()); + $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 200); + } + + public function testRespondsToValidFeedUpdateWithXHubOnBehalfOfHeader() + { + $_SERVER['REQUEST_METHOD'] = 'POST'; + $_SERVER['REQUEST_URI'] = '/some/path/callback/verifytokenkey'; + $_SERVER['CONTENT_TYPE'] = 'application/atom+xml'; + $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); + $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; + $this->_callback->handle(array()); + $this->assertTrue($this->_callback->getHttpResponse()->getHeader('X-Hub-On-Behalf-Of') == 1); + } + + protected function _getCleanMock($className) { + $class = new ReflectionClass($className); + $methods = $class->getMethods(); + $stubMethods = array(); + foreach ($methods as $method) { + if ($method->isPublic() || ($method->isProtected() + && $method->isAbstract())) { + $stubMethods[] = $method->getName(); + } + } + $mocked = $this->getMock( + $className, + $stubMethods, + array(), + $className . '_PubsubSubscriberMock_' . uniqid(), + false + ); + return $mocked; + } + +} + +/** + * Stubs for storage access + * DEPRECATED +class Zend_Feed_Pubsubhubbub_Subscriber_CallbackTestStorageHas implements Zend_Feed_Pubsubhubbub_Storage_StorageInterface +{ + public function setSubscription($key, array $data){} + public function getSubscription($key){ + if ($key == 'verifytokenkey') { + return array( + 'id' => 'verifytokenkey', + 'verify_token' => hash('sha256', 'cba') + ); + } + } + public function hasSubscription($key){return true;} + public function removeSubscription($key){} + public function cleanup($type){} +} +class Zend_Feed_Pubsubhubbub_Subscriber_CallbackTestStorageHasNot implements Zend_Feed_Pubsubhubbub_Storage_StorageInterface +{ + public function setSubscription($key, array $data){} + public function getSubscription($key){} + public function hasSubscription($key){return false;} + public function removeSubscription($key){} + public function cleanup($type){} +} +class Zend_Feed_Pubsubhubbub_Subscriber_CallbackTestStorageHasButWrong implements Zend_Feed_Pubsubhubbub_Storage_StorageInterface +{ + public function setSubscription($key, array $data){} + public function getSubscription($key){return 'wrong';} + public function hasSubscription($key){return true;} + public function removeSubscription($key){} + public function cleanup($type){} +}*/ diff --git a/test/Pubsubhubbub/Subscriber/_files/atom10.xml b/test/Pubsubhubbub/Subscriber/_files/atom10.xml new file mode 100644 index 00000000..18683bf9 --- /dev/null +++ b/test/Pubsubhubbub/Subscriber/_files/atom10.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/test/Pubsubhubbub/SubscriberHttpTest.php b/test/Pubsubhubbub/SubscriberHttpTest.php new file mode 100644 index 00000000..81cb2933 --- /dev/null +++ b/test/Pubsubhubbub/SubscriberHttpTest.php @@ -0,0 +1,136 @@ +_baseuri must point to a directory on a web server + * containing all the files under the _files directory. You should symlink + * or copy these files and set '_baseuri' properly using the constant in + * TestConfiguration.php (based on TestConfiguration.php.dist) + * + * You can also set the proper constant in your test configuration file to + * point to the right place. + * + * @category Zend + * @package Zend_Feed + * @subpackage UnitTests + * @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_Pubsubhubbub_SubscriberHttpTest extends PHPUnit_Framework_TestCase +{ + + protected $_subscriber = null; + + protected $_baseuri; + + protected $_client = null; + + protected $_adapter = null; + + protected $_config = array( + 'adapter' => 'Zend_Http_Client_Adapter_Socket' + ); + + public function setUp() + { + if (defined('TESTS_Zend_Feed_Pubsubhubbub_BASEURI') && + Zend_Uri_Http::check(TESTS_Zend_Feed_Pubsubhubbub_BASEURI)) { + $this->_baseuri = TESTS_Zend_Feed_Pubsubhubbub_BASEURI; + if (substr($this->_baseuri, -1) != '/') $this->_baseuri .= '/'; + $name = $this->getName(); + if (($pos = strpos($name, ' ')) !== false) { + $name = substr($name, 0, $pos); + } + $uri = $this->_baseuri . $name . '.php'; + $this->_adapter = new $this->_config['adapter']; + $this->_client = new Zend_Http_Client($uri, $this->_config); + $this->_client->setAdapter($this->_adapter); + Zend_Feed_Pubsubhubbub::setHttpClient($this->_client); + $this->_subscriber = new Zend_Feed_Pubsubhubbub_Subscriber; + + + $this->_storage = $this->_getCleanMock('Zend_Feed_Pubsubhubbub_Entity_TopicSubscription'); + $this->_subscriber->setStorage($this->_storage); + + } else { + // Skip tests + $this->markTestSkipped("Zend_Feed_Pubsubhubbub_Subscriber dynamic tests' + . ' are not enabled in TestConfiguration.php"); + } + } + + public function testSubscriptionRequestSendsExpectedPostData() + { + $this->_subscriber->setTopicUrl('http://www.example.com/topic'); + $this->_subscriber->addHubUrl($this->_baseuri . '/testRawPostData.php'); + $this->_subscriber->setCallbackUrl('http://www.example.com/callback'); + $this->_subscriber->setTestStaticToken('abc'); // override for testing + $this->_subscriber->subscribeAll(); + $this->assertEquals( + 'hub.callback=http%3A%2F%2Fwww.example.com%2Fcallback%3Fxhub.subscription%3D5536df06b5d' + .'cb966edab3a4c4d56213c16a8184b&hub.lease_seconds=2592000&hub.mode=' + .'subscribe&hub.topic=http%3A%2F%2Fwww.example.com%2Ftopic&hub.veri' + .'fy=sync&hub.verify=async&hub.verify_token=abc', + $this->_client->getLastResponse()->getBody()); + } + + public function testUnsubscriptionRequestSendsExpectedPostData() + { + $this->_subscriber->setTopicUrl('http://www.example.com/topic'); + $this->_subscriber->addHubUrl($this->_baseuri . '/testRawPostData.php'); + $this->_subscriber->setCallbackUrl('http://www.example.com/callback'); + $this->_subscriber->setTestStaticToken('abc'); //override for testing + $this->_subscriber->unsubscribeAll(); + $this->assertEquals( + 'hub.callback=http%3A%2F%2Fwww.example.com%2Fcallback%3Fxhub.subscription%3D5536df06b5d' + .'cb966edab3a4c4d56213c16a8184b&hub.mode=unsubscribe&hub.topic=http' + .'%3A%2F%2Fwww.example.com%2Ftopic&hub.verify=sync&hub.verify=async' + .'&hub.verify_token=abc', + $this->_client->getLastResponse()->getBody()); + } + + protected function _getCleanMock($className) { + $class = new ReflectionClass($className); + $methods = $class->getMethods(); + $stubMethods = array(); + foreach ($methods as $method) { + if ($method->isPublic() || ($method->isProtected() + && $method->isAbstract())) { + $stubMethods[] = $method->getName(); + } + } + $mocked = $this->getMock( + $className, + $stubMethods, + array(), + $className . '_SubscriberHttpTestMock_' . uniqid(), + false + ); + return $mocked; + } + +} diff --git a/test/Pubsubhubbub/SubscriberTest.php b/test/Pubsubhubbub/SubscriberTest.php new file mode 100644 index 00000000..5720d5fb --- /dev/null +++ b/test/Pubsubhubbub/SubscriberTest.php @@ -0,0 +1,352 @@ +_subscriber = new Zend_Feed_Pubsubhubbub_Subscriber; + $this->_adapter = $this->_getCleanMock( + 'Zend_Db_Adapter_Abstract' + ); + $this->_tableGateway = $this->_getCleanMock( + 'Zend_Db_Table_Abstract' + ); + $this->_tableGateway->expects($this->any())->method('getAdapter') + ->will($this->returnValue($this->_adapter)); + } + + + public function testAddsHubServerUrl() + { + $this->_subscriber->addHubUrl('http://www.example.com/hub'); + $this->assertEquals(array('http://www.example.com/hub'), $this->_subscriber->getHubUrls()); + } + + public function testAddsHubServerUrlsFromArray() + { + $this->_subscriber->addHubUrls(array( + 'http://www.example.com/hub', 'http://www.example.com/hub2' + )); + $this->assertEquals(array( + 'http://www.example.com/hub', 'http://www.example.com/hub2' + ), $this->_subscriber->getHubUrls()); + } + + public function testAddsHubServerUrlsFromArrayUsingSetConfig() + { + $this->_subscriber->setConfig(array('hubUrls' => array( + 'http://www.example.com/hub', 'http://www.example.com/hub2' + ))); + $this->assertEquals(array( + 'http://www.example.com/hub', 'http://www.example.com/hub2' + ), $this->_subscriber->getHubUrls()); + } + + public function testRemovesHubServerUrl() + { + $this->_subscriber->addHubUrls(array( + 'http://www.example.com/hub', 'http://www.example.com/hub2' + )); + $this->_subscriber->removeHubUrl('http://www.example.com/hub'); + $this->assertEquals(array( + 1 => 'http://www.example.com/hub2' + ), $this->_subscriber->getHubUrls()); + } + + public function testRetrievesUniqueHubServerUrlsOnly() + { + $this->_subscriber->addHubUrls(array( + 'http://www.example.com/hub', 'http://www.example.com/hub2', + 'http://www.example.com/hub' + )); + $this->assertEquals(array( + 'http://www.example.com/hub', 'http://www.example.com/hub2' + ), $this->_subscriber->getHubUrls()); + } + + public function testThrowsExceptionOnSettingEmptyHubServerUrl() + { + try { + $this->_subscriber->addHubUrl(''); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + public function testThrowsExceptionOnSettingNonStringHubServerUrl() + { + try { + $this->_subscriber->addHubUrl(123); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + public function testThrowsExceptionOnSettingInvalidHubServerUrl() + { + try { + $this->_subscriber->addHubUrl('http://'); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + public function testAddsParameter() + { + $this->_subscriber->setParameter('foo', 'bar'); + $this->assertEquals(array('foo'=>'bar'), $this->_subscriber->getParameters()); + } + + public function testAddsParametersFromArray() + { + $this->_subscriber->setParameters(array( + 'foo' => 'bar', 'boo' => 'baz' + )); + $this->assertEquals(array( + 'foo' => 'bar', 'boo' => 'baz' + ), $this->_subscriber->getParameters()); + } + + public function testAddsParametersFromArrayInSingleMethod() + { + $this->_subscriber->setParameter(array( + 'foo' => 'bar', 'boo' => 'baz' + )); + $this->assertEquals(array( + 'foo' => 'bar', 'boo' => 'baz' + ), $this->_subscriber->getParameters()); + } + + public function testAddsParametersFromArrayUsingSetConfig() + { + $this->_subscriber->setConfig(array('parameters' => array( + 'foo' => 'bar', 'boo' => 'baz' + ))); + $this->assertEquals(array( + 'foo' => 'bar', 'boo' => 'baz' + ), $this->_subscriber->getParameters()); + } + + public function testRemovesParameter() + { + $this->_subscriber->setParameters(array( + 'foo' => 'bar', 'boo' => 'baz' + )); + $this->_subscriber->removeParameter('boo'); + $this->assertEquals(array( + 'foo' => 'bar' + ), $this->_subscriber->getParameters()); + } + + public function testRemovesParameterIfSetToNull() + { + $this->_subscriber->setParameters(array( + 'foo' => 'bar', 'boo' => 'baz' + )); + $this->_subscriber->setParameter('boo', null); + $this->assertEquals(array( + 'foo' => 'bar' + ), $this->_subscriber->getParameters()); + } + + public function testCanSetTopicUrl() + { + $this->_subscriber->setTopicUrl('http://www.example.com/topic'); + $this->assertEquals('http://www.example.com/topic', $this->_subscriber->getTopicUrl()); + } + + public function testThrowsExceptionOnSettingEmptyTopicUrl() + { + try { + $this->_subscriber->setTopicUrl(''); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + + public function testThrowsExceptionOnSettingNonStringTopicUrl() + { + try { + $this->_subscriber->setTopicUrl(123); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + + public function testThrowsExceptionOnSettingInvalidTopicUrl() + { + try { + $this->_subscriber->setTopicUrl('http://'); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + public function testThrowsExceptionOnMissingTopicUrl() + { + try { + $this->_subscriber->getTopicUrl(); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + public function testCanSetCallbackUrl() + { + $this->_subscriber->setCallbackUrl('http://www.example.com/callback'); + $this->assertEquals('http://www.example.com/callback', $this->_subscriber->getCallbackUrl()); + } + + public function testThrowsExceptionOnSettingEmptyCallbackUrl() + { + try { + $this->_subscriber->setCallbackUrl(''); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + + public function testThrowsExceptionOnSettingNonStringCallbackUrl() + { + try { + $this->_subscriber->setCallbackUrl(123); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + + public function testThrowsExceptionOnSettingInvalidCallbackUrl() + { + try { + $this->_subscriber->setCallbackUrl('http://'); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + public function testThrowsExceptionOnMissingCallbackUrl() + { + try { + $this->_subscriber->getCallbackUrl(); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + public function testCanSetLeaseSeconds() + { + $this->_subscriber->setLeaseSeconds('10000'); + $this->assertEquals(10000, $this->_subscriber->getLeaseSeconds()); + } + + public function testThrowsExceptionOnSettingZeroAsLeaseSeconds() + { + try { + $this->_subscriber->setLeaseSeconds(0); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + public function testThrowsExceptionOnSettingLessThanZeroAsLeaseSeconds() + { + try { + $this->_subscriber->setLeaseSeconds(-1); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntegerAsLeaseSeconds() + { + try { + $this->_subscriber->setLeaseSeconds('0aa'); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + public function testCanSetPreferredVerificationMode() + { + $this->_subscriber->setPreferredVerificationMode(Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC); + $this->assertEquals(Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC, $this->_subscriber->getPreferredVerificationMode()); + } + + public function testSetsPreferredVerificationModeThrowsExceptionOnSettingBadMode() + { + try { + $this->_subscriber->setPreferredVerificationMode('abc'); + $this->fail('Should not fail as an Exception would be raised and caught'); + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } + + public function testPreferredVerificationModeDefaultsToSync() + { + $this->assertEquals(Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC, $this->_subscriber->getPreferredVerificationMode()); + } + + public function testCanSetStorageImplementation() + { + $storage = new Zend_Feed_Pubsubhubbub_Model_Subscription($this->_tableGateway); + $this->_subscriber->setStorage($storage); + $this->assertThat($this->_subscriber->getStorage(), $this->identicalTo($storage)); + } + + /** + * @expectedException Zend_Feed_Pubsubhubbub_Exception + */ + public function testGetStorageThrowsExceptionIfNoneSet() + { + $this->_subscriber->getStorage(); + } + + protected function _getCleanMock($className) { + $class = new ReflectionClass($className); + $methods = $class->getMethods(); + $stubMethods = array(); + foreach ($methods as $method) { + if ($method->isPublic() || ($method->isProtected() + && $method->isAbstract())) { + $stubMethods[] = $method->getName(); + } + } + $mocked = $this->getMock( + $className, + $stubMethods, + array(), + $className . '_PubsubSubscriberMock_' . uniqid(), + false + ); + return $mocked; + } + +} diff --git a/test/Pubsubhubbub/_files/rss20.xml b/test/Pubsubhubbub/_files/rss20.xml new file mode 100644 index 00000000..80b98e12 --- /dev/null +++ b/test/Pubsubhubbub/_files/rss20.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/test/Pubsubhubbub/_files/testRawPostData.php b/test/Pubsubhubbub/_files/testRawPostData.php new file mode 100644 index 00000000..990f7360 --- /dev/null +++ b/test/Pubsubhubbub/_files/testRawPostData.php @@ -0,0 +1,3 @@ + Date: Sun, 20 Dec 2009 00:30:58 +0000 Subject: [PATCH 084/238] Updated tests to pass additional two tests relying on new Subscription model git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19796 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Pubsubhubbub/Subscriber/CallbackTest.php | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php index 728aa4dd..1716bcab 100644 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -145,19 +145,16 @@ public function testCanSetStorageImplementation() $this->assertThat($this->_callback->getStorage(), $this->identicalTo($storage)); } - /** - * @group ZFP001 - */ public function testValidatesValidHttpGetData() { - $this->_adapter->expects($this->once()) + $this->_tableGateway->expects($this->any()) ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); - $this->_rowset->expects($this->once()) + $this->_rowset->expects($this->any()) ->method('current') ->will($this->returnValue(array( - 'verify_token' => hash('sha256', 'verifytokenkey') + 'verify_token' => hash('sha256', 'cba') ))); $this->assertTrue($this->_callback->isValidHubVerification($this->_get)); } @@ -191,10 +188,19 @@ public function testReturnsFalseIfVerifyTokenMissingFromHttpGetData() unset($this->_get['hub_verify_token']); $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); } - + public function testReturnsTrueIfModeSetAsUnsubscribeFromHttpGetData() { $this->_get['hub_mode'] = 'unsubscribe'; + $this->_tableGateway->expects($this->any()) + ->method('find') + ->with($this->equalTo('verifytokenkey')) + ->will($this->returnValue($this->_rowset)); + $this->_rowset->expects($this->any()) + ->method('current') + ->will($this->returnValue(array( + 'verify_token' => hash('sha256', 'cba') + ))); $this->assertTrue($this->_callback->isValidHubVerification($this->_get)); } From a261c6423781777e28c5a542db9391060609eeb0 Mon Sep 17 00:00:00 2001 From: padraic Date: Sun, 20 Dec 2009 01:18:12 +0000 Subject: [PATCH 085/238] Zend_Feed_Pubsubhubbub: Patched a test to use correct mocked workflow for Subscription model git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19799 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Pubsubhubbub/Subscriber/CallbackTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php index 1716bcab..d93f339d 100644 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -243,6 +243,18 @@ public function testRespondsToInvalidConfirmationWith404Response() public function testRespondsToValidConfirmationWith200Response() { + $this->_get['hub_mode'] = 'unsubscribe'; + $this->_tableGateway->expects($this->any()) + ->method('find') + ->with($this->equalTo('verifytokenkey')) + ->will($this->returnValue($this->_rowset)); + $rowdata = new stdClass; + $rowdata->id = 'verifytokenkey'; + $rowdata->verify_token = hash('sha256', 'cba'); + $rowdata->created_time = time(); + $this->_rowset->expects($this->any()) + ->method('current') + ->will($this->returnValue($rowdata)); $this->_callback->handle($this->_get); $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 200); } From 1bbec4753eb3266e9bb5ee02af2967ece2669667 Mon Sep 17 00:00:00 2001 From: padraic Date: Sun, 20 Dec 2009 01:27:58 +0000 Subject: [PATCH 086/238] Increased mock object detail in a test - leave nothing to chance! git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19800 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Pubsubhubbub/Subscriber/CallbackTest.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php index d93f339d..3ed28d17 100644 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -251,10 +251,23 @@ public function testRespondsToValidConfirmationWith200Response() $rowdata = new stdClass; $rowdata->id = 'verifytokenkey'; $rowdata->verify_token = hash('sha256', 'cba'); - $rowdata->created_time = time(); + $t = time(); + $rowdata->created_time = $t; $this->_rowset->expects($this->any()) ->method('current') ->will($this->returnValue($rowdata)); + + $this->_tableGateway->expects($this->once()) + ->method('update') + ->with( + $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t,'verified'=>'1')), + $this->equalTo('id = \'verifytokenkey\'') + ); + $this->_adapter->expects($this->once()) + ->method('quoteInto') + ->with($this->equalTo('id = ?'), $this->equalTo('verifytokenkey')) + ->will($this->returnValue('id = \'verifytokenkey\'')); + $this->_callback->handle($this->_get); $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 200); } From 16f04f152118bd5c848143e23a9008584727b1cf Mon Sep 17 00:00:00 2001 From: padraic Date: Sun, 20 Dec 2009 13:09:31 +0000 Subject: [PATCH 087/238] Zend_Feed_Pubsubhubbub: All tests restored to 100% pass rate git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19804 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Pubsubhubbub/Subscriber/CallbackTest.php | 68 ++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php index 3ed28d17..b7a9fffb 100644 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -274,6 +274,29 @@ public function testRespondsToValidConfirmationWith200Response() public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() { + $this->_tableGateway->expects($this->any()) + ->method('find') + ->with($this->equalTo('verifytokenkey')) + ->will($this->returnValue($this->_rowset)); + $rowdata = new stdClass; + $rowdata->id = 'verifytokenkey'; + $rowdata->verify_token = hash('sha256', 'cba'); + $t = time(); + $rowdata->created_time = $t; + $this->_rowset->expects($this->any()) + ->method('current') + ->will($this->returnValue($rowdata)); + + $this->_tableGateway->expects($this->once()) + ->method('update') + ->with( + $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t,'verified'=>'1')), + $this->equalTo('id = \'verifytokenkey\'') + ); + $this->_adapter->expects($this->once()) + ->method('quoteInto') + ->with($this->equalTo('id = ?'), $this->equalTo('verifytokenkey')) + ->will($this->returnValue('id = \'verifytokenkey\'')); $this->_callback->handle($this->_get); $this->assertTrue($this->_callback->getHttpResponse()->getBody() == 'abc'); } @@ -285,10 +308,24 @@ public function testRespondsToValidFeedUpdateRequestWith200Response() $_SERVER['CONTENT_TYPE'] = 'application/atom+xml'; $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; // dirty alternative to php://input + + $this->_tableGateway->expects($this->any()) + ->method('find') + ->with($this->equalTo('verifytokenkey')) + ->will($this->returnValue($this->_rowset)); + $rowdata = new stdClass; + $rowdata->id = 'verifytokenkey'; + $rowdata->verify_token = hash('sha256', 'cba'); + $t = time(); + $rowdata->created_time = $t; + $this->_rowset->expects($this->any()) + ->method('current') + ->will($this->returnValue($rowdata)); + $this->_callback->handle(array()); $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 200); } - + public function testRespondsToInvalidFeedUpdateNotPostWith404Response() { // yes, this example makes no sense for GET - I know!!! $_SERVER['REQUEST_METHOD'] = 'GET'; @@ -296,6 +333,7 @@ public function testRespondsToInvalidFeedUpdateNotPostWith404Response() $_SERVER['CONTENT_TYPE'] = 'application/atom+xml'; $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; + $this->_callback->handle(array()); $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 404); } @@ -324,6 +362,20 @@ public function testRespondsToInvalidFeedUpdateWrongFeedTypeForMimeWith200Respon $_SERVER['CONTENT_TYPE'] = 'application/rss+xml'; $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; + + $this->_tableGateway->expects($this->any()) + ->method('find') + ->with($this->equalTo('verifytokenkey')) + ->will($this->returnValue($this->_rowset)); + $rowdata = new stdClass; + $rowdata->id = 'verifytokenkey'; + $rowdata->verify_token = hash('sha256', 'cba'); + $t = time(); + $rowdata->created_time = $t; + $this->_rowset->expects($this->any()) + ->method('current') + ->will($this->returnValue($rowdata)); + $this->_callback->handle(array()); $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 200); } @@ -335,6 +387,20 @@ public function testRespondsToValidFeedUpdateWithXHubOnBehalfOfHeader() $_SERVER['CONTENT_TYPE'] = 'application/atom+xml'; $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; + + $this->_tableGateway->expects($this->any()) + ->method('find') + ->with($this->equalTo('verifytokenkey')) + ->will($this->returnValue($this->_rowset)); + $rowdata = new stdClass; + $rowdata->id = 'verifytokenkey'; + $rowdata->verify_token = hash('sha256', 'cba'); + $t = time(); + $rowdata->created_time = $t; + $this->_rowset->expects($this->any()) + ->method('current') + ->will($this->returnValue($rowdata)); + $this->_callback->handle(array()); $this->assertTrue($this->_callback->getHttpResponse()->getHeader('X-Hub-On-Behalf-Of') == 1); } From 4b9d07f7e2cacab5370676ca36cea8dc45ee019e Mon Sep 17 00:00:00 2001 From: bkarwin Date: Sun, 20 Dec 2009 19:30:03 +0000 Subject: [PATCH 088/238] fix @group tags git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19816 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Pubsubhubbub/AllTests.php | 10 +++------- test/Pubsubhubbub/PublisherTest.php | 5 ++++- test/Pubsubhubbub/PubsubhubbubTest.php | 5 ++++- test/Pubsubhubbub/Subscriber/CallbackTest.php | 5 ++++- test/Pubsubhubbub/SubscriberHttpTest.php | 5 ++++- test/Pubsubhubbub/SubscriberTest.php | 5 ++++- 6 files changed, 23 insertions(+), 12 deletions(-) diff --git a/test/Pubsubhubbub/AllTests.php b/test/Pubsubhubbub/AllTests.php index 30788d5c..b794bf87 100644 --- a/test/Pubsubhubbub/AllTests.php +++ b/test/Pubsubhubbub/AllTests.php @@ -23,13 +23,7 @@ define('PHPUnit_MAIN_METHOD', 'Zend_Feed_Pubsubhubbub_AllTests::main'); } -/** - * Test helper - */ -require_once dirname(__FILE__) . '/../../../TestHelper.php'; - -require_once 'PHPUnit/Framework/TestSuite.php'; -require_once 'PHPUnit/TextUI/TestRunner.php'; +require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; require_once 'Zend/Feed/Pubsubhubbub/PubsubhubbubTest.php'; require_once 'Zend/Feed/Pubsubhubbub/PublisherTest.php'; @@ -42,6 +36,8 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests + * @group Zend_Feed + * @group Zend_Feed_Subsubhubbub * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/test/Pubsubhubbub/PublisherTest.php b/test/Pubsubhubbub/PublisherTest.php index 14b15c05..4b7bff27 100644 --- a/test/Pubsubhubbub/PublisherTest.php +++ b/test/Pubsubhubbub/PublisherTest.php @@ -19,13 +19,16 @@ * @version $Id$ */ -require_once 'PHPUnit/Framework/TestCase.php'; +require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; + require_once 'Zend/Feed/Pubsubhubbub/Publisher.php'; /** * @category Zend * @package Zend_Feed * @subpackage UnitTests + * @group Zend_Feed + * @group Zend_Feed_Subsubhubbub * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/test/Pubsubhubbub/PubsubhubbubTest.php b/test/Pubsubhubbub/PubsubhubbubTest.php index 7de767c6..1b464c12 100644 --- a/test/Pubsubhubbub/PubsubhubbubTest.php +++ b/test/Pubsubhubbub/PubsubhubbubTest.php @@ -19,13 +19,16 @@ * @version $Id$ */ -require_once 'PHPUnit/Framework/TestCase.php'; +require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; + require_once 'Zend/Feed/Pubsubhubbub.php'; /** * @category Zend * @package Zend_Feed * @subpackage UnitTests + * @group Zend_Feed + * @group Zend_Feed_Subsubhubbub * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php index b7a9fffb..45b51230 100644 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -19,7 +19,8 @@ * @version $Id$ */ -require_once 'PHPUnit/Framework/TestCase.php'; +require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; + require_once 'Zend/Feed/Pubsubhubbub/Subscriber/Callback.php'; require_once 'Zend/Feed/Pubsubhubbub/Model/Subscription.php'; require_once 'Zend/Db/Table/Rowset/Abstract.php'; @@ -28,6 +29,8 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests + * @group Zend_Feed + * @group Zend_Feed_Subsubhubbub * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/test/Pubsubhubbub/SubscriberHttpTest.php b/test/Pubsubhubbub/SubscriberHttpTest.php index 81cb2933..125ecaa3 100644 --- a/test/Pubsubhubbub/SubscriberHttpTest.php +++ b/test/Pubsubhubbub/SubscriberHttpTest.php @@ -19,7 +19,8 @@ * @version $Id$ */ -require_once 'PHPUnit/Framework/TestCase.php'; +require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; + require_once 'Zend/Feed/Pubsubhubbub/Subscriber.php'; require_once 'Zend/Http/Client.php'; require_once 'Zend/Http/Client/Adapter/Socket.php'; @@ -37,6 +38,8 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests + * @group Zend_Feed + * @group Zend_Feed_Subsubhubbub * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/test/Pubsubhubbub/SubscriberTest.php b/test/Pubsubhubbub/SubscriberTest.php index 5720d5fb..be5d8250 100644 --- a/test/Pubsubhubbub/SubscriberTest.php +++ b/test/Pubsubhubbub/SubscriberTest.php @@ -19,7 +19,8 @@ * @version $Id$ */ -require_once 'PHPUnit/Framework/TestCase.php'; +require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; + require_once 'Zend/Feed/Pubsubhubbub/Subscriber.php'; require_once 'Zend/Feed/Pubsubhubbub/Model/Subscription.php'; @@ -27,6 +28,8 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests + * @group Zend_Feed + * @group Zend_Feed_Subsubhubbub * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ From 88fa99e47f252e6901fa8ed84d6627b6bfec6cbb Mon Sep 17 00:00:00 2001 From: padraic Date: Sun, 20 Dec 2009 20:02:11 +0000 Subject: [PATCH 089/238] Removed a redundant require_once file which doesn't exist git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19817 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/Subscriber.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Pubsubhubbub/Subscriber.php b/src/Pubsubhubbub/Subscriber.php index e192f943..1bedeeba 100644 --- a/src/Pubsubhubbub/Subscriber.php +++ b/src/Pubsubhubbub/Subscriber.php @@ -17,8 +17,6 @@ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ - -require_once 'Zend/Feed/Pubsubhubbub/Entity/TopicSubscription.php'; /** * @see Zend_Feed_Pubsubhubbub From 6696d69ac7d73d014816f9c22e14b73dd094dccf Mon Sep 17 00:00:00 2001 From: bkarwin Date: Sun, 20 Dec 2009 20:07:57 +0000 Subject: [PATCH 090/238] fix error in TestHelper require git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19818 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Pubsubhubbub/Subscriber/CallbackTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php index 45b51230..2a065a73 100644 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -19,7 +19,7 @@ * @version $Id$ */ -require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; +require_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; require_once 'Zend/Feed/Pubsubhubbub/Subscriber/Callback.php'; require_once 'Zend/Feed/Pubsubhubbub/Model/Subscription.php'; From bfb71821b3cacffc4056cc4a5d0d2a69aa2c4a18 Mon Sep 17 00:00:00 2001 From: padraic Date: Mon, 21 Dec 2009 00:21:01 +0000 Subject: [PATCH 091/238] Zend_Feed_Reader: Restricted Atom parsing to return feed categories but exclude entry cats. Issue caused by a loose XPath query. Fixes ZF-8467 Zend_Feed_Pubsubhubbub: Fixed a test file include where file to include contained a bad path and was not required. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19823 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Extension/Atom/Feed.php | 4 ++-- test/Pubsubhubbub/Subscriber/CallbackTest.php | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index 9c0f5b30..2bccc1da 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -425,7 +425,7 @@ public function getCategories() } if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10) { - $list = $this->_xpath->query($this->getXpathPrefix() . '//atom:category'); + $list = $this->_xpath->query($this->getXpathPrefix() . '/atom:category'); } else { /** * Since Atom 0.3 did not support categories, it would have used the @@ -433,7 +433,7 @@ public function getCategories() * may have been retrofittied to use Atom 1.0 instead. */ $this->_xpath->registerNamespace('atom10', Zend_Feed_Reader::NAMESPACE_ATOM_10); - $list = $this->_xpath->query($this->getXpathPrefix() . '//atom10:category'); + $list = $this->_xpath->query($this->getXpathPrefix() . '/atom10:category'); } if ($list->length) { diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php index 2a065a73..86de71bf 100644 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -19,8 +19,6 @@ * @version $Id$ */ -require_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; - require_once 'Zend/Feed/Pubsubhubbub/Subscriber/Callback.php'; require_once 'Zend/Feed/Pubsubhubbub/Model/Subscription.php'; require_once 'Zend/Db/Table/Rowset/Abstract.php'; From 777399780b4fdd8b1e47fe78320312ea37fffd9a Mon Sep 17 00:00:00 2001 From: padraic Date: Mon, 21 Dec 2009 16:51:57 +0000 Subject: [PATCH 092/238] Zend_Feed_Pubsubhubbub: added a Subscription Model interface for end-users to implement and updated API comments to reflect git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19846 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/CallbackAbstract.php | 16 ++--- src/Pubsubhubbub/Model/Subscription.php | 4 ++ .../Model/SubscriptionInterface.php | 64 +++++++++++++++++++ src/Pubsubhubbub/Subscriber.php | 12 ++-- test/Pubsubhubbub/Subscriber/CallbackTest.php | 2 +- 5 files changed, 83 insertions(+), 15 deletions(-) create mode 100644 src/Pubsubhubbub/Model/SubscriptionInterface.php diff --git a/src/Pubsubhubbub/CallbackAbstract.php b/src/Pubsubhubbub/CallbackAbstract.php index c094e8e2..7b97bf92 100644 --- a/src/Pubsubhubbub/CallbackAbstract.php +++ b/src/Pubsubhubbub/CallbackAbstract.php @@ -40,11 +40,11 @@ abstract class Zend_Feed_Pubsubhubbub_CallbackAbstract implements Zend_Feed_Pubsubhubbub_CallbackInterface { /** - * An instance of Zend_Feed_Pubsubhubbub_Model_ModelAbstract used + * An instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used * to background save any verification tokens associated with a subscription * or other. * - * @var Zend_Feed_Pubsubhubbub_Model_ModelAbstract + * @var Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface */ protected $_storage = null; @@ -113,32 +113,32 @@ public function sendResponse() } /** - * Sets an instance of Zend_Feed_Pubsubhubbub_Storage_StorageInterface used + * Sets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used * to background save any verification tokens associated with a subscription * or other. * - * @param Zend_Feed_Pubsubhubbub_Storage_StorageInterface $storage + * @param Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage * @return Zend_Feed_Pubsubhubbub_CallbackAbstract */ - public function setStorage(Zend_Feed_Pubsubhubbub_Model_ModelAbstract $storage) + public function setStorage(Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage) { $this->_storage = $storage; return $this; } /** - * Gets an instance of Zend_Feed_Pubsubhubbub_Storage_StorageInterface used + * Gets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used * to background save any verification tokens associated with a subscription * or other. * - * @return Zend_Feed_Pubsubhubbub_Model_ModelAbstract + * @return Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface */ public function getStorage() { if ($this->_storage === null) { require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('No storage object has been' - . ' set that subclasses Zend_Feed_Pubsubhubbub_Model_ModelAbstract'); + . ' set that subclasses Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface'); } return $this->_storage; } diff --git a/src/Pubsubhubbub/Model/Subscription.php b/src/Pubsubhubbub/Model/Subscription.php index 439402bc..401ea93e 100644 --- a/src/Pubsubhubbub/Model/Subscription.php +++ b/src/Pubsubhubbub/Model/Subscription.php @@ -22,6 +22,9 @@ /** @see Zend_Feed_Pubsubhubbub_Model_ModelAbstract */ require_once 'Zend/Feed/Pubsubhubbub/Model/ModelAbstract.php'; +/** @see Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface */ +require_once 'Zend/Feed/Pubsubhubbub/Model/SubscriptionInterface.php'; + /** * @category Zend * @package Zend_Feed_Pubsubhubbub @@ -31,6 +34,7 @@ */ class Zend_Feed_Pubsubhubbub_Model_Subscription extends Zend_Feed_Pubsubhubbub_Model_ModelAbstract + implements Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface { /** diff --git a/src/Pubsubhubbub/Model/SubscriptionInterface.php b/src/Pubsubhubbub/Model/SubscriptionInterface.php new file mode 100644 index 00000000..e999e1da --- /dev/null +++ b/src/Pubsubhubbub/Model/SubscriptionInterface.php @@ -0,0 +1,64 @@ +_storage = $storage; return $this; @@ -536,7 +536,7 @@ public function setStorage(Zend_Feed_Pubsubhubbub_Model_ModelAbstract $storage) * to background save any verification tokens associated with a subscription * or other. * - * @return Zend_Feed_Pubsubhubbub_Storage_StorageInterface + * @return Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface */ public function getStorage() { diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php index 86de71bf..c125a523 100644 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -141,7 +141,7 @@ public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntege public function testCanSetStorageImplementation() { - $storage = new Zend_Feed_Pubsubhubbub_Model_ModelAbstract($this->_tableGateway); + $storage = new Zend_Feed_Pubsubhubbub_Model_Subscription($this->_tableGateway); $this->_callback->setStorage($storage); $this->assertThat($this->_callback->getStorage(), $this->identicalTo($storage)); } From 3348893d8e2c6f38ef98557633dc458e2deb97d6 Mon Sep 17 00:00:00 2001 From: padraic Date: Mon, 21 Dec 2009 22:15:50 +0000 Subject: [PATCH 093/238] Deleted xmlentities ref as not required (and not available) git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19872 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Writer/Extension/ITunes/Renderer/Feed.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php index 31e1be68..d5093cc2 100644 --- a/src/Writer/Extension/ITunes/Renderer/Feed.php +++ b/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -121,21 +121,15 @@ protected function _setCategories(DOMDocument $dom, DOMElement $root) foreach ($cats as $key=>$cat) { if (!is_array($cat)) { $el = $dom->createElement('itunes:category'); - $el->setAttribute('text', Zend_Feed_Writer::xmlentities( - $cat, $this->getEncoding() - )); + $el->setAttribute('text', $cat); $root->appendChild($el); } else { $el = $dom->createElement('itunes:category'); - $el->setAttribute('text', Zend_Feed_Writer::xmlentities( - $key, $this->getEncoding() - )); + $el->setAttribute('text', $key); $root->appendChild($el); foreach ($cat as $subcat) { $el2 = $dom->createElement('itunes:category'); - $el2->setAttribute('text', Zend_Feed_Writer::xmlentities( - $subcat, $this->getEncoding() - )); + $el2->setAttribute('text', $subcat); $el->appendChild($el2); } } From 3600fa9e3ebc9bab54330941fdbf200ed18273cc Mon Sep 17 00:00:00 2001 From: padraic Date: Mon, 21 Dec 2009 22:29:32 +0000 Subject: [PATCH 094/238] Replace missed PHP 5.3 lcfirst() use in iTunes container with 5.2.x compat replacement git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19874 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Writer.php | 6 ++++++ src/Writer/Extension/ITunes/Entry.php | 2 +- src/Writer/Extension/ITunes/Feed.php | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Writer.php b/src/Writer.php index a1de7688..d27e0899 100644 --- a/src/Writer.php +++ b/src/Writer.php @@ -257,5 +257,11 @@ public static function registerCoreExtensions() self::registerExtension('Threading'); self::registerExtension('ITunes'); } + + public static function lcfirst($str) + { + $str[0] = strtolower($str[0]); + return $str; + } } diff --git a/src/Writer/Extension/ITunes/Entry.php b/src/Writer/Extension/ITunes/Entry.php index 3c2dc10b..68bdb2c2 100644 --- a/src/Writer/Extension/ITunes/Entry.php +++ b/src/Writer/Extension/ITunes/Entry.php @@ -223,7 +223,7 @@ public function setItunesSummary($value) */ public function __call($method, array $params) { - $point = lcfirst(substr($method, 9)); + $point = Zend_Feed_Writer::lcfirst(substr($method, 9)); if (!method_exists($this, 'setItunes' . ucfirst($point)) && !method_exists($this, 'addItunes' . ucfirst($point)) ) { diff --git a/src/Writer/Extension/ITunes/Feed.php b/src/Writer/Extension/ITunes/Feed.php index 99c675c7..81210af2 100644 --- a/src/Writer/Extension/ITunes/Feed.php +++ b/src/Writer/Extension/ITunes/Feed.php @@ -344,7 +344,7 @@ public function setItunesSummary($value) */ public function __call($method, array $params) { - $point = lcfirst(substr($method, 9)); + $point = Zend_Feed_Writer::lcfirst(substr($method, 9)); if (!method_exists($this, 'setItunes' . ucfirst($point)) && !method_exists($this, 'addItunes' . ucfirst($point)) ) { From fe6f91c4f688301510c84ccff453ecfc28a106e3 Mon Sep 17 00:00:00 2001 From: bkarwin Date: Wed, 6 Jan 2010 02:05:09 +0000 Subject: [PATCH 095/238] [ZF-8718] update copyright tags for 2010 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20096 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Abstract.php | 4 ++-- src/Atom.php | 4 ++-- src/Builder.php | 4 ++-- src/Builder/Entry.php | 4 ++-- src/Builder/Exception.php | 4 ++-- src/Builder/Header.php | 4 ++-- src/Builder/Header/Itunes.php | 4 ++-- src/Builder/Interface.php | 4 ++-- src/Element.php | 4 ++-- src/Entry/Abstract.php | 4 ++-- src/Entry/Atom.php | 4 ++-- src/Entry/Rss.php | 4 ++-- src/Exception.php | 4 ++-- src/Pubsubhubbub.php | 4 ++-- src/Pubsubhubbub/CallbackAbstract.php | 4 ++-- src/Pubsubhubbub/CallbackInterface.php | 4 ++-- src/Pubsubhubbub/Exception.php | 4 ++-- src/Pubsubhubbub/HttpResponse.php | 4 ++-- src/Pubsubhubbub/Model/ModelAbstract.php | 4 ++-- src/Pubsubhubbub/Model/Subscription.php | 4 ++-- src/Pubsubhubbub/Model/SubscriptionInterface.php | 4 ++-- src/Pubsubhubbub/Publisher.php | 4 ++-- src/Pubsubhubbub/Subscriber.php | 4 ++-- src/Pubsubhubbub/Subscriber/Callback.php | 4 ++-- src/Reader.php | 4 ++-- src/Reader/Collection.php | 4 ++-- src/Reader/Collection/Author.php | 4 ++-- src/Reader/Collection/Category.php | 4 ++-- src/Reader/Collection/CollectionAbstract.php | 4 ++-- src/Reader/Entry/Atom.php | 4 ++-- src/Reader/Entry/Rss.php | 4 ++-- src/Reader/EntryAbstract.php | 4 ++-- src/Reader/EntryInterface.php | 4 ++-- src/Reader/Extension/Atom/Entry.php | 4 ++-- src/Reader/Extension/Atom/Feed.php | 4 ++-- src/Reader/Extension/Content/Entry.php | 4 ++-- src/Reader/Extension/CreativeCommons/Entry.php | 4 ++-- src/Reader/Extension/CreativeCommons/Feed.php | 4 ++-- src/Reader/Extension/DublinCore/Entry.php | 4 ++-- src/Reader/Extension/DublinCore/Feed.php | 4 ++-- src/Reader/Extension/EntryAbstract.php | 4 ++-- src/Reader/Extension/FeedAbstract.php | 4 ++-- src/Reader/Extension/Podcast/Entry.php | 4 ++-- src/Reader/Extension/Podcast/Feed.php | 4 ++-- src/Reader/Extension/Slash/Entry.php | 4 ++-- src/Reader/Extension/Syndication/Feed.php | 4 ++-- src/Reader/Extension/Thread/Entry.php | 4 ++-- src/Reader/Extension/WellFormedWeb/Entry.php | 4 ++-- src/Reader/Feed/Atom.php | 4 ++-- src/Reader/Feed/Atom/Source.php | 4 ++-- src/Reader/Feed/Rss.php | 4 ++-- src/Reader/FeedAbstract.php | 4 ++-- src/Reader/FeedInterface.php | 4 ++-- src/Reader/FeedSet.php | 4 ++-- src/Rss.php | 4 ++-- src/Writer.php | 4 ++-- src/Writer/Entry.php | 4 ++-- src/Writer/Exception/InvalidMethodException.php | 4 ++-- src/Writer/Extension/Atom/Renderer/Feed.php | 4 ++-- src/Writer/Extension/Content/Renderer/Entry.php | 4 ++-- src/Writer/Extension/DublinCore/Renderer/Entry.php | 4 ++-- src/Writer/Extension/DublinCore/Renderer/Feed.php | 4 ++-- src/Writer/Extension/ITunes/Entry.php | 4 ++-- src/Writer/Extension/ITunes/Feed.php | 4 ++-- src/Writer/Extension/ITunes/Renderer/Entry.php | 4 ++-- src/Writer/Extension/ITunes/Renderer/Feed.php | 4 ++-- src/Writer/Extension/RendererAbstract.php | 4 ++-- src/Writer/Extension/RendererInterface.php | 4 ++-- src/Writer/Extension/Slash/Renderer/Entry.php | 4 ++-- src/Writer/Extension/Threading/Renderer/Entry.php | 4 ++-- src/Writer/Extension/WellFormedWeb/Renderer/Entry.php | 4 ++-- src/Writer/Feed.php | 4 ++-- src/Writer/Renderer/Entry/Atom.php | 4 ++-- src/Writer/Renderer/Entry/Rss.php | 4 ++-- src/Writer/Renderer/Feed/Atom.php | 4 ++-- src/Writer/Renderer/Feed/Rss.php | 4 ++-- src/Writer/Renderer/RendererAbstract.php | 4 ++-- src/Writer/Renderer/RendererInterface.php | 4 ++-- test/AllTests.php | 4 ++-- test/ArrayAccessTest.php | 4 ++-- test/AtomEntryOnlyTest.php | 4 ++-- test/AtomPublishingTest.php | 4 ++-- test/CountTest.php | 4 ++-- test/ElementTest.php | 4 ++-- test/Entry/RssTest.php | 4 ++-- test/ImportTest.php | 4 ++-- test/IteratorTest.php | 4 ++-- test/Pubsubhubbub/AllTests.php | 4 ++-- test/Pubsubhubbub/PublisherTest.php | 4 ++-- test/Pubsubhubbub/PubsubhubbubTest.php | 4 ++-- test/Pubsubhubbub/Subscriber/CallbackTest.php | 4 ++-- test/Pubsubhubbub/SubscriberHttpTest.php | 4 ++-- test/Pubsubhubbub/SubscriberTest.php | 4 ++-- test/Reader/Entry/AtomStandaloneEntryTest.php | 4 ++-- test/Reader/Entry/AtomTest.php | 4 ++-- test/Reader/Entry/CommonTest.php | 4 ++-- test/Reader/Entry/RssTest.php | 4 ++-- test/Reader/Feed/AtomSourceTest.php | 4 ++-- test/Reader/Feed/AtomTest.php | 4 ++-- test/Reader/Feed/CommonTest.php | 4 ++-- test/Reader/Feed/RssTest.php | 4 ++-- test/Reader/Integration/H-OnlineComAtom10Test.php | 4 ++-- test/Reader/Integration/LautDeRdfTest.php | 4 ++-- test/Reader/Integration/PodcastRss2Test.php | 4 ++-- test/Reader/Integration/WordpressAtom10Test.php | 4 ++-- test/Reader/Integration/WordpressRss2DcAtomTest.php | 4 ++-- test/Reader/_files/My/Extension/JungleBooks/Entry.php | 4 ++-- test/Reader/_files/My/Extension/JungleBooks/Feed.php | 4 ++-- test/ReaderTest.php | 4 ++-- test/Writer/EntryTest.php | 4 ++-- test/Writer/Extension/ITunes/EntryTest.php | 4 ++-- test/Writer/Extension/ITunes/FeedTest.php | 4 ++-- test/Writer/FeedTest.php | 4 ++-- test/Writer/Renderer/Entry/AtomTest.php | 4 ++-- test/Writer/Renderer/Entry/RssTest.php | 4 ++-- test/Writer/Renderer/Feed/AtomTest.php | 4 ++-- test/Writer/Renderer/Feed/RssTest.php | 4 ++-- 117 files changed, 234 insertions(+), 234 deletions(-) diff --git a/src/Abstract.php b/src/Abstract.php index 046954af..c6fb2e75 100644 --- a/src/Abstract.php +++ b/src/Abstract.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -37,7 +37,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 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, Countable diff --git a/src/Atom.php b/src/Atom.php index d884a8b3..5acc4bb1 100644 --- a/src/Atom.php +++ b/src/Atom.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -44,7 +44,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Atom extends Zend_Feed_Abstract diff --git a/src/Builder.php b/src/Builder.php index c0043d3f..80180560 100644 --- a/src/Builder.php +++ b/src/Builder.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -44,7 +44,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Builder implements Zend_Feed_Builder_Interface diff --git a/src/Builder/Entry.php b/src/Builder/Entry.php index 0a218d14..8d542977 100644 --- a/src/Builder/Entry.php +++ b/src/Builder/Entry.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -29,7 +29,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Builder_Entry extends ArrayObject diff --git a/src/Builder/Exception.php b/src/Builder/Exception.php index c5fedeb1..a070f09c 100644 --- a/src/Builder/Exception.php +++ b/src/Builder/Exception.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -32,7 +32,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Builder_Exception extends Zend_Feed_Exception diff --git a/src/Builder/Header.php b/src/Builder/Header.php index f6b45c4d..16610a86 100644 --- a/src/Builder/Header.php +++ b/src/Builder/Header.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -39,7 +39,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Builder_Header extends ArrayObject diff --git a/src/Builder/Header/Itunes.php b/src/Builder/Header/Itunes.php index 79fca07e..7c93d7b7 100644 --- a/src/Builder/Header/Itunes.php +++ b/src/Builder/Header/Itunes.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -28,7 +28,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Builder_Header_Itunes extends ArrayObject diff --git a/src/Builder/Interface.php b/src/Builder/Interface.php index f03f0f23..1c34190a 100644 --- a/src/Builder/Interface.php +++ b/src/Builder/Interface.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -29,7 +29,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Feed_Builder_Interface diff --git a/src/Element.php b/src/Element.php index 1ea12c40..8611ab3a 100644 --- a/src/Element.php +++ b/src/Element.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -26,7 +26,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Element implements ArrayAccess diff --git a/src/Entry/Abstract.php b/src/Entry/Abstract.php index 374f1f58..4ba78586 100644 --- a/src/Entry/Abstract.php +++ b/src/Entry/Abstract.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -38,7 +38,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Feed_Entry_Abstract extends Zend_Feed_Element diff --git a/src/Entry/Atom.php b/src/Entry/Atom.php index f46edab6..303d8bef 100644 --- a/src/Entry/Atom.php +++ b/src/Entry/Atom.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -32,7 +32,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract diff --git a/src/Entry/Rss.php b/src/Entry/Rss.php index 43224264..bb9bf190 100644 --- a/src/Entry/Rss.php +++ b/src/Entry/Rss.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -32,7 +32,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Entry_Rss extends Zend_Feed_Entry_Abstract diff --git a/src/Exception.php b/src/Exception.php index ec8ca949..de2d81c3 100644 --- a/src/Exception.php +++ b/src/Exception.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -34,7 +34,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Exception extends Zend_Exception diff --git a/src/Pubsubhubbub.php b/src/Pubsubhubbub.php index 0675549b..05f60b91 100644 --- a/src/Pubsubhubbub.php +++ b/src/Pubsubhubbub.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Pubsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -46,7 +46,7 @@ /** * @category Zend * @package Zend_Feed_Pubsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Pubsubhubbub diff --git a/src/Pubsubhubbub/CallbackAbstract.php b/src/Pubsubhubbub/CallbackAbstract.php index 7b97bf92..48fc56d4 100644 --- a/src/Pubsubhubbub/CallbackAbstract.php +++ b/src/Pubsubhubbub/CallbackAbstract.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed_Pubsubhubbub * @subpackage Callback - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Feed_Pubsubhubbub * @subpackage Callback - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Feed_Pubsubhubbub_CallbackAbstract diff --git a/src/Pubsubhubbub/CallbackInterface.php b/src/Pubsubhubbub/CallbackInterface.php index 36d74592..ce30a6bb 100644 --- a/src/Pubsubhubbub/CallbackInterface.php +++ b/src/Pubsubhubbub/CallbackInterface.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed_Pubsubhubbub * @subpackage Callback - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -23,7 +23,7 @@ * @category Zend * @package Zend_Feed_Pubsubhubbub * @subpackage Callback - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Feed_Pubsubhubbub_CallbackInterface diff --git a/src/Pubsubhubbub/Exception.php b/src/Pubsubhubbub/Exception.php index 26e04c10..cac6d238 100644 --- a/src/Pubsubhubbub/Exception.php +++ b/src/Pubsubhubbub/Exception.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Pubsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -26,7 +26,7 @@ /** * @category Zend * @package Zend_Feed_Pubsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Pubsubhubbub_Exception extends Zend_Exception diff --git a/src/Pubsubhubbub/HttpResponse.php b/src/Pubsubhubbub/HttpResponse.php index e944652d..5a14eb60 100644 --- a/src/Pubsubhubbub/HttpResponse.php +++ b/src/Pubsubhubbub/HttpResponse.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Pubsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -26,7 +26,7 @@ /** * @category Zend * @package Zend_Feed_Pubsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Pubsubhubbub_HttpResponse diff --git a/src/Pubsubhubbub/Model/ModelAbstract.php b/src/Pubsubhubbub/Model/ModelAbstract.php index d7eeb1d1..83964464 100644 --- a/src/Pubsubhubbub/Model/ModelAbstract.php +++ b/src/Pubsubhubbub/Model/ModelAbstract.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Pubsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -31,7 +31,7 @@ /** * @category Zend * @package Zend_Feed_Pubsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Pubsubhubbub_Model_ModelAbstract diff --git a/src/Pubsubhubbub/Model/Subscription.php b/src/Pubsubhubbub/Model/Subscription.php index 401ea93e..81efd103 100644 --- a/src/Pubsubhubbub/Model/Subscription.php +++ b/src/Pubsubhubbub/Model/Subscription.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed_Pubsubhubbub * @subpackage Entity - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -29,7 +29,7 @@ * @category Zend * @package Zend_Feed_Pubsubhubbub * @subpackage Entity - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Pubsubhubbub_Model_Subscription diff --git a/src/Pubsubhubbub/Model/SubscriptionInterface.php b/src/Pubsubhubbub/Model/SubscriptionInterface.php index e999e1da..f8a6e6a3 100644 --- a/src/Pubsubhubbub/Model/SubscriptionInterface.php +++ b/src/Pubsubhubbub/Model/SubscriptionInterface.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed_Pubsubhubbub * @subpackage Entity - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -23,7 +23,7 @@ * @category Zend * @package Zend_Feed_Pubsubhubbub * @subpackage Entity - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface diff --git a/src/Pubsubhubbub/Publisher.php b/src/Pubsubhubbub/Publisher.php index 0b4aa47a..1eb594f0 100644 --- a/src/Pubsubhubbub/Publisher.php +++ b/src/Pubsubhubbub/Publisher.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Pubsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -26,7 +26,7 @@ /** * @category Zend * @package Zend_Feed_Pubsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Pubsubhubbub_Publisher diff --git a/src/Pubsubhubbub/Subscriber.php b/src/Pubsubhubbub/Subscriber.php index 7704e227..2f41562d 100644 --- a/src/Pubsubhubbub/Subscriber.php +++ b/src/Pubsubhubbub/Subscriber.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Pubsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -26,7 +26,7 @@ /** * @category Zend * @package Zend_Feed_Pubsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Pubsubhubbub_Subscriber diff --git a/src/Pubsubhubbub/Subscriber/Callback.php b/src/Pubsubhubbub/Subscriber/Callback.php index 1f92a4f0..b296b308 100644 --- a/src/Pubsubhubbub/Subscriber/Callback.php +++ b/src/Pubsubhubbub/Subscriber/Callback.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Pubsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -36,7 +36,7 @@ /** * @category Zend * @package Zend_Feed_Pubsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Pubsubhubbub_Subscriber_Callback diff --git a/src/Reader.php b/src/Reader.php index b7dbc21e..0230e6d3 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -42,7 +42,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Reader diff --git a/src/Reader/Collection.php b/src/Reader/Collection.php index 607c46f5..fba2b52b 100644 --- a/src/Reader/Collection.php +++ b/src/Reader/Collection.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -22,7 +22,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Reader_Collection extends ArrayObject diff --git a/src/Reader/Collection/Author.php b/src/Reader/Collection/Author.php index 86ddb1dd..58d3782e 100644 --- a/src/Reader/Collection/Author.php +++ b/src/Reader/Collection/Author.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Reader_Collection_Author diff --git a/src/Reader/Collection/Category.php b/src/Reader/Collection/Category.php index ce7bedf1..f1c92679 100644 --- a/src/Reader/Collection/Category.php +++ b/src/Reader/Collection/Category.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Reader_Collection_Category diff --git a/src/Reader/Collection/CollectionAbstract.php b/src/Reader/Collection/CollectionAbstract.php index 0c3803e3..b3a5a157 100644 --- a/src/Reader/Collection/CollectionAbstract.php +++ b/src/Reader/Collection/CollectionAbstract.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -22,7 +22,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Feed_Reader_Collection_CollectionAbstract extends ArrayObject diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index ed55501b..3e4ad5e9 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -42,7 +42,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Reader_Entry_Atom extends Zend_Feed_Reader_EntryAbstract implements Zend_Feed_Reader_EntryInterface diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index 7fe0fd01..d339950e 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -77,7 +77,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_EntryAbstract implements Zend_Feed_Reader_EntryInterface diff --git a/src/Reader/EntryAbstract.php b/src/Reader/EntryAbstract.php index d07f1a04..d63cc2ad 100644 --- a/src/Reader/EntryAbstract.php +++ b/src/Reader/EntryAbstract.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -22,7 +22,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Feed_Reader_EntryAbstract diff --git a/src/Reader/EntryInterface.php b/src/Reader/EntryInterface.php index 4e22e35d..1120a9f6 100644 --- a/src/Reader/EntryInterface.php +++ b/src/Reader/EntryInterface.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -22,7 +22,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Feed_Reader_EntryInterface diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index cc97d092..bf548bdd 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -52,7 +52,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 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_Entry diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index 2bccc1da..97261674 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -42,7 +42,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 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 diff --git a/src/Reader/Extension/Content/Entry.php b/src/Reader/Extension/Content/Entry.php index 956a1c7b..93ca5cd0 100644 --- a/src/Reader/Extension/Content/Entry.php +++ b/src/Reader/Extension/Content/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -32,7 +32,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 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 diff --git a/src/Reader/Extension/CreativeCommons/Entry.php b/src/Reader/Extension/CreativeCommons/Entry.php index 5f63618a..5edebf50 100644 --- a/src/Reader/Extension/CreativeCommons/Entry.php +++ b/src/Reader/Extension/CreativeCommons/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -32,7 +32,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 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_Entry extends Zend_Feed_Reader_Extension_EntryAbstract diff --git a/src/Reader/Extension/CreativeCommons/Feed.php b/src/Reader/Extension/CreativeCommons/Feed.php index 101d6a36..78f9b8f6 100644 --- a/src/Reader/Extension/CreativeCommons/Feed.php +++ b/src/Reader/Extension/CreativeCommons/Feed.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 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 diff --git a/src/Reader/Extension/DublinCore/Entry.php b/src/Reader/Extension/DublinCore/Entry.php index 2adcf340..97b3fa62 100644 --- a/src/Reader/Extension/DublinCore/Entry.php +++ b/src/Reader/Extension/DublinCore/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -37,7 +37,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 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 diff --git a/src/Reader/Extension/DublinCore/Feed.php b/src/Reader/Extension/DublinCore/Feed.php index 5ea699d8..7f92fc30 100644 --- a/src/Reader/Extension/DublinCore/Feed.php +++ b/src/Reader/Extension/DublinCore/Feed.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -37,7 +37,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 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 diff --git a/src/Reader/Extension/EntryAbstract.php b/src/Reader/Extension/EntryAbstract.php index 03534fb8..ca5c47a8 100644 --- a/src/Reader/Extension/EntryAbstract.php +++ b/src/Reader/Extension/EntryAbstract.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -22,7 +22,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Feed_Reader_Extension_EntryAbstract diff --git a/src/Reader/Extension/FeedAbstract.php b/src/Reader/Extension/FeedAbstract.php index 9897a791..cb9139d8 100644 --- a/src/Reader/Extension/FeedAbstract.php +++ b/src/Reader/Extension/FeedAbstract.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -38,7 +38,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Feed_Reader_Extension_FeedAbstract diff --git a/src/Reader/Extension/Podcast/Entry.php b/src/Reader/Extension/Podcast/Entry.php index b93193c5..e7adf576 100644 --- a/src/Reader/Extension/Podcast/Entry.php +++ b/src/Reader/Extension/Podcast/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -32,7 +32,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Reader_Extension_Podcast_Entry extends Zend_Feed_Reader_Extension_EntryAbstract diff --git a/src/Reader/Extension/Podcast/Feed.php b/src/Reader/Extension/Podcast/Feed.php index ae747d81..4f2f7f53 100644 --- a/src/Reader/Extension/Podcast/Feed.php +++ b/src/Reader/Extension/Podcast/Feed.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Reader_Extension_Podcast_Feed extends Zend_Feed_Reader_Extension_FeedAbstract diff --git a/src/Reader/Extension/Slash/Entry.php b/src/Reader/Extension/Slash/Entry.php index b306ac30..d8470a2d 100644 --- a/src/Reader/Extension/Slash/Entry.php +++ b/src/Reader/Extension/Slash/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -32,7 +32,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 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 diff --git a/src/Reader/Extension/Syndication/Feed.php b/src/Reader/Extension/Syndication/Feed.php index c927db17..79b91bfd 100644 --- a/src/Reader/Extension/Syndication/Feed.php +++ b/src/Reader/Extension/Syndication/Feed.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -29,7 +29,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 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 diff --git a/src/Reader/Extension/Thread/Entry.php b/src/Reader/Extension/Thread/Entry.php index 13bd9638..c57add4b 100644 --- a/src/Reader/Extension/Thread/Entry.php +++ b/src/Reader/Extension/Thread/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 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 diff --git a/src/Reader/Extension/WellFormedWeb/Entry.php b/src/Reader/Extension/WellFormedWeb/Entry.php index 192504c7..ce7223e3 100644 --- a/src/Reader/Extension/WellFormedWeb/Entry.php +++ b/src/Reader/Extension/WellFormedWeb/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -32,7 +32,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 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 diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index 354b1472..a562e62b 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -32,7 +32,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php index e2ce9b05..8d5fe0c9 100644 --- a/src/Reader/Feed/Atom/Source.php +++ b/src/Reader/Feed/Atom/Source.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Atom.php 19165 2009-11-21 16:46:40Z padraic $ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Reader_Feed_Atom_Source extends Zend_Feed_Reader_Feed_Atom diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index da7eb330..b4f6f66a 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -47,7 +47,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract diff --git a/src/Reader/FeedAbstract.php b/src/Reader/FeedAbstract.php index 456aefcd..b24d8a6d 100644 --- a/src/Reader/FeedAbstract.php +++ b/src/Reader/FeedAbstract.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -32,7 +32,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInterface diff --git a/src/Reader/FeedInterface.php b/src/Reader/FeedInterface.php index 34f443e5..378587fd 100644 --- a/src/Reader/FeedInterface.php +++ b/src/Reader/FeedInterface.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -22,7 +22,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Feed_Reader_FeedInterface extends Iterator, Countable diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index a214d8f7..dcf43ff3 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -32,7 +32,7 @@ /** * @category Zend * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 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 diff --git a/src/Rss.php b/src/Rss.php index ce919093..be47743e 100644 --- a/src/Rss.php +++ b/src/Rss.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -43,7 +43,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Rss extends Zend_Feed_Abstract diff --git a/src/Writer.php b/src/Writer.php index d27e0899..c47893d3 100644 --- a/src/Writer.php +++ b/src/Writer.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -22,7 +22,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index 233d2bb9..4ccd7f53 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -32,7 +32,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Entry diff --git a/src/Writer/Exception/InvalidMethodException.php b/src/Writer/Exception/InvalidMethodException.php index 576e0c0d..553c6249 100644 --- a/src/Writer/Exception/InvalidMethodException.php +++ b/src/Writer/Exception/InvalidMethodException.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -34,7 +34,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Exception_InvalidMethodException extends Zend_Exception diff --git a/src/Writer/Extension/Atom/Renderer/Feed.php b/src/Writer/Extension/Atom/Renderer/Feed.php index db4b3291..f5ac1f31 100644 --- a/src/Writer/Extension/Atom/Renderer/Feed.php +++ b/src/Writer/Extension/Atom/Renderer/Feed.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Extension_Atom_Renderer_Feed diff --git a/src/Writer/Extension/Content/Renderer/Entry.php b/src/Writer/Extension/Content/Renderer/Entry.php index 467155b3..c3f505c7 100644 --- a/src/Writer/Extension/Content/Renderer/Entry.php +++ b/src/Writer/Extension/Content/Renderer/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Extension_Content_Renderer_Entry diff --git a/src/Writer/Extension/DublinCore/Renderer/Entry.php b/src/Writer/Extension/DublinCore/Renderer/Entry.php index f5b76e23..d26befe5 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Entry.php +++ b/src/Writer/Extension/DublinCore/Renderer/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Extension_DublinCore_Renderer_Entry diff --git a/src/Writer/Extension/DublinCore/Renderer/Feed.php b/src/Writer/Extension/DublinCore/Renderer/Feed.php index c6556499..e6d25684 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Feed.php +++ b/src/Writer/Extension/DublinCore/Renderer/Feed.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Extension_DublinCore_Renderer_Feed diff --git a/src/Writer/Extension/ITunes/Entry.php b/src/Writer/Extension/ITunes/Entry.php index 68bdb2c2..91634e98 100644 --- a/src/Writer/Extension/ITunes/Entry.php +++ b/src/Writer/Extension/ITunes/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -22,7 +22,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Extension_ITunes_Entry diff --git a/src/Writer/Extension/ITunes/Feed.php b/src/Writer/Extension/ITunes/Feed.php index 81210af2..53801ecd 100644 --- a/src/Writer/Extension/ITunes/Feed.php +++ b/src/Writer/Extension/ITunes/Feed.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -22,7 +22,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Extension_ITunes_Feed diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php index 4a03cabb..7984579d 100644 --- a/src/Writer/Extension/ITunes/Renderer/Entry.php +++ b/src/Writer/Extension/ITunes/Renderer/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Extension_ITunes_Renderer_Entry diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php index d5093cc2..6ec70715 100644 --- a/src/Writer/Extension/ITunes/Renderer/Feed.php +++ b/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Extension_ITunes_Renderer_Feed diff --git a/src/Writer/Extension/RendererAbstract.php b/src/Writer/Extension/RendererAbstract.php index 80df4c1a..9a0f93df 100644 --- a/src/Writer/Extension/RendererAbstract.php +++ b/src/Writer/Extension/RendererAbstract.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer_Entry_Rss - * @copyright Copyright (c) 2009 Padraic Brady + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -26,7 +26,7 @@ /** * @category Zend * @package Zend_Feed_Writer_Entry_Rss - * @copyright Copyright (c) 2009 Padraic Brady + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Feed_Writer_Extension_RendererAbstract diff --git a/src/Writer/Extension/RendererInterface.php b/src/Writer/Extension/RendererInterface.php index 663b392c..e9c90141 100644 --- a/src/Writer/Extension/RendererInterface.php +++ b/src/Writer/Extension/RendererInterface.php @@ -14,14 +14,14 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2009 Padraic Brady + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2009 Padraic Brady + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Feed_Writer_Extension_RendererInterface diff --git a/src/Writer/Extension/Slash/Renderer/Entry.php b/src/Writer/Extension/Slash/Renderer/Entry.php index b761f01a..b93c7e06 100644 --- a/src/Writer/Extension/Slash/Renderer/Entry.php +++ b/src/Writer/Extension/Slash/Renderer/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Extension_Slash_Renderer_Entry diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php index 7644d1d4..3fd0317b 100644 --- a/src/Writer/Extension/Threading/Renderer/Entry.php +++ b/src/Writer/Extension/Threading/Renderer/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Extension_Threading_Renderer_Entry diff --git a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php index 4b962ce1..8aa37168 100644 --- a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php +++ b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Extension_WellFormedWeb_Renderer_Entry diff --git a/src/Writer/Feed.php b/src/Writer/Feed.php index ff509f48..63edb379 100644 --- a/src/Writer/Feed.php +++ b/src/Writer/Feed.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -52,7 +52,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Feed implements Iterator, Countable diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom.php index d82a3eb6..b6bae222 100644 --- a/src/Writer/Renderer/Entry/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Renderer_Entry_Atom diff --git a/src/Writer/Renderer/Entry/Rss.php b/src/Writer/Renderer/Entry/Rss.php index ead29408..42ef88ff 100644 --- a/src/Writer/Renderer/Entry/Rss.php +++ b/src/Writer/Renderer/Entry/Rss.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Renderer_Entry_Rss diff --git a/src/Writer/Renderer/Feed/Atom.php b/src/Writer/Renderer/Feed/Atom.php index 4477730c..1112d0dd 100644 --- a/src/Writer/Renderer/Feed/Atom.php +++ b/src/Writer/Renderer/Feed/Atom.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -37,7 +37,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Renderer_Feed_Atom diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index 2ef636c6..ba4ede15 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -37,7 +37,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Renderer_Feed_Rss diff --git a/src/Writer/Renderer/RendererAbstract.php b/src/Writer/Renderer/RendererAbstract.php index 8bd53b4b..7fbcc911 100644 --- a/src/Writer/Renderer/RendererAbstract.php +++ b/src/Writer/Renderer/RendererAbstract.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -28,7 +28,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Renderer_RendererAbstract diff --git a/src/Writer/Renderer/RendererInterface.php b/src/Writer/Renderer/RendererInterface.php index 7b5d8a2c..566d70b6 100644 --- a/src/Writer/Renderer/RendererInterface.php +++ b/src/Writer/Renderer/RendererInterface.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -22,7 +22,7 @@ /** * @category Zend * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Feed_Writer_Renderer_RendererInterface diff --git a/test/AllTests.php b/test/AllTests.php index fc414c34..48bc9b2b 100644 --- a/test/AllTests.php +++ b/test/AllTests.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -67,7 +67,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed */ diff --git a/test/ArrayAccessTest.php b/test/ArrayAccessTest.php index e0b8cdef..605652c7 100644 --- a/test/ArrayAccessTest.php +++ b/test/ArrayAccessTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -34,7 +34,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed */ diff --git a/test/AtomEntryOnlyTest.php b/test/AtomEntryOnlyTest.php index d218bac5..b8753b80 100644 --- a/test/AtomEntryOnlyTest.php +++ b/test/AtomEntryOnlyTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -39,7 +39,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed */ diff --git a/test/AtomPublishingTest.php b/test/AtomPublishingTest.php index a4a2806b..e5e62b64 100644 --- a/test/AtomPublishingTest.php +++ b/test/AtomPublishingTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -39,7 +39,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed */ diff --git a/test/CountTest.php b/test/CountTest.php index c95edb3e..ea6f7c7f 100644 --- a/test/CountTest.php +++ b/test/CountTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -34,7 +34,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed */ diff --git a/test/ElementTest.php b/test/ElementTest.php index 680b8457..9f492905 100644 --- a/test/ElementTest.php +++ b/test/ElementTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -34,7 +34,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed */ diff --git a/test/Entry/RssTest.php b/test/Entry/RssTest.php index f662e150..2ee921e4 100644 --- a/test/Entry/RssTest.php +++ b/test/Entry/RssTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -34,7 +34,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed */ diff --git a/test/ImportTest.php b/test/ImportTest.php index 82d2c130..b687ae67 100644 --- a/test/ImportTest.php +++ b/test/ImportTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -49,7 +49,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed */ diff --git a/test/IteratorTest.php b/test/IteratorTest.php index 4ee2f263..017dd1e9 100644 --- a/test/IteratorTest.php +++ b/test/IteratorTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -34,7 +34,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed */ diff --git a/test/Pubsubhubbub/AllTests.php b/test/Pubsubhubbub/AllTests.php index b794bf87..29585731 100644 --- a/test/Pubsubhubbub/AllTests.php +++ b/test/Pubsubhubbub/AllTests.php @@ -14,7 +14,7 @@ * * @category Zend * @package UnitTests - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -38,7 +38,7 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Subsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Pubsubhubbub_AllTests diff --git a/test/Pubsubhubbub/PublisherTest.php b/test/Pubsubhubbub/PublisherTest.php index 4b7bff27..faee5059 100644 --- a/test/Pubsubhubbub/PublisherTest.php +++ b/test/Pubsubhubbub/PublisherTest.php @@ -14,7 +14,7 @@ * * @category Zend * @package UnitTests - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -29,7 +29,7 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Subsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Pubsubhubbub_PublisherTest extends PHPUnit_Framework_TestCase diff --git a/test/Pubsubhubbub/PubsubhubbubTest.php b/test/Pubsubhubbub/PubsubhubbubTest.php index 1b464c12..3a5fa35e 100644 --- a/test/Pubsubhubbub/PubsubhubbubTest.php +++ b/test/Pubsubhubbub/PubsubhubbubTest.php @@ -14,7 +14,7 @@ * * @category Zend * @package UnitTests - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -29,7 +29,7 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Subsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Pubsubhubbub_PubsubhubbubTest extends PHPUnit_Framework_TestCase diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php index c125a523..56d5f405 100644 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -14,7 +14,7 @@ * * @category Zend * @package UnitTests - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -29,7 +29,7 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Subsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Pubsubhubbub_Subscriber_CallbackTest extends PHPUnit_Framework_TestCase diff --git a/test/Pubsubhubbub/SubscriberHttpTest.php b/test/Pubsubhubbub/SubscriberHttpTest.php index 125ecaa3..a063b619 100644 --- a/test/Pubsubhubbub/SubscriberHttpTest.php +++ b/test/Pubsubhubbub/SubscriberHttpTest.php @@ -14,7 +14,7 @@ * * @category Zend * @package UnitTests - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -40,7 +40,7 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Subsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Pubsubhubbub_SubscriberHttpTest extends PHPUnit_Framework_TestCase diff --git a/test/Pubsubhubbub/SubscriberTest.php b/test/Pubsubhubbub/SubscriberTest.php index be5d8250..089d51a7 100644 --- a/test/Pubsubhubbub/SubscriberTest.php +++ b/test/Pubsubhubbub/SubscriberTest.php @@ -14,7 +14,7 @@ * * @category Zend * @package UnitTests - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -30,7 +30,7 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Subsubhubbub - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Pubsubhubbub_SubscriberTest extends PHPUnit_Framework_TestCase diff --git a/test/Reader/Entry/AtomStandaloneEntryTest.php b/test/Reader/Entry/AtomStandaloneEntryTest.php index d7d5b446..6314477e 100644 --- a/test/Reader/Entry/AtomStandaloneEntryTest.php +++ b/test/Reader/Entry/AtomStandaloneEntryTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: AtomTest.php 19159 2009-11-21 14:23:15Z padraic $ */ @@ -27,7 +27,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index 7cb06fb2..7a3c0d18 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader diff --git a/test/Reader/Entry/CommonTest.php b/test/Reader/Entry/CommonTest.php index a23448e0..b2de60fc 100644 --- a/test/Reader/Entry/CommonTest.php +++ b/test/Reader/Entry/CommonTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index 6ba0d22e..1dfe6066 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader diff --git a/test/Reader/Feed/AtomSourceTest.php b/test/Reader/Feed/AtomSourceTest.php index 515796a3..1255ee2c 100644 --- a/test/Reader/Feed/AtomSourceTest.php +++ b/test/Reader/Feed/AtomSourceTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: AtomTest.php 19168 2009-11-21 17:17:18Z padraic $ */ @@ -27,7 +27,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 82787636..4e03bc1a 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader diff --git a/test/Reader/Feed/CommonTest.php b/test/Reader/Feed/CommonTest.php index c41de33e..34814909 100644 --- a/test/Reader/Feed/CommonTest.php +++ b/test/Reader/Feed/CommonTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -28,7 +28,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index bd1ebb15..d1c50c54 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -28,7 +28,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader diff --git a/test/Reader/Integration/H-OnlineComAtom10Test.php b/test/Reader/Integration/H-OnlineComAtom10Test.php index 023e0564..e2605762 100644 --- a/test/Reader/Integration/H-OnlineComAtom10Test.php +++ b/test/Reader/Integration/H-OnlineComAtom10Test.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader diff --git a/test/Reader/Integration/LautDeRdfTest.php b/test/Reader/Integration/LautDeRdfTest.php index 412f7f95..2348f462 100644 --- a/test/Reader/Integration/LautDeRdfTest.php +++ b/test/Reader/Integration/LautDeRdfTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader diff --git a/test/Reader/Integration/PodcastRss2Test.php b/test/Reader/Integration/PodcastRss2Test.php index 10ae989e..dca105b7 100644 --- a/test/Reader/Integration/PodcastRss2Test.php +++ b/test/Reader/Integration/PodcastRss2Test.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -28,7 +28,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader diff --git a/test/Reader/Integration/WordpressAtom10Test.php b/test/Reader/Integration/WordpressAtom10Test.php index 0db86569..f0bcf6d6 100644 --- a/test/Reader/Integration/WordpressAtom10Test.php +++ b/test/Reader/Integration/WordpressAtom10Test.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader diff --git a/test/Reader/Integration/WordpressRss2DcAtomTest.php b/test/Reader/Integration/WordpressRss2DcAtomTest.php index 0324da45..7fee4d57 100644 --- a/test/Reader/Integration/WordpressRss2DcAtomTest.php +++ b/test/Reader/Integration/WordpressRss2DcAtomTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader diff --git a/test/Reader/_files/My/Extension/JungleBooks/Entry.php b/test/Reader/_files/My/Extension/JungleBooks/Entry.php index 0f3b7697..39840a79 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Entry.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Entry.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -28,7 +28,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class My_FeedReader_Extension_JungleBooks_Entry extends Zend_Feed_Reader_Extension_EntryAbstract diff --git a/test/Reader/_files/My/Extension/JungleBooks/Feed.php b/test/Reader/_files/My/Extension/JungleBooks/Feed.php index 2f8af165..700c4ccc 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Feed.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Feed.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -26,7 +26,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class My_FeedReader_Extension_JungleBooks_Feed extends Zend_Feed_Reader_Extension_FeedAbstract diff --git a/test/ReaderTest.php b/test/ReaderTest.php index 842f4f12..6848426c 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -28,7 +28,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader diff --git a/test/Writer/EntryTest.php b/test/Writer/EntryTest.php index 5a7472a8..7fec6a02 100644 --- a/test/Writer/EntryTest.php +++ b/test/Writer/EntryTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -30,7 +30,7 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_EntryTest extends PHPUnit_Framework_TestCase diff --git a/test/Writer/Extension/ITunes/EntryTest.php b/test/Writer/Extension/ITunes/EntryTest.php index 757b7cce..87f3645b 100644 --- a/test/Writer/Extension/ITunes/EntryTest.php +++ b/test/Writer/Extension/ITunes/EntryTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -30,7 +30,7 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Extension_ITunes_EntryTest extends PHPUnit_Framework_TestCase diff --git a/test/Writer/Extension/ITunes/FeedTest.php b/test/Writer/Extension/ITunes/FeedTest.php index 633e7b21..c7af37e2 100644 --- a/test/Writer/Extension/ITunes/FeedTest.php +++ b/test/Writer/Extension/ITunes/FeedTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Json * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -30,7 +30,7 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Extension_ITunes_FeedTest extends PHPUnit_Framework_TestCase diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php index 109e3f17..60320be7 100644 --- a/test/Writer/FeedTest.php +++ b/test/Writer/FeedTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -30,7 +30,7 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_FeedTest extends PHPUnit_Framework_TestCase diff --git a/test/Writer/Renderer/Entry/AtomTest.php b/test/Writer/Renderer/Entry/AtomTest.php index ef4fd66f..cef9ce6e 100644 --- a/test/Writer/Renderer/Entry/AtomTest.php +++ b/test/Writer/Renderer/Entry/AtomTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -32,7 +32,7 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Renderer_Entry_AtomTest extends PHPUnit_Framework_TestCase diff --git a/test/Writer/Renderer/Entry/RssTest.php b/test/Writer/Renderer/Entry/RssTest.php index 6e5bddb1..d0b84ab4 100644 --- a/test/Writer/Renderer/Entry/RssTest.php +++ b/test/Writer/Renderer/Entry/RssTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -32,7 +32,7 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Renderer_Entry_RssTest extends PHPUnit_Framework_TestCase diff --git a/test/Writer/Renderer/Feed/AtomTest.php b/test/Writer/Renderer/Feed/AtomTest.php index 8abcfafc..71e0b877 100644 --- a/test/Writer/Renderer/Feed/AtomTest.php +++ b/test/Writer/Renderer/Feed/AtomTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -32,7 +32,7 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Renderer_Feed_AtomTest extends PHPUnit_Framework_TestCase diff --git a/test/Writer/Renderer/Feed/RssTest.php b/test/Writer/Renderer/Feed/RssTest.php index fd993732..a89eeea2 100644 --- a/test/Writer/Renderer/Feed/RssTest.php +++ b/test/Writer/Renderer/Feed/RssTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -32,7 +32,7 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Writer - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Renderer_Feed_RssTest extends PHPUnit_Framework_TestCase From c460cf96c6a528f6835b7efef84d6e030a0c7d3a Mon Sep 17 00:00:00 2001 From: matthew Date: Wed, 6 Jan 2010 21:26:01 +0000 Subject: [PATCH 096/238] ZF-8715: Fix encoding issues for all components that escape data using htmlentities and/or htmlspecialchars; set default character set to UTF-8 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20104 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Element.php | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/Element.php b/src/Element.php index 8611ab3a..4812a772 100644 --- a/src/Element.php +++ b/src/Element.php @@ -37,6 +37,11 @@ class Zend_Feed_Element implements ArrayAccess */ protected $_element; + /** + * @var string Character encoding to utilize + */ + protected $_encoding = 'UTF-8'; + /** * @var Zend_Feed_Element */ @@ -148,6 +153,27 @@ public function saveXmlFragment() return $this->_element->ownerDocument->saveXML($this->_element); } + /** + * Get encoding + * + * @return string + */ + public function getEncoding() + { + return $this->_encoding; + } + + /** + * Set encoding + * + * @param string $value Encoding to use + * @return Zend_Feed_Element + */ + public function setEncoding($value) + { + $this->_encoding = (string) $value; + return $this; + } /** * Map variable access onto the underlying entry representation. @@ -205,11 +231,11 @@ public function __set($var, $val) if (strpos($var, ':') !== false) { list($ns, $elt) = explode(':', $var, 2); $node = $this->_element->ownerDocument->createElementNS(Zend_Feed::lookupNamespace($ns), - $var, htmlspecialchars($val, ENT_NOQUOTES, 'UTF-8')); + $var, htmlspecialchars($val, ENT_NOQUOTES, $this->getEncoding())); $this->_element->appendChild($node); } else { $node = $this->_element->ownerDocument->createElement($var, - htmlspecialchars($val, ENT_NOQUOTES, 'UTF-8')); + htmlspecialchars($val, ENT_NOQUOTES, $this->getEncoding())); $this->_element->appendChild($node); } } elseif (count($nodes) > 1) { From e4684b50ab69bbf03700929f846ff6b5e9fdcc62 Mon Sep 17 00:00:00 2001 From: padraic Date: Mon, 11 Jan 2010 00:27:16 +0000 Subject: [PATCH 097/238] Added model schema to docs; modified Model to set a MySQL style datetime (via Zend_Date) string for datetime fields git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20190 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/Subscriber.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Pubsubhubbub/Subscriber.php b/src/Pubsubhubbub/Subscriber.php index 2f41562d..d7be9d9c 100644 --- a/src/Pubsubhubbub/Subscriber.php +++ b/src/Pubsubhubbub/Subscriber.php @@ -23,6 +23,11 @@ */ require_once 'Zend/Feed/Pubsubhubbub.php'; +/** + * @see Zend_Date + */ +require_once 'Zend/Date.php'; + /** * @category Zend * @package Zend_Feed_Pubsubhubbub @@ -732,20 +737,26 @@ protected function _getRequestParameters($hubUrl, $mode) $params['hub.lease_seconds'] = $this->getLeaseSeconds(); } - // TODO: hub.secret not currently supported + // hub.secret not currently supported $optParams = $this->getParameters(); foreach ($optParams as $name => $value) { $params[$name] = $value; } // store subscription to storage + $now = new Zend_Date; + $expires = null; + if (isset($params['hub.lease_seconds'])) { + $expires = $now->add($params['hub.lease_seconds'], Zend_Date::SECOND) + ->get('YYYY-MM-dd HH:mm:ss'); + } $data = array( 'id' => $key, 'topic_url' => $params['hub.topic'], 'hub_url' => $hubUrl, - 'created_time' => time(), - 'last_modified' => time(), - 'lease_seconds' => isset($params['hub.lease_seconds']) ? $params['hub.lease_seconds'] : null, + 'created_time' => $now->get('YYYY-MM-dd HH:mm:ss'), + 'last_modified' => $now->get('YYYY-MM-dd HH:mm:ss'), + 'lease_seconds' => $expires, 'verify_token' => hash('sha256', $params['hub.verify_token']), 'secret' => null, 'expiration_time' => isset($params['hub.lease_seconds']) ? time() + $params['hub.lease_seconds'] : null, From 9f85375e0bfebc6926b88c2b028048da6002d348 Mon Sep 17 00:00:00 2001 From: padraic Date: Mon, 11 Jan 2010 11:56:14 +0000 Subject: [PATCH 098/238] Zend_Feed_Pubsubhubbub: Switched model directed year format from YYYY to yyyy for Zend_Date (use real year, not ISO year). git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20194 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/Subscriber.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Pubsubhubbub/Subscriber.php b/src/Pubsubhubbub/Subscriber.php index d7be9d9c..b249f653 100644 --- a/src/Pubsubhubbub/Subscriber.php +++ b/src/Pubsubhubbub/Subscriber.php @@ -748,14 +748,14 @@ protected function _getRequestParameters($hubUrl, $mode) $expires = null; if (isset($params['hub.lease_seconds'])) { $expires = $now->add($params['hub.lease_seconds'], Zend_Date::SECOND) - ->get('YYYY-MM-dd HH:mm:ss'); + ->get('yyyy-MM-dd HH:mm:ss'); } $data = array( 'id' => $key, 'topic_url' => $params['hub.topic'], 'hub_url' => $hubUrl, - 'created_time' => $now->get('YYYY-MM-dd HH:mm:ss'), - 'last_modified' => $now->get('YYYY-MM-dd HH:mm:ss'), + 'created_time' => $now->get('yyyy-MM-dd HH:mm:ss'), + 'last_modified' => $now->get('yyyy-MM-dd HH:mm:ss'), 'lease_seconds' => $expires, 'verify_token' => hash('sha256', $params['hub.verify_token']), 'secret' => null, From c0c5f1ce0a9efb9a195daaec460bc5f8cb6d770a Mon Sep 17 00:00:00 2001 From: padraic Date: Mon, 11 Jan 2010 12:03:06 +0000 Subject: [PATCH 099/238] Zend_Feed_Pubsubhubbub: Applied expiration date to model using typical datetime format; added last_modified change for each save. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20195 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/Model/Subscription.php | 2 ++ src/Pubsubhubbub/Subscriber.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Pubsubhubbub/Model/Subscription.php b/src/Pubsubhubbub/Model/Subscription.php index 81efd103..6b41abb8 100644 --- a/src/Pubsubhubbub/Model/Subscription.php +++ b/src/Pubsubhubbub/Model/Subscription.php @@ -54,6 +54,8 @@ public function setSubscription(array $data) $result = $this->_db->find($data['id']); if ($result) { $data['created_time'] = $result->current()->created_time; + $now = new Zend_Date; + $data['last_modified'] = $now->get('yyyy-MM-dd HH:mm:ss'); $this->_db->update( $data, $this->_db->getAdapter()->quoteInto('id = ?', $data['id']) diff --git a/src/Pubsubhubbub/Subscriber.php b/src/Pubsubhubbub/Subscriber.php index b249f653..8796ff46 100644 --- a/src/Pubsubhubbub/Subscriber.php +++ b/src/Pubsubhubbub/Subscriber.php @@ -759,7 +759,7 @@ protected function _getRequestParameters($hubUrl, $mode) 'lease_seconds' => $expires, 'verify_token' => hash('sha256', $params['hub.verify_token']), 'secret' => null, - 'expiration_time' => isset($params['hub.lease_seconds']) ? time() + $params['hub.lease_seconds'] : null, + 'expiration_time' => $expires, 'subscription_state' => Zend_Feed_Pubsubhubbub::SUBSCRIPTION_NOTVERIFIED, ); $this->getStorage()->setSubscription($data); From 34aba38ec94de032fa83f753ac4ede3e55a7b913 Mon Sep 17 00:00:00 2001 From: padraic Date: Mon, 11 Jan 2010 12:07:41 +0000 Subject: [PATCH 100/238] Zend_Feed_Pubsubhubbub: Added verification flag after successful Hub callback git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20196 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/Subscriber/Callback.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Pubsubhubbub/Subscriber/Callback.php b/src/Pubsubhubbub/Subscriber/Callback.php index b296b308..12029291 100644 --- a/src/Pubsubhubbub/Subscriber/Callback.php +++ b/src/Pubsubhubbub/Subscriber/Callback.php @@ -116,7 +116,7 @@ public function handle(array $httpGetData = null, $sendResponseNow = false) } elseif ($this->isValidHubVerification($httpGetData)) { $data = $this->_currentSubscriptionData; $this->getHttpResponse()->setBody($httpGetData['hub_challenge']); - $data['verified'] = 1; + $data['subscription_state'] = Zend_Feed_Pubsubhubbub::SUBSCRIPTION_VERIFIED; $this->getStorage()->setSubscription($data); /** * Hey, C'mon! We tried everything else! From 3bf1b9f42cad6c0dd774bda4a7c680054281e16d Mon Sep 17 00:00:00 2001 From: padraic Date: Mon, 11 Jan 2010 12:13:15 +0000 Subject: [PATCH 101/238] Zend_Feed_Pubsubhubbub: Added incremented expiration_time on all subscription writes (new,confirmed,refreshed) git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20197 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/Model/Subscription.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Pubsubhubbub/Model/Subscription.php b/src/Pubsubhubbub/Model/Subscription.php index 6b41abb8..e79e39d9 100644 --- a/src/Pubsubhubbub/Model/Subscription.php +++ b/src/Pubsubhubbub/Model/Subscription.php @@ -56,6 +56,8 @@ public function setSubscription(array $data) $data['created_time'] = $result->current()->created_time; $now = new Zend_Date; $data['last_modified'] = $now->get('yyyy-MM-dd HH:mm:ss'); + $data['expiration_time'] = $now->add($data['lease_seconds'], Zend_Date::SECOND) + ->get('yyyy-MM-dd HH:mm:ss'); $this->_db->update( $data, $this->_db->getAdapter()->quoteInto('id = ?', $data['id']) From b7a505ada245b696ea6d378216ab58863ad60bf9 Mon Sep 17 00:00:00 2001 From: padraic Date: Tue, 12 Jan 2010 20:19:46 +0000 Subject: [PATCH 102/238] Fixes two failing Pubsubhubbub tests Fixes bug where Zend_Feed_Writer would render empty description elements if no description (or empty description) was set for an entry. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20241 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/Model/Subscription.php | 2 +- src/Writer/Renderer/Entry/Rss.php | 3 +++ test/Pubsubhubbub/Subscriber/CallbackTest.php | 14 ++++++++------ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Pubsubhubbub/Model/Subscription.php b/src/Pubsubhubbub/Model/Subscription.php index e79e39d9..cf0322f6 100644 --- a/src/Pubsubhubbub/Model/Subscription.php +++ b/src/Pubsubhubbub/Model/Subscription.php @@ -56,7 +56,7 @@ public function setSubscription(array $data) $data['created_time'] = $result->current()->created_time; $now = new Zend_Date; $data['last_modified'] = $now->get('yyyy-MM-dd HH:mm:ss'); - $data['expiration_time'] = $now->add($data['lease_seconds'], Zend_Date::SECOND) + $data['expiration_time'] = $now->add($result->current()->lease_seconds, Zend_Date::SECOND) ->get('yyyy-MM-dd HH:mm:ss'); $this->_db->update( $data, diff --git a/src/Writer/Renderer/Entry/Rss.php b/src/Writer/Renderer/Entry/Rss.php index 42ef88ff..50da5f5d 100644 --- a/src/Writer/Renderer/Entry/Rss.php +++ b/src/Writer/Renderer/Entry/Rss.php @@ -131,6 +131,9 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) return; } } + if (!$this->getDataContainer()->getDescription()) { + return; + } $subtitle = $dom->createElement('description'); $root->appendChild($subtitle); $text = $dom->createCDATASection($this->getDataContainer()->getDescription()); diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php index 56d5f405..e378df8a 100644 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -252,8 +252,9 @@ public function testRespondsToValidConfirmationWith200Response() $rowdata = new stdClass; $rowdata->id = 'verifytokenkey'; $rowdata->verify_token = hash('sha256', 'cba'); - $t = time(); - $rowdata->created_time = $t; + $t = new Zend_Date; + $rowdata->created_time = $t->get(Zend_Date::TIMESTAMP); + $rowdata->lease_seconds = 10000; $this->_rowset->expects($this->any()) ->method('current') ->will($this->returnValue($rowdata)); @@ -261,7 +262,7 @@ public function testRespondsToValidConfirmationWith200Response() $this->_tableGateway->expects($this->once()) ->method('update') ->with( - $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t,'verified'=>'1')), + $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Zend_Date::TIMESTAMP),'lease_seconds'=>10000,'subscription_state'=>'verified','last_modified'=>$t->get('yyyy-MM-dd HH:mm:ss'),'expiration_time'=>$t->add(10000,Zend_Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), $this->equalTo('id = \'verifytokenkey\'') ); $this->_adapter->expects($this->once()) @@ -282,8 +283,9 @@ public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() $rowdata = new stdClass; $rowdata->id = 'verifytokenkey'; $rowdata->verify_token = hash('sha256', 'cba'); - $t = time(); - $rowdata->created_time = $t; + $t = new Zend_Date; + $rowdata->created_time = $t->get(Zend_Date::TIMESTAMP); + $rowdata->lease_seconds = 10000; $this->_rowset->expects($this->any()) ->method('current') ->will($this->returnValue($rowdata)); @@ -291,7 +293,7 @@ public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() $this->_tableGateway->expects($this->once()) ->method('update') ->with( - $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t,'verified'=>'1')), + $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Zend_Date::TIMESTAMP),'lease_seconds'=>10000,'subscription_state'=>'verified','last_modified'=>$t->get('yyyy-MM-dd HH:mm:ss'),'expiration_time'=>$t->add(10000,Zend_Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), $this->equalTo('id = \'verifytokenkey\'') ); $this->_adapter->expects($this->once()) From cb77f86b5620bedc4aff8af05231a134a30b5e10 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 15 Jan 2010 20:53:50 +0000 Subject: [PATCH 103/238] Added omitted Source Atom support to Zend_Feed_Writer (Atom core classes refactored in line with improvements) git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20310 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Writer/Entry.php | 41 + src/Writer/Feed.php | 660 +--------------- src/Writer/Feed/FeedAbstract.php | 716 ++++++++++++++++++ src/Writer/Renderer/Entry/Atom.php | 22 + src/Writer/Renderer/Feed/Atom.php | 355 +-------- .../Renderer/Feed/Atom/AtomAbstract.php | 408 ++++++++++ src/Writer/Renderer/Feed/Atom/Source.php | 84 ++ src/Writer/Source.php | 33 + 8 files changed, 1311 insertions(+), 1008 deletions(-) create mode 100644 src/Writer/Feed/FeedAbstract.php create mode 100644 src/Writer/Renderer/Feed/Atom/AtomAbstract.php create mode 100644 src/Writer/Renderer/Feed/Atom/Source.php create mode 100644 src/Writer/Source.php diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index 4ccd7f53..e61caf15 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -29,6 +29,8 @@ */ require_once 'Zend/Uri.php'; +require_once 'Zend/Feed/Writer/Source.php'; + /** * @category Zend * @package Zend_Feed_Writer @@ -707,6 +709,45 @@ public function __call($method, $args) throw new Zend_Feed_Exception('Method: ' . $method . ' does not exist and could not be located on a registered Extension'); } + + /** + * Creates a new Zend_Feed_Writer_Source data container for use. This is NOT + * added to the current feed automatically, but is necessary to create a + * container with some initial values preset based on the current feed data. + * + * @return Zend_Feed_Writer_Source + */ + public function createSource() + { + $source = new Zend_Feed_Writer_Source; + if ($this->getEncoding()) { + $source->setEncoding($this->getEncoding()); + } + $source->setType($this->getType()); + return $source; + } + + /** + * Appends a Zend_Feed_Writer_Entry object representing a new entry/item + * the feed data container's internal group of entries. + * + * @param Zend_Feed_Writer_Source $source + */ + public function setSource(Zend_Feed_Writer_Source $source) + { + $this->_data['source'] = $source; + } + + /** + * @return Zend_Feed_Writer_Source + */ + public function getSource() + { + if (isset($this->_data['source'])) { + return $this->_data['source']; + } + return null; + } /** * Load extensions from Zend_Feed_Writer diff --git a/src/Writer/Feed.php b/src/Writer/Feed.php index 63edb379..b3c90e4f 100644 --- a/src/Writer/Feed.php +++ b/src/Writer/Feed.php @@ -49,20 +49,17 @@ */ require_once 'Zend/Feed/Writer/Renderer/Feed/Rss.php'; +require_once 'Zend/Feed/Writer/Feed/FeedAbstract.php'; + /** * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Feed implements Iterator, Countable +class Zend_Feed_Writer_Feed extends Zend_Feed_Writer_Feed_FeedAbstract +implements Iterator, Countable { - /** - * Contains all Feed level date to append in feed output - * - * @var array - */ - protected $_data = array(); /** * Contains all entry objects @@ -77,585 +74,6 @@ class Zend_Feed_Writer_Feed implements Iterator, Countable * @var int */ protected $_entriesKey = 0; - - /** - * Holds the value "atom" or "rss" depending on the feed type set when - * when last exported. - * - * @var string - */ - protected $_type = null; - - /** - * Constructor: Primarily triggers the registration of core extensions and - * loads those appropriate to this data container. - * - * @return void - */ - public function __construct() - { - Zend_Feed_Writer::registerCoreExtensions(); - $this->_loadExtensions(); - } - - /** - * Set a single author - * - * @param int $index - * @return string|null - */ - public function addAuthor($name, $email = null, $uri = null) - { - $author = array(); - if (is_array($name)) { - if (!array_key_exists('name', $name) || empty($name['name']) || !is_string($name['name'])) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); - } - $author['name'] = $name['name']; - if (isset($name['email'])) { - if (empty($name['email']) || !is_string($name['email'])) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); - } - $author['email'] = $name['email']; - } - if (isset($name['uri'])) { - if (empty($name['uri']) || !is_string($name['uri']) || !Zend_Uri::check($name['uri'])) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); - } - $author['uri'] = $name['uri']; - } - } else { - if (empty($name['name']) || !is_string($name['name'])) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string value'); - } - $author['name'] = $name; - if (isset($email)) { - if (empty($email) || !is_string($email)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "email" value must be a non-empty string'); - } - $author['email'] = $email; - } - if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); - } - $author['uri'] = $uri; - } - } - $this->_data['authors'][] = $author; - } - - /** - * Set an array with feed authors - * - * @return array - */ - public function addAuthors(array $authors) - { - foreach($authors as $author) { - $this->addAuthor($author); - } - } - - /** - * Set the copyright entry - * - * @return string|null - */ - public function setCopyright($copyright) - { - if (empty($copyright) || !is_string($copyright)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['copyright'] = $copyright; - } - - /** - * Set the feed creation date - * - * @param null|integer|Zend_Date - */ - public function setDateCreated($date = null) - { - $zdate = null; - if (is_null($date)) { - $zdate = new Zend_Date; - } elseif (ctype_digit($date) && strlen($date) == 10) { - $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); - } elseif ($date instanceof Zend_Date) { - $zdate = $date; - } else { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); - } - $this->_data['dateCreated'] = $zdate; - } - - /** - * Set the feed modification date - * - * @param null|integer|Zend_Date - */ - public function setDateModified($date = null) - { - $zdate = null; - if (is_null($date)) { - $zdate = new Zend_Date; - } elseif (ctype_digit($date) && strlen($date) == 10) { - $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); - } elseif ($date instanceof Zend_Date) { - $zdate = $date; - } else { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); - } - $this->_data['dateModified'] = $zdate; - } - - /** - * Set the feed description - * - * @return string|null - */ - public function setDescription($description) - { - if (empty($description) || !is_string($description)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['description'] = $description; - } - - /** - * Set the feed generator entry - * - * @return string|null - */ - public function setGenerator($name, $version = null, $uri = null) - { - if (empty($name) || !is_string($name)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string'); - } - $generator = array('name' => $name); - if (isset($version)) { - if (empty($version) || !is_string($version)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "version" must be a non-empty string'); - } - $generator['version'] = $version; - } - if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); - } - $generator['uri'] = $uri; - } - $this->_data['generator'] = $generator; - } - - /** - * Set the feed ID - URI or URN (via PCRE pattern) supported - * - * @return string|null - */ - public function setId($id) - { - if ((empty($id) || !is_string($id) || !Zend_Uri::check($id)) && - !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); - } - $this->_data['id'] = $id; - } - - /** - * Set the feed language - * - * @return string|null - */ - public function setLanguage($language) - { - if (empty($language) || !is_string($language)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['language'] = $language; - } - - /** - * Set a link to the HTML source - * - * @return string|null - */ - public function setLink($link) - { - if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); - } - $this->_data['link'] = $link; - } - - /** - * Set a link to an XML feed for any feed type/version - * - * @return string|null - */ - public function setFeedLink($link, $type) - { - if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "link"" must be a non-empty string and valid URI/IRI'); - } - if (!in_array(strtolower($type), array('rss', 'rdf', 'atom'))) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom'); - } - $this->_data['feedLinks'][strtolower($type)] = $link; - } - - /** - * Set the feed title - * - * @return string|null - */ - public function setTitle($title) - { - if (empty($title) || !is_string($title)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['title'] = $title; - } - - /** - * Set the feed character encoding - * - * @param string $encoding - */ - public function setEncoding($encoding) - { - if (empty($encoding) || !is_string($encoding)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['encoding'] = $encoding; - } - - /** - * Set the feed's base URL - * - * @param string $url - */ - public function setBaseUrl($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "url" array value' - . ' must be a non-empty string and valid URI/IRI'); - } - $this->_data['baseUrl'] = $url; - } - - /** - * Add a Pubsubhubbub hub endpoint URL - * - * @param string $url - */ - public function addHub($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "url" array value' - . ' must be a non-empty string and valid URI/IRI'); - } - if (!isset($this->_data['hubs'])) { - $this->_data['hubs'] = array(); - } - $this->_data['hubs'][] = $url; - } - - /** - * Add Pubsubhubbub hub endpoint URLs - * - * @param array $urls - */ - public function addHubs(array $urls) - { - foreach ($urls as $url) { - $this->addHub($url); - } - } - - /** - * Add a feed category - * - * @param string $category - */ - public function addCategory(array $category) - { - if (!isset($category['term'])) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Each category must be an array and ' - . 'contain at least a "term" element containing the machine ' - . ' readable category name'); - } - if (isset($category['scheme'])) { - if (empty($category['scheme']) - || !is_string($category['scheme']) - || !Zend_Uri::check($category['scheme']) - ) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('The Atom scheme or RSS domain of' - . ' a category must be a valid URI'); - } - } - if (!isset($this->_data['categories'])) { - $this->_data['categories'] = array(); - } - $this->_data['categories'][] = $category; - } - - /** - * Set an array of feed categories - * - * @param array $categories - */ - public function addCategories(array $categories) - { - foreach ($categories as $category) { - $this->addCategory($category); - } - } - - /** - * Get a single author - * - * @param int $index - * @return string|null - */ - public function getAuthor($index = 0) - { - if (isset($this->_data['authors'][$index])) { - return $this->_data['authors'][$index]; - } else { - return null; - } - } - - /** - * Get an array with feed authors - * - * @return array - */ - public function getAuthors() - { - if (!array_key_exists('authors', $this->_data)) { - return null; - } - return $this->_data['authors']; - } - - /** - * Get the copyright entry - * - * @return string|null - */ - public function getCopyright() - { - if (!array_key_exists('copyright', $this->_data)) { - return null; - } - return $this->_data['copyright']; - } - - /** - * Get the feed creation date - * - * @return string|null - */ - public function getDateCreated() - { - if (!array_key_exists('dateCreated', $this->_data)) { - return null; - } - return $this->_data['dateCreated']; - } - - /** - * Get the feed modification date - * - * @return string|null - */ - public function getDateModified() - { - if (!array_key_exists('dateModified', $this->_data)) { - return null; - } - return $this->_data['dateModified']; - } - - /** - * Get the feed description - * - * @return string|null - */ - public function getDescription() - { - if (!array_key_exists('description', $this->_data)) { - return null; - } - return $this->_data['description']; - } - - /** - * Get the feed generator entry - * - * @return string|null - */ - public function getGenerator() - { - if (!array_key_exists('generator', $this->_data)) { - return null; - } - return $this->_data['generator']; - } - - /** - * Get the feed ID - * - * @return string|null - */ - public function getId() - { - if (!array_key_exists('id', $this->_data)) { - return null; - } - return $this->_data['id']; - } - - /** - * Get the feed language - * - * @return string|null - */ - public function getLanguage() - { - if (!array_key_exists('language', $this->_data)) { - return null; - } - return $this->_data['language']; - } - - /** - * Get a link to the HTML source - * - * @return string|null - */ - public function getLink() - { - if (!array_key_exists('link', $this->_data)) { - return null; - } - return $this->_data['link']; - } - - /** - * Get a link to the XML feed - * - * @return string|null - */ - public function getFeedLinks() - { - if (!array_key_exists('feedLinks', $this->_data)) { - return null; - } - return $this->_data['feedLinks']; - } - - /** - * Get the feed title - * - * @return string|null - */ - public function getTitle() - { - if (!array_key_exists('title', $this->_data)) { - return null; - } - return $this->_data['title']; - } - - /** - * Get the feed character encoding - * - * @return string|null - */ - public function getEncoding() - { - if (!array_key_exists('encoding', $this->_data)) { - return 'UTF-8'; - } - return $this->_data['encoding']; - } - - /** - * Get the feed's base url - * - * @return string|null - */ - public function getBaseUrl() - { - if (!array_key_exists('baseUrl', $this->_data)) { - return null; - } - return $this->_data['baseUrl']; - } - - /** - * Get the URLs used as Pubsubhubbub hubs endpoints - * - * @return string|null - */ - public function getHubs() - { - if (!array_key_exists('hubs', $this->_data)) { - return null; - } - return $this->_data['hubs']; - } - - /** - * Get the feed categories - * - * @return string|null - */ - public function getCategories() - { - if (!array_key_exists('categories', $this->_data)) { - return null; - } - return $this->_data['categories']; - } - - /** - * Resets the instance and deletes all data - * - * @return void - */ - public function reset() - { - $this->_data = array(); - } /** * Creates a new Zend_Feed_Writer_Entry data container for use. This is NOT @@ -803,28 +221,6 @@ public function valid() { return 0 <= $this->_entriesKey && $this->_entriesKey < $this->count(); } - - /** - * Set the current feed type being exported to "rss" or "atom". This allows - * other objects to gracefully choose whether to execute or not, depending - * on their appropriateness for the current type, e.g. renderers. - * - * @param string $type - */ - public function setType($type) - { - $this->_type = $type; - } - - /** - * Retrieve the current or last feed type exported. - * - * @return string Value will be "rss" or "atom" - */ - public function getType() - { - return $this->_type; - } /** * Attempt to build and return the feed resulting from the data set @@ -848,53 +244,5 @@ public function export($type, $ignoreExceptions = false) } return $renderer->render()->saveXml(); } - - /** - * Unset a specific data point - * - * @param string $name - */ - public function remove($name) - { - if (isset($this->_data[$name])) { - unset($this->_data[$name]); - } - } - - /** - * Method overloading: call given method on first extension implementing it - * - * @param string $method - * @param array $args - * @return mixed - * @throws Zend_Feed_Exception if no extensions implements the method - */ - public function __call($method, $args) - { - foreach ($this->_extensions as $extension) { - try { - return call_user_func_array(array($extension, $method), $args); - } catch (Zend_Feed_Writer_Exception_InvalidMethodException $e) { - } - } - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Method: ' . $method - . ' does not exist and could not be located on a registered Extension'); - } - /** - * Load extensions from Zend_Feed_Writer - * - * @return void - */ - protected function _loadExtensions() - { - $all = Zend_Feed_Writer::getExtensions(); - $exts = $all['feed']; - foreach ($exts as $ext) { - $className = Zend_Feed_Writer::getPluginLoader()->getClassName($ext); - $this->_extensions[$ext] = new $className(); - $this->_extensions[$ext]->setEncoding($this->getEncoding()); - } - } } diff --git a/src/Writer/Feed/FeedAbstract.php b/src/Writer/Feed/FeedAbstract.php new file mode 100644 index 00000000..24fbe730 --- /dev/null +++ b/src/Writer/Feed/FeedAbstract.php @@ -0,0 +1,716 @@ +_loadExtensions(); + } + + /** + * Set a single author + * + * @param int $index + * @return string|null + */ + public function addAuthor($name, $email = null, $uri = null) + { + $author = array(); + if (is_array($name)) { + if (!array_key_exists('name', $name) || empty($name['name']) || !is_string($name['name'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); + } + $author['name'] = $name['name']; + if (isset($name['email'])) { + if (empty($name['email']) || !is_string($name['email'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); + } + $author['email'] = $name['email']; + } + if (isset($name['uri'])) { + if (empty($name['uri']) || !is_string($name['uri']) || !Zend_Uri::check($name['uri'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); + } + $author['uri'] = $name['uri']; + } + } else { + if (empty($name['name']) || !is_string($name['name'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string value'); + } + $author['name'] = $name; + if (isset($email)) { + if (empty($email) || !is_string($email)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "email" value must be a non-empty string'); + } + $author['email'] = $email; + } + if (isset($uri)) { + if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); + } + $author['uri'] = $uri; + } + } + $this->_data['authors'][] = $author; + } + + /** + * Set an array with feed authors + * + * @return array + */ + public function addAuthors(array $authors) + { + foreach($authors as $author) { + $this->addAuthor($author); + } + } + + /** + * Set the copyright entry + * + * @return string|null + */ + public function setCopyright($copyright) + { + if (empty($copyright) || !is_string($copyright)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + } + $this->_data['copyright'] = $copyright; + } + + /** + * Set the feed creation date + * + * @param null|integer|Zend_Date + */ + public function setDateCreated($date = null) + { + $zdate = null; + if (is_null($date)) { + $zdate = new Zend_Date; + } elseif (ctype_digit($date) && strlen($date) == 10) { + $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); + } elseif ($date instanceof Zend_Date) { + $zdate = $date; + } else { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + } + $this->_data['dateCreated'] = $zdate; + } + + /** + * Set the feed modification date + * + * @param null|integer|Zend_Date + */ + public function setDateModified($date = null) + { + $zdate = null; + if (is_null($date)) { + $zdate = new Zend_Date; + } elseif (ctype_digit($date) && strlen($date) == 10) { + $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); + } elseif ($date instanceof Zend_Date) { + $zdate = $date; + } else { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + } + $this->_data['dateModified'] = $zdate; + } + + /** + * Set the feed description + * + * @return string|null + */ + public function setDescription($description) + { + if (empty($description) || !is_string($description)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + } + $this->_data['description'] = $description; + } + + /** + * Set the feed generator entry + * + * @return string|null + */ + public function setGenerator($name, $version = null, $uri = null) + { + if (empty($name) || !is_string($name)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string'); + } + $generator = array('name' => $name); + if (isset($version)) { + if (empty($version) || !is_string($version)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "version" must be a non-empty string'); + } + $generator['version'] = $version; + } + if (isset($uri)) { + if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); + } + $generator['uri'] = $uri; + } + $this->_data['generator'] = $generator; + } + + /** + * Set the feed ID - URI or URN (via PCRE pattern) supported + * + * @return string|null + */ + public function setId($id) + { + if ((empty($id) || !is_string($id) || !Zend_Uri::check($id)) && + !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + } + $this->_data['id'] = $id; + } + + /** + * Set the feed language + * + * @return string|null + */ + public function setLanguage($language) + { + if (empty($language) || !is_string($language)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + } + $this->_data['language'] = $language; + } + + /** + * Set a link to the HTML source + * + * @return string|null + */ + public function setLink($link) + { + if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + } + $this->_data['link'] = $link; + } + + /** + * Set a link to an XML feed for any feed type/version + * + * @return string|null + */ + public function setFeedLink($link, $type) + { + if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "link"" must be a non-empty string and valid URI/IRI'); + } + if (!in_array(strtolower($type), array('rss', 'rdf', 'atom'))) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom'); + } + $this->_data['feedLinks'][strtolower($type)] = $link; + } + + /** + * Set the feed title + * + * @return string|null + */ + public function setTitle($title) + { + if (empty($title) || !is_string($title)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + } + $this->_data['title'] = $title; + } + + /** + * Set the feed character encoding + * + * @param string $encoding + */ + public function setEncoding($encoding) + { + if (empty($encoding) || !is_string($encoding)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + } + $this->_data['encoding'] = $encoding; + } + + /** + * Set the feed's base URL + * + * @param string $url + */ + public function setBaseUrl($url) + { + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "url" array value' + . ' must be a non-empty string and valid URI/IRI'); + } + $this->_data['baseUrl'] = $url; + } + + /** + * Add a Pubsubhubbub hub endpoint URL + * + * @param string $url + */ + public function addHub($url) + { + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "url" array value' + . ' must be a non-empty string and valid URI/IRI'); + } + if (!isset($this->_data['hubs'])) { + $this->_data['hubs'] = array(); + } + $this->_data['hubs'][] = $url; + } + + /** + * Add Pubsubhubbub hub endpoint URLs + * + * @param array $urls + */ + public function addHubs(array $urls) + { + foreach ($urls as $url) { + $this->addHub($url); + } + } + + /** + * Add a feed category + * + * @param string $category + */ + public function addCategory(array $category) + { + if (!isset($category['term'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Each category must be an array and ' + . 'contain at least a "term" element containing the machine ' + . ' readable category name'); + } + if (isset($category['scheme'])) { + if (empty($category['scheme']) + || !is_string($category['scheme']) + || !Zend_Uri::check($category['scheme']) + ) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('The Atom scheme or RSS domain of' + . ' a category must be a valid URI'); + } + } + if (!isset($this->_data['categories'])) { + $this->_data['categories'] = array(); + } + $this->_data['categories'][] = $category; + } + + /** + * Set an array of feed categories + * + * @param array $categories + */ + public function addCategories(array $categories) + { + foreach ($categories as $category) { + $this->addCategory($category); + } + } + + /** + * Get a single author + * + * @param int $index + * @return string|null + */ + public function getAuthor($index = 0) + { + if (isset($this->_data['authors'][$index])) { + return $this->_data['authors'][$index]; + } else { + return null; + } + } + + /** + * Get an array with feed authors + * + * @return array + */ + public function getAuthors() + { + if (!array_key_exists('authors', $this->_data)) { + return null; + } + return $this->_data['authors']; + } + + /** + * Get the copyright entry + * + * @return string|null + */ + public function getCopyright() + { + if (!array_key_exists('copyright', $this->_data)) { + return null; + } + return $this->_data['copyright']; + } + + /** + * Get the feed creation date + * + * @return string|null + */ + public function getDateCreated() + { + if (!array_key_exists('dateCreated', $this->_data)) { + return null; + } + return $this->_data['dateCreated']; + } + + /** + * Get the feed modification date + * + * @return string|null + */ + public function getDateModified() + { + if (!array_key_exists('dateModified', $this->_data)) { + return null; + } + return $this->_data['dateModified']; + } + + /** + * Get the feed description + * + * @return string|null + */ + public function getDescription() + { + if (!array_key_exists('description', $this->_data)) { + return null; + } + return $this->_data['description']; + } + + /** + * Get the feed generator entry + * + * @return string|null + */ + public function getGenerator() + { + if (!array_key_exists('generator', $this->_data)) { + return null; + } + return $this->_data['generator']; + } + + /** + * Get the feed ID + * + * @return string|null + */ + public function getId() + { + if (!array_key_exists('id', $this->_data)) { + return null; + } + return $this->_data['id']; + } + + /** + * Get the feed language + * + * @return string|null + */ + public function getLanguage() + { + if (!array_key_exists('language', $this->_data)) { + return null; + } + return $this->_data['language']; + } + + /** + * Get a link to the HTML source + * + * @return string|null + */ + public function getLink() + { + if (!array_key_exists('link', $this->_data)) { + return null; + } + return $this->_data['link']; + } + + /** + * Get a link to the XML feed + * + * @return string|null + */ + public function getFeedLinks() + { + if (!array_key_exists('feedLinks', $this->_data)) { + return null; + } + return $this->_data['feedLinks']; + } + + /** + * Get the feed title + * + * @return string|null + */ + public function getTitle() + { + if (!array_key_exists('title', $this->_data)) { + return null; + } + return $this->_data['title']; + } + + /** + * Get the feed character encoding + * + * @return string|null + */ + public function getEncoding() + { + if (!array_key_exists('encoding', $this->_data)) { + return 'UTF-8'; + } + return $this->_data['encoding']; + } + + /** + * Get the feed's base url + * + * @return string|null + */ + public function getBaseUrl() + { + if (!array_key_exists('baseUrl', $this->_data)) { + return null; + } + return $this->_data['baseUrl']; + } + + /** + * Get the URLs used as Pubsubhubbub hubs endpoints + * + * @return string|null + */ + public function getHubs() + { + if (!array_key_exists('hubs', $this->_data)) { + return null; + } + return $this->_data['hubs']; + } + + /** + * Get the feed categories + * + * @return string|null + */ + public function getCategories() + { + if (!array_key_exists('categories', $this->_data)) { + return null; + } + return $this->_data['categories']; + } + + /** + * Resets the instance and deletes all data + * + * @return void + */ + public function reset() + { + $this->_data = array(); + } + + /** + * Set the current feed type being exported to "rss" or "atom". This allows + * other objects to gracefully choose whether to execute or not, depending + * on their appropriateness for the current type, e.g. renderers. + * + * @param string $type + */ + public function setType($type) + { + $this->_type = $type; + } + + /** + * Retrieve the current or last feed type exported. + * + * @return string Value will be "rss" or "atom" + */ + public function getType() + { + return $this->_type; + } + + /** + * Unset a specific data point + * + * @param string $name + */ + public function remove($name) + { + if (isset($this->_data[$name])) { + unset($this->_data[$name]); + } + } + + /** + * Method overloading: call given method on first extension implementing it + * + * @param string $method + * @param array $args + * @return mixed + * @throws Zend_Feed_Exception if no extensions implements the method + */ + public function __call($method, $args) + { + foreach ($this->_extensions as $extension) { + try { + return call_user_func_array(array($extension, $method), $args); + } catch (Zend_Feed_Writer_Exception_InvalidMethodException $e) { + } + } + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Method: ' . $method + . ' does not exist and could not be located on a registered Extension'); + } + + /** + * Load extensions from Zend_Feed_Writer + * + * @return void + */ + protected function _loadExtensions() + { + $all = Zend_Feed_Writer::getExtensions(); + $exts = $all['feed']; + foreach ($exts as $ext) { + $className = Zend_Feed_Writer::getPluginLoader()->getClassName($ext); + $this->_extensions[$ext] = new $className(); + $this->_extensions[$ext]->setEncoding($this->getEncoding()); + } + } +} diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom.php index b6bae222..a53c9f45 100644 --- a/src/Writer/Renderer/Entry/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -24,6 +24,8 @@ */ require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php'; +require_once 'Zend/Feed/Writer/Renderer/Feed/Atom/Source.php'; + /** * @category Zend * @package Zend_Feed_Writer @@ -57,6 +59,7 @@ public function render() $entry = $this->_dom->createElementNS(Zend_Feed_Writer::NAMESPACE_ATOM_10, 'entry'); $this->_dom->appendChild($entry); + $this->_setSource($this->_dom, $entry); $this->_setTitle($this->_dom, $entry); $this->_setDescription($this->_dom, $entry); $this->_setDateCreated($this->_dom, $entry); @@ -347,4 +350,23 @@ protected function _setCategories(DOMDocument $dom, DOMElement $root) $root->appendChild($category); } } + + /** + * Append Source element (Atom 1.0 Feed Metadata) + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setSource(DOMDocument $dom, DOMElement $root) + { + $source = $this->getDataContainer()->getSource(); + if (!$source) { + return; + } + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom_Source($source); + $element = $renderer->render()->getElement(); + $imported = $dom->importNode($element, true); + $root->appendChild($imported); + } } diff --git a/src/Writer/Renderer/Feed/Atom.php b/src/Writer/Renderer/Feed/Atom.php index 1112d0dd..f5b750ff 100644 --- a/src/Writer/Renderer/Feed/Atom.php +++ b/src/Writer/Renderer/Feed/Atom.php @@ -34,6 +34,8 @@ /** @see Zend_Feed_Writer_Renderer_RendererAbstract */ require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php'; +require_once 'Zend/Feed/Writer/Renderer/Feed/Atom/AtomAbstract.php'; + /** * @category Zend * @package Zend_Feed_Writer @@ -41,7 +43,7 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Writer_Renderer_Feed_Atom - extends Zend_Feed_Writer_Renderer_RendererAbstract + extends Zend_Feed_Writer_Renderer_Feed_Atom_AtomAbstract implements Zend_Feed_Writer_Renderer_RendererInterface { /** @@ -112,355 +114,4 @@ public function render() return $this; } - /** - * Set feed language - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setLanguage(DOMDocument $dom, DOMElement $root) - { - if ($this->getDataContainer()->getLanguage()) { - $root->setAttribute('xml:lang', $this->getDataContainer() - ->getLanguage()); - } - } - - /** - * Set feed title - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setTitle(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getTitle()) { - require_once 'Zend/Feed/Exception.php'; - $message = 'Atom 1.0 feed elements MUST contain exactly one' - . ' atom:title element but a title has not been set'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - - $title = $dom->createElement('title'); - $root->appendChild($title); - $title->setAttribute('type', 'text'); - $text = $dom->createTextNode($this->getDataContainer()->getTitle()); - $title->appendChild($text); - } - - /** - * Set feed description - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDescription(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getDescription()) { - return; - } - $subtitle = $dom->createElement('subtitle'); - $root->appendChild($subtitle); - $subtitle->setAttribute('type', 'text'); - $text = $dom->createTextNode($this->getDataContainer()->getDescription()); - $subtitle->appendChild($text); - } - - /** - * Set date feed was last modified - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateModified(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getDateModified()) { - require_once 'Zend/Feed/Exception.php'; - $message = 'Atom 1.0 feed elements MUST contain exactly one' - . ' atom:updated element but a modification date has not been set'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - - $updated = $dom->createElement('updated'); - $root->appendChild($updated); - $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(Zend_Date::ISO_8601) - ); - $updated->appendChild($text); - } - - /** - * Set feed generator string - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setGenerator(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getGenerator()) { - $this->getDataContainer()->setGenerator('Zend_Feed_Writer', - Zend_Version::VERSION, 'http://framework.zend.com'); - } - - $gdata = $this->getDataContainer()->getGenerator(); - $generator = $dom->createElement('generator'); - $root->appendChild($generator); - $text = $dom->createTextNode($gdata['name']); - $generator->appendChild($text); - if (array_key_exists('uri', $gdata)) { - $generator->setAttribute('uri', $gdata['uri']); - } - if (array_key_exists('version', $gdata)) { - $generator->setAttribute('version', $gdata['version']); - } - } - - /** - * Set link to feed - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setLink(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getLink()) { - return; - } - $link = $dom->createElement('link'); - $root->appendChild($link); - $link->setAttribute('rel', 'alternate'); - $link->setAttribute('type', 'text/html'); - $link->setAttribute('href', $this->getDataContainer()->getLink()); - } - - /** - * Set feed links - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) - { - $flinks = $this->getDataContainer()->getFeedLinks(); - if(!$flinks || !array_key_exists('atom', $flinks)) { - require_once 'Zend/Feed/Exception.php'; - $message = 'Atom 1.0 feed elements SHOULD contain one atom:link ' - . 'element with a rel attribute value of "self". This is the ' - . 'preferred URI for retrieving Atom Feed Documents representing ' - . 'this Atom feed but a feed link has not been set'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - - foreach ($flinks as $type => $href) { - $mime = 'application/' . strtolower($type) . '+xml'; - $flink = $dom->createElement('link'); - $root->appendChild($flink); - $flink->setAttribute('rel', 'self'); - $flink->setAttribute('type', $mime); - $flink->setAttribute('href', $href); - } - } - - /** - * Set feed authors - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setAuthors(DOMDocument $dom, DOMElement $root) - { - $authors = $this->_container->getAuthors(); - if (!$authors || empty($authors)) { - /** - * Technically we should defer an exception until we can check - * that all entries contain an author. If any entry is missing - * an author, then a missing feed author element is invalid - */ - return; - } - foreach ($authors as $data) { - $author = $this->_dom->createElement('author'); - $name = $this->_dom->createElement('name'); - $author->appendChild($name); - $root->appendChild($author); - $text = $dom->createTextNode($data['name']); - $name->appendChild($text); - if (array_key_exists('email', $data)) { - $email = $this->_dom->createElement('email'); - $author->appendChild($email); - $text = $dom->createTextNode($data['email']); - $email->appendChild($text); - } - if (array_key_exists('uri', $data)) { - $uri = $this->_dom->createElement('uri'); - $author->appendChild($uri); - $text = $dom->createTextNode($data['uri']); - $uri->appendChild($text); - } - } - } - - /** - * Set feed identifier - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setId(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getId() - && !$this->getDataContainer()->getLink()) { - require_once 'Zend/Feed/Exception.php'; - $message = 'Atom 1.0 feed elements MUST contain exactly one ' - . 'atom:id element, or as an alternative, we can use the same ' - . 'value as atom:link however neither a suitable link nor an ' - . 'id have been set'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - - if (!$this->getDataContainer()->getId()) { - $this->getDataContainer()->setId( - $this->getDataContainer()->getLink()); - } - $id = $dom->createElement('id'); - $root->appendChild($id); - $text = $dom->createTextNode($this->getDataContainer()->getId()); - $id->appendChild($text); - } - - /** - * Set feed copyright - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCopyright(DOMDocument $dom, DOMElement $root) - { - $copyright = $this->getDataContainer()->getCopyright(); - if (!$copyright) { - return; - } - $copy = $dom->createElement('rights'); - $root->appendChild($copy); - $text = $dom->createTextNode($copyright); - $copy->appendChild($text); - } - - /** - * Set date feed was created - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateCreated(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getDateCreated()) { - return; - } - if(!$this->getDataContainer()->getDateModified()) { - $this->getDataContainer()->setDateModified( - $this->getDataContainer()->getDateCreated() - ); - } - } - - /** - * Set base URL to feed links - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) - { - $baseUrl = $this->getDataContainer()->getBaseUrl(); - if (!$baseUrl) { - return; - } - $root->setAttribute('xml:base', $baseUrl); - } - - /** - * Set hubs to which this feed pushes - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setHubs(DOMDocument $dom, DOMElement $root) - { - $hubs = $this->getDataContainer()->getHubs(); - if (!$hubs) { - return; - } - foreach ($hubs as $hubUrl) { - $hub = $dom->createElement('link'); - $hub->setAttribute('rel', 'hub'); - $hub->setAttribute('href', $hubUrl); - $root->appendChild($hub); - } - } - - /** - * Set feed cateories - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCategories(DOMDocument $dom, DOMElement $root) - { - $categories = $this->getDataContainer()->getCategories(); - if (!$categories) { - return; - } - foreach ($categories as $cat) { - $category = $dom->createElement('category'); - $category->setAttribute('term', $cat['term']); - if (isset($cat['label'])) { - $category->setAttribute('label', $cat['label']); - } else { - $category->setAttribute('label', $cat['term']); - } - if (isset($cat['scheme'])) { - $category->setAttribute('scheme', $cat['scheme']); - } - $root->appendChild($category); - } - } } diff --git a/src/Writer/Renderer/Feed/Atom/AtomAbstract.php b/src/Writer/Renderer/Feed/Atom/AtomAbstract.php new file mode 100644 index 00000000..35be0464 --- /dev/null +++ b/src/Writer/Renderer/Feed/Atom/AtomAbstract.php @@ -0,0 +1,408 @@ +getDataContainer()->getLanguage()) { + $root->setAttribute('xml:lang', $this->getDataContainer() + ->getLanguage()); + } + } + + /** + * Set feed title + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setTitle(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getTitle()) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Atom 1.0 feed elements MUST contain exactly one' + . ' atom:title element but a title has not been set'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + + $title = $dom->createElement('title'); + $root->appendChild($title); + $title->setAttribute('type', 'text'); + $text = $dom->createTextNode($this->getDataContainer()->getTitle()); + $title->appendChild($text); + } + + /** + * Set feed description + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setDescription(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getDescription()) { + return; + } + $subtitle = $dom->createElement('subtitle'); + $root->appendChild($subtitle); + $subtitle->setAttribute('type', 'text'); + $text = $dom->createTextNode($this->getDataContainer()->getDescription()); + $subtitle->appendChild($text); + } + + /** + * Set date feed was last modified + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setDateModified(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getDateModified()) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Atom 1.0 feed elements MUST contain exactly one' + . ' atom:updated element but a modification date has not been set'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + + $updated = $dom->createElement('updated'); + $root->appendChild($updated); + $text = $dom->createTextNode( + $this->getDataContainer()->getDateModified()->get(Zend_Date::ISO_8601) + ); + $updated->appendChild($text); + } + + /** + * Set feed generator string + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setGenerator(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getGenerator()) { + $this->getDataContainer()->setGenerator('Zend_Feed_Writer', + Zend_Version::VERSION, 'http://framework.zend.com'); + } + + $gdata = $this->getDataContainer()->getGenerator(); + $generator = $dom->createElement('generator'); + $root->appendChild($generator); + $text = $dom->createTextNode($gdata['name']); + $generator->appendChild($text); + if (array_key_exists('uri', $gdata)) { + $generator->setAttribute('uri', $gdata['uri']); + } + if (array_key_exists('version', $gdata)) { + $generator->setAttribute('version', $gdata['version']); + } + } + + /** + * Set link to feed + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setLink(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getLink()) { + return; + } + $link = $dom->createElement('link'); + $root->appendChild($link); + $link->setAttribute('rel', 'alternate'); + $link->setAttribute('type', 'text/html'); + $link->setAttribute('href', $this->getDataContainer()->getLink()); + } + + /** + * Set feed links + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) + { + $flinks = $this->getDataContainer()->getFeedLinks(); + if(!$flinks || !array_key_exists('atom', $flinks)) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Atom 1.0 feed elements SHOULD contain one atom:link ' + . 'element with a rel attribute value of "self". This is the ' + . 'preferred URI for retrieving Atom Feed Documents representing ' + . 'this Atom feed but a feed link has not been set'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + + foreach ($flinks as $type => $href) { + $mime = 'application/' . strtolower($type) . '+xml'; + $flink = $dom->createElement('link'); + $root->appendChild($flink); + $flink->setAttribute('rel', 'self'); + $flink->setAttribute('type', $mime); + $flink->setAttribute('href', $href); + } + } + + /** + * Set feed authors + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setAuthors(DOMDocument $dom, DOMElement $root) + { + $authors = $this->_container->getAuthors(); + if (!$authors || empty($authors)) { + /** + * Technically we should defer an exception until we can check + * that all entries contain an author. If any entry is missing + * an author, then a missing feed author element is invalid + */ + return; + } + foreach ($authors as $data) { + $author = $this->_dom->createElement('author'); + $name = $this->_dom->createElement('name'); + $author->appendChild($name); + $root->appendChild($author); + $text = $dom->createTextNode($data['name']); + $name->appendChild($text); + if (array_key_exists('email', $data)) { + $email = $this->_dom->createElement('email'); + $author->appendChild($email); + $text = $dom->createTextNode($data['email']); + $email->appendChild($text); + } + if (array_key_exists('uri', $data)) { + $uri = $this->_dom->createElement('uri'); + $author->appendChild($uri); + $text = $dom->createTextNode($data['uri']); + $uri->appendChild($text); + } + } + } + + /** + * Set feed identifier + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setId(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getId() + && !$this->getDataContainer()->getLink()) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Atom 1.0 feed elements MUST contain exactly one ' + . 'atom:id element, or as an alternative, we can use the same ' + . 'value as atom:link however neither a suitable link nor an ' + . 'id have been set'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + + if (!$this->getDataContainer()->getId()) { + $this->getDataContainer()->setId( + $this->getDataContainer()->getLink()); + } + $id = $dom->createElement('id'); + $root->appendChild($id); + $text = $dom->createTextNode($this->getDataContainer()->getId()); + $id->appendChild($text); + } + + /** + * Set feed copyright + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setCopyright(DOMDocument $dom, DOMElement $root) + { + $copyright = $this->getDataContainer()->getCopyright(); + if (!$copyright) { + return; + } + $copy = $dom->createElement('rights'); + $root->appendChild($copy); + $text = $dom->createTextNode($copyright); + $copy->appendChild($text); + } + + /** + * Set date feed was created + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setDateCreated(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getDateCreated()) { + return; + } + if(!$this->getDataContainer()->getDateModified()) { + $this->getDataContainer()->setDateModified( + $this->getDataContainer()->getDateCreated() + ); + } + } + + /** + * Set base URL to feed links + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) + { + $baseUrl = $this->getDataContainer()->getBaseUrl(); + if (!$baseUrl) { + return; + } + $root->setAttribute('xml:base', $baseUrl); + } + + /** + * Set hubs to which this feed pushes + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setHubs(DOMDocument $dom, DOMElement $root) + { + $hubs = $this->getDataContainer()->getHubs(); + if (!$hubs) { + return; + } + foreach ($hubs as $hubUrl) { + $hub = $dom->createElement('link'); + $hub->setAttribute('rel', 'hub'); + $hub->setAttribute('href', $hubUrl); + $root->appendChild($hub); + } + } + + /** + * Set feed cateories + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setCategories(DOMDocument $dom, DOMElement $root) + { + $categories = $this->getDataContainer()->getCategories(); + if (!$categories) { + return; + } + foreach ($categories as $cat) { + $category = $dom->createElement('category'); + $category->setAttribute('term', $cat['term']); + if (isset($cat['label'])) { + $category->setAttribute('label', $cat['label']); + } else { + $category->setAttribute('label', $cat['term']); + } + if (isset($cat['scheme'])) { + $category->setAttribute('scheme', $cat['scheme']); + } + $root->appendChild($category); + } + } +} diff --git a/src/Writer/Renderer/Feed/Atom/Source.php b/src/Writer/Renderer/Feed/Atom/Source.php new file mode 100644 index 00000000..af27f70c --- /dev/null +++ b/src/Writer/Renderer/Feed/Atom/Source.php @@ -0,0 +1,84 @@ +_container->getEncoding()) { + $this->_container->setEncoding('UTF-8'); + } + $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom->formatOutput = true; + $root = $this->_dom->createElement('source'); + $this->setRootElement($root); + $this->_dom->appendChild($root); + $this->_setLanguage($this->_dom, $root); + $this->_setBaseUrl($this->_dom, $root); + $this->_setTitle($this->_dom, $root); + $this->_setDescription($this->_dom, $root); + $this->_setDateCreated($this->_dom, $root); + $this->_setDateModified($this->_dom, $root); + $this->_setGenerator($this->_dom, $root); + $this->_setLink($this->_dom, $root); + $this->_setFeedLinks($this->_dom, $root); + $this->_setId($this->_dom, $root); + $this->_setAuthors($this->_dom, $root); + $this->_setCopyright($this->_dom, $root); + $this->_setCategories($this->_dom, $root); + + foreach ($this->_extensions as $ext) { + $ext->setType($this->getType()); + $ext->setRootElement($this->getRootElement()); + $ext->setDomDocument($this->getDomDocument(), $root); + $ext->render(); + } + return $this; + } + +} diff --git a/src/Writer/Source.php b/src/Writer/Source.php new file mode 100644 index 00000000..37fcd483 --- /dev/null +++ b/src/Writer/Source.php @@ -0,0 +1,33 @@ + Date: Fri, 15 Jan 2010 23:54:39 +0000 Subject: [PATCH 104/238] Zend_Feed_Writer: Fixed two bugs. 1. Remove atom namespaced generator element in Atom source element unless explicitly set (was defaulting to ZF in error) 2. If no Atom content is set (but a summary/description is) skip rendering a content element (would be empty) git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20321 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Writer/Renderer/Entry/Atom.php | 4 ++++ src/Writer/Renderer/Feed/Atom/Source.php | 26 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom.php index a53c9f45..11ea43c4 100644 --- a/src/Writer/Renderer/Entry/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -316,6 +316,9 @@ protected function _setContent(DOMDocument $dom, DOMElement $root) return; } } + if (!$content) { + return; + } $element = $dom->createElement('content'); $element->setAttribute('type', 'html'); $cdata = $dom->createCDATASection($content); @@ -365,6 +368,7 @@ protected function _setSource(DOMDocument $dom, DOMElement $root) return; } $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom_Source($source); + $renderer->setType($this->getType()); $element = $renderer->render()->getElement(); $imported = $dom->importNode($element, true); $root->appendChild($imported); diff --git a/src/Writer/Renderer/Feed/Atom/Source.php b/src/Writer/Renderer/Feed/Atom/Source.php index af27f70c..2fda14a0 100644 --- a/src/Writer/Renderer/Feed/Atom/Source.php +++ b/src/Writer/Renderer/Feed/Atom/Source.php @@ -80,5 +80,31 @@ public function render() } return $this; } + + /** + * Set feed generator string + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setGenerator(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getGenerator()) { + return; + } + + $gdata = $this->getDataContainer()->getGenerator(); + $generator = $dom->createElement('generator'); + $root->appendChild($generator); + $text = $dom->createTextNode($gdata['name']); + $generator->appendChild($text); + if (array_key_exists('uri', $gdata)) { + $generator->setAttribute('uri', $gdata['uri']); + } + if (array_key_exists('version', $gdata)) { + $generator->setAttribute('version', $gdata['version']); + } + } } From ed9be7a4dc23e142fbac5dfe3ec2104c4582a6c2 Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 16 Jan 2010 00:02:36 +0000 Subject: [PATCH 105/238] Zend_Feed_Writer: Prevent rendering of Atom Threaded comment count attribute and element if a comment count was not set (was defaulting to 0 if not set - but this may present false data) git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20323 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Writer/Extension/Threading/Renderer/Entry.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php index 3fd0317b..71f0d9eb 100644 --- a/src/Writer/Extension/Threading/Renderer/Entry.php +++ b/src/Writer/Extension/Threading/Renderer/Entry.php @@ -78,10 +78,9 @@ protected function _setCommentLink(DOMDocument $dom, DOMElement $root) $clink->setAttribute('type', 'text/html'); $clink->setAttribute('href', $link); $count = $this->getDataContainer()->getCommentCount(); - if (!$count) { - $count = 0; + if (!is_null($count)) { + $clink->setAttribute('thr:count', $count); } - $clink->setAttribute('thr:count', $count); $root->appendChild($clink); } @@ -104,10 +103,9 @@ protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) $flink->setAttribute('type', 'application/'. $link['type'] .'+xml'); $flink->setAttribute('href', $link['uri']); $count = $this->getDataContainer()->getCommentCount(); - if (!$count) { - $count = 0; + if (!is_null($count)) { + $flink->setAttribute('thr:count', $count); } - $flink->setAttribute('thr:count', $count); $root->appendChild($flink); } } @@ -122,8 +120,8 @@ protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) protected function _setCommentCount(DOMDocument $dom, DOMElement $root) { $count = $this->getDataContainer()->getCommentCount(); - if (!$count) { - $count = 0; + if (is_null($count)) { + return; } $tcount = $this->_dom->createElement('thr:total'); $tcount->nodeValue = $count; From 0edaf5aec192044f7b72d2d0a1d9081f3107212c Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 16 Jan 2010 00:17:59 +0000 Subject: [PATCH 106/238] Zend_Feed_Writer: Changes namespace additions to output, so that only namespaces actually required are appended instead of all of them. Makes feeds look a bit neater though the old behaviour was harmless ;). git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20325 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Writer/Extension/Atom/Renderer/Feed.php | 16 +++++++++++- .../Extension/Content/Renderer/Entry.php | 15 ++++++++++- .../Extension/DublinCore/Renderer/Entry.php | 15 ++++++++++- .../Extension/DublinCore/Renderer/Feed.php | 15 ++++++++++- .../Extension/ITunes/Renderer/Entry.php | 20 ++++++++++++++- src/Writer/Extension/ITunes/Renderer/Feed.php | 25 ++++++++++++++++++- src/Writer/Extension/Slash/Renderer/Entry.php | 15 ++++++++++- .../Extension/Threading/Renderer/Entry.php | 17 ++++++++++++- .../WellFormedWeb/Renderer/Entry.php | 15 ++++++++++- 9 files changed, 144 insertions(+), 9 deletions(-) diff --git a/src/Writer/Extension/Atom/Renderer/Feed.php b/src/Writer/Extension/Atom/Renderer/Feed.php index f5ac1f31..0429a15c 100644 --- a/src/Writer/Extension/Atom/Renderer/Feed.php +++ b/src/Writer/Extension/Atom/Renderer/Feed.php @@ -33,6 +33,16 @@ class Zend_Feed_Writer_Extension_Atom_Renderer_Feed extends Zend_Feed_Writer_Extension_RendererAbstract { + + /** + * Set to TRUE if a rendering method actually renders something. This + * is used to prevent premature appending of a XML namespace declaration + * until an element which requires it is actually appended. + * + * @var bool + */ + protected $_called = false; + /** * Render feed * @@ -47,9 +57,11 @@ public function render() if (strtolower($this->getType()) == 'atom') { return; } - $this->_appendNamespaces(); $this->_setFeedLinks($this->_dom, $this->_base); $this->_setHubs($this->_dom, $this->_base); + if ($this->_called) { + $this->_appendNamespaces(); + } } /** @@ -84,6 +96,7 @@ protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) $flink->setAttribute('type', $mime); $flink->setAttribute('href', $href); } + $this->_called = true; } /** @@ -105,5 +118,6 @@ protected function _setHubs(DOMDocument $dom, DOMElement $root) $hub->setAttribute('href', $hubUrl); $root->appendChild($hub); } + $this->_called = true; } } diff --git a/src/Writer/Extension/Content/Renderer/Entry.php b/src/Writer/Extension/Content/Renderer/Entry.php index c3f505c7..e9699670 100644 --- a/src/Writer/Extension/Content/Renderer/Entry.php +++ b/src/Writer/Extension/Content/Renderer/Entry.php @@ -33,6 +33,16 @@ class Zend_Feed_Writer_Extension_Content_Renderer_Entry extends Zend_Feed_Writer_Extension_RendererAbstract { + + /** + * Set to TRUE if a rendering method actually renders something. This + * is used to prevent premature appending of a XML namespace declaration + * until an element which requires it is actually appended. + * + * @var bool + */ + protected $_called = false; + /** * Render entry * @@ -43,8 +53,10 @@ public function render() if (strtolower($this->getType()) == 'atom') { return; } - $this->_appendNamespaces(); $this->_setContent($this->_dom, $this->_base); + if ($this->_called) { + $this->_appendNamespaces(); + } } /** @@ -75,5 +87,6 @@ protected function _setContent(DOMDocument $dom, DOMElement $root) $root->appendChild($element); $cdata = $dom->createCDATASection($content); $element->appendChild($cdata); + $this->_called = true; } } diff --git a/src/Writer/Extension/DublinCore/Renderer/Entry.php b/src/Writer/Extension/DublinCore/Renderer/Entry.php index d26befe5..76a90a06 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Entry.php +++ b/src/Writer/Extension/DublinCore/Renderer/Entry.php @@ -33,6 +33,16 @@ class Zend_Feed_Writer_Extension_DublinCore_Renderer_Entry extends Zend_Feed_Writer_Extension_RendererAbstract { + + /** + * Set to TRUE if a rendering method actually renders something. This + * is used to prevent premature appending of a XML namespace declaration + * until an element which requires it is actually appended. + * + * @var bool + */ + protected $_called = false; + /** * Render entry * @@ -43,8 +53,10 @@ public function render() if (strtolower($this->getType()) == 'atom') { return; } - $this->_appendNamespaces(); $this->_setAuthors($this->_dom, $this->_base); + if ($this->_called) { + $this->_appendNamespaces(); + } } /** @@ -79,5 +91,6 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) $root->appendChild($author); } } + $this->_called = true; } } diff --git a/src/Writer/Extension/DublinCore/Renderer/Feed.php b/src/Writer/Extension/DublinCore/Renderer/Feed.php index e6d25684..a6b955ad 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Feed.php +++ b/src/Writer/Extension/DublinCore/Renderer/Feed.php @@ -33,6 +33,16 @@ class Zend_Feed_Writer_Extension_DublinCore_Renderer_Feed extends Zend_Feed_Writer_Extension_RendererAbstract { + + /** + * Set to TRUE if a rendering method actually renders something. This + * is used to prevent premature appending of a XML namespace declaration + * until an element which requires it is actually appended. + * + * @var bool + */ + protected $_called = false; + /** * Render feed * @@ -43,8 +53,10 @@ public function render() if (strtolower($this->getType()) == 'atom') { return; } - $this->_appendNamespaces(); $this->_setAuthors($this->_dom, $this->_base); + if ($this->_called) { + $this->_appendNamespaces(); + } } /** @@ -79,5 +91,6 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) $root->appendChild($author); } } + $this->_called = true; } } diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php index 7984579d..a300ff1b 100644 --- a/src/Writer/Extension/ITunes/Renderer/Entry.php +++ b/src/Writer/Extension/ITunes/Renderer/Entry.php @@ -33,6 +33,15 @@ class Zend_Feed_Writer_Extension_ITunes_Renderer_Entry extends Zend_Feed_Writer_Extension_RendererAbstract { + /** + * Set to TRUE if a rendering method actually renders something. This + * is used to prevent premature appending of a XML namespace declaration + * until an element which requires it is actually appended. + * + * @var bool + */ + protected $_called = false; + /** * Render entry * @@ -40,7 +49,6 @@ class Zend_Feed_Writer_Extension_ITunes_Renderer_Entry */ public function render() { - $this->_appendNamespaces(); $this->_setAuthors($this->_dom, $this->_base); $this->_setBlock($this->_dom, $this->_base); $this->_setDuration($this->_dom, $this->_base); @@ -48,6 +56,9 @@ public function render() $this->_setKeywords($this->_dom, $this->_base); $this->_setSubtitle($this->_dom, $this->_base); $this->_setSummary($this->_dom, $this->_base); + if ($this->_called) { + $this->_appendNamespaces(); + } } /** @@ -79,6 +90,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) $text = $dom->createTextNode($author); $el->appendChild($text); $root->appendChild($el); + $this->_called = true; } } @@ -99,6 +111,7 @@ protected function _setBlock(DOMDocument $dom, DOMElement $root) $text = $dom->createTextNode($block); $el->appendChild($text); $root->appendChild($el); + $this->_called = true; } /** @@ -118,6 +131,7 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root) $text = $dom->createTextNode($duration); $el->appendChild($text); $root->appendChild($el); + $this->_called = true; } /** @@ -137,6 +151,7 @@ protected function _setExplicit(DOMDocument $dom, DOMElement $root) $text = $dom->createTextNode($explicit); $el->appendChild($text); $root->appendChild($el); + $this->_called = true; } /** @@ -156,6 +171,7 @@ protected function _setKeywords(DOMDocument $dom, DOMElement $root) $text = $dom->createTextNode(implode(',', $keywords)); $el->appendChild($text); $root->appendChild($el); + $this->_called = true; } /** @@ -175,6 +191,7 @@ protected function _setSubtitle(DOMDocument $dom, DOMElement $root) $text = $dom->createTextNode($subtitle); $el->appendChild($text); $root->appendChild($el); + $this->_called = true; } /** @@ -194,5 +211,6 @@ protected function _setSummary(DOMDocument $dom, DOMElement $root) $text = $dom->createTextNode($summary); $el->appendChild($text); $root->appendChild($el); + $this->_called = true; } } diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php index 6ec70715..236d6af8 100644 --- a/src/Writer/Extension/ITunes/Renderer/Feed.php +++ b/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -33,6 +33,16 @@ class Zend_Feed_Writer_Extension_ITunes_Renderer_Feed extends Zend_Feed_Writer_Extension_RendererAbstract { + + /** + * Set to TRUE if a rendering method actually renders something. This + * is used to prevent premature appending of a XML namespace declaration + * until an element which requires it is actually appended. + * + * @var bool + */ + protected $_called = false; + /** * Render feed * @@ -40,7 +50,6 @@ class Zend_Feed_Writer_Extension_ITunes_Renderer_Feed */ public function render() { - $this->_appendNamespaces(); $this->_setAuthors($this->_dom, $this->_base); $this->_setBlock($this->_dom, $this->_base); $this->_setCategories($this->_dom, $this->_base); @@ -52,6 +61,9 @@ public function render() $this->_setOwners($this->_dom, $this->_base); $this->_setSubtitle($this->_dom, $this->_base); $this->_setSummary($this->_dom, $this->_base); + if ($this->_called) { + $this->_appendNamespaces(); + } } /** @@ -84,6 +96,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) $el->appendChild($text); $root->appendChild($el); } + $this->_called = true; } /** @@ -103,6 +116,7 @@ protected function _setBlock(DOMDocument $dom, DOMElement $root) $text = $dom->createTextNode($block); $el->appendChild($text); $root->appendChild($el); + $this->_called = true; } /** @@ -134,6 +148,7 @@ protected function _setCategories(DOMDocument $dom, DOMElement $root) } } } + $this->_called = true; } /** @@ -152,6 +167,7 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) $el = $dom->createElement('itunes:image'); $el->setAttribute('href', $image); $root->appendChild($el); + $this->_called = true; } /** @@ -171,6 +187,7 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root) $text = $dom->createTextNode($duration); $el->appendChild($text); $root->appendChild($el); + $this->_called = true; } /** @@ -190,6 +207,7 @@ protected function _setExplicit(DOMDocument $dom, DOMElement $root) $text = $dom->createTextNode($explicit); $el->appendChild($text); $root->appendChild($el); + $this->_called = true; } /** @@ -209,6 +227,7 @@ protected function _setKeywords(DOMDocument $dom, DOMElement $root) $text = $dom->createTextNode(implode(',', $keywords)); $el->appendChild($text); $root->appendChild($el); + $this->_called = true; } /** @@ -228,6 +247,7 @@ protected function _setNewFeedUrl(DOMDocument $dom, DOMElement $root) $text = $dom->createTextNode($url); $el->appendChild($text); $root->appendChild($el); + $this->_called = true; } /** @@ -255,6 +275,7 @@ protected function _setOwners(DOMDocument $dom, DOMElement $root) $el->appendChild($name); $el->appendChild($email); } + $this->_called = true; } /** @@ -274,6 +295,7 @@ protected function _setSubtitle(DOMDocument $dom, DOMElement $root) $text = $dom->createTextNode($subtitle); $el->appendChild($text); $root->appendChild($el); + $this->_called = true; } /** @@ -293,5 +315,6 @@ protected function _setSummary(DOMDocument $dom, DOMElement $root) $text = $dom->createTextNode($summary); $el->appendChild($text); $root->appendChild($el); + $this->_called = true; } } diff --git a/src/Writer/Extension/Slash/Renderer/Entry.php b/src/Writer/Extension/Slash/Renderer/Entry.php index b93c7e06..aa5cc23c 100644 --- a/src/Writer/Extension/Slash/Renderer/Entry.php +++ b/src/Writer/Extension/Slash/Renderer/Entry.php @@ -33,6 +33,16 @@ class Zend_Feed_Writer_Extension_Slash_Renderer_Entry extends Zend_Feed_Writer_Extension_RendererAbstract { + + /** + * Set to TRUE if a rendering method actually renders something. This + * is used to prevent premature appending of a XML namespace declaration + * until an element which requires it is actually appended. + * + * @var bool + */ + protected $_called = false; + /** * Render entry * @@ -43,8 +53,10 @@ public function render() if (strtolower($this->getType()) == 'atom') { return; // RSS 2.0 only } - $this->_appendNamespaces(); $this->_setCommentCount($this->_dom, $this->_base); + if ($this->_called) { + $this->_appendNamespaces(); + } } /** @@ -74,5 +86,6 @@ protected function _setCommentCount(DOMDocument $dom, DOMElement $root) $tcount = $this->_dom->createElement('slash:comments'); $tcount->nodeValue = $count; $root->appendChild($tcount); + $this->_called = true; } } diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php index 71f0d9eb..93a3666e 100644 --- a/src/Writer/Extension/Threading/Renderer/Entry.php +++ b/src/Writer/Extension/Threading/Renderer/Entry.php @@ -33,6 +33,16 @@ class Zend_Feed_Writer_Extension_Threading_Renderer_Entry extends Zend_Feed_Writer_Extension_RendererAbstract { + + /** + * Set to TRUE if a rendering method actually renders something. This + * is used to prevent premature appending of a XML namespace declaration + * until an element which requires it is actually appended. + * + * @var bool + */ + protected $_called = false; + /** * Render entry * @@ -43,10 +53,12 @@ public function render() if (strtolower($this->getType()) == 'rss') { return; // Atom 1.0 only } - $this->_appendNamespaces(); $this->_setCommentLink($this->_dom, $this->_base); $this->_setCommentFeedLinks($this->_dom, $this->_base); $this->_setCommentCount($this->_dom, $this->_base); + if ($this->_called) { + $this->_appendNamespaces(); + } } /** @@ -82,6 +94,7 @@ protected function _setCommentLink(DOMDocument $dom, DOMElement $root) $clink->setAttribute('thr:count', $count); } $root->appendChild($clink); + $this->_called = true; } /** @@ -107,6 +120,7 @@ protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) $flink->setAttribute('thr:count', $count); } $root->appendChild($flink); + $this->_called = true; } } @@ -126,5 +140,6 @@ protected function _setCommentCount(DOMDocument $dom, DOMElement $root) $tcount = $this->_dom->createElement('thr:total'); $tcount->nodeValue = $count; $root->appendChild($tcount); + $this->_called = true; } } diff --git a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php index 8aa37168..61ba013e 100644 --- a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php +++ b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php @@ -33,6 +33,16 @@ class Zend_Feed_Writer_Extension_WellFormedWeb_Renderer_Entry extends Zend_Feed_Writer_Extension_RendererAbstract { + + /** + * Set to TRUE if a rendering method actually renders something. This + * is used to prevent premature appending of a XML namespace declaration + * until an element which requires it is actually appended. + * + * @var bool + */ + protected $_called = false; + /** * Render entry * @@ -43,8 +53,10 @@ public function render() if (strtolower($this->getType()) == 'atom') { return; // RSS 2.0 only } - $this->_appendNamespaces(); $this->_setCommentFeedLinks($this->_dom, $this->_base); + if ($this->_called) { + $this->_appendNamespaces(); + } } /** @@ -79,5 +91,6 @@ protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) $root->appendChild($flink); } } + $this->_called = true; } } From 2377063faebbfa0c94dd8acec8e4a29445abedad Mon Sep 17 00:00:00 2001 From: padraic Date: Thu, 21 Jan 2010 15:23:52 +0000 Subject: [PATCH 107/238] Improved Atom Content parsing to support XHTML completely - fixes ZF-8789 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20462 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Extension/Atom/Entry.php | 48 ++++++++++++++++--- test/Reader/Entry/AtomStandaloneEntryTest.php | 44 +++++++++++++++-- test/Reader/Entry/AtomTest.php | 45 ++++++++++++++++- .../_files/Atom/content/plain/atom03.xml | 4 +- .../_files/Atom/content/plain/atom10.xml | 4 +- .../_files/Atom/content/plain/atom10_Html.xml | 6 +++ .../Atom/content/plain/atom10_HtmlCdata.xml | 6 +++ .../Atom/content/plain/atom10_Xhtml.xml | 10 ++++ .../AtomStandaloneEntry/content/atom10.xml | 2 +- .../content/atom10_Html.xml | 4 ++ .../content/atom10_HtmlCdata.xml | 4 ++ .../content/atom10_Xhtml.xml | 8 ++++ .../Integration/WordpressAtom10Test.php | 2 +- 13 files changed, 170 insertions(+), 17 deletions(-) create mode 100644 test/Reader/Entry/_files/Atom/content/plain/atom10_Html.xml create mode 100644 test/Reader/Entry/_files/Atom/content/plain/atom10_HtmlCdata.xml create mode 100644 test/Reader/Entry/_files/Atom/content/plain/atom10_Xhtml.xml create mode 100644 test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10_Html.xml create mode 100644 test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10_HtmlCdata.xml create mode 100644 test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10_Xhtml.xml diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index bf548bdd..949f5c29 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -127,21 +127,57 @@ public function getContent() if (array_key_exists('content', $this->_data)) { return $this->_data['content']; } - - $content = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:content)'); - - if ($content) { - $content = html_entity_decode($content, ENT_QUOTES, $this->getEncoding()); + + $content = null; + + $el = $this->getXpath()->query($this->getXpathPrefix() . '/atom:content'); + if($el->length > 0) { + $el = $el->item(0); + $type = $el->getAttribute('type'); + switch ($type) { + case '': + case 'text': + case 'text/plain': + case 'html': + case 'text/html': + $content = $el->nodeValue; + break; + case 'xhtml': + $this->getXpath()->registerNamespace('xhtml', 'http://www.w3.org/1999/xhtml'); + $xhtml = $this->getXpath()->query( + $this->getXpathPrefix() . '/atom:content/xhtml:div' + )->item(0); + $xhtml->setAttribute('xmlns', 'http://www.w3.org/1999/xhtml'); + $d = new DOMDocument('1.0', $this->getEncoding()); + $xhtmls = $d->importNode($xhtml, true); + $d->appendChild($xhtmls); + $content = $this->_collectXhtml($d->saveXML()); + break; + } } if (!$content) { $content = $this->getDescription(); } - $this->_data['content'] = $content; + $this->_data['content'] = trim($content); return $this->_data['content']; } + + /** + * Parse out XHTML to remove the namespacing + */ + protected function _collectXhtml($xhtml) + { + $matches = array( + "/<\?xml[^<]+/", + "/\s*$/" + ); + $cleaned = preg_replace($matches, '', $xhtml); + return $cleaned; + } /** * Get the entry creation date diff --git a/test/Reader/Entry/AtomStandaloneEntryTest.php b/test/Reader/Entry/AtomStandaloneEntryTest.php index 6314477e..d5a5a452 100644 --- a/test/Reader/Entry/AtomStandaloneEntryTest.php +++ b/test/Reader/Entry/AtomStandaloneEntryTest.php @@ -215,17 +215,53 @@ public function testGetsEnclosureFromAtom10() $this->assertEquals($expected, $entry->getEnclosure()); } - + /** - * Get Content (Unencoded Text) - * @group ZFR002 + * TEXT + * @group ZFRATOMCONTENT */ public function testGetsContentFromAtom10() { $entry = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/content/atom10.xml') ); - $this->assertEquals('Entry Content', $entry->getContent()); + $this->assertEquals('Entry Content &', $entry->getContent()); + } + + /** + * HTML Escaped + * @group ZFRATOMCONTENT + */ + public function testGetsContentFromAtom10Html() + { + $entry = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/content/atom10_Html.xml') + ); + $this->assertEquals('

Entry Content &

', $entry->getContent()); + } + + /** + * HTML CDATA Escaped + * @group ZFRATOMCONTENT + */ + public function testGetsContentFromAtom10HtmlCdata() + { + $entry = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/content/atom10_HtmlCdata.xml') + ); + $this->assertEquals('

Entry Content &

', $entry->getContent()); + } + + /** + * XHTML + * @group ZFRATOMCONTENT + */ + public function testGetsContentFromAtom10XhtmlNamespaced() + { + $entry = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/content/atom10_Xhtml.xml') + ); + $this->assertEquals('

Entry Content &x:

', $entry->getContent()); } /** diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index 7a3c0d18..4f7426ea 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -313,13 +313,56 @@ public function testGetsContentFromAtom03() $this->assertEquals('Entry Content', $entry->getContent()); } + /** + * TEXT + * @group ZFRATOMCONTENT + */ public function testGetsContentFromAtom10() { $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/content/plain/atom10.xml') ); $entry = $feed->current(); - $this->assertEquals('Entry Content', $entry->getContent()); + $this->assertEquals('Entry Content &', $entry->getContent()); + } + + /** + * HTML Escaped + * @group ZFRATOMCONTENT + */ + public function testGetsContentFromAtom10Html() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/content/plain/atom10_Html.xml') + ); + $entry = $feed->current(); + $this->assertEquals('

Entry Content &

', $entry->getContent()); + } + + /** + * HTML CDATA Escaped + * @group ZFRATOMCONTENT + */ + public function testGetsContentFromAtom10HtmlCdata() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/content/plain/atom10_HtmlCdata.xml') + ); + $entry = $feed->current(); + $this->assertEquals('

Entry Content &

', $entry->getContent()); + } + + /** + * XHTML + * @group ZFRATOMCONTENT + */ + public function testGetsContentFromAtom10XhtmlNamespaced() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath . '/content/plain/atom10_Xhtml.xml') + ); + $entry = $feed->current(); + $this->assertEquals('

Entry Content &x:

', $entry->getContent()); } /** diff --git a/test/Reader/Entry/_files/Atom/content/plain/atom03.xml b/test/Reader/Entry/_files/Atom/content/plain/atom03.xml index f6d509d7..1ab4d882 100644 --- a/test/Reader/Entry/_files/Atom/content/plain/atom03.xml +++ b/test/Reader/Entry/_files/Atom/content/plain/atom03.xml @@ -1,6 +1,6 @@ - Entry Content + Entry Content - \ No newline at end of file + diff --git a/test/Reader/Entry/_files/Atom/content/plain/atom10.xml b/test/Reader/Entry/_files/Atom/content/plain/atom10.xml index f30eb6a6..f258fd9b 100644 --- a/test/Reader/Entry/_files/Atom/content/plain/atom10.xml +++ b/test/Reader/Entry/_files/Atom/content/plain/atom10.xml @@ -1,6 +1,6 @@ - Entry Content + Entry Content &amp; - \ No newline at end of file + diff --git a/test/Reader/Entry/_files/Atom/content/plain/atom10_Html.xml b/test/Reader/Entry/_files/Atom/content/plain/atom10_Html.xml new file mode 100644 index 00000000..e4ead267 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/content/plain/atom10_Html.xml @@ -0,0 +1,6 @@ + + + + <p>Entry Content &amp;</p> + + diff --git a/test/Reader/Entry/_files/Atom/content/plain/atom10_HtmlCdata.xml b/test/Reader/Entry/_files/Atom/content/plain/atom10_HtmlCdata.xml new file mode 100644 index 00000000..e34a7606 --- /dev/null +++ b/test/Reader/Entry/_files/Atom/content/plain/atom10_HtmlCdata.xml @@ -0,0 +1,6 @@ + + + + Entry Content &

]]>
+
+
diff --git a/test/Reader/Entry/_files/Atom/content/plain/atom10_Xhtml.xml b/test/Reader/Entry/_files/Atom/content/plain/atom10_Xhtml.xml new file mode 100644 index 00000000..080a816f --- /dev/null +++ b/test/Reader/Entry/_files/Atom/content/plain/atom10_Xhtml.xml @@ -0,0 +1,10 @@ + + + + + + Entry Content &x: + + + + diff --git a/test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10.xml b/test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10.xml index 6bc2c678..38c00208 100644 --- a/test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10.xml +++ b/test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10.xml @@ -1,4 +1,4 @@ - Entry Content + Entry Content &amp; diff --git a/test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10_Html.xml b/test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10_Html.xml new file mode 100644 index 00000000..55517fc1 --- /dev/null +++ b/test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10_Html.xml @@ -0,0 +1,4 @@ + + + <p>Entry Content &amp;</p> + diff --git a/test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10_HtmlCdata.xml b/test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10_HtmlCdata.xml new file mode 100644 index 00000000..dab89709 --- /dev/null +++ b/test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10_HtmlCdata.xml @@ -0,0 +1,4 @@ + + + Entry Content &

]]>
+
diff --git a/test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10_Xhtml.xml b/test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10_Xhtml.xml new file mode 100644 index 00000000..263913a4 --- /dev/null +++ b/test/Reader/Entry/_files/AtomStandaloneEntry/content/atom10_Xhtml.xml @@ -0,0 +1,8 @@ + + + + + Entry Content &x: + + + diff --git a/test/Reader/Integration/WordpressAtom10Test.php b/test/Reader/Integration/WordpressAtom10Test.php index f0bcf6d6..6672c531 100644 --- a/test/Reader/Integration/WordpressAtom10Test.php +++ b/test/Reader/Integration/WordpressAtom10Test.php @@ -191,7 +191,7 @@ public function testGetsEntryContent() file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); - $this->assertEquals('

Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

'."\n\n".''."\n".'

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

'."\n", $entry->getContent()); + $this->assertEquals('

Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

', str_replace("\n",'',$entry->getContent())); } public function testGetsEntryLinks() From 3aa510c15549bb1c894726daa009646c0e509382 Mon Sep 17 00:00:00 2001 From: padraic Date: Thu, 21 Jan 2010 22:19:05 +0000 Subject: [PATCH 108/238] Zend_Feed: Patched Atom content handling when XHTML to better deal with XHTML namespacing git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20506 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Extension/Atom/Entry.php | 24 +++++++++++------ src/Writer/Renderer/Entry/Atom.php | 35 ++++++++++++++++++++++--- test/Writer/Renderer/Entry/AtomTest.php | 9 ++++--- 3 files changed, 54 insertions(+), 14 deletions(-) diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 949f5c29..7e4744a7 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -147,14 +147,19 @@ public function getContent() $xhtml = $this->getXpath()->query( $this->getXpathPrefix() . '/atom:content/xhtml:div' )->item(0); - $xhtml->setAttribute('xmlns', 'http://www.w3.org/1999/xhtml'); + //$xhtml->setAttribute('xmlns', 'http://www.w3.org/1999/xhtml'); $d = new DOMDocument('1.0', $this->getEncoding()); $xhtmls = $d->importNode($xhtml, true); $d->appendChild($xhtmls); - $content = $this->_collectXhtml($d->saveXML()); + $content = $this->_collectXhtml( + $d->saveXML(), + $d->lookupPrefix('http://www.w3.org/1999/xhtml') + ); break; } } + + //var_dump($content); exit; if (!$content) { $content = $this->getDescription(); @@ -168,15 +173,18 @@ public function getContent() /** * Parse out XHTML to remove the namespacing */ - protected function _collectXhtml($xhtml) + protected function _collectXhtml($xhtml, $prefix) { + if (!empty($prefix)) $prefix = $prefix . ':'; $matches = array( - "/<\?xml[^<]+/", - "/\s*$/" + "/<\?xml[^<]*>[^<]*<" . $prefix . "div[^<]*/", + "/<\/" . $prefix . "div>\s*$/" ); - $cleaned = preg_replace($matches, '', $xhtml); - return $cleaned; + $xhtml = preg_replace($matches, '', $xhtml); + if (!empty($prefix)) { + $xhtml = preg_replace("/(<[\/]?)" . $prefix . "([a-zA-Z]+)/", '$1$2', $xhtml); + } + return $xhtml; } /** diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom.php index 11ea43c4..2a4dbfa4 100644 --- a/src/Writer/Renderer/Entry/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -320,12 +320,41 @@ protected function _setContent(DOMDocument $dom, DOMElement $root) return; } $element = $dom->createElement('content'); - $element->setAttribute('type', 'html'); - $cdata = $dom->createCDATASection($content); - $element->appendChild($cdata); + $element->setAttribute('type', 'xhtml'); + $xhtmlElement = $this->_loadXhtml($content); + $xhtml = $dom->importNode($xhtmlElement, true); + $element->appendChild($xhtml); $root->appendChild($element); } + /** + * Load a HTML string and attempt to normalise to XML + */ + protected function _loadXhtml($content) + { + $xhtml = ''; + if (class_exists('tidy', false)) { + $tidy = new tidy; + $config = array( + 'output-xhtml' => true, + 'show-body-only' => true + ); + $encoding = str_replace('-', '', $this->getEncoding()); + $tidy->parseString($content, $config, $encoding); + $tidy->cleanRepair(); + $xhtml = (string) $tidy; + } else { + $xhtml = $content; + } + $xhtml = preg_replace(array( + "/(<[\/]?)([a-zA-Z]+)/" + ), '$1xhtml:$2', $xhtml); + $dom = new DOMDocument('1.0', $this->getEncoding()); + $dom->loadXML('' + . $xhtml . ''); + return $dom->documentElement; + } + /** * Set entry cateories * diff --git a/test/Writer/Renderer/Entry/AtomTest.php b/test/Writer/Renderer/Entry/AtomTest.php index cef9ce6e..44566221 100644 --- a/test/Writer/Renderer/Entry/AtomTest.php +++ b/test/Writer/Renderer/Entry/AtomTest.php @@ -60,7 +60,7 @@ public function setUp() $this->_validEntry->setDateCreated(1234567000); $this->_validEntry->setLink('http://www.example.com/1'); $this->_validEntry->addAuthor('Jane', 'jane@example.com', 'http://www.example.com/jane'); - $this->_validEntry->setContent('This is test entry content.'); + $this->_validEntry->setContent('

This is test content for xhtml:

'); $this->_validWriter->addEntry($this->_validEntry); } @@ -123,12 +123,15 @@ public function testEntrySummaryDescriptionHasBeenSet() $this->assertEquals('This is a test entry description.', $entry->getDescription()); } - public function testEntryContentHasBeenSet() + /** + * @group ZFWATOMCONTENT + */ + public function testEntryContentHasBeenSet_Xhtml() { $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); - $this->assertEquals('This is test entry content.', $entry->getContent()); + $this->assertEquals('

This is test content for xhtml:

', $entry->getContent()); } /** From 6791f965117cf9afcf263c4f034641911a139018 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 22 Jan 2010 14:00:30 +0000 Subject: [PATCH 109/238] Patch to enforce Atom Tombstones fully in Zend_Feed_Writer git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20518 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Writer/Deleted.php | 202 +++++++++++++++++++++ src/Writer/Entry.php | 4 + src/Writer/Feed.php | 33 ++++ src/Writer/Renderer/Entry/Atom/Deleted.php | 121 ++++++++++++ src/Writer/Renderer/Feed/Atom.php | 14 +- src/Writer/Renderer/Feed/Rss.php | 6 +- test/AllTests.php | 2 + test/Writer/DeletedTest.php | 163 +++++++++++++++++ test/Writer/EntryTest.php | 2 +- 9 files changed, 544 insertions(+), 3 deletions(-) create mode 100644 src/Writer/Deleted.php create mode 100644 src/Writer/Renderer/Entry/Atom/Deleted.php create mode 100644 test/Writer/DeletedTest.php diff --git a/src/Writer/Deleted.php b/src/Writer/Deleted.php new file mode 100644 index 00000000..4f17c9d7 --- /dev/null +++ b/src/Writer/Deleted.php @@ -0,0 +1,202 @@ +_data['encoding'] = $encoding; + } + + /** + * Get the feed character encoding + * + * @return string|null + */ + public function getEncoding() + { + if (!array_key_exists('encoding', $this->_data)) { + return 'UTF-8'; + } + return $this->_data['encoding']; + } + + /** + * Unset a specific data point + * + * @param string $name + */ + public function remove($name) + { + if (isset($this->_data[$name])) { + unset($this->_data[$name]); + } + } + + /** + * Set the current feed type being exported to "rss" or "atom". This allows + * other objects to gracefully choose whether to execute or not, depending + * on their appropriateness for the current type, e.g. renderers. + * + * @param string $type + */ + public function setType($type) + { + $this->_type = $type; + } + + /** + * Retrieve the current or last feed type exported. + * + * @return string Value will be "rss" or "atom" + */ + public function getType() + { + return $this->_type; + } + + public function setReference($reference) + { + if (empty($reference) || !is_string($reference)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: reference must be a non-empty string'); + } + $this->_data['reference'] = $reference; + } + + public function getReference() + { + if (!array_key_exists('reference', $this->_data)) { + return null; + } + return $this->_data['reference']; + } + + public function setWhen($date = null) + { + $zdate = null; + if (is_null($date)) { + $zdate = new Zend_Date; + } elseif (ctype_digit($date) && strlen($date) == 10) { + $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); + } elseif ($date instanceof Zend_Date) { + $zdate = $date; + } else { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + } + $this->_data['when'] = $zdate; + } + + public function getWhen() + { + if (!array_key_exists('when', $this->_data)) { + return null; + } + return $this->_data['when']; + } + + public function setBy(array $by) + { + $author = array(); + if (!array_key_exists('name', $by) + || empty($by['name']) + || !is_string($by['name']) + ) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); + } + $author['name'] = $by['name']; + if (isset($by['email'])) { + if (empty($by['email']) || !is_string($by['email'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); + } + $author['email'] = $by['email']; + } + if (isset($by['uri'])) { + if (empty($by['uri']) + || !is_string($by['uri']) + || !Zend_Uri::check($by['uri']) + ) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); + } + $author['uri'] = $by['uri']; + } + $this->_data['by'] = $author; + } + + public function getBy() + { + if (!array_key_exists('by', $this->_data)) { + return null; + } + return $this->_data['by']; + } + + public function setComment($comment) + { + $this->_data['comment'] = $comment; + } + + public function getComment() + { + if (!array_key_exists('comment', $this->_data)) { + return null; + } + return $this->_data['comment']; + } + +} diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index e61caf15..c838f1dc 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -109,6 +109,10 @@ public function addAuthor($name, $email = null, $uri = null) } $author['uri'] = $name['uri']; } + /** + * @deprecated + * Array notation (above) is preferred and will be the sole supported input from ZF 2.0 + */ } else { if (empty($name['name']) || !is_string($name['name'])) { require_once 'Zend/Feed/Exception.php'; diff --git a/src/Writer/Feed.php b/src/Writer/Feed.php index b3c90e4f..312828d8 100644 --- a/src/Writer/Feed.php +++ b/src/Writer/Feed.php @@ -39,6 +39,11 @@ */ require_once 'Zend/Feed/Writer/Entry.php'; +/** + * @see Zend_Feed_Writer_Deleted + */ +require_once 'Zend/Feed/Writer/Deleted.php'; + /** * @see Zend_Feed_Writer_Renderer_Feed_Atom */ @@ -92,6 +97,34 @@ public function createEntry() return $entry; } + /** + * Appends a Zend_Feed_Writer_Deleted object representing a new entry tombstone + * to the feed data container's internal group of entries. + * + * @param Zend_Feed_Writer_Deleted $entry + */ + public function addTombstone(Zend_Feed_Writer_Deleted $deleted) + { + $this->_entries[] = $deleted; + } + + /** + * Creates a new Zend_Feed_Writer_Deleted data container for use. This is NOT + * added to the current feed automatically, but is necessary to create a + * container with some initial values preset based on the current feed data. + * + * @return Zend_Feed_Writer_Deleted + */ + public function createTombstone() + { + $deleted = new Zend_Feed_Writer_Deleted; + if ($this->getEncoding()) { + $deleted->setEncoding($this->getEncoding()); + } + $deleted->setType($this->getType()); + return $deleted; + } + /** * Appends a Zend_Feed_Writer_Entry object representing a new entry/item * the feed data container's internal group of entries. diff --git a/src/Writer/Renderer/Entry/Atom/Deleted.php b/src/Writer/Renderer/Entry/Atom/Deleted.php new file mode 100644 index 00000000..f7baf60c --- /dev/null +++ b/src/Writer/Renderer/Entry/Atom/Deleted.php @@ -0,0 +1,121 @@ +_dom = new DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom->formatOutput = true; + $entry = $this->_dom->createElement('at:deleted-entry'); + $this->_dom->appendChild($entry); + + $entry->setAttribute('ref', $this->_container->getReference()); + $entry->setAttribute('when', $this->_container->getWhen()->get(Zend_Date::ISO_8601)); + + $this->_setBy($this->_dom, $entry); + $this->_setComment($this->_dom, $entry); + + return $this; + } + + /** + * Set tombstone comment + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setComment(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getComment()) { + return; + } + $c = $dom->createElement('at:comment'); + $root->appendChild($c); + $c->setAttribute('type', 'html'); + $cdata = $dom->createCDATASection($this->getDataContainer()->getComment()); + $c->appendChild($cdata); + } + + /** + * Set entry authors + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setBy(DOMDocument $dom, DOMElement $root) + { + $data = $this->_container->getBy(); + if ((!$data || empty($data))) { + return; + } + $author = $this->_dom->createElement('at:by'); + $name = $this->_dom->createElement('name'); + $author->appendChild($name); + $root->appendChild($author); + $text = $dom->createTextNode($data['name']); + $name->appendChild($text); + if (array_key_exists('email', $data)) { + $email = $this->_dom->createElement('email'); + $author->appendChild($email); + $text = $dom->createTextNode($data['email']); + $email->appendChild($text); + } + if (array_key_exists('uri', $data)) { + $uri = $this->_dom->createElement('uri'); + $author->appendChild($uri); + $text = $dom->createTextNode($data['uri']); + $uri->appendChild($text); + } + } + +} diff --git a/src/Writer/Renderer/Feed/Atom.php b/src/Writer/Renderer/Feed/Atom.php index f5b750ff..d743c63e 100644 --- a/src/Writer/Renderer/Feed/Atom.php +++ b/src/Writer/Renderer/Feed/Atom.php @@ -31,6 +31,9 @@ /** @see Zend_Feed_Writer_Renderer_Entry_Atom */ require_once 'Zend/Feed/Writer/Renderer/Entry/Atom.php'; +/** @see Zend_Feed_Writer_Renderer_Entry_Atom_Deleted */ +require_once 'Zend/Feed/Writer/Renderer/Entry/Atom/Deleted.php'; + /** @see Zend_Feed_Writer_Renderer_RendererAbstract */ require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php'; @@ -100,7 +103,16 @@ public function render() if ($this->getDataContainer()->getEncoding()) { $entry->setEncoding($this->getDataContainer()->getEncoding()); } - $renderer = new Zend_Feed_Writer_Renderer_Entry_Atom($entry); + if ($entry instanceof Zend_Feed_Writer_Entry) { + $renderer = new Zend_Feed_Writer_Renderer_Entry_Atom($entry); + } else { + if (!$this->_dom->documentElement->hasAttribute('xmlns:at')) { + $this->_dom->documentElement->setAttribute( + 'xmlns:at', 'http://purl.org/atompub/tombstones/1.0' + ); + } + $renderer = new Zend_Feed_Writer_Renderer_Entry_Atom_Deleted($entry); + } if ($this->_ignoreExceptions === true) { $renderer->ignoreExceptions(); } diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index ba4ede15..53026630 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -98,7 +98,11 @@ public function render() if ($this->getDataContainer()->getEncoding()) { $entry->setEncoding($this->getDataContainer()->getEncoding()); } - $renderer = new Zend_Feed_Writer_Renderer_Entry_Rss($entry); + if ($entry instanceof Zend_Feed_Writer_Entry) { + $renderer = new Zend_Feed_Writer_Renderer_Entry_Rss($entry); + } else { + continue; + } if ($this->_ignoreExceptions === true) { $renderer->ignoreExceptions(); } diff --git a/test/AllTests.php b/test/AllTests.php index 48bc9b2b..e45205e9 100644 --- a/test/AllTests.php +++ b/test/AllTests.php @@ -53,6 +53,7 @@ require_once 'Zend/Feed/Writer/FeedTest.php'; require_once 'Zend/Feed/Writer/EntryTest.php'; +require_once 'Zend/Feed/Writer/DeletedTest.php'; require_once 'Zend/Feed/Writer/Renderer/Feed/AtomTest.php'; require_once 'Zend/Feed/Writer/Renderer/Feed/RssTest.php'; require_once 'Zend/Feed/Writer/Renderer/Entry/AtomTest.php'; @@ -120,6 +121,7 @@ public static function suite() $suite->addTestSuite('Zend_Feed_Writer_FeedTest'); $suite->addTestSuite('Zend_Feed_Writer_EntryTest'); + $suite->addTestSuite('Zend_Feed_Writer_DeletedTest'); $suite->addTestSuite('Zend_Feed_Writer_Renderer_Feed_AtomTest'); $suite->addTestSuite('Zend_Feed_Writer_Renderer_Feed_RssTest'); $suite->addTestSuite('Zend_Feed_Writer_Renderer_Entry_AtomTest'); diff --git a/test/Writer/DeletedTest.php b/test/Writer/DeletedTest.php new file mode 100644 index 00000000..0cfca891 --- /dev/null +++ b/test/Writer/DeletedTest.php @@ -0,0 +1,163 @@ +setReference('http://www.example.com/id'); + $this->assertEquals('http://www.example.com/id', $entry->getReference()); + } + + public function testSetReferenceThrowsExceptionOnInvalidParameter() + { + $entry = new Zend_Feed_Writer_Deleted; + try { + $entry->setReference(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetReferenceReturnsNullIfNotSet() + { + $entry = new Zend_Feed_Writer_Deleted; + $this->assertTrue(is_null($entry->getReference())); + } + + public function testSetWhenDefaultsToCurrentTime() + { + $entry = new Zend_Feed_Writer_Deleted; + $entry->setWhen(); + $dateNow = new Zend_Date; + $this->assertTrue($dateNow->isLater($entry->getWhen()) || $dateNow->equals($entry->getWhen())); + } + + public function testSetWhenUsesGivenUnixTimestamp() + { + $entry = new Zend_Feed_Writer_Deleted; + $entry->setWhen(1234567890); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $this->assertTrue($myDate->equals($entry->getWhen())); + } + + public function testSetWhenUsesZendDateObject() + { + $entry = new Zend_Feed_Writer_Deleted; + $entry->setWhen(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $this->assertTrue($myDate->equals($entry->getWhen())); + } + + public function testSetWhenThrowsExceptionOnInvalidParameter() + { + $entry = new Zend_Feed_Writer_Deleted; + try { + $entry->setWhen('abc'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetWhenReturnsNullIfDateNotSet() + { + $entry = new Zend_Feed_Writer_Deleted; + $this->assertTrue(is_null($entry->getWhen())); + } + + public function testAddsByNameFromArray() + { + $entry = new Zend_Feed_Writer_Deleted; + $entry->setBy(array('name'=>'Joe')); + $this->assertEquals(array('name'=>'Joe'), $entry->getBy()); + } + + public function testAddsByEmailFromArray() + { + $entry = new Zend_Feed_Writer_Deleted; + $entry->setBy(array('name'=>'Joe','email'=>'joe@example.com')); + $this->assertEquals(array('name'=>'Joe', 'email' => 'joe@example.com'), $entry->getBy()); + } + + public function testAddsByUriFromArray() + { + $entry = new Zend_Feed_Writer_Deleted; + $entry->setBy(array('name'=>'Joe','uri'=>'http://www.example.com')); + $this->assertEquals(array('name'=>'Joe', 'uri' => 'http://www.example.com'), $entry->getBy()); + } + + public function testAddByThrowsExceptionOnInvalidNameFromArray() + { + $entry = new Zend_Feed_Writer_Deleted; + try { + $entry->setBy(array('name'=>'')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddByThrowsExceptionOnInvalidEmailFromArray() + { + $entry = new Zend_Feed_Writer_Deleted; + try { + $entry->setBy(array('name'=>'Joe','email'=>'')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddByThrowsExceptionOnInvalidUriFromArray() + { + $entry = new Zend_Feed_Writer_Deleted; + try { + $entry->setBy(array('name'=>'Joe','uri'=>'notauri')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testAddByThrowsExceptionIfNameOmittedFromArray() + { + $entry = new Zend_Feed_Writer_Deleted; + try { + $entry->setBy(array('uri'=>'notauri')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + +} diff --git a/test/Writer/EntryTest.php b/test/Writer/EntryTest.php index 7fec6a02..5899c083 100644 --- a/test/Writer/EntryTest.php +++ b/test/Writer/EntryTest.php @@ -426,7 +426,7 @@ public function testSetIdThrowsExceptionOnInvalidParameter() } } - public function testGetIdReturnsNullIfDateNotSet() + public function testGetIdReturnsNullIfNotSet() { $entry = new Zend_Feed_Writer_Entry; $this->assertTrue(is_null($entry->getId())); From 2d7089e49fb2ff6ec7bed097f6f1f1844287e7c9 Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 23 Jan 2010 14:09:55 +0000 Subject: [PATCH 110/238] Trim callback URL of forward slashes before appending subscription ID git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20546 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/Subscriber.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Pubsubhubbub/Subscriber.php b/src/Pubsubhubbub/Subscriber.php index 8796ff46..fe01b172 100644 --- a/src/Pubsubhubbub/Subscriber.php +++ b/src/Pubsubhubbub/Subscriber.php @@ -730,7 +730,7 @@ protected function _getRequestParameters($hubUrl, $mode) $params['hub.callback'] = $this->getCallbackUrl() . '?xhub.subscription=' . Zend_Feed_Pubsubhubbub::urlencode($key); } else { - $params['hub.callback'] = $this->getCallbackUrl() + $params['hub.callback'] = rtrim($this->getCallbackUrl(), '/') . '/' . Zend_Feed_Pubsubhubbub::urlencode($key); } if ($mode == 'subscribe' && !is_null($this->getLeaseSeconds())) { From 368d7c5883f2f1f2efdc97408723b8ac4e0cd703 Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 23 Jan 2010 15:17:12 +0000 Subject: [PATCH 111/238] Added lease_second handling to reset expiration time of subscription correctly git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20549 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/Subscriber/Callback.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Pubsubhubbub/Subscriber/Callback.php b/src/Pubsubhubbub/Subscriber/Callback.php index 12029291..182c857d 100644 --- a/src/Pubsubhubbub/Subscriber/Callback.php +++ b/src/Pubsubhubbub/Subscriber/Callback.php @@ -117,6 +117,9 @@ public function handle(array $httpGetData = null, $sendResponseNow = false) $data = $this->_currentSubscriptionData; $this->getHttpResponse()->setBody($httpGetData['hub_challenge']); $data['subscription_state'] = Zend_Feed_Pubsubhubbub::SUBSCRIPTION_VERIFIED; + if (isset($httpGetData['hub_lease_seconds'])) { + $data['lease_seconds'] = $httpGetData['hub_lease_seconds']; + } $this->getStorage()->setSubscription($data); /** * Hey, C'mon! We tried everything else! From 994d14bb17d1501f4145237850e59b012a14d7b8 Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 23 Jan 2010 15:51:10 +0000 Subject: [PATCH 112/238] Updated dataset to exclude a last_modifed field (irrelevant since creation_date and lease_seconds). This also resolves a possible Doctrine conflict using the suggested schema. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20552 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/Model/Subscription.php | 5 +++-- src/Pubsubhubbub/Subscriber.php | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Pubsubhubbub/Model/Subscription.php b/src/Pubsubhubbub/Model/Subscription.php index cf0322f6..0b3ab2ab 100644 --- a/src/Pubsubhubbub/Model/Subscription.php +++ b/src/Pubsubhubbub/Model/Subscription.php @@ -55,9 +55,10 @@ public function setSubscription(array $data) if ($result) { $data['created_time'] = $result->current()->created_time; $now = new Zend_Date; - $data['last_modified'] = $now->get('yyyy-MM-dd HH:mm:ss'); - $data['expiration_time'] = $now->add($result->current()->lease_seconds, Zend_Date::SECOND) + if ($data['lease_seconds']) { + $data['expiration_time'] = $now->add($data['lease_seconds'], Zend_Date::SECOND) ->get('yyyy-MM-dd HH:mm:ss'); + } $this->_db->update( $data, $this->_db->getAdapter()->quoteInto('id = ?', $data['id']) diff --git a/src/Pubsubhubbub/Subscriber.php b/src/Pubsubhubbub/Subscriber.php index fe01b172..4a19583a 100644 --- a/src/Pubsubhubbub/Subscriber.php +++ b/src/Pubsubhubbub/Subscriber.php @@ -755,7 +755,6 @@ protected function _getRequestParameters($hubUrl, $mode) 'topic_url' => $params['hub.topic'], 'hub_url' => $hubUrl, 'created_time' => $now->get('yyyy-MM-dd HH:mm:ss'), - 'last_modified' => $now->get('yyyy-MM-dd HH:mm:ss'), 'lease_seconds' => $expires, 'verify_token' => hash('sha256', $params['hub.verify_token']), 'secret' => null, From 1a23b164e5dd0fa12c8e2a754979f48d070cb6eb Mon Sep 17 00:00:00 2001 From: padraic Date: Thu, 28 Jan 2010 19:21:33 +0000 Subject: [PATCH 113/238] Fixed failing unit tests on Zend_Feed_Pubsubhubbub (underlying functionality not broken - just two unsynced tests) git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20723 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Pubsubhubbub/Subscriber/CallbackTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php index e378df8a..da864fdb 100644 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -262,7 +262,7 @@ public function testRespondsToValidConfirmationWith200Response() $this->_tableGateway->expects($this->once()) ->method('update') ->with( - $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Zend_Date::TIMESTAMP),'lease_seconds'=>10000,'subscription_state'=>'verified','last_modified'=>$t->get('yyyy-MM-dd HH:mm:ss'),'expiration_time'=>$t->add(10000,Zend_Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), + $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Zend_Date::TIMESTAMP),'lease_seconds'=>1234567,'subscription_state'=>'verified','expiration_time'=>$t->add(1234567,Zend_Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), $this->equalTo('id = \'verifytokenkey\'') ); $this->_adapter->expects($this->once()) @@ -293,7 +293,7 @@ public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() $this->_tableGateway->expects($this->once()) ->method('update') ->with( - $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Zend_Date::TIMESTAMP),'lease_seconds'=>10000,'subscription_state'=>'verified','last_modified'=>$t->get('yyyy-MM-dd HH:mm:ss'),'expiration_time'=>$t->add(10000,Zend_Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), + $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Zend_Date::TIMESTAMP),'lease_seconds'=>1234567,'subscription_state'=>'verified','expiration_time'=>$t->add(1234567,Zend_Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), $this->equalTo('id = \'verifytokenkey\'') ); $this->_adapter->expects($this->once()) From 0ea05680e6a848c9ca7990f094e4d483c7a31824 Mon Sep 17 00:00:00 2001 From: mikaelkael Date: Sun, 31 Jan 2010 09:43:03 +0000 Subject: [PATCH 114/238] [ZF-9029] Add svn keyword Id git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20785 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub.php | 1 + src/Pubsubhubbub/CallbackAbstract.php | 1 + src/Pubsubhubbub/CallbackInterface.php | 1 + src/Pubsubhubbub/Exception.php | 1 + src/Pubsubhubbub/HttpResponse.php | 1 + src/Pubsubhubbub/Model/ModelAbstract.php | 1 + src/Pubsubhubbub/Model/Subscription.php | 1 + src/Pubsubhubbub/Model/SubscriptionInterface.php | 1 + src/Pubsubhubbub/Publisher.php | 1 + src/Pubsubhubbub/Subscriber.php | 1 + src/Pubsubhubbub/Subscriber/Callback.php | 1 + src/Reader/Feed/Atom/Source.php | 2 +- src/Writer/Deleted.php | 2 +- src/Writer/Extension/RendererAbstract.php | 1 + src/Writer/Extension/RendererInterface.php | 1 + src/Writer/Feed/FeedAbstract.php | 2 +- src/Writer/Renderer/Entry/Atom/Deleted.php | 2 +- src/Writer/Renderer/Feed/Atom/AtomAbstract.php | 2 +- src/Writer/Renderer/Feed/Atom/Source.php | 2 +- src/Writer/Source.php | 2 +- 20 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/Pubsubhubbub.php b/src/Pubsubhubbub.php index 05f60b91..108cd818 100644 --- a/src/Pubsubhubbub.php +++ b/src/Pubsubhubbub.php @@ -16,6 +16,7 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ */ /** diff --git a/src/Pubsubhubbub/CallbackAbstract.php b/src/Pubsubhubbub/CallbackAbstract.php index 48fc56d4..850a7322 100644 --- a/src/Pubsubhubbub/CallbackAbstract.php +++ b/src/Pubsubhubbub/CallbackAbstract.php @@ -17,6 +17,7 @@ * @subpackage Callback * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ */ /** diff --git a/src/Pubsubhubbub/CallbackInterface.php b/src/Pubsubhubbub/CallbackInterface.php index ce30a6bb..d47a34dd 100644 --- a/src/Pubsubhubbub/CallbackInterface.php +++ b/src/Pubsubhubbub/CallbackInterface.php @@ -17,6 +17,7 @@ * @subpackage Callback * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ */ /** diff --git a/src/Pubsubhubbub/Exception.php b/src/Pubsubhubbub/Exception.php index cac6d238..881e4463 100644 --- a/src/Pubsubhubbub/Exception.php +++ b/src/Pubsubhubbub/Exception.php @@ -16,6 +16,7 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ */ /** diff --git a/src/Pubsubhubbub/HttpResponse.php b/src/Pubsubhubbub/HttpResponse.php index 5a14eb60..e3c22874 100644 --- a/src/Pubsubhubbub/HttpResponse.php +++ b/src/Pubsubhubbub/HttpResponse.php @@ -16,6 +16,7 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ */ /** diff --git a/src/Pubsubhubbub/Model/ModelAbstract.php b/src/Pubsubhubbub/Model/ModelAbstract.php index 83964464..0e552db8 100644 --- a/src/Pubsubhubbub/Model/ModelAbstract.php +++ b/src/Pubsubhubbub/Model/ModelAbstract.php @@ -16,6 +16,7 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ */ diff --git a/src/Pubsubhubbub/Model/Subscription.php b/src/Pubsubhubbub/Model/Subscription.php index 0b3ab2ab..0ba23e01 100644 --- a/src/Pubsubhubbub/Model/Subscription.php +++ b/src/Pubsubhubbub/Model/Subscription.php @@ -17,6 +17,7 @@ * @subpackage Entity * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ */ /** @see Zend_Feed_Pubsubhubbub_Model_ModelAbstract */ diff --git a/src/Pubsubhubbub/Model/SubscriptionInterface.php b/src/Pubsubhubbub/Model/SubscriptionInterface.php index f8a6e6a3..8933a85b 100644 --- a/src/Pubsubhubbub/Model/SubscriptionInterface.php +++ b/src/Pubsubhubbub/Model/SubscriptionInterface.php @@ -17,6 +17,7 @@ * @subpackage Entity * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ */ /** diff --git a/src/Pubsubhubbub/Publisher.php b/src/Pubsubhubbub/Publisher.php index 1eb594f0..b9524e07 100644 --- a/src/Pubsubhubbub/Publisher.php +++ b/src/Pubsubhubbub/Publisher.php @@ -16,6 +16,7 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ */ /** diff --git a/src/Pubsubhubbub/Subscriber.php b/src/Pubsubhubbub/Subscriber.php index 4a19583a..43ae18c8 100644 --- a/src/Pubsubhubbub/Subscriber.php +++ b/src/Pubsubhubbub/Subscriber.php @@ -16,6 +16,7 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ */ /** diff --git a/src/Pubsubhubbub/Subscriber/Callback.php b/src/Pubsubhubbub/Subscriber/Callback.php index 182c857d..763b2513 100644 --- a/src/Pubsubhubbub/Subscriber/Callback.php +++ b/src/Pubsubhubbub/Subscriber/Callback.php @@ -16,6 +16,7 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ */ /** diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php index 8d5fe0c9..73cfc386 100644 --- a/src/Reader/Feed/Atom/Source.php +++ b/src/Reader/Feed/Atom/Source.php @@ -16,7 +16,7 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Atom.php 19165 2009-11-21 16:46:40Z padraic $ + * @version $Id$ */ /** diff --git a/src/Writer/Deleted.php b/src/Writer/Deleted.php index 4f17c9d7..ce5b00f8 100644 --- a/src/Writer/Deleted.php +++ b/src/Writer/Deleted.php @@ -16,7 +16,7 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id$ */ require_once 'Zend/Feed/Writer/Feed/FeedAbstract.php'; diff --git a/src/Writer/Extension/RendererAbstract.php b/src/Writer/Extension/RendererAbstract.php index 9a0f93df..f1ec2c02 100644 --- a/src/Writer/Extension/RendererAbstract.php +++ b/src/Writer/Extension/RendererAbstract.php @@ -16,6 +16,7 @@ * @package Zend_Feed_Writer_Entry_Rss * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ */ /** diff --git a/src/Writer/Extension/RendererInterface.php b/src/Writer/Extension/RendererInterface.php index e9c90141..110d25ab 100644 --- a/src/Writer/Extension/RendererInterface.php +++ b/src/Writer/Extension/RendererInterface.php @@ -16,6 +16,7 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ */ /** diff --git a/src/Writer/Feed/FeedAbstract.php b/src/Writer/Feed/FeedAbstract.php index 24fbe730..74eae94b 100644 --- a/src/Writer/Feed/FeedAbstract.php +++ b/src/Writer/Feed/FeedAbstract.php @@ -16,7 +16,7 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id$ */ /** diff --git a/src/Writer/Renderer/Entry/Atom/Deleted.php b/src/Writer/Renderer/Entry/Atom/Deleted.php index f7baf60c..8902625f 100644 --- a/src/Writer/Renderer/Entry/Atom/Deleted.php +++ b/src/Writer/Renderer/Entry/Atom/Deleted.php @@ -16,7 +16,7 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Atom.php 20506 2010-01-21 22:19:05Z padraic $ + * @version $Id$ */ /** diff --git a/src/Writer/Renderer/Feed/Atom/AtomAbstract.php b/src/Writer/Renderer/Feed/Atom/AtomAbstract.php index 35be0464..dbd04bf3 100644 --- a/src/Writer/Renderer/Feed/Atom/AtomAbstract.php +++ b/src/Writer/Renderer/Feed/Atom/AtomAbstract.php @@ -16,7 +16,7 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Atom.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id$ */ /** @see Zend_Feed_Writer_Feed */ diff --git a/src/Writer/Renderer/Feed/Atom/Source.php b/src/Writer/Renderer/Feed/Atom/Source.php index 2fda14a0..9d078f2b 100644 --- a/src/Writer/Renderer/Feed/Atom/Source.php +++ b/src/Writer/Renderer/Feed/Atom/Source.php @@ -16,7 +16,7 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Atom.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id$ */ require_once 'Zend/Feed/Writer/Renderer/Feed/Atom/AtomAbstract.php'; diff --git a/src/Writer/Source.php b/src/Writer/Source.php index 37fcd483..119dc0fa 100644 --- a/src/Writer/Source.php +++ b/src/Writer/Source.php @@ -16,7 +16,7 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id$ */ require_once 'Zend/Feed/Writer/Feed/FeedAbstract.php'; From ba8a8d11655325210d7e54db0ecb37515b83e299 Mon Sep 17 00:00:00 2001 From: padraic Date: Sat, 6 Feb 2010 17:55:34 +0000 Subject: [PATCH 115/238] Zend_Feed_Reader: If a category has a term but no label, the Collection result's getValues() method will return the term as an alternative for any category missing labels. Implements ZF-8411 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20953 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Collection/Category.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Reader/Collection/Category.php b/src/Reader/Collection/Category.php index f1c92679..9cd02569 100644 --- a/src/Reader/Collection/Category.php +++ b/src/Reader/Collection/Category.php @@ -45,7 +45,11 @@ class Zend_Feed_Reader_Collection_Category public function getValues() { $categories = array(); foreach ($this->getIterator() as $element) { - $categories[] = $element['label']; + if (isset($element['label']) && !empty($element['label'])) { + $categories[] = $element['label']; + } else { + $categories[] = $element['term']; + } } return array_unique($categories); } From c9507e37890b0160798664a07829072a402be1d3 Mon Sep 17 00:00:00 2001 From: padraic Date: Tue, 16 Feb 2010 14:20:35 +0000 Subject: [PATCH 116/238] Removed commented out line from Zend_Cache_Manager Fixed a parameter missing bug in Zend_Feed_Pubsubhubbub (0.3 Compatibility) git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@21066 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/Subscriber.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Pubsubhubbub/Subscriber.php b/src/Pubsubhubbub/Subscriber.php index 43ae18c8..419bf888 100644 --- a/src/Pubsubhubbub/Subscriber.php +++ b/src/Pubsubhubbub/Subscriber.php @@ -722,7 +722,7 @@ protected function _getRequestParameters($hubUrl, $mode) * Establish a persistent verify_token and attach key to callback * URL's path/querystring */ - $key = $this->_generateSubscriptionKey($params); + $key = $this->_generateSubscriptionKey($params, $hubUrl); $token = $this->_generateVerifyToken(); $params['hub.verify_token'] = $token; @@ -792,9 +792,9 @@ protected function _generateVerifyToken() * @param string $hubUrl The Hub Server URL for which this token will apply * @return string */ - protected function _generateSubscriptionKey(array $params) + protected function _generateSubscriptionKey(array $params, $hubUrl) { - $keyBase = $params['hub.topic'] . $params['hub.callback']; + $keyBase = $params['hub.topic'] . $hubUrl; $key = md5($keyBase); return $key; } From 78e0de9585a17fade055a93d0bbdfdd951ed0474 Mon Sep 17 00:00:00 2001 From: padraic Date: Tue, 16 Feb 2010 14:24:17 +0000 Subject: [PATCH 117/238] Updated params git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@21068 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/Subscriber.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Pubsubhubbub/Subscriber.php b/src/Pubsubhubbub/Subscriber.php index 419bf888..2e8846d8 100644 --- a/src/Pubsubhubbub/Subscriber.php +++ b/src/Pubsubhubbub/Subscriber.php @@ -640,7 +640,6 @@ protected function _doRequest($mode) $client->setUri($url); $client->setRawData($this->_getRequestParameters($url, $mode)); $response = $client->request(); - echo $client->getLastRequest(); if ($response->getStatus() !== 204 && $response->getStatus() !== 202 ) { From 7c063e6870bae323ec19db3868fbbd9c8ca78599 Mon Sep 17 00:00:00 2001 From: padraic Date: Sun, 28 Feb 2010 13:51:41 +0000 Subject: [PATCH 118/238] Loosened checks on Pubsubhubbub response Content-Type to include text/xml and application/xml git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@21234 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/Subscriber/Callback.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Pubsubhubbub/Subscriber/Callback.php b/src/Pubsubhubbub/Subscriber/Callback.php index 763b2513..9e9b2636 100644 --- a/src/Pubsubhubbub/Subscriber/Callback.php +++ b/src/Pubsubhubbub/Subscriber/Callback.php @@ -106,6 +106,8 @@ public function handle(array $httpGetData = null, $sendResponseNow = false) && $this->_hasValidVerifyToken(null, false) && ($this->_getHeader('Content-Type') == 'application/atom+xml' || $this->_getHeader('Content-Type') == 'application/rss+xml' + || $this->_getHeader('Content-Type') == 'application/xml' + || $this->_getHeader('Content-Type') == 'text/xml' || $this->_getHeader('Content-Type') == 'application/rdf+xml') ) { $this->setFeedUpdate($this->_getRawBody()); From 966590dcf0c7c2fc19961a7c23a2f2f01d6921e3 Mon Sep 17 00:00:00 2001 From: matthew Date: Wed, 3 Mar 2010 20:46:05 +0000 Subject: [PATCH 119/238] [2.0] Stripped require_once calls (skipping Zend_Gdata, Zend_Pdf, Zend_Search, and Zend_Service components) git-svn-id: http://framework.zend.com/svn/framework/standard/branches/development-2.0@21309 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Abstract.php | 20 ++--- src/Atom.php | 25 +------ src/Builder.php | 41 +---------- src/Builder/Entry.php | 12 +-- src/Builder/Exception.php | 9 +-- src/Builder/Header.php | 63 ++-------------- src/Builder/Header/Itunes.php | 35 +-------- src/Builder/Interface.php | 2 - src/Element.php | 11 ++- src/Entry/Abstract.php | 25 +------ src/Entry/Atom.php | 43 +---------- src/Entry/Rss.php | 9 +-- src/Exception.php | 9 +-- src/Pubsubhubbub.php | 31 ++------ src/Pubsubhubbub/CallbackAbstract.php | 17 +---- src/Pubsubhubbub/Exception.php | 6 +- src/Pubsubhubbub/HttpResponse.php | 9 +-- src/Pubsubhubbub/Model/ModelAbstract.php | 12 +-- src/Pubsubhubbub/Model/Subscription.php | 13 +--- src/Pubsubhubbub/Publisher.php | 20 ++--- src/Pubsubhubbub/Subscriber.php | 31 ++------ src/Pubsubhubbub/Subscriber/Callback.php | 19 +---- src/Reader.php | 51 ++----------- src/Reader/Collection.php | 1 + src/Reader/Collection/Author.php | 8 +- src/Reader/Collection/Category.php | 8 +- src/Reader/Collection/CollectionAbstract.php | 1 + src/Reader/Entry/Atom.php | 28 ++----- src/Reader/Entry/Rss.php | 73 ++++--------------- src/Reader/EntryAbstract.php | 3 +- src/Reader/Extension/Atom/Entry.php | 39 +++------- src/Reader/Extension/Atom/Feed.php | 26 ++----- src/Reader/Extension/Content/Entry.php | 12 +-- .../Extension/CreativeCommons/Entry.php | 12 +-- src/Reader/Extension/CreativeCommons/Feed.php | 6 +- src/Reader/Extension/DublinCore/Entry.php | 20 ++--- src/Reader/Extension/DublinCore/Feed.php | 20 ++--- src/Reader/Extension/EntryAbstract.php | 1 + src/Reader/Extension/FeedAbstract.php | 20 +---- src/Reader/Extension/Podcast/Entry.php | 14 +--- src/Reader/Extension/Podcast/Feed.php | 8 +- src/Reader/Extension/Slash/Entry.php | 12 +-- src/Reader/Extension/Syndication/Feed.php | 9 +-- src/Reader/Extension/Thread/Entry.php | 6 +- src/Reader/Extension/WellFormedWeb/Entry.php | 12 +-- src/Reader/Feed/Atom.php | 13 +--- src/Reader/Feed/Atom/Source.php | 7 +- src/Reader/Feed/Rss.php | 33 ++------- src/Reader/FeedAbstract.php | 14 +--- src/Reader/FeedInterface.php | 2 + src/Reader/FeedSet.php | 12 +-- src/Rss.php | 25 +------ src/Writer.php | 4 +- src/Writer/Deleted.php | 13 +--- src/Writer/Entry.php | 44 ++--------- .../Exception/InvalidMethodException.php | 8 +- src/Writer/Extension/Atom/Renderer/Feed.php | 6 +- .../Extension/Content/Renderer/Entry.php | 6 +- .../Extension/DublinCore/Renderer/Entry.php | 6 +- .../Extension/DublinCore/Renderer/Feed.php | 6 +- src/Writer/Extension/ITunes/Entry.php | 13 +--- src/Writer/Extension/ITunes/Feed.php | 48 +++++------- .../Extension/ITunes/Renderer/Entry.php | 6 +- src/Writer/Extension/ITunes/Renderer/Feed.php | 6 +- src/Writer/Extension/RendererAbstract.php | 6 +- src/Writer/Extension/Slash/Renderer/Entry.php | 6 +- .../Extension/Threading/Renderer/Entry.php | 6 +- .../WellFormedWeb/Renderer/Entry.php | 6 +- src/Writer/Feed.php | 56 ++++---------- src/Writer/Feed/FeedAbstract.php | 62 ++-------------- src/Writer/Renderer/Entry/Atom.php | 37 +++++----- src/Writer/Renderer/Entry/Atom/Deleted.php | 9 +-- src/Writer/Renderer/Entry/Rss.php | 22 +++--- src/Writer/Renderer/Feed/Atom.php | 29 +++----- .../Renderer/Feed/Atom/AtomAbstract.php | 42 ++++------- src/Writer/Renderer/Feed/Atom/Source.php | 5 +- src/Writer/Renderer/Feed/Rss.php | 33 +++------ src/Writer/Renderer/RendererAbstract.php | 10 +-- src/Writer/Source.php | 5 +- 79 files changed, 320 insertions(+), 1138 deletions(-) diff --git a/src/Abstract.php b/src/Abstract.php index c6fb2e75..dffeaeee 100644 --- a/src/Abstract.php +++ b/src/Abstract.php @@ -20,13 +20,6 @@ * @version $Id$ */ - -/** - * @see Zend_Feed_Element - */ -require_once 'Zend/Feed/Element.php'; - - /** * The Zend_Feed_Abstract class is an abstract class representing feeds. * @@ -35,6 +28,11 @@ * considered to be the entry collection, such that iterating over the * feed takes you through each of the feed.s entries. * + * @uses Countable + * @uses Iterator + * @uses Zend_Feed + * @uses Zend_Feed_Element + * @uses Zend_Feed_Exception * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -77,10 +75,6 @@ public function __construct($uri = null, $string = null, Zend_Feed_Builder_Inter $client->setUri($uri); $response = $client->request('GET'); if ($response->getStatus() !== 200) { - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); } $this->_element = $response->getBody(); @@ -124,10 +118,6 @@ public function __wakeup() } } - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg"); } diff --git a/src/Atom.php b/src/Atom.php index 5acc4bb1..ead22b4f 100644 --- a/src/Atom.php +++ b/src/Atom.php @@ -1,5 +1,4 @@ instead. $element = $this->_element->getElementsByTagName($this->_entryElementName)->item(0); if (!$element) { - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('No root or <' . $this->_entryElementName . '> element found, cannot parse feed.'); } @@ -376,10 +363,6 @@ public function saveXml() public function send() { if (headers_sent()) { - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Cannot send ATOM because headers have already been sent.'); } diff --git a/src/Builder.php b/src/Builder.php index 80180560..b09e6f91 100644 --- a/src/Builder.php +++ b/src/Builder.php @@ -20,28 +20,15 @@ * @version $Id$ */ - -/** - * @see Zend_Feed_Builder_Interface - */ -require_once 'Zend/Feed/Builder/Interface.php'; - -/** - * @see Zend_Feed_Builder_Header - */ -require_once 'Zend/Feed/Builder/Header.php'; - -/** - * @see Zend_Feed_Builder_Entry - */ -require_once 'Zend/Feed/Builder/Entry.php'; - - /** * A simple implementation of Zend_Feed_Builder_Interface. * * Users are encouraged to make their own classes to implement Zend_Feed_Builder_Interface * + * @uses Zend_Feed_Builder_Entry + * @uses Zend_Feed_Builder_Exception + * @uses Zend_Feed_Builder_Header + * @uses Zend_Feed_Builder_Interface * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -217,10 +204,6 @@ protected function _createHeader(array $data) $mandatories = array('title', 'link', 'charset'); foreach ($mandatories as $mandatory) { if (!isset($data[$mandatory])) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("$mandatory key is missing"); } } @@ -265,10 +248,6 @@ protected function _createHeader(array $data) $mandatories = array('domain', 'path', 'registerProcedure', 'protocol'); foreach ($mandatories as $mandatory) { if (!isset($data['cloud'][$mandatory])) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("you have to define $mandatory property of your cloud"); } } @@ -279,10 +258,6 @@ protected function _createHeader(array $data) $mandatories = array('title', 'description', 'name', 'link'); foreach ($mandatories as $mandatory) { if (!isset($data['textInput'][$mandatory])) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("you have to define $mandatory property of your textInput"); } } @@ -346,10 +321,6 @@ protected function _createEntries(array $data) $mandatories = array('title', 'link', 'description'); foreach ($mandatories as $mandatory) { if (!isset($row[$mandatory])) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("$mandatory key is missing"); } } @@ -376,10 +347,6 @@ protected function _createEntries(array $data) $mandatories = array('title', 'url'); foreach ($mandatories as $mandatory) { if (!isset($row['source'][$mandatory])) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("$mandatory key of source property is missing"); } } diff --git a/src/Builder/Entry.php b/src/Builder/Entry.php index 8d542977..370c2b26 100644 --- a/src/Builder/Entry.php +++ b/src/Builder/Entry.php @@ -1,5 +1,4 @@ isValid($email)) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the email property"); } $this->offsetSet('email', $email); @@ -243,16 +230,8 @@ public function setLanguage($language) */ public function setWebmaster($webmaster) { - /** - * @see Zend_Validate_EmailAddress - */ - require_once 'Zend/Validate/EmailAddress.php'; $validate = new Zend_Validate_EmailAddress(); if (!$validate->isValid($webmaster)) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the webmaster property"); } $this->offsetSet('webmaster', $webmaster); @@ -269,16 +248,8 @@ public function setWebmaster($webmaster) */ public function setTtl($ttl) { - /** - * @see Zend_Validate_Int - */ - require_once 'Zend/Validate/Int.php'; $validate = new Zend_Validate_Int(); if (!$validate->isValid($ttl)) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("you have to set an integer value to the ttl property"); } $this->offsetSet('ttl', $ttl); @@ -314,10 +285,6 @@ public function setCloud($uri, $procedure, $protocol) $uri = Zend_Uri::factory($uri); } if (!$uri instanceof Zend_Uri_Http) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception('Passed parameter is not a valid HTTP URI'); } if (!$uri->getPort()) { @@ -359,18 +326,10 @@ public function setTextInput($title, $description, $name, $link) public function setSkipHours(array $hours) { if (count($hours) > 24) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("you can not have more than 24 rows in the skipHours property"); } foreach ($hours as $hour) { if ($hour < 0 || $hour > 23) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("$hour has te be between 0 and 23"); } } @@ -389,19 +348,11 @@ public function setSkipHours(array $hours) public function setSkipDays(array $days) { if (count($days) > 7) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("you can not have more than 7 days in the skipDays property"); } $valid = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'); foreach ($days as $day) { if (!in_array(strtolower($day), $valid)) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("$day is not a valid day"); } } diff --git a/src/Builder/Header/Itunes.php b/src/Builder/Header/Itunes.php index 7c93d7b7..a5625603 100644 --- a/src/Builder/Header/Itunes.php +++ b/src/Builder/Header/Itunes.php @@ -1,5 +1,4 @@ 3) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("you have to set at most three itunes categories"); } foreach ($categories as $i => $category) { if (empty($category['main'])) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("you have to set the main category (category #$i)"); } } @@ -112,16 +101,8 @@ public function setAuthor($author) public function setOwner($name = '', $email = '') { if (!empty($email)) { - /** - * @see Zend_Validate_EmailAddress - */ - require_once 'Zend/Validate/EmailAddress.php'; $validate = new Zend_Validate_EmailAddress(); if (!$validate->isValid($email)) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the itunes owner's email property"); } } @@ -179,10 +160,6 @@ public function setBlock($block) { $block = strtolower($block); if (!in_array($block, array('yes', 'no'))) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("you have to set yes or no to the itunes block property"); } $this->offsetSet('block', $block); @@ -200,10 +177,6 @@ public function setExplicit($explicit) { $explicit = strtolower($explicit); if (!in_array($explicit, array('yes', 'no', 'clean'))) { - /** - * @see Zend_Feed_Builder_Exception - */ - require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("you have to set yes, no or clean to the itunes explicit property"); } $this->offsetSet('explicit', $explicit); @@ -285,4 +258,4 @@ public function __unset($key) } } -} \ No newline at end of file +} diff --git a/src/Builder/Interface.php b/src/Builder/Interface.php index 1c34190a..1ddcf77e 100644 --- a/src/Builder/Interface.php +++ b/src/Builder/Interface.php @@ -1,5 +1,4 @@ _element->appendChild($node); } } elseif (count($nodes) > 1) { - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Cannot set the value of multiple tags simultaneously.'); } else { $nodes[0]->nodeValue = $val; diff --git a/src/Entry/Abstract.php b/src/Entry/Abstract.php index 4ba78586..bdcafcb8 100644 --- a/src/Entry/Abstract.php +++ b/src/Entry/Abstract.php @@ -1,5 +1,4 @@ getElementsByTagName($this->_rootElement)->item(0); if (!$element) { - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('No root <' . $this->_rootElement . '> element found, cannot parse feed.'); } } else { diff --git a/src/Entry/Atom.php b/src/Entry/Atom.php index 303d8bef..6f15e87f 100644 --- a/src/Entry/Atom.php +++ b/src/Entry/Atom.php @@ -1,5 +1,4 @@ link('edit'); if (!$deleteUri) { - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Cannot delete entry; no link rel="edit" is present.'); } @@ -104,10 +95,6 @@ public function delete() continue; // Error default: - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception("Expected response code 2xx, got $httpStatus"); } } while (true); @@ -141,10 +128,6 @@ public function save($postUri = null) // entry object and PUT. $editUri = $this->link('edit'); if (!$editUri) { - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Cannot edit entry; no link rel="edit" is present.'); } @@ -161,18 +144,10 @@ public function save($postUri = null) $response = $client->request('PUT'); } if ($response->getStatus() !== 200) { - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Expected response code 200, got ' . $response->getStatus()); } } else { if ($postUri === null) { - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('PostURI must be specified to save new entries.'); } $client = Zend_Feed::getHttpClient(); @@ -182,10 +157,6 @@ public function save($postUri = null) $response = $client->request('POST'); if ($response->getStatus() !== 201) { - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Expected response code 201, got ' . $response->getStatus()); } @@ -207,19 +178,11 @@ public function save($postUri = null) } } - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('XML cannot be parsed: ' . $php_errormsg); } $newEntry = $newEntry->getElementsByTagName($this->_rootElement)->item(0); if (!$newEntry) { - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('No root element found in server response:' . "\n\n" . $client->responseBody); } diff --git a/src/Entry/Rss.php b/src/Entry/Rss.php index bb9bf190..11072c54 100644 --- a/src/Entry/Rss.php +++ b/src/Entry/Rss.php @@ -1,5 +1,4 @@ toArray(); } elseif (!is_array($config)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' . 'expected, got ' . gettype($config)); } @@ -137,7 +129,6 @@ public function setStorage(Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $s public function getStorage() { if ($this->_storage === null) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('No storage object has been' . ' set that subclasses Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface'); } @@ -158,7 +149,6 @@ public function setHttpResponse($httpResponse) || (!$httpResponse instanceof Zend_Feed_Pubsubhubbub_HttpResponse && !$httpResponse instanceof Zend_Controller_Response_Http) ) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('HTTP Response object must' . ' implement one of Zend_Feed_Pubsubhubbub_HttpResponse or' . ' Zend_Controller_Response_Http'); @@ -194,7 +184,6 @@ public function setSubscriberCount($count) { $count = intval($count); if ($count <= 0) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Subscriber count must be' . ' greater than zero'); } diff --git a/src/Pubsubhubbub/Exception.php b/src/Pubsubhubbub/Exception.php index 881e4463..0e609042 100644 --- a/src/Pubsubhubbub/Exception.php +++ b/src/Pubsubhubbub/Exception.php @@ -20,11 +20,7 @@ */ /** - * @see Zend_Exception - */ -require_once 'Zend/Exception.php'; - -/** + * @uses Zend_Exception * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Pubsubhubbub/HttpResponse.php b/src/Pubsubhubbub/HttpResponse.php index e3c22874..a329c171 100644 --- a/src/Pubsubhubbub/HttpResponse.php +++ b/src/Pubsubhubbub/HttpResponse.php @@ -20,11 +20,8 @@ */ /** - * @see Zend_Feed_Pubsubhubbub - */ -require_once 'Zend/Feed/Pubsubhubbub.php'; - -/** + * @uses Zend_Feed_Pubsubhubbub + * @uses Zend_Feed_Pubsubhubbub_Exception * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -162,7 +159,6 @@ public function canSendHeaders($throw = false) { $ok = headers_sent($file, $line); if ($ok && $throw) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Cannot send headers; headers already sent in ' . $file . ', line ' . $line); } return !$ok; @@ -177,7 +173,6 @@ public function canSendHeaders($throw = false) public function setHttpResponseCode($code) { if (!is_int($code) || (100 > $code) || (599 < $code)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid HTTP response' . ' code:' . $code); } diff --git a/src/Pubsubhubbub/Model/ModelAbstract.php b/src/Pubsubhubbub/Model/ModelAbstract.php index 0e552db8..bdbdd936 100644 --- a/src/Pubsubhubbub/Model/ModelAbstract.php +++ b/src/Pubsubhubbub/Model/ModelAbstract.php @@ -19,17 +19,9 @@ * @version $Id$ */ - -/** @see Zend_Db_Table */ -require_once 'Zend/Db/Table.php'; - -/** - * @see Zend_Registry - * Seems to fix the file not being included by Zend_Db_Table... - */ -require_once 'Zend/Registry.php'; - /** + * @uses Zend_Db_Table + * @uses Zend_Registry * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Pubsubhubbub/Model/Subscription.php b/src/Pubsubhubbub/Model/Subscription.php index 0ba23e01..9abb8c6f 100644 --- a/src/Pubsubhubbub/Model/Subscription.php +++ b/src/Pubsubhubbub/Model/Subscription.php @@ -20,13 +20,11 @@ * @version $Id$ */ -/** @see Zend_Feed_Pubsubhubbub_Model_ModelAbstract */ -require_once 'Zend/Feed/Pubsubhubbub/Model/ModelAbstract.php'; - -/** @see Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface */ -require_once 'Zend/Feed/Pubsubhubbub/Model/SubscriptionInterface.php'; - /** + * @uses Zend_Date + * @uses Zend_Feed_Pubsubhubbub_Exception + * @uses Zend_Feed_Pubsubhubbub_Model_ModelAbstract + * @uses Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface * @category Zend * @package Zend_Feed_Pubsubhubbub * @subpackage Entity @@ -47,7 +45,6 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription public function setSubscription(array $data) { if (!isset($data['id'])) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception( 'ID must be set before attempting a save' ); @@ -80,7 +77,6 @@ public function setSubscription(array $data) public function getSubscription($key) { if (empty($key) || !is_string($key)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "key"' .' of "' . $key . '" must be a non-empty string'); } @@ -100,7 +96,6 @@ public function getSubscription($key) public function hasSubscription($key) { if (empty($key) || !is_string($key)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "key"' .' of "' . $key . '" must be a non-empty string'); } diff --git a/src/Pubsubhubbub/Publisher.php b/src/Pubsubhubbub/Publisher.php index b9524e07..63bb1870 100644 --- a/src/Pubsubhubbub/Publisher.php +++ b/src/Pubsubhubbub/Publisher.php @@ -20,11 +20,11 @@ */ /** - * @see Zend_Feed_Pubsubhubbub - */ -require_once 'Zend/Feed/Pubsubhubbub.php'; - -/** + * @uses Zend_Feed_Pubsubhubbub + * @uses Zend_Feed_Pubsubhubbub_Exception + * @uses Zend_Http_Client + * @uses Zend_Uri + * @uses Zend_Version * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -90,7 +90,6 @@ public function setConfig($config) if ($config instanceof Zend_Config) { $config = $config->toArray(); } elseif (!is_array($config)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' . 'expected, got ' . gettype($config)); } @@ -115,7 +114,6 @@ public function setConfig($config) public function addHubUrl($url) { if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .'URL'); @@ -174,7 +172,6 @@ public function getHubUrls() public function addUpdatedTopicUrl($url) { if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .'URL'); @@ -234,7 +231,6 @@ public function getUpdatedTopicUrls() public function notifyHub($url) { if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .'URL'); @@ -243,7 +239,6 @@ public function notifyHub($url) $client->setUri($url); $response = $client->request(); if ($response->getStatus() !== 204) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Notification to Hub Server ' . 'at "' . $url . '" appears to have failed with a status code of "' . $response->getStatus() . '" and message "' @@ -267,7 +262,6 @@ public function notifyAll() $client = $this->_getHttpClient(); $hubs = $this->getHubUrls(); if (empty($hubs)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('No Hub Server URLs' . ' have been set so no notifcations can be sent'); } @@ -298,7 +292,6 @@ public function setParameter($name, $value = null) return $this; } if (empty($name) || !is_string($name)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' .' of "' . $name . '" must be a non-empty string'); } @@ -307,7 +300,6 @@ public function setParameter($name, $value = null) return $this; } if (empty($value) || (!is_string($value) && !is_null($value))) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "value"' .' of "' . $value . '" must be a non-empty string'); } @@ -338,7 +330,6 @@ public function setParameters(array $parameters) public function removeParameter($name) { if (empty($name) || !is_string($name)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' .' of "' . $name . '" must be a non-empty string'); } @@ -400,7 +391,6 @@ protected function _getHttpClient() $params[] = 'hub.mode=publish'; $topics = $this->getUpdatedTopicUrls(); if (empty($topics)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('No updated topic URLs' . ' have been set'); } diff --git a/src/Pubsubhubbub/Subscriber.php b/src/Pubsubhubbub/Subscriber.php index 2e8846d8..66c8c317 100644 --- a/src/Pubsubhubbub/Subscriber.php +++ b/src/Pubsubhubbub/Subscriber.php @@ -20,16 +20,12 @@ */ /** - * @see Zend_Feed_Pubsubhubbub - */ -require_once 'Zend/Feed/Pubsubhubbub.php'; - -/** - * @see Zend_Date - */ -require_once 'Zend/Date.php'; - -/** + * @uses Zend_Date + * @uses Zend_Feed_Pubsubhubbub + * @uses Zend_Feed_Pubsubhubbub_Exception + * @uses Zend_Http_Client + * @uses Zend_Uri + * @uses Zend_Version * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -166,7 +162,6 @@ public function setConfig($config) if ($config instanceof Zend_Config) { $config = $config->toArray(); } elseif (!is_array($config)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' . ' expected, got ' . gettype($config)); } @@ -212,7 +207,6 @@ public function setConfig($config) public function setTopicUrl($url) { if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .' URL'); @@ -230,7 +224,6 @@ public function setTopicUrl($url) public function getTopicUrl() { if (empty($this->_topicUrl)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('A valid Topic (RSS or Atom' . ' feed) URL MUST be set before attempting any operation'); } @@ -247,7 +240,6 @@ public function setLeaseSeconds($seconds) { $seconds = intval($seconds); if ($seconds <= 0) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Expected lease seconds' . ' must be an integer greater than zero'); } @@ -275,7 +267,6 @@ public function getLeaseSeconds() public function setCallbackUrl($url) { if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); @@ -293,7 +284,6 @@ public function setCallbackUrl($url) public function getCallbackUrl() { if (empty($this->_callbackUrl)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('A valid Callback URL MUST be' . ' set before attempting any operation'); } @@ -315,7 +305,6 @@ public function setPreferredVerificationMode($mode) { if ($mode !== Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC && $mode !== Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid preferred' . ' mode specified: "' . $mode . '" but should be one of' . ' Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC or' @@ -344,7 +333,6 @@ public function getPreferredVerificationMode() public function addHubUrl($url) { if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); @@ -404,7 +392,6 @@ public function getHubUrls() public function addAuthentication($url, array $authentication) { if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); @@ -463,7 +450,6 @@ public function setParameter($name, $value = null) return $this; } if (empty($name) || !is_string($name)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' . ' of "' . $name . '" must be a non-empty string'); } @@ -472,7 +458,6 @@ public function setParameter($name, $value = null) return $this; } if (empty($value) || (!is_string($value) && !is_null($value))) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "value"' . ' of "' . $value . '" must be a non-empty string'); } @@ -504,7 +489,6 @@ public function setParameters(array $parameters) public function removeParameter($name) { if (empty($name) || !is_string($name)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' . ' of "' . $name . '" must be a non-empty string'); } @@ -547,7 +531,6 @@ public function setStorage(Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $s public function getStorage() { if ($this->_storage === null) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('No storage vehicle ' . 'has been set.'); } @@ -626,7 +609,6 @@ protected function _doRequest($mode) $client = $this->_getHttpClient(); $hubs = $this->getHubUrls(); if (empty($hubs)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('No Hub Server URLs' . ' have been set so no subscriptions can be attempted'); } @@ -689,7 +671,6 @@ protected function _getHttpClient() protected function _getRequestParameters($hubUrl, $mode) { if (!in_array($mode, array('subscribe', 'unsubscribe'))) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid mode specified: "' . $mode . '" which should have been "subscribe" or "unsubscribe"'); } diff --git a/src/Pubsubhubbub/Subscriber/Callback.php b/src/Pubsubhubbub/Subscriber/Callback.php index 763b2513..76373f72 100644 --- a/src/Pubsubhubbub/Subscriber/Callback.php +++ b/src/Pubsubhubbub/Subscriber/Callback.php @@ -20,21 +20,10 @@ */ /** - * @see Zend_Feed_Pubsubhubbub - */ -require_once 'Zend/Feed/Pubsubhubbub.php'; - -/** - * @see Zend_Feed_Pubsubhubbub - */ -require_once 'Zend/Feed/Pubsubhubbub/CallbackAbstract.php'; - -/** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** + * @uses Zend_Feed_Pubsubhubbub + * @uses Zend_Feed_Pubsubhubbub_CallbackAbstract + * @uses Zend_Feed_Reader + * @uses Zend_Uri * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader.php b/src/Reader.php index 0230e6d3..e9ed9286 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -20,26 +20,13 @@ */ /** - * @see Zend_Feed - */ -require_once 'Zend/Feed.php'; - -/** - * @see Zend_Feed_Reader_Feed_Rss - */ -require_once 'Zend/Feed/Reader/Feed/Rss.php'; - -/** - * @see Zend_Feed_Reader_Feed_Atom - */ -require_once 'Zend/Feed/Reader/Feed/Atom.php'; - -/** - * @see Zend_Feed_Reader_FeedSet - */ -require_once 'Zend/Feed/Reader/FeedSet.php'; - -/** + * @uses Zend_Feed + * @uses Zend_Feed_Exception + * @uses Zend_Feed_Reader_FeedSet + * @uses Zend_Feed_Reader_Feed_Atom + * @uses Zend_Feed_Reader_Feed_Rss + * @uses Zend_Http_Client + * @uses Zend_Loader_PluginLoader * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -164,10 +151,6 @@ public static function setHttpClient(Zend_Http_Client $httpClient) public static function getHttpClient() { if (!self::$_httpClient instanceof Zend_Http_Client) { - /** - * @see Zend_Http_Client - */ - require_once 'Zend/Http/Client.php'; self::$_httpClient = new Zend_Http_Client(); } @@ -251,7 +234,6 @@ public static function import($uri, $etag = null, $lastModified = null) } $response = $client->request('GET'); if ($response->getStatus() !== 200 && $response->getStatus() !== 304) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); } if ($response->getStatus() == 304) { @@ -274,7 +256,6 @@ public static function import($uri, $etag = null, $lastModified = null) } $response = $client->request('GET'); if ($response->getStatus() !== 200) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); } $responseXml = $response->getBody(); @@ -283,7 +264,6 @@ public static function import($uri, $etag = null, $lastModified = null) } else { $response = $client->request('GET'); if ($response->getStatus() !== 200) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); } return self::importString($response->getBody()); @@ -332,7 +312,6 @@ public static function importString($string) $errormsg = "DOMDocument cannot parse XML: Please check the XML document's validity"; } - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception($errormsg); } @@ -343,11 +322,10 @@ public static function importString($string) if (substr($type, 0, 3) == 'rss') { $reader = new Zend_Feed_Reader_Feed_Rss($dom, $type); } elseif (substr($type, 8, 5) == 'entry') { - $reader = new Zend_Feed_Reader_Entry_Atom($dom->documentElement, 0, Zend_Feed_Reader::TYPE_ATOM_10); + $reader = new Zend_Feed_Reader_Entry_Atom($dom->documentElement, 0, self::TYPE_ATOM_10); } elseif (substr($type, 0, 4) == 'atom') { $reader = new Zend_Feed_Reader_Feed_Atom($dom, $type); } else { - 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.'); } @@ -367,10 +345,6 @@ public static function importFile($filename) $feed = @file_get_contents($filename); @ini_restore('track_errors'); if ($feed === false) { - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception("File could not be loaded: $php_errormsg"); } return self::importString($feed); @@ -383,10 +357,6 @@ public static function findFeedLinks($uri) $client->setUri($uri); $response = $client->request(); if ($response->getStatus() !== 200) { - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception("Failed to access $uri, got response code " . $response->getStatus()); } $responseHtml = $response->getBody(); @@ -403,7 +373,6 @@ public static function findFeedLinks($uri) $errormsg = "DOMDocument cannot parse HTML: Please check the XML document's validity"; } - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception($errormsg); } $feedSet = new Zend_Feed_Reader_FeedSet; @@ -437,11 +406,9 @@ public static function detectType($feed, $specOnly = false) $php_errormsg = '(error message not available)'; } } - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg"); } } else { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid object/scalar provided: must' . ' be of type Zend_Feed_Reader_FeedInterface, DomDocument or string'); } @@ -544,7 +511,6 @@ public static function setPluginLoader(Zend_Loader_PluginLoader_Interface $loade public static function getPluginLoader() { if (!isset(self::$_pluginLoader)) { - require_once 'Zend/Loader/PluginLoader.php'; self::$_pluginLoader = new Zend_Loader_PluginLoader(array( 'Zend_Feed_Reader_Extension_' => 'Zend/Feed/Reader/Extension/', )); @@ -614,7 +580,6 @@ public static function registerExtension($name) if (!self::getPluginLoader()->isLoaded($feedName) && !self::getPluginLoader()->isLoaded($entryName) ) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Could not load extension: ' . $name . 'using Plugin Loader. Check prefix paths are configured and extension exists.'); } diff --git a/src/Reader/Collection.php b/src/Reader/Collection.php index fba2b52b..e4bfa135 100644 --- a/src/Reader/Collection.php +++ b/src/Reader/Collection.php @@ -20,6 +20,7 @@ */ /** + * @uses ArrayObject * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Collection/Author.php b/src/Reader/Collection/Author.php index 58d3782e..bc060f78 100644 --- a/src/Reader/Collection/Author.php +++ b/src/Reader/Collection/Author.php @@ -20,18 +20,14 @@ */ /** - * @see Zend_Feed_Reader_Collection_CollectionAbstract - */ -require_once 'Zend/Feed/Reader/Collection/CollectionAbstract.php'; - -/** + * @uses Zend_Feed_Reader_Collection_CollectionAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Reader_Collection_Author -extends Zend_Feed_Reader_Collection_CollectionAbstract + extends Zend_Feed_Reader_Collection_CollectionAbstract { /** diff --git a/src/Reader/Collection/Category.php b/src/Reader/Collection/Category.php index 9cd02569..3d07207e 100644 --- a/src/Reader/Collection/Category.php +++ b/src/Reader/Collection/Category.php @@ -20,18 +20,14 @@ */ /** - * @see Zend_Feed_Reader_Collection_CollectionAbstract - */ -require_once 'Zend/Feed/Reader/Collection/CollectionAbstract.php'; - -/** + * @uses Zend_Feed_Reader_Collection_CollectionAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Reader_Collection_Category -extends Zend_Feed_Reader_Collection_CollectionAbstract + extends Zend_Feed_Reader_Collection_CollectionAbstract { /** diff --git a/src/Reader/Collection/CollectionAbstract.php b/src/Reader/Collection/CollectionAbstract.php index b3a5a157..16f811b0 100644 --- a/src/Reader/Collection/CollectionAbstract.php +++ b/src/Reader/Collection/CollectionAbstract.php @@ -20,6 +20,7 @@ */ /** + * @uses ArrayObject * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index 3e4ad5e9..5c9548cf 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -20,32 +20,18 @@ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_Feed_Reader_EntryInterface - */ -require_once 'Zend/Feed/Reader/EntryInterface.php'; - -/** - * @see Zend_Feed_Reader_EntryAbstract - */ -require_once 'Zend/Feed/Reader/EntryAbstract.php'; - -/** - * @see Zend_Feed_Reader_Extension_Atom_Entry - */ -require_once 'Zend/Feed/Reader/Extension/Atom/Entry.php'; - -/** + * @uses Zend_Feed_Reader + * @uses Zend_Feed_Reader_EntryAbstract + * @uses Zend_Feed_Reader_EntryInterface + * @uses Zend_Feed_Reader_Extension_Atom_Entry * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Reader_Entry_Atom extends Zend_Feed_Reader_EntryAbstract implements Zend_Feed_Reader_EntryInterface +class Zend_Feed_Reader_Entry_Atom + extends Zend_Feed_Reader_EntryAbstract + implements Zend_Feed_Reader_EntryInterface { /** * XPath query diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index d339950e..6b67dbf4 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -20,69 +20,27 @@ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_Feed_Reader_EntryInterface - */ -require_once 'Zend/Feed/Reader/EntryInterface.php'; - -/** - * @see Zend_Feed_Reader_EntryAbstract - */ -require_once 'Zend/Feed/Reader/EntryAbstract.php'; - -/** - * @see Zend_Feed_Reader_Extension_DublinCore_Entry - */ -require_once 'Zend/Feed/Reader/Extension/DublinCore/Entry.php'; - -/** - * @see Zend_Feed_Reader_Extension_Content_Entry - */ -require_once 'Zend/Feed/Reader/Extension/Content/Entry.php'; - -/** - * @see Zend_Feed_Reader_Extension_Atom_Entry - */ -require_once 'Zend/Feed/Reader/Extension/Atom/Entry.php'; - -/** - * @see Zend_Feed_Reader_Extension_WellformedWeb_Entry - */ -require_once 'Zend/Feed/Reader/Extension/WellFormedWeb/Entry.php'; - -/** - * @see Zend_Feed_Reader_Extension_Slash_Entry - */ -require_once 'Zend/Feed/Reader/Extension/Slash/Entry.php'; - -/** - * @see Zend_Feed_Reader_Extension_Thread_Entry - */ -require_once 'Zend/Feed/Reader/Extension/Thread/Entry.php'; - -/** - * @see Zend_Date - */ -require_once 'Zend/Date.php'; - -/** - * @see Zend_Feed_Reader_Collection_Category - */ -require_once 'Zend/Feed/Reader/Collection/Category.php'; - -/** + * @uses Zend_Date + * @uses Zend_Feed_Exception + * @uses Zend_Feed_Reader + * @uses Zend_Feed_Reader_Collection_Category + * @uses Zend_Feed_Reader_EntryAbstract + * @uses Zend_Feed_Reader_EntryInterface + * @uses Zend_Feed_Reader_Extension_Atom_Entry + * @uses Zend_Feed_Reader_Extension_Content_Entry + * @uses Zend_Feed_Reader_Extension_DublinCore_Entry + * @uses Zend_Feed_Reader_Extension_Slash_Entry + * @uses Zend_Feed_Reader_Extension_Thread_Entry + * @uses Zend_Feed_Reader_Extension_WellformedWeb_Entry * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_EntryAbstract implements Zend_Feed_Reader_EntryInterface +class Zend_Feed_Reader_Entry_Rss + extends Zend_Feed_Reader_EntryAbstract + implements Zend_Feed_Reader_EntryInterface { - /** * XPath query for RDF * @@ -274,7 +232,6 @@ public function getDateModified() break; } 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):' diff --git a/src/Reader/EntryAbstract.php b/src/Reader/EntryAbstract.php index d63cc2ad..aaed6713 100644 --- a/src/Reader/EntryAbstract.php +++ b/src/Reader/EntryAbstract.php @@ -20,6 +20,8 @@ */ /** + * @uses Zend_Feed_Exception + * @uses Zend_Feed_Reader * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -211,7 +213,6 @@ public function __call($method, $args) return call_user_func_array(array($extension, $method), $args); } } - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Method: ' . $method . 'does not exist and could not be located on a registered Extension'); } diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 7e4744a7..64098a96 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -20,36 +20,15 @@ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_Feed_Reader_Extension_EntryAbstract - */ -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; - -/** - * @see Zend_Date - */ -require_once 'Zend/Date.php'; - -/** - * @see Zend_Uri - */ -require_once 'Zend/Uri.php'; - -/** - * @see Zend_Feed_Reader_Collection_Category - */ -require_once 'Zend/Feed/Reader/Collection/Category.php'; - -/** - * @see Zend_Feed_Reader_Feed_Atom_Source - */ -require_once 'Zend/Feed/Reader/Feed/Atom/Source.php'; - -/** + * @uses DOMDocument + * @uses stdClass + * @uses Zend_Date + * @uses Zend_Feed_Reader + * @uses Zend_Feed_Reader_Feed_Atom_Source + * @uses Zend_Feed_Reader_Collection_Author + * @uses Zend_Feed_Reader_Collection_Category + * @uses Zend_Feed_Reader_Extension_EntryAbstract + * @uses Zend_Uri * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index 97261674..32711d90 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -20,26 +20,12 @@ */ /** - * @see Zend_Feed_Reader_Extension_FeedAbstract - */ -require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; - -/** - * @see Zend_Date - */ -require_once 'Zend/Date.php'; - -/** - * @see Zend_Uri - */ -require_once 'Zend/Uri.php'; - -/** - * @see Zend_Feed_Reader_Collection_Author - */ -require_once 'Zend/Feed/Reader/Collection/Author.php'; - -/** + * @uses Zend_Date + * @uses Zend_Feed_Reader + * @uses Zend_Feed_Reader_Collection_Author + * @uses Zend_Feed_Reader_Collection_Category + * @uses Zend_Feed_Reader_Extension_FeedAbstract + * @uses Zend_Uri * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Extension/Content/Entry.php b/src/Reader/Extension/Content/Entry.php index 93ca5cd0..e5e9c2f7 100644 --- a/src/Reader/Extension/Content/Entry.php +++ b/src/Reader/Extension/Content/Entry.php @@ -20,16 +20,8 @@ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_Feed_Reader_Entry_EntryAbstract - */ -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; - -/** + * @uses Zend_Feed_Reader + * @uses Zend_Feed_Reader_Entry_EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Extension/CreativeCommons/Entry.php b/src/Reader/Extension/CreativeCommons/Entry.php index 5edebf50..fc0f362d 100644 --- a/src/Reader/Extension/CreativeCommons/Entry.php +++ b/src/Reader/Extension/CreativeCommons/Entry.php @@ -20,16 +20,8 @@ */ /** - * @see Zend_Feed_Reader_Extension_EntryAbstract - */ -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; - -/** - * @see Zend_Feed_Reader_Extension_CreativeCommons_Feed - */ -require_once 'Zend/Feed/Reader/Extension/CreativeCommons/Feed.php'; - -/** + * @uses Zend_Feed_Reader_Extension_CreativeCommons_Feed + * @uses Zend_Feed_Reader_Extension_EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Extension/CreativeCommons/Feed.php b/src/Reader/Extension/CreativeCommons/Feed.php index 78f9b8f6..0bf2b181 100644 --- a/src/Reader/Extension/CreativeCommons/Feed.php +++ b/src/Reader/Extension/CreativeCommons/Feed.php @@ -20,11 +20,7 @@ */ /** - * @see Zend_Feed_Reader_Extension_FeedAbstract - */ -require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; - -/** + * @uses Zend_Feed_Reader_Extension_FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Extension/DublinCore/Entry.php b/src/Reader/Extension/DublinCore/Entry.php index 97b3fa62..e5e66414 100644 --- a/src/Reader/Extension/DublinCore/Entry.php +++ b/src/Reader/Extension/DublinCore/Entry.php @@ -20,21 +20,11 @@ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_Feed_Reader_Extension_EntryAbstract - */ -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; - -/** - * @see Zend_Date - */ -require_once 'Zend/Date.php'; - -/** + * @uses Zend_Date + * @uses Zend_Feed_Reader + * @uses Zend_Feed_Reader_Collection_Author + * @uses Zend_Feed_Reader_Collection_Category + * @uses Zend_Feed_Reader_Extension_EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Extension/DublinCore/Feed.php b/src/Reader/Extension/DublinCore/Feed.php index 7f92fc30..959ec124 100644 --- a/src/Reader/Extension/DublinCore/Feed.php +++ b/src/Reader/Extension/DublinCore/Feed.php @@ -20,21 +20,11 @@ */ /** - * @see Zend_Feed_Reader_Extension_FeedAbstract - */ -require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; - -/** - * @see Zend_Date - */ -require_once 'Zend/Date.php'; - -/** - * @see Zend_Feed_Reader_Collection_Author - */ -require_once 'Zend/Feed/Reader/Collection/Author.php'; - -/** + * @uses Zend_Date + * @uses Zend_Feed_Reader + * @uses Zend_Feed_Reader_Collection_Author + * @uses Zend_Feed_Reader_Collection_Category + * @uses Zend_Feed_Reader_Extension_FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Extension/EntryAbstract.php b/src/Reader/Extension/EntryAbstract.php index ca5c47a8..f9f3eeaa 100644 --- a/src/Reader/Extension/EntryAbstract.php +++ b/src/Reader/Extension/EntryAbstract.php @@ -20,6 +20,7 @@ */ /** + * @uses Zend_Feed_Reader * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Extension/FeedAbstract.php b/src/Reader/Extension/FeedAbstract.php index cb9139d8..c4105e01 100644 --- a/src/Reader/Extension/FeedAbstract.php +++ b/src/Reader/Extension/FeedAbstract.php @@ -20,22 +20,10 @@ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_Feed_Reader_Entry_Atom - */ -require_once 'Zend/Feed/Reader/Entry/Atom.php'; - - -/** - * @see Zend_Feed_Reader_Entry_Rss - */ -require_once 'Zend/Feed/Reader/Entry/Rss.php'; - -/** + * @uses DOMXPath + * @uses Zend_Feed_Reader + * @uses Zend_Feed_Reader_Entry_Atom + * @uses Zend_Feed_Reader_Entry_Rss * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Extension/Podcast/Entry.php b/src/Reader/Extension/Podcast/Entry.php index e7adf576..54ffab64 100644 --- a/src/Reader/Extension/Podcast/Entry.php +++ b/src/Reader/Extension/Podcast/Entry.php @@ -20,16 +20,8 @@ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_Feed_Reader_Extension_EntryAbstract - */ -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; - -/** + * @uses Zend_Feed_Reader + * @uses Zend_Feed_Reader_Extension_EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -199,4 +191,4 @@ protected function _registerNamespaces() { $this->_xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); } -} \ No newline at end of file +} diff --git a/src/Reader/Extension/Podcast/Feed.php b/src/Reader/Extension/Podcast/Feed.php index 4f2f7f53..2863e21f 100644 --- a/src/Reader/Extension/Podcast/Feed.php +++ b/src/Reader/Extension/Podcast/Feed.php @@ -20,11 +20,7 @@ */ /** - * @see Zend_Feed_Reader_Extension_FeedAbstract - */ -require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; - -/** + * @uses Zend_Feed_Reader_Extension_FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -290,4 +286,4 @@ protected function _registerNamespaces() { $this->_xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); } -} \ No newline at end of file +} diff --git a/src/Reader/Extension/Slash/Entry.php b/src/Reader/Extension/Slash/Entry.php index d8470a2d..5b088fe3 100644 --- a/src/Reader/Extension/Slash/Entry.php +++ b/src/Reader/Extension/Slash/Entry.php @@ -20,16 +20,8 @@ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_Feed_Reader_Extension_EntryAbstract - */ -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; - -/** + * @uses Zend_Feed_Reader + * @uses Zend_Feed_Reader_Extension_EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Extension/Syndication/Feed.php b/src/Reader/Extension/Syndication/Feed.php index 79b91bfd..adb69164 100644 --- a/src/Reader/Extension/Syndication/Feed.php +++ b/src/Reader/Extension/Syndication/Feed.php @@ -20,13 +20,8 @@ */ /** - * @see Zend_Feed_Reader_Extension_FeedAbstract - */ -require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; - -require_once 'Zend/Date.php'; - -/** + * @uses Zend_Date + * @uses Zend_Feed_Reader_Extension_FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Extension/Thread/Entry.php b/src/Reader/Extension/Thread/Entry.php index c57add4b..1e31fff9 100644 --- a/src/Reader/Extension/Thread/Entry.php +++ b/src/Reader/Extension/Thread/Entry.php @@ -20,11 +20,7 @@ */ /** - * @see Zend_Feed_Reader_Extension_EntryAbstract - */ -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; - -/** + * @uses Zend_Feed_Reader_Extension_EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Extension/WellFormedWeb/Entry.php b/src/Reader/Extension/WellFormedWeb/Entry.php index ce7223e3..6b278541 100644 --- a/src/Reader/Extension/WellFormedWeb/Entry.php +++ b/src/Reader/Extension/WellFormedWeb/Entry.php @@ -20,16 +20,8 @@ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_Feed_Reader_Extension_EntryAbstract - */ -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; - -/** + * @uses Zend_Feed_Reader + * @uses Zend_Feed_Reader_Extension_EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index a562e62b..3f1accf9 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -20,16 +20,9 @@ */ /** - * @see Zend_Feed_Reader_FeedAbstract - */ -require_once 'Zend/Feed/Reader/FeedAbstract.php'; - -/** - * @see Zend_Feed_Reader_Extension_Atom_Feed - */ -require_once 'Zend/Feed/Reader/Extension/Atom/Feed.php'; - -/** + * @uses Zend_Feed_Reader + * @uses Zend_Feed_Reader_Extension_Atom_Feed + * @uses Zend_Feed_Reader_FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php index 73cfc386..fe7b2c32 100644 --- a/src/Reader/Feed/Atom/Source.php +++ b/src/Reader/Feed/Atom/Source.php @@ -20,11 +20,8 @@ */ /** - * @see Zend_Feed_Reader_Feed_Atom - */ -require_once 'Zend/Feed/Reader/Feed/Atom.php'; - -/** + * @uses Zend_Feed_Reader + * @uses Zend_Feed_Reader_Feed_Atom * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index b4f6f66a..841eda32 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -20,31 +20,13 @@ */ /** - * @see Zend_Feed_Reader_FeedAbstract - */ -require_once 'Zend/Feed/Reader/FeedAbstract.php'; - -/** - * @see Zend_feed_Reader_Extension_Atom_Feed - */ -require_once 'Zend/Feed/Reader/Extension/Atom/Feed.php'; - -/** - * @see Zend_Feed_Reader_Extension_DublinCore_Feed - */ -require_once 'Zend/Feed/Reader/Extension/DublinCore/Feed.php'; - -/** - * @see Zend_Date - */ -require_once 'Zend/Date.php'; - -/** - * @see Zend_Feed_Reader_Collection_Author - */ -require_once 'Zend/Feed/Reader/Collection/Author.php'; - -/** + * @uses Zend_Date + * @uses Zend_Feed_Exception + * @uses Zend_Feed_Reader + * @uses Zend_Feed_Reader_Collection_Author + * @uses Zend_Feed_Reader_Extension_Atom_Feed + * @uses Zend_Feed_Reader_Extension_DublinCore_Feed + * @uses Zend_Feed_Reader_FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -235,7 +217,6 @@ public function getDateModified() break; } 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):' diff --git a/src/Reader/FeedAbstract.php b/src/Reader/FeedAbstract.php index b24d8a6d..38044e84 100644 --- a/src/Reader/FeedAbstract.php +++ b/src/Reader/FeedAbstract.php @@ -20,16 +20,9 @@ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_feed_Reader_FeedInterface - */ -require_once 'Zend/Feed/Reader/FeedInterface.php'; - -/** + * @uses Zend_Feed_Exception + * @uses Zend_Feed_Reader + * @uses Zend_feed_Reader_FeedInterface * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -243,7 +236,6 @@ public function __call($method, $args) return call_user_func_array(array($extension, $method), $args); } } - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Method: ' . $method . 'does not exist and could not be located on a registered Extension'); } diff --git a/src/Reader/FeedInterface.php b/src/Reader/FeedInterface.php index 378587fd..ee22eef8 100644 --- a/src/Reader/FeedInterface.php +++ b/src/Reader/FeedInterface.php @@ -20,6 +20,8 @@ */ /** + * @uses Countable + * @uses Iterator * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index dcf43ff3..377fa596 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -20,16 +20,8 @@ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_Uri - */ -require_once 'Zend/Uri.php'; - -/** + * @uses Zend_Feed_Reader + * @uses Zend_Uri * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Rss.php b/src/Rss.php index be47743e..1c09d6b9 100644 --- a/src/Rss.php +++ b/src/Rss.php @@ -1,5 +1,4 @@ _element = $this->_element->getElementsByTagName('channel')->item(0); } if (!$this->_element) { - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('No root element found, cannot parse channel.'); } @@ -514,10 +501,6 @@ public function saveXml() public function send() { if (headers_sent()) { - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Cannot send RSS because headers have already been sent.'); } diff --git a/src/Writer.php b/src/Writer.php index c47893d3..bf095a10 100644 --- a/src/Writer.php +++ b/src/Writer.php @@ -20,6 +20,8 @@ */ /** + * @uses Zend_Feed_Exception + * @uses Zend_Loader_PluginLoader * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -100,7 +102,6 @@ public static function setPluginLoader(Zend_Loader_PluginLoader_Interface $loade public static function getPluginLoader() { if (!isset(self::$_pluginLoader)) { - require_once 'Zend/Loader/PluginLoader.php'; self::$_pluginLoader = new Zend_Loader_PluginLoader(array( 'Zend_Feed_Writer_Extension_' => 'Zend/Feed/Writer/Extension/', )); @@ -187,7 +188,6 @@ public static function registerExtension($name) && !self::getPluginLoader()->isLoaded($feedRendererName) && !self::getPluginLoader()->isLoaded($entryRendererName) ) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Could not load extension: ' . $name . 'using Plugin Loader. Check prefix paths are configured and extension exists.'); } diff --git a/src/Writer/Deleted.php b/src/Writer/Deleted.php index ce5b00f8..f6cb07f2 100644 --- a/src/Writer/Deleted.php +++ b/src/Writer/Deleted.php @@ -19,9 +19,10 @@ * @version $Id$ */ -require_once 'Zend/Feed/Writer/Feed/FeedAbstract.php'; - - /** +/** + * @uses Zend_Date + * @uses Zend_Feed_Exception + * @uses Zend_Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -53,7 +54,6 @@ class Zend_Feed_Writer_Deleted public function setEncoding($encoding) { if (empty($encoding) || !is_string($encoding)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['encoding'] = $encoding; @@ -109,7 +109,6 @@ public function getType() public function setReference($reference) { if (empty($reference) || !is_string($reference)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: reference must be a non-empty string'); } $this->_data['reference'] = $reference; @@ -133,7 +132,6 @@ public function setWhen($date = null) } elseif ($date instanceof Zend_Date) { $zdate = $date; } else { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['when'] = $zdate; @@ -154,13 +152,11 @@ public function setBy(array $by) || empty($by['name']) || !is_string($by['name']) ) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); } $author['name'] = $by['name']; if (isset($by['email'])) { if (empty($by['email']) || !is_string($by['email'])) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); } $author['email'] = $by['email']; @@ -170,7 +166,6 @@ public function setBy(array $by) || !is_string($by['uri']) || !Zend_Uri::check($by['uri']) ) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $by['uri']; diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index c838f1dc..a17ada1d 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -20,18 +20,11 @@ */ /** - * @see Zend_Date - */ -require_once 'Zend/Date.php'; - -/** - * @see Zend_Date - */ -require_once 'Zend/Uri.php'; - -require_once 'Zend/Feed/Writer/Source.php'; - -/** + * @uses Zend_Date + * @uses Zend_Feed_Exception + * @uses Zend_Feed_Writer + * @uses Zend_Feed_Writer_Source + * @uses Zend_Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -88,13 +81,11 @@ public function addAuthor($name, $email = null, $uri = null) || empty($name['name']) || !is_string($name['name']) ) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); } $author['name'] = $name['name']; if (isset($name['email'])) { if (empty($name['email']) || !is_string($name['email'])) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); } $author['email'] = $name['email']; @@ -104,7 +95,6 @@ public function addAuthor($name, $email = null, $uri = null) || !is_string($name['uri']) || !Zend_Uri::check($name['uri']) ) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $name['uri']; @@ -115,20 +105,17 @@ public function addAuthor($name, $email = null, $uri = null) */ } else { if (empty($name['name']) || !is_string($name['name'])) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string value'); } $author['name'] = $name; if (isset($email)) { if (empty($email) || !is_string($email)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "email" value must be a non-empty string'); } $author['email'] = $email; } if (isset($uri)) { if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $uri; @@ -157,7 +144,6 @@ public function addAuthors(array $authors) public function setEncoding($encoding) { if (empty($encoding) || !is_string($encoding)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['encoding'] = $encoding; @@ -184,7 +170,6 @@ public function getEncoding() public function setCopyright($copyright) { if (empty($copyright) || !is_string($copyright)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['copyright'] = $copyright; @@ -198,7 +183,6 @@ public function setCopyright($copyright) public function setContent($content) { if (empty($content) || !is_string($content)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['content'] = $content; @@ -219,7 +203,6 @@ public function setDateCreated($date = null) } elseif ($date instanceof Zend_Date) { $zdate = $date; } else { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateCreated'] = $zdate; @@ -240,7 +223,6 @@ public function setDateModified($date = null) } elseif ($date instanceof Zend_Date) { $zdate = $date; } else { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateModified'] = $zdate; @@ -254,7 +236,6 @@ public function setDateModified($date = null) public function setDescription($description) { if (empty($description) || !is_string($description)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['description'] = $description; @@ -268,7 +249,6 @@ public function setDescription($description) public function setId($id) { if (empty($id) || !is_string($id)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['id'] = $id; @@ -282,7 +262,6 @@ public function setId($id) public function setLink($link) { if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['link'] = $link; @@ -296,7 +275,6 @@ public function setLink($link) public function setCommentCount($count) { if (empty($count) || !is_numeric($count) || (int) $count < 0) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "count" must be a non-empty integer number'); } $this->_data['commentCount'] = (int) $count; @@ -310,7 +288,6 @@ public function setCommentCount($count) public function setCommentLink($link) { if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); } $this->_data['commentLink'] = $link; @@ -324,11 +301,9 @@ public function setCommentLink($link) public function setCommentFeedLink(array $link) { if (!isset($link['uri']) || !is_string($link['uri']) || !Zend_Uri::check($link['uri'])) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); } if (!isset($link['type']) || !in_array($link['type'], array('atom', 'rss', 'rdf'))) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "type" must be one' . ' of "atom", "rss" or "rdf"'); } @@ -360,7 +335,6 @@ public function setCommentFeedLinks(array $links) public function setTitle($title) { if (empty($title) || !is_string($title)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['title'] = $title; @@ -545,7 +519,6 @@ public function getCommentFeedLinks() public function addCategory(array $category) { if (!isset($category['term'])) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Each category must be an array and ' . 'contain at least a "term" element containing the machine ' . ' readable category name'); @@ -555,7 +528,6 @@ public function addCategory(array $category) || !is_string($category['scheme']) || !Zend_Uri::check($category['scheme']) ) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('The Atom scheme or RSS domain of' . ' a category must be a valid URI'); } @@ -599,23 +571,18 @@ public function getCategories() public function setEnclosure(array $enclosure) { if (!isset($enclosure['type'])) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Enclosure "type" is not set'); } if (!isset($enclosure['length'])) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Enclosure "length" is not set'); } if (!isset($enclosure['uri'])) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Enclosure "uri" is not set'); } if (!Zend_Uri::check($enclosure['uri'])) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Enclosure "uri" is not a valid URI/IRI'); } if ((int) $enclosure['length'] <= 0) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Enclosure "length" must be an integer' . ' indicating the content\'s length in bytes'); } @@ -709,7 +676,6 @@ public function __call($method, $args) } catch (Zend_Feed_Writer_Exception_InvalidMethodException $e) { } } - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Method: ' . $method . ' does not exist and could not be located on a registered Extension'); } diff --git a/src/Writer/Exception/InvalidMethodException.php b/src/Writer/Exception/InvalidMethodException.php index 553c6249..94c5322e 100644 --- a/src/Writer/Exception/InvalidMethodException.php +++ b/src/Writer/Exception/InvalidMethodException.php @@ -20,18 +20,12 @@ * @version $Id$ */ - -/** - * @see Zend_Feed_Exception - */ -require_once 'Zend/Feed/Exception.php'; - - /** * Feed exceptions * * Class to represent exceptions that occur during Feed operations. * + * @uses Zend_Feed_Exception * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Writer/Extension/Atom/Renderer/Feed.php b/src/Writer/Extension/Atom/Renderer/Feed.php index 0429a15c..ca0a9277 100644 --- a/src/Writer/Extension/Atom/Renderer/Feed.php +++ b/src/Writer/Extension/Atom/Renderer/Feed.php @@ -20,11 +20,7 @@ */ /** - * @see Zend_Feed_Writer_Extension_RendererAbstract - */ -require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; - -/** + * @uses Zend_Feed_Writer_Extension_RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Writer/Extension/Content/Renderer/Entry.php b/src/Writer/Extension/Content/Renderer/Entry.php index e9699670..4fe8490d 100644 --- a/src/Writer/Extension/Content/Renderer/Entry.php +++ b/src/Writer/Extension/Content/Renderer/Entry.php @@ -20,11 +20,7 @@ */ /** - * @see Zend_Feed_Writer_Extension_RendererAbstract - */ -require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; - -/** + * @uses Zend_Feed_Writer_Extension_RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Writer/Extension/DublinCore/Renderer/Entry.php b/src/Writer/Extension/DublinCore/Renderer/Entry.php index 76a90a06..2d212e90 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Entry.php +++ b/src/Writer/Extension/DublinCore/Renderer/Entry.php @@ -20,11 +20,7 @@ */ /** - * @see Zend_Feed_Writer_Extension_RendererAbstract - */ -require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; - -/** + * @uses Zend_Feed_Writer_Extension_RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Writer/Extension/DublinCore/Renderer/Feed.php b/src/Writer/Extension/DublinCore/Renderer/Feed.php index a6b955ad..8816fa8c 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Feed.php +++ b/src/Writer/Extension/DublinCore/Renderer/Feed.php @@ -20,11 +20,7 @@ */ /** - * @see Zend_Feed_Writer_Extension_RendererAbstract - */ -require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; - -/** + * @uses Zend_Feed_Writer_Extension_RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Writer/Extension/ITunes/Entry.php b/src/Writer/Extension/ITunes/Entry.php index 91634e98..360a429e 100644 --- a/src/Writer/Extension/ITunes/Entry.php +++ b/src/Writer/Extension/ITunes/Entry.php @@ -20,6 +20,9 @@ */ /** + * @uses Zend_Feed_Exception + * @uses Zend_Feed_Writer + * @uses Zend_Feed_Writer_Exception_InvalidMethodException * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -72,12 +75,10 @@ public function getEncoding() public function setItunesBlock($value) { if (!ctype_alpha($value) && strlen($value) > 0) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "block" may only' . ' contain alphabetic characters'); } if (iconv_strlen($value, $this->getEncoding()) > 255) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "block" may only' . ' contain a maximum of 255 characters'); } @@ -107,7 +108,6 @@ public function addItunesAuthors(array $values) public function addItunesAuthor($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: any "author" may only' . ' contain a maximum of 255 characters each'); } @@ -131,7 +131,6 @@ public function setItunesDuration($value) && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value) ) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "duration" may only' . ' be of a specified [[HH:]MM:]SS format'); } @@ -148,7 +147,6 @@ public function setItunesDuration($value) public function setItunesExplicit($value) { if (!in_array($value, array('yes','no','clean'))) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "explicit" may only' . ' be one of "yes", "no" or "clean"'); } @@ -165,13 +163,11 @@ public function setItunesExplicit($value) public function setItunesKeywords(array $value) { if (count($value) > 12) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' . ' contain a maximum of 12 terms'); } $concat = implode(',', $value); if (iconv_strlen($concat, $this->getEncoding()) > 255) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' . ' have a concatenated length of 255 chars where terms are delimited' . ' by a comma'); @@ -189,7 +185,6 @@ public function setItunesKeywords(array $value) public function setItunesSubtitle($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "subtitle" may only' . ' contain a maximum of 255 characters'); } @@ -206,7 +201,6 @@ public function setItunesSubtitle($value) public function setItunesSummary($value) { if (iconv_strlen($value, $this->getEncoding()) > 4000) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "summary" may only' . ' contain a maximum of 4000 characters'); } @@ -227,7 +221,6 @@ public function __call($method, array $params) if (!method_exists($this, 'setItunes' . ucfirst($point)) && !method_exists($this, 'addItunes' . ucfirst($point)) ) { - require_once 'Zend/Feed/Writer/Exception/InvalidMethodException.php'; throw new Zend_Feed_Writer_Exception_InvalidMethodException( 'invalid method: ' . $method ); diff --git a/src/Writer/Extension/ITunes/Feed.php b/src/Writer/Extension/ITunes/Feed.php index 53801ecd..aa82003d 100644 --- a/src/Writer/Extension/ITunes/Feed.php +++ b/src/Writer/Extension/ITunes/Feed.php @@ -20,6 +20,10 @@ */ /** + * @uses Zend_Feed_Exception + * @uses Zend_Feed_Writer + * @uses Zend_Feed_Writer_Exception_InvalidMethodException + * @uses Zend_Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -72,12 +76,10 @@ public function getEncoding() public function setItunesBlock($value) { if (!ctype_alpha($value) && strlen($value) > 0) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "block" may only' . ' contain alphabetic characters'); } if (iconv_strlen($value, $this->getEncoding()) > 255) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "block" may only' . ' contain a maximum of 255 characters'); } @@ -108,7 +110,6 @@ public function addItunesAuthors(array $values) public function addItunesAuthor($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: any "author" may only' . ' contain a maximum of 255 characters each'); } @@ -133,21 +134,18 @@ public function setItunesCategories(array $values) foreach ($values as $key=>$value) { if (!is_array($value)) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: any "category" may only' . ' contain a maximum of 255 characters each'); } $this->_data['categories'][] = $value; } else { if (iconv_strlen($key, $this->getEncoding()) > 255) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: any "category" may only' . ' contain a maximum of 255 characters each'); } $this->_data['categories'][$key] = array(); foreach ($value as $val) { if (iconv_strlen($val, $this->getEncoding()) > 255) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: any "category" may only' . ' contain a maximum of 255 characters each'); } @@ -167,15 +165,13 @@ public function setItunesCategories(array $values) public function setItunesImage($value) { if (!Zend_Uri::check($value)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "image" may only' - . ' be a valid URI/IRI'); + . ' be a valid URI/IRI'); } if (!in_array(substr($value, -3), array('jpg','png'))) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "image" may only' - . ' use file extension "jpg" or "png" which must be the last three' - . ' characters of the URI (i.e. no query string or fragment)'); + . ' use file extension "jpg" or "png" which must be the last three' + . ' characters of the URI (i.e. no query string or fragment)'); } $this->_data['image'] = $value; return $this; @@ -194,9 +190,8 @@ public function setItunesDuration($value) && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value) ) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "duration" may only' - . ' be of a specified [[HH:]MM:]SS format'); + . ' be of a specified [[HH:]MM:]SS format'); } $this->_data['duration'] = $value; return $this; @@ -211,9 +206,8 @@ public function setItunesDuration($value) public function setItunesExplicit($value) { if (!in_array($value, array('yes','no','clean'))) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "explicit" may only' - . ' be one of "yes", "no" or "clean"'); + . ' be one of "yes", "no" or "clean"'); } $this->_data['explicit'] = $value; return $this; @@ -228,16 +222,14 @@ public function setItunesExplicit($value) public function setItunesKeywords(array $value) { if (count($value) > 12) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' - . ' contain a maximum of 12 terms'); + . ' contain a maximum of 12 terms'); } $concat = implode(',', $value); if (iconv_strlen($concat, $this->getEncoding()) > 255) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' - . ' have a concatenated length of 255 chars where terms are delimited' - . ' by a comma'); + . ' have a concatenated length of 255 chars where terms are delimited' + . ' by a comma'); } $this->_data['keywords'] = $value; return $this; @@ -252,9 +244,8 @@ public function setItunesKeywords(array $value) public function setItunesNewFeedUrl($value) { if (!Zend_Uri::check($value)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "newFeedUrl" may only' - . ' be a valid URI/IRI'); + . ' be a valid URI/IRI'); } $this->_data['newFeedUrl'] = $value; return $this; @@ -283,16 +274,14 @@ public function addItunesOwners(array $values) public function addItunesOwner(array $value) { if (!isset($value['name']) || !isset($value['email'])) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: any "owner" must' - . ' be an array containing keys "name" and "email"'); + . ' be an array containing keys "name" and "email"'); } if (iconv_strlen($value['name'], $this->getEncoding()) > 255 || iconv_strlen($value['email'], $this->getEncoding()) > 255 ) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: any "owner" may only' - . ' contain a maximum of 255 characters each for "name" and "email"'); + . ' contain a maximum of 255 characters each for "name" and "email"'); } if (!isset($this->_data['owners'])) { $this->_data['owners'] = array(); @@ -310,9 +299,8 @@ public function addItunesOwner(array $value) public function setItunesSubtitle($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "subtitle" may only' - . ' contain a maximum of 255 characters'); + . ' contain a maximum of 255 characters'); } $this->_data['subtitle'] = $value; return $this; @@ -327,9 +315,8 @@ public function setItunesSubtitle($value) public function setItunesSummary($value) { if (iconv_strlen($value, $this->getEncoding()) > 4000) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "summary" may only' - . ' contain a maximum of 4000 characters'); + . ' contain a maximum of 4000 characters'); } $this->_data['summary'] = $value; return $this; @@ -348,7 +335,6 @@ public function __call($method, array $params) if (!method_exists($this, 'setItunes' . ucfirst($point)) && !method_exists($this, 'addItunes' . ucfirst($point)) ) { - require_once 'Zend/Feed/Writer/Exception/InvalidMethodException.php'; throw new Zend_Feed_Writer_Exception_InvalidMethodException( 'invalid method: ' . $method ); diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php index a300ff1b..ed6c7fb0 100644 --- a/src/Writer/Extension/ITunes/Renderer/Entry.php +++ b/src/Writer/Extension/ITunes/Renderer/Entry.php @@ -20,11 +20,7 @@ */ /** - * @see Zend_Feed_Writer_Extension_RendererAbstract - */ -require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; - -/** + * @uses Zend_Feed_Writer_Extension_RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php index 236d6af8..16e89d01 100644 --- a/src/Writer/Extension/ITunes/Renderer/Feed.php +++ b/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -20,11 +20,7 @@ */ /** - * @see Zend_Feed_Writer_Extension_RendererAbstract - */ -require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; - -/** + * @uses Zend_Feed_Writer_Extension_RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Writer/Extension/RendererAbstract.php b/src/Writer/Extension/RendererAbstract.php index f1ec2c02..be05abe0 100644 --- a/src/Writer/Extension/RendererAbstract.php +++ b/src/Writer/Extension/RendererAbstract.php @@ -20,11 +20,7 @@ */ /** - * @see Zend_Feed_Writer_Extension_RendererInterface - */ -require_once 'Zend/Feed/Writer/Extension/RendererInterface.php'; - - /** + * @uses Zend_Feed_Writer_Extension_RendererInterface * @category Zend * @package Zend_Feed_Writer_Entry_Rss * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Writer/Extension/Slash/Renderer/Entry.php b/src/Writer/Extension/Slash/Renderer/Entry.php index aa5cc23c..c98f6ebd 100644 --- a/src/Writer/Extension/Slash/Renderer/Entry.php +++ b/src/Writer/Extension/Slash/Renderer/Entry.php @@ -20,11 +20,7 @@ */ /** - * @see Zend_Feed_Writer_Extension_RendererAbstract - */ -require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; - -/** + * @uses Zend_Feed_Writer_Extension_RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php index 93a3666e..acb7d794 100644 --- a/src/Writer/Extension/Threading/Renderer/Entry.php +++ b/src/Writer/Extension/Threading/Renderer/Entry.php @@ -20,11 +20,7 @@ */ /** - * @see Zend_Feed_Writer_Extension_RendererAbstract - */ -require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; - -/** + * @uses Zend_Feed_Writer_Extension_RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php index 61ba013e..8afbea46 100644 --- a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php +++ b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php @@ -20,11 +20,7 @@ */ /** - * @see Zend_Feed_Writer_Extension_RendererAbstract - */ -require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; - -/** + * @uses Zend_Feed_Writer_Extension_RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Writer/Feed.php b/src/Writer/Feed.php index 312828d8..329861f9 100644 --- a/src/Writer/Feed.php +++ b/src/Writer/Feed.php @@ -20,50 +20,25 @@ */ /** - * @see Zend_Date - */ -require_once 'Zend/Date.php'; - -/** - * @see Zend_Date - */ -require_once 'Zend/Uri.php'; - -/** - * @see Zend_Feed_Writer - */ -require_once 'Zend/Feed/Writer.php'; - -/** - * @see Zend_Feed_Writer_Entry - */ -require_once 'Zend/Feed/Writer/Entry.php'; - -/** - * @see Zend_Feed_Writer_Deleted - */ -require_once 'Zend/Feed/Writer/Deleted.php'; - -/** - * @see Zend_Feed_Writer_Renderer_Feed_Atom - */ -require_once 'Zend/Feed/Writer/Renderer/Feed/Atom.php'; - -/** - * @see Zend_Feed_Writer_Renderer_Feed_Rss - */ -require_once 'Zend/Feed/Writer/Renderer/Feed/Rss.php'; - -require_once 'Zend/Feed/Writer/Feed/FeedAbstract.php'; - -/** + * @uses Countable + * @uses Iterator + * @uses Zend_Date + * @uses Zend_Feed_Exception + * @uses Zend_Feed_Writer + * @uses Zend_Feed_Writer_Deleted + * @uses Zend_Feed_Writer_Entry + * @uses Zend_Feed_Writer_Feed_FeedAbstract + * @uses Zend_Feed_Writer_Renderer_Feed_Atom + * @uses Zend_Feed_Writer_Renderer_Feed_Rss + * @uses Zend_Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Feed extends Zend_Feed_Writer_Feed_FeedAbstract -implements Iterator, Countable +class Zend_Feed_Writer_Feed + extends Zend_Feed_Writer_Feed_FeedAbstract + implements Iterator, Countable { /** @@ -147,7 +122,6 @@ public function removeEntry($index) if (isset($this->_entries[$index])) { unset($this->_entries[$index]); } - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Undefined index: ' . $index . '. Entry does not exist.'); } @@ -162,7 +136,6 @@ public function getEntry($index = 0) if (isset($this->_entries[$index])) { return $this->_entries[$index]; } - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Undefined index: ' . $index . '. Entry does not exist.'); } @@ -266,7 +239,6 @@ public function export($type, $ignoreExceptions = false) $this->setType(strtolower($type)); $type = ucfirst($this->getType()); if ($type !== 'Rss' && $type !== 'Atom') { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid feed type specified: ' . $type . '.' . ' Should be one of "rss" or "atom".'); } diff --git a/src/Writer/Feed/FeedAbstract.php b/src/Writer/Feed/FeedAbstract.php index 74eae94b..78ca9f6d 100644 --- a/src/Writer/Feed/FeedAbstract.php +++ b/src/Writer/Feed/FeedAbstract.php @@ -20,36 +20,13 @@ */ /** - * @see Zend_Date - */ -require_once 'Zend/Date.php'; - -/** - * @see Zend_Date - */ -require_once 'Zend/Uri.php'; - -/** - * @see Zend_Feed_Writer - */ -require_once 'Zend/Feed/Writer.php'; - -/** - * @see Zend_Feed_Writer_Entry - */ -require_once 'Zend/Feed/Writer/Entry.php'; - -/** - * @see Zend_Feed_Writer_Renderer_Feed_Atom - */ -require_once 'Zend/Feed/Writer/Renderer/Feed/Atom.php'; - -/** - * @see Zend_Feed_Writer_Renderer_Feed_Rss - */ -require_once 'Zend/Feed/Writer/Renderer/Feed/Rss.php'; - -/** + * @uses Zend_Date + * @uses Zend_Feed_Exception + * @uses Zend_Feed_Writer + * @uses Zend_Feed_Writer_Entry + * @uses Zend_Feed_Writer_Renderer_Feed_Atom + * @uses Zend_Feed_Writer_Renderer_Feed_Rss + * @uses Zend_Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -95,40 +72,34 @@ public function addAuthor($name, $email = null, $uri = null) $author = array(); if (is_array($name)) { if (!array_key_exists('name', $name) || empty($name['name']) || !is_string($name['name'])) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); } $author['name'] = $name['name']; if (isset($name['email'])) { if (empty($name['email']) || !is_string($name['email'])) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); } $author['email'] = $name['email']; } if (isset($name['uri'])) { if (empty($name['uri']) || !is_string($name['uri']) || !Zend_Uri::check($name['uri'])) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $name['uri']; } } else { if (empty($name['name']) || !is_string($name['name'])) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string value'); } $author['name'] = $name; if (isset($email)) { if (empty($email) || !is_string($email)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "email" value must be a non-empty string'); } $author['email'] = $email; } if (isset($uri)) { if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $uri; @@ -157,7 +128,6 @@ public function addAuthors(array $authors) public function setCopyright($copyright) { if (empty($copyright) || !is_string($copyright)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['copyright'] = $copyright; @@ -178,7 +148,6 @@ public function setDateCreated($date = null) } elseif ($date instanceof Zend_Date) { $zdate = $date; } else { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateCreated'] = $zdate; @@ -199,7 +168,6 @@ public function setDateModified($date = null) } elseif ($date instanceof Zend_Date) { $zdate = $date; } else { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateModified'] = $zdate; @@ -213,7 +181,6 @@ public function setDateModified($date = null) public function setDescription($description) { if (empty($description) || !is_string($description)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['description'] = $description; @@ -227,20 +194,17 @@ public function setDescription($description) public function setGenerator($name, $version = null, $uri = null) { if (empty($name) || !is_string($name)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string'); } $generator = array('name' => $name); if (isset($version)) { if (empty($version) || !is_string($version)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "version" must be a non-empty string'); } $generator['version'] = $version; } if (isset($uri)) { if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); } $generator['uri'] = $uri; @@ -257,7 +221,6 @@ public function setId($id) { if ((empty($id) || !is_string($id) || !Zend_Uri::check($id)) && !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['id'] = $id; @@ -271,7 +234,6 @@ public function setId($id) public function setLanguage($language) { if (empty($language) || !is_string($language)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['language'] = $language; @@ -285,7 +247,6 @@ public function setLanguage($language) public function setLink($link) { if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['link'] = $link; @@ -299,11 +260,9 @@ public function setLink($link) public function setFeedLink($link, $type) { if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "link"" must be a non-empty string and valid URI/IRI'); } if (!in_array(strtolower($type), array('rss', 'rdf', 'atom'))) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom'); } $this->_data['feedLinks'][strtolower($type)] = $link; @@ -317,7 +276,6 @@ public function setFeedLink($link, $type) public function setTitle($title) { if (empty($title) || !is_string($title)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['title'] = $title; @@ -331,7 +289,6 @@ public function setTitle($title) public function setEncoding($encoding) { if (empty($encoding) || !is_string($encoding)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['encoding'] = $encoding; @@ -345,7 +302,6 @@ public function setEncoding($encoding) public function setBaseUrl($url) { if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "url" array value' . ' must be a non-empty string and valid URI/IRI'); } @@ -360,7 +316,6 @@ public function setBaseUrl($url) public function addHub($url) { if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "url" array value' . ' must be a non-empty string and valid URI/IRI'); } @@ -390,7 +345,6 @@ public function addHubs(array $urls) public function addCategory(array $category) { if (!isset($category['term'])) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Each category must be an array and ' . 'contain at least a "term" element containing the machine ' . ' readable category name'); @@ -400,7 +354,6 @@ public function addCategory(array $category) || !is_string($category['scheme']) || !Zend_Uri::check($category['scheme']) ) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('The Atom scheme or RSS domain of' . ' a category must be a valid URI'); } @@ -693,7 +646,6 @@ public function __call($method, $args) } catch (Zend_Feed_Writer_Exception_InvalidMethodException $e) { } } - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Method: ' . $method . ' does not exist and could not be located on a registered Extension'); } diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom.php index 2a4dbfa4..a602ef0e 100644 --- a/src/Writer/Renderer/Entry/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -20,13 +20,15 @@ */ /** - * @see Zend_Feed_Writer_Renderer_RendererAbstract - */ -require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php'; - -require_once 'Zend/Feed/Writer/Renderer/Feed/Atom/Source.php'; - -/** + * @uses DOMDocument + * @uses Zend_Date + * @uses Zend_Feed_Exception + * @uses Zend_Feed_Writer + * @uses Zend_Feed_Writer_Renderer_Feed_Atom_Source + * @uses Zend_Feed_Writer_Renderer_RendererAbstract + * @uses Zend_Feed_Writer_Renderer_RendererInterface + * @uses Zend_Uri + * @uses tidy * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -91,9 +93,8 @@ public function render() protected function _setTitle(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getTitle()) { - require_once 'Zend/Feed/Exception.php'; $message = 'Atom 1.0 entry elements MUST contain exactly one' - . ' atom:title element but a title has not been set'; + . ' atom:title element but a title has not been set'; $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; @@ -140,9 +141,8 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) protected function _setDateModified(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateModified()) { - require_once 'Zend/Feed/Exception.php'; $message = 'Atom 1.0 entry elements MUST contain exactly one' - . ' atom:updated element but a modification date has not been set'; + . ' atom:updated element but a modification date has not been set'; $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; @@ -263,11 +263,10 @@ protected function _setId(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getId() && !$this->getDataContainer()->getLink()) { - require_once 'Zend/Feed/Exception.php'; $message = 'Atom 1.0 entry elements MUST contain exactly one ' - . 'atom:id element, or as an alternative, we can use the same ' - . 'value as atom:link however neither a suitable link nor an ' - . 'id have been set'; + . 'atom:id element, or as an alternative, we can use the same ' + . 'value as atom:link however neither a suitable link nor an ' + . 'id have been set'; $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; @@ -283,7 +282,6 @@ protected function _setId(DOMDocument $dom, DOMElement $root) } if (!Zend_Uri::check($this->getDataContainer()->getId()) && !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $this->getDataContainer()->getId())) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Atom 1.0 IDs must be a valid URI/IRI'); } $id = $dom->createElement('id'); @@ -303,11 +301,10 @@ protected function _setContent(DOMDocument $dom, DOMElement $root) { $content = $this->getDataContainer()->getContent(); if (!$content && !$this->getDataContainer()->getLink()) { - require_once 'Zend/Feed/Exception.php'; $message = 'Atom 1.0 entry elements MUST contain exactly one ' - . 'atom:content element, or as an alternative, at least one link ' - . 'with a rel attribute of "alternate" to indicate an alternate ' - . 'method to consume the content.'; + . 'atom:content element, or as an alternative, at least one link ' + . 'with a rel attribute of "alternate" to indicate an alternate ' + . 'method to consume the content.'; $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; diff --git a/src/Writer/Renderer/Entry/Atom/Deleted.php b/src/Writer/Renderer/Entry/Atom/Deleted.php index 8902625f..072f959f 100644 --- a/src/Writer/Renderer/Entry/Atom/Deleted.php +++ b/src/Writer/Renderer/Entry/Atom/Deleted.php @@ -20,11 +20,10 @@ */ /** - * @see Zend_Feed_Writer_Renderer_RendererAbstract - */ -require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php'; - -/** + * @uses DOMDocument + * @uses Zend_Date + * @uses Zend_Feed_Writer_Renderer_RendererAbstract + * @uses Zend_Feed_Writer_Renderer_RendererInterface * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Writer/Renderer/Entry/Rss.php b/src/Writer/Renderer/Entry/Rss.php index 50da5f5d..d58548a0 100644 --- a/src/Writer/Renderer/Entry/Rss.php +++ b/src/Writer/Renderer/Entry/Rss.php @@ -20,11 +20,11 @@ */ /** - * @see Zend_Feed_Writer_Renderer_RendererAbstract - */ -require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php'; - -/** + * @uses Zend_Date + * @uses Zend_Feed_Exception + * @uses Zend_Feed_Writer_Renderer_RendererAbstract + * @uses Zend_Feed_Writer_Renderer_RendererInterface + * @uses Zend_Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -89,10 +89,9 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDescription() && !$this->getDataContainer()->getTitle()) { - require_once 'Zend/Feed/Exception.php'; $message = 'RSS 2.0 entry elements SHOULD contain exactly one' - . ' title element but a title has not been set. In addition, there' - . ' is no description as required in the absence of a title.'; + . ' title element but a title has not been set. In addition, there' + . ' is no description as required in the absence of a title.'; $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; @@ -118,11 +117,10 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDescription() && !$this->getDataContainer()->getTitle()) { - require_once 'Zend/Feed/Exception.php'; $message = 'RSS 2.0 entry elements SHOULD contain exactly one' - . ' description element but a description has not been set. In' - . ' addition, there is no title element as required in the absence' - . ' of a description.'; + . ' description element but a description has not been set. In' + . ' addition, there is no title element as required in the absence' + . ' of a description.'; $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; diff --git a/src/Writer/Renderer/Feed/Atom.php b/src/Writer/Renderer/Feed/Atom.php index d743c63e..fb4b81df 100644 --- a/src/Writer/Renderer/Feed/Atom.php +++ b/src/Writer/Renderer/Feed/Atom.php @@ -19,27 +19,16 @@ * @version $Id$ */ -/** @see Zend_Feed_Writer_Feed */ -require_once 'Zend/Feed/Writer/Feed.php'; - -/** @see Zend_Version */ -require_once 'Zend/Version.php'; - -/** @see Zend_Feed_Writer_Renderer_RendererInterface */ -require_once 'Zend/Feed/Writer/Renderer/RendererInterface.php'; - -/** @see Zend_Feed_Writer_Renderer_Entry_Atom */ -require_once 'Zend/Feed/Writer/Renderer/Entry/Atom.php'; - -/** @see Zend_Feed_Writer_Renderer_Entry_Atom_Deleted */ -require_once 'Zend/Feed/Writer/Renderer/Entry/Atom/Deleted.php'; - -/** @see Zend_Feed_Writer_Renderer_RendererAbstract */ -require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php'; - -require_once 'Zend/Feed/Writer/Renderer/Feed/Atom/AtomAbstract.php'; - /** + * @uses DOMDocument + * @uses Zend_Feed_Writer + * @uses Zend_Feed_Writer_Feed + * @uses Zend_Feed_Writer_Renderer_Entry_Atom + * @uses Zend_Feed_Writer_Renderer_Entry_Atom_Deleted + * @uses Zend_Feed_Writer_Renderer_Feed_Atom_AtomAbstract + * @uses Zend_Feed_Writer_Renderer_RendererAbstract + * @uses Zend_Feed_Writer_Renderer_RendererInterface + * @uses Zend_Version * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Writer/Renderer/Feed/Atom/AtomAbstract.php b/src/Writer/Renderer/Feed/Atom/AtomAbstract.php index dbd04bf3..c6ba71e0 100644 --- a/src/Writer/Renderer/Feed/Atom/AtomAbstract.php +++ b/src/Writer/Renderer/Feed/Atom/AtomAbstract.php @@ -19,22 +19,14 @@ * @version $Id$ */ -/** @see Zend_Feed_Writer_Feed */ -require_once 'Zend/Feed/Writer/Feed.php'; - -/** @see Zend_Version */ -require_once 'Zend/Version.php'; - -/** @see Zend_Feed_Writer_Renderer_RendererInterface */ -require_once 'Zend/Feed/Writer/Renderer/RendererInterface.php'; - -/** @see Zend_Feed_Writer_Renderer_Entry_Atom */ -require_once 'Zend/Feed/Writer/Renderer/Entry/Atom.php'; - -/** @see Zend_Feed_Writer_Renderer_RendererAbstract */ -require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php'; - /** + * @uses Zend_Date + * @uses Zend_Feed_Exception + * @uses Zend_Feed_Writer_Feed + * @uses Zend_Feed_Writer_Renderer_Entry_Atom + * @uses Zend_Feed_Writer_Renderer_RendererAbstract + * @uses Zend_Feed_Writer_Renderer_RendererInterface + * @uses Zend_Version * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -79,9 +71,8 @@ protected function _setLanguage(DOMDocument $dom, DOMElement $root) protected function _setTitle(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getTitle()) { - require_once 'Zend/Feed/Exception.php'; $message = 'Atom 1.0 feed elements MUST contain exactly one' - . ' atom:title element but a title has not been set'; + . ' atom:title element but a title has not been set'; $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; @@ -127,9 +118,8 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) protected function _setDateModified(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateModified()) { - require_once 'Zend/Feed/Exception.php'; $message = 'Atom 1.0 feed elements MUST contain exactly one' - . ' atom:updated element but a modification date has not been set'; + . ' atom:updated element but a modification date has not been set'; $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; @@ -204,11 +194,10 @@ protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) { $flinks = $this->getDataContainer()->getFeedLinks(); if(!$flinks || !array_key_exists('atom', $flinks)) { - require_once 'Zend/Feed/Exception.php'; $message = 'Atom 1.0 feed elements SHOULD contain one atom:link ' - . 'element with a rel attribute value of "self". This is the ' - . 'preferred URI for retrieving Atom Feed Documents representing ' - . 'this Atom feed but a feed link has not been set'; + . 'element with a rel attribute value of "self". This is the ' + . 'preferred URI for retrieving Atom Feed Documents representing ' + . 'this Atom feed but a feed link has not been set'; $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; @@ -279,11 +268,10 @@ protected function _setId(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getId() && !$this->getDataContainer()->getLink()) { - require_once 'Zend/Feed/Exception.php'; $message = 'Atom 1.0 feed elements MUST contain exactly one ' - . 'atom:id element, or as an alternative, we can use the same ' - . 'value as atom:link however neither a suitable link nor an ' - . 'id have been set'; + . 'atom:id element, or as an alternative, we can use the same ' + . 'value as atom:link however neither a suitable link nor an ' + . 'id have been set'; $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; diff --git a/src/Writer/Renderer/Feed/Atom/Source.php b/src/Writer/Renderer/Feed/Atom/Source.php index 9d078f2b..2008348e 100644 --- a/src/Writer/Renderer/Feed/Atom/Source.php +++ b/src/Writer/Renderer/Feed/Atom/Source.php @@ -19,9 +19,10 @@ * @version $Id$ */ -require_once 'Zend/Feed/Writer/Renderer/Feed/Atom/AtomAbstract.php'; - /** + * @uses DOMDocument + * @uses Zend_Feed_Writer_Renderer_Feed_Atom_AtomAbstract + * @uses Zend_Feed_Writer_Renderer_RendererInterface * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index 53026630..6b230d6e 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -19,22 +19,16 @@ * @version $Id$ */ -/** @see Zend_Feed_Writer_Feed */ -require_once 'Zend/Feed/Writer/Feed.php'; - -/** @see Zend_Version */ -require_once 'Zend/Version.php'; - -/** @see Zend_Feed_Writer_Renderer_RendererInterface */ -require_once 'Zend/Feed/Writer/Renderer/RendererInterface.php'; - -/** @see Zend_Feed_Writer_Renderer_Entry_Rss */ -require_once 'Zend/Feed/Writer/Renderer/Entry/Rss.php'; - -/** @see Zend_Feed_Writer_Renderer_RendererAbstract */ -require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php'; - /** + * @uses DOMDocument + * @uses Zend_Date + * @uses Zend_Feed_Exception + * @uses Zend_Feed_Writer_Feed + * @uses Zend_Feed_Writer_Renderer_Entry_Rss + * @uses Zend_Feed_Writer_Renderer_RendererAbstract + * @uses Zend_Feed_Writer_Renderer_RendererInterface + * @uses Zend_Uri + * @uses Zend_Version * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -144,9 +138,8 @@ protected function _setLanguage(DOMDocument $dom, DOMElement $root) protected function _setTitle(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getTitle()) { - require_once 'Zend/Feed/Exception.php'; $message = 'RSS 2.0 feed elements MUST contain exactly one' - . ' title element but a title has not been set'; + . ' title element but a title has not been set'; $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; @@ -172,9 +165,8 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) protected function _setDescription(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDescription()) { - require_once 'Zend/Feed/Exception.php'; $message = 'RSS 2.0 feed elements MUST contain exactly one' - . ' description element but one has not been set'; + . ' description element but one has not been set'; $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; @@ -249,9 +241,8 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) { $value = $this->getDataContainer()->getLink(); if(!$value) { - require_once 'Zend/Feed/Exception.php'; $message = 'RSS 2.0 feed elements MUST contain exactly one' - . ' link element but one has not been set'; + . ' link element but one has not been set'; $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; diff --git a/src/Writer/Renderer/RendererAbstract.php b/src/Writer/Renderer/RendererAbstract.php index 7fbcc911..e8268353 100644 --- a/src/Writer/Renderer/RendererAbstract.php +++ b/src/Writer/Renderer/RendererAbstract.php @@ -19,13 +19,10 @@ * @version $Id$ */ -/** @see Zend_Feed_Writer */ -require_once 'Zend/Feed/Writer.php'; - -/** @see Zend_Version */ -require_once 'Zend/Version.php'; - /** + * @uses Zend_Feed_Exception + * @uses Zend_Feed_Writer + * @uses Zend_Version * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -163,7 +160,6 @@ public function getEncoding() public function ignoreExceptions($bool = true) { if (!is_bool($bool)) { - require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: $bool. Should be TRUE or FALSE (defaults to TRUE if null)'); } $this->_ignoreExceptions = $bool; diff --git a/src/Writer/Source.php b/src/Writer/Source.php index 119dc0fa..2281bf02 100644 --- a/src/Writer/Source.php +++ b/src/Writer/Source.php @@ -19,9 +19,8 @@ * @version $Id$ */ -require_once 'Zend/Feed/Writer/Feed/FeedAbstract.php'; - - /** +/** + * @uses Zend_Feed_Writer_Feed_FeedAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) From 6232998df4b27d30a7f9b1a9b8ba740fa5a5f33d Mon Sep 17 00:00:00 2001 From: matthew Date: Mon, 8 Mar 2010 20:36:57 +0000 Subject: [PATCH 120/238] [2.0] Updated test suite - Created phpunit.xml - Renamed TestHelper.php Bootstrap.php; latter now referenced in phpunit.xml - Uses autoloading - Stripped require_once calls globally (will need to run individual groups iteratively to determine if any test caes are missing necessary calls) - Controller tests now run (but 4 new errors) git-svn-id: http://framework.zend.com/svn/framework/standard/branches/development-2.0@21390 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/AllTests.php | 141 ------------------ test/ArrayAccessTest.php | 2 - test/AtomEntryOnlyTest.php | 3 - test/AtomPublishingTest.php | 3 - test/CountTest.php | 2 - test/ElementTest.php | 2 - test/Entry/RssTest.php | 2 - test/ImportTest.php | 5 - test/IteratorTest.php | 2 - test/Pubsubhubbub/AllTests.php | 67 --------- test/Pubsubhubbub/PublisherTest.php | 2 - test/Pubsubhubbub/PubsubhubbubTest.php | 2 - test/Pubsubhubbub/Subscriber/CallbackTest.php | 3 - test/Pubsubhubbub/SubscriberHttpTest.php | 5 - test/Pubsubhubbub/SubscriberTest.php | 3 - test/Reader/Entry/AtomStandaloneEntryTest.php | 2 - test/Reader/Entry/AtomTest.php | 2 - test/Reader/Entry/CommonTest.php | 2 - test/Reader/Entry/RssTest.php | 2 - test/Reader/Feed/AtomSourceTest.php | 2 - test/Reader/Feed/AtomTest.php | 2 - test/Reader/Feed/CommonTest.php | 3 - test/Reader/Feed/RssTest.php | 3 - .../Integration/H-OnlineComAtom10Test.php | 2 - test/Reader/Integration/LautDeRdfTest.php | 2 - test/Reader/Integration/PodcastRss2Test.php | 3 - .../Integration/WordpressAtom10Test.php | 2 - .../Integration/WordpressRss2DcAtomTest.php | 2 - .../_files/My/Extension/JungleBooks/Entry.php | 2 - .../_files/My/Extension/JungleBooks/Feed.php | 1 - test/ReaderTest.php | 3 - test/Writer/DeletedTest.php | 2 - test/Writer/EntryTest.php | 2 - test/Writer/Extension/ITunes/EntryTest.php | 2 - test/Writer/Extension/ITunes/FeedTest.php | 2 - test/Writer/FeedTest.php | 2 - test/Writer/Renderer/Entry/AtomTest.php | 4 - test/Writer/Renderer/Entry/RssTest.php | 4 - test/Writer/Renderer/Feed/AtomTest.php | 4 - test/Writer/Renderer/Feed/RssTest.php | 4 - 40 files changed, 305 deletions(-) delete mode 100644 test/AllTests.php delete mode 100644 test/Pubsubhubbub/AllTests.php diff --git a/test/AllTests.php b/test/AllTests.php deleted file mode 100644 index e45205e9..00000000 --- a/test/AllTests.php +++ /dev/null @@ -1,141 +0,0 @@ -addTestSuite('Zend_Feed_ArrayAccessTest'); - $suite->addTestSuite('Zend_Feed_AtomEntryOnlyTest'); - $suite->addTestSuite('Zend_Feed_AtomPublishingTest'); - $suite->addTestSuite('Zend_Feed_CountTest'); - $suite->addTestSuite('Zend_Feed_ElementTest'); - $suite->addTestSuite('Zend_Feed_ImportTest'); - $suite->addTestSuite('Zend_Feed_IteratorTest'); - $suite->addTestSuite('Zend_Feed_Entry_RssTest'); - - /* Zend_Feed_Reader tests */ - // Base parent class - $suite->addTestSuite('Zend_Feed_ReaderTest'); - // RSS - Feed Level - $suite->addTestSuite('Zend_Feed_Reader_Feed_RssTest'); - // RSS - Item Level - $suite->addTestSuite('Zend_Feed_Reader_Entry_RssTest'); - // ATOM - Feed Level - $suite->addTestSuite('Zend_Feed_Reader_Feed_AtomTest'); - // ATOM - Item Level - $suite->addTestSuite('Zend_Feed_Reader_Entry_AtomTest'); - // COMMON - Feed Level - $suite->addTestSuite('Zend_Feed_Reader_Feed_CommonTest'); - // COMMON - Entry Level - $suite->addTestSuite('Zend_Feed_Reader_Entry_CommonTest'); - // ATOM - Entry Level (Source Feed Metadata) - $suite->addTestSuite('Zend_Feed_Reader_Feed_AtomSourceTest'); - // ATOM - Entry Level (Standalone Entry Documents) - $suite->addTestSuite('Zend_Feed_Reader_Entry_AtomStandaloneEntryTest'); - /** - * Real World Feed Tests - */ - $suite->addTestSuite('Zend_Feed_Reader_Integration_WordpressRss2DcAtomTest'); - $suite->addTestSuite('Zend_Feed_Reader_Integration_WordpressAtom10Test'); - $suite->addTestSuite('Zend_Feed_Reader_Integration_LautDeRdfTest'); - $suite->addTestSuite('Zend_Feed_Reader_Integration_HOnlineComAtom10Test'); - - $suite->addTestSuite('Zend_Feed_Writer_FeedTest'); - $suite->addTestSuite('Zend_Feed_Writer_EntryTest'); - $suite->addTestSuite('Zend_Feed_Writer_DeletedTest'); - $suite->addTestSuite('Zend_Feed_Writer_Renderer_Feed_AtomTest'); - $suite->addTestSuite('Zend_Feed_Writer_Renderer_Feed_RssTest'); - $suite->addTestSuite('Zend_Feed_Writer_Renderer_Entry_AtomTest'); - $suite->addTestSuite('Zend_Feed_Writer_Renderer_Entry_RssTest'); - - $suite->addTestSuite('Zend_Feed_Writer_Extension_ITunes_EntryTest'); - $suite->addTestSuite('Zend_Feed_Writer_Extension_ITunes_FeedTest'); - - $suite->addTest(Zend_Feed_Pubsubhubbub_AllTests::suite()); - - return $suite; - } -} - -if (PHPUnit_MAIN_METHOD == 'Zend_Feed_AllTests::main') { - Zend_Feed_AllTests::main(); -} diff --git a/test/ArrayAccessTest.php b/test/ArrayAccessTest.php index 605652c7..19ee8b10 100644 --- a/test/ArrayAccessTest.php +++ b/test/ArrayAccessTest.php @@ -23,12 +23,10 @@ /** * Test helper */ -require_once dirname(__FILE__) . '/../../TestHelper.php'; /** * @see Zend_Feed */ -require_once 'Zend/Feed.php'; /** * @category Zend diff --git a/test/AtomEntryOnlyTest.php b/test/AtomEntryOnlyTest.php index b8753b80..50c980b4 100644 --- a/test/AtomEntryOnlyTest.php +++ b/test/AtomEntryOnlyTest.php @@ -23,17 +23,14 @@ /** * Test helper */ -require_once dirname(__FILE__) . '/../../TestHelper.php'; /** * @see Zend_Feed */ -require_once 'Zend/Feed.php'; /** * @see Zend_Feed_Atom */ -require_once 'Zend/Feed/Atom.php'; /** * @category Zend diff --git a/test/AtomPublishingTest.php b/test/AtomPublishingTest.php index e5e62b64..6d0938cb 100644 --- a/test/AtomPublishingTest.php +++ b/test/AtomPublishingTest.php @@ -23,17 +23,14 @@ /** * Test helper */ -require_once dirname(__FILE__) . '/../../TestHelper.php'; /** * @see Zend_Feed_Entry_Atom */ -require_once 'Zend/Feed/Entry/Atom.php'; /** * @see Zend_Http_Client_File */ -require_once 'Zend/Http/Client.php'; /** * @category Zend diff --git a/test/CountTest.php b/test/CountTest.php index ea6f7c7f..7035d611 100644 --- a/test/CountTest.php +++ b/test/CountTest.php @@ -23,12 +23,10 @@ /** * Test helper */ -require_once dirname(__FILE__) . '/../../TestHelper.php'; /** * @see Zend_Feed */ -require_once 'Zend/Feed.php'; /** * @category Zend diff --git a/test/ElementTest.php b/test/ElementTest.php index 9f492905..3a9e81e1 100644 --- a/test/ElementTest.php +++ b/test/ElementTest.php @@ -23,12 +23,10 @@ /** * Test helper */ -require_once dirname(__FILE__) . '/../../TestHelper.php'; /** * @see Zend_Feed_Entry_Atom */ -require_once 'Zend/Feed/Entry/Atom.php'; /** * @category Zend diff --git a/test/Entry/RssTest.php b/test/Entry/RssTest.php index 2ee921e4..bc1b7aa6 100644 --- a/test/Entry/RssTest.php +++ b/test/Entry/RssTest.php @@ -23,12 +23,10 @@ /** * Test helper */ -require_once dirname(__FILE__) . '/../../../TestHelper.php'; /** * @see Zend_Feed */ -require_once 'Zend/Feed.php'; /** * @category Zend diff --git a/test/ImportTest.php b/test/ImportTest.php index b687ae67..b3eb7d08 100644 --- a/test/ImportTest.php +++ b/test/ImportTest.php @@ -23,27 +23,22 @@ /** * Test helper */ -require_once dirname(__FILE__) . '/../../TestHelper.php'; /** * @see Zend_Feed */ -require_once 'Zend/Feed.php'; /** * @see Zend_Feed_Builder */ -require_once 'Zend/Feed/Builder.php'; /** * @see Zend_Http_Client_Adapter_Test */ -require_once 'Zend/Http/Client/Adapter/Test.php'; /** * @see Zend_Http_Client */ -require_once 'Zend/Http/Client.php'; /** * @category Zend diff --git a/test/IteratorTest.php b/test/IteratorTest.php index 017dd1e9..cb8851c7 100644 --- a/test/IteratorTest.php +++ b/test/IteratorTest.php @@ -23,12 +23,10 @@ /** * Test helper */ -require_once dirname(__FILE__) . '/../../TestHelper.php'; /** * @see Zend_Feed */ -require_once 'Zend/Feed.php'; /** * @category Zend diff --git a/test/Pubsubhubbub/AllTests.php b/test/Pubsubhubbub/AllTests.php deleted file mode 100644 index 29585731..00000000 --- a/test/Pubsubhubbub/AllTests.php +++ /dev/null @@ -1,67 +0,0 @@ -addTestSuite('Zend_Feed_Pubsubhubbub_PubsubhubbubTest'); - $suite->addTestSuite('Zend_Feed_Pubsubhubbub_PublisherTest'); - $suite->addTestSuite('Zend_Feed_Pubsubhubbub_SubscriberTest'); - $suite->addTestSuite('Zend_Feed_Pubsubhubbub_SubscriberHttpTest'); - $suite->addTestSuite('Zend_Feed_Pubsubhubbub_Subscriber_CallbackTest'); - - return $suite; - } -} - -if (PHPUnit_MAIN_METHOD == 'Zend_Feed_Pubsubhubbub_AllTests::main') { - Zend_Feed_Pubsubhubbub_AllTests::main(); -} diff --git a/test/Pubsubhubbub/PublisherTest.php b/test/Pubsubhubbub/PublisherTest.php index faee5059..b4761d71 100644 --- a/test/Pubsubhubbub/PublisherTest.php +++ b/test/Pubsubhubbub/PublisherTest.php @@ -19,9 +19,7 @@ * @version $Id$ */ -require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; -require_once 'Zend/Feed/Pubsubhubbub/Publisher.php'; /** * @category Zend diff --git a/test/Pubsubhubbub/PubsubhubbubTest.php b/test/Pubsubhubbub/PubsubhubbubTest.php index 3a5fa35e..08fd3cf7 100644 --- a/test/Pubsubhubbub/PubsubhubbubTest.php +++ b/test/Pubsubhubbub/PubsubhubbubTest.php @@ -19,9 +19,7 @@ * @version $Id$ */ -require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; -require_once 'Zend/Feed/Pubsubhubbub.php'; /** * @category Zend diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php index da864fdb..c35b56b9 100644 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -19,9 +19,6 @@ * @version $Id$ */ -require_once 'Zend/Feed/Pubsubhubbub/Subscriber/Callback.php'; -require_once 'Zend/Feed/Pubsubhubbub/Model/Subscription.php'; -require_once 'Zend/Db/Table/Rowset/Abstract.php'; /** * @category Zend diff --git a/test/Pubsubhubbub/SubscriberHttpTest.php b/test/Pubsubhubbub/SubscriberHttpTest.php index a063b619..8459100e 100644 --- a/test/Pubsubhubbub/SubscriberHttpTest.php +++ b/test/Pubsubhubbub/SubscriberHttpTest.php @@ -19,12 +19,7 @@ * @version $Id$ */ -require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; -require_once 'Zend/Feed/Pubsubhubbub/Subscriber.php'; -require_once 'Zend/Http/Client.php'; -require_once 'Zend/Http/Client/Adapter/Socket.php'; -require_once 'Zend/Uri/Http.php'; /** * Note that $this->_baseuri must point to a directory on a web server diff --git a/test/Pubsubhubbub/SubscriberTest.php b/test/Pubsubhubbub/SubscriberTest.php index 089d51a7..4680515f 100644 --- a/test/Pubsubhubbub/SubscriberTest.php +++ b/test/Pubsubhubbub/SubscriberTest.php @@ -19,10 +19,7 @@ * @version $Id$ */ -require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; -require_once 'Zend/Feed/Pubsubhubbub/Subscriber.php'; -require_once 'Zend/Feed/Pubsubhubbub/Model/Subscription.php'; /** * @category Zend diff --git a/test/Reader/Entry/AtomStandaloneEntryTest.php b/test/Reader/Entry/AtomStandaloneEntryTest.php index d5a5a452..a9c7a28f 100644 --- a/test/Reader/Entry/AtomStandaloneEntryTest.php +++ b/test/Reader/Entry/AtomStandaloneEntryTest.php @@ -20,8 +20,6 @@ * @version $Id: AtomTest.php 19159 2009-11-21 14:23:15Z padraic $ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; /** * @category Zend diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index 4f7426ea..29cf073e 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -20,8 +20,6 @@ * @version $Id$ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; /** * @category Zend diff --git a/test/Reader/Entry/CommonTest.php b/test/Reader/Entry/CommonTest.php index b2de60fc..f91740b7 100644 --- a/test/Reader/Entry/CommonTest.php +++ b/test/Reader/Entry/CommonTest.php @@ -20,8 +20,6 @@ * @version $Id$ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; /** * @category Zend diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index 1dfe6066..af15e16a 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -20,8 +20,6 @@ * @version $Id$ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; /** * @category Zend diff --git a/test/Reader/Feed/AtomSourceTest.php b/test/Reader/Feed/AtomSourceTest.php index 1255ee2c..a2d7d313 100644 --- a/test/Reader/Feed/AtomSourceTest.php +++ b/test/Reader/Feed/AtomSourceTest.php @@ -20,8 +20,6 @@ * @version $Id: AtomTest.php 19168 2009-11-21 17:17:18Z padraic $ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; /** * @category Zend diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 4e03bc1a..517a3cff 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -20,8 +20,6 @@ * @version $Id$ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; /** * @category Zend diff --git a/test/Reader/Feed/CommonTest.php b/test/Reader/Feed/CommonTest.php index 34814909..371b62d1 100644 --- a/test/Reader/Feed/CommonTest.php +++ b/test/Reader/Feed/CommonTest.php @@ -20,9 +20,6 @@ * @version $Id$ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; -require_once 'Zend/Registry.php'; /** * @category Zend diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index d1c50c54..aef2e966 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -20,9 +20,6 @@ * @version $Id$ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; -require_once 'Zend/Registry.php'; /** * @category Zend diff --git a/test/Reader/Integration/H-OnlineComAtom10Test.php b/test/Reader/Integration/H-OnlineComAtom10Test.php index e2605762..9406468d 100644 --- a/test/Reader/Integration/H-OnlineComAtom10Test.php +++ b/test/Reader/Integration/H-OnlineComAtom10Test.php @@ -20,8 +20,6 @@ * @version $Id$ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; /** * @category Zend diff --git a/test/Reader/Integration/LautDeRdfTest.php b/test/Reader/Integration/LautDeRdfTest.php index 2348f462..9cdd1b6f 100644 --- a/test/Reader/Integration/LautDeRdfTest.php +++ b/test/Reader/Integration/LautDeRdfTest.php @@ -20,8 +20,6 @@ * @version $Id$ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; /** * @category Zend diff --git a/test/Reader/Integration/PodcastRss2Test.php b/test/Reader/Integration/PodcastRss2Test.php index dca105b7..45a9d2d2 100644 --- a/test/Reader/Integration/PodcastRss2Test.php +++ b/test/Reader/Integration/PodcastRss2Test.php @@ -20,9 +20,6 @@ * @version $Id$ */ -require_once dirname(__FILE__) . '/../../../../TestHelper.php'; -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; /** * @category Zend diff --git a/test/Reader/Integration/WordpressAtom10Test.php b/test/Reader/Integration/WordpressAtom10Test.php index 6672c531..0fb59a85 100644 --- a/test/Reader/Integration/WordpressAtom10Test.php +++ b/test/Reader/Integration/WordpressAtom10Test.php @@ -20,8 +20,6 @@ * @version $Id$ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; /** * @category Zend diff --git a/test/Reader/Integration/WordpressRss2DcAtomTest.php b/test/Reader/Integration/WordpressRss2DcAtomTest.php index 7fee4d57..20215df8 100644 --- a/test/Reader/Integration/WordpressRss2DcAtomTest.php +++ b/test/Reader/Integration/WordpressRss2DcAtomTest.php @@ -20,8 +20,6 @@ * @version $Id$ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; /** * @category Zend diff --git a/test/Reader/_files/My/Extension/JungleBooks/Entry.php b/test/Reader/_files/My/Extension/JungleBooks/Entry.php index 39840a79..2da44b4f 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Entry.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Entry.php @@ -20,9 +20,7 @@ * @version $Id$ */ -require_once 'Zend/Feed/Reader.php'; -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; /** * @category Zend diff --git a/test/Reader/_files/My/Extension/JungleBooks/Feed.php b/test/Reader/_files/My/Extension/JungleBooks/Feed.php index 700c4ccc..97343615 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Feed.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Feed.php @@ -20,7 +20,6 @@ * @version $Id$ */ -require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; /** * @category Zend diff --git a/test/ReaderTest.php b/test/ReaderTest.php index 6848426c..d37e8310 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -20,9 +20,6 @@ * @version $Id$ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; -require_once 'Zend/Cache.php'; /** * @category Zend diff --git a/test/Writer/DeletedTest.php b/test/Writer/DeletedTest.php index 0cfca891..2fcc1574 100644 --- a/test/Writer/DeletedTest.php +++ b/test/Writer/DeletedTest.php @@ -20,9 +20,7 @@ * @version $Id$ */ -require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/TestHelper.php'; -require_once 'Zend/Feed/Writer/Deleted.php'; /** * @category Zend diff --git a/test/Writer/EntryTest.php b/test/Writer/EntryTest.php index 5899c083..64dd37e6 100644 --- a/test/Writer/EntryTest.php +++ b/test/Writer/EntryTest.php @@ -20,9 +20,7 @@ * @version $Id$ */ -require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/TestHelper.php'; -require_once 'Zend/Feed/Writer/Entry.php'; /** * @category Zend diff --git a/test/Writer/Extension/ITunes/EntryTest.php b/test/Writer/Extension/ITunes/EntryTest.php index 87f3645b..22ac1d10 100644 --- a/test/Writer/Extension/ITunes/EntryTest.php +++ b/test/Writer/Extension/ITunes/EntryTest.php @@ -20,9 +20,7 @@ * @version $Id$ */ -require_once dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; -require_once 'Zend/Feed/Writer/Entry.php'; /** * @category Zend diff --git a/test/Writer/Extension/ITunes/FeedTest.php b/test/Writer/Extension/ITunes/FeedTest.php index c7af37e2..4e5b659a 100644 --- a/test/Writer/Extension/ITunes/FeedTest.php +++ b/test/Writer/Extension/ITunes/FeedTest.php @@ -20,9 +20,7 @@ * @version $Id$ */ -require_once dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; -require_once 'Zend/Feed/Writer/Feed.php'; /** * @category Zend diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php index 60320be7..0ac08278 100644 --- a/test/Writer/FeedTest.php +++ b/test/Writer/FeedTest.php @@ -20,9 +20,7 @@ * @version $Id$ */ -require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/TestHelper.php'; -require_once 'Zend/Feed/Writer/Feed.php'; /** * @category Zend diff --git a/test/Writer/Renderer/Entry/AtomTest.php b/test/Writer/Renderer/Entry/AtomTest.php index 44566221..5bc8b46f 100644 --- a/test/Writer/Renderer/Entry/AtomTest.php +++ b/test/Writer/Renderer/Entry/AtomTest.php @@ -20,11 +20,7 @@ * @version $Id$ */ -require_once dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; -require_once 'Zend/Feed/Writer/Renderer/Feed/Atom.php'; -require_once 'Zend/Feed/Reader.php'; -require_once 'Zend/Version.php'; /** * @category Zend diff --git a/test/Writer/Renderer/Entry/RssTest.php b/test/Writer/Renderer/Entry/RssTest.php index d0b84ab4..116823d1 100644 --- a/test/Writer/Renderer/Entry/RssTest.php +++ b/test/Writer/Renderer/Entry/RssTest.php @@ -20,11 +20,7 @@ * @version $Id$ */ -require_once dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; -require_once 'Zend/Feed/Writer/Renderer/Feed/Rss.php'; -require_once 'Zend/Feed/Reader.php'; -require_once 'Zend/Version.php'; /** * @category Zend diff --git a/test/Writer/Renderer/Feed/AtomTest.php b/test/Writer/Renderer/Feed/AtomTest.php index 71e0b877..f05c2708 100644 --- a/test/Writer/Renderer/Feed/AtomTest.php +++ b/test/Writer/Renderer/Feed/AtomTest.php @@ -20,11 +20,7 @@ * @version $Id$ */ -require_once dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; -require_once 'Zend/Feed/Writer/Renderer/Feed/Atom.php'; -require_once 'Zend/Feed/Reader.php'; -require_once 'Zend/Version.php'; /** * @category Zend diff --git a/test/Writer/Renderer/Feed/RssTest.php b/test/Writer/Renderer/Feed/RssTest.php index a89eeea2..ad17c1a4 100644 --- a/test/Writer/Renderer/Feed/RssTest.php +++ b/test/Writer/Renderer/Feed/RssTest.php @@ -20,11 +20,7 @@ * @version $Id$ */ -require_once dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; -require_once 'Zend/Feed/Writer/Renderer/Feed/Rss.php'; -require_once 'Zend/Feed/Reader.php'; -require_once 'Zend/Version.php'; /** * @category Zend From 51e4e77fd5afdbda01ae2df728b8d89d287cbcbb Mon Sep 17 00:00:00 2001 From: matthew Date: Tue, 16 Mar 2010 12:38:39 +0000 Subject: [PATCH 121/238] [2.0] Merged in changes from trunk up to r21517 git-svn-id: http://framework.zend.com/svn/framework/standard/branches/development-2.0@21518 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/Subscriber/Callback.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Pubsubhubbub/Subscriber/Callback.php b/src/Pubsubhubbub/Subscriber/Callback.php index 76373f72..860630ef 100644 --- a/src/Pubsubhubbub/Subscriber/Callback.php +++ b/src/Pubsubhubbub/Subscriber/Callback.php @@ -95,6 +95,8 @@ public function handle(array $httpGetData = null, $sendResponseNow = false) && $this->_hasValidVerifyToken(null, false) && ($this->_getHeader('Content-Type') == 'application/atom+xml' || $this->_getHeader('Content-Type') == 'application/rss+xml' + || $this->_getHeader('Content-Type') == 'application/xml' + || $this->_getHeader('Content-Type') == 'text/xml' || $this->_getHeader('Content-Type') == 'application/rdf+xml') ) { $this->setFeedUpdate($this->_getRawBody()); From 19f89b1a8029d0f542f61ca00ca69ab29d03ea3a Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Fri, 26 Mar 2010 12:53:24 -0400 Subject: [PATCH 122/238] Added PHPTools submodule --- .gitmodules | 3 +++ tools/phptools | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 tools/phptools diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..21d57da5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tools/phptools"] + path = tools/phptools + url = git://github.com/ralphschindler/PHPTools.git diff --git a/tools/phptools b/tools/phptools new file mode 160000 index 00000000..685f0e09 --- /dev/null +++ b/tools/phptools @@ -0,0 +1 @@ +Subproject commit 685f0e09aabbc45d82d3836aefc82be1efddb513 From bd36f8ea0b7fc8a61ffdb8600f3186aca4e07a3c Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Fri, 26 Mar 2010 13:49:44 -0400 Subject: [PATCH 123/238] Updated PHPTools --- tools/phptools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/phptools b/tools/phptools index 685f0e09..d232cb3e 160000 --- a/tools/phptools +++ b/tools/phptools @@ -1 +1 @@ -Subproject commit 685f0e09aabbc45d82d3836aefc82be1efddb513 +Subproject commit d232cb3e4f1448daccefc74882da1862cda7656f From 61eadc656df8e026eec1129e43e78206a6b5b18b Mon Sep 17 00:00:00 2001 From: padraic Date: Wed, 28 Apr 2010 15:47:44 +0000 Subject: [PATCH 124/238] Fixed typo (and added missing test!) preventing feed type detection on strings - fixes ZF-9723 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22031 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader.php | 2 +- test/ReaderTest.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Reader.php b/src/Reader.php index 0230e6d3..57660a0e 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -427,7 +427,7 @@ public static function detectType($feed, $specOnly = false) } elseif(is_string($feed) && !empty($feed)) { @ini_set('track_errors', 1); $dom = new DOMDocument; - $status = @$doc->loadXML($string); + $status = @$dom->loadXML($feed); @ini_restore('track_errors'); if (!$status) { if (!isset($php_errormsg)) { diff --git a/test/ReaderTest.php b/test/ReaderTest.php index 6848426c..08a36f7f 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -120,6 +120,16 @@ public function testDetectsFeedIsAtom03() $this->assertEquals(Zend_Feed_Reader::TYPE_ATOM_03, $type); } + /** + * @group ZF-9723 + */ + public function testDetectsTypeFromStringOrToRemindPaddyAboutForgettingATestWhichLetsAStupidTypoSurviveUnnoticedForMonths() + { + $feed = ''; + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_10, $type); + } + public function testGetEncoding() { $feed = Zend_Feed_Reader::importString( From 1dee0b672aa544ff45fe2177895a7eddd0d2fd18 Mon Sep 17 00:00:00 2001 From: padraic Date: Thu, 29 Apr 2010 14:42:24 +0000 Subject: [PATCH 125/238] Fixed cases where Atom Renderer renders a Unicode non-breaking space as   HTML entity during Tidy cleanup. Fixes ZF-9566 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22054 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Writer/Renderer/Entry/Atom.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom.php index 2a4dbfa4..24b30c7e 100644 --- a/src/Writer/Renderer/Entry/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -337,7 +337,8 @@ protected function _loadXhtml($content) $tidy = new tidy; $config = array( 'output-xhtml' => true, - 'show-body-only' => true + 'show-body-only' => true, + 'quote-nbsp' => false ); $encoding = str_replace('-', '', $this->getEncoding()); $tidy->parseString($content, $config, $encoding); From 228e5981219954c87939605f9dfff8e10a344926 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 30 Apr 2010 14:02:38 +0000 Subject: [PATCH 126/238] Adding enclosures now treats type and length parameters as optional for Atom, but throws exceptions for RSS (reflecting specs). Fixes ZF-8892 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22064 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Writer/Entry.php | 18 ++------- src/Writer/Renderer/Entry/Atom.php | 8 +++- src/Writer/Renderer/Entry/Rss.php | 31 +++++++++++++++ test/Writer/EntryTest.php | 50 ------------------------ test/Writer/Renderer/Entry/RssTest.php | 54 ++++++++++++++++++++++++++ 5 files changed, 95 insertions(+), 66 deletions(-) diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index c838f1dc..836069ee 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -592,20 +592,15 @@ public function getCategories() } /** - * Adds an enclosure to the entry. + * Adds an enclosure to the entry. The array parameter may contain the + * keys 'uri', 'type' and 'length'. Only 'uri' is required for Atom, though the + * others must also be provided or RSS rendering (where they are required) + * will throw an Exception. * * @param array $enclosures */ public function setEnclosure(array $enclosure) { - if (!isset($enclosure['type'])) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Enclosure "type" is not set'); - } - if (!isset($enclosure['length'])) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Enclosure "length" is not set'); - } if (!isset($enclosure['uri'])) { require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Enclosure "uri" is not set'); @@ -614,11 +609,6 @@ public function setEnclosure(array $enclosure) require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Enclosure "uri" is not a valid URI/IRI'); } - if ((int) $enclosure['length'] <= 0) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Enclosure "length" must be an integer' - . ' indicating the content\'s length in bytes'); - } $this->_data['enclosure'] = $enclosure; } diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom.php index 24b30c7e..4786f123 100644 --- a/src/Writer/Renderer/Entry/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -234,8 +234,12 @@ protected function _setEnclosure(DOMDocument $dom, DOMElement $root) } $enclosure = $this->_dom->createElement('link'); $enclosure->setAttribute('rel', 'enclosure'); - $enclosure->setAttribute('type', $data['type']); - $enclosure->setAttribute('length', $data['length']); + if (isset($data['type'])) { + $enclosure->setAttribute('type', $data['type']); + } + if (isset($data['length'])) { + $enclosure->setAttribute('length', $data['length']); + } $enclosure->setAttribute('href', $data['uri']); $root->appendChild($enclosure); } diff --git a/src/Writer/Renderer/Entry/Rss.php b/src/Writer/Renderer/Entry/Rss.php index 50da5f5d..34dedeb6 100644 --- a/src/Writer/Renderer/Entry/Rss.php +++ b/src/Writer/Renderer/Entry/Rss.php @@ -218,6 +218,37 @@ protected function _setEnclosure(DOMDocument $dom, DOMElement $root) if ((!$data || empty($data))) { return; } + if (!isset($data['type'])) { + require_once 'Zend/Feed/Exception.php'; + $exception = new Zend_Feed_Exception('Enclosure "type" is not set'); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + if (!isset($data['length'])) { + require_once 'Zend/Feed/Exception.php'; + $exception = new Zend_Feed_Exception('Enclosure "length" is not set'); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + if (isset($data['length']) && (int) $data['length'] <= 0) { + require_once 'Zend/Feed/Exception.php'; + $exception = new Zend_Feed_Exception('Enclosure "length" must be an integer' + . ' indicating the content\'s length in bytes'); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } $enclosure = $this->_dom->createElement('enclosure'); $enclosure->setAttribute('type', $data['type']); $enclosure->setAttribute('length', $data['length']); diff --git a/test/Writer/EntryTest.php b/test/Writer/EntryTest.php index 5899c083..520405da 100644 --- a/test/Writer/EntryTest.php +++ b/test/Writer/EntryTest.php @@ -185,18 +185,6 @@ public function testAddsEnclosure() $this->assertEquals($expected, $entry->getEnclosure()); } - /** - * @expectedException Zend_Feed_Exception - */ - public function testAddsEnclosureThrowsExceptionOnMissingType() - { - $entry = new Zend_Feed_Writer_Entry; - $entry->setEnclosure(array( - 'uri' => 'http://example.com/audio.mp3', - 'length' => '1337' - )); - } - /** * @expectedException Zend_Feed_Exception */ @@ -209,44 +197,6 @@ public function testAddsEnclosureThrowsExceptionOnMissingUri() )); } - /** - * @expectedException Zend_Feed_Exception - */ - public function testAddsEnclosureThrowsExceptionOnMissingLength() - { - $entry = new Zend_Feed_Writer_Entry; - $entry->setEnclosure(array( - 'type' => 'audio/mpeg', - 'uri' => 'http://example.com/audio.mp3' - )); - } - - /** - * @expectedException Zend_Feed_Exception - */ - public function testAddsEnclosureThrowsExceptionOnNonNumericLength() - { - $entry = new Zend_Feed_Writer_Entry; - $entry->setEnclosure(array( - 'type' => 'audio/mpeg', - 'uri' => 'http://example.com/audio.mp3', - 'length' => 'abc' - )); - } - - /** - * @expectedException Zend_Feed_Exception - */ - public function testAddsEnclosureThrowsExceptionOnNegativeLength() - { - $entry = new Zend_Feed_Writer_Entry; - $entry->setEnclosure(array( - 'type' => 'audio/mpeg', - 'uri' => 'http://example.com/audio.mp3', - 'length' => -23 - )); - } - /** * @expectedException Zend_Feed_Exception */ diff --git a/test/Writer/Renderer/Entry/RssTest.php b/test/Writer/Renderer/Entry/RssTest.php index d0b84ab4..c4de5fbf 100644 --- a/test/Writer/Renderer/Entry/RssTest.php +++ b/test/Writer/Renderer/Entry/RssTest.php @@ -226,6 +226,60 @@ public function testEntryHoldsAnyEnclosureAdded() $this->assertEquals('http://example.com/audio.mp3', $enc->url); } + /** + * @expectedException Zend_Feed_Exception + */ + public function testAddsEnclosureThrowsExceptionOnMissingType() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validEntry->setEnclosure(array( + 'uri' => 'http://example.com/audio.mp3', + 'length' => '1337' + )); + $renderer->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testAddsEnclosureThrowsExceptionOnMissingLength() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validEntry->setEnclosure(array( + 'type' => 'audio/mpeg', + 'uri' => 'http://example.com/audio.mp3' + )); + $renderer->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testAddsEnclosureThrowsExceptionOnNonNumericLength() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validEntry->setEnclosure(array( + 'type' => 'audio/mpeg', + 'uri' => 'http://example.com/audio.mp3', + 'length' => 'abc' + )); + $renderer->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testAddsEnclosureThrowsExceptionOnNegativeLength() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validEntry->setEnclosure(array( + 'type' => 'audio/mpeg', + 'uri' => 'http://example.com/audio.mp3', + 'length' => -23 + )); + $renderer->render(); + } + public function testEntryIdHasBeenSet() { $this->_validEntry->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); From 7dd8da4822cf86f5b8a276b426de86247b7b1dc4 Mon Sep 17 00:00:00 2001 From: padraic Date: Tue, 4 May 2010 11:25:54 +0000 Subject: [PATCH 127/238] Fixed errors in parsing non-standard RSS dates under US Locale. Fixes ZF-8702 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22086 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Entry/Rss.php | 37 +++++++++++-------- src/Reader/Feed/Rss.php | 37 +++++++++++-------- test/Reader/Entry/RssTest.php | 18 +++++++++ .../Rss/datemodified/plain/rss20_en_US.xml | 8 ++++ test/Reader/Feed/RssTest.php | 17 +++++++++ .../Rss/datemodified/plain/rss20_en_US.xml | 6 +++ 6 files changed, 91 insertions(+), 32 deletions(-) create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/rss20_en_US.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/rss20_en_US.xml diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index d339950e..f6f65b42 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -265,22 +265,27 @@ public function getDateModified() ) { $dateModified = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/pubDate)'); if ($dateModified) { - $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, $standard); - break; - } 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):' - . $e->getMessage(), - 0, $e - ); + $dateModifiedParsed = strtotime($dateModified); + if ($dateModifiedParsed) { + $date = new Zend_Date($dateModifiedParsed); + } else { + $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, $standard); + break; + } 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):' + . $e->getMessage(), + 0, $e + ); + } } } } diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index b4f6f66a..40274c04 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -226,22 +226,27 @@ public function getDateModified() $dateModified = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)'); } if ($dateModified) { - $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, $standard); - break; - } 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):' - . $e->getMessage(), - 0, $e - ); + $dateModifiedParsed = strtotime($dateModified); + if ($dateModifiedParsed) { + $date = new Zend_Date($dateModifiedParsed); + } else { + $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, $standard); + break; + } 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):' + . $e->getMessage(), + 0, $e + ); + } } } } diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index 1dfe6066..13c3f8c1 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -1896,6 +1896,24 @@ public function testGetsDateModifiedFromRss20() $this->assertTrue($edate->equals($entry->getDateModified())); } + /** + * @group ZF-8702 + */ + public function testParsesCorrectDateIfMissingOffsetWhenSystemUsesUSLocale() + { + $locale = new Zend_Locale('en_US'); + Zend_Registry::set('Zend_Locale', $locale); + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20_en_US.xml') + ); + $entry = $feed->current(); + $fdate = $entry->getDateModified(); + $edate = new Zend_Date; + $edate->set('2010-01-04T08:14:00-0600', Zend_Date::ISO_8601); + Zend_Registry::getInstance()->offsetUnset('Zend_Locale'); + $this->assertTrue($edate->equals($fdate)); + } + // DC 1.0 public function testGetsDateModifiedFromRss20_Dc10() diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/rss20_en_US.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/rss20_en_US.xml new file mode 100644 index 00000000..c48ba68e --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/rss20_en_US.xml @@ -0,0 +1,8 @@ + + + + + Mon, 4 Jan 2010 02:14:00 CST + + + diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index d1c50c54..a15fc37d 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -2103,6 +2103,23 @@ public function testGetsDateModifiedFromRss20() $this->assertTrue($edate->equals($feed->getDateModified())); } + /** + * @group ZF-8702 + */ + public function testParsesCorrectDateIfMissingOffsetWhenSystemUsesUSLocale() + { + $locale = new Zend_Locale('en_US'); + Zend_Registry::set('Zend_Locale', $locale); + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20_en_US.xml') + ); + $fdate = $feed->getDateModified(); + $edate = new Zend_Date; + $edate->set('2010-01-04T08:14:00-0600', Zend_Date::ISO_8601); + Zend_Registry::getInstance()->offsetUnset('Zend_Locale'); + $this->assertTrue($edate->equals($fdate)); + } + // DC 1.0 public function testGetsDateModifiedFromRss20_Dc10() diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/rss20_en_US.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/rss20_en_US.xml new file mode 100644 index 00000000..778b10c8 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/rss20_en_US.xml @@ -0,0 +1,6 @@ + + + + Mon, 4 Jan 2010 02:14:00 CST + + From 8dcf1bf1aee73b60e3f39f0bf9e98dcd8eeec11e Mon Sep 17 00:00:00 2001 From: padraic Date: Tue, 4 May 2010 12:50:51 +0000 Subject: [PATCH 128/238] Added support for returning original source URI of feeds is they omit a self-referencing feed URI - implements ZF-8788 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22092 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader.php | 4 ++- src/Reader/Feed/Atom.php | 4 +++ src/Reader/Feed/Rss.php | 4 +-- src/Reader/FeedAbstract.php | 30 +++++++++++++++++++ test/Reader/Feed/AtomTest.php | 9 ++++++ test/Reader/Feed/RssTest.php | 9 ++++++ .../Atom/feedlink/plain/atom10_NoFeedLink.xml | 3 ++ .../Rss/feedlink/plain/rss20_NoFeedLink.xml | 6 ++++ 8 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 test/Reader/Feed/_files/Atom/feedlink/plain/atom10_NoFeedLink.xml create mode 100644 test/Reader/Feed/_files/Rss/feedlink/plain/rss20_NoFeedLink.xml diff --git a/src/Reader.php b/src/Reader.php index 57660a0e..1308278e 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -286,7 +286,9 @@ public static function import($uri, $etag = null, $lastModified = null) require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); } - return self::importString($response->getBody()); + $reader = self::importString($response->getBody()); + $reader->setOriginalSourceUri($uri); + return $reader; } } diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index a562e62b..3a9a000c 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -290,6 +290,10 @@ public function getFeedLink() $link = $this->getExtension('Atom')->getFeedLink(); + if (is_null($link) || empty($link)) { + $link = $this->getOriginalSourceUri(); + } + $this->_data['feedlink'] = $link; return $this->_data['feedlink']; diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 40274c04..d88e89ac 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -435,8 +435,8 @@ public function getFeedLink() $link = $this->getExtension('Atom')->getFeedLink(); - if (!$link) { - $link = null; + if (is_null($link) || empty($link)) { + $link = $this->getOriginalSourceUri(); } $this->_data['feedlink'] = $link; diff --git a/src/Reader/FeedAbstract.php b/src/Reader/FeedAbstract.php index b24d8a6d..46506016 100644 --- a/src/Reader/FeedAbstract.php +++ b/src/Reader/FeedAbstract.php @@ -79,6 +79,13 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt */ protected $_extensions = array(); + /** + * Original Source URI (set if imported from a URI) + * + * @var string + */ + protected $_originalSourceUri = null; + /** * Constructor * @@ -100,6 +107,29 @@ public function __construct(DomDocument $domDocument, $type = null) $this->_loadExtensions(); } + /** + * Set an original source URI for the feed being parsed. This value + * is returned from getFeedLink() method if the feed does not carry + * a self-referencing URI. + * + * @param string $uri + */ + public function setOriginalSourceUri($uri) + { + $this->_originalSourceUri = $uri; + } + + /** + * Get an original source URI for the feed being parsed. Returns null if + * unset or the feed was not imported from a URI. + * + * @return string|null + */ + public function getOriginalSourceUri() + { + return $this->_originalSourceUri; + } + /** * Get the number of feed entries. * Required by the Iterator interface. diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 4e03bc1a..3d8b9424 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -390,6 +390,15 @@ public function testGetsFeedLinkFromAtom10IfRelativeUri() $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); } + public function testGetsOriginalSourceUriIfFeedLinkNotAvailableFromFeed() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom10_NoFeedLink.xml') + ); + $feed->setOriginalSourceUri('http://www.example.com/feed/atom'); + $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); + } + /** * Get Pubsubhubbub Hubs */ diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index a15fc37d..b048cf60 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -1867,6 +1867,15 @@ public function testGetsFeedLinkFromRss20() $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); } + public function testGetsOriginalSourceUriIfFeedLinkNotAvailableFromFeed() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss20_NoFeedLink.xml') + ); + $feed->setOriginalSourceUri('http://www.example.com/feed/rss'); + $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); + } + public function testGetsFeedLinkFromRss094() { $feed = Zend_Feed_Reader::importString( diff --git a/test/Reader/Feed/_files/Atom/feedlink/plain/atom10_NoFeedLink.xml b/test/Reader/Feed/_files/Atom/feedlink/plain/atom10_NoFeedLink.xml new file mode 100644 index 00000000..2d884af2 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/feedlink/plain/atom10_NoFeedLink.xml @@ -0,0 +1,3 @@ + + + diff --git a/test/Reader/Feed/_files/Rss/feedlink/plain/rss20_NoFeedLink.xml b/test/Reader/Feed/_files/Rss/feedlink/plain/rss20_NoFeedLink.xml new file mode 100644 index 00000000..db102b5d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/feedlink/plain/rss20_NoFeedLink.xml @@ -0,0 +1,6 @@ + + + + + From a21e514773d99d7322cb794551bec36c71d6d148 Mon Sep 17 00:00:00 2001 From: padraic Date: Tue, 4 May 2010 13:30:14 +0000 Subject: [PATCH 129/238] Fixed Zend_Feed_Reader setGenerator() parameter to accept array parameter. Previous signature will be marked as deprecated (remove in ZF 2.0). Fixes ZF-9161 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22094 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Writer/Feed/FeedAbstract.php | 51 ++++++++++++++------ test/Writer/FeedTest.php | 81 +++++++++++++++++++++++++++++--- 2 files changed, 112 insertions(+), 20 deletions(-) diff --git a/src/Writer/Feed/FeedAbstract.php b/src/Writer/Feed/FeedAbstract.php index 74eae94b..d844e663 100644 --- a/src/Writer/Feed/FeedAbstract.php +++ b/src/Writer/Feed/FeedAbstract.php @@ -226,24 +226,47 @@ public function setDescription($description) */ public function setGenerator($name, $version = null, $uri = null) { - if (empty($name) || !is_string($name)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string'); - } - $generator = array('name' => $name); - if (isset($version)) { - if (empty($version) || !is_string($version)) { + if (is_array($name)) { + $data = $name; + if (empty($data['name']) || !is_string($data['name'])) { require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "version" must be a non-empty string'); + throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string'); } - $generator['version'] = $version; - } - if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { + $generator = array('name' => $data['name']); + if (isset($data['version'])) { + if (empty($data['version']) || !is_string($data['version'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "version" must be a non-empty string'); + } + $generator['version'] = $data['version']; + } + if (isset($data['uri'])) { + if (empty($data['uri']) || !is_string($data['uri']) || !Zend_Uri::check($data['uri'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); + } + $generator['uri'] = $data['uri']; + } + } else { + if (empty($name) || !is_string($name)) { require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); + throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string'); + } + $generator = array('name' => $name); + if (isset($version)) { + if (empty($version) || !is_string($version)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "version" must be a non-empty string'); + } + $generator['version'] = $version; + } + if (isset($uri)) { + if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); + } + $generator['uri'] = $uri; } - $generator['uri'] = $uri; } $this->_data['generator'] = $generator; } diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php index 60320be7..4fae8515 100644 --- a/test/Writer/FeedTest.php +++ b/test/Writer/FeedTest.php @@ -436,21 +436,21 @@ public function testGetTitleReturnsNullIfDateNotSet() public function testSetsGeneratorName() { $writer = new Zend_Feed_Writer_Feed; - $writer->setGenerator('ZFW'); + $writer->setGenerator(array('name'=>'ZFW')); $this->assertEquals(array('name'=>'ZFW'), $writer->getGenerator()); } public function testSetsGeneratorVersion() { $writer = new Zend_Feed_Writer_Feed; - $writer->setGenerator('ZFW', '1.0'); + $writer->setGenerator(array('name'=>'ZFW', 'version' => '1.0')); $this->assertEquals(array('name'=>'ZFW', 'version' => '1.0'), $writer->getGenerator()); } public function testSetsGeneratorUri() { $writer = new Zend_Feed_Writer_Feed; - $writer->setGenerator('ZFW', null, 'http://www.example.com'); + $writer->setGenerator(array('name'=>'ZFW', 'uri'=>'http://www.example.com')); $this->assertEquals(array('name'=>'ZFW', 'uri' => 'http://www.example.com'), $writer->getGenerator()); } @@ -458,7 +458,7 @@ public function testSetsGeneratorThrowsExceptionOnInvalidName() { $writer = new Zend_Feed_Writer_Feed; try { - $writer->setGenerator(''); + $writer->setGenerator(array()); $this->fail(); } catch (Zend_Feed_Exception $e) { } @@ -468,13 +468,82 @@ public function testSetsGeneratorThrowsExceptionOnInvalidVersion() { $writer = new Zend_Feed_Writer_Feed; try { - $writer->addAuthor('ZFW', ''); - $this->fail(); + $writer->setGenerator(array('name'=>'ZFW', 'version'=>'')); + $this->fail('Should have failed since version is empty'); } catch (Zend_Feed_Exception $e) { } } public function testSetsGeneratorThrowsExceptionOnInvalidUri() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setGenerator(array('name'=>'ZFW','uri'=>'notauri')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + /** + * @deprecated + */ + public function testSetsGeneratorName_Deprecated() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setGenerator('ZFW'); + $this->assertEquals(array('name'=>'ZFW'), $writer->getGenerator()); + } + + /** + * @deprecated + */ + public function testSetsGeneratorVersion_Deprecated() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setGenerator('ZFW', '1.0'); + $this->assertEquals(array('name'=>'ZFW', 'version' => '1.0'), $writer->getGenerator()); + } + + /** + * @deprecated + */ + public function testSetsGeneratorUri_Deprecated() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setGenerator('ZFW', null, 'http://www.example.com'); + $this->assertEquals(array('name'=>'ZFW', 'uri' => 'http://www.example.com'), $writer->getGenerator()); + } + + /** + * @deprecated + */ + public function testSetsGeneratorThrowsExceptionOnInvalidName_Deprecated() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setGenerator(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + /** + * @deprecated + */ + public function testSetsGeneratorThrowsExceptionOnInvalidVersion_Deprecated() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setGenerator('ZFW', ''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + /** + * @deprecated + */ + public function testSetsGeneratorThrowsExceptionOnInvalidUri_Deprecated() { $writer = new Zend_Feed_Writer_Feed; try { From ffdf8130cf81abadeef42e9ea3f18649c198593d Mon Sep 17 00:00:00 2001 From: padraic Date: Tue, 4 May 2010 17:56:06 +0000 Subject: [PATCH 130/238] Adding support for parsing/writing feed level logos/images - implements ZF-9596 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22097 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Extension/Atom/Feed.php | 24 +++ src/Reader/Feed/Atom.php | 18 ++ src/Reader/Feed/Rss.php | 54 ++++++ src/Writer/Feed/FeedAbstract.php | 36 +++- src/Writer/Renderer/Feed/Atom.php | 1 + .../Renderer/Feed/Atom/AtomAbstract.php | 19 ++ src/Writer/Renderer/Feed/Rss.php | 109 ++++++++++++ test/Reader/Feed/AtomTest.php | 38 ++++ test/Reader/Feed/RssTest.php | 167 ++++++++++++++++++ .../Feed/_files/Atom/image/plain/atom03.xml | 4 + .../Feed/_files/Atom/image/plain/atom10.xml | 4 + .../_files/Atom/image/plain/none/atom03.xml | 3 + .../_files/Atom/image/plain/none/atom10.xml | 3 + .../_files/Rss/image/plain/none/rss090.xml | 7 + .../_files/Rss/image/plain/none/rss091.xml | 5 + .../_files/Rss/image/plain/none/rss092.xml | 5 + .../_files/Rss/image/plain/none/rss093.xml | 5 + .../_files/Rss/image/plain/none/rss094.xml | 5 + .../_files/Rss/image/plain/none/rss10.xml | 7 + .../_files/Rss/image/plain/none/rss20.xml | 5 + .../Feed/_files/Rss/image/plain/rss090.xml | 15 ++ .../Feed/_files/Rss/image/plain/rss091.xml | 13 ++ .../Feed/_files/Rss/image/plain/rss092.xml | 13 ++ .../Feed/_files/Rss/image/plain/rss093.xml | 13 ++ .../Feed/_files/Rss/image/plain/rss094.xml | 13 ++ .../Feed/_files/Rss/image/plain/rss10.xml | 15 ++ .../Feed/_files/Rss/image/plain/rss20.xml | 13 ++ test/Writer/FeedTest.php | 109 ++++++++++++ 28 files changed, 721 insertions(+), 2 deletions(-) create mode 100644 test/Reader/Feed/_files/Atom/image/plain/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/image/plain/atom10.xml create mode 100644 test/Reader/Feed/_files/Atom/image/plain/none/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/image/plain/none/atom10.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/none/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/none/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/none/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/none/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/none/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/none/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/none/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/rss20.xml diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index 97261674..40d28982 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -294,6 +294,30 @@ public function getLanguage() return $this->_data['language']; } + /** + * Get the feed image + * + * @return array|null + */ + public function getImage() + { + if (array_key_exists('image', $this->_data)) { + return $this->_data['image']; + } + + $imageUrl = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:logo)'); + + if (!$imageUrl) { + $image = null; + } else { + $image = array('uri'=>$imageUrl); + } + + $this->_data['image'] = $image; + + return $this->_data['image']; + } + /** * Get the base URI of the feed (if set). * diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index 3a9a000c..ac29cbf2 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -277,6 +277,24 @@ public function getLink() return $this->_data['link']; } + /** + * Get feed image data + * + * @return array|null + */ + public function getImage() + { + if (array_key_exists('image', $this->_data)) { + return $this->_data['image']; + } + + $link = $this->getExtension('Atom')->getImage(); + + $this->_data['image'] = $link; + + return $this->_data['image']; + } + /** * Get a link to the feed's XML Url * diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index d88e89ac..495df477 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -348,6 +348,60 @@ public function getId() return $this->_data['id']; } + /** + * Get the feed image data + * + * @return array|null + */ + public function getImage() + { + if (array_key_exists('image', $this->_data)) { + return $this->_data['image']; + } + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $list = $this->_xpath->query('/rss/channel/image'); + $prefix = '/rss/channel/image[1]'; + } else { + $list = $this->_xpath->query('/rdf:RDF/rss:channel/rss:image'); + $prefix = '/rdf:RDF/rss:channel/rss:image[1]'; + } + if ($list->length > 0) { + $image = array(); + $value = $this->_xpath->evaluate('string(' . $prefix . '/url)'); + if ($value) { + $image['uri'] = $value; + } + $value = $this->_xpath->evaluate('string(' . $prefix . '/link)'); + if ($value) { + $image['link'] = $value; + } + $value = $this->_xpath->evaluate('string(' . $prefix . '/title)'); + if ($value) { + $image['title'] = $value; + } + $value = $this->_xpath->evaluate('string(' . $prefix . '/height)'); + if ($value) { + $image['height'] = $value; + } + $value = $this->_xpath->evaluate('string(' . $prefix . '/width)'); + if ($value) { + $image['width'] = $value; + } + $value = $this->_xpath->evaluate('string(' . $prefix . '/description)'); + if ($value) { + $image['description'] = $value; + } + } else { + $image = null; + } + + $this->_data['image'] = $image; + + return $this->_data['image']; + } + /** * Get the feed language * diff --git a/src/Writer/Feed/FeedAbstract.php b/src/Writer/Feed/FeedAbstract.php index d844e663..72fac523 100644 --- a/src/Writer/Feed/FeedAbstract.php +++ b/src/Writer/Feed/FeedAbstract.php @@ -274,7 +274,7 @@ public function setGenerator($name, $version = null, $uri = null) /** * Set the feed ID - URI or URN (via PCRE pattern) supported * - * @return string|null + * @param string $id */ public function setId($id) { @@ -286,6 +286,25 @@ public function setId($id) $this->_data['id'] = $id; } + /** + * Set a feed image (URI at minimum). Parameter is a single array with the + * required key 'uri'. When rendering as RSS, the required keys are 'uri', + * 'title' and 'link'. RSS also specifies three optional parameters 'width', + * 'height' and 'description'. Only 'uri' is required and used for Atom rendering. + * + * @param array $data + */ + public function setImage(array $data) + { + if (empty($data['uri']) || !is_string($data['uri']) + || !Zend_Uri::check($data['uri'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter \'uri\'' + . ' must be a non-empty string and valid URI/IRI'); + } + $this->_data['image'] = $data; + } + /** * Set the feed language * @@ -303,7 +322,7 @@ public function setLanguage($language) /** * Set a link to the HTML source * - * @return string|null + * @param string $link */ public function setLink($link) { @@ -552,6 +571,19 @@ public function getId() return $this->_data['id']; } + /** + * Get the feed image URI + * + * @return array + */ + public function getImage() + { + if (!array_key_exists('image', $this->_data)) { + return null; + } + return $this->_data['image']; + } + /** * Get the feed language * diff --git a/src/Writer/Renderer/Feed/Atom.php b/src/Writer/Renderer/Feed/Atom.php index d743c63e..727a8fcf 100644 --- a/src/Writer/Renderer/Feed/Atom.php +++ b/src/Writer/Renderer/Feed/Atom.php @@ -81,6 +81,7 @@ public function render() $this->_setBaseUrl($this->_dom, $root); $this->_setTitle($this->_dom, $root); $this->_setDescription($this->_dom, $root); + $this->_setImage($this->_dom, $root); $this->_setDateCreated($this->_dom, $root); $this->_setDateModified($this->_dom, $root); $this->_setGenerator($this->_dom, $root); diff --git a/src/Writer/Renderer/Feed/Atom/AtomAbstract.php b/src/Writer/Renderer/Feed/Atom/AtomAbstract.php index dbd04bf3..d12e3a33 100644 --- a/src/Writer/Renderer/Feed/Atom/AtomAbstract.php +++ b/src/Writer/Renderer/Feed/Atom/AtomAbstract.php @@ -321,6 +321,25 @@ protected function _setCopyright(DOMDocument $dom, DOMElement $root) $text = $dom->createTextNode($copyright); $copy->appendChild($text); } + + /** + * Set feed level logo (image) + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setImage(DOMDocument $dom, DOMElement $root) + { + $image = $this->getDataContainer()->getImage(); + if (!$image) { + return; + } + $img = $dom->createElement('logo'); + $root->appendChild($image); + $text = $img->createTextNode($image['uri']); + $img->appendChild($text); + } /** * Set date feed was created diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index 53026630..73a30c1c 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -79,6 +79,7 @@ public function render() $this->_setBaseUrl($this->_dom, $channel); $this->_setTitle($this->_dom, $channel); $this->_setDescription($this->_dom, $channel); + $this->_setImage($this->_dom, $channel); $this->_setDateCreated($this->_dom, $channel); $this->_setDateModified($this->_dom, $channel); $this->_setGenerator($this->_dom, $channel); @@ -312,6 +313,114 @@ protected function _setCopyright(DOMDocument $dom, DOMElement $root) $text = $dom->createTextNode($copyright); $copy->appendChild($text); } + + /** + * Set feed channel image + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setImage(DOMDocument $dom, DOMElement $root) + { + $image = $this->getDataContainer()->getImage(); + if (!$image) { + return; + } + if (!isset($image['title']) || empty($image['title']) + || !is_string($image['title'])) { + require_once 'Zend/Feed/Exception.php'; + $message = 'RSS 2.0 feed images must include a title'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + if (empty($data['link']) || !is_string($data['link']) + || !Zend_Uri::check($data['link'])) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Invalid parameter: parameter \'link\'' + . 'must be a non-empty string and valid URI/IRI'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $img = $dom->createElement('image'); + $root->appendChild($image); + $url = $dom->createElement('url'); + $text = $url->createTextNode($image['uri']); + $url->appendChild($text); + $title = $dom->createElement('title'); + $text = $title->createTextNode($image['title']); + $title->appendChild($text); + $link = $dom->createElement('link'); + $text = $link->createTextNode($image['link']); + $link->appendChild($text); + $img->appendChild($url); + $img->appendChild($title); + $img->appendChild($link); + if (isset($image['height']) && is_numeric($image['height'])) { + if ($image['height'] > 400) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Invalid parameter: parameter \'height\'' + . ' must be an integer not exceeding 400'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $height = $dom->createElement('height'); + $text = $height->createTextNode($image['height']); + $height->appendChild($text); + $img->appendChild($height); + } + if (isset($image['width']) && is_numeric($image['width'])) { + if ($image['width'] > 144) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Invalid parameter: parameter \'width\'' + . ' must be an integer not exceeding 144'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $width = $dom->createElement('width'); + $text = $width->createTextNode($image['width']); + $width->appendChild($text); + $img->appendChild($width); + } + if (isset($image['description'])) { + if (empty($image['description']) || !is_string($image['description'])) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Invalid parameter: parameter \'description\'' + . ' must be a non-empty string'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $desc = $dom->createElement('description'); + $text = $desc->createTextNode($image['description']); + $desc->appendChild($text); + $img->appendChild($desc); + } + } /** * Set date feed was created diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 3d8b9424..fa2642f7 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -500,4 +500,42 @@ public function testGetsCategoriesFromAtom03_None() $this->assertEquals(array(), (array) $feed->getCategories()); $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); } + + /** + * Get Image (Unencoded Text) + */ + public function testGetsImageFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/atom03.xml') + ); + $this->assertEquals(array('uri'=>'http://www.example.com/logo.gif'), $feed->getImage()); + } + + public function testGetsImageFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/atom10.xml') + ); + $this->assertEquals(array('uri'=>'http://www.example.com/logo.gif'), $feed->getImage()); + } + + /** + * Get Image (Unencoded Text) When Missing + */ + public function testGetsImageFromAtom03_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/atom03.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } + + public function testGetsImageFromAtom10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/atom10.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } } diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index b048cf60..b6d40633 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -2789,4 +2789,171 @@ public function testGetsCategoriesFromRss10_None() $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); } + /** + * Get Image data (Unencoded Text) + */ + public function testGetsImageFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/rss20.xml') + ); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/image.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image title', + 'height' => '55', + 'width' => '50', + 'description' => 'Image description' + ), $feed->getImage()); + } + + public function testGetsImageFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/rss094.xml') + ); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/image.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image title', + 'height' => '55', + 'width' => '50', + 'description' => 'Image description' + ), $feed->getImage()); + } + + public function testGetsImageFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/rss093.xml') + ); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/image.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image title', + 'height' => '55', + 'width' => '50', + 'description' => 'Image description' + ), $feed->getImage()); + } + + public function testGetsImageFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/rss092.xml') + ); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/image.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image title', + 'height' => '55', + 'width' => '50', + 'description' => 'Image description' + ), $feed->getImage()); + } + + public function testGetsImageFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/rss091.xml') + ); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/image.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image title', + 'height' => '55', + 'width' => '50', + 'description' => 'Image description' + ), $feed->getImage()); + } + + public function testGetsImageFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/rss10.xml') + ); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/image.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image title', + 'height' => '55', + 'width' => '50', + 'description' => 'Image description' + ), $feed->getImage()); + } + + public function testGetsImageFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/rss090.xml') + ); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/image.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image title', + 'height' => '55', + 'width' => '50', + 'description' => 'Image description' + ), $feed->getImage()); + } + + /** + * Get Image data (Unencoded Text) Missing + */ + public function testGetsImageFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/rss20.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } + + public function testGetsImageFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/rss094.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } + + public function testGetsImageFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/rss093.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } + + public function testGetsImageFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/rss092.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } + + public function testGetsImageFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/rss091.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } + + public function testGetsImageFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/rss10.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } + + public function testGetsImageFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/rss090.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } + } diff --git a/test/Reader/Feed/_files/Atom/image/plain/atom03.xml b/test/Reader/Feed/_files/Atom/image/plain/atom03.xml new file mode 100644 index 00000000..b4b808c9 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/image/plain/atom03.xml @@ -0,0 +1,4 @@ + + + http://www.example.com/logo.gif + diff --git a/test/Reader/Feed/_files/Atom/image/plain/atom10.xml b/test/Reader/Feed/_files/Atom/image/plain/atom10.xml new file mode 100644 index 00000000..7d674488 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/image/plain/atom10.xml @@ -0,0 +1,4 @@ + + + http://www.example.com/logo.gif + diff --git a/test/Reader/Feed/_files/Atom/image/plain/none/atom03.xml b/test/Reader/Feed/_files/Atom/image/plain/none/atom03.xml new file mode 100644 index 00000000..57c63ee9 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/image/plain/none/atom03.xml @@ -0,0 +1,3 @@ + + + diff --git a/test/Reader/Feed/_files/Atom/image/plain/none/atom10.xml b/test/Reader/Feed/_files/Atom/image/plain/none/atom10.xml new file mode 100644 index 00000000..2d884af2 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/image/plain/none/atom10.xml @@ -0,0 +1,3 @@ + + + diff --git a/test/Reader/Feed/_files/Rss/image/plain/none/rss090.xml b/test/Reader/Feed/_files/Rss/image/plain/none/rss090.xml new file mode 100644 index 00000000..3cec664b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/none/rss090.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/image/plain/none/rss091.xml b/test/Reader/Feed/_files/Rss/image/plain/none/rss091.xml new file mode 100644 index 00000000..259a7e27 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/none/rss091.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/image/plain/none/rss092.xml b/test/Reader/Feed/_files/Rss/image/plain/none/rss092.xml new file mode 100644 index 00000000..72ed43e2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/none/rss092.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/image/plain/none/rss093.xml b/test/Reader/Feed/_files/Rss/image/plain/none/rss093.xml new file mode 100644 index 00000000..1fb8f89e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/none/rss093.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/image/plain/none/rss094.xml b/test/Reader/Feed/_files/Rss/image/plain/none/rss094.xml new file mode 100644 index 00000000..30d48447 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/none/rss094.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/image/plain/none/rss10.xml b/test/Reader/Feed/_files/Rss/image/plain/none/rss10.xml new file mode 100644 index 00000000..67f28b9d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/none/rss10.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/image/plain/none/rss20.xml b/test/Reader/Feed/_files/Rss/image/plain/none/rss20.xml new file mode 100644 index 00000000..c60501ea --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/none/rss20.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/image/plain/rss090.xml b/test/Reader/Feed/_files/Rss/image/plain/rss090.xml new file mode 100644 index 00000000..a9146377 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/rss090.xml @@ -0,0 +1,15 @@ + + + + + http://www.example.com/image.gif + http://www.example.com + Image title + 50 + 55 + Image description + + + diff --git a/test/Reader/Feed/_files/Rss/image/plain/rss091.xml b/test/Reader/Feed/_files/Rss/image/plain/rss091.xml new file mode 100644 index 00000000..cab325ce --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/rss091.xml @@ -0,0 +1,13 @@ + + + + + http://www.example.com/image.gif + http://www.example.com + Image title + 50 + 55 + Image description + + + diff --git a/test/Reader/Feed/_files/Rss/image/plain/rss092.xml b/test/Reader/Feed/_files/Rss/image/plain/rss092.xml new file mode 100644 index 00000000..c921bb62 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/rss092.xml @@ -0,0 +1,13 @@ + + + + + http://www.example.com/image.gif + http://www.example.com + Image title + 50 + 55 + Image description + + + diff --git a/test/Reader/Feed/_files/Rss/image/plain/rss093.xml b/test/Reader/Feed/_files/Rss/image/plain/rss093.xml new file mode 100644 index 00000000..a76e122a --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/rss093.xml @@ -0,0 +1,13 @@ + + + + + http://www.example.com/image.gif + http://www.example.com + Image title + 50 + 55 + Image description + + + diff --git a/test/Reader/Feed/_files/Rss/image/plain/rss094.xml b/test/Reader/Feed/_files/Rss/image/plain/rss094.xml new file mode 100644 index 00000000..3757c0e0 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/rss094.xml @@ -0,0 +1,13 @@ + + + + + http://www.example.com/image.gif + http://www.example.com + Image title + 50 + 55 + Image description + + + diff --git a/test/Reader/Feed/_files/Rss/image/plain/rss10.xml b/test/Reader/Feed/_files/Rss/image/plain/rss10.xml new file mode 100644 index 00000000..1f8b8757 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/rss10.xml @@ -0,0 +1,15 @@ + + + + + http://www.example.com/image.gif + http://www.example.com + Image title + 50 + 55 + Image description + + + diff --git a/test/Reader/Feed/_files/Rss/image/plain/rss20.xml b/test/Reader/Feed/_files/Rss/image/plain/rss20.xml new file mode 100644 index 00000000..7038f7f3 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/rss20.xml @@ -0,0 +1,13 @@ + + + + + http://www.example.com/image.gif + http://www.example.com + Image title + 50 + 55 + Image description + + + diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php index 4fae8515..43aef101 100644 --- a/test/Writer/FeedTest.php +++ b/test/Writer/FeedTest.php @@ -686,6 +686,115 @@ public function testAddingCategoryWithInvalidUriAsSchemeThrowsException() } } + // Image Tests + + public function testSetsImageUri() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array( + 'uri' => 'http://www.example.com/logo.gif' + )); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/logo.gif' + ), $writer->getImage()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetsImageUriThrowsExceptionOnEmptyUri() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array( + 'uri' => '' + )); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetsImageUriThrowsExceptionOnMissingUri() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetsImageUriThrowsExceptionOnInvalidUri() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array( + 'uri' => 'http://' + )); + } + + public function testSetsImageLink() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com' + )); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com' + ), $writer->getImage()); + } + + public function testSetsImageTitle() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'title' => 'Image title' + )); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/logo.gif', + 'title' => 'Image title' + ), $writer->getImage()); + } + + public function testSetsImageHeight() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'height' => '88' + )); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/logo.gif', + 'height' => '88' + ), $writer->getImage()); + } + + public function testSetsImageWidth() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'width' => '88' + )); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/logo.gif', + 'width' => '88' + ), $writer->getImage()); + } + + public function testSetsImageDescription() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'description' => 'Image description' + )); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/logo.gif', + 'description' => 'Image description' + ), $writer->getImage()); + } + public function testGetCategoriesReturnsNullIfNotSet() { $writer = new Zend_Feed_Writer_Feed; From d7932af04000d010d17f8a1823e57cef92cc53eb Mon Sep 17 00:00:00 2001 From: padraic Date: Tue, 4 May 2010 18:51:58 +0000 Subject: [PATCH 131/238] Added unit tests for Atom logo rendering in Zend_Feed_Writer git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22099 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Writer/Renderer/Feed/Atom/AtomAbstract.php | 4 ++-- src/Writer/Renderer/Feed/Rss.php | 12 ++++++------ test/Writer/Renderer/Feed/AtomTest.php | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/Writer/Renderer/Feed/Atom/AtomAbstract.php b/src/Writer/Renderer/Feed/Atom/AtomAbstract.php index d12e3a33..b3f2b2fb 100644 --- a/src/Writer/Renderer/Feed/Atom/AtomAbstract.php +++ b/src/Writer/Renderer/Feed/Atom/AtomAbstract.php @@ -336,8 +336,8 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) return; } $img = $dom->createElement('logo'); - $root->appendChild($image); - $text = $img->createTextNode($image['uri']); + $root->appendChild($img); + $text = $dom->createTextNode($image['uri']); $img->appendChild($text); } diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index 73a30c1c..9c96a425 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -355,13 +355,13 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) $img = $dom->createElement('image'); $root->appendChild($image); $url = $dom->createElement('url'); - $text = $url->createTextNode($image['uri']); + $text = $dom->createTextNode($image['uri']); $url->appendChild($text); $title = $dom->createElement('title'); - $text = $title->createTextNode($image['title']); + $text = $dom->createTextNode($image['title']); $title->appendChild($text); $link = $dom->createElement('link'); - $text = $link->createTextNode($image['link']); + $text = $dom->createTextNode($image['link']); $link->appendChild($text); $img->appendChild($url); $img->appendChild($title); @@ -380,7 +380,7 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) } } $height = $dom->createElement('height'); - $text = $height->createTextNode($image['height']); + $text = $dom->createTextNode($image['height']); $height->appendChild($text); $img->appendChild($height); } @@ -398,7 +398,7 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) } } $width = $dom->createElement('width'); - $text = $width->createTextNode($image['width']); + $text = $dom->createTextNode($image['width']); $width->appendChild($text); $img->appendChild($width); } @@ -416,7 +416,7 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) } } $desc = $dom->createElement('description'); - $text = $desc->createTextNode($image['description']); + $text = $dom->createTextNode($image['description']); $desc->appendChild($text); $img->appendChild($desc); } diff --git a/test/Writer/Renderer/Feed/AtomTest.php b/test/Writer/Renderer/Feed/AtomTest.php index 71e0b877..fe290dcd 100644 --- a/test/Writer/Renderer/Feed/AtomTest.php +++ b/test/Writer/Renderer/Feed/AtomTest.php @@ -403,4 +403,18 @@ public function testHubsCanBeSet() $this->assertEquals($expected, (array) $feed->getHubs()); } + public function testImageCanBeSet() + { + $this->_validWriter->setImage( + array('uri'=>'http://www.example.com/logo.gif') + ); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $expected = array( + 'uri' => 'http://www.example.com/logo.gif' + ); + $this->assertEquals($expected, $feed->getImage()); + } + } From c5c8e619066fd4a2710477933cb7ba8d6d754e4b Mon Sep 17 00:00:00 2001 From: padraic Date: Wed, 5 May 2010 11:39:51 +0000 Subject: [PATCH 132/238] Added final tests for Zend_Feed_Writer RSS image support git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22102 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Writer/Renderer/Feed/Rss.php | 16 +- test/Writer/Renderer/Feed/RssTest.php | 208 ++++++++++++++++++++++++++ 2 files changed, 216 insertions(+), 8 deletions(-) diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index 9c96a425..901fe619 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -339,11 +339,11 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) return; } } - if (empty($data['link']) || !is_string($data['link']) - || !Zend_Uri::check($data['link'])) { + if (empty($image['link']) || !is_string($image['link']) + || !Zend_Uri::check($image['link'])) { require_once 'Zend/Feed/Exception.php'; $message = 'Invalid parameter: parameter \'link\'' - . 'must be a non-empty string and valid URI/IRI'; + . ' must be a non-empty string and valid URI/IRI'; $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; @@ -353,7 +353,7 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) } } $img = $dom->createElement('image'); - $root->appendChild($image); + $root->appendChild($img); $url = $dom->createElement('url'); $text = $dom->createTextNode($image['uri']); $url->appendChild($text); @@ -366,8 +366,8 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) $img->appendChild($url); $img->appendChild($title); $img->appendChild($link); - if (isset($image['height']) && is_numeric($image['height'])) { - if ($image['height'] > 400) { + if (isset($image['height'])) { + if (!ctype_digit((string) $image['height']) || $image['height'] > 400) { require_once 'Zend/Feed/Exception.php'; $message = 'Invalid parameter: parameter \'height\'' . ' must be an integer not exceeding 400'; @@ -384,8 +384,8 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) $height->appendChild($text); $img->appendChild($height); } - if (isset($image['width']) && is_numeric($image['width'])) { - if ($image['width'] > 144) { + if (isset($image['width'])) { + if (!ctype_digit((string) $image['width']) || $image['width'] > 144) { require_once 'Zend/Feed/Exception.php'; $message = 'Invalid parameter: parameter \'width\'' . ' must be an integer not exceeding 144'; diff --git a/test/Writer/Renderer/Feed/RssTest.php b/test/Writer/Renderer/Feed/RssTest.php index a89eeea2..395d46d2 100644 --- a/test/Writer/Renderer/Feed/RssTest.php +++ b/test/Writer/Renderer/Feed/RssTest.php @@ -352,4 +352,212 @@ public function testHubsCanBeSet() $this->assertEquals($expected, (array) $feed->getHubs()); } + public function testImageCanBeSet() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'height' => '400', + 'width' => '144', + 'description' => 'Image TITLE' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $expected = array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'height' => '400', + 'width' => '144', + 'description' => 'Image TITLE' + ); + $this->assertEquals($expected, $feed->getImage()); + } + + public function testImageCanBeSetWithOnlyRequiredElements() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $expected = array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT' + ); + $this->assertEquals($expected, $feed->getImage()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionOnMissingLink() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'title' => 'Image ALT' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionOnMissingTitle() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionOnMissingUri() + { + $this->_validWriter->setImage(array( + 'link' => 'http://www.example.com', + 'title' => 'Image ALT' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionIfOptionalDescriptionInvalid() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'description' => 2 + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionIfOptionalDescriptionEmpty() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'description' => '' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionIfOptionalHeightNotAnInteger() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'height' => 'a', + 'width' => 144 + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionIfOptionalHeightEmpty() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'height' => '', + 'width' => 144 + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionIfOptionalHeightGreaterThan400() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'height' => '401', + 'width' => 144 + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionIfOptionalWidthNotAnInteger() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'height' => '400', + 'width' => 'a' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionIfOptionalWidthEmpty() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'height' => '400', + 'width' => '' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionIfOptionalWidthGreaterThan144() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'height' => '400', + 'width' => '145' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + } From 866d6b3ab722b89f60d1e621118a13e27f10764a Mon Sep 17 00:00:00 2001 From: padraic Date: Wed, 5 May 2010 13:42:20 +0000 Subject: [PATCH 133/238] Added lastBuildDate RSS support to Zend_Feed_Reader/Writer - implements ZF-9595 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22107 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Feed/Atom.php | 10 +++++ src/Reader/Feed/Rss.php | 54 +++++++++++++++++++++++++++ src/Writer/Feed/FeedAbstract.php | 34 +++++++++++++++++ src/Writer/Renderer/Feed/Rss.php | 22 +++++++++++ test/Reader/Feed/AtomTest.php | 11 ++++++ test/Reader/Feed/RssTest.php | 21 +++++++++++ test/Writer/FeedTest.php | 40 ++++++++++++++++++++ test/Writer/Renderer/Feed/RssTest.php | 9 +++++ 8 files changed, 201 insertions(+) diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index ac29cbf2..7e895ec5 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -157,6 +157,16 @@ public function getDateModified() return $this->_data['datemodified']; } + /** + * Get the feed lastBuild date. This is not implemented in Atom. + * + * @return string|null + */ + public function getLastBuildDate() + { + return null; + } + /** * Get the feed description * diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 495df477..832da768 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -270,6 +270,60 @@ public function getDateModified() return $this->_data['datemodified']; } + /** + * Get the feed lastBuild date + * + * @return Zend_Date + */ + public function getLastBuildDate() + { + if (array_key_exists('lastBuildDate', $this->_data)) { + return $this->_data['lastBuildDate']; + } + + $lastBuildDate = null; + $date = null; + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $lastBuildDate = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)'); + if ($lastBuildDate) { + $lastBuildDateParsed = strtotime($lastBuildDate); + if ($lastBuildDateParsed) { + $date = new Zend_Date($lastBuildDateParsed); + } else { + $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($lastBuildDate, $standard); + break; + } 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):' + . $e->getMessage(), + 0, $e + ); + } + } + } + } + } + } + + if (!$date) { + $date = null; + } + + $this->_data['lastBuildDate'] = $date; + + return $this->_data['lastBuildDate']; + } + /** * Get the feed description * diff --git a/src/Writer/Feed/FeedAbstract.php b/src/Writer/Feed/FeedAbstract.php index 72fac523..3699283a 100644 --- a/src/Writer/Feed/FeedAbstract.php +++ b/src/Writer/Feed/FeedAbstract.php @@ -205,6 +205,27 @@ public function setDateModified($date = null) $this->_data['dateModified'] = $zdate; } + /** + * Set the feed last-build date. Ignored for Atom 1.0. + * + * @param null|integer|Zend_Date + */ + public function setLastBuildDate($date = null) + { + $zdate = null; + if (is_null($date)) { + $zdate = new Zend_Date; + } elseif (ctype_digit($date) && strlen($date) == 10) { + $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); + } elseif ($date instanceof Zend_Date) { + $zdate = $date; + } else { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + } + $this->_data['lastBuildDate'] = $zdate; + } + /** * Set the feed description * @@ -532,6 +553,19 @@ public function getDateModified() return $this->_data['dateModified']; } + /** + * Get the feed last-build date + * + * @return string|null + */ + public function getLastBuildDate() + { + if (!array_key_exists('lastBuildDate', $this->_data)) { + return null; + } + return $this->_data['lastBuildDate']; + } + /** * Get the feed description * diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index 901fe619..09f52135 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -82,6 +82,7 @@ public function render() $this->_setImage($this->_dom, $channel); $this->_setDateCreated($this->_dom, $channel); $this->_setDateModified($this->_dom, $channel); + $this->_setLastBuildDate($this->_dom, $channel); $this->_setGenerator($this->_dom, $channel); $this->_setLink($this->_dom, $channel); $this->_setAuthors($this->_dom, $channel); @@ -440,6 +441,27 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) ); } } + + /** + * Set date feed last build date + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setLastBuildDate(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getLastBuildDate()) { + return; + } + + $lastBuildDate = $dom->createElement('lastBuildDate'); + $root->appendChild($lastBuildDate); + $text = $dom->createTextNode( + $this->getDataContainer()->getLastBuildDate()->get(Zend_Date::RSS) + ); + $lastBuildDate->appendChild($text); + } /** * Set base URL to feed links diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index fa2642f7..56898fe6 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -222,6 +222,17 @@ public function testGetsDateModifiedFromAtom10() $this->assertTrue($edate->equals($feed->getDateModified())); } + /** + * Get Last Build Date (Unencoded Text) + */ + public function testGetsLastBuildDateAlwaysReturnsNullForAtom() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10.xml') + ); + $this->assertNull($feed->getLastBuildDate()); + } + /** * Get Generator (Unencoded Text) */ diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index b6d40633..02aef867 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -2099,6 +2099,27 @@ public function testGetsGeneratorFromRss090_None() $this->assertEquals(null, $feed->getGenerator()); } + /** + * Get Last Build Date (Unencoded Text) + */ + public function testGetsLastBuildDateFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/lastbuilddate/plain/rss20.xml') + ); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getLastBuildDate())); + } + + public function testGetsLastBuildDateFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/lastbuilddate/plain/none/rss20.xml') + ); + $this->assertEquals(null, $feed->getLastBuildDate()); + } + /** * Get Date Modified (Unencoded Text) */ diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php index 43aef101..265d89c1 100644 --- a/test/Writer/FeedTest.php +++ b/test/Writer/FeedTest.php @@ -262,6 +262,46 @@ public function testGetDateModifiedReturnsNullIfDateNotSet() $this->assertTrue(is_null($writer->getDateModified())); } + public function testSetLastBuildDateDefaultsToCurrentTime() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setLastBuildDate(); + $dateNow = new Zend_Date; + $this->assertTrue($dateNow->isLater($writer->getLastBuildDate()) || $dateNow->equals($writer->getLastBuildDate())); + } + + public function testSetLastBuildDateUsesGivenUnixTimestamp() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setLastBuildDate(1234567890); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $this->assertTrue($myDate->equals($writer->getLastBuildDate())); + } + + public function testSetLastBuildDateUsesZendDateObject() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setLastBuildDate(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $this->assertTrue($myDate->equals($writer->getLastBuildDate())); + } + + public function testSetLastBuildDateThrowsExceptionOnInvalidParameter() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setLastBuildDate('abc'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetLastBuildDateReturnsNullIfDateNotSet() + { + $writer = new Zend_Feed_Writer_Feed; + $this->assertTrue(is_null($writer->getLastBuildDate())); + } + public function testGetCopyrightReturnsNullIfDateNotSet() { $writer = new Zend_Feed_Writer_Feed; diff --git a/test/Writer/Renderer/Feed/RssTest.php b/test/Writer/Renderer/Feed/RssTest.php index 395d46d2..9217c107 100644 --- a/test/Writer/Renderer/Feed/RssTest.php +++ b/test/Writer/Renderer/Feed/RssTest.php @@ -165,6 +165,15 @@ public function testFeedUpdatedDateIfMissingThrowsNoException() $rssFeed->render(); } + public function testFeedLastBuildDateHasBeenSet() + { + $this->_validWriter->setLastBuildDate(1234567890); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals(1234567890, $feed->getLastBuildDate()->get(Zend_Date::TIMESTAMP)); + } + public function testFeedGeneratorHasBeenSet() { $this->_validWriter->setGenerator('FooFeedBuilder', '1.00', 'http://www.example.com'); From e7bc2be2fc8db5400dd8eb55e46453ac74005023 Mon Sep 17 00:00:00 2001 From: Ralph Schindler Date: Fri, 21 May 2010 12:24:57 -0500 Subject: [PATCH 134/238] Converted Zend_Feed to namespaced Zend\Feed, with tests (some failures) --- src/{Abstract.php => AbstractFeed.php} | 39 +- src/Atom.php | 33 +- src/{ => Builder}/Builder.php | 41 +- .../{Interface.php => BuilderInterface.php} | 11 +- src/Builder/Entry.php | 41 +- src/Builder/Exception.php | 9 +- src/Builder/{ => Header}/Header.php | 102 +-- src/Builder/Header/Itunes.php | 54 +- src/Builder/Header/iTunes.php | 267 +++++++ src/Element.php | 45 +- src/Entry/{Abstract.php => AbstractEntry.php} | 28 +- src/Entry/Atom.php | 46 +- src/Entry/RSS.php | 120 +++ src/Entry/Rss.php | 9 +- src/Exception.php | 9 +- src/Feed.php | 385 ++++++++++ src/PubSubHubbub/CallbackAbstract.php | 302 ++++++++ src/PubSubHubbub/CallbackInterface.php | 74 ++ src/PubSubHubbub/Exception.php | 35 + src/PubSubHubbub/HttpResponse.php | 234 ++++++ src/PubSubHubbub/Model/ModelAbstract.php | 62 ++ src/PubSubHubbub/Model/Subscription.php | 134 ++++ .../Model/SubscriptionInterface.php | 70 ++ .../PubSubHubbub.php} | 43 +- src/PubSubHubbub/Publisher.php | 414 +++++++++++ src/PubSubHubbub/Subscriber/Callback.php | 323 ++++++++ .../Subscriber}/Subscriber.php | 146 ++-- src/Pubsubhubbub/CallbackAbstract.php | 57 +- src/Pubsubhubbub/CallbackInterface.php | 11 +- src/Pubsubhubbub/Exception.php | 9 +- src/Pubsubhubbub/HttpResponse.php | 23 +- src/Pubsubhubbub/Model/ModelAbstract.php | 19 +- src/Pubsubhubbub/Model/Subscription.php | 31 +- .../Model/SubscriptionInterface.php | 7 +- src/Pubsubhubbub/Publisher.php | 82 +- src/Pubsubhubbub/Subscriber/Callback.php | 25 +- src/RSS.php | 517 +++++++++++++ src/Reader/Collection/Author.php | 13 +- src/Reader/Collection/Category.php | 13 +- src/Reader/{ => Collection}/Collection.php | 7 +- src/Reader/Collection/CollectionAbstract.php | 7 +- src/Reader/Entry/Atom.php | 39 +- src/Reader/Entry/RSS.php | 629 ++++++++++++++++ src/Reader/Entry/Rss.php | 123 +-- src/Reader/EntryAbstract.php | 35 +- src/Reader/EntryInterface.php | 9 +- src/Reader/Extension/Atom/Entry.php | 87 ++- src/Reader/Extension/Atom/Feed.php | 87 ++- src/Reader/Extension/Content/Entry.php | 16 +- .../Extension/CreativeCommons/Entry.php | 13 +- src/Reader/Extension/CreativeCommons/Feed.php | 11 +- src/Reader/Extension/DublinCore/Entry.php | 37 +- src/Reader/Extension/DublinCore/Feed.php | 37 +- src/Reader/Extension/EntryAbstract.php | 34 +- src/Reader/Extension/FeedAbstract.php | 27 +- src/Reader/Extension/Podcast/Entry.php | 11 +- src/Reader/Extension/Podcast/Feed.php | 11 +- src/Reader/Extension/Slash/Entry.php | 13 +- src/Reader/Extension/Syndication/Feed.php | 22 +- src/Reader/Extension/Thread/Entry.php | 11 +- src/Reader/Extension/WellFormedWeb/Entry.php | 13 +- src/Reader/Feed/{ => Atom}/Atom.php | 38 +- src/Reader/Feed/Atom/Source.php | 24 +- src/Reader/Feed/RSS.php | 611 +++++++++++++++ src/Reader/Feed/Rss.php | 117 +-- src/Reader/FeedAbstract.php | 35 +- src/Reader/FeedInterface.php | 9 +- src/Reader/FeedSet.php | 24 +- src/{ => Reader}/Reader.php | 149 ++-- src/Rss.php | 35 +- src/Writer/Deleted.php | 35 +- src/Writer/Entry.php | 120 +-- .../Exception/InvalidMethodException.php | 9 +- src/Writer/Extension/Atom/Renderer/Feed.php | 17 +- .../Extension/Content/Renderer/Entry.php | 15 +- .../Extension/DublinCore/Renderer/Entry.php | 15 +- .../Extension/DublinCore/Renderer/Feed.php | 15 +- src/Writer/Extension/ITunes/Entry.php | 56 +- src/Writer/Extension/ITunes/Feed.php | 92 +-- .../Extension/ITunes/Renderer/Entry.php | 27 +- src/Writer/Extension/ITunes/Renderer/Feed.php | 35 +- src/Writer/Extension/RendererAbstract.php | 25 +- src/Writer/Extension/RendererInterface.php | 9 +- src/Writer/Extension/Slash/Renderer/Entry.php | 15 +- .../Extension/Threading/Renderer/Entry.php | 19 +- .../WellFormedWeb/Renderer/Entry.php | 15 +- src/Writer/{ => Feed}/Feed.php | 58 +- src/Writer/Feed/FeedAbstract.php | 121 +-- src/Writer/Renderer/Entry/{ => Atom}/Atom.php | 83 ++- src/Writer/Renderer/Entry/Atom/Deleted.php | 31 +- src/Writer/Renderer/Entry/RSS.php | 319 ++++++++ src/Writer/Renderer/Entry/Rss.php | 58 +- src/Writer/Renderer/Feed/{ => Atom}/Atom.php | 43 +- .../Renderer/Feed/Atom/AtomAbstract.php | 66 +- src/Writer/Renderer/Feed/Atom/Source.php | 25 +- src/Writer/Renderer/Feed/RSS.php | 371 ++++++++++ src/Writer/Renderer/Feed/Rss.php | 74 +- src/Writer/Renderer/RendererAbstract.php | 30 +- src/Writer/Renderer/RendererInterface.php | 9 +- src/Writer/Source.php | 9 +- src/{ => Writer}/Writer.php | 44 +- test/ArrayAccessTest.php | 18 +- test/AtomEntryOnlyTest.php | 18 +- test/AtomPublishingTest.php | 33 +- test/CountTest.php | 12 +- test/ElementTest.php | 25 +- test/Entry/{RssTest.php => RSSTest.php} | 21 +- test/ImportTest.php | 103 ++- test/IteratorTest.php | 16 +- test/Pubsubhubbub/PublisherTest.php | 58 +- test/Pubsubhubbub/PubsubhubbubTest.php | 20 +- test/Pubsubhubbub/Subscriber/CallbackTest.php | 65 +- test/Pubsubhubbub/SubscriberHttpTest.php | 17 +- test/Pubsubhubbub/SubscriberTest.php | 71 +- test/Reader/Entry/AtomStandaloneEntryTest.php | 64 +- test/Reader/Entry/AtomTest.php | 112 +-- test/Reader/Entry/CommonTest.php | 39 +- test/Reader/Entry/RssTest.php | 688 ++++++++--------- test/Reader/Feed/AtomSourceTest.php | 60 +- test/Reader/Feed/AtomTest.php | 110 +-- test/Reader/Feed/CommonTest.php | 39 +- test/Reader/Feed/{RssTest.php => RSSTest.php} | 700 +++++++++--------- .../Integration/H-OnlineComAtom10Test.php | 54 +- test/Reader/Integration/LautDeRdfTest.php | 52 +- test/Reader/Integration/PodcastRss2Test.php | 68 +- .../Integration/WordpressAtom10Test.php | 54 +- .../Integration/WordpressRss2DcAtomTest.php | 47 +- .../_files/My/Extension/JungleBooks/Entry.php | 7 +- .../_files/My/Extension/JungleBooks/Feed.php | 6 +- test/ReaderTest.php | 127 ++-- test/Writer/DeletedTest.php | 60 +- test/Writer/EntryTest.php | 224 +++--- test/Writer/Extension/ITunes/EntryTest.php | 98 +-- test/Writer/Extension/ITunes/FeedTest.php | 134 ++-- test/Writer/FeedTest.php | 230 +++--- test/Writer/Renderer/Entry/AtomTest.php | 114 ++- test/Writer/Renderer/Entry/RssTest.php | 116 +-- test/Writer/Renderer/Feed/AtomTest.php | 152 ++-- test/Writer/Renderer/Feed/RssTest.php | 136 ++-- 139 files changed, 8731 insertions(+), 3301 deletions(-) rename src/{Abstract.php => AbstractFeed.php} (84%) rename src/{ => Builder}/Builder.php (92%) rename src/Builder/{Interface.php => BuilderInterface.php} (88%) rename src/Builder/{ => Header}/Header.php (75%) create mode 100644 src/Builder/Header/iTunes.php rename src/Entry/{Abstract.php => AbstractEntry.php} (81%) create mode 100644 src/Entry/RSS.php create mode 100644 src/Feed.php create mode 100644 src/PubSubHubbub/CallbackAbstract.php create mode 100644 src/PubSubHubbub/CallbackInterface.php create mode 100644 src/PubSubHubbub/Exception.php create mode 100644 src/PubSubHubbub/HttpResponse.php create mode 100644 src/PubSubHubbub/Model/ModelAbstract.php create mode 100644 src/PubSubHubbub/Model/Subscription.php create mode 100644 src/PubSubHubbub/Model/SubscriptionInterface.php rename src/{Pubsubhubbub.php => PubSubHubbub/PubSubHubbub.php} (77%) create mode 100644 src/PubSubHubbub/Publisher.php create mode 100644 src/PubSubHubbub/Subscriber/Callback.php rename src/{Pubsubhubbub => PubSubHubbub/Subscriber}/Subscriber.php (83%) create mode 100644 src/RSS.php rename src/Reader/{ => Collection}/Collection.php (90%) create mode 100644 src/Reader/Entry/RSS.php rename src/Reader/Feed/{ => Atom}/Atom.php (88%) create mode 100644 src/Reader/Feed/RSS.php rename src/{ => Reader}/Reader.php (82%) rename src/Writer/{ => Feed}/Feed.php (82%) rename src/Writer/Renderer/Entry/{ => Atom}/Atom.php (82%) create mode 100644 src/Writer/Renderer/Entry/RSS.php rename src/Writer/Renderer/Feed/{ => Atom}/Atom.php (74%) create mode 100644 src/Writer/Renderer/Feed/RSS.php rename src/{ => Writer}/Writer.php (86%) rename test/Entry/{RssTest.php => RSSTest.php} (81%) rename test/Reader/Feed/{RssTest.php => RSSTest.php} (82%) diff --git a/src/Abstract.php b/src/AbstractFeed.php similarity index 84% rename from src/Abstract.php rename to src/AbstractFeed.php index dffeaeee..8e73a826 100644 --- a/src/Abstract.php +++ b/src/AbstractFeed.php @@ -20,6 +20,11 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed; + /** * The Zend_Feed_Abstract class is an abstract class representing feeds. * @@ -30,15 +35,15 @@ * * @uses Countable * @uses Iterator - * @uses Zend_Feed - * @uses Zend_Feed_Element - * @uses Zend_Feed_Exception + * @uses \Zend\Feed\Feed + * @uses \Zend\Feed\Element + * @uses \Zend\Feed\Exception * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 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, Countable +abstract class AbstractFeed extends Element implements \Iterator, \Countable { /** * Current index on the collection of feed entries for the @@ -63,19 +68,19 @@ abstract class Zend_Feed_Abstract extends Zend_Feed_Element implements Iterator, * * @param string $uri The full URI of the feed to load, or NULL if not retrieved via HTTP or as an array. * @param string $string The feed as a string, or NULL if retrieved via HTTP or as an array. - * @param Zend_Feed_Builder_Interface $builder The feed as a builder instance or NULL if retrieved as a string or via HTTP. + * @param \Zend\Feed\Builder\BuilderInterface $builder The feed as a builder instance or NULL if retrieved as a string or via HTTP. * @return void - * @throws Zend_Feed_Exception If loading the feed failed. + * @throws \Zend\Feed\Exception If loading the feed failed. */ - public function __construct($uri = null, $string = null, Zend_Feed_Builder_Interface $builder = null) + public function __construct($uri = null, $string = null, Builder\BuilderInterface $builder = null) { if ($uri !== null) { // Retrieve the feed via HTTP - $client = Zend_Feed::getHttpClient(); + $client = Feed::getHttpClient(); $client->setUri($uri); $response = $client->request('GET'); if ($response->getStatus() !== 200) { - throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); + throw new Exception('Feed failed to load, got response code ' . $response->getStatus()); } $this->_element = $response->getBody(); $this->__wakeup(); @@ -86,7 +91,7 @@ public function __construct($uri = null, $string = null, Zend_Feed_Builder_Inter } else { // Generate the feed from the array $header = $builder->getHeader(); - $this->_element = new DOMDocument('1.0', $header['charset']); + $this->_element = new \DOMDocument('1.0', $header['charset']); $root = $this->_mapFeedHeaders($header); $this->_mapFeedEntries($root, $builder->getEntries()); $this->_element = $root; @@ -99,12 +104,12 @@ public function __construct($uri = null, $string = null, Zend_Feed_Builder_Inter * Load the feed as an XML DOMDocument object * * @return void - * @throws Zend_Feed_Exception + * @throws \Zend\Feed\Exception */ public function __wakeup() { @ini_set('track_errors', 1); - $doc = new DOMDocument; + $doc = new \DOMDocument; $status = @$doc->loadXML($this->_element); @ini_restore('track_errors'); @@ -118,7 +123,7 @@ public function __wakeup() } } - throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg"); + throw new Exception("DOMDocument cannot parse XML: $php_errormsg"); } $this->_element = $doc; @@ -184,9 +189,11 @@ public function rewind() */ public function current() { + //$entryClassName = ; return new $this->_entryClassName( null, - $this->_entries[$this->_entryIndex]); + $this->_entries[$this->_entryIndex] + ); } @@ -237,12 +244,12 @@ abstract protected function _mapFeedHeaders($array); * @param array $array the data to use * @return DOMElement root node */ - abstract protected function _mapFeedEntries(DOMElement $root, $array); + abstract protected function _mapFeedEntries(\DOMElement $root, $array); /** * Send feed to a http client with the correct header * - * @throws Zend_Feed_Exception if headers have already been sent + * @throws \Zend\Feed\Exception if headers have already been sent * @return void */ abstract public function send(); diff --git a/src/Atom.php b/src/Atom.php index ead22b4f..4af9998c 100644 --- a/src/Atom.php +++ b/src/Atom.php @@ -19,6 +19,11 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed; + /** * Atom feed class * @@ -30,15 +35,15 @@ * what kind of feed object they have been passed. * * @uses DOMDocument - * @uses Zend_Feed_Abstract - * @uses Zend_Feed_Entry_Atom - * @uses Zend_Feed_Exception + * @uses \Zend\Feed\AbstractFeed + * @uses \Zend\Feed\Entry\Atom + * @uses \Zend\Feed\Exception * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Atom extends Zend_Feed_Abstract +class Atom extends AbstractFeed { /** @@ -46,7 +51,7 @@ class Zend_Feed_Atom extends Zend_Feed_Abstract * * @var string */ - protected $_entryClassName = 'Zend_Feed_Entry_Atom'; + protected $_entryClassName = 'Zend\Feed\Entry\Atom'; /** * The element name for individual feed elements (Atom @@ -68,7 +73,7 @@ class Zend_Feed_Atom extends Zend_Feed_Abstract * Override Zend_Feed_Abstract to set up the $_element and $_entries aliases. * * @return void - * @throws Zend_Feed_Exception + * @throws \Zend\Feed\Exception */ public function __wakeup() { @@ -80,11 +85,11 @@ public function __wakeup() // Try to find a single instead. $element = $this->_element->getElementsByTagName($this->_entryElementName)->item(0); if (!$element) { - throw new Zend_Feed_Exception('No root or <' . $this->_entryElementName + throw new Exception('No root or <' . $this->_entryElementName . '> element found, cannot parse feed.'); } - $doc = new DOMDocument($this->_element->version, + $doc = new \DOMDocument($this->_element->version, $this->_element->actualEncoding); $feed = $doc->appendChild($doc->createElement('feed')); $feed->appendChild($doc->importNode($element, true)); @@ -123,7 +128,7 @@ public function link($rel = null) // index link tags by their "rel" attribute. $links = parent::__get('link'); if (!is_array($links)) { - if ($links instanceof Zend_Feed_Element) { + if ($links instanceof Element) { $links = array($links); } else { return $links; @@ -229,7 +234,7 @@ protected function _mapFeedHeaders($array) $feed->appendChild($image); } - $generator = !empty($array->generator) ? $array->generator : 'Zend_Feed'; + $generator = !empty($array->generator) ? $array->generator : 'Zend\Feed'; $generator = $this->_element->createElement('generator', $generator); $feed->appendChild($generator); @@ -253,7 +258,7 @@ protected function _mapFeedHeaders($array) * @param DOMElement $root the root node to use * @return void */ - protected function _mapFeedEntries(DOMElement $root, $array) + protected function _mapFeedEntries(\DOMElement $root, $array) { foreach ($array as $dataentry) { $entry = $this->_element->createElement('entry'); @@ -346,7 +351,7 @@ protected function _mapFeedEntries(DOMElement $root, $array) public function saveXml() { // Return a complete document including XML prologue. - $doc = new DOMDocument($this->_element->ownerDocument->version, + $doc = new \DOMDocument($this->_element->ownerDocument->version, $this->_element->ownerDocument->actualEncoding); $doc->appendChild($doc->importNode($this->_element, true)); $doc->formatOutput = true; @@ -358,12 +363,12 @@ public function saveXml() * Send feed to a http client with the correct header * * @return void - * @throws Zend_Feed_Exception if headers have already been sent + * @throws \Zend\Feed\Exception if headers have already been sent */ public function send() { if (headers_sent()) { - throw new Zend_Feed_Exception('Cannot send ATOM because headers have already been sent.'); + throw new Exception('Cannot send ATOM because headers have already been sent.'); } header('Content-Type: application/atom+xml; charset=' . $this->_element->ownerDocument->actualEncoding); diff --git a/src/Builder.php b/src/Builder/Builder.php similarity index 92% rename from src/Builder.php rename to src/Builder/Builder.php index b09e6f91..8d4e78d0 100644 --- a/src/Builder.php +++ b/src/Builder/Builder.php @@ -20,21 +20,26 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Builder; + /** * A simple implementation of Zend_Feed_Builder_Interface. * * Users are encouraged to make their own classes to implement Zend_Feed_Builder_Interface * - * @uses Zend_Feed_Builder_Entry - * @uses Zend_Feed_Builder_Exception - * @uses Zend_Feed_Builder_Header - * @uses Zend_Feed_Builder_Interface + * @uses \Zend\Feed\Builder\Entry + * @uses \Zend\Feed\Builder\Exception + * @uses \Zend\Feed\Builder\Header\Header + * @uses \Zend\Feed\Builder\BuilderInterface * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Builder implements Zend_Feed_Builder_Interface +class Builder implements BuilderInterface { /** * The data of the feed @@ -46,7 +51,7 @@ class Zend_Feed_Builder implements Zend_Feed_Builder_Interface /** * Header of the feed * - * @var $_header Zend_Feed_Builder_Header + * @var $_header \Zend\Feed\Builder\Header\Header */ private $_header; @@ -174,7 +179,7 @@ public function __construct(array $data) * Returns an instance of Zend_Feed_Builder_Header * describing the header of the feed * - * @return Zend_Feed_Builder_Header + * @return \Zend\Feed\Builder\Header\Header */ public function getHeader() { @@ -185,7 +190,7 @@ public function getHeader() * Returns an array of Zend_Feed_Builder_Entry instances * describing the entries of the feed * - * @return array of Zend_Feed_Builder_Entry + * @return array of \Zend\Feed\Builder\Entry */ public function getEntries() { @@ -196,7 +201,7 @@ public function getEntries() * Create the Zend_Feed_Builder_Header instance * * @param array $data - * @throws Zend_Feed_Builder_Exception + * @throws \Zend\Feed\Builder\Exception * @return void */ protected function _createHeader(array $data) @@ -204,10 +209,10 @@ protected function _createHeader(array $data) $mandatories = array('title', 'link', 'charset'); foreach ($mandatories as $mandatory) { if (!isset($data[$mandatory])) { - throw new Zend_Feed_Builder_Exception("$mandatory key is missing"); + throw new Exception("$mandatory key is missing"); } } - $this->_header = new Zend_Feed_Builder_Header($data['title'], $data['link'], $data['charset']); + $this->_header = new Header\Header($data['title'], $data['link'], $data['charset']); if (isset($data['lastUpdate'])) { $this->_header->setLastUpdate($data['lastUpdate']); } @@ -248,7 +253,7 @@ protected function _createHeader(array $data) $mandatories = array('domain', 'path', 'registerProcedure', 'protocol'); foreach ($mandatories as $mandatory) { if (!isset($data['cloud'][$mandatory])) { - throw new Zend_Feed_Builder_Exception("you have to define $mandatory property of your cloud"); + throw new Exception("you have to define $mandatory property of your cloud"); } } $uri_str = 'http://' . $data['cloud']['domain'] . $data['cloud']['path']; @@ -258,7 +263,7 @@ protected function _createHeader(array $data) $mandatories = array('title', 'description', 'name', 'link'); foreach ($mandatories as $mandatory) { if (!isset($data['textInput'][$mandatory])) { - throw new Zend_Feed_Builder_Exception("you have to define $mandatory property of your textInput"); + throw new Exception("you have to define $mandatory property of your textInput"); } } $this->_header->setTextInput($data['textInput']['title'], @@ -273,7 +278,7 @@ protected function _createHeader(array $data) $this->_header->setSkipDays($data['skipDays']); } if (isset($data['itunes'])) { - $itunes = new Zend_Feed_Builder_Header_Itunes($data['itunes']['category']); + $itunes = new Header\iTunes($data['itunes']['category']); if (isset($data['itunes']['author'])) { $itunes->setAuthor($data['itunes']['author']); } @@ -312,7 +317,7 @@ protected function _createHeader(array $data) * Create the array of article entries * * @param array $data - * @throws Zend_Feed_Builder_Exception + * @throws \Zend\Feed\Builder\Exception * @return void */ protected function _createEntries(array $data) @@ -321,10 +326,10 @@ protected function _createEntries(array $data) $mandatories = array('title', 'link', 'description'); foreach ($mandatories as $mandatory) { if (!isset($row[$mandatory])) { - throw new Zend_Feed_Builder_Exception("$mandatory key is missing"); + throw new Exception("$mandatory key is missing"); } } - $entry = new Zend_Feed_Builder_Entry($row['title'], $row['link'], $row['description']); + $entry = new Entry($row['title'], $row['link'], $row['description']); if (isset($row['author'])) { $entry->setAuthor($row['author']); } @@ -347,7 +352,7 @@ protected function _createEntries(array $data) $mandatories = array('title', 'url'); foreach ($mandatories as $mandatory) { if (!isset($row['source'][$mandatory])) { - throw new Zend_Feed_Builder_Exception("$mandatory key of source property is missing"); + throw new Exception("$mandatory key of source property is missing"); } } $entry->setSource($row['source']['title'], $row['source']['url']); diff --git a/src/Builder/Interface.php b/src/Builder/BuilderInterface.php similarity index 88% rename from src/Builder/Interface.php rename to src/Builder/BuilderInterface.php index 1ddcf77e..a53107a1 100644 --- a/src/Builder/Interface.php +++ b/src/Builder/BuilderInterface.php @@ -19,6 +19,11 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Builder; + /** * Input feed data interface * @@ -30,13 +35,13 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface Zend_Feed_Builder_Interface +interface BuilderInterface { /** * Returns an instance of Zend_Feed_Builder_Header * describing the header of the feed * - * @return Zend_Feed_Builder_Header + * @return \Zend\Feed\Builder\Header\Header */ public function getHeader(); @@ -44,7 +49,7 @@ public function getHeader(); * Returns an array of Zend_Feed_Builder_Entry instances * describing the entries of the feed * - * @return array of Zend_Feed_Builder_Entry + * @return array of \Zend\Feed\Builder\Entry */ public function getEntries(); } diff --git a/src/Builder/Entry.php b/src/Builder/Entry.php index 370c2b26..3143307d 100644 --- a/src/Builder/Entry.php +++ b/src/Builder/Entry.php @@ -19,6 +19,11 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Builder; + /** * An entry of a custom build feed * @@ -26,13 +31,13 @@ * uses this class to describe an entry of a feed * * @uses ArrayObject - * @uses Zend_Feed_Builder_Exception + * @uses \Zend\Feed\Builder\Exception * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Builder_Entry extends ArrayObject +class Entry extends \ArrayObject { /** * Create a new builder entry @@ -105,7 +110,7 @@ public function __unset($key) * Sets the author of the entry * * @param string $author - * @return Zend_Feed_Builder_Entry + * @return \Zend\Feed\Builder\Entry */ public function setAuthor($author) { @@ -117,7 +122,7 @@ public function setAuthor($author) * Sets the id/guid of the entry * * @param string $id - * @return Zend_Feed_Builder_Entry + * @return \Zend\Feed\Builder\Entry */ public function setId($id) { @@ -129,7 +134,7 @@ public function setId($id) * Sets the full html content of the entry * * @param string $content - * @return Zend_Feed_Builder_Entry + * @return \Zend\Feed\Builder\Entry */ public function setContent($content) { @@ -141,7 +146,7 @@ public function setContent($content) * Timestamp of the update date * * @param int $lastUpdate - * @return Zend_Feed_Builder_Entry + * @return \Zend\Feed\Builder\Entry */ public function setLastUpdate($lastUpdate) { @@ -153,7 +158,7 @@ public function setLastUpdate($lastUpdate) * Sets the url of the commented page associated to the entry * * @param string $comments - * @return Zend_Feed_Builder_Entry + * @return \Zend\Feed\Builder\Entry */ public function setCommentsUrl($comments) { @@ -165,7 +170,7 @@ public function setCommentsUrl($comments) * Sets the url of the comments feed link * * @param string $commentRss - * @return Zend_Feed_Builder_Entry + * @return \Zend\Feed\Builder\Entry */ public function setCommentsRssUrl($commentRss) { @@ -178,7 +183,7 @@ public function setCommentsRssUrl($commentRss) * * @param string $title * @param string $url - * @return Zend_Feed_Builder_Entry + * @return \Zend\Feed\Builder\Entry */ public function setSource($title, $url) { @@ -201,7 +206,7 @@ public function setSource($title, $url) * * * @param array $categories - * @return Zend_Feed_Builder_Entry + * @return \Zend\Feed\Builder\Entry */ public function setCategories(array $categories) { @@ -214,14 +219,14 @@ public function setCategories(array $categories) /** * Add a category to the entry * - * @param array $category see Zend_Feed_Builder_Entry::setCategories() for format - * @return Zend_Feed_Builder_Entry - * @throws Zend_Feed_Builder_Exception + * @param array $category see \Zend\Feed\Builder\Entry::setCategories() for format + * @return \Zend\Feed\Builder\Entry + * @throws \Zend\Feed\Builder\Exception */ public function addCategory(array $category) { if (empty($category['term'])) { - throw new Zend_Feed_Builder_Exception("you have to define the name of the category"); + throw new Exception("you have to define the name of the category"); } if (!$this->offsetExists('category')) { @@ -249,14 +254,14 @@ public function addCategory(array $category) * * * @param array $enclosures - * @return Zend_Feed_Builder_Entry - * @throws Zend_Feed_Builder_Exception + * @return \Zend\Feed\Builder\Entry + * @throws \Zend\Feed\Builder\Exception */ public function setEnclosures(array $enclosures) { foreach ($enclosures as $enclosure) { if (empty($enclosure['url'])) { - throw new Zend_Feed_Builder_Exception("you have to supply an url for your enclosure"); + throw new Exception("you have to supply an url for your enclosure"); } $type = isset($enclosure['type']) ? $enclosure['type'] : ''; $length = isset($enclosure['length']) ? $enclosure['length'] : ''; @@ -271,7 +276,7 @@ public function setEnclosures(array $enclosures) * @param string $url * @param string $type * @param string $length - * @return Zend_Feed_Builder_Entry + * @return \Zend\Feed\Builder\Entry */ public function addEnclosure($url, $type = '', $length = '') { diff --git a/src/Builder/Exception.php b/src/Builder/Exception.php index 88bbabc6..8d718b04 100644 --- a/src/Builder/Exception.php +++ b/src/Builder/Exception.php @@ -19,15 +19,20 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Builder; + /** * Zend_Feed_Builder exception class * - * @uses Zend_Feed_Exception + * @uses \Zend\Feed\Exception * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Builder_Exception extends Zend_Feed_Exception +class Exception extends \Zend\Feed\Exception { } diff --git a/src/Builder/Header.php b/src/Builder/Header/Header.php similarity index 75% rename from src/Builder/Header.php rename to src/Builder/Header/Header.php index 23360754..d53c91f1 100644 --- a/src/Builder/Header.php +++ b/src/Builder/Header/Header.php @@ -19,6 +19,14 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Builder\Header; +use Zend\Validator; +use Zend\Feed\Builder; +use Zend\URI; + /** * Header of a custom build feed * @@ -26,18 +34,18 @@ * uses this class to describe the header of a feed * * @uses ArrayObject - * @uses Zend_Feed_Builder_Exception - * @uses Zend_Feed_Builder_Header_Itunes - * @uses Zend_Uri - * @uses Zend_Uri_Http - * @uses Zend_Validate_EmailAddress - * @uses Zend_Validate_Int + * @uses \Zend\Feed\Builder\Exception + * @uses \Zend\Feed\Builder\Header\iTunes + * @uses \Zend\Uri\Uri + * @uses \Zend\URI\URL + * @uses \Zend\Validator\EmailAddress + * @uses \Zend\Validator\Int * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Builder_Header extends ArrayObject +class Header extends \ArrayObject { /** * Constructor @@ -111,7 +119,7 @@ public function __unset($key) * Timestamp of the update date * * @param int $lastUpdate - * @return Zend_Feed_Builder_Header + * @return \Zend\Feed\Builder\Header\Header */ public function setLastUpdate($lastUpdate) { @@ -123,7 +131,7 @@ public function setLastUpdate($lastUpdate) * Timestamp of the publication date * * @param int $published - * @return Zend_Feed_Builder_Header + * @return \Zend\Feed\Builder\Header\Header */ public function setPublishedDate($published) { @@ -135,7 +143,7 @@ public function setPublishedDate($published) * Short description of the feed * * @param string $description - * @return Zend_Feed_Builder_Header + * @return \Zend\Feed\Builder\Header\Header */ public function setDescription($description) { @@ -147,7 +155,7 @@ public function setDescription($description) * Sets the author of the feed * * @param string $author - * @return Zend_Feed_Builder_Header + * @return \Zend\Feed\Builder\Header\Header */ public function setAuthor($author) { @@ -159,14 +167,14 @@ public function setAuthor($author) * Sets the author's email * * @param string $email - * @return Zend_Feed_Builder_Header - * @throws Zend_Feed_Builder_Exception + * @return \Zend\Feed\Builder\Header\Header + * @throws \Zend\Feed\Builder\Exception */ public function setEmail($email) { - $validate = new Zend_Validate_EmailAddress(); + $validate = new Validator\EmailAddress(); if (!$validate->isValid($email)) { - throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the email property"); + throw new Builder\Exception("you have to set a valid email address into the email property"); } $this->offsetSet('email', $email); return $this; @@ -176,7 +184,7 @@ public function setEmail($email) * Sets the copyright notice * * @param string $copyright - * @return Zend_Feed_Builder_Header + * @return \Zend\Feed\Builder\Header\Header */ public function setCopyright($copyright) { @@ -188,7 +196,7 @@ public function setCopyright($copyright) * Sets the image of the feed * * @param string $image - * @return Zend_Feed_Builder_Header + * @return \Zend\Feed\Builder\Header\Header */ public function setImage($image) { @@ -200,7 +208,7 @@ public function setImage($image) * Sets the generator of the feed * * @param string $generator - * @return Zend_Feed_Builder_Header + * @return \Zend\Feed\Builder\Header\Header */ public function setGenerator($generator) { @@ -212,7 +220,7 @@ public function setGenerator($generator) * Sets the language of the feed * * @param string $language - * @return Zend_Feed_Builder_Header + * @return \Zend\Feed\Builder\Header\Header */ public function setLanguage($language) { @@ -225,14 +233,14 @@ public function setLanguage($language) * Ignored if atom is used * * @param string $webmaster - * @return Zend_Feed_Builder_Header - * @throws Zend_Feed_Builder_Exception + * @return \Zend\Feed\Builder\Header\Header + * @throws \Zend\Feed\Builder\Exception */ public function setWebmaster($webmaster) { - $validate = new Zend_Validate_EmailAddress(); + $validate = new Validator\EmailAddress(); if (!$validate->isValid($webmaster)) { - throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the webmaster property"); + throw new Builder\Exception("you have to set a valid email address into the webmaster property"); } $this->offsetSet('webmaster', $webmaster); return $this; @@ -243,14 +251,14 @@ public function setWebmaster($webmaster) * Ignored if atom is used * * @param int $ttl - * @return Zend_Feed_Builder_Header - * @throws Zend_Feed_Builder_Exception + * @return \Zend\Feed\Builder\Header\Header + * @throws \Zend\Feed\Builder\Exception */ public function setTtl($ttl) { - $validate = new Zend_Validate_Int(); + $validate = new Validator\Int(); if (!$validate->isValid($ttl)) { - throw new Zend_Feed_Builder_Exception("you have to set an integer value to the ttl property"); + throw new Builder\Exception("you have to set an integer value to the ttl property"); } $this->offsetSet('ttl', $ttl); return $this; @@ -261,7 +269,7 @@ public function setTtl($ttl) * Ignored if atom is used * * @param string $rating - * @return Zend_Feed_Builder_Header + * @return \Zend\Feed\Builder\Header\Header */ public function setRating($rating) { @@ -273,19 +281,19 @@ public function setRating($rating) * Cloud to be notified of updates of the feed * Ignored if atom is used * - * @param string|Zend_Uri_Http $uri + * @param string|\Zend\URI\URL $uri * @param string $procedure procedure to call, e.g. myCloud.rssPleaseNotify * @param string $protocol protocol to use, e.g. soap or xml-rpc - * @return Zend_Feed_Builder_Header - * @throws Zend_Feed_Builder_Exception + * @return \Zend\Feed\Builder\Header\Header + * @throws \Zend\Feed\Builder\Exception */ public function setCloud($uri, $procedure, $protocol) { - if (is_string($uri) && Zend_Uri_Http::check($uri)) { - $uri = Zend_Uri::factory($uri); + if (is_string($uri)) { + $uri = new \Zend\URI\URL($uri); } - if (!$uri instanceof Zend_Uri_Http) { - throw new Zend_Feed_Builder_Exception('Passed parameter is not a valid HTTP URI'); + if (!$uri instanceof URI\URL) { + throw new Builder\Exception('Passed parameter is not a valid HTTP URI'); } if (!$uri->getPort()) { $uri->setPort(80); @@ -304,7 +312,7 @@ public function setCloud($uri, $procedure, $protocol) * @param string $description explains the text input area * @param string $name the name of the text object in the text input area * @param string $link the URL of the CGI script that processes text input requests - * @return Zend_Feed_Builder_Header + * @return \Zend\Feed\Builder\Header\Header */ public function setTextInput($title, $description, $name, $link) { @@ -320,17 +328,17 @@ public function setTextInput($title, $description, $name, $link) * Ignored if atom is used * * @param array $hours list of hours in 24 format - * @return Zend_Feed_Builder_Header - * @throws Zend_Feed_Builder_Exception + * @return \Zend\Feed\Builder\Header\Header + * @throws \Zend\Feed\Builder\Exception */ public function setSkipHours(array $hours) { if (count($hours) > 24) { - throw new Zend_Feed_Builder_Exception("you can not have more than 24 rows in the skipHours property"); + throw new Builder\Exception("you can not have more than 24 rows in the skipHours property"); } foreach ($hours as $hour) { if ($hour < 0 || $hour > 23) { - throw new Zend_Feed_Builder_Exception("$hour has te be between 0 and 23"); + throw new Builder\Exception("$hour has te be between 0 and 23"); } } $this->offsetSet('skipHours', $hours); @@ -342,18 +350,18 @@ public function setSkipHours(array $hours) * Ignored if atom is used * * @param array $days list of days to skip, e.g. Monday - * @return Zend_Feed_Builder_Header - * @throws Zend_Feed_Builder_Exception + * @return \Zend\Feed\Builder\Header\Header + * @throws \Zend\Feed\Builder\Exception */ public function setSkipDays(array $days) { if (count($days) > 7) { - throw new Zend_Feed_Builder_Exception("you can not have more than 7 days in the skipDays property"); + throw new Builder\Exception("you can not have more than 7 days in the skipDays property"); } $valid = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'); foreach ($days as $day) { if (!in_array(strtolower($day), $valid)) { - throw new Zend_Feed_Builder_Exception("$day is not a valid day"); + throw new Builder\Exception("$day is not a valid day"); } } $this->offsetSet('skipDays', $days); @@ -363,10 +371,10 @@ public function setSkipDays(array $days) /** * Sets the iTunes rss extension * - * @param Zend_Feed_Builder_Header_Itunes $itunes - * @return Zend_Feed_Builder_Header + * @param \Zend\Feed\Builder\Header\iTunes $itunes + * @return \Zend\Feed\Builder\Header\Header */ - public function setITunes(Zend_Feed_Builder_Header_Itunes $itunes) + public function setITunes(iTunes $itunes) { $this->offsetSet('itunes', $itunes); return $this; diff --git a/src/Builder/Header/Itunes.php b/src/Builder/Header/Itunes.php index a5625603..ec6f94a6 100644 --- a/src/Builder/Header/Itunes.php +++ b/src/Builder/Header/Itunes.php @@ -19,20 +19,26 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Builder\Header; +use Zend\Feed\Builder; + /** * ITunes rss extension * * Classes used to describe the itunes channel extension * * @uses ArrayObject - * @uses Zend_Feed_Builder_Exception - * @uses Zend_Validate_EmailAddress + * @uses \Zend\Feed\Builder\Exception + * @uses \Zend\Validator\EmailAddress * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Builder_Header_Itunes extends ArrayObject +class iTunes extends \ArrayObject { /** * Constructor @@ -57,21 +63,21 @@ public function __construct(array $categories) * * * @param array $categories - * @return Zend_Feed_Builder_Header_Itunes - * @throws Zend_Feed_Builder_Exception + * @return \Zend\Feed\Builder\Header\iTunes + * @throws \Zend\Feed\Builder\Exception */ public function setCategories(array $categories) { $nb = count($categories); if (0 === $nb) { - throw new Zend_Feed_Builder_Exception("you have to set at least one itunes category"); + throw new Builder\Exception("you have to set at least one itunes category"); } if ($nb > 3) { - throw new Zend_Feed_Builder_Exception("you have to set at most three itunes categories"); + throw new Builder\Exception("you have to set at most three itunes categories"); } foreach ($categories as $i => $category) { if (empty($category['main'])) { - throw new Zend_Feed_Builder_Exception("you have to set the main category (category #$i)"); + throw new Builder\Exception("you have to set the main category (category #$i)"); } } $this->offsetSet('category', $categories); @@ -82,7 +88,7 @@ public function setCategories(array $categories) * Sets the artist value, default to the feed's author value * * @param string $author - * @return Zend_Feed_Builder_Header_Itunes + * @return \Zend\Feed\Builder\Header\iTunes */ public function setAuthor($author) { @@ -95,15 +101,15 @@ public function setAuthor($author) * * @param string $name default to the feed's author value * @param string $email default to the feed's email value - * @return Zend_Feed_Builder_Header_Itunes - * @throws Zend_Feed_Builder_Exception + * @return \Zend\Feed\Builder\Header\iTunes + * @throws \Zend\Feed\Builder\Exception */ public function setOwner($name = '', $email = '') { if (!empty($email)) { - $validate = new Zend_Validate_EmailAddress(); + $validate = new \Zend\Validator\EmailAddress(); if (!$validate->isValid($email)) { - throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the itunes owner's email property"); + throw new Builder\Exception("you have to set a valid email address into the itunes owner's email property"); } } $this->offsetSet('owner', array('name' => $name, 'email' => $email)); @@ -115,7 +121,7 @@ public function setOwner($name = '', $email = '') * Default to the feed's image value * * @param string $image - * @return Zend_Feed_Builder_Header_Itunes + * @return \Zend\Feed\Builder\Header\iTunes */ public function setImage($image) { @@ -128,7 +134,7 @@ public function setImage($image) * Default to the feed's description * * @param string $subtitle - * @return Zend_Feed_Builder_Header_Itunes + * @return \Zend\Feed\Builder\Header\iTunes */ public function setSubtitle($subtitle) { @@ -141,7 +147,7 @@ public function setSubtitle($subtitle) * Default to the feed's description * * @param string $summary - * @return Zend_Feed_Builder_Header_Itunes + * @return \Zend\Feed\Builder\Header\iTunes */ public function setSummary($summary) { @@ -153,14 +159,14 @@ public function setSummary($summary) * Prevent a feed from appearing * * @param string $block can be 'yes' or 'no' - * @return Zend_Feed_Builder_Header_Itunes - * @throws Zend_Feed_Builder_Exception + * @return \Zend\Feed\Builder\Header\iTunes + * @throws \Zend\Feed\Builder\Exception */ public function setBlock($block) { $block = strtolower($block); if (!in_array($block, array('yes', 'no'))) { - throw new Zend_Feed_Builder_Exception("you have to set yes or no to the itunes block property"); + throw new Builder\Exception("you have to set yes or no to the itunes block property"); } $this->offsetSet('block', $block); return $this; @@ -170,14 +176,14 @@ public function setBlock($block) * Configuration of the parental advisory graphic * * @param string $explicit can be 'yes', 'no' or 'clean' - * @return Zend_Feed_Builder_Header_Itunes - * @throws Zend_Feed_Builder_Exception + * @return \Zend\Feed\Builder\Header\iTunes + * @throws \Zend\Feed\Builder\Exception */ public function setExplicit($explicit) { $explicit = strtolower($explicit); if (!in_array($explicit, array('yes', 'no', 'clean'))) { - throw new Zend_Feed_Builder_Exception("you have to set yes, no or clean to the itunes explicit property"); + throw new Builder\Exception("you have to set yes, no or clean to the itunes explicit property"); } $this->offsetSet('explicit', $explicit); return $this; @@ -187,7 +193,7 @@ public function setExplicit($explicit) * Sets a comma separated list of 12 keywords maximum * * @param string $keywords - * @return Zend_Feed_Builder_Header_Itunes + * @return \Zend\Feed\Builder\Header\iTunes */ public function setKeywords($keywords) { @@ -199,7 +205,7 @@ public function setKeywords($keywords) * Sets the new feed URL location * * @param string $url - * @return Zend_Feed_Builder_Header_Itunes + * @return \Zend\Feed\Builder\Header\iTunes */ public function setNewFeedUrl($url) { diff --git a/src/Builder/Header/iTunes.php b/src/Builder/Header/iTunes.php new file mode 100644 index 00000000..ec6f94a6 --- /dev/null +++ b/src/Builder/Header/iTunes.php @@ -0,0 +1,267 @@ +setCategories($categories); + } + + /** + * Sets the categories column and in iTunes Music Store Browse + * $categories must conform to the following format: + * + * array(array('main' => 'main category', + * 'sub' => 'sub category' // optionnal + * ), + * // up to 3 rows + * ) + * + * + * @param array $categories + * @return \Zend\Feed\Builder\Header\iTunes + * @throws \Zend\Feed\Builder\Exception + */ + public function setCategories(array $categories) + { + $nb = count($categories); + if (0 === $nb) { + throw new Builder\Exception("you have to set at least one itunes category"); + } + if ($nb > 3) { + throw new Builder\Exception("you have to set at most three itunes categories"); + } + foreach ($categories as $i => $category) { + if (empty($category['main'])) { + throw new Builder\Exception("you have to set the main category (category #$i)"); + } + } + $this->offsetSet('category', $categories); + return $this; + } + + /** + * Sets the artist value, default to the feed's author value + * + * @param string $author + * @return \Zend\Feed\Builder\Header\iTunes + */ + public function setAuthor($author) + { + $this->offsetSet('author', $author); + return $this; + } + + /** + * Sets the owner of the postcast + * + * @param string $name default to the feed's author value + * @param string $email default to the feed's email value + * @return \Zend\Feed\Builder\Header\iTunes + * @throws \Zend\Feed\Builder\Exception + */ + public function setOwner($name = '', $email = '') + { + if (!empty($email)) { + $validate = new \Zend\Validator\EmailAddress(); + if (!$validate->isValid($email)) { + throw new Builder\Exception("you have to set a valid email address into the itunes owner's email property"); + } + } + $this->offsetSet('owner', array('name' => $name, 'email' => $email)); + return $this; + } + + /** + * Sets the album/podcast art picture + * Default to the feed's image value + * + * @param string $image + * @return \Zend\Feed\Builder\Header\iTunes + */ + public function setImage($image) + { + $this->offsetSet('image', $image); + return $this; + } + + /** + * Sets the short description of the podcast + * Default to the feed's description + * + * @param string $subtitle + * @return \Zend\Feed\Builder\Header\iTunes + */ + public function setSubtitle($subtitle) + { + $this->offsetSet('subtitle', $subtitle); + return $this; + } + + /** + * Sets the longer description of the podcast + * Default to the feed's description + * + * @param string $summary + * @return \Zend\Feed\Builder\Header\iTunes + */ + public function setSummary($summary) + { + $this->offsetSet('summary', $summary); + return $this; + } + + /** + * Prevent a feed from appearing + * + * @param string $block can be 'yes' or 'no' + * @return \Zend\Feed\Builder\Header\iTunes + * @throws \Zend\Feed\Builder\Exception + */ + public function setBlock($block) + { + $block = strtolower($block); + if (!in_array($block, array('yes', 'no'))) { + throw new Builder\Exception("you have to set yes or no to the itunes block property"); + } + $this->offsetSet('block', $block); + return $this; + } + + /** + * Configuration of the parental advisory graphic + * + * @param string $explicit can be 'yes', 'no' or 'clean' + * @return \Zend\Feed\Builder\Header\iTunes + * @throws \Zend\Feed\Builder\Exception + */ + public function setExplicit($explicit) + { + $explicit = strtolower($explicit); + if (!in_array($explicit, array('yes', 'no', 'clean'))) { + throw new Builder\Exception("you have to set yes, no or clean to the itunes explicit property"); + } + $this->offsetSet('explicit', $explicit); + return $this; + } + + /** + * Sets a comma separated list of 12 keywords maximum + * + * @param string $keywords + * @return \Zend\Feed\Builder\Header\iTunes + */ + public function setKeywords($keywords) + { + $this->offsetSet('keywords', $keywords); + return $this; + } + + /** + * Sets the new feed URL location + * + * @param string $url + * @return \Zend\Feed\Builder\Header\iTunes + */ + public function setNewFeedUrl($url) + { + $this->offsetSet('new_feed_url', $url); + return $this; + } + + /** + * Read only properties accessor + * + * @param string $name property to read + * @return mixed + */ + public function __get($name) + { + if (!$this->offsetExists($name)) { + return NULL; + } + + return $this->offsetGet($name); + } + + /** + * Write properties accessor + * + * @param string $name name of the property to set + * @param mixed $value value to set + * @return void + */ + public function __set($name, $value) + { + $this->offsetSet($name, $value); + } + + /** + * Isset accessor + * + * @param string $key + * @return boolean + */ + public function __isset($key) + { + return $this->offsetExists($key); + } + + /** + * Unset accessor + * + * @param string $key + * @return void + */ + public function __unset($key) + { + if ($this->offsetExists($key)) { + $this->offsetUnset($key); + } + } + +} diff --git a/src/Element.php b/src/Element.php index 6970c272..ba0ac10e 100644 --- a/src/Element.php +++ b/src/Element.php @@ -19,20 +19,25 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed; + /** * Wraps a DOMElement allowing for SimpleXML-like access to attributes. * * @uses ArrayAccess * @uses DOMDocument - * @uses Zend_Feed - * @uses Zend_Feed_Element - * @uses Zend_Feed_Exception + * @uses \Zend\Feed\Feed + * @uses \Zend\Feed\Element + * @uses \Zend\Feed\Exception * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Element implements ArrayAccess +class Element implements \ArrayAccess { /** @@ -46,7 +51,7 @@ class Zend_Feed_Element implements ArrayAccess protected $_encoding = 'UTF-8'; /** - * @var Zend_Feed_Element + * @var \Zend\Feed\Element */ protected $_parentElement; @@ -92,7 +97,7 @@ public function getDOM() * @param DOMElement $element * @return void */ - public function setDOM(DOMElement $element) + public function setDOM(\DOMElement $element) { $this->_element = $this->_element->ownerDocument->importNode($element, true); } @@ -101,10 +106,10 @@ public function setDOM(DOMElement $element) * Set the parent element of this object to another * Zend_Feed_Element. * - * @param Zend_Feed_Element $element + * @param \Zend\Feed\Element $element * @return void */ - public function setParent(Zend_Feed_Element $element) + public function setParent(Element $element) { $this->_parentElement = $element; $this->_appended = false; @@ -137,7 +142,7 @@ protected function ensureAppended() public function saveXml() { // Return a complete document including XML prologue. - $doc = new DOMDocument($this->_element->ownerDocument->version, + $doc = new \DOMDocument($this->_element->ownerDocument->version, $this->_element->ownerDocument->actualEncoding); $doc->appendChild($doc->importNode($this->_element, true)); return $doc->saveXML(); @@ -170,7 +175,7 @@ public function getEncoding() * Set encoding * * @param string $value Encoding to use - * @return Zend_Feed_Element + * @return \Zend\Feed\Element */ public function setEncoding($value) { @@ -194,9 +199,9 @@ public function __get($var) $length = count($nodes); if ($length == 1) { - return new Zend_Feed_Element($nodes[0]); + return new Element($nodes[0]); } elseif ($length > 1) { - return array_map(create_function('$e', 'return new Zend_Feed_Element($e);'), $nodes); + return array_map(create_function('$e', 'return new \Zend\Feed\Element($e);'), $nodes); } else { // When creating anonymous nodes for __set chaining, don't // call appendChild() on them. Instead we pass the current @@ -206,7 +211,7 @@ public function __get($var) // a phantom "bar" element in our tree. if (strpos($var, ':') !== false) { list($ns, $elt) = explode(':', $var, 2); - $node = $this->_element->ownerDocument->createElementNS(Zend_Feed::lookupNamespace($ns), $elt); + $node = $this->_element->ownerDocument->createElementNS(Feed::lookupNamespace($ns), $elt); } else { $node = $this->_element->ownerDocument->createElement($var); } @@ -223,7 +228,7 @@ public function __get($var) * @param string $var The property to change. * @param string $val The property's new value. * @return void - * @throws Zend_Feed_Exception + * @throws \Zend\Feed\Exception */ public function __set($var, $val) { @@ -233,7 +238,7 @@ public function __set($var, $val) if (!$nodes) { if (strpos($var, ':') !== false) { list($ns, $elt) = explode(':', $var, 2); - $node = $this->_element->ownerDocument->createElementNS(Zend_Feed::lookupNamespace($ns), + $node = $this->_element->ownerDocument->createElementNS(Feed::lookupNamespace($ns), $var, htmlspecialchars($val, ENT_NOQUOTES, $this->getEncoding())); $this->_element->appendChild($node); } else { @@ -242,7 +247,7 @@ public function __set($var, $val) $this->_element->appendChild($node); } } elseif (count($nodes) > 1) { - throw new Zend_Feed_Exception('Cannot set the value of multiple tags simultaneously.'); + throw new Exception('Cannot set the value of multiple tags simultaneously.'); } else { $nodes[0]->nodeValue = $val; } @@ -372,7 +377,7 @@ public function offsetExists($offset) { if (strpos($offset, ':') !== false) { list($ns, $attr) = explode(':', $offset, 2); - return $this->_element->hasAttributeNS(Zend_Feed::lookupNamespace($ns), $attr); + return $this->_element->hasAttributeNS(Feed::lookupNamespace($ns), $attr); } else { return $this->_element->hasAttribute($offset); } @@ -389,7 +394,7 @@ public function offsetGet($offset) { if (strpos($offset, ':') !== false) { list($ns, $attr) = explode(':', $offset, 2); - return $this->_element->getAttributeNS(Zend_Feed::lookupNamespace($ns), $attr); + return $this->_element->getAttributeNS(Feed::lookupNamespace($ns), $attr); } else { return $this->_element->getAttribute($offset); } @@ -410,7 +415,7 @@ public function offsetSet($offset, $value) if (strpos($offset, ':') !== false) { list($ns, $attr) = explode(':', $offset, 2); // DOMElement::setAttributeNS() requires $qualifiedName to have a prefix - return $this->_element->setAttributeNS(Zend_Feed::lookupNamespace($ns), $offset, $value); + return $this->_element->setAttributeNS(Feed::lookupNamespace($ns), $offset, $value); } else { return $this->_element->setAttribute($offset, $value); } @@ -427,7 +432,7 @@ public function offsetUnset($offset) { if (strpos($offset, ':') !== false) { list($ns, $attr) = explode(':', $offset, 2); - return $this->_element->removeAttributeNS(Zend_Feed::lookupNamespace($ns), $attr); + return $this->_element->removeAttributeNS(Feed::lookupNamespace($ns), $attr); } else { return $this->_element->removeAttribute($offset); } diff --git a/src/Entry/Abstract.php b/src/Entry/AbstractEntry.php similarity index 81% rename from src/Entry/Abstract.php rename to src/Entry/AbstractEntry.php index bdcafcb8..756687bf 100644 --- a/src/Entry/Abstract.php +++ b/src/Entry/AbstractEntry.php @@ -19,20 +19,26 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Entry; +use Zend\Feed; + /** * Zend_Feed_Entry_Abstract represents a single entry in an Atom or RSS * feed. * * @uses DOMDocument - * @uses Zend_Feed - * @uses Zend_Feed_Element - * @uses Zend_Feed_Exception + * @uses \Zend\Feed\Feed + * @uses \Zend\Feed\Element + * @uses \Zend\Feed\Exception * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class Zend_Feed_Entry_Abstract extends Zend_Feed_Element +abstract class AbstractEntry extends Feed\Element { /** * Root XML element for entries. Subclasses must define this to a @@ -62,15 +68,15 @@ abstract class Zend_Feed_Entry_Abstract extends Zend_Feed_Element * @param string $uri * @param SimpleXMLElement|DOMNode|string $element * @return void - * @throws Zend_Feed_Exception + * @throws \Zend\Feed\Exception */ public function __construct($uri = null, $element = null) { - if (!($element instanceof DOMElement)) { + if (!($element instanceof \DOMElement)) { if ($element) { // Load the feed as an XML DOMDocument object @ini_set('track_errors', 1); - $doc = new DOMDocument(); + $doc = new \DOMDocument(); $status = @$doc->loadXML($element); @ini_restore('track_errors'); @@ -84,17 +90,17 @@ public function __construct($uri = null, $element = null) } } - throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg"); + throw new Feed\Exception("DOMDocument cannot parse XML: $php_errormsg"); } $element = $doc->getElementsByTagName($this->_rootElement)->item(0); if (!$element) { - throw new Zend_Feed_Exception('No root <' . $this->_rootElement . '> element found, cannot parse feed.'); + throw new Feed\Exception('No root <' . $this->_rootElement . '> element found, cannot parse feed.'); } } else { - $doc = new DOMDocument('1.0', 'utf-8'); + $doc = new \DOMDocument('1.0', 'utf-8'); if ($this->_rootNamespace !== null) { - $element = $doc->createElementNS(Zend_Feed::lookupNamespace($this->_rootNamespace), $this->_rootElement); + $element = $doc->createElementNS(Feed\Feed::lookupNamespace($this->_rootNamespace), $this->_rootElement); } else { $element = $doc->createElement($this->_rootElement); } diff --git a/src/Entry/Atom.php b/src/Entry/Atom.php index 6f15e87f..f63fd75e 100644 --- a/src/Entry/Atom.php +++ b/src/Entry/Atom.php @@ -19,18 +19,24 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Entry; +use Zend\Feed; + /** * Concrete class for working with Atom entries. * * @uses DOMDocument - * @uses Zend_Feed_Entry_Abstract - * @uses Zend_Feed_Exception + * @uses \Zend\Feed\Entry\AbstractEntry + * @uses \Zend\Feed\Exception * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract +class Atom extends AbstractEntry { /** * Content-Type @@ -64,21 +70,21 @@ class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract * Publishing Protocol permits it to be 200 OK. * * @return void - * @throws Zend_Feed_Exception + * @throws \Zend\Feed\Exception */ public function delete() { // Look for link rel="edit" in the entry object. $deleteUri = $this->link('edit'); if (!$deleteUri) { - throw new Zend_Feed_Exception('Cannot delete entry; no link rel="edit" is present.'); + throw new Feed\Exception('Cannot delete entry; no link rel="edit" is present.'); } // DELETE - $client = Zend_Feed::getHttpClient(); + $client = Feed\Feed::getHttpClient(); do { $client->setUri($deleteUri); - if (Zend_Feed::getHttpMethodOverride()) { + if (Feed\Feed::getHttpMethodOverride()) { $client->setHeader('X-HTTP-Method-Override', 'DELETE'); $response = $client->request('POST'); } else { @@ -95,7 +101,7 @@ public function delete() continue; // Error default: - throw new Zend_Feed_Exception("Expected response code 2xx, got $httpStatus"); + throw new Feed\Exception("Expected response code 2xx, got $httpStatus"); } } while (true); } @@ -119,7 +125,7 @@ public function delete() * * @param string $postUri Location to POST for creating new entries. * @return void - * @throws Zend_Feed_Exception + * @throws \Zend\Feed\Exception */ public function save($postUri = null) { @@ -128,12 +134,12 @@ public function save($postUri = null) // entry object and PUT. $editUri = $this->link('edit'); if (!$editUri) { - throw new Zend_Feed_Exception('Cannot edit entry; no link rel="edit" is present.'); + throw new Feed\Exception('Cannot edit entry; no link rel="edit" is present.'); } - $client = Zend_Feed::getHttpClient(); + $client = Feed\Feed::getHttpClient(); $client->setUri($editUri); - if (Zend_Feed::getHttpMethodOverride()) { + if (Feed\Feed::getHttpMethodOverride()) { $client->setHeaders(array('X-HTTP-Method-Override: PUT', 'Content-Type: ' . self::CONTENT_TYPE)); $client->setRawData($this->saveXML()); @@ -144,27 +150,27 @@ public function save($postUri = null) $response = $client->request('PUT'); } if ($response->getStatus() !== 200) { - throw new Zend_Feed_Exception('Expected response code 200, got ' . $response->getStatus()); + throw new Feed\Exception('Expected response code 200, got ' . $response->getStatus()); } } else { if ($postUri === null) { - throw new Zend_Feed_Exception('PostURI must be specified to save new entries.'); + throw new Feed\Exception('PostURI must be specified to save new entries.'); } - $client = Zend_Feed::getHttpClient(); + $client = Feed\Feed::getHttpClient(); $client->setUri($postUri); $client->setHeaders('Content-Type', self::CONTENT_TYPE); $client->setRawData($this->saveXML()); $response = $client->request('POST'); if ($response->getStatus() !== 201) { - throw new Zend_Feed_Exception('Expected response code 201, got ' + throw new Feed\Exception('Expected response code 201, got ' . $response->getStatus()); } } // Update internal properties using $client->responseBody; @ini_set('track_errors', 1); - $newEntry = new DOMDocument; + $newEntry = new \DOMDocument; $status = @$newEntry->loadXML($response->getBody()); @ini_restore('track_errors'); @@ -178,12 +184,12 @@ public function save($postUri = null) } } - throw new Zend_Feed_Exception('XML cannot be parsed: ' . $php_errormsg); + throw new Feed\Exception('XML cannot be parsed: ' . $php_errormsg); } $newEntry = $newEntry->getElementsByTagName($this->_rootElement)->item(0); if (!$newEntry) { - throw new Zend_Feed_Exception('No root element found in server response:' + throw new Feed\Exception('No root element found in server response:' . "\n\n" . $client->responseBody); } @@ -221,7 +227,7 @@ public function link($rel = null) // index link tags by their "rel" attribute. $links = parent::__get('link'); if (!is_array($links)) { - if ($links instanceof Zend_Feed_Element) { + if ($links instanceof Feed\Element) { $links = array($links); } else { return $links; diff --git a/src/Entry/RSS.php b/src/Entry/RSS.php new file mode 100644 index 00000000..7954b5bc --- /dev/null +++ b/src/Entry/RSS.php @@ -0,0 +1,120 @@ +_element->lookupPrefix('http://purl.org/rss/1.0/modules/content/'); + return parent::__get("$prefix:encoded"); + default: + return parent::__get($var); + } + } + + /** + * Overwrites parent::_set method to enable write access + * to content:encoded element. + * + * @param string $var The property to change. + * @param string $val The property's new value. + * @return void + */ + public function __set($var, $value) + { + switch ($var) { + case 'content': + parent::__set('content:encoded', $value); + break; + default: + parent::__set($var, $value); + } + } + + /** + * Overwrites parent::_isset method to enable access + * to content:encoded element. + * + * @param string $var + * @return boolean + */ + public function __isset($var) + { + switch ($var) { + case 'content': + // don't use other callback to prevent invalid returned value + return $this->content() !== null; + default: + return parent::__isset($var); + } + } + + /** + * Overwrites parent::_call method to enable read access + * to content:encoded element. + * Please note that method-style write access is not currently supported + * by parent method, consequently this method doesn't as well. + * + * @param string $var The element to get the string value of. + * @param mixed $unused This parameter is not used. + * @return mixed The node's value, null, or an array of nodes. + */ + public function __call($var, $unused) + { + switch ($var) { + case 'content': + $prefix = $this->_element->lookupPrefix('http://purl.org/rss/1.0/modules/content/'); + return parent::__call("$prefix:encoded", $unused); + default: + return parent::__call($var, $unused); + } + } +} diff --git a/src/Entry/Rss.php b/src/Entry/Rss.php index 11072c54..7954b5bc 100644 --- a/src/Entry/Rss.php +++ b/src/Entry/Rss.php @@ -19,16 +19,21 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Entry; + /** * Concrete class for working with RSS items. * - * @uses Zend_Feed_Entry_Abstract + * @uses \Zend\Feed\Entry\AbstractEntry * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Entry_Rss extends Zend_Feed_Entry_Abstract +class RSS extends AbstractEntry { /** * Root XML element for RSS items. diff --git a/src/Exception.php b/src/Exception.php index ac061810..4bfa9ec1 100644 --- a/src/Exception.php +++ b/src/Exception.php @@ -19,17 +19,22 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed; + /** * Feed exceptions * * Class to represent exceptions that occur during Feed operations. * - * @uses Zend_Exception + * @uses \Zend\Exception * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Exception extends Zend_Exception +class Exception extends \Zend\Exception {} diff --git a/src/Feed.php b/src/Feed.php new file mode 100644 index 00000000..ddeef1fa --- /dev/null +++ b/src/Feed.php @@ -0,0 +1,385 @@ + 'http://a9.com/-/spec/opensearchrss/1.0/', + 'atom' => 'http://www.w3.org/2005/Atom', + 'rss' => 'http://blogs.law.harvard.edu/tech/rss', + ); + + + /** + * Set the HTTP client instance + * + * Sets the HTTP client object to use for retrieving the feeds. + * + * @param \Zend\HTTP\Client $httpClient + * @return void + */ + public static function setHttpClient(HTTP\Client $httpClient) + { + self::$_httpClient = $httpClient; + } + + + /** + * Gets the HTTP client object. If none is set, a new Zend_Http_Client will be used. + * + * @return Zend_Http_Client_Abstract + */ + public static function getHttpClient() + { + if (!self::$_httpClient instanceof HTTP\Client) { + self::$_httpClient = new HTTP\Client(); + } + + return self::$_httpClient; + } + + + /** + * Toggle using POST instead of PUT and DELETE HTTP methods + * + * Some feed implementations do not accept PUT and DELETE HTTP + * methods, or they can't be used because of proxies or other + * measures. This allows turning on using POST where PUT and + * DELETE would normally be used; in addition, an + * X-Method-Override header will be sent with a value of PUT or + * DELETE as appropriate. + * + * @param boolean $override Whether to override PUT and DELETE. + * @return void + */ + public static function setHttpMethodOverride($override = true) + { + self::$_httpMethodOverride = $override; + } + + + /** + * Get the HTTP override state + * + * @return boolean + */ + public static function getHttpMethodOverride() + { + return self::$_httpMethodOverride; + } + + + /** + * Get the full version of a namespace prefix + * + * Looks up a prefix (atom:, etc.) in the list of registered + * namespaces and returns the full namespace URI if + * available. Returns the prefix, unmodified, if it's not + * registered. + * + * @return string + */ + public static function lookupNamespace($prefix) + { + return isset(self::$_namespaces[$prefix]) ? + self::$_namespaces[$prefix] : + $prefix; + } + + + /** + * Add a namespace and prefix to the registered list + * + * Takes a prefix and a full namespace URI and adds them to the + * list of registered namespaces for use by + * Zend_Feed::lookupNamespace(). + * + * @param string $prefix The namespace prefix + * @param string $namespaceURI The full namespace URI + * @return void + */ + public static function registerNamespace($prefix, $namespaceURI) + { + self::$_namespaces[$prefix] = $namespaceURI; + } + + + /** + * Imports a feed located at $uri. + * + * @param string $uri + * @throws \Zend\Feed\Exception + * @return \Zend\Feed\AbstractFeed + */ + public static function import($uri) + { + $client = self::getHttpClient(); + $client->setUri($uri); + $response = $client->request('GET'); + if ($response->getStatus() !== 200) { + throw new Exception('Feed failed to load, got response code ' . $response->getStatus()); + } + $feed = $response->getBody(); + return self::importString($feed); + } + + + /** + * Imports a feed represented by $string. + * + * @param string $string + * @throws \Zend\Feed\Exception + * @return \Zend\Feed\AbstractFeed + */ + public static function importString($string) + { + // Load the feed as an XML DOMDocument object + $libxml_errflag = libxml_use_internal_errors(true); + $doc = new \DOMDocument; + if (trim($string) == '') { + throw new Exception('Document/string being imported' + . ' is an Empty string or comes from an empty HTTP response'); + } + $status = $doc->loadXML($string); + libxml_use_internal_errors($libxml_errflag); + + + if (!$status) { + // prevent the class to generate an undefined variable notice (ZF-2590) + // Build error message + $error = libxml_get_last_error(); + if ($error && $error->message) { + $errormsg = "DOMDocument cannot parse XML: {$error->message}"; + } else { + $errormsg = "DOMDocument cannot parse XML"; + } + + throw new Exception($errormsg); + } + + // Try to find the base feed element or a single of an Atom feed + if ($doc->getElementsByTagName('feed')->item(0) || + $doc->getElementsByTagName('entry')->item(0)) { + // return a newly created Zend_Feed_Atom object + return new Atom(null, $string); + } + + // Try to find the base feed element of an RSS feed + if ($doc->getElementsByTagName('channel')->item(0)) { + // return a newly created Zend_Feed_Rss object + return new RSS(null, $string); + } + + // $string does not appear to be a valid feed of the supported types + throw new Exception('Invalid or unsupported feed format'); + } + + + /** + * Imports a feed from a file located at $filename. + * + * @param string $filename + * @throws \Zend\Feed\Exception + * @return \Zend\Feed\AbstractFeed + */ + public static function importFile($filename) + { + @ini_set('track_errors', 1); + $feed = @file_get_contents($filename); + @ini_restore('track_errors'); + if ($feed === false) { + throw new Exception("File could not be loaded: $php_errormsg"); + } + return self::importString($feed); + } + + + /** + * Attempts to find feeds at $uri referenced by tags. Returns an + * array of the feeds referenced at $uri. + * + * @todo Allow findFeeds() to follow one, but only one, code 302. + * + * @param string $uri + * @throws \Zend\Feed\Exception + * @return array + */ + public static function findFeeds($uri) + { + // Get the HTTP response from $uri and save the contents + $client = self::getHttpClient(); + $client->setUri($uri); + $response = $client->request(); + if ($response->getStatus() !== 200) { + throw new Exception("Failed to access $uri, got response code " . $response->getStatus()); + } + $contents = $response->getBody(); + + // Parse the contents for appropriate tags + @ini_set('track_errors', 1); + $pattern = '~(]+)/?>~i'; + $result = @preg_match_all($pattern, $contents, $matches); + @ini_restore('track_errors'); + if ($result === false) { + throw new Exception("Internal error: $php_errormsg"); + } + + // Try to fetch a feed for each link tag that appears to refer to a feed + $feeds = array(); + if (isset($matches[1]) && count($matches[1]) > 0) { + foreach ($matches[1] as $link) { + // force string to be an utf-8 one + if (!mb_check_encoding($link, 'UTF-8')) { + $link = mb_convert_encoding($link, 'UTF-8'); + } + $xml = @simplexml_load_string(rtrim($link, ' /') . ' />'); + if ($xml === false) { + continue; + } + $attributes = $xml->attributes(); + if (!isset($attributes['rel']) || !@preg_match('~^(?:alternate|service\.feed)~i', $attributes['rel'])) { + continue; + } + if (!isset($attributes['type']) || + !@preg_match('~^application/(?:atom|rss|rdf)\+xml~', $attributes['type'])) { + continue; + } + if (!isset($attributes['href'])) { + continue; + } + try { + // checks if we need to canonize the given uri + try { + $uri = URI\Zend\Uri\Uri::factory((string) $attributes['href']); + } catch (end\URI\Exception $e) { + // canonize the uri + $path = (string) $attributes['href']; + $query = $fragment = ''; + if (substr($path, 0, 1) != '/') { + // add the current root path to this one + $path = rtrim($client->getUri()->getPath(), '/') . '/' . $path; + } + if (strpos($path, '?') !== false) { + list($path, $query) = explode('?', $path, 2); + } + if (strpos($query, '#') !== false) { + list($query, $fragment) = explode('#', $query, 2); + } + $uri = URI\Zend\Uri\Uri::factory($client->getUri(true)); + $uri->setPath($path); + $uri->setQuery($query); + $uri->setFragment($fragment); + } + + $feed = self::import($uri); + } catch (\Exception $e) { + continue; + } + $feeds[$uri->getUri()] = $feed; + } + } + + // Return the fetched feeds + return $feeds; + } + + /** + * Construct a new Zend_Feed_Abstract object from a custom array + * + * @param array $data + * @param string $format (rss|atom) the requested output format + * @return \Zend\Feed\AbstractFeed + */ + public static function importArray(array $data, $format = 'Atom') + { + if (strtolower($format) == 'rss') { + $format = 'RSS'; + } else { + $format = ucfirst(strtolower($format)); + } + $obj = 'Zend\Feed\\' . $format; + + return new $obj(null, null, new Builder\Builder($data)); + } + + /** + * Construct a new Zend_Feed_Abstract object from a Zend_Feed_Builder_Interface data source + * + * @param \Zend\Feed\Builder\BuilderInterface $builder this object will be used to extract the data of the feed + * @param string $format (rss|atom) the requested output format + * @return \Zend\Feed\AbstractFeed + */ + public static function importBuilder(Builder\BuilderInterface $builder, $format = 'atom') + { + if (strtolower($format) == 'rss') { + $format = 'RSS'; + } else { + $format = ucfirst(strtolower($format)); + } + $obj = 'Zend\Feed\\' . $format; + + return new $obj(null, null, $builder); + } +} diff --git a/src/PubSubHubbub/CallbackAbstract.php b/src/PubSubHubbub/CallbackAbstract.php new file mode 100644 index 00000000..9a8d2764 --- /dev/null +++ b/src/PubSubHubbub/CallbackAbstract.php @@ -0,0 +1,302 @@ +setConfig($config); + } + } + + /** + * Process any injected configuration options + * + * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance + * @return \Zend\Feed\PubSubHubbub\CallbackAbstract + */ + public function setConfig($config) + { + if ($config instanceof \Zend\Config\Config) { + $config = $config->toArray(); + } elseif (!is_array($config)) { + throw new Exception('Array or Zend_Config object' + . 'expected, got ' . gettype($config)); + } + if (array_key_exists('storage', $config)) { + $this->setStorage($config['storage']); + } + return $this; + } + + /** + * Send the response, including all headers. + * If you wish to handle this via Zend_Controller, use the getter methods + * to retrieve any data needed to be set on your HTTP Response object, or + * simply give this object the HTTP Response instance to work with for you! + * + * @return void + */ + public function sendResponse() + { + $this->getHttpResponse()->sendResponse(); + } + + /** + * Sets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used + * to background save any verification tokens associated with a subscription + * or other. + * + * @param \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface $storage + * @return \Zend\Feed\PubSubHubbub\CallbackAbstract + */ + public function setStorage(Model\SubscriptionInterface $storage) + { + $this->_storage = $storage; + return $this; + } + + /** + * Gets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used + * to background save any verification tokens associated with a subscription + * or other. + * + * @return \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface + */ + public function getStorage() + { + if ($this->_storage === null) { + throw new Exception('No storage object has been' + . ' set that subclasses Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface'); + } + return $this->_storage; + } + + /** + * An instance of a class handling Http Responses. This is implemented in + * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with + * (i.e. not inherited from) Zend_Controller_Response_Http. + * + * @param Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http $httpResponse + * @return \Zend\Feed\PubSubHubbub\CallbackAbstract + */ + public function setHttpResponse($httpResponse) + { + if (!is_object($httpResponse) + || (!$httpResponse instanceof HttpResponse + && !$httpResponse instanceof \Zend\Controller\Response\Http) + ) { + throw new Exception('HTTP Response object must' + . ' implement one of Zend_Feed_Pubsubhubbub_HttpResponse or' + . ' Zend_Controller_Response_Http'); + } + $this->_httpResponse = $httpResponse; + return $this; + } + + /** + * An instance of a class handling Http Responses. This is implemented in + * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with + * (i.e. not inherited from) Zend_Controller_Response_Http. + * + * @return Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http + */ + public function getHttpResponse() + { + if ($this->_httpResponse === null) { + $this->_httpResponse = new HttpResponse; + } + return $this->_httpResponse; + } + + /** + * Sets the number of Subscribers for which any updates are on behalf of. + * In other words, is this class serving one or more subscribers? How many? + * Defaults to 1 if left unchanged. + * + * @param string|int $count + * @return \Zend\Feed\PubSubHubbub\CallbackAbstract + */ + public function setSubscriberCount($count) + { + $count = intval($count); + if ($count <= 0) { + throw new Exception('Subscriber count must be' + . ' greater than zero'); + } + $this->_subscriberCount = $count; + return $this; + } + + /** + * Gets the number of Subscribers for which any updates are on behalf of. + * In other words, is this class serving one or more subscribers? How many? + * + * @return int + */ + public function getSubscriberCount() + { + return $this->_subscriberCount; + } + + /** + * Attempt to detect the callback URL (specifically the path forward) + */ + protected function _detectCallbackUrl() + { + $callbackUrl = ''; + if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { + $callbackUrl = $_SERVER['HTTP_X_REWRITE_URL']; + } elseif (isset($_SERVER['REQUEST_URI'])) { + $callbackUrl = $_SERVER['REQUEST_URI']; + $scheme = 'http'; + if ($_SERVER['HTTPS'] == 'on') { + $scheme = 'https'; + } + $schemeAndHttpHost = $scheme . '://' . $this->_getHttpHost(); + if (strpos($callbackUrl, $schemeAndHttpHost) === 0) { + $callbackUrl = substr($callbackUrl, strlen($schemeAndHttpHost)); + } + } elseif (isset($_SERVER['ORIG_PATH_INFO'])) { + $callbackUrl= $_SERVER['ORIG_PATH_INFO']; + if (!empty($_SERVER['QUERY_STRING'])) { + $callbackUrl .= '?' . $_SERVER['QUERY_STRING']; + } + } + return $callbackUrl; + } + + /** + * Get the HTTP host + * + * @return string + */ + protected function _getHttpHost() + { + if (!empty($_SERVER['HTTP_HOST'])) { + return $_SERVER['HTTP_HOST']; + } + $scheme = 'http'; + if ($_SERVER['HTTPS'] == 'on') { + $scheme = 'https'; + } + $name = $_SERVER['SERVER_NAME']; + $port = $_SERVER['SERVER_PORT']; + if (($scheme == 'http' && $port == 80) + || ($scheme == 'https' && $port == 443) + ) { + return $name; + } else { + return $name . ':' . $port; + } + } + + /** + * Retrieve a Header value from either $_SERVER or Apache + * + * @param string $header + */ + protected function _getHeader($header) + { + $temp = strtoupper(str_replace('-', '_', $header)); + if (!empty($_SERVER[$temp])) { + return $_SERVER[$temp]; + } + $temp = 'HTTP_' . strtoupper(str_replace('-', '_', $header)); + if (!empty($_SERVER[$temp])) { + return $_SERVER[$temp]; + } + if (function_exists('apache_request_headers')) { + $headers = apache_request_headers(); + if (!empty($headers[$header])) { + return $headers[$header]; + } + } + return false; + } + + /** + * Return the raw body of the request + * + * @return string|false Raw body, or false if not present + */ + protected function _getRawBody() + { + $body = file_get_contents('php://input'); + if (strlen(trim($body)) == 0 && isset($GLOBALS['HTTP_RAW_POST_DATA'])) { + $body = $GLOBALS['HTTP_RAW_POST_DATA']; + } + if (strlen(trim($body)) > 0) { + return $body; + } + return false; + } +} diff --git a/src/PubSubHubbub/CallbackInterface.php b/src/PubSubHubbub/CallbackInterface.php new file mode 100644 index 00000000..51d82a96 --- /dev/null +++ b/src/PubSubHubbub/CallbackInterface.php @@ -0,0 +1,74 @@ +sendHeaders(); + echo $this->getBody(); + } + + /** + * Send all headers + * + * Sends any headers specified. If an {@link setHttpResponseCode() HTTP response code} + * has been specified, it is sent with the first header. + * + * @return void + */ + public function sendHeaders() + { + if (count($this->_headers) || (200 != $this->_httpResponseCode)) { + $this->canSendHeaders(true); + } elseif (200 == $this->_httpResponseCode) { + return; + } + $httpCodeSent = false; + foreach ($this->_headers as $header) { + if (!$httpCodeSent && $this->_httpResponseCode) { + header($header['name'] . ': ' . $header['value'], $header['replace'], $this->_httpResponseCode); + $httpCodeSent = true; + } else { + header($header['name'] . ': ' . $header['value'], $header['replace']); + } + } + if (!$httpCodeSent) { + header('HTTP/1.1 ' . $this->_httpResponseCode); + $httpCodeSent = true; + } + } + + /** + * Set a header + * + * If $replace is true, replaces any headers already defined with that + * $name. + * + * @param string $name + * @param string $value + * @param boolean $replace + * @return \Zend\Feed\PubSubHubbub\HttpResponse + */ + public function setHeader($name, $value, $replace = false) + { + $name = $this->_normalizeHeader($name); + $value = (string) $value; + if ($replace) { + foreach ($this->_headers as $key => $header) { + if ($name == $header['name']) { + unset($this->_headers[$key]); + } + } + } + $this->_headers[] = array( + 'name' => $name, + 'value' => $value, + 'replace' => $replace, + ); + + return $this; + } + + /** + * Check if a specific Header is set and return its value + * + * @param string $name + * @return string|null + */ + public function getHeader($name) + { + $name = $this->_normalizeHeader($name); + foreach ($this->_headers as $header) { + if ($header['name'] == $name) { + return $header['value']; + } + } + } + + /** + * Return array of headers; see {@link $_headers} for format + * + * @return array + */ + public function getHeaders() + { + return $this->_headers; + } + + /** + * Can we send headers? + * + * @param boolean $throw Whether or not to throw an exception if headers have been sent; defaults to false + * @return boolean + * @throws \Zend\Feed\PubSubHubbub\Exception + */ + public function canSendHeaders($throw = false) + { + $ok = headers_sent($file, $line); + if ($ok && $throw) { + throw new Exception('Cannot send headers; headers already sent in ' . $file . ', line ' . $line); + } + return !$ok; + } + + /** + * Set HTTP response code to use with headers + * + * @param int $code + * @return \Zend\Feed\PubSubHubbub\HttpResponse + */ + public function setHttpResponseCode($code) + { + if (!is_int($code) || (100 > $code) || (599 < $code)) { + throw new Exception('Invalid HTTP response' + . ' code:' . $code); + } + $this->_httpResponseCode = $code; + return $this; + } + + /** + * Retrieve HTTP response code + * + * @return int + */ + public function getHttpResponseCode() + { + return $this->_httpResponseCode; + } + + /** + * Set body content + * + * @param string $content + * @return \Zend\Feed\PubSubHubbub\HttpResponse + */ + public function setBody($content) + { + $this->_body = (string) $content; + $this->setHeader('content-length', strlen($content)); + return $this; + } + + /** + * Return the body content + * + * @return string + */ + public function getBody() + { + return $this->_body; + } + + /** + * Normalizes a header name to X-Capitalized-Names + * + * @param string $name + * @return string + */ + protected function _normalizeHeader($name) + { + $filtered = str_replace(array('-', '_'), ' ', (string) $name); + $filtered = ucwords(strtolower($filtered)); + $filtered = str_replace(' ', '-', $filtered); + return $filtered; + } +} diff --git a/src/PubSubHubbub/Model/ModelAbstract.php b/src/PubSubHubbub/Model/ModelAbstract.php new file mode 100644 index 00000000..a9c897f1 --- /dev/null +++ b/src/PubSubHubbub/Model/ModelAbstract.php @@ -0,0 +1,62 @@ +_db = new \Zend\DB\Table\Table($table); + } else { + $this->_db = $tableGateway; + } + } + +} diff --git a/src/PubSubHubbub/Model/Subscription.php b/src/PubSubHubbub/Model/Subscription.php new file mode 100644 index 00000000..cc049378 --- /dev/null +++ b/src/PubSubHubbub/Model/Subscription.php @@ -0,0 +1,134 @@ +_db->find($data['id']); + if ($result) { + $data['created_time'] = $result->current()->created_time; + $now = new Date\Date; + if ($data['lease_seconds']) { + $data['expiration_time'] = $now->add($data['lease_seconds'], Date\Date::SECOND) + ->get('yyyy-MM-dd HH:mm:ss'); + } + $this->_db->update( + $data, + $this->_db->getAdapter()->quoteInto('id = ?', $data['id']) + ); + return false; + } + + $this->_db->insert($data); + return true; + } + + /** + * Get subscription by ID/key + * + * @param string $key + * @return array + */ + public function getSubscription($key) + { + if (empty($key) || !is_string($key)) { + throw new PubSubHubbub\Exception('Invalid parameter "key"' + .' of "' . $key . '" must be a non-empty string'); + } + $result = $this->_db->find($key); + if ($result) { + return (array) $result->current(); + } + return false; + } + + /** + * Determine if a subscription matching the key exists + * + * @param string $key + * @return bool + */ + public function hasSubscription($key) + { + if (empty($key) || !is_string($key)) { + throw new PubSubHubbub\Exception('Invalid parameter "key"' + .' of "' . $key . '" must be a non-empty string'); + } + $result = $this->_db->find($key); + if ($result) { + return true; + } + return false; + } + + /** + * Delete a subscription + * + * @param string $key + * @return bool + */ + public function deleteSubscription($key) + { + $result = $this->_db->find($key); + if ($result) { + $this->_db->delete( + $this->_db->getAdapter()->quoteInto('id = ?', $key) + ); + return true; + } + return false; + } + +} diff --git a/src/PubSubHubbub/Model/SubscriptionInterface.php b/src/PubSubHubbub/Model/SubscriptionInterface.php new file mode 100644 index 00000000..bf318407 --- /dev/null +++ b/src/PubSubHubbub/Model/SubscriptionInterface.php @@ -0,0 +1,70 @@ +resetParameters(); endif; diff --git a/src/PubSubHubbub/Publisher.php b/src/PubSubHubbub/Publisher.php new file mode 100644 index 00000000..f482a679 --- /dev/null +++ b/src/PubSubHubbub/Publisher.php @@ -0,0 +1,414 @@ +setConfig($config); + } + } + + /** + * Process any injected configuration options + * + * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance + * @return \Zend\Feed\PubSubHubbub\Publisher + */ + public function setConfig($config) + { + if ($config instanceof \Zend\Config\Config) { + $config = $config->toArray(); + } elseif (!is_array($config)) { + throw new Exception('Array or Zend_Config object' + . 'expected, got ' . gettype($config)); + } + if (array_key_exists('hubUrls', $config)) { + $this->addHubUrls($config['hubUrls']); + } + if (array_key_exists('updatedTopicUrls', $config)) { + $this->addUpdatedTopicUrls($config['updatedTopicUrls']); + } + if (array_key_exists('parameters', $config)) { + $this->setParameters($config['parameters']); + } + return $this; + } + + /** + * Add a Hub Server URL supported by Publisher + * + * @param string $url + * @return \Zend\Feed\PubSubHubbub\Publisher + */ + public function addHubUrl($url) + { + if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { + throw new Exception('Invalid parameter "url"' + .' of "' . $url . '" must be a non-empty string and a valid' + .'URL'); + } + $this->_hubUrls[] = $url; + return $this; + } + + /** + * Add an array of Hub Server URLs supported by Publisher + * + * @param array $urls + * @return \Zend\Feed\PubSubHubbub\Publisher + */ + public function addHubUrls(array $urls) + { + foreach ($urls as $url) { + $this->addHubUrl($url); + } + return $this; + } + + /** + * Remove a Hub Server URL + * + * @param string $url + * @return \Zend\Feed\PubSubHubbub\Publisher + */ + public function removeHubUrl($url) + { + if (!in_array($url, $this->getHubUrls())) { + return $this; + } + $key = array_search($url, $this->_hubUrls); + unset($this->_hubUrls[$key]); + return $this; + } + + /** + * Return an array of unique Hub Server URLs currently available + * + * @return array + */ + public function getHubUrls() + { + $this->_hubUrls = array_unique($this->_hubUrls); + return $this->_hubUrls; + } + + /** + * Add a URL to a topic (Atom or RSS feed) which has been updated + * + * @param string $url + * @return \Zend\Feed\PubSubHubbub\Publisher + */ + public function addUpdatedTopicUrl($url) + { + if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { + throw new Exception('Invalid parameter "url"' + .' of "' . $url . '" must be a non-empty string and a valid' + .'URL'); + } + $this->_updatedTopicUrls[] = $url; + return $this; + } + + /** + * Add an array of Topic URLs which have been updated + * + * @param array $urls + * @return \Zend\Feed\PubSubHubbub\Publisher + */ + public function addUpdatedTopicUrls(array $urls) + { + foreach ($urls as $url) { + $this->addUpdatedTopicUrl($url); + } + return $this; + } + + /** + * Remove an updated topic URL + * + * @param string $url + * @return \Zend\Feed\PubSubHubbub\Publisher + */ + public function removeUpdatedTopicUrl($url) + { + if (!in_array($url, $this->getUpdatedTopicUrls())) { + return $this; + } + $key = array_search($url, $this->_updatedTopicUrls); + unset($this->_updatedTopicUrls[$key]); + return $this; + } + + /** + * Return an array of unique updated topic URLs currently available + * + * @return array + */ + public function getUpdatedTopicUrls() + { + $this->_updatedTopicUrls = array_unique($this->_updatedTopicUrls); + return $this->_updatedTopicUrls; + } + + /** + * Notifies a single Hub Server URL of changes + * + * @param string $url The Hub Server's URL + * @return void + * @throws \Zend\Feed\PubSubHubbub\Exception Thrown on failure + */ + public function notifyHub($url) + { + if (empty($url) || !is_string($url) || !URI\Zend\Uri\Uri::check($url)) { + throw new Exception('Invalid parameter "url"' + .' of "' . $url . '" must be a non-empty string and a valid' + .'URL'); + } + $client = $this->_getHttpClient(); + $client->setUri($url); + $response = $client->request(); + if ($response->getStatus() !== 204) { + throw new Exception('Notification to Hub Server ' + . 'at "' . $url . '" appears to have failed with a status code of "' + . $response->getStatus() . '" and message "' + . $response->getMessage() . '"'); + } + } + + /** + * Notifies all Hub Server URLs of changes + * + * If a Hub notification fails, certain data will be retained in an + * an array retrieved using getErrors(), if a failure occurs for any Hubs + * the isSuccess() check will return FALSE. This method is designed not + * to needlessly fail with an Exception/Error unless from Zend_Http_Client. + * + * @return void + * @throws \Zend\Feed\PubSubHubbub\Exception Thrown if no hubs attached + */ + public function notifyAll() + { + $client = $this->_getHttpClient(); + $hubs = $this->getHubUrls(); + if (empty($hubs)) { + throw new Exception('No Hub Server URLs' + . ' have been set so no notifcations can be sent'); + } + $this->_errors = array(); + foreach ($hubs as $url) { + $client->setUri($url); + $response = $client->request(); + if ($response->getStatus() !== 204) { + $this->_errors[] = array( + 'response' => $response, + 'hubUrl' => $url + ); + } + } + } + + /** + * Add an optional parameter to the update notification requests + * + * @param string $name + * @param string|null $value + * @return \Zend\Feed\PubSubHubbub\Publisher + */ + public function setParameter($name, $value = null) + { + if (is_array($name)) { + $this->setParameters($name); + return $this; + } + if (empty($name) || !is_string($name)) { + throw new Exception('Invalid parameter "name"' + .' of "' . $name . '" must be a non-empty string'); + } + if ($value === null) { + $this->removeParameter($name); + return $this; + } + if (empty($value) || (!is_string($value) && !is_null($value))) { + throw new Exception('Invalid parameter "value"' + .' of "' . $value . '" must be a non-empty string'); + } + $this->_parameters[$name] = $value; + return $this; + } + + /** + * Add an optional parameter to the update notification requests + * + * @param array $parameters + * @return \Zend\Feed\PubSubHubbub\Publisher + */ + public function setParameters(array $parameters) + { + foreach ($parameters as $name => $value) { + $this->setParameter($name, $value); + } + return $this; + } + + /** + * Remove an optional parameter for the notification requests + * + * @param string $name + * @return \Zend\Feed\PubSubHubbub\Publisher + */ + public function removeParameter($name) + { + if (empty($name) || !is_string($name)) { + throw new Exception('Invalid parameter "name"' + .' of "' . $name . '" must be a non-empty string'); + } + if (array_key_exists($name, $this->_parameters)) { + unset($this->_parameters[$name]); + } + return $this; + } + + /** + * Return an array of optional parameters for notification requests + * + * @return array + */ + public function getParameters() + { + return $this->_parameters; + } + + /** + * Returns a boolean indicator of whether the notifications to Hub + * Servers were ALL successful. If even one failed, FALSE is returned. + * + * @return bool + */ + public function isSuccess() + { + if (count($this->_errors) > 0) { + return false; + } + return true; + } + + /** + * Return an array of errors met from any failures, including keys: + * 'response' => the Zend_Http_Response object from the failure + * 'hubUrl' => the URL of the Hub Server whose notification failed + * + * @return array + */ + public function getErrors() + { + return $this->_errors; + } + + /** + * Get a basic prepared HTTP client for use + * + * @return \Zend\HTTP\Client + */ + protected function _getHttpClient() + { + $client = PubSubHubbub::getHttpClient(); + $client->setMethod(\Zend\HTTP\Client::POST); + $client->setConfig(array( + 'useragent' => 'Zend_Feed_Pubsubhubbub_Publisher/' . \Zend\Version::VERSION, + )); + $params = array(); + $params[] = 'hub.mode=publish'; + $topics = $this->getUpdatedTopicUrls(); + if (empty($topics)) { + throw new Exception('No updated topic URLs' + . ' have been set'); + } + foreach ($topics as $topicUrl) { + $params[] = 'hub.url=' . urlencode($topicUrl); + } + $optParams = $this->getParameters(); + foreach ($optParams as $name => $value) { + $params[] = urlencode($name) . '=' . urlencode($value); + } + $paramString = implode('&', $params); + $client->setRawData($paramString); + return $client; + } +} diff --git a/src/PubSubHubbub/Subscriber/Callback.php b/src/PubSubHubbub/Subscriber/Callback.php new file mode 100644 index 00000000..a29850cd --- /dev/null +++ b/src/PubSubHubbub/Subscriber/Callback.php @@ -0,0 +1,323 @@ +_subscriptionKey = $key; + return $this; + } + + /** + * Handle any callback from a Hub Server responding to a subscription or + * unsubscription request. This should be the Hub Server confirming the + * the request prior to taking action on it. + * + * @param array $httpGetData GET data if available and not in $_GET + * @param bool $sendResponseNow Whether to send response now or when asked + * @return void + */ + public function handle(array $httpGetData = null, $sendResponseNow = false) + { + if ($httpGetData === null) { + $httpGetData = $_GET; + } + + /** + * Handle any feed updates (sorry for the mess :P) + * + * This DOES NOT attempt to process a feed update. Feed updates + * SHOULD be validated/processed by an asynchronous process so as + * to avoid holding up responses to the Hub. + */ + if (strtolower($_SERVER['REQUEST_METHOD']) == 'post' + && $this->_hasValidVerifyToken(null, false) + && ($this->_getHeader('Content-Type') == 'application/atom+xml' + || $this->_getHeader('Content-Type') == 'application/rss+xml' + || $this->_getHeader('Content-Type') == 'application/xml' + || $this->_getHeader('Content-Type') == 'text/xml' + || $this->_getHeader('Content-Type') == 'application/rdf+xml') + ) { + $this->setFeedUpdate($this->_getRawBody()); + $this->getHttpResponse() + ->setHeader('X-Hub-On-Behalf-Of', $this->getSubscriberCount()); + /** + * Handle any (un)subscribe confirmation requests + */ + } elseif ($this->isValidHubVerification($httpGetData)) { + $data = $this->_currentSubscriptionData; + $this->getHttpResponse()->setBody($httpGetData['hub_challenge']); + $data['subscription_state'] = \Zend\Feed\PubSubHubbub\PubSubHubbub::SUBSCRIPTION_VERIFIED; + if (isset($httpGetData['hub_lease_seconds'])) { + $data['lease_seconds'] = $httpGetData['hub_lease_seconds']; + } + $this->getStorage()->setSubscription($data); + /** + * Hey, C'mon! We tried everything else! + */ + } else { + $this->getHttpResponse()->setHttpResponseCode(404); + } + if ($sendResponseNow) { + $this->sendResponse(); + } + } + + /** + * Checks validity of the request simply by making a quick pass and + * confirming the presence of all REQUIRED parameters. + * + * @param array $httpGetData + * @return bool + */ + public function isValidHubVerification(array $httpGetData) + { + /** + * As per the specification, the hub.verify_token is OPTIONAL. This + * implementation of Pubsubhubbub considers it REQUIRED and will + * always send a hub.verify_token parameter to be echoed back + * by the Hub Server. Therefore, its absence is considered invalid. + */ + if (strtolower($_SERVER['REQUEST_METHOD']) !== 'get') { + return false; + } + $required = array( + 'hub_mode', + 'hub_topic', + 'hub_challenge', + 'hub_verify_token', + ); + foreach ($required as $key) { + if (!array_key_exists($key, $httpGetData)) { + return false; + } + } + if ($httpGetData['hub_mode'] !== 'subscribe' + && $httpGetData['hub_mode'] !== 'unsubscribe' + ) { + return false; + } + if ($httpGetData['hub_mode'] == 'subscribe' + && !array_key_exists('hub_lease_seconds', $httpGetData) + ) { + return false; + } + if (!\Zend\URI\URL::validate($httpGetData['hub_topic'])) { + return false; + } + + /** + * Attempt to retrieve any Verification Token Key attached to Callback + * URL's path by our Subscriber implementation + */ + if (!$this->_hasValidVerifyToken($httpGetData)) { + return false; + } + return true; + } + + /** + * Sets a newly received feed (Atom/RSS) sent by a Hub as an update to a + * Topic we've subscribed to. + * + * @param string $feed + * @return \Zend\Feed\PubSubHubbub\Subscriber\Callback + */ + public function setFeedUpdate($feed) + { + $this->_feedUpdate = $feed; + return $this; + } + + /** + * Check if any newly received feed (Atom/RSS) update was received + * + * @return bool + */ + public function hasFeedUpdate() + { + if (is_null($this->_feedUpdate)) { + return false; + } + return true; + } + + /** + * Gets a newly received feed (Atom/RSS) sent by a Hub as an update to a + * Topic we've subscribed to. + * + * @return string + */ + public function getFeedUpdate() + { + return $this->_feedUpdate; + } + + /** + * Check for a valid verify_token. By default attempts to compare values + * with that sent from Hub, otherwise merely ascertains its existence. + * + * @param array $httpGetData + * @param bool $checkValue + * @return bool + */ + protected function _hasValidVerifyToken(array $httpGetData = null, $checkValue = true) + { + $verifyTokenKey = $this->_detectVerifyTokenKey($httpGetData); + if (empty($verifyTokenKey)) { + return false; + } + $verifyTokenExists = $this->getStorage()->hasSubscription($verifyTokenKey); + if (!$verifyTokenExists) { + return false; + } + if ($checkValue) { + $data = $this->getStorage()->getSubscription($verifyTokenKey); + $verifyToken = $data['verify_token']; + if ($verifyToken !== hash('sha256', $httpGetData['hub_verify_token'])) { + return false; + } + $this->_currentSubscriptionData = $data; + return true; + } + return true; + } + + /** + * Attempt to detect the verification token key. This would be passed in + * the Callback URL (which we are handling with this class!) as a URI + * path part (the last part by convention). + * + * @param null|array $httpGetData + * @return false|string + */ + protected function _detectVerifyTokenKey(array $httpGetData = null) + { + /** + * Available when sub keys encoding in Callback URL path + */ + if (isset($this->_subscriptionKey)) { + return $this->_subscriptionKey; + } + + /** + * Available only if allowed by PuSH 0.2 Hubs + */ + if (is_array($httpGetData) + && isset($httpGetData['xhub_subscription']) + ) { + return $httpGetData['xhub_subscription']; + } + + /** + * Available (possibly) if corrupted in transit and not part of $_GET + */ + $params = $this->_parseQueryString(); + if (isset($params['xhub.subscription'])) { + return rawurldecode($params['xhub.subscription']); + } + + return false; + } + + /** + * Build an array of Query String parameters. + * This bypasses $_GET which munges parameter names and cannot accept + * multiple parameters with the same key. + * + * @return array|void + */ + protected function _parseQueryString() + { + $params = array(); + $queryString = ''; + if (isset($_SERVER['QUERY_STRING'])) { + $queryString = $_SERVER['QUERY_STRING']; + } + if (empty($queryString)) { + return array(); + } + $parts = explode('&', $queryString); + foreach ($parts as $kvpair) { + $pair = explode('=', $kvpair); + $key = rawurldecode($pair[0]); + $value = rawurldecode($pair[1]); + if (isset($params[$key])) { + if (is_array($params[$key])) { + $params[$key][] = $value; + } else { + $params[$key] = array($params[$key], $value); + } + } else { + $params[$key] = $value; + } + } + return $params; + } +} diff --git a/src/Pubsubhubbub/Subscriber.php b/src/PubSubHubbub/Subscriber/Subscriber.php similarity index 83% rename from src/Pubsubhubbub/Subscriber.php rename to src/PubSubHubbub/Subscriber/Subscriber.php index 66c8c317..05410ff1 100644 --- a/src/Pubsubhubbub/Subscriber.php +++ b/src/PubSubHubbub/Subscriber/Subscriber.php @@ -20,18 +20,26 @@ */ /** - * @uses Zend_Date - * @uses Zend_Feed_Pubsubhubbub - * @uses Zend_Feed_Pubsubhubbub_Exception - * @uses Zend_Http_Client - * @uses Zend_Uri - * @uses Zend_Version + * @namespace + */ +namespace Zend\Feed\PubSubHubbub\Subscriber; +use Zend\Feed\PubSubHubbub; +use Zend\URI; +use Zend\Date; + +/** + * @uses \Zend\Date\Date + * @uses \Zend\Feed\PubSubHubbub\PubSubHubbub + * @uses \Zend\Feed\PubSubHubbub\Exception + * @uses \Zend\HTTP\Client + * @uses \Zend\Uri\Uri + * @uses \Zend\Version * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Pubsubhubbub_Subscriber +class Subscriber { /** * An array of URLs for all Hub Servers to subscribe/unsubscribe. @@ -84,7 +92,7 @@ class Zend_Feed_Pubsubhubbub_Subscriber * @var string */ protected $_preferredVerificationMode - = Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC; + = PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_SYNC; /** * An array of any errors including keys for 'response', 'hubUrl'. @@ -106,7 +114,7 @@ class Zend_Feed_Pubsubhubbub_Subscriber * An instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used to background * save any verification tokens associated with a subscription or other. * - * @var Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface + * @var \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface */ protected $_storage = null; @@ -141,7 +149,7 @@ class Zend_Feed_Pubsubhubbub_Subscriber * options for the Subscriber without calling all supported setter * methods in turn. * - * @param array|Zend_Config $options Options array or Zend_Config instance + * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance * @return void */ public function __construct($config = null) @@ -154,15 +162,15 @@ public function __construct($config = null) /** * Process any injected configuration options * - * @param array|Zend_Config $options Options array or Zend_Config instance - * @return Zend_Feed_Pubsubhubbub_Subscriber + * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance + * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber */ public function setConfig($config) { - if ($config instanceof Zend_Config) { + if ($config instanceof \Zend\Config\Config) { $config = $config->toArray(); } elseif (!is_array($config)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' + throw new PubSubHubbub\Exception('Array or Zend_Config object' . ' expected, got ' . gettype($config)); } if (array_key_exists('hubUrls', $config)) { @@ -202,12 +210,12 @@ public function setConfig($config) * event will relate * * @param string $url - * @return Zend_Feed_Pubsubhubbub_Subscriber + * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber */ public function setTopicUrl($url) { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' + if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { + throw new PubSubHubbub\Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .' URL'); } @@ -224,7 +232,7 @@ public function setTopicUrl($url) public function getTopicUrl() { if (empty($this->_topicUrl)) { - throw new Zend_Feed_Pubsubhubbub_Exception('A valid Topic (RSS or Atom' + throw new PubSubHubbub\Exception('A valid Topic (RSS or Atom' . ' feed) URL MUST be set before attempting any operation'); } return $this->_topicUrl; @@ -234,13 +242,13 @@ public function getTopicUrl() * Set the number of seconds for which any subscription will remain valid * * @param int $seconds - * @return Zend_Feed_Pubsubhubbub_Subscriber + * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber */ public function setLeaseSeconds($seconds) { $seconds = intval($seconds); if ($seconds <= 0) { - throw new Zend_Feed_Pubsubhubbub_Exception('Expected lease seconds' + throw new PubSubHubbub\Exception('Expected lease seconds' . ' must be an integer greater than zero'); } $this->_leaseSeconds = $seconds; @@ -262,12 +270,12 @@ public function getLeaseSeconds() * this Subscriber * * @param string $url - * @return Zend_Feed_Pubsubhubbub_Subscriber + * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber */ public function setCallbackUrl($url) { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' + if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { + throw new PubSubHubbub\Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); } @@ -284,7 +292,7 @@ public function setCallbackUrl($url) public function getCallbackUrl() { if (empty($this->_callbackUrl)) { - throw new Zend_Feed_Pubsubhubbub_Exception('A valid Callback URL MUST be' + throw new PubSubHubbub\Exception('A valid Callback URL MUST be' . ' set before attempting any operation'); } return $this->_callbackUrl; @@ -299,13 +307,13 @@ public function getCallbackUrl() * order of occurance in the parameter list determines this preference. * * @param string $mode Should be 'sync' or 'async' - * @return Zend_Feed_Pubsubhubbub_Subscriber + * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber */ public function setPreferredVerificationMode($mode) { - if ($mode !== Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC - && $mode !== Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid preferred' + if ($mode !== PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_SYNC + && $mode !== PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_ASYNC) { + throw new PubSubHubbub\Exception('Invalid preferred' . ' mode specified: "' . $mode . '" but should be one of' . ' Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC or' . ' Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC'); @@ -328,12 +336,12 @@ public function getPreferredVerificationMode() * Add a Hub Server URL supported by Publisher * * @param string $url - * @return Zend_Feed_Pubsubhubbub_Subscriber + * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber */ public function addHubUrl($url) { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' + if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { + throw new PubSubHubbub\Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); } @@ -345,7 +353,7 @@ public function addHubUrl($url) * Add an array of Hub Server URLs supported by Publisher * * @param array $urls - * @return Zend_Feed_Pubsubhubbub_Subscriber + * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber */ public function addHubUrls(array $urls) { @@ -359,7 +367,7 @@ public function addHubUrls(array $urls) * Remove a Hub Server URL * * @param string $url - * @return Zend_Feed_Pubsubhubbub_Subscriber + * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber */ public function removeHubUrl($url) { @@ -387,12 +395,12 @@ public function getHubUrls() * * @param string $url * @param array $authentication - * @return Zend_Feed_Pubsubhubbub_Subscriber + * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber */ public function addAuthentication($url, array $authentication) { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' + if (empty($url) || !is_string($url) || !URI\Zend\Uri\Uri::check($url)) { + throw new PubSubHubbub\Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); } @@ -404,7 +412,7 @@ public function addAuthentication($url, array $authentication) * Add authentication credentials for hub URLs * * @param array $authentications - * @return Zend_Feed_Pubsubhubbub_Subscriber + * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber */ public function addAuthentications(array $authentications) { @@ -428,7 +436,7 @@ public function getAuthentications() * Set flag indicating whether or not to use a path parameter * * @param bool $bool - * @return Zend_Feed_Pubsubhubbub_Subscriber + * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber */ public function usePathParameter($bool = true) { @@ -441,7 +449,7 @@ public function usePathParameter($bool = true) * * @param string $name * @param string|null $value - * @return Zend_Feed_Pubsubhubbub_Subscriber + * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber */ public function setParameter($name, $value = null) { @@ -450,7 +458,7 @@ public function setParameter($name, $value = null) return $this; } if (empty($name) || !is_string($name)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' + throw new PubSubHubbub\Exception('Invalid parameter "name"' . ' of "' . $name . '" must be a non-empty string'); } if ($value === null) { @@ -458,7 +466,7 @@ public function setParameter($name, $value = null) return $this; } if (empty($value) || (!is_string($value) && !is_null($value))) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "value"' + throw new PubSubHubbub\Exception('Invalid parameter "value"' . ' of "' . $value . '" must be a non-empty string'); } $this->_parameters[$name] = $value; @@ -470,7 +478,7 @@ public function setParameter($name, $value = null) * * @param string $name * @param string|null $value - * @return Zend_Feed_Pubsubhubbub_Subscriber + * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber */ public function setParameters(array $parameters) { @@ -484,12 +492,12 @@ public function setParameters(array $parameters) * Remove an optional parameter for the (un)subscribe requests * * @param string $name - * @return Zend_Feed_Pubsubhubbub_Subscriber + * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber */ public function removeParameter($name) { if (empty($name) || !is_string($name)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' + throw new PubSubHubbub\Exception('Invalid parameter "name"' . ' of "' . $name . '" must be a non-empty string'); } if (array_key_exists($name, $this->_parameters)) { @@ -512,10 +520,10 @@ public function getParameters() * Sets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used to background * save any verification tokens associated with a subscription or other. * - * @param Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage - * @return Zend_Feed_Pubsubhubbub_Subscriber + * @param \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface $storage + * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber */ - public function setStorage(Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage) + public function setStorage(PubSubHubbub\Model\SubscriptionInterface $storage) { $this->_storage = $storage; return $this; @@ -526,12 +534,12 @@ public function setStorage(Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $s * to background save any verification tokens associated with a subscription * or other. * - * @return Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface + * @return \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface */ public function getStorage() { if ($this->_storage === null) { - throw new Zend_Feed_Pubsubhubbub_Exception('No storage vehicle ' + throw new PubSubHubbub\Exception('No storage vehicle ' . 'has been set.'); } return $this->_storage; @@ -609,7 +617,7 @@ protected function _doRequest($mode) $client = $this->_getHttpClient(); $hubs = $this->getHubUrls(); if (empty($hubs)) { - throw new Zend_Feed_Pubsubhubbub_Exception('No Hub Server URLs' + throw new PubSubHubbub\Exception('No Hub Server URLs' . ' have been set so no subscriptions can be attempted'); } $this->_errors = array(); @@ -649,14 +657,14 @@ protected function _doRequest($mode) * Get a basic prepared HTTP client for use * * @param string $mode Must be "subscribe" or "unsubscribe" - * @return Zend_Http_Client + * @return \Zend\HTTP\Client */ protected function _getHttpClient() { - $client = Zend_Feed_Pubsubhubbub::getHttpClient(); - $client->setMethod(Zend_Http_Client::POST); + $client = PubSubHubbub\PubSubHubbub::getHttpClient(); + $client->setMethod(\Zend\HTTP\Client::POST); $client->setConfig(array('useragent' => 'Zend_Feed_Pubsubhubbub_Subscriber/' - . Zend_Version::VERSION)); + . \Zend\Version::VERSION)); return $client; } @@ -671,7 +679,7 @@ protected function _getHttpClient() protected function _getRequestParameters($hubUrl, $mode) { if (!in_array($mode, array('subscribe', 'unsubscribe'))) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid mode specified: "' + throw new PubSubHubbub\Exception('Invalid mode specified: "' . $mode . '" which should have been "subscribe" or "unsubscribe"'); } @@ -681,16 +689,16 @@ protected function _getRequestParameters($hubUrl, $mode) ); if ($this->getPreferredVerificationMode() - == Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC + == PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_SYNC ) { $vmodes = array( - Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC, - Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC, + PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_SYNC, + PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_ASYNC, ); } else { $vmodes = array( - Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC, - Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC, + PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_ASYNC, + PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_SYNC, ); } $params['hub.verify'] = array(); @@ -709,10 +717,10 @@ protected function _getRequestParameters($hubUrl, $mode) // Note: query string only usable with PuSH 0.2 Hubs if (!$this->_usePathParameter) { $params['hub.callback'] = $this->getCallbackUrl() - . '?xhub.subscription=' . Zend_Feed_Pubsubhubbub::urlencode($key); + . '?xhub.subscription=' . PubSubHubbub\PubSubHubbub::urlencode($key); } else { $params['hub.callback'] = rtrim($this->getCallbackUrl(), '/') - . '/' . Zend_Feed_Pubsubhubbub::urlencode($key); + . '/' . PubSubHubbub\PubSubHubbub::urlencode($key); } if ($mode == 'subscribe' && !is_null($this->getLeaseSeconds())) { $params['hub.lease_seconds'] = $this->getLeaseSeconds(); @@ -725,10 +733,10 @@ protected function _getRequestParameters($hubUrl, $mode) } // store subscription to storage - $now = new Zend_Date; + $now = new Date\Date; $expires = null; if (isset($params['hub.lease_seconds'])) { - $expires = $now->add($params['hub.lease_seconds'], Zend_Date::SECOND) + $expires = $now->add($params['hub.lease_seconds'], Date\Date::SECOND) ->get('yyyy-MM-dd HH:mm:ss'); } $data = array( @@ -740,7 +748,7 @@ protected function _getRequestParameters($hubUrl, $mode) 'verify_token' => hash('sha256', $params['hub.verify_token']), 'secret' => null, 'expiration_time' => $expires, - 'subscription_state' => Zend_Feed_Pubsubhubbub::SUBSCRIPTION_NOTVERIFIED, + 'subscription_state' => PubSubHubbub\PubSubHubbub::SUBSCRIPTION_NOTVERIFIED, ); $this->getStorage()->setSubscription($data); @@ -790,15 +798,15 @@ protected function _urlEncode(array $params) $encoded = array(); foreach ($params as $key => $value) { if (is_array($value)) { - $ekey = Zend_Feed_Pubsubhubbub::urlencode($key); + $ekey = PubSubHubbub\PubSubHubbub::urlencode($key); $encoded[$ekey] = array(); foreach ($value as $duplicateKey) { $encoded[$ekey][] - = Zend_Feed_Pubsubhubbub::urlencode($duplicateKey); + = PubSubHubbub\PubSubHubbub::urlencode($duplicateKey); } } else { - $encoded[Zend_Feed_Pubsubhubbub::urlencode($key)] - = Zend_Feed_Pubsubhubbub::urlencode($value); + $encoded[PubSubHubbub\PubSubHubbub::urlencode($key)] + = PubSubHubbub\PubSubHubbub::urlencode($value); } } return $encoded; diff --git a/src/Pubsubhubbub/CallbackAbstract.php b/src/Pubsubhubbub/CallbackAbstract.php index 22dad7df..9a8d2764 100644 --- a/src/Pubsubhubbub/CallbackAbstract.php +++ b/src/Pubsubhubbub/CallbackAbstract.php @@ -21,24 +21,29 @@ */ /** - * @uses Zend_Feed_Pubsubhubbub_CallbackInterface - * @uses Zend_Feed_Pubsubhubbub_Exception - * @uses Zend_Feed_Pubsubhubbub_HttpResponse + * @namespace + */ +namespace Zend\Feed\PubSubHubbub; + +/** + * @uses \Zend\Feed\PubSubHubbub\CallbackInterface + * @uses \Zend\Feed\PubSubHubbub\Exception + * @uses \Zend\Feed\PubSubHubbub\HttpResponse * @category Zend * @package Zend_Feed_Pubsubhubbub * @subpackage Callback * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class Zend_Feed_Pubsubhubbub_CallbackAbstract - implements Zend_Feed_Pubsubhubbub_CallbackInterface +abstract class CallbackAbstract + implements CallbackInterface { /** * An instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used * to background save any verification tokens associated with a subscription * or other. * - * @var Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface + * @var \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface */ protected $_storage = null; @@ -47,7 +52,7 @@ abstract class Zend_Feed_Pubsubhubbub_CallbackAbstract * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with * (i.e. not inherited from) Zend_Controller_Response_Http. * - * @var Zend_Feed_Pubsubhubbub_HttpResponse|Zend_Controller_Response_Http + * @var Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http */ protected $_httpResponse = null; @@ -63,7 +68,7 @@ abstract class Zend_Feed_Pubsubhubbub_CallbackAbstract * options for the Subscriber without calling all supported setter * methods in turn. * - * @param array|Zend_Config $options Options array or Zend_Config instance + * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance */ public function __construct($config = null) { @@ -75,15 +80,15 @@ public function __construct($config = null) /** * Process any injected configuration options * - * @param array|Zend_Config $options Options array or Zend_Config instance - * @return Zend_Feed_Pubsubhubbub_CallbackAbstract + * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance + * @return \Zend\Feed\PubSubHubbub\CallbackAbstract */ public function setConfig($config) { - if ($config instanceof Zend_Config) { + if ($config instanceof \Zend\Config\Config) { $config = $config->toArray(); } elseif (!is_array($config)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' + throw new Exception('Array or Zend_Config object' . 'expected, got ' . gettype($config)); } if (array_key_exists('storage', $config)) { @@ -110,10 +115,10 @@ public function sendResponse() * to background save any verification tokens associated with a subscription * or other. * - * @param Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage - * @return Zend_Feed_Pubsubhubbub_CallbackAbstract + * @param \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface $storage + * @return \Zend\Feed\PubSubHubbub\CallbackAbstract */ - public function setStorage(Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage) + public function setStorage(Model\SubscriptionInterface $storage) { $this->_storage = $storage; return $this; @@ -124,12 +129,12 @@ public function setStorage(Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $s * to background save any verification tokens associated with a subscription * or other. * - * @return Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface + * @return \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface */ public function getStorage() { if ($this->_storage === null) { - throw new Zend_Feed_Pubsubhubbub_Exception('No storage object has been' + throw new Exception('No storage object has been' . ' set that subclasses Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface'); } return $this->_storage; @@ -140,16 +145,16 @@ public function getStorage() * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with * (i.e. not inherited from) Zend_Controller_Response_Http. * - * @param Zend_Feed_Pubsubhubbub_HttpResponse|Zend_Controller_Response_Http $httpResponse - * @return Zend_Feed_Pubsubhubbub_CallbackAbstract + * @param Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http $httpResponse + * @return \Zend\Feed\PubSubHubbub\CallbackAbstract */ public function setHttpResponse($httpResponse) { if (!is_object($httpResponse) - || (!$httpResponse instanceof Zend_Feed_Pubsubhubbub_HttpResponse - && !$httpResponse instanceof Zend_Controller_Response_Http) + || (!$httpResponse instanceof HttpResponse + && !$httpResponse instanceof \Zend\Controller\Response\Http) ) { - throw new Zend_Feed_Pubsubhubbub_Exception('HTTP Response object must' + throw new Exception('HTTP Response object must' . ' implement one of Zend_Feed_Pubsubhubbub_HttpResponse or' . ' Zend_Controller_Response_Http'); } @@ -162,12 +167,12 @@ public function setHttpResponse($httpResponse) * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with * (i.e. not inherited from) Zend_Controller_Response_Http. * - * @return Zend_Feed_Pubsubhubbub_HttpResponse|Zend_Controller_Response_Http + * @return Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http */ public function getHttpResponse() { if ($this->_httpResponse === null) { - $this->_httpResponse = new Zend_Feed_Pubsubhubbub_HttpResponse; + $this->_httpResponse = new HttpResponse; } return $this->_httpResponse; } @@ -178,13 +183,13 @@ public function getHttpResponse() * Defaults to 1 if left unchanged. * * @param string|int $count - * @return Zend_Feed_Pubsubhubbub_CallbackAbstract + * @return \Zend\Feed\PubSubHubbub\CallbackAbstract */ public function setSubscriberCount($count) { $count = intval($count); if ($count <= 0) { - throw new Zend_Feed_Pubsubhubbub_Exception('Subscriber count must be' + throw new Exception('Subscriber count must be' . ' greater than zero'); } $this->_subscriberCount = $count; diff --git a/src/Pubsubhubbub/CallbackInterface.php b/src/Pubsubhubbub/CallbackInterface.php index d47a34dd..51d82a96 100644 --- a/src/Pubsubhubbub/CallbackInterface.php +++ b/src/Pubsubhubbub/CallbackInterface.php @@ -20,6 +20,11 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\PubSubHubbub; + /** * @category Zend * @package Zend_Feed_Pubsubhubbub @@ -27,7 +32,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface Zend_Feed_Pubsubhubbub_CallbackInterface +interface CallbackInterface { /** * Handle any callback from a Hub Server responding to a subscription or @@ -54,7 +59,7 @@ public function sendResponse(); * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with * (i.e. not inherited from) Zend_Controller_Response_Http. * - * @param Zend_Feed_Pubsubhubbub_HttpResponse|Zend_Controller_Response_Http $httpResponse + * @param Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http $httpResponse */ public function setHttpResponse($httpResponse); @@ -63,7 +68,7 @@ public function setHttpResponse($httpResponse); * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with * (i.e. not inherited from) Zend_Controller_Response_Http. * - * @return Zend_Feed_Pubsubhubbub_HttpResponse|Zend_Controller_Response_Http + * @return Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http */ public function getHttpResponse(); } diff --git a/src/Pubsubhubbub/Exception.php b/src/Pubsubhubbub/Exception.php index 0e609042..22dfc283 100644 --- a/src/Pubsubhubbub/Exception.php +++ b/src/Pubsubhubbub/Exception.php @@ -20,11 +20,16 @@ */ /** - * @uses Zend_Exception + * @namespace + */ +namespace Zend\Feed\PubSubHubbub; + +/** + * @uses \Zend\Exception * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Pubsubhubbub_Exception extends Zend_Exception +class Exception extends \Zend\Exception {} diff --git a/src/Pubsubhubbub/HttpResponse.php b/src/Pubsubhubbub/HttpResponse.php index a329c171..afceeed0 100644 --- a/src/Pubsubhubbub/HttpResponse.php +++ b/src/Pubsubhubbub/HttpResponse.php @@ -20,14 +20,19 @@ */ /** - * @uses Zend_Feed_Pubsubhubbub - * @uses Zend_Feed_Pubsubhubbub_Exception + * @namespace + */ +namespace Zend\Feed\PubSubHubbub; + +/** + * @uses \Zend\Feed\PubSubHubbub\PubSubHubbub + * @uses \Zend\Feed\PubSubHubbub\Exception * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Pubsubhubbub_HttpResponse +class HttpResponse { /** * The body of any response to the current callback request @@ -100,7 +105,7 @@ public function sendHeaders() * @param string $name * @param string $value * @param boolean $replace - * @return Zend_Feed_Pubsubhubbub_HttpResponse + * @return \Zend\Feed\PubSubHubbub\HttpResponse */ public function setHeader($name, $value, $replace = false) { @@ -153,13 +158,13 @@ public function getHeaders() * * @param boolean $throw Whether or not to throw an exception if headers have been sent; defaults to false * @return boolean - * @throws Zend_Feed_Pubsubhubbub_Exception + * @throws \Zend\Feed\PubSubHubbub\Exception */ public function canSendHeaders($throw = false) { $ok = headers_sent($file, $line); if ($ok && $throw) { - throw new Zend_Feed_Pubsubhubbub_Exception('Cannot send headers; headers already sent in ' . $file . ', line ' . $line); + throw new Exception('Cannot send headers; headers already sent in ' . $file . ', line ' . $line); } return !$ok; } @@ -168,12 +173,12 @@ public function canSendHeaders($throw = false) * Set HTTP response code to use with headers * * @param int $code - * @return Zend_Feed_Pubsubhubbub_HttpResponse + * @return \Zend\Feed\PubSubHubbub\HttpResponse */ public function setHttpResponseCode($code) { if (!is_int($code) || (100 > $code) || (599 < $code)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid HTTP response' + throw new Exception('Invalid HTTP response' . ' code:' . $code); } $this->_httpResponseCode = $code; @@ -194,7 +199,7 @@ public function getHttpResponseCode() * Set body content * * @param string $content - * @return Zend_Feed_Pubsubhubbub_HttpResponse + * @return \Zend\Feed\PubSubHubbub\HttpResponse */ public function setBody($content) { diff --git a/src/Pubsubhubbub/Model/ModelAbstract.php b/src/Pubsubhubbub/Model/ModelAbstract.php index bdbdd936..a9c897f1 100644 --- a/src/Pubsubhubbub/Model/ModelAbstract.php +++ b/src/Pubsubhubbub/Model/ModelAbstract.php @@ -20,19 +20,24 @@ */ /** - * @uses Zend_Db_Table - * @uses Zend_Registry + * @namespace + */ +namespace Zend\Feed\PubSubHubbub\Model; + +/** + * @uses \Zend\DB\Table\Table + * @uses \Zend\Registry * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Pubsubhubbub_Model_ModelAbstract +class ModelAbstract { /** * Zend_Db_Table instance to host database methods * - * @var Zend_Db_Table + * @var \Zend\DB\Table\Table */ protected $_db = null; @@ -40,15 +45,15 @@ class Zend_Feed_Pubsubhubbub_Model_ModelAbstract * Constructor * * @param array $data - * @param Zend_Db_Table_Abstract $tableGateway + * @param \Zend\DB\Table\AbstractTable $tableGateway * @return void */ - public function __construct(Zend_Db_Table_Abstract $tableGateway = null) + public function __construct(\Zend\DB\Table\AbstractTable $tableGateway = null) { if (is_null($tableGateway)) { $parts = explode('_', get_class($this)); $table = strtolower(array_pop($parts)); - $this->_db = new Zend_Db_Table($table); + $this->_db = new \Zend\DB\Table\Table($table); } else { $this->_db = $tableGateway; } diff --git a/src/Pubsubhubbub/Model/Subscription.php b/src/Pubsubhubbub/Model/Subscription.php index 9abb8c6f..cc049378 100644 --- a/src/Pubsubhubbub/Model/Subscription.php +++ b/src/Pubsubhubbub/Model/Subscription.php @@ -21,19 +21,26 @@ */ /** - * @uses Zend_Date - * @uses Zend_Feed_Pubsubhubbub_Exception - * @uses Zend_Feed_Pubsubhubbub_Model_ModelAbstract - * @uses Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface + * @namespace + */ +namespace Zend\Feed\PubSubHubbub\Model; +use Zend\Feed\PubSubHubbub; +use Zend\Date; + +/** + * @uses \Zend\Date\Date + * @uses \Zend\Feed\PubSubHubbub\Exception + * @uses \Zend\Feed\PubSubHubbub\Model\ModelAbstract + * @uses \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface * @category Zend * @package Zend_Feed_Pubsubhubbub * @subpackage Entity * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Pubsubhubbub_Model_Subscription - extends Zend_Feed_Pubsubhubbub_Model_ModelAbstract - implements Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface +class Subscription + extends ModelAbstract + implements SubscriptionInterface { /** @@ -45,16 +52,16 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription public function setSubscription(array $data) { if (!isset($data['id'])) { - throw new Zend_Feed_Pubsubhubbub_Exception( + throw new PubSubHubbub\Exception( 'ID must be set before attempting a save' ); } $result = $this->_db->find($data['id']); if ($result) { $data['created_time'] = $result->current()->created_time; - $now = new Zend_Date; + $now = new Date\Date; if ($data['lease_seconds']) { - $data['expiration_time'] = $now->add($data['lease_seconds'], Zend_Date::SECOND) + $data['expiration_time'] = $now->add($data['lease_seconds'], Date\Date::SECOND) ->get('yyyy-MM-dd HH:mm:ss'); } $this->_db->update( @@ -77,7 +84,7 @@ public function setSubscription(array $data) public function getSubscription($key) { if (empty($key) || !is_string($key)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "key"' + throw new PubSubHubbub\Exception('Invalid parameter "key"' .' of "' . $key . '" must be a non-empty string'); } $result = $this->_db->find($key); @@ -96,7 +103,7 @@ public function getSubscription($key) public function hasSubscription($key) { if (empty($key) || !is_string($key)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "key"' + throw new PubSubHubbub\Exception('Invalid parameter "key"' .' of "' . $key . '" must be a non-empty string'); } $result = $this->_db->find($key); diff --git a/src/Pubsubhubbub/Model/SubscriptionInterface.php b/src/Pubsubhubbub/Model/SubscriptionInterface.php index 8933a85b..bf318407 100644 --- a/src/Pubsubhubbub/Model/SubscriptionInterface.php +++ b/src/Pubsubhubbub/Model/SubscriptionInterface.php @@ -20,6 +20,11 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\PubSubHubbub\Model; + /** * @category Zend * @package Zend_Feed_Pubsubhubbub @@ -27,7 +32,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface +interface SubscriptionInterface { /** diff --git a/src/Pubsubhubbub/Publisher.php b/src/Pubsubhubbub/Publisher.php index 63bb1870..f482a679 100644 --- a/src/Pubsubhubbub/Publisher.php +++ b/src/Pubsubhubbub/Publisher.php @@ -20,17 +20,23 @@ */ /** - * @uses Zend_Feed_Pubsubhubbub - * @uses Zend_Feed_Pubsubhubbub_Exception - * @uses Zend_Http_Client - * @uses Zend_Uri - * @uses Zend_Version + * @namespace + */ +namespace Zend\Feed\PubSubHubbub; +use Zend\URI; + +/** + * @uses \Zend\Feed\PubSubHubbub\PubSubHubbub + * @uses \Zend\Feed\PubSubHubbub\Exception + * @uses \Zend\HTTP\Client + * @uses \Zend\Uri\Uri + * @uses \Zend\Version * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Pubsubhubbub_Publisher +class Publisher { /** * An array of URLs for all Hub Servers used by the Publisher, and to @@ -69,7 +75,7 @@ class Zend_Feed_Pubsubhubbub_Publisher * options for the Publisher without calling all supported setter * methods in turn. * - * @param array|Zend_Config $options Options array or Zend_Config instance + * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance * @return void */ public function __construct($config = null) @@ -82,15 +88,15 @@ public function __construct($config = null) /** * Process any injected configuration options * - * @param array|Zend_Config $options Options array or Zend_Config instance - * @return Zend_Feed_Pubsubhubbub_Publisher + * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance + * @return \Zend\Feed\PubSubHubbub\Publisher */ public function setConfig($config) { - if ($config instanceof Zend_Config) { + if ($config instanceof \Zend\Config\Config) { $config = $config->toArray(); } elseif (!is_array($config)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' + throw new Exception('Array or Zend_Config object' . 'expected, got ' . gettype($config)); } if (array_key_exists('hubUrls', $config)) { @@ -109,12 +115,12 @@ public function setConfig($config) * Add a Hub Server URL supported by Publisher * * @param string $url - * @return Zend_Feed_Pubsubhubbub_Publisher + * @return \Zend\Feed\PubSubHubbub\Publisher */ public function addHubUrl($url) { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' + if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { + throw new Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .'URL'); } @@ -126,7 +132,7 @@ public function addHubUrl($url) * Add an array of Hub Server URLs supported by Publisher * * @param array $urls - * @return Zend_Feed_Pubsubhubbub_Publisher + * @return \Zend\Feed\PubSubHubbub\Publisher */ public function addHubUrls(array $urls) { @@ -140,7 +146,7 @@ public function addHubUrls(array $urls) * Remove a Hub Server URL * * @param string $url - * @return Zend_Feed_Pubsubhubbub_Publisher + * @return \Zend\Feed\PubSubHubbub\Publisher */ public function removeHubUrl($url) { @@ -167,12 +173,12 @@ public function getHubUrls() * Add a URL to a topic (Atom or RSS feed) which has been updated * * @param string $url - * @return Zend_Feed_Pubsubhubbub_Publisher + * @return \Zend\Feed\PubSubHubbub\Publisher */ public function addUpdatedTopicUrl($url) { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' + if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { + throw new Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .'URL'); } @@ -184,7 +190,7 @@ public function addUpdatedTopicUrl($url) * Add an array of Topic URLs which have been updated * * @param array $urls - * @return Zend_Feed_Pubsubhubbub_Publisher + * @return \Zend\Feed\PubSubHubbub\Publisher */ public function addUpdatedTopicUrls(array $urls) { @@ -198,7 +204,7 @@ public function addUpdatedTopicUrls(array $urls) * Remove an updated topic URL * * @param string $url - * @return Zend_Feed_Pubsubhubbub_Publisher + * @return \Zend\Feed\PubSubHubbub\Publisher */ public function removeUpdatedTopicUrl($url) { @@ -226,12 +232,12 @@ public function getUpdatedTopicUrls() * * @param string $url The Hub Server's URL * @return void - * @throws Zend_Feed_Pubsubhubbub_Exception Thrown on failure + * @throws \Zend\Feed\PubSubHubbub\Exception Thrown on failure */ public function notifyHub($url) { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' + if (empty($url) || !is_string($url) || !URI\Zend\Uri\Uri::check($url)) { + throw new Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .'URL'); } @@ -239,7 +245,7 @@ public function notifyHub($url) $client->setUri($url); $response = $client->request(); if ($response->getStatus() !== 204) { - throw new Zend_Feed_Pubsubhubbub_Exception('Notification to Hub Server ' + throw new Exception('Notification to Hub Server ' . 'at "' . $url . '" appears to have failed with a status code of "' . $response->getStatus() . '" and message "' . $response->getMessage() . '"'); @@ -255,14 +261,14 @@ public function notifyHub($url) * to needlessly fail with an Exception/Error unless from Zend_Http_Client. * * @return void - * @throws Zend_Feed_Pubsubhubbub_Exception Thrown if no hubs attached + * @throws \Zend\Feed\PubSubHubbub\Exception Thrown if no hubs attached */ public function notifyAll() { $client = $this->_getHttpClient(); $hubs = $this->getHubUrls(); if (empty($hubs)) { - throw new Zend_Feed_Pubsubhubbub_Exception('No Hub Server URLs' + throw new Exception('No Hub Server URLs' . ' have been set so no notifcations can be sent'); } $this->_errors = array(); @@ -283,7 +289,7 @@ public function notifyAll() * * @param string $name * @param string|null $value - * @return Zend_Feed_Pubsubhubbub_Publisher + * @return \Zend\Feed\PubSubHubbub\Publisher */ public function setParameter($name, $value = null) { @@ -292,7 +298,7 @@ public function setParameter($name, $value = null) return $this; } if (empty($name) || !is_string($name)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' + throw new Exception('Invalid parameter "name"' .' of "' . $name . '" must be a non-empty string'); } if ($value === null) { @@ -300,7 +306,7 @@ public function setParameter($name, $value = null) return $this; } if (empty($value) || (!is_string($value) && !is_null($value))) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "value"' + throw new Exception('Invalid parameter "value"' .' of "' . $value . '" must be a non-empty string'); } $this->_parameters[$name] = $value; @@ -311,7 +317,7 @@ public function setParameter($name, $value = null) * Add an optional parameter to the update notification requests * * @param array $parameters - * @return Zend_Feed_Pubsubhubbub_Publisher + * @return \Zend\Feed\PubSubHubbub\Publisher */ public function setParameters(array $parameters) { @@ -325,12 +331,12 @@ public function setParameters(array $parameters) * Remove an optional parameter for the notification requests * * @param string $name - * @return Zend_Feed_Pubsubhubbub_Publisher + * @return \Zend\Feed\PubSubHubbub\Publisher */ public function removeParameter($name) { if (empty($name) || !is_string($name)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' + throw new Exception('Invalid parameter "name"' .' of "' . $name . '" must be a non-empty string'); } if (array_key_exists($name, $this->_parameters)) { @@ -378,20 +384,20 @@ public function getErrors() /** * Get a basic prepared HTTP client for use * - * @return Zend_Http_Client + * @return \Zend\HTTP\Client */ protected function _getHttpClient() { - $client = Zend_Feed_Pubsubhubbub::getHttpClient(); - $client->setMethod(Zend_Http_Client::POST); + $client = PubSubHubbub::getHttpClient(); + $client->setMethod(\Zend\HTTP\Client::POST); $client->setConfig(array( - 'useragent' => 'Zend_Feed_Pubsubhubbub_Publisher/' . Zend_Version::VERSION, + 'useragent' => 'Zend_Feed_Pubsubhubbub_Publisher/' . \Zend\Version::VERSION, )); $params = array(); $params[] = 'hub.mode=publish'; $topics = $this->getUpdatedTopicUrls(); if (empty($topics)) { - throw new Zend_Feed_Pubsubhubbub_Exception('No updated topic URLs' + throw new Exception('No updated topic URLs' . ' have been set'); } foreach ($topics as $topicUrl) { diff --git a/src/Pubsubhubbub/Subscriber/Callback.php b/src/Pubsubhubbub/Subscriber/Callback.php index 860630ef..a29850cd 100644 --- a/src/Pubsubhubbub/Subscriber/Callback.php +++ b/src/Pubsubhubbub/Subscriber/Callback.php @@ -20,17 +20,22 @@ */ /** - * @uses Zend_Feed_Pubsubhubbub - * @uses Zend_Feed_Pubsubhubbub_CallbackAbstract - * @uses Zend_Feed_Reader - * @uses Zend_Uri + * @namespace + */ +namespace Zend\Feed\PubSubHubbub\Subscriber; + +/** + * @uses \Zend\Feed\PubSubHubbub\PubSubHubbub + * @uses \Zend\Feed\PubSubHubbub\CallbackAbstract + * @uses \Zend\Feed\Reader\Reader + * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Pubsubhubbub_Subscriber_Callback - extends Zend_Feed_Pubsubhubbub_CallbackAbstract +class Callback + extends \Zend\Feed\PubSubHubbub\CallbackAbstract { /** * Contains the content of any feeds sent as updates to the Callback URL @@ -61,7 +66,7 @@ class Zend_Feed_Pubsubhubbub_Subscriber_Callback * Required if usePathParameter is enabled for the Subscriber. * * @param string $key - * @return Zend_Feed_Pubsubhubbub_Subscriber_Callback + * @return \Zend\Feed\PubSubHubbub\Subscriber\Callback */ public function setSubscriptionKey($key) { @@ -108,7 +113,7 @@ public function handle(array $httpGetData = null, $sendResponseNow = false) } elseif ($this->isValidHubVerification($httpGetData)) { $data = $this->_currentSubscriptionData; $this->getHttpResponse()->setBody($httpGetData['hub_challenge']); - $data['subscription_state'] = Zend_Feed_Pubsubhubbub::SUBSCRIPTION_VERIFIED; + $data['subscription_state'] = \Zend\Feed\PubSubHubbub\PubSubHubbub::SUBSCRIPTION_VERIFIED; if (isset($httpGetData['hub_lease_seconds'])) { $data['lease_seconds'] = $httpGetData['hub_lease_seconds']; } @@ -163,7 +168,7 @@ public function isValidHubVerification(array $httpGetData) ) { return false; } - if (!Zend_Uri::check($httpGetData['hub_topic'])) { + if (!\Zend\URI\URL::validate($httpGetData['hub_topic'])) { return false; } @@ -182,7 +187,7 @@ public function isValidHubVerification(array $httpGetData) * Topic we've subscribed to. * * @param string $feed - * @return Zend_Feed_Pubsubhubbub_Subscriber_Callback + * @return \Zend\Feed\PubSubHubbub\Subscriber\Callback */ public function setFeedUpdate($feed) { diff --git a/src/RSS.php b/src/RSS.php new file mode 100644 index 00000000..deb809e1 --- /dev/null +++ b/src/RSS.php @@ -0,0 +1,517 @@ +s). + * + * @var string + */ + protected $_entryElementName = 'item'; + + /** + * The default namespace for RSS channels. + * + * @var string + */ + protected $_defaultNamespace = 'rss'; + + /** + * Override Zend_Feed_Abstract to set up the $_element and $_entries aliases. + * + * @return void + * @throws \Zend\Feed\Exception + */ + public function __wakeup() + { + parent::__wakeup(); + + // 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); + } else { + $this->_element = $this->_element->getElementsByTagName('channel')->item(0); + } + if (!$this->_element) { + throw new Exception('No root element found, cannot parse channel.'); + } + + // Find the entries and save a pointer to them for speed and + // simplicity. + $this->_buildEntryCache(); + } + + + /** + * Make accessing some individual elements of the channel easier. + * + * Special accessors 'item' and 'items' are provided so that if + * you wish to iterate over an RSS channel's items, you can do so + * using foreach ($channel->items as $item) or foreach + * ($channel->item as $item). + * + * @param string $var The property to access. + * @return mixed + */ + public function __get($var) + { + switch ($var) { + case 'item': + // fall through to the next case + case 'items': + return $this; + + default: + return parent::__get($var); + } + } + + /** + * Generate the header of the feed when working in write mode + * + * @param array $array the data to use + * @return DOMElement root node + */ + protected function _mapFeedHeaders($array) + { + $channel = $this->_element->createElement('channel'); + + $title = $this->_element->createElement('title'); + $title->appendChild($this->_element->createCDATASection($array->title)); + $channel->appendChild($title); + + $link = $this->_element->createElement('link', $array->link); + $channel->appendChild($link); + + $desc = isset($array->description) ? $array->description : ''; + $description = $this->_element->createElement('description'); + $description->appendChild($this->_element->createCDATASection($desc)); + $channel->appendChild($description); + + $pubdate = isset($array->lastUpdate) ? $array->lastUpdate : time(); + $pubdate = $this->_element->createElement('pubDate', date(DATE_RSS, $pubdate)); + $channel->appendChild($pubdate); + + if (isset($array->published)) { + $lastBuildDate = $this->_element->createElement('lastBuildDate', date(DATE_RSS, $array->published)); + $channel->appendChild($lastBuildDate); + } + + $editor = ''; + if (!empty($array->email)) { + $editor .= $array->email; + } + if (!empty($array->author)) { + $editor .= ' (' . $array->author . ')'; + } + if (!empty($editor)) { + $author = $this->_element->createElement('managingEditor', ltrim($editor)); + $channel->appendChild($author); + } + if (isset($array->webmaster)) { + $channel->appendChild($this->_element->createElement('webMaster', $array->webmaster)); + } + + if (!empty($array->copyright)) { + $copyright = $this->_element->createElement('copyright', $array->copyright); + $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'); + $imagetitle->appendChild($this->_element->createCDATASection($array->title)); + $image->appendChild($imagetitle); + $imagelink = $this->_element->createElement('link', $array->link); + $image->appendChild($imagelink); + + $channel->appendChild($image); + } + + $generator = !empty($array->generator) ? $array->generator : 'Zend_Feed'; + $generator = $this->_element->createElement('generator', $generator); + $channel->appendChild($generator); + + if (!empty($array->language)) { + $language = $this->_element->createElement('language', $array->language); + $channel->appendChild($language); + } + + $doc = $this->_element->createElement('docs', 'http://blogs.law.harvard.edu/tech/rss'); + $channel->appendChild($doc); + + if (isset($array->cloud)) { + $cloud = $this->_element->createElement('cloud'); + $cloud->setAttribute('domain', $array->cloud['uri']->getHost()); + $cloud->setAttribute('port', $array->cloud['uri']->getPort()); + $cloud->setAttribute('path', $array->cloud['uri']->getPath()); + $cloud->setAttribute('registerProcedure', $array->cloud['procedure']); + $cloud->setAttribute('protocol', $array->cloud['protocol']); + $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); + } + + if (isset($array->textInput)) { + $textinput = $this->_element->createElement('textInput'); + $textinput->appendChild($this->_element->createElement('title', $array->textInput['title'])); + $textinput->appendChild($this->_element->createElement('description', $array->textInput['description'])); + $textinput->appendChild($this->_element->createElement('name', $array->textInput['name'])); + $textinput->appendChild($this->_element->createElement('link', $array->textInput['link'])); + $channel->appendChild($textinput); + } + + if (isset($array->skipHours)) { + $skipHours = $this->_element->createElement('skipHours'); + foreach ($array->skipHours as $hour) { + $skipHours->appendChild($this->_element->createElement('hour', $hour)); + } + $channel->appendChild($skipHours); + } + + if (isset($array->skipDays)) { + $skipDays = $this->_element->createElement('skipDays'); + foreach ($array->skipDays as $day) { + $skipDays->appendChild($this->_element->createElement('day', $day)); + } + $channel->appendChild($skipDays); + } + + if (isset($array->itunes)) { + $this->_buildiTunes($channel, $array); + } + + return $channel; + } + + /** + * Adds the iTunes extensions to a root node + * + * @param DOMElement $root + * @param array $array + * @return void + */ + private function _buildiTunes(\DOMElement $root, $array) + { + /* author node */ + $author = ''; + if (isset($array->itunes->author)) { + $author = $array->itunes->author; + } elseif (isset($array->author)) { + $author = $array->author; + } + if (!empty($author)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:author', $author); + $root->appendChild($node); + } + + /* owner node */ + $author = ''; + $email = ''; + if (isset($array->itunes->owner)) { + if (isset($array->itunes->owner['name'])) { + $author = $array->itunes->owner['name']; + } + if (isset($array->itunes->owner['email'])) { + $email = $array->itunes->owner['email']; + } + } + if (empty($author) && isset($array->author)) { + $author = $array->author; + } + if (empty($email) && isset($array->email)) { + $email = $array->email; + } + if (!empty($author) || !empty($email)) { + $owner = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:owner'); + if (!empty($author)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:name', $author); + $owner->appendChild($node); + } + if (!empty($email)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:email', $email); + $owner->appendChild($node); + } + $root->appendChild($owner); + } + $image = ''; + if (isset($array->itunes->image)) { + $image = $array->itunes->image; + } elseif (isset($array->image)) { + $image = $array->image; + } + if (!empty($image)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:image'); + $node->setAttribute('href', $image); + $root->appendChild($node); + } + $subtitle = ''; + if (isset($array->itunes->subtitle)) { + $subtitle = $array->itunes->subtitle; + } elseif (isset($array->description)) { + $subtitle = $array->description; + } + if (!empty($subtitle)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:subtitle', $subtitle); + $root->appendChild($node); + } + $summary = ''; + if (isset($array->itunes->summary)) { + $summary = $array->itunes->summary; + } elseif (isset($array->description)) { + $summary = $array->description; + } + if (!empty($summary)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:summary', $summary); + $root->appendChild($node); + } + if (isset($array->itunes->block)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:block', $array->itunes->block); + $root->appendChild($node); + } + if (isset($array->itunes->explicit)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:explicit', $array->itunes->explicit); + $root->appendChild($node); + } + if (isset($array->itunes->keywords)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:keywords', $array->itunes->keywords); + $root->appendChild($node); + } + if (isset($array->itunes->new_feed_url)) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:new-feed-url', $array->itunes->new_feed_url); + $root->appendChild($node); + } + if (isset($array->itunes->category)) { + foreach ($array->itunes->category as $i => $category) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); + $node->setAttribute('text', $category['main']); + $root->appendChild($node); + $add_end_category = false; + if (!empty($category['sub'])) { + $add_end_category = true; + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); + $node->setAttribute('text', $category['sub']); + $root->appendChild($node); + } + if ($i > 0 || $add_end_category) { + $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); + $root->appendChild($node); + } + } + } + } + + /** + * Generate the entries of the feed when working in write mode + * + * The following nodes are constructed for each feed entry + * + * entry title + * url to feed entry + * url to feed entry + * short text + * long version, can contain html + * + * + * @param DOMElement $root the root node to use + * @param array $array the data to use + * @return void + */ + protected function _mapFeedEntries(\DOMElement $root, $array) + { + Feed::registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/'); + + foreach ($array as $dataentry) { + $item = $this->_element->createElement('item'); + + $title = $this->_element->createElement('title'); + $title->appendChild($this->_element->createCDATASection($dataentry->title)); + $item->appendChild($title); + + if (isset($dataentry->author)) { + $author = $this->_element->createElement('author', $dataentry->author); + $item->appendChild($author); + } + + $link = $this->_element->createElement('link', $dataentry->link); + $item->appendChild($link); + + if (isset($dataentry->guid)) { + $guid = $this->_element->createElement('guid', $dataentry->guid); + //if (!\Zend\Uri\Uri::check($dataentry->guid)) { + $guid->setAttribute('isPermaLink', 'false'); + //} + $item->appendChild($guid); + } + + $description = $this->_element->createElement('description'); + $description->appendChild($this->_element->createCDATASection($dataentry->description)); + $item->appendChild($description); + + if (isset($dataentry->content)) { + $content = $this->_element->createElement('content:encoded'); + $content->appendChild($this->_element->createCDATASection($dataentry->content)); + $item->appendChild($content); + } + + $pubdate = isset($dataentry->lastUpdate) ? $dataentry->lastUpdate : time(); + $pubdate = $this->_element->createElement('pubDate', date(DATE_RSS, $pubdate)); + $item->appendChild($pubdate); + + if (isset($dataentry->category)) { + foreach ($dataentry->category as $category) { + $node = $this->_element->createElement('category', $category['term']); + if (isset($category['scheme'])) { + $node->setAttribute('domain', $category['scheme']); + } + $item->appendChild($node); + } + } + + if (isset($dataentry->source)) { + $source = $this->_element->createElement('source', $dataentry->source['title']); + $source->setAttribute('url', $dataentry->source['url']); + $item->appendChild($source); + } + + if (isset($dataentry->comments)) { + $comments = $this->_element->createElement('comments', $dataentry->comments); + $item->appendChild($comments); + } + if (isset($dataentry->commentRss)) { + $comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/', + 'wfw:commentRss', + $dataentry->commentRss); + $item->appendChild($comments); + } + + + if (isset($dataentry->enclosure)) { + foreach ($dataentry->enclosure as $enclosure) { + $node = $this->_element->createElement('enclosure'); + $node->setAttribute('url', $enclosure['url']); + if (isset($enclosure['type'])) { + $node->setAttribute('type', $enclosure['type']); + } + if (isset($enclosure['length'])) { + $node->setAttribute('length', $enclosure['length']); + } + $item->appendChild($node); + } + } + + $root->appendChild($item); + } + } + + /** + * Override Zend_Feed_Element to include root node + * + * @return string + */ + public function saveXml() + { + // Return a complete document including XML prologue. + $doc = new \DOMDocument($this->_element->ownerDocument->version, + $this->_element->ownerDocument->actualEncoding); + $root = $doc->createElement('rss'); + + // Use rss version 2.0 + $root->setAttribute('version', '2.0'); + + // Content namespace + $root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:content', 'http://purl.org/rss/1.0/modules/content/'); + $root->appendChild($doc->importNode($this->_element, true)); + + // Append root node + $doc->appendChild($root); + + // Format output + $doc->formatOutput = true; + + return $doc->saveXML(); + } + + /** + * Send feed to a http client with the correct header + * + * @return void + * @throws \Zend\Feed\Exception if headers have already been sent + */ + public function send() + { + if (headers_sent()) { + throw new Exception('Cannot send RSS because headers have already been sent.'); + } + + header('Content-Type: application/rss+xml; charset=' . $this->_element->ownerDocument->actualEncoding); + + echo $this->saveXml(); + } + +} diff --git a/src/Reader/Collection/Author.php b/src/Reader/Collection/Author.php index bc060f78..38b5d861 100644 --- a/src/Reader/Collection/Author.php +++ b/src/Reader/Collection/Author.php @@ -18,16 +18,21 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ - + +/** + * @namespace + */ +namespace Zend\Feed\Reader\Collection; + /** - * @uses Zend_Feed_Reader_Collection_CollectionAbstract + * @uses \Zend\Feed\Reader\Collection\CollectionAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Reader_Collection_Author - extends Zend_Feed_Reader_Collection_CollectionAbstract +class Author + extends CollectionAbstract { /** diff --git a/src/Reader/Collection/Category.php b/src/Reader/Collection/Category.php index 3d07207e..ebd76ab9 100644 --- a/src/Reader/Collection/Category.php +++ b/src/Reader/Collection/Category.php @@ -18,16 +18,21 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ - + +/** + * @namespace + */ +namespace Zend\Feed\Reader\Collection; + /** - * @uses Zend_Feed_Reader_Collection_CollectionAbstract + * @uses \Zend\Feed\Reader\Collection\CollectionAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Reader_Collection_Category - extends Zend_Feed_Reader_Collection_CollectionAbstract +class Category + extends CollectionAbstract { /** diff --git a/src/Reader/Collection.php b/src/Reader/Collection/Collection.php similarity index 90% rename from src/Reader/Collection.php rename to src/Reader/Collection/Collection.php index e4bfa135..bbc976ed 100644 --- a/src/Reader/Collection.php +++ b/src/Reader/Collection/Collection.php @@ -19,6 +19,11 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Reader\Collection; + /** * @uses ArrayObject * @category Zend @@ -26,7 +31,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Reader_Collection extends ArrayObject +class Collection extends \ArrayObject { diff --git a/src/Reader/Collection/CollectionAbstract.php b/src/Reader/Collection/CollectionAbstract.php index 16f811b0..dcb5bad4 100644 --- a/src/Reader/Collection/CollectionAbstract.php +++ b/src/Reader/Collection/CollectionAbstract.php @@ -19,6 +19,11 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Reader\Collection; + /** * @uses ArrayObject * @category Zend @@ -26,7 +31,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class Zend_Feed_Reader_Collection_CollectionAbstract extends ArrayObject +abstract class CollectionAbstract extends \ArrayObject { /** diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index 5c9548cf..36af8378 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -20,18 +20,23 @@ */ /** - * @uses Zend_Feed_Reader - * @uses Zend_Feed_Reader_EntryAbstract - * @uses Zend_Feed_Reader_EntryInterface - * @uses Zend_Feed_Reader_Extension_Atom_Entry + * @namespace + */ +namespace Zend\Feed\Reader\Entry; +use Zend\Feed\Reader; + +/** + * @uses \Zend\Feed\Reader\Reader + * @uses \Zend\Feed\Reader\EntryAbstract + * @uses \Zend\Feed\Reader\EntryInterface + * @uses \Zend\Feed\Reader\Extension\Atom\Entry * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Reader_Entry_Atom - extends Zend_Feed_Reader_EntryAbstract - implements Zend_Feed_Reader_EntryInterface +class Atom + extends Reader\EntryAbstract { /** * XPath query @@ -48,21 +53,21 @@ class Zend_Feed_Reader_Entry_Atom * @param string $type * @return void */ - public function __construct(DOMElement $entry, $entryKey, $type = null) + public function __construct(\DOMElement $entry, $entryKey, $type = null) { parent::__construct($entry, $entryKey, $type); // Everyone by now should know XPath indices start from 1 not 0 $this->_xpathQuery = '//atom:entry[' . ($this->_entryKey + 1) . ']'; - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Entry'); - $this->_extensions['Atom_Entry'] = new $atomClass($entry, $entryKey, $type); + $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\Entry'); + $this->_extensions['Atom\Entry'] = new $atomClass($entry, $entryKey, $type); - $threadClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Thread_Entry'); - $this->_extensions['Thread_Entry'] = new $threadClass($entry, $entryKey, $type); + $threadClass = Reader\Reader::getPluginLoader()->getClassName('Thread\Entry'); + $this->_extensions['Thread\Entry'] = new $threadClass($entry, $entryKey, $type); - $threadClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Entry'); - $this->_extensions['DublinCore_Entry'] = new $threadClass($entry, $entryKey, $type); + $threadClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\Entry'); + $this->_extensions['DublinCore\Entry'] = new $threadClass($entry, $entryKey, $type); } /** @@ -334,7 +339,7 @@ public function getCommentFeedLink() /** * Get category data as a Zend_Feed_Reader_Collection_Category object * - * @return Zend_Feed_Reader_Collection_Category + * @return \Zend\Feed\Reader\Collection\Category */ public function getCategories() { @@ -356,7 +361,7 @@ public function getCategories() /** * Get source feed metadata from the entry * - * @return Zend_Feed_Reader_Feed_Atom_Source|null + * @return \Zend\Feed\Reader\Feed\Atom\Source|null */ public function getSource() { @@ -376,7 +381,7 @@ public function getSource() * * @param DOMXPath $xpath */ - public function setXpath(DOMXPath $xpath) + public function setXpath(\DOMXPath $xpath) { parent::setXpath($xpath); foreach ($this->_extensions as $extension) { diff --git a/src/Reader/Entry/RSS.php b/src/Reader/Entry/RSS.php new file mode 100644 index 00000000..27e5e190 --- /dev/null +++ b/src/Reader/Entry/RSS.php @@ -0,0 +1,629 @@ +_xpathQueryRss = '//item[' . ($this->_entryKey+1) . ']'; + $this->_xpathQueryRdf = '//rss:item[' . ($this->_entryKey+1) . ']'; + + $pluginLoader = Reader\Reader::getPluginLoader(); + + $dublinCoreClass = $pluginLoader->getClassName('DublinCore\Entry'); + $this->_extensions['DublinCore\Entry'] = new $dublinCoreClass($entry, $entryKey, $type); + + $contentClass = $pluginLoader->getClassName('Content\Entry'); + $this->_extensions['Content\Entry'] = new $contentClass($entry, $entryKey, $type); + + $atomClass = $pluginLoader->getClassName('Atom\Entry'); + $this->_extensions['Atom\Entry'] = new $atomClass($entry, $entryKey, $type); + + $wfwClass = $pluginLoader->getClassName('WellFormedWeb\Entry'); + $this->_extensions['WellFormedWeb\Entry'] = new $wfwClass($entry, $entryKey, $type); + + $slashClass = $pluginLoader->getClassName('Slash\Entry'); + $this->_extensions['Slash\Entry'] = new $slashClass($entry, $entryKey, $type); + + $threadClass = $pluginLoader->getClassName('Thread\Entry'); + $this->_extensions['Thread\Entry'] = new $threadClass($entry, $entryKey, $type); + } + + /** + * Get an author entry + * + * @param DOMElement $element + * @return string + */ + public function getAuthor($index = 0) + { + $authors = $this->getAuthors(); + + if (isset($authors[$index])) { + return $authors[$index]; + } + + return null; + } + + /** + * Get an array with feed authors + * + * @return array + */ + public function getAuthors() + { + if (array_key_exists('authors', $this->_data)) { + return $this->_data['authors']; + } + + $authors = array(); + $authors_dc = $this->getExtension('DublinCore')->getAuthors(); + if (!empty($authors_dc)) { + foreach ($authors_dc as $author) { + $authors[] = array( + 'name' => $author['name'] + ); + } + } + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $list = $this->_xpath->query($this->_xpathQueryRss . '//author'); + } else { + $list = $this->_xpath->query($this->_xpathQueryRdf . '//rss:author'); + } + if ($list->length) { + foreach ($list as $author) { + $string = trim($author->nodeValue); + $email = null; + $name = null; + $data = array(); + // Pretty rough parsing - but it's a catchall + if (preg_match("/^.*@[^ ]*/", $string, $matches)) { + $data['email'] = trim($matches[0]); + if (preg_match("/\((.*)\)$/", $string, $matches)) { + $data['name'] = $matches[1]; + } + $authors[] = $data; + } + } + } + + if (count($authors) == 0) { + $authors = $this->getExtension('Atom')->getAuthors(); + } else { + $authors = new Reader\Collection\Author( + Reader\Reader::arrayUnique($authors) + ); + } + + if (count($authors) == 0) { + $authors = null; + } + + $this->_data['authors'] = $authors; + + return $this->_data['authors']; + } + + /** + * Get the entry content + * + * @return string + */ + public function getContent() + { + if (array_key_exists('content', $this->_data)) { + return $this->_data['content']; + } + + $content = $this->getExtension('Content')->getContent(); + + if (!$content) { + $content = $this->getDescription(); + } + + if (empty($content)) { + $content = $this->getExtension('Atom')->getContent(); + } + + $this->_data['content'] = $content; + + return $this->_data['content']; + } + + /** + * Get the entry's date of creation + * + * @return string + */ + public function getDateCreated() + { + return $this->getDateModified(); + } + + /** + * Get the entry's date of modification + * + * @return string + */ + public function getDateModified() + { + if (array_key_exists('datemodified', $this->_data)) { + return $this->_data['datemodified']; + } + + $dateModified = null; + $date = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 + ) { + $dateModified = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/pubDate)'); + if ($dateModified) { + $dateStandards = array(Date\Date::RSS, Date\Date::RFC_822, + Date\Date::RFC_2822, Date\Date::DATES); + $date = new Date\Date; + foreach ($dateStandards as $standard) { + try { + $date->set($dateModified, $standard); + break; + } catch (Date\Exception $e) { + if ($standard == Date\Date::DATES) { + throw new \Zend\Feed\Exception( + 'Could not load date due to unrecognised' + .' format (should follow RFC 822 or 2822):' + . $e->getMessage(), + 0, $e + ); + } + } + } + } + } + + if (!$date) { + $date = $this->getExtension('DublinCore')->getDate(); + } + + if (!$date) { + $date = $this->getExtension('Atom')->getDateModified(); + } + + if (!$date) { + $date = null; + } + + $this->_data['datemodified'] = $date; + + return $this->_data['datemodified']; + } + + /** + * Get the entry description + * + * @return string + */ + public function getDescription() + { + if (array_key_exists('description', $this->_data)) { + return $this->_data['description']; + } + + $description = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 + ) { + $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/description)'); + } else { + $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRdf.'/rss:description)'); + } + + if (!$description) { + $description = $this->getExtension('DublinCore')->getDescription(); + } + + if (empty($description)) { + $description = $this->getExtension('Atom')->getDescription(); + } + + if (!$description) { + $description = null; + } else { + $description = html_entity_decode($description, ENT_QUOTES, $this->getEncoding()); + } + + $this->_data['description'] = $description; + + return $this->_data['description']; + } + + /** + * Get the entry enclosure + * @return string + */ + public function getEnclosure() + { + if (array_key_exists('enclosure', $this->_data)) { + return $this->_data['enclosure']; + } + + $enclosure = null; + + if ($this->getType() == Reader\Reader::TYPE_RSS_20) { + $nodeList = $this->_xpath->query($this->_xpathQueryRss . '/enclosure'); + + if ($nodeList->length > 0) { + $enclosure = new \stdClass(); + $enclosure->url = $nodeList->item(0)->getAttribute('url'); + $enclosure->length = $nodeList->item(0)->getAttribute('length'); + $enclosure->type = $nodeList->item(0)->getAttribute('type'); + } + } + + if (!$enclosure) { + $enclosure = $this->getExtension('Atom')->getEnclosure(); + } + + $this->_data['enclosure'] = $enclosure; + + return $this->_data['enclosure']; + } + + /** + * Get the entry ID + * + * @return string + */ + public function getId() + { + if (array_key_exists('id', $this->_data)) { + return $this->_data['id']; + } + + $id = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 + ) { + $id = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/guid)'); + } + + if (!$id) { + $id = $this->getExtension('DublinCore')->getId(); + } + + if (empty($id)) { + $id = $this->getExtension('Atom')->getId(); + } + + if (!$id) { + if ($this->getPermalink()) { + $id = $this->getPermalink(); + } elseif ($this->getTitle()) { + $id = $this->getTitle(); + } else { + $id = null; + } + } + + $this->_data['id'] = $id; + + return $this->_data['id']; + } + + /** + * Get a specific link + * + * @param int $index + * @return string + */ + public function getLink($index = 0) + { + if (!array_key_exists('links', $this->_data)) { + $this->getLinks(); + } + + if (isset($this->_data['links'][$index])) { + return $this->_data['links'][$index]; + } + + return null; + } + + /** + * Get all links + * + * @return array + */ + public function getLinks() + { + if (array_key_exists('links', $this->_data)) { + return $this->_data['links']; + } + + $links = array(); + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $list = $this->_xpath->query($this->_xpathQueryRss.'//link'); + } else { + $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:link'); + } + + if (!$list->length) { + $links = $this->getExtension('Atom')->getLinks(); + } else { + foreach ($list as $link) { + $links[] = $link->nodeValue; + } + } + + $this->_data['links'] = $links; + + return $this->_data['links']; + } + + /** + * Get all categories + * + * @return \Zend\Feed\Reader\Collection\Category + */ + public function getCategories() + { + if (array_key_exists('categories', $this->_data)) { + return $this->_data['categories']; + } + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $list = $this->_xpath->query($this->_xpathQueryRss.'//category'); + } else { + $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:category'); + } + + if ($list->length) { + $categoryCollection = new Reader\Collection\Category; + foreach ($list as $category) { + $categoryCollection[] = array( + 'term' => $category->nodeValue, + 'scheme' => $category->getAttribute('domain'), + 'label' => $category->nodeValue, + ); + } + } else { + $categoryCollection = $this->getExtension('DublinCore')->getCategories(); + } + + if (count($categoryCollection) == 0) { + $categoryCollection = $this->getExtension('Atom')->getCategories(); + } + + $this->_data['categories'] = $categoryCollection; + + return $this->_data['categories']; + } + + /** + * Get a permalink to the entry + * + * @return string + */ + public function getPermalink() + { + return $this->getLink(0); + } + + /** + * Get the entry title + * + * @return string + */ + public function getTitle() + { + if (array_key_exists('title', $this->_data)) { + return $this->_data['title']; + } + + $title = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 + ) { + $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/title)'); + } else { + $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRdf.'/rss:title)'); + } + + if (!$title) { + $title = $this->getExtension('DublinCore')->getTitle(); + } + + if (!$title) { + $title = $this->getExtension('Atom')->getTitle(); + } + + if (!$title) { + $title = null; + } + + $this->_data['title'] = $title; + + return $this->_data['title']; + } + + /** + * Get the number of comments/replies for current entry + * + * @return string|null + */ + public function getCommentCount() + { + if (array_key_exists('commentcount', $this->_data)) { + return $this->_data['commentcount']; + } + + $commentcount = $this->getExtension('Slash')->getCommentCount(); + + if (!$commentcount) { + $commentcount = $this->getExtension('Thread')->getCommentCount(); + } + + if (!$commentcount) { + $commentcount = $this->getExtension('Atom')->getCommentCount(); + } + + if (!$commentcount) { + $commentcount = null; + } + + $this->_data['commentcount'] = $commentcount; + + return $this->_data['commentcount']; + } + + /** + * Returns a URI pointing to the HTML page where comments can be made on this entry + * + * @return string + */ + public function getCommentLink() + { + if (array_key_exists('commentlink', $this->_data)) { + return $this->_data['commentlink']; + } + + $commentlink = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 + ) { + $commentlink = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/comments)'); + } + + if (!$commentlink) { + $commentlink = $this->getExtension('Atom')->getCommentLink(); + } + + if (!$commentlink) { + $commentlink = null; + } + + $this->_data['commentlink'] = $commentlink; + + return $this->_data['commentlink']; + } + + /** + * Returns a URI pointing to a feed of all comments for this entry + * + * @return string + */ + public function getCommentFeedLink() + { + if (array_key_exists('commentfeedlink', $this->_data)) { + return $this->_data['commentfeedlink']; + } + + $commentfeedlink = $this->getExtension('WellFormedWeb')->getCommentFeedLink(); + + if (!$commentfeedlink) { + $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink('rss'); + } + + if (!$commentfeedlink) { + $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink('rdf'); + } + + if (!$commentfeedlink) { + $commentfeedlink = null; + } + + $this->_data['commentfeedlink'] = $commentfeedlink; + + return $this->_data['commentfeedlink']; + } + + /** + * Set the XPath query (incl. on all Extensions) + * + * @param DOMXPath $xpath + */ + public function setXpath(\DOMXPath $xpath) + { + parent::setXpath($xpath); + foreach ($this->_extensions as $extension) { + $extension->setXpath($this->_xpath); + } + } +} diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index 6b67dbf4..27e5e190 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -20,26 +20,33 @@ */ /** - * @uses Zend_Date - * @uses Zend_Feed_Exception - * @uses Zend_Feed_Reader - * @uses Zend_Feed_Reader_Collection_Category - * @uses Zend_Feed_Reader_EntryAbstract - * @uses Zend_Feed_Reader_EntryInterface - * @uses Zend_Feed_Reader_Extension_Atom_Entry - * @uses Zend_Feed_Reader_Extension_Content_Entry - * @uses Zend_Feed_Reader_Extension_DublinCore_Entry - * @uses Zend_Feed_Reader_Extension_Slash_Entry - * @uses Zend_Feed_Reader_Extension_Thread_Entry + * @namespace + */ +namespace Zend\Feed\Reader\Entry; +use Zend\Feed\Reader; +use Zend\Date; + +/** + * @uses \Zend\Date\Date + * @uses \Zend\Feed\Exception + * @uses \Zend\Feed\Reader\Reader + * @uses \Zend\Feed\Reader\Collection\Category + * @uses \Zend\Feed\Reader\EntryAbstract + * @uses \Zend\Feed\Reader\EntryInterface + * @uses \Zend\Feed\Reader\Extension\Atom\Entry + * @uses \Zend\Feed\Reader\Extension\Content\Entry + * @uses \Zend\Feed\Reader\Extension\DublinCore\Entry + * @uses \Zend\Feed\Reader\Extension\Slash\Entry + * @uses \Zend\Feed\Reader\Extension\Thread\Entry * @uses Zend_Feed_Reader_Extension_WellformedWeb_Entry * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Reader_Entry_Rss - extends Zend_Feed_Reader_EntryAbstract - implements Zend_Feed_Reader_EntryInterface +class RSS + extends Reader\EntryAbstract + implements Reader\EntryInterface { /** * XPath query for RDF @@ -58,36 +65,36 @@ class Zend_Feed_Reader_Entry_Rss /** * Constructor * - * @param Zend_Feed_Entry_Abstract $entry + * @param \Zend\Feed\Entry\AbstractEntry $entry * @param string $entryKey * @param string $type * @return void */ - public function __construct(DOMElement $entry, $entryKey, $type = null) + public function __construct(\DOMElement $entry, $entryKey, $type = null) { parent::__construct($entry, $entryKey, $type); $this->_xpathQueryRss = '//item[' . ($this->_entryKey+1) . ']'; $this->_xpathQueryRdf = '//rss:item[' . ($this->_entryKey+1) . ']'; - $pluginLoader = Zend_Feed_Reader::getPluginLoader(); + $pluginLoader = Reader\Reader::getPluginLoader(); - $dublinCoreClass = $pluginLoader->getClassName('DublinCore_Entry'); - $this->_extensions['DublinCore_Entry'] = new $dublinCoreClass($entry, $entryKey, $type); + $dublinCoreClass = $pluginLoader->getClassName('DublinCore\Entry'); + $this->_extensions['DublinCore\Entry'] = new $dublinCoreClass($entry, $entryKey, $type); - $contentClass = $pluginLoader->getClassName('Content_Entry'); - $this->_extensions['Content_Entry'] = new $contentClass($entry, $entryKey, $type); + $contentClass = $pluginLoader->getClassName('Content\Entry'); + $this->_extensions['Content\Entry'] = new $contentClass($entry, $entryKey, $type); - $atomClass = $pluginLoader->getClassName('Atom_Entry'); - $this->_extensions['Atom_Entry'] = new $atomClass($entry, $entryKey, $type); + $atomClass = $pluginLoader->getClassName('Atom\Entry'); + $this->_extensions['Atom\Entry'] = new $atomClass($entry, $entryKey, $type); - $wfwClass = $pluginLoader->getClassName('WellFormedWeb_Entry'); - $this->_extensions['WellFormedWeb_Entry'] = new $wfwClass($entry, $entryKey, $type); + $wfwClass = $pluginLoader->getClassName('WellFormedWeb\Entry'); + $this->_extensions['WellFormedWeb\Entry'] = new $wfwClass($entry, $entryKey, $type); - $slashClass = $pluginLoader->getClassName('Slash_Entry'); - $this->_extensions['Slash_Entry'] = new $slashClass($entry, $entryKey, $type); + $slashClass = $pluginLoader->getClassName('Slash\Entry'); + $this->_extensions['Slash\Entry'] = new $slashClass($entry, $entryKey, $type); - $threadClass = $pluginLoader->getClassName('Thread_Entry'); - $this->_extensions['Thread_Entry'] = new $threadClass($entry, $entryKey, $type); + $threadClass = $pluginLoader->getClassName('Thread\Entry'); + $this->_extensions['Thread\Entry'] = new $threadClass($entry, $entryKey, $type); } /** @@ -128,8 +135,8 @@ public function getAuthors() } } - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090) { $list = $this->_xpath->query($this->_xpathQueryRss . '//author'); } else { $list = $this->_xpath->query($this->_xpathQueryRdf . '//rss:author'); @@ -154,8 +161,8 @@ public function getAuthors() if (count($authors) == 0) { $authors = $this->getExtension('Atom')->getAuthors(); } else { - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) + $authors = new Reader\Collection\Author( + Reader\Reader::arrayUnique($authors) ); } @@ -218,21 +225,21 @@ public function getDateModified() $dateModified = null; $date = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { $dateModified = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/pubDate)'); if ($dateModified) { - $dateStandards = array(Zend_Date::RSS, Zend_Date::RFC_822, - Zend_Date::RFC_2822, Zend_Date::DATES); - $date = new Zend_Date; + $dateStandards = array(Date\Date::RSS, Date\Date::RFC_822, + Date\Date::RFC_2822, Date\Date::DATES); + $date = new Date\Date; foreach ($dateStandards as $standard) { try { $date->set($dateModified, $standard); break; - } catch (Zend_Date_Exception $e) { - if ($standard == Zend_Date::DATES) { - throw new Zend_Feed_Exception( + } catch (Date\Exception $e) { + if ($standard == Date\Date::DATES) { + throw new \Zend\Feed\Exception( 'Could not load date due to unrecognised' .' format (should follow RFC 822 or 2822):' . $e->getMessage(), @@ -274,8 +281,8 @@ public function getDescription() $description = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/description)'); } else { @@ -313,11 +320,11 @@ public function getEnclosure() $enclosure = null; - if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_20) { + if ($this->getType() == Reader\Reader::TYPE_RSS_20) { $nodeList = $this->_xpath->query($this->_xpathQueryRss . '/enclosure'); if ($nodeList->length > 0) { - $enclosure = new stdClass(); + $enclosure = new \stdClass(); $enclosure->url = $nodeList->item(0)->getAttribute('url'); $enclosure->length = $nodeList->item(0)->getAttribute('length'); $enclosure->type = $nodeList->item(0)->getAttribute('type'); @@ -346,8 +353,8 @@ public function getId() $id = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { $id = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/guid)'); } @@ -407,8 +414,8 @@ public function getLinks() $links = array(); - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $list = $this->_xpath->query($this->_xpathQueryRss.'//link'); } else { $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:link'); @@ -430,7 +437,7 @@ public function getLinks() /** * Get all categories * - * @return Zend_Feed_Reader_Collection_Category + * @return \Zend\Feed\Reader\Collection\Category */ public function getCategories() { @@ -438,15 +445,15 @@ public function getCategories() return $this->_data['categories']; } - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $list = $this->_xpath->query($this->_xpathQueryRss.'//category'); } else { $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:category'); } if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; + $categoryCollection = new Reader\Collection\Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->nodeValue, @@ -490,8 +497,8 @@ public function getTitle() $title = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/title)'); } else { @@ -558,8 +565,8 @@ public function getCommentLink() $commentlink = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { $commentlink = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/comments)'); } @@ -612,7 +619,7 @@ public function getCommentFeedLink() * * @param DOMXPath $xpath */ - public function setXpath(DOMXPath $xpath) + public function setXpath(\DOMXPath $xpath) { parent::setXpath($xpath); foreach ($this->_extensions as $extension) { diff --git a/src/Reader/EntryAbstract.php b/src/Reader/EntryAbstract.php index aaed6713..a6f66c13 100644 --- a/src/Reader/EntryAbstract.php +++ b/src/Reader/EntryAbstract.php @@ -20,14 +20,19 @@ */ /** - * @uses Zend_Feed_Exception - * @uses Zend_Feed_Reader + * @namespace + */ +namespace Zend\Feed\Reader; + +/** + * @uses \Zend\Feed\Exception + * @uses \Zend\Feed\Reader\Reader * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class Zend_Feed_Reader_EntryAbstract +abstract class EntryAbstract { /** * Feed entry data @@ -79,7 +84,7 @@ abstract class Zend_Feed_Reader_EntryAbstract * @param string $type * @return void */ - public function __construct(DOMElement $entry, $entryKey, $type = null) + public function __construct(\DOMElement $entry, $entryKey, $type = null) { $this->_entry = $entry; $this->_entryKey = $entryKey; @@ -87,7 +92,7 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) if ($type !== null) { $this->_data['type'] = $type; } else { - $this->_data['type'] = Zend_Feed_Reader::detectType($feed); + $this->_data['type'] = Reader::detectType($feed); } $this->_loadExtensions(); } @@ -133,7 +138,7 @@ public function getEncoding() */ public function saveXml() { - $dom = new DOMDocument('1.0', $this->getEncoding()); + $dom = new \DOMDocument('1.0', $this->getEncoding()); $entry = $dom->importNode($this->getElement(), true); $dom->appendChild($entry); return $dom->saveXml(); @@ -157,7 +162,7 @@ public function getType() public function getXpath() { if (!$this->_xpath) { - $this->setXpath(new DOMXPath($this->getDomDocument())); + $this->setXpath(new \DOMXPath($this->getDomDocument())); } return $this->_xpath; } @@ -168,7 +173,7 @@ public function getXpath() * @param DOMXPath $xpath * @return Zend_Feed_Reader_Entry_EntryAbstract */ - public function setXpath(DOMXPath $xpath) + public function setXpath(\DOMXPath $xpath) { $this->_xpath = $xpath; return $this; @@ -188,12 +193,12 @@ public function getExtensions() * Return an Extension object with the matching name (postfixed with _Entry) * * @param string $name - * @return Zend_Feed_Reader_Extension_EntryAbstract + * @return \Zend\Feed\Reader\Extension\EntryAbstract */ public function getExtension($name) { - if (array_key_exists($name . '_Entry', $this->_extensions)) { - return $this->_extensions[$name . '_Entry']; + if (array_key_exists($name . '\Entry', $this->_extensions)) { + return $this->_extensions[$name . '\Entry']; } return null; } @@ -204,7 +209,7 @@ public function getExtension($name) * @param string $method * @param array $args * @return mixed - * @throws Zend_Feed_Exception if no extensions implements the method + * @throws \Zend\Feed\Exception if no extensions implements the method */ public function __call($method, $args) { @@ -213,7 +218,7 @@ public function __call($method, $args) return call_user_func_array(array($extension, $method), $args); } } - throw new Zend_Feed_Exception('Method: ' . $method + throw new \Zend\Feed\Exception('Method: ' . $method . 'does not exist and could not be located on a registered Extension'); } @@ -224,13 +229,13 @@ public function __call($method, $args) */ protected function _loadExtensions() { - $all = Zend_Feed_Reader::getExtensions(); + $all = Reader::getExtensions(); $feed = $all['entry']; foreach ($feed as $extension) { if (in_array($extension, $all['core'])) { continue; } - $className = Zend_Feed_Reader::getPluginLoader()->getClassName($extension); + $className = Reader::getPluginLoader()->getClassName($extension); $this->_extensions[$extension] = new $className( $this->getElement(), $this->_entryKey, $this->_data['type'] ); diff --git a/src/Reader/EntryInterface.php b/src/Reader/EntryInterface.php index 1120a9f6..5d72bcdd 100644 --- a/src/Reader/EntryInterface.php +++ b/src/Reader/EntryInterface.php @@ -19,13 +19,18 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Reader; + /** * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface Zend_Feed_Reader_EntryInterface +interface EntryInterface { /** * Get the specified author @@ -137,7 +142,7 @@ public function getCommentFeedLink(); /** * Get all categories * - * @return Zend_Feed_Reader_Collection_Category + * @return \Zend\Feed\Reader\Collection\Category */ public function getCategories(); } diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 64098a96..4a9a11b0 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -19,23 +19,32 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Reader\Extension\Atom; +use Zend\Feed\Reader; +use Zend\Date; +use Zend\Feed\Reader\Collection; +use Zend\URI; + /** * @uses DOMDocument * @uses stdClass - * @uses Zend_Date - * @uses Zend_Feed_Reader - * @uses Zend_Feed_Reader_Feed_Atom_Source - * @uses Zend_Feed_Reader_Collection_Author - * @uses Zend_Feed_Reader_Collection_Category - * @uses Zend_Feed_Reader_Extension_EntryAbstract - * @uses Zend_Uri + * @uses \Zend\Date\Date + * @uses \Zend\Feed\Reader\Reader + * @uses \Zend\Feed\Reader\Feed\Atom\Source + * @uses \Zend\Feed\Reader\Collection\Author + * @uses \Zend\Feed\Reader\Collection\Category + * @uses \Zend\Feed\Reader\Extension\EntryAbstract + * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 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_Entry - extends Zend_Feed_Reader_Extension_EntryAbstract +class Entry + extends Reader\Extension\EntryAbstract { /** * Get the specified author @@ -87,8 +96,8 @@ public function getAuthors() if (count($authors) == 0) { $authors = null; } else { - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) + $authors = new Collection\Author( + Reader\Reader::arrayUnique($authors) ); } @@ -127,7 +136,7 @@ public function getContent() $this->getXpathPrefix() . '/atom:content/xhtml:div' )->item(0); //$xhtml->setAttribute('xmlns', 'http://www.w3.org/1999/xhtml'); - $d = new DOMDocument('1.0', $this->getEncoding()); + $d = new \DOMDocument('1.0', $this->getEncoding()); $xhtmls = $d->importNode($xhtml, true); $d->appendChild($xhtmls); $content = $this->_collectXhtml( @@ -179,15 +188,15 @@ public function getDateCreated() $date = null; - if ($this->_getAtomType() === Zend_Feed_Reader::TYPE_ATOM_03) { + if ($this->_getAtomType() === Reader\Reader::TYPE_ATOM_03) { $dateCreated = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:created)'); } else { $dateCreated = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:published)'); } if ($dateCreated) { - $date = new Zend_Date; - $date->set($dateCreated, Zend_Date::ISO_8601); + $date = new Date\Date; + $date->set($dateCreated, Date\Date::ISO_8601); } $this->_data['datecreated'] = $date; @@ -208,15 +217,15 @@ public function getDateModified() $date = null; - if ($this->_getAtomType() === Zend_Feed_Reader::TYPE_ATOM_03) { + if ($this->_getAtomType() === Reader\Reader::TYPE_ATOM_03) { $dateModified = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)'); } else { $dateModified = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)'); } if ($dateModified) { - $date = new Zend_Date; - $date->set($dateModified, Zend_Date::ISO_8601); + $date = new Date\Date; + $date->set($dateModified, Date\Date::ISO_8601); } $this->_data['datemodified'] = $date; @@ -264,7 +273,7 @@ public function getEnclosure() $nodeList = $this->getXpath()->query($this->getXpathPrefix() . '/atom:link[@rel="enclosure"]'); if ($nodeList->length > 0) { - $enclosure = new stdClass(); + $enclosure = new \stdClass(); $enclosure->url = $nodeList->item(0)->getAttribute('href'); $enclosure->length = $nodeList->item(0)->getAttribute('length'); $enclosure->type = $nodeList->item(0)->getAttribute('type'); @@ -497,7 +506,7 @@ public function getCommentFeedLink($type = 'atom') /** * Get all categories * - * @return Zend_Feed_Reader_Collection_Category + * @return \Zend\Feed\Reader\Collection\Category */ public function getCategories() { @@ -505,7 +514,7 @@ public function getCategories() return $this->_data['categories']; } - if ($this->_getAtomType() == Zend_Feed_Reader::TYPE_ATOM_10) { + if ($this->_getAtomType() == Reader\Reader::TYPE_ATOM_10) { $list = $this->getXpath()->query($this->getXpathPrefix() . '//atom:category'); } else { /** @@ -513,12 +522,12 @@ public function getCategories() * Dublin Core extension. However there is a small possibility Atom 0.3 * may have been retrofittied to use Atom 1.0 instead. */ - $this->getXpath()->registerNamespace('atom10', Zend_Feed_Reader::NAMESPACE_ATOM_10); + $this->getXpath()->registerNamespace('atom10', Reader\Reader::NAMESPACE_ATOM_10); $list = $this->getXpath()->query($this->getXpathPrefix() . '//atom10:category'); } if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; + $categoryCollection = new Collection\Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->getAttribute('term'), @@ -527,7 +536,7 @@ public function getCategories() ); } } else { - return new Zend_Feed_Reader_Collection_Category; + return new Collection\Category; } $this->_data['categories'] = $categoryCollection; @@ -538,7 +547,7 @@ public function getCategories() /** * Get source feed metadata from the entry * - * @return Zend_Feed_Reader_Feed_Atom_Source|null + * @return \Zend\Feed\Reader\Feed\Atom\Source|null */ public function getSource() { @@ -548,11 +557,11 @@ public function getSource() $source = null; // TODO: Investigate why _getAtomType() fails here. Is it even needed? - if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10) { + if ($this->getType() == Reader\Reader::TYPE_ATOM_10) { $list = $this->getXpath()->query($this->getXpathPrefix() . '/atom:source[1]'); if ($list->length) { $element = $list->item(0); - $source = new Zend_Feed_Reader_Feed_Atom_Source($element, $this->getXpathPrefix()); + $source = new Reader\Feed\Atom\Source($element, $this->getXpathPrefix()); } } @@ -566,10 +575,10 @@ public function getSource() */ protected function _absolutiseUri($link) { - if (!Zend_Uri::check($link)) { + if (!\Zend\URI\URL::validate($link)) { if (!is_null($this->getBaseUrl())) { $link = $this->getBaseUrl() . $link; - if (!Zend_Uri::check($link)) { + if (!\Zend\URI\URL::validate($link)) { $link = null; } } @@ -583,7 +592,7 @@ protected function _absolutiseUri($link) * @param DOMElement $element * @return string */ - protected function _getAuthor(DOMElement $element) + protected function _getAuthor(\DOMElement $element) { $author = array(); @@ -615,11 +624,11 @@ protected function _getAuthor(DOMElement $element) protected function _registerNamespaces() { switch ($this->_getAtomType()) { - case Zend_Feed_Reader::TYPE_ATOM_03: - $this->getXpath()->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03); + case Reader\Reader::TYPE_ATOM_03: + $this->getXpath()->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_03); break; default: - $this->getXpath()->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10); + $this->getXpath()->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_10); break; } } @@ -630,15 +639,15 @@ protected function _registerNamespaces() protected function _getAtomType() { $dom = $this->getDomDocument(); - $prefixAtom03 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_03); - $prefixAtom10 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_10); - if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_03) + $prefixAtom03 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_03); + $prefixAtom10 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_10); + if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_03) || !empty($prefixAtom03)) { - return Zend_Feed_Reader::TYPE_ATOM_03; + return Reader\Reader::TYPE_ATOM_03; } - if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_10) + if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_10) || !empty($prefixAtom10)) { - return Zend_Feed_Reader::TYPE_ATOM_10; + return Reader\Reader::TYPE_ATOM_10; } } } diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index 32711d90..4912190d 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -20,19 +20,28 @@ */ /** - * @uses Zend_Date - * @uses Zend_Feed_Reader - * @uses Zend_Feed_Reader_Collection_Author - * @uses Zend_Feed_Reader_Collection_Category - * @uses Zend_Feed_Reader_Extension_FeedAbstract - * @uses Zend_Uri + * @namespace + */ +namespace Zend\Feed\Reader\Extension\Atom; +use Zend\Feed\Reader; +use Zend\Date; +use Zend\Feed\Reader\Collection; +use Zend\URI; + +/** + * @uses \Zend\Date\Date + * @uses \Zend\Feed\Reader\Reader + * @uses \Zend\Feed\Reader\Collection\Author + * @uses \Zend\Feed\Reader\Collection\Category + * @uses \Zend\Feed\Reader\Extension\FeedAbstract + * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_FeedAbstract +class Feed + extends Reader\Extension\FeedAbstract { /** * Get a single author @@ -78,8 +87,8 @@ public function getAuthors() if (count($authors) == 0) { $authors = null; } else { - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) + $authors = new Collection\Author( + Reader\Reader::arrayUnique($authors) ); } @@ -101,7 +110,7 @@ public function getCopyright() $copyright = null; - if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { + if ($this->getType() === Reader\Reader::TYPE_ATOM_03) { $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:copyright)'); } else { $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:rights)'); @@ -119,7 +128,7 @@ public function getCopyright() /** * Get the feed creation date * - * @return Zend_Date|null + * @return \Zend\Date\Date|null */ public function getDateCreated() { @@ -129,15 +138,15 @@ public function getDateCreated() $date = null; - if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { + if ($this->getType() === Reader\Reader::TYPE_ATOM_03) { $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:created)'); } else { $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:published)'); } if ($dateCreated) { - $date = new Zend_Date; - $date->set($dateCreated, Zend_Date::ISO_8601); + $date = new Date\Date; + $date->set($dateCreated, Date\Date::ISO_8601); } $this->_data['datecreated'] = $date; @@ -148,7 +157,7 @@ public function getDateCreated() /** * Get the feed modification date * - * @return Zend_Date|null + * @return \Zend\Date\Date|null */ public function getDateModified() { @@ -158,15 +167,15 @@ public function getDateModified() $date = null; - if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { + if ($this->getType() === Reader\Reader::TYPE_ATOM_03) { $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)'); } else { $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)'); } if ($dateModified) { - $date = new Zend_Date; - $date->set($dateModified, Zend_Date::ISO_8601); + $date = new Date\Date; + $date->set($dateModified, Date\Date::ISO_8601); } $this->_data['datemodified'] = $date; @@ -187,7 +196,7 @@ public function getDescription() $description = null; - if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { + if ($this->getType() === Reader\Reader::TYPE_ATOM_03) { $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:tagline)'); // TODO: Is this the same as subtitle? } else { $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:subtitle)'); @@ -402,7 +411,7 @@ public function getTitle() /** * Get all categories * - * @return Zend_Feed_Reader_Collection_Category + * @return \Zend\Feed\Reader\Collection\Category */ public function getCategories() { @@ -410,7 +419,7 @@ public function getCategories() return $this->_data['categories']; } - if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10) { + if ($this->getType() == Reader\Reader::TYPE_ATOM_10) { $list = $this->_xpath->query($this->getXpathPrefix() . '/atom:category'); } else { /** @@ -418,12 +427,12 @@ public function getCategories() * Dublin Core extension. However there is a small possibility Atom 0.3 * may have been retrofittied to use Atom 1.0 instead. */ - $this->_xpath->registerNamespace('atom10', Zend_Feed_Reader::NAMESPACE_ATOM_10); + $this->_xpath->registerNamespace('atom10', Reader\Reader::NAMESPACE_ATOM_10); $list = $this->_xpath->query($this->getXpathPrefix() . '/atom10:category'); } if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; + $categoryCollection = new Collection\Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->getAttribute('term'), @@ -432,7 +441,7 @@ public function getCategories() ); } } else { - return new Zend_Feed_Reader_Collection_Category; + return new Collection\Category; } $this->_data['categories'] = $categoryCollection; @@ -446,7 +455,7 @@ public function getCategories() * @param DOMElement $element * @return string */ - protected function _getAuthor(DOMElement $element) + protected function _getAuthor(\DOMElement $element) { $author = array(); @@ -478,10 +487,10 @@ protected function _getAuthor(DOMElement $element) */ protected function _absolutiseUri($link) { - if (!Zend_Uri::check($link)) { + if (!\Zend\URI\URL::validate($link)) { if (!is_null($this->getBaseUrl())) { $link = $this->getBaseUrl() . $link; - if (!Zend_Uri::check($link)) { + if (!\Zend\URI\URL::validate($link)) { $link = null; } } @@ -494,18 +503,18 @@ protected function _absolutiseUri($link) */ protected function _registerNamespaces() { - if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 - || $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03 + if ($this->getType() == Reader\Reader::TYPE_ATOM_10 + || $this->getType() == Reader\Reader::TYPE_ATOM_03 ) { return; // pre-registered at Feed level } $atomDetected = $this->_getAtomType(); switch ($atomDetected) { - case Zend_Feed_Reader::TYPE_ATOM_03: - $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03); + case Reader\Reader::TYPE_ATOM_03: + $this->_xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_03); break; default: - $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10); + $this->_xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_10); break; } } @@ -516,15 +525,15 @@ protected function _registerNamespaces() protected function _getAtomType() { $dom = $this->getDomDocument(); - $prefixAtom03 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_03); - $prefixAtom10 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_10); - if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_10) + $prefixAtom03 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_03); + $prefixAtom10 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_10); + if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_10) || !empty($prefixAtom10)) { - return Zend_Feed_Reader::TYPE_ATOM_10; + return Reader\Reader::TYPE_ATOM_10; } - if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_03) + if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_03) || !empty($prefixAtom03)) { - return Zend_Feed_Reader::TYPE_ATOM_03; + return Reader\Reader::TYPE_ATOM_03; } } } diff --git a/src/Reader/Extension/Content/Entry.php b/src/Reader/Extension/Content/Entry.php index e5e9c2f7..8b0ddd64 100644 --- a/src/Reader/Extension/Content/Entry.php +++ b/src/Reader/Extension/Content/Entry.php @@ -20,21 +20,27 @@ */ /** - * @uses Zend_Feed_Reader + * @namespace + */ +namespace Zend\Feed\Reader\Extension\Content; +use Zend\Feed\Reader; + +/** + * @uses \Zend\Feed\Reader\Reader * @uses Zend_Feed_Reader_Entry_EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_EntryAbstract +class Entry + extends Reader\Extension\EntryAbstract { public function getContent() { - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { $content = $this->_xpath->evaluate('string('.$this->getXpathPrefix().'/content:encoded)'); } else { diff --git a/src/Reader/Extension/CreativeCommons/Entry.php b/src/Reader/Extension/CreativeCommons/Entry.php index fc0f362d..8f45fa15 100644 --- a/src/Reader/Extension/CreativeCommons/Entry.php +++ b/src/Reader/Extension/CreativeCommons/Entry.php @@ -20,14 +20,19 @@ */ /** - * @uses Zend_Feed_Reader_Extension_CreativeCommons_Feed - * @uses Zend_Feed_Reader_Extension_EntryAbstract + * @namespace + */ +namespace Zend\Feed\Reader\Extension\CreativeCommons; + +/** + * @uses \Zend\Feed\Reader\Extension\CreativeCommons\Feed + * @uses \Zend\Feed\Reader\Extension\EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 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_Entry extends Zend_Feed_Reader_Extension_EntryAbstract +class Entry extends \Zend\Feed\Reader\Extension\EntryAbstract { /** * Get the entry license @@ -67,7 +72,7 @@ public function getLicenses() $licenses = array_unique($licenses); } else { - $cc = new Zend_Feed_Reader_Extension_CreativeCommons_Feed( + $cc = new Feed( $this->_domDocument, $this->_data['type'], $this->_xpath ); $licenses = $cc->getLicenses(); diff --git a/src/Reader/Extension/CreativeCommons/Feed.php b/src/Reader/Extension/CreativeCommons/Feed.php index 0bf2b181..3ded5019 100644 --- a/src/Reader/Extension/CreativeCommons/Feed.php +++ b/src/Reader/Extension/CreativeCommons/Feed.php @@ -20,14 +20,19 @@ */ /** - * @uses Zend_Feed_Reader_Extension_FeedAbstract + * @namespace + */ +namespace Zend\Feed\Reader\Extension\CreativeCommons; + +/** + * @uses \Zend\Feed\Reader\Extension\FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_FeedAbstract +class Feed + extends \Zend\Feed\Reader\Extension\FeedAbstract { /** * Get the entry license diff --git a/src/Reader/Extension/DublinCore/Entry.php b/src/Reader/Extension/DublinCore/Entry.php index e5e66414..f42e2eb6 100644 --- a/src/Reader/Extension/DublinCore/Entry.php +++ b/src/Reader/Extension/DublinCore/Entry.php @@ -20,18 +20,25 @@ */ /** - * @uses Zend_Date - * @uses Zend_Feed_Reader - * @uses Zend_Feed_Reader_Collection_Author - * @uses Zend_Feed_Reader_Collection_Category - * @uses Zend_Feed_Reader_Extension_EntryAbstract + * @namespace + */ +namespace Zend\Feed\Reader\Extension\DublinCore; +use Zend\Feed\Reader\Collection; +use Zend\Date; + +/** + * @uses \Zend\Date\Date + * @uses \Zend\Feed\Reader\Reader + * @uses \Zend\Feed\Reader\Collection\Author + * @uses \Zend\Feed\Reader\Collection\Category + * @uses \Zend\Feed\Reader\Extension\EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_EntryAbstract +class Entry + extends \Zend\Feed\Reader\Extension\EntryAbstract { /** * Get an author entry @@ -81,8 +88,8 @@ public function getAuthors() 'name' => $author->nodeValue ); } - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) + $authors = new Collection\Author( + \Zend\Feed\Reader\Reader::arrayUnique($authors) ); } else { $authors = null; @@ -96,7 +103,7 @@ public function getAuthors() /** * Get categories (subjects under DC) * - * @return Zend_Feed_Reader_Collection_Category + * @return \Zend\Feed\Reader\Collection\Category */ public function getCategories() { @@ -111,7 +118,7 @@ public function getCategories() } if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; + $categoryCollection = new Collection\Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->nodeValue, @@ -120,7 +127,7 @@ public function getCategories() ); } } else { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; + $categoryCollection = new Collection\Category; } $this->_data['categories'] = $categoryCollection; @@ -218,7 +225,7 @@ public function getTitle() /** * * - * @return Zend_Date|null + * @return \Zend\Date\Date|null */ public function getDate() { @@ -234,8 +241,8 @@ public function getDate() } if ($date) { - $d = new Zend_Date; - $d->set($date, Zend_Date::ISO_8601); + $d = new Date\Date; + $d->set($date, Date\Date::ISO_8601); } $this->_data['date'] = $d; diff --git a/src/Reader/Extension/DublinCore/Feed.php b/src/Reader/Extension/DublinCore/Feed.php index 959ec124..958faee9 100644 --- a/src/Reader/Extension/DublinCore/Feed.php +++ b/src/Reader/Extension/DublinCore/Feed.php @@ -20,18 +20,25 @@ */ /** - * @uses Zend_Date - * @uses Zend_Feed_Reader - * @uses Zend_Feed_Reader_Collection_Author - * @uses Zend_Feed_Reader_Collection_Category - * @uses Zend_Feed_Reader_Extension_FeedAbstract + * @namespace + */ +namespace Zend\Feed\Reader\Extension\DublinCore; +use Zend\Date; +use Zend\Feed\Reader\Collection; + +/** + * @uses \Zend\Date\Date + * @uses \Zend\Feed\Reader\Reader + * @uses \Zend\Feed\Reader\Collection\Author + * @uses \Zend\Feed\Reader\Collection\Category + * @uses \Zend\Feed\Reader\Extension\FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_FeedAbstract +class Feed + extends \Zend\Feed\Reader\Extension\FeedAbstract { /** * Get a single author @@ -81,8 +88,8 @@ public function getAuthors() 'name' => $author->nodeValue ); } - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) + $authors = new Collection\Author( + \Zend\Feed\Reader\Reader::arrayUnique($authors) ); } else { $authors = null; @@ -227,7 +234,7 @@ public function getTitle() /** * * - * @return Zend_Date|null + * @return \Zend\Date\Date|null */ public function getDate() { @@ -243,8 +250,8 @@ public function getDate() } if ($date) { - $d = new Zend_Date; - $d->set($date, Zend_Date::ISO_8601); + $d = new Date\Date; + $d->set($date, Date\Date::ISO_8601); } $this->_data['date'] = $d; @@ -255,7 +262,7 @@ public function getDate() /** * Get categories (subjects under DC) * - * @return Zend_Feed_Reader_Collection_Category + * @return \Zend\Feed\Reader\Collection\Category */ public function getCategories() { @@ -270,7 +277,7 @@ public function getCategories() } if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; + $categoryCollection = new Collection\Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->nodeValue, @@ -279,7 +286,7 @@ public function getCategories() ); } } else { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; + $categoryCollection = new Collection\Category; } $this->_data['categories'] = $categoryCollection; diff --git a/src/Reader/Extension/EntryAbstract.php b/src/Reader/Extension/EntryAbstract.php index f9f3eeaa..775ed8f9 100644 --- a/src/Reader/Extension/EntryAbstract.php +++ b/src/Reader/Extension/EntryAbstract.php @@ -20,13 +20,19 @@ */ /** - * @uses Zend_Feed_Reader + * @namespace + */ +namespace Zend\Feed\Reader\Extension; +use Zend\Feed\Reader; + +/** + * @uses \Zend\Feed\Reader\Reader * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class Zend_Feed_Reader_Extension_EntryAbstract +abstract class EntryAbstract { /** * Feed entry data @@ -45,7 +51,7 @@ abstract class Zend_Feed_Reader_Extension_EntryAbstract /** * Entry instance * - * @var Zend_Feed_Entry_Abstract + * @var \Zend\Feed\Entry\AbstractEntry */ protected $_entry = null; @@ -73,12 +79,12 @@ abstract class Zend_Feed_Reader_Extension_EntryAbstract /** * Constructor * - * @param Zend_Feed_Entry_Abstract $entry + * @param \Zend\Feed\Entry\AbstractEntry $entry * @param int $entryKey * @param string $type * @return void */ - public function __construct(DOMElement $entry, $entryKey, $type = null) + public function __construct(\DOMElement $entry, $entryKey, $type = null) { $this->_entry = $entry; $this->_entryKey = $entryKey; @@ -87,15 +93,15 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) if (!is_null($type)) { $this->_data['type'] = $type; } else { - $this->_data['type'] = Zend_Feed_Reader::detectType($entry->ownerDocument, true); + $this->_data['type'] = Reader\Reader::detectType($entry->ownerDocument, true); } // set the XPath query prefix for the entry being queried - if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_10 - || $this->getType() == Zend_Feed_Reader::TYPE_RSS_090 + if ($this->getType() == Reader\Reader::TYPE_RSS_10 + || $this->getType() == Reader\Reader::TYPE_RSS_090 ) { $this->setXpathPrefix('//rss:item[' . ($this->_entryKey+1) . ']'); - } elseif ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 - || $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03 + } elseif ($this->getType() == Reader\Reader::TYPE_ATOM_10 + || $this->getType() == Reader\Reader::TYPE_ATOM_03 ) { $this->setXpathPrefix('//atom:entry[' . ($this->_entryKey+1) . ']'); } else { @@ -138,9 +144,9 @@ public function getType() * Set the XPath query * * @param DOMXPath $xpath - * @return Zend_Feed_Reader_Extension_EntryAbstract + * @return \Zend\Feed\Reader\Extension\EntryAbstract */ - public function setXpath(DOMXPath $xpath) + public function setXpath(\DOMXPath $xpath) { $this->_xpath = $xpath; $this->_registerNamespaces(); @@ -155,7 +161,7 @@ public function setXpath(DOMXPath $xpath) public function getXpath() { if (!$this->_xpath) { - $this->setXpath(new DOMXPath($this->getDomDocument())); + $this->setXpath(new \DOMXPath($this->getDomDocument())); } return $this->_xpath; } @@ -184,7 +190,7 @@ public function getXpathPrefix() * Set the XPath prefix * * @param string $prefix - * @return Zend_Feed_Reader_Extension_EntryAbstract + * @return \Zend\Feed\Reader\Extension\EntryAbstract */ public function setXpathPrefix($prefix) { diff --git a/src/Reader/Extension/FeedAbstract.php b/src/Reader/Extension/FeedAbstract.php index c4105e01..0472b39b 100644 --- a/src/Reader/Extension/FeedAbstract.php +++ b/src/Reader/Extension/FeedAbstract.php @@ -19,17 +19,22 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Reader\Extension; + /** * @uses DOMXPath - * @uses Zend_Feed_Reader - * @uses Zend_Feed_Reader_Entry_Atom - * @uses Zend_Feed_Reader_Entry_Rss + * @uses \Zend\Feed\Reader\Reader + * @uses \Zend\Feed\Reader\Entry\Atom + * @uses \Zend\Feed\Reader\Entry\RSS * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class Zend_Feed_Reader_Extension_FeedAbstract +abstract class FeedAbstract { /** * Parsed feed data @@ -62,24 +67,24 @@ abstract class Zend_Feed_Reader_Extension_FeedAbstract /** * Constructor * - * @param Zend_Feed_Abstract $feed The source Zend_Feed object + * @param \Zend\Feed\Feed_Abstract $feed The source \Zend\Feed\Feed object * @param string $type Feed type * @return void */ - public function __construct(DomDocument $dom, $type = null, DOMXPath $xpath = null) + public function __construct(\DomDocument $dom, $type = null, \DOMXPath $xpath = null) { $this->_domDocument = $dom; if ($type !== null) { $this->_data['type'] = $type; } else { - $this->_data['type'] = Zend_Feed_Reader::detectType($dom); + $this->_data['type'] = \Zend\Feed\Reader\Reader::detectType($dom); } if ($xpath !== null) { $this->_xpath = $xpath; } else { - $this->_xpath = new DOMXPath($this->_domDocument); + $this->_xpath = new \DOMXPath($this->_domDocument); } $this->_registerNamespaces(); @@ -131,9 +136,9 @@ public function toArray() // untested * Set the XPath query * * @param DOMXPath $xpath - * @return Zend_Feed_Reader_Extension_EntryAbstract + * @return \Zend\Feed\Reader\Extension\EntryAbstract */ - public function setXpath(DOMXPath $xpath) + public function setXpath(\DOMXPath $xpath) { $this->_xpath = $xpath; $this->_registerNamespaces(); @@ -163,7 +168,7 @@ public function getXpathPrefix() /** * Set the XPath prefix * - * @return Zend_Feed_Reader_Feed_Atom + * @return \Zend\Feed\Reader\Feed\Atom\Atom */ public function setXpathPrefix($prefix) { diff --git a/src/Reader/Extension/Podcast/Entry.php b/src/Reader/Extension/Podcast/Entry.php index 54ffab64..22ef4897 100644 --- a/src/Reader/Extension/Podcast/Entry.php +++ b/src/Reader/Extension/Podcast/Entry.php @@ -20,14 +20,19 @@ */ /** - * @uses Zend_Feed_Reader - * @uses Zend_Feed_Reader_Extension_EntryAbstract + * @namespace + */ +namespace Zend\Feed\Reader\Extension\Podcast; + +/** + * @uses \Zend\Feed\Reader\Reader + * @uses \Zend\Feed\Reader\Extension\EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Reader_Extension_Podcast_Entry extends Zend_Feed_Reader_Extension_EntryAbstract +class Entry extends \Zend\Feed\Reader\Extension\EntryAbstract { /** * Get the entry author diff --git a/src/Reader/Extension/Podcast/Feed.php b/src/Reader/Extension/Podcast/Feed.php index 2863e21f..96a712be 100644 --- a/src/Reader/Extension/Podcast/Feed.php +++ b/src/Reader/Extension/Podcast/Feed.php @@ -20,13 +20,18 @@ */ /** - * @uses Zend_Feed_Reader_Extension_FeedAbstract + * @namespace + */ +namespace Zend\Feed\Reader\Extension\Podcast; + +/** + * @uses \Zend\Feed\Reader\Extension\FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Reader_Extension_Podcast_Feed extends Zend_Feed_Reader_Extension_FeedAbstract +class Feed extends \Zend\Feed\Reader\Extension\FeedAbstract { /** * Get the entry author @@ -95,7 +100,7 @@ public function getCategories() $children = array(); foreach ($node->childNodes as $childNode) { - if (!($childNode instanceof DOMText)) { + if (!($childNode instanceof \DOMText)) { $children[$childNode->getAttribute('text')] = null; } } diff --git a/src/Reader/Extension/Slash/Entry.php b/src/Reader/Extension/Slash/Entry.php index 5b088fe3..717bab23 100644 --- a/src/Reader/Extension/Slash/Entry.php +++ b/src/Reader/Extension/Slash/Entry.php @@ -20,15 +20,20 @@ */ /** - * @uses Zend_Feed_Reader - * @uses Zend_Feed_Reader_Extension_EntryAbstract + * @namespace + */ +namespace Zend\Feed\Reader\Extension\Slash; + +/** + * @uses \Zend\Feed\Reader\Reader + * @uses \Zend\Feed\Reader\Extension\EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_EntryAbstract +class Entry + extends \Zend\Feed\Reader\Extension\EntryAbstract { /** * Get the entry section diff --git a/src/Reader/Extension/Syndication/Feed.php b/src/Reader/Extension/Syndication/Feed.php index adb69164..ec43e24d 100644 --- a/src/Reader/Extension/Syndication/Feed.php +++ b/src/Reader/Extension/Syndication/Feed.php @@ -20,15 +20,21 @@ */ /** - * @uses Zend_Date - * @uses Zend_Feed_Reader_Extension_FeedAbstract + * @namespace + */ +namespace Zend\Feed\Reader\Extension\Syndication; +use Zend\Date; + +/** + * @uses \Zend\Date\Date + * @uses \Zend\Feed\Reader\Extension\FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_FeedAbstract +class Feed + extends \Zend\Feed\Reader\Extension\FeedAbstract { /** * Get update period @@ -52,7 +58,7 @@ public function getUpdatePeriod() 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" ); } @@ -114,15 +120,15 @@ public function getUpdateFrequencyAsTicks() /** * Get update base * - * @return Zend_Date|null + * @return \Zend\Date\Date|null */ public function getUpdateBase() { $updateBase = $this->_getData('updateBase'); $date = null; if ($updateBase) { - $date = new Zend_Date; - $date->set($updateBase, Zend_Date::W3C); + $date = new Date\Date; + $date->set($updateBase, Date\Date::W3C); } return $date; } diff --git a/src/Reader/Extension/Thread/Entry.php b/src/Reader/Extension/Thread/Entry.php index 1e31fff9..89f3a65d 100644 --- a/src/Reader/Extension/Thread/Entry.php +++ b/src/Reader/Extension/Thread/Entry.php @@ -20,14 +20,19 @@ */ /** - * @uses Zend_Feed_Reader_Extension_EntryAbstract + * @namespace + */ +namespace Zend\Feed\Reader\Extension\Thread; + +/** + * @uses \Zend\Feed\Reader\Extension\EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_EntryAbstract +class Entry + extends \Zend\Feed\Reader\Extension\EntryAbstract { /** * Get the "in-reply-to" value diff --git a/src/Reader/Extension/WellFormedWeb/Entry.php b/src/Reader/Extension/WellFormedWeb/Entry.php index 6b278541..fbae9638 100644 --- a/src/Reader/Extension/WellFormedWeb/Entry.php +++ b/src/Reader/Extension/WellFormedWeb/Entry.php @@ -20,15 +20,20 @@ */ /** - * @uses Zend_Feed_Reader - * @uses Zend_Feed_Reader_Extension_EntryAbstract + * @namespace + */ +namespace Zend\Feed\Reader\Extension\WellFormedWeb; + +/** + * @uses \Zend\Feed\Reader\Reader + * @uses \Zend\Feed\Reader\Extension\EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_EntryAbstract +class Entry + extends \Zend\Feed\Reader\Extension\EntryAbstract { /** * Get the entry comment Uri diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom/Atom.php similarity index 88% rename from src/Reader/Feed/Atom.php rename to src/Reader/Feed/Atom/Atom.php index 3f1accf9..fbad6038 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom/Atom.php @@ -20,15 +20,21 @@ */ /** - * @uses Zend_Feed_Reader - * @uses Zend_Feed_Reader_Extension_Atom_Feed - * @uses Zend_Feed_Reader_FeedAbstract + * @namespace + */ +namespace Zend\Feed\Reader\Feed\Atom; +use Zend\Feed\Reader; + +/** + * @uses \Zend\Feed\Reader\Reader + * @uses \Zend\Feed\Reader\Extension\Atom\Feed + * @uses \Zend\Feed\Reader\FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract +class Atom extends Reader\FeedAbstract { /** @@ -37,13 +43,13 @@ class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract * @param DOMDocument $dom * @param string $type */ - public function __construct(DOMDocument $dom, $type = null) + public function __construct(\DOMDocument $dom, $type = null) { parent::__construct($dom, $type); - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Feed'); - $this->_extensions['Atom_Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Feed'); - $this->_extensions['DublinCore_Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); + $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\Feed'); + $this->_extensions['Atom\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); + $atomClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\Feed'); + $this->_extensions['DublinCore\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); foreach ($this->_extensions as $extension) { $extension->setXpathPrefix('/atom:feed'); } @@ -327,7 +333,7 @@ public function getHubs() /** * Get all categories * - * @return Zend_Feed_Reader_Collection_Category + * @return \Zend\Feed\Reader\Collection\Category */ public function getCategories() { @@ -353,8 +359,8 @@ public function getCategories() */ protected function _indexEntries() { - if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 || - $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03) { + if ($this->getType() == Reader\Reader::TYPE_ATOM_10 || + $this->getType() == Reader\Reader::TYPE_ATOM_03) { $entries = array(); $entries = $this->_xpath->evaluate('//atom:entry'); @@ -371,12 +377,12 @@ protected function _indexEntries() protected function _registerNamespaces() { switch ($this->_data['type']) { - case Zend_Feed_Reader::TYPE_ATOM_03: - $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03); + case Reader\Reader::TYPE_ATOM_03: + $this->_xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_03); break; - case Zend_Feed_Reader::TYPE_ATOM_10: + case Reader\Reader::TYPE_ATOM_10: default: - $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10); + $this->_xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_10); } } } diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php index fe7b2c32..5a33d9dc 100644 --- a/src/Reader/Feed/Atom/Source.php +++ b/src/Reader/Feed/Atom/Source.php @@ -20,14 +20,20 @@ */ /** - * @uses Zend_Feed_Reader - * @uses Zend_Feed_Reader_Feed_Atom + * @namespace + */ +namespace Zend\Feed\Reader\Feed\Atom; +use Zend\Feed\Reader; + +/** + * @uses \Zend\Feed\Reader\Reader + * @uses \Zend\Feed\Reader\Feed\Atom\Atom * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Reader_Feed_Atom_Source extends Zend_Feed_Reader_Feed_Atom +class Source extends Atom { /** @@ -39,18 +45,18 @@ class Zend_Feed_Reader_Feed_Atom_Source extends Zend_Feed_Reader_Feed_Atom * @param string $xpathPrefix Passed from parent Entry object * @param string $type Nearly always Atom 1.0 */ - public function __construct(DOMElement $source, $xpathPrefix, $type = Zend_Feed_Reader::TYPE_ATOM_10) + public function __construct(\DOMElement $source, $xpathPrefix, $type = Reader\Reader::TYPE_ATOM_10) { $this->_domDocument = $source->ownerDocument; - $this->_xpath = new DOMXPath($this->_domDocument); + $this->_xpath = new \DOMXPath($this->_domDocument); $this->_data['type'] = $type; $this->_registerNamespaces(); $this->_loadExtensions(); - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Feed'); - $this->_extensions['Atom_Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Feed'); - $this->_extensions['DublinCore_Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); + $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\Feed'); + $this->_extensions['Atom\Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); + $atomClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\Feed'); + $this->_extensions['DublinCore\Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); foreach ($this->_extensions as $extension) { $extension->setXpathPrefix(rtrim($xpathPrefix, '/') . '/atom:source'); } diff --git a/src/Reader/Feed/RSS.php b/src/Reader/Feed/RSS.php new file mode 100644 index 00000000..fd48753e --- /dev/null +++ b/src/Reader/Feed/RSS.php @@ -0,0 +1,611 @@ +getClassName('DublinCore\Feed'); + $this->_extensions['DublinCore\Feed'] = new $dublinCoreClass($dom, $this->_data['type'], $this->_xpath); + $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\Feed'); + $this->_extensions['Atom\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $xpathPrefix = '/rss/channel'; + } else { + $xpathPrefix = '/rdf:RDF/rss:channel'; + } + foreach ($this->_extensions as $extension) { + $extension->setXpathPrefix($xpathPrefix); + } + } + + /** + * Get a single author + * + * @param int $index + * @return string|null + */ + public function getAuthor($index = 0) + { + $authors = $this->getAuthors(); + + if (isset($authors[$index])) { + return $authors[$index]; + } + + return null; + } + + /** + * Get an array with feed authors + * + * @return array + */ + public function getAuthors() + { + if (array_key_exists('authors', $this->_data)) { + return $this->_data['authors']; + } + + $authors = array(); + $authors_dc = $this->getExtension('DublinCore')->getAuthors(); + if (!empty($authors_dc)) { + foreach ($authors_dc as $author) { + $authors[] = array( + 'name' => $author['name'] + ); + } + } + + /** + * Technically RSS doesn't specific author element use at the feed level + * but it's supported on a "just in case" basis. + */ + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $list = $this->_xpath->query('//author'); + } else { + $list = $this->_xpath->query('//rss:author'); + } + if ($list->length) { + foreach ($list as $author) { + $string = trim($author->nodeValue); + $email = null; + $name = null; + $data = array(); + // Pretty rough parsing - but it's a catchall + if (preg_match("/^.*@[^ ]*/", $string, $matches)) { + $data['email'] = trim($matches[0]); + if (preg_match('/\((.*)\)$/', $string, $matches)) { + $data['name'] = $matches[1]; + } + $authors[] = $data; + } + } + } + + if (count($authors) == 0) { + $authors = $this->getExtension('Atom')->getAuthors(); + } else { + $authors = new Reader\Collection\Author( + Reader\Reader::arrayUnique($authors) + ); + } + + if (count($authors) == 0) { + $authors = null; + } + + $this->_data['authors'] = $authors; + + return $this->_data['authors']; + } + + /** + * Get the copyright entry + * + * @return string|null + */ + public function getCopyright() + { + if (array_key_exists('copyright', $this->_data)) { + return $this->_data['copyright']; + } + + $copyright = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $copyright = $this->_xpath->evaluate('string(/rss/channel/copyright)'); + } + + if (!$copyright && !is_null($this->getExtension('DublinCore'))) { + $copyright = $this->getExtension('DublinCore')->getCopyright(); + } + + if (empty($copyright)) { + $copyright = $this->getExtension('Atom')->getCopyright(); + } + + if (!$copyright) { + $copyright = null; + } + + $this->_data['copyright'] = $copyright; + + return $this->_data['copyright']; + } + + /** + * Get the feed creation date + * + * @return string|null + */ + public function getDateCreated() + { + return $this->getDateModified(); + } + + /** + * Get the feed modification date + * + * @return \Zend\Date\Date + */ + public function getDateModified() + { + if (array_key_exists('datemodified', $this->_data)) { + return $this->_data['datemodified']; + } + + $dateModified = null; + $date = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $dateModified = $this->_xpath->evaluate('string(/rss/channel/pubDate)'); + if (!$dateModified) { + $dateModified = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)'); + } + if ($dateModified) { + $dateStandards = array(Date\Date::RSS, Date\Date::RFC_822, + Date\Date::RFC_2822, Date\Date::DATES); + $date = new Date\Date; + foreach ($dateStandards as $standard) { + try { + $date->set($dateModified, $standard); + break; + } catch (Date\Exception $e) { + if ($standard == Date\Date::DATES) { + throw new \Zend\Feed\Exception( + 'Could not load date due to unrecognised' + .' format (should follow RFC 822 or 2822):' + . $e->getMessage(), + 0, $e + ); + } + } + } + } + } + + if (!$date) { + $date = $this->getExtension('DublinCore')->getDate(); + } + + if (!$date) { + $date = $this->getExtension('Atom')->getDateModified(); + } + + if (!$date) { + $date = null; + } + + $this->_data['datemodified'] = $date; + + return $this->_data['datemodified']; + } + + /** + * Get the feed description + * + * @return string|null + */ + public function getDescription() + { + if (array_key_exists('description', $this->_data)) { + return $this->_data['description']; + } + + $description = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $description = $this->_xpath->evaluate('string(/rss/channel/description)'); + } else { + $description = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:description)'); + } + + if (!$description && !is_null($this->getExtension('DublinCore'))) { + $description = $this->getExtension('DublinCore')->getDescription(); + } + + if (empty($description)) { + $description = $this->getExtension('Atom')->getDescription(); + } + + if (!$description) { + $description = null; + } + + $this->_data['description'] = $description; + + return $this->_data['description']; + } + + /** + * Get the feed ID + * + * @return string|null + */ + public function getId() + { + if (array_key_exists('id', $this->_data)) { + return $this->_data['id']; + } + + $id = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $id = $this->_xpath->evaluate('string(/rss/channel/guid)'); + } + + if (!$id && !is_null($this->getExtension('DublinCore'))) { + $id = $this->getExtension('DublinCore')->getId(); + } + + if (empty($id)) { + $id = $this->getExtension('Atom')->getId(); + } + + if (!$id) { + if ($this->getLink()) { + $id = $this->getLink(); + } elseif ($this->getTitle()) { + $id = $this->getTitle(); + } else { + $id = null; + } + } + + $this->_data['id'] = $id; + + return $this->_data['id']; + } + + /** + * Get the feed language + * + * @return string|null + */ + public function getLanguage() + { + if (array_key_exists('language', $this->_data)) { + return $this->_data['language']; + } + + $language = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $language = $this->_xpath->evaluate('string(/rss/channel/language)'); + } + + if (!$language && !is_null($this->getExtension('DublinCore'))) { + $language = $this->getExtension('DublinCore')->getLanguage(); + } + + if (empty($language)) { + $language = $this->getExtension('Atom')->getLanguage(); + } + + if (!$language) { + $language = $this->_xpath->evaluate('string(//@xml:lang[1])'); + } + + if (!$language) { + $language = null; + } + + $this->_data['language'] = $language; + + return $this->_data['language']; + } + + /** + * Get a link to the feed + * + * @return string|null + */ + public function getLink() + { + if (array_key_exists('link', $this->_data)) { + return $this->_data['link']; + } + + $link = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $link = $this->_xpath->evaluate('string(/rss/channel/link)'); + } else { + $link = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:link)'); + } + + if (empty($link)) { + $link = $this->getExtension('Atom')->getLink(); + } + + if (!$link) { + $link = null; + } + + $this->_data['link'] = $link; + + return $this->_data['link']; + } + + /** + * Get a link to the feed XML + * + * @return string|null + */ + public function getFeedLink() + { + if (array_key_exists('feedlink', $this->_data)) { + return $this->_data['feedlink']; + } + + $link = null; + + $link = $this->getExtension('Atom')->getFeedLink(); + + if (!$link) { + $link = null; + } + + $this->_data['feedlink'] = $link; + + return $this->_data['feedlink']; + } + + /** + * Get the feed generator entry + * + * @return string|null + */ + public function getGenerator() + { + if (array_key_exists('generator', $this->_data)) { + return $this->_data['generator']; + } + + $generator = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $generator = $this->_xpath->evaluate('string(/rss/channel/generator)'); + } + + if (!$generator) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $generator = $this->_xpath->evaluate('string(/rss/channel/atom:generator)'); + } else { + $generator = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/atom:generator)'); + } + if ($generator) { + $generator = html_entity_decode($generator, ENT_QUOTES, $this->getEncoding()); + } + } + + if (empty($generator)) { + $generator = $this->getExtension('Atom')->getGenerator(); + } + + if (!$generator) { + $generator = null; + } + + $this->_data['generator'] = $generator; + + return $this->_data['generator']; + } + + /** + * Get the feed title + * + * @return string|null + */ + public function getTitle() + { + if (array_key_exists('title', $this->_data)) { + return $this->_data['title']; + } + + $title = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $title = $this->_xpath->evaluate('string(/rss/channel/title)'); + } else { + $title = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:title)'); + } + + if (!$title && !is_null($this->getExtension('DublinCore'))) { + $title = $this->getExtension('DublinCore')->getTitle(); + } + + if (!$title) { + $title = $this->getExtension('Atom')->getTitle(); + } + + if (!$title) { + $title = null; + } + + $this->_data['title'] = $title; + + return $this->_data['title']; + } + + /** + * Get an array of any supported Pusubhubbub endpoints + * + * @return array|null + */ + public function getHubs() + { + if (array_key_exists('hubs', $this->_data)) { + return $this->_data['hubs']; + } + + $hubs = $this->getExtension('Atom')->getHubs(); + + if (empty($hubs)) { + $hubs = null; + } else { + $hubs = array_unique($hubs); + } + + $this->_data['hubs'] = $hubs; + + return $this->_data['hubs']; + } + + /** + * Get all categories + * + * @return \Zend\Feed\Reader\Collection\Category + */ + public function getCategories() + { + if (array_key_exists('categories', $this->_data)) { + return $this->_data['categories']; + } + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $list = $this->_xpath->query('/rss/channel//category'); + } else { + $list = $this->_xpath->query('/rdf:RDF/rss:channel//rss:category'); + } + + if ($list->length) { + $categoryCollection = new Reader\Collection\Category; + foreach ($list as $category) { + $categoryCollection[] = array( + 'term' => $category->nodeValue, + 'scheme' => $category->getAttribute('domain'), + 'label' => $category->nodeValue, + ); + } + } else { + $categoryCollection = $this->getExtension('DublinCore')->getCategories(); + } + + if (count($categoryCollection) == 0) { + $categoryCollection = $this->getExtension('Atom')->getCategories(); + } + + $this->_data['categories'] = $categoryCollection; + + return $this->_data['categories']; + } + + /** + * Read all entries to the internal entries array + * + */ + 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 { + $entries = $this->_xpath->evaluate('//rss:item'); + } + + foreach($entries as $index=>$entry) { + $this->_entries[$index] = $entry; + } + } + + /** + * Register the default namespaces for the current feed format + * + */ + protected function _registerNamespaces() + { + switch ($this->_data['type']) { + case Reader\Reader::TYPE_RSS_10: + $this->_xpath->registerNamespace('rdf', Reader\Reader::NAMESPACE_RDF); + $this->_xpath->registerNamespace('rss', Reader\Reader::NAMESPACE_RSS_10); + break; + + case Reader\Reader::TYPE_RSS_090: + $this->_xpath->registerNamespace('rdf', Reader\Reader::NAMESPACE_RDF); + $this->_xpath->registerNamespace('rss', Reader\Reader::NAMESPACE_RSS_090); + break; + } + } +} diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 841eda32..fd48753e 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -20,19 +20,26 @@ */ /** - * @uses Zend_Date - * @uses Zend_Feed_Exception - * @uses Zend_Feed_Reader - * @uses Zend_Feed_Reader_Collection_Author - * @uses Zend_Feed_Reader_Extension_Atom_Feed - * @uses Zend_Feed_Reader_Extension_DublinCore_Feed - * @uses Zend_Feed_Reader_FeedAbstract + * @namespace + */ +namespace Zend\Feed\Reader\Feed; +use Zend\Feed\Reader; +use Zend\Date; + +/** + * @uses \Zend\Date\Date + * @uses \Zend\Feed\Exception + * @uses \Zend\Feed\Reader\Reader + * @uses \Zend\Feed\Reader\Collection\Author + * @uses \Zend\Feed\Reader\Extension\Atom\Feed + * @uses \Zend\Feed\Reader\Extension\DublinCore\Feed + * @uses \Zend\Feed\Reader\FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract +class RSS extends Reader\FeedAbstract { /** @@ -41,16 +48,16 @@ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract * @param DOMDocument $dom * @param string $type */ - public function __construct(DomDocument $dom, $type = null) + public function __construct(\DomDocument $dom, $type = null) { parent::__construct($dom, $type); - $dublinCoreClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Feed'); - $this->_extensions['DublinCore_Feed'] = new $dublinCoreClass($dom, $this->_data['type'], $this->_xpath); - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Feed'); - $this->_extensions['Atom_Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); + $dublinCoreClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\Feed'); + $this->_extensions['DublinCore\Feed'] = new $dublinCoreClass($dom, $this->_data['type'], $this->_xpath); + $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\Feed'); + $this->_extensions['Atom\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { $xpathPrefix = '/rss/channel'; } else { $xpathPrefix = '/rdf:RDF/rss:channel'; @@ -102,8 +109,8 @@ public function getAuthors() * Technically RSS doesn't specific author element use at the feed level * but it's supported on a "just in case" basis. */ - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090) { $list = $this->_xpath->query('//author'); } else { $list = $this->_xpath->query('//rss:author'); @@ -117,7 +124,7 @@ public function getAuthors() // Pretty rough parsing - but it's a catchall if (preg_match("/^.*@[^ ]*/", $string, $matches)) { $data['email'] = trim($matches[0]); - if (preg_match("/\((.*)\)$/", $string, $matches)) { + if (preg_match('/\((.*)\)$/', $string, $matches)) { $data['name'] = $matches[1]; } $authors[] = $data; @@ -128,8 +135,8 @@ public function getAuthors() if (count($authors) == 0) { $authors = $this->getExtension('Atom')->getAuthors(); } else { - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) + $authors = new Reader\Collection\Author( + Reader\Reader::arrayUnique($authors) ); } @@ -155,8 +162,8 @@ public function getCopyright() $copyright = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $copyright = $this->_xpath->evaluate('string(/rss/channel/copyright)'); } @@ -190,7 +197,7 @@ public function getDateCreated() /** * Get the feed modification date * - * @return Zend_Date + * @return \Zend\Date\Date */ public function getDateModified() { @@ -201,23 +208,23 @@ public function getDateModified() $dateModified = null; $date = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $dateModified = $this->_xpath->evaluate('string(/rss/channel/pubDate)'); if (!$dateModified) { $dateModified = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)'); } if ($dateModified) { - $dateStandards = array(Zend_Date::RSS, Zend_Date::RFC_822, - Zend_Date::RFC_2822, Zend_Date::DATES); - $date = new Zend_Date; + $dateStandards = array(Date\Date::RSS, Date\Date::RFC_822, + Date\Date::RFC_2822, Date\Date::DATES); + $date = new Date\Date; foreach ($dateStandards as $standard) { try { $date->set($dateModified, $standard); break; - } catch (Zend_Date_Exception $e) { - if ($standard == Zend_Date::DATES) { - throw new Zend_Feed_Exception( + } catch (Date\Exception $e) { + if ($standard == Date\Date::DATES) { + throw new \Zend\Feed\Exception( 'Could not load date due to unrecognised' .' format (should follow RFC 822 or 2822):' . $e->getMessage(), @@ -259,8 +266,8 @@ public function getDescription() $description = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $description = $this->_xpath->evaluate('string(/rss/channel/description)'); } else { $description = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:description)'); @@ -296,8 +303,8 @@ public function getId() $id = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $id = $this->_xpath->evaluate('string(/rss/channel/guid)'); } @@ -337,8 +344,8 @@ public function getLanguage() $language = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $language = $this->_xpath->evaluate('string(/rss/channel/language)'); } @@ -376,8 +383,8 @@ public function getLink() $link = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $link = $this->_xpath->evaluate('string(/rss/channel/link)'); } else { $link = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:link)'); @@ -433,14 +440,14 @@ public function getGenerator() $generator = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $generator = $this->_xpath->evaluate('string(/rss/channel/generator)'); } if (!$generator) { - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $generator = $this->_xpath->evaluate('string(/rss/channel/atom:generator)'); } else { $generator = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/atom:generator)'); @@ -476,8 +483,8 @@ public function getTitle() $title = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $title = $this->_xpath->evaluate('string(/rss/channel/title)'); } else { $title = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:title)'); @@ -527,7 +534,7 @@ public function getHubs() /** * Get all categories * - * @return Zend_Feed_Reader_Collection_Category + * @return \Zend\Feed\Reader\Collection\Category */ public function getCategories() { @@ -535,15 +542,15 @@ public function getCategories() return $this->_data['categories']; } - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $list = $this->_xpath->query('/rss/channel//category'); } else { $list = $this->_xpath->query('/rdf:RDF/rss:channel//rss:category'); } if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; + $categoryCollection = new Reader\Collection\Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->nodeValue, @@ -572,7 +579,7 @@ protected function _indexEntries() { $entries = array(); - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { $entries = $this->_xpath->evaluate('//item'); } else { $entries = $this->_xpath->evaluate('//rss:item'); @@ -590,14 +597,14 @@ protected function _indexEntries() protected function _registerNamespaces() { switch ($this->_data['type']) { - case Zend_Feed_Reader::TYPE_RSS_10: - $this->_xpath->registerNamespace('rdf', Zend_Feed_Reader::NAMESPACE_RDF); - $this->_xpath->registerNamespace('rss', Zend_Feed_Reader::NAMESPACE_RSS_10); + case Reader\Reader::TYPE_RSS_10: + $this->_xpath->registerNamespace('rdf', Reader\Reader::NAMESPACE_RDF); + $this->_xpath->registerNamespace('rss', Reader\Reader::NAMESPACE_RSS_10); break; - case Zend_Feed_Reader::TYPE_RSS_090: - $this->_xpath->registerNamespace('rdf', Zend_Feed_Reader::NAMESPACE_RDF); - $this->_xpath->registerNamespace('rss', Zend_Feed_Reader::NAMESPACE_RSS_090); + case Reader\Reader::TYPE_RSS_090: + $this->_xpath->registerNamespace('rdf', Reader\Reader::NAMESPACE_RDF); + $this->_xpath->registerNamespace('rss', Reader\Reader::NAMESPACE_RSS_090); break; } } diff --git a/src/Reader/FeedAbstract.php b/src/Reader/FeedAbstract.php index 38044e84..48791cf5 100644 --- a/src/Reader/FeedAbstract.php +++ b/src/Reader/FeedAbstract.php @@ -20,15 +20,20 @@ */ /** - * @uses Zend_Feed_Exception - * @uses Zend_Feed_Reader + * @namespace + */ +namespace Zend\Feed\Reader; + +/** + * @uses \Zend\Feed\Exception + * @uses \Zend\Feed\Reader\Reader * @uses Zend_feed_Reader_FeedInterface * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInterface +abstract class FeedAbstract implements FeedInterface { /** * Parsed feed data @@ -78,15 +83,15 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt * @param DomDocument The DOM object for the feed's XML * @param string $type Feed type */ - public function __construct(DomDocument $domDocument, $type = null) + public function __construct(\DomDocument $domDocument, $type = null) { $this->_domDocument = $domDocument; - $this->_xpath = new DOMXPath($this->_domDocument); + $this->_xpath = new \DOMXPath($this->_domDocument); if ($type !== null) { $this->_data['type'] = $type; } else { - $this->_data['type'] = Zend_Feed_Reader::detectType($this->_domDocument); + $this->_data['type'] = Reader::detectType($this->_domDocument); } $this->_registerNamespaces(); $this->_indexEntries(); @@ -107,14 +112,14 @@ public function count() /** * Return the current entry * - * @return Zend_Feed_Reader_EntryInterface + * @return \Zend\Feed\Reader\EntryInterface */ public function current() { if (substr($this->getType(), 0, 3) == 'rss') { - $reader = new Zend_Feed_Reader_Entry_Rss($this->_entries[$this->key()], $this->key(), $this->getType()); + $reader = new Entry\RSS($this->_entries[$this->key()], $this->key(), $this->getType()); } else { - $reader = new Zend_Feed_Reader_Entry_Atom($this->_entries[$this->key()], $this->key(), $this->getType()); + $reader = new Entry\Atom($this->_entries[$this->key()], $this->key(), $this->getType()); } $reader->setXpath($this->_xpath); @@ -236,7 +241,7 @@ public function __call($method, $args) return call_user_func_array(array($extension, $method), $args); } } - throw new Zend_Feed_Exception('Method: ' . $method + throw new \Zend\Feed\Exception('Method: ' . $method . 'does not exist and could not be located on a registered Extension'); } @@ -244,25 +249,25 @@ public function __call($method, $args) * Return an Extension object with the matching name (postfixed with _Feed) * * @param string $name - * @return Zend_Feed_Reader_Extension_FeedAbstract + * @return \Zend\Feed\Reader\Extension\FeedAbstract */ public function getExtension($name) { - if (array_key_exists($name . '_Feed', $this->_extensions)) { - return $this->_extensions[$name . '_Feed']; + if (array_key_exists($name . '\Feed', $this->_extensions)) { + return $this->_extensions[$name . '\Feed']; } return null; } protected function _loadExtensions() { - $all = Zend_Feed_Reader::getExtensions(); + $all = Reader::getExtensions(); $feed = $all['feed']; foreach ($feed as $extension) { if (in_array($extension, $all['core'])) { continue; } - $className = Zend_Feed_Reader::getPluginLoader()->getClassName($extension); + $className = Reader::getPluginLoader()->getClassName($extension); $this->_extensions[$extension] = new $className( $this->getDomDocument(), $this->_data['type'], $this->_xpath ); diff --git a/src/Reader/FeedInterface.php b/src/Reader/FeedInterface.php index ee22eef8..e8f299a5 100644 --- a/src/Reader/FeedInterface.php +++ b/src/Reader/FeedInterface.php @@ -19,6 +19,11 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Reader; + /** * @uses Countable * @uses Iterator @@ -27,7 +32,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface Zend_Feed_Reader_FeedInterface extends Iterator, Countable +interface FeedInterface extends \Iterator, \Countable { /** * Get a single author @@ -117,7 +122,7 @@ public function getTitle(); /** * Get all categories * - * @return Zend_Feed_Reader_Collection_Category + * @return \Zend\Feed\Reader\Collection\Category */ public function getCategories(); diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index 377fa596..abcc16e4 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -20,14 +20,20 @@ */ /** - * @uses Zend_Feed_Reader - * @uses Zend_Uri + * @namespace + */ +namespace Zend\Feed\Reader; +use Zend\URI; + +/** + * @uses \Zend\Feed\Reader\Reader + * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 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 +class FeedSet extends \ArrayObject { public $rss = null; @@ -52,7 +58,7 @@ class Zend_Feed_Reader_FeedSet extends ArrayObject * @param string $uri * @return void */ - public function addLinks(DOMNodeList $links, $uri) + public function addLinks(\DOMNodeList $links, $uri) { foreach ($links as $link) { if (strtolower($link->getAttribute('rel')) !== 'alternate' @@ -79,16 +85,16 @@ public function addLinks(DOMNodeList $links, $uri) */ protected function _absolutiseUri($link, $uri = null) { - if (!Zend_Uri::check($link)) { + if (!URI\URL::validate($link)) { if (!is_null($uri)) { - $uri = Zend_Uri::factory($uri); + $uri = new URI\URL($uri); if ($link[0] !== '/') { $link = $uri->getPath() . '/' . $link; } $link = $uri->getScheme() . '://' . $uri->getHost() . '/' . $this->_canonicalizePath($link); - if (!Zend_Uri::check($link)) { + if (!URI\Zend\Uri\Uri::check($link)) { $link = null; } } @@ -122,7 +128,7 @@ protected function _canonicalizePath($path) * * @param string $offset * @return mixed - * @uses Zend_Feed_Reader + * @uses \Zend\Feed\Reader\Reader */ public function offsetGet($offset) { @@ -130,7 +136,7 @@ public function offsetGet($offset) if (!$this->offsetExists('href')) { return null; } - $feed = Zend_Feed_Reader::import($this->offsetGet('href')); + $feed = Reader::import($this->offsetGet('href')); $this->offsetSet('feed', $feed); return $feed; } diff --git a/src/Reader.php b/src/Reader/Reader.php similarity index 82% rename from src/Reader.php rename to src/Reader/Reader.php index e9ed9286..a2e31eda 100644 --- a/src/Reader.php +++ b/src/Reader/Reader.php @@ -20,19 +20,26 @@ */ /** - * @uses Zend_Feed - * @uses Zend_Feed_Exception - * @uses Zend_Feed_Reader_FeedSet - * @uses Zend_Feed_Reader_Feed_Atom - * @uses Zend_Feed_Reader_Feed_Rss - * @uses Zend_Http_Client - * @uses Zend_Loader_PluginLoader + * @namespace + */ +namespace Zend\Feed\Reader; +use Zend\HTTP; +use Zend\Loader\PluginLoader; + +/** + * @uses \Zend\Feed\Feed + * @uses \Zend\Feed\Exception + * @uses \Zend\Feed\Reader\FeedSet + * @uses \Zend\Feed\Reader\Feed\Atom\Atom + * @uses \Zend\Feed\Reader\Feed\RSS + * @uses \Zend\HTTP\Client + * @uses \Zend\Loader\PluginLoader\PluginLoader * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Reader +class Reader { /** * Namespace constants @@ -65,14 +72,14 @@ class Zend_Feed_Reader /** * Cache instance * - * @var Zend_Cache_Core + * @var \Zend\Cache\Frontend\Core */ protected static $_cache = null; /** * HTTP client object to use for retrieving feeds * - * @var Zend_Http_Client + * @var \Zend\HTTP\Client */ protected static $_httpClient = null; @@ -91,27 +98,27 @@ class Zend_Feed_Reader protected static $_extensions = array( 'feed' => array( - 'DublinCore_Feed', - 'Atom_Feed' + 'DublinCore\Feed', + 'Atom\Feed' ), 'entry' => array( - 'Content_Entry', - 'DublinCore_Entry', - 'Atom_Entry' + 'Content\Entry', + 'DublinCore\Entry', + 'Atom\Entry' ), 'core' => array( - 'DublinCore_Feed', - 'Atom_Feed', - 'Content_Entry', - 'DublinCore_Entry', - 'Atom_Entry' + 'DublinCore\Feed', + 'Atom\Feed', + 'Content\Entry', + 'DublinCore\Entry', + 'Atom\Entry' ) ); /** * Get the Feed cache * - * @return Zend_Cache_Core + * @return \Zend\Cache\Frontend\Core */ public static function getCache() { @@ -121,10 +128,10 @@ public static function getCache() /** * Set the feed cache * - * @param Zend_Cache_Core $cache + * @param \Zend\Cache\Frontend\Core $cache * @return void */ - public static function setCache(Zend_Cache_Core $cache) + public static function setCache(\Zend\Cache\Frontend\Core $cache) { self::$_cache = $cache; } @@ -134,10 +141,10 @@ public static function setCache(Zend_Cache_Core $cache) * * Sets the HTTP client object to use for retrieving the feeds. * - * @param Zend_Http_Client $httpClient + * @param \Zend\HTTP\Client $httpClient * @return void */ - public static function setHttpClient(Zend_Http_Client $httpClient) + public static function setHttpClient(HTTP\Client $httpClient) { self::$_httpClient = $httpClient; } @@ -150,8 +157,8 @@ public static function setHttpClient(Zend_Http_Client $httpClient) */ public static function getHttpClient() { - if (!self::$_httpClient instanceof Zend_Http_Client) { - self::$_httpClient = new Zend_Http_Client(); + if (!self::$_httpClient instanceof HTTP\Client) { + self::$_httpClient = new HTTP\Client(); } return self::$_httpClient; @@ -202,7 +209,7 @@ public static function useHttpConditionalGet($bool = true) * @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_FeedInterface + * @return \Zend\Feed\Reader\FeedInterface */ public static function import($uri, $etag = null, $lastModified = null) { @@ -234,7 +241,7 @@ public static function import($uri, $etag = null, $lastModified = null) } $response = $client->request('GET'); if ($response->getStatus() !== 200 && $response->getStatus() !== 304) { - throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); + throw new \Zend\Feed\Exception('Feed failed to load, got response code ' . $response->getStatus()); } if ($response->getStatus() == 304) { $responseXml = $data; @@ -256,7 +263,7 @@ public static function import($uri, $etag = null, $lastModified = null) } $response = $client->request('GET'); if ($response->getStatus() !== 200) { - throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); + throw new \Zend\Feed\Exception('Feed failed to load, got response code ' . $response->getStatus()); } $responseXml = $response->getBody(); $cache->save($responseXml, $cacheId); @@ -264,7 +271,7 @@ public static function import($uri, $etag = null, $lastModified = null) } else { $response = $client->request('GET'); if ($response->getStatus() !== 200) { - throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); + throw new \Zend\Feed\Exception('Feed failed to load, got response code ' . $response->getStatus()); } return self::importString($response->getBody()); } @@ -273,18 +280,18 @@ public static function import($uri, $etag = null, $lastModified = null) /** * 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_FeedInterface + * @param \Zend\Feed\Feed_Abstract $feed A fully instantiated \Zend\Feed\Feed object + * @return \Zend\Feed\Reader\FeedInterface */ - public static function importFeed(Zend_Feed_Abstract $feed) + public static function importFeed(Feed\AbstractFeed $feed) { $dom = $feed->getDOM()->ownerDocument; $type = self::detectType($dom); self::_registerCoreExtensions(); if (substr($type, 0, 3) == 'rss') { - $reader = new Zend_Feed_Reader_Feed_Rss($dom, $type); + $reader = new Feed\RSS($dom, $type); } else { - $reader = new Zend_Feed_Reader_Feed_Atom($dom, $type); + $reader = new Feed\Atom\Atom($dom, $type); } return $reader; @@ -294,12 +301,12 @@ public static function importFeed(Zend_Feed_Abstract $feed) * Import a feed froma string * * @param string $string - * @return Zend_Feed_Reader_FeedInterface + * @return \Zend\Feed\Reader\FeedInterface */ public static function importString($string) { $libxml_errflag = libxml_use_internal_errors(true); - $dom = new DOMDocument; + $dom = new \DOMDocument; $status = $dom->loadXML($string); libxml_use_internal_errors($libxml_errflag); @@ -312,7 +319,7 @@ public static function importString($string) $errormsg = "DOMDocument cannot parse XML: Please check the XML document's validity"; } - throw new Zend_Feed_Exception($errormsg); + throw new \Zend\Feed\Exception($errormsg); } $type = self::detectType($dom); @@ -320,13 +327,13 @@ public static function importString($string) self::_registerCoreExtensions(); if (substr($type, 0, 3) == 'rss') { - $reader = new Zend_Feed_Reader_Feed_Rss($dom, $type); + $reader = new Feed\RSS($dom, $type); } elseif (substr($type, 8, 5) == 'entry') { - $reader = new Zend_Feed_Reader_Entry_Atom($dom->documentElement, 0, self::TYPE_ATOM_10); + $reader = new Entry\Atom($dom->documentElement, 0, self::TYPE_ATOM_10); } elseif (substr($type, 0, 4) == 'atom') { - $reader = new Zend_Feed_Reader_Feed_Atom($dom, $type); + $reader = new Feed\Atom\Atom($dom, $type); } else { - throw new Zend_Feed_Exception('The URI used does not point to a ' + 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; @@ -336,8 +343,8 @@ public static function importString($string) * Imports a feed from a file located at $filename. * * @param string $filename - * @throws Zend_Feed_Exception - * @return Zend_Feed_Reader_FeedInterface + * @throws \Zend\Feed\Exception + * @return \Zend\Feed\Reader\FeedInterface */ public static function importFile($filename) { @@ -345,7 +352,7 @@ public static function importFile($filename) $feed = @file_get_contents($filename); @ini_restore('track_errors'); if ($feed === false) { - throw new Zend_Feed_Exception("File could not be loaded: $php_errormsg"); + throw new \Zend\Feed\Exception("File could not be loaded: $php_errormsg"); } return self::importString($feed); } @@ -357,11 +364,11 @@ public static function findFeedLinks($uri) $client->setUri($uri); $response = $client->request(); if ($response->getStatus() !== 200) { - throw new Zend_Feed_Exception("Failed to access $uri, got response code " . $response->getStatus()); + throw new \Zend\Feed\Exception("Failed to access $uri, got response code " . $response->getStatus()); } $responseHtml = $response->getBody(); $libxml_errflag = libxml_use_internal_errors(true); - $dom = new DOMDocument; + $dom = new \DOMDocument; $status = $dom->loadHTML($responseHtml); libxml_use_internal_errors($libxml_errflag); if (!$status) { @@ -373,9 +380,9 @@ public static function findFeedLinks($uri) $errormsg = "DOMDocument cannot parse HTML: Please check the XML document's validity"; } - throw new Zend_Feed_Exception($errormsg); + throw new \Zend\Feed\Exception($errormsg); } - $feedSet = new Zend_Feed_Reader_FeedSet; + $feedSet = new FeedSet; $links = $dom->getElementsByTagName('link'); $feedSet->addLinks($links, $uri); return $feedSet; @@ -384,18 +391,18 @@ public static function findFeedLinks($uri) /** * Detect the feed type of the provided feed * - * @param Zend_Feed_Abstract|DOMDocument|string $feed + * @param \Zend\Feed\AbstractFeed|DOMDocument|string $feed * @return string */ public static function detectType($feed, $specOnly = false) { - if ($feed instanceof Zend_Feed_Reader_FeedInterface) { + if ($feed instanceof FeedInterface) { $dom = $feed->getDomDocument(); - } elseif($feed instanceof DOMDocument) { + } elseif($feed instanceof \DOMDocument) { $dom = $feed; } elseif(is_string($feed) && !empty($feed)) { @ini_set('track_errors', 1); - $dom = new DOMDocument; + $dom = new \DOMDocument; $status = @$doc->loadXML($string); @ini_restore('track_errors'); if (!$status) { @@ -406,13 +413,13 @@ public static function detectType($feed, $specOnly = false) $php_errormsg = '(error message not available)'; } } - throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg"); + throw new \Zend\Feed\Exception("DOMDocument cannot parse XML: $php_errormsg"); } } else { - throw new Zend_Feed_Exception('Invalid object/scalar provided: must' + throw new \Zend\Feed\Exception('Invalid object/scalar provided: must' . ' be of type Zend_Feed_Reader_FeedInterface, DomDocument or string'); } - $xpath = new DOMXPath($dom); + $xpath = new \DOMXPath($dom); if ($xpath->query('/rss')->length) { $type = self::TYPE_RSS_ANY; @@ -496,9 +503,9 @@ public static function detectType($feed, $specOnly = false) /** * Set plugin loader for use with Extensions * - * @param Zend_Loader_PluginLoader_Interface $loader + * @param \Zend\Loader\PluginLoader\PluginLoaderInterface $loader */ - public static function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader) + public static function setPluginLoader(PluginLoader\PluginLoaderInterface $loader) { self::$_pluginLoader = $loader; } @@ -506,13 +513,13 @@ public static function setPluginLoader(Zend_Loader_PluginLoader_Interface $loade /** * Get plugin loader for use with Extensions * - * @return Zend_Loader_PluginLoader_Interface $loader + * @return \Zend\Loader\PluginLoader\PluginLoaderInterface $loader */ public static function getPluginLoader() { if (!isset(self::$_pluginLoader)) { - self::$_pluginLoader = new Zend_Loader_PluginLoader(array( - 'Zend_Feed_Reader_Extension_' => 'Zend/Feed/Reader/Extension/', + self::$_pluginLoader = new PluginLoader\PluginLoader(array( + 'Zend\Feed\Reader\Extension\\' => 'Zend/Feed/Reader/Extension/', )); } return self::$_pluginLoader; @@ -527,7 +534,7 @@ public static function getPluginLoader() */ public static function addPrefixPath($prefix, $path) { - $prefix = rtrim($prefix, '_'); + $prefix = rtrim($prefix, '\\'); $path = rtrim($path, DIRECTORY_SEPARATOR); self::getPluginLoader()->addPrefixPath($prefix, $path); } @@ -555,12 +562,12 @@ public static function addPrefixPaths(array $spec) * * @param string $name * @return void - * @throws Zend_Feed_Exception if unable to resolve Extension class + * @throws \Zend\Feed\Exception if unable to resolve Extension class */ public static function registerExtension($name) { - $feedName = $name . '_Feed'; - $entryName = $name . '_Entry'; + $feedName = $name . '\Feed'; + $entryName = $name . '\Entry'; if (self::isRegistered($name)) { if (self::getPluginLoader()->isLoaded($feedName) || self::getPluginLoader()->isLoaded($entryName)) { @@ -570,17 +577,17 @@ public static function registerExtension($name) try { self::getPluginLoader()->load($feedName); self::$_extensions['feed'][] = $feedName; - } catch (Zend_Loader_PluginLoader_Exception $e) { + } catch (PluginLoader\Exception $e) { } try { self::getPluginLoader()->load($entryName); self::$_extensions['entry'][] = $entryName; - } catch (Zend_Loader_PluginLoader_Exception $e) { + } catch (PluginLoader\Exception $e) { } if (!self::getPluginLoader()->isLoaded($feedName) && !self::getPluginLoader()->isLoaded($entryName) ) { - throw new Zend_Feed_Exception('Could not load extension: ' . $name + throw new \Zend\Feed\Exception('Could not load extension: ' . $name . 'using Plugin Loader. Check prefix paths are configured and extension exists.'); } } @@ -593,8 +600,8 @@ public static function registerExtension($name) */ public static function isRegistered($extensionName) { - $feedName = $extensionName . '_Feed'; - $entryName = $extensionName . '_Entry'; + $feedName = $extensionName . '\Feed'; + $entryName = $extensionName . '\Entry'; if (in_array($feedName, self::$_extensions['feed']) || in_array($entryName, self::$_extensions['entry']) ) { diff --git a/src/Rss.php b/src/Rss.php index 1c09d6b9..deb809e1 100644 --- a/src/Rss.php +++ b/src/Rss.php @@ -19,6 +19,11 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed; + /** * RSS channel class * @@ -29,22 +34,22 @@ * RSS-formatted data instead of Atom. * * @uses DOMDocument - * @uses Zend_Feed_Abstract - * @uses Zend_Feed_Entry_Rss - * @uses Zend_Feed_Exception + * @uses \Zend\Feed\AbstractFeed + * @uses \Zend\Feed\Entry\RSS + * @uses \Zend\Feed\Exception * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Rss extends Zend_Feed_Abstract +class RSS extends AbstractFeed { /** * The classname for individual channel elements. * * @var string */ - protected $_entryClassName = 'Zend_Feed_Entry_Rss'; + protected $_entryClassName = 'Zend\Feed\Entry\RSS'; /** * The element name for individual channel elements (RSS s). @@ -64,7 +69,7 @@ class Zend_Feed_Rss extends Zend_Feed_Abstract * Override Zend_Feed_Abstract to set up the $_element and $_entries aliases. * * @return void - * @throws Zend_Feed_Exception + * @throws \Zend\Feed\Exception */ public function __wakeup() { @@ -78,7 +83,7 @@ public function __wakeup() $this->_element = $this->_element->getElementsByTagName('channel')->item(0); } if (!$this->_element) { - throw new Zend_Feed_Exception('No root element found, cannot parse channel.'); + throw new Exception('No root element found, cannot parse channel.'); } // Find the entries and save a pointer to them for speed and @@ -251,7 +256,7 @@ protected function _mapFeedHeaders($array) * @param array $array * @return void */ - private function _buildiTunes(DOMElement $root, $array) + private function _buildiTunes(\DOMElement $root, $array) { /* author node */ $author = ''; @@ -377,9 +382,9 @@ private function _buildiTunes(DOMElement $root, $array) * @param array $array the data to use * @return void */ - protected function _mapFeedEntries(DOMElement $root, $array) + protected function _mapFeedEntries(\DOMElement $root, $array) { - Zend_Feed::registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/'); + Feed::registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/'); foreach ($array as $dataentry) { $item = $this->_element->createElement('item'); @@ -398,9 +403,9 @@ protected function _mapFeedEntries(DOMElement $root, $array) if (isset($dataentry->guid)) { $guid = $this->_element->createElement('guid', $dataentry->guid); - if (!Zend_Uri::check($dataentry->guid)) { + //if (!\Zend\Uri\Uri::check($dataentry->guid)) { $guid->setAttribute('isPermaLink', 'false'); - } + //} $item->appendChild($guid); } @@ -472,7 +477,7 @@ protected function _mapFeedEntries(DOMElement $root, $array) public function saveXml() { // Return a complete document including XML prologue. - $doc = new DOMDocument($this->_element->ownerDocument->version, + $doc = new \DOMDocument($this->_element->ownerDocument->version, $this->_element->ownerDocument->actualEncoding); $root = $doc->createElement('rss'); @@ -496,12 +501,12 @@ public function saveXml() * Send feed to a http client with the correct header * * @return void - * @throws Zend_Feed_Exception if headers have already been sent + * @throws \Zend\Feed\Exception if headers have already been sent */ public function send() { if (headers_sent()) { - throw new Zend_Feed_Exception('Cannot send RSS because headers have already been sent.'); + throw new Exception('Cannot send RSS because headers have already been sent.'); } header('Content-Type: application/rss+xml; charset=' . $this->_element->ownerDocument->actualEncoding); diff --git a/src/Writer/Deleted.php b/src/Writer/Deleted.php index f6cb07f2..df7b5140 100644 --- a/src/Writer/Deleted.php +++ b/src/Writer/Deleted.php @@ -20,15 +20,22 @@ */ /** - * @uses Zend_Date - * @uses Zend_Feed_Exception - * @uses Zend_Uri + * @namespace + */ +namespace Zend\Feed\Writer; +use Zend\Feed; +use Zend\Date; + +/** + * @uses \Zend\Date\Date + * @uses \Zend\Feed\Exception + * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Deleted +class Deleted { /** @@ -54,7 +61,7 @@ class Zend_Feed_Writer_Deleted public function setEncoding($encoding) { if (empty($encoding) || !is_string($encoding)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['encoding'] = $encoding; } @@ -109,7 +116,7 @@ public function getType() public function setReference($reference) { if (empty($reference) || !is_string($reference)) { - throw new Zend_Feed_Exception('Invalid parameter: reference must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: reference must be a non-empty string'); } $this->_data['reference'] = $reference; } @@ -126,13 +133,13 @@ public function setWhen($date = null) { $zdate = null; if (is_null($date)) { - $zdate = new Zend_Date; + $zdate = new Date\Date; } elseif (ctype_digit($date) && strlen($date) == 10) { - $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); - } elseif ($date instanceof Zend_Date) { + $zdate = new Date\Date($date, Date\Date::TIMESTAMP); + } elseif ($date instanceof Date\Date) { $zdate = $date; } else { - throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + throw new Feed\Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['when'] = $zdate; } @@ -152,21 +159,21 @@ public function setBy(array $by) || empty($by['name']) || !is_string($by['name']) ) { - throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); + throw new Feed\Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); } $author['name'] = $by['name']; if (isset($by['email'])) { if (empty($by['email']) || !is_string($by['email'])) { - throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: "email" array value must be a non-empty string'); } $author['email'] = $by['email']; } if (isset($by['uri'])) { if (empty($by['uri']) || !is_string($by['uri']) - || !Zend_Uri::check($by['uri']) + || !\Zend\URI\URL::validate($by['uri']) ) { - throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); + throw new Feed\Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $by['uri']; } diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index a17ada1d..541fcd81 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -20,17 +20,25 @@ */ /** - * @uses Zend_Date - * @uses Zend_Feed_Exception - * @uses Zend_Feed_Writer - * @uses Zend_Feed_Writer_Source - * @uses Zend_Uri + * @namespace + */ +namespace Zend\Feed\Writer; +use Zend\Feed; +use Zend\URI; +use Zend\Date; + +/** + * @uses \Zend\Date\Date + * @uses \Zend\Feed\Exception + * @uses \Zend\Feed\Writer\Writer + * @uses \Zend\Feed\Writer\Source + * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Entry +class Entry { /** @@ -63,7 +71,7 @@ class Zend_Feed_Writer_Entry */ public function __construct() { - Zend_Feed_Writer::registerCoreExtensions(); + Writer::registerCoreExtensions(); $this->_loadExtensions(); } @@ -81,21 +89,21 @@ public function addAuthor($name, $email = null, $uri = null) || empty($name['name']) || !is_string($name['name']) ) { - throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); + throw new Feed\Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); } $author['name'] = $name['name']; if (isset($name['email'])) { if (empty($name['email']) || !is_string($name['email'])) { - throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: "email" array value must be a non-empty string'); } $author['email'] = $name['email']; } if (isset($name['uri'])) { if (empty($name['uri']) || !is_string($name['uri']) - || !Zend_Uri::check($name['uri']) + || !\Zend\URI\URL::validate($name['uri']) ) { - throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); + throw new Feed\Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $name['uri']; } @@ -105,18 +113,18 @@ public function addAuthor($name, $email = null, $uri = null) */ } else { if (empty($name['name']) || !is_string($name['name'])) { - throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string value'); + throw new Feed\Exception('Invalid parameter: "name" must be a non-empty string value'); } $author['name'] = $name; if (isset($email)) { if (empty($email) || !is_string($email)) { - throw new Zend_Feed_Exception('Invalid parameter: "email" value must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: "email" value must be a non-empty string'); } $author['email'] = $email; } if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { - throw new Zend_Feed_Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); + if (empty($uri) || !is_string($uri) || !\Zend\URI\URL::validate($uri)) { + throw new Feed\Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $uri; } @@ -144,7 +152,7 @@ public function addAuthors(array $authors) public function setEncoding($encoding) { if (empty($encoding) || !is_string($encoding)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['encoding'] = $encoding; } @@ -170,7 +178,7 @@ public function getEncoding() public function setCopyright($copyright) { if (empty($copyright) || !is_string($copyright)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['copyright'] = $copyright; } @@ -183,7 +191,7 @@ public function setCopyright($copyright) public function setContent($content) { if (empty($content) || !is_string($content)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['content'] = $content; } @@ -197,13 +205,13 @@ public function setDateCreated($date = null) { $zdate = null; if (is_null($date)) { - $zdate = new Zend_Date; + $zdate = new Date\Date; } elseif (ctype_digit($date) && strlen($date) == 10) { - $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); - } elseif ($date instanceof Zend_Date) { + $zdate = new Date\Date($date, Date\Date::TIMESTAMP); + } elseif ($date instanceof Date\Date) { $zdate = $date; } else { - throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + throw new Feed\Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateCreated'] = $zdate; } @@ -217,13 +225,13 @@ public function setDateModified($date = null) { $zdate = null; if (is_null($date)) { - $zdate = new Zend_Date; + $zdate = new Date\Date; } elseif (ctype_digit($date) && strlen($date) == 10) { - $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); - } elseif ($date instanceof Zend_Date) { + $zdate = new Date\Date($date, Date\Date::TIMESTAMP); + } elseif ($date instanceof Date\Date) { $zdate = $date; } else { - throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + throw new Feed\Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateModified'] = $zdate; } @@ -236,7 +244,7 @@ public function setDateModified($date = null) public function setDescription($description) { if (empty($description) || !is_string($description)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['description'] = $description; } @@ -249,7 +257,7 @@ public function setDescription($description) public function setId($id) { if (empty($id) || !is_string($id)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['id'] = $id; } @@ -261,8 +269,8 @@ public function setId($id) */ public function setLink($link) { - if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + if (empty($link) || !is_string($link) || !\Zend\URI\URL::validate($link)) { + throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['link'] = $link; } @@ -275,7 +283,7 @@ public function setLink($link) public function setCommentCount($count) { if (empty($count) || !is_numeric($count) || (int) $count < 0) { - throw new Zend_Feed_Exception('Invalid parameter: "count" must be a non-empty integer number'); + throw new Feed\Exception('Invalid parameter: "count" must be a non-empty integer number'); } $this->_data['commentCount'] = (int) $count; } @@ -287,8 +295,8 @@ public function setCommentCount($count) */ public function setCommentLink($link) { - if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { - throw new Zend_Feed_Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); + if (empty($link) || !is_string($link) || !\Zend\URI\URL::validate($link)) { + throw new Feed\Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); } $this->_data['commentLink'] = $link; } @@ -300,11 +308,11 @@ public function setCommentLink($link) */ public function setCommentFeedLink(array $link) { - if (!isset($link['uri']) || !is_string($link['uri']) || !Zend_Uri::check($link['uri'])) { - throw new Zend_Feed_Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); + if (!isset($link['uri']) || !is_string($link['uri']) || !\Zend\URI\URL::validate($link['uri'])) { + throw new Feed\Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); } if (!isset($link['type']) || !in_array($link['type'], array('atom', 'rss', 'rdf'))) { - throw new Zend_Feed_Exception('Invalid parameter: "type" must be one' + throw new Feed\Exception('Invalid parameter: "type" must be one' . ' of "atom", "rss" or "rdf"'); } if (!isset($this->_data['commentFeedLinks'])) { @@ -335,7 +343,7 @@ public function setCommentFeedLinks(array $links) public function setTitle($title) { if (empty($title) || !is_string($title)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['title'] = $title; } @@ -519,16 +527,16 @@ public function getCommentFeedLinks() public function addCategory(array $category) { if (!isset($category['term'])) { - throw new Zend_Feed_Exception('Each category must be an array and ' + throw new Feed\Exception('Each category must be an array and ' . 'contain at least a "term" element containing the machine ' . ' readable category name'); } if (isset($category['scheme'])) { if (empty($category['scheme']) || !is_string($category['scheme']) - || !Zend_Uri::check($category['scheme']) + || !\Zend\URI\URL::validate($category['scheme']) ) { - throw new Zend_Feed_Exception('The Atom scheme or RSS domain of' + throw new Feed\Exception('The Atom scheme or RSS domain of' . ' a category must be a valid URI'); } } @@ -571,19 +579,19 @@ public function getCategories() public function setEnclosure(array $enclosure) { if (!isset($enclosure['type'])) { - throw new Zend_Feed_Exception('Enclosure "type" is not set'); + throw new Feed\Exception('Enclosure "type" is not set'); } if (!isset($enclosure['length'])) { - throw new Zend_Feed_Exception('Enclosure "length" is not set'); + throw new Feed\Exception('Enclosure "length" is not set'); } if (!isset($enclosure['uri'])) { - throw new Zend_Feed_Exception('Enclosure "uri" is not set'); + throw new Feed\Exception('Enclosure "uri" is not set'); } - if (!Zend_Uri::check($enclosure['uri'])) { - throw new Zend_Feed_Exception('Enclosure "uri" is not a valid URI/IRI'); + if (!\Zend\URI\URL::validate($enclosure['uri'])) { + throw new Feed\Exception('Enclosure "uri" is not a valid URI/IRI'); } if ((int) $enclosure['length'] <= 0) { - throw new Zend_Feed_Exception('Enclosure "length" must be an integer' + throw new Feed\Exception('Enclosure "length" must be an integer' . ' indicating the content\'s length in bytes'); } $this->_data['enclosure'] = $enclosure; @@ -666,17 +674,17 @@ public function getType() * @param string $method * @param array $args * @return mixed - * @throws Zend_Feed_Exception if no extensions implements the method + * @throws \Zend\Feed\Exception if no extensions implements the method */ public function __call($method, $args) { foreach ($this->_extensions as $extension) { try { return call_user_func_array(array($extension, $method), $args); - } catch (Zend_Feed_Writer_Exception_InvalidMethodException $e) { + } catch (Exception\InvalidMethodException $e) { } } - throw new Zend_Feed_Exception('Method: ' . $method + throw new Feed\Exception('Method: ' . $method . ' does not exist and could not be located on a registered Extension'); } @@ -685,11 +693,11 @@ public function __call($method, $args) * added to the current feed automatically, but is necessary to create a * container with some initial values preset based on the current feed data. * - * @return Zend_Feed_Writer_Source + * @return \Zend\Feed\Writer\Source */ public function createSource() { - $source = new Zend_Feed_Writer_Source; + $source = new Source; if ($this->getEncoding()) { $source->setEncoding($this->getEncoding()); } @@ -701,15 +709,15 @@ public function createSource() * Appends a Zend_Feed_Writer_Entry object representing a new entry/item * the feed data container's internal group of entries. * - * @param Zend_Feed_Writer_Source $source + * @param \Zend\Feed\Writer\Source $source */ - public function setSource(Zend_Feed_Writer_Source $source) + public function setSource(Source $source) { $this->_data['source'] = $source; } /** - * @return Zend_Feed_Writer_Source + * @return \Zend\Feed\Writer\Source */ public function getSource() { @@ -726,10 +734,10 @@ public function getSource() */ protected function _loadExtensions() { - $all = Zend_Feed_Writer::getExtensions(); + $all = Writer::getExtensions(); $exts = $all['entry']; foreach ($exts as $ext) { - $className = Zend_Feed_Writer::getPluginLoader()->getClassName($ext); + $className = Writer::getPluginLoader()->getClassName($ext); $this->_extensions[$ext] = new $className(); $this->_extensions[$ext]->setEncoding($this->getEncoding()); } diff --git a/src/Writer/Exception/InvalidMethodException.php b/src/Writer/Exception/InvalidMethodException.php index 94c5322e..ff301762 100644 --- a/src/Writer/Exception/InvalidMethodException.php +++ b/src/Writer/Exception/InvalidMethodException.php @@ -20,16 +20,21 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Writer\Exception; + /** * Feed exceptions * * Class to represent exceptions that occur during Feed operations. * - * @uses Zend_Feed_Exception + * @uses \Zend\Feed\Exception * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Exception_InvalidMethodException extends Zend_Exception +class InvalidMethodException extends \Zend\Exception {} diff --git a/src/Writer/Extension/Atom/Renderer/Feed.php b/src/Writer/Extension/Atom/Renderer/Feed.php index ca0a9277..6574177c 100644 --- a/src/Writer/Extension/Atom/Renderer/Feed.php +++ b/src/Writer/Extension/Atom/Renderer/Feed.php @@ -18,16 +18,21 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ - + +/** + * @namespace + */ +namespace Zend\Feed\Writer\Extension\Atom\Renderer; + /** - * @uses Zend_Feed_Writer_Extension_RendererAbstract + * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Extension_Atom_Renderer_Feed - extends Zend_Feed_Writer_Extension_RendererAbstract +class Feed + extends \Zend\Feed\Writer\Extension\RendererAbstract { /** @@ -78,7 +83,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) + protected function _setFeedLinks(\DOMDocument $dom, \DOMElement $root) { $flinks = $this->getDataContainer()->getFeedLinks(); if(!$flinks || empty($flinks)) { @@ -102,7 +107,7 @@ protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setHubs(DOMDocument $dom, DOMElement $root) + protected function _setHubs(\DOMDocument $dom, \DOMElement $root) { $hubs = $this->getDataContainer()->getHubs(); if (!$hubs || empty($hubs)) { diff --git a/src/Writer/Extension/Content/Renderer/Entry.php b/src/Writer/Extension/Content/Renderer/Entry.php index 4fe8490d..c559b635 100644 --- a/src/Writer/Extension/Content/Renderer/Entry.php +++ b/src/Writer/Extension/Content/Renderer/Entry.php @@ -18,16 +18,21 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ - + +/** + * @namespace + */ +namespace Zend\Feed\Writer\Extension\Content\Renderer; + /** - * @uses Zend_Feed_Writer_Extension_RendererAbstract + * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Extension_Content_Renderer_Entry - extends Zend_Feed_Writer_Extension_RendererAbstract +class Entry + extends \Zend\Feed\Writer\Extension\RendererAbstract { /** @@ -73,7 +78,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setContent(DOMDocument $dom, DOMElement $root) + protected function _setContent(\DOMDocument $dom, \DOMElement $root) { $content = $this->getDataContainer()->getContent(); if (!$content) { diff --git a/src/Writer/Extension/DublinCore/Renderer/Entry.php b/src/Writer/Extension/DublinCore/Renderer/Entry.php index 2d212e90..f2484e05 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Entry.php +++ b/src/Writer/Extension/DublinCore/Renderer/Entry.php @@ -18,16 +18,21 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ - + +/** + * @namespace + */ +namespace Zend\Feed\Writer\Extension\DublinCore\Renderer; + /** - * @uses Zend_Feed_Writer_Extension_RendererAbstract + * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Extension_DublinCore_Renderer_Entry - extends Zend_Feed_Writer_Extension_RendererAbstract +class Entry + extends \Zend\Feed\Writer\Extension\RendererAbstract { /** @@ -73,7 +78,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setAuthors(DOMDocument $dom, DOMElement $root) + protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) { $authors = $this->getDataContainer()->getAuthors(); if (!$authors || empty($authors)) { diff --git a/src/Writer/Extension/DublinCore/Renderer/Feed.php b/src/Writer/Extension/DublinCore/Renderer/Feed.php index 8816fa8c..c3a41473 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Feed.php +++ b/src/Writer/Extension/DublinCore/Renderer/Feed.php @@ -18,16 +18,21 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ - + +/** + * @namespace + */ +namespace Zend\Feed\Writer\Extension\DublinCore\Renderer; + /** - * @uses Zend_Feed_Writer_Extension_RendererAbstract + * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Extension_DublinCore_Renderer_Feed - extends Zend_Feed_Writer_Extension_RendererAbstract +class Feed + extends \Zend\Feed\Writer\Extension\RendererAbstract { /** @@ -73,7 +78,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setAuthors(DOMDocument $dom, DOMElement $root) + protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) { $authors = $this->getDataContainer()->getAuthors(); if (!$authors || empty($authors)) { diff --git a/src/Writer/Extension/ITunes/Entry.php b/src/Writer/Extension/ITunes/Entry.php index 360a429e..bac16703 100644 --- a/src/Writer/Extension/ITunes/Entry.php +++ b/src/Writer/Extension/ITunes/Entry.php @@ -18,17 +18,23 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ - + /** - * @uses Zend_Feed_Exception - * @uses Zend_Feed_Writer - * @uses Zend_Feed_Writer_Exception_InvalidMethodException + * @namespace + */ +namespace Zend\Feed\Writer\Extension\ITunes; + + +/** + * @uses \Zend\Feed\Exception + * @uses \Zend\Feed\Writer\Writer + * @uses \Zend\Feed\Writer\Exception\InvalidMethodException * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Extension_ITunes_Entry +class Entry { /** * Array of Feed data for rendering by Extension's renderers @@ -48,7 +54,7 @@ class Zend_Feed_Writer_Extension_ITunes_Entry * Set feed encoding * * @param string $enc - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return \Zend\Feed\Writer\Extension\ITunes\Entry */ public function setEncoding($enc) { @@ -70,16 +76,16 @@ public function getEncoding() * Set a block value of "yes" or "no". You may also set an empty string. * * @param string - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return \Zend\Feed\Writer\Extension\ITunes\Entry */ public function setItunesBlock($value) { if (!ctype_alpha($value) && strlen($value) > 0) { - throw new Zend_Feed_Exception('invalid parameter: "block" may only' + throw new \Zend\Feed\Exception('invalid parameter: "block" may only' . ' contain alphabetic characters'); } if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: "block" may only' + throw new \Zend\Feed\Exception('invalid parameter: "block" may only' . ' contain a maximum of 255 characters'); } $this->_data['block'] = $value; @@ -89,7 +95,7 @@ public function setItunesBlock($value) * Add authors to itunes entry * * @param array $values - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return \Zend\Feed\Writer\Extension\ITunes\Entry */ public function addItunesAuthors(array $values) { @@ -103,12 +109,12 @@ public function addItunesAuthors(array $values) * Add author to itunes entry * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return \Zend\Feed\Writer\Extension\ITunes\Entry */ public function addItunesAuthor($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: any "author" may only' + throw new \Zend\Feed\Exception('invalid parameter: any "author" may only' . ' contain a maximum of 255 characters each'); } if (!isset($this->_data['authors'])) { @@ -122,7 +128,7 @@ public function addItunesAuthor($value) * Set duration * * @param int $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return \Zend\Feed\Writer\Extension\ITunes\Entry */ public function setItunesDuration($value) { @@ -131,7 +137,7 @@ public function setItunesDuration($value) && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value) ) { - throw new Zend_Feed_Exception('invalid parameter: "duration" may only' + throw new \Zend\Feed\Exception('invalid parameter: "duration" may only' . ' be of a specified [[HH:]MM:]SS format'); } $this->_data['duration'] = $value; @@ -142,12 +148,12 @@ public function setItunesDuration($value) * Set "explicit" flag * * @param bool $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return \Zend\Feed\Writer\Extension\ITunes\Entry */ public function setItunesExplicit($value) { if (!in_array($value, array('yes','no','clean'))) { - throw new Zend_Feed_Exception('invalid parameter: "explicit" may only' + throw new \Zend\Feed\Exception('invalid parameter: "explicit" may only' . ' be one of "yes", "no" or "clean"'); } $this->_data['explicit'] = $value; @@ -158,17 +164,17 @@ public function setItunesExplicit($value) * Set keywords * * @param array $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return \Zend\Feed\Writer\Extension\ITunes\Entry */ public function setItunesKeywords(array $value) { if (count($value) > 12) { - throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' + throw new \Zend\Feed\Exception('invalid parameter: "keywords" may only' . ' contain a maximum of 12 terms'); } $concat = implode(',', $value); if (iconv_strlen($concat, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' + throw new \Zend\Feed\Exception('invalid parameter: "keywords" may only' . ' have a concatenated length of 255 chars where terms are delimited' . ' by a comma'); } @@ -180,12 +186,12 @@ public function setItunesKeywords(array $value) * Set subtitle * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return \Zend\Feed\Writer\Extension\ITunes\Entry */ public function setItunesSubtitle($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: "subtitle" may only' + throw new \Zend\Feed\Exception('invalid parameter: "subtitle" may only' . ' contain a maximum of 255 characters'); } $this->_data['subtitle'] = $value; @@ -196,12 +202,12 @@ public function setItunesSubtitle($value) * Set summary * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return \Zend\Feed\Writer\Extension\ITunes\Entry */ public function setItunesSummary($value) { if (iconv_strlen($value, $this->getEncoding()) > 4000) { - throw new Zend_Feed_Exception('invalid parameter: "summary" may only' + throw new \Zend\Feed\Exception('invalid parameter: "summary" may only' . ' contain a maximum of 4000 characters'); } $this->_data['summary'] = $value; @@ -217,11 +223,11 @@ public function setItunesSummary($value) */ public function __call($method, array $params) { - $point = Zend_Feed_Writer::lcfirst(substr($method, 9)); + $point = \Zend\Feed\Writer\Writer::lcfirst(substr($method, 9)); if (!method_exists($this, 'setItunes' . ucfirst($point)) && !method_exists($this, 'addItunes' . ucfirst($point)) ) { - throw new Zend_Feed_Writer_Exception_InvalidMethodException( + throw new \Zend\Feed\Writer\Exception\InvalidMethodException( 'invalid method: ' . $method ); } diff --git a/src/Writer/Extension/ITunes/Feed.php b/src/Writer/Extension/ITunes/Feed.php index aa82003d..4624fdb7 100644 --- a/src/Writer/Extension/ITunes/Feed.php +++ b/src/Writer/Extension/ITunes/Feed.php @@ -18,18 +18,24 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ - + /** - * @uses Zend_Feed_Exception - * @uses Zend_Feed_Writer - * @uses Zend_Feed_Writer_Exception_InvalidMethodException - * @uses Zend_Uri + * @namespace + */ +namespace Zend\Feed\Writer\Extension\ITunes; +use Zend\URI; + +/** + * @uses \Zend\Feed\Exception + * @uses \Zend\Feed\Writer\Writer + * @uses \Zend\Feed\Writer\Exception\InvalidMethodException + * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Extension_ITunes_Feed +class Feed { /** * Array of Feed data for rendering by Extension's renderers @@ -49,7 +55,7 @@ class Zend_Feed_Writer_Extension_ITunes_Feed * Set feed encoding * * @param string $enc - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return \Zend\Feed\Writer\Extension\ITunes\Feed */ public function setEncoding($enc) { @@ -71,16 +77,16 @@ public function getEncoding() * Set a block value of "yes" or "no". You may also set an empty string. * * @param string - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return \Zend\Feed\Writer\Extension\ITunes\Feed */ public function setItunesBlock($value) { if (!ctype_alpha($value) && strlen($value) > 0) { - throw new Zend_Feed_Exception('invalid parameter: "block" may only' + throw new \Zend\Feed\Exception('invalid parameter: "block" may only' . ' contain alphabetic characters'); } if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: "block" may only' + throw new \Zend\Feed\Exception('invalid parameter: "block" may only' . ' contain a maximum of 255 characters'); } $this->_data['block'] = $value; @@ -91,7 +97,7 @@ public function setItunesBlock($value) * Add feed authors * * @param array $values - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return \Zend\Feed\Writer\Extension\ITunes\Feed */ public function addItunesAuthors(array $values) { @@ -105,12 +111,12 @@ public function addItunesAuthors(array $values) * Add feed author * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return \Zend\Feed\Writer\Extension\ITunes\Feed */ public function addItunesAuthor($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: any "author" may only' + throw new \Zend\Feed\Exception('invalid parameter: any "author" may only' . ' contain a maximum of 255 characters each'); } if (!isset($this->_data['authors'])) { @@ -124,7 +130,7 @@ public function addItunesAuthor($value) * Set feed categories * * @param array $values - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return \Zend\Feed\Writer\Extension\ITunes\Feed */ public function setItunesCategories(array $values) { @@ -134,19 +140,19 @@ public function setItunesCategories(array $values) foreach ($values as $key=>$value) { if (!is_array($value)) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: any "category" may only' + throw new \Zend\Feed\Exception('invalid parameter: any "category" may only' . ' contain a maximum of 255 characters each'); } $this->_data['categories'][] = $value; } else { if (iconv_strlen($key, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: any "category" may only' + throw new \Zend\Feed\Exception('invalid parameter: any "category" may only' . ' contain a maximum of 255 characters each'); } $this->_data['categories'][$key] = array(); foreach ($value as $val) { if (iconv_strlen($val, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: any "category" may only' + throw new \Zend\Feed\Exception('invalid parameter: any "category" may only' . ' contain a maximum of 255 characters each'); } $this->_data['categories'][$key][] = $val; @@ -160,16 +166,16 @@ public function setItunesCategories(array $values) * Set feed image (icon) * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return \Zend\Feed\Writer\Extension\ITunes\Feed */ public function setItunesImage($value) { - if (!Zend_Uri::check($value)) { - throw new Zend_Feed_Exception('invalid parameter: "image" may only' + if (!\Zend\URI\URL::validate($value)) { + throw new \Zend\Feed\Exception('invalid parameter: "image" may only' . ' be a valid URI/IRI'); } if (!in_array(substr($value, -3), array('jpg','png'))) { - throw new Zend_Feed_Exception('invalid parameter: "image" may only' + throw new \Zend\Feed\Exception('invalid parameter: "image" may only' . ' use file extension "jpg" or "png" which must be the last three' . ' characters of the URI (i.e. no query string or fragment)'); } @@ -181,16 +187,16 @@ public function setItunesImage($value) * Set feed cumulative duration * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return \Zend\Feed\Writer\Extension\ITunes\Feed */ public function setItunesDuration($value) { $value = (string) $value; if (!ctype_digit($value) - && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) - && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value) + && !preg_match('/^\d+:[0-5]{1}[0-9]{1}$/', $value) + && !preg_match('/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/', $value) ) { - throw new Zend_Feed_Exception('invalid parameter: "duration" may only' + throw new \Zend\Feed\Exception('invalid parameter: "duration" may only' . ' be of a specified [[HH:]MM:]SS format'); } $this->_data['duration'] = $value; @@ -201,12 +207,12 @@ public function setItunesDuration($value) * Set "explicit" flag * * @param bool $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return \Zend\Feed\Writer\Extension\ITunes\Feed */ public function setItunesExplicit($value) { if (!in_array($value, array('yes','no','clean'))) { - throw new Zend_Feed_Exception('invalid parameter: "explicit" may only' + throw new \Zend\Feed\Exception('invalid parameter: "explicit" may only' . ' be one of "yes", "no" or "clean"'); } $this->_data['explicit'] = $value; @@ -217,17 +223,17 @@ public function setItunesExplicit($value) * Set feed keywords * * @param array $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return \Zend\Feed\Writer\Extension\ITunes\Feed */ public function setItunesKeywords(array $value) { if (count($value) > 12) { - throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' + throw new \Zend\Feed\Exception('invalid parameter: "keywords" may only' . ' contain a maximum of 12 terms'); } $concat = implode(',', $value); if (iconv_strlen($concat, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' + throw new \Zend\Feed\Exception('invalid parameter: "keywords" may only' . ' have a concatenated length of 255 chars where terms are delimited' . ' by a comma'); } @@ -239,12 +245,12 @@ public function setItunesKeywords(array $value) * Set new feed URL * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return \Zend\Feed\Writer\Extension\ITunes\Feed */ public function setItunesNewFeedUrl($value) { - if (!Zend_Uri::check($value)) { - throw new Zend_Feed_Exception('invalid parameter: "newFeedUrl" may only' + if (!\Zend\URI\URL::validate($value)) { + throw new \Zend\Feed\Exception('invalid parameter: "newFeedUrl" may only' . ' be a valid URI/IRI'); } $this->_data['newFeedUrl'] = $value; @@ -255,7 +261,7 @@ public function setItunesNewFeedUrl($value) * Add feed owners * * @param array $values - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return \Zend\Feed\Writer\Extension\ITunes\Feed */ public function addItunesOwners(array $values) { @@ -269,18 +275,18 @@ public function addItunesOwners(array $values) * Add feed owner * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return \Zend\Feed\Writer\Extension\ITunes\Feed */ public function addItunesOwner(array $value) { if (!isset($value['name']) || !isset($value['email'])) { - throw new Zend_Feed_Exception('invalid parameter: any "owner" must' + throw new \Zend\Feed\Exception('invalid parameter: any "owner" must' . ' be an array containing keys "name" and "email"'); } if (iconv_strlen($value['name'], $this->getEncoding()) > 255 || iconv_strlen($value['email'], $this->getEncoding()) > 255 ) { - throw new Zend_Feed_Exception('invalid parameter: any "owner" may only' + throw new \Zend\Feed\Exception('invalid parameter: any "owner" may only' . ' contain a maximum of 255 characters each for "name" and "email"'); } if (!isset($this->_data['owners'])) { @@ -294,12 +300,12 @@ public function addItunesOwner(array $value) * Set feed subtitle * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return \Zend\Feed\Writer\Extension\ITunes\Feed */ public function setItunesSubtitle($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: "subtitle" may only' + throw new \Zend\Feed\Exception('invalid parameter: "subtitle" may only' . ' contain a maximum of 255 characters'); } $this->_data['subtitle'] = $value; @@ -310,12 +316,12 @@ public function setItunesSubtitle($value) * Set feed summary * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return \Zend\Feed\Writer\Extension\ITunes\Feed */ public function setItunesSummary($value) { if (iconv_strlen($value, $this->getEncoding()) > 4000) { - throw new Zend_Feed_Exception('invalid parameter: "summary" may only' + throw new \Zend\Feed\Exception('invalid parameter: "summary" may only' . ' contain a maximum of 4000 characters'); } $this->_data['summary'] = $value; @@ -331,11 +337,11 @@ public function setItunesSummary($value) */ public function __call($method, array $params) { - $point = Zend_Feed_Writer::lcfirst(substr($method, 9)); + $point = \Zend\Feed\Writer\Writer::lcfirst(substr($method, 9)); if (!method_exists($this, 'setItunes' . ucfirst($point)) && !method_exists($this, 'addItunes' . ucfirst($point)) ) { - throw new Zend_Feed_Writer_Exception_InvalidMethodException( + throw new \Zend\Feed\Writer\Exception\InvalidMethodException( 'invalid method: ' . $method ); } diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php index ed6c7fb0..2fd19e79 100644 --- a/src/Writer/Extension/ITunes/Renderer/Entry.php +++ b/src/Writer/Extension/ITunes/Renderer/Entry.php @@ -18,16 +18,21 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ - + +/** + * @namespace + */ +namespace Zend\Feed\Writer\Extension\ITunes\Renderer; + /** - * @uses Zend_Feed_Writer_Extension_RendererAbstract + * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Extension_ITunes_Renderer_Entry - extends Zend_Feed_Writer_Extension_RendererAbstract +class Entry + extends \Zend\Feed\Writer\Extension\RendererAbstract { /** * Set to TRUE if a rendering method actually renders something. This @@ -75,7 +80,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setAuthors(DOMDocument $dom, DOMElement $root) + protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) { $authors = $this->getDataContainer()->getItunesAuthors(); if (!$authors || empty($authors)) { @@ -97,7 +102,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setBlock(DOMDocument $dom, DOMElement $root) + protected function _setBlock(\DOMDocument $dom, \DOMElement $root) { $block = $this->getDataContainer()->getItunesBlock(); if (is_null($block)) { @@ -117,7 +122,7 @@ protected function _setBlock(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDuration(DOMDocument $dom, DOMElement $root) + protected function _setDuration(\DOMDocument $dom, \DOMElement $root) { $duration = $this->getDataContainer()->getItunesDuration(); if (!$duration) { @@ -137,7 +142,7 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setExplicit(DOMDocument $dom, DOMElement $root) + protected function _setExplicit(\DOMDocument $dom, \DOMElement $root) { $explicit = $this->getDataContainer()->getItunesExplicit(); if (is_null($explicit)) { @@ -157,7 +162,7 @@ protected function _setExplicit(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setKeywords(DOMDocument $dom, DOMElement $root) + protected function _setKeywords(\DOMDocument $dom, \DOMElement $root) { $keywords = $this->getDataContainer()->getItunesKeywords(); if (!$keywords || empty($keywords)) { @@ -177,7 +182,7 @@ protected function _setKeywords(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setSubtitle(DOMDocument $dom, DOMElement $root) + protected function _setSubtitle(\DOMDocument $dom, \DOMElement $root) { $subtitle = $this->getDataContainer()->getItunesSubtitle(); if (!$subtitle) { @@ -197,7 +202,7 @@ protected function _setSubtitle(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setSummary(DOMDocument $dom, DOMElement $root) + protected function _setSummary(\DOMDocument $dom, \DOMElement $root) { $summary = $this->getDataContainer()->getItunesSummary(); if (!$summary) { diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php index 16e89d01..9173dfb2 100644 --- a/src/Writer/Extension/ITunes/Renderer/Feed.php +++ b/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -18,16 +18,21 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ - + +/** + * @namespace + */ +namespace Zend\Feed\Writer\Extension\ITunes\Renderer; + /** - * @uses Zend_Feed_Writer_Extension_RendererAbstract + * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Extension_ITunes_Renderer_Feed - extends Zend_Feed_Writer_Extension_RendererAbstract +class Feed + extends \Zend\Feed\Writer\Extension\RendererAbstract { /** @@ -80,7 +85,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setAuthors(DOMDocument $dom, DOMElement $root) + protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) { $authors = $this->getDataContainer()->getItunesAuthors(); if (!$authors || empty($authors)) { @@ -102,7 +107,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setBlock(DOMDocument $dom, DOMElement $root) + protected function _setBlock(\DOMDocument $dom, \DOMElement $root) { $block = $this->getDataContainer()->getItunesBlock(); if (is_null($block)) { @@ -122,7 +127,7 @@ protected function _setBlock(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCategories(DOMDocument $dom, DOMElement $root) + protected function _setCategories(\DOMDocument $dom, \DOMElement $root) { $cats = $this->getDataContainer()->getItunesCategories(); if (!$cats || empty($cats)) { @@ -154,7 +159,7 @@ protected function _setCategories(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setImage(DOMDocument $dom, DOMElement $root) + protected function _setImage(\DOMDocument $dom, \DOMElement $root) { $image = $this->getDataContainer()->getItunesImage(); if (!$image) { @@ -173,7 +178,7 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDuration(DOMDocument $dom, DOMElement $root) + protected function _setDuration(\DOMDocument $dom, \DOMElement $root) { $duration = $this->getDataContainer()->getItunesDuration(); if (!$duration) { @@ -193,7 +198,7 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setExplicit(DOMDocument $dom, DOMElement $root) + protected function _setExplicit(\DOMDocument $dom, \DOMElement $root) { $explicit = $this->getDataContainer()->getItunesExplicit(); if (is_null($explicit)) { @@ -213,7 +218,7 @@ protected function _setExplicit(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setKeywords(DOMDocument $dom, DOMElement $root) + protected function _setKeywords(\DOMDocument $dom, \DOMElement $root) { $keywords = $this->getDataContainer()->getItunesKeywords(); if (!$keywords || empty($keywords)) { @@ -233,7 +238,7 @@ protected function _setKeywords(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setNewFeedUrl(DOMDocument $dom, DOMElement $root) + protected function _setNewFeedUrl(\DOMDocument $dom, \DOMElement $root) { $url = $this->getDataContainer()->getItunesNewFeedUrl(); if (!$url) { @@ -253,7 +258,7 @@ protected function _setNewFeedUrl(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setOwners(DOMDocument $dom, DOMElement $root) + protected function _setOwners(\DOMDocument $dom, \DOMElement $root) { $owners = $this->getDataContainer()->getItunesOwners(); if (!$owners || empty($owners)) { @@ -281,7 +286,7 @@ protected function _setOwners(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setSubtitle(DOMDocument $dom, DOMElement $root) + protected function _setSubtitle(\DOMDocument $dom, \DOMElement $root) { $subtitle = $this->getDataContainer()->getItunesSubtitle(); if (!$subtitle) { @@ -301,7 +306,7 @@ protected function _setSubtitle(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setSummary(DOMDocument $dom, DOMElement $root) + protected function _setSummary(\DOMDocument $dom, \DOMElement $root) { $summary = $this->getDataContainer()->getItunesSummary(); if (!$summary) { diff --git a/src/Writer/Extension/RendererAbstract.php b/src/Writer/Extension/RendererAbstract.php index be05abe0..28a3fbe0 100644 --- a/src/Writer/Extension/RendererAbstract.php +++ b/src/Writer/Extension/RendererAbstract.php @@ -18,16 +18,21 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ - + +/** + * @namespace + */ +namespace Zend\Feed\Writer\Extension; + /** - * @uses Zend_Feed_Writer_Extension_RendererInterface + * @uses \Zend\Feed\Writer\Extension\RendererInterface * @category Zend * @package Zend_Feed_Writer_Entry_Rss * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class Zend_Feed_Writer_Extension_RendererAbstract - implements Zend_Feed_Writer_Extension_RendererInterface +abstract class RendererAbstract + implements RendererInterface { /** * @var DOMDocument @@ -81,7 +86,7 @@ public function __construct($container) * Set feed encoding * * @param string $enc - * @return Zend_Feed_Writer_Extension_RendererAbstract + * @return \Zend\Feed\Writer\Extension\RendererAbstract */ public function setEncoding($enc) { @@ -104,9 +109,9 @@ public function getEncoding() * * @param DOMDocument $dom * @param DOMElement $base - * @return Zend_Feed_Writer_Extension_RendererAbstract + * @return \Zend\Feed\Writer\Extension\RendererAbstract */ - public function setDomDocument(DOMDocument $dom, DOMElement $base) + public function setDomDocument(\DOMDocument $dom, \DOMElement $base) { $this->_dom = $dom; $this->_base = $base; @@ -127,7 +132,7 @@ public function getDataContainer() * Set feed type * * @param string $type - * @return Zend_Feed_Writer_Extension_RendererAbstract + * @return \Zend\Feed\Writer\Extension\RendererAbstract */ public function setType($type) { @@ -149,9 +154,9 @@ public function getType() * Set root element of document * * @param DOMElement $root - * @return Zend_Feed_Writer_Extension_RendererAbstract + * @return \Zend\Feed\Writer\Extension\RendererAbstract */ - public function setRootElement(DOMElement $root) + public function setRootElement(\DOMElement $root) { $this->_rootElement = $root; return $this; diff --git a/src/Writer/Extension/RendererInterface.php b/src/Writer/Extension/RendererInterface.php index 110d25ab..618da1ff 100644 --- a/src/Writer/Extension/RendererInterface.php +++ b/src/Writer/Extension/RendererInterface.php @@ -19,13 +19,18 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Writer\Extension; + /** * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface Zend_Feed_Writer_Extension_RendererInterface +interface RendererInterface { /** * Constructor @@ -42,7 +47,7 @@ public function __construct($container); * @param DOMElement $base * @return void */ - public function setDomDocument(DOMDocument $dom, DOMElement $base); + public function setDomDocument(\DOMDocument $dom, \DOMElement $base); /** * Render diff --git a/src/Writer/Extension/Slash/Renderer/Entry.php b/src/Writer/Extension/Slash/Renderer/Entry.php index c98f6ebd..914fdf13 100644 --- a/src/Writer/Extension/Slash/Renderer/Entry.php +++ b/src/Writer/Extension/Slash/Renderer/Entry.php @@ -18,16 +18,21 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ - + +/** + * @namespace + */ +namespace Zend\Feed\Writer\Extension\Slash\Renderer; + /** - * @uses Zend_Feed_Writer_Extension_RendererAbstract + * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Extension_Slash_Renderer_Entry - extends Zend_Feed_Writer_Extension_RendererAbstract +class Entry + extends \Zend\Feed\Writer\Extension\RendererAbstract { /** @@ -73,7 +78,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setCommentCount(DOMDocument $dom, DOMElement $root) + protected function _setCommentCount(\DOMDocument $dom, \DOMElement $root) { $count = $this->getDataContainer()->getCommentCount(); if (!$count) { diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php index acb7d794..1baf27d9 100644 --- a/src/Writer/Extension/Threading/Renderer/Entry.php +++ b/src/Writer/Extension/Threading/Renderer/Entry.php @@ -18,16 +18,21 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ - + +/** + * @namespace + */ +namespace Zend\Feed\Writer\Extension\Threading\Renderer; + /** - * @uses Zend_Feed_Writer_Extension_RendererAbstract + * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Extension_Threading_Renderer_Entry - extends Zend_Feed_Writer_Extension_RendererAbstract +class Entry + extends \Zend\Feed\Writer\Extension\RendererAbstract { /** @@ -75,7 +80,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setCommentLink(DOMDocument $dom, DOMElement $root) + protected function _setCommentLink(\DOMDocument $dom, \DOMElement $root) { $link = $this->getDataContainer()->getCommentLink(); if (!$link) { @@ -100,7 +105,7 @@ protected function _setCommentLink(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) + protected function _setCommentFeedLinks(\DOMDocument $dom, \DOMElement $root) { $links = $this->getDataContainer()->getCommentFeedLinks(); if (!$links || empty($links)) { @@ -127,7 +132,7 @@ protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCommentCount(DOMDocument $dom, DOMElement $root) + protected function _setCommentCount(\DOMDocument $dom, \DOMElement $root) { $count = $this->getDataContainer()->getCommentCount(); if (is_null($count)) { diff --git a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php index 8afbea46..a20baa80 100644 --- a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php +++ b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php @@ -18,16 +18,21 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ - + +/** + * @namespace + */ +namespace Zend\Feed\Writer\Extension\WellFormedWeb\Renderer; + /** - * @uses Zend_Feed_Writer_Extension_RendererAbstract + * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Extension_WellFormedWeb_Renderer_Entry - extends Zend_Feed_Writer_Extension_RendererAbstract +class Entry + extends \Zend\Feed\Writer\Extension\RendererAbstract { /** @@ -73,7 +78,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) + protected function _setCommentFeedLinks(\DOMDocument $dom, \DOMElement $root) { $links = $this->getDataContainer()->getCommentFeedLinks(); if (!$links || empty($links)) { diff --git a/src/Writer/Feed.php b/src/Writer/Feed/Feed.php similarity index 82% rename from src/Writer/Feed.php rename to src/Writer/Feed/Feed.php index 329861f9..c735147a 100644 --- a/src/Writer/Feed.php +++ b/src/Writer/Feed/Feed.php @@ -19,26 +19,34 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Writer\Feed; +use Zend\Feed\Writer; +use Zend\Feed as ZendFeed; +use Zend\Date; + /** * @uses Countable * @uses Iterator - * @uses Zend_Date - * @uses Zend_Feed_Exception - * @uses Zend_Feed_Writer - * @uses Zend_Feed_Writer_Deleted - * @uses Zend_Feed_Writer_Entry - * @uses Zend_Feed_Writer_Feed_FeedAbstract - * @uses Zend_Feed_Writer_Renderer_Feed_Atom - * @uses Zend_Feed_Writer_Renderer_Feed_Rss - * @uses Zend_Uri + * @uses \Zend\Date\Date + * @uses \Zend\Feed\Exception + * @uses \Zend\Feed\Writer\Writer + * @uses \Zend\Feed\Writer\Deleted + * @uses \Zend\Feed\Writer\Entry + * @uses \Zend\Feed\Writer\Feed\FeedAbstract + * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Atom + * @uses \Zend\Feed\Writer\Renderer\Feed\RSS + * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Feed - extends Zend_Feed_Writer_Feed_FeedAbstract - implements Iterator, Countable +class Feed + extends FeedAbstract + implements \Iterator, \Countable { /** @@ -60,11 +68,11 @@ class Zend_Feed_Writer_Feed * added to the current feed automatically, but is necessary to create a * container with some initial values preset based on the current feed data. * - * @return Zend_Feed_Writer_Entry + * @return \Zend\Feed\Writer\Entry */ public function createEntry() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; if ($this->getEncoding()) { $entry->setEncoding($this->getEncoding()); } @@ -76,9 +84,9 @@ public function createEntry() * Appends a Zend_Feed_Writer_Deleted object representing a new entry tombstone * to the feed data container's internal group of entries. * - * @param Zend_Feed_Writer_Deleted $entry + * @param \Zend\Feed\Writer\Deleted $entry */ - public function addTombstone(Zend_Feed_Writer_Deleted $deleted) + public function addTombstone(Writer\Deleted $deleted) { $this->_entries[] = $deleted; } @@ -88,11 +96,11 @@ public function addTombstone(Zend_Feed_Writer_Deleted $deleted) * added to the current feed automatically, but is necessary to create a * container with some initial values preset based on the current feed data. * - * @return Zend_Feed_Writer_Deleted + * @return \Zend\Feed\Writer\Deleted */ public function createTombstone() { - $deleted = new Zend_Feed_Writer_Deleted; + $deleted = new Writer\Deleted; if ($this->getEncoding()) { $deleted->setEncoding($this->getEncoding()); } @@ -104,9 +112,9 @@ public function createTombstone() * Appends a Zend_Feed_Writer_Entry object representing a new entry/item * the feed data container's internal group of entries. * - * @param Zend_Feed_Writer_Entry $entry + * @param \Zend\Feed\Writer\Entry $entry */ - public function addEntry(Zend_Feed_Writer_Entry $entry) + public function addEntry(Writer\Entry $entry) { $this->_entries[] = $entry; } @@ -122,7 +130,7 @@ public function removeEntry($index) if (isset($this->_entries[$index])) { unset($this->_entries[$index]); } - throw new Zend_Feed_Exception('Undefined index: ' . $index . '. Entry does not exist.'); + throw new ZendFeed\Exception('Undefined index: ' . $index . '. Entry does not exist.'); } /** @@ -136,7 +144,7 @@ public function getEntry($index = 0) if (isset($this->_entries[$index])) { return $this->_entries[$index]; } - throw new Zend_Feed_Exception('Undefined index: ' . $index . '. Entry does not exist.'); + throw new ZendFeed\Exception('Undefined index: ' . $index . '. Entry does not exist.'); } /** @@ -157,9 +165,9 @@ public function orderByDate() $entries = array(); foreach ($this->_entries as $entry) { if ($entry->getDateModified()) { - $timestamp = (int) $entry->getDateModified()->get(Zend_Date::TIMESTAMP); + $timestamp = (int) $entry->getDateModified()->get(Date\Date::TIMESTAMP); } elseif ($entry->getDateCreated()) { - $timestamp = (int) $entry->getDateCreated()->get(Zend_Date::TIMESTAMP); + $timestamp = (int) $entry->getDateCreated()->get(Date\Date::TIMESTAMP); } $entries[$timestamp] = $entry; } @@ -239,7 +247,7 @@ public function export($type, $ignoreExceptions = false) $this->setType(strtolower($type)); $type = ucfirst($this->getType()); if ($type !== 'Rss' && $type !== 'Atom') { - throw new Zend_Feed_Exception('Invalid feed type specified: ' . $type . '.' + throw new ZendFeed\Exception('Invalid feed type specified: ' . $type . '.' . ' Should be one of "rss" or "atom".'); } $renderClass = 'Zend_Feed_Writer_Renderer_Feed_' . $type; diff --git a/src/Writer/Feed/FeedAbstract.php b/src/Writer/Feed/FeedAbstract.php index 78ca9f6d..d17cefe0 100644 --- a/src/Writer/Feed/FeedAbstract.php +++ b/src/Writer/Feed/FeedAbstract.php @@ -20,19 +20,28 @@ */ /** - * @uses Zend_Date - * @uses Zend_Feed_Exception - * @uses Zend_Feed_Writer - * @uses Zend_Feed_Writer_Entry - * @uses Zend_Feed_Writer_Renderer_Feed_Atom - * @uses Zend_Feed_Writer_Renderer_Feed_Rss - * @uses Zend_Uri + * @namespace + */ +namespace Zend\Feed\Writer\Feed; +use Zend\Feed\Writer; +use Zend\Feed; +use Zend\URI; +use Zend\Date; + +/** + * @uses \Zend\Date\Date + * @uses \Zend\Feed\Exception + * @uses \Zend\Feed\Writer\Writer + * @uses \Zend\Feed\Writer\Entry + * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Atom + * @uses \Zend\Feed\Writer\Renderer\Feed\RSS + * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Feed_FeedAbstract +class FeedAbstract { /** * Contains all Feed level date to append in feed output @@ -57,7 +66,7 @@ class Zend_Feed_Writer_Feed_FeedAbstract */ public function __construct() { - Zend_Feed_Writer::registerCoreExtensions(); + Writer\Writer::registerCoreExtensions(); $this->_loadExtensions(); } @@ -72,35 +81,35 @@ public function addAuthor($name, $email = null, $uri = null) $author = array(); if (is_array($name)) { if (!array_key_exists('name', $name) || empty($name['name']) || !is_string($name['name'])) { - throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); + throw new Feed\Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); } $author['name'] = $name['name']; if (isset($name['email'])) { if (empty($name['email']) || !is_string($name['email'])) { - throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: "email" array value must be a non-empty string'); } $author['email'] = $name['email']; } if (isset($name['uri'])) { - if (empty($name['uri']) || !is_string($name['uri']) || !Zend_Uri::check($name['uri'])) { - throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); + if (empty($name['uri']) || !is_string($name['uri']) || !\Zend\URI\URL::validate($name['uri'])) { + throw new Feed\Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $name['uri']; } } else { if (empty($name['name']) || !is_string($name['name'])) { - throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string value'); + throw new Feed\Exception('Invalid parameter: "name" must be a non-empty string value'); } $author['name'] = $name; if (isset($email)) { if (empty($email) || !is_string($email)) { - throw new Zend_Feed_Exception('Invalid parameter: "email" value must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: "email" value must be a non-empty string'); } $author['email'] = $email; } if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { - throw new Zend_Feed_Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); + if (empty($uri) || !is_string($uri) || !\Zend\URI\URL::validate($uri)) { + throw new Feed\Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $uri; } @@ -128,7 +137,7 @@ public function addAuthors(array $authors) public function setCopyright($copyright) { if (empty($copyright) || !is_string($copyright)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['copyright'] = $copyright; } @@ -136,19 +145,19 @@ public function setCopyright($copyright) /** * Set the feed creation date * - * @param null|integer|Zend_Date + * @param null|integer|\Zend\Date\Date */ public function setDateCreated($date = null) { $zdate = null; if (is_null($date)) { - $zdate = new Zend_Date; + $zdate = new Date\Date; } elseif (ctype_digit($date) && strlen($date) == 10) { - $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); - } elseif ($date instanceof Zend_Date) { + $zdate = new Date\Date($date, Date\Date::TIMESTAMP); + } elseif ($date instanceof Date\Date) { $zdate = $date; } else { - throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + throw new Feed\Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateCreated'] = $zdate; } @@ -156,19 +165,19 @@ public function setDateCreated($date = null) /** * Set the feed modification date * - * @param null|integer|Zend_Date + * @param null|integer|\Zend\Date\Date */ public function setDateModified($date = null) { $zdate = null; if (is_null($date)) { - $zdate = new Zend_Date; + $zdate = new Date\Date; } elseif (ctype_digit($date) && strlen($date) == 10) { - $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); - } elseif ($date instanceof Zend_Date) { + $zdate = new Date\Date($date, Date\Date::TIMESTAMP); + } elseif ($date instanceof Date\Date) { $zdate = $date; } else { - throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + throw new Feed\Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateModified'] = $zdate; } @@ -181,7 +190,7 @@ public function setDateModified($date = null) public function setDescription($description) { if (empty($description) || !is_string($description)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['description'] = $description; } @@ -194,18 +203,18 @@ public function setDescription($description) public function setGenerator($name, $version = null, $uri = null) { if (empty($name) || !is_string($name)) { - throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: "name" must be a non-empty string'); } $generator = array('name' => $name); if (isset($version)) { if (empty($version) || !is_string($version)) { - throw new Zend_Feed_Exception('Invalid parameter: "version" must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: "version" must be a non-empty string'); } $generator['version'] = $version; } if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { - throw new Zend_Feed_Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); + if (empty($uri) || !is_string($uri) || !\Zend\URI\URL::validate($uri)) { + throw new Feed\Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); } $generator['uri'] = $uri; } @@ -219,9 +228,9 @@ public function setGenerator($name, $version = null, $uri = null) */ public function setId($id) { - if ((empty($id) || !is_string($id) || !Zend_Uri::check($id)) && - !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + if ((empty($id) || !is_string($id) || !\Zend\URI\URL::validate($id)) && + !preg_match('#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#', $id)) { + throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['id'] = $id; } @@ -234,7 +243,7 @@ public function setId($id) public function setLanguage($language) { if (empty($language) || !is_string($language)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['language'] = $language; } @@ -246,8 +255,8 @@ public function setLanguage($language) */ public function setLink($link) { - if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + if (empty($link) || !is_string($link) || !\Zend\URI\URL::validate($link)) { + throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['link'] = $link; } @@ -259,11 +268,11 @@ public function setLink($link) */ public function setFeedLink($link, $type) { - if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { - throw new Zend_Feed_Exception('Invalid parameter: "link"" must be a non-empty string and valid URI/IRI'); + if (empty($link) || !is_string($link) || !\Zend\URI\URL::validate($link)) { + throw new Feed\Exception('Invalid parameter: "link"" must be a non-empty string and valid URI/IRI'); } if (!in_array(strtolower($type), array('rss', 'rdf', 'atom'))) { - throw new Zend_Feed_Exception('Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom'); + throw new Feed\Exception('Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom'); } $this->_data['feedLinks'][strtolower($type)] = $link; } @@ -276,7 +285,7 @@ public function setFeedLink($link, $type) public function setTitle($title) { if (empty($title) || !is_string($title)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['title'] = $title; } @@ -289,7 +298,7 @@ public function setTitle($title) public function setEncoding($encoding) { if (empty($encoding) || !is_string($encoding)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['encoding'] = $encoding; } @@ -301,8 +310,8 @@ public function setEncoding($encoding) */ public function setBaseUrl($url) { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Exception('Invalid parameter: "url" array value' + if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { + throw new Feed\Exception('Invalid parameter: "url" array value' . ' must be a non-empty string and valid URI/IRI'); } $this->_data['baseUrl'] = $url; @@ -315,8 +324,8 @@ public function setBaseUrl($url) */ public function addHub($url) { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Exception('Invalid parameter: "url" array value' + if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { + throw new Feed\Exception('Invalid parameter: "url" array value' . ' must be a non-empty string and valid URI/IRI'); } if (!isset($this->_data['hubs'])) { @@ -345,16 +354,16 @@ public function addHubs(array $urls) public function addCategory(array $category) { if (!isset($category['term'])) { - throw new Zend_Feed_Exception('Each category must be an array and ' + throw new Feed\Exception('Each category must be an array and ' . 'contain at least a "term" element containing the machine ' . ' readable category name'); } if (isset($category['scheme'])) { if (empty($category['scheme']) || !is_string($category['scheme']) - || !Zend_Uri::check($category['scheme']) + || !\Zend\URI\URL::validate($category['scheme']) ) { - throw new Zend_Feed_Exception('The Atom scheme or RSS domain of' + throw new Feed\Exception('The Atom scheme or RSS domain of' . ' a category must be a valid URI'); } } @@ -636,17 +645,17 @@ public function remove($name) * @param string $method * @param array $args * @return mixed - * @throws Zend_Feed_Exception if no extensions implements the method + * @throws \Zend\Feed\Exception if no extensions implements the method */ public function __call($method, $args) { foreach ($this->_extensions as $extension) { try { return call_user_func_array(array($extension, $method), $args); - } catch (Zend_Feed_Writer_Exception_InvalidMethodException $e) { + } catch (Feed\Writer\Exception\InvalidMethodException $e) { } } - throw new Zend_Feed_Exception('Method: ' . $method + throw new Feed\Exception('Method: ' . $method . ' does not exist and could not be located on a registered Extension'); } @@ -657,10 +666,10 @@ public function __call($method, $args) */ protected function _loadExtensions() { - $all = Zend_Feed_Writer::getExtensions(); + $all = Writer\Writer::getExtensions(); $exts = $all['feed']; foreach ($exts as $ext) { - $className = Zend_Feed_Writer::getPluginLoader()->getClassName($ext); + $className = Writer\Writer::getPluginLoader()->getClassName($ext); $this->_extensions[$ext] = new $className(); $this->_extensions[$ext]->setEncoding($this->getEncoding()); } diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom/Atom.php similarity index 82% rename from src/Writer/Renderer/Entry/Atom.php rename to src/Writer/Renderer/Entry/Atom/Atom.php index a602ef0e..24c1a383 100644 --- a/src/Writer/Renderer/Entry/Atom.php +++ b/src/Writer/Renderer/Entry/Atom/Atom.php @@ -19,32 +19,39 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Writer\Renderer\Entry\Atom; +use Zend\Feed; +use Zend\Date; + /** * @uses DOMDocument - * @uses Zend_Date - * @uses Zend_Feed_Exception - * @uses Zend_Feed_Writer - * @uses Zend_Feed_Writer_Renderer_Feed_Atom_Source - * @uses Zend_Feed_Writer_Renderer_RendererAbstract - * @uses Zend_Feed_Writer_Renderer_RendererInterface - * @uses Zend_Uri + * @uses \Zend\Date\Date + * @uses \Zend\Feed\Exception + * @uses \Zend\Feed\Writer\Writer + * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Source + * @uses \Zend\Feed\Writer\Renderer\RendererAbstract + * @uses \Zend\Feed\Writer\Renderer\RendererInterface + * @uses \Zend\Uri\Uri * @uses tidy * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Renderer_Entry_Atom - extends Zend_Feed_Writer_Renderer_RendererAbstract - implements Zend_Feed_Writer_Renderer_RendererInterface +class Atom + extends Feed\Writer\Renderer\RendererAbstract + implements Feed\Writer\Renderer\RendererInterface { /** * Constructor * - * @param Zend_Feed_Writer_Entry $container + * @param \Zend\Feed\Writer\Entry $container * @return void */ - public function __construct (Zend_Feed_Writer_Entry $container) + public function __construct (Feed\Writer\Entry $container) { parent::__construct($container); } @@ -52,13 +59,13 @@ public function __construct (Zend_Feed_Writer_Entry $container) /** * Render atom entry * - * @return Zend_Feed_Writer_Renderer_Entry_Atom + * @return \Zend\Feed\Writer\Renderer\Entry\Atom\Atom */ public function render() { - $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; - $entry = $this->_dom->createElementNS(Zend_Feed_Writer::NAMESPACE_ATOM_10, 'entry'); + $entry = $this->_dom->createElementNS(Feed\Writer\Writer::NAMESPACE_ATOM_10, 'entry'); $this->_dom->appendChild($entry); $this->_setSource($this->_dom, $entry); @@ -90,12 +97,12 @@ public function render() * @param DOMElement $root * @return void */ - protected function _setTitle(DOMDocument $dom, DOMElement $root) + protected function _setTitle(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getTitle()) { $message = 'Atom 1.0 entry elements MUST contain exactly one' . ' atom:title element but a title has not been set'; - $exception = new Zend_Feed_Exception($message); + $exception = new Feed\Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -117,7 +124,7 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDescription(DOMDocument $dom, DOMElement $root) + protected function _setDescription(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getDescription()) { return; // unless src content or base64 @@ -138,12 +145,12 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateModified(DOMDocument $dom, DOMElement $root) + protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getDateModified()) { $message = 'Atom 1.0 entry elements MUST contain exactly one' . ' atom:updated element but a modification date has not been set'; - $exception = new Zend_Feed_Exception($message); + $exception = new Feed\Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -155,7 +162,7 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) $updated = $dom->createElement('updated'); $root->appendChild($updated); $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(Zend_Date::ISO_8601) + $this->getDataContainer()->getDateModified()->get(Date\Date::ISO_8601) ); $updated->appendChild($text); } @@ -167,7 +174,7 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateCreated(DOMDocument $dom, DOMElement $root) + protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) { if (!$this->getDataContainer()->getDateCreated()) { return; @@ -175,7 +182,7 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) $el = $dom->createElement('published'); $root->appendChild($el); $text = $dom->createTextNode( - $this->getDataContainer()->getDateCreated()->get(Zend_Date::ISO_8601) + $this->getDataContainer()->getDateCreated()->get(Date\Date::ISO_8601) ); $el->appendChild($text); } @@ -187,7 +194,7 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setAuthors(DOMDocument $dom, DOMElement $root) + protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) { $authors = $this->_container->getAuthors(); if ((!$authors || empty($authors))) { @@ -226,7 +233,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setEnclosure(DOMDocument $dom, DOMElement $root) + protected function _setEnclosure(\DOMDocument $dom, \DOMElement $root) { $data = $this->_container->getEnclosure(); if ((!$data || empty($data))) { @@ -240,7 +247,7 @@ protected function _setEnclosure(DOMDocument $dom, DOMElement $root) $root->appendChild($enclosure); } - protected function _setLink(DOMDocument $dom, DOMElement $root) + protected function _setLink(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getLink()) { return; @@ -259,7 +266,7 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setId(DOMDocument $dom, DOMElement $root) + protected function _setId(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getId() && !$this->getDataContainer()->getLink()) { @@ -267,7 +274,7 @@ protected function _setId(DOMDocument $dom, DOMElement $root) . 'atom:id element, or as an alternative, we can use the same ' . 'value as atom:link however neither a suitable link nor an ' . 'id have been set'; - $exception = new Zend_Feed_Exception($message); + $exception = new Feed\Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -280,9 +287,9 @@ protected function _setId(DOMDocument $dom, DOMElement $root) $this->getDataContainer()->setId( $this->getDataContainer()->getLink()); } - if (!Zend_Uri::check($this->getDataContainer()->getId()) && - !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $this->getDataContainer()->getId())) { - throw new Zend_Feed_Exception('Atom 1.0 IDs must be a valid URI/IRI'); + if (!\Zend\URI\URL::validate($this->getDataContainer()->getId()) && + !preg_match('#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#', $this->getDataContainer()->getId())) { + throw new Feed\Exception('Atom 1.0 IDs must be a valid URI/IRI'); } $id = $dom->createElement('id'); $root->appendChild($id); @@ -297,7 +304,7 @@ protected function _setId(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setContent(DOMDocument $dom, DOMElement $root) + protected function _setContent(\DOMDocument $dom, \DOMElement $root) { $content = $this->getDataContainer()->getContent(); if (!$content && !$this->getDataContainer()->getLink()) { @@ -305,7 +312,7 @@ protected function _setContent(DOMDocument $dom, DOMElement $root) . 'atom:content element, or as an alternative, at least one link ' . 'with a rel attribute of "alternate" to indicate an alternate ' . 'method to consume the content.'; - $exception = new Zend_Feed_Exception($message); + $exception = new Feed\Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -331,7 +338,7 @@ protected function _loadXhtml($content) { $xhtml = ''; if (class_exists('tidy', false)) { - $tidy = new tidy; + $tidy = new \tidy; $config = array( 'output-xhtml' => true, 'show-body-only' => true @@ -346,7 +353,7 @@ protected function _loadXhtml($content) $xhtml = preg_replace(array( "/(<[\/]?)([a-zA-Z]+)/" ), '$1xhtml:$2', $xhtml); - $dom = new DOMDocument('1.0', $this->getEncoding()); + $dom = new \DOMDocument('1.0', $this->getEncoding()); $dom->loadXML('' . $xhtml . ''); return $dom->documentElement; @@ -359,7 +366,7 @@ protected function _loadXhtml($content) * @param DOMElement $root * @return void */ - protected function _setCategories(DOMDocument $dom, DOMElement $root) + protected function _setCategories(\DOMDocument $dom, \DOMElement $root) { $categories = $this->getDataContainer()->getCategories(); if (!$categories) { @@ -387,13 +394,13 @@ protected function _setCategories(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setSource(DOMDocument $dom, DOMElement $root) + protected function _setSource(\DOMDocument $dom, \DOMElement $root) { $source = $this->getDataContainer()->getSource(); if (!$source) { return; } - $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom_Source($source); + $renderer = new Feed\Writer\Renderer\Feed\Atom\Source($source); $renderer->setType($this->getType()); $element = $renderer->render()->getElement(); $imported = $dom->importNode($element, true); diff --git a/src/Writer/Renderer/Entry/Atom/Deleted.php b/src/Writer/Renderer/Entry/Atom/Deleted.php index 072f959f..e76fc221 100644 --- a/src/Writer/Renderer/Entry/Atom/Deleted.php +++ b/src/Writer/Renderer/Entry/Atom/Deleted.php @@ -19,27 +19,32 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Writer\Renderer\Entry\Atom; + /** * @uses DOMDocument - * @uses Zend_Date - * @uses Zend_Feed_Writer_Renderer_RendererAbstract - * @uses Zend_Feed_Writer_Renderer_RendererInterface + * @uses \Zend\Date\Date + * @uses \Zend\Feed\Writer\Renderer\RendererAbstract + * @uses \Zend\Feed\Writer\Renderer\RendererInterface * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Renderer_Entry_Atom_Deleted - extends Zend_Feed_Writer_Renderer_RendererAbstract - implements Zend_Feed_Writer_Renderer_RendererInterface +class Deleted + extends \Zend\Feed\Writer\Renderer\RendererAbstract + implements \Zend\Feed\Writer\Renderer\RendererInterface { /** * Constructor * - * @param Zend_Feed_Writer_Deleted $container + * @param \Zend\Feed\Writer\Deleted $container * @return void */ - public function __construct (Zend_Feed_Writer_Deleted $container) + public function __construct (\Zend\Feed\Writer\Deleted $container) { parent::__construct($container); } @@ -47,17 +52,17 @@ public function __construct (Zend_Feed_Writer_Deleted $container) /** * Render atom entry * - * @return Zend_Feed_Writer_Renderer_Entry_Atom + * @return \Zend\Feed\Writer\Renderer\Entry\Atom\Atom */ public function render() { - $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; $entry = $this->_dom->createElement('at:deleted-entry'); $this->_dom->appendChild($entry); $entry->setAttribute('ref', $this->_container->getReference()); - $entry->setAttribute('when', $this->_container->getWhen()->get(Zend_Date::ISO_8601)); + $entry->setAttribute('when', $this->_container->getWhen()->get(\Zend\Date\Date::ISO_8601)); $this->_setBy($this->_dom, $entry); $this->_setComment($this->_dom, $entry); @@ -72,7 +77,7 @@ public function render() * @param DOMElement $root * @return void */ - protected function _setComment(DOMDocument $dom, DOMElement $root) + protected function _setComment(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getComment()) { return; @@ -91,7 +96,7 @@ protected function _setComment(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setBy(DOMDocument $dom, DOMElement $root) + protected function _setBy(\DOMDocument $dom, \DOMElement $root) { $data = $this->_container->getBy(); if ((!$data || empty($data))) { diff --git a/src/Writer/Renderer/Entry/RSS.php b/src/Writer/Renderer/Entry/RSS.php new file mode 100644 index 00000000..3de04058 --- /dev/null +++ b/src/Writer/Renderer/Entry/RSS.php @@ -0,0 +1,319 @@ +_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom->formatOutput = true; + $this->_dom->substituteEntities = false; + $entry = $this->_dom->createElement('item'); + $this->_dom->appendChild($entry); + + $this->_setTitle($this->_dom, $entry); + $this->_setDescription($this->_dom, $entry); + $this->_setDateCreated($this->_dom, $entry); + $this->_setDateModified($this->_dom, $entry); + $this->_setLink($this->_dom, $entry); + $this->_setId($this->_dom, $entry); + $this->_setAuthors($this->_dom, $entry); + $this->_setEnclosure($this->_dom, $entry); + $this->_setCommentLink($this->_dom, $entry); + $this->_setCategories($this->_dom, $entry); + foreach ($this->_extensions as $ext) { + $ext->setType($this->getType()); + $ext->setRootElement($this->getRootElement()); + $ext->setDomDocument($this->getDomDocument(), $entry); + $ext->render(); + } + + return $this; + } + + /** + * Set entry title + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setTitle(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getDescription() + && !$this->getDataContainer()->getTitle()) { + $message = 'RSS 2.0 entry elements SHOULD contain exactly one' + . ' title element but a title has not been set. In addition, there' + . ' is no description as required in the absence of a title.'; + $exception = new Feed\Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $title = $dom->createElement('title'); + $root->appendChild($title); + $text = $dom->createTextNode($this->getDataContainer()->getTitle()); + $title->appendChild($text); + } + + /** + * Set entry description + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setDescription(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getDescription() + && !$this->getDataContainer()->getTitle()) { + $message = 'RSS 2.0 entry elements SHOULD contain exactly one' + . ' description element but a description has not been set. In' + . ' addition, there is no title element as required in the absence' + . ' of a description.'; + $exception = new Feed\Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + if (!$this->getDataContainer()->getDescription()) { + return; + } + $subtitle = $dom->createElement('description'); + $root->appendChild($subtitle); + $text = $dom->createCDATASection($this->getDataContainer()->getDescription()); + $subtitle->appendChild($text); + } + + /** + * Set date entry was last modified + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getDateModified()) { + return; + } + + $updated = $dom->createElement('pubDate'); + $root->appendChild($updated); + $text = $dom->createTextNode( + $this->getDataContainer()->getDateModified()->get(\Zend\Date\Date::RSS) + ); + $updated->appendChild($text); + } + + /** + * Set date entry was created + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) + { + if (!$this->getDataContainer()->getDateCreated()) { + return; + } + if (!$this->getDataContainer()->getDateModified()) { + $this->getDataContainer()->setDateModified( + $this->getDataContainer()->getDateCreated() + ); + } + } + + /** + * Set entry authors + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + { + $authors = $this->_container->getAuthors(); + if ((!$authors || empty($authors))) { + return; + } + foreach ($authors as $data) { + $author = $this->_dom->createElement('author'); + $name = $data['name']; + if (array_key_exists('email', $data)) { + $name = $data['email'] . ' (' . $data['name'] . ')'; + } + $text = $dom->createTextNode($name); + $author->appendChild($text); + $root->appendChild($author); + } + } + + /** + * Set entry enclosure + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setEnclosure(\DOMDocument $dom, \DOMElement $root) + { + $data = $this->_container->getEnclosure(); + if ((!$data || empty($data))) { + return; + } + $enclosure = $this->_dom->createElement('enclosure'); + $enclosure->setAttribute('type', $data['type']); + $enclosure->setAttribute('length', $data['length']); + $enclosure->setAttribute('url', $data['uri']); + $root->appendChild($enclosure); + } + + /** + * Set link to entry + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setLink(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getLink()) { + return; + } + $link = $dom->createElement('link'); + $root->appendChild($link); + $text = $dom->createTextNode($this->getDataContainer()->getLink()); + $link->appendChild($text); + } + + /** + * Set entry identifier + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setId(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getId() + && !$this->getDataContainer()->getLink()) { + return; + } + + $id = $dom->createElement('guid'); + $root->appendChild($id); + if (!$this->getDataContainer()->getId()) { + $this->getDataContainer()->setId( + $this->getDataContainer()->getLink()); + } + $text = $dom->createTextNode($this->getDataContainer()->getId()); + $id->appendChild($text); + if (!\Zend\URI\URL::validate($this->getDataContainer()->getId())) { + $id->setAttribute('isPermaLink', 'false'); + } + } + + /** + * Set link to entry comments + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setCommentLink(\DOMDocument $dom, \DOMElement $root) + { + $link = $this->getDataContainer()->getCommentLink(); + if (!$link) { + return; + } + $clink = $this->_dom->createElement('comments'); + $text = $dom->createTextNode($link); + $clink->appendChild($text); + $root->appendChild($clink); + } + + /** + * Set entry categories + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setCategories(\DOMDocument $dom, \DOMElement $root) + { + $categories = $this->getDataContainer()->getCategories(); + if (!$categories) { + return; + } + foreach ($categories as $cat) { + $category = $dom->createElement('category'); + if (isset($cat['scheme'])) { + $category->setAttribute('domain', $cat['scheme']); + } + $text = $dom->createCDATASection($cat['term']); + $category->appendChild($text); + $root->appendChild($category); + } + } +} diff --git a/src/Writer/Renderer/Entry/Rss.php b/src/Writer/Renderer/Entry/Rss.php index d58548a0..3de04058 100644 --- a/src/Writer/Renderer/Entry/Rss.php +++ b/src/Writer/Renderer/Entry/Rss.php @@ -20,27 +20,33 @@ */ /** - * @uses Zend_Date - * @uses Zend_Feed_Exception - * @uses Zend_Feed_Writer_Renderer_RendererAbstract - * @uses Zend_Feed_Writer_Renderer_RendererInterface - * @uses Zend_Uri + * @namespace + */ +namespace Zend\Feed\Writer\Renderer\Entry; +use Zend\Feed; + +/** + * @uses \Zend\Date\Date + * @uses \Zend\Feed\Exception + * @uses \Zend\Feed\Writer\Renderer\RendererAbstract + * @uses \Zend\Feed\Writer\Renderer\RendererInterface + * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Renderer_Entry_Rss - extends Zend_Feed_Writer_Renderer_RendererAbstract - implements Zend_Feed_Writer_Renderer_RendererInterface +class RSS + extends Feed\Writer\Renderer\RendererAbstract + implements Feed\Writer\Renderer\RendererInterface { /** * Constructor * - * @param Zend_Feed_Writer_Entry $container + * @param \Zend\Feed\Writer\Entry $container * @return void */ - public function __construct (Zend_Feed_Writer_Entry $container) + public function __construct (Feed\Writer\Entry $container) { parent::__construct($container); } @@ -48,11 +54,11 @@ public function __construct (Zend_Feed_Writer_Entry $container) /** * Render RSS entry * - * @return Zend_Feed_Writer_Renderer_Entry_Rss + * @return \Zend\Feed\Writer\Renderer\Entry\RSS */ public function render() { - $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; $this->_dom->substituteEntities = false; $entry = $this->_dom->createElement('item'); @@ -85,14 +91,14 @@ public function render() * @param DOMElement $root * @return void */ - protected function _setTitle(DOMDocument $dom, DOMElement $root) + protected function _setTitle(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getDescription() && !$this->getDataContainer()->getTitle()) { $message = 'RSS 2.0 entry elements SHOULD contain exactly one' . ' title element but a title has not been set. In addition, there' . ' is no description as required in the absence of a title.'; - $exception = new Zend_Feed_Exception($message); + $exception = new Feed\Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -113,7 +119,7 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDescription(DOMDocument $dom, DOMElement $root) + protected function _setDescription(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getDescription() && !$this->getDataContainer()->getTitle()) { @@ -121,7 +127,7 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) . ' description element but a description has not been set. In' . ' addition, there is no title element as required in the absence' . ' of a description.'; - $exception = new Zend_Feed_Exception($message); + $exception = new Feed\Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -145,7 +151,7 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateModified(DOMDocument $dom, DOMElement $root) + protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getDateModified()) { return; @@ -154,7 +160,7 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) $updated = $dom->createElement('pubDate'); $root->appendChild($updated); $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(Zend_Date::RSS) + $this->getDataContainer()->getDateModified()->get(\Zend\Date\Date::RSS) ); $updated->appendChild($text); } @@ -166,7 +172,7 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateCreated(DOMDocument $dom, DOMElement $root) + protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) { if (!$this->getDataContainer()->getDateCreated()) { return; @@ -185,7 +191,7 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setAuthors(DOMDocument $dom, DOMElement $root) + protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) { $authors = $this->_container->getAuthors(); if ((!$authors || empty($authors))) { @@ -210,7 +216,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setEnclosure(DOMDocument $dom, DOMElement $root) + protected function _setEnclosure(\DOMDocument $dom, \DOMElement $root) { $data = $this->_container->getEnclosure(); if ((!$data || empty($data))) { @@ -230,7 +236,7 @@ protected function _setEnclosure(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setLink(DOMDocument $dom, DOMElement $root) + protected function _setLink(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getLink()) { return; @@ -248,7 +254,7 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setId(DOMDocument $dom, DOMElement $root) + protected function _setId(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getId() && !$this->getDataContainer()->getLink()) { @@ -263,7 +269,7 @@ protected function _setId(DOMDocument $dom, DOMElement $root) } $text = $dom->createTextNode($this->getDataContainer()->getId()); $id->appendChild($text); - if (!Zend_Uri::check($this->getDataContainer()->getId())) { + if (!\Zend\URI\URL::validate($this->getDataContainer()->getId())) { $id->setAttribute('isPermaLink', 'false'); } } @@ -275,7 +281,7 @@ protected function _setId(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCommentLink(DOMDocument $dom, DOMElement $root) + protected function _setCommentLink(\DOMDocument $dom, \DOMElement $root) { $link = $this->getDataContainer()->getCommentLink(); if (!$link) { @@ -294,7 +300,7 @@ protected function _setCommentLink(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCategories(DOMDocument $dom, DOMElement $root) + protected function _setCategories(\DOMDocument $dom, \DOMElement $root) { $categories = $this->getDataContainer()->getCategories(); if (!$categories) { diff --git a/src/Writer/Renderer/Feed/Atom.php b/src/Writer/Renderer/Feed/Atom/Atom.php similarity index 74% rename from src/Writer/Renderer/Feed/Atom.php rename to src/Writer/Renderer/Feed/Atom/Atom.php index fb4b81df..3381d8b4 100644 --- a/src/Writer/Renderer/Feed/Atom.php +++ b/src/Writer/Renderer/Feed/Atom/Atom.php @@ -19,32 +19,37 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Writer\Renderer\Feed\Atom; + /** * @uses DOMDocument - * @uses Zend_Feed_Writer - * @uses Zend_Feed_Writer_Feed - * @uses Zend_Feed_Writer_Renderer_Entry_Atom - * @uses Zend_Feed_Writer_Renderer_Entry_Atom_Deleted - * @uses Zend_Feed_Writer_Renderer_Feed_Atom_AtomAbstract - * @uses Zend_Feed_Writer_Renderer_RendererAbstract - * @uses Zend_Feed_Writer_Renderer_RendererInterface - * @uses Zend_Version + * @uses \Zend\Feed\Writer\Writer + * @uses \Zend\Feed\Writer\Feed\Feed + * @uses \Zend\Feed\Writer\Renderer\Entry\Atom\Atom + * @uses \Zend\Feed\Writer\Renderer\Entry\Atom\Deleted + * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\AtomAbstract + * @uses \Zend\Feed\Writer\Renderer\RendererAbstract + * @uses \Zend\Feed\Writer\Renderer\RendererInterface + * @uses \Zend\Version * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Renderer_Feed_Atom - extends Zend_Feed_Writer_Renderer_Feed_Atom_AtomAbstract - implements Zend_Feed_Writer_Renderer_RendererInterface +class Atom + extends AtomAbstract + implements \Zend\Feed\Writer\Renderer\RendererInterface { /** * Constructor * - * @param Zend_Feed_Writer_Feed $container + * @param \Zend\Feed\Writer\Feed\Feed $container * @return void */ - public function __construct (Zend_Feed_Writer_Feed $container) + public function __construct (\Zend\Feed\Writer\Feed\Feed $container) { parent::__construct($container); } @@ -52,17 +57,17 @@ public function __construct (Zend_Feed_Writer_Feed $container) /** * Render Atom feed * - * @return Zend_Feed_Writer_Renderer_Feed_Atom + * @return \Zend\Feed\Writer\Renderer\Feed\Atom\Atom */ public function render() { if (!$this->_container->getEncoding()) { $this->_container->setEncoding('UTF-8'); } - $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; $root = $this->_dom->createElementNS( - Zend_Feed_Writer::NAMESPACE_ATOM_10, 'feed' + \Zend\Feed\Writer\Writer::NAMESPACE_ATOM_10, 'feed' ); $this->setRootElement($root); $this->_dom->appendChild($root); @@ -92,15 +97,15 @@ public function render() if ($this->getDataContainer()->getEncoding()) { $entry->setEncoding($this->getDataContainer()->getEncoding()); } - if ($entry instanceof Zend_Feed_Writer_Entry) { - $renderer = new Zend_Feed_Writer_Renderer_Entry_Atom($entry); + if ($entry instanceof \Zend\Feed\Writer\Entry) { + $renderer = new \Zend\Feed\Writer\Renderer\Entry\Atom\Atom($entry); } else { if (!$this->_dom->documentElement->hasAttribute('xmlns:at')) { $this->_dom->documentElement->setAttribute( 'xmlns:at', 'http://purl.org/atompub/tombstones/1.0' ); } - $renderer = new Zend_Feed_Writer_Renderer_Entry_Atom_Deleted($entry); + $renderer = new \Zend\Feed\Writer\Renderer\Entry\Atom\Deleted($entry); } if ($this->_ignoreExceptions === true) { $renderer->ignoreExceptions(); diff --git a/src/Writer/Renderer/Feed/Atom/AtomAbstract.php b/src/Writer/Renderer/Feed/Atom/AtomAbstract.php index c6ba71e0..0f8922df 100644 --- a/src/Writer/Renderer/Feed/Atom/AtomAbstract.php +++ b/src/Writer/Renderer/Feed/Atom/AtomAbstract.php @@ -20,25 +20,31 @@ */ /** - * @uses Zend_Date - * @uses Zend_Feed_Exception - * @uses Zend_Feed_Writer_Feed - * @uses Zend_Feed_Writer_Renderer_Entry_Atom - * @uses Zend_Feed_Writer_Renderer_RendererAbstract - * @uses Zend_Feed_Writer_Renderer_RendererInterface - * @uses Zend_Version + * @namespace + */ +namespace Zend\Feed\Writer\Renderer\Feed\Atom; +use Zend\Feed; + +/** + * @uses \Zend\Date\Date + * @uses \Zend\Feed\Exception + * @uses \Zend\Feed\Writer\Feed\Feed + * @uses \Zend\Feed\Writer\Renderer\Entry\Atom\Atom + * @uses \Zend\Feed\Writer\Renderer\RendererAbstract + * @uses \Zend\Feed\Writer\Renderer\RendererInterface + * @uses \Zend\Version * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Renderer_Feed_Atom_AtomAbstract - extends Zend_Feed_Writer_Renderer_RendererAbstract +class AtomAbstract + extends Feed\Writer\Renderer\RendererAbstract { /** * Constructor * - * @param Zend_Feed_Writer_Feed $container + * @param \Zend\Feed\Writer\Feed\Feed $container * @return void */ public function __construct ($container) @@ -53,7 +59,7 @@ public function __construct ($container) * @param DOMElement $root * @return void */ - protected function _setLanguage(DOMDocument $dom, DOMElement $root) + protected function _setLanguage(\DOMDocument $dom, \DOMElement $root) { if ($this->getDataContainer()->getLanguage()) { $root->setAttribute('xml:lang', $this->getDataContainer() @@ -68,12 +74,12 @@ protected function _setLanguage(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setTitle(DOMDocument $dom, DOMElement $root) + protected function _setTitle(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getTitle()) { $message = 'Atom 1.0 feed elements MUST contain exactly one' . ' atom:title element but a title has not been set'; - $exception = new Zend_Feed_Exception($message); + $exception = new Feed\Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -96,7 +102,7 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDescription(DOMDocument $dom, DOMElement $root) + protected function _setDescription(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getDescription()) { return; @@ -115,12 +121,12 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateModified(DOMDocument $dom, DOMElement $root) + protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getDateModified()) { $message = 'Atom 1.0 feed elements MUST contain exactly one' . ' atom:updated element but a modification date has not been set'; - $exception = new Zend_Feed_Exception($message); + $exception = new Feed\Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -132,7 +138,7 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) $updated = $dom->createElement('updated'); $root->appendChild($updated); $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(Zend_Date::ISO_8601) + $this->getDataContainer()->getDateModified()->get(\Zend\Date\Date::ISO_8601) ); $updated->appendChild($text); } @@ -144,11 +150,11 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setGenerator(DOMDocument $dom, DOMElement $root) + protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getGenerator()) { $this->getDataContainer()->setGenerator('Zend_Feed_Writer', - Zend_Version::VERSION, 'http://framework.zend.com'); + \Zend\Version::VERSION, 'http://framework.zend.com'); } $gdata = $this->getDataContainer()->getGenerator(); @@ -171,7 +177,7 @@ protected function _setGenerator(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setLink(DOMDocument $dom, DOMElement $root) + protected function _setLink(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getLink()) { return; @@ -190,7 +196,7 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) + protected function _setFeedLinks(\DOMDocument $dom, \DOMElement $root) { $flinks = $this->getDataContainer()->getFeedLinks(); if(!$flinks || !array_key_exists('atom', $flinks)) { @@ -198,7 +204,7 @@ protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) . 'element with a rel attribute value of "self". This is the ' . 'preferred URI for retrieving Atom Feed Documents representing ' . 'this Atom feed but a feed link has not been set'; - $exception = new Zend_Feed_Exception($message); + $exception = new Feed\Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -224,7 +230,7 @@ protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setAuthors(DOMDocument $dom, DOMElement $root) + protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) { $authors = $this->_container->getAuthors(); if (!$authors || empty($authors)) { @@ -264,7 +270,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setId(DOMDocument $dom, DOMElement $root) + protected function _setId(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getId() && !$this->getDataContainer()->getLink()) { @@ -272,7 +278,7 @@ protected function _setId(DOMDocument $dom, DOMElement $root) . 'atom:id element, or as an alternative, we can use the same ' . 'value as atom:link however neither a suitable link nor an ' . 'id have been set'; - $exception = new Zend_Feed_Exception($message); + $exception = new Feed\Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -298,7 +304,7 @@ protected function _setId(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCopyright(DOMDocument $dom, DOMElement $root) + protected function _setCopyright(\DOMDocument $dom, \DOMElement $root) { $copyright = $this->getDataContainer()->getCopyright(); if (!$copyright) { @@ -317,7 +323,7 @@ protected function _setCopyright(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateCreated(DOMDocument $dom, DOMElement $root) + protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getDateCreated()) { return; @@ -336,7 +342,7 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) + protected function _setBaseUrl(\DOMDocument $dom, \DOMElement $root) { $baseUrl = $this->getDataContainer()->getBaseUrl(); if (!$baseUrl) { @@ -352,7 +358,7 @@ protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setHubs(DOMDocument $dom, DOMElement $root) + protected function _setHubs(\DOMDocument $dom, \DOMElement $root) { $hubs = $this->getDataContainer()->getHubs(); if (!$hubs) { @@ -373,7 +379,7 @@ protected function _setHubs(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCategories(DOMDocument $dom, DOMElement $root) + protected function _setCategories(\DOMDocument $dom, \DOMElement $root) { $categories = $this->getDataContainer()->getCategories(); if (!$categories) { diff --git a/src/Writer/Renderer/Feed/Atom/Source.php b/src/Writer/Renderer/Feed/Atom/Source.php index 2008348e..649bac91 100644 --- a/src/Writer/Renderer/Feed/Atom/Source.php +++ b/src/Writer/Renderer/Feed/Atom/Source.php @@ -18,19 +18,24 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ - + +/** + * @namespace + */ +namespace Zend\Feed\Writer\Renderer\Feed\Atom; + /** * @uses DOMDocument - * @uses Zend_Feed_Writer_Renderer_Feed_Atom_AtomAbstract - * @uses Zend_Feed_Writer_Renderer_RendererInterface + * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\AtomAbstract + * @uses \Zend\Feed\Writer\Renderer\RendererInterface * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Renderer_Feed_Atom_Source - extends Zend_Feed_Writer_Renderer_Feed_Atom_AtomAbstract - implements Zend_Feed_Writer_Renderer_RendererInterface +class Source + extends AtomAbstract + implements \Zend\Feed\Writer\Renderer\RendererInterface { /** @@ -39,7 +44,7 @@ class Zend_Feed_Writer_Renderer_Feed_Atom_Source * @param Zend_Feed_Writer_Feed_Source $container * @return void */ - public function __construct (Zend_Feed_Writer_Source $container) + public function __construct (\Zend\Feed\Writer\Source $container) { parent::__construct($container); } @@ -47,14 +52,14 @@ public function __construct (Zend_Feed_Writer_Source $container) /** * Render Atom Feed Metadata (Source element) * - * @return Zend_Feed_Writer_Renderer_Feed_Atom + * @return \Zend\Feed\Writer\Renderer\Feed\Atom\Atom */ public function render() { if (!$this->_container->getEncoding()) { $this->_container->setEncoding('UTF-8'); } - $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; $root = $this->_dom->createElement('source'); $this->setRootElement($root); @@ -89,7 +94,7 @@ public function render() * @param DOMElement $root * @return void */ - protected function _setGenerator(DOMDocument $dom, DOMElement $root) + protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getGenerator()) { return; diff --git a/src/Writer/Renderer/Feed/RSS.php b/src/Writer/Renderer/Feed/RSS.php new file mode 100644 index 00000000..0ec37a60 --- /dev/null +++ b/src/Writer/Renderer/Feed/RSS.php @@ -0,0 +1,371 @@ +_container->getEncoding()) { + $this->_container->setEncoding('UTF-8'); + } + $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom->formatOutput = true; + $this->_dom->substituteEntities = false; + $rss = $this->_dom->createElement('rss'); + $this->setRootElement($rss); + $rss->setAttribute('version', '2.0'); + + $channel = $this->_dom->createElement('channel'); + $rss->appendChild($channel); + $this->_dom->appendChild($rss); + $this->_setLanguage($this->_dom, $channel); + $this->_setBaseUrl($this->_dom, $channel); + $this->_setTitle($this->_dom, $channel); + $this->_setDescription($this->_dom, $channel); + $this->_setDateCreated($this->_dom, $channel); + $this->_setDateModified($this->_dom, $channel); + $this->_setGenerator($this->_dom, $channel); + $this->_setLink($this->_dom, $channel); + $this->_setAuthors($this->_dom, $channel); + $this->_setCopyright($this->_dom, $channel); + $this->_setCategories($this->_dom, $channel); + + foreach ($this->_extensions as $ext) { + $ext->setType($this->getType()); + $ext->setRootElement($this->getRootElement()); + $ext->setDomDocument($this->getDomDocument(), $channel); + $ext->render(); + } + + foreach ($this->_container as $entry) { + if ($this->getDataContainer()->getEncoding()) { + $entry->setEncoding($this->getDataContainer()->getEncoding()); + } + if ($entry instanceof Feed\Writer\Entry) { + $renderer = new Feed\Writer\Renderer\Entry\RSS($entry); + } else { + continue; + } + if ($this->_ignoreExceptions === true) { + $renderer->ignoreExceptions(); + } + $renderer->setType($this->getType()); + $renderer->setRootElement($this->_dom->documentElement); + $renderer->render(); + $element = $renderer->getElement(); + $imported = $this->_dom->importNode($element, true); + $channel->appendChild($imported); + } + return $this; + } + + /** + * Set feed language + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setLanguage(\DOMDocument $dom, \DOMElement $root) + { + $lang = $this->getDataContainer()->getLanguage(); + if (!$lang) { + return; + } + $language = $dom->createElement('language'); + $root->appendChild($language); + $language->nodeValue = $lang; + } + + /** + * Set feed title + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setTitle(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getTitle()) { + $message = 'RSS 2.0 feed elements MUST contain exactly one' + . ' title element but a title has not been set'; + $exception = new Feed\Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + + $title = $dom->createElement('title'); + $root->appendChild($title); + $text = $dom->createTextNode($this->getDataContainer()->getTitle()); + $title->appendChild($text); + } + + /** + * Set feed description + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setDescription(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getDescription()) { + $message = 'RSS 2.0 feed elements MUST contain exactly one' + . ' description element but one has not been set'; + $exception = new Feed\Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $subtitle = $dom->createElement('description'); + $root->appendChild($subtitle); + $text = $dom->createTextNode($this->getDataContainer()->getDescription()); + $subtitle->appendChild($text); + } + + /** + * Set date feed was last modified + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getDateModified()) { + return; + } + + $updated = $dom->createElement('pubDate'); + $root->appendChild($updated); + $text = $dom->createTextNode( + $this->getDataContainer()->getDateModified()->get(\Zend\Date\Date::RSS) + ); + $updated->appendChild($text); + } + + /** + * Set feed generator string + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getGenerator()) { + $this->getDataContainer()->setGenerator('Zend_Feed_Writer', + \Zend\Version::VERSION, 'http://framework.zend.com'); + } + + $gdata = $this->getDataContainer()->getGenerator(); + $generator = $dom->createElement('generator'); + $root->appendChild($generator); + $name = $gdata['name']; + if (array_key_exists('version', $gdata)) { + $name .= ' ' . $gdata['version']; + } + if (array_key_exists('uri', $gdata)) { + $name .= ' (' . $gdata['uri'] . ')'; + } + $text = $dom->createTextNode($name); + $generator->appendChild($text); + } + + /** + * Set link to feed + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setLink(\DOMDocument $dom, \DOMElement $root) + { + $value = $this->getDataContainer()->getLink(); + if(!$value) { + $message = 'RSS 2.0 feed elements MUST contain exactly one' + . ' link element but one has not been set'; + $exception = new Feed\Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $link = $dom->createElement('link'); + $root->appendChild($link); + $text = $dom->createTextNode($value); + $link->appendChild($text); + if (!\Zend\URI\URL::validate($value)) { + $link->setAttribute('isPermaLink', 'false'); + } + } + + /** + * Set feed authors + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + { + $authors = $this->getDataContainer()->getAuthors(); + if (!$authors || empty($authors)) { + return; + } + foreach ($authors as $data) { + $author = $this->_dom->createElement('author'); + $name = $data['name']; + if (array_key_exists('email', $data)) { + $name = $data['email'] . ' (' . $data['name'] . ')'; + } + $text = $dom->createTextNode($name); + $author->appendChild($text); + $root->appendChild($author); + } + } + + /** + * Set feed copyright + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setCopyright(\DOMDocument $dom, \DOMElement $root) + { + $copyright = $this->getDataContainer()->getCopyright(); + if (!$copyright) { + return; + } + $copy = $dom->createElement('copyright'); + $root->appendChild($copy); + $text = $dom->createTextNode($copyright); + $copy->appendChild($text); + } + + /** + * Set date feed was created + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getDateCreated()) { + return; + } + if(!$this->getDataContainer()->getDateModified()) { + $this->getDataContainer()->setDateModified( + $this->getDataContainer()->getDateCreated() + ); + } + } + + /** + * Set base URL to feed links + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setBaseUrl(\DOMDocument $dom, \DOMElement $root) + { + $baseUrl = $this->getDataContainer()->getBaseUrl(); + if (!$baseUrl) { + return; + } + $root->setAttribute('xml:base', $baseUrl); + } + + /** + * Set feed categories + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setCategories(\DOMDocument $dom, \DOMElement $root) + { + $categories = $this->getDataContainer()->getCategories(); + if (!$categories) { + return; + } + foreach ($categories as $cat) { + $category = $dom->createElement('category'); + if (isset($cat['scheme'])) { + $category->setAttribute('domain', $cat['scheme']); + } + $text = $dom->createTextNode($cat['term']); + $category->appendChild($text); + $root->appendChild($category); + } + } +} diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index 6b230d6e..0ec37a60 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -19,32 +19,38 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Writer\Renderer\Feed; +use Zend\Feed; + /** * @uses DOMDocument - * @uses Zend_Date - * @uses Zend_Feed_Exception - * @uses Zend_Feed_Writer_Feed - * @uses Zend_Feed_Writer_Renderer_Entry_Rss - * @uses Zend_Feed_Writer_Renderer_RendererAbstract - * @uses Zend_Feed_Writer_Renderer_RendererInterface - * @uses Zend_Uri - * @uses Zend_Version + * @uses \Zend\Date\Date + * @uses \Zend\Feed\Exception + * @uses \Zend\Feed\Writer\Feed\Feed + * @uses \Zend\Feed\Writer\Renderer\Entry\RSS + * @uses \Zend\Feed\Writer\Renderer\RendererAbstract + * @uses \Zend\Feed\Writer\Renderer\RendererInterface + * @uses \Zend\Uri\Uri + * @uses \Zend\Version * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Renderer_Feed_Rss - extends Zend_Feed_Writer_Renderer_RendererAbstract - implements Zend_Feed_Writer_Renderer_RendererInterface +class RSS + extends Feed\Writer\Renderer\RendererAbstract + implements Feed\Writer\Renderer\RendererInterface { /** * Constructor * - * @param Zend_Feed_Writer_Feed $container + * @param \Zend\Feed\Writer\Feed\Feed $container * @return void */ - public function __construct (Zend_Feed_Writer_Feed $container) + public function __construct (Feed\Writer\Feed\Feed $container) { parent::__construct($container); } @@ -52,14 +58,14 @@ public function __construct (Zend_Feed_Writer_Feed $container) /** * Render RSS feed * - * @return Zend_Feed_Writer_Renderer_Feed_Rss + * @return \Zend\Feed\Writer\Renderer\Feed\RSS */ public function render() { if (!$this->_container->getEncoding()) { $this->_container->setEncoding('UTF-8'); } - $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; $this->_dom->substituteEntities = false; $rss = $this->_dom->createElement('rss'); @@ -92,8 +98,8 @@ public function render() if ($this->getDataContainer()->getEncoding()) { $entry->setEncoding($this->getDataContainer()->getEncoding()); } - if ($entry instanceof Zend_Feed_Writer_Entry) { - $renderer = new Zend_Feed_Writer_Renderer_Entry_Rss($entry); + if ($entry instanceof Feed\Writer\Entry) { + $renderer = new Feed\Writer\Renderer\Entry\RSS($entry); } else { continue; } @@ -117,7 +123,7 @@ public function render() * @param DOMElement $root * @return void */ - protected function _setLanguage(DOMDocument $dom, DOMElement $root) + protected function _setLanguage(\DOMDocument $dom, \DOMElement $root) { $lang = $this->getDataContainer()->getLanguage(); if (!$lang) { @@ -135,12 +141,12 @@ protected function _setLanguage(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setTitle(DOMDocument $dom, DOMElement $root) + protected function _setTitle(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getTitle()) { $message = 'RSS 2.0 feed elements MUST contain exactly one' . ' title element but a title has not been set'; - $exception = new Zend_Feed_Exception($message); + $exception = new Feed\Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -162,12 +168,12 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDescription(DOMDocument $dom, DOMElement $root) + protected function _setDescription(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getDescription()) { $message = 'RSS 2.0 feed elements MUST contain exactly one' . ' description element but one has not been set'; - $exception = new Zend_Feed_Exception($message); + $exception = new Feed\Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -188,7 +194,7 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateModified(DOMDocument $dom, DOMElement $root) + protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getDateModified()) { return; @@ -197,7 +203,7 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) $updated = $dom->createElement('pubDate'); $root->appendChild($updated); $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(Zend_Date::RSS) + $this->getDataContainer()->getDateModified()->get(\Zend\Date\Date::RSS) ); $updated->appendChild($text); } @@ -209,11 +215,11 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setGenerator(DOMDocument $dom, DOMElement $root) + protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getGenerator()) { $this->getDataContainer()->setGenerator('Zend_Feed_Writer', - Zend_Version::VERSION, 'http://framework.zend.com'); + \Zend\Version::VERSION, 'http://framework.zend.com'); } $gdata = $this->getDataContainer()->getGenerator(); @@ -237,13 +243,13 @@ protected function _setGenerator(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setLink(DOMDocument $dom, DOMElement $root) + protected function _setLink(\DOMDocument $dom, \DOMElement $root) { $value = $this->getDataContainer()->getLink(); if(!$value) { $message = 'RSS 2.0 feed elements MUST contain exactly one' . ' link element but one has not been set'; - $exception = new Zend_Feed_Exception($message); + $exception = new Feed\Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -255,7 +261,7 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) $root->appendChild($link); $text = $dom->createTextNode($value); $link->appendChild($text); - if (!Zend_Uri::check($value)) { + if (!\Zend\URI\URL::validate($value)) { $link->setAttribute('isPermaLink', 'false'); } } @@ -267,7 +273,7 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setAuthors(DOMDocument $dom, DOMElement $root) + protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) { $authors = $this->getDataContainer()->getAuthors(); if (!$authors || empty($authors)) { @@ -292,7 +298,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCopyright(DOMDocument $dom, DOMElement $root) + protected function _setCopyright(\DOMDocument $dom, \DOMElement $root) { $copyright = $this->getDataContainer()->getCopyright(); if (!$copyright) { @@ -311,7 +317,7 @@ protected function _setCopyright(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateCreated(DOMDocument $dom, DOMElement $root) + protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) { if(!$this->getDataContainer()->getDateCreated()) { return; @@ -330,7 +336,7 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) + protected function _setBaseUrl(\DOMDocument $dom, \DOMElement $root) { $baseUrl = $this->getDataContainer()->getBaseUrl(); if (!$baseUrl) { @@ -346,7 +352,7 @@ protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCategories(DOMDocument $dom, DOMElement $root) + protected function _setCategories(\DOMDocument $dom, \DOMElement $root) { $categories = $this->getDataContainer()->getCategories(); if (!$categories) { diff --git a/src/Writer/Renderer/RendererAbstract.php b/src/Writer/Renderer/RendererAbstract.php index e8268353..ea9bdfd3 100644 --- a/src/Writer/Renderer/RendererAbstract.php +++ b/src/Writer/Renderer/RendererAbstract.php @@ -18,17 +18,23 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ - + +/** + * @namespace + */ +namespace Zend\Feed\Writer\Renderer; +use Zend\Feed\Writer; + /** - * @uses Zend_Feed_Exception - * @uses Zend_Feed_Writer - * @uses Zend_Version + * @uses \Zend\Feed\Exception + * @uses \Zend\Feed\Writer\Writer + * @uses \Zend\Version * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Renderer_RendererAbstract +class RendererAbstract { /** * Extensions @@ -133,7 +139,7 @@ public function getDataContainer() * Set feed encoding * * @param string $enc - * @return Zend_Feed_Writer_Renderer_RendererAbstract + * @return \Zend\Feed\Writer\Renderer\RendererAbstract */ public function setEncoding($enc) { @@ -155,12 +161,12 @@ public function getEncoding() * Indicate whether or not to ignore exceptions * * @param bool $bool - * @return Zend_Feed_Writer_Renderer_RendererAbstract + * @return \Zend\Feed\Writer\Renderer\RendererAbstract */ public function ignoreExceptions($bool = true) { if (!is_bool($bool)) { - throw new Zend_Feed_Exception('Invalid parameter: $bool. Should be TRUE or FALSE (defaults to TRUE if null)'); + throw new \Zend\Feed\Exception('Invalid parameter: $bool. Should be TRUE or FALSE (defaults to TRUE if null)'); } $this->_ignoreExceptions = $bool; return $this; @@ -206,7 +212,7 @@ public function getType() * * @param DOMElement $root */ - public function setRootElement(DOMElement $root) + public function setRootElement(\DOMElement $root) { $this->_rootElement = $root; } @@ -228,15 +234,15 @@ public function getRootElement() */ protected function _loadExtensions() { - Zend_Feed_Writer::registerCoreExtensions(); - $all = Zend_Feed_Writer::getExtensions(); + Writer\Writer::registerCoreExtensions(); + $all = Writer\Writer::getExtensions(); if (stripos(get_class($this), 'entry')) { $exts = $all['entryRenderer']; } else { $exts = $all['feedRenderer']; } foreach ($exts as $extension) { - $className = Zend_Feed_Writer::getPluginLoader()->getClassName($extension); + $className = Writer\Writer::getPluginLoader()->getClassName($extension); $this->_extensions[$extension] = new $className( $this->getDataContainer() ); diff --git a/src/Writer/Renderer/RendererInterface.php b/src/Writer/Renderer/RendererInterface.php index 566d70b6..70c304bd 100644 --- a/src/Writer/Renderer/RendererInterface.php +++ b/src/Writer/Renderer/RendererInterface.php @@ -19,13 +19,18 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace Zend\Feed\Writer\Renderer; + /** * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface Zend_Feed_Writer_Renderer_RendererInterface +interface RendererInterface { /** * Render feed/entry @@ -100,7 +105,7 @@ public function getType(); * * @param DOMElement $root */ - public function setRootElement(DOMElement $root); + public function setRootElement(\DOMElement $root); /** * Retrieve the absolute root element for the XML feed being generated. diff --git a/src/Writer/Source.php b/src/Writer/Source.php index 2281bf02..0e41d125 100644 --- a/src/Writer/Source.php +++ b/src/Writer/Source.php @@ -20,13 +20,18 @@ */ /** - * @uses Zend_Feed_Writer_Feed_FeedAbstract + * @namespace + */ +namespace Zend\Feed\Writer; + +/** + * @uses \Zend\Feed\Writer\Feed\FeedAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Source extends Zend_Feed_Writer_Feed_FeedAbstract +class Source extends Feed\FeedAbstract { } diff --git a/src/Writer.php b/src/Writer/Writer.php similarity index 86% rename from src/Writer.php rename to src/Writer/Writer.php index bf095a10..f52deb1f 100644 --- a/src/Writer.php +++ b/src/Writer/Writer.php @@ -20,14 +20,20 @@ */ /** - * @uses Zend_Feed_Exception - * @uses Zend_Loader_PluginLoader + * @namespace + */ +namespace Zend\Feed\Writer; +use Zend\Loader\PluginLoader; + +/** + * @uses \Zend\Feed\Exception + * @uses \Zend\Loader\PluginLoader\PluginLoader * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer +class Writer { /** * Namespace constants @@ -59,7 +65,7 @@ class Zend_Feed_Writer /** * PluginLoader instance used by component * - * @var Zend_Loader_PluginLoader_Interface + * @var \Zend\Loader\PluginLoader\PluginLoaderInterface */ protected static $_pluginLoader = null; @@ -87,9 +93,9 @@ class Zend_Feed_Writer /** * Set plugin loader for use with Extensions * - * @param Zend_Loader_PluginLoader_Interface + * @param \Zend\Loader\PluginLoader\PluginLoaderInterface */ - public static function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader) + public static function setPluginLoader(PluginLoader\PluginLoaderInterface $loader) { self::$_pluginLoader = $loader; } @@ -97,13 +103,13 @@ public static function setPluginLoader(Zend_Loader_PluginLoader_Interface $loade /** * Get plugin loader for use with Extensions * - * @return Zend_Loader_PluginLoader_Interface + * @return \Zend\Loader\PluginLoader\PluginLoaderInterface */ public static function getPluginLoader() { if (!isset(self::$_pluginLoader)) { - self::$_pluginLoader = new Zend_Loader_PluginLoader(array( - 'Zend_Feed_Writer_Extension_' => 'Zend/Feed/Writer/Extension/', + self::$_pluginLoader = new PluginLoader\PluginLoader(array( + 'Zend\Feed\Writer\Extension\\' => 'Zend/Feed/Writer/Extension/', )); } return self::$_pluginLoader; @@ -146,14 +152,14 @@ public static function addPrefixPaths(array $spec) * * @param string $name * @return void - * @throws Zend_Feed_Exception if unable to resolve Extension class + * @throws \Zend\Feed\Exception if unable to resolve Extension class */ public static function registerExtension($name) { - $feedName = $name . '_Feed'; - $entryName = $name . '_Entry'; - $feedRendererName = $name . '_Renderer_Feed'; - $entryRendererName = $name . '_Renderer_Entry'; + $feedName = $name . '\Feed'; + $entryName = $name . '\Entry'; + $feedRendererName = $name . '\Renderer\Feed'; + $entryRendererName = $name . '\Renderer\Entry'; if (self::isRegistered($name)) { if (self::getPluginLoader()->isLoaded($feedName) || self::getPluginLoader()->isLoaded($entryName) @@ -166,29 +172,29 @@ public static function registerExtension($name) try { self::getPluginLoader()->load($feedName); self::$_extensions['feed'][] = $feedName; - } catch (Zend_Loader_PluginLoader_Exception $e) { + } catch (PluginLoader\Exception $e) { } try { self::getPluginLoader()->load($entryName); self::$_extensions['entry'][] = $entryName; - } catch (Zend_Loader_PluginLoader_Exception $e) { + } catch (PluginLoader\Exception $e) { } try { self::getPluginLoader()->load($feedRendererName); self::$_extensions['feedRenderer'][] = $feedRendererName; - } catch (Zend_Loader_PluginLoader_Exception $e) { + } catch (PluginLoader\Exception $e) { } try { self::getPluginLoader()->load($entryRendererName); self::$_extensions['entryRenderer'][] = $entryRendererName; - } catch (Zend_Loader_PluginLoader_Exception $e) { + } catch (PluginLoader\Exception $e) { } if (!self::getPluginLoader()->isLoaded($feedName) && !self::getPluginLoader()->isLoaded($entryName) && !self::getPluginLoader()->isLoaded($feedRendererName) && !self::getPluginLoader()->isLoaded($entryRendererName) ) { - throw new Zend_Feed_Exception('Could not load extension: ' . $name + throw new \Zend\Feed\Exception('Could not load extension: ' . $name . 'using Plugin Loader. Check prefix paths are configured and extension exists.'); } } diff --git a/test/ArrayAccessTest.php b/test/ArrayAccessTest.php index 19ee8b10..3eba1fd0 100644 --- a/test/ArrayAccessTest.php +++ b/test/ArrayAccessTest.php @@ -20,6 +20,12 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed; +use Zend\Feed; + /** * Test helper */ @@ -36,15 +42,15 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed */ -class Zend_Feed_ArrayAccessTest extends PHPUnit_Framework_TestCase +class ArrayAccessTest extends \PHPUnit_Framework_TestCase { protected $_feed; protected $_nsfeed; public function setUp() { - $this->_feed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); - $this->_nsfeed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeedNamespaced.xml'); + $this->_feed = Feed\Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); + $this->_nsfeed = Feed\Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeedNamespaced.xml'); } public function testExists() @@ -80,12 +86,12 @@ public function testSet() public function testUnset() { - $feed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); + $feed = Feed\Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); unset($feed['version']); $this->assertFalse(isset($feed['version']), 'Version should be unset'); $this->assertEquals('', $feed['version'], 'Version should be equal to the empty string'); - $nsfeed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeedNamespaced.xml'); + $nsfeed = Feed\Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeedNamespaced.xml'); unset($nsfeed['version']); $this->assertFalse(isset($nsfeed['version']), 'Version should be unset'); $this->assertEquals('', $nsfeed['version'], 'Version should be equal to the empty string'); @@ -96,7 +102,7 @@ public function testUnset() */ public function testGetsLinkWithEmptyOrMissingRelAsAlternateRel() { - $feed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/AtomHOnline.xml'); + $feed = Feed\Feed::importFile(dirname(__FILE__) . '/_files/AtomHOnline.xml'); $entry = $feed->current(); $this->assertEquals('http://www.h-online.com/security/Google-acquires-reCAPTCHA--/news/114266/from/rss', $entry->link('alternate')); } diff --git a/test/AtomEntryOnlyTest.php b/test/AtomEntryOnlyTest.php index 50c980b4..c569cf60 100644 --- a/test/AtomEntryOnlyTest.php +++ b/test/AtomEntryOnlyTest.php @@ -21,16 +21,10 @@ */ /** - * Test helper + * @namespace */ +namespace ZendTest\Feed; -/** - * @see Zend_Feed - */ - -/** - * @see Zend_Feed_Atom - */ /** * @category Zend @@ -40,17 +34,19 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed */ -class Zend_Feed_AtomEntryOnlyTest extends PHPUnit_Framework_TestCase +class AtomEntryOnlyTest extends \PHPUnit_Framework_TestCase { public function testEntryOnly() { - $feed = new Zend_Feed_Atom(null, file_get_contents(dirname(__FILE__) . '/_files/TestAtomFeedEntryOnly.xml')); + $feed = new \Zend\Feed\Atom(null, file_get_contents(dirname(__FILE__) . '/_files/TestAtomFeedEntryOnly.xml')); $this->assertEquals(1, $feed->count(), 'The entry-only feed should report one entry.'); + $feed->current(); + foreach ($feed as $entry); - $this->assertEquals('Zend_Feed_Entry_Atom', get_class($entry), + $this->assertEquals('Zend\Feed\Entry\Atom', get_class($entry), 'The single entry should be an instance of Zend_Feed_Entry_Atom'); $this->assertEquals('1', $entry->id(), 'The single entry should have id 1'); diff --git a/test/AtomPublishingTest.php b/test/AtomPublishingTest.php index 6d0938cb..e432643d 100644 --- a/test/AtomPublishingTest.php +++ b/test/AtomPublishingTest.php @@ -21,16 +21,13 @@ */ /** - * Test helper + * @namespace */ +namespace ZendTest\Feed; +use Zend\Feed; +use Zend\HTTP; +use Zend\Feed\Entry; -/** - * @see Zend_Feed_Entry_Atom - */ - -/** - * @see Zend_Http_Client_File - */ /** * @category Zend @@ -40,7 +37,7 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed */ -class Zend_Feed_AtomPublishingTest extends PHPUnit_Framework_TestCase +class AtomPublishingTest extends \PHPUnit_Framework_TestCase { protected $_uri; @@ -51,14 +48,14 @@ public function setUp() public function tearDown() { - Zend_Feed::setHttpClient(new Zend_Http_Client()); + Feed\Feed::setHttpClient(new HTTP\Client()); } public function testPost() { - Zend_Feed::setHttpClient(new TestClient()); + Feed\Feed::setHttpClient(new TestClient()); - $entry = new Zend_Feed_Entry_Atom(); + $entry = new Entry\Atom(); /* Give the entry its initial values. */ $entry->title = 'Entry 1'; @@ -81,12 +78,12 @@ public function testPost() public function testEdit() { - Zend_Feed::setHttpClient(new TestClient()); + Feed\Feed::setHttpClient(new TestClient()); $contents = file_get_contents(dirname(__FILE__) . '/_files/AtomPublishingTest-before-update.xml'); /* The base feed URI is the same as the POST URI, so just supply the * Zend_Feed_Entry_Atom object with that. */ - $entry = new Zend_Feed_Entry_Atom($this->_uri, $contents); + $entry = new Entry\Atom($this->_uri, $contents); /* Initial state. */ $this->assertEquals('2005-05-23T16:26:00-08:00', $entry->updated(), 'Initial state of updated timestamp does not match'); @@ -110,7 +107,7 @@ public function testEdit() * the request. * */ -class TestClient extends Zend_Http_Client +class TestClient extends HTTP\Client { public function request($method = null) { @@ -124,9 +121,9 @@ public function request($method = null) break; case self::PUT: - $doc1 = new DOMDocument(); + $doc1 = new \DOMDocument(); $doc1->load(dirname(__FILE__) . '/_files/AtomPublishingTest-expected-update.xml'); - $doc2 = new DOMDocument(); + $doc2 = new \DOMDocument(); $doc2->loadXML($this->raw_post_data); if ($doc1->saveXml() == $doc2->saveXml()) { $code = 200; @@ -138,6 +135,6 @@ public function request($method = null) break; } - return new Zend_Http_Response($code, array(), $body); + return new \Zend\HTTP\Response\Response($code, array(), $body); } } diff --git a/test/CountTest.php b/test/CountTest.php index 7035d611..aaf57c73 100644 --- a/test/CountTest.php +++ b/test/CountTest.php @@ -20,6 +20,12 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed; +use Zend\Feed; + /** * Test helper */ @@ -36,12 +42,12 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed */ -class Zend_Feed_CountTest extends PHPUnit_Framework_TestCase +class CountTest extends \PHPUnit_Framework_TestCase { public function testCount() { - $f = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); + $f = Feed\Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); $this->assertEquals($f->count(), 2, 'Feed count should be 2'); } @@ -50,7 +56,7 @@ public function testCount() */ public function testCountableInterface() { - $f = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); + $f = Feed\Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); $this->assertEquals(count($f), 2, 'Feed count should be 2'); } diff --git a/test/ElementTest.php b/test/ElementTest.php index 3a9e81e1..f09f85cf 100644 --- a/test/ElementTest.php +++ b/test/ElementTest.php @@ -20,6 +20,13 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed; +use Zend\Feed\Entry; +use Zend\Feed; + /** * Test helper */ @@ -36,12 +43,12 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed */ -class Zend_Feed_ElementTest extends PHPUnit_Framework_TestCase +class ElementTest extends \PHPUnit_Framework_TestCase { public function testIsInitialized() { - $e = new Zend_Feed_Entry_Atom(); + $e = new Entry\Atom(); $e->author->name['last'] = 'hagenbuch'; $e->author->name['first'] = 'chuck'; $e->author->name->{'chuck:url'} = 'marina.horde.org'; @@ -77,10 +84,10 @@ public function testStrings() 2005-11-07T08:15:57-08:00 "; - $entry = new Zend_Feed_Entry_Atom('uri', $xml); + $entry = new Entry\Atom('uri', $xml); - $this->assertTrue($entry->summary instanceof Zend_Feed_Element, '__get access should return an Zend_Feed_Element instance'); - $this->assertFalse($entry->summary() instanceof Zend_Feed_Element, 'method access should not return an Zend_Feed_Element instance'); + $this->assertTrue($entry->summary instanceof Feed\Element, '__get access should return an Zend_Feed_Element instance'); + $this->assertFalse($entry->summary() instanceof Feed\Element, 'method access should not return an Zend_Feed_Element instance'); $this->assertTrue(is_string($entry->summary()), 'method access should return a string'); $this->assertFalse(is_string($entry->summary), '__get access should not return a string'); } @@ -89,7 +96,7 @@ public function testSetNamespacedAttributes() { $value = 'value'; - $e = new Zend_Feed_Entry_Atom(); + $e = new Entry\Atom(); $e->test['attr'] = $value; $e->test['namespace1:attr'] = $value; $e->test['namespace2:attr'] = $value; @@ -103,7 +110,7 @@ public function testUnsetNamespacedAttributes() { $value = 'value'; - $e = new Zend_Feed_Entry_Atom(); + $e = new Entry\Atom(); $e->test['attr'] = $value; $e->test['namespace1:attr'] = $value; $e->test['namespace2:attr'] = $value; @@ -130,7 +137,7 @@ public function testValuesWithXmlSpecialChars() $testLt = '<'; $testGt = '>'; - $e = new Zend_Feed_Entry_Atom(); + $e = new Entry\Atom(); $e->testAmp = $testAmp; $e->{'namespace1:lt'} = $testLt; $e->{'namespace1:gt'} = $testGt; @@ -151,7 +158,7 @@ public function testAttributesWithXmlSpecialChars() $testQuot = '"'; $testSquot = "'"; - $e = new Zend_Feed_Entry_Atom(); + $e = new Entry\Atom(); $e->test['amp'] = $testAmp; $e->test['namespace1:lt'] = $testLt; $e->test['namespace1:gt'] = $testGt; diff --git a/test/Entry/RssTest.php b/test/Entry/RSSTest.php similarity index 81% rename from test/Entry/RssTest.php rename to test/Entry/RSSTest.php index bc1b7aa6..b0f0248b 100644 --- a/test/Entry/RssTest.php +++ b/test/Entry/RSSTest.php @@ -21,12 +21,11 @@ */ /** - * Test helper + * @namespace */ +namespace ZendTest\Feed\Entry; +use Zend\Feed; -/** - * @see Zend_Feed - */ /** * @category Zend @@ -36,16 +35,16 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed */ -class Zend_Feed_Entry_RssTest extends PHPUnit_Framework_TestCase +class RSSTest extends \PHPUnit_Framework_TestCase { public function testContentEncodedSupport() { - $feed = Zend_Feed::importFile(dirname(__FILE__) . '/../_files/TestFeedEntryRssContentEncoded.xml'); - $this->assertType('Zend_Feed_Rss', $feed); + $feed = Feed\Feed::importFile(dirname(__FILE__) . '/../_files/TestFeedEntryRssContentEncoded.xml'); + $this->assertType('Zend\Feed\RSS', $feed); $item = $feed->current(); - $this->assertType('Zend_Feed_Entry_Rss', $item); + $this->assertType('Zend\Feed\Entry\RSS', $item); $this->assertTrue(isset($item->content)); $this->assertContains( @@ -62,12 +61,12 @@ public function testContentEncodedSupport() public function testContentEncodedNullIfEmpty() { - $feed = Zend_Feed::importFile(dirname(__FILE__) . '/../_files/TestFeedEntryRssContentEncoded.xml'); - $this->assertType('Zend_Feed_Rss', $feed); + $feed = Feed\Feed::importFile(dirname(__FILE__) . '/../_files/TestFeedEntryRssContentEncoded.xml'); + $this->assertType('Zend\Feed\RSS', $feed); $feed->next(); $item = $feed->current(); - $this->assertType('Zend_Feed_Entry_Rss', $item); + $this->assertType('Zend\Feed\Entry\RSS', $item); $this->assertFalse(isset($item->content)); $this->assertNull($item->content()); // $this->assertNull($item->content); // always return DOMElement Object diff --git a/test/ImportTest.php b/test/ImportTest.php index b3eb7d08..ea130e9a 100644 --- a/test/ImportTest.php +++ b/test/ImportTest.php @@ -21,24 +21,13 @@ */ /** - * Test helper - */ - -/** - * @see Zend_Feed - */ - -/** - * @see Zend_Feed_Builder - */ - -/** - * @see Zend_Http_Client_Adapter_Test - */ - -/** - * @see Zend_Http_Client + * @namespace */ +namespace ZendTest\Feed; +use Zend\Feed; +use Zend\HTTP; +use Zend\Feed\Builder; +use Zend\HTTP\Response; /** * @category Zend @@ -48,7 +37,7 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed */ -class Zend_Feed_ImportTest extends PHPUnit_Framework_TestCase +class ImportTest extends \PHPUnit_Framework_TestCase { protected $_client; protected $_feedDir; @@ -62,9 +51,9 @@ class Zend_Feed_ImportTest extends PHPUnit_Framework_TestCase public function setUp() { - $this->_adapter = new Zend_Http_Client_Adapter_Test(); - Zend_Feed::setHttpClient(new Zend_Http_Client(null, array('adapter' => $this->_adapter))); - $this->_client = Zend_Feed::getHttpClient(); + $this->_adapter = new \Zend\HTTP\Client\Adapter\Test(); + Feed\Feed::setHttpClient(new HTTP\Client(null, array('adapter' => $this->_adapter))); + $this->_client = Feed\Feed::getHttpClient(); $this->_feedDir = dirname(__FILE__) . '/_files'; } @@ -211,8 +200,8 @@ public function testRss200Sample1() */ public function testRssImportFullArray() { - $feed = Zend_Feed::importArray($this->_getFullArray(), 'rss'); - $this->assertType('Zend_Feed_Rss', $feed); + $feed = Feed\Feed::importArray($this->_getFullArray(), 'rss'); + $this->assertType('Zend\Feed\RSS', $feed); } /** @@ -221,7 +210,7 @@ public function testRssImportFullArray() */ public function testRssImportSetsIsPermaLinkAsFalseIfGuidNotAUri() { - $feed = Zend_Feed::importArray($this->_getFullArray(), 'rss'); + $feed = Feed\Feed::importArray($this->_getFullArray(), 'rss'); $entry = $feed->current(); $this->assertEquals('false', $entry->guid['isPermaLink']); } @@ -231,7 +220,7 @@ public function testRssImportSetsIsPermaLinkAsFalseIfGuidNotAUri() */ public function testAtomImportFullArray() { - $feed = Zend_Feed::importArray($this->_getFullArray(), 'atom'); + $feed = Feed\Feed::importArray($this->_getFullArray(), 'atom'); } /** @@ -239,8 +228,8 @@ public function testAtomImportFullArray() */ public function testRssImportFullBuilder() { - $feed = Zend_Feed::importBuilder(new Zend_Feed_Builder($this->_getFullArray()), 'rss'); - $this->assertType('Zend_Feed_Rss', $feed); + $feed = Feed\Feed::importBuilder(new Builder\Builder($this->_getFullArray()), 'rss'); + $this->assertType('Zend\Feed\RSS', $feed); } /** @@ -258,8 +247,8 @@ public function testRssImportFulliTunesBuilder() $array['itunes']['explicit'] = 'clean'; $array['itunes']['block'] = 'no'; $array['itunes']['new-feed-url'] = 'http://www.example/itunes.xml'; - $feed = Zend_Feed::importBuilder(new Zend_Feed_Builder($array), 'rss'); - $this->assertType('Zend_Feed_Rss', $feed); + $feed = Feed\Feed::importBuilder(new Builder\Builder($array), 'rss'); + $this->assertType('Zend\Feed\RSS', $feed); } /** @@ -267,7 +256,7 @@ public function testRssImportFulliTunesBuilder() */ public function testAtomImportFullBuilder() { - $feed = Zend_Feed::importBuilder(new Zend_Feed_Builder($this->_getFullArray()), 'atom'); + $feed = Feed\Feed::importBuilder(new Builder\Builder($this->_getFullArray()), 'atom'); } @@ -276,10 +265,10 @@ public function testAtomImportFullBuilder() */ public function testAtomImportFullBuilderValid() { - $feed = Zend_Feed::importBuilder(new Zend_Feed_Builder($this->_getFullArray()), 'atom'); + $feed = Feed\Feed::importBuilder(new Builder\Builder($this->_getFullArray()), 'atom'); - $feed = Zend_Feed::importString($feed->saveXml()); - $this->assertType('Zend_Feed_Atom', $feed); + $feed = Feed\Feed::importString($feed->saveXml()); + $this->assertType('Zend\Feed\Atom', $feed); } /** @@ -287,10 +276,10 @@ public function testAtomImportFullBuilderValid() */ public function testRssImportFullBuilderValid() { - $feed = Zend_Feed::importBuilder(new Zend_Feed_Builder($this->_getFullArray()), 'rss'); - $this->assertType('Zend_Feed_Rss', $feed); - $feed = Zend_Feed::importString($feed->saveXml()); - $this->assertType('Zend_Feed_Rss', $feed); + $feed = Feed\Feed::importBuilder(new Builder\Builder($this->_getFullArray()), 'rss'); + $this->assertType('Zend\Feed\RSS', $feed); + $feed = Feed\Feed::importString($feed->saveXml()); + $this->assertType('Zend\Feed\RSS', $feed); } /** @@ -298,10 +287,10 @@ public function testRssImportFullBuilderValid() */ public function testAtomGetLink() { - $feed = Zend_Feed::importBuilder(new Zend_Feed_Builder($this->_getFullArray()), 'atom'); - $this->assertType('Zend_Feed_Atom', $feed); - $feed = Zend_Feed::importString($feed->saveXml()); - $this->assertType('Zend_Feed_Atom', $feed); + $feed = Feed\Feed::importBuilder(new Builder\Builder($this->_getFullArray()), 'atom'); + $this->assertType('Zend\Feed\Atom', $feed); + $feed = Feed\Feed::importString($feed->saveXml()); + $this->assertType('Zend\Feed\Atom', $feed); $href = $feed->link('self'); $this->assertEquals('http://www.example.com', $href); } @@ -316,14 +305,14 @@ public function testImportInvalidIsXdebugAware() $this->markTestIncomplete('XDebug not installed'); } - $response = new Zend_Http_Response(200, array(), ''); + $response = new Response\Response(200, array(), ''); $this->_adapter->setResponse($response); try { - $feed = Zend_Feed::import('http://localhost'); + $feed = Feed\Feed::import('http://localhost'); $this->fail('Expected Zend_Feed_Exception not thrown'); - } catch (Zend_Feed_Exception $e) { - $this->assertType('Zend_Feed_Exception', $e); + } catch (Feed\Exception $e) { + $this->assertType('Zend\Feed\Exception', $e); $this->assertRegExp('/(XDebug is running|Empty string)/', $e->getMessage()); } } @@ -412,11 +401,11 @@ protected function _getFullArray() */ protected function _importAtomValid($filename) { - $response = new Zend_Http_Response(200, array(), file_get_contents("$this->_feedDir/$filename")); + $response = new Response\Response(200, array(), file_get_contents("$this->_feedDir/$filename")); $this->_adapter->setResponse($response); - $feed = Zend_Feed::import('http://localhost'); - $this->assertType('Zend_Feed_Atom', $feed); + $feed = Feed\Feed::import('http://localhost'); + $this->assertType('Zend\Feed\Atom', $feed); } /** @@ -424,11 +413,11 @@ protected function _importAtomValid($filename) */ protected function _importRssValid($filename) { - $response = new Zend_Http_Response(200, array(), file_get_contents("$this->_feedDir/$filename")); + $response = new Response\Response(200, array(), file_get_contents("$this->_feedDir/$filename")); $this->_adapter->setResponse($response); - $feed = Zend_Feed::import('http://localhost'); - $this->assertType('Zend_Feed_Rss', $feed); + $feed = Feed\Feed::import('http://localhost'); + $this->assertType('Zend\Feed\RSS', $feed); return $feed; } @@ -437,14 +426,14 @@ protected function _importRssValid($filename) */ protected function _importInvalid($filename) { - $response = new Zend_Http_Response(200, array(), file_get_contents("$this->_feedDir/$filename")); + $response = new Response\Response(200, array(), file_get_contents("$this->_feedDir/$filename")); $this->_adapter->setResponse($response); try { - $feed = Zend_Feed::import('http://localhost'); + $feed = Feed\Feed::import('http://localhost'); $this->fail('Expected Zend_Feed_Exception not thrown'); - } catch (Zend_Feed_Exception $e) { - $this->assertType('Zend_Feed_Exception', $e); + } catch (Feed\Exception $e) { + $this->assertType('Zend\Feed\Exception', $e); } } @@ -459,8 +448,8 @@ public function testFindFeedsIncludesUriAsArrayKey() $this->markTestSkipped('testFindFeedsIncludesUriAsArrayKey() requires a network connection'); return; } - Zend_Feed::setHttpClient(new Zend_Http_Client); - $feeds = Zend_Feed::findFeeds('http://www.planet-php.net'); + Feed\Feed::setHttpClient(new HTTP\Client); + $feeds = Feed\Feed::findFeeds('http://www.planet-php.net'); $this->assertEquals(array( 'http://www.planet-php.org:80/rss/', 'http://www.planet-php.org:80/rdf/' ), array_keys($feeds)); diff --git a/test/IteratorTest.php b/test/IteratorTest.php index cb8851c7..35289cce 100644 --- a/test/IteratorTest.php +++ b/test/IteratorTest.php @@ -20,6 +20,12 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed; +use Zend\Feed; + /** * Test helper */ @@ -36,15 +42,15 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed */ -class Zend_Feed_IteratorTest extends PHPUnit_Framework_TestCase +class IteratorTest extends \PHPUnit_Framework_TestCase { private $_feed; private $_nsfeed; public function setUp() { - $this->_feed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); - $this->_nsfeed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeedNamespaced.xml'); + $this->_feed = Feed\Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); + $this->_nsfeed = Feed\Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeedNamespaced.xml'); } public function testRewind() @@ -77,12 +83,12 @@ public function testRewind() public function testCurrent() { foreach ($this->_feed as $f) { - $this->assertType('Zend_Feed_Entry_Atom', $f, 'Each feed entry should be an instance of Zend_Feed_Entry_Atom'); + $this->assertType('Zend\Feed\Entry\Atom', $f, 'Each feed entry should be an instance of Zend_Feed_Entry_Atom'); break; } foreach ($this->_nsfeed as $f) { - $this->assertType('Zend_Feed_Entry_Atom', $f, 'Each feed entry should be an instance of Zend_Feed_Entry_Atom'); + $this->assertType('Zend\Feed\Entry\Atom', $f, 'Each feed entry should be an instance of Zend_Feed_Entry_Atom'); break; } } diff --git a/test/Pubsubhubbub/PublisherTest.php b/test/Pubsubhubbub/PublisherTest.php index b4761d71..4818cbc1 100644 --- a/test/Pubsubhubbub/PublisherTest.php +++ b/test/Pubsubhubbub/PublisherTest.php @@ -19,7 +19,12 @@ * @version $Id$ */ - +/** + * @namespace + */ +namespace ZendTest\Feed\Pubsubhubbub; +use Zend\HTTP; +use Zend\Feed\PubSubHubbub; /** * @category Zend @@ -30,16 +35,19 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Pubsubhubbub_PublisherTest extends PHPUnit_Framework_TestCase +class PublisherTest extends \PHPUnit_Framework_TestCase { + /** + * @var \Zend\Feed\PubSubHubbub\Publisher + */ protected $_publisher = null; public function setUp() { - $client = new Zend_Http_Client; - Zend_Feed_Pubsubhubbub::setHttpClient($client); - $this->_publisher = new Zend_Feed_Pubsubhubbub_Publisher; + $client = new HTTP\Client; + PubSubHubbub\PubSubHubbub::setHttpClient($client); + $this->_publisher = new PubSubHubbub\Publisher; } public function testAddsHubServerUrl() @@ -95,7 +103,7 @@ public function testThrowsExceptionOnSettingEmptyHubServerUrl() try { $this->_publisher->addHubUrl(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } @@ -104,7 +112,7 @@ public function testThrowsExceptionOnSettingNonStringHubServerUrl() try { $this->_publisher->addHubUrl(123); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } @@ -113,7 +121,7 @@ public function testThrowsExceptionOnSettingInvalidHubServerUrl() try { $this->_publisher->addHubUrl('http://'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testAddsUpdatedTopicUrl() @@ -169,7 +177,7 @@ public function testThrowsExceptionOnSettingEmptyUpdatedTopicUrl() try { $this->_publisher->addUpdatedTopicUrl(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } @@ -178,7 +186,7 @@ public function testThrowsExceptionOnSettingNonStringUpdatedTopicUrl() try { $this->_publisher->addUpdatedTopicUrl(123); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } @@ -187,7 +195,7 @@ public function testThrowsExceptionOnSettingInvalidUpdatedTopicUrl() try { $this->_publisher->addUpdatedTopicUrl('http://'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testAddsParameter() @@ -250,8 +258,8 @@ public function testRemovesParameterIfSetToNull() public function testNotifiesHubWithCorrectParameters() { - Zend_Feed_Pubsubhubbub::setHttpClient(new Zend_Feed_Pubsubhubbub_PublisherTest_ClientSuccess); - $client = Zend_Feed_Pubsubhubbub::getHttpClient(); + PubSubHubbub\PubSubHubbub::setHttpClient(new ClientSuccess); + $client = PubSubHubbub\PubSubHubbub::getHttpClient(); $this->_publisher->addHubUrl('http://www.example.com/hub'); $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); $this->_publisher->setParameter('foo', 'bar'); @@ -261,8 +269,8 @@ public function testNotifiesHubWithCorrectParameters() public function testNotifiesHubWithCorrectParametersAndMultipleTopics() { - Zend_Feed_Pubsubhubbub::setHttpClient(new Zend_Feed_Pubsubhubbub_PublisherTest_ClientSuccess); - $client = Zend_Feed_Pubsubhubbub::getHttpClient(); + PubSubHubbub\PubSubHubbub::setHttpClient(new ClientSuccess); + $client = PubSubHubbub\PubSubHubbub::getHttpClient(); $this->_publisher->addHubUrl('http://www.example.com/hub'); $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic2'); @@ -272,8 +280,8 @@ public function testNotifiesHubWithCorrectParametersAndMultipleTopics() public function testNotifiesHubAndReportsSuccess() { - Zend_Feed_Pubsubhubbub::setHttpClient(new Zend_Feed_Pubsubhubbub_PublisherTest_ClientSuccess); - $client = Zend_Feed_Pubsubhubbub::getHttpClient(); + PubSubHubbub\PubSubHubbub::setHttpClient(new ClientSuccess); + $client = PubSubHubbub\PubSubHubbub::getHttpClient(); $this->_publisher->addHubUrl('http://www.example.com/hub'); $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); $this->_publisher->setParameter('foo', 'bar'); @@ -283,8 +291,8 @@ public function testNotifiesHubAndReportsSuccess() public function testNotifiesHubAndReportsFail() { - Zend_Feed_Pubsubhubbub::setHttpClient(new Zend_Feed_Pubsubhubbub_PublisherTest_ClientFail); - $client = Zend_Feed_Pubsubhubbub::getHttpClient(); + PubSubHubbub\PubSubHubbub::setHttpClient(new ClientFail); + $client = PubSubHubbub\PubSubHubbub::getHttpClient(); $this->_publisher->addHubUrl('http://www.example.com/hub'); $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); $this->_publisher->setParameter('foo', 'bar'); @@ -296,27 +304,27 @@ public function testNotifiesHubAndReportsFail() // Some stubs for what Http_Client would be doing -class Zend_Feed_Pubsubhubbub_PublisherTest_ClientSuccess extends Zend_Http_Client +class ClientSuccess extends HTTP\Client { public function request($method = null) { - $response = new Zend_Feed_Pubsubhubbub_PublisherTest_ResponseSuccess; + $response = new ResponseSuccess; return $response; } public function getBody(){return $this->_prepareBody();} } -class Zend_Feed_Pubsubhubbub_PublisherTest_ClientFail extends Zend_Http_Client +class ClientFail extends HTTP\Client { public function request($method = null) { - $response = new Zend_Feed_Pubsubhubbub_PublisherTest_ResponseFail; + $response = new ResponseFail; return $response; } public function getBody(){return $this->_prepareBody();} } -class Zend_Feed_Pubsubhubbub_PublisherTest_ResponseSuccess +class ResponseSuccess { public function getStatus(){return 204;} } -class Zend_Feed_Pubsubhubbub_PublisherTest_ResponseFail +class ResponseFail { public function getStatus(){return 404;} } diff --git a/test/Pubsubhubbub/PubsubhubbubTest.php b/test/Pubsubhubbub/PubsubhubbubTest.php index 08fd3cf7..a27b081c 100644 --- a/test/Pubsubhubbub/PubsubhubbubTest.php +++ b/test/Pubsubhubbub/PubsubhubbubTest.php @@ -19,7 +19,11 @@ * @version $Id$ */ - +/** + * @namespace + */ +namespace ZendTest\Feed\Pubsubhubbub; +use Zend\Feed\PubSubHubbub; /** * @category Zend @@ -30,28 +34,28 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Pubsubhubbub_PubsubhubbubTest extends PHPUnit_Framework_TestCase +class PubsubhubbubTest extends \PHPUnit_Framework_TestCase { public function teardown() { - Zend_Feed_Pubsubhubbub::clearHttpClient(); + PubSubHubbub\PubSubHubbub::clearHttpClient(); } public function testCanSetCustomHttpClient() { - Zend_Feed_Pubsubhubbub::setHttpClient(new Test_Http_Client_Pubsub()); - $this->assertType('Test_Http_Client_Pubsub', Zend_Feed_Pubsubhubbub::getHttpClient()); + PubSubHubbub\PubSubHubbub::setHttpClient(new Pubsub()); + $this->assertType('ZendTest\Feed\Pubsubhubbub\Pubsub', PubSubHubbub\PubSubHubbub::getHttpClient()); } public function testCanDetectHubs() { - $feed = Zend_Feed_Reader::importFile(dirname(__FILE__) . '/_files/rss20.xml'); + $feed = \Zend\Feed\Reader\Reader::importFile(dirname(__FILE__) . '/_files/rss20.xml'); $this->assertEquals(array( 'http://www.example.com/hub', 'http://www.example.com/hub2' - ), Zend_Feed_Pubsubhubbub::detectHubs($feed)); + ), PubSubHubbub\PubSubHubbub::detectHubs($feed)); } } -class Test_Http_Client_Pubsub extends Zend_Http_Client {} +class Pubsub extends \Zend\HTTP\Client {} diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php index c35b56b9..48df1201 100644 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -19,6 +19,13 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed\Pubsubhubbub\Subscriber; +use Zend\Feed\PubSubHubbub\Model; +use Zend\Feed\PubSubHubbub; +use Zend\Date; /** * @category Zend @@ -29,28 +36,28 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Pubsubhubbub_Subscriber_CallbackTest extends PHPUnit_Framework_TestCase +class CallbackTest extends \PHPUnit_Framework_TestCase { protected $_originalServer = null; public function setUp() { - $this->_callback = new Zend_Feed_Pubsubhubbub_Subscriber_Callback; + $this->_callback = new \Zend\Feed\PubSubHubbub\Subscriber\Callback; $this->_adapter = $this->_getCleanMock( - 'Zend_Db_Adapter_Abstract' + '\Zend\DB\Adapter\AbstractAdapter' ); $this->_tableGateway = $this->_getCleanMock( - 'Zend_Db_Table_Abstract' + '\Zend\DB\Table\AbstractTable' ); $this->_rowset = $this->_getCleanMock( - 'Zend_Db_Table_Rowset_Abstract' + '\Zend\DB\Table\Rowset\AbstractRowset' ); $this->_tableGateway->expects($this->any())->method('getAdapter') ->will($this->returnValue($this->_adapter)); - $storage = new Zend_Feed_Pubsubhubbub_Model_Subscription($this->_tableGateway); + $storage = new Model\Subscription($this->_tableGateway); $this->_callback->setStorage($storage); $this->_get = array( @@ -75,21 +82,21 @@ public function tearDown() public function testCanSetHttpResponseObject() { - $this->_callback->setHttpResponse(new Zend_Feed_Pubsubhubbub_HttpResponse); - $this->assertTrue($this->_callback->getHttpResponse() instanceof Zend_Feed_Pubsubhubbub_HttpResponse); + $this->_callback->setHttpResponse(new PubSubHubbub\HttpResponse); + $this->assertTrue($this->_callback->getHttpResponse() instanceof PubSubHubbub\HttpResponse); } public function testCanUsesDefaultHttpResponseObject() { - $this->assertTrue($this->_callback->getHttpResponse() instanceof Zend_Feed_Pubsubhubbub_HttpResponse); + $this->assertTrue($this->_callback->getHttpResponse() instanceof PubSubHubbub\HttpResponse); } public function testThrowsExceptionOnInvalidHttpResponseObjectSet() { try { - $this->_callback->setHttpResponse(new stdClass); + $this->_callback->setHttpResponse(new \stdClass); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testThrowsExceptionIfNonObjectSetAsHttpResponseObject() @@ -97,7 +104,7 @@ public function testThrowsExceptionIfNonObjectSetAsHttpResponseObject() try { $this->_callback->setHttpResponse(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testCanSetSubscriberCount() @@ -116,7 +123,7 @@ public function testThrowsExceptionOnSettingZeroAsSubscriberCount() try { $this->_callback->setSubscriberCount(0); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testThrowsExceptionOnSettingLessThanZeroAsSubscriberCount() @@ -124,7 +131,7 @@ public function testThrowsExceptionOnSettingLessThanZeroAsSubscriberCount() try { $this->_callback->setSubscriberCount(-1); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntegerAsSubscriberCount() @@ -132,13 +139,13 @@ public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntege try { $this->_callback->setSubscriberCount('0aa'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testCanSetStorageImplementation() { - $storage = new Zend_Feed_Pubsubhubbub_Model_Subscription($this->_tableGateway); + $storage = new Model\Subscription($this->_tableGateway); $this->_callback->setStorage($storage); $this->assertThat($this->_callback->getStorage(), $this->identicalTo($storage)); } @@ -246,11 +253,11 @@ public function testRespondsToValidConfirmationWith200Response() ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); - $rowdata = new stdClass; + $rowdata = new \stdClass; $rowdata->id = 'verifytokenkey'; $rowdata->verify_token = hash('sha256', 'cba'); - $t = new Zend_Date; - $rowdata->created_time = $t->get(Zend_Date::TIMESTAMP); + $t = new Date\Date; + $rowdata->created_time = $t->get(Date\Date::TIMESTAMP); $rowdata->lease_seconds = 10000; $this->_rowset->expects($this->any()) ->method('current') @@ -259,7 +266,7 @@ public function testRespondsToValidConfirmationWith200Response() $this->_tableGateway->expects($this->once()) ->method('update') ->with( - $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Zend_Date::TIMESTAMP),'lease_seconds'=>1234567,'subscription_state'=>'verified','expiration_time'=>$t->add(1234567,Zend_Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), + $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Date\Date::TIMESTAMP),'lease_seconds'=>1234567,'subscription_state'=>'verified','expiration_time'=>$t->add(1234567,Date\Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), $this->equalTo('id = \'verifytokenkey\'') ); $this->_adapter->expects($this->once()) @@ -277,11 +284,11 @@ public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); - $rowdata = new stdClass; + $rowdata = new \stdClass; $rowdata->id = 'verifytokenkey'; $rowdata->verify_token = hash('sha256', 'cba'); - $t = new Zend_Date; - $rowdata->created_time = $t->get(Zend_Date::TIMESTAMP); + $t = new Date\Date; + $rowdata->created_time = $t->get(Date\Date::TIMESTAMP); $rowdata->lease_seconds = 10000; $this->_rowset->expects($this->any()) ->method('current') @@ -290,7 +297,7 @@ public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() $this->_tableGateway->expects($this->once()) ->method('update') ->with( - $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Zend_Date::TIMESTAMP),'lease_seconds'=>1234567,'subscription_state'=>'verified','expiration_time'=>$t->add(1234567,Zend_Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), + $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Date\Date::TIMESTAMP),'lease_seconds'=>1234567,'subscription_state'=>'verified','expiration_time'=>$t->add(1234567,Date\Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), $this->equalTo('id = \'verifytokenkey\'') ); $this->_adapter->expects($this->once()) @@ -313,7 +320,7 @@ public function testRespondsToValidFeedUpdateRequestWith200Response() ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); - $rowdata = new stdClass; + $rowdata = new \stdClass; $rowdata->id = 'verifytokenkey'; $rowdata->verify_token = hash('sha256', 'cba'); $t = time(); @@ -367,7 +374,7 @@ public function testRespondsToInvalidFeedUpdateWrongFeedTypeForMimeWith200Respon ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); - $rowdata = new stdClass; + $rowdata = new \stdClass; $rowdata->id = 'verifytokenkey'; $rowdata->verify_token = hash('sha256', 'cba'); $t = time(); @@ -392,7 +399,7 @@ public function testRespondsToValidFeedUpdateWithXHubOnBehalfOfHeader() ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); - $rowdata = new stdClass; + $rowdata = new \stdClass; $rowdata->id = 'verifytokenkey'; $rowdata->verify_token = hash('sha256', 'cba'); $t = time(); @@ -406,7 +413,7 @@ public function testRespondsToValidFeedUpdateWithXHubOnBehalfOfHeader() } protected function _getCleanMock($className) { - $class = new ReflectionClass($className); + $class = new \ReflectionClass($className); $methods = $class->getMethods(); $stubMethods = array(); foreach ($methods as $method) { @@ -419,7 +426,7 @@ protected function _getCleanMock($className) { $className, $stubMethods, array(), - $className . '_PubsubSubscriberMock_' . uniqid(), + str_replace('\\', '_', ($className . '_PubsubSubscriberMock_' . uniqid())), false ); return $mocked; diff --git a/test/Pubsubhubbub/SubscriberHttpTest.php b/test/Pubsubhubbub/SubscriberHttpTest.php index 8459100e..2f061630 100644 --- a/test/Pubsubhubbub/SubscriberHttpTest.php +++ b/test/Pubsubhubbub/SubscriberHttpTest.php @@ -19,7 +19,10 @@ * @version $Id$ */ - +/** + * @namespace + */ +namespace ZendTest\Feed\Pubsubhubbub; /** * Note that $this->_baseuri must point to a directory on a web server @@ -38,7 +41,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Pubsubhubbub_SubscriberHttpTest extends PHPUnit_Framework_TestCase +class SubscriberHttpTest extends \PHPUnit_Framework_TestCase { protected $_subscriber = null; @@ -56,7 +59,7 @@ class Zend_Feed_Pubsubhubbub_SubscriberHttpTest extends PHPUnit_Framework_TestCa public function setUp() { if (defined('TESTS_Zend_Feed_Pubsubhubbub_BASEURI') && - Zend_Uri_Http::check(TESTS_Zend_Feed_Pubsubhubbub_BASEURI)) { + \Zend\URI\URL::check(TESTS_Zend_Feed_Pubsubhubbub_BASEURI)) { $this->_baseuri = TESTS_Zend_Feed_Pubsubhubbub_BASEURI; if (substr($this->_baseuri, -1) != '/') $this->_baseuri .= '/'; $name = $this->getName(); @@ -65,10 +68,10 @@ public function setUp() } $uri = $this->_baseuri . $name . '.php'; $this->_adapter = new $this->_config['adapter']; - $this->_client = new Zend_Http_Client($uri, $this->_config); + $this->_client = new \Zend\HTTP\Client($uri, $this->_config); $this->_client->setAdapter($this->_adapter); - Zend_Feed_Pubsubhubbub::setHttpClient($this->_client); - $this->_subscriber = new Zend_Feed_Pubsubhubbub_Subscriber; + \Zend\Feed\PubSubHubbub\PubSubHubbub::setHttpClient($this->_client); + $this->_subscriber = new \Zend\Feed\PubSubHubbub\Subscriber\Subscriber; $this->_storage = $this->_getCleanMock('Zend_Feed_Pubsubhubbub_Entity_TopicSubscription'); @@ -112,7 +115,7 @@ public function testUnsubscriptionRequestSendsExpectedPostData() } protected function _getCleanMock($className) { - $class = new ReflectionClass($className); + $class = new \ReflectionClass($className); $methods = $class->getMethods(); $stubMethods = array(); foreach ($methods as $method) { diff --git a/test/Pubsubhubbub/SubscriberTest.php b/test/Pubsubhubbub/SubscriberTest.php index 4680515f..193f3939 100644 --- a/test/Pubsubhubbub/SubscriberTest.php +++ b/test/Pubsubhubbub/SubscriberTest.php @@ -19,7 +19,15 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed\Pubsubhubbub; +use Zend\DB\Adapter; +use Zend\DB\Table; + +use Zend\Feed\PubSubHubbub; /** * @category Zend @@ -30,7 +38,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Pubsubhubbub_SubscriberTest extends PHPUnit_Framework_TestCase +class SubscriberTest extends \PHPUnit_Framework_TestCase { protected $_subscriber = null; @@ -41,14 +49,14 @@ class Zend_Feed_Pubsubhubbub_SubscriberTest extends PHPUnit_Framework_TestCase public function setUp() { - $client = new Zend_Http_Client; - Zend_Feed_Pubsubhubbub::setHttpClient($client); - $this->_subscriber = new Zend_Feed_Pubsubhubbub_Subscriber; + $client = new \Zend\HTTP\Client; + PubSubHubbub\PubSubHubbub::setHttpClient($client); + $this->_subscriber = new \Zend\Feed\PubSubHubbub\Subscriber\Subscriber; $this->_adapter = $this->_getCleanMock( - 'Zend_Db_Adapter_Abstract' + '\Zend\DB\Adapter\AbstractAdapter' ); $this->_tableGateway = $this->_getCleanMock( - 'Zend_Db_Table_Abstract' + '\Zend\DB\Table\AbstractTable' ); $this->_tableGateway->expects($this->any())->method('getAdapter') ->will($this->returnValue($this->_adapter)); @@ -108,7 +116,7 @@ public function testThrowsExceptionOnSettingEmptyHubServerUrl() try { $this->_subscriber->addHubUrl(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testThrowsExceptionOnSettingNonStringHubServerUrl() @@ -116,7 +124,7 @@ public function testThrowsExceptionOnSettingNonStringHubServerUrl() try { $this->_subscriber->addHubUrl(123); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testThrowsExceptionOnSettingInvalidHubServerUrl() @@ -124,7 +132,7 @@ public function testThrowsExceptionOnSettingInvalidHubServerUrl() try { $this->_subscriber->addHubUrl('http://'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testAddsParameter() @@ -196,7 +204,7 @@ public function testThrowsExceptionOnSettingEmptyTopicUrl() try { $this->_subscriber->setTopicUrl(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } @@ -205,7 +213,7 @@ public function testThrowsExceptionOnSettingNonStringTopicUrl() try { $this->_subscriber->setTopicUrl(123); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } @@ -214,7 +222,7 @@ public function testThrowsExceptionOnSettingInvalidTopicUrl() try { $this->_subscriber->setTopicUrl('http://'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testThrowsExceptionOnMissingTopicUrl() @@ -222,7 +230,7 @@ public function testThrowsExceptionOnMissingTopicUrl() try { $this->_subscriber->getTopicUrl(); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testCanSetCallbackUrl() @@ -236,7 +244,7 @@ public function testThrowsExceptionOnSettingEmptyCallbackUrl() try { $this->_subscriber->setCallbackUrl(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } @@ -245,7 +253,7 @@ public function testThrowsExceptionOnSettingNonStringCallbackUrl() try { $this->_subscriber->setCallbackUrl(123); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } @@ -254,7 +262,7 @@ public function testThrowsExceptionOnSettingInvalidCallbackUrl() try { $this->_subscriber->setCallbackUrl('http://'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testThrowsExceptionOnMissingCallbackUrl() @@ -262,7 +270,7 @@ public function testThrowsExceptionOnMissingCallbackUrl() try { $this->_subscriber->getCallbackUrl(); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testCanSetLeaseSeconds() @@ -276,7 +284,7 @@ public function testThrowsExceptionOnSettingZeroAsLeaseSeconds() try { $this->_subscriber->setLeaseSeconds(0); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testThrowsExceptionOnSettingLessThanZeroAsLeaseSeconds() @@ -284,7 +292,7 @@ public function testThrowsExceptionOnSettingLessThanZeroAsLeaseSeconds() try { $this->_subscriber->setLeaseSeconds(-1); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntegerAsLeaseSeconds() @@ -292,13 +300,13 @@ public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntege try { $this->_subscriber->setLeaseSeconds('0aa'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testCanSetPreferredVerificationMode() { - $this->_subscriber->setPreferredVerificationMode(Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC); - $this->assertEquals(Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC, $this->_subscriber->getPreferredVerificationMode()); + $this->_subscriber->setPreferredVerificationMode(PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_ASYNC); + $this->assertEquals(PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_ASYNC, $this->_subscriber->getPreferredVerificationMode()); } public function testSetsPreferredVerificationModeThrowsExceptionOnSettingBadMode() @@ -306,44 +314,43 @@ public function testSetsPreferredVerificationModeThrowsExceptionOnSettingBadMode try { $this->_subscriber->setPreferredVerificationMode('abc'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} + } catch (PubSubHubbub\Exception $e) {} } public function testPreferredVerificationModeDefaultsToSync() { - $this->assertEquals(Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC, $this->_subscriber->getPreferredVerificationMode()); + $this->assertEquals(PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_SYNC, $this->_subscriber->getPreferredVerificationMode()); } public function testCanSetStorageImplementation() { - $storage = new Zend_Feed_Pubsubhubbub_Model_Subscription($this->_tableGateway); + $storage = new \Zend\Feed\PubSubHubbub\Model\Subscription($this->_tableGateway); $this->_subscriber->setStorage($storage); $this->assertThat($this->_subscriber->getStorage(), $this->identicalTo($storage)); } - /** - * @expectedException Zend_Feed_Pubsubhubbub_Exception - */ + public function testGetStorageThrowsExceptionIfNoneSet() { + $this->setExpectedException('Zend\Feed\PubSubHubbub\Exception'); $this->_subscriber->getStorage(); } protected function _getCleanMock($className) { - $class = new ReflectionClass($className); + $class = new \ReflectionClass($className); $methods = $class->getMethods(); $stubMethods = array(); foreach ($methods as $method) { if ($method->isPublic() || ($method->isProtected() - && $method->isAbstract())) { - $stubMethods[] = $method->getName(); + && $method->isAbstract())) { + $stubMethods[] = $method->getName(); } } $mocked = $this->getMock( $className, $stubMethods, array(), - $className . '_PubsubSubscriberMock_' . uniqid(), + str_replace('\\', '_', ($className . '_PubsubSubscriberMock_' . uniqid())), false ); return $mocked; diff --git a/test/Reader/Entry/AtomStandaloneEntryTest.php b/test/Reader/Entry/AtomStandaloneEntryTest.php index a9c7a28f..ae98e0dd 100644 --- a/test/Reader/Entry/AtomStandaloneEntryTest.php +++ b/test/Reader/Entry/AtomStandaloneEntryTest.php @@ -20,6 +20,12 @@ * @version $Id: AtomTest.php 19159 2009-11-21 14:23:15Z padraic $ */ +/** + * @namespace + */ +namespace ZendTest\Feed\Reader\Entry; +use Zend\Feed\Reader; +use Zend\Date; /** * @category Zend @@ -30,7 +36,7 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class Zend_Feed_Reader_Entry_AtomStandaloneEntryTest extends PHPUnit_Framework_TestCase +class AtomStandaloneEntryTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -41,19 +47,19 @@ class Zend_Feed_Reader_Entry_AtomStandaloneEntryTest extends PHPUnit_Framework_T public function setup() { - Zend_Feed_Reader::reset(); - if (Zend_Registry::isRegistered('Zend_Locale')) { - $registry = Zend_Registry::getInstance(); + Reader\Reader::reset(); + if (\Zend\Registry::isRegistered('Zend_Locale')) { + $registry = \Zend\Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/AtomStandaloneEntry'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -87,15 +93,15 @@ public function setup() public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } public function testReaderImportOfAtomEntryDocumentReturnsEntryClass() { - $object = Zend_Feed_Reader::importString( + $object = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/id/atom10.xml') ); - $this->assertTrue($object instanceof Zend_Feed_Reader_Entry_Atom); + $this->assertTrue($object instanceof \Zend\Feed\Reader\Entry\Atom); } /** @@ -104,7 +110,7 @@ public function testReaderImportOfAtomEntryDocumentReturnsEntryClass() */ public function testGetsIdFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/id/atom10.xml') ); $this->assertEquals('1', $entry->getId()); @@ -116,11 +122,11 @@ public function testGetsIdFromAtom10() */ public function testGetsDateCreatedFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/atom10.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateCreated())); } @@ -130,11 +136,11 @@ public function testGetsDateCreatedFromAtom10() */ public function testGetsDateModifiedFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/atom10.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } @@ -144,7 +150,7 @@ public function testGetsDateModifiedFromAtom10() */ public function testGetsTitleFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/title/atom10.xml') ); $this->assertEquals('Entry Title', $entry->getTitle()); @@ -156,7 +162,7 @@ public function testGetsTitleFromAtom10() */ public function testGetsAuthorsFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/author/atom10.xml') ); @@ -178,7 +184,7 @@ public function testGetsAuthorsFromAtom10() */ public function testGetsAuthorFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/author/atom10.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com','uri'=>'http://www.example.com'), $entry->getAuthor()); @@ -190,7 +196,7 @@ public function testGetsAuthorFromAtom10() */ public function testGetsDescriptionFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/description/atom10.xml') ); $this->assertEquals('Entry Description', $entry->getDescription()); @@ -202,11 +208,11 @@ public function testGetsDescriptionFromAtom10() */ public function testGetsEnclosureFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/enclosure/atom10.xml') ); - $expected = new stdClass(); + $expected = new \stdClass(); $expected->url = 'http://www.example.org/myaudiofile.mp3'; $expected->length = '1234'; $expected->type = 'audio/mpeg'; @@ -220,7 +226,7 @@ public function testGetsEnclosureFromAtom10() */ public function testGetsContentFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/atom10.xml') ); $this->assertEquals('Entry Content &', $entry->getContent()); @@ -232,7 +238,7 @@ public function testGetsContentFromAtom10() */ public function testGetsContentFromAtom10Html() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/atom10_Html.xml') ); $this->assertEquals('

Entry Content &

', $entry->getContent()); @@ -244,7 +250,7 @@ public function testGetsContentFromAtom10Html() */ public function testGetsContentFromAtom10HtmlCdata() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/atom10_HtmlCdata.xml') ); $this->assertEquals('

Entry Content &

', $entry->getContent()); @@ -256,7 +262,7 @@ public function testGetsContentFromAtom10HtmlCdata() */ public function testGetsContentFromAtom10XhtmlNamespaced() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/atom10_Xhtml.xml') ); $this->assertEquals('

Entry Content &x:

', $entry->getContent()); @@ -268,7 +274,7 @@ public function testGetsContentFromAtom10XhtmlNamespaced() */ public function testGetsLinkFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/link/atom10.xml') ); $this->assertEquals('http://www.example.com/entry', $entry->getLink()); @@ -280,7 +286,7 @@ public function testGetsLinkFromAtom10() */ public function testGetsCommentLinkFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/commentlink/atom10.xml') ); $this->assertEquals('http://www.example.com/entry/comments', $entry->getCommentLink()); @@ -292,7 +298,7 @@ public function testGetsCommentLinkFromAtom10() */ public function testGetsCategoriesFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/atom10.xml') ); $this->assertEquals($this->_expectedCats, (array) $entry->getCategories()); diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index 29cf073e..7114e82a 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -20,6 +20,12 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed\Reader\Entry; +use Zend\Feed\Reader; +use Zend\Date; /** * @category Zend @@ -30,7 +36,7 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class Zend_Feed_Reader_Entry_AtomTest extends PHPUnit_Framework_TestCase +class AtomTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -41,19 +47,19 @@ class Zend_Feed_Reader_Entry_AtomTest extends PHPUnit_Framework_TestCase public function setup() { - Zend_Feed_Reader::reset(); - if (Zend_Registry::isRegistered('Zend_Locale')) { - $registry = Zend_Registry::getInstance(); + Reader\Reader::reset(); + if (\Zend\Registry::isRegistered('Zend_Locale')) { + $registry = \Zend\Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Atom'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -87,7 +93,7 @@ public function setup() public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } /** @@ -96,7 +102,7 @@ public function teardown() */ public function testGetsIdFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/id/plain/atom03.xml') ); $entry = $feed->current(); @@ -105,7 +111,7 @@ public function testGetsIdFromAtom03() public function testGetsIdFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/id/plain/atom10.xml') ); $entry = $feed->current(); @@ -117,23 +123,23 @@ public function testGetsIdFromAtom10() */ public function testGetsDateCreatedFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom03.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateCreated())); } public function testGetsDateCreatedFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom10.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateCreated())); } @@ -142,23 +148,23 @@ public function testGetsDateCreatedFromAtom10() */ public function testGetsDateModifiedFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom03.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom10.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } @@ -167,7 +173,7 @@ public function testGetsDateModifiedFromAtom10() */ public function testGetsTitleFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/title/plain/atom03.xml') ); $entry = $feed->current(); @@ -176,7 +182,7 @@ public function testGetsTitleFromAtom03() public function testGetsTitleFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/title/plain/atom10.xml') ); $entry = $feed->current(); @@ -188,7 +194,7 @@ public function testGetsTitleFromAtom10() */ public function testGetsAuthorsFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/author/plain/atom03.xml') ); @@ -207,7 +213,7 @@ public function testGetsAuthorsFromAtom03() public function testGetsAuthorsFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/author/plain/atom10.xml') ); @@ -229,7 +235,7 @@ public function testGetsAuthorsFromAtom10() */ public function testGetsAuthorFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/author/plain/atom03.xml') ); $entry = $feed->current(); @@ -238,7 +244,7 @@ public function testGetsAuthorFromAtom03() public function testGetsAuthorFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/author/plain/atom10.xml') ); $entry = $feed->current(); @@ -250,7 +256,7 @@ public function testGetsAuthorFromAtom10() */ public function testGetsDescriptionFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/description/plain/atom03.xml') ); $entry = $feed->current(); @@ -259,7 +265,7 @@ public function testGetsDescriptionFromAtom03() public function testGetsDescriptionFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/description/plain/atom10.xml') ); $entry = $feed->current(); @@ -271,12 +277,12 @@ public function testGetsDescriptionFromAtom10() */ public function testGetsEnclosureFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/enclosure/plain/atom03.xml') ); $entry = $feed->current(); - $expected = new stdClass(); + $expected = new \stdClass(); $expected->url = 'http://www.example.org/myaudiofile.mp3'; $expected->length = '1234'; $expected->type = 'audio/mpeg'; @@ -286,12 +292,12 @@ public function testGetsEnclosureFromAtom03() public function testGetsEnclosureFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/enclosure/plain/atom10.xml') ); $entry = $feed->current(); - $expected = new stdClass(); + $expected = new \stdClass(); $expected->url = 'http://www.example.org/myaudiofile.mp3'; $expected->length = '1234'; $expected->type = 'audio/mpeg'; @@ -304,7 +310,7 @@ public function testGetsEnclosureFromAtom10() */ public function testGetsContentFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/plain/atom03.xml') ); $entry = $feed->current(); @@ -317,7 +323,7 @@ public function testGetsContentFromAtom03() */ public function testGetsContentFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/plain/atom10.xml') ); $entry = $feed->current(); @@ -330,7 +336,7 @@ public function testGetsContentFromAtom10() */ public function testGetsContentFromAtom10Html() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/plain/atom10_Html.xml') ); $entry = $feed->current(); @@ -343,7 +349,7 @@ public function testGetsContentFromAtom10Html() */ public function testGetsContentFromAtom10HtmlCdata() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/plain/atom10_HtmlCdata.xml') ); $entry = $feed->current(); @@ -356,7 +362,7 @@ public function testGetsContentFromAtom10HtmlCdata() */ public function testGetsContentFromAtom10XhtmlNamespaced() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/plain/atom10_Xhtml.xml') ); $entry = $feed->current(); @@ -368,7 +374,7 @@ public function testGetsContentFromAtom10XhtmlNamespaced() */ public function testGetsLinkFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/link/plain/atom03.xml') ); $entry = $feed->current(); @@ -377,7 +383,7 @@ public function testGetsLinkFromAtom03() public function testGetsLinkFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/link/plain/atom10.xml') ); $entry = $feed->current(); @@ -386,7 +392,7 @@ public function testGetsLinkFromAtom10() public function testGetsLinkFromAtom10_WithNoRelAttribute() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/link/plain/atom10-norel.xml') ); $entry = $feed->current(); @@ -395,7 +401,7 @@ public function testGetsLinkFromAtom10_WithNoRelAttribute() public function testGetsLinkFromAtom10_WithRelativeUrl() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/link/plain/atom10-relative.xml') ); $entry = $feed->current(); @@ -407,7 +413,7 @@ public function testGetsLinkFromAtom10_WithRelativeUrl() */ public function testGetsBaseUriFromAtom10_FromFeedElement() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/baseurl/plain/atom10-feedlevel.xml') ); $entry = $feed->current(); @@ -416,7 +422,7 @@ public function testGetsBaseUriFromAtom10_FromFeedElement() public function testGetsBaseUriFromAtom10_FromEntryElement() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/baseurl/plain/atom10-entrylevel.xml') ); $entry = $feed->current(); @@ -428,7 +434,7 @@ public function testGetsBaseUriFromAtom10_FromEntryElement() */ public function testGetsCommentLinkFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/commentlink/plain/atom03.xml') ); $entry = $feed->current(); @@ -437,7 +443,7 @@ public function testGetsCommentLinkFromAtom03() public function testGetsCommentLinkFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/commentlink/plain/atom10.xml') ); $entry = $feed->current(); @@ -446,7 +452,7 @@ public function testGetsCommentLinkFromAtom10() public function testGetsCommentLinkFromAtom10_RelativeLinks() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/commentlink/plain/atom10-relative.xml') ); $entry = $feed->current(); @@ -461,7 +467,7 @@ public function testGetsCommentLinkFromAtom10_RelativeLinks() public function testGetsCategoriesFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10.xml') ); $entry = $feed->current(); @@ -471,7 +477,7 @@ public function testGetsCategoriesFromAtom10() public function testGetsCategoriesFromAtom03_Atom10Extension() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom03.xml') ); $entry = $feed->current(); @@ -483,7 +489,7 @@ public function testGetsCategoriesFromAtom03_Atom10Extension() public function testGetsCategoriesFromAtom03_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/atom03.xml') ); $entry = $feed->current(); @@ -493,7 +499,7 @@ public function testGetsCategoriesFromAtom03_Dc10() public function testGetsCategoriesFromAtom03_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/atom03.xml') ); $entry = $feed->current(); @@ -505,7 +511,7 @@ public function testGetsCategoriesFromAtom03_Dc11() public function testGetsCategoriesFromAtom10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/atom10.xml') ); $entry = $feed->current(); @@ -515,7 +521,7 @@ public function testGetsCategoriesFromAtom10_None() public function testGetsCategoriesFromAtom03_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/atom03.xml') ); $entry = $feed->current(); diff --git a/test/Reader/Entry/CommonTest.php b/test/Reader/Entry/CommonTest.php index f91740b7..9a78a942 100644 --- a/test/Reader/Entry/CommonTest.php +++ b/test/Reader/Entry/CommonTest.php @@ -20,6 +20,11 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed\Reader\Entry; +use Zend\Feed\Reader; /** * @category Zend @@ -30,16 +35,16 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class Zend_Feed_Reader_Entry_CommonTest extends PHPUnit_Framework_TestCase +class CommonTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Zend_Feed_Reader::reset(); - if (Zend_Registry::isRegistered('Zend_Locale')) { - $registry = Zend_Registry::getInstance(); + Reader\Reader::reset(); + if (\Zend\Registry::isRegistered('Zend_Locale')) { + $registry = \Zend\Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Common'; @@ -50,25 +55,25 @@ public function setup() */ public function testGetsDomDocumentObject() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); - $this->assertTrue($entry->getDomDocument() instanceof DOMDocument); + $this->assertTrue($entry->getDomDocument() instanceof \DOMDocument); } public function testGetsDomXpathObject() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); - $this->assertTrue($entry->getXpath() instanceof DOMXPath); + $this->assertTrue($entry->getXpath() instanceof \DOMXPath); } public function testGetsXpathPrefixString() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); @@ -77,16 +82,16 @@ public function testGetsXpathPrefixString() public function testGetsDomElementObject() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); - $this->assertTrue($entry->getElement() instanceof DOMElement); + $this->assertTrue($entry->getElement() instanceof \DOMElement); } public function testSaveXmlOutputsXmlStringForEntry() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); @@ -95,16 +100,16 @@ public function testSaveXmlOutputsXmlStringForEntry() public function testGetsNamedExtension() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); - $this->assertTrue($entry->getExtension('Atom') instanceof Zend_Feed_Reader_Extension_Atom_Entry); + $this->assertTrue($entry->getExtension('Atom') instanceof \Zend\Feed\Reader\Extension\Atom\Entry); } public function testReturnsNullIfExtensionDoesNotExist() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); @@ -116,7 +121,7 @@ public function testReturnsNullIfExtensionDoesNotExist() */ public function testReturnsEncodingOfFeed() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); @@ -128,7 +133,7 @@ public function testReturnsEncodingOfFeed() */ public function testReturnsEncodingOfFeedAsUtf8IfUndefined() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom_noencodingdefined.xml') ); $entry = $feed->current(); diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index af15e16a..b99c7942 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -20,6 +20,12 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed\Reader\Entry; +use Zend\Feed\Reader; +use Zend\Date; /** * @category Zend @@ -30,7 +36,7 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class Zend_Feed_Reader_Entry_RssTest extends PHPUnit_Framework_TestCase +class RssTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -43,19 +49,19 @@ class Zend_Feed_Reader_Entry_RssTest extends PHPUnit_Framework_TestCase public function setup() { - Zend_Feed_Reader::reset(); - if (Zend_Registry::isRegistered('Zend_Locale')) { - $registry = Zend_Registry::getInstance(); + Reader\Reader::reset(); + if (\Zend\Registry::isRegistered('Zend_Locale')) { + $registry = \Zend\Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Rss'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -106,7 +112,7 @@ public function setup() public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } /** @@ -114,7 +120,7 @@ public function teardown() */ public function testGetsIdFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss20.xml') ); $entry = $feed->current(); @@ -123,7 +129,7 @@ public function testGetsIdFromRss20() public function testGetsIdFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss094.xml') ); $entry = $feed->current(); @@ -132,7 +138,7 @@ public function testGetsIdFromRss094() public function testGetsIdFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss093.xml') ); $entry = $feed->current(); @@ -141,7 +147,7 @@ public function testGetsIdFromRss093() public function testGetsIdFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss092.xml') ); $entry = $feed->current(); @@ -150,7 +156,7 @@ public function testGetsIdFromRss092() public function testGetsIdFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss091.xml') ); $entry = $feed->current(); @@ -159,7 +165,7 @@ public function testGetsIdFromRss091() public function testGetsIdFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss10.xml') ); $entry = $feed->current(); @@ -168,7 +174,7 @@ public function testGetsIdFromRss10() public function testGetsIdFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss090.xml') ); $entry = $feed->current(); @@ -179,7 +185,7 @@ public function testGetsIdFromRss090() public function testGetsIdFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss20.xml') ); $entry = $feed->current(); @@ -188,7 +194,7 @@ public function testGetsIdFromRss20_Dc10() public function testGetsIdFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -197,7 +203,7 @@ public function testGetsIdFromRss094_Dc10() public function testGetsIdFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -206,7 +212,7 @@ public function testGetsIdFromRss093_Dc10() public function testGetsIdFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -215,7 +221,7 @@ public function testGetsIdFromRss092_Dc10() public function testGetsIdFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -224,7 +230,7 @@ public function testGetsIdFromRss091_Dc10() public function testGetsIdFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -233,7 +239,7 @@ public function testGetsIdFromRss10_Dc10() public function testGetsIdFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -244,7 +250,7 @@ public function testGetsIdFromRss090_Dc10() public function testGetsIdFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss20.xml') ); $entry = $feed->current(); @@ -253,7 +259,7 @@ public function testGetsIdFromRss20_Dc11() public function testGetsIdFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -262,7 +268,7 @@ public function testGetsIdFromRss094_Dc11() public function testGetsIdFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -271,7 +277,7 @@ public function testGetsIdFromRss093_Dc11() public function testGetsIdFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -280,7 +286,7 @@ public function testGetsIdFromRss092_Dc11() public function testGetsIdFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -289,7 +295,7 @@ public function testGetsIdFromRss091_Dc11() public function testGetsIdFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -298,7 +304,7 @@ public function testGetsIdFromRss10_Dc11() public function testGetsIdFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -309,7 +315,7 @@ public function testGetsIdFromRss090_Dc11() public function testGetsIdFromRss20_Title() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss20.xml') ); $entry = $feed->current(); @@ -318,7 +324,7 @@ public function testGetsIdFromRss20_Title() public function testGetsIdFromRss094_Title() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss094.xml') ); $entry = $feed->current(); @@ -327,7 +333,7 @@ public function testGetsIdFromRss094_Title() public function testGetsIdFromRss093_Title() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss093.xml') ); $entry = $feed->current(); @@ -336,7 +342,7 @@ public function testGetsIdFromRss093_Title() public function testGetsIdFromRss092_Title() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss092.xml') ); $entry = $feed->current(); @@ -345,7 +351,7 @@ public function testGetsIdFromRss092_Title() public function testGetsIdFromRss091_Title() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss091.xml') ); $entry = $feed->current(); @@ -354,7 +360,7 @@ public function testGetsIdFromRss091_Title() public function testGetsIdFromRss10_Title() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss10.xml') ); $entry = $feed->current(); @@ -363,7 +369,7 @@ public function testGetsIdFromRss10_Title() public function testGetsIdFromRss090_Title() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss090.xml') ); $entry = $feed->current(); @@ -374,7 +380,7 @@ public function testGetsIdFromRss090_Title() public function testGetsIdFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -383,7 +389,7 @@ public function testGetsIdFromRss20_None() public function testGetsIdFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -392,7 +398,7 @@ public function testGetsIdFromRss094_None() public function testGetsIdFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -401,7 +407,7 @@ public function testGetsIdFromRss093_None() public function testGetsIdFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -410,7 +416,7 @@ public function testGetsIdFromRss092_None() public function testGetsIdFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -419,7 +425,7 @@ public function testGetsIdFromRss091_None() public function testGetsIdFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -428,7 +434,7 @@ public function testGetsIdFromRss10_None() public function testGetsIdFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -440,7 +446,7 @@ public function testGetsIdFromRss090_None() */ public function testGetsTitleFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss20.xml') ); $entry = $feed->current(); @@ -449,7 +455,7 @@ public function testGetsTitleFromRss20() public function testGetsTitleFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss094.xml') ); $entry = $feed->current(); @@ -458,7 +464,7 @@ public function testGetsTitleFromRss094() public function testGetsTitleFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss093.xml') ); $entry = $feed->current(); @@ -467,7 +473,7 @@ public function testGetsTitleFromRss093() public function testGetsTitleFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss092.xml') ); $entry = $feed->current(); @@ -476,7 +482,7 @@ public function testGetsTitleFromRss092() public function testGetsTitleFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss091.xml') ); $entry = $feed->current(); @@ -485,7 +491,7 @@ public function testGetsTitleFromRss091() public function testGetsTitleFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss10.xml') ); $entry = $feed->current(); @@ -494,7 +500,7 @@ public function testGetsTitleFromRss10() public function testGetsTitleFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss090.xml') ); $entry = $feed->current(); @@ -505,7 +511,7 @@ public function testGetsTitleFromRss090() public function testGetsTitleFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss20.xml') ); $entry = $feed->current(); @@ -514,7 +520,7 @@ public function testGetsTitleFromRss20_Dc10() public function testGetsTitleFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -523,7 +529,7 @@ public function testGetsTitleFromRss094_Dc10() public function testGetsTitleFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -532,7 +538,7 @@ public function testGetsTitleFromRss093_Dc10() public function testGetsTitleFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -541,7 +547,7 @@ public function testGetsTitleFromRss092_Dc10() public function testGetsTitleFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -550,7 +556,7 @@ public function testGetsTitleFromRss091_Dc10() public function testGetsTitleFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -559,7 +565,7 @@ public function testGetsTitleFromRss10_Dc10() public function testGetsTitleFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -570,7 +576,7 @@ public function testGetsTitleFromRss090_Dc10() public function testGetsTitleFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss20.xml') ); $entry = $feed->current(); @@ -579,7 +585,7 @@ public function testGetsTitleFromRss20_Dc11() public function testGetsTitleFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -588,7 +594,7 @@ public function testGetsTitleFromRss094_Dc11() public function testGetsTitleFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -597,7 +603,7 @@ public function testGetsTitleFromRss093_Dc11() public function testGetsTitleFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -606,7 +612,7 @@ public function testGetsTitleFromRss092_Dc11() public function testGetsTitleFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -615,7 +621,7 @@ public function testGetsTitleFromRss091_Dc11() public function testGetsTitleFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -624,7 +630,7 @@ public function testGetsTitleFromRss10_Dc11() public function testGetsTitleFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -635,7 +641,7 @@ public function testGetsTitleFromRss090_Dc11() public function testGetsTitleFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -644,7 +650,7 @@ public function testGetsTitleFromRss20_None() public function testGetsTitleFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -653,7 +659,7 @@ public function testGetsTitleFromRss094_None() public function testGetsTitleFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -662,7 +668,7 @@ public function testGetsTitleFromRss093_None() public function testGetsTitleFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -671,7 +677,7 @@ public function testGetsTitleFromRss092_None() public function testGetsTitleFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -680,7 +686,7 @@ public function testGetsTitleFromRss091_None() public function testGetsTitleFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -689,7 +695,7 @@ public function testGetsTitleFromRss10_None() public function testGetsTitleFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -701,7 +707,7 @@ public function testGetsTitleFromRss090_None() */ public function testGetsAuthorsFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') ); $entry = $feed->current(); @@ -714,7 +720,7 @@ public function testGetsAuthorsFromRss20() public function testGetsAuthorsFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') ); $entry = $feed->current(); @@ -723,7 +729,7 @@ public function testGetsAuthorsFromRss094() public function testGetsAuthorsFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') ); $entry = $feed->current(); @@ -732,7 +738,7 @@ public function testGetsAuthorsFromRss093() public function testGetsAuthorsFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') ); $entry = $feed->current(); @@ -741,7 +747,7 @@ public function testGetsAuthorsFromRss092() public function testGetsAuthorsFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') ); $entry = $feed->current(); @@ -750,7 +756,7 @@ public function testGetsAuthorsFromRss091() public function testGetsAuthorsFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') ); $entry = $feed->current(); @@ -759,7 +765,7 @@ public function testGetsAuthorsFromRss10() public function testGetsAuthorsFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') ); $entry = $feed->current(); @@ -770,7 +776,7 @@ public function testGetsAuthorsFromRss090() public function testGetsAuthorsFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') ); $entry = $feed->current(); @@ -782,7 +788,7 @@ public function testGetsAuthorsFromRss20_Dc10() public function testGetsAuthorsFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -794,7 +800,7 @@ public function testGetsAuthorsFromRss094_Dc10() public function testGetsAuthorsFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -806,7 +812,7 @@ public function testGetsAuthorsFromRss093_Dc10() public function testGetsAuthorsFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -818,7 +824,7 @@ public function testGetsAuthorsFromRss092_Dc10() public function testGetsAuthorsFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -830,7 +836,7 @@ public function testGetsAuthorsFromRss091_Dc10() public function testGetsAuthorsFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -842,7 +848,7 @@ public function testGetsAuthorsFromRss10_Dc10() public function testGetsAuthorsFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -856,7 +862,7 @@ public function testGetsAuthorsFromRss090_Dc10() public function testGetsAuthorsFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') ); $entry = $feed->current(); @@ -868,7 +874,7 @@ public function testGetsAuthorsFromRss20_Dc11() public function testGetsAuthorsFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -880,7 +886,7 @@ public function testGetsAuthorsFromRss094_Dc11() public function testGetsAuthorsFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -892,7 +898,7 @@ public function testGetsAuthorsFromRss093_Dc11() public function testGetsAuthorsFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -904,7 +910,7 @@ public function testGetsAuthorsFromRss092_Dc11() public function testGetsAuthorsFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -916,7 +922,7 @@ public function testGetsAuthorsFromRss091_Dc11() public function testGetsAuthorsFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -928,7 +934,7 @@ public function testGetsAuthorsFromRss10_Dc11() public function testGetsAuthorsFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -942,7 +948,7 @@ public function testGetsAuthorsFromRss090_Dc11() public function testGetsAuthorsFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -951,7 +957,7 @@ public function testGetsAuthorsFromRss20_None() public function testGetsAuthorsFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -960,7 +966,7 @@ public function testGetsAuthorsFromRss094_None() public function testGetsAuthorsFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -969,7 +975,7 @@ public function testGetsAuthorsFromRss093_None() public function testGetsAuthorsFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -978,7 +984,7 @@ public function testGetsAuthorsFromRss092_None() public function testGetsAuthorsFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -987,7 +993,7 @@ public function testGetsAuthorsFromRss091_None() public function testGetsAuthorsFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -996,7 +1002,7 @@ public function testGetsAuthorsFromRss10_None() public function testGetsAuthorsFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -1009,7 +1015,7 @@ public function testGetsAuthorsFromRss090_None() */ public function testGetsAuthorFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') ); $entry = $feed->current(); @@ -1018,7 +1024,7 @@ public function testGetsAuthorFromRss20() public function testGetsAuthorFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') ); $entry = $feed->current(); @@ -1027,7 +1033,7 @@ public function testGetsAuthorFromRss094() public function testGetsAuthorFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') ); $entry = $feed->current(); @@ -1036,7 +1042,7 @@ public function testGetsAuthorFromRss093() public function testGetsAuthorFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') ); $entry = $feed->current(); @@ -1045,7 +1051,7 @@ public function testGetsAuthorFromRss092() public function testGetsAuthorFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') ); $entry = $feed->current(); @@ -1054,7 +1060,7 @@ public function testGetsAuthorFromRss091() public function testGetsAuthorFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') ); $entry = $feed->current(); @@ -1063,7 +1069,7 @@ public function testGetsAuthorFromRss10() public function testGetsAuthorFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') ); $entry = $feed->current(); @@ -1074,7 +1080,7 @@ public function testGetsAuthorFromRss090() public function testGetsAuthorFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') ); $entry = $feed->current(); @@ -1083,7 +1089,7 @@ public function testGetsAuthorFromRss20_Dc10() public function testGetsAuthorFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -1092,7 +1098,7 @@ public function testGetsAuthorFromRss094_Dc10() public function testGetsAuthorFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -1101,7 +1107,7 @@ public function testGetsAuthorFromRss093_Dc10() public function testGetsAuthorFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -1110,7 +1116,7 @@ public function testGetsAuthorFromRss092_Dc10() public function testGetsAuthorFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -1119,7 +1125,7 @@ public function testGetsAuthorFromRss091_Dc10() public function testGetsAuthorFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -1128,7 +1134,7 @@ public function testGetsAuthorFromRss10_Dc10() public function testGetsAuthorFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -1139,7 +1145,7 @@ public function testGetsAuthorFromRss090_Dc10() public function testGetsAuthorFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') ); $entry = $feed->current(); @@ -1148,7 +1154,7 @@ public function testGetsAuthorFromRss20_Dc11() public function testGetsAuthorFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -1157,7 +1163,7 @@ public function testGetsAuthorFromRss094_Dc11() public function testGetsAuthorFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -1166,7 +1172,7 @@ public function testGetsAuthorFromRss093_Dc11() public function testGetsAuthorFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -1175,7 +1181,7 @@ public function testGetsAuthorFromRss092_Dc11() public function testGetsAuthorFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -1184,7 +1190,7 @@ public function testGetsAuthorFromRss091_Dc11() public function testGetsAuthorFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -1193,7 +1199,7 @@ public function testGetsAuthorFromRss10_Dc11() public function testGetsAuthorFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -1204,7 +1210,7 @@ public function testGetsAuthorFromRss090_Dc11() public function testGetsAuthorFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -1213,7 +1219,7 @@ public function testGetsAuthorFromRss20_None() public function testGetsAuthorFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -1222,7 +1228,7 @@ public function testGetsAuthorFromRss094_None() public function testGetsAuthorFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -1231,7 +1237,7 @@ public function testGetsAuthorFromRss093_None() public function testGetsAuthorFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -1240,7 +1246,7 @@ public function testGetsAuthorFromRss092_None() public function testGetsAuthorFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -1249,7 +1255,7 @@ public function testGetsAuthorFromRss091_None() public function testGetsAuthorFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -1258,7 +1264,7 @@ public function testGetsAuthorFromRss10_None() public function testGetsAuthorFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -1270,7 +1276,7 @@ public function testGetsAuthorFromRss090_None() */ public function testGetsDescriptionFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss20.xml') ); $entry = $feed->current(); @@ -1279,7 +1285,7 @@ public function testGetsDescriptionFromRss20() public function testGetsDescriptionFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss094.xml') ); $entry = $feed->current(); @@ -1288,7 +1294,7 @@ public function testGetsDescriptionFromRss094() public function testGetsDescriptionFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss093.xml') ); $entry = $feed->current(); @@ -1297,7 +1303,7 @@ public function testGetsDescriptionFromRss093() public function testGetsDescriptionFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss092.xml') ); $entry = $feed->current(); @@ -1306,7 +1312,7 @@ public function testGetsDescriptionFromRss092() public function testGetsDescriptionFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss091.xml') ); $entry = $feed->current(); @@ -1315,7 +1321,7 @@ public function testGetsDescriptionFromRss091() public function testGetsDescriptionFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss10.xml') ); $entry = $feed->current(); @@ -1324,7 +1330,7 @@ public function testGetsDescriptionFromRss10() public function testGetsDescriptionFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss090.xml') ); $entry = $feed->current(); @@ -1335,7 +1341,7 @@ public function testGetsDescriptionFromRss090() public function testGetsDescriptionFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss20.xml') ); $entry = $feed->current(); @@ -1344,7 +1350,7 @@ public function testGetsDescriptionFromRss20_Dc10() public function testGetsDescriptionFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -1353,7 +1359,7 @@ public function testGetsDescriptionFromRss094_Dc10() public function testGetsDescriptionFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -1362,7 +1368,7 @@ public function testGetsDescriptionFromRss093_Dc10() public function testGetsDescriptionFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -1371,7 +1377,7 @@ public function testGetsDescriptionFromRss092_Dc10() public function testGetsDescriptionFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -1380,7 +1386,7 @@ public function testGetsDescriptionFromRss091_Dc10() public function testGetsDescriptionFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -1389,7 +1395,7 @@ public function testGetsDescriptionFromRss10_Dc10() public function testGetsDescriptionFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -1400,7 +1406,7 @@ public function testGetsDescriptionFromRss090_Dc10() public function testGetsDescriptionFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss20.xml') ); $entry = $feed->current(); @@ -1409,7 +1415,7 @@ public function testGetsDescriptionFromRss20_Dc11() public function testGetsDescriptionFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -1418,7 +1424,7 @@ public function testGetsDescriptionFromRss094_Dc11() public function testGetsDescriptionFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -1427,7 +1433,7 @@ public function testGetsDescriptionFromRss093_Dc11() public function testGetsDescriptionFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -1436,7 +1442,7 @@ public function testGetsDescriptionFromRss092_Dc11() public function testGetsDescriptionFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -1445,7 +1451,7 @@ public function testGetsDescriptionFromRss091_Dc11() public function testGetsDescriptionFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -1454,7 +1460,7 @@ public function testGetsDescriptionFromRss10_Dc11() public function testGetsDescriptionFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -1465,7 +1471,7 @@ public function testGetsDescriptionFromRss090_Dc11() public function testGetsDescriptionFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -1474,7 +1480,7 @@ public function testGetsDescriptionFromRss20_None() public function testGetsDescriptionFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -1483,7 +1489,7 @@ public function testGetsDescriptionFromRss094_None() public function testGetsDescriptionFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -1492,7 +1498,7 @@ public function testGetsDescriptionFromRss093_None() public function testGetsDescriptionFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -1501,7 +1507,7 @@ public function testGetsDescriptionFromRss092_None() public function testGetsDescriptionFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -1510,7 +1516,7 @@ public function testGetsDescriptionFromRss091_None() public function testGetsDescriptionFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -1519,7 +1525,7 @@ public function testGetsDescriptionFromRss10_None() public function testGetsDescriptionFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -1531,12 +1537,12 @@ public function testGetsDescriptionFromRss090_None() */ public function testGetsEnclosureFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/enclosure/plain/rss20.xml') ); $entry = $feed->current(); - $expected = new stdClass(); + $expected = new \stdClass(); $expected->url = 'http://www.scripting.com/mp3s/weatherReportSuite.mp3'; $expected->length = '12216320'; $expected->type = 'audio/mpeg'; @@ -1546,7 +1552,7 @@ public function testGetsEnclosureFromRss20() public function testGetsEnclosureFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/enclosure/plain/rss10.xml') ); $entry = $feed->current(); @@ -1558,7 +1564,7 @@ public function testGetsEnclosureFromRss10() */ public function testGetsContentFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss20.xml') ); $entry = $feed->current(); @@ -1567,7 +1573,7 @@ public function testGetsContentFromRss20() public function testGetsContentFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss094.xml') ); $entry = $feed->current(); @@ -1576,7 +1582,7 @@ public function testGetsContentFromRss094() public function testGetsContentFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss093.xml') ); $entry = $feed->current(); @@ -1585,7 +1591,7 @@ public function testGetsContentFromRss093() public function testGetsContentFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss092.xml') ); $entry = $feed->current(); @@ -1594,7 +1600,7 @@ public function testGetsContentFromRss092() public function testGetsContentFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss091.xml') ); $entry = $feed->current(); @@ -1603,7 +1609,7 @@ public function testGetsContentFromRss091() public function testGetsContentFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss10.xml') ); $entry = $feed->current(); @@ -1612,7 +1618,7 @@ public function testGetsContentFromRss10() public function testGetsContentFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss090.xml') ); $entry = $feed->current(); @@ -1623,7 +1629,7 @@ public function testGetsContentFromRss090() public function testGetsContentFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss20.xml') ); $entry = $feed->current(); @@ -1632,7 +1638,7 @@ public function testGetsContentFromRss20_Dc10() public function testGetsContentFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss094.xml') ); $entry = $feed->current(); @@ -1641,7 +1647,7 @@ public function testGetsContentFromRss094_Dc10() public function testGetsContentFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss093.xml') ); $entry = $feed->current(); @@ -1650,7 +1656,7 @@ public function testGetsContentFromRss093_Dc10() public function testGetsContentFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss092.xml') ); $entry = $feed->current(); @@ -1659,7 +1665,7 @@ public function testGetsContentFromRss092_Dc10() public function testGetsContentFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss091.xml') ); $entry = $feed->current(); @@ -1668,7 +1674,7 @@ public function testGetsContentFromRss091_Dc10() public function testGetsContentFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss10.xml') ); $entry = $feed->current(); @@ -1677,7 +1683,7 @@ public function testGetsContentFromRss10_Dc10() public function testGetsContentFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss090.xml') ); $entry = $feed->current(); @@ -1688,7 +1694,7 @@ public function testGetsContentFromRss090_Dc10() public function testGetsContentFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -1697,7 +1703,7 @@ public function testGetsContentFromRss20_None() public function testGetsContentFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -1706,7 +1712,7 @@ public function testGetsContentFromRss094_None() public function testGetsContentFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -1715,7 +1721,7 @@ public function testGetsContentFromRss093_None() public function testGetsContentFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -1724,7 +1730,7 @@ public function testGetsContentFromRss092_None() public function testGetsContentFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -1733,7 +1739,7 @@ public function testGetsContentFromRss091_None() public function testGetsContentFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -1742,7 +1748,7 @@ public function testGetsContentFromRss10_None() public function testGetsContentFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -1754,7 +1760,7 @@ public function testGetsContentFromRss090_None() */ public function testGetsLinkFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss20.xml') ); $entry = $feed->current(); @@ -1763,7 +1769,7 @@ public function testGetsLinkFromRss20() public function testGetsLinkFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss094.xml') ); $entry = $feed->current(); @@ -1772,7 +1778,7 @@ public function testGetsLinkFromRss094() public function testGetsLinkFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss093.xml') ); $entry = $feed->current(); @@ -1781,7 +1787,7 @@ public function testGetsLinkFromRss093() public function testGetsLinkFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss092.xml') ); $entry = $feed->current(); @@ -1790,7 +1796,7 @@ public function testGetsLinkFromRss092() public function testGetsLinkFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss091.xml') ); $entry = $feed->current(); @@ -1799,7 +1805,7 @@ public function testGetsLinkFromRss091() public function testGetsLinkFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss10.xml') ); $entry = $feed->current(); @@ -1808,7 +1814,7 @@ public function testGetsLinkFromRss10() public function testGetsLinkFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss090.xml') ); $entry = $feed->current(); @@ -1819,7 +1825,7 @@ public function testGetsLinkFromRss090() public function testGetsLinkFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -1828,7 +1834,7 @@ public function testGetsLinkFromRss20_None() public function testGetsLinkFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -1837,7 +1843,7 @@ public function testGetsLinkFromRss094_None() public function testGetsLinkFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -1846,7 +1852,7 @@ public function testGetsLinkFromRss093_None() public function testGetsLinkFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -1855,7 +1861,7 @@ public function testGetsLinkFromRss092_None() public function testGetsLinkFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -1864,7 +1870,7 @@ public function testGetsLinkFromRss091_None() public function testGetsLinkFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -1873,7 +1879,7 @@ public function testGetsLinkFromRss10_None() public function testGetsLinkFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -1885,12 +1891,12 @@ public function testGetsLinkFromRss090_None() */ public function testGetsDateModifiedFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } @@ -1898,78 +1904,78 @@ public function testGetsDateModifiedFromRss20() public function testGetsDateModifiedFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss20.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss094.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss093.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss092.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss091.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss10.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss090.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } @@ -1977,78 +1983,78 @@ public function testGetsDateModifiedFromRss090_Dc10() public function testGetsDateModifiedFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss20.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss094.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss093.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss092.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss091.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss10.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss090.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } @@ -2056,7 +2062,7 @@ public function testGetsDateModifiedFromRss090_Dc11() public function testGetsDateModifiedFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -2065,7 +2071,7 @@ public function testGetsDateModifiedFromRss20_None() public function testGetsDateModifiedFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -2074,7 +2080,7 @@ public function testGetsDateModifiedFromRss094_None() public function testGetsDateModifiedFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -2083,7 +2089,7 @@ public function testGetsDateModifiedFromRss093_None() public function testGetsDateModifiedFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -2092,7 +2098,7 @@ public function testGetsDateModifiedFromRss092_None() public function testGetsDateModifiedFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -2101,7 +2107,7 @@ public function testGetsDateModifiedFromRss091_None() public function testGetsDateModifiedFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -2110,7 +2116,7 @@ public function testGetsDateModifiedFromRss10_None() public function testGetsDateModifiedFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -2122,13 +2128,13 @@ public function testGetsDateModifiedFromRss090_None() */ public function testGetsDateModifiedFromRss20_UnrecognisedGmtFormat() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20-zf-7908.xml') ); $entry = $feed->current(); //$this->assertEquals('Sunday 11 January 2009 09 55 59 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); - $edate = new Zend_Date; - $edate->set('Sun, 11 Jan 2009 09:55:59 GMT', Zend_Date::RSS); + $edate = new Date\Date; + $edate->set('Sun, 11 Jan 2009 09:55:59 GMT', Date\Date::RSS); $this->assertTrue($edate->equals($entry->getDateModified())); } @@ -2140,7 +2146,7 @@ public function testGetsDateModifiedFromRss20_UnrecognisedGmtFormat() public function testGetsCommentCountFromRss20_Slash10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss20.xml') ); $entry = $feed->current(); @@ -2149,7 +2155,7 @@ public function testGetsCommentCountFromRss20_Slash10() public function testGetsCommentCountFromRss094_Slash10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss094.xml') ); $entry = $feed->current(); @@ -2158,7 +2164,7 @@ public function testGetsCommentCountFromRss094_Slash10() public function testGetsCommentCountFromRss093_Slash10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss093.xml') ); $entry = $feed->current(); @@ -2167,7 +2173,7 @@ public function testGetsCommentCountFromRss093_Slash10() public function testGetsCommentCountFromRss092_Slash10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss092.xml') ); $entry = $feed->current(); @@ -2176,7 +2182,7 @@ public function testGetsCommentCountFromRss092_Slash10() public function testGetsCommentCountFromRss091_Slash10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss091.xml') ); $entry = $feed->current(); @@ -2185,7 +2191,7 @@ public function testGetsCommentCountFromRss091_Slash10() public function testGetsCommentCountFromRss10_Slash10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss10.xml') ); $entry = $feed->current(); @@ -2194,7 +2200,7 @@ public function testGetsCommentCountFromRss10_Slash10() public function testGetsCommentCountFromRss090_Slash10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss090.xml') ); $entry = $feed->current(); @@ -2205,7 +2211,7 @@ public function testGetsCommentCountFromRss090_Slash10() public function testGetsCommentCountFromRss20_Thread10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss20.xml') ); $entry = $feed->current(); @@ -2214,7 +2220,7 @@ public function testGetsCommentCountFromRss20_Thread10() public function testGetsCommentCountFromRss094_Thread10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss094.xml') ); $entry = $feed->current(); @@ -2223,7 +2229,7 @@ public function testGetsCommentCountFromRss094_Thread10() public function testGetsCommentCountFromRss093_Thread10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss093.xml') ); $entry = $feed->current(); @@ -2232,7 +2238,7 @@ public function testGetsCommentCountFromRss093_Thread10() public function testGetsCommentCountFromRss092_Thread10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss092.xml') ); $entry = $feed->current(); @@ -2241,7 +2247,7 @@ public function testGetsCommentCountFromRss092_Thread10() public function testGetsCommentCountFromRss091_Thread10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss091.xml') ); $entry = $feed->current(); @@ -2250,7 +2256,7 @@ public function testGetsCommentCountFromRss091_Thread10() public function testGetsCommentCountFromRss10_Thread10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss10.xml') ); $entry = $feed->current(); @@ -2259,7 +2265,7 @@ public function testGetsCommentCountFromRss10_Thread10() public function testGetsCommentCountFromRss090_Thread10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss090.xml') ); $entry = $feed->current(); @@ -2270,7 +2276,7 @@ public function testGetsCommentCountFromRss090_Thread10() public function testGetsCommentCountFromRss20_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss20.xml') ); $entry = $feed->current(); @@ -2279,7 +2285,7 @@ public function testGetsCommentCountFromRss20_Atom10() public function testGetsCommentCountFromRss094_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss094.xml') ); $entry = $feed->current(); @@ -2288,7 +2294,7 @@ public function testGetsCommentCountFromRss094_Atom10() public function testGetsCommentCountFromRss093_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss093.xml') ); $entry = $feed->current(); @@ -2297,7 +2303,7 @@ public function testGetsCommentCountFromRss093_Atom10() public function testGetsCommentCountFromRss092_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss092.xml') ); $entry = $feed->current(); @@ -2306,7 +2312,7 @@ public function testGetsCommentCountFromRss092_Atom10() public function testGetsCommentCountFromRss091_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss091.xml') ); $entry = $feed->current(); @@ -2315,7 +2321,7 @@ public function testGetsCommentCountFromRss091_Atom10() public function testGetsCommentCountFromRss10_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss10.xml') ); $entry = $feed->current(); @@ -2324,7 +2330,7 @@ public function testGetsCommentCountFromRss10_Atom10() public function testGetsCommentCountFromRss090_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss090.xml') ); $entry = $feed->current(); @@ -2335,7 +2341,7 @@ public function testGetsCommentCountFromRss090_Atom10() public function testGetsCommentCountFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -2344,7 +2350,7 @@ public function testGetsCommentCountFromRss20_None() public function testGetsCommentCountFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -2353,7 +2359,7 @@ public function testGetsCommentCountFromRss094_None() public function testGetsCommentCountFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -2362,7 +2368,7 @@ public function testGetsCommentCountFromRss093_None() public function testGetsCommentCountFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -2371,7 +2377,7 @@ public function testGetsCommentCountFromRss092_None() public function testGetsCommentCountFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -2380,7 +2386,7 @@ public function testGetsCommentCountFromRss091_None() public function testGetsCommentCountFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -2389,7 +2395,7 @@ public function testGetsCommentCountFromRss10_None() public function testGetsCommentCountFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -2402,7 +2408,7 @@ public function testGetsCommentCountFromRss090_None() public function testGetsCommentLinkFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss20.xml') ); $entry = $feed->current(); @@ -2411,7 +2417,7 @@ public function testGetsCommentLinkFromRss20() public function testGetsCommentLinkFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss094.xml') ); $entry = $feed->current(); @@ -2420,7 +2426,7 @@ public function testGetsCommentLinkFromRss094() public function testGetsCommentLinkFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss093.xml') ); $entry = $feed->current(); @@ -2429,7 +2435,7 @@ public function testGetsCommentLinkFromRss093() public function testGetsCommentLinkFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss092.xml') ); $entry = $feed->current(); @@ -2438,7 +2444,7 @@ public function testGetsCommentLinkFromRss092() public function testGetsCommentLinkFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss091.xml') ); $entry = $feed->current(); @@ -2449,7 +2455,7 @@ public function testGetsCommentLinkFromRss091() public function testGetsCommentLinkFromRss20_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss20.xml') ); $entry = $feed->current(); @@ -2458,7 +2464,7 @@ public function testGetsCommentLinkFromRss20_Atom10() public function testGetsCommentLinkFromRss094_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss094.xml') ); $entry = $feed->current(); @@ -2467,7 +2473,7 @@ public function testGetsCommentLinkFromRss094_Atom10() public function testGetsCommentLinkFromRss093_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss093.xml') ); $entry = $feed->current(); @@ -2476,7 +2482,7 @@ public function testGetsCommentLinkFromRss093_Atom10() public function testGetsCommentLinkFromRss092_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss092.xml') ); $entry = $feed->current(); @@ -2485,7 +2491,7 @@ public function testGetsCommentLinkFromRss092_Atom10() public function testGetsCommentLinkFromRss091_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss091.xml') ); $entry = $feed->current(); @@ -2494,7 +2500,7 @@ public function testGetsCommentLinkFromRss091_Atom10() public function testGetsCommentLinkFromRss10_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss10.xml') ); $entry = $feed->current(); @@ -2503,7 +2509,7 @@ public function testGetsCommentLinkFromRss10_Atom10() public function testGetsCommentLinkFromRss090_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss090.xml') ); $entry = $feed->current(); @@ -2514,7 +2520,7 @@ public function testGetsCommentLinkFromRss090_Atom10() public function testGetsCommentLinkFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -2523,7 +2529,7 @@ public function testGetsCommentLinkFromRss20_None() public function testGetsCommentLinkFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -2532,7 +2538,7 @@ public function testGetsCommentLinkFromRss094_None() public function testGetsCommentLinkFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -2541,7 +2547,7 @@ public function testGetsCommentLinkFromRss093_None() public function testGetsCommentLinkFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -2550,7 +2556,7 @@ public function testGetsCommentLinkFromRss092_None() public function testGetsCommentLinkFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -2559,7 +2565,7 @@ public function testGetsCommentLinkFromRss091_None() public function testGetsCommentLinkFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -2568,7 +2574,7 @@ public function testGetsCommentLinkFromRss10_None() public function testGetsCommentLinkFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -2583,7 +2589,7 @@ public function testGetsCommentLinkFromRss090_None() public function testGetsCommentFeedLinkFromRss20_WellFormedWeb10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss20.xml') ); $entry = $feed->current(); @@ -2592,7 +2598,7 @@ public function testGetsCommentFeedLinkFromRss20_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss094_WellFormedWeb10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss094.xml') ); $entry = $feed->current(); @@ -2601,7 +2607,7 @@ public function testGetsCommentFeedLinkFromRss094_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss093_WellFormedWeb10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss093.xml') ); $entry = $feed->current(); @@ -2610,7 +2616,7 @@ public function testGetsCommentFeedLinkFromRss093_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss092_WellFormedWeb10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss092.xml') ); $entry = $feed->current(); @@ -2619,7 +2625,7 @@ public function testGetsCommentFeedLinkFromRss092_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss091_WellFormedWeb10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss091.xml') ); $entry = $feed->current(); @@ -2628,7 +2634,7 @@ public function testGetsCommentFeedLinkFromRss091_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss10_WellFormedWeb10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss10.xml') ); $entry = $feed->current(); @@ -2637,7 +2643,7 @@ public function testGetsCommentFeedLinkFromRss10_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss090_WellFormedWeb10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss090.xml') ); $entry = $feed->current(); @@ -2648,7 +2654,7 @@ public function testGetsCommentFeedLinkFromRss090_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss20_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss20.xml') ); $entry = $feed->current(); @@ -2657,7 +2663,7 @@ public function testGetsCommentFeedLinkFromRss20_Atom10() public function testGetsCommentFeedLinkFromRss094_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss094.xml') ); $entry = $feed->current(); @@ -2666,7 +2672,7 @@ public function testGetsCommentFeedLinkFromRss094_Atom10() public function testGetsCommentFeedLinkFromRss093_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss093.xml') ); $entry = $feed->current(); @@ -2675,7 +2681,7 @@ public function testGetsCommentFeedLinkFromRss093_Atom10() public function testGetsCommentFeedLinkFromRss092_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss092.xml') ); $entry = $feed->current(); @@ -2684,7 +2690,7 @@ public function testGetsCommentFeedLinkFromRss092_Atom10() public function testGetsCommentFeedLinkFromRss091_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss091.xml') ); $entry = $feed->current(); @@ -2693,7 +2699,7 @@ public function testGetsCommentFeedLinkFromRss091_Atom10() public function testGetsCommentFeedLinkFromRss10_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss10.xml') ); $entry = $feed->current(); @@ -2702,7 +2708,7 @@ public function testGetsCommentFeedLinkFromRss10_Atom10() public function testGetsCommentFeedLinkFromRss090_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss090.xml') ); $entry = $feed->current(); @@ -2713,7 +2719,7 @@ public function testGetsCommentFeedLinkFromRss090_Atom10() public function testGetsCommentFeedLinkFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -2722,7 +2728,7 @@ public function testGetsCommentFeedLinkFromRss20_None() public function testGetsCommentFeedLinkFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -2731,7 +2737,7 @@ public function testGetsCommentFeedLinkFromRss094_None() public function testGetsCommentFeedLinkFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -2740,7 +2746,7 @@ public function testGetsCommentFeedLinkFromRss093_None() public function testGetsCommentFeedLinkFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -2749,7 +2755,7 @@ public function testGetsCommentFeedLinkFromRss092_None() public function testGetsCommentFeedLinkFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -2758,7 +2764,7 @@ public function testGetsCommentFeedLinkFromRss091_None() public function testGetsCommentFeedLinkFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -2767,7 +2773,7 @@ public function testGetsCommentFeedLinkFromRss10_None() public function testGetsCommentFeedLinkFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -2782,7 +2788,7 @@ public function testGetsCommentFeedLinkFromRss090_None() public function testGetsCategoriesFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/rss20.xml') ); $entry = $feed->current(); @@ -2794,7 +2800,7 @@ public function testGetsCategoriesFromRss20() public function testGetsCategoriesFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -2804,7 +2810,7 @@ public function testGetsCategoriesFromRss090_Dc10() public function testGetsCategoriesFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -2814,7 +2820,7 @@ public function testGetsCategoriesFromRss091_Dc10() public function testGetsCategoriesFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -2824,7 +2830,7 @@ public function testGetsCategoriesFromRss092_Dc10() public function testGetsCategoriesFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -2834,7 +2840,7 @@ public function testGetsCategoriesFromRss093_Dc10() public function testGetsCategoriesFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -2844,7 +2850,7 @@ public function testGetsCategoriesFromRss094_Dc10() public function testGetsCategoriesFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -2856,7 +2862,7 @@ public function testGetsCategoriesFromRss10_Dc10() public function testGetsCategoriesFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -2866,7 +2872,7 @@ public function testGetsCategoriesFromRss090_Dc11() public function testGetsCategoriesFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -2876,7 +2882,7 @@ public function testGetsCategoriesFromRss091_Dc11() public function testGetsCategoriesFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -2886,7 +2892,7 @@ public function testGetsCategoriesFromRss092_Dc11() public function testGetsCategoriesFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -2896,7 +2902,7 @@ public function testGetsCategoriesFromRss093_Dc11() public function testGetsCategoriesFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -2906,7 +2912,7 @@ public function testGetsCategoriesFromRss094_Dc11() public function testGetsCategoriesFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -2918,7 +2924,7 @@ public function testGetsCategoriesFromRss10_Dc11() public function testGetsCategoriesFromRss090_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss090.xml') ); $entry = $feed->current(); @@ -2928,7 +2934,7 @@ public function testGetsCategoriesFromRss090_Atom10() public function testGetsCategoriesFromRss091_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss091.xml') ); $entry = $feed->current(); @@ -2938,7 +2944,7 @@ public function testGetsCategoriesFromRss091_Atom10() public function testGetsCategoriesFromRss092_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss092.xml') ); $entry = $feed->current(); @@ -2948,7 +2954,7 @@ public function testGetsCategoriesFromRss092_Atom10() public function testGetsCategoriesFromRss093_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss093.xml') ); $entry = $feed->current(); @@ -2958,7 +2964,7 @@ public function testGetsCategoriesFromRss093_Atom10() public function testGetsCategoriesFromRss094_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss094.xml') ); $entry = $feed->current(); @@ -2968,7 +2974,7 @@ public function testGetsCategoriesFromRss094_Atom10() public function testGetsCategoriesFromRss10_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss10.xml') ); $entry = $feed->current(); @@ -2980,7 +2986,7 @@ public function testGetsCategoriesFromRss10_Atom10() public function testGetsCategoriesFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -2990,7 +2996,7 @@ public function testGetsCategoriesFromRss20_None() public function testGetsCategoriesFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -3000,7 +3006,7 @@ public function testGetsCategoriesFromRss090_None() public function testGetsCategoriesFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -3010,7 +3016,7 @@ public function testGetsCategoriesFromRss091_None() public function testGetsCategoriesFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -3020,7 +3026,7 @@ public function testGetsCategoriesFromRss092_None() public function testGetsCategoriesFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -3030,7 +3036,7 @@ public function testGetsCategoriesFromRss093_None() public function testGetsCategoriesFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -3040,7 +3046,7 @@ public function testGetsCategoriesFromRss094_None() public function testGetsCategoriesFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss10.xml') ); $entry = $feed->current(); diff --git a/test/Reader/Feed/AtomSourceTest.php b/test/Reader/Feed/AtomSourceTest.php index a2d7d313..8f7609bd 100644 --- a/test/Reader/Feed/AtomSourceTest.php +++ b/test/Reader/Feed/AtomSourceTest.php @@ -20,6 +20,12 @@ * @version $Id: AtomTest.php 19168 2009-11-21 17:17:18Z padraic $ */ +/** + * @namespace + */ +namespace ZendTest\Feed\Reader\Feed; +use Zend\Feed\Reader; +use Zend\Date; /** * @category Zend @@ -30,7 +36,7 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class Zend_Feed_Reader_Feed_AtomSourceTest extends PHPUnit_Framework_TestCase +class AtomSourceTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -43,19 +49,19 @@ class Zend_Feed_Reader_Feed_AtomSourceTest extends PHPUnit_Framework_TestCase public function setup() { - Zend_Feed_Reader::reset(); - if (Zend_Registry::isRegistered('Zend_Locale')) { - $registry = Zend_Registry::getInstance(); + Reader\Reader::reset(); + if (\Zend\Registry::isRegistered('Zend_Locale')) { + $registry = \Zend\Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/AtomSource'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -89,16 +95,16 @@ public function setup() public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } public function testGetsSourceFromEntry() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/atom10.xml') ); $source = $feed->current()->getSource(); - $this->assertTrue($source instanceof Zend_Feed_Reader_Feed_Atom_Source); + $this->assertTrue($source instanceof \Zend\Feed\Reader\Feed\Atom\Source); } /** @@ -107,7 +113,7 @@ public function testGetsSourceFromEntry() public function testGetsTitleFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/atom10.xml') ); $source = $feed->current()->getSource(); @@ -120,7 +126,7 @@ public function testGetsTitleFromAtom10() public function testGetsAuthorArrayFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/atom10.xml') ); $source = $feed->current()->getSource(); @@ -143,7 +149,7 @@ public function testGetsAuthorArrayFromAtom10() public function testGetsSingleAuthorFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/atom10.xml') ); $source = $feed->current()->getSource(); @@ -157,13 +163,13 @@ public function testGetsSingleAuthorFromAtom10() public function testGetsDateCreatedFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/atom10.xml') ); $source = $feed->current()->getSource(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($source->getDateCreated())); } @@ -173,13 +179,13 @@ public function testGetsDateCreatedFromAtom10() public function testGetsDateModifiedFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/atom10.xml') ); $source = $feed->current()->getSource(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($source->getDateModified())); } @@ -189,7 +195,7 @@ public function testGetsDateModifiedFromAtom10() public function testGetsGeneratorFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/atom10.xml') ); $source = $feed->current()->getSource(); @@ -202,7 +208,7 @@ public function testGetsGeneratorFromAtom10() public function testGetsCopyrightFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/atom10.xml') ); $source = $feed->current()->getSource(); @@ -215,7 +221,7 @@ public function testGetsCopyrightFromAtom10() public function testGetsDescriptionFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/atom10.xml') ); $source = $feed->current()->getSource(); @@ -228,7 +234,7 @@ public function testGetsDescriptionFromAtom10() public function testGetsIdFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/atom10.xml') ); $source = $feed->current()->getSource(); @@ -241,7 +247,7 @@ public function testGetsIdFromAtom10() public function testGetsLanguageFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/atom10.xml') ); $source = $feed->current()->getSource(); @@ -254,7 +260,7 @@ public function testGetsLanguageFromAtom10() public function testGetsLinkFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/atom10.xml') ); $source = $feed->current()->getSource(); @@ -267,7 +273,7 @@ public function testGetsLinkFromAtom10() public function testGetsFeedLinkFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/atom10.xml') ); $source = $feed->current()->getSource(); @@ -279,7 +285,7 @@ public function testGetsFeedLinkFromAtom10() */ public function testGetsHubsFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/atom10.xml') ); $source = $feed->current()->getSource(); @@ -294,7 +300,7 @@ public function testGetsHubsFromAtom10() */ public function testGetsCategoriesFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/atom10.xml') ); $source = $feed->current()->getSource(); diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 517a3cff..40b088c5 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -20,6 +20,12 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed\Reader\Feed; +use Zend\Feed\Reader; +use Zend\Date; /** * @category Zend @@ -30,7 +36,7 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class Zend_Feed_Reader_Feed_AtomTest extends PHPUnit_Framework_TestCase +class AtomTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -43,19 +49,19 @@ class Zend_Feed_Reader_Feed_AtomTest extends PHPUnit_Framework_TestCase public function setup() { - Zend_Feed_Reader::reset(); - if (Zend_Registry::isRegistered('Zend_Locale')) { - $registry = Zend_Registry::getInstance(); + Reader\Reader::reset(); + if (\Zend\Registry::isRegistered('Zend_Locale')) { + $registry = \Zend\Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Atom'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -89,7 +95,7 @@ public function setup() public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } /** @@ -97,7 +103,7 @@ public function teardown() */ public function testGetsTitleFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom03.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -105,7 +111,7 @@ public function testGetsTitleFromAtom03() public function testGetsTitleFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -116,7 +122,7 @@ public function testGetsTitleFromAtom10() */ public function testGetsAuthorArrayFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom03.xml') ); @@ -134,7 +140,7 @@ public function testGetsAuthorArrayFromAtom03() public function testGetsAuthorArrayFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10.xml') ); @@ -155,7 +161,7 @@ public function testGetsAuthorArrayFromAtom10() */ public function testGetsSingleAuthorFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom03.xml') ); @@ -164,7 +170,7 @@ public function testGetsSingleAuthorFromAtom03() public function testGetsSingleAuthorFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10.xml') ); @@ -176,22 +182,22 @@ public function testGetsSingleAuthorFromAtom10() */ public function testGetsDateCreatedFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom03.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateCreated())); } public function testGetsDateCreatedFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom10.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateCreated())); } @@ -200,23 +206,23 @@ public function testGetsDateCreatedFromAtom10() */ public function testGetsDateModifiedFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom03.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom10.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } @@ -225,7 +231,7 @@ public function testGetsDateModifiedFromAtom10() */ public function testGetsGeneratorFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/atom03.xml') ); $this->assertEquals('Zend_Feed', $feed->getGenerator()); @@ -233,7 +239,7 @@ public function testGetsGeneratorFromAtom03() public function testGetsGeneratorFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/atom10.xml') ); $this->assertEquals('Zend_Feed', $feed->getGenerator()); @@ -244,7 +250,7 @@ public function testGetsGeneratorFromAtom10() */ public function testGetsCopyrightFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/atom03.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -252,7 +258,7 @@ public function testGetsCopyrightFromAtom03() public function testGetsCopyrightFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/atom10.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -263,7 +269,7 @@ public function testGetsCopyrightFromAtom10() */ public function testGetsDescriptionFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/atom03.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -271,7 +277,7 @@ public function testGetsDescriptionFromAtom03() public function testGetsDescriptionFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/atom10.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -282,7 +288,7 @@ public function testGetsDescriptionFromAtom10() */ public function testGetsIdFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/atom03.xml') ); $this->assertEquals('123', $feed->getId()); @@ -290,7 +296,7 @@ public function testGetsIdFromAtom03() public function testGetsIdFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/atom10.xml') ); $this->assertEquals('123', $feed->getId()); @@ -301,7 +307,7 @@ public function testGetsIdFromAtom10() */ public function testGetsLanguageFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/atom03.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -309,7 +315,7 @@ public function testGetsLanguageFromAtom03() public function testGetsLanguageFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/atom10.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -320,7 +326,7 @@ public function testGetsLanguageFromAtom10() */ public function testGetsLinkFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/atom03.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -328,7 +334,7 @@ public function testGetsLinkFromAtom03() public function testGetsLinkFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/atom10.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -336,7 +342,7 @@ public function testGetsLinkFromAtom10() public function testGetsLinkFromAtom10WithNoRelAttribute() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/atom10-norel.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -344,7 +350,7 @@ public function testGetsLinkFromAtom10WithNoRelAttribute() public function testGetsLinkFromAtom10WithRelativeUrl() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/atom10-relative.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -355,7 +361,7 @@ public function testGetsLinkFromAtom10WithRelativeUrl() */ public function testGetsBaseUriFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom10-relative.xml') ); $this->assertEquals('http://www.example.com/', $feed->getBaseUrl()); @@ -366,7 +372,7 @@ public function testGetsBaseUriFromAtom10() */ public function testGetsFeedLinkFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom03.xml') ); $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); @@ -374,7 +380,7 @@ public function testGetsFeedLinkFromAtom03() public function testGetsFeedLinkFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom10.xml') ); $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); @@ -382,7 +388,7 @@ public function testGetsFeedLinkFromAtom10() public function testGetsFeedLinkFromAtom10IfRelativeUri() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom10-relative.xml') ); $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); @@ -393,7 +399,7 @@ public function testGetsFeedLinkFromAtom10IfRelativeUri() */ public function testGetsHubsFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom03.xml') ); $this->assertEquals(array( @@ -404,7 +410,7 @@ public function testGetsHubsFromAtom03() public function testGetsHubsFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10.xml') ); $this->assertEquals(array( @@ -420,7 +426,7 @@ public function testGetsHubsFromAtom10() public function testCountableInterface() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/atom10.xml') ); $this->assertEquals(0, count($feed)); @@ -434,7 +440,7 @@ public function testCountableInterface() public function testGetsCategoriesFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10.xml') ); $this->assertEquals($this->_expectedCats, (array) $feed->getCategories()); @@ -443,7 +449,7 @@ public function testGetsCategoriesFromAtom10() public function testGetsCategoriesFromAtom03_Atom10Extension() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom03.xml') ); $this->assertEquals($this->_expectedCats, (array) $feed->getCategories()); @@ -454,7 +460,7 @@ public function testGetsCategoriesFromAtom03_Atom10Extension() public function testGetsCategoriesFromAtom03_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/atom03.xml') ); $this->assertEquals($this->_expectedCatsDc, (array) $feed->getCategories()); @@ -463,7 +469,7 @@ public function testGetsCategoriesFromAtom03_Dc10() public function testGetsCategoriesFromAtom03_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/atom03.xml') ); $this->assertEquals($this->_expectedCatsDc, (array) $feed->getCategories()); @@ -474,7 +480,7 @@ public function testGetsCategoriesFromAtom03_Dc11() public function testGetsCategoriesFromAtom10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/atom10.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -483,7 +489,7 @@ public function testGetsCategoriesFromAtom10_None() public function testGetsCategoriesFromAtom03_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/atom03.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); diff --git a/test/Reader/Feed/CommonTest.php b/test/Reader/Feed/CommonTest.php index 371b62d1..193e3ec3 100644 --- a/test/Reader/Feed/CommonTest.php +++ b/test/Reader/Feed/CommonTest.php @@ -20,6 +20,11 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed\Reader\Feed; +use Zend\Feed\Reader; /** * @category Zend @@ -30,16 +35,16 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class Zend_Feed_Reader_Feed_CommonTest extends PHPUnit_Framework_TestCase +class CommonTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Zend_Feed_Reader::reset(); - if (Zend_Registry::isRegistered('Zend_Locale')) { - $registry = Zend_Registry::getInstance(); + Reader\Reader::reset(); + if (\Zend\Registry::isRegistered('Zend_Locale')) { + $registry = \Zend\Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Common'; @@ -50,23 +55,23 @@ public function setup() */ public function testGetsDomDocumentObject() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); - $this->assertTrue($feed->getDomDocument() instanceof DOMDocument); + $this->assertTrue($feed->getDomDocument() instanceof \DOMDocument); } public function testGetsDomXpathObject() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); - $this->assertTrue($feed->getXpath() instanceof DOMXPath); + $this->assertTrue($feed->getXpath() instanceof \DOMXPath); } public function testGetsXpathPrefixString() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $this->assertTrue($feed->getXpathPrefix() == '/atom:feed'); @@ -74,15 +79,15 @@ public function testGetsXpathPrefixString() public function testGetsDomElementObject() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); - $this->assertTrue($feed->getElement() instanceof DOMElement); + $this->assertTrue($feed->getElement() instanceof \DOMElement); } public function testSaveXmlOutputsXmlStringForFeed() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $this->assertEquals($feed->saveXml(), file_get_contents($this->_feedSamplePath.'/atom_rewrittenbydom.xml')); @@ -90,15 +95,15 @@ public function testSaveXmlOutputsXmlStringForFeed() public function testGetsNamedExtension() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); - $this->assertTrue($feed->getExtension('Atom') instanceof Zend_Feed_Reader_Extension_Atom_Feed); + $this->assertTrue($feed->getExtension('Atom') instanceof \Zend\Feed\Reader\Extension\Atom\Feed); } public function testReturnsNullIfExtensionDoesNotExist() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $this->assertEquals(null, $feed->getExtension('Foo')); @@ -109,7 +114,7 @@ public function testReturnsNullIfExtensionDoesNotExist() */ public function testReturnsEncodingOfFeed() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $this->assertEquals('UTF-8', $feed->getEncoding()); @@ -120,7 +125,7 @@ public function testReturnsEncodingOfFeed() */ public function testReturnsEncodingOfFeedAsUtf8IfUndefined() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom_noencodingdefined.xml') ); $this->assertEquals('UTF-8', $feed->getEncoding()); diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RSSTest.php similarity index 82% rename from test/Reader/Feed/RssTest.php rename to test/Reader/Feed/RSSTest.php index aef2e966..1a971671 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RSSTest.php @@ -20,6 +20,12 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed\Reader\Feed; +use Zend\Feed\Reader; +use Zend\Date; /** * @category Zend @@ -30,7 +36,7 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class Zend_Feed_Reader_Feed_RssTest extends PHPUnit_Framework_TestCase +class RSSTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -43,19 +49,19 @@ class Zend_Feed_Reader_Feed_RssTest extends PHPUnit_Framework_TestCase public function setup() { - Zend_Feed_Reader::reset(); - if (Zend_Registry::isRegistered('Zend_Locale')) { - $registry = Zend_Registry::getInstance(); - unset($registry['Zend_Locale']); + Reader\Reader::reset(); + if (\Zend\Registry::isRegistered('Zend\Locale')) { + $registry = \Zend\Registry::getInstance(); + unset($registry['Zend\Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Rss'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -106,7 +112,7 @@ public function setup() public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } /** @@ -114,7 +120,7 @@ public function teardown() */ public function testGetsTitleFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss20.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -122,7 +128,7 @@ public function testGetsTitleFromRss20() public function testGetsTitleFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss094.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -130,7 +136,7 @@ public function testGetsTitleFromRss094() public function testGetsTitleFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss093.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -138,7 +144,7 @@ public function testGetsTitleFromRss093() public function testGetsTitleFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss092.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -146,7 +152,7 @@ public function testGetsTitleFromRss092() public function testGetsTitleFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss091.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -154,7 +160,7 @@ public function testGetsTitleFromRss091() public function testGetsTitleFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss10.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -162,7 +168,7 @@ public function testGetsTitleFromRss10() public function testGetsTitleFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss090.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -172,7 +178,7 @@ public function testGetsTitleFromRss090() public function testGetsTitleFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss20.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -180,7 +186,7 @@ public function testGetsTitleFromRss20_Dc10() public function testGetsTitleFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss094.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -188,7 +194,7 @@ public function testGetsTitleFromRss094_Dc10() public function testGetsTitleFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss093.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -196,7 +202,7 @@ public function testGetsTitleFromRss093_Dc10() public function testGetsTitleFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss092.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -204,7 +210,7 @@ public function testGetsTitleFromRss092_Dc10() public function testGetsTitleFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss091.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -212,7 +218,7 @@ public function testGetsTitleFromRss091_Dc10() public function testGetsTitleFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss10.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -220,7 +226,7 @@ public function testGetsTitleFromRss10_Dc10() public function testGetsTitleFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss090.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -230,7 +236,7 @@ public function testGetsTitleFromRss090_Dc10() public function testGetsTitleFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss20.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -238,7 +244,7 @@ public function testGetsTitleFromRss20_Dc11() public function testGetsTitleFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss094.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -246,7 +252,7 @@ public function testGetsTitleFromRss094_Dc11() public function testGetsTitleFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss093.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -254,7 +260,7 @@ public function testGetsTitleFromRss093_Dc11() public function testGetsTitleFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss092.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -262,7 +268,7 @@ public function testGetsTitleFromRss092_Dc11() public function testGetsTitleFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss091.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -270,7 +276,7 @@ public function testGetsTitleFromRss091_Dc11() public function testGetsTitleFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss10.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -278,7 +284,7 @@ public function testGetsTitleFromRss10_Dc11() public function testGetsTitleFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss090.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -288,7 +294,7 @@ public function testGetsTitleFromRss090_Dc11() public function testGetsTitleFromRss20_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss20.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -296,7 +302,7 @@ public function testGetsTitleFromRss20_atom10() public function testGetsTitleFromRss094_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss094.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -304,7 +310,7 @@ public function testGetsTitleFromRss094_atom10() public function testGetsTitleFromRss093_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss093.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -312,7 +318,7 @@ public function testGetsTitleFromRss093_atom10() public function testGetsTitleFromRss092_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss092.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -320,7 +326,7 @@ public function testGetsTitleFromRss092_atom10() public function testGetsTitleFromRss091_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss091.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -328,7 +334,7 @@ public function testGetsTitleFromRss091_atom10() public function testGetsTitleFromRss10_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss10.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -336,7 +342,7 @@ public function testGetsTitleFromRss10_atom10() public function testGetsTitleFromRss090_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss090.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -346,7 +352,7 @@ public function testGetsTitleFromRss090_atom10() public function testGetsTitleFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -354,7 +360,7 @@ public function testGetsTitleFromRss20_None() public function testGetsTitleFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -362,7 +368,7 @@ public function testGetsTitleFromRss094_None() public function testGetsTitleFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -370,7 +376,7 @@ public function testGetsTitleFromRss093_None() public function testGetsTitleFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -378,7 +384,7 @@ public function testGetsTitleFromRss092_None() public function testGetsTitleFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -386,7 +392,7 @@ public function testGetsTitleFromRss091_None() public function testGetsTitleFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -394,7 +400,7 @@ public function testGetsTitleFromRss10_None() public function testGetsTitleFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -405,7 +411,7 @@ public function testGetsTitleFromRss090_None() */ public function testGetsAuthorArrayFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') ); $this->assertEquals(array( @@ -417,7 +423,7 @@ public function testGetsAuthorArrayFromRss20() public function testGetsAuthorArrayFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') ); $this->assertEquals(array( @@ -429,7 +435,7 @@ public function testGetsAuthorArrayFromRss094() public function testGetsAuthorArrayFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') ); $this->assertEquals(array( @@ -441,7 +447,7 @@ public function testGetsAuthorArrayFromRss093() public function testGetsAuthorArrayFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') ); $this->assertEquals(array( @@ -453,7 +459,7 @@ public function testGetsAuthorArrayFromRss092() public function testGetsAuthorArrayFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') ); $this->assertEquals(array( @@ -465,7 +471,7 @@ public function testGetsAuthorArrayFromRss091() public function testGetsAuthorArrayFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') ); $this->assertEquals(array( @@ -477,7 +483,7 @@ public function testGetsAuthorArrayFromRss10() public function testGetsAuthorArrayFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') ); $this->assertEquals(array( @@ -491,7 +497,7 @@ public function testGetsAuthorArrayFromRss090() public function testGetsAuthorArrayFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') ); $this->assertEquals(array( @@ -502,7 +508,7 @@ public function testGetsAuthorArrayFromRss20_Dc10() public function testGetsAuthorArrayFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') ); $this->assertEquals(array( @@ -513,7 +519,7 @@ public function testGetsAuthorArrayFromRss094_Dc10() public function testGetsAuthorArrayFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') ); $this->assertEquals(array( @@ -524,7 +530,7 @@ public function testGetsAuthorArrayFromRss093_Dc10() public function testGetsAuthorArrayFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') ); $this->assertEquals(array( @@ -535,7 +541,7 @@ public function testGetsAuthorArrayFromRss092_Dc10() public function testGetsAuthorArrayFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') ); $this->assertEquals(array( @@ -546,7 +552,7 @@ public function testGetsAuthorArrayFromRss091_Dc10() public function testGetsAuthorArrayFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') ); $this->assertEquals(array( @@ -557,7 +563,7 @@ public function testGetsAuthorArrayFromRss10_Dc10() public function testGetsAuthorArrayFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') ); $this->assertEquals(array( @@ -570,7 +576,7 @@ public function testGetsAuthorArrayFromRss090_Dc10() public function testGetsAuthorArrayFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') ); $this->assertEquals(array( @@ -581,7 +587,7 @@ public function testGetsAuthorArrayFromRss20_Dc11() public function testGetsAuthorArrayFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') ); $this->assertEquals(array( @@ -592,7 +598,7 @@ public function testGetsAuthorArrayFromRss094_Dc11() public function testGetsAuthorArrayFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') ); $this->assertEquals(array( @@ -603,7 +609,7 @@ public function testGetsAuthorArrayFromRss093_Dc11() public function testGetsAuthorArrayFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') ); $this->assertEquals(array( @@ -614,7 +620,7 @@ public function testGetsAuthorArrayFromRss092_Dc11() public function testGetsAuthorArrayFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') ); $this->assertEquals(array( @@ -625,7 +631,7 @@ public function testGetsAuthorArrayFromRss091_Dc11() public function testGetsAuthorArrayFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') ); $this->assertEquals(array( @@ -636,7 +642,7 @@ public function testGetsAuthorArrayFromRss10_Dc11() public function testGetsAuthorArrayFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') ); $this->assertEquals(array( @@ -649,7 +655,7 @@ public function testGetsAuthorArrayFromRss090_Dc11() public function testGetsAuthorArrayFromRss20_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss20.xml') ); $this->assertEquals(array( @@ -660,7 +666,7 @@ public function testGetsAuthorArrayFromRss20_Atom10() public function testGetsAuthorArrayFromRss094_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss094.xml') ); $this->assertEquals(array( @@ -671,7 +677,7 @@ public function testGetsAuthorArrayFromRss094_Atom10() public function testGetsAuthorArrayFromRss093_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss093.xml') ); $this->assertEquals(array( @@ -682,7 +688,7 @@ public function testGetsAuthorArrayFromRss093_Atom10() public function testGetsAuthorArrayFromRss092_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss092.xml') ); $this->assertEquals(array( @@ -693,7 +699,7 @@ public function testGetsAuthorArrayFromRss092_Atom10() public function testGetsAuthorArrayFromRss091_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss091.xml') ); $this->assertEquals(array( @@ -704,7 +710,7 @@ public function testGetsAuthorArrayFromRss091_Atom10() public function testGetsAuthorArrayFromRss10_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss10.xml') ); $this->assertEquals(array( @@ -715,7 +721,7 @@ public function testGetsAuthorArrayFromRss10_Atom10() public function testGetsAuthorArrayFromRss090_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss090.xml') ); $this->assertEquals(array( @@ -728,7 +734,7 @@ public function testGetsAuthorArrayFromRss090_Atom10() public function testGetsAuthorArrayFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -736,7 +742,7 @@ public function testGetsAuthorArrayFromRss20_None() public function testGetsAuthorArrayFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -744,7 +750,7 @@ public function testGetsAuthorArrayFromRss094_None() public function testGetsAuthorArrayFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -752,7 +758,7 @@ public function testGetsAuthorArrayFromRss093_None() public function testGetsAuthorArrayFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -760,7 +766,7 @@ public function testGetsAuthorArrayFromRss092_None() public function testGetsAuthorArrayFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -768,7 +774,7 @@ public function testGetsAuthorArrayFromRss091_None() public function testGetsAuthorArrayFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -776,7 +782,7 @@ public function testGetsAuthorArrayFromRss10_None() public function testGetsAuthorArrayFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -787,7 +793,7 @@ public function testGetsAuthorArrayFromRss090_None() */ public function testGetsSingleAuthorFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -795,7 +801,7 @@ public function testGetsSingleAuthorFromRss20() public function testGetsSingleAuthorFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -803,7 +809,7 @@ public function testGetsSingleAuthorFromRss094() public function testGetsSingleAuthorFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -811,7 +817,7 @@ public function testGetsSingleAuthorFromRss093() public function testGetsSingleAuthorFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -819,7 +825,7 @@ public function testGetsSingleAuthorFromRss092() public function testGetsSingleAuthorFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -827,7 +833,7 @@ public function testGetsSingleAuthorFromRss091() public function testGetsSingleAuthorFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -835,7 +841,7 @@ public function testGetsSingleAuthorFromRss10() public function testGetsSingleAuthorFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -845,7 +851,7 @@ public function testGetsSingleAuthorFromRss090() public function testGetsSingleAuthorFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -853,7 +859,7 @@ public function testGetsSingleAuthorFromRss20_Dc10() public function testGetsSingleAuthorFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -861,7 +867,7 @@ public function testGetsSingleAuthorFromRss094_Dc10() public function testGetsSingleAuthorFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -869,7 +875,7 @@ public function testGetsSingleAuthorFromRss093_Dc10() public function testGetsSingleAuthorFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -877,7 +883,7 @@ public function testGetsSingleAuthorFromRss092_Dc10() public function testGetsSingleAuthorFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -885,7 +891,7 @@ public function testGetsSingleAuthorFromRss091_Dc10() public function testGetsSingleAuthorFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -893,7 +899,7 @@ public function testGetsSingleAuthorFromRss10_Dc10() public function testGetsSingleAuthorFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -903,7 +909,7 @@ public function testGetsSingleAuthorFromRss090_Dc10() public function testGetsSingleAuthorFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -911,7 +917,7 @@ public function testGetsSingleAuthorFromRss20_Dc11() public function testGetsSingleAuthorFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -919,7 +925,7 @@ public function testGetsSingleAuthorFromRss094_Dc11() public function testGetsSingleAuthorFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -927,7 +933,7 @@ public function testGetsSingleAuthorFromRss093_Dc11() public function testGetsSingleAuthorFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -935,7 +941,7 @@ public function testGetsSingleAuthorFromRss092_Dc11() public function testGetsSingleAuthorFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -943,7 +949,7 @@ public function testGetsSingleAuthorFromRss091_Dc11() public function testGetsSingleAuthorFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -951,7 +957,7 @@ public function testGetsSingleAuthorFromRss10_Dc11() public function testGetsSingleAuthorFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -961,7 +967,7 @@ public function testGetsSingleAuthorFromRss090_Dc11() public function testGetsSingleAuthorFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -969,7 +975,7 @@ public function testGetsSingleAuthorFromRss20_None() public function testGetsSingleAuthorFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -977,7 +983,7 @@ public function testGetsSingleAuthorFromRss094_None() public function testGetsSingleAuthorFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -985,7 +991,7 @@ public function testGetsSingleAuthorFromRss093_None() public function testGetsSingleAuthorFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -993,7 +999,7 @@ public function testGetsSingleAuthorFromRss092_None() public function testGetsSingleAuthorFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -1001,7 +1007,7 @@ public function testGetsSingleAuthorFromRss091_None() public function testGetsSingleAuthorFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -1009,7 +1015,7 @@ public function testGetsSingleAuthorFromRss10_None() public function testGetsSingleAuthorFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -1020,7 +1026,7 @@ public function testGetsSingleAuthorFromRss090_None() */ public function testGetsCopyrightFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss20.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1028,7 +1034,7 @@ public function testGetsCopyrightFromRss20() public function testGetsCopyrightFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss094.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1036,7 +1042,7 @@ public function testGetsCopyrightFromRss094() public function testGetsCopyrightFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss093.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1044,7 +1050,7 @@ public function testGetsCopyrightFromRss093() public function testGetsCopyrightFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss092.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1052,7 +1058,7 @@ public function testGetsCopyrightFromRss092() public function testGetsCopyrightFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss091.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1060,7 +1066,7 @@ public function testGetsCopyrightFromRss091() public function testGetsCopyrightFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss10.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1068,7 +1074,7 @@ public function testGetsCopyrightFromRss10() public function testGetsCopyrightFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss090.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1078,7 +1084,7 @@ public function testGetsCopyrightFromRss090() public function testGetsCopyrightFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss20.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1086,7 +1092,7 @@ public function testGetsCopyrightFromRss20_Dc10() public function testGetsCopyrightFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss094.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1094,7 +1100,7 @@ public function testGetsCopyrightFromRss094_Dc10() public function testGetsCopyrightFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss093.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1102,7 +1108,7 @@ public function testGetsCopyrightFromRss093_Dc10() public function testGetsCopyrightFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss092.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1110,7 +1116,7 @@ public function testGetsCopyrightFromRss092_Dc10() public function testGetsCopyrightFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss091.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1118,7 +1124,7 @@ public function testGetsCopyrightFromRss091_Dc10() public function testGetsCopyrightFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss10.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1126,7 +1132,7 @@ public function testGetsCopyrightFromRss10_Dc10() public function testGetsCopyrightFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss090.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1136,7 +1142,7 @@ public function testGetsCopyrightFromRss090_Dc10() public function testGetsCopyrightFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss20.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1144,7 +1150,7 @@ public function testGetsCopyrightFromRss20_Dc11() public function testGetsCopyrightFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss094.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1152,7 +1158,7 @@ public function testGetsCopyrightFromRss094_Dc11() public function testGetsCopyrightFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss093.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1160,7 +1166,7 @@ public function testGetsCopyrightFromRss093_Dc11() public function testGetsCopyrightFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss092.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1168,7 +1174,7 @@ public function testGetsCopyrightFromRss092_Dc11() public function testGetsCopyrightFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss091.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1176,7 +1182,7 @@ public function testGetsCopyrightFromRss091_Dc11() public function testGetsCopyrightFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss10.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1184,7 +1190,7 @@ public function testGetsCopyrightFromRss10_Dc11() public function testGetsCopyrightFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss090.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1194,7 +1200,7 @@ public function testGetsCopyrightFromRss090_Dc11() public function testGetsCopyrightFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1202,7 +1208,7 @@ public function testGetsCopyrightFromRss20_None() public function testGetsCopyrightFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1210,7 +1216,7 @@ public function testGetsCopyrightFromRss094_None() public function testGetsCopyrightFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1218,7 +1224,7 @@ public function testGetsCopyrightFromRss093_None() public function testGetsCopyrightFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1226,7 +1232,7 @@ public function testGetsCopyrightFromRss092_None() public function testGetsCopyrightFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1234,7 +1240,7 @@ public function testGetsCopyrightFromRss091_None() public function testGetsCopyrightFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1242,7 +1248,7 @@ public function testGetsCopyrightFromRss10_None() public function testGetsCopyrightFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1253,7 +1259,7 @@ public function testGetsCopyrightFromRss090_None() */ public function testGetsDescriptionFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss20.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1261,7 +1267,7 @@ public function testGetsDescriptionFromRss20() public function testGetsDescriptionFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss094.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1269,7 +1275,7 @@ public function testGetsDescriptionFromRss094() public function testGetsDescriptionFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss093.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1277,7 +1283,7 @@ public function testGetsDescriptionFromRss093() public function testGetsDescriptionFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss092.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1285,7 +1291,7 @@ public function testGetsDescriptionFromRss092() public function testGetsDescriptionFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss091.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1293,7 +1299,7 @@ public function testGetsDescriptionFromRss091() public function testGetsDescriptionFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss10.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1301,7 +1307,7 @@ public function testGetsDescriptionFromRss10() public function testGetsDescriptionFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss090.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1311,7 +1317,7 @@ public function testGetsDescriptionFromRss090() public function testGetsDescriptionFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss20.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1319,7 +1325,7 @@ public function testGetsDescriptionFromRss20_Dc10() public function testGetsDescriptionFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss094.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1327,7 +1333,7 @@ public function testGetsDescriptionFromRss094_Dc10() public function testGetsDescriptionFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss093.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1335,7 +1341,7 @@ public function testGetsDescriptionFromRss093_Dc10() public function testGetsDescriptionFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss092.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1343,7 +1349,7 @@ public function testGetsDescriptionFromRss092_Dc10() public function testGetsDescriptionFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss091.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1351,7 +1357,7 @@ public function testGetsDescriptionFromRss091_Dc10() public function testGetsDescriptionFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss10.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1359,7 +1365,7 @@ public function testGetsDescriptionFromRss10_Dc10() public function testGetsDescriptionFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss090.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1369,7 +1375,7 @@ public function testGetsDescriptionFromRss090_Dc10() public function testGetsDescriptionFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss20.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1377,7 +1383,7 @@ public function testGetsDescriptionFromRss20_Dc11() public function testGetsDescriptionFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss094.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1385,7 +1391,7 @@ public function testGetsDescriptionFromRss094_Dc11() public function testGetsDescriptionFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss093.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1393,7 +1399,7 @@ public function testGetsDescriptionFromRss093_Dc11() public function testGetsDescriptionFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss092.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1401,7 +1407,7 @@ public function testGetsDescriptionFromRss092_Dc11() public function testGetsDescriptionFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss091.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1409,7 +1415,7 @@ public function testGetsDescriptionFromRss091_Dc11() public function testGetsDescriptionFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss10.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1417,7 +1423,7 @@ public function testGetsDescriptionFromRss10_Dc11() public function testGetsDescriptionFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss090.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1427,7 +1433,7 @@ public function testGetsDescriptionFromRss090_Dc11() public function testGetsDescriptionFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1435,7 +1441,7 @@ public function testGetsDescriptionFromRss20_None() public function testGetsDescriptionFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1443,7 +1449,7 @@ public function testGetsDescriptionFromRss094_None() public function testGetsDescriptionFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1451,7 +1457,7 @@ public function testGetsDescriptionFromRss093_None() public function testGetsDescriptionFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1459,7 +1465,7 @@ public function testGetsDescriptionFromRss092_None() public function testGetsDescriptionFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1467,7 +1473,7 @@ public function testGetsDescriptionFromRss091_None() public function testGetsDescriptionFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1475,7 +1481,7 @@ public function testGetsDescriptionFromRss10_None() public function testGetsDescriptionFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1486,7 +1492,7 @@ public function testGetsDescriptionFromRss090_None() */ public function testGetsLanguageFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss20.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1494,7 +1500,7 @@ public function testGetsLanguageFromRss20() public function testGetsLanguageFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss094.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1502,7 +1508,7 @@ public function testGetsLanguageFromRss094() public function testGetsLanguageFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss093.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1510,7 +1516,7 @@ public function testGetsLanguageFromRss093() public function testGetsLanguageFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss092.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1518,7 +1524,7 @@ public function testGetsLanguageFromRss092() public function testGetsLanguageFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss091.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1526,7 +1532,7 @@ public function testGetsLanguageFromRss091() public function testGetsLanguageFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss10.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1534,7 +1540,7 @@ public function testGetsLanguageFromRss10() public function testGetsLanguageFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss090.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1544,7 +1550,7 @@ public function testGetsLanguageFromRss090() public function testGetsLanguageFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss20.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1552,7 +1558,7 @@ public function testGetsLanguageFromRss20_Dc10() public function testGetsLanguageFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss094.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1560,7 +1566,7 @@ public function testGetsLanguageFromRss094_Dc10() public function testGetsLanguageFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss093.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1568,7 +1574,7 @@ public function testGetsLanguageFromRss093_Dc10() public function testGetsLanguageFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss092.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1576,7 +1582,7 @@ public function testGetsLanguageFromRss092_Dc10() public function testGetsLanguageFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss091.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1584,7 +1590,7 @@ public function testGetsLanguageFromRss091_Dc10() public function testGetsLanguageFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss10.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1592,7 +1598,7 @@ public function testGetsLanguageFromRss10_Dc10() public function testGetsLanguageFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss090.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1602,7 +1608,7 @@ public function testGetsLanguageFromRss090_Dc10() public function testGetsLanguageFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss20.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1610,7 +1616,7 @@ public function testGetsLanguageFromRss20_Dc11() public function testGetsLanguageFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss094.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1618,7 +1624,7 @@ public function testGetsLanguageFromRss094_Dc11() public function testGetsLanguageFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss093.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1626,7 +1632,7 @@ public function testGetsLanguageFromRss093_Dc11() public function testGetsLanguageFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss092.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1634,7 +1640,7 @@ public function testGetsLanguageFromRss092_Dc11() public function testGetsLanguageFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss091.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1642,7 +1648,7 @@ public function testGetsLanguageFromRss091_Dc11() public function testGetsLanguageFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss10.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1650,7 +1656,7 @@ public function testGetsLanguageFromRss10_Dc11() public function testGetsLanguageFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss090.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1660,7 +1666,7 @@ public function testGetsLanguageFromRss090_Dc11() public function testGetsLanguageFromRss10_XmlLang() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rdf/rss10.xml') ); $this->assertEquals('en', $feed->getLanguage()); @@ -1670,7 +1676,7 @@ public function testGetsLanguageFromRss10_XmlLang() public function testGetsLanguageFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1678,7 +1684,7 @@ public function testGetsLanguageFromRss20_None() public function testGetsLanguageFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1686,7 +1692,7 @@ public function testGetsLanguageFromRss094_None() public function testGetsLanguageFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1694,7 +1700,7 @@ public function testGetsLanguageFromRss093_None() public function testGetsLanguageFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1702,7 +1708,7 @@ public function testGetsLanguageFromRss092_None() public function testGetsLanguageFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1710,7 +1716,7 @@ public function testGetsLanguageFromRss091_None() public function testGetsLanguageFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1718,7 +1724,7 @@ public function testGetsLanguageFromRss10_None() public function testGetsLanguageFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1729,7 +1735,7 @@ public function testGetsLanguageFromRss090_None() */ public function testGetsLinkFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss20.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1737,7 +1743,7 @@ public function testGetsLinkFromRss20() public function testGetsLinkFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss094.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1745,7 +1751,7 @@ public function testGetsLinkFromRss094() public function testGetsLinkFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss093.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1753,7 +1759,7 @@ public function testGetsLinkFromRss093() public function testGetsLinkFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss092.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1761,7 +1767,7 @@ public function testGetsLinkFromRss092() public function testGetsLinkFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss091.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1769,7 +1775,7 @@ public function testGetsLinkFromRss091() public function testGetsLinkFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss10.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1777,7 +1783,7 @@ public function testGetsLinkFromRss10() public function testGetsLinkFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss090.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1787,7 +1793,7 @@ public function testGetsLinkFromRss090() public function testGetsLinkFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1795,7 +1801,7 @@ public function testGetsLinkFromRss20_None() public function testGetsLinkFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1803,7 +1809,7 @@ public function testGetsLinkFromRss094_None() public function testGetsLinkFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1811,7 +1817,7 @@ public function testGetsLinkFromRss093_None() public function testGetsLinkFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1819,7 +1825,7 @@ public function testGetsLinkFromRss092_None() public function testGetsLinkFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1827,7 +1833,7 @@ public function testGetsLinkFromRss091_None() public function testGetsLinkFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1835,7 +1841,7 @@ public function testGetsLinkFromRss10_None() public function testGetsLinkFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1847,7 +1853,7 @@ public function testGetsLinkFromRss090_None() public function testCountableInterface() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss090.xml') ); $this->assertEquals(0, count($feed)); @@ -1858,7 +1864,7 @@ public function testCountableInterface() */ public function testGetsFeedLinkFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss20.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1866,7 +1872,7 @@ public function testGetsFeedLinkFromRss20() public function testGetsFeedLinkFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss094.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1874,7 +1880,7 @@ public function testGetsFeedLinkFromRss094() public function testGetsFeedLinkFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss093.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1882,7 +1888,7 @@ public function testGetsFeedLinkFromRss093() public function testGetsFeedLinkFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss092.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1890,7 +1896,7 @@ public function testGetsFeedLinkFromRss092() public function testGetsFeedLinkFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss091.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1898,7 +1904,7 @@ public function testGetsFeedLinkFromRss091() public function testGetsFeedLinkFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss10.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1906,7 +1912,7 @@ public function testGetsFeedLinkFromRss10() public function testGetsFeedLinkFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss090.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1916,7 +1922,7 @@ public function testGetsFeedLinkFromRss090() public function testGetsFeedLinkFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1924,7 +1930,7 @@ public function testGetsFeedLinkFromRss20_None() public function testGetsFeedLinkFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1932,7 +1938,7 @@ public function testGetsFeedLinkFromRss094_None() public function testGetsFeedLinkFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1940,7 +1946,7 @@ public function testGetsFeedLinkFromRss093_None() public function testGetsFeedLinkFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1948,7 +1954,7 @@ public function testGetsFeedLinkFromRss092_None() public function testGetsFeedLinkFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1956,7 +1962,7 @@ public function testGetsFeedLinkFromRss091_None() public function testGetsFeedLinkFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1964,7 +1970,7 @@ public function testGetsFeedLinkFromRss10_None() public function testGetsFeedLinkFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1975,7 +1981,7 @@ public function testGetsFeedLinkFromRss090_None() */ public function testGetsGeneratorFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss20.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -1983,7 +1989,7 @@ public function testGetsGeneratorFromRss20() public function testGetsGeneratorFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss094.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -1991,7 +1997,7 @@ public function testGetsGeneratorFromRss094() public function testGetsGeneratorFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss093.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -1999,7 +2005,7 @@ public function testGetsGeneratorFromRss093() public function testGetsGeneratorFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss092.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -2007,7 +2013,7 @@ public function testGetsGeneratorFromRss092() public function testGetsGeneratorFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss091.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -2015,7 +2021,7 @@ public function testGetsGeneratorFromRss091() public function testGetsGeneratorFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss10.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -2023,7 +2029,7 @@ public function testGetsGeneratorFromRss10() public function testGetsGeneratorFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss090.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -2033,7 +2039,7 @@ public function testGetsGeneratorFromRss090() public function testGetsGeneratorFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2041,7 +2047,7 @@ public function testGetsGeneratorFromRss20_None() public function testGetsGeneratorFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2049,7 +2055,7 @@ public function testGetsGeneratorFromRss094_None() public function testGetsGeneratorFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2057,7 +2063,7 @@ public function testGetsGeneratorFromRss093_None() public function testGetsGeneratorFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2065,7 +2071,7 @@ public function testGetsGeneratorFromRss092_None() public function testGetsGeneratorFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2073,7 +2079,7 @@ public function testGetsGeneratorFromRss091_None() public function testGetsGeneratorFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2081,7 +2087,7 @@ public function testGetsGeneratorFromRss10_None() public function testGetsGeneratorFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2092,11 +2098,11 @@ public function testGetsGeneratorFromRss090_None() */ public function testGetsDateModifiedFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } @@ -2104,71 +2110,71 @@ public function testGetsDateModifiedFromRss20() public function testGetsDateModifiedFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss20.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss094.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss093.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss092.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss091.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss10.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss090.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } @@ -2176,71 +2182,71 @@ public function testGetsDateModifiedFromRss090_Dc10() public function testGetsDateModifiedFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss20.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss094.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss093.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss092.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss091.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss10.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss090.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } @@ -2248,71 +2254,71 @@ public function testGetsDateModifiedFromRss090_Dc11() public function testGetsDateModifiedFromRss20_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss20.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss094_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss094.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss093_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss093.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss092_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss092.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss091_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss091.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss10_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss10.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss090_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss090.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } @@ -2320,7 +2326,7 @@ public function testGetsDateModifiedFromRss090_atom10() public function testGetsDateModifiedFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2328,7 +2334,7 @@ public function testGetsDateModifiedFromRss20_None() public function testGetsDateModifiedFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2336,7 +2342,7 @@ public function testGetsDateModifiedFromRss094_None() public function testGetsDateModifiedFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2344,7 +2350,7 @@ public function testGetsDateModifiedFromRss093_None() public function testGetsDateModifiedFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2352,7 +2358,7 @@ public function testGetsDateModifiedFromRss092_None() public function testGetsDateModifiedFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2360,7 +2366,7 @@ public function testGetsDateModifiedFromRss091_None() public function testGetsDateModifiedFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2368,7 +2374,7 @@ public function testGetsDateModifiedFromRss10_None() public function testGetsDateModifiedFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2379,7 +2385,7 @@ public function testGetsDateModifiedFromRss090_None() */ public function testGetsHubsFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss20.xml') ); $this->assertEquals(array( @@ -2390,7 +2396,7 @@ public function testGetsHubsFromRss20() public function testGetsHubsFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss094.xml') ); $this->assertEquals(array( @@ -2401,7 +2407,7 @@ public function testGetsHubsFromRss094() public function testGetsHubsFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss093.xml') ); $this->assertEquals(array( @@ -2412,7 +2418,7 @@ public function testGetsHubsFromRss093() public function testGetsHubsFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss092.xml') ); $this->assertEquals(array( @@ -2423,7 +2429,7 @@ public function testGetsHubsFromRss092() public function testGetsHubsFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss091.xml') ); $this->assertEquals(array( @@ -2434,7 +2440,7 @@ public function testGetsHubsFromRss091() public function testGetsHubsFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss10.xml') ); $this->assertEquals(array( @@ -2445,7 +2451,7 @@ public function testGetsHubsFromRss10() public function testGetsHubsFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss090.xml') ); $this->assertEquals(array( @@ -2458,7 +2464,7 @@ public function testGetsHubsFromRss090() public function testGetsHubsFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2466,7 +2472,7 @@ public function testGetsHubsFromRss20_None() public function testGetsHubsFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2474,7 +2480,7 @@ public function testGetsHubsFromRss094_None() public function testGetsHubsFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2482,7 +2488,7 @@ public function testGetsHubsFromRss093_None() public function testGetsHubsFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2490,7 +2496,7 @@ public function testGetsHubsFromRss092_None() public function testGetsHubsFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2498,7 +2504,7 @@ public function testGetsHubsFromRss091_None() public function testGetsHubsFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2506,7 +2512,7 @@ public function testGetsHubsFromRss10_None() public function testGetsHubsFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2520,7 +2526,7 @@ public function testGetsHubsFromRss090_None() public function testGetsCategoriesFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/rss20.xml') ); $this->assertEquals($this->_expectedCats, (array) $feed->getCategories()); @@ -2531,7 +2537,7 @@ public function testGetsCategoriesFromRss20() public function testGetsCategoriesFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss090.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2540,7 +2546,7 @@ public function testGetsCategoriesFromRss090_Dc10() public function testGetsCategoriesFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss091.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2549,7 +2555,7 @@ public function testGetsCategoriesFromRss091_Dc10() public function testGetsCategoriesFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss092.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2558,7 +2564,7 @@ public function testGetsCategoriesFromRss092_Dc10() public function testGetsCategoriesFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss093.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2567,7 +2573,7 @@ public function testGetsCategoriesFromRss093_Dc10() public function testGetsCategoriesFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss094.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2576,7 +2582,7 @@ public function testGetsCategoriesFromRss094_Dc10() public function testGetsCategoriesFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss10.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2587,7 +2593,7 @@ public function testGetsCategoriesFromRss10_Dc10() public function testGetsCategoriesFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss090.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2596,7 +2602,7 @@ public function testGetsCategoriesFromRss090_Dc11() public function testGetsCategoriesFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss091.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2605,7 +2611,7 @@ public function testGetsCategoriesFromRss091_Dc11() public function testGetsCategoriesFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss092.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2614,7 +2620,7 @@ public function testGetsCategoriesFromRss092_Dc11() public function testGetsCategoriesFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss093.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2623,7 +2629,7 @@ public function testGetsCategoriesFromRss093_Dc11() public function testGetsCategoriesFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss094.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2632,7 +2638,7 @@ public function testGetsCategoriesFromRss094_Dc11() public function testGetsCategoriesFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss10.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2643,7 +2649,7 @@ public function testGetsCategoriesFromRss10_Dc11() public function testGetsCategoriesFromRss090_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss090.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2652,7 +2658,7 @@ public function testGetsCategoriesFromRss090_Atom10() public function testGetsCategoriesFromRss091_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss091.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2661,7 +2667,7 @@ public function testGetsCategoriesFromRss091_Atom10() public function testGetsCategoriesFromRss092_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss092.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2670,7 +2676,7 @@ public function testGetsCategoriesFromRss092_Atom10() public function testGetsCategoriesFromRss093_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss093.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2679,7 +2685,7 @@ public function testGetsCategoriesFromRss093_Atom10() public function testGetsCategoriesFromRss094_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss094.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2688,7 +2694,7 @@ public function testGetsCategoriesFromRss094_Atom10() public function testGetsCategoriesFromRss10_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss10.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2699,7 +2705,7 @@ public function testGetsCategoriesFromRss10_Atom10() public function testGetsCategoriesFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss20.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2708,7 +2714,7 @@ public function testGetsCategoriesFromRss20_None() public function testGetsCategoriesFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss090.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2717,7 +2723,7 @@ public function testGetsCategoriesFromRss090_None() public function testGetsCategoriesFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss091.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2726,7 +2732,7 @@ public function testGetsCategoriesFromRss091_None() public function testGetsCategoriesFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss092.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2735,7 +2741,7 @@ public function testGetsCategoriesFromRss092_None() public function testGetsCategoriesFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss093.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2744,7 +2750,7 @@ public function testGetsCategoriesFromRss093_None() public function testGetsCategoriesFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss094.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2753,7 +2759,7 @@ public function testGetsCategoriesFromRss094_None() public function testGetsCategoriesFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss10.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); diff --git a/test/Reader/Integration/H-OnlineComAtom10Test.php b/test/Reader/Integration/H-OnlineComAtom10Test.php index 9406468d..9c2ae8fd 100644 --- a/test/Reader/Integration/H-OnlineComAtom10Test.php +++ b/test/Reader/Integration/H-OnlineComAtom10Test.php @@ -20,6 +20,12 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed\Reader\Integration; +use Zend\Feed\Reader; +use Zend\Date; /** * @category Zend @@ -30,32 +36,32 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class Zend_Feed_Reader_Integration_HOnlineComAtom10Test extends PHPUnit_Framework_TestCase +class HOnlineComAtom10Test extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Zend_Feed_Reader::reset(); + Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/h-online.com-atom10.xml'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); } public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } public function testGetsTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('The H - news feed', $feed->getTitle()); @@ -63,7 +69,7 @@ public function testGetsTitle() public function testGetsAuthors() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array(array('name'=>'The H')), (array) $feed->getAuthors()); @@ -71,7 +77,7 @@ public function testGetsAuthors() public function testGetsSingleAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array('name'=>'The H'), $feed->getAuthor()); @@ -79,7 +85,7 @@ public function testGetsSingleAuthor() public function testGetsCopyright() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(null, $feed->getCopyright()); @@ -87,7 +93,7 @@ public function testGetsCopyright() public function testGetsDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Technology news', $feed->getDescription()); @@ -95,7 +101,7 @@ public function testGetsDescription() public function testGetsLanguage() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(null, $feed->getLanguage()); @@ -103,7 +109,7 @@ public function testGetsLanguage() public function testGetsLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://www.h-online.com', $feed->getLink()); @@ -111,7 +117,7 @@ public function testGetsLink() public function testGetsEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('UTF-8', $feed->getEncoding()); @@ -119,7 +125,7 @@ public function testGetsEncoding() public function testGetsEntryCount() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(60, $feed->count()); @@ -131,7 +137,7 @@ public function testGetsEntryCount() public function testGetsEntryId() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -140,7 +146,7 @@ public function testGetsEntryId() public function testGetsEntryTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -149,7 +155,7 @@ public function testGetsEntryTitle() public function testGetsEntryAuthors() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -158,7 +164,7 @@ public function testGetsEntryAuthors() public function testGetsEntrySingleAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -167,7 +173,7 @@ public function testGetsEntrySingleAuthor() public function testGetsEntryDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -179,7 +185,7 @@ public function testGetsEntryDescription() public function testGetsEntryContent() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -188,7 +194,7 @@ public function testGetsEntryContent() public function testGetsEntryLinks() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -197,7 +203,7 @@ public function testGetsEntryLinks() public function testGetsEntryLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -206,7 +212,7 @@ public function testGetsEntryLink() public function testGetsEntryPermaLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -216,7 +222,7 @@ public function testGetsEntryPermaLink() public function testGetsEntryEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); diff --git a/test/Reader/Integration/LautDeRdfTest.php b/test/Reader/Integration/LautDeRdfTest.php index 9cdd1b6f..b73bd327 100644 --- a/test/Reader/Integration/LautDeRdfTest.php +++ b/test/Reader/Integration/LautDeRdfTest.php @@ -20,6 +20,12 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed\Reader\Integration; +use Zend\Feed\Reader; +use Zend\Date; /** * @category Zend @@ -30,27 +36,27 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class Zend_Feed_Reader_Integration_LautDeRdfTest extends PHPUnit_Framework_TestCase +class LautDeRdfTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Zend_Feed_Reader::reset(); + Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/laut.de-rdf.xml'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); } public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } /** @@ -59,7 +65,7 @@ public function teardown() public function testGetsTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('laut.de - news', $feed->getTitle()); @@ -67,7 +73,7 @@ public function testGetsTitle() public function testGetsAuthors() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array(array('name'=>'laut.de')), (array) $feed->getAuthors()); @@ -75,7 +81,7 @@ public function testGetsAuthors() public function testGetsSingleAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array('name'=>'laut.de'), $feed->getAuthor()); @@ -83,7 +89,7 @@ public function testGetsSingleAuthor() public function testGetsCopyright() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Copyright © 2004 laut.de', $feed->getCopyright()); @@ -91,7 +97,7 @@ public function testGetsCopyright() public function testGetsDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('laut.de: aktuelle News', $feed->getDescription()); @@ -99,7 +105,7 @@ public function testGetsDescription() public function testGetsLanguage() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(null, $feed->getLanguage()); @@ -107,7 +113,7 @@ public function testGetsLanguage() public function testGetsLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://www.laut.de', $feed->getLink()); @@ -115,7 +121,7 @@ public function testGetsLink() public function testGetsEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('ISO-8859-1', $feed->getEncoding()); @@ -129,7 +135,7 @@ public function testGetsEncoding() public function testGetsEntryId() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -138,7 +144,7 @@ public function testGetsEntryId() public function testGetsEntryTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -147,7 +153,7 @@ public function testGetsEntryTitle() public function testGetsEntryAuthors() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -156,7 +162,7 @@ public function testGetsEntryAuthors() public function testGetsEntrySingleAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -170,7 +176,7 @@ public function testGetsEntrySingleAuthor() public function testGetsEntryDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -179,7 +185,7 @@ public function testGetsEntryDescription() public function testGetsEntryContent() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -188,7 +194,7 @@ public function testGetsEntryContent() public function testGetsEntryLinks() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -197,7 +203,7 @@ public function testGetsEntryLinks() public function testGetsEntryLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -206,7 +212,7 @@ public function testGetsEntryLink() public function testGetsEntryPermaLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -216,7 +222,7 @@ public function testGetsEntryPermaLink() public function testGetsEntryEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); diff --git a/test/Reader/Integration/PodcastRss2Test.php b/test/Reader/Integration/PodcastRss2Test.php index 45a9d2d2..29c3fa22 100644 --- a/test/Reader/Integration/PodcastRss2Test.php +++ b/test/Reader/Integration/PodcastRss2Test.php @@ -20,6 +20,12 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed\Reader\Integration; +use Zend\Feed\Reader; +use Zend\Date; /** * @category Zend @@ -30,27 +36,27 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class Zend_Feed_Reader_Integration_PodcastRss2Test extends PHPUnit_Framework_TestCase +class PodcastRss2Test extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Zend_Feed_Reader::reset(); + Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/podcast.xml'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); } public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } /** @@ -59,7 +65,7 @@ public function teardown() public function testGetsNewFeedUrl() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://newlocation.com/example.rss', $feed->getNewFeedUrl()); @@ -67,7 +73,7 @@ public function testGetsNewFeedUrl() public function testGetsOwner() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('john.doe@example.com (John Doe)', $feed->getOwner()); @@ -75,7 +81,7 @@ public function testGetsOwner() public function testGetsCategories() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array( @@ -88,7 +94,7 @@ public function testGetsCategories() public function testGetsTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('All About Everything', $feed->getTitle()); @@ -96,7 +102,7 @@ public function testGetsTitle() public function testGetsCastAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('John Doe', $feed->getCastAuthor()); @@ -104,7 +110,7 @@ public function testGetsCastAuthor() public function testGetsFeedBlock() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('no', $feed->getBlock()); @@ -112,7 +118,7 @@ public function testGetsFeedBlock() public function testGetsCopyright() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('℗ & © 2005 John Doe & Family', $feed->getCopyright()); @@ -120,7 +126,7 @@ public function testGetsCopyright() public function testGetsDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('All About Everything is a show about everything. @@ -131,7 +137,7 @@ public function testGetsDescription() public function testGetsLanguage() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('en-us', $feed->getLanguage()); @@ -139,7 +145,7 @@ public function testGetsLanguage() public function testGetsLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://www.example.com/podcasts/everything/index.html', $feed->getLink()); @@ -147,7 +153,7 @@ public function testGetsLink() public function testGetsEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('UTF-8', $feed->getEncoding()); @@ -155,7 +161,7 @@ public function testGetsEncoding() public function testGetsFeedExplicit() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('yes', $feed->getExplicit()); @@ -163,7 +169,7 @@ public function testGetsFeedExplicit() public function testGetsEntryCount() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(3, $feed->count()); @@ -171,7 +177,7 @@ public function testGetsEntryCount() public function testGetsImage() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://example.com/podcasts/everything/AllAboutEverything.jpg', $feed->getImage()); @@ -183,7 +189,7 @@ public function testGetsImage() public function testGetsEntryBlock() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -192,7 +198,7 @@ public function testGetsEntryBlock() public function testGetsEntryId() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -201,7 +207,7 @@ public function testGetsEntryId() public function testGetsEntryTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -210,7 +216,7 @@ public function testGetsEntryTitle() public function testGetsEntryCastAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -219,7 +225,7 @@ public function testGetsEntryCastAuthor() public function testGetsEntryExplicit() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -228,7 +234,7 @@ public function testGetsEntryExplicit() public function testGetsSubtitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -238,7 +244,7 @@ public function testGetsSubtitle() public function testGetsSummary() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -250,7 +256,7 @@ public function testGetsSummary() public function testGetsDuration() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -259,7 +265,7 @@ public function testGetsDuration() public function testGetsKeywords() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -269,7 +275,7 @@ public function testGetsKeywords() public function testGetsEntryEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -278,12 +284,12 @@ public function testGetsEntryEncoding() public function testGetsEnclosure() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); - $expected = new stdClass(); + $expected = new \stdClass(); $expected->url = 'http://example.com/podcasts/everything/AllAboutEverythingEpisode3.m4a'; $expected->length = '8727310'; $expected->type = 'audio/x-m4a'; diff --git a/test/Reader/Integration/WordpressAtom10Test.php b/test/Reader/Integration/WordpressAtom10Test.php index 0fb59a85..66c22918 100644 --- a/test/Reader/Integration/WordpressAtom10Test.php +++ b/test/Reader/Integration/WordpressAtom10Test.php @@ -20,6 +20,12 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed\Reader\Integration; +use Zend\Feed\Reader; +use Zend\Date; /** * @category Zend @@ -30,32 +36,32 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class Zend_Feed_Reader_Integration_WordpressAtom10Test extends PHPUnit_Framework_TestCase +class WordpressAtom10Test extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Zend_Feed_Reader::reset(); + Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/wordpress-atom10.xml'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); } public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } public function testGetsTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Norm 2782', $feed->getTitle()); @@ -63,7 +69,7 @@ public function testGetsTitle() public function testGetsAuthors() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array( @@ -73,7 +79,7 @@ public function testGetsAuthors() public function testGetsSingleAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array('name'=>'norm2782','uri'=>'http://www.norm2782.com'), $feed->getAuthor()); @@ -81,7 +87,7 @@ public function testGetsSingleAuthor() public function testGetsCopyright() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(null, $feed->getCopyright()); @@ -89,7 +95,7 @@ public function testGetsCopyright() public function testGetsDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Why are you here?', $feed->getDescription()); @@ -97,7 +103,7 @@ public function testGetsDescription() public function testGetsLanguage() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('en', $feed->getLanguage()); @@ -105,7 +111,7 @@ public function testGetsLanguage() public function testGetsLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://www.norm2782.com', $feed->getLink()); @@ -113,7 +119,7 @@ public function testGetsLink() public function testGetsEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('UTF-8', $feed->getEncoding()); @@ -121,7 +127,7 @@ public function testGetsEncoding() public function testGetsEntryCount() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(10, $feed->count()); @@ -133,7 +139,7 @@ public function testGetsEntryCount() public function testGetsEntryId() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -142,7 +148,7 @@ public function testGetsEntryId() public function testGetsEntryTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -155,7 +161,7 @@ public function testGetsEntryTitle() public function testGetsEntryAuthors() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -164,7 +170,7 @@ public function testGetsEntryAuthors() public function testGetsEntrySingleAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -173,7 +179,7 @@ public function testGetsEntrySingleAuthor() public function testGetsEntryDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -185,7 +191,7 @@ public function testGetsEntryDescription() public function testGetsEntryContent() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -194,7 +200,7 @@ public function testGetsEntryContent() public function testGetsEntryLinks() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -203,7 +209,7 @@ public function testGetsEntryLinks() public function testGetsEntryLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -212,7 +218,7 @@ public function testGetsEntryLink() public function testGetsEntryPermaLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -222,7 +228,7 @@ public function testGetsEntryPermaLink() public function testGetsEntryEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); diff --git a/test/Reader/Integration/WordpressRss2DcAtomTest.php b/test/Reader/Integration/WordpressRss2DcAtomTest.php index 20215df8..388d33d5 100644 --- a/test/Reader/Integration/WordpressRss2DcAtomTest.php +++ b/test/Reader/Integration/WordpressRss2DcAtomTest.php @@ -20,6 +20,11 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed\Reader\Integration; +use Zend\Feed\Reader; /** * @category Zend @@ -30,14 +35,14 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class Zend_Feed_Reader_Integration_WordpressRss2DcAtomTest extends PHPUnit_Framework_TestCase +class WordpressRss2DcAtomTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Zend_Feed_Reader::reset(); + Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/wordpress-rss2-dc-atom.xml'; } @@ -47,7 +52,7 @@ public function setup() public function testGetsTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Norm 2782', $feed->getTitle()); @@ -55,7 +60,7 @@ public function testGetsTitle() public function testGetsAuthors() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array( @@ -65,7 +70,7 @@ public function testGetsAuthors() public function testGetsSingleAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array('name'=>'norm2782'), $feed->getAuthor()); @@ -73,7 +78,7 @@ public function testGetsSingleAuthor() public function testGetsCopyright() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(null, $feed->getCopyright()); @@ -81,7 +86,7 @@ public function testGetsCopyright() public function testGetsDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Why are you here?', $feed->getDescription()); @@ -89,7 +94,7 @@ public function testGetsDescription() public function testGetsLanguage() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('en', $feed->getLanguage()); @@ -97,7 +102,7 @@ public function testGetsLanguage() public function testGetsLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://www.norm2782.com', $feed->getLink()); @@ -105,7 +110,7 @@ public function testGetsLink() public function testGetsEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('UTF-8', $feed->getEncoding()); @@ -113,7 +118,7 @@ public function testGetsEncoding() public function testGetsEntryCount() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(10, $feed->count()); @@ -125,7 +130,7 @@ public function testGetsEntryCount() public function testGetsEntryId() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -134,7 +139,7 @@ public function testGetsEntryId() public function testGetsEntryTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -147,7 +152,7 @@ public function testGetsEntryTitle() public function testGetsEntryAuthors() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -156,7 +161,7 @@ public function testGetsEntryAuthors() public function testGetsEntrySingleAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -165,7 +170,7 @@ public function testGetsEntrySingleAuthor() public function testGetsEntryDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -177,7 +182,7 @@ public function testGetsEntryDescription() public function testGetsEntryContent() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -186,7 +191,7 @@ public function testGetsEntryContent() public function testGetsEntryLinks() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -195,7 +200,7 @@ public function testGetsEntryLinks() public function testGetsEntryLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -204,7 +209,7 @@ public function testGetsEntryLink() public function testGetsEntryPermaLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -214,7 +219,7 @@ public function testGetsEntryPermaLink() public function testGetsEntryEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); diff --git a/test/Reader/_files/My/Extension/JungleBooks/Entry.php b/test/Reader/_files/My/Extension/JungleBooks/Entry.php index 2da44b4f..f9c22d6a 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Entry.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Entry.php @@ -20,7 +20,10 @@ * @version $Id$ */ - +/** + * @namespace + */ +namespace My\Extension\JungleBooks; /** * @category Zend @@ -29,7 +32,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class My_FeedReader_Extension_JungleBooks_Entry extends Zend_Feed_Reader_Extension_EntryAbstract +class Entry extends \Zend\Feed\Reader\Extension\EntryAbstract { public function getIsbn() diff --git a/test/Reader/_files/My/Extension/JungleBooks/Feed.php b/test/Reader/_files/My/Extension/JungleBooks/Feed.php index 97343615..960f42b0 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Feed.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Feed.php @@ -20,6 +20,10 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace My\Extension\JungleBooks; /** * @category Zend @@ -28,7 +32,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class My_FeedReader_Extension_JungleBooks_Feed extends Zend_Feed_Reader_Extension_FeedAbstract +class Feed extends \Zend\Feed\Reader\Extension\FeedAbstract { public function getDaysPopularBookLink() diff --git a/test/ReaderTest.php b/test/ReaderTest.php index d37e8310..7be2138e 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -20,6 +20,11 @@ * @version $Id$ */ +/** + * @namespace + */ +namespace ZendTest\Feed; +use Zend\Feed\Reader; /** * @category Zend @@ -30,7 +35,7 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class Zend_Feed_ReaderTest extends PHPUnit_Framework_TestCase +class ReaderTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -42,84 +47,84 @@ public function setup() public function tearDown() { - Zend_Feed_Reader::reset(); + Reader\Reader::reset(); } public function testDetectsFeedIsRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss20.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_20, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_RSS_20, $type); } public function testDetectsFeedIsRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss094.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_094, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_RSS_094, $type); } public function testDetectsFeedIsRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss093.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_093, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_RSS_093, $type); } public function testDetectsFeedIsRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss092.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_092, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_RSS_092, $type); } public function testDetectsFeedIsRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss091.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_091, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_RSS_091, $type); } public function testDetectsFeedIsRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss10.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_10, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_RSS_10, $type); } public function testDetectsFeedIsRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss090.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_090, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_RSS_090, $type); } public function testDetectsFeedIsAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/atom10.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_ATOM_10, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_ATOM_10, $type); } public function testDetectsFeedIsAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/atom03.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_ATOM_03, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_ATOM_03, $type); } public function testGetEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents(dirname(__FILE__) . '/Reader/Entry/_files/Atom/title/plain/atom10.xml') ); @@ -130,10 +135,10 @@ public function testGetEncoding() public function testImportsFile() { try { - $feed = Zend_Feed_Reader::importFile( + $feed = Reader\Reader::importFile( dirname(__FILE__) . '/Reader/Entry/_files/Atom/title/plain/atom10.xml' ); - } catch(Exception $e) { + } catch(\Exception $e) { $this->fail($e->getMessage()); } } @@ -148,18 +153,18 @@ public function testImportsUri() } try { - $feed = Zend_Feed_Reader::import('http://www.planet-php.net/rdf/'); - } catch(Exception $e) { + $feed = Reader\Reader::import('http://www.planet-php.net/rdf/'); + } catch(\Exception $e) { $this->fail($e->getMessage()); } } /** * @group ZF-8328 - * @expectedException Zend_Feed_Exception */ public function testImportsUriAndThrowsExceptionIfNotAFeed() { + $this->setExpectedException('Zend\Feed\Exception'); if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') ) { @@ -167,7 +172,7 @@ public function testImportsUriAndThrowsExceptionIfNotAFeed() return; } - $feed = Zend_Feed_Reader::import('http://twitter.com/alganet'); + $feed = Reader\Reader::import('http://twitter.com/alganet'); } public function testGetsFeedLinksAsValueObject() @@ -180,8 +185,8 @@ public function testGetsFeedLinksAsValueObject() } try { - $links = Zend_Feed_Reader::findFeedLinks('http://www.planet-php.net'); - } catch(Exception $e) { + $links = Reader\Reader::findFeedLinks('http://www.planet-php.net'); + } catch(\Exception $e) { $this->fail($e->getMessage()); } $this->assertEquals('http://www.planet-php.org/rss/', $links->rss); @@ -195,8 +200,8 @@ public function testCompilesLinksAsArrayObject() $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); return; } - $links = Zend_Feed_Reader::findFeedLinks('http://www.planet-php.net'); - $this->assertTrue($links instanceof Zend_Feed_Reader_FeedSet); + $links = Reader\Reader::findFeedLinks('http://www.planet-php.net'); + $this->assertTrue($links instanceof Reader\FeedSet); $this->assertEquals(array( 'rel' => 'alternate', 'type' => 'application/rss+xml', 'href' => 'http://www.planet-php.org/rss/' ), (array) $links->getIterator()->current()); @@ -210,9 +215,9 @@ public function testFeedSetLoadsFeedObjectWhenFeedArrayKeyAccessed() $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); return; } - $links = Zend_Feed_Reader::findFeedLinks('http://www.planet-php.net'); + $links = Reader\Reader::findFeedLinks('http://www.planet-php.net'); $link = $links->getIterator()->current(); - $this->assertTrue($link['feed'] instanceof Zend_Feed_Reader_Feed_Rss); + $this->assertTrue($link['feed'] instanceof \Zend\Feed\Reader\Feed\RSS); } public function testZeroCountFeedSetReturnedFromEmptyList() @@ -223,7 +228,7 @@ public function testZeroCountFeedSetReturnedFromEmptyList() $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); return; } - $links = Zend_Feed_Reader::findFeedLinks('http://www.example.com'); + $links = Reader\Reader::findFeedLinks('http://www.example.com'); $this->assertEquals(0, count($links)); } @@ -240,8 +245,8 @@ public function testGetsFeedLinksAndTrimsNewlines() } try { - $links = Zend_Feed_Reader::findFeedLinks('http://www.infopod.com.br'); - } catch(Exception $e) { + $links = Reader\Reader::findFeedLinks('http://www.infopod.com.br'); + } catch(\Exception $e) { $this->fail($e->getMessage()); } $this->assertEquals('http://feeds.feedburner.com/jonnyken/infoblog', $links->rss); @@ -260,8 +265,8 @@ public function testGetsFeedLinksAndNormalisesRelativeUrls() } try { - $links = Zend_Feed_Reader::findFeedLinks('http://meiobit.com'); - } catch(Exception $e) { + $links = Reader\Reader::findFeedLinks('http://meiobit.com'); + } catch(\Exception $e) { $this->fail($e->getMessage()); } $this->assertEquals('http://meiobit.com/rss.xml', $links->rss); @@ -273,16 +278,16 @@ public function testGetsFeedLinksAndNormalisesRelativeUrls() public function testGetsFeedLinksAndNormalisesRelativeUrlsOnUriWithPath() { try { - $currClient = Zend_Feed_Reader::getHttpClient(); + $currClient = Reader\Reader::getHttpClient(); - $testAdapter = new Zend_Http_Client_Adapter_Test(); - $testAdapter->setResponse(new Zend_Http_Response(200, array(), '')); - Zend_Feed_Reader::setHttpClient(new Zend_Http_Client(null, array('adapter' => $testAdapter))); + $testAdapter = new \Zend\HTTP\Client\Adapter\Test(); + $testAdapter->setResponse(new \Zend\HTTP\Response\Response(200, array(), '')); + Reader\Reader::setHttpClient(new \Zend\HTTP\Client(null, array('adapter' => $testAdapter))); - $links = Zend_Feed_Reader::findFeedLinks('http://foo/bar'); + $links = Reader\Reader::findFeedLinks('http://foo/bar'); - Zend_Feed_Reader::setHttpClient($currClient); - } catch(Exception $e) { + Reader\Reader::setHttpClient($currClient); + } catch(\Exception $e) { $this->fail($e->getMessage()); } @@ -292,20 +297,20 @@ public function testGetsFeedLinksAndNormalisesRelativeUrlsOnUriWithPath() public function testAddsPrefixPath() { - Zend_Feed_Reader::addPrefixPath('A_B_C', '/A/B/C'); - $prefixPaths = Zend_Feed_Reader::getPluginLoader()->getPaths(); - $this->assertEquals('/A/B/C/', $prefixPaths['A_B_C_'][0]); + Reader\Reader::addPrefixPath('A\B\C', '/A/B/C'); + $prefixPaths = Reader\Reader::getPluginLoader()->getPaths(); + $this->assertEquals('/A/B/C/', $prefixPaths['A\B\C\\'][0]); } public function testRegistersUserExtension() { try { - Zend_Feed_Reader::addPrefixPath('My_FeedReader_Extension',dirname(__FILE__) . '/Reader/_files/My/Extension'); - Zend_Feed_Reader::registerExtension('JungleBooks'); - } catch(Exception $e) { + Reader\Reader::addPrefixPath('My\FeedReader\Extension', dirname(__FILE__) . '/Reader/_files/My/Extension'); + Reader\Reader::registerExtension('JungleBooks'); + } catch(\Exception $e) { $this->fail($e->getMessage()); } - $this->assertTrue(Zend_Feed_Reader::isRegistered('JungleBooks')); + $this->assertTrue(Reader\Reader::isRegistered('JungleBooks')); } protected function _getTempDirectory() diff --git a/test/Writer/DeletedTest.php b/test/Writer/DeletedTest.php index 2fcc1574..b6039981 100644 --- a/test/Writer/DeletedTest.php +++ b/test/Writer/DeletedTest.php @@ -20,7 +20,13 @@ * @version $Id$ */ - +/** + * @namespace + */ +namespace ZendTest\Feed\Writer; +use Zend\Feed\Writer; +use Zend\Feed; +use Zend\Date; /** * @category Zend @@ -31,130 +37,130 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_DeletedTest extends PHPUnit_Framework_TestCase +class DeletedTest extends \PHPUnit_Framework_TestCase { public function testSetsReference() { - $entry = new Zend_Feed_Writer_Deleted; + $entry = new Writer\Deleted; $entry->setReference('http://www.example.com/id'); $this->assertEquals('http://www.example.com/id', $entry->getReference()); } public function testSetReferenceThrowsExceptionOnInvalidParameter() { - $entry = new Zend_Feed_Writer_Deleted; + $entry = new Writer\Deleted; try { $entry->setReference(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetReferenceReturnsNullIfNotSet() { - $entry = new Zend_Feed_Writer_Deleted; + $entry = new Writer\Deleted; $this->assertTrue(is_null($entry->getReference())); } public function testSetWhenDefaultsToCurrentTime() { - $entry = new Zend_Feed_Writer_Deleted; + $entry = new Writer\Deleted; $entry->setWhen(); - $dateNow = new Zend_Date; + $dateNow = new Date\Date; $this->assertTrue($dateNow->isLater($entry->getWhen()) || $dateNow->equals($entry->getWhen())); } public function testSetWhenUsesGivenUnixTimestamp() { - $entry = new Zend_Feed_Writer_Deleted; + $entry = new Writer\Deleted; $entry->setWhen(1234567890); - $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($entry->getWhen())); } public function testSetWhenUsesZendDateObject() { - $entry = new Zend_Feed_Writer_Deleted; - $entry->setWhen(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); - $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $entry = new Writer\Deleted; + $entry->setWhen(new Date\Date('1234567890', Date\Date::TIMESTAMP)); + $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($entry->getWhen())); } public function testSetWhenThrowsExceptionOnInvalidParameter() { - $entry = new Zend_Feed_Writer_Deleted; + $entry = new Writer\Deleted; try { $entry->setWhen('abc'); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetWhenReturnsNullIfDateNotSet() { - $entry = new Zend_Feed_Writer_Deleted; + $entry = new Writer\Deleted; $this->assertTrue(is_null($entry->getWhen())); } public function testAddsByNameFromArray() { - $entry = new Zend_Feed_Writer_Deleted; + $entry = new Writer\Deleted; $entry->setBy(array('name'=>'Joe')); $this->assertEquals(array('name'=>'Joe'), $entry->getBy()); } public function testAddsByEmailFromArray() { - $entry = new Zend_Feed_Writer_Deleted; + $entry = new Writer\Deleted; $entry->setBy(array('name'=>'Joe','email'=>'joe@example.com')); $this->assertEquals(array('name'=>'Joe', 'email' => 'joe@example.com'), $entry->getBy()); } public function testAddsByUriFromArray() { - $entry = new Zend_Feed_Writer_Deleted; + $entry = new Writer\Deleted; $entry->setBy(array('name'=>'Joe','uri'=>'http://www.example.com')); $this->assertEquals(array('name'=>'Joe', 'uri' => 'http://www.example.com'), $entry->getBy()); } public function testAddByThrowsExceptionOnInvalidNameFromArray() { - $entry = new Zend_Feed_Writer_Deleted; + $entry = new Writer\Deleted; try { $entry->setBy(array('name'=>'')); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddByThrowsExceptionOnInvalidEmailFromArray() { - $entry = new Zend_Feed_Writer_Deleted; + $entry = new Writer\Deleted; try { $entry->setBy(array('name'=>'Joe','email'=>'')); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddByThrowsExceptionOnInvalidUriFromArray() { - $entry = new Zend_Feed_Writer_Deleted; + $entry = new Writer\Deleted; try { $entry->setBy(array('name'=>'Joe','uri'=>'notauri')); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddByThrowsExceptionIfNameOmittedFromArray() { - $entry = new Zend_Feed_Writer_Deleted; + $entry = new Writer\Deleted; try { $entry->setBy(array('uri'=>'notauri')); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } diff --git a/test/Writer/EntryTest.php b/test/Writer/EntryTest.php index 64dd37e6..b8d87c39 100644 --- a/test/Writer/EntryTest.php +++ b/test/Writer/EntryTest.php @@ -20,7 +20,13 @@ * @version $Id$ */ - +/** + * @namespace + */ +namespace ZendTest\Feed\Writer; +use Zend\Feed\Writer; +use Zend\Feed; +use Zend\Date; /** * @category Zend @@ -31,7 +37,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_EntryTest extends PHPUnit_Framework_TestCase +class EntryTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -43,119 +49,119 @@ public function setup() public function testAddsAuthorName() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->addAuthor('Joe'); $this->assertEquals(array(array('name'=>'Joe')), $entry->getAuthors()); } public function testAddsAuthorEmail() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->addAuthor('Joe', 'joe@example.com'); $this->assertEquals(array(array('name'=>'Joe', 'email' => 'joe@example.com')), $entry->getAuthors()); } public function testAddsAuthorUri() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->addAuthor('Joe', null, 'http://www.example.com'); $this->assertEquals(array(array('name'=>'Joe', 'uri' => 'http://www.example.com')), $entry->getAuthors()); } public function testAddAuthorThrowsExceptionOnInvalidName() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->addAuthor(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddAuthorThrowsExceptionOnInvalidEmail() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->addAuthor('Joe', ''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddAuthorThrowsExceptionOnInvalidUri() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->addAuthor('Joe', null, 'notauri'); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddsAuthorNameFromArray() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->addAuthor(array('name'=>'Joe')); $this->assertEquals(array(array('name'=>'Joe')), $entry->getAuthors()); } public function testAddsAuthorEmailFromArray() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->addAuthor(array('name'=>'Joe','email'=>'joe@example.com')); $this->assertEquals(array(array('name'=>'Joe', 'email' => 'joe@example.com')), $entry->getAuthors()); } public function testAddsAuthorUriFromArray() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->addAuthor(array('name'=>'Joe','uri'=>'http://www.example.com')); $this->assertEquals(array(array('name'=>'Joe', 'uri' => 'http://www.example.com')), $entry->getAuthors()); } public function testAddAuthorThrowsExceptionOnInvalidNameFromArray() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->addAuthor(array('name'=>'')); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddAuthorThrowsExceptionOnInvalidEmailFromArray() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->addAuthor(array('name'=>'Joe','email'=>'')); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddAuthorThrowsExceptionOnInvalidUriFromArray() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->addAuthor(array('name'=>'Joe','uri'=>'notauri')); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddAuthorThrowsExceptionIfNameOmittedFromArray() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->addAuthor(array('uri'=>'notauri')); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddsAuthorsFromArrayOfAuthors() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->addAuthors(array( array('name'=>'Joe','uri'=>'http://www.example.com'), array('name'=>'Jane','uri'=>'http://www.example.com') @@ -169,7 +175,7 @@ public function testAddsAuthorsFromArrayOfAuthors() public function testAddsEnclosure() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setEnclosure(array( 'type' => 'audio/mpeg', 'uri' => 'http://example.com/audio.mp3', @@ -183,48 +189,41 @@ public function testAddsEnclosure() $this->assertEquals($expected, $entry->getEnclosure()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testAddsEnclosureThrowsExceptionOnMissingType() { - $entry = new Zend_Feed_Writer_Entry; + $this->setExpectedException('Zend\Feed\Exception'); + $entry = new Writer\Entry; $entry->setEnclosure(array( 'uri' => 'http://example.com/audio.mp3', 'length' => '1337' )); } - /** - * @expectedException Zend_Feed_Exception - */ public function testAddsEnclosureThrowsExceptionOnMissingUri() { - $entry = new Zend_Feed_Writer_Entry; + $this->setExpectedException('Zend\Feed\Exception'); + $entry = new Writer\Entry; $entry->setEnclosure(array( 'type' => 'audio/mpeg', 'length' => '1337' )); } - /** - * @expectedException Zend_Feed_Exception - */ + public function testAddsEnclosureThrowsExceptionOnMissingLength() { - $entry = new Zend_Feed_Writer_Entry; + $this->setExpectedException('Zend\Feed\Exception'); + $entry = new Writer\Entry; $entry->setEnclosure(array( 'type' => 'audio/mpeg', 'uri' => 'http://example.com/audio.mp3' )); } - /** - * @expectedException Zend_Feed_Exception - */ public function testAddsEnclosureThrowsExceptionOnNonNumericLength() { - $entry = new Zend_Feed_Writer_Entry; + $this->setExpectedException('Zend\Feed\Exception'); + $entry = new Writer\Entry; $entry->setEnclosure(array( 'type' => 'audio/mpeg', 'uri' => 'http://example.com/audio.mp3', @@ -232,12 +231,11 @@ public function testAddsEnclosureThrowsExceptionOnNonNumericLength() )); } - /** - * @expectedException Zend_Feed_Exception - */ + public function testAddsEnclosureThrowsExceptionOnNegativeLength() { - $entry = new Zend_Feed_Writer_Entry; + $this->setExpectedException('Zend\Feed\Exception'); + $entry = new Writer\Entry; $entry->setEnclosure(array( 'type' => 'audio/mpeg', 'uri' => 'http://example.com/audio.mp3', @@ -245,12 +243,10 @@ public function testAddsEnclosureThrowsExceptionOnNegativeLength() )); } - /** - * @expectedException Zend_Feed_Exception - */ public function testAddsEnclosureThrowsExceptionWhenUriIsInvalid() { - $entry = new Zend_Feed_Writer_Entry; + $this->setExpectedException('Zend\Feed\Exception'); + $entry = new Writer\Entry; $entry->setEnclosure(array( 'type' => 'audio/mpeg', 'uri' => 'http://', @@ -260,245 +256,245 @@ public function testAddsEnclosureThrowsExceptionWhenUriIsInvalid() public function testSetsCopyright() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setCopyright('Copyright (c) 2009 Paddy Brady'); $this->assertEquals('Copyright (c) 2009 Paddy Brady', $entry->getCopyright()); } public function testSetCopyrightThrowsExceptionOnInvalidParam() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->setCopyright(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testSetsContent() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setContent('I\'m content.'); $this->assertEquals("I'm content.", $entry->getContent()); } public function testSetContentThrowsExceptionOnInvalidParam() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->setContent(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testSetDateCreatedDefaultsToCurrentTime() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setDateCreated(); - $dateNow = new Zend_Date; + $dateNow = new Date\Date; $this->assertTrue($dateNow->isLater($entry->getDateCreated()) || $dateNow->equals($entry->getDateCreated())); } public function testSetDateCreatedUsesGivenUnixTimestamp() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setDateCreated(1234567890); - $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($entry->getDateCreated())); } public function testSetDateCreatedUsesZendDateObject() { - $entry = new Zend_Feed_Writer_Entry; - $entry->setDateCreated(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); - $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $entry = new Writer\Entry; + $entry->setDateCreated(new Date\Date('1234567890', Date\Date::TIMESTAMP)); + $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($entry->getDateCreated())); } public function testSetDateModifiedDefaultsToCurrentTime() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setDateModified(); - $dateNow = new Zend_Date; + $dateNow = new Date\Date; $this->assertTrue($dateNow->isLater($entry->getDateModified()) || $dateNow->equals($entry->getDateModified())); } public function testSetDateModifiedUsesGivenUnixTimestamp() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setDateModified(1234567890); - $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($entry->getDateModified())); } public function testSetDateModifiedUsesZendDateObject() { - $entry = new Zend_Feed_Writer_Entry; - $entry->setDateModified(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); - $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $entry = new Writer\Entry; + $entry->setDateModified(new Date\Date('1234567890', Date\Date::TIMESTAMP)); + $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($entry->getDateModified())); } public function testSetDateCreatedThrowsExceptionOnInvalidParameter() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->setDateCreated('abc'); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testSetDateModifiedThrowsExceptionOnInvalidParameter() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->setDateModified('abc'); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetDateCreatedReturnsNullIfDateNotSet() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $this->assertTrue(is_null($entry->getDateCreated())); } public function testGetDateModifiedReturnsNullIfDateNotSet() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $this->assertTrue(is_null($entry->getDateModified())); } public function testGetCopyrightReturnsNullIfDateNotSet() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $this->assertTrue(is_null($entry->getCopyright())); } public function testGetContentReturnsNullIfDateNotSet() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $this->assertTrue(is_null($entry->getContent())); } public function testSetsDescription() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setDescription('abc'); $this->assertEquals('abc', $entry->getDescription()); } public function testSetDescriptionThrowsExceptionOnInvalidParameter() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->setDescription(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetDescriptionReturnsNullIfDateNotSet() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $this->assertTrue(is_null($entry->getDescription())); } public function testSetsId() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setId('http://www.example.com/id'); $this->assertEquals('http://www.example.com/id', $entry->getId()); } public function testSetIdThrowsExceptionOnInvalidParameter() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->setId(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetIdReturnsNullIfNotSet() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $this->assertTrue(is_null($entry->getId())); } public function testSetsLink() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setLink('http://www.example.com/id'); $this->assertEquals('http://www.example.com/id', $entry->getLink()); } public function testSetLinkThrowsExceptionOnEmptyString() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->setLink(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testSetLinkThrowsExceptionOnInvalidUri() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->setLink('http://'); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetLinkReturnsNullIfNotSet() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $this->assertTrue(is_null($entry->getLink())); } public function testSetsCommentLink() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setCommentLink('http://www.example.com/id/comments'); $this->assertEquals('http://www.example.com/id/comments', $entry->getCommentLink()); } public function testSetCommentLinkThrowsExceptionOnEmptyString() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->setCommentLink(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testSetCommentLinkThrowsExceptionOnInvalidUri() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->setCommentLink('http://'); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetCommentLinkReturnsNullIfDateNotSet() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $this->assertTrue(is_null($entry->getCommentLink())); } public function testSetsCommentFeedLink() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setCommentFeedLink(array('uri'=>'http://www.example.com/id/comments', 'type'=>'rdf')); $this->assertEquals(array(array('uri'=>'http://www.example.com/id/comments', 'type'=>'rdf')), $entry->getCommentFeedLinks()); @@ -506,93 +502,93 @@ public function testSetsCommentFeedLink() public function testSetCommentFeedLinkThrowsExceptionOnEmptyString() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->setCommentFeedLink(array('uri'=>'', 'type'=>'rdf')); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testSetCommentFeedLinkThrowsExceptionOnInvalidUri() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->setCommentFeedLink(array('uri'=>'http://', 'type'=>'rdf')); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testSetCommentFeedLinkThrowsExceptionOnInvalidType() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->setCommentFeedLink(array('uri'=>'http://www.example.com/id/comments', 'type'=>'foo')); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetCommentFeedLinkReturnsNullIfNoneSet() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $this->assertTrue(is_null($entry->getCommentFeedLinks())); } public function testSetsTitle() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setTitle('abc'); $this->assertEquals('abc', $entry->getTitle()); } public function testSetTitleThrowsExceptionOnInvalidParameter() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->setTitle(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetTitleReturnsNullIfDateNotSet() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $this->assertTrue(is_null($entry->getTitle())); } public function testSetsCommentCount() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setCommentCount('10'); $this->assertEquals(10, $entry->getCommentCount()); } public function testSetCommentCountThrowsExceptionOnInvalidEmptyParameter() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->setCommentCount(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testSetCommentCountThrowsExceptionOnInvalidNonIntegerParameter() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; try { $entry->setCommentCount('a'); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetCommentCountReturnsNullIfDateNotSet() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $this->assertTrue(is_null($entry->getCommentCount())); } diff --git a/test/Writer/Extension/ITunes/EntryTest.php b/test/Writer/Extension/ITunes/EntryTest.php index 22ac1d10..bdfb595f 100644 --- a/test/Writer/Extension/ITunes/EntryTest.php +++ b/test/Writer/Extension/ITunes/EntryTest.php @@ -20,7 +20,11 @@ * @version $Id$ */ - +/** + * @namespace + */ +namespace ZendTest\Feed\Writer\Extension\ITunes; +use Zend\Feed\Writer; /** * @category Zend @@ -31,138 +35,124 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Extension_ITunes_EntryTest extends PHPUnit_Framework_TestCase +class EntryTest extends \PHPUnit_Framework_TestCase { public function testSetBlock() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setItunesBlock('yes'); $this->assertEquals('yes', $entry->getItunesBlock()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetBlockThrowsExceptionOnNonAlphaValue() { - $entry = new Zend_Feed_Writer_Entry; + $this->setExpectedException('Zend\Feed\Exception'); + $entry = new Writer\Entry; $entry->setItunesBlock('123'); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetBlockThrowsExceptionIfValueGreaterThan255CharsLength() { - $entry = new Zend_Feed_Writer_Entry; + $this->setExpectedException('Zend\Feed\Exception'); + $entry = new Writer\Entry; $entry->setItunesBlock(str_repeat('a', 256)); } public function testAddAuthors() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->addItunesAuthors(array('joe', 'jane')); $this->assertEquals(array('joe', 'jane'), $entry->getItunesAuthors()); } public function testAddAuthor() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->addItunesAuthor('joe'); $this->assertEquals(array('joe'), $entry->getItunesAuthors()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testAddAuthorThrowsExceptionIfValueGreaterThan255CharsLength() { - $entry = new Zend_Feed_Writer_Entry; + $this->setExpectedException('Zend\Feed\Exception'); + $entry = new Writer\Entry; $entry->addItunesAuthor(str_repeat('a', 256)); } public function testSetDurationAsSeconds() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setItunesDuration(23); $this->assertEquals(23, $entry->getItunesDuration()); } public function testSetDurationAsMinutesAndSeconds() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setItunesDuration('23:23'); $this->assertEquals('23:23', $entry->getItunesDuration()); } public function testSetDurationAsHoursMinutesAndSeconds() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setItunesDuration('23:23:23'); $this->assertEquals('23:23:23', $entry->getItunesDuration()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetDurationThrowsExceptionOnUnknownFormat() { - $entry = new Zend_Feed_Writer_Entry; + $this->setExpectedException('Zend\Feed\Exception'); + $entry = new Writer\Entry; $entry->setItunesDuration('abc'); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetDurationThrowsExceptionOnInvalidSeconds() { - $entry = new Zend_Feed_Writer_Entry; + $this->setExpectedException('Zend\Feed\Exception'); + $entry = new Writer\Entry; $entry->setItunesDuration('23:456'); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetDurationThrowsExceptionOnInvalidMinutes() { - $entry = new Zend_Feed_Writer_Entry; + $this->setExpectedException('Zend\Feed\Exception'); + $entry = new Writer\Entry; $entry->setItunesDuration('23:234:45'); } public function testSetExplicitToYes() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setItunesExplicit('yes'); $this->assertEquals('yes', $entry->getItunesExplicit()); } public function testSetExplicitToNo() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setItunesExplicit('no'); $this->assertEquals('no', $entry->getItunesExplicit()); } public function testSetExplicitToClean() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setItunesExplicit('clean'); $this->assertEquals('clean', $entry->getItunesExplicit()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetExplicitThrowsExceptionOnUnknownTerm() { - $entry = new Zend_Feed_Writer_Entry; + $this->setExpectedException('Zend\Feed\Exception'); + $entry = new Writer\Entry; $entry->setItunesExplicit('abc'); } public function testSetKeywords() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $words = array( 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12' ); @@ -170,24 +160,20 @@ public function testSetKeywords() $this->assertEquals($words, $entry->getItunesKeywords()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded() { - $entry = new Zend_Feed_Writer_Entry; + $this->setExpectedException('Zend\Feed\Exception'); + $entry = new Writer\Entry; $words = array( 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12', 'a13' ); $entry->setItunesKeywords($words); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharLength() { - $entry = new Zend_Feed_Writer_Entry; + $this->setExpectedException('Zend\Feed\Exception'); + $entry = new Writer\Entry; $words = array( str_repeat('a', 253), str_repeat('b', 2) ); @@ -196,33 +182,29 @@ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharL public function testSetSubtitle() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setItunesSubtitle('abc'); $this->assertEquals('abc', $entry->getItunesSubtitle()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetSubtitleThrowsExceptionWhenValueExceeds255Chars() { - $entry = new Zend_Feed_Writer_Entry; + $this->setExpectedException('Zend\Feed\Exception'); + $entry = new Writer\Entry; $entry->setItunesSubtitle(str_repeat('a', 256)); } public function testSetSummary() { - $entry = new Zend_Feed_Writer_Entry; + $entry = new Writer\Entry; $entry->setItunesSummary('abc'); $this->assertEquals('abc', $entry->getItunesSummary()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetSummaryThrowsExceptionWhenValueExceeds255Chars() { - $entry = new Zend_Feed_Writer_Entry; + $this->setExpectedException('Zend\Feed\Exception'); + $entry = new Writer\Entry; $entry->setItunesSummary(str_repeat('a', 4001)); } diff --git a/test/Writer/Extension/ITunes/FeedTest.php b/test/Writer/Extension/ITunes/FeedTest.php index 4e5b659a..8eaaff49 100644 --- a/test/Writer/Extension/ITunes/FeedTest.php +++ b/test/Writer/Extension/ITunes/FeedTest.php @@ -20,7 +20,11 @@ * @version $Id$ */ - +/** + * @namespace + */ +namespace ZendTest\Feed\Writer\Extension\ITunes; +use Zend\Feed\Writer\Feed; /** * @category Zend @@ -31,60 +35,54 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Extension_ITunes_FeedTest extends PHPUnit_Framework_TestCase +class FeedTest extends \PHPUnit_Framework_TestCase { public function testSetBlock() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $feed->setItunesBlock('yes'); $this->assertEquals('yes', $feed->getItunesBlock()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetBlockThrowsExceptionOnNonAlphaValue() { - $feed = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $feed = new Feed\Feed; $feed->setItunesBlock('123'); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetBlockThrowsExceptionIfValueGreaterThan255CharsLength() { - $feed = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $feed = new Feed\Feed; $feed->setItunesBlock(str_repeat('a', 256)); } public function testAddAuthors() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $feed->addItunesAuthors(array('joe', 'jane')); $this->assertEquals(array('joe', 'jane'), $feed->getItunesAuthors()); } public function testAddAuthor() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $feed->addItunesAuthor('joe'); $this->assertEquals(array('joe'), $feed->getItunesAuthors()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testAddAuthorThrowsExceptionIfValueGreaterThan255CharsLength() { - $feed = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $feed = new Feed\Feed; $feed->addItunesAuthor(str_repeat('a', 256)); } public function testSetCategories() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $cats = array( 'cat1', 'cat2' => array('cat2-1', 'cat2-a&b') @@ -93,12 +91,10 @@ public function testSetCategories() $this->assertEquals($cats, $feed->getItunesCategories()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetCategoriesThrowsExceptionIfAnyCatNameGreaterThan255CharsLength() { - $feed = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $feed = new Feed\Feed; $cats = array( 'cat1', 'cat2' => array('cat2-1', str_repeat('a', 256)) @@ -109,117 +105,105 @@ public function testSetCategoriesThrowsExceptionIfAnyCatNameGreaterThan255CharsL public function testSetImageAsPngFile() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $feed->setItunesImage('http://www.example.com/image.png'); $this->assertEquals('http://www.example.com/image.png', $feed->getItunesImage()); } public function testSetImageAsJpgFile() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $feed->setItunesImage('http://www.example.com/image.jpg'); $this->assertEquals('http://www.example.com/image.jpg', $feed->getItunesImage()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetImageThrowsExceptionOnInvalidUri() { - $feed = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $feed = new Feed\Feed; $feed->setItunesImage('http://'); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetImageThrowsExceptionOnInvalidImageExtension() { - $feed = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $feed = new Feed\Feed; $feed->setItunesImage('http://www.example.com/image.gif'); } public function testSetDurationAsSeconds() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $feed->setItunesDuration(23); $this->assertEquals(23, $feed->getItunesDuration()); } public function testSetDurationAsMinutesAndSeconds() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $feed->setItunesDuration('23:23'); $this->assertEquals('23:23', $feed->getItunesDuration()); } public function testSetDurationAsHoursMinutesAndSeconds() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $feed->setItunesDuration('23:23:23'); $this->assertEquals('23:23:23', $feed->getItunesDuration()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetDurationThrowsExceptionOnUnknownFormat() { - $feed = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $feed = new Feed\Feed; $feed->setItunesDuration('abc'); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetDurationThrowsExceptionOnInvalidSeconds() { - $feed = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $feed = new Feed\Feed; $feed->setItunesDuration('23:456'); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetDurationThrowsExceptionOnInvalidMinutes() { - $feed = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $feed = new Feed\Feed; $feed->setItunesDuration('23:234:45'); } public function testSetExplicitToYes() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $feed->setItunesExplicit('yes'); $this->assertEquals('yes', $feed->getItunesExplicit()); } public function testSetExplicitToNo() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $feed->setItunesExplicit('no'); $this->assertEquals('no', $feed->getItunesExplicit()); } public function testSetExplicitToClean() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $feed->setItunesExplicit('clean'); $this->assertEquals('clean', $feed->getItunesExplicit()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetExplicitThrowsExceptionOnUnknownTerm() { - $feed = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $feed = new Feed\Feed; $feed->setItunesExplicit('abc'); } public function testSetKeywords() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $words = array( 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12' ); @@ -227,24 +211,20 @@ public function testSetKeywords() $this->assertEquals($words, $feed->getItunesKeywords()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded() { - $feed = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $feed = new Feed\Feed; $words = array( 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12', 'a13' ); $feed->setItunesKeywords($words); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharLength() { - $feed = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $feed = new Feed\Feed; $words = array( str_repeat('a', 253), str_repeat('b', 2) ); @@ -253,63 +233,57 @@ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharL public function testSetNewFeedUrl() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $feed->setItunesNewFeedUrl('http://example.com/feed'); $this->assertEquals('http://example.com/feed', $feed->getItunesNewFeedUrl()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetNewFeedUrlThrowsExceptionOnInvalidUri() { - $feed = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $feed = new Feed\Feed; $feed->setItunesNewFeedUrl('http://'); } public function testAddOwner() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $feed->addItunesOwner(array('name'=>'joe','email'=>'joe@example.com')); $this->assertEquals(array(array('name'=>'joe','email'=>'joe@example.com')), $feed->getItunesOwners()); } public function testAddOwners() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $feed->addItunesOwners(array(array('name'=>'joe','email'=>'joe@example.com'))); $this->assertEquals(array(array('name'=>'joe','email'=>'joe@example.com')), $feed->getItunesOwners()); } public function testSetSubtitle() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $feed->setItunesSubtitle('abc'); $this->assertEquals('abc', $feed->getItunesSubtitle()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetSubtitleThrowsExceptionWhenValueExceeds255Chars() { - $feed = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $feed = new Feed\Feed; $feed->setItunesSubtitle(str_repeat('a', 256)); } public function testSetSummary() { - $feed = new Zend_Feed_Writer_Feed; + $feed = new Feed\Feed; $feed->setItunesSummary('abc'); $this->assertEquals('abc', $feed->getItunesSummary()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetSummaryThrowsExceptionWhenValueExceeds4000Chars() { - $feed = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $feed = new Feed\Feed; $feed->setItunesSummary(str_repeat('a',4001)); } diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php index 0ac08278..1c04cfde 100644 --- a/test/Writer/FeedTest.php +++ b/test/Writer/FeedTest.php @@ -20,7 +20,13 @@ * @version $Id$ */ - +/** + * @namespace + */ +namespace ZendTest\Feed\Writer; +use Zend\Feed; +use Zend\Feed\Writer\Feed as WriterFeed; +use Zend\Date; /** * @category Zend @@ -31,7 +37,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_FeedTest extends PHPUnit_Framework_TestCase +class FeedTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -43,119 +49,119 @@ public function setup() public function testAddsAuthorName() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->addAuthor('Joe'); $this->assertEquals(array('name'=>'Joe'), $writer->getAuthor()); } public function testAddsAuthorEmail() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->addAuthor('Joe', 'joe@example.com'); $this->assertEquals(array('name'=>'Joe', 'email' => 'joe@example.com'), $writer->getAuthor()); } public function testAddsAuthorUri() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->addAuthor('Joe', null, 'http://www.example.com'); $this->assertEquals(array('name'=>'Joe', 'uri' => 'http://www.example.com'), $writer->getAuthor()); } public function testAddAuthorThrowsExceptionOnInvalidName() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->addAuthor(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddAuthorThrowsExceptionOnInvalidEmail() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->addAuthor('Joe', ''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddAuthorThrowsExceptionOnInvalidUri() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->addAuthor('Joe', null, 'notauri'); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddsAuthorNameFromArray() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->addAuthor(array('name'=>'Joe')); $this->assertEquals(array('name'=>'Joe'), $writer->getAuthor()); } public function testAddsAuthorEmailFromArray() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->addAuthor(array('name'=>'Joe','email'=>'joe@example.com')); $this->assertEquals(array('name'=>'Joe', 'email' => 'joe@example.com'), $writer->getAuthor()); } public function testAddsAuthorUriFromArray() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->addAuthor(array('name'=>'Joe','uri'=>'http://www.example.com')); $this->assertEquals(array('name'=>'Joe', 'uri' => 'http://www.example.com'), $writer->getAuthor()); } public function testAddAuthorThrowsExceptionOnInvalidNameFromArray() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->addAuthor(array('name'=>'')); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddAuthorThrowsExceptionOnInvalidEmailFromArray() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->addAuthor(array('name'=>'Joe','email'=>'')); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddAuthorThrowsExceptionOnInvalidUriFromArray() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->addAuthor(array('name'=>'Joe','uri'=>'notauri')); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddAuthorThrowsExceptionIfNameOmittedFromArray() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->addAuthor(array('uri'=>'notauri')); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddsAuthorsFromArrayOfAuthors() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->addAuthors(array( array('name'=>'Joe','uri'=>'http://www.example.com'), array('name'=>'Jane','uri'=>'http://www.example.com') @@ -165,465 +171,465 @@ public function testAddsAuthorsFromArrayOfAuthors() public function testSetsCopyright() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->setCopyright('Copyright (c) 2009 Paddy Brady'); $this->assertEquals('Copyright (c) 2009 Paddy Brady', $writer->getCopyright()); } public function testSetCopyrightThrowsExceptionOnInvalidParam() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->setCopyright(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testSetDateCreatedDefaultsToCurrentTime() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->setDateCreated(); - $dateNow = new Zend_Date; + $dateNow = new Date\Date; $this->assertTrue($dateNow->isLater($writer->getDateCreated()) || $dateNow->equals($writer->getDateCreated())); } public function testSetDateCreatedUsesGivenUnixTimestamp() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->setDateCreated(1234567890); - $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($writer->getDateCreated())); } public function testSetDateCreatedUsesZendDateObject() { - $writer = new Zend_Feed_Writer_Feed; - $writer->setDateCreated(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); - $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $writer = new WriterFeed\Feed; + $writer->setDateCreated(new Date\Date('1234567890', Date\Date::TIMESTAMP)); + $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($writer->getDateCreated())); } public function testSetDateModifiedDefaultsToCurrentTime() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->setDateModified(); - $dateNow = new Zend_Date; + $dateNow = new Date\Date; $this->assertTrue($dateNow->isLater($writer->getDateModified()) || $dateNow->equals($writer->getDateModified())); } public function testSetDateModifiedUsesGivenUnixTimestamp() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->setDateModified(1234567890); - $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($writer->getDateModified())); } public function testSetDateModifiedUsesZendDateObject() { - $writer = new Zend_Feed_Writer_Feed; - $writer->setDateModified(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); - $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $writer = new WriterFeed\Feed; + $writer->setDateModified(new Date\Date('1234567890', Date\Date::TIMESTAMP)); + $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($writer->getDateModified())); } public function testSetDateCreatedThrowsExceptionOnInvalidParameter() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->setDateCreated('abc'); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testSetDateModifiedThrowsExceptionOnInvalidParameter() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->setDateModified('abc'); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetDateCreatedReturnsNullIfDateNotSet() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $this->assertTrue(is_null($writer->getDateCreated())); } public function testGetDateModifiedReturnsNullIfDateNotSet() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $this->assertTrue(is_null($writer->getDateModified())); } public function testGetCopyrightReturnsNullIfDateNotSet() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $this->assertTrue(is_null($writer->getCopyright())); } public function testSetsDescription() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->setDescription('abc'); $this->assertEquals('abc', $writer->getDescription()); } public function testSetDescriptionThrowsExceptionOnInvalidParameter() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->setDescription(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetDescriptionReturnsNullIfDateNotSet() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $this->assertTrue(is_null($writer->getDescription())); } public function testSetsId() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->setId('http://www.example.com/id'); $this->assertEquals('http://www.example.com/id', $writer->getId()); } public function testSetsIdAcceptsUrns() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $writer->getId()); } public function testSetIdThrowsExceptionOnInvalidParameter() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->setId(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testSetIdThrowsExceptionOnInvalidUri() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->setId('http://'); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetIdReturnsNullIfDateNotSet() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $this->assertTrue(is_null($writer->getId())); } public function testSetsLanguage() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->setLanguage('abc'); $this->assertEquals('abc', $writer->getLanguage()); } public function testSetLanguageThrowsExceptionOnInvalidParameter() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->setLanguage(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetLanguageReturnsNullIfDateNotSet() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $this->assertTrue(is_null($writer->getLanguage())); } public function testSetsLink() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->setLink('http://www.example.com/id'); $this->assertEquals('http://www.example.com/id', $writer->getLink()); } public function testSetLinkThrowsExceptionOnEmptyString() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->setLink(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testSetLinkThrowsExceptionOnInvalidUri() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->setLink('http://'); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetLinkReturnsNullIfDateNotSet() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $this->assertTrue(is_null($writer->getLink())); } public function testSetsEncoding() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->setEncoding('utf-16'); $this->assertEquals('utf-16', $writer->getEncoding()); } public function testSetEncodingThrowsExceptionOnInvalidParameter() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->setEncoding(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetEncodingReturnsUtf8IfNotSet() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $this->assertEquals('UTF-8', $writer->getEncoding()); } public function testSetsTitle() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->setTitle('abc'); $this->assertEquals('abc', $writer->getTitle()); } public function testSetTitleThrowsExceptionOnInvalidParameter() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->setTitle(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetTitleReturnsNullIfDateNotSet() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $this->assertTrue(is_null($writer->getTitle())); } public function testSetsGeneratorName() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->setGenerator('ZFW'); $this->assertEquals(array('name'=>'ZFW'), $writer->getGenerator()); } public function testSetsGeneratorVersion() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->setGenerator('ZFW', '1.0'); $this->assertEquals(array('name'=>'ZFW', 'version' => '1.0'), $writer->getGenerator()); } public function testSetsGeneratorUri() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->setGenerator('ZFW', null, 'http://www.example.com'); $this->assertEquals(array('name'=>'ZFW', 'uri' => 'http://www.example.com'), $writer->getGenerator()); } public function testSetsGeneratorThrowsExceptionOnInvalidName() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->setGenerator(''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testSetsGeneratorThrowsExceptionOnInvalidVersion() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->addAuthor('ZFW', ''); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testSetsGeneratorThrowsExceptionOnInvalidUri() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->setGenerator('ZFW', null, 'notauri'); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetGeneratorReturnsNullIfDateNotSet() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $this->assertTrue(is_null($writer->getGenerator())); } public function testSetsFeedLink() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->setFeedLink('http://www.example.com/rss', 'RSS'); $this->assertEquals(array('rss'=>'http://www.example.com/rss'), $writer->getFeedLinks()); } public function testSetsFeedLinkThrowsExceptionOnInvalidType() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->setFeedLink('http://www.example.com/rss', 'abc'); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testSetsFeedLinkThrowsExceptionOnInvalidUri() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->setFeedLink('http://', 'rss'); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetFeedLinksReturnsNullIfNotSet() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $this->assertTrue(is_null($writer->getFeedLinks())); } public function testSetsBaseUrl() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->setBaseUrl('http://www.example.com'); $this->assertEquals('http://www.example.com', $writer->getBaseUrl()); } public function testSetsBaseUrlThrowsExceptionOnInvalidUri() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->setBaseUrl('http://'); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetBaseUrlReturnsNullIfNotSet() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $this->assertTrue(is_null($writer->getBaseUrl())); } public function testAddsHubUrl() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->addHub('http://www.example.com/hub'); $this->assertEquals(array('http://www.example.com/hub'), $writer->getHubs()); } public function testAddsManyHubUrls() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->addHubs(array('http://www.example.com/hub', 'http://www.example.com/hub2')); $this->assertEquals(array('http://www.example.com/hub', 'http://www.example.com/hub2'), $writer->getHubs()); } public function testAddingHubUrlThrowsExceptionOnInvalidUri() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->addHub('http://'); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddingHubUrlReturnsNullIfNotSet() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $this->assertTrue(is_null($writer->getHubs())); } public function testCreatesNewEntryDataContainer() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $entry = $writer->createEntry(); - $this->assertTrue($entry instanceof Zend_Feed_Writer_Entry); + $this->assertTrue($entry instanceof \Zend\Feed\Writer\Entry); } public function testAddsCategory() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->addCategory(array('term'=>'cat_dog')); $this->assertEquals(array(array('term'=>'cat_dog')), $writer->getCategories()); } public function testAddsManyCategories() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $writer->addCategories(array(array('term'=>'cat_dog'),array('term'=>'cat_mouse'))); $this->assertEquals(array(array('term'=>'cat_dog'),array('term'=>'cat_mouse')), $writer->getCategories()); } public function testAddingCategoryWithoutTermThrowsException() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->addCategory(array('label' => 'Cats & Dogs', 'scheme' => 'http://www.example.com/schema1')); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testAddingCategoryWithInvalidUriAsSchemeThrowsException() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; try { $writer->addCategory(array('term' => 'cat_dog', 'scheme' => 'http://')); $this->fail(); - } catch (Zend_Feed_Exception $e) { + } catch (Feed\Exception $e) { } } public function testGetCategoriesReturnsNullIfNotSet() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $this->assertTrue(is_null($writer->getCategories())); } public function testAddsAndOrdersEntriesByDateIfRequested() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed\Feed; $entry = $writer->createEntry(); $entry->setDateCreated(1234567890); $entry2 = $writer->createEntry(); @@ -631,7 +637,7 @@ public function testAddsAndOrdersEntriesByDateIfRequested() $writer->addEntry($entry); $writer->addEntry($entry2); $writer->orderByDate(); - $this->assertEquals(1230000000, $writer->getEntry(1)->getDateCreated()->get(Zend_Date::TIMESTAMP)); + $this->assertEquals(1230000000, $writer->getEntry(1)->getDateCreated()->get(Date\Date::TIMESTAMP)); } } diff --git a/test/Writer/Renderer/Entry/AtomTest.php b/test/Writer/Renderer/Entry/AtomTest.php index 5bc8b46f..92b9ff57 100644 --- a/test/Writer/Renderer/Entry/AtomTest.php +++ b/test/Writer/Renderer/Entry/AtomTest.php @@ -20,7 +20,13 @@ * @version $Id$ */ - +/** + * @namespace + */ +namespace ZendTest\Feed\Writer\Renderer\Entry; +use Zend\Feed\Writer\Renderer\Feed\Atom; +use Zend\Feed\Reader; +use Zend\Date; /** * @category Zend @@ -31,7 +37,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Renderer_Entry_AtomTest extends PHPUnit_Framework_TestCase +class AtomTest extends \PHPUnit_Framework_TestCase { protected $_validWriter = null; @@ -39,7 +45,7 @@ class Zend_Feed_Writer_Renderer_Entry_AtomTest extends PHPUnit_Framework_TestCas public function setUp() { - $this->_validWriter = new Zend_Feed_Writer_Feed; + $this->_validWriter = new \Zend\Feed\Writer\Feed\Feed; $this->_validWriter->setType('atom'); @@ -68,10 +74,10 @@ public function tearDown() public function testRenderMethodRunsMinimalWriterContainerProperlyBeforeICheckAtomCompliance() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $renderer = new Atom\Atom($this->_validWriter); try { $renderer->render(); - } catch (Zend_Feed_Exception $e) { + } catch (\Zend\Feed\Exception $e) { $this->fail('Valid Writer object caused an exception when building which should never happen'); } } @@ -79,42 +85,40 @@ public function testRenderMethodRunsMinimalWriterContainerProperlyBeforeICheckAt public function testEntryEncodingHasBeenSet() { $this->_validWriter->setEncoding('iso-8859-1'); - $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Atom\Atom($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('iso-8859-1', $entry->getEncoding()); } public function testEntryEncodingDefaultIsUsedIfEncodingNotSetByHand() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Atom\Atom($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('UTF-8', $entry->getEncoding()); } public function testEntryTitleHasBeenSet() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Atom\Atom($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('This is a test entry.', $entry->getTitle()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testFeedTitleIfMissingThrowsException() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->setExpectedException('Zend\Feed\Exception'); + $atomFeed = new Atom\Atom($this->_validWriter); $this->_validEntry->remove('title'); $atomFeed->render(); } public function testEntrySummaryDescriptionHasBeenSet() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Atom\Atom($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('This is a test entry description.', $entry->getDescription()); } @@ -124,18 +128,16 @@ public function testEntrySummaryDescriptionHasBeenSet() */ public function testEntryContentHasBeenSet_Xhtml() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Atom\Atom($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('

This is test content for xhtml:

', $entry->getContent()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testFeedContentIfMissingThrowsExceptionIfThereIsNoLink() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->setExpectedException('Zend\Feed\Exception'); + $atomFeed = new Atom\Atom($this->_validWriter); $this->_validEntry->remove('content'); $this->_validEntry->remove('link'); $atomFeed->render(); @@ -143,42 +145,40 @@ public function testFeedContentIfMissingThrowsExceptionIfThereIsNoLink() public function testEntryUpdatedDateHasBeenSet() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Atom\Atom($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); - $this->assertEquals(1234567890, $entry->getDateModified()->get(Zend_Date::TIMESTAMP)); + $this->assertEquals(1234567890, $entry->getDateModified()->get(Date\Date::TIMESTAMP)); } - /** - * @expectedException Zend_Feed_Exception - */ public function testFeedUpdatedDateIfMissingThrowsException() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->setExpectedException('Zend\Feed\Exception'); + $atomFeed = new Atom\Atom($this->_validWriter); $this->_validEntry->remove('dateModified'); $atomFeed->render(); } public function testEntryPublishedDateHasBeenSet() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Atom\Atom($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); - $this->assertEquals(1234567000, $entry->getDateCreated()->get(Zend_Date::TIMESTAMP)); + $this->assertEquals(1234567000, $entry->getDateCreated()->get(Date\Date::TIMESTAMP)); } public function testEntryIncludesLinkToHtmlVersionOfFeed() { - $renderer= new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer= new Atom\Atom($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('http://www.example.com/1', $entry->getLink()); } public function testEntryHoldsAnyAuthorAdded() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Atom\Atom($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $author = $entry->getAuthor(); $this->assertEquals(array( @@ -189,13 +189,13 @@ public function testEntryHoldsAnyAuthorAdded() public function testEntryHoldsAnyEnclosureAdded() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $renderer = new Atom\Atom($this->_validWriter); $this->_validEntry->setEnclosure(array( 'type' => 'audio/mpeg', 'length' => '1337', 'uri' => 'http://example.com/audio.mp3' )); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $enc = $entry->getEnclosure(); $this->assertEquals('audio/mpeg', $enc->type); @@ -206,37 +206,33 @@ public function testEntryHoldsAnyEnclosureAdded() public function testEntryIdHasBeenSet() { $this->_validEntry->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); - $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Atom\Atom($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $entry->getId()); } public function testFeedIdDefaultIsUsedIfNotSetByHand() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Atom\Atom($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals($entry->getLink(), $entry->getId()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testFeedIdIfMissingThrowsException() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->setExpectedException('Zend\Feed\Exception'); + $atomFeed = new Atom\Atom($this->_validWriter); $this->_validEntry->remove('id'); $this->_validEntry->remove('link'); $atomFeed->render(); } - /** - * @expectedException Zend_Feed_Exception - */ public function testFeedIdThrowsExceptionIfNotUri() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->setExpectedException('Zend\Feed\Exception'); + $atomFeed = new Atom\Atom($this->_validWriter); $this->_validEntry->remove('id'); $this->_validEntry->remove('link'); $this->_validEntry->setId('not-a-uri'); @@ -245,18 +241,18 @@ public function testFeedIdThrowsExceptionIfNotUri() public function testCommentLinkRendered() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $renderer = new Atom\Atom($this->_validWriter); $this->_validEntry->setCommentLink('http://www.example.com/id/1'); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('http://www.example.com/id/1', $entry->getCommentLink()); } public function testCommentCountRendered() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $renderer = new Atom\Atom($this->_validWriter); $this->_validEntry->setCommentCount(22); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals(22, $entry->getCommentCount()); } @@ -267,9 +263,9 @@ public function testCategoriesCanBeSet() array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2') )); - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $entry = $feed->current(); $expected = array( array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), @@ -280,12 +276,12 @@ public function testCategoriesCanBeSet() public function testCommentFeedLinksRendered() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $renderer = new Atom\Atom($this->_validWriter); $this->_validEntry->setCommentFeedLinks(array( array('uri'=>'http://www.example.com/atom/id/1','type'=>'atom'), array('uri'=>'http://www.example.com/rss/id/1','type'=>'rss'), )); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); // Skipped over due to ZFR bug (detects Atom in error when RSS requested) //$this->assertEquals('http://www.example.com/rss/id/1', $entry->getCommentFeedLink('rss')); diff --git a/test/Writer/Renderer/Entry/RssTest.php b/test/Writer/Renderer/Entry/RssTest.php index 116823d1..0ca5a7f7 100644 --- a/test/Writer/Renderer/Entry/RssTest.php +++ b/test/Writer/Renderer/Entry/RssTest.php @@ -20,7 +20,13 @@ * @version $Id$ */ - +/** + * @namespace + */ +namespace ZendTest\Feed\Writer\Renderer\Entry; +use Zend\Feed\Writer\Renderer\Feed; +use Zend\Feed\Reader; +use Zend\Date; /** * @category Zend @@ -31,7 +37,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Renderer_Entry_RssTest extends PHPUnit_Framework_TestCase +class RssTest extends \PHPUnit_Framework_TestCase { protected $_validWriter = null; @@ -39,7 +45,7 @@ class Zend_Feed_Writer_Renderer_Entry_RssTest extends PHPUnit_Framework_TestCase public function setUp() { - $this->_validWriter = new Zend_Feed_Writer_Feed; + $this->_validWriter = new \Zend\Feed\Writer\Feed\Feed; $this->_validWriter->setType('rss'); @@ -61,10 +67,10 @@ public function tearDown() public function testRenderMethodRunsMinimalWriterContainerProperlyBeforeICheckAtomCompliance() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $renderer = new Feed\RSS($this->_validWriter); try { $renderer->render(); - } catch (Zend_Feed_Exception $e) { + } catch (\Zend\Feed\Exception $e) { $this->fail('Valid Writer object caused an exception when building which should never happen'); } } @@ -72,34 +78,32 @@ public function testRenderMethodRunsMinimalWriterContainerProperlyBeforeICheckAt public function testEntryEncodingHasBeenSet() { $this->_validWriter->setEncoding('iso-8859-1'); - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Feed\RSS($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('iso-8859-1', $entry->getEncoding()); } public function testEntryEncodingDefaultIsUsedIfEncodingNotSetByHand() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Feed\RSS($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('UTF-8', $entry->getEncoding()); } public function testEntryTitleHasBeenSet() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Feed\RSS($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('This is a test entry.', $entry->getTitle()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testEntryTitleIfMissingThrowsExceptionIfDescriptionAlsoMissing() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->setExpectedException('Zend\Feed\Exception'); + $atomFeed = new Feed\RSS($this->_validWriter); $this->_validEntry->remove('title'); $this->_validEntry->remove('description'); $atomFeed->render(); @@ -107,27 +111,25 @@ public function testEntryTitleIfMissingThrowsExceptionIfDescriptionAlsoMissing() public function testEntryTitleCharDataEncoding() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $renderer = new Feed\RSS($this->_validWriter); $this->_validEntry->setTitle('<>&\'"áéíóú'); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('<>&\'"áéíóú', $entry->getTitle()); } public function testEntrySummaryDescriptionHasBeenSet() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Feed\RSS($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('This is a test entry description.', $entry->getDescription()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testEntryDescriptionIfMissingThrowsExceptionIfAlsoNoTitle() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->setExpectedException('Zend\Feed\Exception'); + $atomFeed = new Feed\RSS($this->_validWriter); $this->_validEntry->remove('description'); $this->_validEntry->remove('title'); $atomFeed->render(); @@ -135,9 +137,9 @@ public function testEntryDescriptionIfMissingThrowsExceptionIfAlsoNoTitle() public function testEntryDescriptionCharDataEncoding() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $renderer = new Feed\RSS($this->_validWriter); $this->_validEntry->setDescription('<>&\'"áéíóú'); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('<>&\'"áéíóú', $entry->getDescription()); } @@ -145,17 +147,17 @@ public function testEntryDescriptionCharDataEncoding() public function testEntryContentHasBeenSet() { $this->_validEntry->setContent('This is test entry content.'); - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Feed\RSS($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('This is test entry content.', $entry->getContent()); } public function testEntryContentCharDataEncoding() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $renderer = new Feed\RSS($this->_validWriter); $this->_validEntry->setContent('<>&\'"áéíóú'); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('<>&\'"áéíóú', $entry->getContent()); } @@ -163,25 +165,25 @@ public function testEntryContentCharDataEncoding() public function testEntryUpdatedDateHasBeenSet() { $this->_validEntry->setDateModified(1234567890); - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Feed\RSS($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); - $this->assertEquals(1234567890, $entry->getDateModified()->get(Zend_Date::TIMESTAMP)); + $this->assertEquals(1234567890, $entry->getDateModified()->get(Date\Date::TIMESTAMP)); } public function testEntryPublishedDateHasBeenSet() { $this->_validEntry->setDateCreated(1234567000); - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Feed\RSS($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); - $this->assertEquals(1234567000, $entry->getDateCreated()->get(Zend_Date::TIMESTAMP)); + $this->assertEquals(1234567000, $entry->getDateCreated()->get(Date\Date::TIMESTAMP)); } public function testEntryIncludesLinkToHtmlVersionOfFeed() { - $renderer= new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer= new Feed\RSS($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('http://www.example.com/1', $entry->getLink()); } @@ -189,8 +191,8 @@ public function testEntryIncludesLinkToHtmlVersionOfFeed() public function testEntryHoldsAnyAuthorAdded() { $this->_validEntry->addAuthor('Jane', 'jane@example.com', 'http://www.example.com/jane'); - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Feed\RSS($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $author = $entry->getAuthor(); $this->assertEquals(array('name'=>'Jane'), $entry->getAuthor()); @@ -199,8 +201,8 @@ public function testEntryHoldsAnyAuthorAdded() public function testEntryAuthorCharDataEncoding() { $this->_validEntry->addAuthor('<>&\'"áéíóú', 'jane@example.com', 'http://www.example.com/jane'); - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Feed\RSS($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $author = $entry->getAuthor(); $this->assertEquals(array('name'=>'<>&\'"áéíóú'), $entry->getAuthor()); @@ -208,13 +210,13 @@ public function testEntryAuthorCharDataEncoding() public function testEntryHoldsAnyEnclosureAdded() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $renderer = new Feed\RSS($this->_validWriter); $this->_validEntry->setEnclosure(array( 'type' => 'audio/mpeg', 'length' => '1337', 'uri' => 'http://example.com/audio.mp3' )); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $enc = $entry->getEnclosure(); $this->assertEquals('audio/mpeg', $enc->type); @@ -225,8 +227,8 @@ public function testEntryHoldsAnyEnclosureAdded() public function testEntryIdHasBeenSet() { $this->_validEntry->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Feed\RSS($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $entry->getId()); } @@ -238,38 +240,38 @@ public function testEntryIdHasBeenSetWithPermaLinkAsFalseWhenNotUri() public function testEntryIdDefaultIsUsedIfNotSetByHand() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Feed\RSS($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals($entry->getLink(), $entry->getId()); } public function testCommentLinkRendered() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $renderer = new Feed\RSS($this->_validWriter); $this->_validEntry->setCommentLink('http://www.example.com/id/1'); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('http://www.example.com/id/1', $entry->getCommentLink()); } public function testCommentCountRendered() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $renderer = new Feed\RSS($this->_validWriter); $this->_validEntry->setCommentCount(22); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals(22, $entry->getCommentCount()); } public function testCommentFeedLinksRendered() { - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $renderer = new Feed\RSS($this->_validWriter); $this->_validEntry->setCommentFeedLinks(array( array('uri'=>'http://www.example.com/atom/id/1','type'=>'atom'), array('uri'=>'http://www.example.com/rss/id/1','type'=>'rss'), )); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); // Skipped assertion is because RSS has no facility to show Atom feeds without an extension $this->assertEquals('http://www.example.com/rss/id/1', $entry->getCommentFeedLink('rss')); @@ -282,8 +284,8 @@ public function testCategoriesCanBeSet() array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2') )); - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Feed\RSS($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $expected = array( array('term'=>'cat_dog', 'label' => 'cat_dog', 'scheme' => 'http://example.com/schema1'), @@ -301,8 +303,8 @@ public function testCategoriesCharDataEncoding() array('term'=>'<>&\'"áéíóú', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2') )); - $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); - $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); + $renderer = new Feed\RSS($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $expected = array( array('term'=>'<>&\'"áéíóú', 'label' => '<>&\'"áéíóú', 'scheme' => 'http://example.com/schema1'), diff --git a/test/Writer/Renderer/Feed/AtomTest.php b/test/Writer/Renderer/Feed/AtomTest.php index f05c2708..54063133 100644 --- a/test/Writer/Renderer/Feed/AtomTest.php +++ b/test/Writer/Renderer/Feed/AtomTest.php @@ -20,7 +20,13 @@ * @version $Id$ */ - +/** + * @namespace + */ +namespace ZendTest\Feed\Writer\Renderer\Feed; +use Zend\Feed\Writer\Feed; +use Zend\Feed\Writer\Renderer\Feed\Atom; +use Zend\Feed\Reader; /** * @category Zend @@ -31,14 +37,14 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Renderer_Feed_AtomTest extends PHPUnit_Framework_TestCase +class AtomTest extends \PHPUnit_Framework_TestCase { protected $_validWriter = null; public function setUp() { - $this->_validWriter = new Zend_Feed_Writer_Feed; + $this->_validWriter = new Feed\Feed; $this->_validWriter->setTitle('This is a test feed.'); $this->_validWriter->setDescription('This is a test description.'); $this->_validWriter->setDateModified(1234567890); @@ -56,17 +62,17 @@ public function tearDown() public function testSetsWriterInConstructor() { - $writer = new Zend_Feed_Writer_Feed; - $feed = new Zend_Feed_Writer_Renderer_Feed_Atom($writer); - $this->assertTrue($feed->getDataContainer() instanceof Zend_Feed_Writer_Feed); + $writer = new Feed\Feed; + $feed = new Atom\Atom($writer); + $this->assertTrue($feed->getDataContainer() instanceof Feed\Feed); } public function testBuildMethodRunsMinimalWriterContainerProperlyBeforeICheckAtomCompliance() { - $feed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = new Atom\Atom($this->_validWriter); try { $feed->render(); - } catch (Zend_Feed_Exception $e) { + } catch (\Zend\Feed\Exception $e) { $this->fail('Valid Writer object caused an exception when building which should never happen'); } } @@ -74,34 +80,32 @@ public function testBuildMethodRunsMinimalWriterContainerProperlyBeforeICheckAto public function testFeedEncodingHasBeenSet() { $this->_validWriter->setEncoding('iso-8859-1'); - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('iso-8859-1', $feed->getEncoding()); } public function testFeedEncodingDefaultIsUsedIfEncodingNotSetByHand() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('UTF-8', $feed->getEncoding()); } public function testFeedTitleHasBeenSet() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('This is a test feed.', $feed->getTitle()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testFeedTitleIfMissingThrowsException() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->setExpectedException('Zend\Feed\Exception'); + $atomFeed = new Atom\Atom($this->_validWriter); $this->_validWriter->remove('title'); $atomFeed->render(); } @@ -111,24 +115,24 @@ public function testFeedTitleIfMissingThrowsException() */ public function testFeedTitleCharDataEncoding() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $this->_validWriter->setTitle('<>&\'"áéíóú'); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('<>&\'"áéíóú', $feed->getTitle()); } public function testFeedSubtitleHasBeenSet() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('This is a test description.', $feed->getDescription()); } public function testFeedSubtitleThrowsNoExceptionIfMissing() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $this->_validWriter->remove('description'); $atomFeed->render(); } @@ -138,27 +142,25 @@ public function testFeedSubtitleThrowsNoExceptionIfMissing() */ public function testFeedSubtitleCharDataEncoding() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $this->_validWriter->setDescription('<>&\'"áéíóú'); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('<>&\'"áéíóú', $feed->getDescription()); } public function testFeedUpdatedDateHasBeenSet() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); - $this->assertEquals(1234567890, $feed->getDateModified()->get(Zend_Date::TIMESTAMP)); + $feed = Reader\Reader::importString($atomFeed->saveXml()); + $this->assertEquals(1234567890, $feed->getDateModified()->get(\Zend\Date\Date::TIMESTAMP)); } - /** - * @expectedException Zend_Feed_Exception - */ public function testFeedUpdatedDateIfMissingThrowsException() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->setExpectedException('Zend\Feed\Exception'); + $atomFeed = new Atom\Atom($this->_validWriter); $this->_validWriter->remove('dateModified'); $atomFeed->render(); } @@ -166,24 +168,24 @@ public function testFeedUpdatedDateIfMissingThrowsException() public function testFeedGeneratorHasBeenSet() { $this->_validWriter->setGenerator('FooFeedBuilder', '1.00', 'http://www.example.com'); - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('FooFeedBuilder', $feed->getGenerator()); } public function testFeedGeneratorIfMissingThrowsNoException() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $this->_validWriter->remove('generator'); $atomFeed->render(); } public function testFeedGeneratorDefaultIsUsedIfGeneratorNotSetByHand() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); } @@ -193,85 +195,81 @@ public function testFeedGeneratorDefaultIsUsedIfGeneratorNotSetByHand() public function testFeedGeneratorCharDataEncoding() { $this->_validWriter->setGenerator('<>&\'"áéíóú', '1.00', 'http://www.example.com'); - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('<>&\'"áéíóú', $feed->getGenerator()); } public function testFeedLanguageHasBeenSet() { $this->_validWriter->setLanguage('fr'); - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('fr', $feed->getLanguage()); } public function testFeedLanguageIfMissingThrowsNoException() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $this->_validWriter->remove('language'); $atomFeed->render(); } public function testFeedLanguageDefaultIsUsedIfGeneratorNotSetByHand() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals(null, $feed->getLanguage()); } public function testFeedIncludesLinkToHtmlVersionOfFeed() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('http://www.example.com', $feed->getLink()); } public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsNoExceptionIfIdSet() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $this->_validWriter->setId('http://www.example.com'); $this->_validWriter->remove('link'); $atomFeed->render(); } - /** - * @expectedException Zend_Feed_Exception - */ public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsExceptionIfIdMissing() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->setExpectedException('Zend\Feed\Exception'); + $atomFeed = new Atom\Atom($this->_validWriter); $this->_validWriter->remove('link'); $atomFeed->render(); } public function testFeedIncludesLinkToXmlAtomWhereTheFeedWillBeAvailable() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('http://www.example.com/atom', $feed->getFeedLink()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testFeedLinkToXmlAtomWhereTheFeedWillBeAvailableIfMissingThrowsException() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $this->setExpectedException('Zend\Feed\Exception'); + $atomFeed = new Atom\Atom($this->_validWriter); $this->_validWriter->remove('feedLinks'); $atomFeed->render(); } public function testFeedHoldsAnyAuthorAdded() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $author = $feed->getAuthor(); $this->assertEquals(array( 'email'=>'joe@example.com', @@ -284,14 +282,14 @@ public function testFeedHoldsAnyAuthorAdded() */ public function testFeedAuthorCharDataEncoding() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $this->_validWriter->remove('authors'); $this->_validWriter->addAuthor(array( 'email'=>'<>&\'"áéíóú', 'name'=>'<>&\'"áéíóú', 'uri'=>'http://www.example.com/joe')); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $author = $feed->getAuthor(); $this->assertEquals(array( 'email'=>'<>&\'"áéíóú', @@ -312,44 +310,44 @@ public function testFeedAuthorIfNotSetThrowsNoExceptionIfAllEntriesIncludeAtLeas public function testFeedIdHasBeenSet() { $this->_validWriter->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $feed->getId()); } public function testFeedIdDefaultOfHtmlLinkIsUsedIfNotSetByHand() { - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals($feed->getLink(), $feed->getId()); } public function testBaseUrlCanBeSet() { $this->_validWriter->setBaseUrl('http://www.example.com/base'); - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('http://www.example.com/base', $feed->getBaseUrl()); } public function testCopyrightCanBeSet() { $this->_validWriter->setCopyright('Copyright © 2009 Paddy'); - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('Copyright © 2009 Paddy', $feed->getCopyright()); } public function testCopyrightCharDataEncoding() { $this->_validWriter->setCopyright('<>&\'"áéíóú'); - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('<>&\'"áéíóú', $feed->getCopyright()); } @@ -359,9 +357,9 @@ public function testCategoriesCanBeSet() array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2') )); - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $expected = array( array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2', 'label' => 'cat_dog2', 'scheme' => null) @@ -375,9 +373,9 @@ public function testCategoriesCharDataEncoding() array('term'=>'cat_dog', 'label' => '<>&\'"áéíóú', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2') )); - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $expected = array( array('term'=>'cat_dog', 'label' => '<>&\'"áéíóú', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2', 'label' => 'cat_dog2', 'scheme' => null) @@ -390,9 +388,9 @@ public function testHubsCanBeSet() $this->_validWriter->addHubs( array('http://www.example.com/hub', 'http://www.example.com/hub2') ); - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom\Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $expected = array( 'http://www.example.com/hub', 'http://www.example.com/hub2' ); diff --git a/test/Writer/Renderer/Feed/RssTest.php b/test/Writer/Renderer/Feed/RssTest.php index ad17c1a4..c22d4b1f 100644 --- a/test/Writer/Renderer/Feed/RssTest.php +++ b/test/Writer/Renderer/Feed/RssTest.php @@ -20,7 +20,13 @@ * @version $Id$ */ - +/** + * @namespace + */ +namespace ZendTest\Feed\Writer\Renderer\Feed; +use Zend\Feed\Writer\Feed; +use Zend\Feed\Writer\Renderer\Feed as RendererFeed; +use Zend\Feed\Reader; /** * @category Zend @@ -31,14 +37,14 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Renderer_Feed_RssTest extends PHPUnit_Framework_TestCase +class RssTest extends \PHPUnit_Framework_TestCase { protected $_validWriter = null; public function setUp() { - $this->_validWriter = new Zend_Feed_Writer_Feed; + $this->_validWriter = new Feed\Feed; $this->_validWriter->setTitle('This is a test feed.'); $this->_validWriter->setDescription('This is a test description.'); $this->_validWriter->setLink('http://www.example.com'); @@ -53,17 +59,17 @@ public function tearDown() public function testSetsWriterInConstructor() { - $writer = new Zend_Feed_Writer_Feed; - $feed = new Zend_Feed_Writer_Renderer_Feed_Rss($writer); - $this->assertTrue($feed->getDataContainer() instanceof Zend_Feed_Writer_Feed); + $writer = new Feed\Feed; + $feed = new RendererFeed\RSS($writer); + $this->assertTrue($feed->getDataContainer() instanceof Feed\Feed); } public function testBuildMethodRunsMinimalWriterContainerProperlyBeforeICheckRssCompliance() { - $feed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = new RendererFeed\RSS($this->_validWriter); try { $feed->render(); - } catch (Zend_Feed_Exception $e) { + } catch (\Zend\Feed\Exception $e) { $this->fail('Valid Writer object caused an exception when building which should never happen'); } } @@ -71,34 +77,32 @@ public function testBuildMethodRunsMinimalWriterContainerProperlyBeforeICheckRss public function testFeedEncodingHasBeenSet() { $this->_validWriter->setEncoding('iso-8859-1'); - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); $this->assertEquals('iso-8859-1', $feed->getEncoding()); } public function testFeedEncodingDefaultIsUsedIfEncodingNotSetByHand() { - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); $this->assertEquals('UTF-8', $feed->getEncoding()); } public function testFeedTitleHasBeenSet() { - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); $this->assertEquals('This is a test feed.', $feed->getTitle()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testFeedTitleIfMissingThrowsException() { - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->setExpectedException('Zend\Feed\Exception'); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $this->_validWriter->remove('title'); $rssFeed->render(); } @@ -108,27 +112,25 @@ public function testFeedTitleIfMissingThrowsException() */ public function testFeedTitleCharDataEncoding() { - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $this->_validWriter->setTitle('<>&\'"áéíóú'); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); $this->assertEquals('<>&\'"áéíóú', $feed->getTitle()); } public function testFeedDescriptionHasBeenSet() { - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); $this->assertEquals('This is a test description.', $feed->getDescription()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testFeedDescriptionThrowsExceptionIfMissing() { - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->setExpectedException('Zend\Feed\Exception'); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $this->_validWriter->remove('description'); $rssFeed->render(); } @@ -138,25 +140,25 @@ public function testFeedDescriptionThrowsExceptionIfMissing() */ public function testFeedDescriptionCharDataEncoding() { - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $this->_validWriter->setDescription('<>&\'"áéíóú'); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); $this->assertEquals('<>&\'"áéíóú', $feed->getDescription()); } public function testFeedUpdatedDateHasBeenSet() { $this->_validWriter->setDateModified(1234567890); - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); - $this->assertEquals(1234567890, $feed->getDateModified()->get(Zend_Date::TIMESTAMP)); + $feed = Reader\Reader::importString($rssFeed->saveXml()); + $this->assertEquals(1234567890, $feed->getDateModified()->get(\Zend\Date\Date::TIMESTAMP)); } public function testFeedUpdatedDateIfMissingThrowsNoException() { - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $this->_validWriter->remove('dateModified'); $rssFeed->render(); } @@ -164,65 +166,63 @@ public function testFeedUpdatedDateIfMissingThrowsNoException() public function testFeedGeneratorHasBeenSet() { $this->_validWriter->setGenerator('FooFeedBuilder', '1.00', 'http://www.example.com'); - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); $this->assertEquals('FooFeedBuilder 1.00 (http://www.example.com)', $feed->getGenerator()); } public function testFeedGeneratorIfMissingThrowsNoException() { - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $this->_validWriter->remove('generator'); $rssFeed->render(); } public function testFeedGeneratorDefaultIsUsedIfGeneratorNotSetByHand() { - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); - $this->assertEquals('Zend_Feed_Writer ' . Zend_Version::VERSION . ' (http://framework.zend.com)', $feed->getGenerator()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); + $this->assertEquals('Zend_Feed_Writer ' . \Zend\Version::VERSION . ' (http://framework.zend.com)', $feed->getGenerator()); } public function testFeedLanguageHasBeenSet() { $this->_validWriter->setLanguage('fr'); - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); $this->assertEquals('fr', $feed->getLanguage()); } public function testFeedLanguageIfMissingThrowsNoException() { - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $this->_validWriter->remove('language'); $rssFeed->render(); } public function testFeedLanguageDefaultIsUsedIfGeneratorNotSetByHand() { - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); $this->assertEquals(null, $feed->getLanguage()); } public function testFeedIncludesLinkToHtmlVersionOfFeed() { - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); $this->assertEquals('http://www.example.com', $feed->getLink()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsException() { - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->setExpectedException('Zend\Feed\Exception'); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $this->_validWriter->remove('link'); $rssFeed->render(); } @@ -230,15 +230,15 @@ public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsException() public function testFeedIncludesLinkToXmlRssWhereTheFeedWillBeAvailable() { $this->_validWriter->setFeedLink('http://www.example.com/rss', 'rss'); - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); $this->assertEquals('http://www.example.com/rss', $feed->getFeedLink()); } public function testFeedLinkToXmlRssWhereTheFeedWillBeAvailableIfMissingThrowsNoException() { - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $this->_validWriter->remove('feedLinks'); $rssFeed->render(); } @@ -246,9 +246,9 @@ public function testFeedLinkToXmlRssWhereTheFeedWillBeAvailableIfMissingThrowsNo public function testBaseUrlCanBeSet() { $this->_validWriter->setBaseUrl('http://www.example.com/base'); - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); $this->assertEquals('http://www.example.com/base', $feed->getBaseUrl()); } @@ -258,9 +258,9 @@ public function testBaseUrlCanBeSet() public function testFeedHoldsAnyAuthorAdded() { $this->_validWriter->addAuthor('Joe', 'joe@example.com', 'http://www.example.com/joe'); - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $atomFeed = new RendererFeed\RSS($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $author = $feed->getAuthor(); $this->assertEquals(array('name'=>'Joe'), $feed->getAuthor()); } @@ -271,9 +271,9 @@ public function testFeedHoldsAnyAuthorAdded() public function testFeedAuthorCharDataEncoding() { $this->_validWriter->addAuthor('<>&\'"áéíóú', 'joe@example.com', 'http://www.example.com/joe'); - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $atomFeed = new RendererFeed\RSS($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $author = $feed->getAuthor(); $this->assertEquals(array('name'=>'<>&\'"áéíóú'), $feed->getAuthor()); } @@ -281,9 +281,9 @@ public function testFeedAuthorCharDataEncoding() public function testCopyrightCanBeSet() { $this->_validWriter->setCopyright('Copyright © 2009 Paddy'); - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); $this->assertEquals('Copyright © 2009 Paddy', $feed->getCopyright()); } @@ -293,9 +293,9 @@ public function testCopyrightCanBeSet() public function testCopyrightCharDataEncoding() { $this->_validWriter->setCopyright('<>&\'"áéíóú'); - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); $this->assertEquals('<>&\'"áéíóú', $feed->getCopyright()); } @@ -305,9 +305,9 @@ public function testCategoriesCanBeSet() array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2') )); - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); $expected = array( array('term'=>'cat_dog', 'label' => 'cat_dog', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2', 'label' => 'cat_dog2', 'scheme' => null) @@ -324,9 +324,9 @@ public function testCategoriesCharDataEncoding() array('term'=>'<>&\'"áéíóú', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2') )); - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); $expected = array( array('term'=>'<>&\'"áéíóú', 'label' => '<>&\'"áéíóú', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2', 'label' => 'cat_dog2', 'scheme' => null) @@ -339,9 +339,9 @@ public function testHubsCanBeSet() $this->_validWriter->addHubs( array('http://www.example.com/hub', 'http://www.example.com/hub2') ); - $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed = new RendererFeed\RSS($this->_validWriter); $rssFeed->render(); - $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $feed = Reader\Reader::importString($rssFeed->saveXml()); $expected = array( 'http://www.example.com/hub', 'http://www.example.com/hub2' ); From a92879f6709b4cf0e0ebfad764af6f273dc1a6aa Mon Sep 17 00:00:00 2001 From: padraic Date: Tue, 25 May 2010 21:33:38 +0000 Subject: [PATCH 135/238] Adding missing test files for Zend_Feed (last build date tests) git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22297 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Reader/Feed/RssTest.php | 4 ++-- .../Feed/_files/Rss/lastbuilddate/plain/none/rss20.xml | 5 +++++ test/Reader/Feed/_files/Rss/lastbuilddate/plain/rss20.xml | 6 ++++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 test/Reader/Feed/_files/Rss/lastbuilddate/plain/none/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/lastbuilddate/plain/rss20.xml diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index 02aef867..d09d8dee 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -2888,7 +2888,7 @@ public function testGetsImageFromRss091() ), $feed->getImage()); } - public function testGetsImageFromRss10() + /*public function testGetsImageFromRss10() { $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/rss10.xml') @@ -2916,7 +2916,7 @@ public function testGetsImageFromRss090() 'width' => '50', 'description' => 'Image description' ), $feed->getImage()); - } + }*/ /** * Get Image data (Unencoded Text) Missing diff --git a/test/Reader/Feed/_files/Rss/lastbuilddate/plain/none/rss20.xml b/test/Reader/Feed/_files/Rss/lastbuilddate/plain/none/rss20.xml new file mode 100644 index 00000000..c60501ea --- /dev/null +++ b/test/Reader/Feed/_files/Rss/lastbuilddate/plain/none/rss20.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/lastbuilddate/plain/rss20.xml b/test/Reader/Feed/_files/Rss/lastbuilddate/plain/rss20.xml new file mode 100644 index 00000000..5d22fe6e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/lastbuilddate/plain/rss20.xml @@ -0,0 +1,6 @@ + + + + Sat, 07 Mar 2009 08:03:50 +0000 + + From e3b06c9df4d184475122484815cb151f559aa309 Mon Sep 17 00:00:00 2001 From: padraic Date: Wed, 26 May 2010 10:13:34 +0000 Subject: [PATCH 136/238] Zend_Feed_Reader no longer applies html_entity_decode() to content. This is a minor backwards-compatibility break to prevent decoding of HTML entities out of context. Fixes ZF-9141 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22300 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Reader/Entry/Rss.php | 2 -- src/Reader/Extension/Atom/Entry.php | 6 +----- src/Reader/Extension/Atom/Feed.php | 4 +--- src/Reader/Extension/Content/Entry.php | 3 --- src/Reader/Feed/Rss.php | 3 --- test/Reader/Integration/WordpressAtom10Test.php | 4 ++-- test/Reader/Integration/WordpressRss2DcAtomTest.php | 4 ++-- 7 files changed, 6 insertions(+), 20 deletions(-) diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index f6f65b42..a86b9e34 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -340,8 +340,6 @@ public function getDescription() if (!$description) { $description = null; - } else { - $description = html_entity_decode($description, ENT_QUOTES, $this->getEncoding()); } $this->_data['description'] = $description; diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 7e4744a7..87051588 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -260,8 +260,6 @@ public function getDescription() if (!$description) { $description = null; - } else { - $description = html_entity_decode($description, ENT_QUOTES, $this->getEncoding()); } $this->_data['description'] = $description; @@ -425,8 +423,6 @@ public function getTitle() if (!$title) { $title = null; - } else { - $title = html_entity_decode($title, ENT_QUOTES, $this->getEncoding()); } $this->_data['title'] = $title; @@ -544,7 +540,7 @@ public function getCategories() $categoryCollection[] = array( 'term' => $category->getAttribute('term'), 'scheme' => $category->getAttribute('scheme'), - 'label' => html_entity_decode($category->getAttribute('label')) + 'label' => $category->getAttribute('label') ); } } else { diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index 40d28982..c5c25872 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -231,8 +231,6 @@ public function getGenerator() if (!$generator) { $generator = null; - } else { - $generator = html_entity_decode($generator, ENT_QUOTES, $this->getEncoding()); } $this->_data['generator'] = $generator; @@ -466,7 +464,7 @@ public function getCategories() $categoryCollection[] = array( 'term' => $category->getAttribute('term'), 'scheme' => $category->getAttribute('scheme'), - 'label' => html_entity_decode($category->getAttribute('label')) + 'label' => $category->getAttribute('label') ); } } else { diff --git a/src/Reader/Extension/Content/Entry.php b/src/Reader/Extension/Content/Entry.php index 93ca5cd0..40f568bf 100644 --- a/src/Reader/Extension/Content/Entry.php +++ b/src/Reader/Extension/Content/Entry.php @@ -48,9 +48,6 @@ public function getContent() } else { $content = $this->_xpath->evaluate('string('.$this->getXpathPrefix().'/content:encoded)'); } - if ($content) { - $content = html_entity_decode($content, ENT_QUOTES, $this->getEncoding()); - } return $content; } diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 832da768..273347b4 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -577,9 +577,6 @@ public function getGenerator() } else { $generator = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/atom:generator)'); } - if ($generator) { - $generator = html_entity_decode($generator, ENT_QUOTES, $this->getEncoding()); - } } if (empty($generator)) { diff --git a/test/Reader/Integration/WordpressAtom10Test.php b/test/Reader/Integration/WordpressAtom10Test.php index 6672c531..27ec5847 100644 --- a/test/Reader/Integration/WordpressAtom10Test.php +++ b/test/Reader/Integration/WordpressAtom10Test.php @@ -152,7 +152,7 @@ public function testGetsEntryTitle() * Note: The three dots below is actually a single Unicode character * called the "three dot leader". Don't replace in error! */ - $this->assertEquals('Wth… reading books?', $entry->getTitle()); + $this->assertEquals('Wth… reading books?', $entry->getTitle()); } public function testGetsEntryAuthors() @@ -182,7 +182,7 @@ public function testGetsEntryDescription() /** * Note: "’" is not the same as "'" - don't replace in error */ - $this->assertEquals('Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.'."\n\n".'Agile Software Development with Scrum, by Ken Schwaber and Mike Beedle'."\n".'Domain-Driven Design: Tackling Complexity in the [...]', $entry->getDescription()); + $this->assertEquals('Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.'."\n\n".'Agile Software Development with Scrum, by Ken Schwaber and Mike Beedle'."\n".'Domain-Driven Design: Tackling Complexity in the [...]', $entry->getDescription()); } public function testGetsEntryContent() diff --git a/test/Reader/Integration/WordpressRss2DcAtomTest.php b/test/Reader/Integration/WordpressRss2DcAtomTest.php index 7fee4d57..94d04d23 100644 --- a/test/Reader/Integration/WordpressRss2DcAtomTest.php +++ b/test/Reader/Integration/WordpressRss2DcAtomTest.php @@ -174,7 +174,7 @@ public function testGetsEntryDescription() /** * Note: "’" is not the same as "'" - don't replace in error */ - $this->assertEquals('Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.'."\n\n".'Agile Software Development with Scrum, by Ken Schwaber and Mike Beedle'."\n".'Domain-Driven Design: Tackling Complexity in the [...]', $entry->getDescription()); + $this->assertEquals('Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.'."\n\n".'Agile Software Development with Scrum, by Ken Schwaber and Mike Beedle'."\n".'Domain-Driven Design: Tackling Complexity in the [...]', $entry->getDescription()); } public function testGetsEntryContent() @@ -183,7 +183,7 @@ public function testGetsEntryContent() file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); - $this->assertEquals('

Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

'."\n".''."\n".'

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

'."\n", $entry->getContent()); + $this->assertEquals('

Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

'."\n".''."\n".'

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

'."\n", $entry->getContent()); } public function testGetsEntryLinks() From c56e8d4846e87419f398e26cdea86fe341afb174 Mon Sep 17 00:00:00 2001 From: Padraic Brady Date: Sun, 6 Jun 2010 22:56:57 +0100 Subject: [PATCH 137/238] Hard reset back to SVN current HEAD revision --- src/AbstractFeed.php | 256 ----- src/Atom.php | 378 ------- src/Builder/Builder.php | 370 ------- src/Builder/BuilderInterface.php | 55 -- src/Builder/Entry.php | 294 ------ src/Builder/Exception.php | 38 - src/Builder/Header/Header.php | 382 -------- src/Builder/Header/Itunes.php | 267 ----- src/Builder/Header/iTunes.php | 267 ----- src/Element.php | 441 --------- src/Entry/AbstractEntry.php | 113 --- src/Entry/Atom.php | 249 ----- src/Entry/RSS.php | 120 --- src/Entry/Rss.php | 120 --- src/Exception.php | 40 - src/Feed.php | 385 -------- src/PubSubHubbub/CallbackAbstract.php | 302 ------ src/PubSubHubbub/CallbackInterface.php | 74 -- src/PubSubHubbub/Exception.php | 35 - src/PubSubHubbub/HttpResponse.php | 234 ----- src/PubSubHubbub/Model/ModelAbstract.php | 62 -- src/PubSubHubbub/Model/Subscription.php | 134 --- .../Model/SubscriptionInterface.php | 70 -- src/PubSubHubbub/Publisher.php | 414 -------- src/PubSubHubbub/Subscriber/Callback.php | 323 ------ .../PubSubHubbub.php => Pubsubhubbub.php} | 58 +- src/Pubsubhubbub/CallbackAbstract.php | 64 +- src/Pubsubhubbub/CallbackInterface.php | 13 +- src/Pubsubhubbub/Exception.php | 9 +- src/Pubsubhubbub/HttpResponse.php | 24 +- src/Pubsubhubbub/Model/ModelAbstract.php | 25 +- src/Pubsubhubbub/Model/Subscription.php | 36 +- .../Model/SubscriptionInterface.php | 9 +- src/Pubsubhubbub/Publisher.php | 88 +- .../Subscriber.php | 161 +-- src/Pubsubhubbub/Subscriber/Callback.php | 32 +- src/RSS.php | 517 ---------- src/{Reader => }/Reader.php | 186 ++-- src/Reader/{Collection => }/Collection.php | 10 +- src/Reader/Collection/Author.php | 13 +- src/Reader/Collection/Category.php | 13 +- src/Reader/Collection/CollectionAbstract.php | 10 +- src/Reader/Entry/Atom.php | 49 +- src/Reader/Entry/RSS.php | 629 ------------ src/Reader/Entry/Rss.php | 189 ++-- src/Reader/EntryAbstract.php | 36 +- src/Reader/EntryInterface.php | 11 +- src/Reader/Extension/Atom/Entry.php | 114 ++- src/Reader/Extension/Atom/Feed.php | 125 ++- src/Reader/Extension/Content/Entry.php | 25 +- .../Extension/CreativeCommons/Entry.php | 17 +- src/Reader/Extension/CreativeCommons/Feed.php | 11 +- src/Reader/Extension/DublinCore/Entry.php | 43 +- src/Reader/Extension/DublinCore/Feed.php | 43 +- src/Reader/Extension/EntryAbstract.php | 35 +- src/Reader/Extension/FeedAbstract.php | 37 +- src/Reader/Extension/Podcast/Entry.php | 17 +- src/Reader/Extension/Podcast/Feed.php | 13 +- src/Reader/Extension/Slash/Entry.php | 17 +- src/Reader/Extension/Syndication/Feed.php | 23 +- src/Reader/Extension/Thread/Entry.php | 11 +- src/Reader/Extension/WellFormedWeb/Entry.php | 17 +- src/Reader/Feed/{Atom => }/Atom.php | 73 +- src/Reader/Feed/Atom/Source.php | 23 +- src/Reader/Feed/RSS.php | 611 ------------ src/Reader/Feed/Rss.php | 270 +++-- src/Reader/FeedAbstract.php | 71 +- src/Reader/FeedInterface.php | 13 +- src/Reader/FeedSet.php | 28 +- src/Rss.php | 517 ---------- src/{Writer => }/Writer.php | 46 +- src/Writer/Deleted.php | 44 +- src/Writer/Entry.php | 156 +-- .../Exception/InvalidMethodException.php | 11 +- src/Writer/Extension/Atom/Renderer/Feed.php | 19 +- .../Extension/Content/Renderer/Entry.php | 17 +- .../Extension/DublinCore/Renderer/Entry.php | 17 +- .../Extension/DublinCore/Renderer/Feed.php | 17 +- src/Writer/Extension/ITunes/Entry.php | 65 +- src/Writer/Extension/ITunes/Feed.php | 134 +-- .../Extension/ITunes/Renderer/Entry.php | 29 +- src/Writer/Extension/ITunes/Renderer/Feed.php | 37 +- src/Writer/Extension/RendererAbstract.php | 29 +- src/Writer/Extension/RendererInterface.php | 11 +- src/Writer/Extension/Slash/Renderer/Entry.php | 17 +- .../Extension/Threading/Renderer/Entry.php | 21 +- .../WellFormedWeb/Renderer/Entry.php | 17 +- src/Writer/{Feed => }/Feed.php | 86 +- src/Writer/Feed/FeedAbstract.php | 276 ++++-- src/Writer/Renderer/Entry/{Atom => }/Atom.php | 113 +-- src/Writer/Renderer/Entry/Atom/Deleted.php | 30 +- src/Writer/Renderer/Entry/RSS.php | 319 ------ src/Writer/Renderer/Entry/Rss.php | 97 +- src/Writer/Renderer/Feed/{Atom => }/Atom.php | 57 +- .../Renderer/Feed/Atom/AtomAbstract.php | 113 ++- src/Writer/Renderer/Feed/Atom/Source.php | 28 +- src/Writer/Renderer/Feed/RSS.php | 371 ------- src/Writer/Renderer/Feed/Rss.php | 222 ++++- src/Writer/Renderer/RendererAbstract.php | 34 +- src/Writer/Renderer/RendererInterface.php | 11 +- src/Writer/Source.php | 14 +- test/ArrayAccessTest.php | 110 --- test/AtomEntryOnlyTest.php | 56 -- test/AtomPublishingTest.php | 140 --- test/CountTest.php | 63 -- test/ElementTest.php | 175 ---- test/Entry/RSSTest.php | 75 -- test/ImportTest.php | 457 --------- test/IteratorTest.php | 126 --- test/Pubsubhubbub/AllTests.php | 67 ++ test/Pubsubhubbub/PublisherTest.php | 62 +- test/Pubsubhubbub/PubsubhubbubTest.php | 24 +- test/Pubsubhubbub/Subscriber/CallbackTest.php | 70 +- test/Pubsubhubbub/SubscriberHttpTest.php | 24 +- test/Pubsubhubbub/SubscriberTest.php | 76 +- test/Reader/Entry/AtomStandaloneEntryTest.php | 66 +- test/Reader/Entry/AtomTest.php | 116 ++- test/Reader/Entry/CommonTest.php | 43 +- test/Reader/Entry/RssTest.php | 710 +++++++------- .../Rss/datemodified/plain/rss20_en_US.xml | 8 + test/Reader/Feed/AtomSourceTest.php | 62 +- test/Reader/Feed/AtomTest.php | 172 ++-- test/Reader/Feed/CommonTest.php | 44 +- test/Reader/Feed/{RSSTest.php => RssTest.php} | 919 +++++++++++------- .../Atom/feedlink/plain/atom10_NoFeedLink.xml | 3 + .../Feed/_files/Atom/image/plain/atom03.xml | 4 + .../Feed/_files/Atom/image/plain/atom10.xml | 4 + .../_files/Atom/image/plain/none/atom03.xml | 3 + .../_files/Atom/image/plain/none/atom10.xml | 3 + .../Rss/datemodified/plain/rss20_en_US.xml | 6 + .../Rss/feedlink/plain/rss20_NoFeedLink.xml | 6 + .../_files/Rss/image/plain/none/rss090.xml | 7 + .../_files/Rss/image/plain/none/rss091.xml | 5 + .../_files/Rss/image/plain/none/rss092.xml | 5 + .../_files/Rss/image/plain/none/rss093.xml | 5 + .../_files/Rss/image/plain/none/rss094.xml | 5 + .../_files/Rss/image/plain/none/rss10.xml | 7 + .../_files/Rss/image/plain/none/rss20.xml | 5 + .../Feed/_files/Rss/image/plain/rss090.xml | 15 + .../Feed/_files/Rss/image/plain/rss091.xml | 13 + .../Feed/_files/Rss/image/plain/rss092.xml | 13 + .../Feed/_files/Rss/image/plain/rss093.xml | 13 + .../Feed/_files/Rss/image/plain/rss094.xml | 13 + .../Feed/_files/Rss/image/plain/rss10.xml | 15 + .../Feed/_files/Rss/image/plain/rss20.xml | 13 + .../Rss/lastbuilddate/plain/none/rss20.xml | 5 + .../_files/Rss/lastbuilddate/plain/rss20.xml | 6 + .../Integration/H-OnlineComAtom10Test.php | 58 +- test/Reader/Integration/LautDeRdfTest.php | 56 +- test/Reader/Integration/PodcastRss2Test.php | 73 +- .../Integration/WordpressAtom10Test.php | 62 +- .../Integration/WordpressRss2DcAtomTest.php | 55 +- .../_files/My/Extension/JungleBooks/Entry.php | 11 +- .../_files/My/Extension/JungleBooks/Feed.php | 9 +- test/ReaderTest.php | 142 +-- test/Writer/DeletedTest.php | 62 +- test/Writer/EntryTest.php | 244 ++--- test/Writer/Extension/ITunes/EntryTest.php | 100 +- test/Writer/Extension/ITunes/FeedTest.php | 136 ++- test/Writer/FeedTest.php | 462 ++++++--- test/Writer/Renderer/Entry/AtomTest.php | 118 +-- test/Writer/Renderer/Entry/RssTest.php | 174 ++-- test/Writer/Renderer/Feed/AtomTest.php | 170 ++-- test/Writer/Renderer/Feed/RssTest.php | 357 +++++-- test/_files/AtomHOnline.xml | 554 ----------- .../AtomPublishingTest-before-update.xml | 7 - .../AtomPublishingTest-created-entry.xml | 15 - .../AtomPublishingTest-expected-update.xml | 7 - .../AtomPublishingTest-updated-entry.xml | 18 - test/_files/AtomTestGoogle.xml | 148 --- test/_files/AtomTestMozillazine.xml | 213 ---- test/_files/AtomTestOReilly.xml | 214 ---- test/_files/AtomTestPlanetPHP.xml | 125 --- test/_files/AtomTestSample1.xml | 22 - test/_files/AtomTestSample2.xml | 15 - test/_files/AtomTestSample3.xml | 17 - test/_files/AtomTestSample4.xml | 31 - test/_files/RssTest091Sample1.xml | 50 - test/_files/RssTest092Sample1.xml | 103 -- test/_files/RssTest100Sample1.xml | 62 -- test/_files/RssTest100Sample2.xml | 67 -- test/_files/RssTest200Sample1.xml | 41 - test/_files/RssTestCNN.xml | 80 -- test/_files/RssTestHarvardLaw.xml | 142 --- test/_files/RssTestPlanetPHP.xml | 126 --- test/_files/RssTestSlashdot.xml | 178 ---- test/_files/TestAtomFeed.xml | 34 - test/_files/TestAtomFeedEntryOnly.xml | 1 - test/_files/TestAtomFeedNamespaced.xml | 34 - .../_files/TestFeedEntryRssContentEncoded.xml | 61 -- test/_files/htmlPage.html | 16 - 191 files changed, 5196 insertions(+), 15530 deletions(-) delete mode 100644 src/AbstractFeed.php delete mode 100644 src/Atom.php delete mode 100644 src/Builder/Builder.php delete mode 100644 src/Builder/BuilderInterface.php delete mode 100644 src/Builder/Entry.php delete mode 100644 src/Builder/Exception.php delete mode 100644 src/Builder/Header/Header.php delete mode 100644 src/Builder/Header/Itunes.php delete mode 100644 src/Builder/Header/iTunes.php delete mode 100644 src/Element.php delete mode 100644 src/Entry/AbstractEntry.php delete mode 100644 src/Entry/Atom.php delete mode 100644 src/Entry/RSS.php delete mode 100644 src/Entry/Rss.php delete mode 100644 src/Exception.php delete mode 100644 src/Feed.php delete mode 100644 src/PubSubHubbub/CallbackAbstract.php delete mode 100644 src/PubSubHubbub/CallbackInterface.php delete mode 100644 src/PubSubHubbub/Exception.php delete mode 100644 src/PubSubHubbub/HttpResponse.php delete mode 100644 src/PubSubHubbub/Model/ModelAbstract.php delete mode 100644 src/PubSubHubbub/Model/Subscription.php delete mode 100644 src/PubSubHubbub/Model/SubscriptionInterface.php delete mode 100644 src/PubSubHubbub/Publisher.php delete mode 100644 src/PubSubHubbub/Subscriber/Callback.php rename src/{PubSubHubbub/PubSubHubbub.php => Pubsubhubbub.php} (74%) rename src/{PubSubHubbub/Subscriber => Pubsubhubbub}/Subscriber.php (80%) delete mode 100644 src/RSS.php rename src/{Reader => }/Reader.php (77%) rename src/Reader/{Collection => }/Collection.php (86%) delete mode 100644 src/Reader/Entry/RSS.php rename src/Reader/Feed/{Atom => }/Atom.php (81%) delete mode 100644 src/Reader/Feed/RSS.php delete mode 100644 src/Rss.php rename src/{Writer => }/Writer.php (86%) rename src/Writer/{Feed => }/Feed.php (78%) rename src/Writer/Renderer/Entry/{Atom => }/Atom.php (75%) delete mode 100644 src/Writer/Renderer/Entry/RSS.php rename src/Writer/Renderer/Feed/{Atom => }/Atom.php (69%) delete mode 100644 src/Writer/Renderer/Feed/RSS.php delete mode 100644 test/ArrayAccessTest.php delete mode 100644 test/AtomEntryOnlyTest.php delete mode 100644 test/AtomPublishingTest.php delete mode 100644 test/CountTest.php delete mode 100644 test/ElementTest.php delete mode 100644 test/Entry/RSSTest.php delete mode 100644 test/ImportTest.php delete mode 100644 test/IteratorTest.php create mode 100644 test/Pubsubhubbub/AllTests.php create mode 100644 test/Reader/Entry/_files/Rss/datemodified/plain/rss20_en_US.xml rename test/Reader/Feed/{RSSTest.php => RssTest.php} (77%) create mode 100644 test/Reader/Feed/_files/Atom/feedlink/plain/atom10_NoFeedLink.xml create mode 100644 test/Reader/Feed/_files/Atom/image/plain/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/image/plain/atom10.xml create mode 100644 test/Reader/Feed/_files/Atom/image/plain/none/atom03.xml create mode 100644 test/Reader/Feed/_files/Atom/image/plain/none/atom10.xml create mode 100644 test/Reader/Feed/_files/Rss/datemodified/plain/rss20_en_US.xml create mode 100644 test/Reader/Feed/_files/Rss/feedlink/plain/rss20_NoFeedLink.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/none/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/none/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/none/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/none/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/none/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/none/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/none/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/rss090.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/rss091.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/rss092.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/rss093.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/rss094.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/rss10.xml create mode 100644 test/Reader/Feed/_files/Rss/image/plain/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/lastbuilddate/plain/none/rss20.xml create mode 100644 test/Reader/Feed/_files/Rss/lastbuilddate/plain/rss20.xml delete mode 100644 test/_files/AtomHOnline.xml delete mode 100644 test/_files/AtomPublishingTest-before-update.xml delete mode 100644 test/_files/AtomPublishingTest-created-entry.xml delete mode 100644 test/_files/AtomPublishingTest-expected-update.xml delete mode 100644 test/_files/AtomPublishingTest-updated-entry.xml delete mode 100644 test/_files/AtomTestGoogle.xml delete mode 100644 test/_files/AtomTestMozillazine.xml delete mode 100644 test/_files/AtomTestOReilly.xml delete mode 100644 test/_files/AtomTestPlanetPHP.xml delete mode 100644 test/_files/AtomTestSample1.xml delete mode 100644 test/_files/AtomTestSample2.xml delete mode 100644 test/_files/AtomTestSample3.xml delete mode 100644 test/_files/AtomTestSample4.xml delete mode 100644 test/_files/RssTest091Sample1.xml delete mode 100644 test/_files/RssTest092Sample1.xml delete mode 100644 test/_files/RssTest100Sample1.xml delete mode 100644 test/_files/RssTest100Sample2.xml delete mode 100644 test/_files/RssTest200Sample1.xml delete mode 100644 test/_files/RssTestCNN.xml delete mode 100644 test/_files/RssTestHarvardLaw.xml delete mode 100644 test/_files/RssTestPlanetPHP.xml delete mode 100644 test/_files/RssTestSlashdot.xml delete mode 100644 test/_files/TestAtomFeed.xml delete mode 100644 test/_files/TestAtomFeedEntryOnly.xml delete mode 100644 test/_files/TestAtomFeedNamespaced.xml delete mode 100644 test/_files/TestFeedEntryRssContentEncoded.xml delete mode 100644 test/_files/htmlPage.html diff --git a/src/AbstractFeed.php b/src/AbstractFeed.php deleted file mode 100644 index 8e73a826..00000000 --- a/src/AbstractFeed.php +++ /dev/null @@ -1,256 +0,0 @@ -setUri($uri); - $response = $client->request('GET'); - if ($response->getStatus() !== 200) { - throw new Exception('Feed failed to load, got response code ' . $response->getStatus()); - } - $this->_element = $response->getBody(); - $this->__wakeup(); - } elseif ($string !== null) { - // Retrieve the feed from $string - $this->_element = $string; - $this->__wakeup(); - } else { - // Generate the feed from the array - $header = $builder->getHeader(); - $this->_element = new \DOMDocument('1.0', $header['charset']); - $root = $this->_mapFeedHeaders($header); - $this->_mapFeedEntries($root, $builder->getEntries()); - $this->_element = $root; - $this->_buildEntryCache(); - } - } - - - /** - * Load the feed as an XML DOMDocument object - * - * @return void - * @throws \Zend\Feed\Exception - */ - public function __wakeup() - { - @ini_set('track_errors', 1); - $doc = new \DOMDocument; - $status = @$doc->loadXML($this->_element); - @ini_restore('track_errors'); - - if (!$status) { - // prevent the class to generate an undefined variable notice (ZF-2590) - 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)'; - } - } - - throw new Exception("DOMDocument cannot parse XML: $php_errormsg"); - } - - $this->_element = $doc; - } - - - /** - * Prepare for serialiation - * - * @return array - */ - public function __sleep() - { - $this->_element = $this->saveXML(); - - return array('_element'); - } - - - /** - * Cache the individual feed elements so they don't need to be - * searched for on every operation. - * - * @return void - */ - protected function _buildEntryCache() - { - $this->_entries = array(); - foreach ($this->_element->childNodes as $child) { - if ($child->localName == $this->_entryElementName) { - $this->_entries[] = $child; - } - } - } - - - /** - * Get the number of entries in this feed object. - * - * @return integer Entry count. - */ - public function count() - { - return count($this->_entries); - } - - - /** - * Required by the Iterator interface. - * - * @return void - */ - public function rewind() - { - $this->_entryIndex = 0; - } - - - /** - * Required by the Iterator interface. - * - * @return mixed The current row, or null if no rows. - */ - public function current() - { - //$entryClassName = ; - return new $this->_entryClassName( - null, - $this->_entries[$this->_entryIndex] - ); - } - - - /** - * Required by the Iterator interface. - * - * @return mixed The current row number (starts at 0), or NULL if no rows - */ - public function key() - { - return $this->_entryIndex; - } - - - /** - * Required by the Iterator interface. - * - * @return mixed The next row, or null if no more rows. - */ - public function next() - { - ++$this->_entryIndex; - } - - - /** - * Required by the Iterator interface. - * - * @return boolean Whether the iteration is valid - */ - public function valid() - { - return 0 <= $this->_entryIndex && $this->_entryIndex < $this->count(); - } - - /** - * Generate the header of the feed when working in write mode - * - * @param array $array the data to use - * @return DOMElement root node - */ - abstract protected function _mapFeedHeaders($array); - - /** - * Generate the entries of the feed when working in write mode - * - * @param DOMElement $root the root node to use - * @param array $array the data to use - * @return DOMElement root node - */ - abstract protected function _mapFeedEntries(\DOMElement $root, $array); - - /** - * Send feed to a http client with the correct header - * - * @throws \Zend\Feed\Exception if headers have already been sent - * @return void - */ - abstract public function send(); -} diff --git a/src/Atom.php b/src/Atom.php deleted file mode 100644 index 4af9998c..00000000 --- a/src/Atom.php +++ /dev/null @@ -1,378 +0,0 @@ - - * elements). - * - * @var string - */ - protected $_entryElementName = 'entry'; - - /** - * The default namespace for Atom feeds. - * - * @var string - */ - protected $_defaultNamespace = 'atom'; - - - /** - * Override Zend_Feed_Abstract to set up the $_element and $_entries aliases. - * - * @return void - * @throws \Zend\Feed\Exception - */ - public function __wakeup() - { - parent::__wakeup(); - - // Find the base feed element and create an alias to it. - $element = $this->_element->getElementsByTagName('feed')->item(0); - if (!$element) { - // Try to find a single instead. - $element = $this->_element->getElementsByTagName($this->_entryElementName)->item(0); - if (!$element) { - throw new Exception('No root or <' . $this->_entryElementName - . '> element found, cannot parse feed.'); - } - - $doc = new \DOMDocument($this->_element->version, - $this->_element->actualEncoding); - $feed = $doc->appendChild($doc->createElement('feed')); - $feed->appendChild($doc->importNode($element, true)); - $element = $feed; - } - - $this->_element = $element; - - // Find the entries and save a pointer to them for speed and - // simplicity. - $this->_buildEntryCache(); - } - - - /** - * Easy access to tags keyed by "rel" attributes. - * - * If $elt->link() is called with no arguments, we will attempt to - * return the value of the tag(s) like all other - * method-syntax attribute access. If an argument is passed to - * link(), however, then we will return the "href" value of the - * first tag that has a "rel" attribute matching $rel: - * - * $elt->link(): returns the value of the link tag. - * $elt->link('self'): returns the href from the first in the entry. - * - * @param string $rel The "rel" attribute to look for. - * @return mixed - */ - public function link($rel = null) - { - if ($rel === null) { - return parent::__call('link', null); - } - - // index link tags by their "rel" attribute. - $links = parent::__get('link'); - if (!is_array($links)) { - if ($links instanceof Element) { - $links = array($links); - } else { - return $links; - } - } - - foreach ($links as $link) { - if (empty($link['rel'])) { - continue; - } - if ($rel == $link['rel']) { - return $link['href']; - } - } - - return null; - } - - - /** - * Make accessing some individual elements of the feed easier. - * - * Special accessors 'entry' and 'entries' are provided so that if - * you wish to iterate over an Atom feed's entries, you can do so - * using foreach ($feed->entries as $entry) or foreach - * ($feed->entry as $entry). - * - * @param string $var The property to access. - * @return mixed - */ - public function __get($var) - { - switch ($var) { - case 'entry': - // fall through to the next case - case 'entries': - return $this; - - default: - return parent::__get($var); - } - } - - /** - * Generate the header of the feed when working in write mode - * - * @param array $array the data to use - * @return DOMElement root node - */ - protected function _mapFeedHeaders($array) - { - $feed = $this->_element->createElement('feed'); - $feed->setAttribute('xmlns', 'http://www.w3.org/2005/Atom'); - - $id = $this->_element->createElement('id', $array->link); - $feed->appendChild($id); - - $title = $this->_element->createElement('title'); - $title->appendChild($this->_element->createCDATASection($array->title)); - $feed->appendChild($title); - - if (isset($array->author)) { - $author = $this->_element->createElement('author'); - $name = $this->_element->createElement('name', $array->author); - $author->appendChild($name); - if (isset($array->email)) { - $email = $this->_element->createElement('email', $array->email); - $author->appendChild($email); - } - $feed->appendChild($author); - } - - $updated = isset($array->lastUpdate) ? $array->lastUpdate : time(); - $updated = $this->_element->createElement('updated', date(DATE_ATOM, $updated)); - $feed->appendChild($updated); - - if (isset($array->published)) { - $published = $this->_element->createElement('published', date(DATE_ATOM, $array->published)); - $feed->appendChild($published); - } - - $link = $this->_element->createElement('link'); - $link->setAttribute('rel', 'self'); - $link->setAttribute('href', $array->link); - if (isset($array->language)) { - $link->setAttribute('hreflang', $array->language); - } - $feed->appendChild($link); - - if (isset($array->description)) { - $subtitle = $this->_element->createElement('subtitle'); - $subtitle->appendChild($this->_element->createCDATASection($array->description)); - $feed->appendChild($subtitle); - } - - if (isset($array->copyright)) { - $copyright = $this->_element->createElement('rights', $array->copyright); - $feed->appendChild($copyright); - } - - if (isset($array->image)) { - $image = $this->_element->createElement('logo', $array->image); - $feed->appendChild($image); - } - - $generator = !empty($array->generator) ? $array->generator : 'Zend\Feed'; - $generator = $this->_element->createElement('generator', $generator); - $feed->appendChild($generator); - - return $feed; - } - - /** - * Generate the entries of the feed when working in write mode - * - * The following nodes are constructed for each feed entry - * - * url to feed entry - * entry title - * last update - * - * short text - * long version, can contain html - * - * - * @param array $array the data to use - * @param DOMElement $root the root node to use - * @return void - */ - protected function _mapFeedEntries(\DOMElement $root, $array) - { - foreach ($array as $dataentry) { - $entry = $this->_element->createElement('entry'); - - $id = $this->_element->createElement('id', isset($dataentry->guid) ? $dataentry->guid : $dataentry->link); - $entry->appendChild($id); - - $title = $this->_element->createElement('title'); - $title->appendChild($this->_element->createCDATASection($dataentry->title)); - $entry->appendChild($title); - - $updated = isset($dataentry->lastUpdate) ? $dataentry->lastUpdate : time(); - $updated = $this->_element->createElement('updated', date(DATE_ATOM, $updated)); - $entry->appendChild($updated); - - $link = $this->_element->createElement('link'); - $link->setAttribute('rel', 'alternate'); - $link->setAttribute('href', $dataentry->link); - $entry->appendChild($link); - - $summary = $this->_element->createElement('summary'); - $summary->appendChild($this->_element->createCDATASection($dataentry->description)); - $entry->appendChild($summary); - - if (isset($dataentry->content)) { - $content = $this->_element->createElement('content'); - $content->setAttribute('type', 'html'); - $content->appendChild($this->_element->createCDATASection($dataentry->content)); - $entry->appendChild($content); - } - - if (isset($dataentry->category)) { - foreach ($dataentry->category as $category) { - $node = $this->_element->createElement('category'); - $node->setAttribute('term', $category['term']); - if (isset($category['scheme'])) { - $node->setAttribute('scheme', $category['scheme']); - } - $entry->appendChild($node); - } - } - - if (isset($dataentry->source)) { - $source = $this->_element->createElement('source'); - $title = $this->_element->createElement('title', $dataentry->source['title']); - $source->appendChild($title); - $link = $this->_element->createElement('link', $dataentry->source['title']); - $link->setAttribute('rel', 'alternate'); - $link->setAttribute('href', $dataentry->source['url']); - $source->appendChild($link); - } - - if (isset($dataentry->enclosure)) { - foreach ($dataentry->enclosure as $enclosure) { - $node = $this->_element->createElement('link'); - $node->setAttribute('rel', 'enclosure'); - $node->setAttribute('href', $enclosure['url']); - if (isset($enclosure['type'])) { - $node->setAttribute('type', $enclosure['type']); - } - if (isset($enclosure['length'])) { - $node->setAttribute('length', $enclosure['length']); - } - $entry->appendChild($node); - } - } - - if (isset($dataentry->comments)) { - $comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/', - 'wfw:comment', - $dataentry->comments); - $entry->appendChild($comments); - } - if (isset($dataentry->commentRss)) { - $comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/', - 'wfw:commentRss', - $dataentry->commentRss); - $entry->appendChild($comments); - } - - $root->appendChild($entry); - } - } - - /** - * Override Zend_Feed_Element to allow formated feeds - * - * @return string - */ - public function saveXml() - { - // Return a complete document including XML prologue. - $doc = new \DOMDocument($this->_element->ownerDocument->version, - $this->_element->ownerDocument->actualEncoding); - $doc->appendChild($doc->importNode($this->_element, true)); - $doc->formatOutput = true; - - return $doc->saveXML(); - } - - /** - * Send feed to a http client with the correct header - * - * @return void - * @throws \Zend\Feed\Exception if headers have already been sent - */ - public function send() - { - if (headers_sent()) { - throw new Exception('Cannot send ATOM because headers have already been sent.'); - } - - header('Content-Type: application/atom+xml; charset=' . $this->_element->ownerDocument->actualEncoding); - - echo $this->saveXML(); - } -} diff --git a/src/Builder/Builder.php b/src/Builder/Builder.php deleted file mode 100644 index 8d4e78d0..00000000 --- a/src/Builder/Builder.php +++ /dev/null @@ -1,370 +0,0 @@ - - * array( - * 'title' => 'title of the feed', //required - * 'link' => 'canonical url to the feed', //required - * 'lastUpdate' => 'timestamp of the update date', // optional - * 'published' => 'timestamp of the publication date', //optional - * 'charset' => 'charset', // required - * 'description' => 'short description of the feed', //optional - * 'author' => 'author/publisher of the feed', //optional - * 'email' => 'email of the author', //optional - * 'webmaster' => 'email address for person responsible for technical issues' // optional, ignored if atom is used - * 'copyright' => 'copyright notice', //optional - * 'image' => 'url to image', //optional - * 'generator' => 'generator', // optional - * 'language' => 'language the feed is written in', // optional - * 'ttl' => 'how long in minutes a feed can be cached before refreshing', // optional, ignored if atom is used - * 'rating' => 'The PICS rating for the channel.', // optional, ignored if atom is used - * 'cloud' => array( - * 'domain' => 'domain of the cloud, e.g. rpc.sys.com' // required - * 'port' => 'port to connect to' // optional, default to 80 - * 'path' => 'path of the cloud, e.g. /RPC2 //required - * 'registerProcedure' => 'procedure to call, e.g. myCloud.rssPleaseNotify' // required - * 'protocol' => 'protocol to use, e.g. soap or xml-rpc' // required - * ), a cloud to be notified of updates // optional, ignored if atom is used - * 'textInput' => array( - * 'title' => 'the label of the Submit button in the text input area' // required, - * 'description' => 'explains the text input area' // required - * 'name' => 'the name of the text object in the text input area' // required - * 'link' => 'the URL of the CGI script that processes text input requests' // required - * ) // a text input box that can be displayed with the feed // optional, ignored if atom is used - * 'skipHours' => array( - * 'hour in 24 format', // e.g 13 (1pm) - * // up to 24 rows whose value is a number between 0 and 23 - * ) // Hint telling aggregators which hours they can skip // optional, ignored if atom is used - * 'skipDays ' => array( - * 'a day to skip', // e.g Monday - * // up to 7 rows whose value is a Monday, Tuesday, Wednesday, Thursday, Friday, Saturday or Sunday - * ) // Hint telling aggregators which days they can skip // optional, ignored if atom is used - * 'itunes' => array( - * 'author' => 'Artist column' // optional, default to the main author value - * 'owner' => array( - * 'name' => 'name of the owner' // optional, default to main author value - * 'email' => 'email of the owner' // optional, default to main email value - * ) // Owner of the podcast // optional - * 'image' => 'album/podcast art' // optional, default to the main image value - * 'subtitle' => 'short description' // optional, default to the main description value - * 'summary' => 'longer description' // optional, default to the main description value - * 'block' => 'Prevent an episode from appearing (yes|no)' // optional - * 'category' => array( - * array('main' => 'main category', // required - * 'sub' => 'sub category' // optional - * ), - * // up to 3 rows - * ) // 'Category column and in iTunes Music Store Browse' // required - * 'explicit' => 'parental advisory graphic (yes|no|clean)' // optional - * 'keywords' => 'a comma separated list of 12 keywords maximum' // optional - * 'new-feed-url' => 'used to inform iTunes of new feed URL location' // optional - * ) // Itunes extension data // optional, ignored if atom is used - * 'entries' => array( - * array( - * 'title' => 'title of the feed entry', //required - * 'link' => 'url to a feed entry', //required - * 'description' => 'short version of a feed entry', // only text, no html, required - * 'guid' => 'id of the article, if not given link value will used', //optional - * 'content' => 'long version', // can contain html, optional - * 'lastUpdate' => 'timestamp of the publication date', // optional - * 'comments' => 'comments page of the feed entry', // optional - * 'commentRss' => 'the feed url of the associated comments', // optional - * 'source' => array( - * 'title' => 'title of the original source' // required, - * 'url' => 'url of the original source' // required - * ) // original source of the feed entry // optional - * 'category' => array( - * array( - * 'term' => 'first category label' // required, - * 'scheme' => 'url that identifies a categorization scheme' // optional - * ), - * array( - * //data for the second category and so on - * ) - * ) // list of the attached categories // optional - * 'enclosure' => array( - * array( - * 'url' => 'url of the linked enclosure' // required - * 'type' => 'mime type of the enclosure' // optional - * 'length' => 'length of the linked content in octets' // optional - * ), - * array( - * //data for the second enclosure and so on - * ) - * ) // list of the enclosures of the feed entry // optional - * ), - * array( - * //data for the second entry and so on - * ) - * ) - * ); - * - * - * @param array $data - * @return void - */ - public function __construct(array $data) - { - $this->_data = $data; - $this->_createHeader($data); - if (isset($data['entries'])) { - $this->_createEntries($data['entries']); - } - } - - /** - * Returns an instance of Zend_Feed_Builder_Header - * describing the header of the feed - * - * @return \Zend\Feed\Builder\Header\Header - */ - public function getHeader() - { - return $this->_header; - } - - /** - * Returns an array of Zend_Feed_Builder_Entry instances - * describing the entries of the feed - * - * @return array of \Zend\Feed\Builder\Entry - */ - public function getEntries() - { - return $this->_entries; - } - - /** - * Create the Zend_Feed_Builder_Header instance - * - * @param array $data - * @throws \Zend\Feed\Builder\Exception - * @return void - */ - protected function _createHeader(array $data) - { - $mandatories = array('title', 'link', 'charset'); - foreach ($mandatories as $mandatory) { - if (!isset($data[$mandatory])) { - throw new Exception("$mandatory key is missing"); - } - } - $this->_header = new Header\Header($data['title'], $data['link'], $data['charset']); - if (isset($data['lastUpdate'])) { - $this->_header->setLastUpdate($data['lastUpdate']); - } - if (isset($data['published'])) { - $this->_header->setPublishedDate($data['published']); - } - if (isset($data['description'])) { - $this->_header->setDescription($data['description']); - } - if (isset($data['author'])) { - $this->_header->setAuthor($data['author']); - } - if (isset($data['email'])) { - $this->_header->setEmail($data['email']); - } - if (isset($data['webmaster'])) { - $this->_header->setWebmaster($data['webmaster']); - } - if (isset($data['copyright'])) { - $this->_header->setCopyright($data['copyright']); - } - if (isset($data['image'])) { - $this->_header->setImage($data['image']); - } - if (isset($data['generator'])) { - $this->_header->setGenerator($data['generator']); - } - if (isset($data['language'])) { - $this->_header->setLanguage($data['language']); - } - if (isset($data['ttl'])) { - $this->_header->setTtl($data['ttl']); - } - if (isset($data['rating'])) { - $this->_header->setRating($data['rating']); - } - if (isset($data['cloud'])) { - $mandatories = array('domain', 'path', 'registerProcedure', 'protocol'); - foreach ($mandatories as $mandatory) { - if (!isset($data['cloud'][$mandatory])) { - throw new Exception("you have to define $mandatory property of your cloud"); - } - } - $uri_str = 'http://' . $data['cloud']['domain'] . $data['cloud']['path']; - $this->_header->setCloud($uri_str, $data['cloud']['registerProcedure'], $data['cloud']['protocol']); - } - if (isset($data['textInput'])) { - $mandatories = array('title', 'description', 'name', 'link'); - foreach ($mandatories as $mandatory) { - if (!isset($data['textInput'][$mandatory])) { - throw new Exception("you have to define $mandatory property of your textInput"); - } - } - $this->_header->setTextInput($data['textInput']['title'], - $data['textInput']['description'], - $data['textInput']['name'], - $data['textInput']['link']); - } - if (isset($data['skipHours'])) { - $this->_header->setSkipHours($data['skipHours']); - } - if (isset($data['skipDays'])) { - $this->_header->setSkipDays($data['skipDays']); - } - if (isset($data['itunes'])) { - $itunes = new Header\iTunes($data['itunes']['category']); - if (isset($data['itunes']['author'])) { - $itunes->setAuthor($data['itunes']['author']); - } - if (isset($data['itunes']['owner'])) { - $name = isset($data['itunes']['owner']['name']) ? $data['itunes']['owner']['name'] : ''; - $email = isset($data['itunes']['owner']['email']) ? $data['itunes']['owner']['email'] : ''; - $itunes->setOwner($name, $email); - } - if (isset($data['itunes']['image'])) { - $itunes->setImage($data['itunes']['image']); - } - if (isset($data['itunes']['subtitle'])) { - $itunes->setSubtitle($data['itunes']['subtitle']); - } - if (isset($data['itunes']['summary'])) { - $itunes->setSummary($data['itunes']['summary']); - } - if (isset($data['itunes']['block'])) { - $itunes->setBlock($data['itunes']['block']); - } - if (isset($data['itunes']['explicit'])) { - $itunes->setExplicit($data['itunes']['explicit']); - } - if (isset($data['itunes']['keywords'])) { - $itunes->setKeywords($data['itunes']['keywords']); - } - if (isset($data['itunes']['new-feed-url'])) { - $itunes->setNewFeedUrl($data['itunes']['new-feed-url']); - } - - $this->_header->setITunes($itunes); - } - } - - /** - * Create the array of article entries - * - * @param array $data - * @throws \Zend\Feed\Builder\Exception - * @return void - */ - protected function _createEntries(array $data) - { - foreach ($data as $row) { - $mandatories = array('title', 'link', 'description'); - foreach ($mandatories as $mandatory) { - if (!isset($row[$mandatory])) { - throw new Exception("$mandatory key is missing"); - } - } - $entry = new Entry($row['title'], $row['link'], $row['description']); - if (isset($row['author'])) { - $entry->setAuthor($row['author']); - } - if (isset($row['guid'])) { - $entry->setId($row['guid']); - } - if (isset($row['content'])) { - $entry->setContent($row['content']); - } - if (isset($row['lastUpdate'])) { - $entry->setLastUpdate($row['lastUpdate']); - } - if (isset($row['comments'])) { - $entry->setCommentsUrl($row['comments']); - } - if (isset($row['commentRss'])) { - $entry->setCommentsRssUrl($row['commentRss']); - } - if (isset($row['source'])) { - $mandatories = array('title', 'url'); - foreach ($mandatories as $mandatory) { - if (!isset($row['source'][$mandatory])) { - throw new Exception("$mandatory key of source property is missing"); - } - } - $entry->setSource($row['source']['title'], $row['source']['url']); - } - if (isset($row['category'])) { - $entry->setCategories($row['category']); - } - if (isset($row['enclosure'])) { - $entry->setEnclosures($row['enclosure']); - } - - $this->_entries[] = $entry; - } - } -} diff --git a/src/Builder/BuilderInterface.php b/src/Builder/BuilderInterface.php deleted file mode 100644 index a53107a1..00000000 --- a/src/Builder/BuilderInterface.php +++ /dev/null @@ -1,55 +0,0 @@ -offsetSet('title', $title); - $this->offsetSet('link', $link); - $this->offsetSet('description', $description); - $this->setLastUpdate(time()); - } - - /** - * Read only properties accessor - * - * @param string $name property to read - * @return mixed - */ - public function __get($name) - { - if (!$this->offsetExists($name)) { - return NULL; - } - - return $this->offsetGet($name); - } - - /** - * Write properties accessor - * - * @param string $name name of the property to set - * @param mixed $value value to set - * @return void - */ - public function __set($name, $value) - { - $this->offsetSet($name, $value); - } - - /** - * Isset accessor - * - * @param string $key - * @return boolean - */ - public function __isset($key) - { - return $this->offsetExists($key); - } - - /** - * Unset accessor - * - * @param string $key - * @return void - */ - public function __unset($key) - { - if ($this->offsetExists($key)) { - $this->offsetUnset($key); - } - } - - /** - * 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 - * - * @param string $id - * @return \Zend\Feed\Builder\Entry - */ - public function setId($id) - { - $this->offsetSet('guid', $id); - return $this; - } - - /** - * Sets the full html content of the entry - * - * @param string $content - * @return \Zend\Feed\Builder\Entry - */ - public function setContent($content) - { - $this->offsetSet('content', $content); - return $this; - } - - /** - * Timestamp of the update date - * - * @param int $lastUpdate - * @return \Zend\Feed\Builder\Entry - */ - public function setLastUpdate($lastUpdate) - { - $this->offsetSet('lastUpdate', $lastUpdate); - return $this; - } - - /** - * Sets the url of the commented page associated to the entry - * - * @param string $comments - * @return \Zend\Feed\Builder\Entry - */ - public function setCommentsUrl($comments) - { - $this->offsetSet('comments', $comments); - return $this; - } - - /** - * Sets the url of the comments feed link - * - * @param string $commentRss - * @return \Zend\Feed\Builder\Entry - */ - public function setCommentsRssUrl($commentRss) - { - $this->offsetSet('commentRss', $commentRss); - return $this; - } - - /** - * Defines a reference to the original source - * - * @param string $title - * @param string $url - * @return \Zend\Feed\Builder\Entry - */ - public function setSource($title, $url) - { - $this->offsetSet('source', array('title' => $title, - 'url' => $url)); - return $this; - } - - /** - * Sets the categories of the entry - * Format of the array: - * - * array( - * array( - * 'term' => 'first category label', - * 'scheme' => 'url that identifies a categorization scheme' // optional - * ), - * // second category and so one - * ) - * - * - * @param array $categories - * @return \Zend\Feed\Builder\Entry - */ - public function setCategories(array $categories) - { - foreach ($categories as $category) { - $this->addCategory($category); - } - return $this; - } - - /** - * Add a category to the entry - * - * @param array $category see \Zend\Feed\Builder\Entry::setCategories() for format - * @return \Zend\Feed\Builder\Entry - * @throws \Zend\Feed\Builder\Exception - */ - public function addCategory(array $category) - { - if (empty($category['term'])) { - throw new Exception("you have to define the name of the category"); - } - - if (!$this->offsetExists('category')) { - $categories = array($category); - } else { - $categories = $this->offsetGet('category'); - $categories[] = $category; - } - $this->offsetSet('category', $categories); - return $this; - } - - /** - * Sets the enclosures of the entry - * Format of the array: - * - * array( - * array( - * 'url' => 'url of the linked enclosure', - * 'type' => 'mime type of the enclosure' // optional - * 'length' => 'length of the linked content in octets' // optional - * ), - * // second enclosure and so one - * ) - * - * - * @param array $enclosures - * @return \Zend\Feed\Builder\Entry - * @throws \Zend\Feed\Builder\Exception - */ - public function setEnclosures(array $enclosures) - { - foreach ($enclosures as $enclosure) { - if (empty($enclosure['url'])) { - throw new Exception("you have to supply an url for your enclosure"); - } - $type = isset($enclosure['type']) ? $enclosure['type'] : ''; - $length = isset($enclosure['length']) ? $enclosure['length'] : ''; - $this->addEnclosure($enclosure['url'], $type, $length); - } - return $this; - } - - /** - * Add an enclosure to the entry - * - * @param string $url - * @param string $type - * @param string $length - * @return \Zend\Feed\Builder\Entry - */ - public function addEnclosure($url, $type = '', $length = '') - { - if (!$this->offsetExists('enclosure')) { - $enclosure = array(); - } else { - $enclosure = $this->offsetGet('enclosure'); - } - $enclosure[] = array('url' => $url, - 'type' => $type, - 'length' => $length); - $this->offsetSet('enclosure', $enclosure); - return $this; - } -} diff --git a/src/Builder/Exception.php b/src/Builder/Exception.php deleted file mode 100644 index 8d718b04..00000000 --- a/src/Builder/Exception.php +++ /dev/null @@ -1,38 +0,0 @@ -offsetSet('title', $title); - $this->offsetSet('link', $link); - $this->offsetSet('charset', $charset); - $this->setLastUpdate(time()) - ->setGenerator('Zend_Feed'); - } - - /** - * Read only properties accessor - * - * @param string $name property to read - * @return mixed - */ - public function __get($name) - { - if (!$this->offsetExists($name)) { - return NULL; - } - - return $this->offsetGet($name); - } - - /** - * Write properties accessor - * - * @param string $name name of the property to set - * @param mixed $value value to set - * @return void - */ - public function __set($name, $value) - { - $this->offsetSet($name, $value); - } - - /** - * Isset accessor - * - * @param string $key - * @return boolean - */ - public function __isset($key) - { - return $this->offsetExists($key); - } - - /** - * Unset accessor - * - * @param string $key - * @return void - */ - public function __unset($key) - { - if ($this->offsetExists($key)) { - $this->offsetUnset($key); - } - } - - /** - * Timestamp of the update date - * - * @param int $lastUpdate - * @return \Zend\Feed\Builder\Header\Header - */ - public function setLastUpdate($lastUpdate) - { - $this->offsetSet('lastUpdate', $lastUpdate); - return $this; - } - - /** - * Timestamp of the publication date - * - * @param int $published - * @return \Zend\Feed\Builder\Header\Header - */ - public function setPublishedDate($published) - { - $this->offsetSet('published', $published); - return $this; - } - - /** - * Short description of the feed - * - * @param string $description - * @return \Zend\Feed\Builder\Header\Header - */ - public function setDescription($description) - { - $this->offsetSet('description', $description); - return $this; - } - - /** - * Sets the author of the feed - * - * @param string $author - * @return \Zend\Feed\Builder\Header\Header - */ - public function setAuthor($author) - { - $this->offsetSet('author', $author); - return $this; - } - - /** - * Sets the author's email - * - * @param string $email - * @return \Zend\Feed\Builder\Header\Header - * @throws \Zend\Feed\Builder\Exception - */ - public function setEmail($email) - { - $validate = new Validator\EmailAddress(); - if (!$validate->isValid($email)) { - throw new Builder\Exception("you have to set a valid email address into the email property"); - } - $this->offsetSet('email', $email); - return $this; - } - - /** - * Sets the copyright notice - * - * @param string $copyright - * @return \Zend\Feed\Builder\Header\Header - */ - public function setCopyright($copyright) - { - $this->offsetSet('copyright', $copyright); - return $this; - } - - /** - * Sets the image of the feed - * - * @param string $image - * @return \Zend\Feed\Builder\Header\Header - */ - public function setImage($image) - { - $this->offsetSet('image', $image); - return $this; - } - - /** - * Sets the generator of the feed - * - * @param string $generator - * @return \Zend\Feed\Builder\Header\Header - */ - public function setGenerator($generator) - { - $this->offsetSet('generator', $generator); - return $this; - } - - /** - * Sets the language of the feed - * - * @param string $language - * @return \Zend\Feed\Builder\Header\Header - */ - public function setLanguage($language) - { - $this->offsetSet('language', $language); - return $this; - } - - /** - * Email address for person responsible for technical issues - * Ignored if atom is used - * - * @param string $webmaster - * @return \Zend\Feed\Builder\Header\Header - * @throws \Zend\Feed\Builder\Exception - */ - public function setWebmaster($webmaster) - { - $validate = new Validator\EmailAddress(); - if (!$validate->isValid($webmaster)) { - throw new Builder\Exception("you have to set a valid email address into the webmaster property"); - } - $this->offsetSet('webmaster', $webmaster); - return $this; - } - - /** - * How long in minutes a feed can be cached before refreshing - * Ignored if atom is used - * - * @param int $ttl - * @return \Zend\Feed\Builder\Header\Header - * @throws \Zend\Feed\Builder\Exception - */ - public function setTtl($ttl) - { - $validate = new Validator\Int(); - if (!$validate->isValid($ttl)) { - throw new Builder\Exception("you have to set an integer value to the ttl property"); - } - $this->offsetSet('ttl', $ttl); - return $this; - } - - /** - * PICS rating for the feed - * Ignored if atom is used - * - * @param string $rating - * @return \Zend\Feed\Builder\Header\Header - */ - public function setRating($rating) - { - $this->offsetSet('rating', $rating); - return $this; - } - - /** - * Cloud to be notified of updates of the feed - * Ignored if atom is used - * - * @param string|\Zend\URI\URL $uri - * @param string $procedure procedure to call, e.g. myCloud.rssPleaseNotify - * @param string $protocol protocol to use, e.g. soap or xml-rpc - * @return \Zend\Feed\Builder\Header\Header - * @throws \Zend\Feed\Builder\Exception - */ - public function setCloud($uri, $procedure, $protocol) - { - if (is_string($uri)) { - $uri = new \Zend\URI\URL($uri); - } - if (!$uri instanceof URI\URL) { - throw new Builder\Exception('Passed parameter is not a valid HTTP URI'); - } - if (!$uri->getPort()) { - $uri->setPort(80); - } - $this->offsetSet('cloud', array('uri' => $uri, - 'procedure' => $procedure, - 'protocol' => $protocol)); - return $this; - } - - /** - * A text input box that can be displayed with the feed - * Ignored if atom is used - * - * @param string $title the label of the Submit button in the text input area - * @param string $description explains the text input area - * @param string $name the name of the text object in the text input area - * @param string $link the URL of the CGI script that processes text input requests - * @return \Zend\Feed\Builder\Header\Header - */ - public function setTextInput($title, $description, $name, $link) - { - $this->offsetSet('textInput', array('title' => $title, - 'description' => $description, - 'name' => $name, - 'link' => $link)); - return $this; - } - - /** - * Hint telling aggregators which hours they can skip - * Ignored if atom is used - * - * @param array $hours list of hours in 24 format - * @return \Zend\Feed\Builder\Header\Header - * @throws \Zend\Feed\Builder\Exception - */ - public function setSkipHours(array $hours) - { - if (count($hours) > 24) { - throw new Builder\Exception("you can not have more than 24 rows in the skipHours property"); - } - foreach ($hours as $hour) { - if ($hour < 0 || $hour > 23) { - throw new Builder\Exception("$hour has te be between 0 and 23"); - } - } - $this->offsetSet('skipHours', $hours); - return $this; - } - - /** - * Hint telling aggregators which days they can skip - * Ignored if atom is used - * - * @param array $days list of days to skip, e.g. Monday - * @return \Zend\Feed\Builder\Header\Header - * @throws \Zend\Feed\Builder\Exception - */ - public function setSkipDays(array $days) - { - if (count($days) > 7) { - throw new Builder\Exception("you can not have more than 7 days in the skipDays property"); - } - $valid = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'); - foreach ($days as $day) { - if (!in_array(strtolower($day), $valid)) { - throw new Builder\Exception("$day is not a valid day"); - } - } - $this->offsetSet('skipDays', $days); - return $this; - } - - /** - * Sets the iTunes rss extension - * - * @param \Zend\Feed\Builder\Header\iTunes $itunes - * @return \Zend\Feed\Builder\Header\Header - */ - public function setITunes(iTunes $itunes) - { - $this->offsetSet('itunes', $itunes); - return $this; - } -} diff --git a/src/Builder/Header/Itunes.php b/src/Builder/Header/Itunes.php deleted file mode 100644 index ec6f94a6..00000000 --- a/src/Builder/Header/Itunes.php +++ /dev/null @@ -1,267 +0,0 @@ -setCategories($categories); - } - - /** - * Sets the categories column and in iTunes Music Store Browse - * $categories must conform to the following format: - * - * array(array('main' => 'main category', - * 'sub' => 'sub category' // optionnal - * ), - * // up to 3 rows - * ) - * - * - * @param array $categories - * @return \Zend\Feed\Builder\Header\iTunes - * @throws \Zend\Feed\Builder\Exception - */ - public function setCategories(array $categories) - { - $nb = count($categories); - if (0 === $nb) { - throw new Builder\Exception("you have to set at least one itunes category"); - } - if ($nb > 3) { - throw new Builder\Exception("you have to set at most three itunes categories"); - } - foreach ($categories as $i => $category) { - if (empty($category['main'])) { - throw new Builder\Exception("you have to set the main category (category #$i)"); - } - } - $this->offsetSet('category', $categories); - return $this; - } - - /** - * Sets the artist value, default to the feed's author value - * - * @param string $author - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setAuthor($author) - { - $this->offsetSet('author', $author); - return $this; - } - - /** - * Sets the owner of the postcast - * - * @param string $name default to the feed's author value - * @param string $email default to the feed's email value - * @return \Zend\Feed\Builder\Header\iTunes - * @throws \Zend\Feed\Builder\Exception - */ - public function setOwner($name = '', $email = '') - { - if (!empty($email)) { - $validate = new \Zend\Validator\EmailAddress(); - if (!$validate->isValid($email)) { - throw new Builder\Exception("you have to set a valid email address into the itunes owner's email property"); - } - } - $this->offsetSet('owner', array('name' => $name, 'email' => $email)); - return $this; - } - - /** - * Sets the album/podcast art picture - * Default to the feed's image value - * - * @param string $image - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setImage($image) - { - $this->offsetSet('image', $image); - return $this; - } - - /** - * Sets the short description of the podcast - * Default to the feed's description - * - * @param string $subtitle - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setSubtitle($subtitle) - { - $this->offsetSet('subtitle', $subtitle); - return $this; - } - - /** - * Sets the longer description of the podcast - * Default to the feed's description - * - * @param string $summary - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setSummary($summary) - { - $this->offsetSet('summary', $summary); - return $this; - } - - /** - * Prevent a feed from appearing - * - * @param string $block can be 'yes' or 'no' - * @return \Zend\Feed\Builder\Header\iTunes - * @throws \Zend\Feed\Builder\Exception - */ - public function setBlock($block) - { - $block = strtolower($block); - if (!in_array($block, array('yes', 'no'))) { - throw new Builder\Exception("you have to set yes or no to the itunes block property"); - } - $this->offsetSet('block', $block); - return $this; - } - - /** - * Configuration of the parental advisory graphic - * - * @param string $explicit can be 'yes', 'no' or 'clean' - * @return \Zend\Feed\Builder\Header\iTunes - * @throws \Zend\Feed\Builder\Exception - */ - public function setExplicit($explicit) - { - $explicit = strtolower($explicit); - if (!in_array($explicit, array('yes', 'no', 'clean'))) { - throw new Builder\Exception("you have to set yes, no or clean to the itunes explicit property"); - } - $this->offsetSet('explicit', $explicit); - return $this; - } - - /** - * Sets a comma separated list of 12 keywords maximum - * - * @param string $keywords - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setKeywords($keywords) - { - $this->offsetSet('keywords', $keywords); - return $this; - } - - /** - * Sets the new feed URL location - * - * @param string $url - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setNewFeedUrl($url) - { - $this->offsetSet('new_feed_url', $url); - return $this; - } - - /** - * Read only properties accessor - * - * @param string $name property to read - * @return mixed - */ - public function __get($name) - { - if (!$this->offsetExists($name)) { - return NULL; - } - - return $this->offsetGet($name); - } - - /** - * Write properties accessor - * - * @param string $name name of the property to set - * @param mixed $value value to set - * @return void - */ - public function __set($name, $value) - { - $this->offsetSet($name, $value); - } - - /** - * Isset accessor - * - * @param string $key - * @return boolean - */ - public function __isset($key) - { - return $this->offsetExists($key); - } - - /** - * Unset accessor - * - * @param string $key - * @return void - */ - public function __unset($key) - { - if ($this->offsetExists($key)) { - $this->offsetUnset($key); - } - } - -} diff --git a/src/Builder/Header/iTunes.php b/src/Builder/Header/iTunes.php deleted file mode 100644 index ec6f94a6..00000000 --- a/src/Builder/Header/iTunes.php +++ /dev/null @@ -1,267 +0,0 @@ -setCategories($categories); - } - - /** - * Sets the categories column and in iTunes Music Store Browse - * $categories must conform to the following format: - * - * array(array('main' => 'main category', - * 'sub' => 'sub category' // optionnal - * ), - * // up to 3 rows - * ) - * - * - * @param array $categories - * @return \Zend\Feed\Builder\Header\iTunes - * @throws \Zend\Feed\Builder\Exception - */ - public function setCategories(array $categories) - { - $nb = count($categories); - if (0 === $nb) { - throw new Builder\Exception("you have to set at least one itunes category"); - } - if ($nb > 3) { - throw new Builder\Exception("you have to set at most three itunes categories"); - } - foreach ($categories as $i => $category) { - if (empty($category['main'])) { - throw new Builder\Exception("you have to set the main category (category #$i)"); - } - } - $this->offsetSet('category', $categories); - return $this; - } - - /** - * Sets the artist value, default to the feed's author value - * - * @param string $author - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setAuthor($author) - { - $this->offsetSet('author', $author); - return $this; - } - - /** - * Sets the owner of the postcast - * - * @param string $name default to the feed's author value - * @param string $email default to the feed's email value - * @return \Zend\Feed\Builder\Header\iTunes - * @throws \Zend\Feed\Builder\Exception - */ - public function setOwner($name = '', $email = '') - { - if (!empty($email)) { - $validate = new \Zend\Validator\EmailAddress(); - if (!$validate->isValid($email)) { - throw new Builder\Exception("you have to set a valid email address into the itunes owner's email property"); - } - } - $this->offsetSet('owner', array('name' => $name, 'email' => $email)); - return $this; - } - - /** - * Sets the album/podcast art picture - * Default to the feed's image value - * - * @param string $image - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setImage($image) - { - $this->offsetSet('image', $image); - return $this; - } - - /** - * Sets the short description of the podcast - * Default to the feed's description - * - * @param string $subtitle - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setSubtitle($subtitle) - { - $this->offsetSet('subtitle', $subtitle); - return $this; - } - - /** - * Sets the longer description of the podcast - * Default to the feed's description - * - * @param string $summary - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setSummary($summary) - { - $this->offsetSet('summary', $summary); - return $this; - } - - /** - * Prevent a feed from appearing - * - * @param string $block can be 'yes' or 'no' - * @return \Zend\Feed\Builder\Header\iTunes - * @throws \Zend\Feed\Builder\Exception - */ - public function setBlock($block) - { - $block = strtolower($block); - if (!in_array($block, array('yes', 'no'))) { - throw new Builder\Exception("you have to set yes or no to the itunes block property"); - } - $this->offsetSet('block', $block); - return $this; - } - - /** - * Configuration of the parental advisory graphic - * - * @param string $explicit can be 'yes', 'no' or 'clean' - * @return \Zend\Feed\Builder\Header\iTunes - * @throws \Zend\Feed\Builder\Exception - */ - public function setExplicit($explicit) - { - $explicit = strtolower($explicit); - if (!in_array($explicit, array('yes', 'no', 'clean'))) { - throw new Builder\Exception("you have to set yes, no or clean to the itunes explicit property"); - } - $this->offsetSet('explicit', $explicit); - return $this; - } - - /** - * Sets a comma separated list of 12 keywords maximum - * - * @param string $keywords - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setKeywords($keywords) - { - $this->offsetSet('keywords', $keywords); - return $this; - } - - /** - * Sets the new feed URL location - * - * @param string $url - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setNewFeedUrl($url) - { - $this->offsetSet('new_feed_url', $url); - return $this; - } - - /** - * Read only properties accessor - * - * @param string $name property to read - * @return mixed - */ - public function __get($name) - { - if (!$this->offsetExists($name)) { - return NULL; - } - - return $this->offsetGet($name); - } - - /** - * Write properties accessor - * - * @param string $name name of the property to set - * @param mixed $value value to set - * @return void - */ - public function __set($name, $value) - { - $this->offsetSet($name, $value); - } - - /** - * Isset accessor - * - * @param string $key - * @return boolean - */ - public function __isset($key) - { - return $this->offsetExists($key); - } - - /** - * Unset accessor - * - * @param string $key - * @return void - */ - public function __unset($key) - { - if ($this->offsetExists($key)) { - $this->offsetUnset($key); - } - } - -} diff --git a/src/Element.php b/src/Element.php deleted file mode 100644 index ba0ac10e..00000000 --- a/src/Element.php +++ /dev/null @@ -1,441 +0,0 @@ -_element = $element; - } - - - /** - * Get a DOM representation of the element - * - * Returns the underlying DOM object, which can then be - * manipulated with full DOM methods. - * - * @return DOMDocument - */ - public function getDOM() - { - return $this->_element; - } - - - /** - * Update the object from a DOM element - * - * Take a DOMElement object, which may be originally from a call - * to getDOM() or may be custom created, and use it as the - * DOM tree for this Zend_Feed_Element. - * - * @param DOMElement $element - * @return void - */ - public function setDOM(\DOMElement $element) - { - $this->_element = $this->_element->ownerDocument->importNode($element, true); - } - - /** - * Set the parent element of this object to another - * Zend_Feed_Element. - * - * @param \Zend\Feed\Element $element - * @return void - */ - public function setParent(Element $element) - { - $this->_parentElement = $element; - $this->_appended = false; - } - - - /** - * Appends this element to its parent if necessary. - * - * @return void - */ - protected function ensureAppended() - { - if (!$this->_appended) { - $this->_parentElement->getDOM()->appendChild($this->_element); - $this->_appended = true; - $this->_parentElement->ensureAppended(); - } - } - - - /** - * Get an XML string representation of this element - * - * Returns a string of this element's XML, including the XML - * prologue. - * - * @return string - */ - public function saveXml() - { - // Return a complete document including XML prologue. - $doc = new \DOMDocument($this->_element->ownerDocument->version, - $this->_element->ownerDocument->actualEncoding); - $doc->appendChild($doc->importNode($this->_element, true)); - return $doc->saveXML(); - } - - - /** - * Get the XML for only this element - * - * Returns a string of this element's XML without prologue. - * - * @return string - */ - public function saveXmlFragment() - { - return $this->_element->ownerDocument->saveXML($this->_element); - } - - /** - * Get encoding - * - * @return string - */ - public function getEncoding() - { - return $this->_encoding; - } - - /** - * Set encoding - * - * @param string $value Encoding to use - * @return \Zend\Feed\Element - */ - public function setEncoding($value) - { - $this->_encoding = (string) $value; - return $this; - } - - /** - * Map variable access onto the underlying entry representation. - * - * Get-style access returns a Zend_Feed_Element representing the - * child element accessed. To get string values, use method syntax - * with the __call() overriding. - * - * @param string $var The property to access. - * @return mixed - */ - public function __get($var) - { - $nodes = $this->_children($var); - $length = count($nodes); - - if ($length == 1) { - return new Element($nodes[0]); - } elseif ($length > 1) { - return array_map(create_function('$e', 'return new \Zend\Feed\Element($e);'), $nodes); - } else { - // When creating anonymous nodes for __set chaining, don't - // call appendChild() on them. Instead we pass the current - // element to them as an extra reference; the child is - // then responsible for appending itself when it is - // actually set. This way "if ($foo->bar)" doesn't create - // a phantom "bar" element in our tree. - if (strpos($var, ':') !== false) { - list($ns, $elt) = explode(':', $var, 2); - $node = $this->_element->ownerDocument->createElementNS(Feed::lookupNamespace($ns), $elt); - } else { - $node = $this->_element->ownerDocument->createElement($var); - } - $node = new self($node); - $node->setParent($this); - return $node; - } - } - - - /** - * Map variable sets onto the underlying entry representation. - * - * @param string $var The property to change. - * @param string $val The property's new value. - * @return void - * @throws \Zend\Feed\Exception - */ - public function __set($var, $val) - { - $this->ensureAppended(); - - $nodes = $this->_children($var); - if (!$nodes) { - if (strpos($var, ':') !== false) { - list($ns, $elt) = explode(':', $var, 2); - $node = $this->_element->ownerDocument->createElementNS(Feed::lookupNamespace($ns), - $var, htmlspecialchars($val, ENT_NOQUOTES, $this->getEncoding())); - $this->_element->appendChild($node); - } else { - $node = $this->_element->ownerDocument->createElement($var, - htmlspecialchars($val, ENT_NOQUOTES, $this->getEncoding())); - $this->_element->appendChild($node); - } - } elseif (count($nodes) > 1) { - throw new Exception('Cannot set the value of multiple tags simultaneously.'); - } else { - $nodes[0]->nodeValue = $val; - } - } - - - /** - * Map isset calls onto the underlying entry representation. - * - * @param string $var - * @return boolean - */ - public function __isset($var) - { - // Look for access of the form {ns:var}. We don't use - // _children() here because we can break out of the loop - // immediately once we find something. - if (strpos($var, ':') !== false) { - list($ns, $elt) = explode(':', $var, 2); - foreach ($this->_element->childNodes as $child) { - if ($child->localName == $elt && $child->prefix == $ns) { - return true; - } - } - } else { - foreach ($this->_element->childNodes as $child) { - if ($child->localName == $var) { - return true; - } - } - } - } - - - /** - * Get the value of an element with method syntax. - * - * Map method calls to get the string value of the requested - * element. If there are multiple elements that match, this will - * return an array of those objects. - * - * @param string $var The element to get the string value of. - * @param mixed $unused This parameter is not used. - * @return mixed The node's value, null, or an array of nodes. - */ - public function __call($var, $unused) - { - $nodes = $this->_children($var); - - if (!$nodes) { - return null; - } elseif (count($nodes) > 1) { - return $nodes; - } else { - return $nodes[0]->nodeValue; - } - } - - - /** - * Remove all children matching $var. - * - * @param string $var - * @return void - */ - public function __unset($var) - { - $nodes = $this->_children($var); - foreach ($nodes as $node) { - $parent = $node->parentNode; - $parent->removeChild($node); - } - } - - - /** - * Returns the nodeValue of this element when this object is used - * in a string context. - * - * @return string - */ - public function __toString() - { - return $this->_element->nodeValue; - } - - - /** - * Finds children with tagnames matching $var - * - * Similar to SimpleXML's children() method. - * - * @param string $var Tagname to match, can be either namespace:tagName or just tagName. - * @return array - */ - protected function _children($var) - { - $found = array(); - - // Look for access of the form {ns:var}. - if (strpos($var, ':') !== false) { - list($ns, $elt) = explode(':', $var, 2); - foreach ($this->_element->childNodes as $child) { - if ($child->localName == $elt && $child->prefix == $ns) { - $found[] = $child; - } - } - } else { - foreach ($this->_element->childNodes as $child) { - if ($child->localName == $var) { - $found[] = $child; - } - } - } - - return $found; - } - - - /** - * Required by the ArrayAccess interface. - * - * @param string $offset - * @return boolean - */ - public function offsetExists($offset) - { - if (strpos($offset, ':') !== false) { - list($ns, $attr) = explode(':', $offset, 2); - return $this->_element->hasAttributeNS(Feed::lookupNamespace($ns), $attr); - } else { - return $this->_element->hasAttribute($offset); - } - } - - - /** - * Required by the ArrayAccess interface. - * - * @param string $offset - * @return string - */ - public function offsetGet($offset) - { - if (strpos($offset, ':') !== false) { - list($ns, $attr) = explode(':', $offset, 2); - return $this->_element->getAttributeNS(Feed::lookupNamespace($ns), $attr); - } else { - return $this->_element->getAttribute($offset); - } - } - - - /** - * Required by the ArrayAccess interface. - * - * @param string $offset - * @param string $value - * @return string - */ - public function offsetSet($offset, $value) - { - $this->ensureAppended(); - - if (strpos($offset, ':') !== false) { - list($ns, $attr) = explode(':', $offset, 2); - // DOMElement::setAttributeNS() requires $qualifiedName to have a prefix - return $this->_element->setAttributeNS(Feed::lookupNamespace($ns), $offset, $value); - } else { - return $this->_element->setAttribute($offset, $value); - } - } - - - /** - * Required by the ArrayAccess interface. - * - * @param string $offset - * @return boolean - */ - public function offsetUnset($offset) - { - if (strpos($offset, ':') !== false) { - list($ns, $attr) = explode(':', $offset, 2); - return $this->_element->removeAttributeNS(Feed::lookupNamespace($ns), $attr); - } else { - return $this->_element->removeAttribute($offset); - } - } - -} diff --git a/src/Entry/AbstractEntry.php b/src/Entry/AbstractEntry.php deleted file mode 100644 index 756687bf..00000000 --- a/src/Entry/AbstractEntry.php +++ /dev/null @@ -1,113 +0,0 @@ -loadXML($element); - @ini_restore('track_errors'); - - if (!$status) { - // prevent the class to generate an undefined variable notice (ZF-2590) - 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)'; - } - } - - throw new Feed\Exception("DOMDocument cannot parse XML: $php_errormsg"); - } - - $element = $doc->getElementsByTagName($this->_rootElement)->item(0); - if (!$element) { - throw new Feed\Exception('No root <' . $this->_rootElement . '> element found, cannot parse feed.'); - } - } else { - $doc = new \DOMDocument('1.0', 'utf-8'); - if ($this->_rootNamespace !== null) { - $element = $doc->createElementNS(Feed\Feed::lookupNamespace($this->_rootNamespace), $this->_rootElement); - } else { - $element = $doc->createElement($this->_rootElement); - } - } - } - - parent::__construct($element); - } - -} diff --git a/src/Entry/Atom.php b/src/Entry/Atom.php deleted file mode 100644 index f63fd75e..00000000 --- a/src/Entry/Atom.php +++ /dev/null @@ -1,249 +0,0 @@ -link('edit'); - if (!$deleteUri) { - throw new Feed\Exception('Cannot delete entry; no link rel="edit" is present.'); - } - - // DELETE - $client = Feed\Feed::getHttpClient(); - do { - $client->setUri($deleteUri); - if (Feed\Feed::getHttpMethodOverride()) { - $client->setHeader('X-HTTP-Method-Override', 'DELETE'); - $response = $client->request('POST'); - } else { - $response = $client->request('DELETE'); - } - $httpStatus = $response->getStatus(); - switch ((int) $httpStatus / 100) { - // Success - case 2: - return true; - // Redirect - case 3: - $deleteUri = $response->getHeader('Location'); - continue; - // Error - default: - throw new Feed\Exception("Expected response code 2xx, got $httpStatus"); - } - } while (true); - } - - - /** - * Save a new or updated Atom entry. - * - * Save is used to either create new entries or to save changes to - * existing ones. If we have a link rel="edit", we are changing - * an existing entry. In this case we re-serialize the entry and - * PUT it to the edit URI, checking for a 200 OK result. - * - * For posting new entries, you must specify the $postUri - * parameter to save() to tell the object where to post itself. - * We use $postUri and POST the serialized entry there, checking - * for a 201 Created response. If the insert is successful, we - * then parse the response from the POST to get any values that - * the server has generated: an id, an updated time, and its new - * link rel="edit". - * - * @param string $postUri Location to POST for creating new entries. - * @return void - * @throws \Zend\Feed\Exception - */ - public function save($postUri = null) - { - if ($this->id()) { - // If id is set, look for link rel="edit" in the - // entry object and PUT. - $editUri = $this->link('edit'); - if (!$editUri) { - throw new Feed\Exception('Cannot edit entry; no link rel="edit" is present.'); - } - - $client = Feed\Feed::getHttpClient(); - $client->setUri($editUri); - if (Feed\Feed::getHttpMethodOverride()) { - $client->setHeaders(array('X-HTTP-Method-Override: PUT', - 'Content-Type: ' . self::CONTENT_TYPE)); - $client->setRawData($this->saveXML()); - $response = $client->request('POST'); - } else { - $client->setHeaders('Content-Type', self::CONTENT_TYPE); - $client->setRawData($this->saveXML()); - $response = $client->request('PUT'); - } - if ($response->getStatus() !== 200) { - throw new Feed\Exception('Expected response code 200, got ' . $response->getStatus()); - } - } else { - if ($postUri === null) { - throw new Feed\Exception('PostURI must be specified to save new entries.'); - } - $client = Feed\Feed::getHttpClient(); - $client->setUri($postUri); - $client->setHeaders('Content-Type', self::CONTENT_TYPE); - $client->setRawData($this->saveXML()); - $response = $client->request('POST'); - - if ($response->getStatus() !== 201) { - throw new Feed\Exception('Expected response code 201, got ' - . $response->getStatus()); - } - } - - // Update internal properties using $client->responseBody; - @ini_set('track_errors', 1); - $newEntry = new \DOMDocument; - $status = @$newEntry->loadXML($response->getBody()); - @ini_restore('track_errors'); - - if (!$status) { - // prevent the class to generate an undefined variable notice (ZF-2590) - 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)'; - } - } - - throw new Feed\Exception('XML cannot be parsed: ' . $php_errormsg); - } - - $newEntry = $newEntry->getElementsByTagName($this->_rootElement)->item(0); - if (!$newEntry) { - throw new Feed\Exception('No root element found in server response:' - . "\n\n" . $client->responseBody); - } - - if ($this->_element->parentNode) { - $oldElement = $this->_element; - $this->_element = $oldElement->ownerDocument->importNode($newEntry, true); - $oldElement->parentNode->replaceChild($this->_element, $oldElement); - } else { - $this->_element = $newEntry; - } - } - - - /** - * Easy access to tags keyed by "rel" attributes. - * - * If $elt->link() is called with no arguments, we will attempt to - * return the value of the tag(s) like all other - * method-syntax attribute access. If an argument is passed to - * link(), however, then we will return the "href" value of the - * first tag that has a "rel" attribute matching $rel: - * - * $elt->link(): returns the value of the link tag. - * $elt->link('self'): returns the href from the first in the entry. - * - * @param string $rel The "rel" attribute to look for. - * @return mixed - */ - public function link($rel = null) - { - if ($rel === null) { - return parent::__call('link', null); - } - - // index link tags by their "rel" attribute. - $links = parent::__get('link'); - if (!is_array($links)) { - if ($links instanceof Feed\Element) { - $links = array($links); - } else { - return $links; - } - } - - foreach ($links as $link) { - if (empty($link['rel'])) { - $link['rel'] = 'alternate'; // see Atom 1.0 spec - } - if ($rel == $link['rel']) { - return $link['href']; - } - } - - return null; - } - -} diff --git a/src/Entry/RSS.php b/src/Entry/RSS.php deleted file mode 100644 index 7954b5bc..00000000 --- a/src/Entry/RSS.php +++ /dev/null @@ -1,120 +0,0 @@ -_element->lookupPrefix('http://purl.org/rss/1.0/modules/content/'); - return parent::__get("$prefix:encoded"); - default: - return parent::__get($var); - } - } - - /** - * Overwrites parent::_set method to enable write access - * to content:encoded element. - * - * @param string $var The property to change. - * @param string $val The property's new value. - * @return void - */ - public function __set($var, $value) - { - switch ($var) { - case 'content': - parent::__set('content:encoded', $value); - break; - default: - parent::__set($var, $value); - } - } - - /** - * Overwrites parent::_isset method to enable access - * to content:encoded element. - * - * @param string $var - * @return boolean - */ - public function __isset($var) - { - switch ($var) { - case 'content': - // don't use other callback to prevent invalid returned value - return $this->content() !== null; - default: - return parent::__isset($var); - } - } - - /** - * Overwrites parent::_call method to enable read access - * to content:encoded element. - * Please note that method-style write access is not currently supported - * by parent method, consequently this method doesn't as well. - * - * @param string $var The element to get the string value of. - * @param mixed $unused This parameter is not used. - * @return mixed The node's value, null, or an array of nodes. - */ - public function __call($var, $unused) - { - switch ($var) { - case 'content': - $prefix = $this->_element->lookupPrefix('http://purl.org/rss/1.0/modules/content/'); - return parent::__call("$prefix:encoded", $unused); - default: - return parent::__call($var, $unused); - } - } -} diff --git a/src/Entry/Rss.php b/src/Entry/Rss.php deleted file mode 100644 index 7954b5bc..00000000 --- a/src/Entry/Rss.php +++ /dev/null @@ -1,120 +0,0 @@ -_element->lookupPrefix('http://purl.org/rss/1.0/modules/content/'); - return parent::__get("$prefix:encoded"); - default: - return parent::__get($var); - } - } - - /** - * Overwrites parent::_set method to enable write access - * to content:encoded element. - * - * @param string $var The property to change. - * @param string $val The property's new value. - * @return void - */ - public function __set($var, $value) - { - switch ($var) { - case 'content': - parent::__set('content:encoded', $value); - break; - default: - parent::__set($var, $value); - } - } - - /** - * Overwrites parent::_isset method to enable access - * to content:encoded element. - * - * @param string $var - * @return boolean - */ - public function __isset($var) - { - switch ($var) { - case 'content': - // don't use other callback to prevent invalid returned value - return $this->content() !== null; - default: - return parent::__isset($var); - } - } - - /** - * Overwrites parent::_call method to enable read access - * to content:encoded element. - * Please note that method-style write access is not currently supported - * by parent method, consequently this method doesn't as well. - * - * @param string $var The element to get the string value of. - * @param mixed $unused This parameter is not used. - * @return mixed The node's value, null, or an array of nodes. - */ - public function __call($var, $unused) - { - switch ($var) { - case 'content': - $prefix = $this->_element->lookupPrefix('http://purl.org/rss/1.0/modules/content/'); - return parent::__call("$prefix:encoded", $unused); - default: - return parent::__call($var, $unused); - } - } -} diff --git a/src/Exception.php b/src/Exception.php deleted file mode 100644 index 4bfa9ec1..00000000 --- a/src/Exception.php +++ /dev/null @@ -1,40 +0,0 @@ - 'http://a9.com/-/spec/opensearchrss/1.0/', - 'atom' => 'http://www.w3.org/2005/Atom', - 'rss' => 'http://blogs.law.harvard.edu/tech/rss', - ); - - - /** - * Set the HTTP client instance - * - * Sets the HTTP client object to use for retrieving the feeds. - * - * @param \Zend\HTTP\Client $httpClient - * @return void - */ - public static function setHttpClient(HTTP\Client $httpClient) - { - self::$_httpClient = $httpClient; - } - - - /** - * Gets the HTTP client object. If none is set, a new Zend_Http_Client will be used. - * - * @return Zend_Http_Client_Abstract - */ - public static function getHttpClient() - { - if (!self::$_httpClient instanceof HTTP\Client) { - self::$_httpClient = new HTTP\Client(); - } - - return self::$_httpClient; - } - - - /** - * Toggle using POST instead of PUT and DELETE HTTP methods - * - * Some feed implementations do not accept PUT and DELETE HTTP - * methods, or they can't be used because of proxies or other - * measures. This allows turning on using POST where PUT and - * DELETE would normally be used; in addition, an - * X-Method-Override header will be sent with a value of PUT or - * DELETE as appropriate. - * - * @param boolean $override Whether to override PUT and DELETE. - * @return void - */ - public static function setHttpMethodOverride($override = true) - { - self::$_httpMethodOverride = $override; - } - - - /** - * Get the HTTP override state - * - * @return boolean - */ - public static function getHttpMethodOverride() - { - return self::$_httpMethodOverride; - } - - - /** - * Get the full version of a namespace prefix - * - * Looks up a prefix (atom:, etc.) in the list of registered - * namespaces and returns the full namespace URI if - * available. Returns the prefix, unmodified, if it's not - * registered. - * - * @return string - */ - public static function lookupNamespace($prefix) - { - return isset(self::$_namespaces[$prefix]) ? - self::$_namespaces[$prefix] : - $prefix; - } - - - /** - * Add a namespace and prefix to the registered list - * - * Takes a prefix and a full namespace URI and adds them to the - * list of registered namespaces for use by - * Zend_Feed::lookupNamespace(). - * - * @param string $prefix The namespace prefix - * @param string $namespaceURI The full namespace URI - * @return void - */ - public static function registerNamespace($prefix, $namespaceURI) - { - self::$_namespaces[$prefix] = $namespaceURI; - } - - - /** - * Imports a feed located at $uri. - * - * @param string $uri - * @throws \Zend\Feed\Exception - * @return \Zend\Feed\AbstractFeed - */ - public static function import($uri) - { - $client = self::getHttpClient(); - $client->setUri($uri); - $response = $client->request('GET'); - if ($response->getStatus() !== 200) { - throw new Exception('Feed failed to load, got response code ' . $response->getStatus()); - } - $feed = $response->getBody(); - return self::importString($feed); - } - - - /** - * Imports a feed represented by $string. - * - * @param string $string - * @throws \Zend\Feed\Exception - * @return \Zend\Feed\AbstractFeed - */ - public static function importString($string) - { - // Load the feed as an XML DOMDocument object - $libxml_errflag = libxml_use_internal_errors(true); - $doc = new \DOMDocument; - if (trim($string) == '') { - throw new Exception('Document/string being imported' - . ' is an Empty string or comes from an empty HTTP response'); - } - $status = $doc->loadXML($string); - libxml_use_internal_errors($libxml_errflag); - - - if (!$status) { - // prevent the class to generate an undefined variable notice (ZF-2590) - // Build error message - $error = libxml_get_last_error(); - if ($error && $error->message) { - $errormsg = "DOMDocument cannot parse XML: {$error->message}"; - } else { - $errormsg = "DOMDocument cannot parse XML"; - } - - throw new Exception($errormsg); - } - - // Try to find the base feed element or a single of an Atom feed - if ($doc->getElementsByTagName('feed')->item(0) || - $doc->getElementsByTagName('entry')->item(0)) { - // return a newly created Zend_Feed_Atom object - return new Atom(null, $string); - } - - // Try to find the base feed element of an RSS feed - if ($doc->getElementsByTagName('channel')->item(0)) { - // return a newly created Zend_Feed_Rss object - return new RSS(null, $string); - } - - // $string does not appear to be a valid feed of the supported types - throw new Exception('Invalid or unsupported feed format'); - } - - - /** - * Imports a feed from a file located at $filename. - * - * @param string $filename - * @throws \Zend\Feed\Exception - * @return \Zend\Feed\AbstractFeed - */ - public static function importFile($filename) - { - @ini_set('track_errors', 1); - $feed = @file_get_contents($filename); - @ini_restore('track_errors'); - if ($feed === false) { - throw new Exception("File could not be loaded: $php_errormsg"); - } - return self::importString($feed); - } - - - /** - * Attempts to find feeds at $uri referenced by tags. Returns an - * array of the feeds referenced at $uri. - * - * @todo Allow findFeeds() to follow one, but only one, code 302. - * - * @param string $uri - * @throws \Zend\Feed\Exception - * @return array - */ - public static function findFeeds($uri) - { - // Get the HTTP response from $uri and save the contents - $client = self::getHttpClient(); - $client->setUri($uri); - $response = $client->request(); - if ($response->getStatus() !== 200) { - throw new Exception("Failed to access $uri, got response code " . $response->getStatus()); - } - $contents = $response->getBody(); - - // Parse the contents for appropriate tags - @ini_set('track_errors', 1); - $pattern = '~(]+)/?>~i'; - $result = @preg_match_all($pattern, $contents, $matches); - @ini_restore('track_errors'); - if ($result === false) { - throw new Exception("Internal error: $php_errormsg"); - } - - // Try to fetch a feed for each link tag that appears to refer to a feed - $feeds = array(); - if (isset($matches[1]) && count($matches[1]) > 0) { - foreach ($matches[1] as $link) { - // force string to be an utf-8 one - if (!mb_check_encoding($link, 'UTF-8')) { - $link = mb_convert_encoding($link, 'UTF-8'); - } - $xml = @simplexml_load_string(rtrim($link, ' /') . ' />'); - if ($xml === false) { - continue; - } - $attributes = $xml->attributes(); - if (!isset($attributes['rel']) || !@preg_match('~^(?:alternate|service\.feed)~i', $attributes['rel'])) { - continue; - } - if (!isset($attributes['type']) || - !@preg_match('~^application/(?:atom|rss|rdf)\+xml~', $attributes['type'])) { - continue; - } - if (!isset($attributes['href'])) { - continue; - } - try { - // checks if we need to canonize the given uri - try { - $uri = URI\Zend\Uri\Uri::factory((string) $attributes['href']); - } catch (end\URI\Exception $e) { - // canonize the uri - $path = (string) $attributes['href']; - $query = $fragment = ''; - if (substr($path, 0, 1) != '/') { - // add the current root path to this one - $path = rtrim($client->getUri()->getPath(), '/') . '/' . $path; - } - if (strpos($path, '?') !== false) { - list($path, $query) = explode('?', $path, 2); - } - if (strpos($query, '#') !== false) { - list($query, $fragment) = explode('#', $query, 2); - } - $uri = URI\Zend\Uri\Uri::factory($client->getUri(true)); - $uri->setPath($path); - $uri->setQuery($query); - $uri->setFragment($fragment); - } - - $feed = self::import($uri); - } catch (\Exception $e) { - continue; - } - $feeds[$uri->getUri()] = $feed; - } - } - - // Return the fetched feeds - return $feeds; - } - - /** - * Construct a new Zend_Feed_Abstract object from a custom array - * - * @param array $data - * @param string $format (rss|atom) the requested output format - * @return \Zend\Feed\AbstractFeed - */ - public static function importArray(array $data, $format = 'Atom') - { - if (strtolower($format) == 'rss') { - $format = 'RSS'; - } else { - $format = ucfirst(strtolower($format)); - } - $obj = 'Zend\Feed\\' . $format; - - return new $obj(null, null, new Builder\Builder($data)); - } - - /** - * Construct a new Zend_Feed_Abstract object from a Zend_Feed_Builder_Interface data source - * - * @param \Zend\Feed\Builder\BuilderInterface $builder this object will be used to extract the data of the feed - * @param string $format (rss|atom) the requested output format - * @return \Zend\Feed\AbstractFeed - */ - public static function importBuilder(Builder\BuilderInterface $builder, $format = 'atom') - { - if (strtolower($format) == 'rss') { - $format = 'RSS'; - } else { - $format = ucfirst(strtolower($format)); - } - $obj = 'Zend\Feed\\' . $format; - - return new $obj(null, null, $builder); - } -} diff --git a/src/PubSubHubbub/CallbackAbstract.php b/src/PubSubHubbub/CallbackAbstract.php deleted file mode 100644 index 9a8d2764..00000000 --- a/src/PubSubHubbub/CallbackAbstract.php +++ /dev/null @@ -1,302 +0,0 @@ -setConfig($config); - } - } - - /** - * Process any injected configuration options - * - * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance - * @return \Zend\Feed\PubSubHubbub\CallbackAbstract - */ - public function setConfig($config) - { - if ($config instanceof \Zend\Config\Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - throw new Exception('Array or Zend_Config object' - . 'expected, got ' . gettype($config)); - } - if (array_key_exists('storage', $config)) { - $this->setStorage($config['storage']); - } - return $this; - } - - /** - * Send the response, including all headers. - * If you wish to handle this via Zend_Controller, use the getter methods - * to retrieve any data needed to be set on your HTTP Response object, or - * simply give this object the HTTP Response instance to work with for you! - * - * @return void - */ - public function sendResponse() - { - $this->getHttpResponse()->sendResponse(); - } - - /** - * Sets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used - * to background save any verification tokens associated with a subscription - * or other. - * - * @param \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface $storage - * @return \Zend\Feed\PubSubHubbub\CallbackAbstract - */ - public function setStorage(Model\SubscriptionInterface $storage) - { - $this->_storage = $storage; - return $this; - } - - /** - * Gets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used - * to background save any verification tokens associated with a subscription - * or other. - * - * @return \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface - */ - public function getStorage() - { - if ($this->_storage === null) { - throw new Exception('No storage object has been' - . ' set that subclasses Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface'); - } - return $this->_storage; - } - - /** - * An instance of a class handling Http Responses. This is implemented in - * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with - * (i.e. not inherited from) Zend_Controller_Response_Http. - * - * @param Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http $httpResponse - * @return \Zend\Feed\PubSubHubbub\CallbackAbstract - */ - public function setHttpResponse($httpResponse) - { - if (!is_object($httpResponse) - || (!$httpResponse instanceof HttpResponse - && !$httpResponse instanceof \Zend\Controller\Response\Http) - ) { - throw new Exception('HTTP Response object must' - . ' implement one of Zend_Feed_Pubsubhubbub_HttpResponse or' - . ' Zend_Controller_Response_Http'); - } - $this->_httpResponse = $httpResponse; - return $this; - } - - /** - * An instance of a class handling Http Responses. This is implemented in - * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with - * (i.e. not inherited from) Zend_Controller_Response_Http. - * - * @return Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http - */ - public function getHttpResponse() - { - if ($this->_httpResponse === null) { - $this->_httpResponse = new HttpResponse; - } - return $this->_httpResponse; - } - - /** - * Sets the number of Subscribers for which any updates are on behalf of. - * In other words, is this class serving one or more subscribers? How many? - * Defaults to 1 if left unchanged. - * - * @param string|int $count - * @return \Zend\Feed\PubSubHubbub\CallbackAbstract - */ - public function setSubscriberCount($count) - { - $count = intval($count); - if ($count <= 0) { - throw new Exception('Subscriber count must be' - . ' greater than zero'); - } - $this->_subscriberCount = $count; - return $this; - } - - /** - * Gets the number of Subscribers for which any updates are on behalf of. - * In other words, is this class serving one or more subscribers? How many? - * - * @return int - */ - public function getSubscriberCount() - { - return $this->_subscriberCount; - } - - /** - * Attempt to detect the callback URL (specifically the path forward) - */ - protected function _detectCallbackUrl() - { - $callbackUrl = ''; - if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { - $callbackUrl = $_SERVER['HTTP_X_REWRITE_URL']; - } elseif (isset($_SERVER['REQUEST_URI'])) { - $callbackUrl = $_SERVER['REQUEST_URI']; - $scheme = 'http'; - if ($_SERVER['HTTPS'] == 'on') { - $scheme = 'https'; - } - $schemeAndHttpHost = $scheme . '://' . $this->_getHttpHost(); - if (strpos($callbackUrl, $schemeAndHttpHost) === 0) { - $callbackUrl = substr($callbackUrl, strlen($schemeAndHttpHost)); - } - } elseif (isset($_SERVER['ORIG_PATH_INFO'])) { - $callbackUrl= $_SERVER['ORIG_PATH_INFO']; - if (!empty($_SERVER['QUERY_STRING'])) { - $callbackUrl .= '?' . $_SERVER['QUERY_STRING']; - } - } - return $callbackUrl; - } - - /** - * Get the HTTP host - * - * @return string - */ - protected function _getHttpHost() - { - if (!empty($_SERVER['HTTP_HOST'])) { - return $_SERVER['HTTP_HOST']; - } - $scheme = 'http'; - if ($_SERVER['HTTPS'] == 'on') { - $scheme = 'https'; - } - $name = $_SERVER['SERVER_NAME']; - $port = $_SERVER['SERVER_PORT']; - if (($scheme == 'http' && $port == 80) - || ($scheme == 'https' && $port == 443) - ) { - return $name; - } else { - return $name . ':' . $port; - } - } - - /** - * Retrieve a Header value from either $_SERVER or Apache - * - * @param string $header - */ - protected function _getHeader($header) - { - $temp = strtoupper(str_replace('-', '_', $header)); - if (!empty($_SERVER[$temp])) { - return $_SERVER[$temp]; - } - $temp = 'HTTP_' . strtoupper(str_replace('-', '_', $header)); - if (!empty($_SERVER[$temp])) { - return $_SERVER[$temp]; - } - if (function_exists('apache_request_headers')) { - $headers = apache_request_headers(); - if (!empty($headers[$header])) { - return $headers[$header]; - } - } - return false; - } - - /** - * Return the raw body of the request - * - * @return string|false Raw body, or false if not present - */ - protected function _getRawBody() - { - $body = file_get_contents('php://input'); - if (strlen(trim($body)) == 0 && isset($GLOBALS['HTTP_RAW_POST_DATA'])) { - $body = $GLOBALS['HTTP_RAW_POST_DATA']; - } - if (strlen(trim($body)) > 0) { - return $body; - } - return false; - } -} diff --git a/src/PubSubHubbub/CallbackInterface.php b/src/PubSubHubbub/CallbackInterface.php deleted file mode 100644 index 51d82a96..00000000 --- a/src/PubSubHubbub/CallbackInterface.php +++ /dev/null @@ -1,74 +0,0 @@ -sendHeaders(); - echo $this->getBody(); - } - - /** - * Send all headers - * - * Sends any headers specified. If an {@link setHttpResponseCode() HTTP response code} - * has been specified, it is sent with the first header. - * - * @return void - */ - public function sendHeaders() - { - if (count($this->_headers) || (200 != $this->_httpResponseCode)) { - $this->canSendHeaders(true); - } elseif (200 == $this->_httpResponseCode) { - return; - } - $httpCodeSent = false; - foreach ($this->_headers as $header) { - if (!$httpCodeSent && $this->_httpResponseCode) { - header($header['name'] . ': ' . $header['value'], $header['replace'], $this->_httpResponseCode); - $httpCodeSent = true; - } else { - header($header['name'] . ': ' . $header['value'], $header['replace']); - } - } - if (!$httpCodeSent) { - header('HTTP/1.1 ' . $this->_httpResponseCode); - $httpCodeSent = true; - } - } - - /** - * Set a header - * - * If $replace is true, replaces any headers already defined with that - * $name. - * - * @param string $name - * @param string $value - * @param boolean $replace - * @return \Zend\Feed\PubSubHubbub\HttpResponse - */ - public function setHeader($name, $value, $replace = false) - { - $name = $this->_normalizeHeader($name); - $value = (string) $value; - if ($replace) { - foreach ($this->_headers as $key => $header) { - if ($name == $header['name']) { - unset($this->_headers[$key]); - } - } - } - $this->_headers[] = array( - 'name' => $name, - 'value' => $value, - 'replace' => $replace, - ); - - return $this; - } - - /** - * Check if a specific Header is set and return its value - * - * @param string $name - * @return string|null - */ - public function getHeader($name) - { - $name = $this->_normalizeHeader($name); - foreach ($this->_headers as $header) { - if ($header['name'] == $name) { - return $header['value']; - } - } - } - - /** - * Return array of headers; see {@link $_headers} for format - * - * @return array - */ - public function getHeaders() - { - return $this->_headers; - } - - /** - * Can we send headers? - * - * @param boolean $throw Whether or not to throw an exception if headers have been sent; defaults to false - * @return boolean - * @throws \Zend\Feed\PubSubHubbub\Exception - */ - public function canSendHeaders($throw = false) - { - $ok = headers_sent($file, $line); - if ($ok && $throw) { - throw new Exception('Cannot send headers; headers already sent in ' . $file . ', line ' . $line); - } - return !$ok; - } - - /** - * Set HTTP response code to use with headers - * - * @param int $code - * @return \Zend\Feed\PubSubHubbub\HttpResponse - */ - public function setHttpResponseCode($code) - { - if (!is_int($code) || (100 > $code) || (599 < $code)) { - throw new Exception('Invalid HTTP response' - . ' code:' . $code); - } - $this->_httpResponseCode = $code; - return $this; - } - - /** - * Retrieve HTTP response code - * - * @return int - */ - public function getHttpResponseCode() - { - return $this->_httpResponseCode; - } - - /** - * Set body content - * - * @param string $content - * @return \Zend\Feed\PubSubHubbub\HttpResponse - */ - public function setBody($content) - { - $this->_body = (string) $content; - $this->setHeader('content-length', strlen($content)); - return $this; - } - - /** - * Return the body content - * - * @return string - */ - public function getBody() - { - return $this->_body; - } - - /** - * Normalizes a header name to X-Capitalized-Names - * - * @param string $name - * @return string - */ - protected function _normalizeHeader($name) - { - $filtered = str_replace(array('-', '_'), ' ', (string) $name); - $filtered = ucwords(strtolower($filtered)); - $filtered = str_replace(' ', '-', $filtered); - return $filtered; - } -} diff --git a/src/PubSubHubbub/Model/ModelAbstract.php b/src/PubSubHubbub/Model/ModelAbstract.php deleted file mode 100644 index a9c897f1..00000000 --- a/src/PubSubHubbub/Model/ModelAbstract.php +++ /dev/null @@ -1,62 +0,0 @@ -_db = new \Zend\DB\Table\Table($table); - } else { - $this->_db = $tableGateway; - } - } - -} diff --git a/src/PubSubHubbub/Model/Subscription.php b/src/PubSubHubbub/Model/Subscription.php deleted file mode 100644 index cc049378..00000000 --- a/src/PubSubHubbub/Model/Subscription.php +++ /dev/null @@ -1,134 +0,0 @@ -_db->find($data['id']); - if ($result) { - $data['created_time'] = $result->current()->created_time; - $now = new Date\Date; - if ($data['lease_seconds']) { - $data['expiration_time'] = $now->add($data['lease_seconds'], Date\Date::SECOND) - ->get('yyyy-MM-dd HH:mm:ss'); - } - $this->_db->update( - $data, - $this->_db->getAdapter()->quoteInto('id = ?', $data['id']) - ); - return false; - } - - $this->_db->insert($data); - return true; - } - - /** - * Get subscription by ID/key - * - * @param string $key - * @return array - */ - public function getSubscription($key) - { - if (empty($key) || !is_string($key)) { - throw new PubSubHubbub\Exception('Invalid parameter "key"' - .' of "' . $key . '" must be a non-empty string'); - } - $result = $this->_db->find($key); - if ($result) { - return (array) $result->current(); - } - return false; - } - - /** - * Determine if a subscription matching the key exists - * - * @param string $key - * @return bool - */ - public function hasSubscription($key) - { - if (empty($key) || !is_string($key)) { - throw new PubSubHubbub\Exception('Invalid parameter "key"' - .' of "' . $key . '" must be a non-empty string'); - } - $result = $this->_db->find($key); - if ($result) { - return true; - } - return false; - } - - /** - * Delete a subscription - * - * @param string $key - * @return bool - */ - public function deleteSubscription($key) - { - $result = $this->_db->find($key); - if ($result) { - $this->_db->delete( - $this->_db->getAdapter()->quoteInto('id = ?', $key) - ); - return true; - } - return false; - } - -} diff --git a/src/PubSubHubbub/Model/SubscriptionInterface.php b/src/PubSubHubbub/Model/SubscriptionInterface.php deleted file mode 100644 index bf318407..00000000 --- a/src/PubSubHubbub/Model/SubscriptionInterface.php +++ /dev/null @@ -1,70 +0,0 @@ -setConfig($config); - } - } - - /** - * Process any injected configuration options - * - * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance - * @return \Zend\Feed\PubSubHubbub\Publisher - */ - public function setConfig($config) - { - if ($config instanceof \Zend\Config\Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - throw new Exception('Array or Zend_Config object' - . 'expected, got ' . gettype($config)); - } - if (array_key_exists('hubUrls', $config)) { - $this->addHubUrls($config['hubUrls']); - } - if (array_key_exists('updatedTopicUrls', $config)) { - $this->addUpdatedTopicUrls($config['updatedTopicUrls']); - } - if (array_key_exists('parameters', $config)) { - $this->setParameters($config['parameters']); - } - return $this; - } - - /** - * Add a Hub Server URL supported by Publisher - * - * @param string $url - * @return \Zend\Feed\PubSubHubbub\Publisher - */ - public function addHubUrl($url) - { - if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { - throw new Exception('Invalid parameter "url"' - .' of "' . $url . '" must be a non-empty string and a valid' - .'URL'); - } - $this->_hubUrls[] = $url; - return $this; - } - - /** - * Add an array of Hub Server URLs supported by Publisher - * - * @param array $urls - * @return \Zend\Feed\PubSubHubbub\Publisher - */ - public function addHubUrls(array $urls) - { - foreach ($urls as $url) { - $this->addHubUrl($url); - } - return $this; - } - - /** - * Remove a Hub Server URL - * - * @param string $url - * @return \Zend\Feed\PubSubHubbub\Publisher - */ - public function removeHubUrl($url) - { - if (!in_array($url, $this->getHubUrls())) { - return $this; - } - $key = array_search($url, $this->_hubUrls); - unset($this->_hubUrls[$key]); - return $this; - } - - /** - * Return an array of unique Hub Server URLs currently available - * - * @return array - */ - public function getHubUrls() - { - $this->_hubUrls = array_unique($this->_hubUrls); - return $this->_hubUrls; - } - - /** - * Add a URL to a topic (Atom or RSS feed) which has been updated - * - * @param string $url - * @return \Zend\Feed\PubSubHubbub\Publisher - */ - public function addUpdatedTopicUrl($url) - { - if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { - throw new Exception('Invalid parameter "url"' - .' of "' . $url . '" must be a non-empty string and a valid' - .'URL'); - } - $this->_updatedTopicUrls[] = $url; - return $this; - } - - /** - * Add an array of Topic URLs which have been updated - * - * @param array $urls - * @return \Zend\Feed\PubSubHubbub\Publisher - */ - public function addUpdatedTopicUrls(array $urls) - { - foreach ($urls as $url) { - $this->addUpdatedTopicUrl($url); - } - return $this; - } - - /** - * Remove an updated topic URL - * - * @param string $url - * @return \Zend\Feed\PubSubHubbub\Publisher - */ - public function removeUpdatedTopicUrl($url) - { - if (!in_array($url, $this->getUpdatedTopicUrls())) { - return $this; - } - $key = array_search($url, $this->_updatedTopicUrls); - unset($this->_updatedTopicUrls[$key]); - return $this; - } - - /** - * Return an array of unique updated topic URLs currently available - * - * @return array - */ - public function getUpdatedTopicUrls() - { - $this->_updatedTopicUrls = array_unique($this->_updatedTopicUrls); - return $this->_updatedTopicUrls; - } - - /** - * Notifies a single Hub Server URL of changes - * - * @param string $url The Hub Server's URL - * @return void - * @throws \Zend\Feed\PubSubHubbub\Exception Thrown on failure - */ - public function notifyHub($url) - { - if (empty($url) || !is_string($url) || !URI\Zend\Uri\Uri::check($url)) { - throw new Exception('Invalid parameter "url"' - .' of "' . $url . '" must be a non-empty string and a valid' - .'URL'); - } - $client = $this->_getHttpClient(); - $client->setUri($url); - $response = $client->request(); - if ($response->getStatus() !== 204) { - throw new Exception('Notification to Hub Server ' - . 'at "' . $url . '" appears to have failed with a status code of "' - . $response->getStatus() . '" and message "' - . $response->getMessage() . '"'); - } - } - - /** - * Notifies all Hub Server URLs of changes - * - * If a Hub notification fails, certain data will be retained in an - * an array retrieved using getErrors(), if a failure occurs for any Hubs - * the isSuccess() check will return FALSE. This method is designed not - * to needlessly fail with an Exception/Error unless from Zend_Http_Client. - * - * @return void - * @throws \Zend\Feed\PubSubHubbub\Exception Thrown if no hubs attached - */ - public function notifyAll() - { - $client = $this->_getHttpClient(); - $hubs = $this->getHubUrls(); - if (empty($hubs)) { - throw new Exception('No Hub Server URLs' - . ' have been set so no notifcations can be sent'); - } - $this->_errors = array(); - foreach ($hubs as $url) { - $client->setUri($url); - $response = $client->request(); - if ($response->getStatus() !== 204) { - $this->_errors[] = array( - 'response' => $response, - 'hubUrl' => $url - ); - } - } - } - - /** - * Add an optional parameter to the update notification requests - * - * @param string $name - * @param string|null $value - * @return \Zend\Feed\PubSubHubbub\Publisher - */ - public function setParameter($name, $value = null) - { - if (is_array($name)) { - $this->setParameters($name); - return $this; - } - if (empty($name) || !is_string($name)) { - throw new Exception('Invalid parameter "name"' - .' of "' . $name . '" must be a non-empty string'); - } - if ($value === null) { - $this->removeParameter($name); - return $this; - } - if (empty($value) || (!is_string($value) && !is_null($value))) { - throw new Exception('Invalid parameter "value"' - .' of "' . $value . '" must be a non-empty string'); - } - $this->_parameters[$name] = $value; - return $this; - } - - /** - * Add an optional parameter to the update notification requests - * - * @param array $parameters - * @return \Zend\Feed\PubSubHubbub\Publisher - */ - public function setParameters(array $parameters) - { - foreach ($parameters as $name => $value) { - $this->setParameter($name, $value); - } - return $this; - } - - /** - * Remove an optional parameter for the notification requests - * - * @param string $name - * @return \Zend\Feed\PubSubHubbub\Publisher - */ - public function removeParameter($name) - { - if (empty($name) || !is_string($name)) { - throw new Exception('Invalid parameter "name"' - .' of "' . $name . '" must be a non-empty string'); - } - if (array_key_exists($name, $this->_parameters)) { - unset($this->_parameters[$name]); - } - return $this; - } - - /** - * Return an array of optional parameters for notification requests - * - * @return array - */ - public function getParameters() - { - return $this->_parameters; - } - - /** - * Returns a boolean indicator of whether the notifications to Hub - * Servers were ALL successful. If even one failed, FALSE is returned. - * - * @return bool - */ - public function isSuccess() - { - if (count($this->_errors) > 0) { - return false; - } - return true; - } - - /** - * Return an array of errors met from any failures, including keys: - * 'response' => the Zend_Http_Response object from the failure - * 'hubUrl' => the URL of the Hub Server whose notification failed - * - * @return array - */ - public function getErrors() - { - return $this->_errors; - } - - /** - * Get a basic prepared HTTP client for use - * - * @return \Zend\HTTP\Client - */ - protected function _getHttpClient() - { - $client = PubSubHubbub::getHttpClient(); - $client->setMethod(\Zend\HTTP\Client::POST); - $client->setConfig(array( - 'useragent' => 'Zend_Feed_Pubsubhubbub_Publisher/' . \Zend\Version::VERSION, - )); - $params = array(); - $params[] = 'hub.mode=publish'; - $topics = $this->getUpdatedTopicUrls(); - if (empty($topics)) { - throw new Exception('No updated topic URLs' - . ' have been set'); - } - foreach ($topics as $topicUrl) { - $params[] = 'hub.url=' . urlencode($topicUrl); - } - $optParams = $this->getParameters(); - foreach ($optParams as $name => $value) { - $params[] = urlencode($name) . '=' . urlencode($value); - } - $paramString = implode('&', $params); - $client->setRawData($paramString); - return $client; - } -} diff --git a/src/PubSubHubbub/Subscriber/Callback.php b/src/PubSubHubbub/Subscriber/Callback.php deleted file mode 100644 index a29850cd..00000000 --- a/src/PubSubHubbub/Subscriber/Callback.php +++ /dev/null @@ -1,323 +0,0 @@ -_subscriptionKey = $key; - return $this; - } - - /** - * Handle any callback from a Hub Server responding to a subscription or - * unsubscription request. This should be the Hub Server confirming the - * the request prior to taking action on it. - * - * @param array $httpGetData GET data if available and not in $_GET - * @param bool $sendResponseNow Whether to send response now or when asked - * @return void - */ - public function handle(array $httpGetData = null, $sendResponseNow = false) - { - if ($httpGetData === null) { - $httpGetData = $_GET; - } - - /** - * Handle any feed updates (sorry for the mess :P) - * - * This DOES NOT attempt to process a feed update. Feed updates - * SHOULD be validated/processed by an asynchronous process so as - * to avoid holding up responses to the Hub. - */ - if (strtolower($_SERVER['REQUEST_METHOD']) == 'post' - && $this->_hasValidVerifyToken(null, false) - && ($this->_getHeader('Content-Type') == 'application/atom+xml' - || $this->_getHeader('Content-Type') == 'application/rss+xml' - || $this->_getHeader('Content-Type') == 'application/xml' - || $this->_getHeader('Content-Type') == 'text/xml' - || $this->_getHeader('Content-Type') == 'application/rdf+xml') - ) { - $this->setFeedUpdate($this->_getRawBody()); - $this->getHttpResponse() - ->setHeader('X-Hub-On-Behalf-Of', $this->getSubscriberCount()); - /** - * Handle any (un)subscribe confirmation requests - */ - } elseif ($this->isValidHubVerification($httpGetData)) { - $data = $this->_currentSubscriptionData; - $this->getHttpResponse()->setBody($httpGetData['hub_challenge']); - $data['subscription_state'] = \Zend\Feed\PubSubHubbub\PubSubHubbub::SUBSCRIPTION_VERIFIED; - if (isset($httpGetData['hub_lease_seconds'])) { - $data['lease_seconds'] = $httpGetData['hub_lease_seconds']; - } - $this->getStorage()->setSubscription($data); - /** - * Hey, C'mon! We tried everything else! - */ - } else { - $this->getHttpResponse()->setHttpResponseCode(404); - } - if ($sendResponseNow) { - $this->sendResponse(); - } - } - - /** - * Checks validity of the request simply by making a quick pass and - * confirming the presence of all REQUIRED parameters. - * - * @param array $httpGetData - * @return bool - */ - public function isValidHubVerification(array $httpGetData) - { - /** - * As per the specification, the hub.verify_token is OPTIONAL. This - * implementation of Pubsubhubbub considers it REQUIRED and will - * always send a hub.verify_token parameter to be echoed back - * by the Hub Server. Therefore, its absence is considered invalid. - */ - if (strtolower($_SERVER['REQUEST_METHOD']) !== 'get') { - return false; - } - $required = array( - 'hub_mode', - 'hub_topic', - 'hub_challenge', - 'hub_verify_token', - ); - foreach ($required as $key) { - if (!array_key_exists($key, $httpGetData)) { - return false; - } - } - if ($httpGetData['hub_mode'] !== 'subscribe' - && $httpGetData['hub_mode'] !== 'unsubscribe' - ) { - return false; - } - if ($httpGetData['hub_mode'] == 'subscribe' - && !array_key_exists('hub_lease_seconds', $httpGetData) - ) { - return false; - } - if (!\Zend\URI\URL::validate($httpGetData['hub_topic'])) { - return false; - } - - /** - * Attempt to retrieve any Verification Token Key attached to Callback - * URL's path by our Subscriber implementation - */ - if (!$this->_hasValidVerifyToken($httpGetData)) { - return false; - } - return true; - } - - /** - * Sets a newly received feed (Atom/RSS) sent by a Hub as an update to a - * Topic we've subscribed to. - * - * @param string $feed - * @return \Zend\Feed\PubSubHubbub\Subscriber\Callback - */ - public function setFeedUpdate($feed) - { - $this->_feedUpdate = $feed; - return $this; - } - - /** - * Check if any newly received feed (Atom/RSS) update was received - * - * @return bool - */ - public function hasFeedUpdate() - { - if (is_null($this->_feedUpdate)) { - return false; - } - return true; - } - - /** - * Gets a newly received feed (Atom/RSS) sent by a Hub as an update to a - * Topic we've subscribed to. - * - * @return string - */ - public function getFeedUpdate() - { - return $this->_feedUpdate; - } - - /** - * Check for a valid verify_token. By default attempts to compare values - * with that sent from Hub, otherwise merely ascertains its existence. - * - * @param array $httpGetData - * @param bool $checkValue - * @return bool - */ - protected function _hasValidVerifyToken(array $httpGetData = null, $checkValue = true) - { - $verifyTokenKey = $this->_detectVerifyTokenKey($httpGetData); - if (empty($verifyTokenKey)) { - return false; - } - $verifyTokenExists = $this->getStorage()->hasSubscription($verifyTokenKey); - if (!$verifyTokenExists) { - return false; - } - if ($checkValue) { - $data = $this->getStorage()->getSubscription($verifyTokenKey); - $verifyToken = $data['verify_token']; - if ($verifyToken !== hash('sha256', $httpGetData['hub_verify_token'])) { - return false; - } - $this->_currentSubscriptionData = $data; - return true; - } - return true; - } - - /** - * Attempt to detect the verification token key. This would be passed in - * the Callback URL (which we are handling with this class!) as a URI - * path part (the last part by convention). - * - * @param null|array $httpGetData - * @return false|string - */ - protected function _detectVerifyTokenKey(array $httpGetData = null) - { - /** - * Available when sub keys encoding in Callback URL path - */ - if (isset($this->_subscriptionKey)) { - return $this->_subscriptionKey; - } - - /** - * Available only if allowed by PuSH 0.2 Hubs - */ - if (is_array($httpGetData) - && isset($httpGetData['xhub_subscription']) - ) { - return $httpGetData['xhub_subscription']; - } - - /** - * Available (possibly) if corrupted in transit and not part of $_GET - */ - $params = $this->_parseQueryString(); - if (isset($params['xhub.subscription'])) { - return rawurldecode($params['xhub.subscription']); - } - - return false; - } - - /** - * Build an array of Query String parameters. - * This bypasses $_GET which munges parameter names and cannot accept - * multiple parameters with the same key. - * - * @return array|void - */ - protected function _parseQueryString() - { - $params = array(); - $queryString = ''; - if (isset($_SERVER['QUERY_STRING'])) { - $queryString = $_SERVER['QUERY_STRING']; - } - if (empty($queryString)) { - return array(); - } - $parts = explode('&', $queryString); - foreach ($parts as $kvpair) { - $pair = explode('=', $kvpair); - $key = rawurldecode($pair[0]); - $value = rawurldecode($pair[1]); - if (isset($params[$key])) { - if (is_array($params[$key])) { - $params[$key][] = $value; - } else { - $params[$key] = array($params[$key], $value); - } - } else { - $params[$key] = $value; - } - } - return $params; - } -} diff --git a/src/PubSubHubbub/PubSubHubbub.php b/src/Pubsubhubbub.php similarity index 74% rename from src/PubSubHubbub/PubSubHubbub.php rename to src/Pubsubhubbub.php index 947c6a75..31e9ef20 100644 --- a/src/PubSubHubbub/PubSubHubbub.php +++ b/src/Pubsubhubbub.php @@ -16,29 +16,41 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Pubsubhubbub.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ /** - * @namespace + * @see Zend_Http_Client */ -namespace Zend\Feed\PubSubHubbub; -use Zend\Feed\Reader; -use Zend\HTTP; +require_once 'Zend/Http/Client.php'; + +/** + * @see Zend_Uri + */ +require_once 'Zend/Uri.php'; + +/** + * @see Zend_Version + */ +require_once 'Zend/Version.php'; + +/** + * @see Zend_Feed_Reader + */ +require_once 'Zend/Feed/Reader.php'; + +/** + * @see Zend_Feed_Abstract + */ +require_once 'Zend/Feed/Abstract.php'; /** - * @uses \Zend\HTTP\Client - * @uses \Zend\Feed\AbstractFeed - * @uses \Zend\Feed\PubSubHubbub\Exception - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Uri\Uri - * @uses \Zend\Version * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class PubSubHubbub +class Zend_Feed_Pubsubhubbub { /** * Verification Modes @@ -56,7 +68,7 @@ class PubSubHubbub /** * Singleton instance if required of the HTTP client * - * @var \Zend\HTTP\Client + * @var Zend_Http_Client */ protected static $httpClient = null; @@ -66,20 +78,20 @@ class PubSubHubbub * best if directly given an instance of Zend_Feed_Reader_Atom|Rss * to leverage off. * - * @param Zend_Feed_Reader_FeedAbstract|\Zend\Feed\AbstractFeed|string $source + * @param Zend_Feed_Reader_FeedAbstract|Zend_Feed_Abstract|string $source * @return array */ public static function detectHubs($source) { if (is_string($source)) { - $feed = Reader\Reader::import($source); - } elseif (is_object($source) && $source instanceof Reader\FeedAbstract) { + $feed = Zend_Feed_Reader::import($source); + } elseif (is_object($source) && $source instanceof Zend_Feed_Reader_FeedAbstract) { $feed = $source; - } elseif (is_object($source) && $source instanceof \Zend\Feed\AbstractFeed) { - $feed = Reader\Reader::importFeed($source); + } elseif (is_object($source) && $source instanceof Zend_Feed_Abstract) { + $feed = Zend_Feed_Reader::importFeed($source); } else { require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Exception('The source parameter was' + throw new Zend_Feed_Pubsubhubbub_Exception('The source parameter was' . ' invalid, i.e. not a URL string or an instance of type' . ' Zend_Feed_Reader_FeedAbstract or Zend_Feed_Abstract'); } @@ -90,10 +102,10 @@ public static function detectHubs($source) * Allows the external environment to make Zend_Oauth use a specific * Client instance. * - * @param \Zend\HTTP\Client $httpClient + * @param Zend_Http_Client $httpClient * @return void */ - public static function setHttpClient(HTTP\Client $httpClient) + public static function setHttpClient(Zend_Http_Client $httpClient) { self::$httpClient = $httpClient; } @@ -103,12 +115,12 @@ public static function setHttpClient(HTTP\Client $httpClient) * the instance is reset and cleared of previous parameters GET/POST. * Headers are NOT reset but handled by this component if applicable. * - * @return \Zend\HTTP\Client + * @return Zend_Http_Client */ public static function getHttpClient() { if (!isset(self::$httpClient)): - self::$httpClient = new HTTP\Client; + self::$httpClient = new Zend_Http_Client; else: self::$httpClient->resetParameters(); endif; diff --git a/src/Pubsubhubbub/CallbackAbstract.php b/src/Pubsubhubbub/CallbackAbstract.php index 9a8d2764..70f2fb92 100644 --- a/src/Pubsubhubbub/CallbackAbstract.php +++ b/src/Pubsubhubbub/CallbackAbstract.php @@ -17,33 +17,35 @@ * @subpackage Callback * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: CallbackAbstract.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ /** - * @namespace + * @see Zend_Feed_Pubsubhubbub_CallbackInterface */ -namespace Zend\Feed\PubSubHubbub; +require_once 'Zend/Feed/Pubsubhubbub/CallbackInterface.php'; + +/** + * @see Zend_Feed_Pubsubhubbub_HttpResponse + */ +require_once 'Zend/Feed/Pubsubhubbub/HttpResponse.php'; /** - * @uses \Zend\Feed\PubSubHubbub\CallbackInterface - * @uses \Zend\Feed\PubSubHubbub\Exception - * @uses \Zend\Feed\PubSubHubbub\HttpResponse * @category Zend * @package Zend_Feed_Pubsubhubbub * @subpackage Callback * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class CallbackAbstract - implements CallbackInterface +abstract class Zend_Feed_Pubsubhubbub_CallbackAbstract + implements Zend_Feed_Pubsubhubbub_CallbackInterface { /** * An instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used * to background save any verification tokens associated with a subscription * or other. * - * @var \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface + * @var Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface */ protected $_storage = null; @@ -52,7 +54,7 @@ abstract class CallbackAbstract * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with * (i.e. not inherited from) Zend_Controller_Response_Http. * - * @var Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http + * @var Zend_Feed_Pubsubhubbub_HttpResponse|Zend_Controller_Response_Http */ protected $_httpResponse = null; @@ -68,7 +70,7 @@ abstract class CallbackAbstract * options for the Subscriber without calling all supported setter * methods in turn. * - * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance + * @param array|Zend_Config $options Options array or Zend_Config instance */ public function __construct($config = null) { @@ -80,15 +82,16 @@ public function __construct($config = null) /** * Process any injected configuration options * - * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance - * @return \Zend\Feed\PubSubHubbub\CallbackAbstract + * @param array|Zend_Config $options Options array or Zend_Config instance + * @return Zend_Feed_Pubsubhubbub_CallbackAbstract */ public function setConfig($config) { - if ($config instanceof \Zend\Config\Config) { + if ($config instanceof Zend_Config) { $config = $config->toArray(); } elseif (!is_array($config)) { - throw new Exception('Array or Zend_Config object' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' . 'expected, got ' . gettype($config)); } if (array_key_exists('storage', $config)) { @@ -115,10 +118,10 @@ public function sendResponse() * to background save any verification tokens associated with a subscription * or other. * - * @param \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface $storage - * @return \Zend\Feed\PubSubHubbub\CallbackAbstract + * @param Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage + * @return Zend_Feed_Pubsubhubbub_CallbackAbstract */ - public function setStorage(Model\SubscriptionInterface $storage) + public function setStorage(Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage) { $this->_storage = $storage; return $this; @@ -129,12 +132,13 @@ public function setStorage(Model\SubscriptionInterface $storage) * to background save any verification tokens associated with a subscription * or other. * - * @return \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface + * @return Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface */ public function getStorage() { if ($this->_storage === null) { - throw new Exception('No storage object has been' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('No storage object has been' . ' set that subclasses Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface'); } return $this->_storage; @@ -145,16 +149,17 @@ public function getStorage() * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with * (i.e. not inherited from) Zend_Controller_Response_Http. * - * @param Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http $httpResponse - * @return \Zend\Feed\PubSubHubbub\CallbackAbstract + * @param Zend_Feed_Pubsubhubbub_HttpResponse|Zend_Controller_Response_Http $httpResponse + * @return Zend_Feed_Pubsubhubbub_CallbackAbstract */ public function setHttpResponse($httpResponse) { if (!is_object($httpResponse) - || (!$httpResponse instanceof HttpResponse - && !$httpResponse instanceof \Zend\Controller\Response\Http) + || (!$httpResponse instanceof Zend_Feed_Pubsubhubbub_HttpResponse + && !$httpResponse instanceof Zend_Controller_Response_Http) ) { - throw new Exception('HTTP Response object must' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('HTTP Response object must' . ' implement one of Zend_Feed_Pubsubhubbub_HttpResponse or' . ' Zend_Controller_Response_Http'); } @@ -167,12 +172,12 @@ public function setHttpResponse($httpResponse) * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with * (i.e. not inherited from) Zend_Controller_Response_Http. * - * @return Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http + * @return Zend_Feed_Pubsubhubbub_HttpResponse|Zend_Controller_Response_Http */ public function getHttpResponse() { if ($this->_httpResponse === null) { - $this->_httpResponse = new HttpResponse; + $this->_httpResponse = new Zend_Feed_Pubsubhubbub_HttpResponse; } return $this->_httpResponse; } @@ -183,13 +188,14 @@ public function getHttpResponse() * Defaults to 1 if left unchanged. * * @param string|int $count - * @return \Zend\Feed\PubSubHubbub\CallbackAbstract + * @return Zend_Feed_Pubsubhubbub_CallbackAbstract */ public function setSubscriberCount($count) { $count = intval($count); if ($count <= 0) { - throw new Exception('Subscriber count must be' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Subscriber count must be' . ' greater than zero'); } $this->_subscriberCount = $count; diff --git a/src/Pubsubhubbub/CallbackInterface.php b/src/Pubsubhubbub/CallbackInterface.php index 51d82a96..15e89f5b 100644 --- a/src/Pubsubhubbub/CallbackInterface.php +++ b/src/Pubsubhubbub/CallbackInterface.php @@ -17,14 +17,9 @@ * @subpackage Callback * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: CallbackInterface.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ -/** - * @namespace - */ -namespace Zend\Feed\PubSubHubbub; - /** * @category Zend * @package Zend_Feed_Pubsubhubbub @@ -32,7 +27,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface CallbackInterface +interface Zend_Feed_Pubsubhubbub_CallbackInterface { /** * Handle any callback from a Hub Server responding to a subscription or @@ -59,7 +54,7 @@ public function sendResponse(); * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with * (i.e. not inherited from) Zend_Controller_Response_Http. * - * @param Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http $httpResponse + * @param Zend_Feed_Pubsubhubbub_HttpResponse|Zend_Controller_Response_Http $httpResponse */ public function setHttpResponse($httpResponse); @@ -68,7 +63,7 @@ public function setHttpResponse($httpResponse); * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with * (i.e. not inherited from) Zend_Controller_Response_Http. * - * @return Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http + * @return Zend_Feed_Pubsubhubbub_HttpResponse|Zend_Controller_Response_Http */ public function getHttpResponse(); } diff --git a/src/Pubsubhubbub/Exception.php b/src/Pubsubhubbub/Exception.php index 22dfc283..e49f42cf 100644 --- a/src/Pubsubhubbub/Exception.php +++ b/src/Pubsubhubbub/Exception.php @@ -16,20 +16,19 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Exception.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ /** - * @namespace + * @see Zend_Exception */ -namespace Zend\Feed\PubSubHubbub; +require_once 'Zend/Exception.php'; /** - * @uses \Zend\Exception * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Exception extends \Zend\Exception +class Zend_Feed_Pubsubhubbub_Exception extends Zend_Exception {} diff --git a/src/Pubsubhubbub/HttpResponse.php b/src/Pubsubhubbub/HttpResponse.php index afceeed0..37eaab8c 100644 --- a/src/Pubsubhubbub/HttpResponse.php +++ b/src/Pubsubhubbub/HttpResponse.php @@ -16,23 +16,21 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: HttpResponse.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ /** - * @namespace + * @see Zend_Feed_Pubsubhubbub */ -namespace Zend\Feed\PubSubHubbub; +require_once 'Zend/Feed/Pubsubhubbub.php'; /** - * @uses \Zend\Feed\PubSubHubbub\PubSubHubbub - * @uses \Zend\Feed\PubSubHubbub\Exception * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class HttpResponse +class Zend_Feed_Pubsubhubbub_HttpResponse { /** * The body of any response to the current callback request @@ -105,7 +103,7 @@ public function sendHeaders() * @param string $name * @param string $value * @param boolean $replace - * @return \Zend\Feed\PubSubHubbub\HttpResponse + * @return Zend_Feed_Pubsubhubbub_HttpResponse */ public function setHeader($name, $value, $replace = false) { @@ -158,13 +156,14 @@ public function getHeaders() * * @param boolean $throw Whether or not to throw an exception if headers have been sent; defaults to false * @return boolean - * @throws \Zend\Feed\PubSubHubbub\Exception + * @throws Zend_Feed_Pubsubhubbub_Exception */ public function canSendHeaders($throw = false) { $ok = headers_sent($file, $line); if ($ok && $throw) { - throw new Exception('Cannot send headers; headers already sent in ' . $file . ', line ' . $line); + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Cannot send headers; headers already sent in ' . $file . ', line ' . $line); } return !$ok; } @@ -173,12 +172,13 @@ public function canSendHeaders($throw = false) * Set HTTP response code to use with headers * * @param int $code - * @return \Zend\Feed\PubSubHubbub\HttpResponse + * @return Zend_Feed_Pubsubhubbub_HttpResponse */ public function setHttpResponseCode($code) { if (!is_int($code) || (100 > $code) || (599 < $code)) { - throw new Exception('Invalid HTTP response' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid HTTP response' . ' code:' . $code); } $this->_httpResponseCode = $code; @@ -199,7 +199,7 @@ public function getHttpResponseCode() * Set body content * * @param string $content - * @return \Zend\Feed\PubSubHubbub\HttpResponse + * @return Zend_Feed_Pubsubhubbub_HttpResponse */ public function setBody($content) { diff --git a/src/Pubsubhubbub/Model/ModelAbstract.php b/src/Pubsubhubbub/Model/ModelAbstract.php index a9c897f1..951c0d85 100644 --- a/src/Pubsubhubbub/Model/ModelAbstract.php +++ b/src/Pubsubhubbub/Model/ModelAbstract.php @@ -16,28 +16,31 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: ModelAbstract.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ -/** - * @namespace + +/** @see Zend_Db_Table */ +require_once 'Zend/Db/Table.php'; + +/** + * @see Zend_Registry + * Seems to fix the file not being included by Zend_Db_Table... */ -namespace Zend\Feed\PubSubHubbub\Model; +require_once 'Zend/Registry.php'; /** - * @uses \Zend\DB\Table\Table - * @uses \Zend\Registry * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class ModelAbstract +class Zend_Feed_Pubsubhubbub_Model_ModelAbstract { /** * Zend_Db_Table instance to host database methods * - * @var \Zend\DB\Table\Table + * @var Zend_Db_Table */ protected $_db = null; @@ -45,15 +48,15 @@ class ModelAbstract * Constructor * * @param array $data - * @param \Zend\DB\Table\AbstractTable $tableGateway + * @param Zend_Db_Table_Abstract $tableGateway * @return void */ - public function __construct(\Zend\DB\Table\AbstractTable $tableGateway = null) + public function __construct(Zend_Db_Table_Abstract $tableGateway = null) { if (is_null($tableGateway)) { $parts = explode('_', get_class($this)); $table = strtolower(array_pop($parts)); - $this->_db = new \Zend\DB\Table\Table($table); + $this->_db = new Zend_Db_Table($table); } else { $this->_db = $tableGateway; } diff --git a/src/Pubsubhubbub/Model/Subscription.php b/src/Pubsubhubbub/Model/Subscription.php index cc049378..96184f84 100644 --- a/src/Pubsubhubbub/Model/Subscription.php +++ b/src/Pubsubhubbub/Model/Subscription.php @@ -17,30 +17,25 @@ * @subpackage Entity * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Subscription.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ -/** - * @namespace - */ -namespace Zend\Feed\PubSubHubbub\Model; -use Zend\Feed\PubSubHubbub; -use Zend\Date; +/** @see Zend_Feed_Pubsubhubbub_Model_ModelAbstract */ +require_once 'Zend/Feed/Pubsubhubbub/Model/ModelAbstract.php'; + +/** @see Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface */ +require_once 'Zend/Feed/Pubsubhubbub/Model/SubscriptionInterface.php'; /** - * @uses \Zend\Date\Date - * @uses \Zend\Feed\PubSubHubbub\Exception - * @uses \Zend\Feed\PubSubHubbub\Model\ModelAbstract - * @uses \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface * @category Zend * @package Zend_Feed_Pubsubhubbub * @subpackage Entity * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Subscription - extends ModelAbstract - implements SubscriptionInterface +class Zend_Feed_Pubsubhubbub_Model_Subscription + extends Zend_Feed_Pubsubhubbub_Model_ModelAbstract + implements Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface { /** @@ -52,16 +47,17 @@ class Subscription public function setSubscription(array $data) { if (!isset($data['id'])) { - throw new PubSubHubbub\Exception( + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception( 'ID must be set before attempting a save' ); } $result = $this->_db->find($data['id']); if ($result) { $data['created_time'] = $result->current()->created_time; - $now = new Date\Date; + $now = new Zend_Date; if ($data['lease_seconds']) { - $data['expiration_time'] = $now->add($data['lease_seconds'], Date\Date::SECOND) + $data['expiration_time'] = $now->add($data['lease_seconds'], Zend_Date::SECOND) ->get('yyyy-MM-dd HH:mm:ss'); } $this->_db->update( @@ -84,7 +80,8 @@ public function setSubscription(array $data) public function getSubscription($key) { if (empty($key) || !is_string($key)) { - throw new PubSubHubbub\Exception('Invalid parameter "key"' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "key"' .' of "' . $key . '" must be a non-empty string'); } $result = $this->_db->find($key); @@ -103,7 +100,8 @@ public function getSubscription($key) public function hasSubscription($key) { if (empty($key) || !is_string($key)) { - throw new PubSubHubbub\Exception('Invalid parameter "key"' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "key"' .' of "' . $key . '" must be a non-empty string'); } $result = $this->_db->find($key); diff --git a/src/Pubsubhubbub/Model/SubscriptionInterface.php b/src/Pubsubhubbub/Model/SubscriptionInterface.php index bf318407..9675880e 100644 --- a/src/Pubsubhubbub/Model/SubscriptionInterface.php +++ b/src/Pubsubhubbub/Model/SubscriptionInterface.php @@ -17,14 +17,9 @@ * @subpackage Entity * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: SubscriptionInterface.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ -/** - * @namespace - */ -namespace Zend\Feed\PubSubHubbub\Model; - /** * @category Zend * @package Zend_Feed_Pubsubhubbub @@ -32,7 +27,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface SubscriptionInterface +interface Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface { /** diff --git a/src/Pubsubhubbub/Publisher.php b/src/Pubsubhubbub/Publisher.php index f482a679..fad60783 100644 --- a/src/Pubsubhubbub/Publisher.php +++ b/src/Pubsubhubbub/Publisher.php @@ -16,27 +16,21 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Publisher.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ /** - * @namespace + * @see Zend_Feed_Pubsubhubbub */ -namespace Zend\Feed\PubSubHubbub; -use Zend\URI; +require_once 'Zend/Feed/Pubsubhubbub.php'; /** - * @uses \Zend\Feed\PubSubHubbub\PubSubHubbub - * @uses \Zend\Feed\PubSubHubbub\Exception - * @uses \Zend\HTTP\Client - * @uses \Zend\Uri\Uri - * @uses \Zend\Version * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Publisher +class Zend_Feed_Pubsubhubbub_Publisher { /** * An array of URLs for all Hub Servers used by the Publisher, and to @@ -75,7 +69,7 @@ class Publisher * options for the Publisher without calling all supported setter * methods in turn. * - * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance + * @param array|Zend_Config $options Options array or Zend_Config instance * @return void */ public function __construct($config = null) @@ -88,15 +82,16 @@ public function __construct($config = null) /** * Process any injected configuration options * - * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance - * @return \Zend\Feed\PubSubHubbub\Publisher + * @param array|Zend_Config $options Options array or Zend_Config instance + * @return Zend_Feed_Pubsubhubbub_Publisher */ public function setConfig($config) { - if ($config instanceof \Zend\Config\Config) { + if ($config instanceof Zend_Config) { $config = $config->toArray(); } elseif (!is_array($config)) { - throw new Exception('Array or Zend_Config object' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' . 'expected, got ' . gettype($config)); } if (array_key_exists('hubUrls', $config)) { @@ -115,12 +110,13 @@ public function setConfig($config) * Add a Hub Server URL supported by Publisher * * @param string $url - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Zend_Feed_Pubsubhubbub_Publisher */ public function addHubUrl($url) { - if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { - throw new Exception('Invalid parameter "url"' + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .'URL'); } @@ -132,7 +128,7 @@ public function addHubUrl($url) * Add an array of Hub Server URLs supported by Publisher * * @param array $urls - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Zend_Feed_Pubsubhubbub_Publisher */ public function addHubUrls(array $urls) { @@ -146,7 +142,7 @@ public function addHubUrls(array $urls) * Remove a Hub Server URL * * @param string $url - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Zend_Feed_Pubsubhubbub_Publisher */ public function removeHubUrl($url) { @@ -173,12 +169,13 @@ public function getHubUrls() * Add a URL to a topic (Atom or RSS feed) which has been updated * * @param string $url - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Zend_Feed_Pubsubhubbub_Publisher */ public function addUpdatedTopicUrl($url) { - if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { - throw new Exception('Invalid parameter "url"' + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .'URL'); } @@ -190,7 +187,7 @@ public function addUpdatedTopicUrl($url) * Add an array of Topic URLs which have been updated * * @param array $urls - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Zend_Feed_Pubsubhubbub_Publisher */ public function addUpdatedTopicUrls(array $urls) { @@ -204,7 +201,7 @@ public function addUpdatedTopicUrls(array $urls) * Remove an updated topic URL * * @param string $url - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Zend_Feed_Pubsubhubbub_Publisher */ public function removeUpdatedTopicUrl($url) { @@ -232,12 +229,13 @@ public function getUpdatedTopicUrls() * * @param string $url The Hub Server's URL * @return void - * @throws \Zend\Feed\PubSubHubbub\Exception Thrown on failure + * @throws Zend_Feed_Pubsubhubbub_Exception Thrown on failure */ public function notifyHub($url) { - if (empty($url) || !is_string($url) || !URI\Zend\Uri\Uri::check($url)) { - throw new Exception('Invalid parameter "url"' + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .'URL'); } @@ -245,7 +243,8 @@ public function notifyHub($url) $client->setUri($url); $response = $client->request(); if ($response->getStatus() !== 204) { - throw new Exception('Notification to Hub Server ' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Notification to Hub Server ' . 'at "' . $url . '" appears to have failed with a status code of "' . $response->getStatus() . '" and message "' . $response->getMessage() . '"'); @@ -261,14 +260,15 @@ public function notifyHub($url) * to needlessly fail with an Exception/Error unless from Zend_Http_Client. * * @return void - * @throws \Zend\Feed\PubSubHubbub\Exception Thrown if no hubs attached + * @throws Zend_Feed_Pubsubhubbub_Exception Thrown if no hubs attached */ public function notifyAll() { $client = $this->_getHttpClient(); $hubs = $this->getHubUrls(); if (empty($hubs)) { - throw new Exception('No Hub Server URLs' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('No Hub Server URLs' . ' have been set so no notifcations can be sent'); } $this->_errors = array(); @@ -289,7 +289,7 @@ public function notifyAll() * * @param string $name * @param string|null $value - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Zend_Feed_Pubsubhubbub_Publisher */ public function setParameter($name, $value = null) { @@ -298,7 +298,8 @@ public function setParameter($name, $value = null) return $this; } if (empty($name) || !is_string($name)) { - throw new Exception('Invalid parameter "name"' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' .' of "' . $name . '" must be a non-empty string'); } if ($value === null) { @@ -306,7 +307,8 @@ public function setParameter($name, $value = null) return $this; } if (empty($value) || (!is_string($value) && !is_null($value))) { - throw new Exception('Invalid parameter "value"' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "value"' .' of "' . $value . '" must be a non-empty string'); } $this->_parameters[$name] = $value; @@ -317,7 +319,7 @@ public function setParameter($name, $value = null) * Add an optional parameter to the update notification requests * * @param array $parameters - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Zend_Feed_Pubsubhubbub_Publisher */ public function setParameters(array $parameters) { @@ -331,12 +333,13 @@ public function setParameters(array $parameters) * Remove an optional parameter for the notification requests * * @param string $name - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Zend_Feed_Pubsubhubbub_Publisher */ public function removeParameter($name) { if (empty($name) || !is_string($name)) { - throw new Exception('Invalid parameter "name"' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' .' of "' . $name . '" must be a non-empty string'); } if (array_key_exists($name, $this->_parameters)) { @@ -384,20 +387,21 @@ public function getErrors() /** * Get a basic prepared HTTP client for use * - * @return \Zend\HTTP\Client + * @return Zend_Http_Client */ protected function _getHttpClient() { - $client = PubSubHubbub::getHttpClient(); - $client->setMethod(\Zend\HTTP\Client::POST); + $client = Zend_Feed_Pubsubhubbub::getHttpClient(); + $client->setMethod(Zend_Http_Client::POST); $client->setConfig(array( - 'useragent' => 'Zend_Feed_Pubsubhubbub_Publisher/' . \Zend\Version::VERSION, + 'useragent' => 'Zend_Feed_Pubsubhubbub_Publisher/' . Zend_Version::VERSION, )); $params = array(); $params[] = 'hub.mode=publish'; $topics = $this->getUpdatedTopicUrls(); if (empty($topics)) { - throw new Exception('No updated topic URLs' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('No updated topic URLs' . ' have been set'); } foreach ($topics as $topicUrl) { diff --git a/src/PubSubHubbub/Subscriber/Subscriber.php b/src/Pubsubhubbub/Subscriber.php similarity index 80% rename from src/PubSubHubbub/Subscriber/Subscriber.php rename to src/Pubsubhubbub/Subscriber.php index 05410ff1..4f3892a5 100644 --- a/src/PubSubHubbub/Subscriber/Subscriber.php +++ b/src/Pubsubhubbub/Subscriber.php @@ -16,30 +16,26 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Subscriber.php 21068 2010-02-16 14:24:17Z padraic $ */ /** - * @namespace + * @see Zend_Feed_Pubsubhubbub */ -namespace Zend\Feed\PubSubHubbub\Subscriber; -use Zend\Feed\PubSubHubbub; -use Zend\URI; -use Zend\Date; +require_once 'Zend/Feed/Pubsubhubbub.php'; + +/** + * @see Zend_Date + */ +require_once 'Zend/Date.php'; /** - * @uses \Zend\Date\Date - * @uses \Zend\Feed\PubSubHubbub\PubSubHubbub - * @uses \Zend\Feed\PubSubHubbub\Exception - * @uses \Zend\HTTP\Client - * @uses \Zend\Uri\Uri - * @uses \Zend\Version * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Subscriber +class Zend_Feed_Pubsubhubbub_Subscriber { /** * An array of URLs for all Hub Servers to subscribe/unsubscribe. @@ -92,7 +88,7 @@ class Subscriber * @var string */ protected $_preferredVerificationMode - = PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_SYNC; + = Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC; /** * An array of any errors including keys for 'response', 'hubUrl'. @@ -114,7 +110,7 @@ class Subscriber * An instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used to background * save any verification tokens associated with a subscription or other. * - * @var \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface + * @var Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface */ protected $_storage = null; @@ -149,7 +145,7 @@ class Subscriber * options for the Subscriber without calling all supported setter * methods in turn. * - * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance + * @param array|Zend_Config $options Options array or Zend_Config instance * @return void */ public function __construct($config = null) @@ -162,15 +158,16 @@ public function __construct($config = null) /** * Process any injected configuration options * - * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @param array|Zend_Config $options Options array or Zend_Config instance + * @return Zend_Feed_Pubsubhubbub_Subscriber */ public function setConfig($config) { - if ($config instanceof \Zend\Config\Config) { + if ($config instanceof Zend_Config) { $config = $config->toArray(); } elseif (!is_array($config)) { - throw new PubSubHubbub\Exception('Array or Zend_Config object' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' . ' expected, got ' . gettype($config)); } if (array_key_exists('hubUrls', $config)) { @@ -210,12 +207,13 @@ public function setConfig($config) * event will relate * * @param string $url - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Zend_Feed_Pubsubhubbub_Subscriber */ public function setTopicUrl($url) { - if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { - throw new PubSubHubbub\Exception('Invalid parameter "url"' + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .' URL'); } @@ -232,7 +230,8 @@ public function setTopicUrl($url) public function getTopicUrl() { if (empty($this->_topicUrl)) { - throw new PubSubHubbub\Exception('A valid Topic (RSS or Atom' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('A valid Topic (RSS or Atom' . ' feed) URL MUST be set before attempting any operation'); } return $this->_topicUrl; @@ -242,13 +241,14 @@ public function getTopicUrl() * Set the number of seconds for which any subscription will remain valid * * @param int $seconds - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Zend_Feed_Pubsubhubbub_Subscriber */ public function setLeaseSeconds($seconds) { $seconds = intval($seconds); if ($seconds <= 0) { - throw new PubSubHubbub\Exception('Expected lease seconds' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Expected lease seconds' . ' must be an integer greater than zero'); } $this->_leaseSeconds = $seconds; @@ -270,12 +270,13 @@ public function getLeaseSeconds() * this Subscriber * * @param string $url - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Zend_Feed_Pubsubhubbub_Subscriber */ public function setCallbackUrl($url) { - if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { - throw new PubSubHubbub\Exception('Invalid parameter "url"' + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); } @@ -292,7 +293,8 @@ public function setCallbackUrl($url) public function getCallbackUrl() { if (empty($this->_callbackUrl)) { - throw new PubSubHubbub\Exception('A valid Callback URL MUST be' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('A valid Callback URL MUST be' . ' set before attempting any operation'); } return $this->_callbackUrl; @@ -307,13 +309,14 @@ public function getCallbackUrl() * order of occurance in the parameter list determines this preference. * * @param string $mode Should be 'sync' or 'async' - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Zend_Feed_Pubsubhubbub_Subscriber */ public function setPreferredVerificationMode($mode) { - if ($mode !== PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_SYNC - && $mode !== PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_ASYNC) { - throw new PubSubHubbub\Exception('Invalid preferred' + if ($mode !== Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC + && $mode !== Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid preferred' . ' mode specified: "' . $mode . '" but should be one of' . ' Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC or' . ' Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC'); @@ -336,12 +339,13 @@ public function getPreferredVerificationMode() * Add a Hub Server URL supported by Publisher * * @param string $url - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Zend_Feed_Pubsubhubbub_Subscriber */ public function addHubUrl($url) { - if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { - throw new PubSubHubbub\Exception('Invalid parameter "url"' + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); } @@ -353,7 +357,7 @@ public function addHubUrl($url) * Add an array of Hub Server URLs supported by Publisher * * @param array $urls - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Zend_Feed_Pubsubhubbub_Subscriber */ public function addHubUrls(array $urls) { @@ -367,7 +371,7 @@ public function addHubUrls(array $urls) * Remove a Hub Server URL * * @param string $url - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Zend_Feed_Pubsubhubbub_Subscriber */ public function removeHubUrl($url) { @@ -395,12 +399,13 @@ public function getHubUrls() * * @param string $url * @param array $authentication - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Zend_Feed_Pubsubhubbub_Subscriber */ public function addAuthentication($url, array $authentication) { - if (empty($url) || !is_string($url) || !URI\Zend\Uri\Uri::check($url)) { - throw new PubSubHubbub\Exception('Invalid parameter "url"' + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); } @@ -412,7 +417,7 @@ public function addAuthentication($url, array $authentication) * Add authentication credentials for hub URLs * * @param array $authentications - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Zend_Feed_Pubsubhubbub_Subscriber */ public function addAuthentications(array $authentications) { @@ -436,7 +441,7 @@ public function getAuthentications() * Set flag indicating whether or not to use a path parameter * * @param bool $bool - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Zend_Feed_Pubsubhubbub_Subscriber */ public function usePathParameter($bool = true) { @@ -449,7 +454,7 @@ public function usePathParameter($bool = true) * * @param string $name * @param string|null $value - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Zend_Feed_Pubsubhubbub_Subscriber */ public function setParameter($name, $value = null) { @@ -458,7 +463,8 @@ public function setParameter($name, $value = null) return $this; } if (empty($name) || !is_string($name)) { - throw new PubSubHubbub\Exception('Invalid parameter "name"' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' . ' of "' . $name . '" must be a non-empty string'); } if ($value === null) { @@ -466,7 +472,8 @@ public function setParameter($name, $value = null) return $this; } if (empty($value) || (!is_string($value) && !is_null($value))) { - throw new PubSubHubbub\Exception('Invalid parameter "value"' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "value"' . ' of "' . $value . '" must be a non-empty string'); } $this->_parameters[$name] = $value; @@ -478,7 +485,7 @@ public function setParameter($name, $value = null) * * @param string $name * @param string|null $value - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Zend_Feed_Pubsubhubbub_Subscriber */ public function setParameters(array $parameters) { @@ -492,12 +499,13 @@ public function setParameters(array $parameters) * Remove an optional parameter for the (un)subscribe requests * * @param string $name - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Zend_Feed_Pubsubhubbub_Subscriber */ public function removeParameter($name) { if (empty($name) || !is_string($name)) { - throw new PubSubHubbub\Exception('Invalid parameter "name"' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' . ' of "' . $name . '" must be a non-empty string'); } if (array_key_exists($name, $this->_parameters)) { @@ -520,10 +528,10 @@ public function getParameters() * Sets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used to background * save any verification tokens associated with a subscription or other. * - * @param \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface $storage - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @param Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage + * @return Zend_Feed_Pubsubhubbub_Subscriber */ - public function setStorage(PubSubHubbub\Model\SubscriptionInterface $storage) + public function setStorage(Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage) { $this->_storage = $storage; return $this; @@ -534,12 +542,13 @@ public function setStorage(PubSubHubbub\Model\SubscriptionInterface $storage) * to background save any verification tokens associated with a subscription * or other. * - * @return \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface + * @return Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface */ public function getStorage() { if ($this->_storage === null) { - throw new PubSubHubbub\Exception('No storage vehicle ' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('No storage vehicle ' . 'has been set.'); } return $this->_storage; @@ -617,7 +626,8 @@ protected function _doRequest($mode) $client = $this->_getHttpClient(); $hubs = $this->getHubUrls(); if (empty($hubs)) { - throw new PubSubHubbub\Exception('No Hub Server URLs' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('No Hub Server URLs' . ' have been set so no subscriptions can be attempted'); } $this->_errors = array(); @@ -657,14 +667,14 @@ protected function _doRequest($mode) * Get a basic prepared HTTP client for use * * @param string $mode Must be "subscribe" or "unsubscribe" - * @return \Zend\HTTP\Client + * @return Zend_Http_Client */ protected function _getHttpClient() { - $client = PubSubHubbub\PubSubHubbub::getHttpClient(); - $client->setMethod(\Zend\HTTP\Client::POST); + $client = Zend_Feed_Pubsubhubbub::getHttpClient(); + $client->setMethod(Zend_Http_Client::POST); $client->setConfig(array('useragent' => 'Zend_Feed_Pubsubhubbub_Subscriber/' - . \Zend\Version::VERSION)); + . Zend_Version::VERSION)); return $client; } @@ -679,7 +689,8 @@ protected function _getHttpClient() protected function _getRequestParameters($hubUrl, $mode) { if (!in_array($mode, array('subscribe', 'unsubscribe'))) { - throw new PubSubHubbub\Exception('Invalid mode specified: "' + require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; + throw new Zend_Feed_Pubsubhubbub_Exception('Invalid mode specified: "' . $mode . '" which should have been "subscribe" or "unsubscribe"'); } @@ -689,16 +700,16 @@ protected function _getRequestParameters($hubUrl, $mode) ); if ($this->getPreferredVerificationMode() - == PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_SYNC + == Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC ) { $vmodes = array( - PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_SYNC, - PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_ASYNC, + Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC, + Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC, ); } else { $vmodes = array( - PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_ASYNC, - PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_SYNC, + Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC, + Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC, ); } $params['hub.verify'] = array(); @@ -717,10 +728,10 @@ protected function _getRequestParameters($hubUrl, $mode) // Note: query string only usable with PuSH 0.2 Hubs if (!$this->_usePathParameter) { $params['hub.callback'] = $this->getCallbackUrl() - . '?xhub.subscription=' . PubSubHubbub\PubSubHubbub::urlencode($key); + . '?xhub.subscription=' . Zend_Feed_Pubsubhubbub::urlencode($key); } else { $params['hub.callback'] = rtrim($this->getCallbackUrl(), '/') - . '/' . PubSubHubbub\PubSubHubbub::urlencode($key); + . '/' . Zend_Feed_Pubsubhubbub::urlencode($key); } if ($mode == 'subscribe' && !is_null($this->getLeaseSeconds())) { $params['hub.lease_seconds'] = $this->getLeaseSeconds(); @@ -733,10 +744,10 @@ protected function _getRequestParameters($hubUrl, $mode) } // store subscription to storage - $now = new Date\Date; + $now = new Zend_Date; $expires = null; if (isset($params['hub.lease_seconds'])) { - $expires = $now->add($params['hub.lease_seconds'], Date\Date::SECOND) + $expires = $now->add($params['hub.lease_seconds'], Zend_Date::SECOND) ->get('yyyy-MM-dd HH:mm:ss'); } $data = array( @@ -748,7 +759,7 @@ protected function _getRequestParameters($hubUrl, $mode) 'verify_token' => hash('sha256', $params['hub.verify_token']), 'secret' => null, 'expiration_time' => $expires, - 'subscription_state' => PubSubHubbub\PubSubHubbub::SUBSCRIPTION_NOTVERIFIED, + 'subscription_state' => Zend_Feed_Pubsubhubbub::SUBSCRIPTION_NOTVERIFIED, ); $this->getStorage()->setSubscription($data); @@ -798,15 +809,15 @@ protected function _urlEncode(array $params) $encoded = array(); foreach ($params as $key => $value) { if (is_array($value)) { - $ekey = PubSubHubbub\PubSubHubbub::urlencode($key); + $ekey = Zend_Feed_Pubsubhubbub::urlencode($key); $encoded[$ekey] = array(); foreach ($value as $duplicateKey) { $encoded[$ekey][] - = PubSubHubbub\PubSubHubbub::urlencode($duplicateKey); + = Zend_Feed_Pubsubhubbub::urlencode($duplicateKey); } } else { - $encoded[PubSubHubbub\PubSubHubbub::urlencode($key)] - = PubSubHubbub\PubSubHubbub::urlencode($value); + $encoded[Zend_Feed_Pubsubhubbub::urlencode($key)] + = Zend_Feed_Pubsubhubbub::urlencode($value); } } return $encoded; diff --git a/src/Pubsubhubbub/Subscriber/Callback.php b/src/Pubsubhubbub/Subscriber/Callback.php index a29850cd..ef6134a5 100644 --- a/src/Pubsubhubbub/Subscriber/Callback.php +++ b/src/Pubsubhubbub/Subscriber/Callback.php @@ -16,26 +16,32 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Callback.php 21234 2010-02-28 13:51:41Z padraic $ */ /** - * @namespace + * @see Zend_Feed_Pubsubhubbub */ -namespace Zend\Feed\PubSubHubbub\Subscriber; +require_once 'Zend/Feed/Pubsubhubbub.php'; + +/** + * @see Zend_Feed_Pubsubhubbub + */ +require_once 'Zend/Feed/Pubsubhubbub/CallbackAbstract.php'; + +/** + * @see Zend_Feed_Reader + */ +require_once 'Zend/Feed/Reader.php'; /** - * @uses \Zend\Feed\PubSubHubbub\PubSubHubbub - * @uses \Zend\Feed\PubSubHubbub\CallbackAbstract - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Callback - extends \Zend\Feed\PubSubHubbub\CallbackAbstract +class Zend_Feed_Pubsubhubbub_Subscriber_Callback + extends Zend_Feed_Pubsubhubbub_CallbackAbstract { /** * Contains the content of any feeds sent as updates to the Callback URL @@ -66,7 +72,7 @@ class Callback * Required if usePathParameter is enabled for the Subscriber. * * @param string $key - * @return \Zend\Feed\PubSubHubbub\Subscriber\Callback + * @return Zend_Feed_Pubsubhubbub_Subscriber_Callback */ public function setSubscriptionKey($key) { @@ -113,7 +119,7 @@ public function handle(array $httpGetData = null, $sendResponseNow = false) } elseif ($this->isValidHubVerification($httpGetData)) { $data = $this->_currentSubscriptionData; $this->getHttpResponse()->setBody($httpGetData['hub_challenge']); - $data['subscription_state'] = \Zend\Feed\PubSubHubbub\PubSubHubbub::SUBSCRIPTION_VERIFIED; + $data['subscription_state'] = Zend_Feed_Pubsubhubbub::SUBSCRIPTION_VERIFIED; if (isset($httpGetData['hub_lease_seconds'])) { $data['lease_seconds'] = $httpGetData['hub_lease_seconds']; } @@ -168,7 +174,7 @@ public function isValidHubVerification(array $httpGetData) ) { return false; } - if (!\Zend\URI\URL::validate($httpGetData['hub_topic'])) { + if (!Zend_Uri::check($httpGetData['hub_topic'])) { return false; } @@ -187,7 +193,7 @@ public function isValidHubVerification(array $httpGetData) * Topic we've subscribed to. * * @param string $feed - * @return \Zend\Feed\PubSubHubbub\Subscriber\Callback + * @return Zend_Feed_Pubsubhubbub_Subscriber_Callback */ public function setFeedUpdate($feed) { diff --git a/src/RSS.php b/src/RSS.php deleted file mode 100644 index deb809e1..00000000 --- a/src/RSS.php +++ /dev/null @@ -1,517 +0,0 @@ -s). - * - * @var string - */ - protected $_entryElementName = 'item'; - - /** - * The default namespace for RSS channels. - * - * @var string - */ - protected $_defaultNamespace = 'rss'; - - /** - * Override Zend_Feed_Abstract to set up the $_element and $_entries aliases. - * - * @return void - * @throws \Zend\Feed\Exception - */ - public function __wakeup() - { - parent::__wakeup(); - - // 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); - } else { - $this->_element = $this->_element->getElementsByTagName('channel')->item(0); - } - if (!$this->_element) { - throw new Exception('No root element found, cannot parse channel.'); - } - - // Find the entries and save a pointer to them for speed and - // simplicity. - $this->_buildEntryCache(); - } - - - /** - * Make accessing some individual elements of the channel easier. - * - * Special accessors 'item' and 'items' are provided so that if - * you wish to iterate over an RSS channel's items, you can do so - * using foreach ($channel->items as $item) or foreach - * ($channel->item as $item). - * - * @param string $var The property to access. - * @return mixed - */ - public function __get($var) - { - switch ($var) { - case 'item': - // fall through to the next case - case 'items': - return $this; - - default: - return parent::__get($var); - } - } - - /** - * Generate the header of the feed when working in write mode - * - * @param array $array the data to use - * @return DOMElement root node - */ - protected function _mapFeedHeaders($array) - { - $channel = $this->_element->createElement('channel'); - - $title = $this->_element->createElement('title'); - $title->appendChild($this->_element->createCDATASection($array->title)); - $channel->appendChild($title); - - $link = $this->_element->createElement('link', $array->link); - $channel->appendChild($link); - - $desc = isset($array->description) ? $array->description : ''; - $description = $this->_element->createElement('description'); - $description->appendChild($this->_element->createCDATASection($desc)); - $channel->appendChild($description); - - $pubdate = isset($array->lastUpdate) ? $array->lastUpdate : time(); - $pubdate = $this->_element->createElement('pubDate', date(DATE_RSS, $pubdate)); - $channel->appendChild($pubdate); - - if (isset($array->published)) { - $lastBuildDate = $this->_element->createElement('lastBuildDate', date(DATE_RSS, $array->published)); - $channel->appendChild($lastBuildDate); - } - - $editor = ''; - if (!empty($array->email)) { - $editor .= $array->email; - } - if (!empty($array->author)) { - $editor .= ' (' . $array->author . ')'; - } - if (!empty($editor)) { - $author = $this->_element->createElement('managingEditor', ltrim($editor)); - $channel->appendChild($author); - } - if (isset($array->webmaster)) { - $channel->appendChild($this->_element->createElement('webMaster', $array->webmaster)); - } - - if (!empty($array->copyright)) { - $copyright = $this->_element->createElement('copyright', $array->copyright); - $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'); - $imagetitle->appendChild($this->_element->createCDATASection($array->title)); - $image->appendChild($imagetitle); - $imagelink = $this->_element->createElement('link', $array->link); - $image->appendChild($imagelink); - - $channel->appendChild($image); - } - - $generator = !empty($array->generator) ? $array->generator : 'Zend_Feed'; - $generator = $this->_element->createElement('generator', $generator); - $channel->appendChild($generator); - - if (!empty($array->language)) { - $language = $this->_element->createElement('language', $array->language); - $channel->appendChild($language); - } - - $doc = $this->_element->createElement('docs', 'http://blogs.law.harvard.edu/tech/rss'); - $channel->appendChild($doc); - - if (isset($array->cloud)) { - $cloud = $this->_element->createElement('cloud'); - $cloud->setAttribute('domain', $array->cloud['uri']->getHost()); - $cloud->setAttribute('port', $array->cloud['uri']->getPort()); - $cloud->setAttribute('path', $array->cloud['uri']->getPath()); - $cloud->setAttribute('registerProcedure', $array->cloud['procedure']); - $cloud->setAttribute('protocol', $array->cloud['protocol']); - $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); - } - - if (isset($array->textInput)) { - $textinput = $this->_element->createElement('textInput'); - $textinput->appendChild($this->_element->createElement('title', $array->textInput['title'])); - $textinput->appendChild($this->_element->createElement('description', $array->textInput['description'])); - $textinput->appendChild($this->_element->createElement('name', $array->textInput['name'])); - $textinput->appendChild($this->_element->createElement('link', $array->textInput['link'])); - $channel->appendChild($textinput); - } - - if (isset($array->skipHours)) { - $skipHours = $this->_element->createElement('skipHours'); - foreach ($array->skipHours as $hour) { - $skipHours->appendChild($this->_element->createElement('hour', $hour)); - } - $channel->appendChild($skipHours); - } - - if (isset($array->skipDays)) { - $skipDays = $this->_element->createElement('skipDays'); - foreach ($array->skipDays as $day) { - $skipDays->appendChild($this->_element->createElement('day', $day)); - } - $channel->appendChild($skipDays); - } - - if (isset($array->itunes)) { - $this->_buildiTunes($channel, $array); - } - - return $channel; - } - - /** - * Adds the iTunes extensions to a root node - * - * @param DOMElement $root - * @param array $array - * @return void - */ - private function _buildiTunes(\DOMElement $root, $array) - { - /* author node */ - $author = ''; - if (isset($array->itunes->author)) { - $author = $array->itunes->author; - } elseif (isset($array->author)) { - $author = $array->author; - } - if (!empty($author)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:author', $author); - $root->appendChild($node); - } - - /* owner node */ - $author = ''; - $email = ''; - if (isset($array->itunes->owner)) { - if (isset($array->itunes->owner['name'])) { - $author = $array->itunes->owner['name']; - } - if (isset($array->itunes->owner['email'])) { - $email = $array->itunes->owner['email']; - } - } - if (empty($author) && isset($array->author)) { - $author = $array->author; - } - if (empty($email) && isset($array->email)) { - $email = $array->email; - } - if (!empty($author) || !empty($email)) { - $owner = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:owner'); - if (!empty($author)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:name', $author); - $owner->appendChild($node); - } - if (!empty($email)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:email', $email); - $owner->appendChild($node); - } - $root->appendChild($owner); - } - $image = ''; - if (isset($array->itunes->image)) { - $image = $array->itunes->image; - } elseif (isset($array->image)) { - $image = $array->image; - } - if (!empty($image)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:image'); - $node->setAttribute('href', $image); - $root->appendChild($node); - } - $subtitle = ''; - if (isset($array->itunes->subtitle)) { - $subtitle = $array->itunes->subtitle; - } elseif (isset($array->description)) { - $subtitle = $array->description; - } - if (!empty($subtitle)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:subtitle', $subtitle); - $root->appendChild($node); - } - $summary = ''; - if (isset($array->itunes->summary)) { - $summary = $array->itunes->summary; - } elseif (isset($array->description)) { - $summary = $array->description; - } - if (!empty($summary)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:summary', $summary); - $root->appendChild($node); - } - if (isset($array->itunes->block)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:block', $array->itunes->block); - $root->appendChild($node); - } - if (isset($array->itunes->explicit)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:explicit', $array->itunes->explicit); - $root->appendChild($node); - } - if (isset($array->itunes->keywords)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:keywords', $array->itunes->keywords); - $root->appendChild($node); - } - if (isset($array->itunes->new_feed_url)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:new-feed-url', $array->itunes->new_feed_url); - $root->appendChild($node); - } - if (isset($array->itunes->category)) { - foreach ($array->itunes->category as $i => $category) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); - $node->setAttribute('text', $category['main']); - $root->appendChild($node); - $add_end_category = false; - if (!empty($category['sub'])) { - $add_end_category = true; - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); - $node->setAttribute('text', $category['sub']); - $root->appendChild($node); - } - if ($i > 0 || $add_end_category) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); - $root->appendChild($node); - } - } - } - } - - /** - * Generate the entries of the feed when working in write mode - * - * The following nodes are constructed for each feed entry - * - * entry title - * url to feed entry - * url to feed entry - * short text - * long version, can contain html - * - * - * @param DOMElement $root the root node to use - * @param array $array the data to use - * @return void - */ - protected function _mapFeedEntries(\DOMElement $root, $array) - { - Feed::registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/'); - - foreach ($array as $dataentry) { - $item = $this->_element->createElement('item'); - - $title = $this->_element->createElement('title'); - $title->appendChild($this->_element->createCDATASection($dataentry->title)); - $item->appendChild($title); - - if (isset($dataentry->author)) { - $author = $this->_element->createElement('author', $dataentry->author); - $item->appendChild($author); - } - - $link = $this->_element->createElement('link', $dataentry->link); - $item->appendChild($link); - - if (isset($dataentry->guid)) { - $guid = $this->_element->createElement('guid', $dataentry->guid); - //if (!\Zend\Uri\Uri::check($dataentry->guid)) { - $guid->setAttribute('isPermaLink', 'false'); - //} - $item->appendChild($guid); - } - - $description = $this->_element->createElement('description'); - $description->appendChild($this->_element->createCDATASection($dataentry->description)); - $item->appendChild($description); - - if (isset($dataentry->content)) { - $content = $this->_element->createElement('content:encoded'); - $content->appendChild($this->_element->createCDATASection($dataentry->content)); - $item->appendChild($content); - } - - $pubdate = isset($dataentry->lastUpdate) ? $dataentry->lastUpdate : time(); - $pubdate = $this->_element->createElement('pubDate', date(DATE_RSS, $pubdate)); - $item->appendChild($pubdate); - - if (isset($dataentry->category)) { - foreach ($dataentry->category as $category) { - $node = $this->_element->createElement('category', $category['term']); - if (isset($category['scheme'])) { - $node->setAttribute('domain', $category['scheme']); - } - $item->appendChild($node); - } - } - - if (isset($dataentry->source)) { - $source = $this->_element->createElement('source', $dataentry->source['title']); - $source->setAttribute('url', $dataentry->source['url']); - $item->appendChild($source); - } - - if (isset($dataentry->comments)) { - $comments = $this->_element->createElement('comments', $dataentry->comments); - $item->appendChild($comments); - } - if (isset($dataentry->commentRss)) { - $comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/', - 'wfw:commentRss', - $dataentry->commentRss); - $item->appendChild($comments); - } - - - if (isset($dataentry->enclosure)) { - foreach ($dataentry->enclosure as $enclosure) { - $node = $this->_element->createElement('enclosure'); - $node->setAttribute('url', $enclosure['url']); - if (isset($enclosure['type'])) { - $node->setAttribute('type', $enclosure['type']); - } - if (isset($enclosure['length'])) { - $node->setAttribute('length', $enclosure['length']); - } - $item->appendChild($node); - } - } - - $root->appendChild($item); - } - } - - /** - * Override Zend_Feed_Element to include root node - * - * @return string - */ - public function saveXml() - { - // Return a complete document including XML prologue. - $doc = new \DOMDocument($this->_element->ownerDocument->version, - $this->_element->ownerDocument->actualEncoding); - $root = $doc->createElement('rss'); - - // Use rss version 2.0 - $root->setAttribute('version', '2.0'); - - // Content namespace - $root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:content', 'http://purl.org/rss/1.0/modules/content/'); - $root->appendChild($doc->importNode($this->_element, true)); - - // Append root node - $doc->appendChild($root); - - // Format output - $doc->formatOutput = true; - - return $doc->saveXML(); - } - - /** - * Send feed to a http client with the correct header - * - * @return void - * @throws \Zend\Feed\Exception if headers have already been sent - */ - public function send() - { - if (headers_sent()) { - throw new Exception('Cannot send RSS because headers have already been sent.'); - } - - header('Content-Type: application/rss+xml; charset=' . $this->_element->ownerDocument->actualEncoding); - - echo $this->saveXml(); - } - -} diff --git a/src/Reader/Reader.php b/src/Reader.php similarity index 77% rename from src/Reader/Reader.php rename to src/Reader.php index a2e31eda..9f56a26e 100644 --- a/src/Reader/Reader.php +++ b/src/Reader.php @@ -16,30 +16,36 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Reader.php 22092 2010-05-04 12:50:51Z padraic $ */ /** - * @namespace + * @see Zend_Feed */ -namespace Zend\Feed\Reader; -use Zend\HTTP; -use Zend\Loader\PluginLoader; +require_once 'Zend/Feed.php'; + +/** + * @see Zend_Feed_Reader_Feed_Rss + */ +require_once 'Zend/Feed/Reader/Feed/Rss.php'; + +/** + * @see Zend_Feed_Reader_Feed_Atom + */ +require_once 'Zend/Feed/Reader/Feed/Atom.php'; + +/** + * @see Zend_Feed_Reader_FeedSet + */ +require_once 'Zend/Feed/Reader/FeedSet.php'; /** - * @uses \Zend\Feed\Feed - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Reader\FeedSet - * @uses \Zend\Feed\Reader\Feed\Atom\Atom - * @uses \Zend\Feed\Reader\Feed\RSS - * @uses \Zend\HTTP\Client - * @uses \Zend\Loader\PluginLoader\PluginLoader * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Reader +class Zend_Feed_Reader { /** * Namespace constants @@ -72,14 +78,14 @@ class Reader /** * Cache instance * - * @var \Zend\Cache\Frontend\Core + * @var Zend_Cache_Core */ protected static $_cache = null; /** * HTTP client object to use for retrieving feeds * - * @var \Zend\HTTP\Client + * @var Zend_Http_Client */ protected static $_httpClient = null; @@ -98,27 +104,27 @@ class Reader protected static $_extensions = array( 'feed' => array( - 'DublinCore\Feed', - 'Atom\Feed' + 'DublinCore_Feed', + 'Atom_Feed' ), 'entry' => array( - 'Content\Entry', - 'DublinCore\Entry', - 'Atom\Entry' + 'Content_Entry', + 'DublinCore_Entry', + 'Atom_Entry' ), 'core' => array( - 'DublinCore\Feed', - 'Atom\Feed', - 'Content\Entry', - 'DublinCore\Entry', - 'Atom\Entry' + 'DublinCore_Feed', + 'Atom_Feed', + 'Content_Entry', + 'DublinCore_Entry', + 'Atom_Entry' ) ); /** * Get the Feed cache * - * @return \Zend\Cache\Frontend\Core + * @return Zend_Cache_Core */ public static function getCache() { @@ -128,10 +134,10 @@ public static function getCache() /** * Set the feed cache * - * @param \Zend\Cache\Frontend\Core $cache + * @param Zend_Cache_Core $cache * @return void */ - public static function setCache(\Zend\Cache\Frontend\Core $cache) + public static function setCache(Zend_Cache_Core $cache) { self::$_cache = $cache; } @@ -141,10 +147,10 @@ public static function setCache(\Zend\Cache\Frontend\Core $cache) * * Sets the HTTP client object to use for retrieving the feeds. * - * @param \Zend\HTTP\Client $httpClient + * @param Zend_Http_Client $httpClient * @return void */ - public static function setHttpClient(HTTP\Client $httpClient) + public static function setHttpClient(Zend_Http_Client $httpClient) { self::$_httpClient = $httpClient; } @@ -157,8 +163,12 @@ public static function setHttpClient(HTTP\Client $httpClient) */ public static function getHttpClient() { - if (!self::$_httpClient instanceof HTTP\Client) { - self::$_httpClient = new HTTP\Client(); + if (!self::$_httpClient instanceof Zend_Http_Client) { + /** + * @see Zend_Http_Client + */ + require_once 'Zend/Http/Client.php'; + self::$_httpClient = new Zend_Http_Client(); } return self::$_httpClient; @@ -209,7 +219,7 @@ public static function useHttpConditionalGet($bool = true) * @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\FeedInterface + * @return Zend_Feed_Reader_FeedInterface */ public static function import($uri, $etag = null, $lastModified = null) { @@ -241,7 +251,8 @@ public static function import($uri, $etag = null, $lastModified = null) } $response = $client->request('GET'); if ($response->getStatus() !== 200 && $response->getStatus() !== 304) { - throw new \Zend\Feed\Exception('Feed failed to load, got response code ' . $response->getStatus()); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); } if ($response->getStatus() == 304) { $responseXml = $data; @@ -263,7 +274,8 @@ public static function import($uri, $etag = null, $lastModified = null) } $response = $client->request('GET'); if ($response->getStatus() !== 200) { - throw new \Zend\Feed\Exception('Feed failed to load, got response code ' . $response->getStatus()); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); } $responseXml = $response->getBody(); $cache->save($responseXml, $cacheId); @@ -271,27 +283,30 @@ public static function import($uri, $etag = null, $lastModified = null) } else { $response = $client->request('GET'); if ($response->getStatus() !== 200) { - throw new \Zend\Feed\Exception('Feed failed to load, got response code ' . $response->getStatus()); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); } - return self::importString($response->getBody()); + $reader = self::importString($response->getBody()); + $reader->setOriginalSourceUri($uri); + return $reader; } } /** * Import a feed by providing a Zend_Feed_Abstract object * - * @param \Zend\Feed\Feed_Abstract $feed A fully instantiated \Zend\Feed\Feed object - * @return \Zend\Feed\Reader\FeedInterface + * @param Zend_Feed_Abstract $feed A fully instantiated Zend_Feed object + * @return Zend_Feed_Reader_FeedInterface */ - public static function importFeed(Feed\AbstractFeed $feed) + public static function importFeed(Zend_Feed_Abstract $feed) { $dom = $feed->getDOM()->ownerDocument; $type = self::detectType($dom); self::_registerCoreExtensions(); if (substr($type, 0, 3) == 'rss') { - $reader = new Feed\RSS($dom, $type); + $reader = new Zend_Feed_Reader_Feed_Rss($dom, $type); } else { - $reader = new Feed\Atom\Atom($dom, $type); + $reader = new Zend_Feed_Reader_Feed_Atom($dom, $type); } return $reader; @@ -301,12 +316,12 @@ public static function importFeed(Feed\AbstractFeed $feed) * Import a feed froma string * * @param string $string - * @return \Zend\Feed\Reader\FeedInterface + * @return Zend_Feed_Reader_FeedInterface */ public static function importString($string) { $libxml_errflag = libxml_use_internal_errors(true); - $dom = new \DOMDocument; + $dom = new DOMDocument; $status = $dom->loadXML($string); libxml_use_internal_errors($libxml_errflag); @@ -319,7 +334,8 @@ public static function importString($string) $errormsg = "DOMDocument cannot parse XML: Please check the XML document's validity"; } - throw new \Zend\Feed\Exception($errormsg); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception($errormsg); } $type = self::detectType($dom); @@ -327,13 +343,14 @@ public static function importString($string) self::_registerCoreExtensions(); if (substr($type, 0, 3) == 'rss') { - $reader = new Feed\RSS($dom, $type); + $reader = new Zend_Feed_Reader_Feed_Rss($dom, $type); } elseif (substr($type, 8, 5) == 'entry') { - $reader = new Entry\Atom($dom->documentElement, 0, self::TYPE_ATOM_10); + $reader = new Zend_Feed_Reader_Entry_Atom($dom->documentElement, 0, Zend_Feed_Reader::TYPE_ATOM_10); } elseif (substr($type, 0, 4) == 'atom') { - $reader = new Feed\Atom\Atom($dom, $type); + $reader = new Zend_Feed_Reader_Feed_Atom($dom, $type); } else { - throw new \Zend\Feed\Exception('The URI used does not point to a ' + 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; @@ -343,8 +360,8 @@ public static function importString($string) * Imports a feed from a file located at $filename. * * @param string $filename - * @throws \Zend\Feed\Exception - * @return \Zend\Feed\Reader\FeedInterface + * @throws Zend_Feed_Exception + * @return Zend_Feed_Reader_FeedInterface */ public static function importFile($filename) { @@ -352,7 +369,11 @@ public static function importFile($filename) $feed = @file_get_contents($filename); @ini_restore('track_errors'); if ($feed === false) { - throw new \Zend\Feed\Exception("File could not be loaded: $php_errormsg"); + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception("File could not be loaded: $php_errormsg"); } return self::importString($feed); } @@ -364,11 +385,15 @@ public static function findFeedLinks($uri) $client->setUri($uri); $response = $client->request(); if ($response->getStatus() !== 200) { - throw new \Zend\Feed\Exception("Failed to access $uri, got response code " . $response->getStatus()); + /** + * @see Zend_Feed_Exception + */ + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception("Failed to access $uri, got response code " . $response->getStatus()); } $responseHtml = $response->getBody(); $libxml_errflag = libxml_use_internal_errors(true); - $dom = new \DOMDocument; + $dom = new DOMDocument; $status = $dom->loadHTML($responseHtml); libxml_use_internal_errors($libxml_errflag); if (!$status) { @@ -380,9 +405,10 @@ public static function findFeedLinks($uri) $errormsg = "DOMDocument cannot parse HTML: Please check the XML document's validity"; } - throw new \Zend\Feed\Exception($errormsg); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception($errormsg); } - $feedSet = new FeedSet; + $feedSet = new Zend_Feed_Reader_FeedSet; $links = $dom->getElementsByTagName('link'); $feedSet->addLinks($links, $uri); return $feedSet; @@ -391,19 +417,19 @@ public static function findFeedLinks($uri) /** * Detect the feed type of the provided feed * - * @param \Zend\Feed\AbstractFeed|DOMDocument|string $feed + * @param Zend_Feed_Abstract|DOMDocument|string $feed * @return string */ public static function detectType($feed, $specOnly = false) { - if ($feed instanceof FeedInterface) { + if ($feed instanceof Zend_Feed_Reader_FeedInterface) { $dom = $feed->getDomDocument(); - } elseif($feed instanceof \DOMDocument) { + } elseif($feed instanceof DOMDocument) { $dom = $feed; } elseif(is_string($feed) && !empty($feed)) { @ini_set('track_errors', 1); - $dom = new \DOMDocument; - $status = @$doc->loadXML($string); + $dom = new DOMDocument; + $status = @$dom->loadXML($feed); @ini_restore('track_errors'); if (!$status) { if (!isset($php_errormsg)) { @@ -413,13 +439,15 @@ public static function detectType($feed, $specOnly = false) $php_errormsg = '(error message not available)'; } } - throw new \Zend\Feed\Exception("DOMDocument cannot parse XML: $php_errormsg"); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg"); } } else { - throw new \Zend\Feed\Exception('Invalid object/scalar provided: must' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid object/scalar provided: must' . ' be of type Zend_Feed_Reader_FeedInterface, DomDocument or string'); } - $xpath = new \DOMXPath($dom); + $xpath = new DOMXPath($dom); if ($xpath->query('/rss')->length) { $type = self::TYPE_RSS_ANY; @@ -503,9 +531,9 @@ public static function detectType($feed, $specOnly = false) /** * Set plugin loader for use with Extensions * - * @param \Zend\Loader\PluginLoader\PluginLoaderInterface $loader + * @param Zend_Loader_PluginLoader_Interface $loader */ - public static function setPluginLoader(PluginLoader\PluginLoaderInterface $loader) + public static function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader) { self::$_pluginLoader = $loader; } @@ -513,13 +541,14 @@ public static function setPluginLoader(PluginLoader\PluginLoaderInterface $loade /** * Get plugin loader for use with Extensions * - * @return \Zend\Loader\PluginLoader\PluginLoaderInterface $loader + * @return Zend_Loader_PluginLoader_Interface $loader */ public static function getPluginLoader() { if (!isset(self::$_pluginLoader)) { - self::$_pluginLoader = new PluginLoader\PluginLoader(array( - 'Zend\Feed\Reader\Extension\\' => 'Zend/Feed/Reader/Extension/', + require_once 'Zend/Loader/PluginLoader.php'; + self::$_pluginLoader = new Zend_Loader_PluginLoader(array( + 'Zend_Feed_Reader_Extension_' => 'Zend/Feed/Reader/Extension/', )); } return self::$_pluginLoader; @@ -534,7 +563,7 @@ public static function getPluginLoader() */ public static function addPrefixPath($prefix, $path) { - $prefix = rtrim($prefix, '\\'); + $prefix = rtrim($prefix, '_'); $path = rtrim($path, DIRECTORY_SEPARATOR); self::getPluginLoader()->addPrefixPath($prefix, $path); } @@ -562,12 +591,12 @@ public static function addPrefixPaths(array $spec) * * @param string $name * @return void - * @throws \Zend\Feed\Exception if unable to resolve Extension class + * @throws Zend_Feed_Exception if unable to resolve Extension class */ public static function registerExtension($name) { - $feedName = $name . '\Feed'; - $entryName = $name . '\Entry'; + $feedName = $name . '_Feed'; + $entryName = $name . '_Entry'; if (self::isRegistered($name)) { if (self::getPluginLoader()->isLoaded($feedName) || self::getPluginLoader()->isLoaded($entryName)) { @@ -577,17 +606,18 @@ public static function registerExtension($name) try { self::getPluginLoader()->load($feedName); self::$_extensions['feed'][] = $feedName; - } catch (PluginLoader\Exception $e) { + } catch (Zend_Loader_PluginLoader_Exception $e) { } try { self::getPluginLoader()->load($entryName); self::$_extensions['entry'][] = $entryName; - } catch (PluginLoader\Exception $e) { + } catch (Zend_Loader_PluginLoader_Exception $e) { } if (!self::getPluginLoader()->isLoaded($feedName) && !self::getPluginLoader()->isLoaded($entryName) ) { - throw new \Zend\Feed\Exception('Could not load extension: ' . $name + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Could not load extension: ' . $name . 'using Plugin Loader. Check prefix paths are configured and extension exists.'); } } @@ -600,8 +630,8 @@ public static function registerExtension($name) */ public static function isRegistered($extensionName) { - $feedName = $extensionName . '\Feed'; - $entryName = $extensionName . '\Entry'; + $feedName = $extensionName . '_Feed'; + $entryName = $extensionName . '_Entry'; if (in_array($feedName, self::$_extensions['feed']) || in_array($entryName, self::$_extensions['entry']) ) { diff --git a/src/Reader/Collection/Collection.php b/src/Reader/Collection.php similarity index 86% rename from src/Reader/Collection/Collection.php rename to src/Reader/Collection.php index bbc976ed..64af8483 100644 --- a/src/Reader/Collection/Collection.php +++ b/src/Reader/Collection.php @@ -16,22 +16,16 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Collection.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ /** - * @namespace - */ -namespace Zend\Feed\Reader\Collection; - -/** - * @uses ArrayObject * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Collection extends \ArrayObject +class Zend_Feed_Reader_Collection extends ArrayObject { diff --git a/src/Reader/Collection/Author.php b/src/Reader/Collection/Author.php index 38b5d861..98a8aea2 100644 --- a/src/Reader/Collection/Author.php +++ b/src/Reader/Collection/Author.php @@ -16,23 +16,22 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Author.php 20096 2010-01-06 02:05:09Z bkarwin $ */ - + /** - * @namespace + * @see Zend_Feed_Reader_Collection_CollectionAbstract */ -namespace Zend\Feed\Reader\Collection; +require_once 'Zend/Feed/Reader/Collection/CollectionAbstract.php'; /** - * @uses \Zend\Feed\Reader\Collection\CollectionAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Author - extends CollectionAbstract +class Zend_Feed_Reader_Collection_Author +extends Zend_Feed_Reader_Collection_CollectionAbstract { /** diff --git a/src/Reader/Collection/Category.php b/src/Reader/Collection/Category.php index ebd76ab9..f7230af9 100644 --- a/src/Reader/Collection/Category.php +++ b/src/Reader/Collection/Category.php @@ -16,23 +16,22 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Category.php 20953 2010-02-06 17:55:34Z padraic $ */ - + /** - * @namespace + * @see Zend_Feed_Reader_Collection_CollectionAbstract */ -namespace Zend\Feed\Reader\Collection; +require_once 'Zend/Feed/Reader/Collection/CollectionAbstract.php'; /** - * @uses \Zend\Feed\Reader\Collection\CollectionAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Category - extends CollectionAbstract +class Zend_Feed_Reader_Collection_Category +extends Zend_Feed_Reader_Collection_CollectionAbstract { /** diff --git a/src/Reader/Collection/CollectionAbstract.php b/src/Reader/Collection/CollectionAbstract.php index dcb5bad4..7b6dbd03 100644 --- a/src/Reader/Collection/CollectionAbstract.php +++ b/src/Reader/Collection/CollectionAbstract.php @@ -16,22 +16,16 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: CollectionAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace - */ -namespace Zend\Feed\Reader\Collection; - -/** - * @uses ArrayObject * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class CollectionAbstract extends \ArrayObject +abstract class Zend_Feed_Reader_Collection_CollectionAbstract extends ArrayObject { /** diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index 36af8378..308deba5 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -16,27 +16,36 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Atom.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace + * @see Zend_Feed_Reader */ -namespace Zend\Feed\Reader\Entry; -use Zend\Feed\Reader; +require_once 'Zend/Feed/Reader.php'; + +/** + * @see Zend_Feed_Reader_EntryInterface + */ +require_once 'Zend/Feed/Reader/EntryInterface.php'; + +/** + * @see Zend_Feed_Reader_EntryAbstract + */ +require_once 'Zend/Feed/Reader/EntryAbstract.php'; + +/** + * @see Zend_Feed_Reader_Extension_Atom_Entry + */ +require_once 'Zend/Feed/Reader/Extension/Atom/Entry.php'; /** - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\EntryAbstract - * @uses \Zend\Feed\Reader\EntryInterface - * @uses \Zend\Feed\Reader\Extension\Atom\Entry * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Atom - extends Reader\EntryAbstract +class Zend_Feed_Reader_Entry_Atom extends Zend_Feed_Reader_EntryAbstract implements Zend_Feed_Reader_EntryInterface { /** * XPath query @@ -53,21 +62,21 @@ class Atom * @param string $type * @return void */ - public function __construct(\DOMElement $entry, $entryKey, $type = null) + public function __construct(DOMElement $entry, $entryKey, $type = null) { parent::__construct($entry, $entryKey, $type); // Everyone by now should know XPath indices start from 1 not 0 $this->_xpathQuery = '//atom:entry[' . ($this->_entryKey + 1) . ']'; - $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\Entry'); - $this->_extensions['Atom\Entry'] = new $atomClass($entry, $entryKey, $type); + $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Entry'); + $this->_extensions['Atom_Entry'] = new $atomClass($entry, $entryKey, $type); - $threadClass = Reader\Reader::getPluginLoader()->getClassName('Thread\Entry'); - $this->_extensions['Thread\Entry'] = new $threadClass($entry, $entryKey, $type); + $threadClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Thread_Entry'); + $this->_extensions['Thread_Entry'] = new $threadClass($entry, $entryKey, $type); - $threadClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\Entry'); - $this->_extensions['DublinCore\Entry'] = new $threadClass($entry, $entryKey, $type); + $threadClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Entry'); + $this->_extensions['DublinCore_Entry'] = new $threadClass($entry, $entryKey, $type); } /** @@ -339,7 +348,7 @@ public function getCommentFeedLink() /** * Get category data as a Zend_Feed_Reader_Collection_Category object * - * @return \Zend\Feed\Reader\Collection\Category + * @return Zend_Feed_Reader_Collection_Category */ public function getCategories() { @@ -361,7 +370,7 @@ public function getCategories() /** * Get source feed metadata from the entry * - * @return \Zend\Feed\Reader\Feed\Atom\Source|null + * @return Zend_Feed_Reader_Feed_Atom_Source|null */ public function getSource() { @@ -381,7 +390,7 @@ public function getSource() * * @param DOMXPath $xpath */ - public function setXpath(\DOMXPath $xpath) + public function setXpath(DOMXPath $xpath) { parent::setXpath($xpath); foreach ($this->_extensions as $extension) { diff --git a/src/Reader/Entry/RSS.php b/src/Reader/Entry/RSS.php deleted file mode 100644 index 27e5e190..00000000 --- a/src/Reader/Entry/RSS.php +++ /dev/null @@ -1,629 +0,0 @@ -_xpathQueryRss = '//item[' . ($this->_entryKey+1) . ']'; - $this->_xpathQueryRdf = '//rss:item[' . ($this->_entryKey+1) . ']'; - - $pluginLoader = Reader\Reader::getPluginLoader(); - - $dublinCoreClass = $pluginLoader->getClassName('DublinCore\Entry'); - $this->_extensions['DublinCore\Entry'] = new $dublinCoreClass($entry, $entryKey, $type); - - $contentClass = $pluginLoader->getClassName('Content\Entry'); - $this->_extensions['Content\Entry'] = new $contentClass($entry, $entryKey, $type); - - $atomClass = $pluginLoader->getClassName('Atom\Entry'); - $this->_extensions['Atom\Entry'] = new $atomClass($entry, $entryKey, $type); - - $wfwClass = $pluginLoader->getClassName('WellFormedWeb\Entry'); - $this->_extensions['WellFormedWeb\Entry'] = new $wfwClass($entry, $entryKey, $type); - - $slashClass = $pluginLoader->getClassName('Slash\Entry'); - $this->_extensions['Slash\Entry'] = new $slashClass($entry, $entryKey, $type); - - $threadClass = $pluginLoader->getClassName('Thread\Entry'); - $this->_extensions['Thread\Entry'] = new $threadClass($entry, $entryKey, $type); - } - - /** - * Get an author entry - * - * @param DOMElement $element - * @return string - */ - public function getAuthor($index = 0) - { - $authors = $this->getAuthors(); - - if (isset($authors[$index])) { - return $authors[$index]; - } - - return null; - } - - /** - * Get an array with feed authors - * - * @return array - */ - public function getAuthors() - { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; - } - - $authors = array(); - $authors_dc = $this->getExtension('DublinCore')->getAuthors(); - if (!empty($authors_dc)) { - foreach ($authors_dc as $author) { - $authors[] = array( - 'name' => $author['name'] - ); - } - } - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $list = $this->_xpath->query($this->_xpathQueryRss . '//author'); - } else { - $list = $this->_xpath->query($this->_xpathQueryRdf . '//rss:author'); - } - if ($list->length) { - foreach ($list as $author) { - $string = trim($author->nodeValue); - $email = null; - $name = null; - $data = array(); - // Pretty rough parsing - but it's a catchall - if (preg_match("/^.*@[^ ]*/", $string, $matches)) { - $data['email'] = trim($matches[0]); - if (preg_match("/\((.*)\)$/", $string, $matches)) { - $data['name'] = $matches[1]; - } - $authors[] = $data; - } - } - } - - if (count($authors) == 0) { - $authors = $this->getExtension('Atom')->getAuthors(); - } else { - $authors = new Reader\Collection\Author( - Reader\Reader::arrayUnique($authors) - ); - } - - if (count($authors) == 0) { - $authors = null; - } - - $this->_data['authors'] = $authors; - - return $this->_data['authors']; - } - - /** - * Get the entry content - * - * @return string - */ - public function getContent() - { - if (array_key_exists('content', $this->_data)) { - return $this->_data['content']; - } - - $content = $this->getExtension('Content')->getContent(); - - if (!$content) { - $content = $this->getDescription(); - } - - if (empty($content)) { - $content = $this->getExtension('Atom')->getContent(); - } - - $this->_data['content'] = $content; - - return $this->_data['content']; - } - - /** - * Get the entry's date of creation - * - * @return string - */ - public function getDateCreated() - { - return $this->getDateModified(); - } - - /** - * Get the entry's date of modification - * - * @return string - */ - public function getDateModified() - { - if (array_key_exists('datemodified', $this->_data)) { - return $this->_data['datemodified']; - } - - $dateModified = null; - $date = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090 - ) { - $dateModified = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/pubDate)'); - if ($dateModified) { - $dateStandards = array(Date\Date::RSS, Date\Date::RFC_822, - Date\Date::RFC_2822, Date\Date::DATES); - $date = new Date\Date; - foreach ($dateStandards as $standard) { - try { - $date->set($dateModified, $standard); - break; - } catch (Date\Exception $e) { - if ($standard == Date\Date::DATES) { - throw new \Zend\Feed\Exception( - 'Could not load date due to unrecognised' - .' format (should follow RFC 822 or 2822):' - . $e->getMessage(), - 0, $e - ); - } - } - } - } - } - - if (!$date) { - $date = $this->getExtension('DublinCore')->getDate(); - } - - if (!$date) { - $date = $this->getExtension('Atom')->getDateModified(); - } - - if (!$date) { - $date = null; - } - - $this->_data['datemodified'] = $date; - - return $this->_data['datemodified']; - } - - /** - * Get the entry description - * - * @return string - */ - public function getDescription() - { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; - } - - $description = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090 - ) { - $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/description)'); - } else { - $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRdf.'/rss:description)'); - } - - if (!$description) { - $description = $this->getExtension('DublinCore')->getDescription(); - } - - if (empty($description)) { - $description = $this->getExtension('Atom')->getDescription(); - } - - if (!$description) { - $description = null; - } else { - $description = html_entity_decode($description, ENT_QUOTES, $this->getEncoding()); - } - - $this->_data['description'] = $description; - - return $this->_data['description']; - } - - /** - * Get the entry enclosure - * @return string - */ - public function getEnclosure() - { - if (array_key_exists('enclosure', $this->_data)) { - return $this->_data['enclosure']; - } - - $enclosure = null; - - if ($this->getType() == Reader\Reader::TYPE_RSS_20) { - $nodeList = $this->_xpath->query($this->_xpathQueryRss . '/enclosure'); - - if ($nodeList->length > 0) { - $enclosure = new \stdClass(); - $enclosure->url = $nodeList->item(0)->getAttribute('url'); - $enclosure->length = $nodeList->item(0)->getAttribute('length'); - $enclosure->type = $nodeList->item(0)->getAttribute('type'); - } - } - - if (!$enclosure) { - $enclosure = $this->getExtension('Atom')->getEnclosure(); - } - - $this->_data['enclosure'] = $enclosure; - - return $this->_data['enclosure']; - } - - /** - * Get the entry ID - * - * @return string - */ - public function getId() - { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; - } - - $id = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090 - ) { - $id = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/guid)'); - } - - if (!$id) { - $id = $this->getExtension('DublinCore')->getId(); - } - - if (empty($id)) { - $id = $this->getExtension('Atom')->getId(); - } - - if (!$id) { - if ($this->getPermalink()) { - $id = $this->getPermalink(); - } elseif ($this->getTitle()) { - $id = $this->getTitle(); - } else { - $id = null; - } - } - - $this->_data['id'] = $id; - - return $this->_data['id']; - } - - /** - * Get a specific link - * - * @param int $index - * @return string - */ - public function getLink($index = 0) - { - if (!array_key_exists('links', $this->_data)) { - $this->getLinks(); - } - - if (isset($this->_data['links'][$index])) { - return $this->_data['links'][$index]; - } - - return null; - } - - /** - * Get all links - * - * @return array - */ - public function getLinks() - { - if (array_key_exists('links', $this->_data)) { - return $this->_data['links']; - } - - $links = array(); - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $list = $this->_xpath->query($this->_xpathQueryRss.'//link'); - } else { - $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:link'); - } - - if (!$list->length) { - $links = $this->getExtension('Atom')->getLinks(); - } else { - foreach ($list as $link) { - $links[] = $link->nodeValue; - } - } - - $this->_data['links'] = $links; - - return $this->_data['links']; - } - - /** - * Get all categories - * - * @return \Zend\Feed\Reader\Collection\Category - */ - public function getCategories() - { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; - } - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $list = $this->_xpath->query($this->_xpathQueryRss.'//category'); - } else { - $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:category'); - } - - if ($list->length) { - $categoryCollection = new Reader\Collection\Category; - foreach ($list as $category) { - $categoryCollection[] = array( - 'term' => $category->nodeValue, - 'scheme' => $category->getAttribute('domain'), - 'label' => $category->nodeValue, - ); - } - } else { - $categoryCollection = $this->getExtension('DublinCore')->getCategories(); - } - - if (count($categoryCollection) == 0) { - $categoryCollection = $this->getExtension('Atom')->getCategories(); - } - - $this->_data['categories'] = $categoryCollection; - - return $this->_data['categories']; - } - - /** - * Get a permalink to the entry - * - * @return string - */ - public function getPermalink() - { - return $this->getLink(0); - } - - /** - * Get the entry title - * - * @return string - */ - public function getTitle() - { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; - } - - $title = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090 - ) { - $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/title)'); - } else { - $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRdf.'/rss:title)'); - } - - if (!$title) { - $title = $this->getExtension('DublinCore')->getTitle(); - } - - if (!$title) { - $title = $this->getExtension('Atom')->getTitle(); - } - - if (!$title) { - $title = null; - } - - $this->_data['title'] = $title; - - return $this->_data['title']; - } - - /** - * Get the number of comments/replies for current entry - * - * @return string|null - */ - public function getCommentCount() - { - if (array_key_exists('commentcount', $this->_data)) { - return $this->_data['commentcount']; - } - - $commentcount = $this->getExtension('Slash')->getCommentCount(); - - if (!$commentcount) { - $commentcount = $this->getExtension('Thread')->getCommentCount(); - } - - if (!$commentcount) { - $commentcount = $this->getExtension('Atom')->getCommentCount(); - } - - if (!$commentcount) { - $commentcount = null; - } - - $this->_data['commentcount'] = $commentcount; - - return $this->_data['commentcount']; - } - - /** - * Returns a URI pointing to the HTML page where comments can be made on this entry - * - * @return string - */ - public function getCommentLink() - { - if (array_key_exists('commentlink', $this->_data)) { - return $this->_data['commentlink']; - } - - $commentlink = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090 - ) { - $commentlink = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/comments)'); - } - - if (!$commentlink) { - $commentlink = $this->getExtension('Atom')->getCommentLink(); - } - - if (!$commentlink) { - $commentlink = null; - } - - $this->_data['commentlink'] = $commentlink; - - return $this->_data['commentlink']; - } - - /** - * Returns a URI pointing to a feed of all comments for this entry - * - * @return string - */ - public function getCommentFeedLink() - { - if (array_key_exists('commentfeedlink', $this->_data)) { - return $this->_data['commentfeedlink']; - } - - $commentfeedlink = $this->getExtension('WellFormedWeb')->getCommentFeedLink(); - - if (!$commentfeedlink) { - $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink('rss'); - } - - if (!$commentfeedlink) { - $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink('rdf'); - } - - if (!$commentfeedlink) { - $commentfeedlink = null; - } - - $this->_data['commentfeedlink'] = $commentfeedlink; - - return $this->_data['commentfeedlink']; - } - - /** - * Set the XPath query (incl. on all Extensions) - * - * @param DOMXPath $xpath - */ - public function setXpath(\DOMXPath $xpath) - { - parent::setXpath($xpath); - foreach ($this->_extensions as $extension) { - $extension->setXpath($this->_xpath); - } - } -} diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index 27e5e190..4a9d3ab2 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -16,38 +16,73 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Rss.php 22300 2010-05-26 10:13:34Z padraic $ */ /** - * @namespace + * @see Zend_Feed_Reader */ -namespace Zend\Feed\Reader\Entry; -use Zend\Feed\Reader; -use Zend\Date; +require_once 'Zend/Feed/Reader.php'; + +/** + * @see Zend_Feed_Reader_EntryInterface + */ +require_once 'Zend/Feed/Reader/EntryInterface.php'; + +/** + * @see Zend_Feed_Reader_EntryAbstract + */ +require_once 'Zend/Feed/Reader/EntryAbstract.php'; + +/** + * @see Zend_Feed_Reader_Extension_DublinCore_Entry + */ +require_once 'Zend/Feed/Reader/Extension/DublinCore/Entry.php'; + +/** + * @see Zend_Feed_Reader_Extension_Content_Entry + */ +require_once 'Zend/Feed/Reader/Extension/Content/Entry.php'; + +/** + * @see Zend_Feed_Reader_Extension_Atom_Entry + */ +require_once 'Zend/Feed/Reader/Extension/Atom/Entry.php'; + +/** + * @see Zend_Feed_Reader_Extension_WellformedWeb_Entry + */ +require_once 'Zend/Feed/Reader/Extension/WellFormedWeb/Entry.php'; + +/** + * @see Zend_Feed_Reader_Extension_Slash_Entry + */ +require_once 'Zend/Feed/Reader/Extension/Slash/Entry.php'; + +/** + * @see Zend_Feed_Reader_Extension_Thread_Entry + */ +require_once 'Zend/Feed/Reader/Extension/Thread/Entry.php'; + +/** + * @see Zend_Date + */ +require_once 'Zend/Date.php'; + +/** + * @see Zend_Feed_Reader_Collection_Category + */ +require_once 'Zend/Feed/Reader/Collection/Category.php'; /** - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Collection\Category - * @uses \Zend\Feed\Reader\EntryAbstract - * @uses \Zend\Feed\Reader\EntryInterface - * @uses \Zend\Feed\Reader\Extension\Atom\Entry - * @uses \Zend\Feed\Reader\Extension\Content\Entry - * @uses \Zend\Feed\Reader\Extension\DublinCore\Entry - * @uses \Zend\Feed\Reader\Extension\Slash\Entry - * @uses \Zend\Feed\Reader\Extension\Thread\Entry - * @uses Zend_Feed_Reader_Extension_WellformedWeb_Entry * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class RSS - extends Reader\EntryAbstract - implements Reader\EntryInterface +class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_EntryAbstract implements Zend_Feed_Reader_EntryInterface { + /** * XPath query for RDF * @@ -65,36 +100,36 @@ class RSS /** * Constructor * - * @param \Zend\Feed\Entry\AbstractEntry $entry + * @param Zend_Feed_Entry_Abstract $entry * @param string $entryKey * @param string $type * @return void */ - public function __construct(\DOMElement $entry, $entryKey, $type = null) + public function __construct(DOMElement $entry, $entryKey, $type = null) { parent::__construct($entry, $entryKey, $type); $this->_xpathQueryRss = '//item[' . ($this->_entryKey+1) . ']'; $this->_xpathQueryRdf = '//rss:item[' . ($this->_entryKey+1) . ']'; - $pluginLoader = Reader\Reader::getPluginLoader(); + $pluginLoader = Zend_Feed_Reader::getPluginLoader(); - $dublinCoreClass = $pluginLoader->getClassName('DublinCore\Entry'); - $this->_extensions['DublinCore\Entry'] = new $dublinCoreClass($entry, $entryKey, $type); + $dublinCoreClass = $pluginLoader->getClassName('DublinCore_Entry'); + $this->_extensions['DublinCore_Entry'] = new $dublinCoreClass($entry, $entryKey, $type); - $contentClass = $pluginLoader->getClassName('Content\Entry'); - $this->_extensions['Content\Entry'] = new $contentClass($entry, $entryKey, $type); + $contentClass = $pluginLoader->getClassName('Content_Entry'); + $this->_extensions['Content_Entry'] = new $contentClass($entry, $entryKey, $type); - $atomClass = $pluginLoader->getClassName('Atom\Entry'); - $this->_extensions['Atom\Entry'] = new $atomClass($entry, $entryKey, $type); + $atomClass = $pluginLoader->getClassName('Atom_Entry'); + $this->_extensions['Atom_Entry'] = new $atomClass($entry, $entryKey, $type); - $wfwClass = $pluginLoader->getClassName('WellFormedWeb\Entry'); - $this->_extensions['WellFormedWeb\Entry'] = new $wfwClass($entry, $entryKey, $type); + $wfwClass = $pluginLoader->getClassName('WellFormedWeb_Entry'); + $this->_extensions['WellFormedWeb_Entry'] = new $wfwClass($entry, $entryKey, $type); - $slashClass = $pluginLoader->getClassName('Slash\Entry'); - $this->_extensions['Slash\Entry'] = new $slashClass($entry, $entryKey, $type); + $slashClass = $pluginLoader->getClassName('Slash_Entry'); + $this->_extensions['Slash_Entry'] = new $slashClass($entry, $entryKey, $type); - $threadClass = $pluginLoader->getClassName('Thread\Entry'); - $this->_extensions['Thread\Entry'] = new $threadClass($entry, $entryKey, $type); + $threadClass = $pluginLoader->getClassName('Thread_Entry'); + $this->_extensions['Thread_Entry'] = new $threadClass($entry, $entryKey, $type); } /** @@ -135,8 +170,8 @@ public function getAuthors() } } - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 + && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $list = $this->_xpath->query($this->_xpathQueryRss . '//author'); } else { $list = $this->_xpath->query($this->_xpathQueryRdf . '//rss:author'); @@ -161,8 +196,8 @@ public function getAuthors() if (count($authors) == 0) { $authors = $this->getExtension('Atom')->getAuthors(); } else { - $authors = new Reader\Collection\Author( - Reader\Reader::arrayUnique($authors) + $authors = new Zend_Feed_Reader_Collection_Author( + Zend_Feed_Reader::arrayUnique($authors) ); } @@ -225,26 +260,32 @@ public function getDateModified() $dateModified = null; $date = null; - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090 + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 + && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 ) { $dateModified = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/pubDate)'); if ($dateModified) { - $dateStandards = array(Date\Date::RSS, Date\Date::RFC_822, - Date\Date::RFC_2822, Date\Date::DATES); - $date = new Date\Date; - foreach ($dateStandards as $standard) { - try { - $date->set($dateModified, $standard); - break; - } catch (Date\Exception $e) { - if ($standard == Date\Date::DATES) { - throw new \Zend\Feed\Exception( - 'Could not load date due to unrecognised' - .' format (should follow RFC 822 or 2822):' - . $e->getMessage(), - 0, $e - ); + $dateModifiedParsed = strtotime($dateModified); + if ($dateModifiedParsed) { + $date = new Zend_Date($dateModifiedParsed); + } else { + $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, $standard); + break; + } 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):' + . $e->getMessage(), + 0, $e + ); + } } } } @@ -281,8 +322,8 @@ public function getDescription() $description = null; - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090 + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 + && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 ) { $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/description)'); } else { @@ -299,8 +340,6 @@ public function getDescription() if (!$description) { $description = null; - } else { - $description = html_entity_decode($description, ENT_QUOTES, $this->getEncoding()); } $this->_data['description'] = $description; @@ -320,11 +359,11 @@ public function getEnclosure() $enclosure = null; - if ($this->getType() == Reader\Reader::TYPE_RSS_20) { + if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_20) { $nodeList = $this->_xpath->query($this->_xpathQueryRss . '/enclosure'); if ($nodeList->length > 0) { - $enclosure = new \stdClass(); + $enclosure = new stdClass(); $enclosure->url = $nodeList->item(0)->getAttribute('url'); $enclosure->length = $nodeList->item(0)->getAttribute('length'); $enclosure->type = $nodeList->item(0)->getAttribute('type'); @@ -353,8 +392,8 @@ public function getId() $id = null; - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090 + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 + && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 ) { $id = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/guid)'); } @@ -414,8 +453,8 @@ public function getLinks() $links = array(); - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $list = $this->_xpath->query($this->_xpathQueryRss.'//link'); } else { $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:link'); @@ -437,7 +476,7 @@ public function getLinks() /** * Get all categories * - * @return \Zend\Feed\Reader\Collection\Category + * @return Zend_Feed_Reader_Collection_Category */ public function getCategories() { @@ -445,15 +484,15 @@ public function getCategories() return $this->_data['categories']; } - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $list = $this->_xpath->query($this->_xpathQueryRss.'//category'); } else { $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:category'); } if ($list->length) { - $categoryCollection = new Reader\Collection\Category; + $categoryCollection = new Zend_Feed_Reader_Collection_Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->nodeValue, @@ -497,8 +536,8 @@ public function getTitle() $title = null; - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090 + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 + && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 ) { $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/title)'); } else { @@ -565,8 +604,8 @@ public function getCommentLink() $commentlink = null; - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090 + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 + && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 ) { $commentlink = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/comments)'); } @@ -619,7 +658,7 @@ public function getCommentFeedLink() * * @param DOMXPath $xpath */ - public function setXpath(\DOMXPath $xpath) + public function setXpath(DOMXPath $xpath) { parent::setXpath($xpath); foreach ($this->_extensions as $extension) { diff --git a/src/Reader/EntryAbstract.php b/src/Reader/EntryAbstract.php index a6f66c13..193bb65c 100644 --- a/src/Reader/EntryAbstract.php +++ b/src/Reader/EntryAbstract.php @@ -16,23 +16,16 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: EntryAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace - */ -namespace Zend\Feed\Reader; - -/** - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Reader\Reader * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class EntryAbstract +abstract class Zend_Feed_Reader_EntryAbstract { /** * Feed entry data @@ -84,7 +77,7 @@ abstract class EntryAbstract * @param string $type * @return void */ - public function __construct(\DOMElement $entry, $entryKey, $type = null) + public function __construct(DOMElement $entry, $entryKey, $type = null) { $this->_entry = $entry; $this->_entryKey = $entryKey; @@ -92,7 +85,7 @@ public function __construct(\DOMElement $entry, $entryKey, $type = null) if ($type !== null) { $this->_data['type'] = $type; } else { - $this->_data['type'] = Reader::detectType($feed); + $this->_data['type'] = Zend_Feed_Reader::detectType($feed); } $this->_loadExtensions(); } @@ -138,7 +131,7 @@ public function getEncoding() */ public function saveXml() { - $dom = new \DOMDocument('1.0', $this->getEncoding()); + $dom = new DOMDocument('1.0', $this->getEncoding()); $entry = $dom->importNode($this->getElement(), true); $dom->appendChild($entry); return $dom->saveXml(); @@ -162,7 +155,7 @@ public function getType() public function getXpath() { if (!$this->_xpath) { - $this->setXpath(new \DOMXPath($this->getDomDocument())); + $this->setXpath(new DOMXPath($this->getDomDocument())); } return $this->_xpath; } @@ -173,7 +166,7 @@ public function getXpath() * @param DOMXPath $xpath * @return Zend_Feed_Reader_Entry_EntryAbstract */ - public function setXpath(\DOMXPath $xpath) + public function setXpath(DOMXPath $xpath) { $this->_xpath = $xpath; return $this; @@ -193,12 +186,12 @@ public function getExtensions() * Return an Extension object with the matching name (postfixed with _Entry) * * @param string $name - * @return \Zend\Feed\Reader\Extension\EntryAbstract + * @return Zend_Feed_Reader_Extension_EntryAbstract */ public function getExtension($name) { - if (array_key_exists($name . '\Entry', $this->_extensions)) { - return $this->_extensions[$name . '\Entry']; + if (array_key_exists($name . '_Entry', $this->_extensions)) { + return $this->_extensions[$name . '_Entry']; } return null; } @@ -209,7 +202,7 @@ public function getExtension($name) * @param string $method * @param array $args * @return mixed - * @throws \Zend\Feed\Exception if no extensions implements the method + * @throws Zend_Feed_Exception if no extensions implements the method */ public function __call($method, $args) { @@ -218,7 +211,8 @@ public function __call($method, $args) return call_user_func_array(array($extension, $method), $args); } } - throw new \Zend\Feed\Exception('Method: ' . $method + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Method: ' . $method . 'does not exist and could not be located on a registered Extension'); } @@ -229,13 +223,13 @@ public function __call($method, $args) */ protected function _loadExtensions() { - $all = Reader::getExtensions(); + $all = Zend_Feed_Reader::getExtensions(); $feed = $all['entry']; foreach ($feed as $extension) { if (in_array($extension, $all['core'])) { continue; } - $className = Reader::getPluginLoader()->getClassName($extension); + $className = Zend_Feed_Reader::getPluginLoader()->getClassName($extension); $this->_extensions[$extension] = new $className( $this->getElement(), $this->_entryKey, $this->_data['type'] ); diff --git a/src/Reader/EntryInterface.php b/src/Reader/EntryInterface.php index 5d72bcdd..392a533a 100644 --- a/src/Reader/EntryInterface.php +++ b/src/Reader/EntryInterface.php @@ -16,21 +16,16 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: EntryInterface.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -/** - * @namespace - */ -namespace Zend\Feed\Reader; - /** * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface EntryInterface +interface Zend_Feed_Reader_EntryInterface { /** * Get the specified author @@ -142,7 +137,7 @@ public function getCommentFeedLink(); /** * Get all categories * - * @return \Zend\Feed\Reader\Collection\Category + * @return Zend_Feed_Reader_Collection_Category */ public function getCategories(); } diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 4a9a11b0..5bdab0df 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -16,35 +16,47 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Entry.php 22300 2010-05-26 10:13:34Z padraic $ */ /** - * @namespace + * @see Zend_Feed_Reader */ -namespace Zend\Feed\Reader\Extension\Atom; -use Zend\Feed\Reader; -use Zend\Date; -use Zend\Feed\Reader\Collection; -use Zend\URI; +require_once 'Zend/Feed/Reader.php'; + +/** + * @see Zend_Feed_Reader_Extension_EntryAbstract + */ +require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; + +/** + * @see Zend_Date + */ +require_once 'Zend/Date.php'; + +/** + * @see Zend_Uri + */ +require_once 'Zend/Uri.php'; + +/** + * @see Zend_Feed_Reader_Collection_Category + */ +require_once 'Zend/Feed/Reader/Collection/Category.php'; + +/** + * @see Zend_Feed_Reader_Feed_Atom_Source + */ +require_once 'Zend/Feed/Reader/Feed/Atom/Source.php'; /** - * @uses DOMDocument - * @uses stdClass - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Feed\Atom\Source - * @uses \Zend\Feed\Reader\Collection\Author - * @uses \Zend\Feed\Reader\Collection\Category - * @uses \Zend\Feed\Reader\Extension\EntryAbstract - * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends Reader\Extension\EntryAbstract +class Zend_Feed_Reader_Extension_Atom_Entry + extends Zend_Feed_Reader_Extension_EntryAbstract { /** * Get the specified author @@ -96,8 +108,8 @@ public function getAuthors() if (count($authors) == 0) { $authors = null; } else { - $authors = new Collection\Author( - Reader\Reader::arrayUnique($authors) + $authors = new Zend_Feed_Reader_Collection_Author( + Zend_Feed_Reader::arrayUnique($authors) ); } @@ -136,7 +148,7 @@ public function getContent() $this->getXpathPrefix() . '/atom:content/xhtml:div' )->item(0); //$xhtml->setAttribute('xmlns', 'http://www.w3.org/1999/xhtml'); - $d = new \DOMDocument('1.0', $this->getEncoding()); + $d = new DOMDocument('1.0', $this->getEncoding()); $xhtmls = $d->importNode($xhtml, true); $d->appendChild($xhtmls); $content = $this->_collectXhtml( @@ -188,15 +200,15 @@ public function getDateCreated() $date = null; - if ($this->_getAtomType() === Reader\Reader::TYPE_ATOM_03) { + if ($this->_getAtomType() === Zend_Feed_Reader::TYPE_ATOM_03) { $dateCreated = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:created)'); } else { $dateCreated = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:published)'); } if ($dateCreated) { - $date = new Date\Date; - $date->set($dateCreated, Date\Date::ISO_8601); + $date = new Zend_Date; + $date->set($dateCreated, Zend_Date::ISO_8601); } $this->_data['datecreated'] = $date; @@ -217,15 +229,15 @@ public function getDateModified() $date = null; - if ($this->_getAtomType() === Reader\Reader::TYPE_ATOM_03) { + if ($this->_getAtomType() === Zend_Feed_Reader::TYPE_ATOM_03) { $dateModified = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)'); } else { $dateModified = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)'); } if ($dateModified) { - $date = new Date\Date; - $date->set($dateModified, Date\Date::ISO_8601); + $date = new Zend_Date; + $date->set($dateModified, Zend_Date::ISO_8601); } $this->_data['datemodified'] = $date; @@ -248,8 +260,6 @@ public function getDescription() if (!$description) { $description = null; - } else { - $description = html_entity_decode($description, ENT_QUOTES, $this->getEncoding()); } $this->_data['description'] = $description; @@ -273,7 +283,7 @@ public function getEnclosure() $nodeList = $this->getXpath()->query($this->getXpathPrefix() . '/atom:link[@rel="enclosure"]'); if ($nodeList->length > 0) { - $enclosure = new \stdClass(); + $enclosure = new stdClass(); $enclosure->url = $nodeList->item(0)->getAttribute('href'); $enclosure->length = $nodeList->item(0)->getAttribute('length'); $enclosure->type = $nodeList->item(0)->getAttribute('type'); @@ -413,8 +423,6 @@ public function getTitle() if (!$title) { $title = null; - } else { - $title = html_entity_decode($title, ENT_QUOTES, $this->getEncoding()); } $this->_data['title'] = $title; @@ -506,7 +514,7 @@ public function getCommentFeedLink($type = 'atom') /** * Get all categories * - * @return \Zend\Feed\Reader\Collection\Category + * @return Zend_Feed_Reader_Collection_Category */ public function getCategories() { @@ -514,7 +522,7 @@ public function getCategories() return $this->_data['categories']; } - if ($this->_getAtomType() == Reader\Reader::TYPE_ATOM_10) { + if ($this->_getAtomType() == Zend_Feed_Reader::TYPE_ATOM_10) { $list = $this->getXpath()->query($this->getXpathPrefix() . '//atom:category'); } else { /** @@ -522,21 +530,21 @@ public function getCategories() * Dublin Core extension. However there is a small possibility Atom 0.3 * may have been retrofittied to use Atom 1.0 instead. */ - $this->getXpath()->registerNamespace('atom10', Reader\Reader::NAMESPACE_ATOM_10); + $this->getXpath()->registerNamespace('atom10', Zend_Feed_Reader::NAMESPACE_ATOM_10); $list = $this->getXpath()->query($this->getXpathPrefix() . '//atom10:category'); } if ($list->length) { - $categoryCollection = new Collection\Category; + $categoryCollection = new Zend_Feed_Reader_Collection_Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->getAttribute('term'), 'scheme' => $category->getAttribute('scheme'), - 'label' => html_entity_decode($category->getAttribute('label')) + 'label' => $category->getAttribute('label') ); } } else { - return new Collection\Category; + return new Zend_Feed_Reader_Collection_Category; } $this->_data['categories'] = $categoryCollection; @@ -547,7 +555,7 @@ public function getCategories() /** * Get source feed metadata from the entry * - * @return \Zend\Feed\Reader\Feed\Atom\Source|null + * @return Zend_Feed_Reader_Feed_Atom_Source|null */ public function getSource() { @@ -557,11 +565,11 @@ public function getSource() $source = null; // TODO: Investigate why _getAtomType() fails here. Is it even needed? - if ($this->getType() == Reader\Reader::TYPE_ATOM_10) { + if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10) { $list = $this->getXpath()->query($this->getXpathPrefix() . '/atom:source[1]'); if ($list->length) { $element = $list->item(0); - $source = new Reader\Feed\Atom\Source($element, $this->getXpathPrefix()); + $source = new Zend_Feed_Reader_Feed_Atom_Source($element, $this->getXpathPrefix()); } } @@ -575,10 +583,10 @@ public function getSource() */ protected function _absolutiseUri($link) { - if (!\Zend\URI\URL::validate($link)) { + if (!Zend_Uri::check($link)) { if (!is_null($this->getBaseUrl())) { $link = $this->getBaseUrl() . $link; - if (!\Zend\URI\URL::validate($link)) { + if (!Zend_Uri::check($link)) { $link = null; } } @@ -592,7 +600,7 @@ protected function _absolutiseUri($link) * @param DOMElement $element * @return string */ - protected function _getAuthor(\DOMElement $element) + protected function _getAuthor(DOMElement $element) { $author = array(); @@ -624,11 +632,11 @@ protected function _getAuthor(\DOMElement $element) protected function _registerNamespaces() { switch ($this->_getAtomType()) { - case Reader\Reader::TYPE_ATOM_03: - $this->getXpath()->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_03); + case Zend_Feed_Reader::TYPE_ATOM_03: + $this->getXpath()->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03); break; default: - $this->getXpath()->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_10); + $this->getXpath()->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10); break; } } @@ -639,15 +647,15 @@ protected function _registerNamespaces() protected function _getAtomType() { $dom = $this->getDomDocument(); - $prefixAtom03 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_03); - $prefixAtom10 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_10); - if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_03) + $prefixAtom03 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_03); + $prefixAtom10 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_10); + if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_03) || !empty($prefixAtom03)) { - return Reader\Reader::TYPE_ATOM_03; + return Zend_Feed_Reader::TYPE_ATOM_03; } - if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_10) + if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_10) || !empty($prefixAtom10)) { - return Reader\Reader::TYPE_ATOM_10; + return Zend_Feed_Reader::TYPE_ATOM_10; } } } diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index 4912190d..cc7e4090 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -16,32 +16,37 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Feed.php 22300 2010-05-26 10:13:34Z padraic $ */ /** - * @namespace + * @see Zend_Feed_Reader_Extension_FeedAbstract */ -namespace Zend\Feed\Reader\Extension\Atom; -use Zend\Feed\Reader; -use Zend\Date; -use Zend\Feed\Reader\Collection; -use Zend\URI; +require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; + +/** + * @see Zend_Date + */ +require_once 'Zend/Date.php'; + +/** + * @see Zend_Uri + */ +require_once 'Zend/Uri.php'; + +/** + * @see Zend_Feed_Reader_Collection_Author + */ +require_once 'Zend/Feed/Reader/Collection/Author.php'; /** - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Collection\Author - * @uses \Zend\Feed\Reader\Collection\Category - * @uses \Zend\Feed\Reader\Extension\FeedAbstract - * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed - extends Reader\Extension\FeedAbstract +class Zend_Feed_Reader_Extension_Atom_Feed + extends Zend_Feed_Reader_Extension_FeedAbstract { /** * Get a single author @@ -87,8 +92,8 @@ public function getAuthors() if (count($authors) == 0) { $authors = null; } else { - $authors = new Collection\Author( - Reader\Reader::arrayUnique($authors) + $authors = new Zend_Feed_Reader_Collection_Author( + Zend_Feed_Reader::arrayUnique($authors) ); } @@ -110,7 +115,7 @@ public function getCopyright() $copyright = null; - if ($this->getType() === Reader\Reader::TYPE_ATOM_03) { + if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:copyright)'); } else { $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:rights)'); @@ -128,7 +133,7 @@ public function getCopyright() /** * Get the feed creation date * - * @return \Zend\Date\Date|null + * @return Zend_Date|null */ public function getDateCreated() { @@ -138,15 +143,15 @@ public function getDateCreated() $date = null; - if ($this->getType() === Reader\Reader::TYPE_ATOM_03) { + if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:created)'); } else { $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:published)'); } if ($dateCreated) { - $date = new Date\Date; - $date->set($dateCreated, Date\Date::ISO_8601); + $date = new Zend_Date; + $date->set($dateCreated, Zend_Date::ISO_8601); } $this->_data['datecreated'] = $date; @@ -157,7 +162,7 @@ public function getDateCreated() /** * Get the feed modification date * - * @return \Zend\Date\Date|null + * @return Zend_Date|null */ public function getDateModified() { @@ -167,15 +172,15 @@ public function getDateModified() $date = null; - if ($this->getType() === Reader\Reader::TYPE_ATOM_03) { + if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)'); } else { $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)'); } if ($dateModified) { - $date = new Date\Date; - $date->set($dateModified, Date\Date::ISO_8601); + $date = new Zend_Date; + $date->set($dateModified, Zend_Date::ISO_8601); } $this->_data['datemodified'] = $date; @@ -196,7 +201,7 @@ public function getDescription() $description = null; - if ($this->getType() === Reader\Reader::TYPE_ATOM_03) { + if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:tagline)'); // TODO: Is this the same as subtitle? } else { $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:subtitle)'); @@ -226,8 +231,6 @@ public function getGenerator() if (!$generator) { $generator = null; - } else { - $generator = html_entity_decode($generator, ENT_QUOTES, $this->getEncoding()); } $this->_data['generator'] = $generator; @@ -289,6 +292,30 @@ public function getLanguage() return $this->_data['language']; } + /** + * Get the feed image + * + * @return array|null + */ + public function getImage() + { + if (array_key_exists('image', $this->_data)) { + return $this->_data['image']; + } + + $imageUrl = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:logo)'); + + if (!$imageUrl) { + $image = null; + } else { + $image = array('uri'=>$imageUrl); + } + + $this->_data['image'] = $image; + + return $this->_data['image']; + } + /** * Get the base URI of the feed (if set). * @@ -411,7 +438,7 @@ public function getTitle() /** * Get all categories * - * @return \Zend\Feed\Reader\Collection\Category + * @return Zend_Feed_Reader_Collection_Category */ public function getCategories() { @@ -419,7 +446,7 @@ public function getCategories() return $this->_data['categories']; } - if ($this->getType() == Reader\Reader::TYPE_ATOM_10) { + if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10) { $list = $this->_xpath->query($this->getXpathPrefix() . '/atom:category'); } else { /** @@ -427,21 +454,21 @@ public function getCategories() * Dublin Core extension. However there is a small possibility Atom 0.3 * may have been retrofittied to use Atom 1.0 instead. */ - $this->_xpath->registerNamespace('atom10', Reader\Reader::NAMESPACE_ATOM_10); + $this->_xpath->registerNamespace('atom10', Zend_Feed_Reader::NAMESPACE_ATOM_10); $list = $this->_xpath->query($this->getXpathPrefix() . '/atom10:category'); } if ($list->length) { - $categoryCollection = new Collection\Category; + $categoryCollection = new Zend_Feed_Reader_Collection_Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->getAttribute('term'), 'scheme' => $category->getAttribute('scheme'), - 'label' => html_entity_decode($category->getAttribute('label')) + 'label' => $category->getAttribute('label') ); } } else { - return new Collection\Category; + return new Zend_Feed_Reader_Collection_Category; } $this->_data['categories'] = $categoryCollection; @@ -455,7 +482,7 @@ public function getCategories() * @param DOMElement $element * @return string */ - protected function _getAuthor(\DOMElement $element) + protected function _getAuthor(DOMElement $element) { $author = array(); @@ -487,10 +514,10 @@ protected function _getAuthor(\DOMElement $element) */ protected function _absolutiseUri($link) { - if (!\Zend\URI\URL::validate($link)) { + if (!Zend_Uri::check($link)) { if (!is_null($this->getBaseUrl())) { $link = $this->getBaseUrl() . $link; - if (!\Zend\URI\URL::validate($link)) { + if (!Zend_Uri::check($link)) { $link = null; } } @@ -503,18 +530,18 @@ protected function _absolutiseUri($link) */ protected function _registerNamespaces() { - if ($this->getType() == Reader\Reader::TYPE_ATOM_10 - || $this->getType() == Reader\Reader::TYPE_ATOM_03 + if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 + || $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03 ) { return; // pre-registered at Feed level } $atomDetected = $this->_getAtomType(); switch ($atomDetected) { - case Reader\Reader::TYPE_ATOM_03: - $this->_xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_03); + case Zend_Feed_Reader::TYPE_ATOM_03: + $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03); break; default: - $this->_xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_10); + $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10); break; } } @@ -525,15 +552,15 @@ protected function _registerNamespaces() protected function _getAtomType() { $dom = $this->getDomDocument(); - $prefixAtom03 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_03); - $prefixAtom10 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_10); - if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_10) + $prefixAtom03 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_03); + $prefixAtom10 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_10); + if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_10) || !empty($prefixAtom10)) { - return Reader\Reader::TYPE_ATOM_10; + return Zend_Feed_Reader::TYPE_ATOM_10; } - if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_03) + if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_03) || !empty($prefixAtom03)) { - return Reader\Reader::TYPE_ATOM_03; + return Zend_Feed_Reader::TYPE_ATOM_03; } } } diff --git a/src/Reader/Extension/Content/Entry.php b/src/Reader/Extension/Content/Entry.php index 8b0ddd64..cd94f951 100644 --- a/src/Reader/Extension/Content/Entry.php +++ b/src/Reader/Extension/Content/Entry.php @@ -16,39 +16,38 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Entry.php 22300 2010-05-26 10:13:34Z padraic $ */ /** - * @namespace + * @see Zend_Feed_Reader */ -namespace Zend\Feed\Reader\Extension\Content; -use Zend\Feed\Reader; +require_once 'Zend/Feed/Reader.php'; + +/** + * @see Zend_Feed_Reader_Entry_EntryAbstract + */ +require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; /** - * @uses \Zend\Feed\Reader\Reader - * @uses Zend_Feed_Reader_Entry_EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends Reader\Extension\EntryAbstract +class Zend_Feed_Reader_Extension_Content_Entry + extends Zend_Feed_Reader_Extension_EntryAbstract { public function getContent() { - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090 + 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)'); } else { $content = $this->_xpath->evaluate('string('.$this->getXpathPrefix().'/content:encoded)'); } - if ($content) { - $content = html_entity_decode($content, ENT_QUOTES, $this->getEncoding()); - } return $content; } diff --git a/src/Reader/Extension/CreativeCommons/Entry.php b/src/Reader/Extension/CreativeCommons/Entry.php index 8f45fa15..9c8cd4da 100644 --- a/src/Reader/Extension/CreativeCommons/Entry.php +++ b/src/Reader/Extension/CreativeCommons/Entry.php @@ -16,23 +16,26 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace + * @see Zend_Feed_Reader_Extension_EntryAbstract */ -namespace Zend\Feed\Reader\Extension\CreativeCommons; +require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; + +/** + * @see Zend_Feed_Reader_Extension_CreativeCommons_Feed + */ +require_once 'Zend/Feed/Reader/Extension/CreativeCommons/Feed.php'; /** - * @uses \Zend\Feed\Reader\Extension\CreativeCommons\Feed - * @uses \Zend\Feed\Reader\Extension\EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry extends \Zend\Feed\Reader\Extension\EntryAbstract +class Zend_Feed_Reader_Extension_CreativeCommons_Entry extends Zend_Feed_Reader_Extension_EntryAbstract { /** * Get the entry license @@ -72,7 +75,7 @@ public function getLicenses() $licenses = array_unique($licenses); } else { - $cc = new Feed( + $cc = new Zend_Feed_Reader_Extension_CreativeCommons_Feed( $this->_domDocument, $this->_data['type'], $this->_xpath ); $licenses = $cc->getLicenses(); diff --git a/src/Reader/Extension/CreativeCommons/Feed.php b/src/Reader/Extension/CreativeCommons/Feed.php index 3ded5019..4b1c7a9f 100644 --- a/src/Reader/Extension/CreativeCommons/Feed.php +++ b/src/Reader/Extension/CreativeCommons/Feed.php @@ -16,23 +16,22 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace + * @see Zend_Feed_Reader_Extension_FeedAbstract */ -namespace Zend\Feed\Reader\Extension\CreativeCommons; +require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; /** - * @uses \Zend\Feed\Reader\Extension\FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed - extends \Zend\Feed\Reader\Extension\FeedAbstract +class Zend_Feed_Reader_Extension_CreativeCommons_Feed + extends Zend_Feed_Reader_Extension_FeedAbstract { /** * Get the entry license diff --git a/src/Reader/Extension/DublinCore/Entry.php b/src/Reader/Extension/DublinCore/Entry.php index f42e2eb6..c2039459 100644 --- a/src/Reader/Extension/DublinCore/Entry.php +++ b/src/Reader/Extension/DublinCore/Entry.php @@ -16,29 +16,32 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace + * @see Zend_Feed_Reader */ -namespace Zend\Feed\Reader\Extension\DublinCore; -use Zend\Feed\Reader\Collection; -use Zend\Date; +require_once 'Zend/Feed/Reader.php'; + +/** + * @see Zend_Feed_Reader_Extension_EntryAbstract + */ +require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; + +/** + * @see Zend_Date + */ +require_once 'Zend/Date.php'; /** - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Collection\Author - * @uses \Zend\Feed\Reader\Collection\Category - * @uses \Zend\Feed\Reader\Extension\EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Reader\Extension\EntryAbstract +class Zend_Feed_Reader_Extension_DublinCore_Entry + extends Zend_Feed_Reader_Extension_EntryAbstract { /** * Get an author entry @@ -88,8 +91,8 @@ public function getAuthors() 'name' => $author->nodeValue ); } - $authors = new Collection\Author( - \Zend\Feed\Reader\Reader::arrayUnique($authors) + $authors = new Zend_Feed_Reader_Collection_Author( + Zend_Feed_Reader::arrayUnique($authors) ); } else { $authors = null; @@ -103,7 +106,7 @@ public function getAuthors() /** * Get categories (subjects under DC) * - * @return \Zend\Feed\Reader\Collection\Category + * @return Zend_Feed_Reader_Collection_Category */ public function getCategories() { @@ -118,7 +121,7 @@ public function getCategories() } if ($list->length) { - $categoryCollection = new Collection\Category; + $categoryCollection = new Zend_Feed_Reader_Collection_Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->nodeValue, @@ -127,7 +130,7 @@ public function getCategories() ); } } else { - $categoryCollection = new Collection\Category; + $categoryCollection = new Zend_Feed_Reader_Collection_Category; } $this->_data['categories'] = $categoryCollection; @@ -225,7 +228,7 @@ public function getTitle() /** * * - * @return \Zend\Date\Date|null + * @return Zend_Date|null */ public function getDate() { @@ -241,8 +244,8 @@ public function getDate() } if ($date) { - $d = new Date\Date; - $d->set($date, Date\Date::ISO_8601); + $d = new Zend_Date; + $d->set($date, Zend_Date::ISO_8601); } $this->_data['date'] = $d; diff --git a/src/Reader/Extension/DublinCore/Feed.php b/src/Reader/Extension/DublinCore/Feed.php index 958faee9..5b7816f5 100644 --- a/src/Reader/Extension/DublinCore/Feed.php +++ b/src/Reader/Extension/DublinCore/Feed.php @@ -16,29 +16,32 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace + * @see Zend_Feed_Reader_Extension_FeedAbstract */ -namespace Zend\Feed\Reader\Extension\DublinCore; -use Zend\Date; -use Zend\Feed\Reader\Collection; +require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; + +/** + * @see Zend_Date + */ +require_once 'Zend/Date.php'; + +/** + * @see Zend_Feed_Reader_Collection_Author + */ +require_once 'Zend/Feed/Reader/Collection/Author.php'; /** - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Collection\Author - * @uses \Zend\Feed\Reader\Collection\Category - * @uses \Zend\Feed\Reader\Extension\FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed - extends \Zend\Feed\Reader\Extension\FeedAbstract +class Zend_Feed_Reader_Extension_DublinCore_Feed + extends Zend_Feed_Reader_Extension_FeedAbstract { /** * Get a single author @@ -88,8 +91,8 @@ public function getAuthors() 'name' => $author->nodeValue ); } - $authors = new Collection\Author( - \Zend\Feed\Reader\Reader::arrayUnique($authors) + $authors = new Zend_Feed_Reader_Collection_Author( + Zend_Feed_Reader::arrayUnique($authors) ); } else { $authors = null; @@ -234,7 +237,7 @@ public function getTitle() /** * * - * @return \Zend\Date\Date|null + * @return Zend_Date|null */ public function getDate() { @@ -250,8 +253,8 @@ public function getDate() } if ($date) { - $d = new Date\Date; - $d->set($date, Date\Date::ISO_8601); + $d = new Zend_Date; + $d->set($date, Zend_Date::ISO_8601); } $this->_data['date'] = $d; @@ -262,7 +265,7 @@ public function getDate() /** * Get categories (subjects under DC) * - * @return \Zend\Feed\Reader\Collection\Category + * @return Zend_Feed_Reader_Collection_Category */ public function getCategories() { @@ -277,7 +280,7 @@ public function getCategories() } if ($list->length) { - $categoryCollection = new Collection\Category; + $categoryCollection = new Zend_Feed_Reader_Collection_Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->nodeValue, @@ -286,7 +289,7 @@ public function getCategories() ); } } else { - $categoryCollection = new Collection\Category; + $categoryCollection = new Zend_Feed_Reader_Collection_Category; } $this->_data['categories'] = $categoryCollection; diff --git a/src/Reader/Extension/EntryAbstract.php b/src/Reader/Extension/EntryAbstract.php index 775ed8f9..299c1bfb 100644 --- a/src/Reader/Extension/EntryAbstract.php +++ b/src/Reader/Extension/EntryAbstract.php @@ -16,23 +16,16 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: EntryAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace - */ -namespace Zend\Feed\Reader\Extension; -use Zend\Feed\Reader; - -/** - * @uses \Zend\Feed\Reader\Reader * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class EntryAbstract +abstract class Zend_Feed_Reader_Extension_EntryAbstract { /** * Feed entry data @@ -51,7 +44,7 @@ abstract class EntryAbstract /** * Entry instance * - * @var \Zend\Feed\Entry\AbstractEntry + * @var Zend_Feed_Entry_Abstract */ protected $_entry = null; @@ -79,12 +72,12 @@ abstract class EntryAbstract /** * Constructor * - * @param \Zend\Feed\Entry\AbstractEntry $entry + * @param Zend_Feed_Entry_Abstract $entry * @param int $entryKey * @param string $type * @return void */ - public function __construct(\DOMElement $entry, $entryKey, $type = null) + public function __construct(DOMElement $entry, $entryKey, $type = null) { $this->_entry = $entry; $this->_entryKey = $entryKey; @@ -93,15 +86,15 @@ public function __construct(\DOMElement $entry, $entryKey, $type = null) if (!is_null($type)) { $this->_data['type'] = $type; } else { - $this->_data['type'] = Reader\Reader::detectType($entry->ownerDocument, true); + $this->_data['type'] = Zend_Feed_Reader::detectType($entry->ownerDocument, true); } // set the XPath query prefix for the entry being queried - if ($this->getType() == Reader\Reader::TYPE_RSS_10 - || $this->getType() == Reader\Reader::TYPE_RSS_090 + 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() == Reader\Reader::TYPE_ATOM_10 - || $this->getType() == Reader\Reader::TYPE_ATOM_03 + } elseif ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 + || $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03 ) { $this->setXpathPrefix('//atom:entry[' . ($this->_entryKey+1) . ']'); } else { @@ -144,9 +137,9 @@ public function getType() * Set the XPath query * * @param DOMXPath $xpath - * @return \Zend\Feed\Reader\Extension\EntryAbstract + * @return Zend_Feed_Reader_Extension_EntryAbstract */ - public function setXpath(\DOMXPath $xpath) + public function setXpath(DOMXPath $xpath) { $this->_xpath = $xpath; $this->_registerNamespaces(); @@ -161,7 +154,7 @@ public function setXpath(\DOMXPath $xpath) public function getXpath() { if (!$this->_xpath) { - $this->setXpath(new \DOMXPath($this->getDomDocument())); + $this->setXpath(new DOMXPath($this->getDomDocument())); } return $this->_xpath; } @@ -190,7 +183,7 @@ public function getXpathPrefix() * Set the XPath prefix * * @param string $prefix - * @return \Zend\Feed\Reader\Extension\EntryAbstract + * @return Zend_Feed_Reader_Extension_EntryAbstract */ public function setXpathPrefix($prefix) { diff --git a/src/Reader/Extension/FeedAbstract.php b/src/Reader/Extension/FeedAbstract.php index 0472b39b..73aa8c90 100644 --- a/src/Reader/Extension/FeedAbstract.php +++ b/src/Reader/Extension/FeedAbstract.php @@ -16,25 +16,32 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: FeedAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace + * @see Zend_Feed_Reader */ -namespace Zend\Feed\Reader\Extension; +require_once 'Zend/Feed/Reader.php'; + +/** + * @see Zend_Feed_Reader_Entry_Atom + */ +require_once 'Zend/Feed/Reader/Entry/Atom.php'; + + +/** + * @see Zend_Feed_Reader_Entry_Rss + */ +require_once 'Zend/Feed/Reader/Entry/Rss.php'; /** - * @uses DOMXPath - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Entry\Atom - * @uses \Zend\Feed\Reader\Entry\RSS * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class FeedAbstract +abstract class Zend_Feed_Reader_Extension_FeedAbstract { /** * Parsed feed data @@ -67,24 +74,24 @@ abstract class FeedAbstract /** * Constructor * - * @param \Zend\Feed\Feed_Abstract $feed The source \Zend\Feed\Feed object + * @param Zend_Feed_Abstract $feed The source Zend_Feed object * @param string $type Feed type * @return void */ - public function __construct(\DomDocument $dom, $type = null, \DOMXPath $xpath = null) + public function __construct(DomDocument $dom, $type = null, DOMXPath $xpath = null) { $this->_domDocument = $dom; if ($type !== null) { $this->_data['type'] = $type; } else { - $this->_data['type'] = \Zend\Feed\Reader\Reader::detectType($dom); + $this->_data['type'] = Zend_Feed_Reader::detectType($dom); } if ($xpath !== null) { $this->_xpath = $xpath; } else { - $this->_xpath = new \DOMXPath($this->_domDocument); + $this->_xpath = new DOMXPath($this->_domDocument); } $this->_registerNamespaces(); @@ -136,9 +143,9 @@ public function toArray() // untested * Set the XPath query * * @param DOMXPath $xpath - * @return \Zend\Feed\Reader\Extension\EntryAbstract + * @return Zend_Feed_Reader_Extension_EntryAbstract */ - public function setXpath(\DOMXPath $xpath) + public function setXpath(DOMXPath $xpath) { $this->_xpath = $xpath; $this->_registerNamespaces(); @@ -168,7 +175,7 @@ public function getXpathPrefix() /** * Set the XPath prefix * - * @return \Zend\Feed\Reader\Feed\Atom\Atom + * @return Zend_Feed_Reader_Feed_Atom */ public function setXpathPrefix($prefix) { diff --git a/src/Reader/Extension/Podcast/Entry.php b/src/Reader/Extension/Podcast/Entry.php index 22ef4897..eeffed2b 100644 --- a/src/Reader/Extension/Podcast/Entry.php +++ b/src/Reader/Extension/Podcast/Entry.php @@ -16,23 +16,26 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace + * @see Zend_Feed_Reader */ -namespace Zend\Feed\Reader\Extension\Podcast; +require_once 'Zend/Feed/Reader.php'; + +/** + * @see Zend_Feed_Reader_Extension_EntryAbstract + */ +require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; /** - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Extension\EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry extends \Zend\Feed\Reader\Extension\EntryAbstract +class Zend_Feed_Reader_Extension_Podcast_Entry extends Zend_Feed_Reader_Extension_EntryAbstract { /** * Get the entry author @@ -196,4 +199,4 @@ protected function _registerNamespaces() { $this->_xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); } -} +} \ No newline at end of file diff --git a/src/Reader/Extension/Podcast/Feed.php b/src/Reader/Extension/Podcast/Feed.php index 96a712be..01a5a191 100644 --- a/src/Reader/Extension/Podcast/Feed.php +++ b/src/Reader/Extension/Podcast/Feed.php @@ -16,22 +16,21 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace + * @see Zend_Feed_Reader_Extension_FeedAbstract */ -namespace Zend\Feed\Reader\Extension\Podcast; +require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; /** - * @uses \Zend\Feed\Reader\Extension\FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed extends \Zend\Feed\Reader\Extension\FeedAbstract +class Zend_Feed_Reader_Extension_Podcast_Feed extends Zend_Feed_Reader_Extension_FeedAbstract { /** * Get the entry author @@ -100,7 +99,7 @@ public function getCategories() $children = array(); foreach ($node->childNodes as $childNode) { - if (!($childNode instanceof \DOMText)) { + if (!($childNode instanceof DOMText)) { $children[$childNode->getAttribute('text')] = null; } } @@ -291,4 +290,4 @@ protected function _registerNamespaces() { $this->_xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); } -} +} \ No newline at end of file diff --git a/src/Reader/Extension/Slash/Entry.php b/src/Reader/Extension/Slash/Entry.php index 717bab23..c5f259fb 100644 --- a/src/Reader/Extension/Slash/Entry.php +++ b/src/Reader/Extension/Slash/Entry.php @@ -16,24 +16,27 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace + * @see Zend_Feed_Reader */ -namespace Zend\Feed\Reader\Extension\Slash; +require_once 'Zend/Feed/Reader.php'; + +/** + * @see Zend_Feed_Reader_Extension_EntryAbstract + */ +require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; /** - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Extension\EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Reader\Extension\EntryAbstract +class Zend_Feed_Reader_Extension_Slash_Entry + extends Zend_Feed_Reader_Extension_EntryAbstract { /** * Get the entry section diff --git a/src/Reader/Extension/Syndication/Feed.php b/src/Reader/Extension/Syndication/Feed.php index ec43e24d..91044865 100644 --- a/src/Reader/Extension/Syndication/Feed.php +++ b/src/Reader/Extension/Syndication/Feed.php @@ -16,25 +16,24 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace + * @see Zend_Feed_Reader_Extension_FeedAbstract */ -namespace Zend\Feed\Reader\Extension\Syndication; -use Zend\Date; +require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; + +require_once 'Zend/Date.php'; /** - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Reader\Extension\FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed - extends \Zend\Feed\Reader\Extension\FeedAbstract +class Zend_Feed_Reader_Extension_Syndication_Feed + extends Zend_Feed_Reader_Extension_FeedAbstract { /** * Get update period @@ -58,7 +57,7 @@ public function getUpdatePeriod() 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" ); } @@ -120,15 +119,15 @@ public function getUpdateFrequencyAsTicks() /** * Get update base * - * @return \Zend\Date\Date|null + * @return Zend_Date|null */ public function getUpdateBase() { $updateBase = $this->_getData('updateBase'); $date = null; if ($updateBase) { - $date = new Date\Date; - $date->set($updateBase, Date\Date::W3C); + $date = new Zend_Date; + $date->set($updateBase, Zend_Date::W3C); } return $date; } diff --git a/src/Reader/Extension/Thread/Entry.php b/src/Reader/Extension/Thread/Entry.php index 89f3a65d..7b397de7 100644 --- a/src/Reader/Extension/Thread/Entry.php +++ b/src/Reader/Extension/Thread/Entry.php @@ -16,23 +16,22 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace + * @see Zend_Feed_Reader_Extension_EntryAbstract */ -namespace Zend\Feed\Reader\Extension\Thread; +require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; /** - * @uses \Zend\Feed\Reader\Extension\EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Reader\Extension\EntryAbstract +class Zend_Feed_Reader_Extension_Thread_Entry + extends Zend_Feed_Reader_Extension_EntryAbstract { /** * Get the "in-reply-to" value diff --git a/src/Reader/Extension/WellFormedWeb/Entry.php b/src/Reader/Extension/WellFormedWeb/Entry.php index fbae9638..24832fee 100644 --- a/src/Reader/Extension/WellFormedWeb/Entry.php +++ b/src/Reader/Extension/WellFormedWeb/Entry.php @@ -16,24 +16,27 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace + * @see Zend_Feed_Reader */ -namespace Zend\Feed\Reader\Extension\WellFormedWeb; +require_once 'Zend/Feed/Reader.php'; + +/** + * @see Zend_Feed_Reader_Extension_EntryAbstract + */ +require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; /** - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Extension\EntryAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Reader\Extension\EntryAbstract +class Zend_Feed_Reader_Extension_WellFormedWeb_Entry + extends Zend_Feed_Reader_Extension_EntryAbstract { /** * Get the entry comment Uri diff --git a/src/Reader/Feed/Atom/Atom.php b/src/Reader/Feed/Atom.php similarity index 81% rename from src/Reader/Feed/Atom/Atom.php rename to src/Reader/Feed/Atom.php index fbad6038..62515b46 100644 --- a/src/Reader/Feed/Atom/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -16,25 +16,26 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Atom.php 22107 2010-05-05 13:42:20Z padraic $ */ /** - * @namespace + * @see Zend_Feed_Reader_FeedAbstract */ -namespace Zend\Feed\Reader\Feed\Atom; -use Zend\Feed\Reader; +require_once 'Zend/Feed/Reader/FeedAbstract.php'; + +/** + * @see Zend_Feed_Reader_Extension_Atom_Feed + */ +require_once 'Zend/Feed/Reader/Extension/Atom/Feed.php'; /** - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Extension\Atom\Feed - * @uses \Zend\Feed\Reader\FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Atom extends Reader\FeedAbstract +class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract { /** @@ -43,13 +44,13 @@ class Atom extends Reader\FeedAbstract * @param DOMDocument $dom * @param string $type */ - public function __construct(\DOMDocument $dom, $type = null) + public function __construct(DOMDocument $dom, $type = null) { parent::__construct($dom, $type); - $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\Feed'); - $this->_extensions['Atom\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); - $atomClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\Feed'); - $this->_extensions['DublinCore\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); + $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Feed'); + $this->_extensions['Atom_Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); + $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Feed'); + $this->_extensions['DublinCore_Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); foreach ($this->_extensions as $extension) { $extension->setXpathPrefix('/atom:feed'); } @@ -156,6 +157,16 @@ public function getDateModified() return $this->_data['datemodified']; } + /** + * Get the feed lastBuild date. This is not implemented in Atom. + * + * @return string|null + */ + public function getLastBuildDate() + { + return null; + } + /** * Get the feed description * @@ -276,6 +287,24 @@ public function getLink() return $this->_data['link']; } + /** + * Get feed image data + * + * @return array|null + */ + public function getImage() + { + if (array_key_exists('image', $this->_data)) { + return $this->_data['image']; + } + + $link = $this->getExtension('Atom')->getImage(); + + $this->_data['image'] = $link; + + return $this->_data['image']; + } + /** * Get a link to the feed's XML Url * @@ -289,6 +318,10 @@ public function getFeedLink() $link = $this->getExtension('Atom')->getFeedLink(); + if (is_null($link) || empty($link)) { + $link = $this->getOriginalSourceUri(); + } + $this->_data['feedlink'] = $link; return $this->_data['feedlink']; @@ -333,7 +366,7 @@ public function getHubs() /** * Get all categories * - * @return \Zend\Feed\Reader\Collection\Category + * @return Zend_Feed_Reader_Collection_Category */ public function getCategories() { @@ -359,8 +392,8 @@ public function getCategories() */ protected function _indexEntries() { - if ($this->getType() == Reader\Reader::TYPE_ATOM_10 || - $this->getType() == Reader\Reader::TYPE_ATOM_03) { + if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 || + $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03) { $entries = array(); $entries = $this->_xpath->evaluate('//atom:entry'); @@ -377,12 +410,12 @@ protected function _indexEntries() protected function _registerNamespaces() { switch ($this->_data['type']) { - case Reader\Reader::TYPE_ATOM_03: - $this->_xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_03); + case Zend_Feed_Reader::TYPE_ATOM_03: + $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03); break; - case Reader\Reader::TYPE_ATOM_10: + case Zend_Feed_Reader::TYPE_ATOM_10: default: - $this->_xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_10); + $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10); } } } diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php index 5a33d9dc..cee5061d 100644 --- a/src/Reader/Feed/Atom/Source.php +++ b/src/Reader/Feed/Atom/Source.php @@ -16,24 +16,21 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Source.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ /** - * @namespace + * @see Zend_Feed_Reader_Feed_Atom */ -namespace Zend\Feed\Reader\Feed\Atom; -use Zend\Feed\Reader; +require_once 'Zend/Feed/Reader/Feed/Atom.php'; /** - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Feed\Atom\Atom * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Source extends Atom +class Zend_Feed_Reader_Feed_Atom_Source extends Zend_Feed_Reader_Feed_Atom { /** @@ -45,18 +42,18 @@ class Source extends Atom * @param string $xpathPrefix Passed from parent Entry object * @param string $type Nearly always Atom 1.0 */ - public function __construct(\DOMElement $source, $xpathPrefix, $type = Reader\Reader::TYPE_ATOM_10) + public function __construct(DOMElement $source, $xpathPrefix, $type = Zend_Feed_Reader::TYPE_ATOM_10) { $this->_domDocument = $source->ownerDocument; - $this->_xpath = new \DOMXPath($this->_domDocument); + $this->_xpath = new DOMXPath($this->_domDocument); $this->_data['type'] = $type; $this->_registerNamespaces(); $this->_loadExtensions(); - $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\Feed'); - $this->_extensions['Atom\Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); - $atomClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\Feed'); - $this->_extensions['DublinCore\Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); + $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Feed'); + $this->_extensions['Atom_Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); + $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Feed'); + $this->_extensions['DublinCore_Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); foreach ($this->_extensions as $extension) { $extension->setXpathPrefix(rtrim($xpathPrefix, '/') . '/atom:source'); } diff --git a/src/Reader/Feed/RSS.php b/src/Reader/Feed/RSS.php deleted file mode 100644 index fd48753e..00000000 --- a/src/Reader/Feed/RSS.php +++ /dev/null @@ -1,611 +0,0 @@ -getClassName('DublinCore\Feed'); - $this->_extensions['DublinCore\Feed'] = new $dublinCoreClass($dom, $this->_data['type'], $this->_xpath); - $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\Feed'); - $this->_extensions['Atom\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $xpathPrefix = '/rss/channel'; - } else { - $xpathPrefix = '/rdf:RDF/rss:channel'; - } - foreach ($this->_extensions as $extension) { - $extension->setXpathPrefix($xpathPrefix); - } - } - - /** - * Get a single author - * - * @param int $index - * @return string|null - */ - public function getAuthor($index = 0) - { - $authors = $this->getAuthors(); - - if (isset($authors[$index])) { - return $authors[$index]; - } - - return null; - } - - /** - * Get an array with feed authors - * - * @return array - */ - public function getAuthors() - { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; - } - - $authors = array(); - $authors_dc = $this->getExtension('DublinCore')->getAuthors(); - if (!empty($authors_dc)) { - foreach ($authors_dc as $author) { - $authors[] = array( - 'name' => $author['name'] - ); - } - } - - /** - * Technically RSS doesn't specific author element use at the feed level - * but it's supported on a "just in case" basis. - */ - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $list = $this->_xpath->query('//author'); - } else { - $list = $this->_xpath->query('//rss:author'); - } - if ($list->length) { - foreach ($list as $author) { - $string = trim($author->nodeValue); - $email = null; - $name = null; - $data = array(); - // Pretty rough parsing - but it's a catchall - if (preg_match("/^.*@[^ ]*/", $string, $matches)) { - $data['email'] = trim($matches[0]); - if (preg_match('/\((.*)\)$/', $string, $matches)) { - $data['name'] = $matches[1]; - } - $authors[] = $data; - } - } - } - - if (count($authors) == 0) { - $authors = $this->getExtension('Atom')->getAuthors(); - } else { - $authors = new Reader\Collection\Author( - Reader\Reader::arrayUnique($authors) - ); - } - - if (count($authors) == 0) { - $authors = null; - } - - $this->_data['authors'] = $authors; - - return $this->_data['authors']; - } - - /** - * Get the copyright entry - * - * @return string|null - */ - public function getCopyright() - { - if (array_key_exists('copyright', $this->_data)) { - return $this->_data['copyright']; - } - - $copyright = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $copyright = $this->_xpath->evaluate('string(/rss/channel/copyright)'); - } - - if (!$copyright && !is_null($this->getExtension('DublinCore'))) { - $copyright = $this->getExtension('DublinCore')->getCopyright(); - } - - if (empty($copyright)) { - $copyright = $this->getExtension('Atom')->getCopyright(); - } - - if (!$copyright) { - $copyright = null; - } - - $this->_data['copyright'] = $copyright; - - return $this->_data['copyright']; - } - - /** - * Get the feed creation date - * - * @return string|null - */ - public function getDateCreated() - { - return $this->getDateModified(); - } - - /** - * Get the feed modification date - * - * @return \Zend\Date\Date - */ - public function getDateModified() - { - if (array_key_exists('datemodified', $this->_data)) { - return $this->_data['datemodified']; - } - - $dateModified = null; - $date = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $dateModified = $this->_xpath->evaluate('string(/rss/channel/pubDate)'); - if (!$dateModified) { - $dateModified = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)'); - } - if ($dateModified) { - $dateStandards = array(Date\Date::RSS, Date\Date::RFC_822, - Date\Date::RFC_2822, Date\Date::DATES); - $date = new Date\Date; - foreach ($dateStandards as $standard) { - try { - $date->set($dateModified, $standard); - break; - } catch (Date\Exception $e) { - if ($standard == Date\Date::DATES) { - throw new \Zend\Feed\Exception( - 'Could not load date due to unrecognised' - .' format (should follow RFC 822 or 2822):' - . $e->getMessage(), - 0, $e - ); - } - } - } - } - } - - if (!$date) { - $date = $this->getExtension('DublinCore')->getDate(); - } - - if (!$date) { - $date = $this->getExtension('Atom')->getDateModified(); - } - - if (!$date) { - $date = null; - } - - $this->_data['datemodified'] = $date; - - return $this->_data['datemodified']; - } - - /** - * Get the feed description - * - * @return string|null - */ - public function getDescription() - { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; - } - - $description = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $description = $this->_xpath->evaluate('string(/rss/channel/description)'); - } else { - $description = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:description)'); - } - - if (!$description && !is_null($this->getExtension('DublinCore'))) { - $description = $this->getExtension('DublinCore')->getDescription(); - } - - if (empty($description)) { - $description = $this->getExtension('Atom')->getDescription(); - } - - if (!$description) { - $description = null; - } - - $this->_data['description'] = $description; - - return $this->_data['description']; - } - - /** - * Get the feed ID - * - * @return string|null - */ - public function getId() - { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; - } - - $id = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $id = $this->_xpath->evaluate('string(/rss/channel/guid)'); - } - - if (!$id && !is_null($this->getExtension('DublinCore'))) { - $id = $this->getExtension('DublinCore')->getId(); - } - - if (empty($id)) { - $id = $this->getExtension('Atom')->getId(); - } - - if (!$id) { - if ($this->getLink()) { - $id = $this->getLink(); - } elseif ($this->getTitle()) { - $id = $this->getTitle(); - } else { - $id = null; - } - } - - $this->_data['id'] = $id; - - return $this->_data['id']; - } - - /** - * Get the feed language - * - * @return string|null - */ - public function getLanguage() - { - if (array_key_exists('language', $this->_data)) { - return $this->_data['language']; - } - - $language = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $language = $this->_xpath->evaluate('string(/rss/channel/language)'); - } - - if (!$language && !is_null($this->getExtension('DublinCore'))) { - $language = $this->getExtension('DublinCore')->getLanguage(); - } - - if (empty($language)) { - $language = $this->getExtension('Atom')->getLanguage(); - } - - if (!$language) { - $language = $this->_xpath->evaluate('string(//@xml:lang[1])'); - } - - if (!$language) { - $language = null; - } - - $this->_data['language'] = $language; - - return $this->_data['language']; - } - - /** - * Get a link to the feed - * - * @return string|null - */ - public function getLink() - { - if (array_key_exists('link', $this->_data)) { - return $this->_data['link']; - } - - $link = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $link = $this->_xpath->evaluate('string(/rss/channel/link)'); - } else { - $link = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:link)'); - } - - if (empty($link)) { - $link = $this->getExtension('Atom')->getLink(); - } - - if (!$link) { - $link = null; - } - - $this->_data['link'] = $link; - - return $this->_data['link']; - } - - /** - * Get a link to the feed XML - * - * @return string|null - */ - public function getFeedLink() - { - if (array_key_exists('feedlink', $this->_data)) { - return $this->_data['feedlink']; - } - - $link = null; - - $link = $this->getExtension('Atom')->getFeedLink(); - - if (!$link) { - $link = null; - } - - $this->_data['feedlink'] = $link; - - return $this->_data['feedlink']; - } - - /** - * Get the feed generator entry - * - * @return string|null - */ - public function getGenerator() - { - if (array_key_exists('generator', $this->_data)) { - return $this->_data['generator']; - } - - $generator = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $generator = $this->_xpath->evaluate('string(/rss/channel/generator)'); - } - - if (!$generator) { - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $generator = $this->_xpath->evaluate('string(/rss/channel/atom:generator)'); - } else { - $generator = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/atom:generator)'); - } - if ($generator) { - $generator = html_entity_decode($generator, ENT_QUOTES, $this->getEncoding()); - } - } - - if (empty($generator)) { - $generator = $this->getExtension('Atom')->getGenerator(); - } - - if (!$generator) { - $generator = null; - } - - $this->_data['generator'] = $generator; - - return $this->_data['generator']; - } - - /** - * Get the feed title - * - * @return string|null - */ - public function getTitle() - { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; - } - - $title = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $title = $this->_xpath->evaluate('string(/rss/channel/title)'); - } else { - $title = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:title)'); - } - - if (!$title && !is_null($this->getExtension('DublinCore'))) { - $title = $this->getExtension('DublinCore')->getTitle(); - } - - if (!$title) { - $title = $this->getExtension('Atom')->getTitle(); - } - - if (!$title) { - $title = null; - } - - $this->_data['title'] = $title; - - return $this->_data['title']; - } - - /** - * Get an array of any supported Pusubhubbub endpoints - * - * @return array|null - */ - public function getHubs() - { - if (array_key_exists('hubs', $this->_data)) { - return $this->_data['hubs']; - } - - $hubs = $this->getExtension('Atom')->getHubs(); - - if (empty($hubs)) { - $hubs = null; - } else { - $hubs = array_unique($hubs); - } - - $this->_data['hubs'] = $hubs; - - return $this->_data['hubs']; - } - - /** - * Get all categories - * - * @return \Zend\Feed\Reader\Collection\Category - */ - public function getCategories() - { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; - } - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $list = $this->_xpath->query('/rss/channel//category'); - } else { - $list = $this->_xpath->query('/rdf:RDF/rss:channel//rss:category'); - } - - if ($list->length) { - $categoryCollection = new Reader\Collection\Category; - foreach ($list as $category) { - $categoryCollection[] = array( - 'term' => $category->nodeValue, - 'scheme' => $category->getAttribute('domain'), - 'label' => $category->nodeValue, - ); - } - } else { - $categoryCollection = $this->getExtension('DublinCore')->getCategories(); - } - - if (count($categoryCollection) == 0) { - $categoryCollection = $this->getExtension('Atom')->getCategories(); - } - - $this->_data['categories'] = $categoryCollection; - - return $this->_data['categories']; - } - - /** - * Read all entries to the internal entries array - * - */ - 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 { - $entries = $this->_xpath->evaluate('//rss:item'); - } - - foreach($entries as $index=>$entry) { - $this->_entries[$index] = $entry; - } - } - - /** - * Register the default namespaces for the current feed format - * - */ - protected function _registerNamespaces() - { - switch ($this->_data['type']) { - case Reader\Reader::TYPE_RSS_10: - $this->_xpath->registerNamespace('rdf', Reader\Reader::NAMESPACE_RDF); - $this->_xpath->registerNamespace('rss', Reader\Reader::NAMESPACE_RSS_10); - break; - - case Reader\Reader::TYPE_RSS_090: - $this->_xpath->registerNamespace('rdf', Reader\Reader::NAMESPACE_RDF); - $this->_xpath->registerNamespace('rss', Reader\Reader::NAMESPACE_RSS_090); - break; - } - } -} diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index fd48753e..e1b7bddb 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -16,30 +16,41 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Rss.php 22300 2010-05-26 10:13:34Z padraic $ */ /** - * @namespace + * @see Zend_Feed_Reader_FeedAbstract */ -namespace Zend\Feed\Reader\Feed; -use Zend\Feed\Reader; -use Zend\Date; +require_once 'Zend/Feed/Reader/FeedAbstract.php'; + +/** + * @see Zend_feed_Reader_Extension_Atom_Feed + */ +require_once 'Zend/Feed/Reader/Extension/Atom/Feed.php'; + +/** + * @see Zend_Feed_Reader_Extension_DublinCore_Feed + */ +require_once 'Zend/Feed/Reader/Extension/DublinCore/Feed.php'; + +/** + * @see Zend_Date + */ +require_once 'Zend/Date.php'; + +/** + * @see Zend_Feed_Reader_Collection_Author + */ +require_once 'Zend/Feed/Reader/Collection/Author.php'; /** - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Collection\Author - * @uses \Zend\Feed\Reader\Extension\Atom\Feed - * @uses \Zend\Feed\Reader\Extension\DublinCore\Feed - * @uses \Zend\Feed\Reader\FeedAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class RSS extends Reader\FeedAbstract +class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract { /** @@ -48,16 +59,16 @@ class RSS extends Reader\FeedAbstract * @param DOMDocument $dom * @param string $type */ - public function __construct(\DomDocument $dom, $type = null) + public function __construct(DomDocument $dom, $type = null) { parent::__construct($dom, $type); - $dublinCoreClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\Feed'); - $this->_extensions['DublinCore\Feed'] = new $dublinCoreClass($dom, $this->_data['type'], $this->_xpath); - $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\Feed'); - $this->_extensions['Atom\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); + $dublinCoreClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Feed'); + $this->_extensions['DublinCore_Feed'] = new $dublinCoreClass($dom, $this->_data['type'], $this->_xpath); + $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Feed'); + $this->_extensions['Atom_Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $xpathPrefix = '/rss/channel'; } else { $xpathPrefix = '/rdf:RDF/rss:channel'; @@ -109,8 +120,8 @@ public function getAuthors() * Technically RSS doesn't specific author element use at the feed level * but it's supported on a "just in case" basis. */ - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 + && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $list = $this->_xpath->query('//author'); } else { $list = $this->_xpath->query('//rss:author'); @@ -124,7 +135,7 @@ public function getAuthors() // Pretty rough parsing - but it's a catchall if (preg_match("/^.*@[^ ]*/", $string, $matches)) { $data['email'] = trim($matches[0]); - if (preg_match('/\((.*)\)$/', $string, $matches)) { + if (preg_match("/\((.*)\)$/", $string, $matches)) { $data['name'] = $matches[1]; } $authors[] = $data; @@ -135,8 +146,8 @@ public function getAuthors() if (count($authors) == 0) { $authors = $this->getExtension('Atom')->getAuthors(); } else { - $authors = new Reader\Collection\Author( - Reader\Reader::arrayUnique($authors) + $authors = new Zend_Feed_Reader_Collection_Author( + Zend_Feed_Reader::arrayUnique($authors) ); } @@ -162,8 +173,8 @@ public function getCopyright() $copyright = null; - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $copyright = $this->_xpath->evaluate('string(/rss/channel/copyright)'); } @@ -197,7 +208,7 @@ public function getDateCreated() /** * Get the feed modification date * - * @return \Zend\Date\Date + * @return Zend_Date */ public function getDateModified() { @@ -208,28 +219,34 @@ public function getDateModified() $dateModified = null; $date = null; - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $dateModified = $this->_xpath->evaluate('string(/rss/channel/pubDate)'); if (!$dateModified) { $dateModified = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)'); } if ($dateModified) { - $dateStandards = array(Date\Date::RSS, Date\Date::RFC_822, - Date\Date::RFC_2822, Date\Date::DATES); - $date = new Date\Date; - foreach ($dateStandards as $standard) { - try { - $date->set($dateModified, $standard); - break; - } catch (Date\Exception $e) { - if ($standard == Date\Date::DATES) { - throw new \Zend\Feed\Exception( - 'Could not load date due to unrecognised' - .' format (should follow RFC 822 or 2822):' - . $e->getMessage(), - 0, $e - ); + $dateModifiedParsed = strtotime($dateModified); + if ($dateModifiedParsed) { + $date = new Zend_Date($dateModifiedParsed); + } else { + $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, $standard); + break; + } 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):' + . $e->getMessage(), + 0, $e + ); + } } } } @@ -253,6 +270,60 @@ public function getDateModified() return $this->_data['datemodified']; } + /** + * Get the feed lastBuild date + * + * @return Zend_Date + */ + public function getLastBuildDate() + { + if (array_key_exists('lastBuildDate', $this->_data)) { + return $this->_data['lastBuildDate']; + } + + $lastBuildDate = null; + $date = null; + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $lastBuildDate = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)'); + if ($lastBuildDate) { + $lastBuildDateParsed = strtotime($lastBuildDate); + if ($lastBuildDateParsed) { + $date = new Zend_Date($lastBuildDateParsed); + } else { + $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($lastBuildDate, $standard); + break; + } 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):' + . $e->getMessage(), + 0, $e + ); + } + } + } + } + } + } + + if (!$date) { + $date = null; + } + + $this->_data['lastBuildDate'] = $date; + + return $this->_data['lastBuildDate']; + } + /** * Get the feed description * @@ -266,8 +337,8 @@ public function getDescription() $description = null; - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $description = $this->_xpath->evaluate('string(/rss/channel/description)'); } else { $description = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:description)'); @@ -303,8 +374,8 @@ public function getId() $id = null; - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $id = $this->_xpath->evaluate('string(/rss/channel/guid)'); } @@ -331,6 +402,60 @@ public function getId() return $this->_data['id']; } + /** + * Get the feed image data + * + * @return array|null + */ + public function getImage() + { + if (array_key_exists('image', $this->_data)) { + return $this->_data['image']; + } + + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + $list = $this->_xpath->query('/rss/channel/image'); + $prefix = '/rss/channel/image[1]'; + } else { + $list = $this->_xpath->query('/rdf:RDF/rss:channel/rss:image'); + $prefix = '/rdf:RDF/rss:channel/rss:image[1]'; + } + if ($list->length > 0) { + $image = array(); + $value = $this->_xpath->evaluate('string(' . $prefix . '/url)'); + if ($value) { + $image['uri'] = $value; + } + $value = $this->_xpath->evaluate('string(' . $prefix . '/link)'); + if ($value) { + $image['link'] = $value; + } + $value = $this->_xpath->evaluate('string(' . $prefix . '/title)'); + if ($value) { + $image['title'] = $value; + } + $value = $this->_xpath->evaluate('string(' . $prefix . '/height)'); + if ($value) { + $image['height'] = $value; + } + $value = $this->_xpath->evaluate('string(' . $prefix . '/width)'); + if ($value) { + $image['width'] = $value; + } + $value = $this->_xpath->evaluate('string(' . $prefix . '/description)'); + if ($value) { + $image['description'] = $value; + } + } else { + $image = null; + } + + $this->_data['image'] = $image; + + return $this->_data['image']; + } + /** * Get the feed language * @@ -344,8 +469,8 @@ public function getLanguage() $language = null; - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $language = $this->_xpath->evaluate('string(/rss/channel/language)'); } @@ -383,8 +508,8 @@ public function getLink() $link = null; - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $link = $this->_xpath->evaluate('string(/rss/channel/link)'); } else { $link = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:link)'); @@ -418,8 +543,8 @@ public function getFeedLink() $link = $this->getExtension('Atom')->getFeedLink(); - if (!$link) { - $link = null; + if (is_null($link) || empty($link)) { + $link = $this->getOriginalSourceUri(); } $this->_data['feedlink'] = $link; @@ -440,21 +565,18 @@ public function getGenerator() $generator = null; - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $generator = $this->_xpath->evaluate('string(/rss/channel/generator)'); } if (!$generator) { - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $generator = $this->_xpath->evaluate('string(/rss/channel/atom:generator)'); } else { $generator = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/atom:generator)'); } - if ($generator) { - $generator = html_entity_decode($generator, ENT_QUOTES, $this->getEncoding()); - } } if (empty($generator)) { @@ -483,8 +605,8 @@ public function getTitle() $title = null; - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $title = $this->_xpath->evaluate('string(/rss/channel/title)'); } else { $title = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:title)'); @@ -534,7 +656,7 @@ public function getHubs() /** * Get all categories * - * @return \Zend\Feed\Reader\Collection\Category + * @return Zend_Feed_Reader_Collection_Category */ public function getCategories() { @@ -542,15 +664,15 @@ public function getCategories() return $this->_data['categories']; } - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && + $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $list = $this->_xpath->query('/rss/channel//category'); } else { $list = $this->_xpath->query('/rdf:RDF/rss:channel//rss:category'); } if ($list->length) { - $categoryCollection = new Reader\Collection\Category; + $categoryCollection = new Zend_Feed_Reader_Collection_Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->nodeValue, @@ -579,7 +701,7 @@ protected function _indexEntries() { $entries = array(); - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { + if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $entries = $this->_xpath->evaluate('//item'); } else { $entries = $this->_xpath->evaluate('//rss:item'); @@ -597,14 +719,14 @@ protected function _indexEntries() protected function _registerNamespaces() { switch ($this->_data['type']) { - case Reader\Reader::TYPE_RSS_10: - $this->_xpath->registerNamespace('rdf', Reader\Reader::NAMESPACE_RDF); - $this->_xpath->registerNamespace('rss', Reader\Reader::NAMESPACE_RSS_10); + case Zend_Feed_Reader::TYPE_RSS_10: + $this->_xpath->registerNamespace('rdf', Zend_Feed_Reader::NAMESPACE_RDF); + $this->_xpath->registerNamespace('rss', Zend_Feed_Reader::NAMESPACE_RSS_10); break; - case Reader\Reader::TYPE_RSS_090: - $this->_xpath->registerNamespace('rdf', Reader\Reader::NAMESPACE_RDF); - $this->_xpath->registerNamespace('rss', Reader\Reader::NAMESPACE_RSS_090); + case Zend_Feed_Reader::TYPE_RSS_090: + $this->_xpath->registerNamespace('rdf', Zend_Feed_Reader::NAMESPACE_RDF); + $this->_xpath->registerNamespace('rss', Zend_Feed_Reader::NAMESPACE_RSS_090); break; } } diff --git a/src/Reader/FeedAbstract.php b/src/Reader/FeedAbstract.php index 48791cf5..15552bbc 100644 --- a/src/Reader/FeedAbstract.php +++ b/src/Reader/FeedAbstract.php @@ -16,24 +16,26 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: FeedAbstract.php 22092 2010-05-04 12:50:51Z padraic $ */ /** - * @namespace + * @see Zend_Feed_Reader */ -namespace Zend\Feed\Reader; +require_once 'Zend/Feed/Reader.php'; + +/** + * @see Zend_feed_Reader_FeedInterface + */ +require_once 'Zend/Feed/Reader/FeedInterface.php'; /** - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Reader\Reader - * @uses Zend_feed_Reader_FeedInterface * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class FeedAbstract implements FeedInterface +abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInterface { /** * Parsed feed data @@ -77,27 +79,57 @@ abstract class FeedAbstract implements FeedInterface */ protected $_extensions = array(); + /** + * Original Source URI (set if imported from a URI) + * + * @var string + */ + protected $_originalSourceUri = null; + /** * Constructor * * @param DomDocument The DOM object for the feed's XML * @param string $type Feed type */ - public function __construct(\DomDocument $domDocument, $type = null) + public function __construct(DomDocument $domDocument, $type = null) { $this->_domDocument = $domDocument; - $this->_xpath = new \DOMXPath($this->_domDocument); + $this->_xpath = new DOMXPath($this->_domDocument); if ($type !== null) { $this->_data['type'] = $type; } else { - $this->_data['type'] = Reader::detectType($this->_domDocument); + $this->_data['type'] = Zend_Feed_Reader::detectType($this->_domDocument); } $this->_registerNamespaces(); $this->_indexEntries(); $this->_loadExtensions(); } + /** + * Set an original source URI for the feed being parsed. This value + * is returned from getFeedLink() method if the feed does not carry + * a self-referencing URI. + * + * @param string $uri + */ + public function setOriginalSourceUri($uri) + { + $this->_originalSourceUri = $uri; + } + + /** + * Get an original source URI for the feed being parsed. Returns null if + * unset or the feed was not imported from a URI. + * + * @return string|null + */ + public function getOriginalSourceUri() + { + return $this->_originalSourceUri; + } + /** * Get the number of feed entries. * Required by the Iterator interface. @@ -112,14 +144,14 @@ public function count() /** * Return the current entry * - * @return \Zend\Feed\Reader\EntryInterface + * @return Zend_Feed_Reader_EntryInterface */ public function current() { if (substr($this->getType(), 0, 3) == 'rss') { - $reader = new Entry\RSS($this->_entries[$this->key()], $this->key(), $this->getType()); + $reader = new Zend_Feed_Reader_Entry_Rss($this->_entries[$this->key()], $this->key(), $this->getType()); } else { - $reader = new Entry\Atom($this->_entries[$this->key()], $this->key(), $this->getType()); + $reader = new Zend_Feed_Reader_Entry_Atom($this->_entries[$this->key()], $this->key(), $this->getType()); } $reader->setXpath($this->_xpath); @@ -241,7 +273,8 @@ public function __call($method, $args) return call_user_func_array(array($extension, $method), $args); } } - throw new \Zend\Feed\Exception('Method: ' . $method + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Method: ' . $method . 'does not exist and could not be located on a registered Extension'); } @@ -249,25 +282,25 @@ public function __call($method, $args) * Return an Extension object with the matching name (postfixed with _Feed) * * @param string $name - * @return \Zend\Feed\Reader\Extension\FeedAbstract + * @return Zend_Feed_Reader_Extension_FeedAbstract */ public function getExtension($name) { - if (array_key_exists($name . '\Feed', $this->_extensions)) { - return $this->_extensions[$name . '\Feed']; + if (array_key_exists($name . '_Feed', $this->_extensions)) { + return $this->_extensions[$name . '_Feed']; } return null; } protected function _loadExtensions() { - $all = Reader::getExtensions(); + $all = Zend_Feed_Reader::getExtensions(); $feed = $all['feed']; foreach ($feed as $extension) { if (in_array($extension, $all['core'])) { continue; } - $className = Reader::getPluginLoader()->getClassName($extension); + $className = Zend_Feed_Reader::getPluginLoader()->getClassName($extension); $this->_extensions[$extension] = new $className( $this->getDomDocument(), $this->_data['type'], $this->_xpath ); diff --git a/src/Reader/FeedInterface.php b/src/Reader/FeedInterface.php index e8f299a5..35060baf 100644 --- a/src/Reader/FeedInterface.php +++ b/src/Reader/FeedInterface.php @@ -16,23 +16,16 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: FeedInterface.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace - */ -namespace Zend\Feed\Reader; - -/** - * @uses Countable - * @uses Iterator * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface FeedInterface extends \Iterator, \Countable +interface Zend_Feed_Reader_FeedInterface extends Iterator, Countable { /** * Get a single author @@ -122,7 +115,7 @@ public function getTitle(); /** * Get all categories * - * @return \Zend\Feed\Reader\Collection\Category + * @return Zend_Feed_Reader_Collection_Category */ public function getCategories(); diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index abcc16e4..3d073c73 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -16,24 +16,26 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: FeedSet.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace + * @see Zend_Feed_Reader */ -namespace Zend\Feed\Reader; -use Zend\URI; +require_once 'Zend/Feed/Reader.php'; + +/** + * @see Zend_Uri + */ +require_once 'Zend/Uri.php'; /** - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class FeedSet extends \ArrayObject +class Zend_Feed_Reader_FeedSet extends ArrayObject { public $rss = null; @@ -58,7 +60,7 @@ class FeedSet extends \ArrayObject * @param string $uri * @return void */ - public function addLinks(\DOMNodeList $links, $uri) + public function addLinks(DOMNodeList $links, $uri) { foreach ($links as $link) { if (strtolower($link->getAttribute('rel')) !== 'alternate' @@ -85,16 +87,16 @@ public function addLinks(\DOMNodeList $links, $uri) */ protected function _absolutiseUri($link, $uri = null) { - if (!URI\URL::validate($link)) { + if (!Zend_Uri::check($link)) { if (!is_null($uri)) { - $uri = new URI\URL($uri); + $uri = Zend_Uri::factory($uri); if ($link[0] !== '/') { $link = $uri->getPath() . '/' . $link; } $link = $uri->getScheme() . '://' . $uri->getHost() . '/' . $this->_canonicalizePath($link); - if (!URI\Zend\Uri\Uri::check($link)) { + if (!Zend_Uri::check($link)) { $link = null; } } @@ -128,7 +130,7 @@ protected function _canonicalizePath($path) * * @param string $offset * @return mixed - * @uses \Zend\Feed\Reader\Reader + * @uses Zend_Feed_Reader */ public function offsetGet($offset) { @@ -136,7 +138,7 @@ public function offsetGet($offset) if (!$this->offsetExists('href')) { return null; } - $feed = Reader::import($this->offsetGet('href')); + $feed = Zend_Feed_Reader::import($this->offsetGet('href')); $this->offsetSet('feed', $feed); return $feed; } diff --git a/src/Rss.php b/src/Rss.php deleted file mode 100644 index deb809e1..00000000 --- a/src/Rss.php +++ /dev/null @@ -1,517 +0,0 @@ -s). - * - * @var string - */ - protected $_entryElementName = 'item'; - - /** - * The default namespace for RSS channels. - * - * @var string - */ - protected $_defaultNamespace = 'rss'; - - /** - * Override Zend_Feed_Abstract to set up the $_element and $_entries aliases. - * - * @return void - * @throws \Zend\Feed\Exception - */ - public function __wakeup() - { - parent::__wakeup(); - - // 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); - } else { - $this->_element = $this->_element->getElementsByTagName('channel')->item(0); - } - if (!$this->_element) { - throw new Exception('No root element found, cannot parse channel.'); - } - - // Find the entries and save a pointer to them for speed and - // simplicity. - $this->_buildEntryCache(); - } - - - /** - * Make accessing some individual elements of the channel easier. - * - * Special accessors 'item' and 'items' are provided so that if - * you wish to iterate over an RSS channel's items, you can do so - * using foreach ($channel->items as $item) or foreach - * ($channel->item as $item). - * - * @param string $var The property to access. - * @return mixed - */ - public function __get($var) - { - switch ($var) { - case 'item': - // fall through to the next case - case 'items': - return $this; - - default: - return parent::__get($var); - } - } - - /** - * Generate the header of the feed when working in write mode - * - * @param array $array the data to use - * @return DOMElement root node - */ - protected function _mapFeedHeaders($array) - { - $channel = $this->_element->createElement('channel'); - - $title = $this->_element->createElement('title'); - $title->appendChild($this->_element->createCDATASection($array->title)); - $channel->appendChild($title); - - $link = $this->_element->createElement('link', $array->link); - $channel->appendChild($link); - - $desc = isset($array->description) ? $array->description : ''; - $description = $this->_element->createElement('description'); - $description->appendChild($this->_element->createCDATASection($desc)); - $channel->appendChild($description); - - $pubdate = isset($array->lastUpdate) ? $array->lastUpdate : time(); - $pubdate = $this->_element->createElement('pubDate', date(DATE_RSS, $pubdate)); - $channel->appendChild($pubdate); - - if (isset($array->published)) { - $lastBuildDate = $this->_element->createElement('lastBuildDate', date(DATE_RSS, $array->published)); - $channel->appendChild($lastBuildDate); - } - - $editor = ''; - if (!empty($array->email)) { - $editor .= $array->email; - } - if (!empty($array->author)) { - $editor .= ' (' . $array->author . ')'; - } - if (!empty($editor)) { - $author = $this->_element->createElement('managingEditor', ltrim($editor)); - $channel->appendChild($author); - } - if (isset($array->webmaster)) { - $channel->appendChild($this->_element->createElement('webMaster', $array->webmaster)); - } - - if (!empty($array->copyright)) { - $copyright = $this->_element->createElement('copyright', $array->copyright); - $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'); - $imagetitle->appendChild($this->_element->createCDATASection($array->title)); - $image->appendChild($imagetitle); - $imagelink = $this->_element->createElement('link', $array->link); - $image->appendChild($imagelink); - - $channel->appendChild($image); - } - - $generator = !empty($array->generator) ? $array->generator : 'Zend_Feed'; - $generator = $this->_element->createElement('generator', $generator); - $channel->appendChild($generator); - - if (!empty($array->language)) { - $language = $this->_element->createElement('language', $array->language); - $channel->appendChild($language); - } - - $doc = $this->_element->createElement('docs', 'http://blogs.law.harvard.edu/tech/rss'); - $channel->appendChild($doc); - - if (isset($array->cloud)) { - $cloud = $this->_element->createElement('cloud'); - $cloud->setAttribute('domain', $array->cloud['uri']->getHost()); - $cloud->setAttribute('port', $array->cloud['uri']->getPort()); - $cloud->setAttribute('path', $array->cloud['uri']->getPath()); - $cloud->setAttribute('registerProcedure', $array->cloud['procedure']); - $cloud->setAttribute('protocol', $array->cloud['protocol']); - $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); - } - - if (isset($array->textInput)) { - $textinput = $this->_element->createElement('textInput'); - $textinput->appendChild($this->_element->createElement('title', $array->textInput['title'])); - $textinput->appendChild($this->_element->createElement('description', $array->textInput['description'])); - $textinput->appendChild($this->_element->createElement('name', $array->textInput['name'])); - $textinput->appendChild($this->_element->createElement('link', $array->textInput['link'])); - $channel->appendChild($textinput); - } - - if (isset($array->skipHours)) { - $skipHours = $this->_element->createElement('skipHours'); - foreach ($array->skipHours as $hour) { - $skipHours->appendChild($this->_element->createElement('hour', $hour)); - } - $channel->appendChild($skipHours); - } - - if (isset($array->skipDays)) { - $skipDays = $this->_element->createElement('skipDays'); - foreach ($array->skipDays as $day) { - $skipDays->appendChild($this->_element->createElement('day', $day)); - } - $channel->appendChild($skipDays); - } - - if (isset($array->itunes)) { - $this->_buildiTunes($channel, $array); - } - - return $channel; - } - - /** - * Adds the iTunes extensions to a root node - * - * @param DOMElement $root - * @param array $array - * @return void - */ - private function _buildiTunes(\DOMElement $root, $array) - { - /* author node */ - $author = ''; - if (isset($array->itunes->author)) { - $author = $array->itunes->author; - } elseif (isset($array->author)) { - $author = $array->author; - } - if (!empty($author)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:author', $author); - $root->appendChild($node); - } - - /* owner node */ - $author = ''; - $email = ''; - if (isset($array->itunes->owner)) { - if (isset($array->itunes->owner['name'])) { - $author = $array->itunes->owner['name']; - } - if (isset($array->itunes->owner['email'])) { - $email = $array->itunes->owner['email']; - } - } - if (empty($author) && isset($array->author)) { - $author = $array->author; - } - if (empty($email) && isset($array->email)) { - $email = $array->email; - } - if (!empty($author) || !empty($email)) { - $owner = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:owner'); - if (!empty($author)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:name', $author); - $owner->appendChild($node); - } - if (!empty($email)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:email', $email); - $owner->appendChild($node); - } - $root->appendChild($owner); - } - $image = ''; - if (isset($array->itunes->image)) { - $image = $array->itunes->image; - } elseif (isset($array->image)) { - $image = $array->image; - } - if (!empty($image)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:image'); - $node->setAttribute('href', $image); - $root->appendChild($node); - } - $subtitle = ''; - if (isset($array->itunes->subtitle)) { - $subtitle = $array->itunes->subtitle; - } elseif (isset($array->description)) { - $subtitle = $array->description; - } - if (!empty($subtitle)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:subtitle', $subtitle); - $root->appendChild($node); - } - $summary = ''; - if (isset($array->itunes->summary)) { - $summary = $array->itunes->summary; - } elseif (isset($array->description)) { - $summary = $array->description; - } - if (!empty($summary)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:summary', $summary); - $root->appendChild($node); - } - if (isset($array->itunes->block)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:block', $array->itunes->block); - $root->appendChild($node); - } - if (isset($array->itunes->explicit)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:explicit', $array->itunes->explicit); - $root->appendChild($node); - } - if (isset($array->itunes->keywords)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:keywords', $array->itunes->keywords); - $root->appendChild($node); - } - if (isset($array->itunes->new_feed_url)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:new-feed-url', $array->itunes->new_feed_url); - $root->appendChild($node); - } - if (isset($array->itunes->category)) { - foreach ($array->itunes->category as $i => $category) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); - $node->setAttribute('text', $category['main']); - $root->appendChild($node); - $add_end_category = false; - if (!empty($category['sub'])) { - $add_end_category = true; - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); - $node->setAttribute('text', $category['sub']); - $root->appendChild($node); - } - if ($i > 0 || $add_end_category) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); - $root->appendChild($node); - } - } - } - } - - /** - * Generate the entries of the feed when working in write mode - * - * The following nodes are constructed for each feed entry - * - * entry title - * url to feed entry - * url to feed entry - * short text - * long version, can contain html - * - * - * @param DOMElement $root the root node to use - * @param array $array the data to use - * @return void - */ - protected function _mapFeedEntries(\DOMElement $root, $array) - { - Feed::registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/'); - - foreach ($array as $dataentry) { - $item = $this->_element->createElement('item'); - - $title = $this->_element->createElement('title'); - $title->appendChild($this->_element->createCDATASection($dataentry->title)); - $item->appendChild($title); - - if (isset($dataentry->author)) { - $author = $this->_element->createElement('author', $dataentry->author); - $item->appendChild($author); - } - - $link = $this->_element->createElement('link', $dataentry->link); - $item->appendChild($link); - - if (isset($dataentry->guid)) { - $guid = $this->_element->createElement('guid', $dataentry->guid); - //if (!\Zend\Uri\Uri::check($dataentry->guid)) { - $guid->setAttribute('isPermaLink', 'false'); - //} - $item->appendChild($guid); - } - - $description = $this->_element->createElement('description'); - $description->appendChild($this->_element->createCDATASection($dataentry->description)); - $item->appendChild($description); - - if (isset($dataentry->content)) { - $content = $this->_element->createElement('content:encoded'); - $content->appendChild($this->_element->createCDATASection($dataentry->content)); - $item->appendChild($content); - } - - $pubdate = isset($dataentry->lastUpdate) ? $dataentry->lastUpdate : time(); - $pubdate = $this->_element->createElement('pubDate', date(DATE_RSS, $pubdate)); - $item->appendChild($pubdate); - - if (isset($dataentry->category)) { - foreach ($dataentry->category as $category) { - $node = $this->_element->createElement('category', $category['term']); - if (isset($category['scheme'])) { - $node->setAttribute('domain', $category['scheme']); - } - $item->appendChild($node); - } - } - - if (isset($dataentry->source)) { - $source = $this->_element->createElement('source', $dataentry->source['title']); - $source->setAttribute('url', $dataentry->source['url']); - $item->appendChild($source); - } - - if (isset($dataentry->comments)) { - $comments = $this->_element->createElement('comments', $dataentry->comments); - $item->appendChild($comments); - } - if (isset($dataentry->commentRss)) { - $comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/', - 'wfw:commentRss', - $dataentry->commentRss); - $item->appendChild($comments); - } - - - if (isset($dataentry->enclosure)) { - foreach ($dataentry->enclosure as $enclosure) { - $node = $this->_element->createElement('enclosure'); - $node->setAttribute('url', $enclosure['url']); - if (isset($enclosure['type'])) { - $node->setAttribute('type', $enclosure['type']); - } - if (isset($enclosure['length'])) { - $node->setAttribute('length', $enclosure['length']); - } - $item->appendChild($node); - } - } - - $root->appendChild($item); - } - } - - /** - * Override Zend_Feed_Element to include root node - * - * @return string - */ - public function saveXml() - { - // Return a complete document including XML prologue. - $doc = new \DOMDocument($this->_element->ownerDocument->version, - $this->_element->ownerDocument->actualEncoding); - $root = $doc->createElement('rss'); - - // Use rss version 2.0 - $root->setAttribute('version', '2.0'); - - // Content namespace - $root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:content', 'http://purl.org/rss/1.0/modules/content/'); - $root->appendChild($doc->importNode($this->_element, true)); - - // Append root node - $doc->appendChild($root); - - // Format output - $doc->formatOutput = true; - - return $doc->saveXML(); - } - - /** - * Send feed to a http client with the correct header - * - * @return void - * @throws \Zend\Feed\Exception if headers have already been sent - */ - public function send() - { - if (headers_sent()) { - throw new Exception('Cannot send RSS because headers have already been sent.'); - } - - header('Content-Type: application/rss+xml; charset=' . $this->_element->ownerDocument->actualEncoding); - - echo $this->saveXml(); - } - -} diff --git a/src/Writer/Writer.php b/src/Writer.php similarity index 86% rename from src/Writer/Writer.php rename to src/Writer.php index f52deb1f..8653af8d 100644 --- a/src/Writer/Writer.php +++ b/src/Writer.php @@ -16,24 +16,16 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Writer.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @namespace - */ -namespace Zend\Feed\Writer; -use Zend\Loader\PluginLoader; - -/** - * @uses \Zend\Feed\Exception - * @uses \Zend\Loader\PluginLoader\PluginLoader * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Writer +class Zend_Feed_Writer { /** * Namespace constants @@ -65,7 +57,7 @@ class Writer /** * PluginLoader instance used by component * - * @var \Zend\Loader\PluginLoader\PluginLoaderInterface + * @var Zend_Loader_PluginLoader_Interface */ protected static $_pluginLoader = null; @@ -93,9 +85,9 @@ class Writer /** * Set plugin loader for use with Extensions * - * @param \Zend\Loader\PluginLoader\PluginLoaderInterface + * @param Zend_Loader_PluginLoader_Interface */ - public static function setPluginLoader(PluginLoader\PluginLoaderInterface $loader) + public static function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader) { self::$_pluginLoader = $loader; } @@ -103,13 +95,14 @@ public static function setPluginLoader(PluginLoader\PluginLoaderInterface $loade /** * Get plugin loader for use with Extensions * - * @return \Zend\Loader\PluginLoader\PluginLoaderInterface + * @return Zend_Loader_PluginLoader_Interface */ public static function getPluginLoader() { if (!isset(self::$_pluginLoader)) { - self::$_pluginLoader = new PluginLoader\PluginLoader(array( - 'Zend\Feed\Writer\Extension\\' => 'Zend/Feed/Writer/Extension/', + require_once 'Zend/Loader/PluginLoader.php'; + self::$_pluginLoader = new Zend_Loader_PluginLoader(array( + 'Zend_Feed_Writer_Extension_' => 'Zend/Feed/Writer/Extension/', )); } return self::$_pluginLoader; @@ -152,14 +145,14 @@ public static function addPrefixPaths(array $spec) * * @param string $name * @return void - * @throws \Zend\Feed\Exception if unable to resolve Extension class + * @throws Zend_Feed_Exception if unable to resolve Extension class */ public static function registerExtension($name) { - $feedName = $name . '\Feed'; - $entryName = $name . '\Entry'; - $feedRendererName = $name . '\Renderer\Feed'; - $entryRendererName = $name . '\Renderer\Entry'; + $feedName = $name . '_Feed'; + $entryName = $name . '_Entry'; + $feedRendererName = $name . '_Renderer_Feed'; + $entryRendererName = $name . '_Renderer_Entry'; if (self::isRegistered($name)) { if (self::getPluginLoader()->isLoaded($feedName) || self::getPluginLoader()->isLoaded($entryName) @@ -172,29 +165,30 @@ public static function registerExtension($name) try { self::getPluginLoader()->load($feedName); self::$_extensions['feed'][] = $feedName; - } catch (PluginLoader\Exception $e) { + } catch (Zend_Loader_PluginLoader_Exception $e) { } try { self::getPluginLoader()->load($entryName); self::$_extensions['entry'][] = $entryName; - } catch (PluginLoader\Exception $e) { + } catch (Zend_Loader_PluginLoader_Exception $e) { } try { self::getPluginLoader()->load($feedRendererName); self::$_extensions['feedRenderer'][] = $feedRendererName; - } catch (PluginLoader\Exception $e) { + } catch (Zend_Loader_PluginLoader_Exception $e) { } try { self::getPluginLoader()->load($entryRendererName); self::$_extensions['entryRenderer'][] = $entryRendererName; - } catch (PluginLoader\Exception $e) { + } catch (Zend_Loader_PluginLoader_Exception $e) { } if (!self::getPluginLoader()->isLoaded($feedName) && !self::getPluginLoader()->isLoaded($entryName) && !self::getPluginLoader()->isLoaded($feedRendererName) && !self::getPluginLoader()->isLoaded($entryRendererName) ) { - throw new \Zend\Feed\Exception('Could not load extension: ' . $name + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Could not load extension: ' . $name . 'using Plugin Loader. Check prefix paths are configured and extension exists.'); } } diff --git a/src/Writer/Deleted.php b/src/Writer/Deleted.php index df7b5140..ba189201 100644 --- a/src/Writer/Deleted.php +++ b/src/Writer/Deleted.php @@ -16,26 +16,18 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Deleted.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ -/** - * @namespace - */ -namespace Zend\Feed\Writer; -use Zend\Feed; -use Zend\Date; - -/** - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Exception - * @uses \Zend\Uri\Uri +require_once 'Zend/Feed/Writer/Feed/FeedAbstract.php'; + + /** * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Deleted +class Zend_Feed_Writer_Deleted { /** @@ -61,7 +53,8 @@ class Deleted public function setEncoding($encoding) { if (empty($encoding) || !is_string($encoding)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['encoding'] = $encoding; } @@ -116,7 +109,8 @@ public function getType() public function setReference($reference) { if (empty($reference) || !is_string($reference)) { - throw new Feed\Exception('Invalid parameter: reference must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: reference must be a non-empty string'); } $this->_data['reference'] = $reference; } @@ -133,13 +127,14 @@ public function setWhen($date = null) { $zdate = null; if (is_null($date)) { - $zdate = new Date\Date; + $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { - $zdate = new Date\Date($date, Date\Date::TIMESTAMP); - } elseif ($date instanceof Date\Date) { + $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); + } elseif ($date instanceof Zend_Date) { $zdate = $date; } else { - throw new Feed\Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['when'] = $zdate; } @@ -159,21 +154,24 @@ public function setBy(array $by) || empty($by['name']) || !is_string($by['name']) ) { - throw new Feed\Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); } $author['name'] = $by['name']; if (isset($by['email'])) { if (empty($by['email']) || !is_string($by['email'])) { - throw new Feed\Exception('Invalid parameter: "email" array value must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); } $author['email'] = $by['email']; } if (isset($by['uri'])) { if (empty($by['uri']) || !is_string($by['uri']) - || !\Zend\URI\URL::validate($by['uri']) + || !Zend_Uri::check($by['uri']) ) { - throw new Feed\Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $by['uri']; } diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index 541fcd81..4dc19820 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -16,29 +16,28 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Entry.php 22064 2010-04-30 14:02:38Z padraic $ */ /** - * @namespace + * @see Zend_Date */ -namespace Zend\Feed\Writer; -use Zend\Feed; -use Zend\URI; -use Zend\Date; +require_once 'Zend/Date.php'; + +/** + * @see Zend_Date + */ +require_once 'Zend/Uri.php'; + +require_once 'Zend/Feed/Writer/Source.php'; /** - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Writer\Writer - * @uses \Zend\Feed\Writer\Source - * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry +class Zend_Feed_Writer_Entry { /** @@ -71,7 +70,7 @@ class Entry */ public function __construct() { - Writer::registerCoreExtensions(); + Zend_Feed_Writer::registerCoreExtensions(); $this->_loadExtensions(); } @@ -89,21 +88,24 @@ public function addAuthor($name, $email = null, $uri = null) || empty($name['name']) || !is_string($name['name']) ) { - throw new Feed\Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); } $author['name'] = $name['name']; if (isset($name['email'])) { if (empty($name['email']) || !is_string($name['email'])) { - throw new Feed\Exception('Invalid parameter: "email" array value must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); } $author['email'] = $name['email']; } if (isset($name['uri'])) { if (empty($name['uri']) || !is_string($name['uri']) - || !\Zend\URI\URL::validate($name['uri']) + || !Zend_Uri::check($name['uri']) ) { - throw new Feed\Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $name['uri']; } @@ -113,18 +115,21 @@ public function addAuthor($name, $email = null, $uri = null) */ } else { if (empty($name['name']) || !is_string($name['name'])) { - throw new Feed\Exception('Invalid parameter: "name" must be a non-empty string value'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string value'); } $author['name'] = $name; if (isset($email)) { if (empty($email) || !is_string($email)) { - throw new Feed\Exception('Invalid parameter: "email" value must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "email" value must be a non-empty string'); } $author['email'] = $email; } if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !\Zend\URI\URL::validate($uri)) { - throw new Feed\Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); + if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $uri; } @@ -152,7 +157,8 @@ public function addAuthors(array $authors) public function setEncoding($encoding) { if (empty($encoding) || !is_string($encoding)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['encoding'] = $encoding; } @@ -178,7 +184,8 @@ public function getEncoding() public function setCopyright($copyright) { if (empty($copyright) || !is_string($copyright)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['copyright'] = $copyright; } @@ -191,7 +198,8 @@ public function setCopyright($copyright) public function setContent($content) { if (empty($content) || !is_string($content)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['content'] = $content; } @@ -205,13 +213,14 @@ public function setDateCreated($date = null) { $zdate = null; if (is_null($date)) { - $zdate = new Date\Date; + $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { - $zdate = new Date\Date($date, Date\Date::TIMESTAMP); - } elseif ($date instanceof Date\Date) { + $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); + } elseif ($date instanceof Zend_Date) { $zdate = $date; } else { - throw new Feed\Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateCreated'] = $zdate; } @@ -225,13 +234,14 @@ public function setDateModified($date = null) { $zdate = null; if (is_null($date)) { - $zdate = new Date\Date; + $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { - $zdate = new Date\Date($date, Date\Date::TIMESTAMP); - } elseif ($date instanceof Date\Date) { + $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); + } elseif ($date instanceof Zend_Date) { $zdate = $date; } else { - throw new Feed\Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateModified'] = $zdate; } @@ -244,7 +254,8 @@ public function setDateModified($date = null) public function setDescription($description) { if (empty($description) || !is_string($description)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['description'] = $description; } @@ -257,7 +268,8 @@ public function setDescription($description) public function setId($id) { if (empty($id) || !is_string($id)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['id'] = $id; } @@ -269,8 +281,9 @@ public function setId($id) */ public function setLink($link) { - if (empty($link) || !is_string($link) || !\Zend\URI\URL::validate($link)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['link'] = $link; } @@ -283,7 +296,8 @@ public function setLink($link) public function setCommentCount($count) { if (empty($count) || !is_numeric($count) || (int) $count < 0) { - throw new Feed\Exception('Invalid parameter: "count" must be a non-empty integer number'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "count" must be a non-empty integer number'); } $this->_data['commentCount'] = (int) $count; } @@ -295,8 +309,9 @@ public function setCommentCount($count) */ public function setCommentLink($link) { - if (empty($link) || !is_string($link) || !\Zend\URI\URL::validate($link)) { - throw new Feed\Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); + if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); } $this->_data['commentLink'] = $link; } @@ -308,11 +323,13 @@ public function setCommentLink($link) */ public function setCommentFeedLink(array $link) { - if (!isset($link['uri']) || !is_string($link['uri']) || !\Zend\URI\URL::validate($link['uri'])) { - throw new Feed\Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); + if (!isset($link['uri']) || !is_string($link['uri']) || !Zend_Uri::check($link['uri'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); } if (!isset($link['type']) || !in_array($link['type'], array('atom', 'rss', 'rdf'))) { - throw new Feed\Exception('Invalid parameter: "type" must be one' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "type" must be one' . ' of "atom", "rss" or "rdf"'); } if (!isset($this->_data['commentFeedLinks'])) { @@ -343,7 +360,8 @@ public function setCommentFeedLinks(array $links) public function setTitle($title) { if (empty($title) || !is_string($title)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['title'] = $title; } @@ -527,16 +545,18 @@ public function getCommentFeedLinks() public function addCategory(array $category) { if (!isset($category['term'])) { - throw new Feed\Exception('Each category must be an array and ' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Each category must be an array and ' . 'contain at least a "term" element containing the machine ' . ' readable category name'); } if (isset($category['scheme'])) { if (empty($category['scheme']) || !is_string($category['scheme']) - || !\Zend\URI\URL::validate($category['scheme']) + || !Zend_Uri::check($category['scheme']) ) { - throw new Feed\Exception('The Atom scheme or RSS domain of' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('The Atom scheme or RSS domain of' . ' a category must be a valid URI'); } } @@ -572,27 +592,22 @@ public function getCategories() } /** - * Adds an enclosure to the entry. + * Adds an enclosure to the entry. The array parameter may contain the + * keys 'uri', 'type' and 'length'. Only 'uri' is required for Atom, though the + * others must also be provided or RSS rendering (where they are required) + * will throw an Exception. * * @param array $enclosures */ public function setEnclosure(array $enclosure) { - if (!isset($enclosure['type'])) { - throw new Feed\Exception('Enclosure "type" is not set'); - } - if (!isset($enclosure['length'])) { - throw new Feed\Exception('Enclosure "length" is not set'); - } if (!isset($enclosure['uri'])) { - throw new Feed\Exception('Enclosure "uri" is not set'); - } - if (!\Zend\URI\URL::validate($enclosure['uri'])) { - throw new Feed\Exception('Enclosure "uri" is not a valid URI/IRI'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Enclosure "uri" is not set'); } - if ((int) $enclosure['length'] <= 0) { - throw new Feed\Exception('Enclosure "length" must be an integer' - . ' indicating the content\'s length in bytes'); + if (!Zend_Uri::check($enclosure['uri'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Enclosure "uri" is not a valid URI/IRI'); } $this->_data['enclosure'] = $enclosure; } @@ -674,17 +689,18 @@ public function getType() * @param string $method * @param array $args * @return mixed - * @throws \Zend\Feed\Exception if no extensions implements the method + * @throws Zend_Feed_Exception if no extensions implements the method */ public function __call($method, $args) { foreach ($this->_extensions as $extension) { try { return call_user_func_array(array($extension, $method), $args); - } catch (Exception\InvalidMethodException $e) { + } catch (Zend_Feed_Writer_Exception_InvalidMethodException $e) { } } - throw new Feed\Exception('Method: ' . $method + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Method: ' . $method . ' does not exist and could not be located on a registered Extension'); } @@ -693,11 +709,11 @@ public function __call($method, $args) * added to the current feed automatically, but is necessary to create a * container with some initial values preset based on the current feed data. * - * @return \Zend\Feed\Writer\Source + * @return Zend_Feed_Writer_Source */ public function createSource() { - $source = new Source; + $source = new Zend_Feed_Writer_Source; if ($this->getEncoding()) { $source->setEncoding($this->getEncoding()); } @@ -709,15 +725,15 @@ public function createSource() * Appends a Zend_Feed_Writer_Entry object representing a new entry/item * the feed data container's internal group of entries. * - * @param \Zend\Feed\Writer\Source $source + * @param Zend_Feed_Writer_Source $source */ - public function setSource(Source $source) + public function setSource(Zend_Feed_Writer_Source $source) { $this->_data['source'] = $source; } /** - * @return \Zend\Feed\Writer\Source + * @return Zend_Feed_Writer_Source */ public function getSource() { @@ -734,10 +750,10 @@ public function getSource() */ protected function _loadExtensions() { - $all = Writer::getExtensions(); + $all = Zend_Feed_Writer::getExtensions(); $exts = $all['entry']; foreach ($exts as $ext) { - $className = Writer::getPluginLoader()->getClassName($ext); + $className = Zend_Feed_Writer::getPluginLoader()->getClassName($ext); $this->_extensions[$ext] = new $className(); $this->_extensions[$ext]->setEncoding($this->getEncoding()); } diff --git a/src/Writer/Exception/InvalidMethodException.php b/src/Writer/Exception/InvalidMethodException.php index ff301762..f6c4f933 100644 --- a/src/Writer/Exception/InvalidMethodException.php +++ b/src/Writer/Exception/InvalidMethodException.php @@ -17,24 +17,25 @@ * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: InvalidMethodException.php 20096 2010-01-06 02:05:09Z bkarwin $ */ + /** - * @namespace + * @see Zend_Feed_Exception */ -namespace Zend\Feed\Writer\Exception; +require_once 'Zend/Feed/Exception.php'; + /** * Feed exceptions * * Class to represent exceptions that occur during Feed operations. * - * @uses \Zend\Feed\Exception * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class InvalidMethodException extends \Zend\Exception +class Zend_Feed_Writer_Exception_InvalidMethodException extends Zend_Exception {} diff --git a/src/Writer/Extension/Atom/Renderer/Feed.php b/src/Writer/Extension/Atom/Renderer/Feed.php index 6574177c..d525f55f 100644 --- a/src/Writer/Extension/Atom/Renderer/Feed.php +++ b/src/Writer/Extension/Atom/Renderer/Feed.php @@ -16,23 +16,22 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Feed.php 20325 2010-01-16 00:17:59Z padraic $ */ - + /** - * @namespace + * @see Zend_Feed_Writer_Extension_RendererAbstract */ -namespace Zend\Feed\Writer\Extension\Atom\Renderer; - +require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; + /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Zend_Feed_Writer_Extension_Atom_Renderer_Feed + extends Zend_Feed_Writer_Extension_RendererAbstract { /** @@ -83,7 +82,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setFeedLinks(\DOMDocument $dom, \DOMElement $root) + protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) { $flinks = $this->getDataContainer()->getFeedLinks(); if(!$flinks || empty($flinks)) { @@ -107,7 +106,7 @@ protected function _setFeedLinks(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setHubs(\DOMDocument $dom, \DOMElement $root) + protected function _setHubs(DOMDocument $dom, DOMElement $root) { $hubs = $this->getDataContainer()->getHubs(); if (!$hubs || empty($hubs)) { diff --git a/src/Writer/Extension/Content/Renderer/Entry.php b/src/Writer/Extension/Content/Renderer/Entry.php index c559b635..429fbed3 100644 --- a/src/Writer/Extension/Content/Renderer/Entry.php +++ b/src/Writer/Extension/Content/Renderer/Entry.php @@ -16,23 +16,22 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Entry.php 20325 2010-01-16 00:17:59Z padraic $ */ - + /** - * @namespace + * @see Zend_Feed_Writer_Extension_RendererAbstract */ -namespace Zend\Feed\Writer\Extension\Content\Renderer; - +require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; + /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Zend_Feed_Writer_Extension_Content_Renderer_Entry + extends Zend_Feed_Writer_Extension_RendererAbstract { /** @@ -78,7 +77,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setContent(\DOMDocument $dom, \DOMElement $root) + protected function _setContent(DOMDocument $dom, DOMElement $root) { $content = $this->getDataContainer()->getContent(); if (!$content) { diff --git a/src/Writer/Extension/DublinCore/Renderer/Entry.php b/src/Writer/Extension/DublinCore/Renderer/Entry.php index f2484e05..fb3d13e0 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Entry.php +++ b/src/Writer/Extension/DublinCore/Renderer/Entry.php @@ -16,23 +16,22 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Entry.php 20325 2010-01-16 00:17:59Z padraic $ */ - + /** - * @namespace + * @see Zend_Feed_Writer_Extension_RendererAbstract */ -namespace Zend\Feed\Writer\Extension\DublinCore\Renderer; - +require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; + /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Zend_Feed_Writer_Extension_DublinCore_Renderer_Entry + extends Zend_Feed_Writer_Extension_RendererAbstract { /** @@ -78,7 +77,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->getDataContainer()->getAuthors(); if (!$authors || empty($authors)) { diff --git a/src/Writer/Extension/DublinCore/Renderer/Feed.php b/src/Writer/Extension/DublinCore/Renderer/Feed.php index c3a41473..2f6c70a5 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Feed.php +++ b/src/Writer/Extension/DublinCore/Renderer/Feed.php @@ -16,23 +16,22 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Feed.php 20325 2010-01-16 00:17:59Z padraic $ */ - + /** - * @namespace + * @see Zend_Feed_Writer_Extension_RendererAbstract */ -namespace Zend\Feed\Writer\Extension\DublinCore\Renderer; - +require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; + /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Zend_Feed_Writer_Extension_DublinCore_Renderer_Feed + extends Zend_Feed_Writer_Extension_RendererAbstract { /** @@ -78,7 +77,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->getDataContainer()->getAuthors(); if (!$authors || empty($authors)) { diff --git a/src/Writer/Extension/ITunes/Entry.php b/src/Writer/Extension/ITunes/Entry.php index bac16703..49eecb71 100644 --- a/src/Writer/Extension/ITunes/Entry.php +++ b/src/Writer/Extension/ITunes/Entry.php @@ -16,25 +16,16 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ - + /** - * @namespace - */ -namespace Zend\Feed\Writer\Extension\ITunes; - - -/** - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Writer\Writer - * @uses \Zend\Feed\Writer\Exception\InvalidMethodException * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry +class Zend_Feed_Writer_Extension_ITunes_Entry { /** * Array of Feed data for rendering by Extension's renderers @@ -54,7 +45,7 @@ class Entry * Set feed encoding * * @param string $enc - * @return \Zend\Feed\Writer\Extension\ITunes\Entry + * @return Zend_Feed_Writer_Extension_ITunes_Entry */ public function setEncoding($enc) { @@ -76,16 +67,18 @@ public function getEncoding() * Set a block value of "yes" or "no". You may also set an empty string. * * @param string - * @return \Zend\Feed\Writer\Extension\ITunes\Entry + * @return Zend_Feed_Writer_Extension_ITunes_Entry */ public function setItunesBlock($value) { if (!ctype_alpha($value) && strlen($value) > 0) { - throw new \Zend\Feed\Exception('invalid parameter: "block" may only' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "block" may only' . ' contain alphabetic characters'); } if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new \Zend\Feed\Exception('invalid parameter: "block" may only' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "block" may only' . ' contain a maximum of 255 characters'); } $this->_data['block'] = $value; @@ -95,7 +88,7 @@ public function setItunesBlock($value) * Add authors to itunes entry * * @param array $values - * @return \Zend\Feed\Writer\Extension\ITunes\Entry + * @return Zend_Feed_Writer_Extension_ITunes_Entry */ public function addItunesAuthors(array $values) { @@ -109,12 +102,13 @@ public function addItunesAuthors(array $values) * Add author to itunes entry * * @param string $value - * @return \Zend\Feed\Writer\Extension\ITunes\Entry + * @return Zend_Feed_Writer_Extension_ITunes_Entry */ public function addItunesAuthor($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new \Zend\Feed\Exception('invalid parameter: any "author" may only' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: any "author" may only' . ' contain a maximum of 255 characters each'); } if (!isset($this->_data['authors'])) { @@ -128,7 +122,7 @@ public function addItunesAuthor($value) * Set duration * * @param int $value - * @return \Zend\Feed\Writer\Extension\ITunes\Entry + * @return Zend_Feed_Writer_Extension_ITunes_Entry */ public function setItunesDuration($value) { @@ -137,7 +131,8 @@ public function setItunesDuration($value) && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value) ) { - throw new \Zend\Feed\Exception('invalid parameter: "duration" may only' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "duration" may only' . ' be of a specified [[HH:]MM:]SS format'); } $this->_data['duration'] = $value; @@ -148,12 +143,13 @@ public function setItunesDuration($value) * Set "explicit" flag * * @param bool $value - * @return \Zend\Feed\Writer\Extension\ITunes\Entry + * @return Zend_Feed_Writer_Extension_ITunes_Entry */ public function setItunesExplicit($value) { if (!in_array($value, array('yes','no','clean'))) { - throw new \Zend\Feed\Exception('invalid parameter: "explicit" may only' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "explicit" may only' . ' be one of "yes", "no" or "clean"'); } $this->_data['explicit'] = $value; @@ -164,17 +160,19 @@ public function setItunesExplicit($value) * Set keywords * * @param array $value - * @return \Zend\Feed\Writer\Extension\ITunes\Entry + * @return Zend_Feed_Writer_Extension_ITunes_Entry */ public function setItunesKeywords(array $value) { if (count($value) > 12) { - throw new \Zend\Feed\Exception('invalid parameter: "keywords" may only' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' . ' contain a maximum of 12 terms'); } $concat = implode(',', $value); if (iconv_strlen($concat, $this->getEncoding()) > 255) { - throw new \Zend\Feed\Exception('invalid parameter: "keywords" may only' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' . ' have a concatenated length of 255 chars where terms are delimited' . ' by a comma'); } @@ -186,12 +184,13 @@ public function setItunesKeywords(array $value) * Set subtitle * * @param string $value - * @return \Zend\Feed\Writer\Extension\ITunes\Entry + * @return Zend_Feed_Writer_Extension_ITunes_Entry */ public function setItunesSubtitle($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new \Zend\Feed\Exception('invalid parameter: "subtitle" may only' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "subtitle" may only' . ' contain a maximum of 255 characters'); } $this->_data['subtitle'] = $value; @@ -202,12 +201,13 @@ public function setItunesSubtitle($value) * Set summary * * @param string $value - * @return \Zend\Feed\Writer\Extension\ITunes\Entry + * @return Zend_Feed_Writer_Extension_ITunes_Entry */ public function setItunesSummary($value) { if (iconv_strlen($value, $this->getEncoding()) > 4000) { - throw new \Zend\Feed\Exception('invalid parameter: "summary" may only' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "summary" may only' . ' contain a maximum of 4000 characters'); } $this->_data['summary'] = $value; @@ -223,11 +223,12 @@ public function setItunesSummary($value) */ public function __call($method, array $params) { - $point = \Zend\Feed\Writer\Writer::lcfirst(substr($method, 9)); + $point = Zend_Feed_Writer::lcfirst(substr($method, 9)); if (!method_exists($this, 'setItunes' . ucfirst($point)) && !method_exists($this, 'addItunes' . ucfirst($point)) ) { - throw new \Zend\Feed\Writer\Exception\InvalidMethodException( + require_once 'Zend/Feed/Writer/Exception/InvalidMethodException.php'; + throw new Zend_Feed_Writer_Exception_InvalidMethodException( 'invalid method: ' . $method ); } diff --git a/src/Writer/Extension/ITunes/Feed.php b/src/Writer/Extension/ITunes/Feed.php index 4624fdb7..565fdc5c 100644 --- a/src/Writer/Extension/ITunes/Feed.php +++ b/src/Writer/Extension/ITunes/Feed.php @@ -16,26 +16,16 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ */ - + /** - * @namespace - */ -namespace Zend\Feed\Writer\Extension\ITunes; -use Zend\URI; - -/** - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Writer\Writer - * @uses \Zend\Feed\Writer\Exception\InvalidMethodException - * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed +class Zend_Feed_Writer_Extension_ITunes_Feed { /** * Array of Feed data for rendering by Extension's renderers @@ -55,7 +45,7 @@ class Feed * Set feed encoding * * @param string $enc - * @return \Zend\Feed\Writer\Extension\ITunes\Feed + * @return Zend_Feed_Writer_Extension_ITunes_Feed */ public function setEncoding($enc) { @@ -77,16 +67,18 @@ public function getEncoding() * Set a block value of "yes" or "no". You may also set an empty string. * * @param string - * @return \Zend\Feed\Writer\Extension\ITunes\Feed + * @return Zend_Feed_Writer_Extension_ITunes_Feed */ public function setItunesBlock($value) { if (!ctype_alpha($value) && strlen($value) > 0) { - throw new \Zend\Feed\Exception('invalid parameter: "block" may only' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "block" may only' . ' contain alphabetic characters'); } if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new \Zend\Feed\Exception('invalid parameter: "block" may only' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "block" may only' . ' contain a maximum of 255 characters'); } $this->_data['block'] = $value; @@ -97,7 +89,7 @@ public function setItunesBlock($value) * Add feed authors * * @param array $values - * @return \Zend\Feed\Writer\Extension\ITunes\Feed + * @return Zend_Feed_Writer_Extension_ITunes_Feed */ public function addItunesAuthors(array $values) { @@ -111,12 +103,13 @@ public function addItunesAuthors(array $values) * Add feed author * * @param string $value - * @return \Zend\Feed\Writer\Extension\ITunes\Feed + * @return Zend_Feed_Writer_Extension_ITunes_Feed */ public function addItunesAuthor($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new \Zend\Feed\Exception('invalid parameter: any "author" may only' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: any "author" may only' . ' contain a maximum of 255 characters each'); } if (!isset($this->_data['authors'])) { @@ -130,7 +123,7 @@ public function addItunesAuthor($value) * Set feed categories * * @param array $values - * @return \Zend\Feed\Writer\Extension\ITunes\Feed + * @return Zend_Feed_Writer_Extension_ITunes_Feed */ public function setItunesCategories(array $values) { @@ -140,19 +133,22 @@ public function setItunesCategories(array $values) foreach ($values as $key=>$value) { if (!is_array($value)) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new \Zend\Feed\Exception('invalid parameter: any "category" may only' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: any "category" may only' . ' contain a maximum of 255 characters each'); } $this->_data['categories'][] = $value; } else { if (iconv_strlen($key, $this->getEncoding()) > 255) { - throw new \Zend\Feed\Exception('invalid parameter: any "category" may only' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: any "category" may only' . ' contain a maximum of 255 characters each'); } $this->_data['categories'][$key] = array(); foreach ($value as $val) { if (iconv_strlen($val, $this->getEncoding()) > 255) { - throw new \Zend\Feed\Exception('invalid parameter: any "category" may only' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: any "category" may only' . ' contain a maximum of 255 characters each'); } $this->_data['categories'][$key][] = $val; @@ -166,18 +162,20 @@ public function setItunesCategories(array $values) * Set feed image (icon) * * @param string $value - * @return \Zend\Feed\Writer\Extension\ITunes\Feed + * @return Zend_Feed_Writer_Extension_ITunes_Feed */ public function setItunesImage($value) { - if (!\Zend\URI\URL::validate($value)) { - throw new \Zend\Feed\Exception('invalid parameter: "image" may only' - . ' be a valid URI/IRI'); + if (!Zend_Uri::check($value)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "image" may only' + . ' be a valid URI/IRI'); } if (!in_array(substr($value, -3), array('jpg','png'))) { - throw new \Zend\Feed\Exception('invalid parameter: "image" may only' - . ' use file extension "jpg" or "png" which must be the last three' - . ' characters of the URI (i.e. no query string or fragment)'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "image" may only' + . ' use file extension "jpg" or "png" which must be the last three' + . ' characters of the URI (i.e. no query string or fragment)'); } $this->_data['image'] = $value; return $this; @@ -187,17 +185,18 @@ public function setItunesImage($value) * Set feed cumulative duration * * @param string $value - * @return \Zend\Feed\Writer\Extension\ITunes\Feed + * @return Zend_Feed_Writer_Extension_ITunes_Feed */ public function setItunesDuration($value) { $value = (string) $value; if (!ctype_digit($value) - && !preg_match('/^\d+:[0-5]{1}[0-9]{1}$/', $value) - && !preg_match('/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/', $value) + && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) + && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value) ) { - throw new \Zend\Feed\Exception('invalid parameter: "duration" may only' - . ' be of a specified [[HH:]MM:]SS format'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "duration" may only' + . ' be of a specified [[HH:]MM:]SS format'); } $this->_data['duration'] = $value; return $this; @@ -207,13 +206,14 @@ public function setItunesDuration($value) * Set "explicit" flag * * @param bool $value - * @return \Zend\Feed\Writer\Extension\ITunes\Feed + * @return Zend_Feed_Writer_Extension_ITunes_Feed */ public function setItunesExplicit($value) { if (!in_array($value, array('yes','no','clean'))) { - throw new \Zend\Feed\Exception('invalid parameter: "explicit" may only' - . ' be one of "yes", "no" or "clean"'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "explicit" may only' + . ' be one of "yes", "no" or "clean"'); } $this->_data['explicit'] = $value; return $this; @@ -223,19 +223,21 @@ public function setItunesExplicit($value) * Set feed keywords * * @param array $value - * @return \Zend\Feed\Writer\Extension\ITunes\Feed + * @return Zend_Feed_Writer_Extension_ITunes_Feed */ public function setItunesKeywords(array $value) { if (count($value) > 12) { - throw new \Zend\Feed\Exception('invalid parameter: "keywords" may only' - . ' contain a maximum of 12 terms'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' + . ' contain a maximum of 12 terms'); } $concat = implode(',', $value); if (iconv_strlen($concat, $this->getEncoding()) > 255) { - throw new \Zend\Feed\Exception('invalid parameter: "keywords" may only' - . ' have a concatenated length of 255 chars where terms are delimited' - . ' by a comma'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' + . ' have a concatenated length of 255 chars where terms are delimited' + . ' by a comma'); } $this->_data['keywords'] = $value; return $this; @@ -245,13 +247,14 @@ public function setItunesKeywords(array $value) * Set new feed URL * * @param string $value - * @return \Zend\Feed\Writer\Extension\ITunes\Feed + * @return Zend_Feed_Writer_Extension_ITunes_Feed */ public function setItunesNewFeedUrl($value) { - if (!\Zend\URI\URL::validate($value)) { - throw new \Zend\Feed\Exception('invalid parameter: "newFeedUrl" may only' - . ' be a valid URI/IRI'); + if (!Zend_Uri::check($value)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "newFeedUrl" may only' + . ' be a valid URI/IRI'); } $this->_data['newFeedUrl'] = $value; return $this; @@ -261,7 +264,7 @@ public function setItunesNewFeedUrl($value) * Add feed owners * * @param array $values - * @return \Zend\Feed\Writer\Extension\ITunes\Feed + * @return Zend_Feed_Writer_Extension_ITunes_Feed */ public function addItunesOwners(array $values) { @@ -275,19 +278,21 @@ public function addItunesOwners(array $values) * Add feed owner * * @param string $value - * @return \Zend\Feed\Writer\Extension\ITunes\Feed + * @return Zend_Feed_Writer_Extension_ITunes_Feed */ public function addItunesOwner(array $value) { if (!isset($value['name']) || !isset($value['email'])) { - throw new \Zend\Feed\Exception('invalid parameter: any "owner" must' - . ' be an array containing keys "name" and "email"'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: any "owner" must' + . ' be an array containing keys "name" and "email"'); } if (iconv_strlen($value['name'], $this->getEncoding()) > 255 || iconv_strlen($value['email'], $this->getEncoding()) > 255 ) { - throw new \Zend\Feed\Exception('invalid parameter: any "owner" may only' - . ' contain a maximum of 255 characters each for "name" and "email"'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: any "owner" may only' + . ' contain a maximum of 255 characters each for "name" and "email"'); } if (!isset($this->_data['owners'])) { $this->_data['owners'] = array(); @@ -300,13 +305,14 @@ public function addItunesOwner(array $value) * Set feed subtitle * * @param string $value - * @return \Zend\Feed\Writer\Extension\ITunes\Feed + * @return Zend_Feed_Writer_Extension_ITunes_Feed */ public function setItunesSubtitle($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new \Zend\Feed\Exception('invalid parameter: "subtitle" may only' - . ' contain a maximum of 255 characters'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "subtitle" may only' + . ' contain a maximum of 255 characters'); } $this->_data['subtitle'] = $value; return $this; @@ -316,13 +322,14 @@ public function setItunesSubtitle($value) * Set feed summary * * @param string $value - * @return \Zend\Feed\Writer\Extension\ITunes\Feed + * @return Zend_Feed_Writer_Extension_ITunes_Feed */ public function setItunesSummary($value) { if (iconv_strlen($value, $this->getEncoding()) > 4000) { - throw new \Zend\Feed\Exception('invalid parameter: "summary" may only' - . ' contain a maximum of 4000 characters'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('invalid parameter: "summary" may only' + . ' contain a maximum of 4000 characters'); } $this->_data['summary'] = $value; return $this; @@ -337,11 +344,12 @@ public function setItunesSummary($value) */ public function __call($method, array $params) { - $point = \Zend\Feed\Writer\Writer::lcfirst(substr($method, 9)); + $point = Zend_Feed_Writer::lcfirst(substr($method, 9)); if (!method_exists($this, 'setItunes' . ucfirst($point)) && !method_exists($this, 'addItunes' . ucfirst($point)) ) { - throw new \Zend\Feed\Writer\Exception\InvalidMethodException( + require_once 'Zend/Feed/Writer/Exception/InvalidMethodException.php'; + throw new Zend_Feed_Writer_Exception_InvalidMethodException( 'invalid method: ' . $method ); } diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php index 2fd19e79..56a635e9 100644 --- a/src/Writer/Extension/ITunes/Renderer/Entry.php +++ b/src/Writer/Extension/ITunes/Renderer/Entry.php @@ -16,23 +16,22 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Entry.php 20325 2010-01-16 00:17:59Z padraic $ */ - + /** - * @namespace + * @see Zend_Feed_Writer_Extension_RendererAbstract */ -namespace Zend\Feed\Writer\Extension\ITunes\Renderer; - +require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; + /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Zend_Feed_Writer_Extension_ITunes_Renderer_Entry + extends Zend_Feed_Writer_Extension_RendererAbstract { /** * Set to TRUE if a rendering method actually renders something. This @@ -80,7 +79,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->getDataContainer()->getItunesAuthors(); if (!$authors || empty($authors)) { @@ -102,7 +101,7 @@ protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setBlock(\DOMDocument $dom, \DOMElement $root) + protected function _setBlock(DOMDocument $dom, DOMElement $root) { $block = $this->getDataContainer()->getItunesBlock(); if (is_null($block)) { @@ -122,7 +121,7 @@ protected function _setBlock(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDuration(\DOMDocument $dom, \DOMElement $root) + protected function _setDuration(DOMDocument $dom, DOMElement $root) { $duration = $this->getDataContainer()->getItunesDuration(); if (!$duration) { @@ -142,7 +141,7 @@ protected function _setDuration(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setExplicit(\DOMDocument $dom, \DOMElement $root) + protected function _setExplicit(DOMDocument $dom, DOMElement $root) { $explicit = $this->getDataContainer()->getItunesExplicit(); if (is_null($explicit)) { @@ -162,7 +161,7 @@ protected function _setExplicit(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setKeywords(\DOMDocument $dom, \DOMElement $root) + protected function _setKeywords(DOMDocument $dom, DOMElement $root) { $keywords = $this->getDataContainer()->getItunesKeywords(); if (!$keywords || empty($keywords)) { @@ -182,7 +181,7 @@ protected function _setKeywords(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setSubtitle(\DOMDocument $dom, \DOMElement $root) + protected function _setSubtitle(DOMDocument $dom, DOMElement $root) { $subtitle = $this->getDataContainer()->getItunesSubtitle(); if (!$subtitle) { @@ -202,7 +201,7 @@ protected function _setSubtitle(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setSummary(\DOMDocument $dom, \DOMElement $root) + protected function _setSummary(DOMDocument $dom, DOMElement $root) { $summary = $this->getDataContainer()->getItunesSummary(); if (!$summary) { diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php index 9173dfb2..e8054d24 100644 --- a/src/Writer/Extension/ITunes/Renderer/Feed.php +++ b/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -16,23 +16,22 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Feed.php 20325 2010-01-16 00:17:59Z padraic $ */ - + /** - * @namespace + * @see Zend_Feed_Writer_Extension_RendererAbstract */ -namespace Zend\Feed\Writer\Extension\ITunes\Renderer; - +require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; + /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Zend_Feed_Writer_Extension_ITunes_Renderer_Feed + extends Zend_Feed_Writer_Extension_RendererAbstract { /** @@ -85,7 +84,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->getDataContainer()->getItunesAuthors(); if (!$authors || empty($authors)) { @@ -107,7 +106,7 @@ protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setBlock(\DOMDocument $dom, \DOMElement $root) + protected function _setBlock(DOMDocument $dom, DOMElement $root) { $block = $this->getDataContainer()->getItunesBlock(); if (is_null($block)) { @@ -127,7 +126,7 @@ protected function _setBlock(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCategories(\DOMDocument $dom, \DOMElement $root) + protected function _setCategories(DOMDocument $dom, DOMElement $root) { $cats = $this->getDataContainer()->getItunesCategories(); if (!$cats || empty($cats)) { @@ -159,7 +158,7 @@ protected function _setCategories(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setImage(\DOMDocument $dom, \DOMElement $root) + protected function _setImage(DOMDocument $dom, DOMElement $root) { $image = $this->getDataContainer()->getItunesImage(); if (!$image) { @@ -178,7 +177,7 @@ protected function _setImage(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDuration(\DOMDocument $dom, \DOMElement $root) + protected function _setDuration(DOMDocument $dom, DOMElement $root) { $duration = $this->getDataContainer()->getItunesDuration(); if (!$duration) { @@ -198,7 +197,7 @@ protected function _setDuration(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setExplicit(\DOMDocument $dom, \DOMElement $root) + protected function _setExplicit(DOMDocument $dom, DOMElement $root) { $explicit = $this->getDataContainer()->getItunesExplicit(); if (is_null($explicit)) { @@ -218,7 +217,7 @@ protected function _setExplicit(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setKeywords(\DOMDocument $dom, \DOMElement $root) + protected function _setKeywords(DOMDocument $dom, DOMElement $root) { $keywords = $this->getDataContainer()->getItunesKeywords(); if (!$keywords || empty($keywords)) { @@ -238,7 +237,7 @@ protected function _setKeywords(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setNewFeedUrl(\DOMDocument $dom, \DOMElement $root) + protected function _setNewFeedUrl(DOMDocument $dom, DOMElement $root) { $url = $this->getDataContainer()->getItunesNewFeedUrl(); if (!$url) { @@ -258,7 +257,7 @@ protected function _setNewFeedUrl(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setOwners(\DOMDocument $dom, \DOMElement $root) + protected function _setOwners(DOMDocument $dom, DOMElement $root) { $owners = $this->getDataContainer()->getItunesOwners(); if (!$owners || empty($owners)) { @@ -286,7 +285,7 @@ protected function _setOwners(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setSubtitle(\DOMDocument $dom, \DOMElement $root) + protected function _setSubtitle(DOMDocument $dom, DOMElement $root) { $subtitle = $this->getDataContainer()->getItunesSubtitle(); if (!$subtitle) { @@ -306,7 +305,7 @@ protected function _setSubtitle(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setSummary(\DOMDocument $dom, \DOMElement $root) + protected function _setSummary(DOMDocument $dom, DOMElement $root) { $summary = $this->getDataContainer()->getItunesSummary(); if (!$summary) { diff --git a/src/Writer/Extension/RendererAbstract.php b/src/Writer/Extension/RendererAbstract.php index 28a3fbe0..4bc43859 100644 --- a/src/Writer/Extension/RendererAbstract.php +++ b/src/Writer/Extension/RendererAbstract.php @@ -16,23 +16,22 @@ * @package Zend_Feed_Writer_Entry_Rss * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: RendererAbstract.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ - + /** - * @namespace + * @see Zend_Feed_Writer_Extension_RendererInterface */ -namespace Zend\Feed\Writer\Extension; - -/** - * @uses \Zend\Feed\Writer\Extension\RendererInterface +require_once 'Zend/Feed/Writer/Extension/RendererInterface.php'; + + /** * @category Zend * @package Zend_Feed_Writer_Entry_Rss * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class RendererAbstract - implements RendererInterface +abstract class Zend_Feed_Writer_Extension_RendererAbstract + implements Zend_Feed_Writer_Extension_RendererInterface { /** * @var DOMDocument @@ -86,7 +85,7 @@ public function __construct($container) * Set feed encoding * * @param string $enc - * @return \Zend\Feed\Writer\Extension\RendererAbstract + * @return Zend_Feed_Writer_Extension_RendererAbstract */ public function setEncoding($enc) { @@ -109,9 +108,9 @@ public function getEncoding() * * @param DOMDocument $dom * @param DOMElement $base - * @return \Zend\Feed\Writer\Extension\RendererAbstract + * @return Zend_Feed_Writer_Extension_RendererAbstract */ - public function setDomDocument(\DOMDocument $dom, \DOMElement $base) + public function setDomDocument(DOMDocument $dom, DOMElement $base) { $this->_dom = $dom; $this->_base = $base; @@ -132,7 +131,7 @@ public function getDataContainer() * Set feed type * * @param string $type - * @return \Zend\Feed\Writer\Extension\RendererAbstract + * @return Zend_Feed_Writer_Extension_RendererAbstract */ public function setType($type) { @@ -154,9 +153,9 @@ public function getType() * Set root element of document * * @param DOMElement $root - * @return \Zend\Feed\Writer\Extension\RendererAbstract + * @return Zend_Feed_Writer_Extension_RendererAbstract */ - public function setRootElement(\DOMElement $root) + public function setRootElement(DOMElement $root) { $this->_rootElement = $root; return $this; diff --git a/src/Writer/Extension/RendererInterface.php b/src/Writer/Extension/RendererInterface.php index 618da1ff..249e4888 100644 --- a/src/Writer/Extension/RendererInterface.php +++ b/src/Writer/Extension/RendererInterface.php @@ -16,21 +16,16 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: RendererInterface.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ -/** - * @namespace - */ -namespace Zend\Feed\Writer\Extension; - /** * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface RendererInterface +interface Zend_Feed_Writer_Extension_RendererInterface { /** * Constructor @@ -47,7 +42,7 @@ public function __construct($container); * @param DOMElement $base * @return void */ - public function setDomDocument(\DOMDocument $dom, \DOMElement $base); + public function setDomDocument(DOMDocument $dom, DOMElement $base); /** * Render diff --git a/src/Writer/Extension/Slash/Renderer/Entry.php b/src/Writer/Extension/Slash/Renderer/Entry.php index 914fdf13..f8c57f24 100644 --- a/src/Writer/Extension/Slash/Renderer/Entry.php +++ b/src/Writer/Extension/Slash/Renderer/Entry.php @@ -16,23 +16,22 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Entry.php 20325 2010-01-16 00:17:59Z padraic $ */ - + /** - * @namespace + * @see Zend_Feed_Writer_Extension_RendererAbstract */ -namespace Zend\Feed\Writer\Extension\Slash\Renderer; - +require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; + /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Zend_Feed_Writer_Extension_Slash_Renderer_Entry + extends Zend_Feed_Writer_Extension_RendererAbstract { /** @@ -78,7 +77,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setCommentCount(\DOMDocument $dom, \DOMElement $root) + protected function _setCommentCount(DOMDocument $dom, DOMElement $root) { $count = $this->getDataContainer()->getCommentCount(); if (!$count) { diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php index 1baf27d9..884f2d08 100644 --- a/src/Writer/Extension/Threading/Renderer/Entry.php +++ b/src/Writer/Extension/Threading/Renderer/Entry.php @@ -16,23 +16,22 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Entry.php 20325 2010-01-16 00:17:59Z padraic $ */ - + /** - * @namespace + * @see Zend_Feed_Writer_Extension_RendererAbstract */ -namespace Zend\Feed\Writer\Extension\Threading\Renderer; - +require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; + /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Zend_Feed_Writer_Extension_Threading_Renderer_Entry + extends Zend_Feed_Writer_Extension_RendererAbstract { /** @@ -80,7 +79,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setCommentLink(\DOMDocument $dom, \DOMElement $root) + protected function _setCommentLink(DOMDocument $dom, DOMElement $root) { $link = $this->getDataContainer()->getCommentLink(); if (!$link) { @@ -105,7 +104,7 @@ protected function _setCommentLink(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCommentFeedLinks(\DOMDocument $dom, \DOMElement $root) + protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) { $links = $this->getDataContainer()->getCommentFeedLinks(); if (!$links || empty($links)) { @@ -132,7 +131,7 @@ protected function _setCommentFeedLinks(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCommentCount(\DOMDocument $dom, \DOMElement $root) + protected function _setCommentCount(DOMDocument $dom, DOMElement $root) { $count = $this->getDataContainer()->getCommentCount(); if (is_null($count)) { diff --git a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php index a20baa80..6aec2d9b 100644 --- a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php +++ b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php @@ -16,23 +16,22 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Entry.php 20325 2010-01-16 00:17:59Z padraic $ */ - + /** - * @namespace + * @see Zend_Feed_Writer_Extension_RendererAbstract */ -namespace Zend\Feed\Writer\Extension\WellFormedWeb\Renderer; - +require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php'; + /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Zend_Feed_Writer_Extension_WellFormedWeb_Renderer_Entry + extends Zend_Feed_Writer_Extension_RendererAbstract { /** @@ -78,7 +77,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setCommentFeedLinks(\DOMDocument $dom, \DOMElement $root) + protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) { $links = $this->getDataContainer()->getCommentFeedLinks(); if (!$links || empty($links)) { diff --git a/src/Writer/Feed/Feed.php b/src/Writer/Feed.php similarity index 78% rename from src/Writer/Feed/Feed.php rename to src/Writer/Feed.php index c735147a..4dad11b5 100644 --- a/src/Writer/Feed/Feed.php +++ b/src/Writer/Feed.php @@ -16,37 +16,54 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Feed.php 20518 2010-01-22 14:00:30Z padraic $ */ /** - * @namespace + * @see Zend_Date */ -namespace Zend\Feed\Writer\Feed; -use Zend\Feed\Writer; -use Zend\Feed as ZendFeed; -use Zend\Date; +require_once 'Zend/Date.php'; + +/** + * @see Zend_Date + */ +require_once 'Zend/Uri.php'; + +/** + * @see Zend_Feed_Writer + */ +require_once 'Zend/Feed/Writer.php'; + +/** + * @see Zend_Feed_Writer_Entry + */ +require_once 'Zend/Feed/Writer/Entry.php'; + +/** + * @see Zend_Feed_Writer_Deleted + */ +require_once 'Zend/Feed/Writer/Deleted.php'; + +/** + * @see Zend_Feed_Writer_Renderer_Feed_Atom + */ +require_once 'Zend/Feed/Writer/Renderer/Feed/Atom.php'; + +/** + * @see Zend_Feed_Writer_Renderer_Feed_Rss + */ +require_once 'Zend/Feed/Writer/Renderer/Feed/Rss.php'; + +require_once 'Zend/Feed/Writer/Feed/FeedAbstract.php'; /** - * @uses Countable - * @uses Iterator - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Writer\Writer - * @uses \Zend\Feed\Writer\Deleted - * @uses \Zend\Feed\Writer\Entry - * @uses \Zend\Feed\Writer\Feed\FeedAbstract - * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Atom - * @uses \Zend\Feed\Writer\Renderer\Feed\RSS - * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed - extends FeedAbstract - implements \Iterator, \Countable +class Zend_Feed_Writer_Feed extends Zend_Feed_Writer_Feed_FeedAbstract +implements Iterator, Countable { /** @@ -68,11 +85,11 @@ class Feed * added to the current feed automatically, but is necessary to create a * container with some initial values preset based on the current feed data. * - * @return \Zend\Feed\Writer\Entry + * @return Zend_Feed_Writer_Entry */ public function createEntry() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; if ($this->getEncoding()) { $entry->setEncoding($this->getEncoding()); } @@ -84,9 +101,9 @@ public function createEntry() * Appends a Zend_Feed_Writer_Deleted object representing a new entry tombstone * to the feed data container's internal group of entries. * - * @param \Zend\Feed\Writer\Deleted $entry + * @param Zend_Feed_Writer_Deleted $entry */ - public function addTombstone(Writer\Deleted $deleted) + public function addTombstone(Zend_Feed_Writer_Deleted $deleted) { $this->_entries[] = $deleted; } @@ -96,11 +113,11 @@ public function addTombstone(Writer\Deleted $deleted) * added to the current feed automatically, but is necessary to create a * container with some initial values preset based on the current feed data. * - * @return \Zend\Feed\Writer\Deleted + * @return Zend_Feed_Writer_Deleted */ public function createTombstone() { - $deleted = new Writer\Deleted; + $deleted = new Zend_Feed_Writer_Deleted; if ($this->getEncoding()) { $deleted->setEncoding($this->getEncoding()); } @@ -112,9 +129,9 @@ public function createTombstone() * Appends a Zend_Feed_Writer_Entry object representing a new entry/item * the feed data container's internal group of entries. * - * @param \Zend\Feed\Writer\Entry $entry + * @param Zend_Feed_Writer_Entry $entry */ - public function addEntry(Writer\Entry $entry) + public function addEntry(Zend_Feed_Writer_Entry $entry) { $this->_entries[] = $entry; } @@ -130,7 +147,8 @@ public function removeEntry($index) if (isset($this->_entries[$index])) { unset($this->_entries[$index]); } - throw new ZendFeed\Exception('Undefined index: ' . $index . '. Entry does not exist.'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Undefined index: ' . $index . '. Entry does not exist.'); } /** @@ -144,7 +162,8 @@ public function getEntry($index = 0) if (isset($this->_entries[$index])) { return $this->_entries[$index]; } - throw new ZendFeed\Exception('Undefined index: ' . $index . '. Entry does not exist.'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Undefined index: ' . $index . '. Entry does not exist.'); } /** @@ -165,9 +184,9 @@ public function orderByDate() $entries = array(); foreach ($this->_entries as $entry) { if ($entry->getDateModified()) { - $timestamp = (int) $entry->getDateModified()->get(Date\Date::TIMESTAMP); + $timestamp = (int) $entry->getDateModified()->get(Zend_Date::TIMESTAMP); } elseif ($entry->getDateCreated()) { - $timestamp = (int) $entry->getDateCreated()->get(Date\Date::TIMESTAMP); + $timestamp = (int) $entry->getDateCreated()->get(Zend_Date::TIMESTAMP); } $entries[$timestamp] = $entry; } @@ -247,7 +266,8 @@ public function export($type, $ignoreExceptions = false) $this->setType(strtolower($type)); $type = ucfirst($this->getType()); if ($type !== 'Rss' && $type !== 'Atom') { - throw new ZendFeed\Exception('Invalid feed type specified: ' . $type . '.' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid feed type specified: ' . $type . '.' . ' Should be one of "rss" or "atom".'); } $renderClass = 'Zend_Feed_Writer_Renderer_Feed_' . $type; diff --git a/src/Writer/Feed/FeedAbstract.php b/src/Writer/Feed/FeedAbstract.php index d17cefe0..34df5c34 100644 --- a/src/Writer/Feed/FeedAbstract.php +++ b/src/Writer/Feed/FeedAbstract.php @@ -16,32 +16,46 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: FeedAbstract.php 22107 2010-05-05 13:42:20Z padraic $ */ /** - * @namespace + * @see Zend_Date */ -namespace Zend\Feed\Writer\Feed; -use Zend\Feed\Writer; -use Zend\Feed; -use Zend\URI; -use Zend\Date; +require_once 'Zend/Date.php'; + +/** + * @see Zend_Date + */ +require_once 'Zend/Uri.php'; + +/** + * @see Zend_Feed_Writer + */ +require_once 'Zend/Feed/Writer.php'; + +/** + * @see Zend_Feed_Writer_Entry + */ +require_once 'Zend/Feed/Writer/Entry.php'; + +/** + * @see Zend_Feed_Writer_Renderer_Feed_Atom + */ +require_once 'Zend/Feed/Writer/Renderer/Feed/Atom.php'; + +/** + * @see Zend_Feed_Writer_Renderer_Feed_Rss + */ +require_once 'Zend/Feed/Writer/Renderer/Feed/Rss.php'; /** - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Writer\Writer - * @uses \Zend\Feed\Writer\Entry - * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Atom - * @uses \Zend\Feed\Writer\Renderer\Feed\RSS - * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class FeedAbstract +class Zend_Feed_Writer_Feed_FeedAbstract { /** * Contains all Feed level date to append in feed output @@ -66,7 +80,7 @@ class FeedAbstract */ public function __construct() { - Writer\Writer::registerCoreExtensions(); + Zend_Feed_Writer::registerCoreExtensions(); $this->_loadExtensions(); } @@ -81,35 +95,41 @@ public function addAuthor($name, $email = null, $uri = null) $author = array(); if (is_array($name)) { if (!array_key_exists('name', $name) || empty($name['name']) || !is_string($name['name'])) { - throw new Feed\Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); } $author['name'] = $name['name']; if (isset($name['email'])) { if (empty($name['email']) || !is_string($name['email'])) { - throw new Feed\Exception('Invalid parameter: "email" array value must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); } $author['email'] = $name['email']; } if (isset($name['uri'])) { - if (empty($name['uri']) || !is_string($name['uri']) || !\Zend\URI\URL::validate($name['uri'])) { - throw new Feed\Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); + if (empty($name['uri']) || !is_string($name['uri']) || !Zend_Uri::check($name['uri'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $name['uri']; } } else { if (empty($name['name']) || !is_string($name['name'])) { - throw new Feed\Exception('Invalid parameter: "name" must be a non-empty string value'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string value'); } $author['name'] = $name; if (isset($email)) { if (empty($email) || !is_string($email)) { - throw new Feed\Exception('Invalid parameter: "email" value must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "email" value must be a non-empty string'); } $author['email'] = $email; } if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !\Zend\URI\URL::validate($uri)) { - throw new Feed\Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); + if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $uri; } @@ -137,7 +157,8 @@ public function addAuthors(array $authors) public function setCopyright($copyright) { if (empty($copyright) || !is_string($copyright)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['copyright'] = $copyright; } @@ -145,19 +166,20 @@ public function setCopyright($copyright) /** * Set the feed creation date * - * @param null|integer|\Zend\Date\Date + * @param null|integer|Zend_Date */ public function setDateCreated($date = null) { $zdate = null; if (is_null($date)) { - $zdate = new Date\Date; + $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { - $zdate = new Date\Date($date, Date\Date::TIMESTAMP); - } elseif ($date instanceof Date\Date) { + $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); + } elseif ($date instanceof Zend_Date) { $zdate = $date; } else { - throw new Feed\Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateCreated'] = $zdate; } @@ -165,23 +187,45 @@ public function setDateCreated($date = null) /** * Set the feed modification date * - * @param null|integer|\Zend\Date\Date + * @param null|integer|Zend_Date */ public function setDateModified($date = null) { $zdate = null; if (is_null($date)) { - $zdate = new Date\Date; + $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { - $zdate = new Date\Date($date, Date\Date::TIMESTAMP); - } elseif ($date instanceof Date\Date) { + $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); + } elseif ($date instanceof Zend_Date) { $zdate = $date; } else { - throw new Feed\Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateModified'] = $zdate; } + /** + * Set the feed last-build date. Ignored for Atom 1.0. + * + * @param null|integer|Zend_Date + */ + public function setLastBuildDate($date = null) + { + $zdate = null; + if (is_null($date)) { + $zdate = new Zend_Date; + } elseif (ctype_digit($date) && strlen($date) == 10) { + $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); + } elseif ($date instanceof Zend_Date) { + $zdate = $date; + } else { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + } + $this->_data['lastBuildDate'] = $zdate; + } + /** * Set the feed description * @@ -190,7 +234,8 @@ public function setDateModified($date = null) public function setDescription($description) { if (empty($description) || !is_string($description)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['description'] = $description; } @@ -202,21 +247,47 @@ public function setDescription($description) */ public function setGenerator($name, $version = null, $uri = null) { - if (empty($name) || !is_string($name)) { - throw new Feed\Exception('Invalid parameter: "name" must be a non-empty string'); - } - $generator = array('name' => $name); - if (isset($version)) { - if (empty($version) || !is_string($version)) { - throw new Feed\Exception('Invalid parameter: "version" must be a non-empty string'); + if (is_array($name)) { + $data = $name; + if (empty($data['name']) || !is_string($data['name'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string'); } - $generator['version'] = $version; - } - if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !\Zend\URI\URL::validate($uri)) { - throw new Feed\Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); + $generator = array('name' => $data['name']); + if (isset($data['version'])) { + if (empty($data['version']) || !is_string($data['version'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "version" must be a non-empty string'); + } + $generator['version'] = $data['version']; + } + if (isset($data['uri'])) { + if (empty($data['uri']) || !is_string($data['uri']) || !Zend_Uri::check($data['uri'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); + } + $generator['uri'] = $data['uri']; + } + } else { + if (empty($name) || !is_string($name)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string'); + } + $generator = array('name' => $name); + if (isset($version)) { + if (empty($version) || !is_string($version)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "version" must be a non-empty string'); + } + $generator['version'] = $version; + } + if (isset($uri)) { + if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); + } + $generator['uri'] = $uri; } - $generator['uri'] = $uri; } $this->_data['generator'] = $generator; } @@ -224,17 +295,37 @@ public function setGenerator($name, $version = null, $uri = null) /** * Set the feed ID - URI or URN (via PCRE pattern) supported * - * @return string|null + * @param string $id */ public function setId($id) { - if ((empty($id) || !is_string($id) || !\Zend\URI\URL::validate($id)) && - !preg_match('#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#', $id)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + if ((empty($id) || !is_string($id) || !Zend_Uri::check($id)) && + !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['id'] = $id; } + /** + * Set a feed image (URI at minimum). Parameter is a single array with the + * required key 'uri'. When rendering as RSS, the required keys are 'uri', + * 'title' and 'link'. RSS also specifies three optional parameters 'width', + * 'height' and 'description'. Only 'uri' is required and used for Atom rendering. + * + * @param array $data + */ + public function setImage(array $data) + { + if (empty($data['uri']) || !is_string($data['uri']) + || !Zend_Uri::check($data['uri'])) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter \'uri\'' + . ' must be a non-empty string and valid URI/IRI'); + } + $this->_data['image'] = $data; + } + /** * Set the feed language * @@ -243,7 +334,8 @@ public function setId($id) public function setLanguage($language) { if (empty($language) || !is_string($language)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['language'] = $language; } @@ -251,12 +343,13 @@ public function setLanguage($language) /** * Set a link to the HTML source * - * @return string|null + * @param string $link */ public function setLink($link) { - if (empty($link) || !is_string($link) || !\Zend\URI\URL::validate($link)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['link'] = $link; } @@ -268,11 +361,13 @@ public function setLink($link) */ public function setFeedLink($link, $type) { - if (empty($link) || !is_string($link) || !\Zend\URI\URL::validate($link)) { - throw new Feed\Exception('Invalid parameter: "link"" must be a non-empty string and valid URI/IRI'); + if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "link"" must be a non-empty string and valid URI/IRI'); } if (!in_array(strtolower($type), array('rss', 'rdf', 'atom'))) { - throw new Feed\Exception('Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom'); } $this->_data['feedLinks'][strtolower($type)] = $link; } @@ -285,7 +380,8 @@ public function setFeedLink($link, $type) public function setTitle($title) { if (empty($title) || !is_string($title)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['title'] = $title; } @@ -298,7 +394,8 @@ public function setTitle($title) public function setEncoding($encoding) { if (empty($encoding) || !is_string($encoding)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); } $this->_data['encoding'] = $encoding; } @@ -310,8 +407,9 @@ public function setEncoding($encoding) */ public function setBaseUrl($url) { - if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { - throw new Feed\Exception('Invalid parameter: "url" array value' + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "url" array value' . ' must be a non-empty string and valid URI/IRI'); } $this->_data['baseUrl'] = $url; @@ -324,8 +422,9 @@ public function setBaseUrl($url) */ public function addHub($url) { - if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { - throw new Feed\Exception('Invalid parameter: "url" array value' + if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: "url" array value' . ' must be a non-empty string and valid URI/IRI'); } if (!isset($this->_data['hubs'])) { @@ -354,16 +453,18 @@ public function addHubs(array $urls) public function addCategory(array $category) { if (!isset($category['term'])) { - throw new Feed\Exception('Each category must be an array and ' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Each category must be an array and ' . 'contain at least a "term" element containing the machine ' . ' readable category name'); } if (isset($category['scheme'])) { if (empty($category['scheme']) || !is_string($category['scheme']) - || !\Zend\URI\URL::validate($category['scheme']) + || !Zend_Uri::check($category['scheme']) ) { - throw new Feed\Exception('The Atom scheme or RSS domain of' + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('The Atom scheme or RSS domain of' . ' a category must be a valid URI'); } } @@ -452,6 +553,19 @@ public function getDateModified() return $this->_data['dateModified']; } + /** + * Get the feed last-build date + * + * @return string|null + */ + public function getLastBuildDate() + { + if (!array_key_exists('lastBuildDate', $this->_data)) { + return null; + } + return $this->_data['lastBuildDate']; + } + /** * Get the feed description * @@ -491,6 +605,19 @@ public function getId() return $this->_data['id']; } + /** + * Get the feed image URI + * + * @return array + */ + public function getImage() + { + if (!array_key_exists('image', $this->_data)) { + return null; + } + return $this->_data['image']; + } + /** * Get the feed language * @@ -645,17 +772,18 @@ public function remove($name) * @param string $method * @param array $args * @return mixed - * @throws \Zend\Feed\Exception if no extensions implements the method + * @throws Zend_Feed_Exception if no extensions implements the method */ public function __call($method, $args) { foreach ($this->_extensions as $extension) { try { return call_user_func_array(array($extension, $method), $args); - } catch (Feed\Writer\Exception\InvalidMethodException $e) { + } catch (Zend_Feed_Writer_Exception_InvalidMethodException $e) { } } - throw new Feed\Exception('Method: ' . $method + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Method: ' . $method . ' does not exist and could not be located on a registered Extension'); } @@ -666,10 +794,10 @@ public function __call($method, $args) */ protected function _loadExtensions() { - $all = Writer\Writer::getExtensions(); + $all = Zend_Feed_Writer::getExtensions(); $exts = $all['feed']; foreach ($exts as $ext) { - $className = Writer\Writer::getPluginLoader()->getClassName($ext); + $className = Zend_Feed_Writer::getPluginLoader()->getClassName($ext); $this->_extensions[$ext] = new $className(); $this->_extensions[$ext]->setEncoding($this->getEncoding()); } diff --git a/src/Writer/Renderer/Entry/Atom/Atom.php b/src/Writer/Renderer/Entry/Atom.php similarity index 75% rename from src/Writer/Renderer/Entry/Atom/Atom.php rename to src/Writer/Renderer/Entry/Atom.php index 24c1a383..6d35eb90 100644 --- a/src/Writer/Renderer/Entry/Atom/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -16,42 +16,33 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Atom.php 22064 2010-04-30 14:02:38Z padraic $ */ /** - * @namespace + * @see Zend_Feed_Writer_Renderer_RendererAbstract */ -namespace Zend\Feed\Writer\Renderer\Entry\Atom; -use Zend\Feed; -use Zend\Date; +require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php'; + +require_once 'Zend/Feed/Writer/Renderer/Feed/Atom/Source.php'; /** - * @uses DOMDocument - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Writer\Writer - * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Source - * @uses \Zend\Feed\Writer\Renderer\RendererAbstract - * @uses \Zend\Feed\Writer\Renderer\RendererInterface - * @uses \Zend\Uri\Uri - * @uses tidy * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Atom - extends Feed\Writer\Renderer\RendererAbstract - implements Feed\Writer\Renderer\RendererInterface +class Zend_Feed_Writer_Renderer_Entry_Atom + extends Zend_Feed_Writer_Renderer_RendererAbstract + implements Zend_Feed_Writer_Renderer_RendererInterface { /** * Constructor * - * @param \Zend\Feed\Writer\Entry $container + * @param Zend_Feed_Writer_Entry $container * @return void */ - public function __construct (Feed\Writer\Entry $container) + public function __construct (Zend_Feed_Writer_Entry $container) { parent::__construct($container); } @@ -59,13 +50,13 @@ public function __construct (Feed\Writer\Entry $container) /** * Render atom entry * - * @return \Zend\Feed\Writer\Renderer\Entry\Atom\Atom + * @return Zend_Feed_Writer_Renderer_Entry_Atom */ public function render() { - $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; - $entry = $this->_dom->createElementNS(Feed\Writer\Writer::NAMESPACE_ATOM_10, 'entry'); + $entry = $this->_dom->createElementNS(Zend_Feed_Writer::NAMESPACE_ATOM_10, 'entry'); $this->_dom->appendChild($entry); $this->_setSource($this->_dom, $entry); @@ -97,12 +88,13 @@ public function render() * @param DOMElement $root * @return void */ - protected function _setTitle(\DOMDocument $dom, \DOMElement $root) + protected function _setTitle(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getTitle()) { + require_once 'Zend/Feed/Exception.php'; $message = 'Atom 1.0 entry elements MUST contain exactly one' - . ' atom:title element but a title has not been set'; - $exception = new Feed\Exception($message); + . ' atom:title element but a title has not been set'; + $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -124,7 +116,7 @@ protected function _setTitle(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDescription(\DOMDocument $dom, \DOMElement $root) + protected function _setDescription(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDescription()) { return; // unless src content or base64 @@ -145,12 +137,13 @@ protected function _setDescription(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) + protected function _setDateModified(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateModified()) { + require_once 'Zend/Feed/Exception.php'; $message = 'Atom 1.0 entry elements MUST contain exactly one' - . ' atom:updated element but a modification date has not been set'; - $exception = new Feed\Exception($message); + . ' atom:updated element but a modification date has not been set'; + $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -162,7 +155,7 @@ protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) $updated = $dom->createElement('updated'); $root->appendChild($updated); $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(Date\Date::ISO_8601) + $this->getDataContainer()->getDateModified()->get(Zend_Date::ISO_8601) ); $updated->appendChild($text); } @@ -174,7 +167,7 @@ protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) + protected function _setDateCreated(DOMDocument $dom, DOMElement $root) { if (!$this->getDataContainer()->getDateCreated()) { return; @@ -182,7 +175,7 @@ protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) $el = $dom->createElement('published'); $root->appendChild($el); $text = $dom->createTextNode( - $this->getDataContainer()->getDateCreated()->get(Date\Date::ISO_8601) + $this->getDataContainer()->getDateCreated()->get(Zend_Date::ISO_8601) ); $el->appendChild($text); } @@ -194,7 +187,7 @@ protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->_container->getAuthors(); if ((!$authors || empty($authors))) { @@ -233,7 +226,7 @@ protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setEnclosure(\DOMDocument $dom, \DOMElement $root) + protected function _setEnclosure(DOMDocument $dom, DOMElement $root) { $data = $this->_container->getEnclosure(); if ((!$data || empty($data))) { @@ -241,13 +234,17 @@ protected function _setEnclosure(\DOMDocument $dom, \DOMElement $root) } $enclosure = $this->_dom->createElement('link'); $enclosure->setAttribute('rel', 'enclosure'); - $enclosure->setAttribute('type', $data['type']); - $enclosure->setAttribute('length', $data['length']); + if (isset($data['type'])) { + $enclosure->setAttribute('type', $data['type']); + } + if (isset($data['length'])) { + $enclosure->setAttribute('length', $data['length']); + } $enclosure->setAttribute('href', $data['uri']); $root->appendChild($enclosure); } - protected function _setLink(\DOMDocument $dom, \DOMElement $root) + protected function _setLink(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getLink()) { return; @@ -266,15 +263,16 @@ protected function _setLink(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setId(\DOMDocument $dom, \DOMElement $root) + protected function _setId(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getId() && !$this->getDataContainer()->getLink()) { + require_once 'Zend/Feed/Exception.php'; $message = 'Atom 1.0 entry elements MUST contain exactly one ' - . 'atom:id element, or as an alternative, we can use the same ' - . 'value as atom:link however neither a suitable link nor an ' - . 'id have been set'; - $exception = new Feed\Exception($message); + . 'atom:id element, or as an alternative, we can use the same ' + . 'value as atom:link however neither a suitable link nor an ' + . 'id have been set'; + $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -287,9 +285,10 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) $this->getDataContainer()->setId( $this->getDataContainer()->getLink()); } - if (!\Zend\URI\URL::validate($this->getDataContainer()->getId()) && - !preg_match('#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#', $this->getDataContainer()->getId())) { - throw new Feed\Exception('Atom 1.0 IDs must be a valid URI/IRI'); + if (!Zend_Uri::check($this->getDataContainer()->getId()) && + !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $this->getDataContainer()->getId())) { + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Atom 1.0 IDs must be a valid URI/IRI'); } $id = $dom->createElement('id'); $root->appendChild($id); @@ -304,15 +303,16 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setContent(\DOMDocument $dom, \DOMElement $root) + protected function _setContent(DOMDocument $dom, DOMElement $root) { $content = $this->getDataContainer()->getContent(); if (!$content && !$this->getDataContainer()->getLink()) { + require_once 'Zend/Feed/Exception.php'; $message = 'Atom 1.0 entry elements MUST contain exactly one ' - . 'atom:content element, or as an alternative, at least one link ' - . 'with a rel attribute of "alternate" to indicate an alternate ' - . 'method to consume the content.'; - $exception = new Feed\Exception($message); + . 'atom:content element, or as an alternative, at least one link ' + . 'with a rel attribute of "alternate" to indicate an alternate ' + . 'method to consume the content.'; + $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -338,10 +338,11 @@ protected function _loadXhtml($content) { $xhtml = ''; if (class_exists('tidy', false)) { - $tidy = new \tidy; + $tidy = new tidy; $config = array( 'output-xhtml' => true, - 'show-body-only' => true + 'show-body-only' => true, + 'quote-nbsp' => false ); $encoding = str_replace('-', '', $this->getEncoding()); $tidy->parseString($content, $config, $encoding); @@ -353,7 +354,7 @@ protected function _loadXhtml($content) $xhtml = preg_replace(array( "/(<[\/]?)([a-zA-Z]+)/" ), '$1xhtml:$2', $xhtml); - $dom = new \DOMDocument('1.0', $this->getEncoding()); + $dom = new DOMDocument('1.0', $this->getEncoding()); $dom->loadXML('' . $xhtml . ''); return $dom->documentElement; @@ -366,7 +367,7 @@ protected function _loadXhtml($content) * @param DOMElement $root * @return void */ - protected function _setCategories(\DOMDocument $dom, \DOMElement $root) + protected function _setCategories(DOMDocument $dom, DOMElement $root) { $categories = $this->getDataContainer()->getCategories(); if (!$categories) { @@ -394,13 +395,13 @@ protected function _setCategories(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setSource(\DOMDocument $dom, \DOMElement $root) + protected function _setSource(DOMDocument $dom, DOMElement $root) { $source = $this->getDataContainer()->getSource(); if (!$source) { return; } - $renderer = new Feed\Writer\Renderer\Feed\Atom\Source($source); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom_Source($source); $renderer->setType($this->getType()); $element = $renderer->render()->getElement(); $imported = $dom->importNode($element, true); diff --git a/src/Writer/Renderer/Entry/Atom/Deleted.php b/src/Writer/Renderer/Entry/Atom/Deleted.php index e76fc221..23dd4dd2 100644 --- a/src/Writer/Renderer/Entry/Atom/Deleted.php +++ b/src/Writer/Renderer/Entry/Atom/Deleted.php @@ -16,35 +16,31 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Deleted.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ /** - * @namespace + * @see Zend_Feed_Writer_Renderer_RendererAbstract */ -namespace Zend\Feed\Writer\Renderer\Entry\Atom; +require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php'; /** - * @uses DOMDocument - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Writer\Renderer\RendererAbstract - * @uses \Zend\Feed\Writer\Renderer\RendererInterface * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Deleted - extends \Zend\Feed\Writer\Renderer\RendererAbstract - implements \Zend\Feed\Writer\Renderer\RendererInterface +class Zend_Feed_Writer_Renderer_Entry_Atom_Deleted + extends Zend_Feed_Writer_Renderer_RendererAbstract + implements Zend_Feed_Writer_Renderer_RendererInterface { /** * Constructor * - * @param \Zend\Feed\Writer\Deleted $container + * @param Zend_Feed_Writer_Deleted $container * @return void */ - public function __construct (\Zend\Feed\Writer\Deleted $container) + public function __construct (Zend_Feed_Writer_Deleted $container) { parent::__construct($container); } @@ -52,17 +48,17 @@ public function __construct (\Zend\Feed\Writer\Deleted $container) /** * Render atom entry * - * @return \Zend\Feed\Writer\Renderer\Entry\Atom\Atom + * @return Zend_Feed_Writer_Renderer_Entry_Atom */ public function render() { - $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; $entry = $this->_dom->createElement('at:deleted-entry'); $this->_dom->appendChild($entry); $entry->setAttribute('ref', $this->_container->getReference()); - $entry->setAttribute('when', $this->_container->getWhen()->get(\Zend\Date\Date::ISO_8601)); + $entry->setAttribute('when', $this->_container->getWhen()->get(Zend_Date::ISO_8601)); $this->_setBy($this->_dom, $entry); $this->_setComment($this->_dom, $entry); @@ -77,7 +73,7 @@ public function render() * @param DOMElement $root * @return void */ - protected function _setComment(\DOMDocument $dom, \DOMElement $root) + protected function _setComment(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getComment()) { return; @@ -96,7 +92,7 @@ protected function _setComment(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setBy(\DOMDocument $dom, \DOMElement $root) + protected function _setBy(DOMDocument $dom, DOMElement $root) { $data = $this->_container->getBy(); if ((!$data || empty($data))) { diff --git a/src/Writer/Renderer/Entry/RSS.php b/src/Writer/Renderer/Entry/RSS.php deleted file mode 100644 index 3de04058..00000000 --- a/src/Writer/Renderer/Entry/RSS.php +++ /dev/null @@ -1,319 +0,0 @@ -_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); - $this->_dom->formatOutput = true; - $this->_dom->substituteEntities = false; - $entry = $this->_dom->createElement('item'); - $this->_dom->appendChild($entry); - - $this->_setTitle($this->_dom, $entry); - $this->_setDescription($this->_dom, $entry); - $this->_setDateCreated($this->_dom, $entry); - $this->_setDateModified($this->_dom, $entry); - $this->_setLink($this->_dom, $entry); - $this->_setId($this->_dom, $entry); - $this->_setAuthors($this->_dom, $entry); - $this->_setEnclosure($this->_dom, $entry); - $this->_setCommentLink($this->_dom, $entry); - $this->_setCategories($this->_dom, $entry); - foreach ($this->_extensions as $ext) { - $ext->setType($this->getType()); - $ext->setRootElement($this->getRootElement()); - $ext->setDomDocument($this->getDomDocument(), $entry); - $ext->render(); - } - - return $this; - } - - /** - * Set entry title - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setTitle(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getDescription() - && !$this->getDataContainer()->getTitle()) { - $message = 'RSS 2.0 entry elements SHOULD contain exactly one' - . ' title element but a title has not been set. In addition, there' - . ' is no description as required in the absence of a title.'; - $exception = new Feed\Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $title = $dom->createElement('title'); - $root->appendChild($title); - $text = $dom->createTextNode($this->getDataContainer()->getTitle()); - $title->appendChild($text); - } - - /** - * Set entry description - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDescription(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getDescription() - && !$this->getDataContainer()->getTitle()) { - $message = 'RSS 2.0 entry elements SHOULD contain exactly one' - . ' description element but a description has not been set. In' - . ' addition, there is no title element as required in the absence' - . ' of a description.'; - $exception = new Feed\Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - if (!$this->getDataContainer()->getDescription()) { - return; - } - $subtitle = $dom->createElement('description'); - $root->appendChild($subtitle); - $text = $dom->createCDATASection($this->getDataContainer()->getDescription()); - $subtitle->appendChild($text); - } - - /** - * Set date entry was last modified - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getDateModified()) { - return; - } - - $updated = $dom->createElement('pubDate'); - $root->appendChild($updated); - $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(\Zend\Date\Date::RSS) - ); - $updated->appendChild($text); - } - - /** - * Set date entry was created - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) - { - if (!$this->getDataContainer()->getDateCreated()) { - return; - } - if (!$this->getDataContainer()->getDateModified()) { - $this->getDataContainer()->setDateModified( - $this->getDataContainer()->getDateCreated() - ); - } - } - - /** - * Set entry authors - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) - { - $authors = $this->_container->getAuthors(); - if ((!$authors || empty($authors))) { - return; - } - foreach ($authors as $data) { - $author = $this->_dom->createElement('author'); - $name = $data['name']; - if (array_key_exists('email', $data)) { - $name = $data['email'] . ' (' . $data['name'] . ')'; - } - $text = $dom->createTextNode($name); - $author->appendChild($text); - $root->appendChild($author); - } - } - - /** - * Set entry enclosure - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setEnclosure(\DOMDocument $dom, \DOMElement $root) - { - $data = $this->_container->getEnclosure(); - if ((!$data || empty($data))) { - return; - } - $enclosure = $this->_dom->createElement('enclosure'); - $enclosure->setAttribute('type', $data['type']); - $enclosure->setAttribute('length', $data['length']); - $enclosure->setAttribute('url', $data['uri']); - $root->appendChild($enclosure); - } - - /** - * Set link to entry - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setLink(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getLink()) { - return; - } - $link = $dom->createElement('link'); - $root->appendChild($link); - $text = $dom->createTextNode($this->getDataContainer()->getLink()); - $link->appendChild($text); - } - - /** - * Set entry identifier - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setId(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getId() - && !$this->getDataContainer()->getLink()) { - return; - } - - $id = $dom->createElement('guid'); - $root->appendChild($id); - if (!$this->getDataContainer()->getId()) { - $this->getDataContainer()->setId( - $this->getDataContainer()->getLink()); - } - $text = $dom->createTextNode($this->getDataContainer()->getId()); - $id->appendChild($text); - if (!\Zend\URI\URL::validate($this->getDataContainer()->getId())) { - $id->setAttribute('isPermaLink', 'false'); - } - } - - /** - * Set link to entry comments - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCommentLink(\DOMDocument $dom, \DOMElement $root) - { - $link = $this->getDataContainer()->getCommentLink(); - if (!$link) { - return; - } - $clink = $this->_dom->createElement('comments'); - $text = $dom->createTextNode($link); - $clink->appendChild($text); - $root->appendChild($clink); - } - - /** - * Set entry categories - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCategories(\DOMDocument $dom, \DOMElement $root) - { - $categories = $this->getDataContainer()->getCategories(); - if (!$categories) { - return; - } - foreach ($categories as $cat) { - $category = $dom->createElement('category'); - if (isset($cat['scheme'])) { - $category->setAttribute('domain', $cat['scheme']); - } - $text = $dom->createCDATASection($cat['term']); - $category->appendChild($text); - $root->appendChild($category); - } - } -} diff --git a/src/Writer/Renderer/Entry/Rss.php b/src/Writer/Renderer/Entry/Rss.php index 3de04058..ce7aaebb 100644 --- a/src/Writer/Renderer/Entry/Rss.php +++ b/src/Writer/Renderer/Entry/Rss.php @@ -16,37 +16,31 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Rss.php 22064 2010-04-30 14:02:38Z padraic $ */ /** - * @namespace + * @see Zend_Feed_Writer_Renderer_RendererAbstract */ -namespace Zend\Feed\Writer\Renderer\Entry; -use Zend\Feed; +require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php'; /** - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Writer\Renderer\RendererAbstract - * @uses \Zend\Feed\Writer\Renderer\RendererInterface - * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class RSS - extends Feed\Writer\Renderer\RendererAbstract - implements Feed\Writer\Renderer\RendererInterface +class Zend_Feed_Writer_Renderer_Entry_Rss + extends Zend_Feed_Writer_Renderer_RendererAbstract + implements Zend_Feed_Writer_Renderer_RendererInterface { /** * Constructor * - * @param \Zend\Feed\Writer\Entry $container + * @param Zend_Feed_Writer_Entry $container * @return void */ - public function __construct (Feed\Writer\Entry $container) + public function __construct (Zend_Feed_Writer_Entry $container) { parent::__construct($container); } @@ -54,11 +48,11 @@ public function __construct (Feed\Writer\Entry $container) /** * Render RSS entry * - * @return \Zend\Feed\Writer\Renderer\Entry\RSS + * @return Zend_Feed_Writer_Renderer_Entry_Rss */ public function render() { - $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; $this->_dom->substituteEntities = false; $entry = $this->_dom->createElement('item'); @@ -91,14 +85,15 @@ public function render() * @param DOMElement $root * @return void */ - protected function _setTitle(\DOMDocument $dom, \DOMElement $root) + protected function _setTitle(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDescription() && !$this->getDataContainer()->getTitle()) { + require_once 'Zend/Feed/Exception.php'; $message = 'RSS 2.0 entry elements SHOULD contain exactly one' - . ' title element but a title has not been set. In addition, there' - . ' is no description as required in the absence of a title.'; - $exception = new Feed\Exception($message); + . ' title element but a title has not been set. In addition, there' + . ' is no description as required in the absence of a title.'; + $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -119,15 +114,16 @@ protected function _setTitle(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDescription(\DOMDocument $dom, \DOMElement $root) + protected function _setDescription(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDescription() && !$this->getDataContainer()->getTitle()) { + require_once 'Zend/Feed/Exception.php'; $message = 'RSS 2.0 entry elements SHOULD contain exactly one' - . ' description element but a description has not been set. In' - . ' addition, there is no title element as required in the absence' - . ' of a description.'; - $exception = new Feed\Exception($message); + . ' description element but a description has not been set. In' + . ' addition, there is no title element as required in the absence' + . ' of a description.'; + $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -151,7 +147,7 @@ protected function _setDescription(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) + protected function _setDateModified(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateModified()) { return; @@ -160,7 +156,7 @@ protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) $updated = $dom->createElement('pubDate'); $root->appendChild($updated); $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(\Zend\Date\Date::RSS) + $this->getDataContainer()->getDateModified()->get(Zend_Date::RSS) ); $updated->appendChild($text); } @@ -172,7 +168,7 @@ protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) + protected function _setDateCreated(DOMDocument $dom, DOMElement $root) { if (!$this->getDataContainer()->getDateCreated()) { return; @@ -191,7 +187,7 @@ protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->_container->getAuthors(); if ((!$authors || empty($authors))) { @@ -216,12 +212,43 @@ protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setEnclosure(\DOMDocument $dom, \DOMElement $root) + protected function _setEnclosure(DOMDocument $dom, DOMElement $root) { $data = $this->_container->getEnclosure(); if ((!$data || empty($data))) { return; } + if (!isset($data['type'])) { + require_once 'Zend/Feed/Exception.php'; + $exception = new Zend_Feed_Exception('Enclosure "type" is not set'); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + if (!isset($data['length'])) { + require_once 'Zend/Feed/Exception.php'; + $exception = new Zend_Feed_Exception('Enclosure "length" is not set'); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + if (isset($data['length']) && (int) $data['length'] <= 0) { + require_once 'Zend/Feed/Exception.php'; + $exception = new Zend_Feed_Exception('Enclosure "length" must be an integer' + . ' indicating the content\'s length in bytes'); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } $enclosure = $this->_dom->createElement('enclosure'); $enclosure->setAttribute('type', $data['type']); $enclosure->setAttribute('length', $data['length']); @@ -236,7 +263,7 @@ protected function _setEnclosure(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setLink(\DOMDocument $dom, \DOMElement $root) + protected function _setLink(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getLink()) { return; @@ -254,7 +281,7 @@ protected function _setLink(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setId(\DOMDocument $dom, \DOMElement $root) + protected function _setId(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getId() && !$this->getDataContainer()->getLink()) { @@ -269,7 +296,7 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) } $text = $dom->createTextNode($this->getDataContainer()->getId()); $id->appendChild($text); - if (!\Zend\URI\URL::validate($this->getDataContainer()->getId())) { + if (!Zend_Uri::check($this->getDataContainer()->getId())) { $id->setAttribute('isPermaLink', 'false'); } } @@ -281,7 +308,7 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCommentLink(\DOMDocument $dom, \DOMElement $root) + protected function _setCommentLink(DOMDocument $dom, DOMElement $root) { $link = $this->getDataContainer()->getCommentLink(); if (!$link) { @@ -300,7 +327,7 @@ protected function _setCommentLink(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCategories(\DOMDocument $dom, \DOMElement $root) + protected function _setCategories(DOMDocument $dom, DOMElement $root) { $categories = $this->getDataContainer()->getCategories(); if (!$categories) { diff --git a/src/Writer/Renderer/Feed/Atom/Atom.php b/src/Writer/Renderer/Feed/Atom.php similarity index 69% rename from src/Writer/Renderer/Feed/Atom/Atom.php rename to src/Writer/Renderer/Feed/Atom.php index 3381d8b4..1543a62c 100644 --- a/src/Writer/Renderer/Feed/Atom/Atom.php +++ b/src/Writer/Renderer/Feed/Atom.php @@ -16,40 +16,46 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Atom.php 22097 2010-05-04 17:56:06Z padraic $ */ -/** - * @namespace - */ -namespace Zend\Feed\Writer\Renderer\Feed\Atom; +/** @see Zend_Feed_Writer_Feed */ +require_once 'Zend/Feed/Writer/Feed.php'; + +/** @see Zend_Version */ +require_once 'Zend/Version.php'; + +/** @see Zend_Feed_Writer_Renderer_RendererInterface */ +require_once 'Zend/Feed/Writer/Renderer/RendererInterface.php'; + +/** @see Zend_Feed_Writer_Renderer_Entry_Atom */ +require_once 'Zend/Feed/Writer/Renderer/Entry/Atom.php'; + +/** @see Zend_Feed_Writer_Renderer_Entry_Atom_Deleted */ +require_once 'Zend/Feed/Writer/Renderer/Entry/Atom/Deleted.php'; + +/** @see Zend_Feed_Writer_Renderer_RendererAbstract */ +require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php'; + +require_once 'Zend/Feed/Writer/Renderer/Feed/Atom/AtomAbstract.php'; /** - * @uses DOMDocument - * @uses \Zend\Feed\Writer\Writer - * @uses \Zend\Feed\Writer\Feed\Feed - * @uses \Zend\Feed\Writer\Renderer\Entry\Atom\Atom - * @uses \Zend\Feed\Writer\Renderer\Entry\Atom\Deleted - * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\AtomAbstract - * @uses \Zend\Feed\Writer\Renderer\RendererAbstract - * @uses \Zend\Feed\Writer\Renderer\RendererInterface - * @uses \Zend\Version * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Atom - extends AtomAbstract - implements \Zend\Feed\Writer\Renderer\RendererInterface +class Zend_Feed_Writer_Renderer_Feed_Atom + extends Zend_Feed_Writer_Renderer_Feed_Atom_AtomAbstract + implements Zend_Feed_Writer_Renderer_RendererInterface { /** * Constructor * - * @param \Zend\Feed\Writer\Feed\Feed $container + * @param Zend_Feed_Writer_Feed $container * @return void */ - public function __construct (\Zend\Feed\Writer\Feed\Feed $container) + public function __construct (Zend_Feed_Writer_Feed $container) { parent::__construct($container); } @@ -57,17 +63,17 @@ public function __construct (\Zend\Feed\Writer\Feed\Feed $container) /** * Render Atom feed * - * @return \Zend\Feed\Writer\Renderer\Feed\Atom\Atom + * @return Zend_Feed_Writer_Renderer_Feed_Atom */ public function render() { if (!$this->_container->getEncoding()) { $this->_container->setEncoding('UTF-8'); } - $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; $root = $this->_dom->createElementNS( - \Zend\Feed\Writer\Writer::NAMESPACE_ATOM_10, 'feed' + Zend_Feed_Writer::NAMESPACE_ATOM_10, 'feed' ); $this->setRootElement($root); $this->_dom->appendChild($root); @@ -75,6 +81,7 @@ public function render() $this->_setBaseUrl($this->_dom, $root); $this->_setTitle($this->_dom, $root); $this->_setDescription($this->_dom, $root); + $this->_setImage($this->_dom, $root); $this->_setDateCreated($this->_dom, $root); $this->_setDateModified($this->_dom, $root); $this->_setGenerator($this->_dom, $root); @@ -97,15 +104,15 @@ public function render() if ($this->getDataContainer()->getEncoding()) { $entry->setEncoding($this->getDataContainer()->getEncoding()); } - if ($entry instanceof \Zend\Feed\Writer\Entry) { - $renderer = new \Zend\Feed\Writer\Renderer\Entry\Atom\Atom($entry); + if ($entry instanceof Zend_Feed_Writer_Entry) { + $renderer = new Zend_Feed_Writer_Renderer_Entry_Atom($entry); } else { if (!$this->_dom->documentElement->hasAttribute('xmlns:at')) { $this->_dom->documentElement->setAttribute( 'xmlns:at', 'http://purl.org/atompub/tombstones/1.0' ); } - $renderer = new \Zend\Feed\Writer\Renderer\Entry\Atom\Deleted($entry); + $renderer = new Zend_Feed_Writer_Renderer_Entry_Atom_Deleted($entry); } if ($this->_ignoreExceptions === true) { $renderer->ignoreExceptions(); diff --git a/src/Writer/Renderer/Feed/Atom/AtomAbstract.php b/src/Writer/Renderer/Feed/Atom/AtomAbstract.php index 0f8922df..3dcb1c26 100644 --- a/src/Writer/Renderer/Feed/Atom/AtomAbstract.php +++ b/src/Writer/Renderer/Feed/Atom/AtomAbstract.php @@ -16,35 +16,37 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: AtomAbstract.php 22099 2010-05-04 18:51:58Z padraic $ */ -/** - * @namespace - */ -namespace Zend\Feed\Writer\Renderer\Feed\Atom; -use Zend\Feed; +/** @see Zend_Feed_Writer_Feed */ +require_once 'Zend/Feed/Writer/Feed.php'; + +/** @see Zend_Version */ +require_once 'Zend/Version.php'; + +/** @see Zend_Feed_Writer_Renderer_RendererInterface */ +require_once 'Zend/Feed/Writer/Renderer/RendererInterface.php'; + +/** @see Zend_Feed_Writer_Renderer_Entry_Atom */ +require_once 'Zend/Feed/Writer/Renderer/Entry/Atom.php'; + +/** @see Zend_Feed_Writer_Renderer_RendererAbstract */ +require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php'; /** - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Writer\Feed\Feed - * @uses \Zend\Feed\Writer\Renderer\Entry\Atom\Atom - * @uses \Zend\Feed\Writer\Renderer\RendererAbstract - * @uses \Zend\Feed\Writer\Renderer\RendererInterface - * @uses \Zend\Version * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class AtomAbstract - extends Feed\Writer\Renderer\RendererAbstract +class Zend_Feed_Writer_Renderer_Feed_Atom_AtomAbstract + extends Zend_Feed_Writer_Renderer_RendererAbstract { /** * Constructor * - * @param \Zend\Feed\Writer\Feed\Feed $container + * @param Zend_Feed_Writer_Feed $container * @return void */ public function __construct ($container) @@ -59,7 +61,7 @@ public function __construct ($container) * @param DOMElement $root * @return void */ - protected function _setLanguage(\DOMDocument $dom, \DOMElement $root) + protected function _setLanguage(DOMDocument $dom, DOMElement $root) { if ($this->getDataContainer()->getLanguage()) { $root->setAttribute('xml:lang', $this->getDataContainer() @@ -74,12 +76,13 @@ protected function _setLanguage(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setTitle(\DOMDocument $dom, \DOMElement $root) + protected function _setTitle(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getTitle()) { + require_once 'Zend/Feed/Exception.php'; $message = 'Atom 1.0 feed elements MUST contain exactly one' - . ' atom:title element but a title has not been set'; - $exception = new Feed\Exception($message); + . ' atom:title element but a title has not been set'; + $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -102,7 +105,7 @@ protected function _setTitle(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDescription(\DOMDocument $dom, \DOMElement $root) + protected function _setDescription(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDescription()) { return; @@ -121,12 +124,13 @@ protected function _setDescription(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) + protected function _setDateModified(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateModified()) { + require_once 'Zend/Feed/Exception.php'; $message = 'Atom 1.0 feed elements MUST contain exactly one' - . ' atom:updated element but a modification date has not been set'; - $exception = new Feed\Exception($message); + . ' atom:updated element but a modification date has not been set'; + $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -138,7 +142,7 @@ protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) $updated = $dom->createElement('updated'); $root->appendChild($updated); $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(\Zend\Date\Date::ISO_8601) + $this->getDataContainer()->getDateModified()->get(Zend_Date::ISO_8601) ); $updated->appendChild($text); } @@ -150,11 +154,11 @@ protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) + protected function _setGenerator(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getGenerator()) { $this->getDataContainer()->setGenerator('Zend_Feed_Writer', - \Zend\Version::VERSION, 'http://framework.zend.com'); + Zend_Version::VERSION, 'http://framework.zend.com'); } $gdata = $this->getDataContainer()->getGenerator(); @@ -177,7 +181,7 @@ protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setLink(\DOMDocument $dom, \DOMElement $root) + protected function _setLink(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getLink()) { return; @@ -196,15 +200,16 @@ protected function _setLink(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setFeedLinks(\DOMDocument $dom, \DOMElement $root) + protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) { $flinks = $this->getDataContainer()->getFeedLinks(); if(!$flinks || !array_key_exists('atom', $flinks)) { + require_once 'Zend/Feed/Exception.php'; $message = 'Atom 1.0 feed elements SHOULD contain one atom:link ' - . 'element with a rel attribute value of "self". This is the ' - . 'preferred URI for retrieving Atom Feed Documents representing ' - . 'this Atom feed but a feed link has not been set'; - $exception = new Feed\Exception($message); + . 'element with a rel attribute value of "self". This is the ' + . 'preferred URI for retrieving Atom Feed Documents representing ' + . 'this Atom feed but a feed link has not been set'; + $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -230,7 +235,7 @@ protected function _setFeedLinks(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->_container->getAuthors(); if (!$authors || empty($authors)) { @@ -270,15 +275,16 @@ protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setId(\DOMDocument $dom, \DOMElement $root) + protected function _setId(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getId() && !$this->getDataContainer()->getLink()) { + require_once 'Zend/Feed/Exception.php'; $message = 'Atom 1.0 feed elements MUST contain exactly one ' - . 'atom:id element, or as an alternative, we can use the same ' - . 'value as atom:link however neither a suitable link nor an ' - . 'id have been set'; - $exception = new Feed\Exception($message); + . 'atom:id element, or as an alternative, we can use the same ' + . 'value as atom:link however neither a suitable link nor an ' + . 'id have been set'; + $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -304,7 +310,7 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCopyright(\DOMDocument $dom, \DOMElement $root) + protected function _setCopyright(DOMDocument $dom, DOMElement $root) { $copyright = $this->getDataContainer()->getCopyright(); if (!$copyright) { @@ -315,6 +321,25 @@ protected function _setCopyright(\DOMDocument $dom, \DOMElement $root) $text = $dom->createTextNode($copyright); $copy->appendChild($text); } + + /** + * Set feed level logo (image) + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setImage(DOMDocument $dom, DOMElement $root) + { + $image = $this->getDataContainer()->getImage(); + if (!$image) { + return; + } + $img = $dom->createElement('logo'); + $root->appendChild($img); + $text = $dom->createTextNode($image['uri']); + $img->appendChild($text); + } /** * Set date feed was created @@ -323,7 +348,7 @@ protected function _setCopyright(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) + protected function _setDateCreated(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateCreated()) { return; @@ -342,7 +367,7 @@ protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setBaseUrl(\DOMDocument $dom, \DOMElement $root) + protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) { $baseUrl = $this->getDataContainer()->getBaseUrl(); if (!$baseUrl) { @@ -358,7 +383,7 @@ protected function _setBaseUrl(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setHubs(\DOMDocument $dom, \DOMElement $root) + protected function _setHubs(DOMDocument $dom, DOMElement $root) { $hubs = $this->getDataContainer()->getHubs(); if (!$hubs) { @@ -379,7 +404,7 @@ protected function _setHubs(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCategories(\DOMDocument $dom, \DOMElement $root) + protected function _setCategories(DOMDocument $dom, DOMElement $root) { $categories = $this->getDataContainer()->getCategories(); if (!$categories) { diff --git a/src/Writer/Renderer/Feed/Atom/Source.php b/src/Writer/Renderer/Feed/Atom/Source.php index 649bac91..7f5a6e3b 100644 --- a/src/Writer/Renderer/Feed/Atom/Source.php +++ b/src/Writer/Renderer/Feed/Atom/Source.php @@ -16,26 +16,20 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Source.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ - -/** - * @namespace - */ -namespace Zend\Feed\Writer\Renderer\Feed\Atom; - + +require_once 'Zend/Feed/Writer/Renderer/Feed/Atom/AtomAbstract.php'; + /** - * @uses DOMDocument - * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\AtomAbstract - * @uses \Zend\Feed\Writer\Renderer\RendererInterface * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Source - extends AtomAbstract - implements \Zend\Feed\Writer\Renderer\RendererInterface +class Zend_Feed_Writer_Renderer_Feed_Atom_Source + extends Zend_Feed_Writer_Renderer_Feed_Atom_AtomAbstract + implements Zend_Feed_Writer_Renderer_RendererInterface { /** @@ -44,7 +38,7 @@ class Source * @param Zend_Feed_Writer_Feed_Source $container * @return void */ - public function __construct (\Zend\Feed\Writer\Source $container) + public function __construct (Zend_Feed_Writer_Source $container) { parent::__construct($container); } @@ -52,14 +46,14 @@ public function __construct (\Zend\Feed\Writer\Source $container) /** * Render Atom Feed Metadata (Source element) * - * @return \Zend\Feed\Writer\Renderer\Feed\Atom\Atom + * @return Zend_Feed_Writer_Renderer_Feed_Atom */ public function render() { if (!$this->_container->getEncoding()) { $this->_container->setEncoding('UTF-8'); } - $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; $root = $this->_dom->createElement('source'); $this->setRootElement($root); @@ -94,7 +88,7 @@ public function render() * @param DOMElement $root * @return void */ - protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) + protected function _setGenerator(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getGenerator()) { return; diff --git a/src/Writer/Renderer/Feed/RSS.php b/src/Writer/Renderer/Feed/RSS.php deleted file mode 100644 index 0ec37a60..00000000 --- a/src/Writer/Renderer/Feed/RSS.php +++ /dev/null @@ -1,371 +0,0 @@ -_container->getEncoding()) { - $this->_container->setEncoding('UTF-8'); - } - $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); - $this->_dom->formatOutput = true; - $this->_dom->substituteEntities = false; - $rss = $this->_dom->createElement('rss'); - $this->setRootElement($rss); - $rss->setAttribute('version', '2.0'); - - $channel = $this->_dom->createElement('channel'); - $rss->appendChild($channel); - $this->_dom->appendChild($rss); - $this->_setLanguage($this->_dom, $channel); - $this->_setBaseUrl($this->_dom, $channel); - $this->_setTitle($this->_dom, $channel); - $this->_setDescription($this->_dom, $channel); - $this->_setDateCreated($this->_dom, $channel); - $this->_setDateModified($this->_dom, $channel); - $this->_setGenerator($this->_dom, $channel); - $this->_setLink($this->_dom, $channel); - $this->_setAuthors($this->_dom, $channel); - $this->_setCopyright($this->_dom, $channel); - $this->_setCategories($this->_dom, $channel); - - foreach ($this->_extensions as $ext) { - $ext->setType($this->getType()); - $ext->setRootElement($this->getRootElement()); - $ext->setDomDocument($this->getDomDocument(), $channel); - $ext->render(); - } - - foreach ($this->_container as $entry) { - if ($this->getDataContainer()->getEncoding()) { - $entry->setEncoding($this->getDataContainer()->getEncoding()); - } - if ($entry instanceof Feed\Writer\Entry) { - $renderer = new Feed\Writer\Renderer\Entry\RSS($entry); - } else { - continue; - } - if ($this->_ignoreExceptions === true) { - $renderer->ignoreExceptions(); - } - $renderer->setType($this->getType()); - $renderer->setRootElement($this->_dom->documentElement); - $renderer->render(); - $element = $renderer->getElement(); - $imported = $this->_dom->importNode($element, true); - $channel->appendChild($imported); - } - return $this; - } - - /** - * Set feed language - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setLanguage(\DOMDocument $dom, \DOMElement $root) - { - $lang = $this->getDataContainer()->getLanguage(); - if (!$lang) { - return; - } - $language = $dom->createElement('language'); - $root->appendChild($language); - $language->nodeValue = $lang; - } - - /** - * Set feed title - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setTitle(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getTitle()) { - $message = 'RSS 2.0 feed elements MUST contain exactly one' - . ' title element but a title has not been set'; - $exception = new Feed\Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - - $title = $dom->createElement('title'); - $root->appendChild($title); - $text = $dom->createTextNode($this->getDataContainer()->getTitle()); - $title->appendChild($text); - } - - /** - * Set feed description - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDescription(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getDescription()) { - $message = 'RSS 2.0 feed elements MUST contain exactly one' - . ' description element but one has not been set'; - $exception = new Feed\Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $subtitle = $dom->createElement('description'); - $root->appendChild($subtitle); - $text = $dom->createTextNode($this->getDataContainer()->getDescription()); - $subtitle->appendChild($text); - } - - /** - * Set date feed was last modified - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getDateModified()) { - return; - } - - $updated = $dom->createElement('pubDate'); - $root->appendChild($updated); - $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(\Zend\Date\Date::RSS) - ); - $updated->appendChild($text); - } - - /** - * Set feed generator string - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getGenerator()) { - $this->getDataContainer()->setGenerator('Zend_Feed_Writer', - \Zend\Version::VERSION, 'http://framework.zend.com'); - } - - $gdata = $this->getDataContainer()->getGenerator(); - $generator = $dom->createElement('generator'); - $root->appendChild($generator); - $name = $gdata['name']; - if (array_key_exists('version', $gdata)) { - $name .= ' ' . $gdata['version']; - } - if (array_key_exists('uri', $gdata)) { - $name .= ' (' . $gdata['uri'] . ')'; - } - $text = $dom->createTextNode($name); - $generator->appendChild($text); - } - - /** - * Set link to feed - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setLink(\DOMDocument $dom, \DOMElement $root) - { - $value = $this->getDataContainer()->getLink(); - if(!$value) { - $message = 'RSS 2.0 feed elements MUST contain exactly one' - . ' link element but one has not been set'; - $exception = new Feed\Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $link = $dom->createElement('link'); - $root->appendChild($link); - $text = $dom->createTextNode($value); - $link->appendChild($text); - if (!\Zend\URI\URL::validate($value)) { - $link->setAttribute('isPermaLink', 'false'); - } - } - - /** - * Set feed authors - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) - { - $authors = $this->getDataContainer()->getAuthors(); - if (!$authors || empty($authors)) { - return; - } - foreach ($authors as $data) { - $author = $this->_dom->createElement('author'); - $name = $data['name']; - if (array_key_exists('email', $data)) { - $name = $data['email'] . ' (' . $data['name'] . ')'; - } - $text = $dom->createTextNode($name); - $author->appendChild($text); - $root->appendChild($author); - } - } - - /** - * Set feed copyright - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCopyright(\DOMDocument $dom, \DOMElement $root) - { - $copyright = $this->getDataContainer()->getCopyright(); - if (!$copyright) { - return; - } - $copy = $dom->createElement('copyright'); - $root->appendChild($copy); - $text = $dom->createTextNode($copyright); - $copy->appendChild($text); - } - - /** - * Set date feed was created - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getDateCreated()) { - return; - } - if(!$this->getDataContainer()->getDateModified()) { - $this->getDataContainer()->setDateModified( - $this->getDataContainer()->getDateCreated() - ); - } - } - - /** - * Set base URL to feed links - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setBaseUrl(\DOMDocument $dom, \DOMElement $root) - { - $baseUrl = $this->getDataContainer()->getBaseUrl(); - if (!$baseUrl) { - return; - } - $root->setAttribute('xml:base', $baseUrl); - } - - /** - * Set feed categories - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCategories(\DOMDocument $dom, \DOMElement $root) - { - $categories = $this->getDataContainer()->getCategories(); - if (!$categories) { - return; - } - foreach ($categories as $cat) { - $category = $dom->createElement('category'); - if (isset($cat['scheme'])) { - $category->setAttribute('domain', $cat['scheme']); - } - $text = $dom->createTextNode($cat['term']); - $category->appendChild($text); - $root->appendChild($category); - } - } -} diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index 0ec37a60..3e71f356 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -16,41 +16,41 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Rss.php 22107 2010-05-05 13:42:20Z padraic $ */ -/** - * @namespace - */ -namespace Zend\Feed\Writer\Renderer\Feed; -use Zend\Feed; +/** @see Zend_Feed_Writer_Feed */ +require_once 'Zend/Feed/Writer/Feed.php'; + +/** @see Zend_Version */ +require_once 'Zend/Version.php'; + +/** @see Zend_Feed_Writer_Renderer_RendererInterface */ +require_once 'Zend/Feed/Writer/Renderer/RendererInterface.php'; + +/** @see Zend_Feed_Writer_Renderer_Entry_Rss */ +require_once 'Zend/Feed/Writer/Renderer/Entry/Rss.php'; + +/** @see Zend_Feed_Writer_Renderer_RendererAbstract */ +require_once 'Zend/Feed/Writer/Renderer/RendererAbstract.php'; /** - * @uses DOMDocument - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Writer\Feed\Feed - * @uses \Zend\Feed\Writer\Renderer\Entry\RSS - * @uses \Zend\Feed\Writer\Renderer\RendererAbstract - * @uses \Zend\Feed\Writer\Renderer\RendererInterface - * @uses \Zend\Uri\Uri - * @uses \Zend\Version * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class RSS - extends Feed\Writer\Renderer\RendererAbstract - implements Feed\Writer\Renderer\RendererInterface +class Zend_Feed_Writer_Renderer_Feed_Rss + extends Zend_Feed_Writer_Renderer_RendererAbstract + implements Zend_Feed_Writer_Renderer_RendererInterface { /** * Constructor * - * @param \Zend\Feed\Writer\Feed\Feed $container + * @param Zend_Feed_Writer_Feed $container * @return void */ - public function __construct (Feed\Writer\Feed\Feed $container) + public function __construct (Zend_Feed_Writer_Feed $container) { parent::__construct($container); } @@ -58,14 +58,14 @@ public function __construct (Feed\Writer\Feed\Feed $container) /** * Render RSS feed * - * @return \Zend\Feed\Writer\Renderer\Feed\RSS + * @return Zend_Feed_Writer_Renderer_Feed_Rss */ public function render() { if (!$this->_container->getEncoding()) { $this->_container->setEncoding('UTF-8'); } - $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; $this->_dom->substituteEntities = false; $rss = $this->_dom->createElement('rss'); @@ -79,8 +79,10 @@ public function render() $this->_setBaseUrl($this->_dom, $channel); $this->_setTitle($this->_dom, $channel); $this->_setDescription($this->_dom, $channel); + $this->_setImage($this->_dom, $channel); $this->_setDateCreated($this->_dom, $channel); $this->_setDateModified($this->_dom, $channel); + $this->_setLastBuildDate($this->_dom, $channel); $this->_setGenerator($this->_dom, $channel); $this->_setLink($this->_dom, $channel); $this->_setAuthors($this->_dom, $channel); @@ -98,8 +100,8 @@ public function render() if ($this->getDataContainer()->getEncoding()) { $entry->setEncoding($this->getDataContainer()->getEncoding()); } - if ($entry instanceof Feed\Writer\Entry) { - $renderer = new Feed\Writer\Renderer\Entry\RSS($entry); + if ($entry instanceof Zend_Feed_Writer_Entry) { + $renderer = new Zend_Feed_Writer_Renderer_Entry_Rss($entry); } else { continue; } @@ -123,7 +125,7 @@ public function render() * @param DOMElement $root * @return void */ - protected function _setLanguage(\DOMDocument $dom, \DOMElement $root) + protected function _setLanguage(DOMDocument $dom, DOMElement $root) { $lang = $this->getDataContainer()->getLanguage(); if (!$lang) { @@ -141,12 +143,13 @@ protected function _setLanguage(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setTitle(\DOMDocument $dom, \DOMElement $root) + protected function _setTitle(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getTitle()) { + require_once 'Zend/Feed/Exception.php'; $message = 'RSS 2.0 feed elements MUST contain exactly one' - . ' title element but a title has not been set'; - $exception = new Feed\Exception($message); + . ' title element but a title has not been set'; + $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -168,12 +171,13 @@ protected function _setTitle(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDescription(\DOMDocument $dom, \DOMElement $root) + protected function _setDescription(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDescription()) { + require_once 'Zend/Feed/Exception.php'; $message = 'RSS 2.0 feed elements MUST contain exactly one' - . ' description element but one has not been set'; - $exception = new Feed\Exception($message); + . ' description element but one has not been set'; + $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -194,7 +198,7 @@ protected function _setDescription(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) + protected function _setDateModified(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateModified()) { return; @@ -203,7 +207,7 @@ protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) $updated = $dom->createElement('pubDate'); $root->appendChild($updated); $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(\Zend\Date\Date::RSS) + $this->getDataContainer()->getDateModified()->get(Zend_Date::RSS) ); $updated->appendChild($text); } @@ -215,11 +219,11 @@ protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) + protected function _setGenerator(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getGenerator()) { $this->getDataContainer()->setGenerator('Zend_Feed_Writer', - \Zend\Version::VERSION, 'http://framework.zend.com'); + Zend_Version::VERSION, 'http://framework.zend.com'); } $gdata = $this->getDataContainer()->getGenerator(); @@ -243,13 +247,14 @@ protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setLink(\DOMDocument $dom, \DOMElement $root) + protected function _setLink(DOMDocument $dom, DOMElement $root) { $value = $this->getDataContainer()->getLink(); if(!$value) { + require_once 'Zend/Feed/Exception.php'; $message = 'RSS 2.0 feed elements MUST contain exactly one' - . ' link element but one has not been set'; - $exception = new Feed\Exception($message); + . ' link element but one has not been set'; + $exception = new Zend_Feed_Exception($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -261,7 +266,7 @@ protected function _setLink(\DOMDocument $dom, \DOMElement $root) $root->appendChild($link); $text = $dom->createTextNode($value); $link->appendChild($text); - if (!\Zend\URI\URL::validate($value)) { + if (!Zend_Uri::check($value)) { $link->setAttribute('isPermaLink', 'false'); } } @@ -273,7 +278,7 @@ protected function _setLink(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->getDataContainer()->getAuthors(); if (!$authors || empty($authors)) { @@ -298,7 +303,7 @@ protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCopyright(\DOMDocument $dom, \DOMElement $root) + protected function _setCopyright(DOMDocument $dom, DOMElement $root) { $copyright = $this->getDataContainer()->getCopyright(); if (!$copyright) { @@ -309,6 +314,114 @@ protected function _setCopyright(\DOMDocument $dom, \DOMElement $root) $text = $dom->createTextNode($copyright); $copy->appendChild($text); } + + /** + * Set feed channel image + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setImage(DOMDocument $dom, DOMElement $root) + { + $image = $this->getDataContainer()->getImage(); + if (!$image) { + return; + } + if (!isset($image['title']) || empty($image['title']) + || !is_string($image['title'])) { + require_once 'Zend/Feed/Exception.php'; + $message = 'RSS 2.0 feed images must include a title'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + if (empty($image['link']) || !is_string($image['link']) + || !Zend_Uri::check($image['link'])) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Invalid parameter: parameter \'link\'' + . ' must be a non-empty string and valid URI/IRI'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $img = $dom->createElement('image'); + $root->appendChild($img); + $url = $dom->createElement('url'); + $text = $dom->createTextNode($image['uri']); + $url->appendChild($text); + $title = $dom->createElement('title'); + $text = $dom->createTextNode($image['title']); + $title->appendChild($text); + $link = $dom->createElement('link'); + $text = $dom->createTextNode($image['link']); + $link->appendChild($text); + $img->appendChild($url); + $img->appendChild($title); + $img->appendChild($link); + if (isset($image['height'])) { + if (!ctype_digit((string) $image['height']) || $image['height'] > 400) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Invalid parameter: parameter \'height\'' + . ' must be an integer not exceeding 400'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $height = $dom->createElement('height'); + $text = $dom->createTextNode($image['height']); + $height->appendChild($text); + $img->appendChild($height); + } + if (isset($image['width'])) { + if (!ctype_digit((string) $image['width']) || $image['width'] > 144) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Invalid parameter: parameter \'width\'' + . ' must be an integer not exceeding 144'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $width = $dom->createElement('width'); + $text = $dom->createTextNode($image['width']); + $width->appendChild($text); + $img->appendChild($width); + } + if (isset($image['description'])) { + if (empty($image['description']) || !is_string($image['description'])) { + require_once 'Zend/Feed/Exception.php'; + $message = 'Invalid parameter: parameter \'description\'' + . ' must be a non-empty string'; + $exception = new Zend_Feed_Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $desc = $dom->createElement('description'); + $text = $dom->createTextNode($image['description']); + $desc->appendChild($text); + $img->appendChild($desc); + } + } /** * Set date feed was created @@ -317,7 +430,7 @@ protected function _setCopyright(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) + protected function _setDateCreated(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateCreated()) { return; @@ -328,6 +441,27 @@ protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) ); } } + + /** + * Set date feed last build date + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setLastBuildDate(DOMDocument $dom, DOMElement $root) + { + if(!$this->getDataContainer()->getLastBuildDate()) { + return; + } + + $lastBuildDate = $dom->createElement('lastBuildDate'); + $root->appendChild($lastBuildDate); + $text = $dom->createTextNode( + $this->getDataContainer()->getLastBuildDate()->get(Zend_Date::RSS) + ); + $lastBuildDate->appendChild($text); + } /** * Set base URL to feed links @@ -336,7 +470,7 @@ protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setBaseUrl(\DOMDocument $dom, \DOMElement $root) + protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) { $baseUrl = $this->getDataContainer()->getBaseUrl(); if (!$baseUrl) { @@ -352,7 +486,7 @@ protected function _setBaseUrl(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCategories(\DOMDocument $dom, \DOMElement $root) + protected function _setCategories(DOMDocument $dom, DOMElement $root) { $categories = $this->getDataContainer()->getCategories(); if (!$categories) { diff --git a/src/Writer/Renderer/RendererAbstract.php b/src/Writer/Renderer/RendererAbstract.php index ea9bdfd3..0778e435 100644 --- a/src/Writer/Renderer/RendererAbstract.php +++ b/src/Writer/Renderer/RendererAbstract.php @@ -16,25 +16,22 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: RendererAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $ */ + +/** @see Zend_Feed_Writer */ +require_once 'Zend/Feed/Writer.php'; +/** @see Zend_Version */ +require_once 'Zend/Version.php'; + /** - * @namespace - */ -namespace Zend\Feed\Writer\Renderer; -use Zend\Feed\Writer; - -/** - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Writer\Writer - * @uses \Zend\Version * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class RendererAbstract +class Zend_Feed_Writer_Renderer_RendererAbstract { /** * Extensions @@ -139,7 +136,7 @@ public function getDataContainer() * Set feed encoding * * @param string $enc - * @return \Zend\Feed\Writer\Renderer\RendererAbstract + * @return Zend_Feed_Writer_Renderer_RendererAbstract */ public function setEncoding($enc) { @@ -161,12 +158,13 @@ public function getEncoding() * Indicate whether or not to ignore exceptions * * @param bool $bool - * @return \Zend\Feed\Writer\Renderer\RendererAbstract + * @return Zend_Feed_Writer_Renderer_RendererAbstract */ public function ignoreExceptions($bool = true) { if (!is_bool($bool)) { - throw new \Zend\Feed\Exception('Invalid parameter: $bool. Should be TRUE or FALSE (defaults to TRUE if null)'); + require_once 'Zend/Feed/Exception.php'; + throw new Zend_Feed_Exception('Invalid parameter: $bool. Should be TRUE or FALSE (defaults to TRUE if null)'); } $this->_ignoreExceptions = $bool; return $this; @@ -212,7 +210,7 @@ public function getType() * * @param DOMElement $root */ - public function setRootElement(\DOMElement $root) + public function setRootElement(DOMElement $root) { $this->_rootElement = $root; } @@ -234,15 +232,15 @@ public function getRootElement() */ protected function _loadExtensions() { - Writer\Writer::registerCoreExtensions(); - $all = Writer\Writer::getExtensions(); + Zend_Feed_Writer::registerCoreExtensions(); + $all = Zend_Feed_Writer::getExtensions(); if (stripos(get_class($this), 'entry')) { $exts = $all['entryRenderer']; } else { $exts = $all['feedRenderer']; } foreach ($exts as $extension) { - $className = Writer\Writer::getPluginLoader()->getClassName($extension); + $className = Zend_Feed_Writer::getPluginLoader()->getClassName($extension); $this->_extensions[$extension] = new $className( $this->getDataContainer() ); diff --git a/src/Writer/Renderer/RendererInterface.php b/src/Writer/Renderer/RendererInterface.php index 70c304bd..89b42944 100644 --- a/src/Writer/Renderer/RendererInterface.php +++ b/src/Writer/Renderer/RendererInterface.php @@ -16,21 +16,16 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: RendererInterface.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -/** - * @namespace - */ -namespace Zend\Feed\Writer\Renderer; - /** * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface RendererInterface +interface Zend_Feed_Writer_Renderer_RendererInterface { /** * Render feed/entry @@ -105,7 +100,7 @@ public function getType(); * * @param DOMElement $root */ - public function setRootElement(\DOMElement $root); + public function setRootElement(DOMElement $root); /** * Retrieve the absolute root element for the XML feed being generated. diff --git a/src/Writer/Source.php b/src/Writer/Source.php index 0e41d125..0ed2daeb 100644 --- a/src/Writer/Source.php +++ b/src/Writer/Source.php @@ -16,22 +16,18 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Source.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ -/** - * @namespace - */ -namespace Zend\Feed\Writer; - -/** - * @uses \Zend\Feed\Writer\Feed\FeedAbstract +require_once 'Zend/Feed/Writer/Feed/FeedAbstract.php'; + + /** * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Source extends Feed\FeedAbstract +class Zend_Feed_Writer_Source extends Zend_Feed_Writer_Feed_FeedAbstract { } diff --git a/test/ArrayAccessTest.php b/test/ArrayAccessTest.php deleted file mode 100644 index 3eba1fd0..00000000 --- a/test/ArrayAccessTest.php +++ /dev/null @@ -1,110 +0,0 @@ -_feed = Feed\Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); - $this->_nsfeed = Feed\Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeedNamespaced.xml'); - } - - public function testExists() - { - $this->assertFalse(isset($this->_feed[-1]), 'Negative array access should fail'); - $this->assertTrue(isset($this->_feed['version']), 'Feed version should be set'); - - $this->assertFalse(isset($this->_nsfeed[-1]), 'Negative array access should fail'); - $this->assertTrue(isset($this->_nsfeed['version']), 'Feed version should be set'); - } - - public function testGet() - { - $this->assertEquals($this->_feed['version'], '1.0', 'Feed version should be 1.0'); - $this->assertEquals($this->_nsfeed['version'], '1.0', 'Feed version should be 1.0'); - } - - public function testSet() - { - $this->_feed['category'] = 'tests'; - $this->assertTrue(isset($this->_feed['category']), 'Feed category should be set'); - $this->assertEquals($this->_feed['category'], 'tests', 'Feed category should be tests'); - - $this->_nsfeed['atom:category'] = 'tests'; - $this->assertTrue(isset($this->_nsfeed['atom:category']), 'Feed category should be set'); - $this->assertEquals($this->_nsfeed['atom:category'], 'tests', 'Feed category should be tests'); - - // Changing an existing index. - $oldEntry = $this->_feed['version']; - $this->_feed['version'] = '1.1'; - $this->assertTrue($oldEntry != $this->_feed['version'], 'Version should have changed'); - } - - public function testUnset() - { - $feed = Feed\Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); - unset($feed['version']); - $this->assertFalse(isset($feed['version']), 'Version should be unset'); - $this->assertEquals('', $feed['version'], 'Version should be equal to the empty string'); - - $nsfeed = Feed\Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeedNamespaced.xml'); - unset($nsfeed['version']); - $this->assertFalse(isset($nsfeed['version']), 'Version should be unset'); - $this->assertEquals('', $nsfeed['version'], 'Version should be equal to the empty string'); - } - - /** - * @issue ZF-5354 - */ - public function testGetsLinkWithEmptyOrMissingRelAsAlternateRel() - { - $feed = Feed\Feed::importFile(dirname(__FILE__) . '/_files/AtomHOnline.xml'); - $entry = $feed->current(); - $this->assertEquals('http://www.h-online.com/security/Google-acquires-reCAPTCHA--/news/114266/from/rss', $entry->link('alternate')); - } - -} diff --git a/test/AtomEntryOnlyTest.php b/test/AtomEntryOnlyTest.php deleted file mode 100644 index c569cf60..00000000 --- a/test/AtomEntryOnlyTest.php +++ /dev/null @@ -1,56 +0,0 @@ -assertEquals(1, $feed->count(), 'The entry-only feed should report one entry.'); - - $feed->current(); - - foreach ($feed as $entry); - $this->assertEquals('Zend\Feed\Entry\Atom', get_class($entry), - 'The single entry should be an instance of Zend_Feed_Entry_Atom'); - - $this->assertEquals('1', $entry->id(), 'The single entry should have id 1'); - $this->assertEquals('Bug', $entry->title(), 'The entry\'s title should be "Bug"'); - } - -} diff --git a/test/AtomPublishingTest.php b/test/AtomPublishingTest.php deleted file mode 100644 index e432643d..00000000 --- a/test/AtomPublishingTest.php +++ /dev/null @@ -1,140 +0,0 @@ -_uri = 'http://fubar.com/myFeed'; - } - - public function tearDown() - { - Feed\Feed::setHttpClient(new HTTP\Client()); - } - - public function testPost() - { - Feed\Feed::setHttpClient(new TestClient()); - - $entry = new Entry\Atom(); - - /* Give the entry its initial values. */ - $entry->title = 'Entry 1'; - $entry->content = '1.1'; - $entry->content['type'] = 'text'; - - /* Do the initial post. The base feed URI is the same as the - * POST URI, so just supply save() with that. */ - $entry->save($this->_uri); - - /* $entry will be filled in with any elements returned by the - * server (id, updated, link rel="edit", etc). */ - $this->assertEquals('1', $entry->id(), 'Expected id to be 1'); - $this->assertEquals('Entry 1', $entry->title(), 'Expected title to be "Entry 1"'); - $this->assertEquals('1.1', $entry->content(), 'Expected content to be "1.1"'); - $this->assertEquals('text', $entry->content['type'], 'Expected content/type to be "text"'); - $this->assertEquals('2005-05-23T16:26:00-08:00', $entry->updated(), 'Expected updated date of 2005-05-23T16:26:00-08:00'); - $this->assertEquals('http://fubar.com/myFeed/1/1/', $entry->link('edit'), 'Expected edit URI of http://fubar.com/myFeed/1/1/'); - } - - public function testEdit() - { - Feed\Feed::setHttpClient(new TestClient()); - $contents = file_get_contents(dirname(__FILE__) . '/_files/AtomPublishingTest-before-update.xml'); - - /* The base feed URI is the same as the POST URI, so just supply the - * Zend_Feed_Entry_Atom object with that. */ - $entry = new Entry\Atom($this->_uri, $contents); - - /* Initial state. */ - $this->assertEquals('2005-05-23T16:26:00-08:00', $entry->updated(), 'Initial state of updated timestamp does not match'); - $this->assertEquals('http://fubar.com/myFeed/1/1/', $entry->link('edit'), 'Initial state of edit link does not match'); - - /* Just change the entry's properties directly. */ - $entry->content = '1.2'; - - /* Then save the changes. */ - $entry->save(); - - /* New state. */ - $this->assertEquals('1.2', $entry->content(), 'Content change did not stick'); - $this->assertEquals('2005-05-23T16:27:00-08:00', $entry->updated(), 'New updated link is not correct'); - $this->assertEquals('http://fubar.com/myFeed/1/2/', $entry->link('edit'), 'New edit link is not correct'); - } -} - -/** - * A test wrapper around Zend_Http_Client, not actually performing - * the request. - * - */ -class TestClient extends HTTP\Client -{ - public function request($method = null) - { - $code = 400; - $body = ''; - - switch ($method) { - case self::POST: - $code = 201; - $body = file_get_contents(dirname(__FILE__) . '/_files/AtomPublishingTest-created-entry.xml'); - break; - - case self::PUT: - $doc1 = new \DOMDocument(); - $doc1->load(dirname(__FILE__) . '/_files/AtomPublishingTest-expected-update.xml'); - $doc2 = new \DOMDocument(); - $doc2->loadXML($this->raw_post_data); - if ($doc1->saveXml() == $doc2->saveXml()) { - $code = 200; - $body = file_get_contents(dirname(__FILE__) . '/_files/AtomPublishingTest-updated-entry.xml'); - } - break; - - default: - break; - } - - return new \Zend\HTTP\Response\Response($code, array(), $body); - } -} diff --git a/test/CountTest.php b/test/CountTest.php deleted file mode 100644 index aaf57c73..00000000 --- a/test/CountTest.php +++ /dev/null @@ -1,63 +0,0 @@ -assertEquals($f->count(), 2, 'Feed count should be 2'); - } - - /** - * ZF-3848 - */ - public function testCountableInterface() - { - $f = Feed\Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); - $this->assertEquals(count($f), 2, 'Feed count should be 2'); - } - -} diff --git a/test/ElementTest.php b/test/ElementTest.php deleted file mode 100644 index f09f85cf..00000000 --- a/test/ElementTest.php +++ /dev/null @@ -1,175 +0,0 @@ -author->name['last'] = 'hagenbuch'; - $e->author->name['first'] = 'chuck'; - $e->author->name->{'chuck:url'} = 'marina.horde.org'; - - $e->author->title['foo'] = 'bar'; - if ($e->pants()) { - $this->fail(' does not exist, it should not have a true value'); - // This should not create an element in the actual tree. - } - if ($e->pants()) { - $this->fail(' should not have been created by testing for it'); - // This should not create an element in the actual tree. - } - - $xml = $e->saveXml(); - - $this->assertFalse(strpos($xml, 'pants'), ' should not be in the xml output'); - $this->assertTrue(strpos($xml, 'marina.horde.org') !== false, 'the url attribute should be set'); - } - - public function testStrings() - { - $xml = " - Using C++ Intrinsic Functions for Pipelined Text Processing - http://www.oreillynet.com/pub/wlg/8356 - - -
- A good C++ programming technique that has almost no published material available on the WWW relates to using the special pipeline instructions in modern CPUs for faster text processing. Here's example code using C++ intrinsic functions to give a fourfold speed increase for a UTF-8 to UTF-16 converter compared to the original C/C++ code. -
-
- Rick Jelliffe - 2005-11-07T08:15:57-08:00 -
"; - - $entry = new Entry\Atom('uri', $xml); - - $this->assertTrue($entry->summary instanceof Feed\Element, '__get access should return an Zend_Feed_Element instance'); - $this->assertFalse($entry->summary() instanceof Feed\Element, 'method access should not return an Zend_Feed_Element instance'); - $this->assertTrue(is_string($entry->summary()), 'method access should return a string'); - $this->assertFalse(is_string($entry->summary), '__get access should not return a string'); - } - - public function testSetNamespacedAttributes() - { - $value = 'value'; - - $e = new Entry\Atom(); - $e->test['attr'] = $value; - $e->test['namespace1:attr'] = $value; - $e->test['namespace2:attr'] = $value; - - $this->assertEquals($value, $e->test['attr']); - $this->assertEquals($value, $e->test['namespace1:attr']); - $this->assertEquals($value, $e->test['namespace2:attr']); - } - - public function testUnsetNamespacedAttributes() - { - $value = 'value'; - - $e = new Entry\Atom(); - $e->test['attr'] = $value; - $e->test['namespace1:attr'] = $value; - $e->test['namespace2:attr'] = $value; - - $this->assertEquals($value, $e->test['attr']); - $this->assertEquals($value, $e->test['namespace1:attr']); - $this->assertEquals($value, $e->test['namespace2:attr']); - - unset($e->test['attr']); - unset($e->test['namespace1:attr']); - unset($e->test['namespace2:attr']); - - $this->assertEquals('', $e->test['attr']); - $this->assertEquals('', $e->test['namespace1:attr']); - $this->assertEquals('', $e->test['namespace1:attr']); - } - - /** - * @group ZF-2606 - */ - public function testValuesWithXmlSpecialChars() - { - $testAmp = '&'; - $testLt = '<'; - $testGt = '>'; - - $e = new Entry\Atom(); - $e->testAmp = $testAmp; - $e->{'namespace1:lt'} = $testLt; - $e->{'namespace1:gt'} = $testGt; - - $this->assertEquals($testAmp, $e->testAmp()); - $this->assertEquals($testLt, $e->{'namespace1:lt'}()); - $this->assertEquals($testGt, $e->{'namespace1:gt'}()); - } - - /** - * @group ZF-2606 - */ - public function testAttributesWithXmlSpecialChars() - { - $testAmp = '&'; - $testLt = '<'; - $testGt = '>'; - $testQuot = '"'; - $testSquot = "'"; - - $e = new Entry\Atom(); - $e->test['amp'] = $testAmp; - $e->test['namespace1:lt'] = $testLt; - $e->test['namespace1:gt'] = $testGt; - $e->test['namespace1:quot'] = $testQuot; - $e->test['namespace1:squot'] = $testSquot; - - $this->assertEquals($testAmp, $e->test['amp']); - $this->assertEquals($testLt, $e->test['namespace1:lt']); - $this->assertEquals($testGt, $e->test['namespace1:gt']); - $this->assertEquals($testQuot, $e->test['namespace1:quot']); - $this->assertEquals($testSquot, $e->test['namespace1:squot']); - } - -} diff --git a/test/Entry/RSSTest.php b/test/Entry/RSSTest.php deleted file mode 100644 index b0f0248b..00000000 --- a/test/Entry/RSSTest.php +++ /dev/null @@ -1,75 +0,0 @@ -assertType('Zend\Feed\RSS', $feed); - - $item = $feed->current(); - $this->assertType('Zend\Feed\Entry\RSS', $item); - - $this->assertTrue(isset($item->content)); - $this->assertContains( - 'http://framework.zend.com/fisheye/changelog/Zend_Framework/?cs=7757', - $item->content->__toString() - ); - $this->assertContains( - 'http://framework.zend.com/fisheye/changelog/Zend_Framework/?cs=7757', - $item->content() - ); - $item->content = 'foo'; - $this->assertEquals('foo', $item->content->__toString()); - } - - public function testContentEncodedNullIfEmpty() - { - $feed = Feed\Feed::importFile(dirname(__FILE__) . '/../_files/TestFeedEntryRssContentEncoded.xml'); - $this->assertType('Zend\Feed\RSS', $feed); - - $feed->next(); - $item = $feed->current(); - $this->assertType('Zend\Feed\Entry\RSS', $item); - $this->assertFalse(isset($item->content)); - $this->assertNull($item->content()); - // $this->assertNull($item->content); // always return DOMElement Object - } - -} diff --git a/test/ImportTest.php b/test/ImportTest.php deleted file mode 100644 index ea130e9a..00000000 --- a/test/ImportTest.php +++ /dev/null @@ -1,457 +0,0 @@ -_adapter = new \Zend\HTTP\Client\Adapter\Test(); - Feed\Feed::setHttpClient(new HTTP\Client(null, array('adapter' => $this->_adapter))); - $this->_client = Feed\Feed::getHttpClient(); - $this->_feedDir = dirname(__FILE__) . '/_files'; - } - - /** - * Test an atom feed generated by google's Blogger platform - */ - public function testAtomGoogle() - { - $this->_importAtomValid('AtomTestGoogle.xml'); - } - - /** - * Test an atom feed generated by mozillaZine.org - */ - public function testAtomMozillazine() - { - $this->_importAtomValid('AtomTestMozillazine.xml'); - } - - /** - * Test an atom feed generated by O'Reilly - */ - public function testAtomOReilly() - { - $this->_importAtomValid('AtomTestOReilly.xml'); - } - - /** - * Test an atom feed generated by PlanetPHP - */ - public function testAtomPlanetPHP() - { - $this->_importAtomValid('AtomTestPlanetPHP.xml'); - } - - /** - * Test a small atom feed - */ - public function testAtomSample1() - { - $this->_importAtomValid('AtomTestSample1.xml'); - } - - /** - * Test a small atom feed without any entries - */ - public function testAtomSample2() - { - $this->_importAtomValid('AtomTestSample2.xml'); - } - - /** - * Test an atom feed with a
tag missing - */ - public function testAtomSample3() - { - $this->_importInvalid('AtomTestSample3.xml'); - } - - /** - * Test an atom feed with links within entries - */ - public function testAtomSample4() - { - $this->_importAtomValid('AtomTestSample4.xml'); - } - - /** - * Test a RSS feed generated by UserLand Frontier v9.5 - */ - public function testRssHarvardLaw() - { - $this->_importRssValid('RssTestHarvardLaw.xml'); - } - - /** - * Test a RSS feed generated by PlanetPHP - */ - public function testRssPlanetPHP() - { - $this->_importRssValid('RssTestPlanetPHP.xml'); - } - - /** - * Test a RSS feed generated by Slashdot - */ - public function testRssSlashdot() - { - $this->_importRssValid('RssTestSlashdot.xml'); - } - - /** - * Test a RSS feed generated by CNN - */ - public function testRssCNN() - { - $this->_importRssValid('RssTestCNN.xml'); - } - - /** - * Test a valid RSS 0.91 sample - */ - public function testRss091Sample1() - { - $this->_importRssValid('RssTest091Sample1.xml'); - } - - /** - * Test a valid RSS 0.91 sample - */ - public function testRss092Sample1() - { - $this->_importRssValid('RssTest092Sample1.xml'); - } - - /** - * Test a valid RSS 1.0 sample - */ - public function testRss100Sample1() - { - $feed = $this->_importRssValid('RssTest100Sample1.xml'); - $this->assertEquals(2, $feed->count()); - } - - /** - * Test a valid RSS 1.0 sample with some extensions in it - */ - public function testRss100Sample2() - { - $feed = $this->_importRssValid('RssTest100Sample2.xml'); - $this->assertEquals(1, $feed->count()); - } - - /** - * Test a valid RSS 2.0 sample - */ - public function testRss200Sample1() - { - $this->_importRssValid('RssTest200Sample1.xml'); - } - - /** - * Test the import of a RSS feed from an array - */ - public function testRssImportFullArray() - { - $feed = Feed\Feed::importArray($this->_getFullArray(), 'rss'); - $this->assertType('Zend\Feed\RSS', $feed); - } - - /** - * Test the import of a RSS feed from an array - * @group ZF-5833 - */ - public function testRssImportSetsIsPermaLinkAsFalseIfGuidNotAUri() - { - $feed = Feed\Feed::importArray($this->_getFullArray(), 'rss'); - $entry = $feed->current(); - $this->assertEquals('false', $entry->guid['isPermaLink']); - } - - /** - * Test the import of a RSS feed from an array - */ - public function testAtomImportFullArray() - { - $feed = Feed\Feed::importArray($this->_getFullArray(), 'atom'); - } - - /** - * Test the import of a RSS feed from a builder - */ - public function testRssImportFullBuilder() - { - $feed = Feed\Feed::importBuilder(new Builder\Builder($this->_getFullArray()), 'rss'); - $this->assertType('Zend\Feed\RSS', $feed); - } - - /** - * Test the import of a full iTunes RSS feed from a builder - */ - public function testRssImportFulliTunesBuilder() - { - $array = $this->_getFullArray(); - $array['itunes']['author'] = 'iTunes Author'; - $array['itunes']['owner'] = array('name' => 'iTunes Owner', - 'email' => 'itunes@example.com'); - $array['itunes']['image'] = 'http://www.example/itunes.png'; - $array['itunes']['subtitle'] = 'iTunes subtitle'; - $array['itunes']['summary'] = 'iTunes summary'; - $array['itunes']['explicit'] = 'clean'; - $array['itunes']['block'] = 'no'; - $array['itunes']['new-feed-url'] = 'http://www.example/itunes.xml'; - $feed = Feed\Feed::importBuilder(new Builder\Builder($array), 'rss'); - $this->assertType('Zend\Feed\RSS', $feed); - } - - /** - * Test the import of an Atom feed from a builder - */ - public function testAtomImportFullBuilder() - { - $feed = Feed\Feed::importBuilder(new Builder\Builder($this->_getFullArray()), 'atom'); - - } - - /** - * Test the import of an Atom feed from a builder - */ - public function testAtomImportFullBuilderValid() - { - $feed = Feed\Feed::importBuilder(new Builder\Builder($this->_getFullArray()), 'atom'); - - $feed = Feed\Feed::importString($feed->saveXml()); - $this->assertType('Zend\Feed\Atom', $feed); - } - - /** - * Check the validity of the builder import (rss) - */ - public function testRssImportFullBuilderValid() - { - $feed = Feed\Feed::importBuilder(new Builder\Builder($this->_getFullArray()), 'rss'); - $this->assertType('Zend\Feed\RSS', $feed); - $feed = Feed\Feed::importString($feed->saveXml()); - $this->assertType('Zend\Feed\RSS', $feed); - } - - /** - * Test the return of a link() call (atom) - */ - public function testAtomGetLink() - { - $feed = Feed\Feed::importBuilder(new Builder\Builder($this->_getFullArray()), 'atom'); - $this->assertType('Zend\Feed\Atom', $feed); - $feed = Feed\Feed::importString($feed->saveXml()); - $this->assertType('Zend\Feed\Atom', $feed); - $href = $feed->link('self'); - $this->assertEquals('http://www.example.com', $href); - } - - /** - * Imports an invalid feed and ensure everything works as expected - * even if XDebug is running (ZF-2590). - */ - public function testImportInvalidIsXdebugAware() - { - if (!function_exists('xdebug_is_enabled')) { - $this->markTestIncomplete('XDebug not installed'); - } - - $response = new Response\Response(200, array(), ''); - $this->_adapter->setResponse($response); - - try { - $feed = Feed\Feed::import('http://localhost'); - $this->fail('Expected Zend_Feed_Exception not thrown'); - } catch (Feed\Exception $e) { - $this->assertType('Zend\Feed\Exception', $e); - $this->assertRegExp('/(XDebug is running|Empty string)/', $e->getMessage()); - } - } - - /** - * Returns the array used by Zend_Feed::importArray - * and Zend_Feed::importBuilder tests - * - * @return array - */ - protected function _getFullArray() - { - $array = array('title' => 'Title of the feed', - 'link' => 'http://www.example.com', - 'description' => 'Description of the feed', - 'author' => 'Olivier Sirven', - 'email' => 'olivier@elma.fr', - 'webmaster' => 'olivier@elma.fr', - 'charset' => 'iso-8859-15', - 'lastUpdate' => time(), - 'published' => strtotime('2007-02-27'), - 'copyright' => 'Common Creative', - 'image' => 'http://www.example/images/icon.png', - 'language' => 'en', - 'ttl' => 60, - 'rating' => ' (PICS-1.1 "http://www.gcf.org/v2.5" labels - on "1994.11.05T08:15-0500" - exp "1995.12.31T23:59-0000" - for "http://www.greatdocs.com/foo.html" - by "George Sanderson, Jr." - ratings (suds 0.5 density 0 color/hue 1))', - 'cloud' => array('domain' => 'rpc.sys.com', - 'path' => '/rpc', - 'registerProcedure' => 'webServices.pingMe', - 'protocol' => 'xml-rpc'), - 'textInput' => array('title' => 'subscribe', - 'description' => 'enter your email address to subscribe by mail', - 'name' => 'email', - 'link' => 'http://www.example.com/subscribe'), - 'skipHours' => array(1, 13, 17), - 'skipDays' => array('Saturday', 'Sunday'), - 'itunes' => array('block' => 'no', - 'keywords' => 'example,itunes,podcast', - 'category' => array(array('main' => 'Technology', - 'sub' => 'Gadgets'), - array('main' => 'Music'))), - 'entries' => array(array('guid' => time(), - 'title' => 'First article', - 'link' => 'http://www.example.com', - 'description' => 'First article description', - 'content' => 'First article content', - 'lastUpdate' => time(), - 'comments' => 'http://www.example.com/#comments', - 'commentRss' => 'http://www.example.com/comments.xml', - 'source' => array('title' => 'Original title', - 'url' => 'http://www.domain.com'), - 'category' => array(array('term' => 'test category', - 'scheme' => 'http://www.example.com/scheme'), - array('term' => 'another category') - ), - 'enclosure' => array(array('url' => 'http://www.example.com/podcast.mp3', - 'type' => 'audio/mpeg', - 'length' => '12216320' - ), - array('url' => 'http://www.example.com/podcast2.mp3', - 'type' => 'audio/mpeg', - 'length' => '1221632' - ) - ) - ), - array('title' => 'Second article', - 'link' => 'http://www.example.com/two', - 'description' => 'Second article description', - 'content' => 'Second article content', - 'lastUpdate' => time(), - 'comments' => 'http://www.example.com/two/#comments', - 'category' => array(array('term' => 'test category')), - ) - ) - ); - return $array; - } - - /** - * Import an invalid atom feed - */ - protected function _importAtomValid($filename) - { - $response = new Response\Response(200, array(), file_get_contents("$this->_feedDir/$filename")); - $this->_adapter->setResponse($response); - - $feed = Feed\Feed::import('http://localhost'); - $this->assertType('Zend\Feed\Atom', $feed); - } - - /** - * Import a valid rss feed - */ - protected function _importRssValid($filename) - { - $response = new Response\Response(200, array(), file_get_contents("$this->_feedDir/$filename")); - $this->_adapter->setResponse($response); - - $feed = Feed\Feed::import('http://localhost'); - $this->assertType('Zend\Feed\RSS', $feed); - return $feed; - } - - /** - * Imports an invalid feed - */ - protected function _importInvalid($filename) - { - $response = new Response\Response(200, array(), file_get_contents("$this->_feedDir/$filename")); - $this->_adapter->setResponse($response); - - try { - $feed = Feed\Feed::import('http://localhost'); - $this->fail('Expected Zend_Feed_Exception not thrown'); - } catch (Feed\Exception $e) { - $this->assertType('Zend\Feed\Exception', $e); - } - } - - /** - * @issue ZF-5903 - */ - public function testFindFeedsIncludesUriAsArrayKey() - { - if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - ) { - $this->markTestSkipped('testFindFeedsIncludesUriAsArrayKey() requires a network connection'); - return; - } - Feed\Feed::setHttpClient(new HTTP\Client); - $feeds = Feed\Feed::findFeeds('http://www.planet-php.net'); - $this->assertEquals(array( - 'http://www.planet-php.org:80/rss/', 'http://www.planet-php.org:80/rdf/' - ), array_keys($feeds)); - } -} diff --git a/test/IteratorTest.php b/test/IteratorTest.php deleted file mode 100644 index 35289cce..00000000 --- a/test/IteratorTest.php +++ /dev/null @@ -1,126 +0,0 @@ -_feed = Feed\Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml'); - $this->_nsfeed = Feed\Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeedNamespaced.xml'); - } - - public function testRewind() - { - $times = 0; - foreach ($this->_feed as $f) { - ++$times; - } - - $times2 = 0; - foreach ($this->_feed as $f) { - ++$times2; - } - - $this->assertEquals($times, $times2, 'Feed should have the same number of iterations multiple times through'); - - $times = 0; - foreach ($this->_nsfeed as $f) { - ++$times; - } - - $times2 = 0; - foreach ($this->_nsfeed as $f) { - ++$times2; - } - - $this->assertEquals($times, $times2, 'Feed should have the same number of iterations multiple times through'); - } - - public function testCurrent() - { - foreach ($this->_feed as $f) { - $this->assertType('Zend\Feed\Entry\Atom', $f, 'Each feed entry should be an instance of Zend_Feed_Entry_Atom'); - break; - } - - foreach ($this->_nsfeed as $f) { - $this->assertType('Zend\Feed\Entry\Atom', $f, 'Each feed entry should be an instance of Zend_Feed_Entry_Atom'); - break; - } - } - - public function testKey() - { - $keys = array(); - foreach ($this->_feed as $k => $f) { - $keys[] = $k; - } - $this->assertEquals($keys, array(0, 1), 'Feed should have keys 0 and 1'); - - $keys = array(); - foreach ($this->_nsfeed as $k => $f) { - $keys[] = $k; - } - $this->assertEquals($keys, array(0, 1), 'Feed should have keys 0 and 1'); - } - - public function testNext() - { - $last = null; - foreach ($this->_feed as $current) { - $this->assertFalse($last === $current, 'Iteration should produce a new object each entry'); - $last = $current; - } - - $last = null; - foreach ($this->_nsfeed as $current) { - $this->assertFalse($last === $current, 'Iteration should produce a new object each entry'); - $last = $current; - } - } - -} diff --git a/test/Pubsubhubbub/AllTests.php b/test/Pubsubhubbub/AllTests.php new file mode 100644 index 00000000..4a6a161e --- /dev/null +++ b/test/Pubsubhubbub/AllTests.php @@ -0,0 +1,67 @@ +addTestSuite('Zend_Feed_Pubsubhubbub_PubsubhubbubTest'); + $suite->addTestSuite('Zend_Feed_Pubsubhubbub_PublisherTest'); + $suite->addTestSuite('Zend_Feed_Pubsubhubbub_SubscriberTest'); + $suite->addTestSuite('Zend_Feed_Pubsubhubbub_SubscriberHttpTest'); + $suite->addTestSuite('Zend_Feed_Pubsubhubbub_Subscriber_CallbackTest'); + + return $suite; + } +} + +if (PHPUnit_MAIN_METHOD == 'Zend_Feed_Pubsubhubbub_AllTests::main') { + Zend_Feed_Pubsubhubbub_AllTests::main(); +} diff --git a/test/Pubsubhubbub/PublisherTest.php b/test/Pubsubhubbub/PublisherTest.php index 4818cbc1..163936d8 100644 --- a/test/Pubsubhubbub/PublisherTest.php +++ b/test/Pubsubhubbub/PublisherTest.php @@ -16,15 +16,12 @@ * @package UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: PublisherTest.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Pubsubhubbub; -use Zend\HTTP; -use Zend\Feed\PubSubHubbub; +require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; + +require_once 'Zend/Feed/Pubsubhubbub/Publisher.php'; /** * @category Zend @@ -35,19 +32,16 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class PublisherTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Pubsubhubbub_PublisherTest extends PHPUnit_Framework_TestCase { - /** - * @var \Zend\Feed\PubSubHubbub\Publisher - */ protected $_publisher = null; public function setUp() { - $client = new HTTP\Client; - PubSubHubbub\PubSubHubbub::setHttpClient($client); - $this->_publisher = new PubSubHubbub\Publisher; + $client = new Zend_Http_Client; + Zend_Feed_Pubsubhubbub::setHttpClient($client); + $this->_publisher = new Zend_Feed_Pubsubhubbub_Publisher; } public function testAddsHubServerUrl() @@ -103,7 +97,7 @@ public function testThrowsExceptionOnSettingEmptyHubServerUrl() try { $this->_publisher->addHubUrl(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } @@ -112,7 +106,7 @@ public function testThrowsExceptionOnSettingNonStringHubServerUrl() try { $this->_publisher->addHubUrl(123); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } @@ -121,7 +115,7 @@ public function testThrowsExceptionOnSettingInvalidHubServerUrl() try { $this->_publisher->addHubUrl('http://'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testAddsUpdatedTopicUrl() @@ -177,7 +171,7 @@ public function testThrowsExceptionOnSettingEmptyUpdatedTopicUrl() try { $this->_publisher->addUpdatedTopicUrl(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } @@ -186,7 +180,7 @@ public function testThrowsExceptionOnSettingNonStringUpdatedTopicUrl() try { $this->_publisher->addUpdatedTopicUrl(123); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } @@ -195,7 +189,7 @@ public function testThrowsExceptionOnSettingInvalidUpdatedTopicUrl() try { $this->_publisher->addUpdatedTopicUrl('http://'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testAddsParameter() @@ -258,8 +252,8 @@ public function testRemovesParameterIfSetToNull() public function testNotifiesHubWithCorrectParameters() { - PubSubHubbub\PubSubHubbub::setHttpClient(new ClientSuccess); - $client = PubSubHubbub\PubSubHubbub::getHttpClient(); + Zend_Feed_Pubsubhubbub::setHttpClient(new Zend_Feed_Pubsubhubbub_PublisherTest_ClientSuccess); + $client = Zend_Feed_Pubsubhubbub::getHttpClient(); $this->_publisher->addHubUrl('http://www.example.com/hub'); $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); $this->_publisher->setParameter('foo', 'bar'); @@ -269,8 +263,8 @@ public function testNotifiesHubWithCorrectParameters() public function testNotifiesHubWithCorrectParametersAndMultipleTopics() { - PubSubHubbub\PubSubHubbub::setHttpClient(new ClientSuccess); - $client = PubSubHubbub\PubSubHubbub::getHttpClient(); + Zend_Feed_Pubsubhubbub::setHttpClient(new Zend_Feed_Pubsubhubbub_PublisherTest_ClientSuccess); + $client = Zend_Feed_Pubsubhubbub::getHttpClient(); $this->_publisher->addHubUrl('http://www.example.com/hub'); $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic2'); @@ -280,8 +274,8 @@ public function testNotifiesHubWithCorrectParametersAndMultipleTopics() public function testNotifiesHubAndReportsSuccess() { - PubSubHubbub\PubSubHubbub::setHttpClient(new ClientSuccess); - $client = PubSubHubbub\PubSubHubbub::getHttpClient(); + Zend_Feed_Pubsubhubbub::setHttpClient(new Zend_Feed_Pubsubhubbub_PublisherTest_ClientSuccess); + $client = Zend_Feed_Pubsubhubbub::getHttpClient(); $this->_publisher->addHubUrl('http://www.example.com/hub'); $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); $this->_publisher->setParameter('foo', 'bar'); @@ -291,8 +285,8 @@ public function testNotifiesHubAndReportsSuccess() public function testNotifiesHubAndReportsFail() { - PubSubHubbub\PubSubHubbub::setHttpClient(new ClientFail); - $client = PubSubHubbub\PubSubHubbub::getHttpClient(); + Zend_Feed_Pubsubhubbub::setHttpClient(new Zend_Feed_Pubsubhubbub_PublisherTest_ClientFail); + $client = Zend_Feed_Pubsubhubbub::getHttpClient(); $this->_publisher->addHubUrl('http://www.example.com/hub'); $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); $this->_publisher->setParameter('foo', 'bar'); @@ -304,27 +298,27 @@ public function testNotifiesHubAndReportsFail() // Some stubs for what Http_Client would be doing -class ClientSuccess extends HTTP\Client +class Zend_Feed_Pubsubhubbub_PublisherTest_ClientSuccess extends Zend_Http_Client { public function request($method = null) { - $response = new ResponseSuccess; + $response = new Zend_Feed_Pubsubhubbub_PublisherTest_ResponseSuccess; return $response; } public function getBody(){return $this->_prepareBody();} } -class ClientFail extends HTTP\Client +class Zend_Feed_Pubsubhubbub_PublisherTest_ClientFail extends Zend_Http_Client { public function request($method = null) { - $response = new ResponseFail; + $response = new Zend_Feed_Pubsubhubbub_PublisherTest_ResponseFail; return $response; } public function getBody(){return $this->_prepareBody();} } -class ResponseSuccess +class Zend_Feed_Pubsubhubbub_PublisherTest_ResponseSuccess { public function getStatus(){return 204;} } -class ResponseFail +class Zend_Feed_Pubsubhubbub_PublisherTest_ResponseFail { public function getStatus(){return 404;} } diff --git a/test/Pubsubhubbub/PubsubhubbubTest.php b/test/Pubsubhubbub/PubsubhubbubTest.php index a27b081c..417c77b9 100644 --- a/test/Pubsubhubbub/PubsubhubbubTest.php +++ b/test/Pubsubhubbub/PubsubhubbubTest.php @@ -16,14 +16,12 @@ * @package UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: PubsubhubbubTest.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Pubsubhubbub; -use Zend\Feed\PubSubHubbub; +require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; + +require_once 'Zend/Feed/Pubsubhubbub.php'; /** * @category Zend @@ -34,28 +32,28 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class PubsubhubbubTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Pubsubhubbub_PubsubhubbubTest extends PHPUnit_Framework_TestCase { public function teardown() { - PubSubHubbub\PubSubHubbub::clearHttpClient(); + Zend_Feed_Pubsubhubbub::clearHttpClient(); } public function testCanSetCustomHttpClient() { - PubSubHubbub\PubSubHubbub::setHttpClient(new Pubsub()); - $this->assertType('ZendTest\Feed\Pubsubhubbub\Pubsub', PubSubHubbub\PubSubHubbub::getHttpClient()); + Zend_Feed_Pubsubhubbub::setHttpClient(new Test_Http_Client_Pubsub()); + $this->assertType('Test_Http_Client_Pubsub', Zend_Feed_Pubsubhubbub::getHttpClient()); } public function testCanDetectHubs() { - $feed = \Zend\Feed\Reader\Reader::importFile(dirname(__FILE__) . '/_files/rss20.xml'); + $feed = Zend_Feed_Reader::importFile(dirname(__FILE__) . '/_files/rss20.xml'); $this->assertEquals(array( 'http://www.example.com/hub', 'http://www.example.com/hub2' - ), PubSubHubbub\PubSubHubbub::detectHubs($feed)); + ), Zend_Feed_Pubsubhubbub::detectHubs($feed)); } } -class Pubsub extends \Zend\HTTP\Client {} +class Test_Http_Client_Pubsub extends Zend_Http_Client {} diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php index 48df1201..30ddc2c6 100644 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -16,16 +16,12 @@ * @package UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: CallbackTest.php 20723 2010-01-28 19:21:33Z padraic $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Pubsubhubbub\Subscriber; -use Zend\Feed\PubSubHubbub\Model; -use Zend\Feed\PubSubHubbub; -use Zend\Date; +require_once 'Zend/Feed/Pubsubhubbub/Subscriber/Callback.php'; +require_once 'Zend/Feed/Pubsubhubbub/Model/Subscription.php'; +require_once 'Zend/Db/Table/Rowset/Abstract.php'; /** * @category Zend @@ -36,28 +32,28 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class CallbackTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Pubsubhubbub_Subscriber_CallbackTest extends PHPUnit_Framework_TestCase { protected $_originalServer = null; public function setUp() { - $this->_callback = new \Zend\Feed\PubSubHubbub\Subscriber\Callback; + $this->_callback = new Zend_Feed_Pubsubhubbub_Subscriber_Callback; $this->_adapter = $this->_getCleanMock( - '\Zend\DB\Adapter\AbstractAdapter' + 'Zend_Db_Adapter_Abstract' ); $this->_tableGateway = $this->_getCleanMock( - '\Zend\DB\Table\AbstractTable' + 'Zend_Db_Table_Abstract' ); $this->_rowset = $this->_getCleanMock( - '\Zend\DB\Table\Rowset\AbstractRowset' + 'Zend_Db_Table_Rowset_Abstract' ); $this->_tableGateway->expects($this->any())->method('getAdapter') ->will($this->returnValue($this->_adapter)); - $storage = new Model\Subscription($this->_tableGateway); + $storage = new Zend_Feed_Pubsubhubbub_Model_Subscription($this->_tableGateway); $this->_callback->setStorage($storage); $this->_get = array( @@ -82,21 +78,21 @@ public function tearDown() public function testCanSetHttpResponseObject() { - $this->_callback->setHttpResponse(new PubSubHubbub\HttpResponse); - $this->assertTrue($this->_callback->getHttpResponse() instanceof PubSubHubbub\HttpResponse); + $this->_callback->setHttpResponse(new Zend_Feed_Pubsubhubbub_HttpResponse); + $this->assertTrue($this->_callback->getHttpResponse() instanceof Zend_Feed_Pubsubhubbub_HttpResponse); } public function testCanUsesDefaultHttpResponseObject() { - $this->assertTrue($this->_callback->getHttpResponse() instanceof PubSubHubbub\HttpResponse); + $this->assertTrue($this->_callback->getHttpResponse() instanceof Zend_Feed_Pubsubhubbub_HttpResponse); } public function testThrowsExceptionOnInvalidHttpResponseObjectSet() { try { - $this->_callback->setHttpResponse(new \stdClass); + $this->_callback->setHttpResponse(new stdClass); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testThrowsExceptionIfNonObjectSetAsHttpResponseObject() @@ -104,7 +100,7 @@ public function testThrowsExceptionIfNonObjectSetAsHttpResponseObject() try { $this->_callback->setHttpResponse(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testCanSetSubscriberCount() @@ -123,7 +119,7 @@ public function testThrowsExceptionOnSettingZeroAsSubscriberCount() try { $this->_callback->setSubscriberCount(0); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testThrowsExceptionOnSettingLessThanZeroAsSubscriberCount() @@ -131,7 +127,7 @@ public function testThrowsExceptionOnSettingLessThanZeroAsSubscriberCount() try { $this->_callback->setSubscriberCount(-1); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntegerAsSubscriberCount() @@ -139,13 +135,13 @@ public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntege try { $this->_callback->setSubscriberCount('0aa'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testCanSetStorageImplementation() { - $storage = new Model\Subscription($this->_tableGateway); + $storage = new Zend_Feed_Pubsubhubbub_Model_Subscription($this->_tableGateway); $this->_callback->setStorage($storage); $this->assertThat($this->_callback->getStorage(), $this->identicalTo($storage)); } @@ -253,11 +249,11 @@ public function testRespondsToValidConfirmationWith200Response() ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); - $rowdata = new \stdClass; + $rowdata = new stdClass; $rowdata->id = 'verifytokenkey'; $rowdata->verify_token = hash('sha256', 'cba'); - $t = new Date\Date; - $rowdata->created_time = $t->get(Date\Date::TIMESTAMP); + $t = new Zend_Date; + $rowdata->created_time = $t->get(Zend_Date::TIMESTAMP); $rowdata->lease_seconds = 10000; $this->_rowset->expects($this->any()) ->method('current') @@ -266,7 +262,7 @@ public function testRespondsToValidConfirmationWith200Response() $this->_tableGateway->expects($this->once()) ->method('update') ->with( - $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Date\Date::TIMESTAMP),'lease_seconds'=>1234567,'subscription_state'=>'verified','expiration_time'=>$t->add(1234567,Date\Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), + $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Zend_Date::TIMESTAMP),'lease_seconds'=>1234567,'subscription_state'=>'verified','expiration_time'=>$t->add(1234567,Zend_Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), $this->equalTo('id = \'verifytokenkey\'') ); $this->_adapter->expects($this->once()) @@ -284,11 +280,11 @@ public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); - $rowdata = new \stdClass; + $rowdata = new stdClass; $rowdata->id = 'verifytokenkey'; $rowdata->verify_token = hash('sha256', 'cba'); - $t = new Date\Date; - $rowdata->created_time = $t->get(Date\Date::TIMESTAMP); + $t = new Zend_Date; + $rowdata->created_time = $t->get(Zend_Date::TIMESTAMP); $rowdata->lease_seconds = 10000; $this->_rowset->expects($this->any()) ->method('current') @@ -297,7 +293,7 @@ public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() $this->_tableGateway->expects($this->once()) ->method('update') ->with( - $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Date\Date::TIMESTAMP),'lease_seconds'=>1234567,'subscription_state'=>'verified','expiration_time'=>$t->add(1234567,Date\Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), + $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Zend_Date::TIMESTAMP),'lease_seconds'=>1234567,'subscription_state'=>'verified','expiration_time'=>$t->add(1234567,Zend_Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), $this->equalTo('id = \'verifytokenkey\'') ); $this->_adapter->expects($this->once()) @@ -320,7 +316,7 @@ public function testRespondsToValidFeedUpdateRequestWith200Response() ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); - $rowdata = new \stdClass; + $rowdata = new stdClass; $rowdata->id = 'verifytokenkey'; $rowdata->verify_token = hash('sha256', 'cba'); $t = time(); @@ -374,7 +370,7 @@ public function testRespondsToInvalidFeedUpdateWrongFeedTypeForMimeWith200Respon ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); - $rowdata = new \stdClass; + $rowdata = new stdClass; $rowdata->id = 'verifytokenkey'; $rowdata->verify_token = hash('sha256', 'cba'); $t = time(); @@ -399,7 +395,7 @@ public function testRespondsToValidFeedUpdateWithXHubOnBehalfOfHeader() ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); - $rowdata = new \stdClass; + $rowdata = new stdClass; $rowdata->id = 'verifytokenkey'; $rowdata->verify_token = hash('sha256', 'cba'); $t = time(); @@ -413,7 +409,7 @@ public function testRespondsToValidFeedUpdateWithXHubOnBehalfOfHeader() } protected function _getCleanMock($className) { - $class = new \ReflectionClass($className); + $class = new ReflectionClass($className); $methods = $class->getMethods(); $stubMethods = array(); foreach ($methods as $method) { @@ -426,7 +422,7 @@ protected function _getCleanMock($className) { $className, $stubMethods, array(), - str_replace('\\', '_', ($className . '_PubsubSubscriberMock_' . uniqid())), + $className . '_PubsubSubscriberMock_' . uniqid(), false ); return $mocked; diff --git a/test/Pubsubhubbub/SubscriberHttpTest.php b/test/Pubsubhubbub/SubscriberHttpTest.php index 2f061630..9d7e5aec 100644 --- a/test/Pubsubhubbub/SubscriberHttpTest.php +++ b/test/Pubsubhubbub/SubscriberHttpTest.php @@ -16,13 +16,15 @@ * @package UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: SubscriberHttpTest.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Pubsubhubbub; +require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; + +require_once 'Zend/Feed/Pubsubhubbub/Subscriber.php'; +require_once 'Zend/Http/Client.php'; +require_once 'Zend/Http/Client/Adapter/Socket.php'; +require_once 'Zend/Uri/Http.php'; /** * Note that $this->_baseuri must point to a directory on a web server @@ -41,7 +43,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class SubscriberHttpTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Pubsubhubbub_SubscriberHttpTest extends PHPUnit_Framework_TestCase { protected $_subscriber = null; @@ -59,7 +61,7 @@ class SubscriberHttpTest extends \PHPUnit_Framework_TestCase public function setUp() { if (defined('TESTS_Zend_Feed_Pubsubhubbub_BASEURI') && - \Zend\URI\URL::check(TESTS_Zend_Feed_Pubsubhubbub_BASEURI)) { + Zend_Uri_Http::check(TESTS_Zend_Feed_Pubsubhubbub_BASEURI)) { $this->_baseuri = TESTS_Zend_Feed_Pubsubhubbub_BASEURI; if (substr($this->_baseuri, -1) != '/') $this->_baseuri .= '/'; $name = $this->getName(); @@ -68,10 +70,10 @@ public function setUp() } $uri = $this->_baseuri . $name . '.php'; $this->_adapter = new $this->_config['adapter']; - $this->_client = new \Zend\HTTP\Client($uri, $this->_config); + $this->_client = new Zend_Http_Client($uri, $this->_config); $this->_client->setAdapter($this->_adapter); - \Zend\Feed\PubSubHubbub\PubSubHubbub::setHttpClient($this->_client); - $this->_subscriber = new \Zend\Feed\PubSubHubbub\Subscriber\Subscriber; + Zend_Feed_Pubsubhubbub::setHttpClient($this->_client); + $this->_subscriber = new Zend_Feed_Pubsubhubbub_Subscriber; $this->_storage = $this->_getCleanMock('Zend_Feed_Pubsubhubbub_Entity_TopicSubscription'); @@ -115,7 +117,7 @@ public function testUnsubscriptionRequestSendsExpectedPostData() } protected function _getCleanMock($className) { - $class = new \ReflectionClass($className); + $class = new ReflectionClass($className); $methods = $class->getMethods(); $stubMethods = array(); foreach ($methods as $method) { diff --git a/test/Pubsubhubbub/SubscriberTest.php b/test/Pubsubhubbub/SubscriberTest.php index 193f3939..1ebedf29 100644 --- a/test/Pubsubhubbub/SubscriberTest.php +++ b/test/Pubsubhubbub/SubscriberTest.php @@ -16,18 +16,13 @@ * @package UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: SubscriberTest.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Pubsubhubbub; -use Zend\DB\Adapter; +require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; -use Zend\DB\Table; - -use Zend\Feed\PubSubHubbub; +require_once 'Zend/Feed/Pubsubhubbub/Subscriber.php'; +require_once 'Zend/Feed/Pubsubhubbub/Model/Subscription.php'; /** * @category Zend @@ -38,7 +33,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class SubscriberTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Pubsubhubbub_SubscriberTest extends PHPUnit_Framework_TestCase { protected $_subscriber = null; @@ -49,14 +44,14 @@ class SubscriberTest extends \PHPUnit_Framework_TestCase public function setUp() { - $client = new \Zend\HTTP\Client; - PubSubHubbub\PubSubHubbub::setHttpClient($client); - $this->_subscriber = new \Zend\Feed\PubSubHubbub\Subscriber\Subscriber; + $client = new Zend_Http_Client; + Zend_Feed_Pubsubhubbub::setHttpClient($client); + $this->_subscriber = new Zend_Feed_Pubsubhubbub_Subscriber; $this->_adapter = $this->_getCleanMock( - '\Zend\DB\Adapter\AbstractAdapter' + 'Zend_Db_Adapter_Abstract' ); $this->_tableGateway = $this->_getCleanMock( - '\Zend\DB\Table\AbstractTable' + 'Zend_Db_Table_Abstract' ); $this->_tableGateway->expects($this->any())->method('getAdapter') ->will($this->returnValue($this->_adapter)); @@ -116,7 +111,7 @@ public function testThrowsExceptionOnSettingEmptyHubServerUrl() try { $this->_subscriber->addHubUrl(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testThrowsExceptionOnSettingNonStringHubServerUrl() @@ -124,7 +119,7 @@ public function testThrowsExceptionOnSettingNonStringHubServerUrl() try { $this->_subscriber->addHubUrl(123); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testThrowsExceptionOnSettingInvalidHubServerUrl() @@ -132,7 +127,7 @@ public function testThrowsExceptionOnSettingInvalidHubServerUrl() try { $this->_subscriber->addHubUrl('http://'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testAddsParameter() @@ -204,7 +199,7 @@ public function testThrowsExceptionOnSettingEmptyTopicUrl() try { $this->_subscriber->setTopicUrl(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } @@ -213,7 +208,7 @@ public function testThrowsExceptionOnSettingNonStringTopicUrl() try { $this->_subscriber->setTopicUrl(123); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } @@ -222,7 +217,7 @@ public function testThrowsExceptionOnSettingInvalidTopicUrl() try { $this->_subscriber->setTopicUrl('http://'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testThrowsExceptionOnMissingTopicUrl() @@ -230,7 +225,7 @@ public function testThrowsExceptionOnMissingTopicUrl() try { $this->_subscriber->getTopicUrl(); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testCanSetCallbackUrl() @@ -244,7 +239,7 @@ public function testThrowsExceptionOnSettingEmptyCallbackUrl() try { $this->_subscriber->setCallbackUrl(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } @@ -253,7 +248,7 @@ public function testThrowsExceptionOnSettingNonStringCallbackUrl() try { $this->_subscriber->setCallbackUrl(123); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } @@ -262,7 +257,7 @@ public function testThrowsExceptionOnSettingInvalidCallbackUrl() try { $this->_subscriber->setCallbackUrl('http://'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testThrowsExceptionOnMissingCallbackUrl() @@ -270,7 +265,7 @@ public function testThrowsExceptionOnMissingCallbackUrl() try { $this->_subscriber->getCallbackUrl(); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testCanSetLeaseSeconds() @@ -284,7 +279,7 @@ public function testThrowsExceptionOnSettingZeroAsLeaseSeconds() try { $this->_subscriber->setLeaseSeconds(0); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testThrowsExceptionOnSettingLessThanZeroAsLeaseSeconds() @@ -292,7 +287,7 @@ public function testThrowsExceptionOnSettingLessThanZeroAsLeaseSeconds() try { $this->_subscriber->setLeaseSeconds(-1); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntegerAsLeaseSeconds() @@ -300,13 +295,13 @@ public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntege try { $this->_subscriber->setLeaseSeconds('0aa'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testCanSetPreferredVerificationMode() { - $this->_subscriber->setPreferredVerificationMode(PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_ASYNC); - $this->assertEquals(PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_ASYNC, $this->_subscriber->getPreferredVerificationMode()); + $this->_subscriber->setPreferredVerificationMode(Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC); + $this->assertEquals(Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC, $this->_subscriber->getPreferredVerificationMode()); } public function testSetsPreferredVerificationModeThrowsExceptionOnSettingBadMode() @@ -314,43 +309,44 @@ public function testSetsPreferredVerificationModeThrowsExceptionOnSettingBadMode try { $this->_subscriber->setPreferredVerificationMode('abc'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} } public function testPreferredVerificationModeDefaultsToSync() { - $this->assertEquals(PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_SYNC, $this->_subscriber->getPreferredVerificationMode()); + $this->assertEquals(Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC, $this->_subscriber->getPreferredVerificationMode()); } public function testCanSetStorageImplementation() { - $storage = new \Zend\Feed\PubSubHubbub\Model\Subscription($this->_tableGateway); + $storage = new Zend_Feed_Pubsubhubbub_Model_Subscription($this->_tableGateway); $this->_subscriber->setStorage($storage); $this->assertThat($this->_subscriber->getStorage(), $this->identicalTo($storage)); } - + /** + * @expectedException Zend_Feed_Pubsubhubbub_Exception + */ public function testGetStorageThrowsExceptionIfNoneSet() { - $this->setExpectedException('Zend\Feed\PubSubHubbub\Exception'); $this->_subscriber->getStorage(); } protected function _getCleanMock($className) { - $class = new \ReflectionClass($className); + $class = new ReflectionClass($className); $methods = $class->getMethods(); $stubMethods = array(); foreach ($methods as $method) { if ($method->isPublic() || ($method->isProtected() - && $method->isAbstract())) { - $stubMethods[] = $method->getName(); + && $method->isAbstract())) { + $stubMethods[] = $method->getName(); } } $mocked = $this->getMock( $className, $stubMethods, array(), - str_replace('\\', '_', ($className . '_PubsubSubscriberMock_' . uniqid())), + $className . '_PubsubSubscriberMock_' . uniqid(), false ); return $mocked; diff --git a/test/Reader/Entry/AtomStandaloneEntryTest.php b/test/Reader/Entry/AtomStandaloneEntryTest.php index ae98e0dd..d5a5a452 100644 --- a/test/Reader/Entry/AtomStandaloneEntryTest.php +++ b/test/Reader/Entry/AtomStandaloneEntryTest.php @@ -20,12 +20,8 @@ * @version $Id: AtomTest.php 19159 2009-11-21 14:23:15Z padraic $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Reader\Entry; -use Zend\Feed\Reader; -use Zend\Date; +require_once 'PHPUnit/Framework/TestCase.php'; +require_once 'Zend/Feed/Reader.php'; /** * @category Zend @@ -36,7 +32,7 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class AtomStandaloneEntryTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Reader_Entry_AtomStandaloneEntryTest extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -47,19 +43,19 @@ class AtomStandaloneEntryTest extends \PHPUnit_Framework_TestCase public function setup() { - Reader\Reader::reset(); - if (\Zend\Registry::isRegistered('Zend_Locale')) { - $registry = \Zend\Registry::getInstance(); + Zend_Feed_Reader::reset(); + if (Zend_Registry::isRegistered('Zend_Locale')) { + $registry = Zend_Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/AtomStandaloneEntry'; - $this->_options = Date\Date::setOptions(); + $this->_options = Zend_Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Date\Date::setOptions(array('format_type'=>'iso')); + Zend_Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -93,15 +89,15 @@ public function setup() public function teardown() { - Date\Date::setOptions($this->_options); + Zend_Date::setOptions($this->_options); } public function testReaderImportOfAtomEntryDocumentReturnsEntryClass() { - $object = Reader\Reader::importString( + $object = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/id/atom10.xml') ); - $this->assertTrue($object instanceof \Zend\Feed\Reader\Entry\Atom); + $this->assertTrue($object instanceof Zend_Feed_Reader_Entry_Atom); } /** @@ -110,7 +106,7 @@ public function testReaderImportOfAtomEntryDocumentReturnsEntryClass() */ public function testGetsIdFromAtom10() { - $entry = Reader\Reader::importString( + $entry = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/id/atom10.xml') ); $this->assertEquals('1', $entry->getId()); @@ -122,11 +118,11 @@ public function testGetsIdFromAtom10() */ public function testGetsDateCreatedFromAtom10() { - $entry = Reader\Reader::importString( + $entry = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/atom10.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateCreated())); } @@ -136,11 +132,11 @@ public function testGetsDateCreatedFromAtom10() */ public function testGetsDateModifiedFromAtom10() { - $entry = Reader\Reader::importString( + $entry = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/atom10.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } @@ -150,7 +146,7 @@ public function testGetsDateModifiedFromAtom10() */ public function testGetsTitleFromAtom10() { - $entry = Reader\Reader::importString( + $entry = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/title/atom10.xml') ); $this->assertEquals('Entry Title', $entry->getTitle()); @@ -162,7 +158,7 @@ public function testGetsTitleFromAtom10() */ public function testGetsAuthorsFromAtom10() { - $entry = Reader\Reader::importString( + $entry = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/author/atom10.xml') ); @@ -184,7 +180,7 @@ public function testGetsAuthorsFromAtom10() */ public function testGetsAuthorFromAtom10() { - $entry = Reader\Reader::importString( + $entry = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/author/atom10.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com','uri'=>'http://www.example.com'), $entry->getAuthor()); @@ -196,7 +192,7 @@ public function testGetsAuthorFromAtom10() */ public function testGetsDescriptionFromAtom10() { - $entry = Reader\Reader::importString( + $entry = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/description/atom10.xml') ); $this->assertEquals('Entry Description', $entry->getDescription()); @@ -208,11 +204,11 @@ public function testGetsDescriptionFromAtom10() */ public function testGetsEnclosureFromAtom10() { - $entry = Reader\Reader::importString( + $entry = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/enclosure/atom10.xml') ); - $expected = new \stdClass(); + $expected = new stdClass(); $expected->url = 'http://www.example.org/myaudiofile.mp3'; $expected->length = '1234'; $expected->type = 'audio/mpeg'; @@ -226,7 +222,7 @@ public function testGetsEnclosureFromAtom10() */ public function testGetsContentFromAtom10() { - $entry = Reader\Reader::importString( + $entry = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/content/atom10.xml') ); $this->assertEquals('Entry Content &', $entry->getContent()); @@ -238,7 +234,7 @@ public function testGetsContentFromAtom10() */ public function testGetsContentFromAtom10Html() { - $entry = Reader\Reader::importString( + $entry = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/content/atom10_Html.xml') ); $this->assertEquals('

Entry Content &

', $entry->getContent()); @@ -250,7 +246,7 @@ public function testGetsContentFromAtom10Html() */ public function testGetsContentFromAtom10HtmlCdata() { - $entry = Reader\Reader::importString( + $entry = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/content/atom10_HtmlCdata.xml') ); $this->assertEquals('

Entry Content &

', $entry->getContent()); @@ -262,7 +258,7 @@ public function testGetsContentFromAtom10HtmlCdata() */ public function testGetsContentFromAtom10XhtmlNamespaced() { - $entry = Reader\Reader::importString( + $entry = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/content/atom10_Xhtml.xml') ); $this->assertEquals('

Entry Content &x:

', $entry->getContent()); @@ -274,7 +270,7 @@ public function testGetsContentFromAtom10XhtmlNamespaced() */ public function testGetsLinkFromAtom10() { - $entry = Reader\Reader::importString( + $entry = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/link/atom10.xml') ); $this->assertEquals('http://www.example.com/entry', $entry->getLink()); @@ -286,7 +282,7 @@ public function testGetsLinkFromAtom10() */ public function testGetsCommentLinkFromAtom10() { - $entry = Reader\Reader::importString( + $entry = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/commentlink/atom10.xml') ); $this->assertEquals('http://www.example.com/entry/comments', $entry->getCommentLink()); @@ -298,7 +294,7 @@ public function testGetsCommentLinkFromAtom10() */ public function testGetsCategoriesFromAtom10() { - $entry = Reader\Reader::importString( + $entry = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/atom10.xml') ); $this->assertEquals($this->_expectedCats, (array) $entry->getCategories()); diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index 7114e82a..57ffe9d4 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -17,15 +17,11 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: AtomTest.php 20462 2010-01-21 15:23:52Z padraic $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Reader\Entry; -use Zend\Feed\Reader; -use Zend\Date; +require_once 'PHPUnit/Framework/TestCase.php'; +require_once 'Zend/Feed/Reader.php'; /** * @category Zend @@ -36,7 +32,7 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class AtomTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Reader_Entry_AtomTest extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -47,19 +43,19 @@ class AtomTest extends \PHPUnit_Framework_TestCase public function setup() { - Reader\Reader::reset(); - if (\Zend\Registry::isRegistered('Zend_Locale')) { - $registry = \Zend\Registry::getInstance(); + Zend_Feed_Reader::reset(); + if (Zend_Registry::isRegistered('Zend_Locale')) { + $registry = Zend_Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Atom'; - $this->_options = Date\Date::setOptions(); + $this->_options = Zend_Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Date\Date::setOptions(array('format_type'=>'iso')); + Zend_Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -93,7 +89,7 @@ public function setup() public function teardown() { - Date\Date::setOptions($this->_options); + Zend_Date::setOptions($this->_options); } /** @@ -102,7 +98,7 @@ public function teardown() */ public function testGetsIdFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/id/plain/atom03.xml') ); $entry = $feed->current(); @@ -111,7 +107,7 @@ public function testGetsIdFromAtom03() public function testGetsIdFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/id/plain/atom10.xml') ); $entry = $feed->current(); @@ -123,23 +119,23 @@ public function testGetsIdFromAtom10() */ public function testGetsDateCreatedFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom03.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateCreated())); } public function testGetsDateCreatedFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom10.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateCreated())); } @@ -148,23 +144,23 @@ public function testGetsDateCreatedFromAtom10() */ public function testGetsDateModifiedFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom03.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom10.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } @@ -173,7 +169,7 @@ public function testGetsDateModifiedFromAtom10() */ public function testGetsTitleFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/title/plain/atom03.xml') ); $entry = $feed->current(); @@ -182,7 +178,7 @@ public function testGetsTitleFromAtom03() public function testGetsTitleFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/title/plain/atom10.xml') ); $entry = $feed->current(); @@ -194,7 +190,7 @@ public function testGetsTitleFromAtom10() */ public function testGetsAuthorsFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/author/plain/atom03.xml') ); @@ -213,7 +209,7 @@ public function testGetsAuthorsFromAtom03() public function testGetsAuthorsFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/author/plain/atom10.xml') ); @@ -235,7 +231,7 @@ public function testGetsAuthorsFromAtom10() */ public function testGetsAuthorFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/author/plain/atom03.xml') ); $entry = $feed->current(); @@ -244,7 +240,7 @@ public function testGetsAuthorFromAtom03() public function testGetsAuthorFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/author/plain/atom10.xml') ); $entry = $feed->current(); @@ -256,7 +252,7 @@ public function testGetsAuthorFromAtom10() */ public function testGetsDescriptionFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/description/plain/atom03.xml') ); $entry = $feed->current(); @@ -265,7 +261,7 @@ public function testGetsDescriptionFromAtom03() public function testGetsDescriptionFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/description/plain/atom10.xml') ); $entry = $feed->current(); @@ -277,12 +273,12 @@ public function testGetsDescriptionFromAtom10() */ public function testGetsEnclosureFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/enclosure/plain/atom03.xml') ); $entry = $feed->current(); - $expected = new \stdClass(); + $expected = new stdClass(); $expected->url = 'http://www.example.org/myaudiofile.mp3'; $expected->length = '1234'; $expected->type = 'audio/mpeg'; @@ -292,12 +288,12 @@ public function testGetsEnclosureFromAtom03() public function testGetsEnclosureFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/enclosure/plain/atom10.xml') ); $entry = $feed->current(); - $expected = new \stdClass(); + $expected = new stdClass(); $expected->url = 'http://www.example.org/myaudiofile.mp3'; $expected->length = '1234'; $expected->type = 'audio/mpeg'; @@ -310,7 +306,7 @@ public function testGetsEnclosureFromAtom10() */ public function testGetsContentFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/content/plain/atom03.xml') ); $entry = $feed->current(); @@ -323,7 +319,7 @@ public function testGetsContentFromAtom03() */ public function testGetsContentFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/content/plain/atom10.xml') ); $entry = $feed->current(); @@ -336,7 +332,7 @@ public function testGetsContentFromAtom10() */ public function testGetsContentFromAtom10Html() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/content/plain/atom10_Html.xml') ); $entry = $feed->current(); @@ -349,7 +345,7 @@ public function testGetsContentFromAtom10Html() */ public function testGetsContentFromAtom10HtmlCdata() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/content/plain/atom10_HtmlCdata.xml') ); $entry = $feed->current(); @@ -362,7 +358,7 @@ public function testGetsContentFromAtom10HtmlCdata() */ public function testGetsContentFromAtom10XhtmlNamespaced() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/content/plain/atom10_Xhtml.xml') ); $entry = $feed->current(); @@ -374,7 +370,7 @@ public function testGetsContentFromAtom10XhtmlNamespaced() */ public function testGetsLinkFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/link/plain/atom03.xml') ); $entry = $feed->current(); @@ -383,7 +379,7 @@ public function testGetsLinkFromAtom03() public function testGetsLinkFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/link/plain/atom10.xml') ); $entry = $feed->current(); @@ -392,7 +388,7 @@ public function testGetsLinkFromAtom10() public function testGetsLinkFromAtom10_WithNoRelAttribute() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/link/plain/atom10-norel.xml') ); $entry = $feed->current(); @@ -401,7 +397,7 @@ public function testGetsLinkFromAtom10_WithNoRelAttribute() public function testGetsLinkFromAtom10_WithRelativeUrl() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/link/plain/atom10-relative.xml') ); $entry = $feed->current(); @@ -413,7 +409,7 @@ public function testGetsLinkFromAtom10_WithRelativeUrl() */ public function testGetsBaseUriFromAtom10_FromFeedElement() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/baseurl/plain/atom10-feedlevel.xml') ); $entry = $feed->current(); @@ -422,7 +418,7 @@ public function testGetsBaseUriFromAtom10_FromFeedElement() public function testGetsBaseUriFromAtom10_FromEntryElement() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/baseurl/plain/atom10-entrylevel.xml') ); $entry = $feed->current(); @@ -434,7 +430,7 @@ public function testGetsBaseUriFromAtom10_FromEntryElement() */ public function testGetsCommentLinkFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/commentlink/plain/atom03.xml') ); $entry = $feed->current(); @@ -443,7 +439,7 @@ public function testGetsCommentLinkFromAtom03() public function testGetsCommentLinkFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/commentlink/plain/atom10.xml') ); $entry = $feed->current(); @@ -452,7 +448,7 @@ public function testGetsCommentLinkFromAtom10() public function testGetsCommentLinkFromAtom10_RelativeLinks() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/commentlink/plain/atom10-relative.xml') ); $entry = $feed->current(); @@ -467,7 +463,7 @@ public function testGetsCommentLinkFromAtom10_RelativeLinks() public function testGetsCategoriesFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10.xml') ); $entry = $feed->current(); @@ -477,7 +473,7 @@ public function testGetsCategoriesFromAtom10() public function testGetsCategoriesFromAtom03_Atom10Extension() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom03.xml') ); $entry = $feed->current(); @@ -489,7 +485,7 @@ public function testGetsCategoriesFromAtom03_Atom10Extension() public function testGetsCategoriesFromAtom03_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/atom03.xml') ); $entry = $feed->current(); @@ -499,7 +495,7 @@ public function testGetsCategoriesFromAtom03_Dc10() public function testGetsCategoriesFromAtom03_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/atom03.xml') ); $entry = $feed->current(); @@ -511,7 +507,7 @@ public function testGetsCategoriesFromAtom03_Dc11() public function testGetsCategoriesFromAtom10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/atom10.xml') ); $entry = $feed->current(); @@ -521,7 +517,7 @@ public function testGetsCategoriesFromAtom10_None() public function testGetsCategoriesFromAtom03_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/atom03.xml') ); $entry = $feed->current(); diff --git a/test/Reader/Entry/CommonTest.php b/test/Reader/Entry/CommonTest.php index 9a78a942..ba5c9802 100644 --- a/test/Reader/Entry/CommonTest.php +++ b/test/Reader/Entry/CommonTest.php @@ -17,14 +17,11 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: CommonTest.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Reader\Entry; -use Zend\Feed\Reader; +require_once 'PHPUnit/Framework/TestCase.php'; +require_once 'Zend/Feed/Reader.php'; /** * @category Zend @@ -35,16 +32,16 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class CommonTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Reader_Entry_CommonTest extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Reader\Reader::reset(); - if (\Zend\Registry::isRegistered('Zend_Locale')) { - $registry = \Zend\Registry::getInstance(); + Zend_Feed_Reader::reset(); + if (Zend_Registry::isRegistered('Zend_Locale')) { + $registry = Zend_Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Common'; @@ -55,25 +52,25 @@ public function setup() */ public function testGetsDomDocumentObject() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); - $this->assertTrue($entry->getDomDocument() instanceof \DOMDocument); + $this->assertTrue($entry->getDomDocument() instanceof DOMDocument); } public function testGetsDomXpathObject() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); - $this->assertTrue($entry->getXpath() instanceof \DOMXPath); + $this->assertTrue($entry->getXpath() instanceof DOMXPath); } public function testGetsXpathPrefixString() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); @@ -82,16 +79,16 @@ public function testGetsXpathPrefixString() public function testGetsDomElementObject() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); - $this->assertTrue($entry->getElement() instanceof \DOMElement); + $this->assertTrue($entry->getElement() instanceof DOMElement); } public function testSaveXmlOutputsXmlStringForEntry() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); @@ -100,16 +97,16 @@ public function testSaveXmlOutputsXmlStringForEntry() public function testGetsNamedExtension() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); - $this->assertTrue($entry->getExtension('Atom') instanceof \Zend\Feed\Reader\Extension\Atom\Entry); + $this->assertTrue($entry->getExtension('Atom') instanceof Zend_Feed_Reader_Extension_Atom_Entry); } public function testReturnsNullIfExtensionDoesNotExist() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); @@ -121,7 +118,7 @@ public function testReturnsNullIfExtensionDoesNotExist() */ public function testReturnsEncodingOfFeed() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); @@ -133,7 +130,7 @@ public function testReturnsEncodingOfFeed() */ public function testReturnsEncodingOfFeedAsUtf8IfUndefined() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom_noencodingdefined.xml') ); $entry = $feed->current(); diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index b99c7942..48f01e24 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -17,15 +17,11 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: RssTest.php 22086 2010-05-04 11:25:54Z padraic $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Reader\Entry; -use Zend\Feed\Reader; -use Zend\Date; +require_once 'PHPUnit/Framework/TestCase.php'; +require_once 'Zend/Feed/Reader.php'; /** * @category Zend @@ -36,7 +32,7 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class RssTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Reader_Entry_RssTest extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -49,19 +45,19 @@ class RssTest extends \PHPUnit_Framework_TestCase public function setup() { - Reader\Reader::reset(); - if (\Zend\Registry::isRegistered('Zend_Locale')) { - $registry = \Zend\Registry::getInstance(); + Zend_Feed_Reader::reset(); + if (Zend_Registry::isRegistered('Zend_Locale')) { + $registry = Zend_Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Rss'; - $this->_options = Date\Date::setOptions(); + $this->_options = Zend_Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Date\Date::setOptions(array('format_type'=>'iso')); + Zend_Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -112,7 +108,7 @@ public function setup() public function teardown() { - Date\Date::setOptions($this->_options); + Zend_Date::setOptions($this->_options); } /** @@ -120,7 +116,7 @@ public function teardown() */ public function testGetsIdFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss20.xml') ); $entry = $feed->current(); @@ -129,7 +125,7 @@ public function testGetsIdFromRss20() public function testGetsIdFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss094.xml') ); $entry = $feed->current(); @@ -138,7 +134,7 @@ public function testGetsIdFromRss094() public function testGetsIdFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss093.xml') ); $entry = $feed->current(); @@ -147,7 +143,7 @@ public function testGetsIdFromRss093() public function testGetsIdFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss092.xml') ); $entry = $feed->current(); @@ -156,7 +152,7 @@ public function testGetsIdFromRss092() public function testGetsIdFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss091.xml') ); $entry = $feed->current(); @@ -165,7 +161,7 @@ public function testGetsIdFromRss091() public function testGetsIdFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss10.xml') ); $entry = $feed->current(); @@ -174,7 +170,7 @@ public function testGetsIdFromRss10() public function testGetsIdFromRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss090.xml') ); $entry = $feed->current(); @@ -185,7 +181,7 @@ public function testGetsIdFromRss090() public function testGetsIdFromRss20_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss20.xml') ); $entry = $feed->current(); @@ -194,7 +190,7 @@ public function testGetsIdFromRss20_Dc10() public function testGetsIdFromRss094_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -203,7 +199,7 @@ public function testGetsIdFromRss094_Dc10() public function testGetsIdFromRss093_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -212,7 +208,7 @@ public function testGetsIdFromRss093_Dc10() public function testGetsIdFromRss092_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -221,7 +217,7 @@ public function testGetsIdFromRss092_Dc10() public function testGetsIdFromRss091_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -230,7 +226,7 @@ public function testGetsIdFromRss091_Dc10() public function testGetsIdFromRss10_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -239,7 +235,7 @@ public function testGetsIdFromRss10_Dc10() public function testGetsIdFromRss090_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -250,7 +246,7 @@ public function testGetsIdFromRss090_Dc10() public function testGetsIdFromRss20_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss20.xml') ); $entry = $feed->current(); @@ -259,7 +255,7 @@ public function testGetsIdFromRss20_Dc11() public function testGetsIdFromRss094_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -268,7 +264,7 @@ public function testGetsIdFromRss094_Dc11() public function testGetsIdFromRss093_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -277,7 +273,7 @@ public function testGetsIdFromRss093_Dc11() public function testGetsIdFromRss092_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -286,7 +282,7 @@ public function testGetsIdFromRss092_Dc11() public function testGetsIdFromRss091_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -295,7 +291,7 @@ public function testGetsIdFromRss091_Dc11() public function testGetsIdFromRss10_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -304,7 +300,7 @@ public function testGetsIdFromRss10_Dc11() public function testGetsIdFromRss090_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -315,7 +311,7 @@ public function testGetsIdFromRss090_Dc11() public function testGetsIdFromRss20_Title() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss20.xml') ); $entry = $feed->current(); @@ -324,7 +320,7 @@ public function testGetsIdFromRss20_Title() public function testGetsIdFromRss094_Title() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss094.xml') ); $entry = $feed->current(); @@ -333,7 +329,7 @@ public function testGetsIdFromRss094_Title() public function testGetsIdFromRss093_Title() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss093.xml') ); $entry = $feed->current(); @@ -342,7 +338,7 @@ public function testGetsIdFromRss093_Title() public function testGetsIdFromRss092_Title() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss092.xml') ); $entry = $feed->current(); @@ -351,7 +347,7 @@ public function testGetsIdFromRss092_Title() public function testGetsIdFromRss091_Title() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss091.xml') ); $entry = $feed->current(); @@ -360,7 +356,7 @@ public function testGetsIdFromRss091_Title() public function testGetsIdFromRss10_Title() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss10.xml') ); $entry = $feed->current(); @@ -369,7 +365,7 @@ public function testGetsIdFromRss10_Title() public function testGetsIdFromRss090_Title() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss090.xml') ); $entry = $feed->current(); @@ -380,7 +376,7 @@ public function testGetsIdFromRss090_Title() public function testGetsIdFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -389,7 +385,7 @@ public function testGetsIdFromRss20_None() public function testGetsIdFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -398,7 +394,7 @@ public function testGetsIdFromRss094_None() public function testGetsIdFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -407,7 +403,7 @@ public function testGetsIdFromRss093_None() public function testGetsIdFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -416,7 +412,7 @@ public function testGetsIdFromRss092_None() public function testGetsIdFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -425,7 +421,7 @@ public function testGetsIdFromRss091_None() public function testGetsIdFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -434,7 +430,7 @@ public function testGetsIdFromRss10_None() public function testGetsIdFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -446,7 +442,7 @@ public function testGetsIdFromRss090_None() */ public function testGetsTitleFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss20.xml') ); $entry = $feed->current(); @@ -455,7 +451,7 @@ public function testGetsTitleFromRss20() public function testGetsTitleFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss094.xml') ); $entry = $feed->current(); @@ -464,7 +460,7 @@ public function testGetsTitleFromRss094() public function testGetsTitleFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss093.xml') ); $entry = $feed->current(); @@ -473,7 +469,7 @@ public function testGetsTitleFromRss093() public function testGetsTitleFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss092.xml') ); $entry = $feed->current(); @@ -482,7 +478,7 @@ public function testGetsTitleFromRss092() public function testGetsTitleFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss091.xml') ); $entry = $feed->current(); @@ -491,7 +487,7 @@ public function testGetsTitleFromRss091() public function testGetsTitleFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss10.xml') ); $entry = $feed->current(); @@ -500,7 +496,7 @@ public function testGetsTitleFromRss10() public function testGetsTitleFromRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss090.xml') ); $entry = $feed->current(); @@ -511,7 +507,7 @@ public function testGetsTitleFromRss090() public function testGetsTitleFromRss20_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss20.xml') ); $entry = $feed->current(); @@ -520,7 +516,7 @@ public function testGetsTitleFromRss20_Dc10() public function testGetsTitleFromRss094_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -529,7 +525,7 @@ public function testGetsTitleFromRss094_Dc10() public function testGetsTitleFromRss093_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -538,7 +534,7 @@ public function testGetsTitleFromRss093_Dc10() public function testGetsTitleFromRss092_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -547,7 +543,7 @@ public function testGetsTitleFromRss092_Dc10() public function testGetsTitleFromRss091_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -556,7 +552,7 @@ public function testGetsTitleFromRss091_Dc10() public function testGetsTitleFromRss10_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -565,7 +561,7 @@ public function testGetsTitleFromRss10_Dc10() public function testGetsTitleFromRss090_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -576,7 +572,7 @@ public function testGetsTitleFromRss090_Dc10() public function testGetsTitleFromRss20_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss20.xml') ); $entry = $feed->current(); @@ -585,7 +581,7 @@ public function testGetsTitleFromRss20_Dc11() public function testGetsTitleFromRss094_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -594,7 +590,7 @@ public function testGetsTitleFromRss094_Dc11() public function testGetsTitleFromRss093_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -603,7 +599,7 @@ public function testGetsTitleFromRss093_Dc11() public function testGetsTitleFromRss092_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -612,7 +608,7 @@ public function testGetsTitleFromRss092_Dc11() public function testGetsTitleFromRss091_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -621,7 +617,7 @@ public function testGetsTitleFromRss091_Dc11() public function testGetsTitleFromRss10_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -630,7 +626,7 @@ public function testGetsTitleFromRss10_Dc11() public function testGetsTitleFromRss090_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -641,7 +637,7 @@ public function testGetsTitleFromRss090_Dc11() public function testGetsTitleFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -650,7 +646,7 @@ public function testGetsTitleFromRss20_None() public function testGetsTitleFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -659,7 +655,7 @@ public function testGetsTitleFromRss094_None() public function testGetsTitleFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -668,7 +664,7 @@ public function testGetsTitleFromRss093_None() public function testGetsTitleFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -677,7 +673,7 @@ public function testGetsTitleFromRss092_None() public function testGetsTitleFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -686,7 +682,7 @@ public function testGetsTitleFromRss091_None() public function testGetsTitleFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -695,7 +691,7 @@ public function testGetsTitleFromRss10_None() public function testGetsTitleFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -707,7 +703,7 @@ public function testGetsTitleFromRss090_None() */ public function testGetsAuthorsFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') ); $entry = $feed->current(); @@ -720,7 +716,7 @@ public function testGetsAuthorsFromRss20() public function testGetsAuthorsFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') ); $entry = $feed->current(); @@ -729,7 +725,7 @@ public function testGetsAuthorsFromRss094() public function testGetsAuthorsFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') ); $entry = $feed->current(); @@ -738,7 +734,7 @@ public function testGetsAuthorsFromRss093() public function testGetsAuthorsFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') ); $entry = $feed->current(); @@ -747,7 +743,7 @@ public function testGetsAuthorsFromRss092() public function testGetsAuthorsFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') ); $entry = $feed->current(); @@ -756,7 +752,7 @@ public function testGetsAuthorsFromRss091() public function testGetsAuthorsFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') ); $entry = $feed->current(); @@ -765,7 +761,7 @@ public function testGetsAuthorsFromRss10() public function testGetsAuthorsFromRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') ); $entry = $feed->current(); @@ -776,7 +772,7 @@ public function testGetsAuthorsFromRss090() public function testGetsAuthorsFromRss20_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') ); $entry = $feed->current(); @@ -788,7 +784,7 @@ public function testGetsAuthorsFromRss20_Dc10() public function testGetsAuthorsFromRss094_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -800,7 +796,7 @@ public function testGetsAuthorsFromRss094_Dc10() public function testGetsAuthorsFromRss093_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -812,7 +808,7 @@ public function testGetsAuthorsFromRss093_Dc10() public function testGetsAuthorsFromRss092_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -824,7 +820,7 @@ public function testGetsAuthorsFromRss092_Dc10() public function testGetsAuthorsFromRss091_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -836,7 +832,7 @@ public function testGetsAuthorsFromRss091_Dc10() public function testGetsAuthorsFromRss10_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -848,7 +844,7 @@ public function testGetsAuthorsFromRss10_Dc10() public function testGetsAuthorsFromRss090_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -862,7 +858,7 @@ public function testGetsAuthorsFromRss090_Dc10() public function testGetsAuthorsFromRss20_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') ); $entry = $feed->current(); @@ -874,7 +870,7 @@ public function testGetsAuthorsFromRss20_Dc11() public function testGetsAuthorsFromRss094_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -886,7 +882,7 @@ public function testGetsAuthorsFromRss094_Dc11() public function testGetsAuthorsFromRss093_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -898,7 +894,7 @@ public function testGetsAuthorsFromRss093_Dc11() public function testGetsAuthorsFromRss092_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -910,7 +906,7 @@ public function testGetsAuthorsFromRss092_Dc11() public function testGetsAuthorsFromRss091_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -922,7 +918,7 @@ public function testGetsAuthorsFromRss091_Dc11() public function testGetsAuthorsFromRss10_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -934,7 +930,7 @@ public function testGetsAuthorsFromRss10_Dc11() public function testGetsAuthorsFromRss090_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -948,7 +944,7 @@ public function testGetsAuthorsFromRss090_Dc11() public function testGetsAuthorsFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -957,7 +953,7 @@ public function testGetsAuthorsFromRss20_None() public function testGetsAuthorsFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -966,7 +962,7 @@ public function testGetsAuthorsFromRss094_None() public function testGetsAuthorsFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -975,7 +971,7 @@ public function testGetsAuthorsFromRss093_None() public function testGetsAuthorsFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -984,7 +980,7 @@ public function testGetsAuthorsFromRss092_None() public function testGetsAuthorsFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -993,7 +989,7 @@ public function testGetsAuthorsFromRss091_None() public function testGetsAuthorsFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -1002,7 +998,7 @@ public function testGetsAuthorsFromRss10_None() public function testGetsAuthorsFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -1015,7 +1011,7 @@ public function testGetsAuthorsFromRss090_None() */ public function testGetsAuthorFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') ); $entry = $feed->current(); @@ -1024,7 +1020,7 @@ public function testGetsAuthorFromRss20() public function testGetsAuthorFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') ); $entry = $feed->current(); @@ -1033,7 +1029,7 @@ public function testGetsAuthorFromRss094() public function testGetsAuthorFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') ); $entry = $feed->current(); @@ -1042,7 +1038,7 @@ public function testGetsAuthorFromRss093() public function testGetsAuthorFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') ); $entry = $feed->current(); @@ -1051,7 +1047,7 @@ public function testGetsAuthorFromRss092() public function testGetsAuthorFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') ); $entry = $feed->current(); @@ -1060,7 +1056,7 @@ public function testGetsAuthorFromRss091() public function testGetsAuthorFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') ); $entry = $feed->current(); @@ -1069,7 +1065,7 @@ public function testGetsAuthorFromRss10() public function testGetsAuthorFromRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') ); $entry = $feed->current(); @@ -1080,7 +1076,7 @@ public function testGetsAuthorFromRss090() public function testGetsAuthorFromRss20_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') ); $entry = $feed->current(); @@ -1089,7 +1085,7 @@ public function testGetsAuthorFromRss20_Dc10() public function testGetsAuthorFromRss094_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -1098,7 +1094,7 @@ public function testGetsAuthorFromRss094_Dc10() public function testGetsAuthorFromRss093_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -1107,7 +1103,7 @@ public function testGetsAuthorFromRss093_Dc10() public function testGetsAuthorFromRss092_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -1116,7 +1112,7 @@ public function testGetsAuthorFromRss092_Dc10() public function testGetsAuthorFromRss091_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -1125,7 +1121,7 @@ public function testGetsAuthorFromRss091_Dc10() public function testGetsAuthorFromRss10_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -1134,7 +1130,7 @@ public function testGetsAuthorFromRss10_Dc10() public function testGetsAuthorFromRss090_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -1145,7 +1141,7 @@ public function testGetsAuthorFromRss090_Dc10() public function testGetsAuthorFromRss20_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') ); $entry = $feed->current(); @@ -1154,7 +1150,7 @@ public function testGetsAuthorFromRss20_Dc11() public function testGetsAuthorFromRss094_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -1163,7 +1159,7 @@ public function testGetsAuthorFromRss094_Dc11() public function testGetsAuthorFromRss093_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -1172,7 +1168,7 @@ public function testGetsAuthorFromRss093_Dc11() public function testGetsAuthorFromRss092_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -1181,7 +1177,7 @@ public function testGetsAuthorFromRss092_Dc11() public function testGetsAuthorFromRss091_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -1190,7 +1186,7 @@ public function testGetsAuthorFromRss091_Dc11() public function testGetsAuthorFromRss10_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -1199,7 +1195,7 @@ public function testGetsAuthorFromRss10_Dc11() public function testGetsAuthorFromRss090_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -1210,7 +1206,7 @@ public function testGetsAuthorFromRss090_Dc11() public function testGetsAuthorFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -1219,7 +1215,7 @@ public function testGetsAuthorFromRss20_None() public function testGetsAuthorFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -1228,7 +1224,7 @@ public function testGetsAuthorFromRss094_None() public function testGetsAuthorFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -1237,7 +1233,7 @@ public function testGetsAuthorFromRss093_None() public function testGetsAuthorFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -1246,7 +1242,7 @@ public function testGetsAuthorFromRss092_None() public function testGetsAuthorFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -1255,7 +1251,7 @@ public function testGetsAuthorFromRss091_None() public function testGetsAuthorFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -1264,7 +1260,7 @@ public function testGetsAuthorFromRss10_None() public function testGetsAuthorFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -1276,7 +1272,7 @@ public function testGetsAuthorFromRss090_None() */ public function testGetsDescriptionFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss20.xml') ); $entry = $feed->current(); @@ -1285,7 +1281,7 @@ public function testGetsDescriptionFromRss20() public function testGetsDescriptionFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss094.xml') ); $entry = $feed->current(); @@ -1294,7 +1290,7 @@ public function testGetsDescriptionFromRss094() public function testGetsDescriptionFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss093.xml') ); $entry = $feed->current(); @@ -1303,7 +1299,7 @@ public function testGetsDescriptionFromRss093() public function testGetsDescriptionFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss092.xml') ); $entry = $feed->current(); @@ -1312,7 +1308,7 @@ public function testGetsDescriptionFromRss092() public function testGetsDescriptionFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss091.xml') ); $entry = $feed->current(); @@ -1321,7 +1317,7 @@ public function testGetsDescriptionFromRss091() public function testGetsDescriptionFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss10.xml') ); $entry = $feed->current(); @@ -1330,7 +1326,7 @@ public function testGetsDescriptionFromRss10() public function testGetsDescriptionFromRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss090.xml') ); $entry = $feed->current(); @@ -1341,7 +1337,7 @@ public function testGetsDescriptionFromRss090() public function testGetsDescriptionFromRss20_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss20.xml') ); $entry = $feed->current(); @@ -1350,7 +1346,7 @@ public function testGetsDescriptionFromRss20_Dc10() public function testGetsDescriptionFromRss094_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -1359,7 +1355,7 @@ public function testGetsDescriptionFromRss094_Dc10() public function testGetsDescriptionFromRss093_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -1368,7 +1364,7 @@ public function testGetsDescriptionFromRss093_Dc10() public function testGetsDescriptionFromRss092_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -1377,7 +1373,7 @@ public function testGetsDescriptionFromRss092_Dc10() public function testGetsDescriptionFromRss091_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -1386,7 +1382,7 @@ public function testGetsDescriptionFromRss091_Dc10() public function testGetsDescriptionFromRss10_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -1395,7 +1391,7 @@ public function testGetsDescriptionFromRss10_Dc10() public function testGetsDescriptionFromRss090_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -1406,7 +1402,7 @@ public function testGetsDescriptionFromRss090_Dc10() public function testGetsDescriptionFromRss20_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss20.xml') ); $entry = $feed->current(); @@ -1415,7 +1411,7 @@ public function testGetsDescriptionFromRss20_Dc11() public function testGetsDescriptionFromRss094_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -1424,7 +1420,7 @@ public function testGetsDescriptionFromRss094_Dc11() public function testGetsDescriptionFromRss093_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -1433,7 +1429,7 @@ public function testGetsDescriptionFromRss093_Dc11() public function testGetsDescriptionFromRss092_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -1442,7 +1438,7 @@ public function testGetsDescriptionFromRss092_Dc11() public function testGetsDescriptionFromRss091_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -1451,7 +1447,7 @@ public function testGetsDescriptionFromRss091_Dc11() public function testGetsDescriptionFromRss10_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -1460,7 +1456,7 @@ public function testGetsDescriptionFromRss10_Dc11() public function testGetsDescriptionFromRss090_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -1471,7 +1467,7 @@ public function testGetsDescriptionFromRss090_Dc11() public function testGetsDescriptionFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -1480,7 +1476,7 @@ public function testGetsDescriptionFromRss20_None() public function testGetsDescriptionFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -1489,7 +1485,7 @@ public function testGetsDescriptionFromRss094_None() public function testGetsDescriptionFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -1498,7 +1494,7 @@ public function testGetsDescriptionFromRss093_None() public function testGetsDescriptionFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -1507,7 +1503,7 @@ public function testGetsDescriptionFromRss092_None() public function testGetsDescriptionFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -1516,7 +1512,7 @@ public function testGetsDescriptionFromRss091_None() public function testGetsDescriptionFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -1525,7 +1521,7 @@ public function testGetsDescriptionFromRss10_None() public function testGetsDescriptionFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -1537,12 +1533,12 @@ public function testGetsDescriptionFromRss090_None() */ public function testGetsEnclosureFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/enclosure/plain/rss20.xml') ); $entry = $feed->current(); - $expected = new \stdClass(); + $expected = new stdClass(); $expected->url = 'http://www.scripting.com/mp3s/weatherReportSuite.mp3'; $expected->length = '12216320'; $expected->type = 'audio/mpeg'; @@ -1552,7 +1548,7 @@ public function testGetsEnclosureFromRss20() public function testGetsEnclosureFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/enclosure/plain/rss10.xml') ); $entry = $feed->current(); @@ -1564,7 +1560,7 @@ public function testGetsEnclosureFromRss10() */ public function testGetsContentFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss20.xml') ); $entry = $feed->current(); @@ -1573,7 +1569,7 @@ public function testGetsContentFromRss20() public function testGetsContentFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss094.xml') ); $entry = $feed->current(); @@ -1582,7 +1578,7 @@ public function testGetsContentFromRss094() public function testGetsContentFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss093.xml') ); $entry = $feed->current(); @@ -1591,7 +1587,7 @@ public function testGetsContentFromRss093() public function testGetsContentFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss092.xml') ); $entry = $feed->current(); @@ -1600,7 +1596,7 @@ public function testGetsContentFromRss092() public function testGetsContentFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss091.xml') ); $entry = $feed->current(); @@ -1609,7 +1605,7 @@ public function testGetsContentFromRss091() public function testGetsContentFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss10.xml') ); $entry = $feed->current(); @@ -1618,7 +1614,7 @@ public function testGetsContentFromRss10() public function testGetsContentFromRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss090.xml') ); $entry = $feed->current(); @@ -1629,7 +1625,7 @@ public function testGetsContentFromRss090() public function testGetsContentFromRss20_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss20.xml') ); $entry = $feed->current(); @@ -1638,7 +1634,7 @@ public function testGetsContentFromRss20_Dc10() public function testGetsContentFromRss094_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss094.xml') ); $entry = $feed->current(); @@ -1647,7 +1643,7 @@ public function testGetsContentFromRss094_Dc10() public function testGetsContentFromRss093_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss093.xml') ); $entry = $feed->current(); @@ -1656,7 +1652,7 @@ public function testGetsContentFromRss093_Dc10() public function testGetsContentFromRss092_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss092.xml') ); $entry = $feed->current(); @@ -1665,7 +1661,7 @@ public function testGetsContentFromRss092_Dc10() public function testGetsContentFromRss091_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss091.xml') ); $entry = $feed->current(); @@ -1674,7 +1670,7 @@ public function testGetsContentFromRss091_Dc10() public function testGetsContentFromRss10_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss10.xml') ); $entry = $feed->current(); @@ -1683,7 +1679,7 @@ public function testGetsContentFromRss10_Dc10() public function testGetsContentFromRss090_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss090.xml') ); $entry = $feed->current(); @@ -1694,7 +1690,7 @@ public function testGetsContentFromRss090_Dc10() public function testGetsContentFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -1703,7 +1699,7 @@ public function testGetsContentFromRss20_None() public function testGetsContentFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -1712,7 +1708,7 @@ public function testGetsContentFromRss094_None() public function testGetsContentFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -1721,7 +1717,7 @@ public function testGetsContentFromRss093_None() public function testGetsContentFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -1730,7 +1726,7 @@ public function testGetsContentFromRss092_None() public function testGetsContentFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -1739,7 +1735,7 @@ public function testGetsContentFromRss091_None() public function testGetsContentFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -1748,7 +1744,7 @@ public function testGetsContentFromRss10_None() public function testGetsContentFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -1760,7 +1756,7 @@ public function testGetsContentFromRss090_None() */ public function testGetsLinkFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss20.xml') ); $entry = $feed->current(); @@ -1769,7 +1765,7 @@ public function testGetsLinkFromRss20() public function testGetsLinkFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss094.xml') ); $entry = $feed->current(); @@ -1778,7 +1774,7 @@ public function testGetsLinkFromRss094() public function testGetsLinkFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss093.xml') ); $entry = $feed->current(); @@ -1787,7 +1783,7 @@ public function testGetsLinkFromRss093() public function testGetsLinkFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss092.xml') ); $entry = $feed->current(); @@ -1796,7 +1792,7 @@ public function testGetsLinkFromRss092() public function testGetsLinkFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss091.xml') ); $entry = $feed->current(); @@ -1805,7 +1801,7 @@ public function testGetsLinkFromRss091() public function testGetsLinkFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss10.xml') ); $entry = $feed->current(); @@ -1814,7 +1810,7 @@ public function testGetsLinkFromRss10() public function testGetsLinkFromRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss090.xml') ); $entry = $feed->current(); @@ -1825,7 +1821,7 @@ public function testGetsLinkFromRss090() public function testGetsLinkFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -1834,7 +1830,7 @@ public function testGetsLinkFromRss20_None() public function testGetsLinkFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -1843,7 +1839,7 @@ public function testGetsLinkFromRss094_None() public function testGetsLinkFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -1852,7 +1848,7 @@ public function testGetsLinkFromRss093_None() public function testGetsLinkFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -1861,7 +1857,7 @@ public function testGetsLinkFromRss092_None() public function testGetsLinkFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -1870,7 +1866,7 @@ public function testGetsLinkFromRss091_None() public function testGetsLinkFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -1879,7 +1875,7 @@ public function testGetsLinkFromRss10_None() public function testGetsLinkFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -1891,91 +1887,109 @@ public function testGetsLinkFromRss090_None() */ public function testGetsDateModifiedFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } + /** + * @group ZF-8702 + */ + public function testParsesCorrectDateIfMissingOffsetWhenSystemUsesUSLocale() + { + $locale = new Zend_Locale('en_US'); + Zend_Registry::set('Zend_Locale', $locale); + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20_en_US.xml') + ); + $entry = $feed->current(); + $fdate = $entry->getDateModified(); + $edate = new Zend_Date; + $edate->set('2010-01-04T08:14:00-0600', Zend_Date::ISO_8601); + Zend_Registry::getInstance()->offsetUnset('Zend_Locale'); + $this->assertTrue($edate->equals($fdate)); + } + // DC 1.0 public function testGetsDateModifiedFromRss20_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss20.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss094_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss094.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss093_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss093.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss092_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss092.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss091_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss091.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss10_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss10.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss090_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss090.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } @@ -1983,78 +1997,78 @@ public function testGetsDateModifiedFromRss090_Dc10() public function testGetsDateModifiedFromRss20_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss20.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss094_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss094.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss093_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss093.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss092_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss092.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss091_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss091.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss10_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss10.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss090_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss090.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } @@ -2062,7 +2076,7 @@ public function testGetsDateModifiedFromRss090_Dc11() public function testGetsDateModifiedFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -2071,7 +2085,7 @@ public function testGetsDateModifiedFromRss20_None() public function testGetsDateModifiedFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -2080,7 +2094,7 @@ public function testGetsDateModifiedFromRss094_None() public function testGetsDateModifiedFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -2089,7 +2103,7 @@ public function testGetsDateModifiedFromRss093_None() public function testGetsDateModifiedFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -2098,7 +2112,7 @@ public function testGetsDateModifiedFromRss092_None() public function testGetsDateModifiedFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -2107,7 +2121,7 @@ public function testGetsDateModifiedFromRss091_None() public function testGetsDateModifiedFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -2116,7 +2130,7 @@ public function testGetsDateModifiedFromRss10_None() public function testGetsDateModifiedFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -2128,13 +2142,13 @@ public function testGetsDateModifiedFromRss090_None() */ public function testGetsDateModifiedFromRss20_UnrecognisedGmtFormat() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20-zf-7908.xml') ); $entry = $feed->current(); //$this->assertEquals('Sunday 11 January 2009 09 55 59 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); - $edate = new Date\Date; - $edate->set('Sun, 11 Jan 2009 09:55:59 GMT', Date\Date::RSS); + $edate = new Zend_Date; + $edate->set('Sun, 11 Jan 2009 09:55:59 GMT', Zend_Date::RSS); $this->assertTrue($edate->equals($entry->getDateModified())); } @@ -2146,7 +2160,7 @@ public function testGetsDateModifiedFromRss20_UnrecognisedGmtFormat() public function testGetsCommentCountFromRss20_Slash10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss20.xml') ); $entry = $feed->current(); @@ -2155,7 +2169,7 @@ public function testGetsCommentCountFromRss20_Slash10() public function testGetsCommentCountFromRss094_Slash10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss094.xml') ); $entry = $feed->current(); @@ -2164,7 +2178,7 @@ public function testGetsCommentCountFromRss094_Slash10() public function testGetsCommentCountFromRss093_Slash10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss093.xml') ); $entry = $feed->current(); @@ -2173,7 +2187,7 @@ public function testGetsCommentCountFromRss093_Slash10() public function testGetsCommentCountFromRss092_Slash10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss092.xml') ); $entry = $feed->current(); @@ -2182,7 +2196,7 @@ public function testGetsCommentCountFromRss092_Slash10() public function testGetsCommentCountFromRss091_Slash10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss091.xml') ); $entry = $feed->current(); @@ -2191,7 +2205,7 @@ public function testGetsCommentCountFromRss091_Slash10() public function testGetsCommentCountFromRss10_Slash10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss10.xml') ); $entry = $feed->current(); @@ -2200,7 +2214,7 @@ public function testGetsCommentCountFromRss10_Slash10() public function testGetsCommentCountFromRss090_Slash10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss090.xml') ); $entry = $feed->current(); @@ -2211,7 +2225,7 @@ public function testGetsCommentCountFromRss090_Slash10() public function testGetsCommentCountFromRss20_Thread10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss20.xml') ); $entry = $feed->current(); @@ -2220,7 +2234,7 @@ public function testGetsCommentCountFromRss20_Thread10() public function testGetsCommentCountFromRss094_Thread10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss094.xml') ); $entry = $feed->current(); @@ -2229,7 +2243,7 @@ public function testGetsCommentCountFromRss094_Thread10() public function testGetsCommentCountFromRss093_Thread10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss093.xml') ); $entry = $feed->current(); @@ -2238,7 +2252,7 @@ public function testGetsCommentCountFromRss093_Thread10() public function testGetsCommentCountFromRss092_Thread10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss092.xml') ); $entry = $feed->current(); @@ -2247,7 +2261,7 @@ public function testGetsCommentCountFromRss092_Thread10() public function testGetsCommentCountFromRss091_Thread10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss091.xml') ); $entry = $feed->current(); @@ -2256,7 +2270,7 @@ public function testGetsCommentCountFromRss091_Thread10() public function testGetsCommentCountFromRss10_Thread10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss10.xml') ); $entry = $feed->current(); @@ -2265,7 +2279,7 @@ public function testGetsCommentCountFromRss10_Thread10() public function testGetsCommentCountFromRss090_Thread10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss090.xml') ); $entry = $feed->current(); @@ -2276,7 +2290,7 @@ public function testGetsCommentCountFromRss090_Thread10() public function testGetsCommentCountFromRss20_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss20.xml') ); $entry = $feed->current(); @@ -2285,7 +2299,7 @@ public function testGetsCommentCountFromRss20_Atom10() public function testGetsCommentCountFromRss094_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss094.xml') ); $entry = $feed->current(); @@ -2294,7 +2308,7 @@ public function testGetsCommentCountFromRss094_Atom10() public function testGetsCommentCountFromRss093_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss093.xml') ); $entry = $feed->current(); @@ -2303,7 +2317,7 @@ public function testGetsCommentCountFromRss093_Atom10() public function testGetsCommentCountFromRss092_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss092.xml') ); $entry = $feed->current(); @@ -2312,7 +2326,7 @@ public function testGetsCommentCountFromRss092_Atom10() public function testGetsCommentCountFromRss091_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss091.xml') ); $entry = $feed->current(); @@ -2321,7 +2335,7 @@ public function testGetsCommentCountFromRss091_Atom10() public function testGetsCommentCountFromRss10_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss10.xml') ); $entry = $feed->current(); @@ -2330,7 +2344,7 @@ public function testGetsCommentCountFromRss10_Atom10() public function testGetsCommentCountFromRss090_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss090.xml') ); $entry = $feed->current(); @@ -2341,7 +2355,7 @@ public function testGetsCommentCountFromRss090_Atom10() public function testGetsCommentCountFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -2350,7 +2364,7 @@ public function testGetsCommentCountFromRss20_None() public function testGetsCommentCountFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -2359,7 +2373,7 @@ public function testGetsCommentCountFromRss094_None() public function testGetsCommentCountFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -2368,7 +2382,7 @@ public function testGetsCommentCountFromRss093_None() public function testGetsCommentCountFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -2377,7 +2391,7 @@ public function testGetsCommentCountFromRss092_None() public function testGetsCommentCountFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -2386,7 +2400,7 @@ public function testGetsCommentCountFromRss091_None() public function testGetsCommentCountFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -2395,7 +2409,7 @@ public function testGetsCommentCountFromRss10_None() public function testGetsCommentCountFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -2408,7 +2422,7 @@ public function testGetsCommentCountFromRss090_None() public function testGetsCommentLinkFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss20.xml') ); $entry = $feed->current(); @@ -2417,7 +2431,7 @@ public function testGetsCommentLinkFromRss20() public function testGetsCommentLinkFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss094.xml') ); $entry = $feed->current(); @@ -2426,7 +2440,7 @@ public function testGetsCommentLinkFromRss094() public function testGetsCommentLinkFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss093.xml') ); $entry = $feed->current(); @@ -2435,7 +2449,7 @@ public function testGetsCommentLinkFromRss093() public function testGetsCommentLinkFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss092.xml') ); $entry = $feed->current(); @@ -2444,7 +2458,7 @@ public function testGetsCommentLinkFromRss092() public function testGetsCommentLinkFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss091.xml') ); $entry = $feed->current(); @@ -2455,7 +2469,7 @@ public function testGetsCommentLinkFromRss091() public function testGetsCommentLinkFromRss20_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss20.xml') ); $entry = $feed->current(); @@ -2464,7 +2478,7 @@ public function testGetsCommentLinkFromRss20_Atom10() public function testGetsCommentLinkFromRss094_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss094.xml') ); $entry = $feed->current(); @@ -2473,7 +2487,7 @@ public function testGetsCommentLinkFromRss094_Atom10() public function testGetsCommentLinkFromRss093_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss093.xml') ); $entry = $feed->current(); @@ -2482,7 +2496,7 @@ public function testGetsCommentLinkFromRss093_Atom10() public function testGetsCommentLinkFromRss092_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss092.xml') ); $entry = $feed->current(); @@ -2491,7 +2505,7 @@ public function testGetsCommentLinkFromRss092_Atom10() public function testGetsCommentLinkFromRss091_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss091.xml') ); $entry = $feed->current(); @@ -2500,7 +2514,7 @@ public function testGetsCommentLinkFromRss091_Atom10() public function testGetsCommentLinkFromRss10_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss10.xml') ); $entry = $feed->current(); @@ -2509,7 +2523,7 @@ public function testGetsCommentLinkFromRss10_Atom10() public function testGetsCommentLinkFromRss090_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss090.xml') ); $entry = $feed->current(); @@ -2520,7 +2534,7 @@ public function testGetsCommentLinkFromRss090_Atom10() public function testGetsCommentLinkFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -2529,7 +2543,7 @@ public function testGetsCommentLinkFromRss20_None() public function testGetsCommentLinkFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -2538,7 +2552,7 @@ public function testGetsCommentLinkFromRss094_None() public function testGetsCommentLinkFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -2547,7 +2561,7 @@ public function testGetsCommentLinkFromRss093_None() public function testGetsCommentLinkFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -2556,7 +2570,7 @@ public function testGetsCommentLinkFromRss092_None() public function testGetsCommentLinkFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -2565,7 +2579,7 @@ public function testGetsCommentLinkFromRss091_None() public function testGetsCommentLinkFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -2574,7 +2588,7 @@ public function testGetsCommentLinkFromRss10_None() public function testGetsCommentLinkFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -2589,7 +2603,7 @@ public function testGetsCommentLinkFromRss090_None() public function testGetsCommentFeedLinkFromRss20_WellFormedWeb10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss20.xml') ); $entry = $feed->current(); @@ -2598,7 +2612,7 @@ public function testGetsCommentFeedLinkFromRss20_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss094_WellFormedWeb10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss094.xml') ); $entry = $feed->current(); @@ -2607,7 +2621,7 @@ public function testGetsCommentFeedLinkFromRss094_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss093_WellFormedWeb10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss093.xml') ); $entry = $feed->current(); @@ -2616,7 +2630,7 @@ public function testGetsCommentFeedLinkFromRss093_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss092_WellFormedWeb10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss092.xml') ); $entry = $feed->current(); @@ -2625,7 +2639,7 @@ public function testGetsCommentFeedLinkFromRss092_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss091_WellFormedWeb10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss091.xml') ); $entry = $feed->current(); @@ -2634,7 +2648,7 @@ public function testGetsCommentFeedLinkFromRss091_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss10_WellFormedWeb10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss10.xml') ); $entry = $feed->current(); @@ -2643,7 +2657,7 @@ public function testGetsCommentFeedLinkFromRss10_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss090_WellFormedWeb10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss090.xml') ); $entry = $feed->current(); @@ -2654,7 +2668,7 @@ public function testGetsCommentFeedLinkFromRss090_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss20_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss20.xml') ); $entry = $feed->current(); @@ -2663,7 +2677,7 @@ public function testGetsCommentFeedLinkFromRss20_Atom10() public function testGetsCommentFeedLinkFromRss094_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss094.xml') ); $entry = $feed->current(); @@ -2672,7 +2686,7 @@ public function testGetsCommentFeedLinkFromRss094_Atom10() public function testGetsCommentFeedLinkFromRss093_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss093.xml') ); $entry = $feed->current(); @@ -2681,7 +2695,7 @@ public function testGetsCommentFeedLinkFromRss093_Atom10() public function testGetsCommentFeedLinkFromRss092_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss092.xml') ); $entry = $feed->current(); @@ -2690,7 +2704,7 @@ public function testGetsCommentFeedLinkFromRss092_Atom10() public function testGetsCommentFeedLinkFromRss091_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss091.xml') ); $entry = $feed->current(); @@ -2699,7 +2713,7 @@ public function testGetsCommentFeedLinkFromRss091_Atom10() public function testGetsCommentFeedLinkFromRss10_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss10.xml') ); $entry = $feed->current(); @@ -2708,7 +2722,7 @@ public function testGetsCommentFeedLinkFromRss10_Atom10() public function testGetsCommentFeedLinkFromRss090_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss090.xml') ); $entry = $feed->current(); @@ -2719,7 +2733,7 @@ public function testGetsCommentFeedLinkFromRss090_Atom10() public function testGetsCommentFeedLinkFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -2728,7 +2742,7 @@ public function testGetsCommentFeedLinkFromRss20_None() public function testGetsCommentFeedLinkFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -2737,7 +2751,7 @@ public function testGetsCommentFeedLinkFromRss094_None() public function testGetsCommentFeedLinkFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -2746,7 +2760,7 @@ public function testGetsCommentFeedLinkFromRss093_None() public function testGetsCommentFeedLinkFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -2755,7 +2769,7 @@ public function testGetsCommentFeedLinkFromRss092_None() public function testGetsCommentFeedLinkFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -2764,7 +2778,7 @@ public function testGetsCommentFeedLinkFromRss091_None() public function testGetsCommentFeedLinkFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -2773,7 +2787,7 @@ public function testGetsCommentFeedLinkFromRss10_None() public function testGetsCommentFeedLinkFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -2788,7 +2802,7 @@ public function testGetsCommentFeedLinkFromRss090_None() public function testGetsCategoriesFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/rss20.xml') ); $entry = $feed->current(); @@ -2800,7 +2814,7 @@ public function testGetsCategoriesFromRss20() public function testGetsCategoriesFromRss090_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -2810,7 +2824,7 @@ public function testGetsCategoriesFromRss090_Dc10() public function testGetsCategoriesFromRss091_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -2820,7 +2834,7 @@ public function testGetsCategoriesFromRss091_Dc10() public function testGetsCategoriesFromRss092_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -2830,7 +2844,7 @@ public function testGetsCategoriesFromRss092_Dc10() public function testGetsCategoriesFromRss093_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -2840,7 +2854,7 @@ public function testGetsCategoriesFromRss093_Dc10() public function testGetsCategoriesFromRss094_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -2850,7 +2864,7 @@ public function testGetsCategoriesFromRss094_Dc10() public function testGetsCategoriesFromRss10_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -2862,7 +2876,7 @@ public function testGetsCategoriesFromRss10_Dc10() public function testGetsCategoriesFromRss090_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -2872,7 +2886,7 @@ public function testGetsCategoriesFromRss090_Dc11() public function testGetsCategoriesFromRss091_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -2882,7 +2896,7 @@ public function testGetsCategoriesFromRss091_Dc11() public function testGetsCategoriesFromRss092_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -2892,7 +2906,7 @@ public function testGetsCategoriesFromRss092_Dc11() public function testGetsCategoriesFromRss093_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -2902,7 +2916,7 @@ public function testGetsCategoriesFromRss093_Dc11() public function testGetsCategoriesFromRss094_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -2912,7 +2926,7 @@ public function testGetsCategoriesFromRss094_Dc11() public function testGetsCategoriesFromRss10_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -2924,7 +2938,7 @@ public function testGetsCategoriesFromRss10_Dc11() public function testGetsCategoriesFromRss090_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss090.xml') ); $entry = $feed->current(); @@ -2934,7 +2948,7 @@ public function testGetsCategoriesFromRss090_Atom10() public function testGetsCategoriesFromRss091_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss091.xml') ); $entry = $feed->current(); @@ -2944,7 +2958,7 @@ public function testGetsCategoriesFromRss091_Atom10() public function testGetsCategoriesFromRss092_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss092.xml') ); $entry = $feed->current(); @@ -2954,7 +2968,7 @@ public function testGetsCategoriesFromRss092_Atom10() public function testGetsCategoriesFromRss093_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss093.xml') ); $entry = $feed->current(); @@ -2964,7 +2978,7 @@ public function testGetsCategoriesFromRss093_Atom10() public function testGetsCategoriesFromRss094_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss094.xml') ); $entry = $feed->current(); @@ -2974,7 +2988,7 @@ public function testGetsCategoriesFromRss094_Atom10() public function testGetsCategoriesFromRss10_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss10.xml') ); $entry = $feed->current(); @@ -2986,7 +3000,7 @@ public function testGetsCategoriesFromRss10_Atom10() public function testGetsCategoriesFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -2996,7 +3010,7 @@ public function testGetsCategoriesFromRss20_None() public function testGetsCategoriesFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -3006,7 +3020,7 @@ public function testGetsCategoriesFromRss090_None() public function testGetsCategoriesFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -3016,7 +3030,7 @@ public function testGetsCategoriesFromRss091_None() public function testGetsCategoriesFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -3026,7 +3040,7 @@ public function testGetsCategoriesFromRss092_None() public function testGetsCategoriesFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -3036,7 +3050,7 @@ public function testGetsCategoriesFromRss093_None() public function testGetsCategoriesFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -3046,7 +3060,7 @@ public function testGetsCategoriesFromRss094_None() public function testGetsCategoriesFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss10.xml') ); $entry = $feed->current(); diff --git a/test/Reader/Entry/_files/Rss/datemodified/plain/rss20_en_US.xml b/test/Reader/Entry/_files/Rss/datemodified/plain/rss20_en_US.xml new file mode 100644 index 00000000..c48ba68e --- /dev/null +++ b/test/Reader/Entry/_files/Rss/datemodified/plain/rss20_en_US.xml @@ -0,0 +1,8 @@ + + + + + Mon, 4 Jan 2010 02:14:00 CST + + + diff --git a/test/Reader/Feed/AtomSourceTest.php b/test/Reader/Feed/AtomSourceTest.php index 8f7609bd..1255ee2c 100644 --- a/test/Reader/Feed/AtomSourceTest.php +++ b/test/Reader/Feed/AtomSourceTest.php @@ -20,12 +20,8 @@ * @version $Id: AtomTest.php 19168 2009-11-21 17:17:18Z padraic $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Reader\Feed; -use Zend\Feed\Reader; -use Zend\Date; +require_once 'PHPUnit/Framework/TestCase.php'; +require_once 'Zend/Feed/Reader.php'; /** * @category Zend @@ -36,7 +32,7 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class AtomSourceTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Reader_Feed_AtomSourceTest extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -49,19 +45,19 @@ class AtomSourceTest extends \PHPUnit_Framework_TestCase public function setup() { - Reader\Reader::reset(); - if (\Zend\Registry::isRegistered('Zend_Locale')) { - $registry = \Zend\Registry::getInstance(); + Zend_Feed_Reader::reset(); + if (Zend_Registry::isRegistered('Zend_Locale')) { + $registry = Zend_Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/AtomSource'; - $this->_options = Date\Date::setOptions(); + $this->_options = Zend_Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Date\Date::setOptions(array('format_type'=>'iso')); + Zend_Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -95,16 +91,16 @@ public function setup() public function teardown() { - Date\Date::setOptions($this->_options); + Zend_Date::setOptions($this->_options); } public function testGetsSourceFromEntry() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/atom10.xml') ); $source = $feed->current()->getSource(); - $this->assertTrue($source instanceof \Zend\Feed\Reader\Feed\Atom\Source); + $this->assertTrue($source instanceof Zend_Feed_Reader_Feed_Atom_Source); } /** @@ -113,7 +109,7 @@ public function testGetsSourceFromEntry() public function testGetsTitleFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/atom10.xml') ); $source = $feed->current()->getSource(); @@ -126,7 +122,7 @@ public function testGetsTitleFromAtom10() public function testGetsAuthorArrayFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/atom10.xml') ); $source = $feed->current()->getSource(); @@ -149,7 +145,7 @@ public function testGetsAuthorArrayFromAtom10() public function testGetsSingleAuthorFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/atom10.xml') ); $source = $feed->current()->getSource(); @@ -163,13 +159,13 @@ public function testGetsSingleAuthorFromAtom10() public function testGetsDateCreatedFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/atom10.xml') ); $source = $feed->current()->getSource(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($source->getDateCreated())); } @@ -179,13 +175,13 @@ public function testGetsDateCreatedFromAtom10() public function testGetsDateModifiedFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/atom10.xml') ); $source = $feed->current()->getSource(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($source->getDateModified())); } @@ -195,7 +191,7 @@ public function testGetsDateModifiedFromAtom10() public function testGetsGeneratorFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/atom10.xml') ); $source = $feed->current()->getSource(); @@ -208,7 +204,7 @@ public function testGetsGeneratorFromAtom10() public function testGetsCopyrightFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/atom10.xml') ); $source = $feed->current()->getSource(); @@ -221,7 +217,7 @@ public function testGetsCopyrightFromAtom10() public function testGetsDescriptionFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/atom10.xml') ); $source = $feed->current()->getSource(); @@ -234,7 +230,7 @@ public function testGetsDescriptionFromAtom10() public function testGetsIdFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/atom10.xml') ); $source = $feed->current()->getSource(); @@ -247,7 +243,7 @@ public function testGetsIdFromAtom10() public function testGetsLanguageFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/atom10.xml') ); $source = $feed->current()->getSource(); @@ -260,7 +256,7 @@ public function testGetsLanguageFromAtom10() public function testGetsLinkFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/atom10.xml') ); $source = $feed->current()->getSource(); @@ -273,7 +269,7 @@ public function testGetsLinkFromAtom10() public function testGetsFeedLinkFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/atom10.xml') ); $source = $feed->current()->getSource(); @@ -285,7 +281,7 @@ public function testGetsFeedLinkFromAtom10() */ public function testGetsHubsFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/atom10.xml') ); $source = $feed->current()->getSource(); @@ -300,7 +296,7 @@ public function testGetsHubsFromAtom10() */ public function testGetsCategoriesFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/atom10.xml') ); $source = $feed->current()->getSource(); diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 40b088c5..237b254d 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -17,15 +17,11 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: AtomTest.php 22107 2010-05-05 13:42:20Z padraic $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Reader\Feed; -use Zend\Feed\Reader; -use Zend\Date; +require_once 'PHPUnit/Framework/TestCase.php'; +require_once 'Zend/Feed/Reader.php'; /** * @category Zend @@ -36,7 +32,7 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class AtomTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Reader_Feed_AtomTest extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -49,19 +45,19 @@ class AtomTest extends \PHPUnit_Framework_TestCase public function setup() { - Reader\Reader::reset(); - if (\Zend\Registry::isRegistered('Zend_Locale')) { - $registry = \Zend\Registry::getInstance(); + Zend_Feed_Reader::reset(); + if (Zend_Registry::isRegistered('Zend_Locale')) { + $registry = Zend_Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Atom'; - $this->_options = Date\Date::setOptions(); + $this->_options = Zend_Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Date\Date::setOptions(array('format_type'=>'iso')); + Zend_Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -95,7 +91,7 @@ public function setup() public function teardown() { - Date\Date::setOptions($this->_options); + Zend_Date::setOptions($this->_options); } /** @@ -103,7 +99,7 @@ public function teardown() */ public function testGetsTitleFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom03.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -111,7 +107,7 @@ public function testGetsTitleFromAtom03() public function testGetsTitleFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -122,7 +118,7 @@ public function testGetsTitleFromAtom10() */ public function testGetsAuthorArrayFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom03.xml') ); @@ -140,7 +136,7 @@ public function testGetsAuthorArrayFromAtom03() public function testGetsAuthorArrayFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10.xml') ); @@ -161,7 +157,7 @@ public function testGetsAuthorArrayFromAtom10() */ public function testGetsSingleAuthorFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom03.xml') ); @@ -170,7 +166,7 @@ public function testGetsSingleAuthorFromAtom03() public function testGetsSingleAuthorFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10.xml') ); @@ -182,22 +178,22 @@ public function testGetsSingleAuthorFromAtom10() */ public function testGetsDateCreatedFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom03.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateCreated())); } public function testGetsDateCreatedFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom10.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateCreated())); } @@ -206,32 +202,43 @@ public function testGetsDateCreatedFromAtom10() */ public function testGetsDateModifiedFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom03.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom10.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } + /** + * Get Last Build Date (Unencoded Text) + */ + public function testGetsLastBuildDateAlwaysReturnsNullForAtom() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10.xml') + ); + $this->assertNull($feed->getLastBuildDate()); + } + /** * Get Generator (Unencoded Text) */ public function testGetsGeneratorFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/atom03.xml') ); $this->assertEquals('Zend_Feed', $feed->getGenerator()); @@ -239,7 +246,7 @@ public function testGetsGeneratorFromAtom03() public function testGetsGeneratorFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/atom10.xml') ); $this->assertEquals('Zend_Feed', $feed->getGenerator()); @@ -250,7 +257,7 @@ public function testGetsGeneratorFromAtom10() */ public function testGetsCopyrightFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/atom03.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -258,7 +265,7 @@ public function testGetsCopyrightFromAtom03() public function testGetsCopyrightFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/atom10.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -269,7 +276,7 @@ public function testGetsCopyrightFromAtom10() */ public function testGetsDescriptionFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/atom03.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -277,7 +284,7 @@ public function testGetsDescriptionFromAtom03() public function testGetsDescriptionFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/atom10.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -288,7 +295,7 @@ public function testGetsDescriptionFromAtom10() */ public function testGetsIdFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/atom03.xml') ); $this->assertEquals('123', $feed->getId()); @@ -296,7 +303,7 @@ public function testGetsIdFromAtom03() public function testGetsIdFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/atom10.xml') ); $this->assertEquals('123', $feed->getId()); @@ -307,7 +314,7 @@ public function testGetsIdFromAtom10() */ public function testGetsLanguageFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/atom03.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -315,7 +322,7 @@ public function testGetsLanguageFromAtom03() public function testGetsLanguageFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/atom10.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -326,7 +333,7 @@ public function testGetsLanguageFromAtom10() */ public function testGetsLinkFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/atom03.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -334,7 +341,7 @@ public function testGetsLinkFromAtom03() public function testGetsLinkFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/atom10.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -342,7 +349,7 @@ public function testGetsLinkFromAtom10() public function testGetsLinkFromAtom10WithNoRelAttribute() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/atom10-norel.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -350,7 +357,7 @@ public function testGetsLinkFromAtom10WithNoRelAttribute() public function testGetsLinkFromAtom10WithRelativeUrl() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/atom10-relative.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -361,7 +368,7 @@ public function testGetsLinkFromAtom10WithRelativeUrl() */ public function testGetsBaseUriFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom10-relative.xml') ); $this->assertEquals('http://www.example.com/', $feed->getBaseUrl()); @@ -372,7 +379,7 @@ public function testGetsBaseUriFromAtom10() */ public function testGetsFeedLinkFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom03.xml') ); $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); @@ -380,7 +387,7 @@ public function testGetsFeedLinkFromAtom03() public function testGetsFeedLinkFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom10.xml') ); $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); @@ -388,18 +395,27 @@ public function testGetsFeedLinkFromAtom10() public function testGetsFeedLinkFromAtom10IfRelativeUri() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom10-relative.xml') ); $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); } + public function testGetsOriginalSourceUriIfFeedLinkNotAvailableFromFeed() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom10_NoFeedLink.xml') + ); + $feed->setOriginalSourceUri('http://www.example.com/feed/atom'); + $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); + } + /** * Get Pubsubhubbub Hubs */ public function testGetsHubsFromAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom03.xml') ); $this->assertEquals(array( @@ -410,7 +426,7 @@ public function testGetsHubsFromAtom03() public function testGetsHubsFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10.xml') ); $this->assertEquals(array( @@ -426,7 +442,7 @@ public function testGetsHubsFromAtom10() public function testCountableInterface() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/atom10.xml') ); $this->assertEquals(0, count($feed)); @@ -440,7 +456,7 @@ public function testCountableInterface() public function testGetsCategoriesFromAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10.xml') ); $this->assertEquals($this->_expectedCats, (array) $feed->getCategories()); @@ -449,7 +465,7 @@ public function testGetsCategoriesFromAtom10() public function testGetsCategoriesFromAtom03_Atom10Extension() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom03.xml') ); $this->assertEquals($this->_expectedCats, (array) $feed->getCategories()); @@ -460,7 +476,7 @@ public function testGetsCategoriesFromAtom03_Atom10Extension() public function testGetsCategoriesFromAtom03_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/atom03.xml') ); $this->assertEquals($this->_expectedCatsDc, (array) $feed->getCategories()); @@ -469,7 +485,7 @@ public function testGetsCategoriesFromAtom03_Dc10() public function testGetsCategoriesFromAtom03_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/atom03.xml') ); $this->assertEquals($this->_expectedCatsDc, (array) $feed->getCategories()); @@ -480,7 +496,7 @@ public function testGetsCategoriesFromAtom03_Dc11() public function testGetsCategoriesFromAtom10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/atom10.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -489,10 +505,48 @@ public function testGetsCategoriesFromAtom10_None() public function testGetsCategoriesFromAtom03_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/atom03.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); } + + /** + * Get Image (Unencoded Text) + */ + public function testGetsImageFromAtom03() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/atom03.xml') + ); + $this->assertEquals(array('uri'=>'http://www.example.com/logo.gif'), $feed->getImage()); + } + + public function testGetsImageFromAtom10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/atom10.xml') + ); + $this->assertEquals(array('uri'=>'http://www.example.com/logo.gif'), $feed->getImage()); + } + + /** + * Get Image (Unencoded Text) When Missing + */ + public function testGetsImageFromAtom03_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/atom03.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } + + public function testGetsImageFromAtom10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/atom10.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } } diff --git a/test/Reader/Feed/CommonTest.php b/test/Reader/Feed/CommonTest.php index 193e3ec3..d70d34c6 100644 --- a/test/Reader/Feed/CommonTest.php +++ b/test/Reader/Feed/CommonTest.php @@ -17,14 +17,12 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: CommonTest.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Reader\Feed; -use Zend\Feed\Reader; +require_once 'PHPUnit/Framework/TestCase.php'; +require_once 'Zend/Feed/Reader.php'; +require_once 'Zend/Registry.php'; /** * @category Zend @@ -35,16 +33,16 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class CommonTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Reader_Feed_CommonTest extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Reader\Reader::reset(); - if (\Zend\Registry::isRegistered('Zend_Locale')) { - $registry = \Zend\Registry::getInstance(); + Zend_Feed_Reader::reset(); + if (Zend_Registry::isRegistered('Zend_Locale')) { + $registry = Zend_Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Common'; @@ -55,23 +53,23 @@ public function setup() */ public function testGetsDomDocumentObject() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); - $this->assertTrue($feed->getDomDocument() instanceof \DOMDocument); + $this->assertTrue($feed->getDomDocument() instanceof DOMDocument); } public function testGetsDomXpathObject() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); - $this->assertTrue($feed->getXpath() instanceof \DOMXPath); + $this->assertTrue($feed->getXpath() instanceof DOMXPath); } public function testGetsXpathPrefixString() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $this->assertTrue($feed->getXpathPrefix() == '/atom:feed'); @@ -79,15 +77,15 @@ public function testGetsXpathPrefixString() public function testGetsDomElementObject() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); - $this->assertTrue($feed->getElement() instanceof \DOMElement); + $this->assertTrue($feed->getElement() instanceof DOMElement); } public function testSaveXmlOutputsXmlStringForFeed() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $this->assertEquals($feed->saveXml(), file_get_contents($this->_feedSamplePath.'/atom_rewrittenbydom.xml')); @@ -95,15 +93,15 @@ public function testSaveXmlOutputsXmlStringForFeed() public function testGetsNamedExtension() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); - $this->assertTrue($feed->getExtension('Atom') instanceof \Zend\Feed\Reader\Extension\Atom\Feed); + $this->assertTrue($feed->getExtension('Atom') instanceof Zend_Feed_Reader_Extension_Atom_Feed); } public function testReturnsNullIfExtensionDoesNotExist() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $this->assertEquals(null, $feed->getExtension('Foo')); @@ -114,7 +112,7 @@ public function testReturnsNullIfExtensionDoesNotExist() */ public function testReturnsEncodingOfFeed() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $this->assertEquals('UTF-8', $feed->getEncoding()); @@ -125,7 +123,7 @@ public function testReturnsEncodingOfFeed() */ public function testReturnsEncodingOfFeedAsUtf8IfUndefined() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/atom_noencodingdefined.xml') ); $this->assertEquals('UTF-8', $feed->getEncoding()); diff --git a/test/Reader/Feed/RSSTest.php b/test/Reader/Feed/RssTest.php similarity index 77% rename from test/Reader/Feed/RSSTest.php rename to test/Reader/Feed/RssTest.php index 1a971671..e8dc3d2c 100644 --- a/test/Reader/Feed/RSSTest.php +++ b/test/Reader/Feed/RssTest.php @@ -17,15 +17,12 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: RssTest.php 22297 2010-05-25 21:33:38Z padraic $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Reader\Feed; -use Zend\Feed\Reader; -use Zend\Date; +require_once 'PHPUnit/Framework/TestCase.php'; +require_once 'Zend/Feed/Reader.php'; +require_once 'Zend/Registry.php'; /** * @category Zend @@ -36,7 +33,7 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class RSSTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Reader_Feed_RssTest extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -49,19 +46,19 @@ class RSSTest extends \PHPUnit_Framework_TestCase public function setup() { - Reader\Reader::reset(); - if (\Zend\Registry::isRegistered('Zend\Locale')) { - $registry = \Zend\Registry::getInstance(); - unset($registry['Zend\Locale']); + Zend_Feed_Reader::reset(); + if (Zend_Registry::isRegistered('Zend_Locale')) { + $registry = Zend_Registry::getInstance(); + unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Rss'; - $this->_options = Date\Date::setOptions(); + $this->_options = Zend_Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Date\Date::setOptions(array('format_type'=>'iso')); + Zend_Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -112,7 +109,7 @@ public function setup() public function teardown() { - Date\Date::setOptions($this->_options); + Zend_Date::setOptions($this->_options); } /** @@ -120,7 +117,7 @@ public function teardown() */ public function testGetsTitleFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss20.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -128,7 +125,7 @@ public function testGetsTitleFromRss20() public function testGetsTitleFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss094.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -136,7 +133,7 @@ public function testGetsTitleFromRss094() public function testGetsTitleFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss093.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -144,7 +141,7 @@ public function testGetsTitleFromRss093() public function testGetsTitleFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss092.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -152,7 +149,7 @@ public function testGetsTitleFromRss092() public function testGetsTitleFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss091.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -160,7 +157,7 @@ public function testGetsTitleFromRss091() public function testGetsTitleFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss10.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -168,7 +165,7 @@ public function testGetsTitleFromRss10() public function testGetsTitleFromRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss090.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -178,7 +175,7 @@ public function testGetsTitleFromRss090() public function testGetsTitleFromRss20_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss20.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -186,7 +183,7 @@ public function testGetsTitleFromRss20_Dc10() public function testGetsTitleFromRss094_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss094.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -194,7 +191,7 @@ public function testGetsTitleFromRss094_Dc10() public function testGetsTitleFromRss093_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss093.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -202,7 +199,7 @@ public function testGetsTitleFromRss093_Dc10() public function testGetsTitleFromRss092_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss092.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -210,7 +207,7 @@ public function testGetsTitleFromRss092_Dc10() public function testGetsTitleFromRss091_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss091.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -218,7 +215,7 @@ public function testGetsTitleFromRss091_Dc10() public function testGetsTitleFromRss10_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss10.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -226,7 +223,7 @@ public function testGetsTitleFromRss10_Dc10() public function testGetsTitleFromRss090_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss090.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -236,7 +233,7 @@ public function testGetsTitleFromRss090_Dc10() public function testGetsTitleFromRss20_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss20.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -244,7 +241,7 @@ public function testGetsTitleFromRss20_Dc11() public function testGetsTitleFromRss094_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss094.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -252,7 +249,7 @@ public function testGetsTitleFromRss094_Dc11() public function testGetsTitleFromRss093_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss093.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -260,7 +257,7 @@ public function testGetsTitleFromRss093_Dc11() public function testGetsTitleFromRss092_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss092.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -268,7 +265,7 @@ public function testGetsTitleFromRss092_Dc11() public function testGetsTitleFromRss091_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss091.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -276,7 +273,7 @@ public function testGetsTitleFromRss091_Dc11() public function testGetsTitleFromRss10_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss10.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -284,7 +281,7 @@ public function testGetsTitleFromRss10_Dc11() public function testGetsTitleFromRss090_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss090.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -294,7 +291,7 @@ public function testGetsTitleFromRss090_Dc11() public function testGetsTitleFromRss20_atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss20.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -302,7 +299,7 @@ public function testGetsTitleFromRss20_atom10() public function testGetsTitleFromRss094_atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss094.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -310,7 +307,7 @@ public function testGetsTitleFromRss094_atom10() public function testGetsTitleFromRss093_atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss093.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -318,7 +315,7 @@ public function testGetsTitleFromRss093_atom10() public function testGetsTitleFromRss092_atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss092.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -326,7 +323,7 @@ public function testGetsTitleFromRss092_atom10() public function testGetsTitleFromRss091_atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss091.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -334,7 +331,7 @@ public function testGetsTitleFromRss091_atom10() public function testGetsTitleFromRss10_atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss10.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -342,7 +339,7 @@ public function testGetsTitleFromRss10_atom10() public function testGetsTitleFromRss090_atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss090.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -352,7 +349,7 @@ public function testGetsTitleFromRss090_atom10() public function testGetsTitleFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -360,7 +357,7 @@ public function testGetsTitleFromRss20_None() public function testGetsTitleFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -368,7 +365,7 @@ public function testGetsTitleFromRss094_None() public function testGetsTitleFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -376,7 +373,7 @@ public function testGetsTitleFromRss093_None() public function testGetsTitleFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -384,7 +381,7 @@ public function testGetsTitleFromRss092_None() public function testGetsTitleFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -392,7 +389,7 @@ public function testGetsTitleFromRss091_None() public function testGetsTitleFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -400,7 +397,7 @@ public function testGetsTitleFromRss10_None() public function testGetsTitleFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -411,7 +408,7 @@ public function testGetsTitleFromRss090_None() */ public function testGetsAuthorArrayFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') ); $this->assertEquals(array( @@ -423,7 +420,7 @@ public function testGetsAuthorArrayFromRss20() public function testGetsAuthorArrayFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') ); $this->assertEquals(array( @@ -435,7 +432,7 @@ public function testGetsAuthorArrayFromRss094() public function testGetsAuthorArrayFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') ); $this->assertEquals(array( @@ -447,7 +444,7 @@ public function testGetsAuthorArrayFromRss093() public function testGetsAuthorArrayFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') ); $this->assertEquals(array( @@ -459,7 +456,7 @@ public function testGetsAuthorArrayFromRss092() public function testGetsAuthorArrayFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') ); $this->assertEquals(array( @@ -471,7 +468,7 @@ public function testGetsAuthorArrayFromRss091() public function testGetsAuthorArrayFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') ); $this->assertEquals(array( @@ -483,7 +480,7 @@ public function testGetsAuthorArrayFromRss10() public function testGetsAuthorArrayFromRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') ); $this->assertEquals(array( @@ -497,7 +494,7 @@ public function testGetsAuthorArrayFromRss090() public function testGetsAuthorArrayFromRss20_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') ); $this->assertEquals(array( @@ -508,7 +505,7 @@ public function testGetsAuthorArrayFromRss20_Dc10() public function testGetsAuthorArrayFromRss094_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') ); $this->assertEquals(array( @@ -519,7 +516,7 @@ public function testGetsAuthorArrayFromRss094_Dc10() public function testGetsAuthorArrayFromRss093_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') ); $this->assertEquals(array( @@ -530,7 +527,7 @@ public function testGetsAuthorArrayFromRss093_Dc10() public function testGetsAuthorArrayFromRss092_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') ); $this->assertEquals(array( @@ -541,7 +538,7 @@ public function testGetsAuthorArrayFromRss092_Dc10() public function testGetsAuthorArrayFromRss091_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') ); $this->assertEquals(array( @@ -552,7 +549,7 @@ public function testGetsAuthorArrayFromRss091_Dc10() public function testGetsAuthorArrayFromRss10_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') ); $this->assertEquals(array( @@ -563,7 +560,7 @@ public function testGetsAuthorArrayFromRss10_Dc10() public function testGetsAuthorArrayFromRss090_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') ); $this->assertEquals(array( @@ -576,7 +573,7 @@ public function testGetsAuthorArrayFromRss090_Dc10() public function testGetsAuthorArrayFromRss20_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') ); $this->assertEquals(array( @@ -587,7 +584,7 @@ public function testGetsAuthorArrayFromRss20_Dc11() public function testGetsAuthorArrayFromRss094_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') ); $this->assertEquals(array( @@ -598,7 +595,7 @@ public function testGetsAuthorArrayFromRss094_Dc11() public function testGetsAuthorArrayFromRss093_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') ); $this->assertEquals(array( @@ -609,7 +606,7 @@ public function testGetsAuthorArrayFromRss093_Dc11() public function testGetsAuthorArrayFromRss092_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') ); $this->assertEquals(array( @@ -620,7 +617,7 @@ public function testGetsAuthorArrayFromRss092_Dc11() public function testGetsAuthorArrayFromRss091_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') ); $this->assertEquals(array( @@ -631,7 +628,7 @@ public function testGetsAuthorArrayFromRss091_Dc11() public function testGetsAuthorArrayFromRss10_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') ); $this->assertEquals(array( @@ -642,7 +639,7 @@ public function testGetsAuthorArrayFromRss10_Dc11() public function testGetsAuthorArrayFromRss090_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') ); $this->assertEquals(array( @@ -655,7 +652,7 @@ public function testGetsAuthorArrayFromRss090_Dc11() public function testGetsAuthorArrayFromRss20_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss20.xml') ); $this->assertEquals(array( @@ -666,7 +663,7 @@ public function testGetsAuthorArrayFromRss20_Atom10() public function testGetsAuthorArrayFromRss094_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss094.xml') ); $this->assertEquals(array( @@ -677,7 +674,7 @@ public function testGetsAuthorArrayFromRss094_Atom10() public function testGetsAuthorArrayFromRss093_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss093.xml') ); $this->assertEquals(array( @@ -688,7 +685,7 @@ public function testGetsAuthorArrayFromRss093_Atom10() public function testGetsAuthorArrayFromRss092_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss092.xml') ); $this->assertEquals(array( @@ -699,7 +696,7 @@ public function testGetsAuthorArrayFromRss092_Atom10() public function testGetsAuthorArrayFromRss091_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss091.xml') ); $this->assertEquals(array( @@ -710,7 +707,7 @@ public function testGetsAuthorArrayFromRss091_Atom10() public function testGetsAuthorArrayFromRss10_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss10.xml') ); $this->assertEquals(array( @@ -721,7 +718,7 @@ public function testGetsAuthorArrayFromRss10_Atom10() public function testGetsAuthorArrayFromRss090_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss090.xml') ); $this->assertEquals(array( @@ -734,7 +731,7 @@ public function testGetsAuthorArrayFromRss090_Atom10() public function testGetsAuthorArrayFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -742,7 +739,7 @@ public function testGetsAuthorArrayFromRss20_None() public function testGetsAuthorArrayFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -750,7 +747,7 @@ public function testGetsAuthorArrayFromRss094_None() public function testGetsAuthorArrayFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -758,7 +755,7 @@ public function testGetsAuthorArrayFromRss093_None() public function testGetsAuthorArrayFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -766,7 +763,7 @@ public function testGetsAuthorArrayFromRss092_None() public function testGetsAuthorArrayFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -774,7 +771,7 @@ public function testGetsAuthorArrayFromRss091_None() public function testGetsAuthorArrayFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -782,7 +779,7 @@ public function testGetsAuthorArrayFromRss10_None() public function testGetsAuthorArrayFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -793,7 +790,7 @@ public function testGetsAuthorArrayFromRss090_None() */ public function testGetsSingleAuthorFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -801,7 +798,7 @@ public function testGetsSingleAuthorFromRss20() public function testGetsSingleAuthorFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -809,7 +806,7 @@ public function testGetsSingleAuthorFromRss094() public function testGetsSingleAuthorFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -817,7 +814,7 @@ public function testGetsSingleAuthorFromRss093() public function testGetsSingleAuthorFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -825,7 +822,7 @@ public function testGetsSingleAuthorFromRss092() public function testGetsSingleAuthorFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -833,7 +830,7 @@ public function testGetsSingleAuthorFromRss091() public function testGetsSingleAuthorFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -841,7 +838,7 @@ public function testGetsSingleAuthorFromRss10() public function testGetsSingleAuthorFromRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -851,7 +848,7 @@ public function testGetsSingleAuthorFromRss090() public function testGetsSingleAuthorFromRss20_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -859,7 +856,7 @@ public function testGetsSingleAuthorFromRss20_Dc10() public function testGetsSingleAuthorFromRss094_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -867,7 +864,7 @@ public function testGetsSingleAuthorFromRss094_Dc10() public function testGetsSingleAuthorFromRss093_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -875,7 +872,7 @@ public function testGetsSingleAuthorFromRss093_Dc10() public function testGetsSingleAuthorFromRss092_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -883,7 +880,7 @@ public function testGetsSingleAuthorFromRss092_Dc10() public function testGetsSingleAuthorFromRss091_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -891,7 +888,7 @@ public function testGetsSingleAuthorFromRss091_Dc10() public function testGetsSingleAuthorFromRss10_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -899,7 +896,7 @@ public function testGetsSingleAuthorFromRss10_Dc10() public function testGetsSingleAuthorFromRss090_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -909,7 +906,7 @@ public function testGetsSingleAuthorFromRss090_Dc10() public function testGetsSingleAuthorFromRss20_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -917,7 +914,7 @@ public function testGetsSingleAuthorFromRss20_Dc11() public function testGetsSingleAuthorFromRss094_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -925,7 +922,7 @@ public function testGetsSingleAuthorFromRss094_Dc11() public function testGetsSingleAuthorFromRss093_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -933,7 +930,7 @@ public function testGetsSingleAuthorFromRss093_Dc11() public function testGetsSingleAuthorFromRss092_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -941,7 +938,7 @@ public function testGetsSingleAuthorFromRss092_Dc11() public function testGetsSingleAuthorFromRss091_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -949,7 +946,7 @@ public function testGetsSingleAuthorFromRss091_Dc11() public function testGetsSingleAuthorFromRss10_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -957,7 +954,7 @@ public function testGetsSingleAuthorFromRss10_Dc11() public function testGetsSingleAuthorFromRss090_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -967,7 +964,7 @@ public function testGetsSingleAuthorFromRss090_Dc11() public function testGetsSingleAuthorFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -975,7 +972,7 @@ public function testGetsSingleAuthorFromRss20_None() public function testGetsSingleAuthorFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -983,7 +980,7 @@ public function testGetsSingleAuthorFromRss094_None() public function testGetsSingleAuthorFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -991,7 +988,7 @@ public function testGetsSingleAuthorFromRss093_None() public function testGetsSingleAuthorFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -999,7 +996,7 @@ public function testGetsSingleAuthorFromRss092_None() public function testGetsSingleAuthorFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -1007,7 +1004,7 @@ public function testGetsSingleAuthorFromRss091_None() public function testGetsSingleAuthorFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -1015,7 +1012,7 @@ public function testGetsSingleAuthorFromRss10_None() public function testGetsSingleAuthorFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -1026,7 +1023,7 @@ public function testGetsSingleAuthorFromRss090_None() */ public function testGetsCopyrightFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss20.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1034,7 +1031,7 @@ public function testGetsCopyrightFromRss20() public function testGetsCopyrightFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss094.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1042,7 +1039,7 @@ public function testGetsCopyrightFromRss094() public function testGetsCopyrightFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss093.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1050,7 +1047,7 @@ public function testGetsCopyrightFromRss093() public function testGetsCopyrightFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss092.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1058,7 +1055,7 @@ public function testGetsCopyrightFromRss092() public function testGetsCopyrightFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss091.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1066,7 +1063,7 @@ public function testGetsCopyrightFromRss091() public function testGetsCopyrightFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss10.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1074,7 +1071,7 @@ public function testGetsCopyrightFromRss10() public function testGetsCopyrightFromRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss090.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1084,7 +1081,7 @@ public function testGetsCopyrightFromRss090() public function testGetsCopyrightFromRss20_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss20.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1092,7 +1089,7 @@ public function testGetsCopyrightFromRss20_Dc10() public function testGetsCopyrightFromRss094_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss094.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1100,7 +1097,7 @@ public function testGetsCopyrightFromRss094_Dc10() public function testGetsCopyrightFromRss093_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss093.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1108,7 +1105,7 @@ public function testGetsCopyrightFromRss093_Dc10() public function testGetsCopyrightFromRss092_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss092.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1116,7 +1113,7 @@ public function testGetsCopyrightFromRss092_Dc10() public function testGetsCopyrightFromRss091_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss091.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1124,7 +1121,7 @@ public function testGetsCopyrightFromRss091_Dc10() public function testGetsCopyrightFromRss10_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss10.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1132,7 +1129,7 @@ public function testGetsCopyrightFromRss10_Dc10() public function testGetsCopyrightFromRss090_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss090.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1142,7 +1139,7 @@ public function testGetsCopyrightFromRss090_Dc10() public function testGetsCopyrightFromRss20_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss20.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1150,7 +1147,7 @@ public function testGetsCopyrightFromRss20_Dc11() public function testGetsCopyrightFromRss094_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss094.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1158,7 +1155,7 @@ public function testGetsCopyrightFromRss094_Dc11() public function testGetsCopyrightFromRss093_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss093.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1166,7 +1163,7 @@ public function testGetsCopyrightFromRss093_Dc11() public function testGetsCopyrightFromRss092_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss092.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1174,7 +1171,7 @@ public function testGetsCopyrightFromRss092_Dc11() public function testGetsCopyrightFromRss091_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss091.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1182,7 +1179,7 @@ public function testGetsCopyrightFromRss091_Dc11() public function testGetsCopyrightFromRss10_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss10.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1190,7 +1187,7 @@ public function testGetsCopyrightFromRss10_Dc11() public function testGetsCopyrightFromRss090_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss090.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1200,7 +1197,7 @@ public function testGetsCopyrightFromRss090_Dc11() public function testGetsCopyrightFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1208,7 +1205,7 @@ public function testGetsCopyrightFromRss20_None() public function testGetsCopyrightFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1216,7 +1213,7 @@ public function testGetsCopyrightFromRss094_None() public function testGetsCopyrightFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1224,7 +1221,7 @@ public function testGetsCopyrightFromRss093_None() public function testGetsCopyrightFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1232,7 +1229,7 @@ public function testGetsCopyrightFromRss092_None() public function testGetsCopyrightFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1240,7 +1237,7 @@ public function testGetsCopyrightFromRss091_None() public function testGetsCopyrightFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1248,7 +1245,7 @@ public function testGetsCopyrightFromRss10_None() public function testGetsCopyrightFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1259,7 +1256,7 @@ public function testGetsCopyrightFromRss090_None() */ public function testGetsDescriptionFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss20.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1267,7 +1264,7 @@ public function testGetsDescriptionFromRss20() public function testGetsDescriptionFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss094.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1275,7 +1272,7 @@ public function testGetsDescriptionFromRss094() public function testGetsDescriptionFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss093.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1283,7 +1280,7 @@ public function testGetsDescriptionFromRss093() public function testGetsDescriptionFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss092.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1291,7 +1288,7 @@ public function testGetsDescriptionFromRss092() public function testGetsDescriptionFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss091.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1299,7 +1296,7 @@ public function testGetsDescriptionFromRss091() public function testGetsDescriptionFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss10.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1307,7 +1304,7 @@ public function testGetsDescriptionFromRss10() public function testGetsDescriptionFromRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss090.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1317,7 +1314,7 @@ public function testGetsDescriptionFromRss090() public function testGetsDescriptionFromRss20_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss20.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1325,7 +1322,7 @@ public function testGetsDescriptionFromRss20_Dc10() public function testGetsDescriptionFromRss094_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss094.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1333,7 +1330,7 @@ public function testGetsDescriptionFromRss094_Dc10() public function testGetsDescriptionFromRss093_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss093.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1341,7 +1338,7 @@ public function testGetsDescriptionFromRss093_Dc10() public function testGetsDescriptionFromRss092_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss092.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1349,7 +1346,7 @@ public function testGetsDescriptionFromRss092_Dc10() public function testGetsDescriptionFromRss091_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss091.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1357,7 +1354,7 @@ public function testGetsDescriptionFromRss091_Dc10() public function testGetsDescriptionFromRss10_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss10.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1365,7 +1362,7 @@ public function testGetsDescriptionFromRss10_Dc10() public function testGetsDescriptionFromRss090_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss090.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1375,7 +1372,7 @@ public function testGetsDescriptionFromRss090_Dc10() public function testGetsDescriptionFromRss20_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss20.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1383,7 +1380,7 @@ public function testGetsDescriptionFromRss20_Dc11() public function testGetsDescriptionFromRss094_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss094.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1391,7 +1388,7 @@ public function testGetsDescriptionFromRss094_Dc11() public function testGetsDescriptionFromRss093_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss093.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1399,7 +1396,7 @@ public function testGetsDescriptionFromRss093_Dc11() public function testGetsDescriptionFromRss092_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss092.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1407,7 +1404,7 @@ public function testGetsDescriptionFromRss092_Dc11() public function testGetsDescriptionFromRss091_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss091.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1415,7 +1412,7 @@ public function testGetsDescriptionFromRss091_Dc11() public function testGetsDescriptionFromRss10_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss10.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1423,7 +1420,7 @@ public function testGetsDescriptionFromRss10_Dc11() public function testGetsDescriptionFromRss090_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss090.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1433,7 +1430,7 @@ public function testGetsDescriptionFromRss090_Dc11() public function testGetsDescriptionFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1441,7 +1438,7 @@ public function testGetsDescriptionFromRss20_None() public function testGetsDescriptionFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1449,7 +1446,7 @@ public function testGetsDescriptionFromRss094_None() public function testGetsDescriptionFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1457,7 +1454,7 @@ public function testGetsDescriptionFromRss093_None() public function testGetsDescriptionFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1465,7 +1462,7 @@ public function testGetsDescriptionFromRss092_None() public function testGetsDescriptionFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1473,7 +1470,7 @@ public function testGetsDescriptionFromRss091_None() public function testGetsDescriptionFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1481,7 +1478,7 @@ public function testGetsDescriptionFromRss10_None() public function testGetsDescriptionFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1492,7 +1489,7 @@ public function testGetsDescriptionFromRss090_None() */ public function testGetsLanguageFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss20.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1500,7 +1497,7 @@ public function testGetsLanguageFromRss20() public function testGetsLanguageFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss094.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1508,7 +1505,7 @@ public function testGetsLanguageFromRss094() public function testGetsLanguageFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss093.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1516,7 +1513,7 @@ public function testGetsLanguageFromRss093() public function testGetsLanguageFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss092.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1524,7 +1521,7 @@ public function testGetsLanguageFromRss092() public function testGetsLanguageFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss091.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1532,7 +1529,7 @@ public function testGetsLanguageFromRss091() public function testGetsLanguageFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss10.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1540,7 +1537,7 @@ public function testGetsLanguageFromRss10() public function testGetsLanguageFromRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss090.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1550,7 +1547,7 @@ public function testGetsLanguageFromRss090() public function testGetsLanguageFromRss20_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss20.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1558,7 +1555,7 @@ public function testGetsLanguageFromRss20_Dc10() public function testGetsLanguageFromRss094_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss094.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1566,7 +1563,7 @@ public function testGetsLanguageFromRss094_Dc10() public function testGetsLanguageFromRss093_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss093.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1574,7 +1571,7 @@ public function testGetsLanguageFromRss093_Dc10() public function testGetsLanguageFromRss092_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss092.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1582,7 +1579,7 @@ public function testGetsLanguageFromRss092_Dc10() public function testGetsLanguageFromRss091_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss091.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1590,7 +1587,7 @@ public function testGetsLanguageFromRss091_Dc10() public function testGetsLanguageFromRss10_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss10.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1598,7 +1595,7 @@ public function testGetsLanguageFromRss10_Dc10() public function testGetsLanguageFromRss090_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss090.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1608,7 +1605,7 @@ public function testGetsLanguageFromRss090_Dc10() public function testGetsLanguageFromRss20_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss20.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1616,7 +1613,7 @@ public function testGetsLanguageFromRss20_Dc11() public function testGetsLanguageFromRss094_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss094.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1624,7 +1621,7 @@ public function testGetsLanguageFromRss094_Dc11() public function testGetsLanguageFromRss093_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss093.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1632,7 +1629,7 @@ public function testGetsLanguageFromRss093_Dc11() public function testGetsLanguageFromRss092_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss092.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1640,7 +1637,7 @@ public function testGetsLanguageFromRss092_Dc11() public function testGetsLanguageFromRss091_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss091.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1648,7 +1645,7 @@ public function testGetsLanguageFromRss091_Dc11() public function testGetsLanguageFromRss10_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss10.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1656,7 +1653,7 @@ public function testGetsLanguageFromRss10_Dc11() public function testGetsLanguageFromRss090_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss090.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1666,7 +1663,7 @@ public function testGetsLanguageFromRss090_Dc11() public function testGetsLanguageFromRss10_XmlLang() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rdf/rss10.xml') ); $this->assertEquals('en', $feed->getLanguage()); @@ -1676,7 +1673,7 @@ public function testGetsLanguageFromRss10_XmlLang() public function testGetsLanguageFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1684,7 +1681,7 @@ public function testGetsLanguageFromRss20_None() public function testGetsLanguageFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1692,7 +1689,7 @@ public function testGetsLanguageFromRss094_None() public function testGetsLanguageFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1700,7 +1697,7 @@ public function testGetsLanguageFromRss093_None() public function testGetsLanguageFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1708,7 +1705,7 @@ public function testGetsLanguageFromRss092_None() public function testGetsLanguageFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1716,7 +1713,7 @@ public function testGetsLanguageFromRss091_None() public function testGetsLanguageFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1724,7 +1721,7 @@ public function testGetsLanguageFromRss10_None() public function testGetsLanguageFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1735,7 +1732,7 @@ public function testGetsLanguageFromRss090_None() */ public function testGetsLinkFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss20.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1743,7 +1740,7 @@ public function testGetsLinkFromRss20() public function testGetsLinkFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss094.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1751,7 +1748,7 @@ public function testGetsLinkFromRss094() public function testGetsLinkFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss093.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1759,7 +1756,7 @@ public function testGetsLinkFromRss093() public function testGetsLinkFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss092.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1767,7 +1764,7 @@ public function testGetsLinkFromRss092() public function testGetsLinkFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss091.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1775,7 +1772,7 @@ public function testGetsLinkFromRss091() public function testGetsLinkFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss10.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1783,7 +1780,7 @@ public function testGetsLinkFromRss10() public function testGetsLinkFromRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss090.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1793,7 +1790,7 @@ public function testGetsLinkFromRss090() public function testGetsLinkFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1801,7 +1798,7 @@ public function testGetsLinkFromRss20_None() public function testGetsLinkFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1809,7 +1806,7 @@ public function testGetsLinkFromRss094_None() public function testGetsLinkFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1817,7 +1814,7 @@ public function testGetsLinkFromRss093_None() public function testGetsLinkFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1825,7 +1822,7 @@ public function testGetsLinkFromRss092_None() public function testGetsLinkFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1833,7 +1830,7 @@ public function testGetsLinkFromRss091_None() public function testGetsLinkFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1841,7 +1838,7 @@ public function testGetsLinkFromRss10_None() public function testGetsLinkFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1853,7 +1850,7 @@ public function testGetsLinkFromRss090_None() public function testCountableInterface() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss090.xml') ); $this->assertEquals(0, count($feed)); @@ -1864,15 +1861,24 @@ public function testCountableInterface() */ public function testGetsFeedLinkFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss20.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); } + public function testGetsOriginalSourceUriIfFeedLinkNotAvailableFromFeed() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss20_NoFeedLink.xml') + ); + $feed->setOriginalSourceUri('http://www.example.com/feed/rss'); + $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); + } + public function testGetsFeedLinkFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss094.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1880,7 +1886,7 @@ public function testGetsFeedLinkFromRss094() public function testGetsFeedLinkFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss093.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1888,7 +1894,7 @@ public function testGetsFeedLinkFromRss093() public function testGetsFeedLinkFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss092.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1896,7 +1902,7 @@ public function testGetsFeedLinkFromRss092() public function testGetsFeedLinkFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss091.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1904,7 +1910,7 @@ public function testGetsFeedLinkFromRss091() public function testGetsFeedLinkFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss10.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1912,7 +1918,7 @@ public function testGetsFeedLinkFromRss10() public function testGetsFeedLinkFromRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss090.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1922,7 +1928,7 @@ public function testGetsFeedLinkFromRss090() public function testGetsFeedLinkFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1930,7 +1936,7 @@ public function testGetsFeedLinkFromRss20_None() public function testGetsFeedLinkFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1938,7 +1944,7 @@ public function testGetsFeedLinkFromRss094_None() public function testGetsFeedLinkFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1946,7 +1952,7 @@ public function testGetsFeedLinkFromRss093_None() public function testGetsFeedLinkFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1954,7 +1960,7 @@ public function testGetsFeedLinkFromRss092_None() public function testGetsFeedLinkFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1962,7 +1968,7 @@ public function testGetsFeedLinkFromRss091_None() public function testGetsFeedLinkFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1970,7 +1976,7 @@ public function testGetsFeedLinkFromRss10_None() public function testGetsFeedLinkFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1981,7 +1987,7 @@ public function testGetsFeedLinkFromRss090_None() */ public function testGetsGeneratorFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss20.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -1989,7 +1995,7 @@ public function testGetsGeneratorFromRss20() public function testGetsGeneratorFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss094.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -1997,7 +2003,7 @@ public function testGetsGeneratorFromRss094() public function testGetsGeneratorFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss093.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -2005,7 +2011,7 @@ public function testGetsGeneratorFromRss093() public function testGetsGeneratorFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss092.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -2013,7 +2019,7 @@ public function testGetsGeneratorFromRss092() public function testGetsGeneratorFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss091.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -2021,7 +2027,7 @@ public function testGetsGeneratorFromRss091() public function testGetsGeneratorFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss10.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -2029,7 +2035,7 @@ public function testGetsGeneratorFromRss10() public function testGetsGeneratorFromRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss090.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -2039,7 +2045,7 @@ public function testGetsGeneratorFromRss090() public function testGetsGeneratorFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2047,7 +2053,7 @@ public function testGetsGeneratorFromRss20_None() public function testGetsGeneratorFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2055,7 +2061,7 @@ public function testGetsGeneratorFromRss094_None() public function testGetsGeneratorFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2063,7 +2069,7 @@ public function testGetsGeneratorFromRss093_None() public function testGetsGeneratorFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2071,7 +2077,7 @@ public function testGetsGeneratorFromRss092_None() public function testGetsGeneratorFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2079,7 +2085,7 @@ public function testGetsGeneratorFromRss091_None() public function testGetsGeneratorFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2087,94 +2093,132 @@ public function testGetsGeneratorFromRss10_None() public function testGetsGeneratorFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getGenerator()); } + /** + * Get Last Build Date (Unencoded Text) + */ + public function testGetsLastBuildDateFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/lastbuilddate/plain/rss20.xml') + ); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $this->assertTrue($edate->equals($feed->getLastBuildDate())); + } + + public function testGetsLastBuildDateFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/lastbuilddate/plain/none/rss20.xml') + ); + $this->assertEquals(null, $feed->getLastBuildDate()); + } + /** * Get Date Modified (Unencoded Text) */ public function testGetsDateModifiedFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } + /** + * @group ZF-8702 + */ + public function testParsesCorrectDateIfMissingOffsetWhenSystemUsesUSLocale() + { + $locale = new Zend_Locale('en_US'); + Zend_Registry::set('Zend_Locale', $locale); + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20_en_US.xml') + ); + $fdate = $feed->getDateModified(); + $edate = new Zend_Date; + $edate->set('2010-01-04T08:14:00-0600', Zend_Date::ISO_8601); + Zend_Registry::getInstance()->offsetUnset('Zend_Locale'); + $this->assertTrue($edate->equals($fdate)); + } + // DC 1.0 public function testGetsDateModifiedFromRss20_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss20.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss094_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss094.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss093_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss093.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss092_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss092.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss091_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss091.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss10_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss10.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss090_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss090.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } @@ -2182,71 +2226,71 @@ public function testGetsDateModifiedFromRss090_Dc10() public function testGetsDateModifiedFromRss20_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss20.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss094_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss094.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss093_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss093.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss092_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss092.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss091_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss091.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss10_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss10.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss090_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss090.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } @@ -2254,71 +2298,71 @@ public function testGetsDateModifiedFromRss090_Dc11() public function testGetsDateModifiedFromRss20_atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss20.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss094_atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss094.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss093_atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss093.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss092_atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss092.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss091_atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss091.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss10_atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss10.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss090_atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss090.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); + $edate = new Zend_Date; + $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } @@ -2326,7 +2370,7 @@ public function testGetsDateModifiedFromRss090_atom10() public function testGetsDateModifiedFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2334,7 +2378,7 @@ public function testGetsDateModifiedFromRss20_None() public function testGetsDateModifiedFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2342,7 +2386,7 @@ public function testGetsDateModifiedFromRss094_None() public function testGetsDateModifiedFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2350,7 +2394,7 @@ public function testGetsDateModifiedFromRss093_None() public function testGetsDateModifiedFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2358,7 +2402,7 @@ public function testGetsDateModifiedFromRss092_None() public function testGetsDateModifiedFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2366,7 +2410,7 @@ public function testGetsDateModifiedFromRss091_None() public function testGetsDateModifiedFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2374,7 +2418,7 @@ public function testGetsDateModifiedFromRss10_None() public function testGetsDateModifiedFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2385,7 +2429,7 @@ public function testGetsDateModifiedFromRss090_None() */ public function testGetsHubsFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss20.xml') ); $this->assertEquals(array( @@ -2396,7 +2440,7 @@ public function testGetsHubsFromRss20() public function testGetsHubsFromRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss094.xml') ); $this->assertEquals(array( @@ -2407,7 +2451,7 @@ public function testGetsHubsFromRss094() public function testGetsHubsFromRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss093.xml') ); $this->assertEquals(array( @@ -2418,7 +2462,7 @@ public function testGetsHubsFromRss093() public function testGetsHubsFromRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss092.xml') ); $this->assertEquals(array( @@ -2429,7 +2473,7 @@ public function testGetsHubsFromRss092() public function testGetsHubsFromRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss091.xml') ); $this->assertEquals(array( @@ -2440,7 +2484,7 @@ public function testGetsHubsFromRss091() public function testGetsHubsFromRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss10.xml') ); $this->assertEquals(array( @@ -2451,7 +2495,7 @@ public function testGetsHubsFromRss10() public function testGetsHubsFromRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss090.xml') ); $this->assertEquals(array( @@ -2464,7 +2508,7 @@ public function testGetsHubsFromRss090() public function testGetsHubsFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2472,7 +2516,7 @@ public function testGetsHubsFromRss20_None() public function testGetsHubsFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2480,7 +2524,7 @@ public function testGetsHubsFromRss094_None() public function testGetsHubsFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2488,7 +2532,7 @@ public function testGetsHubsFromRss093_None() public function testGetsHubsFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2496,7 +2540,7 @@ public function testGetsHubsFromRss092_None() public function testGetsHubsFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2504,7 +2548,7 @@ public function testGetsHubsFromRss091_None() public function testGetsHubsFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2512,7 +2556,7 @@ public function testGetsHubsFromRss10_None() public function testGetsHubsFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2526,7 +2570,7 @@ public function testGetsHubsFromRss090_None() public function testGetsCategoriesFromRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/rss20.xml') ); $this->assertEquals($this->_expectedCats, (array) $feed->getCategories()); @@ -2537,7 +2581,7 @@ public function testGetsCategoriesFromRss20() public function testGetsCategoriesFromRss090_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss090.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2546,7 +2590,7 @@ public function testGetsCategoriesFromRss090_Dc10() public function testGetsCategoriesFromRss091_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss091.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2555,7 +2599,7 @@ public function testGetsCategoriesFromRss091_Dc10() public function testGetsCategoriesFromRss092_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss092.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2564,7 +2608,7 @@ public function testGetsCategoriesFromRss092_Dc10() public function testGetsCategoriesFromRss093_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss093.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2573,7 +2617,7 @@ public function testGetsCategoriesFromRss093_Dc10() public function testGetsCategoriesFromRss094_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss094.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2582,7 +2626,7 @@ public function testGetsCategoriesFromRss094_Dc10() public function testGetsCategoriesFromRss10_Dc10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss10.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2593,7 +2637,7 @@ public function testGetsCategoriesFromRss10_Dc10() public function testGetsCategoriesFromRss090_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss090.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2602,7 +2646,7 @@ public function testGetsCategoriesFromRss090_Dc11() public function testGetsCategoriesFromRss091_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss091.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2611,7 +2655,7 @@ public function testGetsCategoriesFromRss091_Dc11() public function testGetsCategoriesFromRss092_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss092.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2620,7 +2664,7 @@ public function testGetsCategoriesFromRss092_Dc11() public function testGetsCategoriesFromRss093_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss093.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2629,7 +2673,7 @@ public function testGetsCategoriesFromRss093_Dc11() public function testGetsCategoriesFromRss094_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss094.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2638,7 +2682,7 @@ public function testGetsCategoriesFromRss094_Dc11() public function testGetsCategoriesFromRss10_Dc11() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss10.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2649,7 +2693,7 @@ public function testGetsCategoriesFromRss10_Dc11() public function testGetsCategoriesFromRss090_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss090.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2658,7 +2702,7 @@ public function testGetsCategoriesFromRss090_Atom10() public function testGetsCategoriesFromRss091_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss091.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2667,7 +2711,7 @@ public function testGetsCategoriesFromRss091_Atom10() public function testGetsCategoriesFromRss092_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss092.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2676,7 +2720,7 @@ public function testGetsCategoriesFromRss092_Atom10() public function testGetsCategoriesFromRss093_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss093.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2685,7 +2729,7 @@ public function testGetsCategoriesFromRss093_Atom10() public function testGetsCategoriesFromRss094_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss094.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2694,7 +2738,7 @@ public function testGetsCategoriesFromRss094_Atom10() public function testGetsCategoriesFromRss10_Atom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss10.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2705,7 +2749,7 @@ public function testGetsCategoriesFromRss10_Atom10() public function testGetsCategoriesFromRss20_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss20.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2714,7 +2758,7 @@ public function testGetsCategoriesFromRss20_None() public function testGetsCategoriesFromRss090_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss090.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2723,7 +2767,7 @@ public function testGetsCategoriesFromRss090_None() public function testGetsCategoriesFromRss091_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss091.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2732,7 +2776,7 @@ public function testGetsCategoriesFromRss091_None() public function testGetsCategoriesFromRss092_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss092.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2741,7 +2785,7 @@ public function testGetsCategoriesFromRss092_None() public function testGetsCategoriesFromRss093_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss093.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2750,7 +2794,7 @@ public function testGetsCategoriesFromRss093_None() public function testGetsCategoriesFromRss094_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss094.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2759,11 +2803,178 @@ public function testGetsCategoriesFromRss094_None() public function testGetsCategoriesFromRss10_None() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss10.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); } + /** + * Get Image data (Unencoded Text) + */ + public function testGetsImageFromRss20() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/rss20.xml') + ); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/image.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image title', + 'height' => '55', + 'width' => '50', + 'description' => 'Image description' + ), $feed->getImage()); + } + + public function testGetsImageFromRss094() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/rss094.xml') + ); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/image.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image title', + 'height' => '55', + 'width' => '50', + 'description' => 'Image description' + ), $feed->getImage()); + } + + public function testGetsImageFromRss093() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/rss093.xml') + ); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/image.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image title', + 'height' => '55', + 'width' => '50', + 'description' => 'Image description' + ), $feed->getImage()); + } + + public function testGetsImageFromRss092() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/rss092.xml') + ); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/image.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image title', + 'height' => '55', + 'width' => '50', + 'description' => 'Image description' + ), $feed->getImage()); + } + + public function testGetsImageFromRss091() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/rss091.xml') + ); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/image.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image title', + 'height' => '55', + 'width' => '50', + 'description' => 'Image description' + ), $feed->getImage()); + } + + /*public function testGetsImageFromRss10() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/rss10.xml') + ); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/image.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image title', + 'height' => '55', + 'width' => '50', + 'description' => 'Image description' + ), $feed->getImage()); + } + + public function testGetsImageFromRss090() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/rss090.xml') + ); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/image.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image title', + 'height' => '55', + 'width' => '50', + 'description' => 'Image description' + ), $feed->getImage()); + }*/ + + /** + * Get Image data (Unencoded Text) Missing + */ + public function testGetsImageFromRss20_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/rss20.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } + + public function testGetsImageFromRss094_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/rss094.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } + + public function testGetsImageFromRss093_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/rss093.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } + + public function testGetsImageFromRss092_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/rss092.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } + + public function testGetsImageFromRss091_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/rss091.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } + + public function testGetsImageFromRss10_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/rss10.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } + + public function testGetsImageFromRss090_None() + { + $feed = Zend_Feed_Reader::importString( + file_get_contents($this->_feedSamplePath.'/image/plain/none/rss090.xml') + ); + $this->assertEquals(null, $feed->getImage()); + } + } diff --git a/test/Reader/Feed/_files/Atom/feedlink/plain/atom10_NoFeedLink.xml b/test/Reader/Feed/_files/Atom/feedlink/plain/atom10_NoFeedLink.xml new file mode 100644 index 00000000..2d884af2 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/feedlink/plain/atom10_NoFeedLink.xml @@ -0,0 +1,3 @@ + + + diff --git a/test/Reader/Feed/_files/Atom/image/plain/atom03.xml b/test/Reader/Feed/_files/Atom/image/plain/atom03.xml new file mode 100644 index 00000000..b4b808c9 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/image/plain/atom03.xml @@ -0,0 +1,4 @@ + + + http://www.example.com/logo.gif + diff --git a/test/Reader/Feed/_files/Atom/image/plain/atom10.xml b/test/Reader/Feed/_files/Atom/image/plain/atom10.xml new file mode 100644 index 00000000..7d674488 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/image/plain/atom10.xml @@ -0,0 +1,4 @@ + + + http://www.example.com/logo.gif + diff --git a/test/Reader/Feed/_files/Atom/image/plain/none/atom03.xml b/test/Reader/Feed/_files/Atom/image/plain/none/atom03.xml new file mode 100644 index 00000000..57c63ee9 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/image/plain/none/atom03.xml @@ -0,0 +1,3 @@ + + + diff --git a/test/Reader/Feed/_files/Atom/image/plain/none/atom10.xml b/test/Reader/Feed/_files/Atom/image/plain/none/atom10.xml new file mode 100644 index 00000000..2d884af2 --- /dev/null +++ b/test/Reader/Feed/_files/Atom/image/plain/none/atom10.xml @@ -0,0 +1,3 @@ + + + diff --git a/test/Reader/Feed/_files/Rss/datemodified/plain/rss20_en_US.xml b/test/Reader/Feed/_files/Rss/datemodified/plain/rss20_en_US.xml new file mode 100644 index 00000000..778b10c8 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/datemodified/plain/rss20_en_US.xml @@ -0,0 +1,6 @@ + + + + Mon, 4 Jan 2010 02:14:00 CST + + diff --git a/test/Reader/Feed/_files/Rss/feedlink/plain/rss20_NoFeedLink.xml b/test/Reader/Feed/_files/Rss/feedlink/plain/rss20_NoFeedLink.xml new file mode 100644 index 00000000..db102b5d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/feedlink/plain/rss20_NoFeedLink.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/test/Reader/Feed/_files/Rss/image/plain/none/rss090.xml b/test/Reader/Feed/_files/Rss/image/plain/none/rss090.xml new file mode 100644 index 00000000..3cec664b --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/none/rss090.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/image/plain/none/rss091.xml b/test/Reader/Feed/_files/Rss/image/plain/none/rss091.xml new file mode 100644 index 00000000..259a7e27 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/none/rss091.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/image/plain/none/rss092.xml b/test/Reader/Feed/_files/Rss/image/plain/none/rss092.xml new file mode 100644 index 00000000..72ed43e2 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/none/rss092.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/image/plain/none/rss093.xml b/test/Reader/Feed/_files/Rss/image/plain/none/rss093.xml new file mode 100644 index 00000000..1fb8f89e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/none/rss093.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/image/plain/none/rss094.xml b/test/Reader/Feed/_files/Rss/image/plain/none/rss094.xml new file mode 100644 index 00000000..30d48447 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/none/rss094.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/image/plain/none/rss10.xml b/test/Reader/Feed/_files/Rss/image/plain/none/rss10.xml new file mode 100644 index 00000000..67f28b9d --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/none/rss10.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/image/plain/none/rss20.xml b/test/Reader/Feed/_files/Rss/image/plain/none/rss20.xml new file mode 100644 index 00000000..c60501ea --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/none/rss20.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/image/plain/rss090.xml b/test/Reader/Feed/_files/Rss/image/plain/rss090.xml new file mode 100644 index 00000000..a9146377 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/rss090.xml @@ -0,0 +1,15 @@ + + + + + http://www.example.com/image.gif + http://www.example.com + Image title + 50 + 55 + Image description + + + diff --git a/test/Reader/Feed/_files/Rss/image/plain/rss091.xml b/test/Reader/Feed/_files/Rss/image/plain/rss091.xml new file mode 100644 index 00000000..cab325ce --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/rss091.xml @@ -0,0 +1,13 @@ + + + + + http://www.example.com/image.gif + http://www.example.com + Image title + 50 + 55 + Image description + + + diff --git a/test/Reader/Feed/_files/Rss/image/plain/rss092.xml b/test/Reader/Feed/_files/Rss/image/plain/rss092.xml new file mode 100644 index 00000000..c921bb62 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/rss092.xml @@ -0,0 +1,13 @@ + + + + + http://www.example.com/image.gif + http://www.example.com + Image title + 50 + 55 + Image description + + + diff --git a/test/Reader/Feed/_files/Rss/image/plain/rss093.xml b/test/Reader/Feed/_files/Rss/image/plain/rss093.xml new file mode 100644 index 00000000..a76e122a --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/rss093.xml @@ -0,0 +1,13 @@ + + + + + http://www.example.com/image.gif + http://www.example.com + Image title + 50 + 55 + Image description + + + diff --git a/test/Reader/Feed/_files/Rss/image/plain/rss094.xml b/test/Reader/Feed/_files/Rss/image/plain/rss094.xml new file mode 100644 index 00000000..3757c0e0 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/rss094.xml @@ -0,0 +1,13 @@ + + + + + http://www.example.com/image.gif + http://www.example.com + Image title + 50 + 55 + Image description + + + diff --git a/test/Reader/Feed/_files/Rss/image/plain/rss10.xml b/test/Reader/Feed/_files/Rss/image/plain/rss10.xml new file mode 100644 index 00000000..1f8b8757 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/rss10.xml @@ -0,0 +1,15 @@ + + + + + http://www.example.com/image.gif + http://www.example.com + Image title + 50 + 55 + Image description + + + diff --git a/test/Reader/Feed/_files/Rss/image/plain/rss20.xml b/test/Reader/Feed/_files/Rss/image/plain/rss20.xml new file mode 100644 index 00000000..7038f7f3 --- /dev/null +++ b/test/Reader/Feed/_files/Rss/image/plain/rss20.xml @@ -0,0 +1,13 @@ + + + + + http://www.example.com/image.gif + http://www.example.com + Image title + 50 + 55 + Image description + + + diff --git a/test/Reader/Feed/_files/Rss/lastbuilddate/plain/none/rss20.xml b/test/Reader/Feed/_files/Rss/lastbuilddate/plain/none/rss20.xml new file mode 100644 index 00000000..c60501ea --- /dev/null +++ b/test/Reader/Feed/_files/Rss/lastbuilddate/plain/none/rss20.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Reader/Feed/_files/Rss/lastbuilddate/plain/rss20.xml b/test/Reader/Feed/_files/Rss/lastbuilddate/plain/rss20.xml new file mode 100644 index 00000000..5d22fe6e --- /dev/null +++ b/test/Reader/Feed/_files/Rss/lastbuilddate/plain/rss20.xml @@ -0,0 +1,6 @@ + + + + Sat, 07 Mar 2009 08:03:50 +0000 + + diff --git a/test/Reader/Integration/H-OnlineComAtom10Test.php b/test/Reader/Integration/H-OnlineComAtom10Test.php index 9c2ae8fd..8918bf16 100644 --- a/test/Reader/Integration/H-OnlineComAtom10Test.php +++ b/test/Reader/Integration/H-OnlineComAtom10Test.php @@ -17,15 +17,11 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: H-OnlineComAtom10Test.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Reader\Integration; -use Zend\Feed\Reader; -use Zend\Date; +require_once 'PHPUnit/Framework/TestCase.php'; +require_once 'Zend/Feed/Reader.php'; /** * @category Zend @@ -36,32 +32,32 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class HOnlineComAtom10Test extends \PHPUnit_Framework_TestCase +class Zend_Feed_Reader_Integration_HOnlineComAtom10Test extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Reader\Reader::reset(); + Zend_Feed_Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/h-online.com-atom10.xml'; - $this->_options = Date\Date::setOptions(); + $this->_options = Zend_Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Date\Date::setOptions(array('format_type'=>'iso')); + Zend_Date::setOptions(array('format_type'=>'iso')); } public function teardown() { - Date\Date::setOptions($this->_options); + Zend_Date::setOptions($this->_options); } public function testGetsTitle() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('The H - news feed', $feed->getTitle()); @@ -69,7 +65,7 @@ public function testGetsTitle() public function testGetsAuthors() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array(array('name'=>'The H')), (array) $feed->getAuthors()); @@ -77,7 +73,7 @@ public function testGetsAuthors() public function testGetsSingleAuthor() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array('name'=>'The H'), $feed->getAuthor()); @@ -85,7 +81,7 @@ public function testGetsSingleAuthor() public function testGetsCopyright() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(null, $feed->getCopyright()); @@ -93,7 +89,7 @@ public function testGetsCopyright() public function testGetsDescription() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Technology news', $feed->getDescription()); @@ -101,7 +97,7 @@ public function testGetsDescription() public function testGetsLanguage() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(null, $feed->getLanguage()); @@ -109,7 +105,7 @@ public function testGetsLanguage() public function testGetsLink() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://www.h-online.com', $feed->getLink()); @@ -117,7 +113,7 @@ public function testGetsLink() public function testGetsEncoding() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('UTF-8', $feed->getEncoding()); @@ -125,7 +121,7 @@ public function testGetsEncoding() public function testGetsEntryCount() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(60, $feed->count()); @@ -137,7 +133,7 @@ public function testGetsEntryCount() public function testGetsEntryId() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -146,7 +142,7 @@ public function testGetsEntryId() public function testGetsEntryTitle() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -155,7 +151,7 @@ public function testGetsEntryTitle() public function testGetsEntryAuthors() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -164,7 +160,7 @@ public function testGetsEntryAuthors() public function testGetsEntrySingleAuthor() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -173,7 +169,7 @@ public function testGetsEntrySingleAuthor() public function testGetsEntryDescription() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -185,7 +181,7 @@ public function testGetsEntryDescription() public function testGetsEntryContent() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -194,7 +190,7 @@ public function testGetsEntryContent() public function testGetsEntryLinks() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -203,7 +199,7 @@ public function testGetsEntryLinks() public function testGetsEntryLink() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -212,7 +208,7 @@ public function testGetsEntryLink() public function testGetsEntryPermaLink() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -222,7 +218,7 @@ public function testGetsEntryPermaLink() public function testGetsEntryEncoding() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); diff --git a/test/Reader/Integration/LautDeRdfTest.php b/test/Reader/Integration/LautDeRdfTest.php index b73bd327..5604b193 100644 --- a/test/Reader/Integration/LautDeRdfTest.php +++ b/test/Reader/Integration/LautDeRdfTest.php @@ -17,15 +17,11 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: LautDeRdfTest.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Reader\Integration; -use Zend\Feed\Reader; -use Zend\Date; +require_once 'PHPUnit/Framework/TestCase.php'; +require_once 'Zend/Feed/Reader.php'; /** * @category Zend @@ -36,27 +32,27 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class LautDeRdfTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Reader_Integration_LautDeRdfTest extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Reader\Reader::reset(); + Zend_Feed_Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/laut.de-rdf.xml'; - $this->_options = Date\Date::setOptions(); + $this->_options = Zend_Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Date\Date::setOptions(array('format_type'=>'iso')); + Zend_Date::setOptions(array('format_type'=>'iso')); } public function teardown() { - Date\Date::setOptions($this->_options); + Zend_Date::setOptions($this->_options); } /** @@ -65,7 +61,7 @@ public function teardown() public function testGetsTitle() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('laut.de - news', $feed->getTitle()); @@ -73,7 +69,7 @@ public function testGetsTitle() public function testGetsAuthors() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array(array('name'=>'laut.de')), (array) $feed->getAuthors()); @@ -81,7 +77,7 @@ public function testGetsAuthors() public function testGetsSingleAuthor() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array('name'=>'laut.de'), $feed->getAuthor()); @@ -89,7 +85,7 @@ public function testGetsSingleAuthor() public function testGetsCopyright() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Copyright © 2004 laut.de', $feed->getCopyright()); @@ -97,7 +93,7 @@ public function testGetsCopyright() public function testGetsDescription() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('laut.de: aktuelle News', $feed->getDescription()); @@ -105,7 +101,7 @@ public function testGetsDescription() public function testGetsLanguage() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(null, $feed->getLanguage()); @@ -113,7 +109,7 @@ public function testGetsLanguage() public function testGetsLink() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://www.laut.de', $feed->getLink()); @@ -121,7 +117,7 @@ public function testGetsLink() public function testGetsEncoding() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('ISO-8859-1', $feed->getEncoding()); @@ -135,7 +131,7 @@ public function testGetsEncoding() public function testGetsEntryId() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -144,7 +140,7 @@ public function testGetsEntryId() public function testGetsEntryTitle() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -153,7 +149,7 @@ public function testGetsEntryTitle() public function testGetsEntryAuthors() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -162,7 +158,7 @@ public function testGetsEntryAuthors() public function testGetsEntrySingleAuthor() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -176,7 +172,7 @@ public function testGetsEntrySingleAuthor() public function testGetsEntryDescription() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -185,7 +181,7 @@ public function testGetsEntryDescription() public function testGetsEntryContent() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -194,7 +190,7 @@ public function testGetsEntryContent() public function testGetsEntryLinks() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -203,7 +199,7 @@ public function testGetsEntryLinks() public function testGetsEntryLink() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -212,7 +208,7 @@ public function testGetsEntryLink() public function testGetsEntryPermaLink() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -222,7 +218,7 @@ public function testGetsEntryPermaLink() public function testGetsEntryEncoding() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); diff --git a/test/Reader/Integration/PodcastRss2Test.php b/test/Reader/Integration/PodcastRss2Test.php index 29c3fa22..fb08fe03 100644 --- a/test/Reader/Integration/PodcastRss2Test.php +++ b/test/Reader/Integration/PodcastRss2Test.php @@ -17,15 +17,12 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: PodcastRss2Test.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Reader\Integration; -use Zend\Feed\Reader; -use Zend\Date; +require_once dirname(__FILE__) . '/../../../../TestHelper.php'; +require_once 'PHPUnit/Framework/TestCase.php'; +require_once 'Zend/Feed/Reader.php'; /** * @category Zend @@ -36,27 +33,27 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class PodcastRss2Test extends \PHPUnit_Framework_TestCase +class Zend_Feed_Reader_Integration_PodcastRss2Test extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Reader\Reader::reset(); + Zend_Feed_Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/podcast.xml'; - $this->_options = Date\Date::setOptions(); + $this->_options = Zend_Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Date\Date::setOptions(array('format_type'=>'iso')); + Zend_Date::setOptions(array('format_type'=>'iso')); } public function teardown() { - Date\Date::setOptions($this->_options); + Zend_Date::setOptions($this->_options); } /** @@ -65,7 +62,7 @@ public function teardown() public function testGetsNewFeedUrl() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://newlocation.com/example.rss', $feed->getNewFeedUrl()); @@ -73,7 +70,7 @@ public function testGetsNewFeedUrl() public function testGetsOwner() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('john.doe@example.com (John Doe)', $feed->getOwner()); @@ -81,7 +78,7 @@ public function testGetsOwner() public function testGetsCategories() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array( @@ -94,7 +91,7 @@ public function testGetsCategories() public function testGetsTitle() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('All About Everything', $feed->getTitle()); @@ -102,7 +99,7 @@ public function testGetsTitle() public function testGetsCastAuthor() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('John Doe', $feed->getCastAuthor()); @@ -110,7 +107,7 @@ public function testGetsCastAuthor() public function testGetsFeedBlock() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('no', $feed->getBlock()); @@ -118,7 +115,7 @@ public function testGetsFeedBlock() public function testGetsCopyright() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('â„— & © 2005 John Doe & Family', $feed->getCopyright()); @@ -126,7 +123,7 @@ public function testGetsCopyright() public function testGetsDescription() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('All About Everything is a show about everything. @@ -137,7 +134,7 @@ public function testGetsDescription() public function testGetsLanguage() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('en-us', $feed->getLanguage()); @@ -145,7 +142,7 @@ public function testGetsLanguage() public function testGetsLink() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://www.example.com/podcasts/everything/index.html', $feed->getLink()); @@ -153,7 +150,7 @@ public function testGetsLink() public function testGetsEncoding() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('UTF-8', $feed->getEncoding()); @@ -161,7 +158,7 @@ public function testGetsEncoding() public function testGetsFeedExplicit() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('yes', $feed->getExplicit()); @@ -169,7 +166,7 @@ public function testGetsFeedExplicit() public function testGetsEntryCount() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(3, $feed->count()); @@ -177,7 +174,7 @@ public function testGetsEntryCount() public function testGetsImage() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://example.com/podcasts/everything/AllAboutEverything.jpg', $feed->getImage()); @@ -189,7 +186,7 @@ public function testGetsImage() public function testGetsEntryBlock() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -198,7 +195,7 @@ public function testGetsEntryBlock() public function testGetsEntryId() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -207,7 +204,7 @@ public function testGetsEntryId() public function testGetsEntryTitle() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -216,7 +213,7 @@ public function testGetsEntryTitle() public function testGetsEntryCastAuthor() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -225,7 +222,7 @@ public function testGetsEntryCastAuthor() public function testGetsEntryExplicit() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -234,7 +231,7 @@ public function testGetsEntryExplicit() public function testGetsSubtitle() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -244,7 +241,7 @@ public function testGetsSubtitle() public function testGetsSummary() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -256,7 +253,7 @@ public function testGetsSummary() public function testGetsDuration() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -265,7 +262,7 @@ public function testGetsDuration() public function testGetsKeywords() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -275,7 +272,7 @@ public function testGetsKeywords() public function testGetsEntryEncoding() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -284,12 +281,12 @@ public function testGetsEntryEncoding() public function testGetsEnclosure() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); - $expected = new \stdClass(); + $expected = new stdClass(); $expected->url = 'http://example.com/podcasts/everything/AllAboutEverythingEpisode3.m4a'; $expected->length = '8727310'; $expected->type = 'audio/x-m4a'; diff --git a/test/Reader/Integration/WordpressAtom10Test.php b/test/Reader/Integration/WordpressAtom10Test.php index 66c22918..c3a2a134 100644 --- a/test/Reader/Integration/WordpressAtom10Test.php +++ b/test/Reader/Integration/WordpressAtom10Test.php @@ -17,15 +17,11 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: WordpressAtom10Test.php 22300 2010-05-26 10:13:34Z padraic $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Reader\Integration; -use Zend\Feed\Reader; -use Zend\Date; +require_once 'PHPUnit/Framework/TestCase.php'; +require_once 'Zend/Feed/Reader.php'; /** * @category Zend @@ -36,32 +32,32 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class WordpressAtom10Test extends \PHPUnit_Framework_TestCase +class Zend_Feed_Reader_Integration_WordpressAtom10Test extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Reader\Reader::reset(); + Zend_Feed_Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/wordpress-atom10.xml'; - $this->_options = Date\Date::setOptions(); + $this->_options = Zend_Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Date\Date::setOptions(array('format_type'=>'iso')); + Zend_Date::setOptions(array('format_type'=>'iso')); } public function teardown() { - Date\Date::setOptions($this->_options); + Zend_Date::setOptions($this->_options); } public function testGetsTitle() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Norm 2782', $feed->getTitle()); @@ -69,7 +65,7 @@ public function testGetsTitle() public function testGetsAuthors() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array( @@ -79,7 +75,7 @@ public function testGetsAuthors() public function testGetsSingleAuthor() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array('name'=>'norm2782','uri'=>'http://www.norm2782.com'), $feed->getAuthor()); @@ -87,7 +83,7 @@ public function testGetsSingleAuthor() public function testGetsCopyright() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(null, $feed->getCopyright()); @@ -95,7 +91,7 @@ public function testGetsCopyright() public function testGetsDescription() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Why are you here?', $feed->getDescription()); @@ -103,7 +99,7 @@ public function testGetsDescription() public function testGetsLanguage() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('en', $feed->getLanguage()); @@ -111,7 +107,7 @@ public function testGetsLanguage() public function testGetsLink() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://www.norm2782.com', $feed->getLink()); @@ -119,7 +115,7 @@ public function testGetsLink() public function testGetsEncoding() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('UTF-8', $feed->getEncoding()); @@ -127,7 +123,7 @@ public function testGetsEncoding() public function testGetsEntryCount() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(10, $feed->count()); @@ -139,7 +135,7 @@ public function testGetsEntryCount() public function testGetsEntryId() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -148,7 +144,7 @@ public function testGetsEntryId() public function testGetsEntryTitle() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -156,12 +152,12 @@ public function testGetsEntryTitle() * Note: The three dots below is actually a single Unicode character * called the "three dot leader". Don't replace in error! */ - $this->assertEquals('Wth… reading books?', $entry->getTitle()); + $this->assertEquals('Wth… reading books?', $entry->getTitle()); } public function testGetsEntryAuthors() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -170,7 +166,7 @@ public function testGetsEntryAuthors() public function testGetsEntrySingleAuthor() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -179,19 +175,19 @@ public function testGetsEntrySingleAuthor() public function testGetsEntryDescription() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); /** * Note: "’" is not the same as "'" - don't replace in error */ - $this->assertEquals('Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.'."\n\n".'Agile Software Development with Scrum, by Ken Schwaber and Mike Beedle'."\n".'Domain-Driven Design: Tackling Complexity in the [...]', $entry->getDescription()); + $this->assertEquals('Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.'."\n\n".'Agile Software Development with Scrum, by Ken Schwaber and Mike Beedle'."\n".'Domain-Driven Design: Tackling Complexity in the [...]', $entry->getDescription()); } public function testGetsEntryContent() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -200,7 +196,7 @@ public function testGetsEntryContent() public function testGetsEntryLinks() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -209,7 +205,7 @@ public function testGetsEntryLinks() public function testGetsEntryLink() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -218,7 +214,7 @@ public function testGetsEntryLink() public function testGetsEntryPermaLink() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -228,7 +224,7 @@ public function testGetsEntryPermaLink() public function testGetsEntryEncoding() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); diff --git a/test/Reader/Integration/WordpressRss2DcAtomTest.php b/test/Reader/Integration/WordpressRss2DcAtomTest.php index 388d33d5..3bead6ae 100644 --- a/test/Reader/Integration/WordpressRss2DcAtomTest.php +++ b/test/Reader/Integration/WordpressRss2DcAtomTest.php @@ -17,14 +17,11 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: WordpressRss2DcAtomTest.php 22300 2010-05-26 10:13:34Z padraic $ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Reader\Integration; -use Zend\Feed\Reader; +require_once 'PHPUnit/Framework/TestCase.php'; +require_once 'Zend/Feed/Reader.php'; /** * @category Zend @@ -35,14 +32,14 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class WordpressRss2DcAtomTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Reader_Integration_WordpressRss2DcAtomTest extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Reader\Reader::reset(); + Zend_Feed_Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/wordpress-rss2-dc-atom.xml'; } @@ -52,7 +49,7 @@ public function setup() public function testGetsTitle() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Norm 2782', $feed->getTitle()); @@ -60,7 +57,7 @@ public function testGetsTitle() public function testGetsAuthors() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array( @@ -70,7 +67,7 @@ public function testGetsAuthors() public function testGetsSingleAuthor() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array('name'=>'norm2782'), $feed->getAuthor()); @@ -78,7 +75,7 @@ public function testGetsSingleAuthor() public function testGetsCopyright() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(null, $feed->getCopyright()); @@ -86,7 +83,7 @@ public function testGetsCopyright() public function testGetsDescription() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Why are you here?', $feed->getDescription()); @@ -94,7 +91,7 @@ public function testGetsDescription() public function testGetsLanguage() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('en', $feed->getLanguage()); @@ -102,7 +99,7 @@ public function testGetsLanguage() public function testGetsLink() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://www.norm2782.com', $feed->getLink()); @@ -110,7 +107,7 @@ public function testGetsLink() public function testGetsEncoding() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('UTF-8', $feed->getEncoding()); @@ -118,7 +115,7 @@ public function testGetsEncoding() public function testGetsEntryCount() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(10, $feed->count()); @@ -130,7 +127,7 @@ public function testGetsEntryCount() public function testGetsEntryId() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -139,7 +136,7 @@ public function testGetsEntryId() public function testGetsEntryTitle() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -152,7 +149,7 @@ public function testGetsEntryTitle() public function testGetsEntryAuthors() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -161,7 +158,7 @@ public function testGetsEntryAuthors() public function testGetsEntrySingleAuthor() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -170,28 +167,28 @@ public function testGetsEntrySingleAuthor() public function testGetsEntryDescription() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); /** * Note: "’" is not the same as "'" - don't replace in error */ - $this->assertEquals('Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.'."\n\n".'Agile Software Development with Scrum, by Ken Schwaber and Mike Beedle'."\n".'Domain-Driven Design: Tackling Complexity in the [...]', $entry->getDescription()); + $this->assertEquals('Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.'."\n\n".'Agile Software Development with Scrum, by Ken Schwaber and Mike Beedle'."\n".'Domain-Driven Design: Tackling Complexity in the [...]', $entry->getDescription()); } public function testGetsEntryContent() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); - $this->assertEquals('

Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

'."\n".''."\n".'

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

'."\n", $entry->getContent()); + $this->assertEquals('

Being in New Zealand does strange things to a person. Everybody who knows me, knows I don’t much like that crazy invention called a Book. However, being here I’ve already finished 4 books, all of which I can highly recommend.

'."\n".''."\n".'

Next up: Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four. Yes, talk about classics and shame on me for not having ordered it sooner! Also reading Implementation Patterns, by Kent Beck at the moment.

'."\n", $entry->getContent()); } public function testGetsEntryLinks() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -200,7 +197,7 @@ public function testGetsEntryLinks() public function testGetsEntryLink() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -209,7 +206,7 @@ public function testGetsEntryLink() public function testGetsEntryPermaLink() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -219,7 +216,7 @@ public function testGetsEntryPermaLink() public function testGetsEntryEncoding() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); diff --git a/test/Reader/_files/My/Extension/JungleBooks/Entry.php b/test/Reader/_files/My/Extension/JungleBooks/Entry.php index f9c22d6a..ef8ad1cf 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Entry.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Entry.php @@ -17,13 +17,12 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -/** - * @namespace - */ -namespace My\Extension\JungleBooks; +require_once 'Zend/Feed/Reader.php'; + +require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; /** * @category Zend @@ -32,7 +31,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry extends \Zend\Feed\Reader\Extension\EntryAbstract +class My_FeedReader_Extension_JungleBooks_Entry extends Zend_Feed_Reader_Extension_EntryAbstract { public function getIsbn() diff --git a/test/Reader/_files/My/Extension/JungleBooks/Feed.php b/test/Reader/_files/My/Extension/JungleBooks/Feed.php index 960f42b0..fb460e9c 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Feed.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Feed.php @@ -17,13 +17,10 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -/** - * @namespace - */ -namespace My\Extension\JungleBooks; +require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; /** * @category Zend @@ -32,7 +29,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed extends \Zend\Feed\Reader\Extension\FeedAbstract +class My_FeedReader_Extension_JungleBooks_Feed extends Zend_Feed_Reader_Extension_FeedAbstract { public function getDaysPopularBookLink() diff --git a/test/ReaderTest.php b/test/ReaderTest.php index 7be2138e..8c52b6c8 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -17,14 +17,12 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: ReaderTest.php 22031 2010-04-28 15:47:44Z padraic $ */ -/** - * @namespace - */ -namespace ZendTest\Feed; -use Zend\Feed\Reader; +require_once 'PHPUnit/Framework/TestCase.php'; +require_once 'Zend/Feed/Reader.php'; +require_once 'Zend/Cache.php'; /** * @category Zend @@ -35,7 +33,7 @@ * @group Zend_Feed * @group Zend_Feed_Reader */ -class ReaderTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_ReaderTest extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -47,84 +45,94 @@ public function setup() public function tearDown() { - Reader\Reader::reset(); + Zend_Feed_Reader::reset(); } public function testDetectsFeedIsRss20() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss20.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_RSS_20, $type); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_20, $type); } public function testDetectsFeedIsRss094() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss094.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_RSS_094, $type); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_094, $type); } public function testDetectsFeedIsRss093() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss093.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_RSS_093, $type); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_093, $type); } public function testDetectsFeedIsRss092() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss092.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_RSS_092, $type); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_092, $type); } public function testDetectsFeedIsRss091() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss091.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_RSS_091, $type); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_091, $type); } public function testDetectsFeedIsRss10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss10.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_RSS_10, $type); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_10, $type); } public function testDetectsFeedIsRss090() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss090.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_RSS_090, $type); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_090, $type); } public function testDetectsFeedIsAtom10() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/atom10.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_ATOM_10, $type); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_ATOM_10, $type); } public function testDetectsFeedIsAtom03() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/atom03.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_ATOM_03, $type); + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_ATOM_03, $type); + } + + /** + * @group ZF-9723 + */ + public function testDetectsTypeFromStringOrToRemindPaddyAboutForgettingATestWhichLetsAStupidTypoSurviveUnnoticedForMonths() + { + $feed = ''; + $type = Zend_Feed_Reader::detectType($feed); + $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_10, $type); } public function testGetEncoding() { - $feed = Reader\Reader::importString( + $feed = Zend_Feed_Reader::importString( file_get_contents(dirname(__FILE__) . '/Reader/Entry/_files/Atom/title/plain/atom10.xml') ); @@ -135,10 +143,10 @@ public function testGetEncoding() public function testImportsFile() { try { - $feed = Reader\Reader::importFile( + $feed = Zend_Feed_Reader::importFile( dirname(__FILE__) . '/Reader/Entry/_files/Atom/title/plain/atom10.xml' ); - } catch(\Exception $e) { + } catch(Exception $e) { $this->fail($e->getMessage()); } } @@ -153,18 +161,18 @@ public function testImportsUri() } try { - $feed = Reader\Reader::import('http://www.planet-php.net/rdf/'); - } catch(\Exception $e) { + $feed = Zend_Feed_Reader::import('http://www.planet-php.net/rdf/'); + } catch(Exception $e) { $this->fail($e->getMessage()); } } /** * @group ZF-8328 + * @expectedException Zend_Feed_Exception */ public function testImportsUriAndThrowsExceptionIfNotAFeed() { - $this->setExpectedException('Zend\Feed\Exception'); if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') ) { @@ -172,7 +180,7 @@ public function testImportsUriAndThrowsExceptionIfNotAFeed() return; } - $feed = Reader\Reader::import('http://twitter.com/alganet'); + $feed = Zend_Feed_Reader::import('http://twitter.com/alganet'); } public function testGetsFeedLinksAsValueObject() @@ -185,8 +193,8 @@ public function testGetsFeedLinksAsValueObject() } try { - $links = Reader\Reader::findFeedLinks('http://www.planet-php.net'); - } catch(\Exception $e) { + $links = Zend_Feed_Reader::findFeedLinks('http://www.planet-php.net'); + } catch(Exception $e) { $this->fail($e->getMessage()); } $this->assertEquals('http://www.planet-php.org/rss/', $links->rss); @@ -200,8 +208,8 @@ public function testCompilesLinksAsArrayObject() $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); return; } - $links = Reader\Reader::findFeedLinks('http://www.planet-php.net'); - $this->assertTrue($links instanceof Reader\FeedSet); + $links = Zend_Feed_Reader::findFeedLinks('http://www.planet-php.net'); + $this->assertTrue($links instanceof Zend_Feed_Reader_FeedSet); $this->assertEquals(array( 'rel' => 'alternate', 'type' => 'application/rss+xml', 'href' => 'http://www.planet-php.org/rss/' ), (array) $links->getIterator()->current()); @@ -215,9 +223,9 @@ public function testFeedSetLoadsFeedObjectWhenFeedArrayKeyAccessed() $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); return; } - $links = Reader\Reader::findFeedLinks('http://www.planet-php.net'); + $links = Zend_Feed_Reader::findFeedLinks('http://www.planet-php.net'); $link = $links->getIterator()->current(); - $this->assertTrue($link['feed'] instanceof \Zend\Feed\Reader\Feed\RSS); + $this->assertTrue($link['feed'] instanceof Zend_Feed_Reader_Feed_Rss); } public function testZeroCountFeedSetReturnedFromEmptyList() @@ -228,7 +236,7 @@ public function testZeroCountFeedSetReturnedFromEmptyList() $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); return; } - $links = Reader\Reader::findFeedLinks('http://www.example.com'); + $links = Zend_Feed_Reader::findFeedLinks('http://www.example.com'); $this->assertEquals(0, count($links)); } @@ -245,8 +253,8 @@ public function testGetsFeedLinksAndTrimsNewlines() } try { - $links = Reader\Reader::findFeedLinks('http://www.infopod.com.br'); - } catch(\Exception $e) { + $links = Zend_Feed_Reader::findFeedLinks('http://www.infopod.com.br'); + } catch(Exception $e) { $this->fail($e->getMessage()); } $this->assertEquals('http://feeds.feedburner.com/jonnyken/infoblog', $links->rss); @@ -265,8 +273,8 @@ public function testGetsFeedLinksAndNormalisesRelativeUrls() } try { - $links = Reader\Reader::findFeedLinks('http://meiobit.com'); - } catch(\Exception $e) { + $links = Zend_Feed_Reader::findFeedLinks('http://meiobit.com'); + } catch(Exception $e) { $this->fail($e->getMessage()); } $this->assertEquals('http://meiobit.com/rss.xml', $links->rss); @@ -278,16 +286,16 @@ public function testGetsFeedLinksAndNormalisesRelativeUrls() public function testGetsFeedLinksAndNormalisesRelativeUrlsOnUriWithPath() { try { - $currClient = Reader\Reader::getHttpClient(); + $currClient = Zend_Feed_Reader::getHttpClient(); - $testAdapter = new \Zend\HTTP\Client\Adapter\Test(); - $testAdapter->setResponse(new \Zend\HTTP\Response\Response(200, array(), '')); - Reader\Reader::setHttpClient(new \Zend\HTTP\Client(null, array('adapter' => $testAdapter))); + $testAdapter = new Zend_Http_Client_Adapter_Test(); + $testAdapter->setResponse(new Zend_Http_Response(200, array(), '')); + Zend_Feed_Reader::setHttpClient(new Zend_Http_Client(null, array('adapter' => $testAdapter))); - $links = Reader\Reader::findFeedLinks('http://foo/bar'); + $links = Zend_Feed_Reader::findFeedLinks('http://foo/bar'); - Reader\Reader::setHttpClient($currClient); - } catch(\Exception $e) { + Zend_Feed_Reader::setHttpClient($currClient); + } catch(Exception $e) { $this->fail($e->getMessage()); } @@ -297,20 +305,20 @@ public function testGetsFeedLinksAndNormalisesRelativeUrlsOnUriWithPath() public function testAddsPrefixPath() { - Reader\Reader::addPrefixPath('A\B\C', '/A/B/C'); - $prefixPaths = Reader\Reader::getPluginLoader()->getPaths(); - $this->assertEquals('/A/B/C/', $prefixPaths['A\B\C\\'][0]); + Zend_Feed_Reader::addPrefixPath('A_B_C', '/A/B/C'); + $prefixPaths = Zend_Feed_Reader::getPluginLoader()->getPaths(); + $this->assertEquals('/A/B/C/', $prefixPaths['A_B_C_'][0]); } public function testRegistersUserExtension() { try { - Reader\Reader::addPrefixPath('My\FeedReader\Extension', dirname(__FILE__) . '/Reader/_files/My/Extension'); - Reader\Reader::registerExtension('JungleBooks'); - } catch(\Exception $e) { + Zend_Feed_Reader::addPrefixPath('My_FeedReader_Extension',dirname(__FILE__) . '/Reader/_files/My/Extension'); + Zend_Feed_Reader::registerExtension('JungleBooks'); + } catch(Exception $e) { $this->fail($e->getMessage()); } - $this->assertTrue(Reader\Reader::isRegistered('JungleBooks')); + $this->assertTrue(Zend_Feed_Reader::isRegistered('JungleBooks')); } protected function _getTempDirectory() diff --git a/test/Writer/DeletedTest.php b/test/Writer/DeletedTest.php index b6039981..0cfca891 100644 --- a/test/Writer/DeletedTest.php +++ b/test/Writer/DeletedTest.php @@ -20,13 +20,9 @@ * @version $Id$ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Writer; -use Zend\Feed\Writer; -use Zend\Feed; -use Zend\Date; +require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/TestHelper.php'; + +require_once 'Zend/Feed/Writer/Deleted.php'; /** * @category Zend @@ -37,130 +33,130 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class DeletedTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Writer_DeletedTest extends PHPUnit_Framework_TestCase { public function testSetsReference() { - $entry = new Writer\Deleted; + $entry = new Zend_Feed_Writer_Deleted; $entry->setReference('http://www.example.com/id'); $this->assertEquals('http://www.example.com/id', $entry->getReference()); } public function testSetReferenceThrowsExceptionOnInvalidParameter() { - $entry = new Writer\Deleted; + $entry = new Zend_Feed_Writer_Deleted; try { $entry->setReference(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetReferenceReturnsNullIfNotSet() { - $entry = new Writer\Deleted; + $entry = new Zend_Feed_Writer_Deleted; $this->assertTrue(is_null($entry->getReference())); } public function testSetWhenDefaultsToCurrentTime() { - $entry = new Writer\Deleted; + $entry = new Zend_Feed_Writer_Deleted; $entry->setWhen(); - $dateNow = new Date\Date; + $dateNow = new Zend_Date; $this->assertTrue($dateNow->isLater($entry->getWhen()) || $dateNow->equals($entry->getWhen())); } public function testSetWhenUsesGivenUnixTimestamp() { - $entry = new Writer\Deleted; + $entry = new Zend_Feed_Writer_Deleted; $entry->setWhen(1234567890); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); $this->assertTrue($myDate->equals($entry->getWhen())); } public function testSetWhenUsesZendDateObject() { - $entry = new Writer\Deleted; - $entry->setWhen(new Date\Date('1234567890', Date\Date::TIMESTAMP)); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); + $entry = new Zend_Feed_Writer_Deleted; + $entry->setWhen(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); $this->assertTrue($myDate->equals($entry->getWhen())); } public function testSetWhenThrowsExceptionOnInvalidParameter() { - $entry = new Writer\Deleted; + $entry = new Zend_Feed_Writer_Deleted; try { $entry->setWhen('abc'); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetWhenReturnsNullIfDateNotSet() { - $entry = new Writer\Deleted; + $entry = new Zend_Feed_Writer_Deleted; $this->assertTrue(is_null($entry->getWhen())); } public function testAddsByNameFromArray() { - $entry = new Writer\Deleted; + $entry = new Zend_Feed_Writer_Deleted; $entry->setBy(array('name'=>'Joe')); $this->assertEquals(array('name'=>'Joe'), $entry->getBy()); } public function testAddsByEmailFromArray() { - $entry = new Writer\Deleted; + $entry = new Zend_Feed_Writer_Deleted; $entry->setBy(array('name'=>'Joe','email'=>'joe@example.com')); $this->assertEquals(array('name'=>'Joe', 'email' => 'joe@example.com'), $entry->getBy()); } public function testAddsByUriFromArray() { - $entry = new Writer\Deleted; + $entry = new Zend_Feed_Writer_Deleted; $entry->setBy(array('name'=>'Joe','uri'=>'http://www.example.com')); $this->assertEquals(array('name'=>'Joe', 'uri' => 'http://www.example.com'), $entry->getBy()); } public function testAddByThrowsExceptionOnInvalidNameFromArray() { - $entry = new Writer\Deleted; + $entry = new Zend_Feed_Writer_Deleted; try { $entry->setBy(array('name'=>'')); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddByThrowsExceptionOnInvalidEmailFromArray() { - $entry = new Writer\Deleted; + $entry = new Zend_Feed_Writer_Deleted; try { $entry->setBy(array('name'=>'Joe','email'=>'')); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddByThrowsExceptionOnInvalidUriFromArray() { - $entry = new Writer\Deleted; + $entry = new Zend_Feed_Writer_Deleted; try { $entry->setBy(array('name'=>'Joe','uri'=>'notauri')); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddByThrowsExceptionIfNameOmittedFromArray() { - $entry = new Writer\Deleted; + $entry = new Zend_Feed_Writer_Deleted; try { $entry->setBy(array('uri'=>'notauri')); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } diff --git a/test/Writer/EntryTest.php b/test/Writer/EntryTest.php index b8d87c39..520405da 100644 --- a/test/Writer/EntryTest.php +++ b/test/Writer/EntryTest.php @@ -20,13 +20,9 @@ * @version $Id$ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Writer; -use Zend\Feed\Writer; -use Zend\Feed; -use Zend\Date; +require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/TestHelper.php'; + +require_once 'Zend/Feed/Writer/Entry.php'; /** * @category Zend @@ -37,7 +33,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class EntryTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Writer_EntryTest extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -49,119 +45,119 @@ public function setup() public function testAddsAuthorName() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->addAuthor('Joe'); $this->assertEquals(array(array('name'=>'Joe')), $entry->getAuthors()); } public function testAddsAuthorEmail() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->addAuthor('Joe', 'joe@example.com'); $this->assertEquals(array(array('name'=>'Joe', 'email' => 'joe@example.com')), $entry->getAuthors()); } public function testAddsAuthorUri() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->addAuthor('Joe', null, 'http://www.example.com'); $this->assertEquals(array(array('name'=>'Joe', 'uri' => 'http://www.example.com')), $entry->getAuthors()); } public function testAddAuthorThrowsExceptionOnInvalidName() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->addAuthor(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddAuthorThrowsExceptionOnInvalidEmail() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->addAuthor('Joe', ''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddAuthorThrowsExceptionOnInvalidUri() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->addAuthor('Joe', null, 'notauri'); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddsAuthorNameFromArray() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->addAuthor(array('name'=>'Joe')); $this->assertEquals(array(array('name'=>'Joe')), $entry->getAuthors()); } public function testAddsAuthorEmailFromArray() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->addAuthor(array('name'=>'Joe','email'=>'joe@example.com')); $this->assertEquals(array(array('name'=>'Joe', 'email' => 'joe@example.com')), $entry->getAuthors()); } public function testAddsAuthorUriFromArray() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->addAuthor(array('name'=>'Joe','uri'=>'http://www.example.com')); $this->assertEquals(array(array('name'=>'Joe', 'uri' => 'http://www.example.com')), $entry->getAuthors()); } public function testAddAuthorThrowsExceptionOnInvalidNameFromArray() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->addAuthor(array('name'=>'')); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddAuthorThrowsExceptionOnInvalidEmailFromArray() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->addAuthor(array('name'=>'Joe','email'=>'')); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddAuthorThrowsExceptionOnInvalidUriFromArray() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->addAuthor(array('name'=>'Joe','uri'=>'notauri')); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddAuthorThrowsExceptionIfNameOmittedFromArray() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->addAuthor(array('uri'=>'notauri')); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddsAuthorsFromArrayOfAuthors() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->addAuthors(array( array('name'=>'Joe','uri'=>'http://www.example.com'), array('name'=>'Jane','uri'=>'http://www.example.com') @@ -175,7 +171,7 @@ public function testAddsAuthorsFromArrayOfAuthors() public function testAddsEnclosure() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setEnclosure(array( 'type' => 'audio/mpeg', 'uri' => 'http://example.com/audio.mp3', @@ -189,64 +185,24 @@ public function testAddsEnclosure() $this->assertEquals($expected, $entry->getEnclosure()); } - public function testAddsEnclosureThrowsExceptionOnMissingType() - { - $this->setExpectedException('Zend\Feed\Exception'); - $entry = new Writer\Entry; - $entry->setEnclosure(array( - 'uri' => 'http://example.com/audio.mp3', - 'length' => '1337' - )); - } - + /** + * @expectedException Zend_Feed_Exception + */ public function testAddsEnclosureThrowsExceptionOnMissingUri() { - $this->setExpectedException('Zend\Feed\Exception'); - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setEnclosure(array( 'type' => 'audio/mpeg', 'length' => '1337' )); } - - public function testAddsEnclosureThrowsExceptionOnMissingLength() - { - $this->setExpectedException('Zend\Feed\Exception'); - $entry = new Writer\Entry; - $entry->setEnclosure(array( - 'type' => 'audio/mpeg', - 'uri' => 'http://example.com/audio.mp3' - )); - } - - public function testAddsEnclosureThrowsExceptionOnNonNumericLength() - { - $this->setExpectedException('Zend\Feed\Exception'); - $entry = new Writer\Entry; - $entry->setEnclosure(array( - 'type' => 'audio/mpeg', - 'uri' => 'http://example.com/audio.mp3', - 'length' => 'abc' - )); - } - - - public function testAddsEnclosureThrowsExceptionOnNegativeLength() - { - $this->setExpectedException('Zend\Feed\Exception'); - $entry = new Writer\Entry; - $entry->setEnclosure(array( - 'type' => 'audio/mpeg', - 'uri' => 'http://example.com/audio.mp3', - 'length' => -23 - )); - } - + /** + * @expectedException Zend_Feed_Exception + */ public function testAddsEnclosureThrowsExceptionWhenUriIsInvalid() { - $this->setExpectedException('Zend\Feed\Exception'); - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setEnclosure(array( 'type' => 'audio/mpeg', 'uri' => 'http://', @@ -256,245 +212,245 @@ public function testAddsEnclosureThrowsExceptionWhenUriIsInvalid() public function testSetsCopyright() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setCopyright('Copyright (c) 2009 Paddy Brady'); $this->assertEquals('Copyright (c) 2009 Paddy Brady', $entry->getCopyright()); } public function testSetCopyrightThrowsExceptionOnInvalidParam() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->setCopyright(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testSetsContent() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setContent('I\'m content.'); $this->assertEquals("I'm content.", $entry->getContent()); } public function testSetContentThrowsExceptionOnInvalidParam() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->setContent(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testSetDateCreatedDefaultsToCurrentTime() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setDateCreated(); - $dateNow = new Date\Date; + $dateNow = new Zend_Date; $this->assertTrue($dateNow->isLater($entry->getDateCreated()) || $dateNow->equals($entry->getDateCreated())); } public function testSetDateCreatedUsesGivenUnixTimestamp() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setDateCreated(1234567890); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); $this->assertTrue($myDate->equals($entry->getDateCreated())); } public function testSetDateCreatedUsesZendDateObject() { - $entry = new Writer\Entry; - $entry->setDateCreated(new Date\Date('1234567890', Date\Date::TIMESTAMP)); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); + $entry = new Zend_Feed_Writer_Entry; + $entry->setDateCreated(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); $this->assertTrue($myDate->equals($entry->getDateCreated())); } public function testSetDateModifiedDefaultsToCurrentTime() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setDateModified(); - $dateNow = new Date\Date; + $dateNow = new Zend_Date; $this->assertTrue($dateNow->isLater($entry->getDateModified()) || $dateNow->equals($entry->getDateModified())); } public function testSetDateModifiedUsesGivenUnixTimestamp() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setDateModified(1234567890); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); $this->assertTrue($myDate->equals($entry->getDateModified())); } public function testSetDateModifiedUsesZendDateObject() { - $entry = new Writer\Entry; - $entry->setDateModified(new Date\Date('1234567890', Date\Date::TIMESTAMP)); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); + $entry = new Zend_Feed_Writer_Entry; + $entry->setDateModified(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); $this->assertTrue($myDate->equals($entry->getDateModified())); } public function testSetDateCreatedThrowsExceptionOnInvalidParameter() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->setDateCreated('abc'); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testSetDateModifiedThrowsExceptionOnInvalidParameter() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->setDateModified('abc'); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetDateCreatedReturnsNullIfDateNotSet() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $this->assertTrue(is_null($entry->getDateCreated())); } public function testGetDateModifiedReturnsNullIfDateNotSet() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $this->assertTrue(is_null($entry->getDateModified())); } public function testGetCopyrightReturnsNullIfDateNotSet() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $this->assertTrue(is_null($entry->getCopyright())); } public function testGetContentReturnsNullIfDateNotSet() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $this->assertTrue(is_null($entry->getContent())); } public function testSetsDescription() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setDescription('abc'); $this->assertEquals('abc', $entry->getDescription()); } public function testSetDescriptionThrowsExceptionOnInvalidParameter() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->setDescription(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetDescriptionReturnsNullIfDateNotSet() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $this->assertTrue(is_null($entry->getDescription())); } public function testSetsId() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setId('http://www.example.com/id'); $this->assertEquals('http://www.example.com/id', $entry->getId()); } public function testSetIdThrowsExceptionOnInvalidParameter() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->setId(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetIdReturnsNullIfNotSet() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $this->assertTrue(is_null($entry->getId())); } public function testSetsLink() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setLink('http://www.example.com/id'); $this->assertEquals('http://www.example.com/id', $entry->getLink()); } public function testSetLinkThrowsExceptionOnEmptyString() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->setLink(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testSetLinkThrowsExceptionOnInvalidUri() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->setLink('http://'); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetLinkReturnsNullIfNotSet() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $this->assertTrue(is_null($entry->getLink())); } public function testSetsCommentLink() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setCommentLink('http://www.example.com/id/comments'); $this->assertEquals('http://www.example.com/id/comments', $entry->getCommentLink()); } public function testSetCommentLinkThrowsExceptionOnEmptyString() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->setCommentLink(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testSetCommentLinkThrowsExceptionOnInvalidUri() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->setCommentLink('http://'); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetCommentLinkReturnsNullIfDateNotSet() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $this->assertTrue(is_null($entry->getCommentLink())); } public function testSetsCommentFeedLink() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setCommentFeedLink(array('uri'=>'http://www.example.com/id/comments', 'type'=>'rdf')); $this->assertEquals(array(array('uri'=>'http://www.example.com/id/comments', 'type'=>'rdf')), $entry->getCommentFeedLinks()); @@ -502,93 +458,93 @@ public function testSetsCommentFeedLink() public function testSetCommentFeedLinkThrowsExceptionOnEmptyString() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->setCommentFeedLink(array('uri'=>'', 'type'=>'rdf')); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testSetCommentFeedLinkThrowsExceptionOnInvalidUri() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->setCommentFeedLink(array('uri'=>'http://', 'type'=>'rdf')); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testSetCommentFeedLinkThrowsExceptionOnInvalidType() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->setCommentFeedLink(array('uri'=>'http://www.example.com/id/comments', 'type'=>'foo')); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetCommentFeedLinkReturnsNullIfNoneSet() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $this->assertTrue(is_null($entry->getCommentFeedLinks())); } public function testSetsTitle() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setTitle('abc'); $this->assertEquals('abc', $entry->getTitle()); } public function testSetTitleThrowsExceptionOnInvalidParameter() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->setTitle(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetTitleReturnsNullIfDateNotSet() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $this->assertTrue(is_null($entry->getTitle())); } public function testSetsCommentCount() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setCommentCount('10'); $this->assertEquals(10, $entry->getCommentCount()); } public function testSetCommentCountThrowsExceptionOnInvalidEmptyParameter() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->setCommentCount(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testSetCommentCountThrowsExceptionOnInvalidNonIntegerParameter() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; try { $entry->setCommentCount('a'); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetCommentCountReturnsNullIfDateNotSet() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $this->assertTrue(is_null($entry->getCommentCount())); } diff --git a/test/Writer/Extension/ITunes/EntryTest.php b/test/Writer/Extension/ITunes/EntryTest.php index bdfb595f..87f3645b 100644 --- a/test/Writer/Extension/ITunes/EntryTest.php +++ b/test/Writer/Extension/ITunes/EntryTest.php @@ -20,11 +20,9 @@ * @version $Id$ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Writer\Extension\ITunes; -use Zend\Feed\Writer; +require_once dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; + +require_once 'Zend/Feed/Writer/Entry.php'; /** * @category Zend @@ -35,124 +33,138 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class EntryTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Writer_Extension_ITunes_EntryTest extends PHPUnit_Framework_TestCase { public function testSetBlock() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setItunesBlock('yes'); $this->assertEquals('yes', $entry->getItunesBlock()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetBlockThrowsExceptionOnNonAlphaValue() { - $this->setExpectedException('Zend\Feed\Exception'); - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setItunesBlock('123'); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetBlockThrowsExceptionIfValueGreaterThan255CharsLength() { - $this->setExpectedException('Zend\Feed\Exception'); - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setItunesBlock(str_repeat('a', 256)); } public function testAddAuthors() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->addItunesAuthors(array('joe', 'jane')); $this->assertEquals(array('joe', 'jane'), $entry->getItunesAuthors()); } public function testAddAuthor() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->addItunesAuthor('joe'); $this->assertEquals(array('joe'), $entry->getItunesAuthors()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testAddAuthorThrowsExceptionIfValueGreaterThan255CharsLength() { - $this->setExpectedException('Zend\Feed\Exception'); - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->addItunesAuthor(str_repeat('a', 256)); } public function testSetDurationAsSeconds() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setItunesDuration(23); $this->assertEquals(23, $entry->getItunesDuration()); } public function testSetDurationAsMinutesAndSeconds() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setItunesDuration('23:23'); $this->assertEquals('23:23', $entry->getItunesDuration()); } public function testSetDurationAsHoursMinutesAndSeconds() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setItunesDuration('23:23:23'); $this->assertEquals('23:23:23', $entry->getItunesDuration()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetDurationThrowsExceptionOnUnknownFormat() { - $this->setExpectedException('Zend\Feed\Exception'); - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setItunesDuration('abc'); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetDurationThrowsExceptionOnInvalidSeconds() { - $this->setExpectedException('Zend\Feed\Exception'); - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setItunesDuration('23:456'); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetDurationThrowsExceptionOnInvalidMinutes() { - $this->setExpectedException('Zend\Feed\Exception'); - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setItunesDuration('23:234:45'); } public function testSetExplicitToYes() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setItunesExplicit('yes'); $this->assertEquals('yes', $entry->getItunesExplicit()); } public function testSetExplicitToNo() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setItunesExplicit('no'); $this->assertEquals('no', $entry->getItunesExplicit()); } public function testSetExplicitToClean() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setItunesExplicit('clean'); $this->assertEquals('clean', $entry->getItunesExplicit()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetExplicitThrowsExceptionOnUnknownTerm() { - $this->setExpectedException('Zend\Feed\Exception'); - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setItunesExplicit('abc'); } public function testSetKeywords() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $words = array( 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12' ); @@ -160,20 +172,24 @@ public function testSetKeywords() $this->assertEquals($words, $entry->getItunesKeywords()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded() { - $this->setExpectedException('Zend\Feed\Exception'); - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $words = array( 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12', 'a13' ); $entry->setItunesKeywords($words); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharLength() { - $this->setExpectedException('Zend\Feed\Exception'); - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $words = array( str_repeat('a', 253), str_repeat('b', 2) ); @@ -182,29 +198,33 @@ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharL public function testSetSubtitle() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setItunesSubtitle('abc'); $this->assertEquals('abc', $entry->getItunesSubtitle()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetSubtitleThrowsExceptionWhenValueExceeds255Chars() { - $this->setExpectedException('Zend\Feed\Exception'); - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setItunesSubtitle(str_repeat('a', 256)); } public function testSetSummary() { - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setItunesSummary('abc'); $this->assertEquals('abc', $entry->getItunesSummary()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetSummaryThrowsExceptionWhenValueExceeds255Chars() { - $this->setExpectedException('Zend\Feed\Exception'); - $entry = new Writer\Entry; + $entry = new Zend_Feed_Writer_Entry; $entry->setItunesSummary(str_repeat('a', 4001)); } diff --git a/test/Writer/Extension/ITunes/FeedTest.php b/test/Writer/Extension/ITunes/FeedTest.php index 8eaaff49..c7af37e2 100644 --- a/test/Writer/Extension/ITunes/FeedTest.php +++ b/test/Writer/Extension/ITunes/FeedTest.php @@ -20,11 +20,9 @@ * @version $Id$ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Writer\Extension\ITunes; -use Zend\Feed\Writer\Feed; +require_once dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; + +require_once 'Zend/Feed/Writer/Feed.php'; /** * @category Zend @@ -35,54 +33,60 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class FeedTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Writer_Extension_ITunes_FeedTest extends PHPUnit_Framework_TestCase { public function testSetBlock() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesBlock('yes'); $this->assertEquals('yes', $feed->getItunesBlock()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetBlockThrowsExceptionOnNonAlphaValue() { - $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesBlock('123'); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetBlockThrowsExceptionIfValueGreaterThan255CharsLength() { - $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesBlock(str_repeat('a', 256)); } public function testAddAuthors() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->addItunesAuthors(array('joe', 'jane')); $this->assertEquals(array('joe', 'jane'), $feed->getItunesAuthors()); } public function testAddAuthor() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->addItunesAuthor('joe'); $this->assertEquals(array('joe'), $feed->getItunesAuthors()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testAddAuthorThrowsExceptionIfValueGreaterThan255CharsLength() { - $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->addItunesAuthor(str_repeat('a', 256)); } public function testSetCategories() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $cats = array( 'cat1', 'cat2' => array('cat2-1', 'cat2-a&b') @@ -91,10 +95,12 @@ public function testSetCategories() $this->assertEquals($cats, $feed->getItunesCategories()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetCategoriesThrowsExceptionIfAnyCatNameGreaterThan255CharsLength() { - $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $cats = array( 'cat1', 'cat2' => array('cat2-1', str_repeat('a', 256)) @@ -105,105 +111,117 @@ public function testSetCategoriesThrowsExceptionIfAnyCatNameGreaterThan255CharsL public function testSetImageAsPngFile() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesImage('http://www.example.com/image.png'); $this->assertEquals('http://www.example.com/image.png', $feed->getItunesImage()); } public function testSetImageAsJpgFile() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesImage('http://www.example.com/image.jpg'); $this->assertEquals('http://www.example.com/image.jpg', $feed->getItunesImage()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetImageThrowsExceptionOnInvalidUri() { - $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesImage('http://'); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetImageThrowsExceptionOnInvalidImageExtension() { - $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesImage('http://www.example.com/image.gif'); } public function testSetDurationAsSeconds() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesDuration(23); $this->assertEquals(23, $feed->getItunesDuration()); } public function testSetDurationAsMinutesAndSeconds() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesDuration('23:23'); $this->assertEquals('23:23', $feed->getItunesDuration()); } public function testSetDurationAsHoursMinutesAndSeconds() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesDuration('23:23:23'); $this->assertEquals('23:23:23', $feed->getItunesDuration()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetDurationThrowsExceptionOnUnknownFormat() { - $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesDuration('abc'); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetDurationThrowsExceptionOnInvalidSeconds() { - $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesDuration('23:456'); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetDurationThrowsExceptionOnInvalidMinutes() { - $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesDuration('23:234:45'); } public function testSetExplicitToYes() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesExplicit('yes'); $this->assertEquals('yes', $feed->getItunesExplicit()); } public function testSetExplicitToNo() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesExplicit('no'); $this->assertEquals('no', $feed->getItunesExplicit()); } public function testSetExplicitToClean() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesExplicit('clean'); $this->assertEquals('clean', $feed->getItunesExplicit()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetExplicitThrowsExceptionOnUnknownTerm() { - $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesExplicit('abc'); } public function testSetKeywords() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $words = array( 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12' ); @@ -211,20 +229,24 @@ public function testSetKeywords() $this->assertEquals($words, $feed->getItunesKeywords()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded() { - $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $words = array( 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12', 'a13' ); $feed->setItunesKeywords($words); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharLength() { - $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $words = array( str_repeat('a', 253), str_repeat('b', 2) ); @@ -233,57 +255,63 @@ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharL public function testSetNewFeedUrl() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesNewFeedUrl('http://example.com/feed'); $this->assertEquals('http://example.com/feed', $feed->getItunesNewFeedUrl()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetNewFeedUrlThrowsExceptionOnInvalidUri() { - $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesNewFeedUrl('http://'); } public function testAddOwner() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->addItunesOwner(array('name'=>'joe','email'=>'joe@example.com')); $this->assertEquals(array(array('name'=>'joe','email'=>'joe@example.com')), $feed->getItunesOwners()); } public function testAddOwners() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->addItunesOwners(array(array('name'=>'joe','email'=>'joe@example.com'))); $this->assertEquals(array(array('name'=>'joe','email'=>'joe@example.com')), $feed->getItunesOwners()); } public function testSetSubtitle() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesSubtitle('abc'); $this->assertEquals('abc', $feed->getItunesSubtitle()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetSubtitleThrowsExceptionWhenValueExceeds255Chars() { - $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesSubtitle(str_repeat('a', 256)); } public function testSetSummary() { - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesSummary('abc'); $this->assertEquals('abc', $feed->getItunesSummary()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testSetSummaryThrowsExceptionWhenValueExceeds4000Chars() { - $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Zend_Feed_Writer_Feed; $feed->setItunesSummary(str_repeat('a',4001)); } diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php index 1c04cfde..265d89c1 100644 --- a/test/Writer/FeedTest.php +++ b/test/Writer/FeedTest.php @@ -20,13 +20,9 @@ * @version $Id$ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Writer; -use Zend\Feed; -use Zend\Feed\Writer\Feed as WriterFeed; -use Zend\Date; +require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/TestHelper.php'; + +require_once 'Zend/Feed/Writer/Feed.php'; /** * @category Zend @@ -37,7 +33,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class FeedTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Writer_FeedTest extends PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -49,119 +45,119 @@ public function setup() public function testAddsAuthorName() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->addAuthor('Joe'); $this->assertEquals(array('name'=>'Joe'), $writer->getAuthor()); } public function testAddsAuthorEmail() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->addAuthor('Joe', 'joe@example.com'); $this->assertEquals(array('name'=>'Joe', 'email' => 'joe@example.com'), $writer->getAuthor()); } public function testAddsAuthorUri() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->addAuthor('Joe', null, 'http://www.example.com'); $this->assertEquals(array('name'=>'Joe', 'uri' => 'http://www.example.com'), $writer->getAuthor()); } public function testAddAuthorThrowsExceptionOnInvalidName() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->addAuthor(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddAuthorThrowsExceptionOnInvalidEmail() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->addAuthor('Joe', ''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddAuthorThrowsExceptionOnInvalidUri() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->addAuthor('Joe', null, 'notauri'); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddsAuthorNameFromArray() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->addAuthor(array('name'=>'Joe')); $this->assertEquals(array('name'=>'Joe'), $writer->getAuthor()); } public function testAddsAuthorEmailFromArray() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->addAuthor(array('name'=>'Joe','email'=>'joe@example.com')); $this->assertEquals(array('name'=>'Joe', 'email' => 'joe@example.com'), $writer->getAuthor()); } public function testAddsAuthorUriFromArray() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->addAuthor(array('name'=>'Joe','uri'=>'http://www.example.com')); $this->assertEquals(array('name'=>'Joe', 'uri' => 'http://www.example.com'), $writer->getAuthor()); } public function testAddAuthorThrowsExceptionOnInvalidNameFromArray() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->addAuthor(array('name'=>'')); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddAuthorThrowsExceptionOnInvalidEmailFromArray() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->addAuthor(array('name'=>'Joe','email'=>'')); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddAuthorThrowsExceptionOnInvalidUriFromArray() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->addAuthor(array('name'=>'Joe','uri'=>'notauri')); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddAuthorThrowsExceptionIfNameOmittedFromArray() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->addAuthor(array('uri'=>'notauri')); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddsAuthorsFromArrayOfAuthors() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->addAuthors(array( array('name'=>'Joe','uri'=>'http://www.example.com'), array('name'=>'Jane','uri'=>'http://www.example.com') @@ -171,465 +167,683 @@ public function testAddsAuthorsFromArrayOfAuthors() public function testSetsCopyright() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->setCopyright('Copyright (c) 2009 Paddy Brady'); $this->assertEquals('Copyright (c) 2009 Paddy Brady', $writer->getCopyright()); } public function testSetCopyrightThrowsExceptionOnInvalidParam() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->setCopyright(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testSetDateCreatedDefaultsToCurrentTime() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->setDateCreated(); - $dateNow = new Date\Date; + $dateNow = new Zend_Date; $this->assertTrue($dateNow->isLater($writer->getDateCreated()) || $dateNow->equals($writer->getDateCreated())); } public function testSetDateCreatedUsesGivenUnixTimestamp() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->setDateCreated(1234567890); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); $this->assertTrue($myDate->equals($writer->getDateCreated())); } public function testSetDateCreatedUsesZendDateObject() { - $writer = new WriterFeed\Feed; - $writer->setDateCreated(new Date\Date('1234567890', Date\Date::TIMESTAMP)); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); + $writer = new Zend_Feed_Writer_Feed; + $writer->setDateCreated(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); $this->assertTrue($myDate->equals($writer->getDateCreated())); } public function testSetDateModifiedDefaultsToCurrentTime() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->setDateModified(); - $dateNow = new Date\Date; + $dateNow = new Zend_Date; $this->assertTrue($dateNow->isLater($writer->getDateModified()) || $dateNow->equals($writer->getDateModified())); } public function testSetDateModifiedUsesGivenUnixTimestamp() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->setDateModified(1234567890); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); $this->assertTrue($myDate->equals($writer->getDateModified())); } public function testSetDateModifiedUsesZendDateObject() { - $writer = new WriterFeed\Feed; - $writer->setDateModified(new Date\Date('1234567890', Date\Date::TIMESTAMP)); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); + $writer = new Zend_Feed_Writer_Feed; + $writer->setDateModified(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); $this->assertTrue($myDate->equals($writer->getDateModified())); } public function testSetDateCreatedThrowsExceptionOnInvalidParameter() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->setDateCreated('abc'); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testSetDateModifiedThrowsExceptionOnInvalidParameter() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->setDateModified('abc'); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetDateCreatedReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $this->assertTrue(is_null($writer->getDateCreated())); } public function testGetDateModifiedReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $this->assertTrue(is_null($writer->getDateModified())); } + public function testSetLastBuildDateDefaultsToCurrentTime() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setLastBuildDate(); + $dateNow = new Zend_Date; + $this->assertTrue($dateNow->isLater($writer->getLastBuildDate()) || $dateNow->equals($writer->getLastBuildDate())); + } + + public function testSetLastBuildDateUsesGivenUnixTimestamp() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setLastBuildDate(1234567890); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $this->assertTrue($myDate->equals($writer->getLastBuildDate())); + } + + public function testSetLastBuildDateUsesZendDateObject() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setLastBuildDate(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); + $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $this->assertTrue($myDate->equals($writer->getLastBuildDate())); + } + + public function testSetLastBuildDateThrowsExceptionOnInvalidParameter() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setLastBuildDate('abc'); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + public function testGetLastBuildDateReturnsNullIfDateNotSet() + { + $writer = new Zend_Feed_Writer_Feed; + $this->assertTrue(is_null($writer->getLastBuildDate())); + } + public function testGetCopyrightReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $this->assertTrue(is_null($writer->getCopyright())); } public function testSetsDescription() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->setDescription('abc'); $this->assertEquals('abc', $writer->getDescription()); } public function testSetDescriptionThrowsExceptionOnInvalidParameter() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->setDescription(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetDescriptionReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $this->assertTrue(is_null($writer->getDescription())); } public function testSetsId() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->setId('http://www.example.com/id'); $this->assertEquals('http://www.example.com/id', $writer->getId()); } public function testSetsIdAcceptsUrns() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $writer->getId()); } public function testSetIdThrowsExceptionOnInvalidParameter() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->setId(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testSetIdThrowsExceptionOnInvalidUri() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->setId('http://'); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetIdReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $this->assertTrue(is_null($writer->getId())); } public function testSetsLanguage() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->setLanguage('abc'); $this->assertEquals('abc', $writer->getLanguage()); } public function testSetLanguageThrowsExceptionOnInvalidParameter() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->setLanguage(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetLanguageReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $this->assertTrue(is_null($writer->getLanguage())); } public function testSetsLink() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->setLink('http://www.example.com/id'); $this->assertEquals('http://www.example.com/id', $writer->getLink()); } public function testSetLinkThrowsExceptionOnEmptyString() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->setLink(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testSetLinkThrowsExceptionOnInvalidUri() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->setLink('http://'); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetLinkReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $this->assertTrue(is_null($writer->getLink())); } public function testSetsEncoding() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->setEncoding('utf-16'); $this->assertEquals('utf-16', $writer->getEncoding()); } public function testSetEncodingThrowsExceptionOnInvalidParameter() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->setEncoding(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetEncodingReturnsUtf8IfNotSet() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $this->assertEquals('UTF-8', $writer->getEncoding()); } public function testSetsTitle() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->setTitle('abc'); $this->assertEquals('abc', $writer->getTitle()); } public function testSetTitleThrowsExceptionOnInvalidParameter() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->setTitle(''); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetTitleReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $this->assertTrue(is_null($writer->getTitle())); } public function testSetsGeneratorName() { - $writer = new WriterFeed\Feed; - $writer->setGenerator('ZFW'); + $writer = new Zend_Feed_Writer_Feed; + $writer->setGenerator(array('name'=>'ZFW')); $this->assertEquals(array('name'=>'ZFW'), $writer->getGenerator()); } public function testSetsGeneratorVersion() { - $writer = new WriterFeed\Feed; - $writer->setGenerator('ZFW', '1.0'); + $writer = new Zend_Feed_Writer_Feed; + $writer->setGenerator(array('name'=>'ZFW', 'version' => '1.0')); $this->assertEquals(array('name'=>'ZFW', 'version' => '1.0'), $writer->getGenerator()); } public function testSetsGeneratorUri() { - $writer = new WriterFeed\Feed; - $writer->setGenerator('ZFW', null, 'http://www.example.com'); + $writer = new Zend_Feed_Writer_Feed; + $writer->setGenerator(array('name'=>'ZFW', 'uri'=>'http://www.example.com')); $this->assertEquals(array('name'=>'ZFW', 'uri' => 'http://www.example.com'), $writer->getGenerator()); } public function testSetsGeneratorThrowsExceptionOnInvalidName() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { - $writer->setGenerator(''); + $writer->setGenerator(array()); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testSetsGeneratorThrowsExceptionOnInvalidVersion() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { - $writer->addAuthor('ZFW', ''); - $this->fail(); - } catch (Feed\Exception $e) { + $writer->setGenerator(array('name'=>'ZFW', 'version'=>'')); + $this->fail('Should have failed since version is empty'); + } catch (Zend_Feed_Exception $e) { } } public function testSetsGeneratorThrowsExceptionOnInvalidUri() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setGenerator(array('name'=>'ZFW','uri'=>'notauri')); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + /** + * @deprecated + */ + public function testSetsGeneratorName_Deprecated() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setGenerator('ZFW'); + $this->assertEquals(array('name'=>'ZFW'), $writer->getGenerator()); + } + + /** + * @deprecated + */ + public function testSetsGeneratorVersion_Deprecated() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setGenerator('ZFW', '1.0'); + $this->assertEquals(array('name'=>'ZFW', 'version' => '1.0'), $writer->getGenerator()); + } + + /** + * @deprecated + */ + public function testSetsGeneratorUri_Deprecated() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setGenerator('ZFW', null, 'http://www.example.com'); + $this->assertEquals(array('name'=>'ZFW', 'uri' => 'http://www.example.com'), $writer->getGenerator()); + } + + /** + * @deprecated + */ + public function testSetsGeneratorThrowsExceptionOnInvalidName_Deprecated() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setGenerator(''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + /** + * @deprecated + */ + public function testSetsGeneratorThrowsExceptionOnInvalidVersion_Deprecated() + { + $writer = new Zend_Feed_Writer_Feed; + try { + $writer->setGenerator('ZFW', ''); + $this->fail(); + } catch (Zend_Feed_Exception $e) { + } + } + + /** + * @deprecated + */ + public function testSetsGeneratorThrowsExceptionOnInvalidUri_Deprecated() + { + $writer = new Zend_Feed_Writer_Feed; try { $writer->setGenerator('ZFW', null, 'notauri'); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetGeneratorReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $this->assertTrue(is_null($writer->getGenerator())); } public function testSetsFeedLink() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->setFeedLink('http://www.example.com/rss', 'RSS'); $this->assertEquals(array('rss'=>'http://www.example.com/rss'), $writer->getFeedLinks()); } public function testSetsFeedLinkThrowsExceptionOnInvalidType() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->setFeedLink('http://www.example.com/rss', 'abc'); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testSetsFeedLinkThrowsExceptionOnInvalidUri() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->setFeedLink('http://', 'rss'); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetFeedLinksReturnsNullIfNotSet() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $this->assertTrue(is_null($writer->getFeedLinks())); } public function testSetsBaseUrl() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->setBaseUrl('http://www.example.com'); $this->assertEquals('http://www.example.com', $writer->getBaseUrl()); } public function testSetsBaseUrlThrowsExceptionOnInvalidUri() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->setBaseUrl('http://'); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testGetBaseUrlReturnsNullIfNotSet() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $this->assertTrue(is_null($writer->getBaseUrl())); } public function testAddsHubUrl() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->addHub('http://www.example.com/hub'); $this->assertEquals(array('http://www.example.com/hub'), $writer->getHubs()); } public function testAddsManyHubUrls() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->addHubs(array('http://www.example.com/hub', 'http://www.example.com/hub2')); $this->assertEquals(array('http://www.example.com/hub', 'http://www.example.com/hub2'), $writer->getHubs()); } public function testAddingHubUrlThrowsExceptionOnInvalidUri() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->addHub('http://'); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddingHubUrlReturnsNullIfNotSet() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $this->assertTrue(is_null($writer->getHubs())); } public function testCreatesNewEntryDataContainer() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $entry = $writer->createEntry(); - $this->assertTrue($entry instanceof \Zend\Feed\Writer\Entry); + $this->assertTrue($entry instanceof Zend_Feed_Writer_Entry); } public function testAddsCategory() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->addCategory(array('term'=>'cat_dog')); $this->assertEquals(array(array('term'=>'cat_dog')), $writer->getCategories()); } public function testAddsManyCategories() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $writer->addCategories(array(array('term'=>'cat_dog'),array('term'=>'cat_mouse'))); $this->assertEquals(array(array('term'=>'cat_dog'),array('term'=>'cat_mouse')), $writer->getCategories()); } public function testAddingCategoryWithoutTermThrowsException() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->addCategory(array('label' => 'Cats & Dogs', 'scheme' => 'http://www.example.com/schema1')); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } public function testAddingCategoryWithInvalidUriAsSchemeThrowsException() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; try { $writer->addCategory(array('term' => 'cat_dog', 'scheme' => 'http://')); $this->fail(); - } catch (Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { } } + // Image Tests + + public function testSetsImageUri() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array( + 'uri' => 'http://www.example.com/logo.gif' + )); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/logo.gif' + ), $writer->getImage()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetsImageUriThrowsExceptionOnEmptyUri() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array( + 'uri' => '' + )); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetsImageUriThrowsExceptionOnMissingUri() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testSetsImageUriThrowsExceptionOnInvalidUri() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array( + 'uri' => 'http://' + )); + } + + public function testSetsImageLink() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com' + )); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com' + ), $writer->getImage()); + } + + public function testSetsImageTitle() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'title' => 'Image title' + )); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/logo.gif', + 'title' => 'Image title' + ), $writer->getImage()); + } + + public function testSetsImageHeight() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'height' => '88' + )); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/logo.gif', + 'height' => '88' + ), $writer->getImage()); + } + + public function testSetsImageWidth() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'width' => '88' + )); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/logo.gif', + 'width' => '88' + ), $writer->getImage()); + } + + public function testSetsImageDescription() + { + $writer = new Zend_Feed_Writer_Feed; + $writer->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'description' => 'Image description' + )); + $this->assertEquals(array( + 'uri' => 'http://www.example.com/logo.gif', + 'description' => 'Image description' + ), $writer->getImage()); + } + public function testGetCategoriesReturnsNullIfNotSet() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $this->assertTrue(is_null($writer->getCategories())); } public function testAddsAndOrdersEntriesByDateIfRequested() { - $writer = new WriterFeed\Feed; + $writer = new Zend_Feed_Writer_Feed; $entry = $writer->createEntry(); $entry->setDateCreated(1234567890); $entry2 = $writer->createEntry(); @@ -637,7 +851,7 @@ public function testAddsAndOrdersEntriesByDateIfRequested() $writer->addEntry($entry); $writer->addEntry($entry2); $writer->orderByDate(); - $this->assertEquals(1230000000, $writer->getEntry(1)->getDateCreated()->get(Date\Date::TIMESTAMP)); + $this->assertEquals(1230000000, $writer->getEntry(1)->getDateCreated()->get(Zend_Date::TIMESTAMP)); } } diff --git a/test/Writer/Renderer/Entry/AtomTest.php b/test/Writer/Renderer/Entry/AtomTest.php index 92b9ff57..44566221 100644 --- a/test/Writer/Renderer/Entry/AtomTest.php +++ b/test/Writer/Renderer/Entry/AtomTest.php @@ -20,13 +20,11 @@ * @version $Id$ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Writer\Renderer\Entry; -use Zend\Feed\Writer\Renderer\Feed\Atom; -use Zend\Feed\Reader; -use Zend\Date; +require_once dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; + +require_once 'Zend/Feed/Writer/Renderer/Feed/Atom.php'; +require_once 'Zend/Feed/Reader.php'; +require_once 'Zend/Version.php'; /** * @category Zend @@ -37,7 +35,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class AtomTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Writer_Renderer_Entry_AtomTest extends PHPUnit_Framework_TestCase { protected $_validWriter = null; @@ -45,7 +43,7 @@ class AtomTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->_validWriter = new \Zend\Feed\Writer\Feed\Feed; + $this->_validWriter = new Zend_Feed_Writer_Feed; $this->_validWriter->setType('atom'); @@ -74,10 +72,10 @@ public function tearDown() public function testRenderMethodRunsMinimalWriterContainerProperlyBeforeICheckAtomCompliance() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); try { $renderer->render(); - } catch (\Zend\Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { $this->fail('Valid Writer object caused an exception when building which should never happen'); } } @@ -85,40 +83,42 @@ public function testRenderMethodRunsMinimalWriterContainerProperlyBeforeICheckAt public function testEntryEncodingHasBeenSet() { $this->_validWriter->setEncoding('iso-8859-1'); - $renderer = new Atom\Atom($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('iso-8859-1', $entry->getEncoding()); } public function testEntryEncodingDefaultIsUsedIfEncodingNotSetByHand() { - $renderer = new Atom\Atom($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('UTF-8', $entry->getEncoding()); } public function testEntryTitleHasBeenSet() { - $renderer = new Atom\Atom($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('This is a test entry.', $entry->getTitle()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testFeedTitleIfMissingThrowsException() { - $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validEntry->remove('title'); $atomFeed->render(); } public function testEntrySummaryDescriptionHasBeenSet() { - $renderer = new Atom\Atom($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('This is a test entry description.', $entry->getDescription()); } @@ -128,16 +128,18 @@ public function testEntrySummaryDescriptionHasBeenSet() */ public function testEntryContentHasBeenSet_Xhtml() { - $renderer = new Atom\Atom($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('

This is test content for xhtml:

', $entry->getContent()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testFeedContentIfMissingThrowsExceptionIfThereIsNoLink() { - $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validEntry->remove('content'); $this->_validEntry->remove('link'); $atomFeed->render(); @@ -145,40 +147,42 @@ public function testFeedContentIfMissingThrowsExceptionIfThereIsNoLink() public function testEntryUpdatedDateHasBeenSet() { - $renderer = new Atom\Atom($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); - $this->assertEquals(1234567890, $entry->getDateModified()->get(Date\Date::TIMESTAMP)); + $this->assertEquals(1234567890, $entry->getDateModified()->get(Zend_Date::TIMESTAMP)); } + /** + * @expectedException Zend_Feed_Exception + */ public function testFeedUpdatedDateIfMissingThrowsException() { - $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validEntry->remove('dateModified'); $atomFeed->render(); } public function testEntryPublishedDateHasBeenSet() { - $renderer = new Atom\Atom($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); - $this->assertEquals(1234567000, $entry->getDateCreated()->get(Date\Date::TIMESTAMP)); + $this->assertEquals(1234567000, $entry->getDateCreated()->get(Zend_Date::TIMESTAMP)); } public function testEntryIncludesLinkToHtmlVersionOfFeed() { - $renderer= new Atom\Atom($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer= new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('http://www.example.com/1', $entry->getLink()); } public function testEntryHoldsAnyAuthorAdded() { - $renderer = new Atom\Atom($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $author = $entry->getAuthor(); $this->assertEquals(array( @@ -189,13 +193,13 @@ public function testEntryHoldsAnyAuthorAdded() public function testEntryHoldsAnyEnclosureAdded() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validEntry->setEnclosure(array( 'type' => 'audio/mpeg', 'length' => '1337', 'uri' => 'http://example.com/audio.mp3' )); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $enc = $entry->getEnclosure(); $this->assertEquals('audio/mpeg', $enc->type); @@ -206,33 +210,37 @@ public function testEntryHoldsAnyEnclosureAdded() public function testEntryIdHasBeenSet() { $this->_validEntry->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); - $renderer = new Atom\Atom($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $entry->getId()); } public function testFeedIdDefaultIsUsedIfNotSetByHand() { - $renderer = new Atom\Atom($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals($entry->getLink(), $entry->getId()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testFeedIdIfMissingThrowsException() { - $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validEntry->remove('id'); $this->_validEntry->remove('link'); $atomFeed->render(); } + /** + * @expectedException Zend_Feed_Exception + */ public function testFeedIdThrowsExceptionIfNotUri() { - $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validEntry->remove('id'); $this->_validEntry->remove('link'); $this->_validEntry->setId('not-a-uri'); @@ -241,18 +249,18 @@ public function testFeedIdThrowsExceptionIfNotUri() public function testCommentLinkRendered() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validEntry->setCommentLink('http://www.example.com/id/1'); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('http://www.example.com/id/1', $entry->getCommentLink()); } public function testCommentCountRendered() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validEntry->setCommentCount(22); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals(22, $entry->getCommentCount()); } @@ -263,9 +271,9 @@ public function testCategoriesCanBeSet() array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2') )); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $entry = $feed->current(); $expected = array( array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), @@ -276,12 +284,12 @@ public function testCategoriesCanBeSet() public function testCommentFeedLinksRendered() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validEntry->setCommentFeedLinks(array( array('uri'=>'http://www.example.com/atom/id/1','type'=>'atom'), array('uri'=>'http://www.example.com/rss/id/1','type'=>'rss'), )); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); // Skipped over due to ZFR bug (detects Atom in error when RSS requested) //$this->assertEquals('http://www.example.com/rss/id/1', $entry->getCommentFeedLink('rss')); diff --git a/test/Writer/Renderer/Entry/RssTest.php b/test/Writer/Renderer/Entry/RssTest.php index 0ca5a7f7..c4de5fbf 100644 --- a/test/Writer/Renderer/Entry/RssTest.php +++ b/test/Writer/Renderer/Entry/RssTest.php @@ -20,13 +20,11 @@ * @version $Id$ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Writer\Renderer\Entry; -use Zend\Feed\Writer\Renderer\Feed; -use Zend\Feed\Reader; -use Zend\Date; +require_once dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; + +require_once 'Zend/Feed/Writer/Renderer/Feed/Rss.php'; +require_once 'Zend/Feed/Reader.php'; +require_once 'Zend/Version.php'; /** * @category Zend @@ -37,7 +35,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class RssTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Writer_Renderer_Entry_RssTest extends PHPUnit_Framework_TestCase { protected $_validWriter = null; @@ -45,7 +43,7 @@ class RssTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->_validWriter = new \Zend\Feed\Writer\Feed\Feed; + $this->_validWriter = new Zend_Feed_Writer_Feed; $this->_validWriter->setType('rss'); @@ -67,10 +65,10 @@ public function tearDown() public function testRenderMethodRunsMinimalWriterContainerProperlyBeforeICheckAtomCompliance() { - $renderer = new Feed\RSS($this->_validWriter); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); try { $renderer->render(); - } catch (\Zend\Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { $this->fail('Valid Writer object caused an exception when building which should never happen'); } } @@ -78,32 +76,34 @@ public function testRenderMethodRunsMinimalWriterContainerProperlyBeforeICheckAt public function testEntryEncodingHasBeenSet() { $this->_validWriter->setEncoding('iso-8859-1'); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('iso-8859-1', $entry->getEncoding()); } public function testEntryEncodingDefaultIsUsedIfEncodingNotSetByHand() { - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('UTF-8', $entry->getEncoding()); } public function testEntryTitleHasBeenSet() { - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('This is a test entry.', $entry->getTitle()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testEntryTitleIfMissingThrowsExceptionIfDescriptionAlsoMissing() { - $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Feed\RSS($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validEntry->remove('title'); $this->_validEntry->remove('description'); $atomFeed->render(); @@ -111,25 +111,27 @@ public function testEntryTitleIfMissingThrowsExceptionIfDescriptionAlsoMissing() public function testEntryTitleCharDataEncoding() { - $renderer = new Feed\RSS($this->_validWriter); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validEntry->setTitle('<>&\'"áéíóú'); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('<>&\'"áéíóú', $entry->getTitle()); } public function testEntrySummaryDescriptionHasBeenSet() { - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('This is a test entry description.', $entry->getDescription()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testEntryDescriptionIfMissingThrowsExceptionIfAlsoNoTitle() { - $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Feed\RSS($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validEntry->remove('description'); $this->_validEntry->remove('title'); $atomFeed->render(); @@ -137,9 +139,9 @@ public function testEntryDescriptionIfMissingThrowsExceptionIfAlsoNoTitle() public function testEntryDescriptionCharDataEncoding() { - $renderer = new Feed\RSS($this->_validWriter); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validEntry->setDescription('<>&\'"áéíóú'); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('<>&\'"áéíóú', $entry->getDescription()); } @@ -147,17 +149,17 @@ public function testEntryDescriptionCharDataEncoding() public function testEntryContentHasBeenSet() { $this->_validEntry->setContent('This is test entry content.'); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('This is test entry content.', $entry->getContent()); } public function testEntryContentCharDataEncoding() { - $renderer = new Feed\RSS($this->_validWriter); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validEntry->setContent('<>&\'"áéíóú'); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('<>&\'"áéíóú', $entry->getContent()); } @@ -165,25 +167,25 @@ public function testEntryContentCharDataEncoding() public function testEntryUpdatedDateHasBeenSet() { $this->_validEntry->setDateModified(1234567890); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); - $this->assertEquals(1234567890, $entry->getDateModified()->get(Date\Date::TIMESTAMP)); + $this->assertEquals(1234567890, $entry->getDateModified()->get(Zend_Date::TIMESTAMP)); } public function testEntryPublishedDateHasBeenSet() { $this->_validEntry->setDateCreated(1234567000); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); - $this->assertEquals(1234567000, $entry->getDateCreated()->get(Date\Date::TIMESTAMP)); + $this->assertEquals(1234567000, $entry->getDateCreated()->get(Zend_Date::TIMESTAMP)); } public function testEntryIncludesLinkToHtmlVersionOfFeed() { - $renderer= new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer= new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('http://www.example.com/1', $entry->getLink()); } @@ -191,8 +193,8 @@ public function testEntryIncludesLinkToHtmlVersionOfFeed() public function testEntryHoldsAnyAuthorAdded() { $this->_validEntry->addAuthor('Jane', 'jane@example.com', 'http://www.example.com/jane'); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $author = $entry->getAuthor(); $this->assertEquals(array('name'=>'Jane'), $entry->getAuthor()); @@ -201,8 +203,8 @@ public function testEntryHoldsAnyAuthorAdded() public function testEntryAuthorCharDataEncoding() { $this->_validEntry->addAuthor('<>&\'"áéíóú', 'jane@example.com', 'http://www.example.com/jane'); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $author = $entry->getAuthor(); $this->assertEquals(array('name'=>'<>&\'"áéíóú'), $entry->getAuthor()); @@ -210,13 +212,13 @@ public function testEntryAuthorCharDataEncoding() public function testEntryHoldsAnyEnclosureAdded() { - $renderer = new Feed\RSS($this->_validWriter); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validEntry->setEnclosure(array( 'type' => 'audio/mpeg', 'length' => '1337', 'uri' => 'http://example.com/audio.mp3' )); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $enc = $entry->getEnclosure(); $this->assertEquals('audio/mpeg', $enc->type); @@ -224,11 +226,65 @@ public function testEntryHoldsAnyEnclosureAdded() $this->assertEquals('http://example.com/audio.mp3', $enc->url); } + /** + * @expectedException Zend_Feed_Exception + */ + public function testAddsEnclosureThrowsExceptionOnMissingType() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validEntry->setEnclosure(array( + 'uri' => 'http://example.com/audio.mp3', + 'length' => '1337' + )); + $renderer->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testAddsEnclosureThrowsExceptionOnMissingLength() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validEntry->setEnclosure(array( + 'type' => 'audio/mpeg', + 'uri' => 'http://example.com/audio.mp3' + )); + $renderer->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testAddsEnclosureThrowsExceptionOnNonNumericLength() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validEntry->setEnclosure(array( + 'type' => 'audio/mpeg', + 'uri' => 'http://example.com/audio.mp3', + 'length' => 'abc' + )); + $renderer->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testAddsEnclosureThrowsExceptionOnNegativeLength() + { + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $this->_validEntry->setEnclosure(array( + 'type' => 'audio/mpeg', + 'uri' => 'http://example.com/audio.mp3', + 'length' => -23 + )); + $renderer->render(); + } + public function testEntryIdHasBeenSet() { $this->_validEntry->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $entry->getId()); } @@ -240,38 +296,38 @@ public function testEntryIdHasBeenSetWithPermaLinkAsFalseWhenNotUri() public function testEntryIdDefaultIsUsedIfNotSetByHand() { - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals($entry->getLink(), $entry->getId()); } public function testCommentLinkRendered() { - $renderer = new Feed\RSS($this->_validWriter); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validEntry->setCommentLink('http://www.example.com/id/1'); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('http://www.example.com/id/1', $entry->getCommentLink()); } public function testCommentCountRendered() { - $renderer = new Feed\RSS($this->_validWriter); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validEntry->setCommentCount(22); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals(22, $entry->getCommentCount()); } public function testCommentFeedLinksRendered() { - $renderer = new Feed\RSS($this->_validWriter); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validEntry->setCommentFeedLinks(array( array('uri'=>'http://www.example.com/atom/id/1','type'=>'atom'), array('uri'=>'http://www.example.com/rss/id/1','type'=>'rss'), )); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); // Skipped assertion is because RSS has no facility to show Atom feeds without an extension $this->assertEquals('http://www.example.com/rss/id/1', $entry->getCommentFeedLink('rss')); @@ -284,8 +340,8 @@ public function testCategoriesCanBeSet() array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2') )); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $expected = array( array('term'=>'cat_dog', 'label' => 'cat_dog', 'scheme' => 'http://example.com/schema1'), @@ -303,8 +359,8 @@ public function testCategoriesCharDataEncoding() array('term'=>'<>&\'"áéíóú', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2') )); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $renderer = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $feed = Zend_Feed_Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $expected = array( array('term'=>'<>&\'"áéíóú', 'label' => '<>&\'"áéíóú', 'scheme' => 'http://example.com/schema1'), diff --git a/test/Writer/Renderer/Feed/AtomTest.php b/test/Writer/Renderer/Feed/AtomTest.php index 54063133..fe290dcd 100644 --- a/test/Writer/Renderer/Feed/AtomTest.php +++ b/test/Writer/Renderer/Feed/AtomTest.php @@ -20,13 +20,11 @@ * @version $Id$ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Writer\Renderer\Feed; -use Zend\Feed\Writer\Feed; -use Zend\Feed\Writer\Renderer\Feed\Atom; -use Zend\Feed\Reader; +require_once dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; + +require_once 'Zend/Feed/Writer/Renderer/Feed/Atom.php'; +require_once 'Zend/Feed/Reader.php'; +require_once 'Zend/Version.php'; /** * @category Zend @@ -37,14 +35,14 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class AtomTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Writer_Renderer_Feed_AtomTest extends PHPUnit_Framework_TestCase { protected $_validWriter = null; public function setUp() { - $this->_validWriter = new Feed\Feed; + $this->_validWriter = new Zend_Feed_Writer_Feed; $this->_validWriter->setTitle('This is a test feed.'); $this->_validWriter->setDescription('This is a test description.'); $this->_validWriter->setDateModified(1234567890); @@ -62,17 +60,17 @@ public function tearDown() public function testSetsWriterInConstructor() { - $writer = new Feed\Feed; - $feed = new Atom\Atom($writer); - $this->assertTrue($feed->getDataContainer() instanceof Feed\Feed); + $writer = new Zend_Feed_Writer_Feed; + $feed = new Zend_Feed_Writer_Renderer_Feed_Atom($writer); + $this->assertTrue($feed->getDataContainer() instanceof Zend_Feed_Writer_Feed); } public function testBuildMethodRunsMinimalWriterContainerProperlyBeforeICheckAtomCompliance() { - $feed = new Atom\Atom($this->_validWriter); + $feed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); try { $feed->render(); - } catch (\Zend\Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { $this->fail('Valid Writer object caused an exception when building which should never happen'); } } @@ -80,32 +78,34 @@ public function testBuildMethodRunsMinimalWriterContainerProperlyBeforeICheckAto public function testFeedEncodingHasBeenSet() { $this->_validWriter->setEncoding('iso-8859-1'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals('iso-8859-1', $feed->getEncoding()); } public function testFeedEncodingDefaultIsUsedIfEncodingNotSetByHand() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals('UTF-8', $feed->getEncoding()); } public function testFeedTitleHasBeenSet() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals('This is a test feed.', $feed->getTitle()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testFeedTitleIfMissingThrowsException() { - $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validWriter->remove('title'); $atomFeed->render(); } @@ -115,24 +115,24 @@ public function testFeedTitleIfMissingThrowsException() */ public function testFeedTitleCharDataEncoding() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validWriter->setTitle('<>&\'"áéíóú'); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals('<>&\'"áéíóú', $feed->getTitle()); } public function testFeedSubtitleHasBeenSet() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals('This is a test description.', $feed->getDescription()); } public function testFeedSubtitleThrowsNoExceptionIfMissing() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validWriter->remove('description'); $atomFeed->render(); } @@ -142,25 +142,27 @@ public function testFeedSubtitleThrowsNoExceptionIfMissing() */ public function testFeedSubtitleCharDataEncoding() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validWriter->setDescription('<>&\'"áéíóú'); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals('<>&\'"áéíóú', $feed->getDescription()); } public function testFeedUpdatedDateHasBeenSet() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); - $this->assertEquals(1234567890, $feed->getDateModified()->get(\Zend\Date\Date::TIMESTAMP)); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $this->assertEquals(1234567890, $feed->getDateModified()->get(Zend_Date::TIMESTAMP)); } + /** + * @expectedException Zend_Feed_Exception + */ public function testFeedUpdatedDateIfMissingThrowsException() { - $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validWriter->remove('dateModified'); $atomFeed->render(); } @@ -168,24 +170,24 @@ public function testFeedUpdatedDateIfMissingThrowsException() public function testFeedGeneratorHasBeenSet() { $this->_validWriter->setGenerator('FooFeedBuilder', '1.00', 'http://www.example.com'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals('FooFeedBuilder', $feed->getGenerator()); } public function testFeedGeneratorIfMissingThrowsNoException() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validWriter->remove('generator'); $atomFeed->render(); } public function testFeedGeneratorDefaultIsUsedIfGeneratorNotSetByHand() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); } @@ -195,81 +197,85 @@ public function testFeedGeneratorDefaultIsUsedIfGeneratorNotSetByHand() public function testFeedGeneratorCharDataEncoding() { $this->_validWriter->setGenerator('<>&\'"áéíóú', '1.00', 'http://www.example.com'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals('<>&\'"áéíóú', $feed->getGenerator()); } public function testFeedLanguageHasBeenSet() { $this->_validWriter->setLanguage('fr'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals('fr', $feed->getLanguage()); } public function testFeedLanguageIfMissingThrowsNoException() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validWriter->remove('language'); $atomFeed->render(); } public function testFeedLanguageDefaultIsUsedIfGeneratorNotSetByHand() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals(null, $feed->getLanguage()); } public function testFeedIncludesLinkToHtmlVersionOfFeed() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals('http://www.example.com', $feed->getLink()); } public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsNoExceptionIfIdSet() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validWriter->setId('http://www.example.com'); $this->_validWriter->remove('link'); $atomFeed->render(); } + /** + * @expectedException Zend_Feed_Exception + */ public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsExceptionIfIdMissing() { - $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validWriter->remove('link'); $atomFeed->render(); } public function testFeedIncludesLinkToXmlAtomWhereTheFeedWillBeAvailable() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals('http://www.example.com/atom', $feed->getFeedLink()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testFeedLinkToXmlAtomWhereTheFeedWillBeAvailableIfMissingThrowsException() { - $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validWriter->remove('feedLinks'); $atomFeed->render(); } public function testFeedHoldsAnyAuthorAdded() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $author = $feed->getAuthor(); $this->assertEquals(array( 'email'=>'joe@example.com', @@ -282,14 +288,14 @@ public function testFeedHoldsAnyAuthorAdded() */ public function testFeedAuthorCharDataEncoding() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $this->_validWriter->remove('authors'); $this->_validWriter->addAuthor(array( 'email'=>'<>&\'"áéíóú', 'name'=>'<>&\'"áéíóú', 'uri'=>'http://www.example.com/joe')); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $author = $feed->getAuthor(); $this->assertEquals(array( 'email'=>'<>&\'"áéíóú', @@ -310,44 +316,44 @@ public function testFeedAuthorIfNotSetThrowsNoExceptionIfAllEntriesIncludeAtLeas public function testFeedIdHasBeenSet() { $this->_validWriter->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $feed->getId()); } public function testFeedIdDefaultOfHtmlLinkIsUsedIfNotSetByHand() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals($feed->getLink(), $feed->getId()); } public function testBaseUrlCanBeSet() { $this->_validWriter->setBaseUrl('http://www.example.com/base'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals('http://www.example.com/base', $feed->getBaseUrl()); } public function testCopyrightCanBeSet() { $this->_validWriter->setCopyright('Copyright © 2009 Paddy'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals('Copyright © 2009 Paddy', $feed->getCopyright()); } public function testCopyrightCharDataEncoding() { $this->_validWriter->setCopyright('<>&\'"áéíóú'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $this->assertEquals('<>&\'"áéíóú', $feed->getCopyright()); } @@ -357,9 +363,9 @@ public function testCategoriesCanBeSet() array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2') )); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $expected = array( array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2', 'label' => 'cat_dog2', 'scheme' => null) @@ -373,9 +379,9 @@ public function testCategoriesCharDataEncoding() array('term'=>'cat_dog', 'label' => '<>&\'"áéíóú', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2') )); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $expected = array( array('term'=>'cat_dog', 'label' => '<>&\'"áéíóú', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2', 'label' => 'cat_dog2', 'scheme' => null) @@ -388,13 +394,27 @@ public function testHubsCanBeSet() $this->_validWriter->addHubs( array('http://www.example.com/hub', 'http://www.example.com/hub2') ); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $expected = array( 'http://www.example.com/hub', 'http://www.example.com/hub2' ); $this->assertEquals($expected, (array) $feed->getHubs()); } + public function testImageCanBeSet() + { + $this->_validWriter->setImage( + array('uri'=>'http://www.example.com/logo.gif') + ); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed->render(); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $expected = array( + 'uri' => 'http://www.example.com/logo.gif' + ); + $this->assertEquals($expected, $feed->getImage()); + } + } diff --git a/test/Writer/Renderer/Feed/RssTest.php b/test/Writer/Renderer/Feed/RssTest.php index c22d4b1f..9217c107 100644 --- a/test/Writer/Renderer/Feed/RssTest.php +++ b/test/Writer/Renderer/Feed/RssTest.php @@ -20,13 +20,11 @@ * @version $Id$ */ -/** - * @namespace - */ -namespace ZendTest\Feed\Writer\Renderer\Feed; -use Zend\Feed\Writer\Feed; -use Zend\Feed\Writer\Renderer\Feed as RendererFeed; -use Zend\Feed\Reader; +require_once dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; + +require_once 'Zend/Feed/Writer/Renderer/Feed/Rss.php'; +require_once 'Zend/Feed/Reader.php'; +require_once 'Zend/Version.php'; /** * @category Zend @@ -37,14 +35,14 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class RssTest extends \PHPUnit_Framework_TestCase +class Zend_Feed_Writer_Renderer_Feed_RssTest extends PHPUnit_Framework_TestCase { protected $_validWriter = null; public function setUp() { - $this->_validWriter = new Feed\Feed; + $this->_validWriter = new Zend_Feed_Writer_Feed; $this->_validWriter->setTitle('This is a test feed.'); $this->_validWriter->setDescription('This is a test description.'); $this->_validWriter->setLink('http://www.example.com'); @@ -59,17 +57,17 @@ public function tearDown() public function testSetsWriterInConstructor() { - $writer = new Feed\Feed; - $feed = new RendererFeed\RSS($writer); - $this->assertTrue($feed->getDataContainer() instanceof Feed\Feed); + $writer = new Zend_Feed_Writer_Feed; + $feed = new Zend_Feed_Writer_Renderer_Feed_Rss($writer); + $this->assertTrue($feed->getDataContainer() instanceof Zend_Feed_Writer_Feed); } public function testBuildMethodRunsMinimalWriterContainerProperlyBeforeICheckRssCompliance() { - $feed = new RendererFeed\RSS($this->_validWriter); + $feed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); try { $feed->render(); - } catch (\Zend\Feed\Exception $e) { + } catch (Zend_Feed_Exception $e) { $this->fail('Valid Writer object caused an exception when building which should never happen'); } } @@ -77,32 +75,34 @@ public function testBuildMethodRunsMinimalWriterContainerProperlyBeforeICheckRss public function testFeedEncodingHasBeenSet() { $this->_validWriter->setEncoding('iso-8859-1'); - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); $this->assertEquals('iso-8859-1', $feed->getEncoding()); } public function testFeedEncodingDefaultIsUsedIfEncodingNotSetByHand() { - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); $this->assertEquals('UTF-8', $feed->getEncoding()); } public function testFeedTitleHasBeenSet() { - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); $this->assertEquals('This is a test feed.', $feed->getTitle()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testFeedTitleIfMissingThrowsException() { - $this->setExpectedException('Zend\Feed\Exception'); - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validWriter->remove('title'); $rssFeed->render(); } @@ -112,25 +112,27 @@ public function testFeedTitleIfMissingThrowsException() */ public function testFeedTitleCharDataEncoding() { - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validWriter->setTitle('<>&\'"áéíóú'); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); $this->assertEquals('<>&\'"áéíóú', $feed->getTitle()); } public function testFeedDescriptionHasBeenSet() { - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); $this->assertEquals('This is a test description.', $feed->getDescription()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testFeedDescriptionThrowsExceptionIfMissing() { - $this->setExpectedException('Zend\Feed\Exception'); - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validWriter->remove('description'); $rssFeed->render(); } @@ -140,89 +142,100 @@ public function testFeedDescriptionThrowsExceptionIfMissing() */ public function testFeedDescriptionCharDataEncoding() { - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validWriter->setDescription('<>&\'"áéíóú'); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); $this->assertEquals('<>&\'"áéíóú', $feed->getDescription()); } public function testFeedUpdatedDateHasBeenSet() { $this->_validWriter->setDateModified(1234567890); - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); - $this->assertEquals(1234567890, $feed->getDateModified()->get(\Zend\Date\Date::TIMESTAMP)); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals(1234567890, $feed->getDateModified()->get(Zend_Date::TIMESTAMP)); } public function testFeedUpdatedDateIfMissingThrowsNoException() { - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validWriter->remove('dateModified'); $rssFeed->render(); } + public function testFeedLastBuildDateHasBeenSet() + { + $this->_validWriter->setLastBuildDate(1234567890); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals(1234567890, $feed->getLastBuildDate()->get(Zend_Date::TIMESTAMP)); + } + public function testFeedGeneratorHasBeenSet() { $this->_validWriter->setGenerator('FooFeedBuilder', '1.00', 'http://www.example.com'); - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); $this->assertEquals('FooFeedBuilder 1.00 (http://www.example.com)', $feed->getGenerator()); } public function testFeedGeneratorIfMissingThrowsNoException() { - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validWriter->remove('generator'); $rssFeed->render(); } public function testFeedGeneratorDefaultIsUsedIfGeneratorNotSetByHand() { - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); - $this->assertEquals('Zend_Feed_Writer ' . \Zend\Version::VERSION . ' (http://framework.zend.com)', $feed->getGenerator()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $this->assertEquals('Zend_Feed_Writer ' . Zend_Version::VERSION . ' (http://framework.zend.com)', $feed->getGenerator()); } public function testFeedLanguageHasBeenSet() { $this->_validWriter->setLanguage('fr'); - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); $this->assertEquals('fr', $feed->getLanguage()); } public function testFeedLanguageIfMissingThrowsNoException() { - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validWriter->remove('language'); $rssFeed->render(); } public function testFeedLanguageDefaultIsUsedIfGeneratorNotSetByHand() { - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); $this->assertEquals(null, $feed->getLanguage()); } public function testFeedIncludesLinkToHtmlVersionOfFeed() { - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); $this->assertEquals('http://www.example.com', $feed->getLink()); } + /** + * @expectedException Zend_Feed_Exception + */ public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsException() { - $this->setExpectedException('Zend\Feed\Exception'); - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validWriter->remove('link'); $rssFeed->render(); } @@ -230,15 +243,15 @@ public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsException() public function testFeedIncludesLinkToXmlRssWhereTheFeedWillBeAvailable() { $this->_validWriter->setFeedLink('http://www.example.com/rss', 'rss'); - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); $this->assertEquals('http://www.example.com/rss', $feed->getFeedLink()); } public function testFeedLinkToXmlRssWhereTheFeedWillBeAvailableIfMissingThrowsNoException() { - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $this->_validWriter->remove('feedLinks'); $rssFeed->render(); } @@ -246,9 +259,9 @@ public function testFeedLinkToXmlRssWhereTheFeedWillBeAvailableIfMissingThrowsNo public function testBaseUrlCanBeSet() { $this->_validWriter->setBaseUrl('http://www.example.com/base'); - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); $this->assertEquals('http://www.example.com/base', $feed->getBaseUrl()); } @@ -258,9 +271,9 @@ public function testBaseUrlCanBeSet() public function testFeedHoldsAnyAuthorAdded() { $this->_validWriter->addAuthor('Joe', 'joe@example.com', 'http://www.example.com/joe'); - $atomFeed = new RendererFeed\RSS($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $author = $feed->getAuthor(); $this->assertEquals(array('name'=>'Joe'), $feed->getAuthor()); } @@ -271,9 +284,9 @@ public function testFeedHoldsAnyAuthorAdded() public function testFeedAuthorCharDataEncoding() { $this->_validWriter->addAuthor('<>&\'"áéíóú', 'joe@example.com', 'http://www.example.com/joe'); - $atomFeed = new RendererFeed\RSS($this->_validWriter); + $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $atomFeed->render(); - $feed = Reader\Reader::importString($atomFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); $author = $feed->getAuthor(); $this->assertEquals(array('name'=>'<>&\'"áéíóú'), $feed->getAuthor()); } @@ -281,9 +294,9 @@ public function testFeedAuthorCharDataEncoding() public function testCopyrightCanBeSet() { $this->_validWriter->setCopyright('Copyright © 2009 Paddy'); - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); $this->assertEquals('Copyright © 2009 Paddy', $feed->getCopyright()); } @@ -293,9 +306,9 @@ public function testCopyrightCanBeSet() public function testCopyrightCharDataEncoding() { $this->_validWriter->setCopyright('<>&\'"áéíóú'); - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); $this->assertEquals('<>&\'"áéíóú', $feed->getCopyright()); } @@ -305,9 +318,9 @@ public function testCategoriesCanBeSet() array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2') )); - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); $expected = array( array('term'=>'cat_dog', 'label' => 'cat_dog', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2', 'label' => 'cat_dog2', 'scheme' => null) @@ -324,9 +337,9 @@ public function testCategoriesCharDataEncoding() array('term'=>'<>&\'"áéíóú', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2') )); - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); $expected = array( array('term'=>'<>&\'"áéíóú', 'label' => '<>&\'"áéíóú', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2', 'label' => 'cat_dog2', 'scheme' => null) @@ -339,13 +352,221 @@ public function testHubsCanBeSet() $this->_validWriter->addHubs( array('http://www.example.com/hub', 'http://www.example.com/hub2') ); - $rssFeed = new RendererFeed\RSS($this->_validWriter); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); $rssFeed->render(); - $feed = Reader\Reader::importString($rssFeed->saveXml()); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); $expected = array( 'http://www.example.com/hub', 'http://www.example.com/hub2' ); $this->assertEquals($expected, (array) $feed->getHubs()); } + public function testImageCanBeSet() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'height' => '400', + 'width' => '144', + 'description' => 'Image TITLE' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $expected = array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'height' => '400', + 'width' => '144', + 'description' => 'Image TITLE' + ); + $this->assertEquals($expected, $feed->getImage()); + } + + public function testImageCanBeSetWithOnlyRequiredElements() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + $feed = Zend_Feed_Reader::importString($rssFeed->saveXml()); + $expected = array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT' + ); + $this->assertEquals($expected, $feed->getImage()); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionOnMissingLink() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'title' => 'Image ALT' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionOnMissingTitle() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionOnMissingUri() + { + $this->_validWriter->setImage(array( + 'link' => 'http://www.example.com', + 'title' => 'Image ALT' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionIfOptionalDescriptionInvalid() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'description' => 2 + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionIfOptionalDescriptionEmpty() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'description' => '' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionIfOptionalHeightNotAnInteger() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'height' => 'a', + 'width' => 144 + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionIfOptionalHeightEmpty() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'height' => '', + 'width' => 144 + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionIfOptionalHeightGreaterThan400() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'height' => '401', + 'width' => 144 + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionIfOptionalWidthNotAnInteger() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'height' => '400', + 'width' => 'a' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionIfOptionalWidthEmpty() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'height' => '400', + 'width' => '' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + /** + * @expectedException Zend_Feed_Exception + */ + public function testImageThrowsExceptionIfOptionalWidthGreaterThan144() + { + $this->_validWriter->setImage(array( + 'uri' => 'http://www.example.com/logo.gif', + 'link' => 'http://www.example.com', + 'title' => 'Image ALT', + 'height' => '400', + 'width' => '145' + )); + $rssFeed = new Zend_Feed_Writer_Renderer_Feed_Rss($this->_validWriter); + $rssFeed->render(); + } + + } diff --git a/test/_files/AtomHOnline.xml b/test/_files/AtomHOnline.xml deleted file mode 100644 index c1d6daa5..00000000 --- a/test/_files/AtomHOnline.xml +++ /dev/null @@ -1,554 +0,0 @@ - - - - -The H - news feed -Technology news - - -2009-09-17T17:39:21+02:00 - -The H - -http://www.h-online.com/security/Google-acquires-reCAPTCHA--/news/114266/from/rss - - - Google acquires reCAPTCHA - - Google has announced that it has acquired reCAPTCHA, one of the leading providers of CAPTCHAs which are used in authentication tests - http://www.h-online.com/security/Google-acquires-reCAPTCHA--/news/114266/from/rss - 2009-09-17T17:39:21+02:00 - - - - - Lost+Found: Password shaking, macro viruses and comment spam - - Too short for news, too good to lose; lost+found is a round up of useful security information. Today, Password shaking, macro viruses and comment spam - http://www.h-online.com/security/Lost-Found-Password-shaking-macro-viruses-and-comment-spam--/news/114265/from/rss - 2009-09-17T16:29:59+02:00 - - - - - Free Microsoft tools for detecting security problems - - Microsoft has made two free tools for detecting holes in applications available to developers. For quite some time Redmond's own developers have been using these tools within the Security Development Life cycle - http://www.h-online.com/security/Free-Microsoft-tools-for-detecting-security-problems--/news/114264/from/rss - 2009-09-17T16:00:48+02:00 - - - - - Chatting with a phisher - - After Man-in-the-Middle attacks we now have Chat-in-the-Middle attacks on online banking customers. These pop up a chat window in the browser - and a phisher, posing as a bank representative, starts asking probing questions - http://www.h-online.com/security/Chatting-with-a-phisher--/news/114263/from/rss - 2009-09-17T15:20:05+02:00 - - - - - Noop - a new language for the JVM - - Noop is a new language for the JVM which aims to make coding more productive and reliable by making dependency injection and testing fundamental to the language - http://www.h-online.com/open/Noop-a-new-language-for-the-JVM--/news/114262/from/rss - 2009-09-17T13:14:06+02:00 - - - - - Version 4.2 of OSGi Java component technology available - - Version 4.2 of the OSGi component technology, which is popular in the Java world, is now available to download. Almost all Java EE application servers are based on this specification - http://www.h-online.com/open/Version-4-2-of-OSGi-Java-component-technology-available--/news/114261/from/rss - 2009-09-17T11:53:12+02:00 - - - - - DragonFly BSD 2.4 released - - The DragonFly BSD project has announced the availability of version 2.4 of their FreeBSD fork, a major update that includes several bug fixes, performance improvements and a new 64-bit port - http://www.h-online.com/open/DragonFly-BSD-2-4-released--/news/114260/from/rss - 2009-09-17T11:16:08+02:00 - - - - - Privacy for RFID tags - - Wholesale RFID tagging poses a risk to privacy. A research team has proposed distributing keys as a method of ensuring privacy - http://www.h-online.com/security/Privacy-for-RFID-tags--/news/114259/from/rss - 2009-09-17T09:48:38+02:00 - - - - - Firefox Flash check working - - In one week, ten million Firefox users have responded to Firefox's recently added Adobe Flash checks - http://www.h-online.com/security/Firefox-Flash-check-working--/news/114258/from/rss - 2009-09-17T10:44:58+02:00 - - - - - Nominations open for the Free Software Awards - - The FSF has opened nominations for 2009's Free Software Awards, and is looking for nominations for individuals and projects - http://www.h-online.com/open/Nominations-open-for-the-Free-Software-Awards--/news/114257/from/rss - 2009-09-16T20:06:38+02:00 - - - - - ClarkConnect becomes ClearOS - - The ClearFoundation is hoping to scale new heights with ClearOS [--] the Linux-based small business server, a successor to ClarkConnect, which will now be free to use, with the income stream coming from related services - http://www.h-online.com/open/ClarkConnect-becomes-ClearOS--/news/114256/from/rss - 2009-09-16T18:58:00+02:00 - - - - - GitHub to move to Rackspace - - GitHub co-founder Tom Preston-Werner has announced that the open source code hosting service will be moving its servers from Engine Yard to Rackspace - http://www.h-online.com/open/GitHub-to-move-to-Rackspace--/news/114255/from/rss - 2009-09-16T18:23:09+02:00 - - - - - KOffice 2.1 Beta 2 released - - The KOffice developers have released the second beta of version 2.1 of their open source office suite, which includes a number of bug fixes, new features and performance improvements - http://www.h-online.com/open/KOffice-2-1-Beta-2-released--/news/114253/from/rss - 2009-09-16T16:34:45+02:00 - - - - - MonitoringForge uncovered by GroundWork - - GroundWork has revealed its new community for open source network monitoring and management - http://www.h-online.com/open/MonitoringForge-uncovered-by-GroundWork--/news/114254/from/rss - 2009-09-16T16:32:06+02:00 - - - - - Companies have wrong priorities for security updates - - Although attacks on Windows PCs nowadays almost exclusively exploit vulnerabilities in applications, it takes twice as long for security updates for applications to be installed as it does to plug vulnerabilities in the operating system - http://www.h-online.com/security/Companies-have-wrong-priorities-for-security-updates--/news/114252/from/rss - 2009-09-16T15:07:52+02:00 - - - - - Jaspersoft launches JasperReports Professional Developer Edition - - Open source Business Intelligence software specialist Jaspersoft has announced the immediate availability of a new version of JasperReports Professional and has introduced JasperReports Professional Developer Edition - http://www.h-online.com/open/Jaspersoft-launches-JasperReports-Professional-Developer-Edition--/news/114251/from/rss - 2009-09-16T13:12:54+02:00 - - - - - Google Android 1.6 SDK released - - The Google Android Developers have announced the release of the Android 1.6, code name Donut, software development kit - http://www.h-online.com/open/Google-Android-1-6-SDK-released--/news/114249/from/rss - 2009-09-16T12:30:13+02:00 - - - - - Oracle Enterprise Linux updated - - Oracle updates its RHEL clone, Unbreakable Linux, to keep in step with Red Hat Enterprise Linux - http://www.h-online.com/open/Oracle-Enterprise-Linux-updated--/news/114250/from/rss - 2009-09-16T11:46:25+02:00 - - - - - Terracotta 3.1 supports Hibernate - - Distributed caching for Hibernate queries comes to Terracotta's caching system with version 3.1's new Hibernate plug-in - http://www.h-online.com/open/Terracotta-3-1-supports-Hibernate--/news/114248/from/rss - 2009-09-16T11:30:17+02:00 - - - - - Google Chrome 3.0 released - - Just over one year after Google's Chrome web browser was originally launched, Google has announced the release of Chrome version 3 which includes several bug fixes, improvements and new features - http://www.h-online.com/security/Google-Chrome-3-0-released--/news/114247/from/rss - 2009-09-16T11:18:46+02:00 - - - - - MySpace bring open source MapReduce to .NET - - MySpace have released Quizmt, an implementation of MapReduce algorithms for clustered computing running on Windows and .NET - http://www.h-online.com/open/MySpace-bring-open-source-MapReduce-to-NET--/news/114246/from/rss - 2009-09-17T12:07:01+02:00 - - - - - GNOME Foundation releases first quarterly report - - The GNOME Foundation has released its first quarterly report. The Q2 2009 Quarterly report spans June, July and August and covers several topics, including the projects migration to Git - http://www.h-online.com/open/GNOME-Foundation-releases-first-quarterly-report--/news/114244/from/rss - 2009-09-15T17:29:49+02:00 - - - - - Live video stream of LinuxCon 2009 highlights - - Highlights of the Linux Foundation conference LinuxCon 2009, taking place from the 21st to the 23rd of September are to be available as a live internet broadcast. Keynote speakers include Joe Brockmeier, Bdale Garbee and Mark Shuttleworth - http://www.h-online.com/open/Live-video-stream-of-LinuxCon-2009-highlights--/news/114245/from/rss - 2009-09-15T17:22:22+02:00 - - - - - Anonymous browsing on Android - - A group of developers at the Digital Technology Group at the University of Cambridge have released two Android applications that allow users browse the web anonymously using The Onion Router - http://www.h-online.com/security/Anonymous-browsing-on-Android--/news/114243/from/rss - 2009-09-15T16:25:05+02:00 - - - - - New York Times shows bad banner ad - - Over the weekend, visitors to the newspaper's website were confronted with scareware pop-ups telling them that their PCs had an infection. In order to place their fake banner ad, the scammers had passed themselves off as a well-known company - http://www.h-online.com/security/New-York-Times-shows-bad-banner-ad--/news/114242/from/rss - 2009-09-15T14:31:25+02:00 - - - - - Referential integrity for Berkeley DB - - Oracle has added foreign keys and a C# interface to its free Berkeley DB - http://www.h-online.com/open/Referential-integrity-for-Berkeley-DB--/news/114241/from/rss - 2009-09-15T13:49:10+02:00 - - - - - Horde vulnerabilities fixed - - New versions of the Horde Application Framework, Horde Groupware and various other Horde applications fix two cross-site scripting vulnerabilities and one vulnerability which allows files to be overwritten - http://www.h-online.com/security/Horde-vulnerabilities-fixed--/news/114240/from/rss - 2009-09-15T11:59:43+02:00 - - - - - openSUSE 11.2 Milestone 7 released - - The openSUSE project has released the seventh milestone in the development of openSUSE 11.2, code named Fichte - http://www.h-online.com/open/openSUSE-11-2-Milestone-7-released--/news/114238/from/rss - 2009-09-15T11:51:52+02:00 - - - - - Security updates for Bugzilla - - The developers of the Bugzilla open source bug tracking system have released versions 3.0.9, 3.2.5 and 3.4.2, which fix SQL injection vulnerabilities and remove a means of sniffing out a user's password - http://www.h-online.com/security/Security-updates-for-Bugzilla--/news/114239/from/rss - 2009-09-15T11:12:10+02:00 - - - - - Microsoft says "We are working on our Linux drivers" - - Microsoft's Sam Ramji says the company is working on their Linux Hyper-V drivers and has not abandoned them - http://www.h-online.com/open/Microsoft-says-We-are-working-on-our-Linux-drivers--/news/114237/from/rss - 2009-09-15T09:48:54+02:00 - - - - - The Linux Foundation welcomes ARM - - The microprocessor and microcontroller manufacturer has joined the Linux Foundation. ARM processors are used in a large number of Linux driven mobile devices - http://www.h-online.com/open/The-Linux-Foundation-welcomes-ARM--/news/114236/from/rss - 2009-09-15T12:43:47+02:00 - - - - - CodePlex Foundation founding flawed says legal expert - - Andrew Updegrove, of Gesmer Updegrove LLP, has documented his concerns with the founding of Microsoft's CodePlex Foundation - http://www.h-online.com/open/CodePlex-Foundation-founding-flawed-says-legal-expert--/news/114235/from/rss - 2009-09-14T18:05:10+02:00 - - - - - SystemRescueCd 1.3.0 released - - The SystemRescueCD developers have released version 1.3.0 of their Linux distribution for administering or repairing an operating system and recovering data after a system crash - http://www.h-online.com/open/SystemRescueCd-1-3-0-released--/news/114234/from/rss - 2009-09-14T17:30:13+02:00 - - - - - First Alpha of BeOS-inspired Haiku released - - After eight years of development, the Haiku Project developers have announced the availability of the first official development release of Haiku - http://www.h-online.com/open/First-Alpha-of-BeOS-inspired-Haiku-released--/news/114232/from/rss - 2009-09-14T17:09:46+02:00 - - - - - eyeOS 2.0 rethinks its webtop for 2010 - - In 2010, eyeOS, the webtop operating system, is getting a new desktop, easier collaboration, real time notifications and more - http://www.h-online.com/open/eyeOS-2-0-rethinks-its-webtop-for-2010--/news/114231/from/rss - 2009-09-14T16:44:43+02:00 - - - - - WebKit adds support for WebGL - - The WebKit developers have begun to integrate GPU-accelerated 3D capabilities via WebGL into their open source browser engine - http://www.h-online.com/open/WebKit-adds-support-for-WebGL--/news/114230/from/rss - 2009-09-14T16:13:02+02:00 - - - - - MonoTouch 1.0 released for iPhone developers - - Novell's Mono on iPhone package arrives, with prices ranging from $399 to $3,999 - http://www.h-online.com/open/MonoTouch-1-0-released-for-iPhone-developers--/news/114229/from/rss - 2009-09-14T17:00:13+02:00 - - - - - Survey: Three out of four administrators don't trust anti-virus software - - In a study, 89 per cent of respondents use a standard anti-virus product, but half of them only because it is "better than nothing". The other half felt compelled to use an anti-virus product due to company guidelines - http://www.h-online.com/security/Survey-Three-out-of-four-administrators-don-t-trust-anti-virus-software--/news/114227/from/rss - 2009-09-14T13:51:54+02:00 - - - - - Twitapps.com to close, code to be open sourced - - The Twitter notification by email service will close in the next few weeks, but the code behind it will be released as open source - http://www.h-online.com/open/Twitapps-com-to-close-code-to-be-open-sourced--/news/114228/from/rss - 2009-09-14T12:50:26+02:00 - - - - - Linux Mint 7 XFCE released - - The Mint development team have released Linux Mint 7 XFCE, a Community Edition based on Xfce 4.6 - http://www.h-online.com/open/Linux-Mint-7-XFCE-released--/news/114226/from/rss - 2009-09-14T12:34:12+02:00 - - - - - Botnet discovered on Linux servers - - The servers in question register with dynamic DNS services to distribute malware - http://www.h-online.com/security/Botnet-discovered-on-Linux-servers--/news/114225/from/rss - 2009-09-14T10:52:46+02:00 - - - - - Mozilla releases SeaMonkey 2.0 Beta 2 - - Mozilla has announced the release of version 2.0 beta 2 of their SeaMonkey "all-in-one internet application suite", completing the planned feature set - http://www.h-online.com/open/Mozilla-releases-SeaMonkey-2-0-Beta-2--/news/114224/from/rss - 2009-09-14T11:07:47+02:00 - - - - - Creature comforts for Ubuntu - - Ubuntu's community manager Jono Bacon discusses a number of features designed to make the popular Linux distribution more user-friendly and productive - http://www.h-online.com/open/Creature-comforts-for-Ubuntu--/news/114223/from/rss - 2009-09-14T09:34:09+02:00 - - - - - The H Week - - Linux Kernel 2.6.31 is released, The H looks at Linux and Digital Rights Management, Microsoft confirmed an SMB vulnerability can be exploited to remotely reboot Windows and announced the formation of the new CodePlex Foundation for open source - http://www.h-online.com/news/The-H-Week--/114222/from/rss - 2009-09-12T14:40:15+02:00 - - - - - Apple open source Grand Central - - The engine behind Snow Leopards multi-core support is released as Apache 2.0 licensed open source - http://www.h-online.com/open/Apple-open-source-Grand-Central--/news/114221/from/rss - 2009-09-13T11:01:28+02:00 - - - - - Chrome adds new defence for cross-site scripting attacks - - Google has released Chrome 4.0.207.0 for Mac and Linux into its developer channel, adding a new a reflective XSS filter to defend against cross-site scripting attacks - http://www.h-online.com/security/Chrome-adds-new-defence-for-cross-site-scripting-attacks--/news/114220/from/rss - 2009-09-11T17:09:26+02:00 - - - - - openSUSE planned outage this weekend - - A planned power outage in the projects office in Nuernberg, Germany will take several of its servers off line from the 11th to the 14th of September - http://www.h-online.com/open/openSUSE-planned-outage-this-weekend--/news/114219/from/rss - 2009-09-11T16:07:36+02:00 - - - - - Apple's iPhone 3.1 anti-phishing ineffective? - - According to several reports, the new anti-phishing feature Apple introduced in iPhone OS 3.1 for its mobile version of the Safari web browser is unreliable - http://www.h-online.com/security/Apple-s-iPhone-3-1-anti-phishing-ineffective--/news/114218/from/rss - 2009-09-11T13:25:23+02:00 - - - - - New Google Summer of Code statistics posted - - Google has posted new statistics about its 2005 to 2009 Summer of Code contests which offer university students stipends to write and develop code for various open source projects - http://www.h-online.com/open/New-Google-Summer-of-Code-statistics-posted--/news/114217/from/rss - 2009-09-11T13:11:34+02:00 - - - - - Report says IBM is switching from Microsoft Office to Lotus Symphony - - According to German daily "Handelsblatt", the Lotus office suite has to be installed on all company PCs within the next ten days. Reportedly, some 330,000 employees have already switched - http://www.h-online.com/open/Report-says-IBM-is-switching-from-Microsoft-Office-to-Lotus-Symphony--/news/114216/from/rss - 2009-09-11T12:59:14+02:00 - - - - - VirtualBox 3.0.6 released - - Sun Microsystems has released version 3.0.6, a maintenance update of its open source VirtualBox desktop virtualisation application for x86 hardware - http://www.h-online.com/open/VirtualBox-3-0-6-released--/news/114215/from/rss - 2009-09-11T13:09:42+02:00 - - - - - First update for Apple's Snow Leopard released - - Apple has released Mac OS X 10.6.1 for Snow Leopard and Security Update 2009-005 for 10.4.11 Tiger and 10.5.8 Leopard systems, fixing several bugs and security vulnerabilities - http://www.h-online.com/security/First-update-for-Apple-s-Snow-Leopard-released--/news/114213/from/rss - 2009-09-11T11:39:55+02:00 - - - - - Tornado let loose by Facebook - - Facebook shake up the Python web framework sector by open sourcing Tornado Web Server, the Python server behind the FriendFeed social network aggregator - http://www.h-online.com/open/Tornado-let-loose-by-Facebook--/news/114214/from/rss - 2009-09-14T15:24:28+02:00 - - - - - Survey: "Open Core" least popular open source option - - A survey says that the "Open Core" model for open source licensing trails behind dual licensing and open source with commercial support in terms of acceptability to the enterprise - http://www.h-online.com/open/Survey-Open-Core-least-popular-open-source-option--/news/114212/from/rss - 2009-09-11T10:50:37+02:00 - - - - - Microsoft announces open source foundation - - The new CodePlex Foundation aims to bring together commercial software vendors and the open source community - http://www.h-online.com/open/Microsoft-announces-open-source-foundation--/news/114211/from/rss - 2009-09-11T11:02:35+02:00 - - - - - Four Critical Holes in QuickTime Closed - - The update closes errors which could allow crafted video files to be used to spread infection - http://www.h-online.com/security/Four-Critical-Holes-in-QuickTime-Closed--/news/114209/from/rss - 2009-09-10T15:56:10+02:00 - - - - - Google begins launch of Chrome Extensions - - Extensions for Google Chrome and Chromium are clearly on their way as the feature is now switched on by default in the developer builds of the open source browsers - http://www.h-online.com/open/Google-begins-launch-of-Chrome-Extensions--/news/114208/from/rss - 2009-09-10T14:43:53+02:00 - - - - - iPhone OS 3.1 available - - iPhone OS 3.1 and iPhone OS 3.1.1 for all iPod touch devices are now available for download at iTunes. The new systems come with numerous improvements and functions and close several security holes, some of them critical - http://www.h-online.com/security/iPhone-OS-3-1-available--/news/114207/from/rss - 2009-09-10T12:54:42+02:00 - - - - - Numerous holes in Firefox 3.0 and 3.5 fixed - - Attackers were able to use manipulated websites to infect PCs. The new versions now also warn users if they are using outdated versions of the Flash plug-in - http://www.h-online.com/security/Numerous-holes-in-Firefox-3-0-and-3-5-fixed--/news/114206/from/rss - 2009-09-10T12:18:54+02:00 - - - - - Better query analysis in MySQL Enterprise - - The commercial Enterprise Fall Release 2009 of the open source MySQL database will feature query filtering and analysis using new correlation graphs - http://www.h-online.com/open/Better-query-analysis-in-MySQL-Enterprise--/news/114205/from/rss - 2009-09-10T11:40:38+02:00 - - - diff --git a/test/_files/AtomPublishingTest-before-update.xml b/test/_files/AtomPublishingTest-before-update.xml deleted file mode 100644 index cd6591d5..00000000 --- a/test/_files/AtomPublishingTest-before-update.xml +++ /dev/null @@ -1,7 +0,0 @@ - - 1 - - 2005-05-23T16:26:00-08:00 - Entry 1 - 1.2 - diff --git a/test/_files/AtomPublishingTest-created-entry.xml b/test/_files/AtomPublishingTest-created-entry.xml deleted file mode 100644 index e8e8e810..00000000 --- a/test/_files/AtomPublishingTest-created-entry.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - 1 - - 2005-05-23T16:26:00-08:00 - Entry 1 - 1.1 - diff --git a/test/_files/AtomPublishingTest-expected-update.xml b/test/_files/AtomPublishingTest-expected-update.xml deleted file mode 100644 index cd6591d5..00000000 --- a/test/_files/AtomPublishingTest-expected-update.xml +++ /dev/null @@ -1,7 +0,0 @@ - - 1 - - 2005-05-23T16:26:00-08:00 - Entry 1 - 1.2 - diff --git a/test/_files/AtomPublishingTest-updated-entry.xml b/test/_files/AtomPublishingTest-updated-entry.xml deleted file mode 100644 index 629dc7cb..00000000 --- a/test/_files/AtomPublishingTest-updated-entry.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - 1 - - 2005-05-23T16:27:00-08:00 - Entry 1 - 1.2 - diff --git a/test/_files/AtomTestGoogle.xml b/test/_files/AtomTestGoogle.xml deleted file mode 100644 index 669ff221..00000000 --- a/test/_files/AtomTestGoogle.xml +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - -Official Google Blog -Googler insights into product and technology news and our culture. - -tag:blogger.com,1999:blog-10861780 -2006-01-12T19:55:20Z -Blogger - -
This is an Atom formatted XML site feed. It is intended to be viewed in a Newsreader or syndicated to another site. Please visit the Blogger Help for more info.
-
-true - - - -A Googler - -2006-01-12T11:53:00-08:00 -2006-01-12T19:55:20Z -2006-01-11T03:07:43Z - -tag:blogger.com,1999:blog-10861780.post-113694886327994245 -Your Google homepage, to go - -
- -
-
Anyone who's ever tried to browse the web on their cell phone knows that it isn't always the best user experience. That's why I'm excited to tell you about Google Mobile Personalized Home. We've designed a way for you to view the things that you really care about, from your Gmail inbox to news headlines, weather, stock quotes, and feeds (Atom or RSS). The interface is optimized for small screens, and we've arranged things so you don't have to click on a bunch of links to locate what you're after -– your personalized content appears on top, right where it should be. Give it a try, and let us know how you like it.
-
-false -
- - - -A Googler - -2006-01-12T09:15:00-08:00 -2006-01-12T17:18:46Z -2006-01-03T20:50:32Z - -tag:blogger.com,1999:blog-10861780.post-113632143275337066 -Many Minis - -
- -
-
Today is the one year anniversary of the Google Mini, Google's solution for website and corporate network search, and to celebrate we thought we'd announce a few more of them. The standard Mini lets you search up to 100,000 documents. Now organizations that constantly crank out new content can opt for either of two new Minis: one searches up to 200,000 documents, and another that can manage up to 300,000. All three deliver the same easy setup, intuitive interface and fast, relevant results that the Mini is already bringing to thousands of websites and corporate networks. You're growing, and the Mini is growing with you.
-
-false -
- - - -A Googler - -2006-01-10T12:49:00-08:00 -2006-01-10T21:02:47Z -2005-12-31T01:44:54Z - -tag:blogger.com,1999:blog-10861780.post-113599349496410640 -Google Earth in a Mac world (PC too) - -
- -
-
We feel like proud parents around here. Our eldest, Google Earth for the PC, is officially leaving beta status today, and we couldn't be more pleased. For those of you who downloaded early, upgrade to the latest and discover Google Earth all over again.
-
And we have a brand new member of the family -- Google Earth for Macintosh. We're happy to finally have some good news for the, ahem, vocal Mac enthusiasts we've been hearing from. Let's just say that we have gotten more than a few "requests" for a Mac version of Google Earth. They've gone something like this:
-
1) "When is it coming out? Your website says that you are working on it."
-
2) "You know, Mac users are very heavy graphics/mapping/visualization/design/ architecture/education/real estate/geocaching/social-geo-video-networking fans who would certainly use Google Earth a lot."
-
3) "So when is it coming out?"
-
We heard you loud and clear. The Mac version runs on OS X 10.4 and up. Happy travels throughout Google Earth, whether you're on a Mac or a PC.
-
-false -
- - - -A Googler - -2006-01-09T22:16:00-08:00 -2006-01-11T20:30:26Z -2005-12-31T18:25:16Z - -tag:blogger.com,1999:blog-10861780.post-113605351620153422 -A new year for Google Video -<span class="byline-author">Posted by Sanjay Raman, Google Video Team</span><br /><br />Till now, Google Video has been about watching videos and clips online, which is really convenient for videos <a href="http://video.google.com/videoplay?docid=-3496860874967925614&q=fastfocus">like this</a>. But wouldn't it be awesome to watch that episode of <span style="font-style: italic;"><a href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCSI">CSI</a></span> that you missed when even your trusty DVR failed you? This is one reason we've launched the Google Video store, where you can rent or buy from such well-known media partners as <a href="http://video.google.com/cbs.html">CBS</a>, the <a href="http://video.google.com/nba.html">NBA</a>, The <a href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCharlie_Rose">Charlie Rose Show</a>, and <a href="http://video.google.com/videosearch?q=Sony+BMG">SONY BMG</a>.<br /><br />We’re not only about mainstream content, though -– we have thousands of titles available (and more coming every day) from every imaginable type of producer, including <a href="http://video.google.com/videosearch?q=1896+tsar+nicholas&so=0">this 1896 clip</a> of the coronation of Tsar Nicholas II – one of the earliest known moving images. We’re especially pleased to offer such quality indie features as Ben Rekhi’s <span style="font-style: italic;"><a href="http://video.google.com/videoplay?docid=-1607114503824678810&q=waterborne ">Waterborne</a></span> (Drops Entertainment) and Lerone Wilson’s <span style="font-style: italic;"><a href="http://video.google.com/videoplay?docid=-4929215594503422280&q=aardvark%27d ">Aardvark’d: 12 Weeks with Geeks</a></span> (Boondoggle Films).<br /><br />When we launched our <a href="https://upload.video.google.com">Upload Program</a> earlier this year, people sent in a huge number of free and compelling videos. But since there's a ton of video that can't be offered for free, we built the <a href="http://video.google.com/">Google Video store</a> to give content owners the option to charge for downloads if they'd like. This means producers large and small can distribute their great content in an easy, secure way. Some of your favorite prime time and classic TV shows, sports, music videos, and documentaries are at your fingertips. Want to see how Shaq scored 30 points last night? Download and watch it (and every <a href="http://video.google.com/nba.html">NBA</a> game for the rest of the season) through Google Video.<br /><br />You can play all the videos you download using the all-new Google Video Player. We're especially pleased about the thumbnail navigation for browsing an entire video so you can play any portion with a single click. And there's another thing: if the content is not copy-protected, you can take your favorite videos with you on your <a href="http://www.apple.com/ipod/">iPod</a> or <a href="http://www.us.playstation.com/psp.aspx">PSP</a> -- our "to go" option.<br /><br />Since it's so early in the year, here's a resolution we intend to keep: make sure new features and content continue to roll out, so that you think Google Video is one of the best ways to find video on the web.<br /><br />These video providers are getting us off to a great start:<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Daquarius">Aquarius Health Care Media</a></span>: A leading producer and distributor of healthcare-related videos will pilot with Google Video using a variety of titles covering SIDS, diabetes, and blindness, among other health issues.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=ardustry">Ardustry Home Entertainment</a></span>: Offers substantial libraries of theatrical motion pictures, television series, documentaries and reality programming, music and sports specials, lifestyle titles, and a wide array of “how-to†products.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=bluehighways">BlueHighways TV</a></span>: Programming service that explores the people, stories, traditions and cultures of America. Discovering the sights and sounds of communities across the country with an up-close, laid-back programming style, BlueHighways TV presents a collage of remarkable music, folklore and information for audiences interested in all aspects of American life and heritage. Programming includes <span style="font-style: italic;">Reno's Old Time Music Festival,</span> <span style="font-style: italic;">American Journeys,</span> <span style="font-style: italic;">Stan Hitchcock's Heart to Heart,</span> and <span style="font-style: italic;">Gospel Sampler</span>.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dcaretalk">CareTALK</a></span>: A multimedia brand dedicated to consumer-directed health care offering programming and tools to help modern family caregivers; initially offering 10-20 hours of health and caregiving-related content (10-20 minutes in length).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/cbs.html">CBS</a>: Includes prime time hits such as <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCSI">CSI</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3Dncis">NCIS</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DSurvivor_Guatemala">Survivor: Guatemala</a>, and The Amazing Race (available spring ’06), as well as classics like <a style="font-style: italic;" href="http://video.google.com/videosearch?q=I+Love+Lucy">I Love Lucy</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DTwilight_Zone">Twilight Zone</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DBrady_Bunch">Brady Bunch</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=Have+Gun+Will+Travel">Have Gun Will Travel</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DMacGyver">MacGyver</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DStar_Trek_Deep_Space_Nine">Star Trek: Deep Space Nine</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DStar_Trek_Voyager">Star Trek: Voyager</a>, and My Three Sons (coming soon).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCharlie_Rose">The Charlie Rose Show</a>: Includes interviews with Henry Kissinger, Oliver Stone, Quentin Tarantino, Martha Stewart, Martin Scorsese, Harrison Ford, Dan Rather, Charles M. Schulz, Steve Jobs, Jay Leno, Tom Brokaw, and others.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Cine+Excel&so=0">Cine Excel</a>: Independent producer will trial on Google Video with 3 DVD movie titles: <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=6833548605067650376&q=Cine+Excel">Bikini Hotel </a>(1997), <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=-9198267889833807992&q=Cine+Excel">Tao of Karate</a> (short-film, 1998) and <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=8241854949946868864&q=Cine+Excel">Karate Wars</a> (1998).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=classic+media">Classic Media</a>: Classic Media owns and manages some of the world's most recognizable family properties across all media including feature film, television, home video and consumer products. The company's extensive library features a diverse collection of popular animated and live-action characters. For lentaries are at your fingertips. Want to see how Shaq scored 30 points last night? Download and watch it (and every <a href="http://video.google.com/nba.html">NBA</a> game for the rest of the season) through Google Video.<br /><br />You can play all the videos you download using the all-new Google Video Player. We're especially pleased about the thumbnail navigation for browsing an entire video so you can play any portion with a single click. And there's another thing: if the content is not copy-protected, you can take your favorite videos with you on your <a href="http://www.apple.com/ipod/">iPod</a> or <a href="http://www.us.playstation.com/psp.aspx">PSP</a> -- our "to go" option.<br /><br />Since it's so early in the year, here's a resolution we intend to keep: make sure new features and content continue to roll out, so that you think Google Video is one of the best ways to find video on the web.<br /><br />These video providers are getting us off to a great start:<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Daquarius">Aquarius Health Care Media</a></span>: A leading producer and distributor of healthcare-related videos will pilot with Google Video using a variety of titles covering SIDS, diabetes, and blindness, among other health issues.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=ardustry">Ardustry Home Entertainment</a></span>: Offers substantial libraries of theatrical motion pictures, television series, documentaries and reality programming, music and sports specials, lifestyle titles, and a wide array of “how-to†products.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=bluehighways">BlueHighways TV</a></span>: Programming service that explores the people, stories, traditions and cultures of America. Discovering the sights and sounds of communities across the country with an up-close, laid-back programming style, BlueHighways TV presents a collage of remarkable music, folklore and information for audiences interested in all aspects of American life and heritage. Programming includes <span style="font-style: italic;">Reno's Old Time Music Festival,</span> <span style="font-style: italic;">American Journeys,</span> <span style="font-style: italic;">Stan Hitchcock's Heart to Heart,</span> and <span style="font-style: italic;">Gospel Sampler</span>.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dcaretalk">CareTALK</a></span>: A multimedia brand dedicated to consumer-directed health care offering programming and tools to help modern family caregivers; initially offering 10-20 hours of health and caregiving-related content (10-20 minutes in length).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/cbs.html">CBS</a>: Includes prime time hits such as <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCSI">CSI</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3Dncis">NCIS</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DSurvivor_Guatemala">Survivor: Guatemala</a>, and The Amazing Race (available spring ’06), as well as classics like <a style="font-style: italic;" href="http://video.google.com/videosearch?q=I+Love+Lucy">I Love Lucy</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DTwilight_Zone">Twilight Zone</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DBrady_Bunch">Brady Bunch</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=Have+Gun+Will+Travel">Have Gun Will Travel</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DMacGyver">MacGyver</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DStar_Trek_Deep_Space_Nine">Star Trek: Deep Space Nine</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DStar_Trek_Voyager">Star Trek: Voyager</a>, and My Three Sons (coming soon).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCharlie_Rose">The Charlie Rose Show</a>: Includes interviews with Henry Kissinger, Oliver Stone, Quentin Tarantino, Martha Stewart, Martin Scorsese, Harrison Ford, Dan Rather, Charles M. Schulz, Steve Jobs, Jay Leno, Tom Brokaw, and others.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Cine+Excel&so=0">Cine Excel</a>: Independent producer will trial on Google Video with 3 DVD movie titles: <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=6833548605067650376&q=Cine+Excel">Bikini Hotel </a>(1997), <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=-9198267889833807992&q=Cine+Excel">Tao of Karate</a> (short-film, 1998) and <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=8241854949946868864&q=Cine+Excel">Karate Wars</a> (1998).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=classic+media">Classic Media</a>: Classic Media owns and manages some of the world's most recognizable family properties across all media including feature film, television, home video and consumer products. The company's extensive library features a diverse collection of popular animated and live-action characters. For launch we will have <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=2700527067868455741&q=classic+media">Rocky &amp; Bullwinkle</a>, <span style="font-style: italic;">Casper</span>, <span style="font-style: italic;">Wendy</span>, <span style="font-style: italic;">Richie Rich</span>, <span style="font-style: italic;">Herman & Katnip</span>, <span style="font-style: italic;">Baby Huey</span>, <span style="font-style: italic;">Little Audrey</span>, <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=-3466783103686653836&q=Mighty+Hercules">Mighty Hercules</a>, <span style="font-style: italic;">Little Lulu</span>, and <span style="font-style: italic;">Felix the Cat</span>.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=clearvue">CLEARVUE & SVE</a>: A leading provider of educational K-12 educational video content. They sell DVDs and run a subscription media-on-demand website with video, audio, and images. CLEARVUE &amp; SVE primarily serves large clients such as schools, school districts or entire states. Leveraging Google Video, they have embarked on a new and bold strategy to target individual customers directly. Among the hundreds of videos you will find on Google, topics vary from classic children's literature to detailed explanations about the workings of the human body.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dechelon">Echelon Home Entertainment 2</a></span>: Focuses on independently produced films made by filmmakers from around the world which offer a unique perspective to the traditional genres: drama, action, thriller, comedy, family, animation, classic, B&W, foreign.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dimage_entertainment">Egami Media</a></span>: A subsidiary of Image Entertainment and a leading independent licensee, producer and distributor of home entertainment programming with over 3,000 titles released in North America. Highlighted content in Google Video includes live concert programs include <span style="font-style: italic;">Kiss: Rock the Nation: Live!</span>, <span style="font-style: italic;">Chick Corea: Rendezvous in New York</span>, <span style="font-style: italic;">Roy Orbison: Black & White Night</span>, and dozens more. Other titles include IMAX programs from MacGillivray Freeman, stand-up comedy and independent, foreign and silent film classics.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dfashion_tv">Fashion TV</a>: The only 24 hours a day, 7 days a week fashion, beauty and style TV station worldwide provides glamorous entertainment with emphasis on the latest trends. Google Video content includes fashion show clips and behind the scenes footage from many fashion shows.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dgetty_images">Getty Images' Archive Films Collection</a>: A diverse collection of short clips that capture personalities, moments and eras throughout history -- selected from vintage newsreels and educational film, as well as contemporary news and events from around the world.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dgreencine">GreenCine.com</a>: Feature length independent films, documentaries and classic titles, including works by legendary Polish director Andrzej Wajda (<span style="font-style: italic;">Zemsta</span>) and award-winning actor-director Caveh Zahedi (<span style="font-style: italic;">In the Bathtub of the World</span>).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=HDNet&so=0">HDNet</a>: Co-founded by Mark Cuban, HDNet has agreed to make select original programming from its library available for the launch of Google's first commercial video offering. The programs to be made available come from HDNet's ever growing library of original content including the <span style="font-style: italic;">HDNet World Report</span>, a groundbreaking series featuring news in HD from around the globe; <span style="font-style: italic;">True Music</span>, a popular weekly music series highlighting up-and-coming bands; <span style="font-style: italic;">Higher Definition</span>, a celebrity interview series hosted by Robert Wilonsky; <span style="font-style: italic;">Young, Beautiful and Trying to Make it in Hollywood</span>, following actresses through the hectic process of getting hired in Hollywood; and <span style="font-style: italic;">Deadline</span>, delivering current events and news from around the world from an irreverent point of view.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=heretv">here!</a>: Gay and lesbian U.S. television network featuring original movies and series and film library (independent and foreign films, documentaries and shorts).<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=hollywood+licensing">Hollywood Licensing's HilariousDownloads.com</a></span>: Hollywood Licensing is the entertainment licensing agency which represents the best and most extensive library of hilarious videos in the world. Tapping into a library boasting tens of thousands of clips, they have custom produced 20 packages of funny themes a celebrity interview series hosted by Robert Wilonsky; <span style="font-style: italic;">Young, Beautiful and Trying to Make it in Hollywood</span>, following actresses through the hectic process of getting hired in Hollywood; and <span style="font-style: italic;">Deadline</span>, delivering current events and news from around the world from an irreverent point of view.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=heretv">here!</a>: Gay and lesbian U.S. television network featuring original movies and series and film library (independent and foreign films, documentaries and shorts).<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=hollywood+licensing">Hollywood Licensing's HilariousDownloads.com</a></span>: Hollywood Licensing is the entertainment licensing agency which represents the best and most extensive library of hilarious videos in the world. Tapping into a library boasting tens of thousands of clips, they have custom produced 20 packages of funny themes for Google Video. For example, if you think that your recent home improvements was nothing but a miserable experience, wait until you see a bucket of wet plaster land on a man's face, a house collapsing or a door falling of its hinges for no particular reason.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Ditn">ITN</a>: One of the world's leading news producers, providing news programming for the main commercial broadcasters in the U.K. and its combined news broadcasts reach over two-thirds of the U.K. population. The company has a strong reputation for the creative and innovative use of modern technology, winning the Royal Television Society's 2004 Innovation Award.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Diwatchnow">iWatchNow.com</a>: Titles include Night of the Living Dead (George Romero), The Chronicles of Narnia: The Lion, Witch, and the Wardrobe (original animated film BBC from1979), The Man Who Knew Too Much (Hitchcock), the hard-to-find Comedy's Dirtiest Dozen (with Chris Rock and Tim Allen), and The Little Shop of Horrors (1960).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=kantola&so=0">Kantola Productions</a>: Captures unique speaking events given by well-known experts at Stanford University. Topics focus on innovative and practical business advice, such as How Leaders Boost Productivity by John H. (Jack) Zenger and <span style="font-style: italic;">Mastery of Speaking as a Leader</span> by Terry Pearce.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dlime">LIME</a></span>: “Healthy Living with a Twist†offers entertaining and revealing programming focused on a greener, healthier, more balanced lifestyle. Programming features inspiration from leading experts, authors, and pop culture icons and covers topics including the environment and sustainability, personal growth, alternative health, healthy foods, and business ethics.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=mediazone.com&so=0">MediaZone.com</a>: Programming covers sporting events, TV episodes, movies, how-to programs. Content includes <span style="font-style: italic;">The Rugby Channel presents ‘The Best Tries of 2004’</span> and <span style="font-style: italic;">The All Blacks of New Zealand Vs. Springboks of South Africa</span>.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dtwi+nobel">Nobel Video Library</a>: A library focused on the achievements of individual Nobel Laureate. The series was developed to introduce students to the work of the laureates as well as to support classroom discussion regarding important issues addressed by Nobel Prize winners in recent decades.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=open+championship&so=0">Open Championship</a>: Official programs from the classic golf tournament, the British Open, such as<span style="font-style: italic;"> </span><span style="font-style: italic;">Reflections: Past Open Champions</span>.<br /><br />•<a style="font-weight: bold;" href="http://video.google.com/videosearch?q=plum+tv"> Plum TV</a>: Provides highly localized programming to the nation’s most influential consumers, and strives to be an incubator of groundbreaking new television programming. Each Plum TV station shares branding which links each station as a network, but still provides original programming customized to reflect each community. Plum TV’s programming includes regionally-focused feature pieces, tourist information (weather, traffic reports, restaurant reviews, retail and lodging information), a real estate show, local news and specially targeted entertainment for each community’s interests.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=porchlight+entertainment">PorchLight Entertainment</a>: Porchlight produces family-oriented motion pictures and TV specials. Google Video will offer 36 titles including <span style="font-style: italic;">Enough Already</span> and <span style="font-style: italic;">Role of a Lifetime</span>.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=SOFA+Entertainment&so=0">SOFA Entertainment</a>: Represents pop culture at its best. Featuring several titles from the classic <span style="font-style: italic;">The Ed Sullivan Show</span> along with documentaries, feature films and music programming. SOFA Entertainment truly offers something for everyone. Some highlights include <span style="font-style: italic;">The Very Best of The Ed Sullivan Show - Vol. 1 & Vol. 2.</span><br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Sony+BMG">SONY BMG MUSIC ENTERTAINMENT</a>: The lineup of launch videos includes offerings from some of SONY BMG's largest global superstar artists, including Christina Aguilera, Beyonce, Kenny Chesney, Destiny's Child, Kelly Clarkson, Alicia Keys, Lil' Flip, Jessica Simpson, Shakira, System of a Down, Switchfoot, Usher, and many more.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Tai+Seng&so=0">Tai Seng Entertainment</a>: The definitive Asian cinema powerhouse. Known as the best source for Hong Kong films, Tai Seng also releases cinematic masterpieces from all over the Asia region in a variety of languages. Tai Seng brings to your home the best in class from high-octane action to bone-crushing martial arts, from chilling horror to lush swordplay epics. We are proud to showcase with Google some of Asia's biggest hits like Johnnie To's <span style="font-style: italic;">Running On Karma</span>, Korea's sensuously emotional drama <span style="font-style: italic;">Addicted</span>, martial arts Master Yuen Wo Ping's highly acclaimed <span style="font-style: italic;">Tai Chi Master</span>, and Michelle Yeoh's violently elegant <span style="font-style: italic;">Butterfly Sword</span>.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Teen+Kids+news">Teen Kids News</a>: A dynamic television news program for teens and pre-teens, by teens. The half-hour weekly program provides 10 eyewitness news segments to students in a way that's educational as well as entertaining. Thirty shows with kids reporting on camera are available on Google Video.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Trinity+Broadcasting+&so=0">Trinity Broadcasting Network</a>: The world's largest religious network and America's most watched faith channel, TBN offers 24 hours of commercial-free inspirational programming that appeal to people in a wide variety of Protestant, Catholic and Messianic Jewish denominations. <span style="font-style: italic;">The Praise the Lord Program</span> is the only live two-hour Christian program in the world. The program brings the highest caliber of guests from well-known celebrities to laypersons for interview, as well as, singers, musicians, evangelists and the coverage of revivals and crusades from around the world. This award-winning program has been on each week night for over 30 years.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videoplay?docid=8592392906577495616&q=in_label%3Aowner%3Dunion">Union</a>: Offers the best of breed from the world of action sports, including snow, skate, bmx, moto, and surfing. Union is owned by Quiksilver Entertainment, Inc. and Global Media Ventures, LLC.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=wilderness+films+india">WFIL</a>: Wilderness Films India Ltd. is a leading producer and library of stock footage captured in India and across Asia. WFIL will offer 100 hours of high quality video, both free and for sale, on Google Video. Topics vary from helicopter skiing in the Himalaya, broadcast coverage of an Everest climb, and rare wildlife such as the takin and the clouded leopard to imagery spanning India's art, culture, technology, peoples, cities, and rural areas.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=wgbh+boston">WGBH</a>: WGBH Boston is America's preeminent public broadcasting producer, the source of fully one-third of PBS's prime-time lineup, along with some of public television's best-known lifestyle shows and children's programs and many public radio favorites. Programming available includes <span style="font-style: italic;">Nova</span>, <span style="font-style: italic;">La Plaza</span> (the longest running Latino program in the country), <span style="font-style: italic;">Thinking Big</span>, and <span style="font-style: italic;">Basic Black</span>. WGBH is the number one producer of Web sites on pbs.org, one of the most trafficked dot-org Web sites in the world. WGBH is a pioneer in educational multimedia and in technologies and services that make media accessible to the 36 million Americans who rely on captioning or video descriptions. WGBH has been recognized with hundreds of honors: Emmys, Peabodys, duPont-Columbia Awards.even two Oscars. In 2002, WGBH was honored with a special institutional Peabody Award for 50 years of excellence.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=WheelsTV&so=0">WheelsTV</a>: Serves both the general audience and the enthusiast with a wide spectrum of vehicle-based entertainment, news and information. WheelsTV Network, WheelsTV On Demand and WheelsTV.net have been developed by the producers of multi-awarding winning automotive programming for Discovery, PBS, Speedvision, Fox and Outdoor Life Networks including <span style="font-style: italic;">Wild About Wheels</span>, <span style="font-style: italic;">Wheels</span>, and <span style="font-style: italic;">Motor Trend Television</span>. WheelsTV Network’s valuable consumer programs include <span style="font-style: italic;">Top 200™ New Vehicle Test Drives</span>. With <span style="font-style: italic;">Top 200</span> on Google, consumers will be able to download virtual test drives of the best selling and most exciting cars on the road today, saving time and money.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dtwi">Wimbledon</a>: Official programs from the Wimbledon Tennis Championships such as <span style="font-style: italic;">Legends of Wimbledon: Bjorn Borg</span>. -false - - - - -A Googler - -2006-01-09T06:27:00-08:00 -2006-01-09T14:30:23Z -2005-12-18T23:47:55Z - -tag:blogger.com,1999:blog-10861780.post-113494967528450491 -The 2006 Anita Borg Scholarships - -
- -
-
The wonderfully-named Dr. Anita Borg (1949 - 2003) was a rebel with a cause: ensuring that technology itself has positive outcomes, and dismantling barriers that keep women and minorities from entering computing and technology fields. Today the Anita Borg Institute for Women and Technology carries on her vision. And because Google shares that passion, we are pleased to sponsor the 2006 Anita Borg Scholarship program. We are inspired by the past scholarship recipients -- and in hopes of finding more, the program is expanded this year to accept applications from students entering their senior year of undergraduate study as well as those enrolled in a graduate program. Last year we awarded 23 scholarships; this year we'd like to do more.
-
Tell your friends, or apply yourself - the deadline is January 20.
-
-false -
- - - -A Googler - -2006-01-06T16:51:00-08:00 -2006-01-07T00:54:51Z -2005-12-31T18:24:44Z - -tag:blogger.com,1999:blog-10861780.post-113605348414874975 -Make your computer just work -<span class="byline-author">Posted by Jesse Savage, Google Pack team</span><br /> <br />So you bought a new PC for yourself or a relative during the holidays. There was the initial excitement about its speed and the nice screen – and then it came time to actually get it running. Which meant embarking on some real work -– downloading a browser, a couple of multimedia players, a PDF reader, a toolbar, and maybe something for voice and instant messaging. Don’t forget the anti-spyware and anti-virus apps – you’ve got to have those. Hours, maybe even days, go by. How many wizards have you clicked through, not to mention license agreements and preference pickers? And then you have to ask: did I get everything? And how am I going to keep all of this up to date?<br /> <br />This was the experience both Sergey and Larry had a year ago. And they’re computer guys, after all. Which led them to ask more of us to make it easier for everyone. So we created the <a href="http://pack.google.com">Google Pack</a> -- a one-stop software package that helps you discover, install, and maintain a wide range of essential PC programs. It’s yours today – and it’s something we hope you find to be painless, easy, and even fun (if computer setup can ever be called that). And it’s free. <br /> <br />We worked with a number of technology companies to identify products that are the best of their type to create <a href="http://www.google.com/support/pack">this suite</a>. (We didn’t pay them, and they aren’t paying us.) For PC users running Windows XP, it downloads in minutes and installs in just a few clicks. There’s only one license agreement – and no wizards. And there’s a new tool called the <a href="http://www.google.com/support/pack/bin/answer.py?answer=30252&topic=8326/">Google Updater</a> that keeps all the software in the Google Pack current. Even if you already have some of the software in the Pack, you can use the Google Updater to update and manage it.<br /> <br />There’s one more thing in the Pack that we think you’ll like. The Pack team asked people what kind of screensavers they like best. They kept saying, “I want my own photos as a screensaver, why can’t I do that?†Good question -- lots of people have trouble with this. So we made the <a href="http://www.google.com/support/pack/bin/answer.py?answer=28076&topic=8315">Google Pack Screensaver</a>, which is the easiest possible way to make your photos into an animated photo collage. And now the question for you is: what will you do with all that time you've saved? -false - - - - -A Googler - -2005-12-30T17:18:00-08:00 -2006-01-05T21:52:34Z -2005-12-31T01:31:39Z - -tag:blogger.com,1999:blog-10861780.post-113599269991367646 -A year of Google blogging - -
- -
-
This is the 201st post to be published on the Google Blog in 2005. In closing out the first full year of our company-wide effort to share news and views, we thought you might be interested in a few factoids. Since we've had Google Analytics running on this blog since June, some of these numbers reflect only half a year. In that time, 4.3 million unique visitors have generated 8.7 million pageviews. Readers have come from all over the world, not just English-speaking countries: 53,001 visitors from Turkey have stopped by, for example; so have 155,691 from France, 29,614 from Thailand and 8,233 from Peru.
-
The most popular posts? Here are a few that have yielded scores of backlinks:

- Our explanation of "Googlebombing"
- A celebration of email and Gmail
- Google Earth's partnership with National Geographic about Africa
-
Several on Google Book Search (formerly known as Google Print), including:
- Preserving public domain books
- Our statement on the Authors' Guild suit
- and Eric Schmidt's op-ed about Book Search.

During the year, we've published 38 how-to tips, announced 77 new products and services, and addressed policy questions and legal matters 17 times. We've featured 11 guest bloggers. Forty posts have illuminated something about day to day life at Google; 19 have offered some international perspective.

In 2006, we'll keep up the Google Blog with more posts, more bloggers, and even more topics. Meanwhile, we really appreciate your interest and feedback, now visible through "Links to this post." We know some of you would like to offer comments directly, and we would like that too, when we can add resources to the blog crew. Meanwhile, our best to you and yours for the New Year.
-
-false -
-
diff --git a/test/_files/AtomTestMozillazine.xml b/test/_files/AtomTestMozillazine.xml deleted file mode 100644 index 2fa18ece..00000000 --- a/test/_files/AtomTestMozillazine.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - mozillaZine.org - - 2006-01-23T04:04:45-08:00 - Your Source for Daily Mozilla News and Advocacy - tag:mozillazine.org,2004:1 - Copyright (c) 2004, The Mozillazine Organization - - Minutes of the mozilla.org Staff Meeting of Monday 9th January 2006 - - 2006-01-22T20:04:42-08:00 - 2006-01-22T20:04:42-08:00 - 2006-01-22T20:04:42-08:00 - tag:mozillazine.org,2004:article7935 - - mozillaZine.org - - - The minutes of the mozilla.org staff meeting held on Monday 9th January 2006 are now online. Issues discussed include Firefox 1.5.0.1 release schedule, Thunderbird 1.5 release and Marketing.

]]> - Talkback

]]> -
-
- - - Minutes of the mozilla.org Staff Meeting of Wednesday 4th January 2006 - - 2006-01-12T09:29:47-08:00 - 2006-01-12T09:29:47-08:00 - 2006-01-12T09:29:47-08:00 - tag:mozillazine.org,2004:article7895 - - mozillaZine.org - - - The minutes of the mozilla.org staff meeting held on Wednesday 4th January 2006 are now available. Issues discussed include Upcoming Releases, Marketing, Thunderbird, 1.9 Roadmap, Firefox 2 Process and Calendar.

-

The minutes have been posted to the new mozilla.dev.general newsgroup, which is accessible via news.mozilla.org. The previously announced newsgroup migration is in progress. Once mozilla.dev.planning is created, minutes will be posted there.

]]> - Talkback

]]> -
-
- - - Thunderbird 1.5 Released - - 2006-01-11T18:19:13-08:00 - 2006-01-11T18:19:13-08:00 - 2006-01-11T18:19:13-08:00 - tag:mozillazine.org,2004:article7892 - - mozillaZine.org - - - Scott MacGregor writes: "The final release of Mozilla Thunderbird 1.5 is now available for download from getthunderbird.com. Users of RC1 should see the update soon. If you are using RC2, then you already have 1.5 final."

-

"Thunderbird 1.5 introduces several new features including a software update system, spell check as you type, built in phishing detector, auto save as draft, and support for deleting attachments from email messages. Message filtering has also been improved with new filter actions for replying and forwarding. Saved search folders can now search folders across multiple accounts."

-

"More details can be found in the Mozilla Thunderbird 1.5 Release Notes, and the support forum staff is available for questions. "

-

"I wanted to thank everyone in the mozillaZine community who helped test the alphas, the betas, and the release candidates that went into this release. Thank you for trusting Thunderbird with your email throughout the development and release cycle for 1.5. I'm looking forward to working with all of you on 2.0 and beyond!"

]]> - Talkback

]]> -
-
- - - Firefox Smoketest Day Planned for January 6, 2006 - - 2006-01-04T14:14:20-08:00 - 2006-01-04T14:14:20-08:00 - 2006-01-04T14:14:20-08:00 - tag:mozillazine.org,2004:article7859 - - mozillaZine.org - - - The Mozilla QA team has announced a community test day with focus on smoketesting nightly Firefox 1.5.0.1 builds.

-

Litmus tool will be used for this testing event. There is a FAQ posted on the QA community wiki that will have specific instructions on how this testing day will run.

]]> - Talkback

]]> -
-
- - - Camino 1.0 Beta 2 Released - - 2006-01-02T15:23:18-08:00 - 2006-01-02T15:23:18-08:00 - 2006-01-02T15:23:18-08:00 - tag:mozillazine.org,2004:article7850 - - mozillaZine.org - - - Camino 1.0 beta 2 has been released. This latest version of the native Mac OS X browser is replacing 0.8.4 as the stable Camino release on all systems 10.2+. See the Camino 1.0 Beta 2 Release Notes for more details.

]]> - Talkback

]]> -
-
- - - Mozilla Newsgroups Migration Scheduled - - 2006-01-02T15:07:27-08:00 - 2006-01-02T15:07:27-08:00 - 2006-01-02T15:07:27-08:00 - tag:mozillazine.org,2004:article7849 - - mozillaZine.org - - - Frank Wein has announced that the migration and reorganization of Mozilla newsgroups will take place in January 2006. As announced earlier, the new newsgroups will be hosted by Giganews. Access to the news server news.mozilla.org will remain free. The new groups will only be propogated to news.mozilla.org, Giganews Servers and Google Groups in an effort to combat news spam. For more information, refer to the FAQ and the list of new newsgroups. -

]]> - Talkback

]]> -
-
- - - Mozilla Thunderbird 1.5 Release Candidate 2 Available - - 2005-12-21T13:58:07-08:00 - 2005-12-21T13:58:07-08:00 - 2005-12-21T13:58:07-08:00 - tag:mozillazine.org,2004:article7823 - - mozillaZine.org - - - Scott MacGregor writes: "The second release candidate of Mozilla Thunderbird 1.5 is now available for download. Mozilla Thunderbird 1.5 RC2 is intended to allow testers to ensure that there are no last-minute problems with the Thunderbird 1.5 code. "

-

"RC2 contains several key bug fixes that were identified during the RC1 testing cycle. There are no new features or enchancements from RC1. Users of Thunderbird 1.5 RC1 will be offered RC 2 through the software update system."

-

"Thunderbird 1.5 RC2 can be downloaded from the Thunderbird 1.5 RC2 Release Notes page, or the Thunderbird 1.5rc2 directory on ftp.mozilla.org. More details can be found in the Release Notes."

-

"I'd like to single out all of the folks who participated in our QA testing day and our localization testing day. We wouldn't have been able to release RC2 before the holidays without all the volunteers who pitched in. Thank you!"

]]> - Talkback

]]> -
-
- - - Interview with Mike Beltzner - - 2005-12-20T23:00:29-08:00 - 2005-12-20T23:00:29-08:00 - 2005-12-20T23:00:29-08:00 - tag:mozillazine.org,2004:article7820 - - mozillaZine.org - - - David Tenser has posted an interview with Mozilla Foundation's User Experience Lead, Mike Beltzner. The interview was conducted over instant messaging sessions during the last week of November. Mike talks about usability studies, design of the Mozilla Developer Central, and the new bookmark system planned for Firefox 2.

]]> - Talkback

]]> -
-
- - - Gecko 1.9 Trunk and 1.8 Branch Management Plan Posted - - 2005-12-20T18:08:36-08:00 - 2005-12-20T18:08:36-08:00 - 2005-12-20T18:08:36-08:00 - tag:mozillazine.org,2004:article7819 - - mozillaZine.org - - - Brendan Eich has posted a draft plan for Gecko 1.9 Trunk and 1.8 Branch Management, including a FAQ at the mozilla wiki. Comments should be directed as followups to the newsgroup post. -

]]> - Talkback

]]> -
-
- - - Minutes of the mozilla.org Staff Meeting of Monday 12th December 2005 - - 2005-12-20T18:04:08-08:00 - 2005-12-20T18:04:08-08:00 - 2005-12-20T18:04:08-08:00 - tag:mozillazine.org,2004:article7818 - - mozillaZine.org - - - The minutes of the mozilla.org staff meeting held on Monday 12th December 2005 are now online. Issues discussed include Firefox Summit, Engineering, Upgrading, Awards and Newsgroups reorganisation

]]> - Talkback

]]> -
-
- - - Minutes of the mozilla.org Staff Meeting of Monday 5th December 2005 - - 2005-12-20T18:02:08-08:00 - 2005-12-20T18:02:08-08:00 - 2005-12-20T18:02:08-08:00 - tag:mozillazine.org,2004:article7817 - - mozillaZine.org - - - The minutes of the mozilla.org staff meeting held on Monday 5th December 2005 are now online. Issues discussed include Firefox Summit and Engineering.

]]> - Talkback

]]> -
-
- - - SeaMonkey 1.0 Beta Released - - 2005-12-20T17:41:12-08:00 - 2005-12-20T17:41:12-08:00 - 2005-12-20T17:41:12-08:00 - tag:mozillazine.org,2004:article7815 - - mozillaZine.org - - - Robert Kaiser writes: "Today, the SeaMonkey Council announces a new developer release, SeaMonkey 1.0 Beta. Compared to the Alpha version released in September, SeaMonkey 1.0 Beta enhances the product with new features like tab drag and drop, but also is the first release branded with the new SeaMonkey logo, which was unveiled earlier this month."

-

"The SeaMonkey 1.0 Beta Release Notes have more information about this test version. All the builds are available from the SeaMonkey 1.0b directory on ftp.mozilla.org."

]]> - Talkback

]]> -
-
- -
diff --git a/test/_files/AtomTestOReilly.xml b/test/_files/AtomTestOReilly.xml deleted file mode 100644 index bc9645ee..00000000 --- a/test/_files/AtomTestOReilly.xml +++ /dev/null @@ -1,214 +0,0 @@ - - - - -weblogs.oreilly.com - -The O'Reilly Network Weblogs -Copyright 2005, O'Reilly Media, Inc. -http://weblogs.oreilly.com/ -2006-01-23T09:16:40-08:00 - -O'Reilly Media, Inc. - -no - - - Delightful Javascript Libs -- LGPL, Too. - http://www.oreillynet.com/pub/wlg/9085 - - -
- Here are some fundamental, well made JS goodies: Vectorgraphics Library, Drag'nDrop & DHTML Library, Tooltips with JavaScript Lib, and Rotate Image Lib. A pleasure to work with, and LGPL'ed. Also check out the JS Online Function Grapher. -
-
- Sid Steward - 2006-01-23T09:16:40-08:00 -
- - - Web 2.0: Simple division? - http://www.oreillynet.com/pub/wlg/9084 - - -
- There's been a lot of talk about the revolutionary change Web 2.0 promises, and it's time to look at the architecture that's leading to that change: a greater split between client and server logic. -
-
- Simon St. Laurent - 2006-01-23T08:15:34-08:00 -
- - - Don't Give us your Tired Your Poor - http://www.oreillynet.com/pub/wlg/9083 - - -
- Give us your vibrant, exciting, cool, open source Java submissions for this year's OSCON. -
-
- Daniel H. Steinberg - 2006-01-23T07:45:36-08:00 -
- - - Cutting Through the Patent Thicket - http://www.oreillynet.com/pub/wlg/9082 - - -
- Good succinct summary of the anti-patent argument, including how VC's look at patents and get duped by them. -
-
- Damien Stolarz - 2006-01-23T00:45:30-08:00 -
- - - The addslashes() Versus mysql_real_escape_string() Debate - http://www.oreillynet.com/pub/wlg/9081 - - -
- Last month, I discussed Google's XSS Vulnerability and provided an example that demonstrates it. I was hoping to highlight why character encoding consistency is important, but apparently the addslashes() versus mysql_real_escape_string() debate continues. -
-
- Chris Shiflett - 2006-01-22T22:45:11-08:00 -
- - - RPM Rollback in Fedora Core 4/5 - http://www.oreillynet.com/pub/wlg/9080 - - -
- Fedora's yum/rpm system includes a little-known capability: it can rollback a system to a previously-installed state. -
-
- Chris Tyler - 2006-01-22T13:15:12-08:00 -
- - - Shifting Gears: Switching to Django - http://www.oreillynet.com/pub/wlg/9075 - - -
- I've been using TurboGears since its public debut around September of last year. I believe it has incredible potential, but I'm finding myself needing something a little different. That something is Django. -
-
- Jeremy Jones - 2006-01-22T12:15:19-08:00 -
- - - Are We In A Productivity Crisis? - http://www.oreillynet.com/pub/wlg/9079 - - -
- Are we in a new kind of productivity crisis, one in which there is not too little productivity, but too much? -
-
- Spencer Critchley - 2006-01-22T09:45:58-08:00 -
- - - What Happens When You Edit an Image Stored Outside of iPhoto 6 - http://www.oreillynet.com/pub/wlg/9078 - - -
- Is the edited image stored inside or outside of your iPhoto 6 library? -
-
- Derrick Story - 2006-01-22T07:45:58-08:00 -
- - - Building emacs22 on Mac OS X - http://www.oreillynet.com/pub/wlg/9074 - - -
- Emacs 22 is Mac OS X aware, and can be built either as a Carbon .app double-clickable, or as a typical X11 program. Problem is, the information about how to build it is pretty scattered. Here's what works for me. -
-
- Chris Adamson - 2006-01-21T19:45:53-08:00 -
- - - hip to bash web2.0, are we? - http://www.oreillynet.com/pub/wlg/9034 - - -
- It's hip to take some "diggs" at Web 2.0. -
-
- Timothy M. O'Brien - 2006-01-21T15:46:26-08:00 -
- - - My New Game Development Course at Tufts - http://www.oreillynet.com/pub/wlg/9076 - - -
- I am teaching a new course at the Tufts University, "Introduction to Game Development," this semester. -
-
- Ming Chow - 2006-01-21T12:46:56-08:00 -
- - - Tune in to Radio Babylon - http://www.oreillynet.com/pub/wlg/9073 - - -
- Hardware hacks we'd like to see in iPods, #1 -
-
- Giles Turnbull - 2006-01-20T14:15:54-08:00 -
- - - A resource for Google maphacks and mashers now at Maphacks,net - http://www.oreillynet.com/pub/wlg/9072 - - -
- -
-
- Glenn Letham - 2006-01-20T12:16:05-08:00 -
- - - UK film studio on the hunt for Google earth programmers - http://www.oreillynet.com/pub/wlg/9071 - - -
- -
-
- Glenn Letham - 2006-01-20T11:47:03-08:00 -
- -
- diff --git a/test/_files/AtomTestPlanetPHP.xml b/test/_files/AtomTestPlanetPHP.xml deleted file mode 100644 index 762f0101..00000000 --- a/test/_files/AtomTestPlanetPHP.xml +++ /dev/null @@ -1,125 +0,0 @@ - -Planet PHPPeople blogging about PHPhttp://www.planet-php.net/ - Planet PHP Aggregator - 2006-01-23T16:40:00ZeZ components in Gentoo LinuxSebastian Bergmannhttp://www.sebastian-bergmann.de/blog/archives/565-guid.html2006-01-23T16:40:00Z2006-01-23T16:40:00ZeZ components, which provide an enterprise ready general purpose PHP platform, are now available through Gentoo Linux's portage system:
wopr-mobile ~ # emerge -vp ezc-eZcomponents
-
-These are the packages that I would merge, in order:
-
-Calculating dependencies ...done!
-[ebuild  N    ] app-admin/php-toolkit-1.0-r2  0 kB
-[ebuild  N    ] dev-lang/php-5.1.2  0 kB [3]
-[ebuild  N    ] dev-php/PEAR-PEAR-1.4.6  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Base-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Database-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-PhpGenerator-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Configuration-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-ImageAnalysis-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Archive-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Translation-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Cache-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-ConsoleTools-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-PersistentObject-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-ImageConversion-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Mail-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-UserInput-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Debug-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-EventLog-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Execution-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-eZcomponents-1.0_rc1  0 kB [2]
-
-Total size of downloads: 0 kB
-Portage overlays:
- [1] /usr/local/overlay/personal
- [2] /usr/local/overlay/cvs
- [3] /usr/local/overlay/php/testing
- [4] /usr/local/overlay/php/experimental
- [5] /usr/local/overlay/gentopia
- [6] /usr/local/overlay/xgl
- ]]>
PHP InsecurityChris Shifletthttp://shiflett.org/archive/1852006-01-23T16:15:00Z2006-01-23T16:15:00ZAndrew van der Stock has written a strong criticism of PHP's insecurity. Andrew is a seasoned security expert and a major contributor to OWASP, and he states:

-
After writing PHP forum software for three years now, I've come to the conclusion that it is basically impossible for normal programmers to write secure PHP code. It takes far too much effort.
-

He continues, citing specific areas where he thinks PHP is weak and asserting that "PHP must now mature and take on a proper security architecture."

-

Many of the insecure features he cites (register_globals, magic_quotes_gpc, and safe_mode) are slated to be removed in PHP 6, but his core complaint seems to revolve around the fact that PHP makes too much power too easily accessible, often granting developers more power and flexibility than they realize (e.g., wrappers).

-

Aside from minor language features like taint mode, I don't see what other platforms offer to help prevent inexperienced developers from writing insecure code. Anyone care to enlighten me? :-)

- Posted Mon, 23 Jan 2006 16:15:56 GMT in Chris Shiflett: The PHP Blog
- [ -   - - Discuss -   - | -   - - Tag -   - | -   - - Digg -   - | -   - - Furl -   - | -   - - Cosmos -   - ] -

]]>
Beta release of mobile webmail client (MIMP)Horde Newshttp://janschneider.de/cweb/home/index,channel,25,story,255.html2006-01-23T10:01:00Z2006-01-23T10:01:00ZMeet me at php|tekThinkPHP /dev/blog - PHPhttp://blog.thinkphp.de/archives/81-guid.html2006-01-22T22:34:00Z2006-01-22T22:34:00Zphp|tek, the next conference from the php|arch -guys around Marco Tabini who already organized the php|cruise and php|tropics -conferences, will be from April 26th to 28th at Orlando, Florida. As -you can read on the recently published schedule -I'll hold two talks. The first talk will be about PHP on the command -line, showing PHP's strength beyond the web which can be helpful to -build, deploy and scale your web-application and even for building apps -completely independent from anything on the web. My second talk will be -about PHP's reflection API. In that session I'll give an introduction -into the API and show how to use it to build modular, dynamic -applications.

-

If you're in reachable distance you should take the chance to listen and meet PHP developers from all over the world. (Hint: Till January 31st you can get early-bird rates!)

johannes

]]>
Quick LookupJohn Coxhttp://wyome.com/index.php?module=articles&func=display&ptid=10&catid=29-31&aid=5072006-01-22T19:23:00Z2006-01-22T19:23:00ZQuick lookup is a very nice little reference tool for lookups of web development documentation. It installs as a simple bookmark which can be changed to your sidebar for look ups of php / css / javascript / mysql documentation. It has a limited scope of features (which isn't a bad thing in my mind):

-

* Multiple tabs
-* PHP / MySQL / CSS / JS reference (MySQL is 55% complete)
-* Examples
-* Search as you type
-* Fast results
-* Remembers your last tab on your revisit
-* Access keys, [alt + (p, m, j, c)]
-

-

I did a cursory install, and it appears to be pretty fast. I think it might be better as part of the Web Developer Extension for Firefox, but as is, I can see the uses.

- ]]>
mysql_real_escape_string() versus Prepared StatementsIlia Alshanetskyhttp://ilia.ws/archives/103-guid.html2006-01-22T18:03:00Z2006-01-22T18:03:00ZChris has written a compelling piece about how the use of addslashes() for string escaping in MySQL queries can lead to SQL injection through the abuse of multibyte character sets. In his example he relies on addslashes() to convert an invalid multibyte sequence into a valid one, which also has an embedded ' that is not escaped. And in an ironic twist, the function intended to protect against SQL injection is used to actually trigger it.

-The problem demonstrated, actually goes a bit further, which even makes the prescribed escaping mechanism, mysql_real_escape_string() prone to the same kind of issues affecting addslashes(). The main advantage of the mysql_real_escape_string() over addslashes() lies in the fact that it takes character set into account and thus is able to determine how to properly escape the data. For example, if GBK character set is being used, it will not convert an invalid multibyte sequence 0xbf27 (¿’) into 0xbf5c27 (¿\’ or in GBK a single valid multibyte character followed by a single quote). To determine the proper escaping methodology mysql_real_escape_string() needs to know the character set used, which is normally retrieved from the database connection cursor. Herein lies the “trick”. In MySQL there are two ways to change the character set, you can do it by changing in MySQL configuration file (my.cnf) by doing:

CODE:
[client]
-default-character-set=GBK


-Or you can change on a per-connection basis, which is a common practice done by people without admin level access to the server via the following query:

CODE:
SET CHARACTER SET 'GBK'


-The problem with the latter, is that while it most certainly modified the charset it didnÂ’t let the escaping facilities know about it. Which means that mysql_real_escape_string() still works on the basis of the default charset, which if set to latin1 (common default) will make the function work in a manner identical to addslashes() for our purposes. Another word, 0xbf27 will be converted to 0xbf5c27 facilitating the SQL injection. Here is a brief proof of concept.

PHP:

<?php

-$c 
= mysql_connect("localhost", "user", "pass");
mysql_select_db("database", $c);

// change our character set
mysql_query("SET CHARACTER SET 'gbk'", $c);

// create demo table
mysql_query("CREATE TABLE users (
-    username VARCHAR(32) PRIMARY KEY,
-    password VARCHAR(32)
-) CHARACTER SET 'GBK'"
, $c);
mysql_query("INSERT INTO users VALUES('foo','bar'), ('baz','test')", $c);

// now the exploit code
$_POST['username'] = chr(0xbf) . chr(0x27) . ' OR username = username /*'; 
$_POST['password'] = 'anything'; 

Truncated by Planet PHP, read more at the original (another 2694 bytes)

]]>
The addslashes() Versus mysql_real_escape_string() DebateChris Shifletthttp://shiflett.org/archive/1842006-01-22T04:15:00Z2006-01-22T04:15:00ZLast month, I discussed Google's XSS Vulnerability and provided an example that demonstrates it. I was hoping to highlight why character encoding consistency is important, but apparently the addslashes() versus mysql_real_escape_string() debate continues. Demonstrating Google's XSS vulnerability was pretty easy. Demonstrating an SQL injection attack that is immune to addslashes() is a bit more involved, but still pretty straightforward.

-

In GBK, 0xbf27 is not a valid multi-byte character, but 0xbf5c is. Interpreted as single-byte characters, 0xbf27 is 0xbf (¿) followed by 0x27 ('), and 0xbf5c is 0xbf (¿) followed by 0x5c (\).

-

How does this help? If I want to attempt an SQL injection attack against a MySQL database, having single quotes escaped with a backslash is a bummer. If you're using addslashes(), however, I'm in luck. All I need to do is inject something like 0xbf27, and addslashes() modifies this to become 0xbf5c27, a valid multi-byte character followed by a single quote. In other words, I can successfully inject a single quote despite your escaping. That's because 0xbf5c is considered to be a single character, not two. Oops, there goes the backslash.

-

I'm going to use MySQL 5.0 and PHP's mysqli extension for this demonstration. If you want to try this yourself, make sure you're using GBK. I just changed /etc/my.cnf, but that's because I'm testing locally:

-
[client]
-default-character-set=GBK
-

Create a table called users:

-
CREATE TABLE users
-(
-    username VARCHAR(32) CHARACTER SET GBK,
-    password VARCHAR(32) CHARACTER SET GBK,
-    PRIMARY KEY (username)
-);
-
-

The following script mimics a situation where only addslashes() is used to escape the data being used in a query:

-
<?php 

$mysql 
= array();

$db = mysqli_init();
$db->real_connect('localhost', 'myuser', 'mypass', 'mydb');

$_POST['username'] = chr(0xbf) .
                     
chr(0x27) .
                     
' OR username = username /*';
$_POST['password'] = 'guess';

$mysql['username'] = addslashes($_POST['username']);
$mysql['password'] = addslashes($_POST

Truncated by Planet PHP, read more at the original (another 4165 bytes)

]]>
PHP ConferencesJason E. Sweathttp://blog.casey-sweat.us/?p=692006-01-22T04:04:00Z2006-01-22T04:04:00ZBack from NorwayTobias Schlitthttp://www.schlitt.info/applications/blog/index.php?/archives/407-guid.html2006-01-22T00:30:00Z2006-01-22T00:30:00ZNorway is a somewhat strange country. When I got there - 2 weeks ago to work with Amos, Derick, Fred and Ray on the eZ components - it had the expected amount of snow. A few days later, there was nothing anymore. We had positive celsius values and the weather was really crappy... until Monday. Since then it has been snowing all the time and yesterday we left when it looked like this:

- -

pict1285.jpg

- -

Nice to watch, but not real fun to walk onto. :) Anyway, it's been another great stay in Skien, where the eZ headquarter is and I'm pretty much looking forward to our summer conference, where we plan to have the complete eZ team there and lots of people from the PHP world. Thanks for the great time, folks!

- - ]]>
Solar 0.10.0 ReleasedPaul M. Joneshttp://paul-m-jones.com/blog/?p=1922006-01-21T21:44:00Z2006-01-21T21:44:00Z
diff --git a/test/_files/AtomTestSample1.xml b/test/_files/AtomTestSample1.xml deleted file mode 100644 index 40aa3671..00000000 --- a/test/_files/AtomTestSample1.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - Example Feed - Insert witty or insightful remark here - - 2003-12-13T18:30:02Z - - John Doe - johndoe@example.com - - urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 - - - Atom-Powered Robots Run Amok - - urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a - 2003-12-13T18:30:02Z - Some text. - - - \ No newline at end of file diff --git a/test/_files/AtomTestSample2.xml b/test/_files/AtomTestSample2.xml deleted file mode 100644 index 7a7a6285..00000000 --- a/test/_files/AtomTestSample2.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - Example Atom Feed - 2006-01-23T23:04:33Z - - http://www.example.com - - - John Doe - John@Example.com - http://www.example.com - - - \ No newline at end of file diff --git a/test/_files/AtomTestSample3.xml b/test/_files/AtomTestSample3.xml deleted file mode 100644 index 0accba88..00000000 --- a/test/_files/AtomTestSample3.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - Example Atom Feed - 2006-01-23T23:04:33Z - - http://www.example.com - - - John Doe - John@Example.com - http://www.example.com - - - - - \ No newline at end of file diff --git a/test/_files/AtomTestSample4.xml b/test/_files/AtomTestSample4.xml deleted file mode 100644 index 8af5593f..00000000 --- a/test/_files/AtomTestSample4.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - http://www.example.com - Example Atom Feed - 2006-01-23T23:04:33Z - - - - John Doe - John@Example.com - http://www.example.com - - - - tag:www.example.com,2006-01-23:/post/1234 - Mars Attacks Pluto Probe - 2006-01-23T23:04:33Z - In upheaval of the tenuous peace between Earth and Mars over the last century, it has been confirmed that a rogue Martian fighter ship suddenly attacked Earth's 2006 probe to Pluto today. Martian delegates have been dispatched to Earth in an effort to quell the political firestorm that has ensued. - - - - - tag:www.example.com,2006-01-23:/post/1235 - Quake Rocks Io - 2006-01-23T23:04:33Z - A strong tremor rocked Io this afternoon, and officials are saying that no one has been found alive on Io since the quake. - - - - \ No newline at end of file diff --git a/test/_files/RssTest091Sample1.xml b/test/_files/RssTest091Sample1.xml deleted file mode 100644 index 65788c3d..00000000 --- a/test/_files/RssTest091Sample1.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - WriteTheWeb - http://writetheweb.com - News for web users that write back - en-us - Copyright 2000, WriteTheWeb team. - editor@writetheweb.com - webmaster@writetheweb.com - - WriteTheWeb - http://writetheweb.com/images/mynetscape88.gif - http://writetheweb.com - 88 - 31 - News for web users that write back - - - Giving the world a pluggable Gnutella - http://writetheweb.com/read.php?item=24 - WorldOS is a framework on which to build programs that work like Freenet or Gnutella -allowing distributed applications using peer-to-peer routing. - - - Syndication discussions hot up - http://writetheweb.com/read.php?item=23 - After a period of dormancy, the Syndication mailing list has become active again, with contributions from leaders in traditional media and Web syndication. - - - Personal web server integrates file sharing and messaging - http://writetheweb.com/read.php?item=22 - The Magi Project is an innovative project to create a combined personal web server and messaging system that enables the sharing and synchronization of information across desktop, laptop and palmtop devices. - - - Syndication and Metadata - http://writetheweb.com/read.php?item=21 - RSS is probably the best known metadata format around. RDF is probably one of the least understood. In this essay, published on my O'Reilly Network weblog, I argue that the next generation of RSS should be based on RDF. - - - UK bloggers get organised - http://writetheweb.com/read.php?item=20 - Looks like the weblogs scene is gathering pace beyond the shores of the US. There's now a UK-specific page on weblogs.com, and a mailing list at egroups. - - - Yournamehere.com more important than anything - http://writetheweb.com/read.php?item=19 - Whatever you're publishing on the web, your site name is the most valuable asset you have, according to Carl Steadman. - - - diff --git a/test/_files/RssTest092Sample1.xml b/test/_files/RssTest092Sample1.xml deleted file mode 100644 index 5d75c352..00000000 --- a/test/_files/RssTest092Sample1.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - Dave Winer: Grateful Dead - http://www.scripting.com/blog/categories/gratefulDead.html - A high-fidelity Grateful Dead song every day. This is where we're experimenting with enclosures on RSS news items that download when you're not using your computer. If it works (it will) it will be the end of the Click-And-Wait multimedia experience on the Internet. - Fri, 13 Apr 2001 19:23:02 GMT - http://backend.userland.com/rss092 - dave@userland.com (Dave Winer) - dave@userland.com (Dave Winer) - - - It's been a few days since I added a song to the Grateful Dead channel. Now that there are all these new Radio users, many of whom are tuned into this channel (it's #16 on the hotlist of upstreaming Radio users, there's no way of knowing how many non-upstreaming users are subscribing, have to do something about this..). Anyway, tonight's song is a live version of Weather Report Suite from Dick's Picks Volume 7. It's wistful music. Of course a beautiful song, oft-quoted here on Scripting News. <i>A little change, the wind and rain.</i> - - - - - Kevin Drennan started a <a href="http://deadend.editthispage.com/">Grateful Dead Weblog</a>. Hey it's cool, he even has a <a href="http://deadend.editthispage.com/directory/61">directory</a>. <i>A Frontier 7 feature.</i> - Scripting News - - - <a href="http://arts.ucsc.edu/GDead/AGDL/other1.html">The Other One</a>, live instrumental, One From The Vault. Very rhythmic very spacy, you can listen to it many times, and enjoy something new every time. - - - - This is a test of a change I just made. Still diggin.. - - - The HTML rendering almost <a href="http://validator.w3.org/check/referer">validates</a>. Close. Hey I wonder if anyone has ever published a style guide for ALT attributes on images? What are you supposed to say in the ALT attribute? I sure don't know. If you're blind send me an email if u cn rd ths. - - - <a href="http://www.cs.cmu.edu/~mleone/gdead/dead-lyrics/Franklin's_Tower.txt">Franklin's Tower</a>, a live version from One From The Vault. - - - - Moshe Weitzman says Shakedown Street is what I'm lookin for for tonight. I'm listening right now. It's one of my favorites. "Don't tell me this town ain't got no heart." Too bright. I like the jazziness of Weather Report Suite. Dreamy and soft. How about The Other One? "Spanish lady come to me.." - Scripting News - - - <a href="http://www.scripting.com/mp3s/youWinAgain.mp3">The news is out</a>, all over town..<p> -You've been seen, out runnin round. <p> -The lyrics are <a href="http://www.cs.cmu.edu/~mleone/gdead/dead-lyrics/You_Win_Again.txt">here</a>, short and sweet. <p> -<i>You win again!</i> - - - - - <a href="http://www.getlyrics.com/lyrics/grateful-dead/wake-of-the-flood/07.htm">Weather Report Suite</a>: "Winter rain, now tell me why, summers fade, and roses die? The answer came. The wind and rain. Golden hills, now veiled in grey, summer leaves have blown away. Now what remains? The wind and rain." - - - - <a href="http://arts.ucsc.edu/gdead/agdl/darkstar.html">Dark Star</a> crashes, pouring its light into ashes. - - - - DaveNet: <a href="http://davenet.userland.com/2001/01/21/theUsBlues">The U.S. Blues</a>. - - - Still listening to the US Blues. <i>"Wave that flag, wave it wide and high.."</i> Mistake made in the 60s. We gave our country to the assholes. Ah ah. Let's take it back. Hey I'm still a hippie. <i>"You could call this song The United States Blues."</i> - - - <a href="http://www.sixties.com/html/garcia_stack_0.html"><img src="http://www.scripting.com/images/captainTripsSmall.gif" height="51" width="42" border="0" hspace="10" vspace="10" align="right"></a>In celebration of today's inauguration, after hearing all those great patriotic songs, America the Beautiful, even The Star Spangled Banner made my eyes mist up. It made my choice of Grateful Dead song of the night realllly easy. Here are the <a href="http://searchlyrics2.homestead.com/gd_usblues.html">lyrics</a>. Click on the audio icon to the left to give it a listen. "Red and white, blue suede shoes, I'm Uncle Sam, how do you do?" It's a different kind of patriotic music, but man I love my country and I love Jerry and the band. <i>I truly do!</i> - - - - Grateful Dead: "Tennessee, Tennessee, ain't no place I'd rather be." - - - - Ed Cone: "Had a nice Deadhead experience with my wife, who never was one but gets the vibe and knows and likes a lot of the music. Somehow she made it to the age of 40 without ever hearing Wharf Rat. We drove to Jersey and back over Christmas with the live album commonly known as Skull and Roses in the CD player much of the way, and it was cool to see her discover one the band's finest moments. That song is unique and underappreciated. Fun to hear that disc again after a few years off -- you get Jerry as blues-guitar hero on Big Railroad Blues and a nice version of Bertha." - - - - <a href="http://arts.ucsc.edu/GDead/AGDL/fotd.html">Tonight's Song</a>: "If I get home before daylight I just might get some sleep tonight." - - - - <a href="http://arts.ucsc.edu/GDead/AGDL/uncle.html">Tonight's song</a>: "Come hear Uncle John's Band by the river side. Got some things to talk about here beside the rising tide." - - - - <a href="http://www.cs.cmu.edu/~mleone/gdead/dead-lyrics/Me_and_My_Uncle.txt">Me and My Uncle</a>: "I loved my uncle, God rest his soul, taught me good, Lord, taught me all I know. Taught me so well, I grabbed that gold and I left his dead ass there by the side of the road." - - - - - Truckin, like the doo-dah man, once told me gotta play your hand. Sometimes the cards ain't worth a dime, if you don't lay em down. - - - - Two-Way-Web: <a href="http://www.thetwowayweb.com/payloadsForRss">Payloads for RSS</a>. "When I started talking with Adam late last year, he wanted me to think about high quality video on the Internet, and I totally didn't want to hear about it." - - - A touch of gray, kinda suits you anyway.. - - - - <a href="http://www.sixties.com/html/garcia_stack_0.html"><img src="http://www.scripting.com/images/captainTripsSmall.gif" height="51" width="42" border="0" hspace="10" vspace="10" align="right"></a>In celebration of today's inauguration, after hearing all those great patriotic songs, America the Beautiful, even The Star Spangled Banner made my eyes mist up. It made my choice of Grateful Dead song of the night realllly easy. Here are the <a href="http://searchlyrics2.homestead.com/gd_usblues.html">lyrics</a>. Click on the audio icon to the left to give it a listen. "Red and white, blue suede shoes, I'm Uncle Sam, how do you do?" It's a different kind of patriotic music, but man I love my country and I love Jerry and the band. <i>I truly do!</i> - - - - \ No newline at end of file diff --git a/test/_files/RssTest100Sample1.xml b/test/_files/RssTest100Sample1.xml deleted file mode 100644 index cd884501..00000000 --- a/test/_files/RssTest100Sample1.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - XML.com - http://xml.com/pub - - XML.com features a rich mix of information and services - for the XML community. - - - - - - - - - - - - - - - - - XML.com - http://www.xml.com - http://xml.com/universal/images/xml_tiny.gif - - - - Processing Inclusions with XSLT - http://xml.com/pub/2000/08/09/xslt/xslt.html - - Processing document inclusions with general XML tools can be - problematic. This article proposes a way of preserving inclusion - information through SAX-based processing. - - - - - Putting RDF to Work - http://xml.com/pub/2000/08/09/rdfdb/index.html - - Tool and API support for the Resource Description Framework - is slowly coming of age. Edd Dumbill takes a look at RDFDB, - one of the most exciting new RDF toolkits. - - - - - Search XML.com - Search XML.com's XML collection - s - http://search.xml.com - - - \ No newline at end of file diff --git a/test/_files/RssTest100Sample2.xml b/test/_files/RssTest100Sample2.xml deleted file mode 100644 index 5b4cbc46..00000000 --- a/test/_files/RssTest100Sample2.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - Meerkat - http://meerkat.oreillynet.com - Meerkat: An Open Wire Service - The O'Reilly Network - Rael Dornfest (mailto:rael@oreilly.com) - Copyright © 2000 O'Reilly & Associates, Inc. - 2000-01-01T12:00+00:00 - hourly - 2 - 2000-01-01T12:00+00:00 - - - - - - - - - - - - - - - Meerkat Powered! - http://meerkat.oreillynet.com/icons/meerkat-powered.jpg - http://meerkat.oreillynet.com - - - - XML: A Disruptive Technology - http://c.moreover.com/click/here.pl?r123 - - XML is placing increasingly heavy loads on the existing technical - infrastructure of the Internet. - - The O'Reilly Network - Simon St.Laurent (mailto:simonstl@simonstl.com) - Copyright © 2000 O'Reilly & Associates, Inc. - XML - XML.com - NASDAQ - XML - - - - Search Meerkat - Search Meerkat's RSS Database... - s - http://meerkat.oreillynet.com/ - search - regex - - - \ No newline at end of file diff --git a/test/_files/RssTest200Sample1.xml b/test/_files/RssTest200Sample1.xml deleted file mode 100644 index 7eedaf81..00000000 --- a/test/_files/RssTest200Sample1.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - Liftoff News - http://liftoff.msfc.nasa.gov/ - Liftoff to Space Exploration. - en-us - Tue, 10 Jun 2003 04:00:00 GMT - Tue, 10 Jun 2003 09:41:01 GMT - http://blogs.law.harvard.edu/tech/rss - Weblog Editor 2.0 - editor@example.com - webmaster@example.com - - Star City - http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp - How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia's <a href="http://howe.iki.rssi.ru/GCTC/gctc_e.htm">Star City</a>. - Tue, 03 Jun 2003 09:39:21 GMT - http://liftoff.msfc.nasa.gov/2003/06/03.html#item573 - - - Sky watchers in Europe, Asia, and parts of Alaska and Canada will experience a <a href="http://science.nasa.gov/headlines/y2003/30may_solareclipse.htm">partial eclipse of the Sun</a> on Saturday, May 31st. - Fri, 30 May 2003 11:06:42 GMT - http://liftoff.msfc.nasa.gov/2003/05/30.html#item572 - - - The Engine That Does More - http://liftoff.msfc.nasa.gov/news/2003/news-VASIMR.asp - Before man travels to Mars, NASA hopes to design new engines that will let us fly through the Solar System more quickly. The proposed VASIMR engine would do that. - Tue, 27 May 2003 08:37:32 GMT - http://liftoff.msfc.nasa.gov/2003/05/27.html#item571 - - - Astronauts' Dirty Laundry - http://liftoff.msfc.nasa.gov/news/2003/news-laundry.asp - Compared to earlier spacecraft, the International Space Station has many luxuries, but laundry facilities are not one of them. Instead, astronauts have other options. - Tue, 20 May 2003 08:56:02 GMT - http://liftoff.msfc.nasa.gov/2003/05/20.html#item570 - - - \ No newline at end of file diff --git a/test/_files/RssTestCNN.xml b/test/_files/RssTestCNN.xml deleted file mode 100644 index b7992aa0..00000000 --- a/test/_files/RssTestCNN.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - -CNN.com -http://www.cnn.com/rssclick/?section=cnn_topstories -CNN.com delivers up-to-the-minute news and information on the latest top stories, weather, entertainment, politics and more. -en-us -© 2006 Cable News Network LP, LLLP. -Mon, 23 Jan 2006 15:11:09 EST -5 - -CNN.com -http://www.cnn.com/rssclick/?section=cnn_topstories -http://i.cnn.net/cnn/.element/img/1.0/logo/cnn.logo.rss.gif -144 -33 -CNN.com delivers up-to-the-minute news and information on the latest top stories, weather, entertainment, politics and more. - - -Court ruling could lead to BlackBerry shutdown -http://www.cnn.com/rssclick/money/2006/01/23/technology/rim/index.htm?section=cnn_topstories -BlackBerry maker Research in Motion was dealt a setback today when the U.S. Supreme Court turned down a request to review a major patent infringement ruling against the company. Research In Motion (RIM) had petitioned the Supreme Court to review a federal appeals court ruling that could lead to a shutdown of most U.S. BlackBerry sales and service. -Mon, 23 Jan 2006 15:09:23 EST - - -Ford owners not told how to reduce fire risk -http://www.cnn.com/rssclick/2006/US/01/23/ford.fires/index.html?section=cnn_topstories -The parents of three sisters burned to death in a rear-end crash are asking Ford Motor Co. to install the same gas tank protective devices in regular models as it did for its police cars. -Mon, 23 Jan 2006 12:30:45 EST - - -Ford cutting up to 30,000 jobs -http://www.cnn.com/rssclick/money/2006/01/23/news/companies/ford_closings/index.htm?section=cnn_topstories -Ford will close 14 manufacturing plants in North America and cut up to 30,000 jobs in the coming years to try to stem losses and adjust to a new, significantly lower market share. "If we build it, they'll buy it. That's business as usual and it's wrong," said Ford Chairman and CEO Bill Ford . "Our product plans for too long have been defined by our capacity. That's why we must reduce capacity in North America." -Mon, 23 Jan 2006 11:56:19 EST - - -Bush rejects warrantless wiretaps furor -http://www.cnn.com/rssclick/2006/POLITICS/01/23/bush.ap/index.html?section=cnn_topstories -Read full story for latest details. -Mon, 23 Jan 2006 14:25:26 EST - - -Rescuers dig for survivors in collapsed Nairobi building -http://www.cnn.com/rssclick/2006/WORLD/africa/01/23/kenya.building/index.html?section=cnn_topstories -Rescuers are desperately trying to dig out construction workers trapped under the rubble of a five-story building that collapsed today in Nairobi, Kenya. At least 60 people are injured. It was unclear if any workers had died. Witnesses told news agencies they had seen between four and eight bodies but police have given no official death toll yet. Dozens of rescuers dug into the rubble with their bare hands while the injured were taken to hospitals in cars. -Mon, 23 Jan 2006 15:06:36 EST - - -DNA frees man 24 years into 130-year sentence -http://www.cnn.com/rssclick/2006/LAW/01/23/dna.exoneration.ap/index.html?section=cnn_topstories -Read full story for latest details. -Mon, 23 Jan 2006 14:05:16 EST - - -School nurse crisis putting kids at risk -http://www.cnn.com/rssclick/2006/HEALTH/01/23/btsc.cohen/index.html?section=cnn_topstories -A few months ago, I was interviewing a principal at a Chicago, Illinois, public elementary school, when from outside her office came the sounds of a child coughing. -Mon, 23 Jan 2006 12:54:40 EST - - -Russia: Britain used 'rock' to spy -http://www.cnn.com/rssclick/2006/WORLD/europe/01/23/uk.russia.row/index.html?section=cnn_topstories -British official say they are "concerned and surprised" at allegations by a Russian state TV program that UK diplomats used a transmitter embedded in a fake rock as part of a high-tech spying operation in Moscow, news agencies report. -Mon, 23 Jan 2006 14:21:29 EST - - -Buttafuocos plan TV reunion with Amy Fisher -http://www.cnn.com/rssclick/2006/SHOWBIZ/TV/01/23/people.fisher.buttafuoco.reunion.ap/index.html?section=cnn_topstories -Read full story for latest details. -Mon, 23 Jan 2006 13:31:06 EST - - -Could you love the 'world's worst dog'? -http://www.cnn.com/rssclick/2006/SHOWBIZ/books/01/23/books.marley.me.ap/index.html?section=cnn_topstories -Read full story for latest details. -Mon, 23 Jan 2006 12:35:01 EST - - - diff --git a/test/_files/RssTestHarvardLaw.xml b/test/_files/RssTestHarvardLaw.xml deleted file mode 100644 index 842ba27a..00000000 --- a/test/_files/RssTestHarvardLaw.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - - Really Simple Syndication - http://blogs.law.harvard.edu/tech/ - RSS Advisory Board announcements and RSS news - http://creativecommons.org/licenses/by-sa/1.0/ - en-us - Sat, 21 Jan 2006 05:00:00 GMT - Sun, 22 Jan 2006 02:01:58 GMT - http://backend.userland.com/rss - UserLand Frontier v9.5 - rssUpdates - rcade@yahoo.com - rcade@yahoo.com - - Simple Syndication in Communist China - http://english.peopledaily.com.cn/rss/rss.html - The English language edition of <a href="http://english.peopledaily.com.cn/">People's Daily</a>, the official newspaper of the Communist Party of China, offers <a href="http://english.peopledaily.com.cn/rss/rss.html">18 RSS 2.0 newsfeeds</a>.<br> -<br> -In addition to feeds on current events in news, business, sports, and -other areas, the paper devotes feeds to party leaders such as Chinese -President <a href="http://english.people.com.cn/rss/hujintao.xml">Hu Jintao</a> and Premier <a href="http://english.peopledaily.com.cn/rss/rss.html">Wen Jiabao</a>.<br> -<br> -Outside observers of China often look to <span style="font-style: italic;">People's Daily</span> for clues about the inner workings of the government, as described in <a href="http://en.wikipedia.org/wiki/People%27s_Daily">Wikipedia</a>:<br> -<p style="margin-left: 40px;">Newspaper articles in the <span style="font-style: italic;">People's Daily</span> are often not read for -content, so much as placement. A large number of articles devoted to a -political figure or idea is often taken as a sign that that official is -rising.</p><br><br><div style="margin-left: 40px;">In addition, editorials in the <i>People's Daily</i> are also still regarded as fairly authoritative statements of government policy.<br> -</div> - Rogers Cadenhead - http://blogs.law.harvard.edu/tech/2005/07/10#a852 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=852&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2005%2F07%2F10%23a852 - - - RSS Takes Flight at NASA - http://www.nasa.gov/rss/ - The National Aeronautics and Space Administration makes extensive use -of RSS 2.0 to provide news, photographs, and press releases on upcoming -missions and other space-related topics.<br> -<br> -People looking ahead to the planned July 13 launch of the space shuttle Discovery can subscribe to a <a href="http://www.nasa.gov/rss/rtf_news.rss">Return to Flight RSS feed</a>.<br> -<br> -NASA's RSS information page also includes an interesting demonstration of an RSS viewer created in Macromedia Flash.<br> - Rogers Cadenhead - http://blogs.law.harvard.edu/tech/2005/07/09#a851 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=851&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2005%2F07%2F09%23a851 - - - RSS Usage Skyrockets in the U.S. - http://blogs.law.harvard.edu/tech/2005/01/04#a821 - Six million Americans get news and information from RSS aggregators, according to a <a href="http://www.pewinternet.org/pdfs/PIP_blogging_data.pdf">nationwide telephone survey</a> conducted by the Pew Internet and American Life Project in November.<br> -<br> -The project, an ongoing survey of the 120 million Americans using the -Internet, found that 5 percent follow their favorite sources through -RSS syndication. "This is a first-time measurement from our surveys and -is an indicator that this application is gaining an impressive -foothold."<br> -<br> -The survey also found that 27 percent of those polled are weblog -readers, a 58 percent jump in the 9 months since the preceding poll was -conducted.<br> - Rogers Cadenhead - http://blogs.law.harvard.edu/tech/2005/01/04#a821 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=821&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2005%2F01%2F04%23a821 - - - Added link to encoding examples in RSS 2.0 spec - http://blogs.law.harvard.edu/tech/2004/06/19#a683 - <P>We added a link to a page of <A href="http://blogs.law.harvard.edu/tech/encodingDescriptions">encoding examples</A> for descriptions, <A href="http://blogs.law.harvard.edu/tech/rss#hrelementsOfLtitemgt">under</A> Elements of &lt;item>. The change is also <A href="http://blogs.law.harvard.edu/tech/rssChangeNotes#61904Dw">noted</A> on the Change Notes page.</P> - Dave Winer - http://blogs.law.harvard.edu/tech/2004/06/19#a683 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=683&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F06%2F19%23a683 - - - Proposed clarification for RSS 2.0 spec (revised) - http://blogs.law.harvard.edu/tech/2004/06/15#a648 - <P>Here's a revised proposal for a clarification to the RSS 2.0 spec.</P> -<P>Under <A href="http://blogs.law.harvard.edu/tech/rss#hrelementsOfLtitemgt">Elements of &lt;item></A>, replace the lead paragraph with the following.<BR></P> -<BLOCKQUOTE> -<P>A channel may contain any number of &lt;item>s. An item may represent a "story" -- much like a story in a newspaper or magazine; if so its description is a synopsis of the story, and the link points to the full story. An item may also be complete in itself, if so, the description contains the text (entity-encoded HTML is allowed<FONT color=green><B>; see <A style="COLOR: green" href="http://blogs.law.harvard.edu/tech/encodingDescriptions">examples</A></B></FONT>), and the link and title may be omitted. All elements of an item are optional, however at least one of title or description must be present.</P></BLOCKQUOTE> -<P><STRONG>Notes</STRONG>: The new text is in green. The word examples links to a <A href="http://blogs.law.harvard.edu/tech/encodingDescriptions">page</A> of examples of encodings. We'd like to make the changes to the spec early next week.&nbsp;&nbsp;If you have concerns about this change, please post a comment below, and we will review them before making the change. Thanks to everyone who has participated in the discussion thus far.</P> - Andrew Grumet - http://blogs.law.harvard.edu/tech/2004/06/15#a648 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=648&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F06%2F15%23a648 - - - Proposed clarification for RSS 2.0 spec - http://blogs.law.harvard.edu/tech/2004/06/04#a553 - <P>Requesting comments on a couple of proposed clarifications to the <A href="http://blogs.law.harvard.edu/tech/rss#hrelementsOfLtitemgt">RSS 2.0 spec</A>.</P> -<P>1. Under Elements of &lt;item>, replace the lead paragraph with the following. The new text is highlighted in green.</P> -<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"> -<P>A channel may contain any number of &lt;item>s. An item may represent a "story" -- much like a story in a newspaper or magazine; if so its description is a synopsis of the story, and the link points to the full story. An item may also be complete in itself, if so, the description contains the text, and the link and title may be omitted. <B><FONT color=green>Either way, &lt;description> contains entity-encoded HTML</FONT>.</B> All elements of an item are optional, however at least one of title or description must be present.</P></BLOCKQUOTE> -<P>2. Immediately following that section, a link to a <A href="http://blogs.law.harvard.edu/tech/encodingDescriptions">page of examples</A>, authored by Nick Bradbury, author of the FeedDemon aggregator.</P> -<P><STRONG>Notes: </STRONG>We believe aggregators already assume the&nbsp;item-level description contains entity-encoded HTML.&nbsp; We'd like to make the changes to the spec early next week and if there are no deal-stoppers, we will. Please comment below. Off-topic and personal comments will be deleted.</P> -<P><STRONG>Thanks to:</STRONG> Nick Bradbury, Brent Simmons, Greg Reinacker, Jake Savin, Dare Obasanjo, Matt Mullenweg for their help working out this proposed clarification.</P> - Dave Winer - http://blogs.law.harvard.edu/tech/2004/06/04#a553 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=553&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F06%2F04%23a553 - - - RSS documentation updates - http://blogs.law.harvard.edu/tech/2004/05/31#a550 - If you're not tracking this site's <A href="http://blogs.law.harvard.edu/tech/rssChangeNotes">change notes page</A>, you might have missed a few minor edits to the documentation for RSS 2.0:<BR> -<UL> -<LI>The <A href="http://cyber.law.harvard.edu/blogs/gems/tech/rss2sample.xml">RSS 2.0 sample file</A> has been updated. -<LI>An <A href="http://blogs.law.harvard.edu/tech/rssChangeNotes#53104Dw">encoding issue</A> has been fixed on the <A href="http://blogs.law.harvard.edu/tech/skipHoursDays">skipHours and skipDays</A> page. </LI></UL>Suggestions for further improvements to the documentation are encouraged.<BR><BR> - Rogers Cadenhead - http://blogs.law.harvard.edu/tech/2004/05/31#a550 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=550&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F05%2F31%23a550 - - - The role of the advisory board - http://blogs.law.harvard.edu/tech/2004/05/18#a540 - There's been some confusion about the role of the advisory board. The purpose of this post to try to clear it up.<BR><BR>1. It's got a very conservative mission, to answer questions about RSS, to help people use it, to promote its use. It's basically a support function. <BR><BR>2. Anyone can extend RSS through namespaces. We suggest that people look first to see if there is a core element that already does what they need to do, and if so, use that instead of inventing a new one. That will keep the work of aggregator developers to a minimum, keep the barriers to entry low, help keep the market competitive. Competition should be based on features, performance and price, not compatibility. Compatibility should be easy.<BR><BR>3. Emphatically, this group is not a standards organization. It does not own RSS, or the spec, it has no more or less authority than any other group of people who wish to promote RSS. - Dave Winer - http://blogs.law.harvard.edu/tech/2004/05/18#a540 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=540&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F05%2F18%23a540 - - - Why are dates RFC 822? - http://blogs.law.harvard.edu/tech/2004/05/16#a534 - <P>Gene Saunders writes: "Why does RSS 2.0 use RFC 822 instead of the (infinitely more modern) RFC 2822?"</P> -<P>Here's why we went with RFC 822:</P> -<P>1. Any scripting software that was used in Internet applications would already have to deal with RFC 822 dates, since that was the format used in email. For most app developers, I imagined, they already had library routines that dealt with 822 format dates. The script environment I was using certainly did. Over the years I've never heard a complaint that people were unable to process 822 dates. <img src="http://static.userland.com/shortcuts/images/qbullets/sidesmiley.gif"></P> -<P>2. 822 dates are not only machine readable, they are also human readable. One of the <A href="http://davenet.scripting.com/2000/09/02/whatToDoAboutRss#rssIsAboutSimplicity">goals</A> of RSS was to be non-intimidating for non-technical users -- they should be able to look at a file and make sense of what's there, where ever possible. </P> -<P>3. Believe it or not, the decision was made in 1997, seven years ago. RSS is a venerable institution, so its anachronisms should be appreciated&nbsp;as one respects a fine wine or an elder statesman, or a format that spawned an incredible market.</P> - Dave Winer - http://blogs.law.harvard.edu/tech/2004/05/16#a534 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=534&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F05%2F16%23a534 - - - Speed Meets Feed in Download Tool - http://blogs.law.harvard.edu/tech/2004/03/15#a519 - <A href="http://www.wired.com/news/infostructure/0,1377,62651,00.html">Wired</A>: "A demo publishing system launched Friday by a popular programmer and blogger merges two of this season's hottest tech fads -- RSS news syndication and BitTorrent file sharing -- to create a cheap publishing system for what its author calls 'big media objects.' The hybrid system is meant to eliminate both the publisher's need for fat bandwidth, and the consumer's need to wait through a grueling download." - Dave Winer - http://blogs.law.harvard.edu/tech/2004/03/15#a519 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=519&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F03%2F15%23a519 - - - \ No newline at end of file diff --git a/test/_files/RssTestPlanetPHP.xml b/test/_files/RssTestPlanetPHP.xml deleted file mode 100644 index 762f9877..00000000 --- a/test/_files/RssTestPlanetPHP.xml +++ /dev/null @@ -1,126 +0,0 @@ - - -Planet PHPhttp://planet-php.netPeople blogging about PHPeneZ components in Gentoo Linux - Sebastian Bergmannhttp://www.sebastian-bergmann.de/blog/archives/565-eZ-components-in-Gentoo-Linux.htmlMon, 23 Jan 2006 16:40:00 +0000eZ components, which provide an enterprise ready general purpose PHP platform, are now available through Gentoo Linux's portage system:
wopr-mobile ~ # emerge -vp ezc-eZcomponents
-
-These are the packages that I would merge, in order:
-
-Calculating dependencies ...done!
-[ebuild  N    ] app-admin/php-toolkit-1.0-r2  0 kB
-[ebuild  N    ] dev-lang/php-5.1.2  0 kB [3]
-[ebuild  N    ] dev-php/PEAR-PEAR-1.4.6  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Base-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Database-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-PhpGenerator-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Configuration-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-ImageAnalysis-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Archive-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Translation-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Cache-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-ConsoleTools-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-PersistentObject-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-ImageConversion-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Mail-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-UserInput-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Debug-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-EventLog-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Execution-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-eZcomponents-1.0_rc1  0 kB [2]
-
-Total size of downloads: 0 kB
-Portage overlays:
- [1] /usr/local/overlay/personal
- [2] /usr/local/overlay/cvs
- [3] /usr/local/overlay/php/testing
- [4] /usr/local/overlay/php/experimental
- [5] /usr/local/overlay/gentopia
- [6] /usr/local/overlay/xgl
- ]]>
PHP Insecurity - Chris Shifletthttp://shiflett.org/archive/185Mon, 23 Jan 2006 16:15:56 +0000Andrew van der Stock has written a strong criticism of PHP's insecurity. Andrew is a seasoned security expert and a major contributor to OWASP, and he states:

-
After writing PHP forum software for three years now, I've come to the conclusion that it is basically impossible for normal programmers to write secure PHP code. It takes far too much effort.
-

He continues, citing specific areas where he thinks PHP is weak and asserting that "PHP must now mature and take on a proper security architecture."

-

Many of the insecure features he cites (register_globals, magic_quotes_gpc, and safe_mode) are slated to be removed in PHP 6, but his core complaint seems to revolve around the fact that PHP makes too much power too easily accessible, often granting developers more power and flexibility than they realize (e.g., wrappers).

-

Aside from minor language features like taint mode, I don't see what other platforms offer to help prevent inexperienced developers from writing insecure code. Anyone care to enlighten me? :-)

- Posted Mon, 23 Jan 2006 16:15:56 GMT in Chris Shiflett: The PHP Blog
- [ -   - - Discuss -   - | -   - - Tag -   - | -   - - Digg -   - | -   - - Furl -   - | -   - - Cosmos -   - ] -

]]>
Beta release of mobile webmail client (MIMP) - Horde Newshttp://janschneider.de/cweb/home/index,channel,25,story,255.htmlMon, 23 Jan 2006 10:01:16 +0000Meet me at php|tek - ThinkPHP /dev/blog - PHPhttp://blog.thinkphp.de/archives/81-Meet-me-at-phptek.htmlSun, 22 Jan 2006 22:34:00 +0000php|tek, the next conference from the php|arch -guys around Marco Tabini who already organized the php|cruise and php|tropics -conferences, will be from April 26th to 28th at Orlando, Florida. As -you can read on the recently published schedule -I'll hold two talks. The first talk will be about PHP on the command -line, showing PHP's strength beyond the web which can be helpful to -build, deploy and scale your web-application and even for building apps -completely independent from anything on the web. My second talk will be -about PHP's reflection API. In that session I'll give an introduction -into the API and show how to use it to build modular, dynamic -applications.

-

If you're in reachable distance you should take the chance to listen and meet PHP developers from all over the world. (Hint: Till January 31st you can get early-bird rates!)

johannes

]]>
Quick Lookup - John Coxhttp://wyome.com/index.php?module=articles&func=display&ptid=10&catid=29-31&aid=507Sun, 22 Jan 2006 19:23:31 +0000Quick lookup is a very nice little reference tool for lookups of web development documentation. It installs as a simple bookmark which can be changed to your sidebar for look ups of php / css / javascript / mysql documentation. It has a limited scope of features (which isn't a bad thing in my mind):

-

* Multiple tabs
-* PHP / MySQL / CSS / JS reference (MySQL is 55% complete)
-* Examples
-* Search as you type
-* Fast results
-* Remembers your last tab on your revisit
-* Access keys, [alt + (p, m, j, c)]
-

-

I did a cursory install, and it appears to be pretty fast. I think it might be better as part of the Web Developer Extension for Firefox, but as is, I can see the uses.

- ]]>
mysql_real_escape_string() versus Prepared Statements - Ilia Alshanetskyhttp://ilia.ws/archives/103-mysql_real_escape_string-versus-Prepared-Statements.htmlSun, 22 Jan 2006 18:03:59 +0000Chris has written a compelling piece about how the use of addslashes() for string escaping in MySQL queries can lead to SQL injection through the abuse of multibyte character sets. In his example he relies on addslashes() to convert an invalid multibyte sequence into a valid one, which also has an embedded ' that is not escaped. And in an ironic twist, the function intended to protect against SQL injection is used to actually trigger it.

-The problem demonstrated, actually goes a bit further, which even makes the prescribed escaping mechanism, mysql_real_escape_string() prone to the same kind of issues affecting addslashes(). The main advantage of the mysql_real_escape_string() over addslashes() lies in the fact that it takes character set into account and thus is able to determine how to properly escape the data. For example, if GBK character set is being used, it will not convert an invalid multibyte sequence 0xbf27 (¿’) into 0xbf5c27 (¿\’ or in GBK a single valid multibyte character followed by a single quote). To determine the proper escaping methodology mysql_real_escape_string() needs to know the character set used, which is normally retrieved from the database connection cursor. Herein lies the “trick”. In MySQL there are two ways to change the character set, you can do it by changing in MySQL configuration file (my.cnf) by doing:

CODE:
[client]
-default-character-set=GBK


-Or you can change on a per-connection basis, which is a common practice done by people without admin level access to the server via the following query:

CODE:
SET CHARACTER SET 'GBK'


-The problem with the latter, is that while it most certainly modified the charset it didnÂ’t let the escaping facilities know about it. Which means that mysql_real_escape_string() still works on the basis of the default charset, which if set to latin1 (common default) will make the function work in a manner identical to addslashes() for our purposes. Another word, 0xbf27 will be converted to 0xbf5c27 facilitating the SQL injection. Here is a brief proof of concept.

PHP:

<?php

-$c 
= mysql_connect("localhost", "user", "pass");
mysql_select_db("database", $c);

// change our character set
mysql_query("SET CHARACTER SET 'gbk'", $c);

// create demo table
mysql_query("CREATE TABLE users (
-    username VARCHAR(32) PRIMARY KEY,
-    password VARCHAR(32)
-) CHARACTER SET 'GBK'"
, $c);
mysql_query("INSERT INTO users VALUES('foo','bar'), ('baz','test')", $c);

// now the exploit code
$_POST['username'] = chr(0xbf) . chr(0x27) . ' OR username = username /*'; 
$_POST['password'] = 'anything'; 

Truncated by Planet PHP, read more at the original (another 2694 bytes)

]]>
The addslashes() Versus mysql_real_escape_string() Debate - Chris Shifletthttp://shiflett.org/archive/184Sun, 22 Jan 2006 04:15:58 +0000Last month, I discussed Google's XSS Vulnerability and provided an example that demonstrates it. I was hoping to highlight why character encoding consistency is important, but apparently the addslashes() versus mysql_real_escape_string() debate continues. Demonstrating Google's XSS vulnerability was pretty easy. Demonstrating an SQL injection attack that is immune to addslashes() is a bit more involved, but still pretty straightforward.

-

In GBK, 0xbf27 is not a valid multi-byte character, but 0xbf5c is. Interpreted as single-byte characters, 0xbf27 is 0xbf (¿) followed by 0x27 ('), and 0xbf5c is 0xbf (¿) followed by 0x5c (\).

-

How does this help? If I want to attempt an SQL injection attack against a MySQL database, having single quotes escaped with a backslash is a bummer. If you're using addslashes(), however, I'm in luck. All I need to do is inject something like 0xbf27, and addslashes() modifies this to become 0xbf5c27, a valid multi-byte character followed by a single quote. In other words, I can successfully inject a single quote despite your escaping. That's because 0xbf5c is considered to be a single character, not two. Oops, there goes the backslash.

-

I'm going to use MySQL 5.0 and PHP's mysqli extension for this demonstration. If you want to try this yourself, make sure you're using GBK. I just changed /etc/my.cnf, but that's because I'm testing locally:

-
[client]
-default-character-set=GBK
-

Create a table called users:

-
CREATE TABLE users
-(
-    username VARCHAR(32) CHARACTER SET GBK,
-    password VARCHAR(32) CHARACTER SET GBK,
-    PRIMARY KEY (username)
-);
-
-

The following script mimics a situation where only addslashes() is used to escape the data being used in a query:

-
<?php 

$mysql 
= array();

$db = mysqli_init();
$db->real_connect('localhost', 'myuser', 'mypass', 'mydb');

$_POST['username'] = chr(0xbf) .
                     
chr(0x27) .
                     
' OR username = username /*';
$_POST['password'] = 'guess';

$mysql['username'] = addslashes($_POST['username']);
$mysql['password'] = addslashes($_POST

Truncated by Planet PHP, read more at the original (another 4165 bytes)

]]>
PHP Conferences - Jason E. Sweathttp://blog.casey-sweat.us/?p=69Sun, 22 Jan 2006 04:04:14 +0000Back from Norway - Tobias Schlitthttp://www.schlitt.info/applications/blog/index.php?/archives/407-Back-from-Norway.htmlSun, 22 Jan 2006 00:30:57 +0000Norway is a somewhat strange country. When I got there - 2 weeks ago to work with Amos, Derick, Fred and Ray on the eZ components - it had the expected amount of snow. A few days later, there was nothing anymore. We had positive celsius values and the weather was really crappy... until Monday. Since then it has been snowing all the time and yesterday we left when it looked like this:

- -

pict1285.jpg

- -

Nice to watch, but not real fun to walk onto. :) Anyway, it's been another great stay in Skien, where the eZ headquarter is and I'm pretty much looking forward to our summer conference, where we plan to have the complete eZ team there and lots of people from the PHP world. Thanks for the great time, folks!

- - ]]>
Solar 0.10.0 Released - Paul M. Joneshttp://paul-m-jones.com/blog/?p=192Sat, 21 Jan 2006 21:44:43 +0000
diff --git a/test/_files/RssTestSlashdot.xml b/test/_files/RssTestSlashdot.xml deleted file mode 100644 index 2ae85d9a..00000000 --- a/test/_files/RssTestSlashdot.xml +++ /dev/null @@ -1,178 +0,0 @@ - - - - Slashdot - http://slashdot.org/ - News for nerds, stuff that matters - en-us - Copyright 1997-2005, OSTG - Open Source Technology Group, Inc. All Rights Reserved. - 2006-01-23T20:11:00+00:00 - OSTG - pater@slashdot.org - Technology - hourly - 1 - 1970-01-01T00:00+00:00 - - - - - - - - - - - - - - - - - - - Slashdot - http://images.slashdot.org/topics/topicslashdot.gif - http://slashdot.org/ - - - Interview with Mark Spencer of Asterisk - http://rss.slashdot.org/Slashdot/slashdot?m=3264 - comforteagle writes "OSDir has published an interview with Mark Spencer of Asterisk and Gaim about why and how he got started coding up the software platform PBX system and how it has become much more than -just- another phone system. He also shares his insights for the opportunities within the telecom industry for open source."<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3264"/> - ScuttleMonkey - 2006-01-23T19:47:00+00:00 - communications - ripe-for-open-source - mainpage - 15 - 15,13,11,6,2,1,1 - http://slashdot.org/article.pl?sid=06/01/23/1517205&from=rss - - - The Adobe Photoshop Elements Crafts Book - http://rss.slashdot.org/Slashdot/slashdot?m=3263 - Sdurham writes "Adobe Photoshop and its many siblings have long been a staple of artists, photographers, and programmers interested in doing serious image manipulation. Increasingly, Photoshop's younger sister Photoshop Elements comes prepackaged with digital cameras. Yet many of the users of these cameras lack the time or patience to tackle the steep learning curve of the Photoshop family and are left asking "How do I do ... ?". Elizabeth Bulger's The Adobe Photoshop Elements Crafts Book attempts to bridge the gap between Photoshop skill level and personal creativity by stepping the reader through 14 different craft projects. In doing so, Bulger tries to provide the basic Photoshop Elements skills necessary for readers to pursue their own projects after finishing the book." Read the rest of Sdurham's review.<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3263"/> - samzenpus - 2006-01-23T18:54:00+00:00 - books - update-your-prom-pictures - books - 18 - 18,15,9,5,3,1,0 - http://books.slashdot.org/article.pl?sid=06/01/23/1411250&from=rss - - - Supreme Court spurns RIM - http://rss.slashdot.org/Slashdot/slashdot?m=3262 - l2718 writes "NTP has just won the latest round in its court battle against Research in Motion (makers of the Blackberry). Today's Order List from the US Supreme Court includes a denial of certiorary for RIM's appeal. This follows the Circuit Court of Appeals' denial of review en banc we have covered previously. As sometimes happens, the court nevertheless accepted amicus curiae briefs from several groups, including Intel and the Canadian government." The potential impact of this may mean the shutdown of Blackberry's network. I hope the crackberry addicts have lots of methadone onhand. -<p><a href="http://rss.slashdot.org/~c/Slashdot/slashdot?a=fYMCju"><img src="http://rss.slashdot.org/~c/Slashdot/slashdot?i=fYMCju" border="0"></img></a></p><img src="http://rss.slashdot.org/Slashdot/slashdot?g=3262"/> - Hemos - 2006-01-23T18:22:00+00:00 - patents - good-bye-black-berry - yro - 138 - 138,131,116,73,15,9,5 - http://yro.slashdot.org/article.pl?sid=06/01/23/1744258&from=rss - - - Adult Entertainment Antes Up In DRM War - http://rss.slashdot.org/Slashdot/slashdot?m=3261 - At the recent adult entertainment awards, host Greg Fitzsimmons highlighted the deep relationship between the internet and pornography stating "'The Internet was completely funded by porn,' he said [...] And if it wasn't for the Internet, he added, 'you guys would be completely out of business.' The audience, packed with porn actors and adult entertainment moguls like Jenna Jameson and Larry Flynt, roared with laughter." Now it appears that the adult entertainment industry has chosen to ante up in the DRM battle as well. Some companies have chosen to take sides, like Digital Playground who will be supporting Sony's Blu-Ray. Others, like Vivid Entertainment, seem to think that the answer is diversity and will be supporting both Blu-Ray and HD-DVD.<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3261"/> - ScuttleMonkey - 2006-01-23T17:37:00+00:00 - media - can't-we-all-just-get-along - hardware - 152 - 152,146,124,84,34,17,12 - http://hardware.slashdot.org/article.pl?sid=06/01/23/1544235&from=rss - - - Slashdot Index Code Update - http://rss.slashdot.org/Slashdot/slashdot?m=3259 - For years now Slashdot has posted what we call "Sectional Content". That is to say, stories that we think are good, but since we try to keep the Slashdot Main Page to around 15 stories per day, some stuff just gets put into the sections. This content is mostly lost to readers who simply don't know it exists. Today we're deploying new code to help you find that content (and alternatively, to disable it).<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3259"/> - CmdrTaco - 2006-01-23T17:00:00+00:00 - slashdot - zomg-you-got-some-ajax-in-our-ui - mainpage - 247 - 247,231,192,142,41,21,14 - http://slashdot.org/article.pl?sid=06/01/19/175253&from=rss - - - IE7 Leaked - http://rss.slashdot.org/Slashdot/slashdot?m=3260 - lju writes "IE7 has been leaked according to pcpro. From the article: '...last Friday it was revealed that a build of the new browser - version 5299 - along with numerous screenshots, was available online.' " -<p><a href="http://rss.slashdot.org/~c/Slashdot/slashdot?a=jVTbOh"><img src="http://rss.slashdot.org/~c/Slashdot/slashdot?i=jVTbOh" border="0"></img></a></p><img src="http://rss.slashdot.org/Slashdot/slashdot?g=3260"/> - CmdrTaco - 2006-01-23T16:41:00+00:00 - microsoft - hate-when-that-happens - it - 265 - 265,257,202,137,52,31,19 - http://it.slashdot.org/article.pl?sid=06/01/23/152211&from=rss - - - The Future of e-Commerce and e-Information? - http://rss.slashdot.org/Slashdot/slashdot?m=3257 - An anonymous reader writes "The Washington Post has an interesting article on what they label 'The Coming Tug of War Over the Internet. From the article: 'Do you prefer to search for information online with Google or Yahoo? What about bargain shopping -- do you go to Amazon or eBay? Many of us make these kinds of decisions several times a day, based on who knows what -- maybe you don't like bidding, or maybe Google's clean white search page suits you better than Yahoo's colorful clutter. But the nation's largest telephone companies have a new business plan, and if it comes to pass you may one day discover that Yahoo suddenly responds much faster to your inquiries, overriding your affinity for Google. Or that Amazon's Web site seems sluggish compared with eBay's.'" Seems like the idea of the 2-tier internet is really catching on with the market-droids.<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3257"/> - ScuttleMonkey - 2006-01-23T15:46:00+00:00 - biz - bad-for-the-internet-good-for-business - yro - 159 - 159,157,140,90,25,16,10 - http://yro.slashdot.org/article.pl?sid=06/01/23/1450249&from=rss - - - MacWorld MacBook Only a Prototype? - http://rss.slashdot.org/Slashdot/slashdot?m=3256 - mahju writes "Hard Mac is reporting that Apple's, unoffical, response in Paris to the the lack of information on battery life, is that the MacBook Pro that were demoed at Mac World SF are only prototypes and the final versions are still under development. " -<p><a href="http://rss.slashdot.org/~c/Slashdot/slashdot?a=qEOB5Q"><img src="http://rss.slashdot.org/~c/Slashdot/slashdot?i=qEOB5Q" border="0"></img></a></p><img src="http://rss.slashdot.org/Slashdot/slashdot?g=3256"/> - CmdrTaco - 2006-01-23T14:12:00+00:00 - intel - well-thats-not-surprising - apple - 160 - 160,150,136,102,35,21,14 - http://apple.slashdot.org/article.pl?sid=06/01/23/1333220&from=rss - - - Has Microsoft 'Solved' Spam? - http://rss.slashdot.org/Slashdot/slashdot?m=3254 - MsWillow writes to tell us the Seattle PI is running a story looking back at Bill Gates promise to have the spam problem "solved" in two years. Well, it looks like time is up, and the verdict is -- an emphatic "maybe". From the article: "Microsoft says it sees things differently. To "solve" the problem for consumers in the short run doesn't require eliminating spam entirely, said Ryan Hamlin, the general manager who oversees the company's anti-spam programs. Rather, he said, the idea is to contain it to the point that its impact on in-boxes is minor. In that way, Hamlin said, Gates' prediction has come true for people using the right tactics and advanced filtering technology."<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3254"/> - ScuttleMonkey - 2006-01-23T13:37:00+00:00 - spam - depends-on-your-definition-of-solved - it - 283 - 283,277,240,152,57,27,15 - http://it.slashdot.org/article.pl?sid=06/01/23/0340241&from=rss - - - World of Warcraft AQ Gates Open! - http://rss.slashdot.org/Slashdot/slashdot?m=3255 - Tayman writes "Wow...who didn't see this one coming? The players on the World of Warcraft Medivh server opened the gates to AQ. What happened next? The server crashed repeatedly. Why create content the servers can't handle? The very first time I read about this patch, I knew the servers would crash. The more people who open the gates, the more angry customers Blizzard will have in my opinion. With 5million+ subscribers, you would think Blizzard would have the best servers/connection money can buy. Although, I'm sure it's more complicated than simply plugging in a few ram chips and faster processors though. Most of the people involved in the raid are having a great time though. Could this be the most epic battle ever introduced to the mmorpg market? All signs point to yes. Let's see how long the mobs will respawn. Hopefully, the people of the Medivh server haven't seen anything yet. Either way, I would hate to be a network admin for Blizzard atm. ^_^ Here are some pics of the event. Thanks go out to all of those who took these pics. World of Warcraft AQ Pics Check out MMORPG Veteran to keep up with the events as they unfold." Update: 01/23 13:44 GMT by Z : Additionally, brandor wrote in with a link to some video of the event.<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3255"/> - Hemos - 2006-01-23T13:33:00+00:00 - rpg - of-course-it-will-blow-up - games - 330 - 330,313,258,158,46,27,20 - http://games.slashdot.org/article.pl?sid=06/01/23/1244201&from=rss - - - Search Slashdot - Search Slashdot stories - query - http://slashdot.org/search.pl - - - diff --git a/test/_files/TestAtomFeed.xml b/test/_files/TestAtomFeed.xml deleted file mode 100644 index 69afce7a..00000000 --- a/test/_files/TestAtomFeed.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - Atom Example - This is a simple Atom Feed made by XML_Feed_Writer. - - - - 4 - 3 - 2 - 2005-04-25T00:00:00+02:00 - - 1 - - The Item Title - 2004-09-25T16:03:00+02:00 - 2005-12-25T16:03:00+01:00 - - David Coallier - - Testing something before releasing - - - 2 - - Second item added to the builder/feeded.. - 2004-01-04T00:00:00+01:00 - 1970-01-01T01:00:00+01:00 - - David Coallier - - Jaws project, visit the website for infos... - - diff --git a/test/_files/TestAtomFeedEntryOnly.xml b/test/_files/TestAtomFeedEntryOnly.xml deleted file mode 100644 index 9088137d..00000000 --- a/test/_files/TestAtomFeedEntryOnly.xml +++ /dev/null @@ -1 +0,0 @@ -1Bug1BuggyLong time debugging2005-09-152005-09-18RESOLVEDnormalP2FIXEDexample@example.comThe bug has been fixed. diff --git a/test/_files/TestAtomFeedNamespaced.xml b/test/_files/TestAtomFeedNamespaced.xml deleted file mode 100644 index 02d0ee25..00000000 --- a/test/_files/TestAtomFeedNamespaced.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - Atom Example - This is a simple Atom Feed made by XML_Feed_Writer. - - - - 4 - 3 - 2 - 2005-04-25T00:00:00+02:00 - - 1 - - The Item Title - 2004-09-25T16:03:00+02:00 - 2005-12-25T16:03:00+01:00 - - David Coallier - - Testing something before releasing - - - 2 - - Second item added to the builder/feeded.. - 2004-01-04T00:00:00+01:00 - 1970-01-01T01:00:00+01:00 - - David Coallier - - Jaws project, visit the website for infos... - - diff --git a/test/_files/TestFeedEntryRssContentEncoded.xml b/test/_files/TestFeedEntryRssContentEncoded.xml deleted file mode 100644 index baa70a73..00000000 --- a/test/_files/TestFeedEntryRssContentEncoded.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - Zend Framework IT - http://www.zend-framework.it - Just another Zend Framework (Italian) weblog. - Sun, 03 Feb 2008 21:07:35 +0000 - http://wordpress.org/?v=2.3.1 - en - - Zend_Service_Technorati promosso in Core - http://www.zend-framework.it/2008/02/03/zend_service_technorati-promosso-in-core/ - http://www.zend-framework.it/2008/02/03/zend_service_technorati-promosso-in-core/#comments - Sun, 03 Feb 2008 21:06:15 +0000 - weppos - - - - - http://www.zend-framework.it/2008/02/03/zend_service_technorati-promosso-in-core/ - - Il commit r7757 ha ufficialmente decretato la promozione nella core library di un componente al quale sono molto affezionato: Zend_Service_Technorati.
-Non solo si tratta della prima libreria completamente proposta e sviluppata dal sottoscritto, ma è anche un lavoro che mi ha visto occupato per diversi giorni nel tentativo di risolvere i vari problemi di inconsistenza delle API di Technorati, come dimostra il ticket #ZF-2334. (more…)

-]]>
- http://www.zend-framework.it/2008/02/03/zend_service_technorati-promosso-in-core/feed/ -
- - Proposta per la struttura predefinita di un nuovo progetto Zend Framework - http://www.zend-framework.it/2008/02/02/proposta-per-la-struttura-predefinita-di-un-nuovo-progetto-zend-framework/ - http://www.zend-framework.it/2008/02/02/proposta-per-la-struttura-predefinita-di-un-nuovo-progetto-zend-framework/#comments - Sat, 02 Feb 2008 14:21:15 +0000 - weppos - - - http://www.zend-framework.it/2008/02/02/proposta-per-la-struttura-predefinita-di-un-nuovo-progetto-zend-framework/ - - - http://www.zend-framework.it/2008/02/02/proposta-per-la-struttura-predefinita-di-un-nuovo-progetto-zend-framework/feed/ - - - Installare Zend Framework via PEAR - http://www.zend-framework.it/2008/01/29/installare-zend-framework-via-pear/ - http://www.zend-framework.it/2008/01/29/installare-zend-framework-via-pear/#comments - Tue, 29 Jan 2008 08:42:37 +0000 - weppos - - - - http://www.zend-framework.it/2008/01/29/installare-zend-framework-via-pear/ - - Introduzione a PEAR -

Chiunque programmi in PHP avrà sentito parlare, prima o poi, di PEAR.
-PEAR è un enorme repository di librerie PHP. Vi si trovano applicazioni complete, librerie complete ma, ahimè, anche molti componenti abbandonati sul nascere.

-

PEAR offre un eccellente sistema di packaging che consente di installare facilmente una libreria parte del repository ufficiale o una qualsiasi libreria su un altro repository che sia compatibile con gli standard definiti.
-Per chi programma in altri linguaggi, questo sistema è molto simile al concetto di GEM in Ruby o ai moduli di PERL. (more…)

-]]>
- http://www.zend-framework.it/2008/01/29/installare-zend-framework-via-pear/feed/ -
-
-
diff --git a/test/_files/htmlPage.html b/test/_files/htmlPage.html deleted file mode 100644 index 467d534d..00000000 --- a/test/_files/htmlPage.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - Blog - - - - - - - - From d491f984b80ad44d4946263552815b18982fcc03 Mon Sep 17 00:00:00 2001 From: Padraic Brady Date: Mon, 7 Jun 2010 00:21:06 +0100 Subject: [PATCH 138/238] First pass on majority namespacing - excl non-Atom extension --- ...ionAbstract.php => AbstractCollection.php} | 2 +- src/Reader/Collection/Author.php | 20 +- src/Reader/Collection/Category.php | 20 +- src/Reader/{ => Collection}/Collection.php | 17 +- src/Reader/{EntryInterface.php => Entry.php} | 17 +- .../AbstractEntry.php} | 43 ++-- src/Reader/Entry/Atom.php | 64 +++--- src/Reader/Entry/Rss.php | 172 +++++++--------- .../{EntryAbstract.php => AbstractEntry.php} | 43 ++-- .../{FeedAbstract.php => AbstractFeed.php} | 48 ++--- src/Reader/Extension/Atom/Entry.php | 123 +++++------- src/Reader/Extension/Atom/Feed.php | 111 +++++----- src/Reader/{FeedInterface.php => Feed.php} | 19 +- .../AbstractFeed.php} | 50 +++-- src/Reader/Feed/Atom.php | 52 ++--- src/Reader/Feed/Atom/Source.php | 39 ++-- src/Reader/Feed/Rss.php | 169 +++++++--------- src/Reader/FeedSet.php | 36 ++-- src/{ => Reader}/Reader.php | 190 +++++++----------- 19 files changed, 566 insertions(+), 669 deletions(-) rename src/Reader/Collection/{CollectionAbstract.php => AbstractCollection.php} (94%) rename src/Reader/{ => Collection}/Collection.php (72%) rename src/Reader/{EntryInterface.php => Entry.php} (91%) rename src/Reader/{EntryAbstract.php => Entry/AbstractEntry.php} (81%) rename src/Reader/Extension/{EntryAbstract.php => AbstractEntry.php} (77%) rename src/Reader/Extension/{FeedAbstract.php => AbstractFeed.php} (77%) rename src/Reader/{FeedInterface.php => Feed.php} (87%) rename src/Reader/{FeedAbstract.php => Feed/AbstractFeed.php} (82%) rename src/{ => Reader}/Reader.php (77%) diff --git a/src/Reader/Collection/CollectionAbstract.php b/src/Reader/Collection/AbstractCollection.php similarity index 94% rename from src/Reader/Collection/CollectionAbstract.php rename to src/Reader/Collection/AbstractCollection.php index 7b6dbd03..ec54fe7e 100644 --- a/src/Reader/Collection/CollectionAbstract.php +++ b/src/Reader/Collection/AbstractCollection.php @@ -25,7 +25,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class Zend_Feed_Reader_Collection_CollectionAbstract extends ArrayObject +abstract class AbstractCollection extends \ArrayObject { /** diff --git a/src/Reader/Collection/Author.php b/src/Reader/Collection/Author.php index 98a8aea2..979349bb 100644 --- a/src/Reader/Collection/Author.php +++ b/src/Reader/Collection/Author.php @@ -20,18 +20,18 @@ */ /** - * @see Zend_Feed_Reader_Collection_CollectionAbstract - */ -require_once 'Zend/Feed/Reader/Collection/CollectionAbstract.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Collection; /** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Feed_Reader_Collection_Author -extends Zend_Feed_Reader_Collection_CollectionAbstract +* @uses \Zend\Feed\Reader\Collection\AbstractCollection +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Author extends AbstractCollection { /** diff --git a/src/Reader/Collection/Category.php b/src/Reader/Collection/Category.php index f7230af9..fd172c03 100644 --- a/src/Reader/Collection/Category.php +++ b/src/Reader/Collection/Category.php @@ -20,18 +20,18 @@ */ /** - * @see Zend_Feed_Reader_Collection_CollectionAbstract - */ -require_once 'Zend/Feed/Reader/Collection/CollectionAbstract.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Collection; /** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Feed_Reader_Collection_Category -extends Zend_Feed_Reader_Collection_CollectionAbstract +* @uses \Zend\Feed\Reader\Collection\CollectionAbstract +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Category extends AbstractCollection { /** diff --git a/src/Reader/Collection.php b/src/Reader/Collection/Collection.php similarity index 72% rename from src/Reader/Collection.php rename to src/Reader/Collection/Collection.php index 64af8483..7d024aed 100644 --- a/src/Reader/Collection.php +++ b/src/Reader/Collection/Collection.php @@ -20,12 +20,17 @@ */ /** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Feed_Reader_Collection extends ArrayObject +* @namespace +*/ +namespace Zend\Feed\Reader\Collection; + +/** +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Collection extends \ArrayObject { diff --git a/src/Reader/EntryInterface.php b/src/Reader/Entry.php similarity index 91% rename from src/Reader/EntryInterface.php rename to src/Reader/Entry.php index 392a533a..753db670 100644 --- a/src/Reader/EntryInterface.php +++ b/src/Reader/Entry.php @@ -20,12 +20,17 @@ */ /** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -interface Zend_Feed_Reader_EntryInterface +* @namespace +*/ +namespace Zend\Feed\Reader; + +/** +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +interface Entry { /** * Get the specified author diff --git a/src/Reader/EntryAbstract.php b/src/Reader/Entry/AbstractEntry.php similarity index 81% rename from src/Reader/EntryAbstract.php rename to src/Reader/Entry/AbstractEntry.php index 193bb65c..fb950743 100644 --- a/src/Reader/EntryAbstract.php +++ b/src/Reader/Entry/AbstractEntry.php @@ -18,14 +18,22 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: EntryAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $ */ + +/** +* @namespace +*/ +namespace Zend\Feed\Reader\Entry; +use Zend\Feed\Reader; /** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -abstract class Zend_Feed_Reader_EntryAbstract +* @uses \Zend\Feed\Reader\Exception +* @uses \Zend\Feed\Reader\Reader +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +abstract class AbstractEntry { /** * Feed entry data @@ -37,7 +45,7 @@ abstract class Zend_Feed_Reader_EntryAbstract /** * DOM document object * - * @var DOMDocument + * @var \DOMDocument */ protected $_domDocument = null; @@ -77,7 +85,7 @@ abstract class Zend_Feed_Reader_EntryAbstract * @param string $type * @return void */ - public function __construct(DOMElement $entry, $entryKey, $type = null) + public function __construct(\DOMElement $entry, $entryKey, $type = null) { $this->_entry = $entry; $this->_entryKey = $entryKey; @@ -85,7 +93,7 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) if ($type !== null) { $this->_data['type'] = $type; } else { - $this->_data['type'] = Zend_Feed_Reader::detectType($feed); + $this->_data['type'] = Reader\Reader::detectType($feed); } $this->_loadExtensions(); } @@ -131,7 +139,7 @@ public function getEncoding() */ public function saveXml() { - $dom = new DOMDocument('1.0', $this->getEncoding()); + $dom = new \DOMDocument('1.0', $this->getEncoding()); $entry = $dom->importNode($this->getElement(), true); $dom->appendChild($entry); return $dom->saveXml(); @@ -155,7 +163,7 @@ public function getType() public function getXpath() { if (!$this->_xpath) { - $this->setXpath(new DOMXPath($this->getDomDocument())); + $this->setXpath(new \DOMXPath($this->getDomDocument())); } return $this->_xpath; } @@ -166,7 +174,7 @@ public function getXpath() * @param DOMXPath $xpath * @return Zend_Feed_Reader_Entry_EntryAbstract */ - public function setXpath(DOMXPath $xpath) + public function setXpath(\DOMXPath $xpath) { $this->_xpath = $xpath; return $this; @@ -190,8 +198,8 @@ public function getExtensions() */ public function getExtension($name) { - if (array_key_exists($name . '_Entry', $this->_extensions)) { - return $this->_extensions[$name . '_Entry']; + if (array_key_exists($name . '\\Entry', $this->_extensions)) { + return $this->_extensions[$name . '\\Entry']; } return null; } @@ -211,8 +219,7 @@ public function __call($method, $args) return call_user_func_array(array($extension, $method), $args); } } - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Method: ' . $method + throw new Exception('Method: ' . $method . 'does not exist and could not be located on a registered Extension'); } @@ -223,13 +230,13 @@ public function __call($method, $args) */ protected function _loadExtensions() { - $all = Zend_Feed_Reader::getExtensions(); + $all = Reader\Reader::getExtensions(); $feed = $all['entry']; foreach ($feed as $extension) { if (in_array($extension, $all['core'])) { continue; } - $className = Zend_Feed_Reader::getPluginLoader()->getClassName($extension); + $className = Reader\Reader::getPluginLoader()->getClassName($extension); $this->_extensions[$extension] = new $className( $this->getElement(), $this->_entryKey, $this->_data['type'] ); diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index 308deba5..9169f14d 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -13,39 +13,29 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_Feed_Reader + * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Atom.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_Feed_Reader_EntryInterface - */ -require_once 'Zend/Feed/Reader/EntryInterface.php'; - -/** - * @see Zend_Feed_Reader_EntryAbstract - */ -require_once 'Zend/Feed/Reader/EntryAbstract.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Entry; +use Zend\Feed\Reader; /** - * @see Zend_Feed_Reader_Extension_Atom_Entry - */ -require_once 'Zend/Feed/Reader/Extension/Atom/Entry.php'; - -/** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Feed_Reader_Entry_Atom extends Zend_Feed_Reader_EntryAbstract implements Zend_Feed_Reader_EntryInterface +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Entry\AbstractEntry +* @uses \Zend\Feed\Reader\Entry +* @uses \Zend\Feed\Reader\Extension\Atom\Entry +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Atom extends AbstractEntry implements Reader\Entry { /** * XPath query @@ -62,21 +52,21 @@ class Zend_Feed_Reader_Entry_Atom extends Zend_Feed_Reader_EntryAbstract impleme * @param string $type * @return void */ - public function __construct(DOMElement $entry, $entryKey, $type = null) + public function __construct(\DOMElement $entry, $entryKey, $type = null) { parent::__construct($entry, $entryKey, $type); // Everyone by now should know XPath indices start from 1 not 0 $this->_xpathQuery = '//atom:entry[' . ($this->_entryKey + 1) . ']'; - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Entry'); - $this->_extensions['Atom_Entry'] = new $atomClass($entry, $entryKey, $type); + $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\\Entry'); + $this->_extensions['Atom\\Entry'] = new $atomClass($entry, $entryKey, $type); - $threadClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Thread_Entry'); - $this->_extensions['Thread_Entry'] = new $threadClass($entry, $entryKey, $type); + $threadClass = Reader\Reader::getPluginLoader()->getClassName('Thread\\Entry'); + $this->_extensions['Thread\\Entry'] = new $threadClass($entry, $entryKey, $type); - $threadClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Entry'); - $this->_extensions['DublinCore_Entry'] = new $threadClass($entry, $entryKey, $type); + $threadClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\\Entry'); + $this->_extensions['DublinCore\\Entry'] = new $threadClass($entry, $entryKey, $type); } /** @@ -346,9 +336,9 @@ public function getCommentFeedLink() } /** - * Get category data as a Zend_Feed_Reader_Collection_Category object + * Get category data as a Reader\Reader_Collection_Category object * - * @return Zend_Feed_Reader_Collection_Category + * @return Reader\Reader_Collection_Category */ public function getCategories() { @@ -370,7 +360,7 @@ public function getCategories() /** * Get source feed metadata from the entry * - * @return Zend_Feed_Reader_Feed_Atom_Source|null + * @return Reader\Reader_Feed_Atom_Source|null */ public function getSource() { @@ -388,9 +378,9 @@ public function getSource() /** * Set the XPath query (incl. on all Extensions) * - * @param DOMXPath $xpath + * @param \DOMXPath $xpath */ - public function setXpath(DOMXPath $xpath) + public function setXpath(\DOMXPath $xpath) { parent::setXpath($xpath); foreach ($this->_extensions as $extension) { diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index 4a9d3ab2..ed4b3b0f 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -13,74 +13,38 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_Feed_Reader + * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Rss.php 22300 2010-05-26 10:13:34Z padraic $ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_Feed_Reader_EntryInterface - */ -require_once 'Zend/Feed/Reader/EntryInterface.php'; - -/** - * @see Zend_Feed_Reader_EntryAbstract - */ -require_once 'Zend/Feed/Reader/EntryAbstract.php'; - -/** - * @see Zend_Feed_Reader_Extension_DublinCore_Entry - */ -require_once 'Zend/Feed/Reader/Extension/DublinCore/Entry.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Entry; +use Zend\Feed\Reader; +use Zend\Date; /** - * @see Zend_Feed_Reader_Extension_Content_Entry - */ -require_once 'Zend/Feed/Reader/Extension/Content/Entry.php'; - -/** - * @see Zend_Feed_Reader_Extension_Atom_Entry - */ -require_once 'Zend/Feed/Reader/Extension/Atom/Entry.php'; - -/** - * @see Zend_Feed_Reader_Extension_WellformedWeb_Entry - */ -require_once 'Zend/Feed/Reader/Extension/WellFormedWeb/Entry.php'; - -/** - * @see Zend_Feed_Reader_Extension_Slash_Entry - */ -require_once 'Zend/Feed/Reader/Extension/Slash/Entry.php'; - -/** - * @see Zend_Feed_Reader_Extension_Thread_Entry - */ -require_once 'Zend/Feed/Reader/Extension/Thread/Entry.php'; - -/** - * @see Zend_Date - */ -require_once 'Zend/Date.php'; - -/** - * @see Zend_Feed_Reader_Collection_Category - */ -require_once 'Zend/Feed/Reader/Collection/Category.php'; - -/** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_EntryAbstract implements Zend_Feed_Reader_EntryInterface +* @uses \Zend\Date\Date +* @uses \Zend\Feed\Exception +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Collection\Category +* @uses \Zend\Feed\Reader\EntryAbstract +* @uses \Zend\Feed\Reader\EntryInterface +* @uses \Zend\Feed\Reader\Extension\Atom\Entry +* @uses \Zend\Feed\Reader\Extension\Content\Entry +* @uses \Zend\Feed\Reader\Extension\DublinCore\Entry +* @uses \Zend\Feed\Reader\Extension\Slash\Entry +* @uses \Zend\Feed\Reader\Extension\Thread\Entry +* @uses \Zend\Feed\Reader\Extension\WellformedWeb\Entry +* @category Zend +* @package Reader\Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Rss extends AbstractEntry implements Reader\Entry { /** @@ -105,31 +69,31 @@ class Zend_Feed_Reader_Entry_Rss extends Zend_Feed_Reader_EntryAbstract implemen * @param string $type * @return void */ - public function __construct(DOMElement $entry, $entryKey, $type = null) + public function __construct(\DOMElement $entry, $entryKey, $type = null) { parent::__construct($entry, $entryKey, $type); $this->_xpathQueryRss = '//item[' . ($this->_entryKey+1) . ']'; $this->_xpathQueryRdf = '//rss:item[' . ($this->_entryKey+1) . ']'; - $pluginLoader = Zend_Feed_Reader::getPluginLoader(); + $pluginLoader = Reader\Reader::getPluginLoader(); - $dublinCoreClass = $pluginLoader->getClassName('DublinCore_Entry'); - $this->_extensions['DublinCore_Entry'] = new $dublinCoreClass($entry, $entryKey, $type); + $dublinCoreClass = $pluginLoader->getClassName('DublinCore\\Entry'); + $this->_extensions['DublinCore\\Entry'] = new $dublinCoreClass($entry, $entryKey, $type); - $contentClass = $pluginLoader->getClassName('Content_Entry'); - $this->_extensions['Content_Entry'] = new $contentClass($entry, $entryKey, $type); + $contentClass = $pluginLoader->getClassName('Content\\Entry'); + $this->_extensions['Content\\Entry'] = new $contentClass($entry, $entryKey, $type); - $atomClass = $pluginLoader->getClassName('Atom_Entry'); - $this->_extensions['Atom_Entry'] = new $atomClass($entry, $entryKey, $type); + $atomClass = $pluginLoader->getClassName('Atom\\Entry'); + $this->_extensions['Atom\\Entry'] = new $atomClass($entry, $entryKey, $type); - $wfwClass = $pluginLoader->getClassName('WellFormedWeb_Entry'); - $this->_extensions['WellFormedWeb_Entry'] = new $wfwClass($entry, $entryKey, $type); + $wfwClass = $pluginLoader->getClassName('WellFormedWeb\\Entry'); + $this->_extensions['WellFormedWeb\\Entry'] = new $wfwClass($entry, $entryKey, $type); - $slashClass = $pluginLoader->getClassName('Slash_Entry'); - $this->_extensions['Slash_Entry'] = new $slashClass($entry, $entryKey, $type); + $slashClass = $pluginLoader->getClassName('Slash\\Entry'); + $this->_extensions['Slash\\Entry'] = new $slashClass($entry, $entryKey, $type); - $threadClass = $pluginLoader->getClassName('Thread_Entry'); - $this->_extensions['Thread_Entry'] = new $threadClass($entry, $entryKey, $type); + $threadClass = $pluginLoader->getClassName('Thread\\Entry'); + $this->_extensions['Thread\\Entry'] = new $threadClass($entry, $entryKey, $type); } /** @@ -170,8 +134,8 @@ public function getAuthors() } } - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090) { $list = $this->_xpath->query($this->_xpathQueryRss . '//author'); } else { $list = $this->_xpath->query($this->_xpathQueryRdf . '//rss:author'); @@ -196,8 +160,8 @@ public function getAuthors() if (count($authors) == 0) { $authors = $this->getExtension('Atom')->getAuthors(); } else { - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) + $authors = new Reader\Collection\Author( + Reader\Reader::arrayUnique($authors) ); } @@ -260,26 +224,26 @@ public function getDateModified() $dateModified = null; $date = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { $dateModified = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/pubDate)'); if ($dateModified) { $dateModifiedParsed = strtotime($dateModified); if ($dateModifiedParsed) { - $date = new Zend_Date($dateModifiedParsed); + $date = new Date\Date($dateModifiedParsed); } else { - $dateStandards = array(Zend_Date::RSS, Zend_Date::RFC_822, - Zend_Date::RFC_2822, Zend_Date::DATES); - $date = new Zend_Date; + $dateStandards = array(Date\Date::RSS, Date\Date::RFC_822, + Date\Date::RFC_2822, Date\Date::DATES); + $date = new Date\Date; foreach ($dateStandards as $standard) { try { $date->set($dateModified, $standard); break; - } catch (Zend_Date_Exception $e) { - if ($standard == Zend_Date::DATES) { + } catch (Date\Exception $e) { + if ($standard == Date\Date::DATES) { require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception( + throw new Exception( 'Could not load date due to unrecognised' .' format (should follow RFC 822 or 2822):' . $e->getMessage(), @@ -322,8 +286,8 @@ public function getDescription() $description = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/description)'); } else { @@ -359,7 +323,7 @@ public function getEnclosure() $enclosure = null; - if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_20) { + if ($this->getType() == Reader\Reader::TYPE_RSS_20) { $nodeList = $this->_xpath->query($this->_xpathQueryRss . '/enclosure'); if ($nodeList->length > 0) { @@ -392,8 +356,8 @@ public function getId() $id = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { $id = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/guid)'); } @@ -453,8 +417,8 @@ public function getLinks() $links = array(); - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $list = $this->_xpath->query($this->_xpathQueryRss.'//link'); } else { $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:link'); @@ -476,7 +440,7 @@ public function getLinks() /** * Get all categories * - * @return Zend_Feed_Reader_Collection_Category + * @return Reader\Reader_Collection_Category */ public function getCategories() { @@ -484,15 +448,15 @@ public function getCategories() return $this->_data['categories']; } - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $list = $this->_xpath->query($this->_xpathQueryRss.'//category'); } else { $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:category'); } if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; + $categoryCollection = new Reader\Collection\Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->nodeValue, @@ -536,8 +500,8 @@ public function getTitle() $title = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/title)'); } else { @@ -604,8 +568,8 @@ public function getCommentLink() $commentlink = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { $commentlink = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/comments)'); } @@ -656,9 +620,9 @@ public function getCommentFeedLink() /** * Set the XPath query (incl. on all Extensions) * - * @param DOMXPath $xpath + * @param \DOMXPath $xpath */ - public function setXpath(DOMXPath $xpath) + public function setXpath(\DOMXPath $xpath) { parent::setXpath($xpath); foreach ($this->_extensions as $extension) { diff --git a/src/Reader/Extension/EntryAbstract.php b/src/Reader/Extension/AbstractEntry.php similarity index 77% rename from src/Reader/Extension/EntryAbstract.php rename to src/Reader/Extension/AbstractEntry.php index 299c1bfb..cc367fe8 100644 --- a/src/Reader/Extension/EntryAbstract.php +++ b/src/Reader/Extension/AbstractEntry.php @@ -13,19 +13,26 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_Feed_Reader + * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: EntryAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -abstract class Zend_Feed_Reader_Extension_EntryAbstract +* @namespace +*/ +namespace Zend\Feed\Reader\Extension; +use Zend\Feed\Reader; + +/** +* @uses \Zend\Feed\Reader\Reader +* @category Zend +* @package Reader\Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +abstract class AbstractEntry { /** * Feed entry data @@ -77,7 +84,7 @@ abstract class Zend_Feed_Reader_Extension_EntryAbstract * @param string $type * @return void */ - public function __construct(DOMElement $entry, $entryKey, $type = null) + public function __construct(\DOMElement $entry, $entryKey, $type = null) { $this->_entry = $entry; $this->_entryKey = $entryKey; @@ -86,15 +93,15 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) if (!is_null($type)) { $this->_data['type'] = $type; } else { - $this->_data['type'] = Zend_Feed_Reader::detectType($entry->ownerDocument, true); + $this->_data['type'] = Reader\Reader::detectType($entry->ownerDocument, true); } // set the XPath query prefix for the entry being queried - if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_10 - || $this->getType() == Zend_Feed_Reader::TYPE_RSS_090 + if ($this->getType() == Reader\Reader::TYPE_RSS_10 + || $this->getType() == Reader\Reader::TYPE_RSS_090 ) { $this->setXpathPrefix('//rss:item[' . ($this->_entryKey+1) . ']'); - } elseif ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 - || $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03 + } elseif ($this->getType() == Reader\Reader::TYPE_ATOM_10 + || $this->getType() == Reader\Reader::TYPE_ATOM_03 ) { $this->setXpathPrefix('//atom:entry[' . ($this->_entryKey+1) . ']'); } else { @@ -105,7 +112,7 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) /** * Get the DOM * - * @return DOMDocument + * @return \DOMDocument */ public function getDomDocument() { @@ -137,9 +144,9 @@ public function getType() * Set the XPath query * * @param DOMXPath $xpath - * @return Zend_Feed_Reader_Extension_EntryAbstract + * @return Reader\Reader_Extension_EntryAbstract */ - public function setXpath(DOMXPath $xpath) + public function setXpath(\DOMXPath $xpath) { $this->_xpath = $xpath; $this->_registerNamespaces(); @@ -154,7 +161,7 @@ public function setXpath(DOMXPath $xpath) public function getXpath() { if (!$this->_xpath) { - $this->setXpath(new DOMXPath($this->getDomDocument())); + $this->setXpath(new \DOMXPath($this->getDomDocument())); } return $this->_xpath; } @@ -183,7 +190,7 @@ public function getXpathPrefix() * Set the XPath prefix * * @param string $prefix - * @return Zend_Feed_Reader_Extension_EntryAbstract + * @return Reader\Reader_Extension_EntryAbstract */ public function setXpathPrefix($prefix) { diff --git a/src/Reader/Extension/FeedAbstract.php b/src/Reader/Extension/AbstractFeed.php similarity index 77% rename from src/Reader/Extension/FeedAbstract.php rename to src/Reader/Extension/AbstractFeed.php index 73aa8c90..089a3acd 100644 --- a/src/Reader/Extension/FeedAbstract.php +++ b/src/Reader/Extension/AbstractFeed.php @@ -13,35 +13,29 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_Feed_Reader + * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: FeedAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_Feed_Reader_Entry_Atom - */ -require_once 'Zend/Feed/Reader/Entry/Atom.php'; - - -/** - * @see Zend_Feed_Reader_Entry_Rss - */ -require_once 'Zend/Feed/Reader/Entry/Rss.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Extension; +use Zend\Feed\Reader /** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -abstract class Zend_Feed_Reader_Extension_FeedAbstract +* @uses \DOMXPath +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Entry\Atom +* @uses \Zend\Feed\Reader\Entry\RSS +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +abstract class AbstractFeed { /** * Parsed feed data @@ -78,20 +72,20 @@ abstract class Zend_Feed_Reader_Extension_FeedAbstract * @param string $type Feed type * @return void */ - public function __construct(DomDocument $dom, $type = null, DOMXPath $xpath = null) + public function __construct(\DomDocument $dom, $type = null, \DOMXPath $xpath = null) { $this->_domDocument = $dom; if ($type !== null) { $this->_data['type'] = $type; } else { - $this->_data['type'] = Zend_Feed_Reader::detectType($dom); + $this->_data['type'] = Reader\Reader::detectType($dom); } if ($xpath !== null) { $this->_xpath = $xpath; } else { - $this->_xpath = new DOMXPath($this->_domDocument); + $this->_xpath = new \DOMXPath($this->_domDocument); } $this->_registerNamespaces(); @@ -143,9 +137,9 @@ public function toArray() // untested * Set the XPath query * * @param DOMXPath $xpath - * @return Zend_Feed_Reader_Extension_EntryAbstract + * @return Reader\Reader_Extension_EntryAbstract */ - public function setXpath(DOMXPath $xpath) + public function setXpath(\DOMXPath $xpath) { $this->_xpath = $xpath; $this->_registerNamespaces(); @@ -175,7 +169,7 @@ public function getXpathPrefix() /** * Set the XPath prefix * - * @return Zend_Feed_Reader_Feed_Atom + * @return Reader\Reader_Feed_Atom */ public function setXpathPrefix($prefix) { diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 5bdab0df..5b0711d5 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -13,50 +13,38 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_Feed_Reader + * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Entry.php 22300 2010-05-26 10:13:34Z padraic $ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_Feed_Reader_Extension_EntryAbstract - */ -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Extension\Atom; +use Zend\Feed\Reader; +use Zend\Date; +use Zend\Feed\Reader\Collection; +use Zend\Feed\Reader\Extension; +use Zend\URI; /** - * @see Zend_Date - */ -require_once 'Zend/Date.php'; - -/** - * @see Zend_Uri - */ -require_once 'Zend/Uri.php'; - -/** - * @see Zend_Feed_Reader_Collection_Category - */ -require_once 'Zend/Feed/Reader/Collection/Category.php'; - -/** - * @see Zend_Feed_Reader_Feed_Atom_Source - */ -require_once 'Zend/Feed/Reader/Feed/Atom/Source.php'; - -/** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 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_Entry - extends Zend_Feed_Reader_Extension_EntryAbstract +* @uses DOMDocument +* @uses stdClass +* @uses \Zend\Date\Date +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Feed\Atom\Source +* @uses \Zend\Feed\Reader\Collection\Author +* @uses \Zend\Feed\Reader\Collection\Category +* @uses \Zend\Feed\Reader\Extension\EntryAbstract +* @uses \Zend\Uri\Uri +* @category Zend +* @package Reader\Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Entry extends Extension\AbstractEntry { /** * Get the specified author @@ -108,8 +96,8 @@ public function getAuthors() if (count($authors) == 0) { $authors = null; } else { - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) + $authors = new Reader\Reader_Collection_Author( + Reader\Reader::arrayUnique($authors) ); } @@ -147,8 +135,7 @@ public function getContent() $xhtml = $this->getXpath()->query( $this->getXpathPrefix() . '/atom:content/xhtml:div' )->item(0); - //$xhtml->setAttribute('xmlns', 'http://www.w3.org/1999/xhtml'); - $d = new DOMDocument('1.0', $this->getEncoding()); + $d = new \DOMDocument('1.0', $this->getEncoding()); $xhtmls = $d->importNode($xhtml, true); $d->appendChild($xhtmls); $content = $this->_collectXhtml( @@ -158,8 +145,6 @@ public function getContent() break; } } - - //var_dump($content); exit; if (!$content) { $content = $this->getDescription(); @@ -200,15 +185,15 @@ public function getDateCreated() $date = null; - if ($this->_getAtomType() === Zend_Feed_Reader::TYPE_ATOM_03) { + if ($this->_getAtomType() === Reader\Reader::TYPE_ATOM_03) { $dateCreated = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:created)'); } else { $dateCreated = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:published)'); } if ($dateCreated) { - $date = new Zend_Date; - $date->set($dateCreated, Zend_Date::ISO_8601); + $date = new Date\Date; + $date->set($dateCreated, Date\Date::ISO_8601); } $this->_data['datecreated'] = $date; @@ -229,15 +214,15 @@ public function getDateModified() $date = null; - if ($this->_getAtomType() === Zend_Feed_Reader::TYPE_ATOM_03) { + if ($this->_getAtomType() === Reader\Reader::TYPE_ATOM_03) { $dateModified = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)'); } else { $dateModified = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)'); } if ($dateModified) { - $date = new Zend_Date; - $date->set($dateModified, Zend_Date::ISO_8601); + $date = new Date\Date; + $date->set($dateModified, Date\Date::ISO_8601); } $this->_data['datemodified'] = $date; @@ -514,7 +499,7 @@ public function getCommentFeedLink($type = 'atom') /** * Get all categories * - * @return Zend_Feed_Reader_Collection_Category + * @return Reader\Reader_Collection_Category */ public function getCategories() { @@ -522,20 +507,20 @@ public function getCategories() return $this->_data['categories']; } - if ($this->_getAtomType() == Zend_Feed_Reader::TYPE_ATOM_10) { + if ($this->_getAtomType() == Reader\Reader::TYPE_ATOM_10) { $list = $this->getXpath()->query($this->getXpathPrefix() . '//atom:category'); } else { /** * Since Atom 0.3 did not support categories, it would have used the * Dublin Core extension. However there is a small possibility Atom 0.3 - * may have been retrofittied to use Atom 1.0 instead. + * may have been retrofitted to use Atom 1.0 instead. */ - $this->getXpath()->registerNamespace('atom10', Zend_Feed_Reader::NAMESPACE_ATOM_10); + $this->getXpath()->registerNamespace('atom10', Reader\Reader::NAMESPACE_ATOM_10); $list = $this->getXpath()->query($this->getXpathPrefix() . '//atom10:category'); } if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; + $categoryCollection = new Collection\Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->getAttribute('term'), @@ -544,7 +529,7 @@ public function getCategories() ); } } else { - return new Zend_Feed_Reader_Collection_Category; + return new Collection\Category; } $this->_data['categories'] = $categoryCollection; @@ -555,7 +540,7 @@ public function getCategories() /** * Get source feed metadata from the entry * - * @return Zend_Feed_Reader_Feed_Atom_Source|null + * @return Reader\Reader_Feed_Atom_Source|null */ public function getSource() { @@ -565,11 +550,11 @@ public function getSource() $source = null; // TODO: Investigate why _getAtomType() fails here. Is it even needed? - if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10) { + if ($this->getType() == Reader\Reader::TYPE_ATOM_10) { $list = $this->getXpath()->query($this->getXpathPrefix() . '/atom:source[1]'); if ($list->length) { $element = $list->item(0); - $source = new Zend_Feed_Reader_Feed_Atom_Source($element, $this->getXpathPrefix()); + $source = new Reader\Reader_Feed_Atom_Source($element, $this->getXpathPrefix()); } } @@ -583,10 +568,10 @@ public function getSource() */ protected function _absolutiseUri($link) { - if (!Zend_Uri::check($link)) { + if (!\Zend\URI\URL::validate($link)) { if (!is_null($this->getBaseUrl())) { $link = $this->getBaseUrl() . $link; - if (!Zend_Uri::check($link)) { + if (!\Zend\URI\URL::validate($link)) { $link = null; } } @@ -600,7 +585,7 @@ protected function _absolutiseUri($link) * @param DOMElement $element * @return string */ - protected function _getAuthor(DOMElement $element) + protected function _getAuthor(\DOMElement $element) { $author = array(); @@ -632,11 +617,11 @@ protected function _getAuthor(DOMElement $element) protected function _registerNamespaces() { switch ($this->_getAtomType()) { - case Zend_Feed_Reader::TYPE_ATOM_03: - $this->getXpath()->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03); + case Reader\Reader::TYPE_ATOM_03: + $this->getXpath()->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_03); break; default: - $this->getXpath()->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10); + $this->getXpath()->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_10); break; } } @@ -647,15 +632,15 @@ protected function _registerNamespaces() protected function _getAtomType() { $dom = $this->getDomDocument(); - $prefixAtom03 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_03); - $prefixAtom10 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_10); - if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_03) + $prefixAtom03 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_03); + $prefixAtom10 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_10); + if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_03) || !empty($prefixAtom03)) { - return Zend_Feed_Reader::TYPE_ATOM_03; + return Reader\Reader::TYPE_ATOM_03; } - if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_10) + if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_10) || !empty($prefixAtom10)) { - return Zend_Feed_Reader::TYPE_ATOM_10; + return Reader\Reader::TYPE_ATOM_10; } } } diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index cc7e4090..cc362a5f 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -13,40 +13,35 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_Feed_Reader + * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Feed.php 22300 2010-05-26 10:13:34Z padraic $ */ /** - * @see Zend_Feed_Reader_Extension_FeedAbstract - */ -require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; - -/** - * @see Zend_Date - */ -require_once 'Zend/Date.php'; - -/** - * @see Zend_Uri - */ -require_once 'Zend/Uri.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Extension\Atom; +use Zend\Feed\Reader; +use Zend\Date; +use Zend\Feed\Reader\Collection; +use Zend\Feed\Reader\Extension; +use Zend\URI; /** - * @see Zend_Feed_Reader_Collection_Author - */ -require_once 'Zend/Feed/Reader/Collection/Author.php'; - -/** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_FeedAbstract +* @uses \Zend\Date\Date +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Collection\Author +* @uses \Zend\Feed\Reader\Collection\Category +* @uses \Zend\Feed\Reader\Extension\FeedAbstract +* @uses \Zend\Uri\Uri +* @category Zend +* @package Reader\Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Feed extends Extension\AbstractFeed { /** * Get a single author @@ -92,8 +87,8 @@ public function getAuthors() if (count($authors) == 0) { $authors = null; } else { - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) + $authors = new Collection\Author( + Reader\Reader::arrayUnique($authors) ); } @@ -115,7 +110,7 @@ public function getCopyright() $copyright = null; - if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { + if ($this->getType() === Reader\Reader::TYPE_ATOM_03) { $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:copyright)'); } else { $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:rights)'); @@ -133,7 +128,7 @@ public function getCopyright() /** * Get the feed creation date * - * @return Zend_Date|null + * @return Date\Date|null */ public function getDateCreated() { @@ -143,15 +138,15 @@ public function getDateCreated() $date = null; - if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { + if ($this->getType() === Reader\Reader::TYPE_ATOM_03) { $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:created)'); } else { $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:published)'); } if ($dateCreated) { - $date = new Zend_Date; - $date->set($dateCreated, Zend_Date::ISO_8601); + $date = new Date\Date; + $date->set($dateCreated, Date\Date::ISO_8601); } $this->_data['datecreated'] = $date; @@ -162,7 +157,7 @@ public function getDateCreated() /** * Get the feed modification date * - * @return Zend_Date|null + * @return Date\Date|null */ public function getDateModified() { @@ -172,15 +167,15 @@ public function getDateModified() $date = null; - if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { + if ($this->getType() === Reader\Reader::TYPE_ATOM_03) { $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)'); } else { $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)'); } if ($dateModified) { - $date = new Zend_Date; - $date->set($dateModified, Zend_Date::ISO_8601); + $date = new Date\Date; + $date->set($dateModified, Date\Date::ISO_8601); } $this->_data['datemodified'] = $date; @@ -201,8 +196,8 @@ public function getDescription() $description = null; - if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { - $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:tagline)'); // TODO: Is this the same as subtitle? + if ($this->getType() === Reader\Reader::TYPE_ATOM_03) { + $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:tagline)'); } else { $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:subtitle)'); } @@ -438,7 +433,7 @@ public function getTitle() /** * Get all categories * - * @return Zend_Feed_Reader_Collection_Category + * @return Reader\Reader_Collection_Category */ public function getCategories() { @@ -446,7 +441,7 @@ public function getCategories() return $this->_data['categories']; } - if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10) { + if ($this->getType() == Reader\Reader::TYPE_ATOM_10) { $list = $this->_xpath->query($this->getXpathPrefix() . '/atom:category'); } else { /** @@ -454,12 +449,12 @@ public function getCategories() * Dublin Core extension. However there is a small possibility Atom 0.3 * may have been retrofittied to use Atom 1.0 instead. */ - $this->_xpath->registerNamespace('atom10', Zend_Feed_Reader::NAMESPACE_ATOM_10); + $this->_xpath->registerNamespace('atom10', Reader\Reader::NAMESPACE_ATOM_10); $list = $this->_xpath->query($this->getXpathPrefix() . '/atom10:category'); } if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; + $categoryCollection = new Collection\Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->getAttribute('term'), @@ -468,7 +463,7 @@ public function getCategories() ); } } else { - return new Zend_Feed_Reader_Collection_Category; + return new Collection\Category; } $this->_data['categories'] = $categoryCollection; @@ -482,7 +477,7 @@ public function getCategories() * @param DOMElement $element * @return string */ - protected function _getAuthor(DOMElement $element) + protected function _getAuthor(\DOMElement $element) { $author = array(); @@ -514,10 +509,10 @@ protected function _getAuthor(DOMElement $element) */ protected function _absolutiseUri($link) { - if (!Zend_Uri::check($link)) { + if (!\Zend\URI\URL::validate($link)) { if (!is_null($this->getBaseUrl())) { $link = $this->getBaseUrl() . $link; - if (!Zend_Uri::check($link)) { + if (!\Zend\URI\URL::validate($link)) { $link = null; } } @@ -530,18 +525,18 @@ protected function _absolutiseUri($link) */ protected function _registerNamespaces() { - if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 - || $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03 + if ($this->getType() == Reader\Reader::TYPE_ATOM_10 + || $this->getType() == Reader\Reader::TYPE_ATOM_03 ) { return; // pre-registered at Feed level } $atomDetected = $this->_getAtomType(); switch ($atomDetected) { - case Zend_Feed_Reader::TYPE_ATOM_03: - $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03); + case Reader\Reader::TYPE_ATOM_03: + $this->_xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_03); break; default: - $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10); + $this->_xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_10); break; } } @@ -552,15 +547,15 @@ protected function _registerNamespaces() protected function _getAtomType() { $dom = $this->getDomDocument(); - $prefixAtom03 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_03); - $prefixAtom10 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_10); - if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_10) + $prefixAtom03 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_03); + $prefixAtom10 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_10); + if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_10) || !empty($prefixAtom10)) { - return Zend_Feed_Reader::TYPE_ATOM_10; + return Reader\Reader::TYPE_ATOM_10; } - if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_03) + if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_03) || !empty($prefixAtom03)) { - return Zend_Feed_Reader::TYPE_ATOM_03; + return Reader\Reader::TYPE_ATOM_03; } } } diff --git a/src/Reader/FeedInterface.php b/src/Reader/Feed.php similarity index 87% rename from src/Reader/FeedInterface.php rename to src/Reader/Feed.php index 35060baf..46cc3b3a 100644 --- a/src/Reader/FeedInterface.php +++ b/src/Reader/Feed.php @@ -20,12 +20,19 @@ */ /** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -interface Zend_Feed_Reader_FeedInterface extends Iterator, Countable +* @namespace +*/ +namespace Zend\Feed\Reader; + +/** +* @uses Countable +* @uses Iterator +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +interface Feed extends \Iterator, \Countable { /** * Get a single author diff --git a/src/Reader/FeedAbstract.php b/src/Reader/Feed/AbstractFeed.php similarity index 82% rename from src/Reader/FeedAbstract.php rename to src/Reader/Feed/AbstractFeed.php index 15552bbc..cf7d117c 100644 --- a/src/Reader/FeedAbstract.php +++ b/src/Reader/Feed/AbstractFeed.php @@ -18,24 +18,23 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: FeedAbstract.php 22092 2010-05-04 12:50:51Z padraic $ */ - + /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_feed_Reader_FeedInterface - */ -require_once 'Zend/Feed/Reader/FeedInterface.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Feed; +use Zend\Feed\Reader; /** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInterface +* @uses \Zend\Feed\Exception +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Feed +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +abstract class AbstractFeed implements Feed { /** * Parsed feed data @@ -92,15 +91,15 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt * @param DomDocument The DOM object for the feed's XML * @param string $type Feed type */ - public function __construct(DomDocument $domDocument, $type = null) + public function __construct(\DomDocument $domDocument, $type = null) { $this->_domDocument = $domDocument; - $this->_xpath = new DOMXPath($this->_domDocument); + $this->_xpath = new \DOMXPath($this->_domDocument); if ($type !== null) { $this->_data['type'] = $type; } else { - $this->_data['type'] = Zend_Feed_Reader::detectType($this->_domDocument); + $this->_data['type'] = Reader\Reader::detectType($this->_domDocument); } $this->_registerNamespaces(); $this->_indexEntries(); @@ -149,9 +148,9 @@ public function count() public function current() { if (substr($this->getType(), 0, 3) == 'rss') { - $reader = new Zend_Feed_Reader_Entry_Rss($this->_entries[$this->key()], $this->key(), $this->getType()); + $reader = new Reader\Entry\Rss($this->_entries[$this->key()], $this->key(), $this->getType()); } else { - $reader = new Zend_Feed_Reader_Entry_Atom($this->_entries[$this->key()], $this->key(), $this->getType()); + $reader = new Reader\Entry\Atom($this->_entries[$this->key()], $this->key(), $this->getType()); } $reader->setXpath($this->_xpath); @@ -273,8 +272,7 @@ public function __call($method, $args) return call_user_func_array(array($extension, $method), $args); } } - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Method: ' . $method + throw new Exception('Method: ' . $method . 'does not exist and could not be located on a registered Extension'); } @@ -286,21 +284,21 @@ public function __call($method, $args) */ public function getExtension($name) { - if (array_key_exists($name . '_Feed', $this->_extensions)) { - return $this->_extensions[$name . '_Feed']; + if (array_key_exists($name . '\\Feed', $this->_extensions)) { + return $this->_extensions[$name . '\\Feed']; } return null; } protected function _loadExtensions() { - $all = Zend_Feed_Reader::getExtensions(); + $all = Reader\Reader::getExtensions(); $feed = $all['feed']; foreach ($feed as $extension) { if (in_array($extension, $all['core'])) { continue; } - $className = Zend_Feed_Reader::getPluginLoader()->getClassName($extension); + $className = Reader\Reader::getPluginLoader()->getClassName($extension); $this->_extensions[$extension] = new $className( $this->getDomDocument(), $this->_data['type'], $this->_xpath ); diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index 62515b46..3b7ec9a6 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -13,29 +13,29 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_Feed_Reader + * @package Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Atom.php 22107 2010-05-05 13:42:20Z padraic $ */ /** - * @see Zend_Feed_Reader_FeedAbstract - */ -require_once 'Zend/Feed/Reader/FeedAbstract.php'; - -/** - * @see Zend_Feed_Reader_Extension_Atom_Feed - */ -require_once 'Zend/Feed/Reader/Extension/Atom/Feed.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Feed; +use Zend\Feed\Reader; +use Zend\Date; /** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Extension\Atom\Feed +* @uses \Zend\Feed\Reader\Feed\AbstractFeed +* @category Zend +* @package Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Atom extends AbstractFeed { /** @@ -44,13 +44,13 @@ class Zend_Feed_Reader_Feed_Atom extends Zend_Feed_Reader_FeedAbstract * @param DOMDocument $dom * @param string $type */ - public function __construct(DOMDocument $dom, $type = null) + public function __construct(\DOMDocument $dom, $type = null) { parent::__construct($dom, $type); - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Feed'); + $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\\Feed'); $this->_extensions['Atom_Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Feed'); - $this->_extensions['DublinCore_Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); + $atomClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\\Feed'); + $this->_extensions['DublinCore\\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); foreach ($this->_extensions as $extension) { $extension->setXpathPrefix('/atom:feed'); } @@ -366,7 +366,7 @@ public function getHubs() /** * Get all categories * - * @return Zend_Feed_Reader_Collection_Category + * @return Reader_Collection_Category */ public function getCategories() { @@ -392,8 +392,8 @@ public function getCategories() */ protected function _indexEntries() { - if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 || - $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03) { + if ($this->getType() == Reader\Reader::TYPE_ATOM_10 || + $this->getType() == Reader\Reader::TYPE_ATOM_03) { $entries = array(); $entries = $this->_xpath->evaluate('//atom:entry'); @@ -410,12 +410,12 @@ protected function _indexEntries() protected function _registerNamespaces() { switch ($this->_data['type']) { - case Zend_Feed_Reader::TYPE_ATOM_03: - $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03); + case Reader\Reader::TYPE_ATOM_03: + $this->_xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_03); break; - case Zend_Feed_Reader::TYPE_ATOM_10: + case Reader\Reader::TYPE_ATOM_10: default: - $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10); + $this->_xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_10); } } } diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php index cee5061d..c744ba7b 100644 --- a/src/Reader/Feed/Atom/Source.php +++ b/src/Reader/Feed/Atom/Source.php @@ -13,47 +13,52 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_Feed_Reader + * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Source.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ /** - * @see Zend_Feed_Reader_Feed_Atom - */ -require_once 'Zend/Feed/Reader/Feed/Atom.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Feed\Atom; +use Zend\Feed\Reader; +use Zend\Date; /** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Feed_Reader_Feed_Atom_Source extends Zend_Feed_Reader_Feed_Atom +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Extension\Atom\Feed +* @uses \Zend\Feed\Reader\Feed\AbstractFeed +* @category Zend +* @package Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Source extends Atom { /** * Constructor: Create a Source object which is largely just a normal - * Zend_Feed_Reader_FeedAbstract object only designed to retrieve feed level + * Reader\Reader_FeedAbstract object only designed to retrieve feed level * metadata from an Atom entry's source element. * * @param DOMElement $source * @param string $xpathPrefix Passed from parent Entry object * @param string $type Nearly always Atom 1.0 */ - public function __construct(DOMElement $source, $xpathPrefix, $type = Zend_Feed_Reader::TYPE_ATOM_10) + public function __construct(\DOMElement $source, $xpathPrefix, $type = Reader\Reader::TYPE_ATOM_10) { $this->_domDocument = $source->ownerDocument; - $this->_xpath = new DOMXPath($this->_domDocument); + $this->_xpath = new \DOMXPath($this->_domDocument); $this->_data['type'] = $type; $this->_registerNamespaces(); $this->_loadExtensions(); - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Feed'); - $this->_extensions['Atom_Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Feed'); - $this->_extensions['DublinCore_Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); + $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\\Feed'); + $this->_extensions['Atom\\Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); + $atomClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\\Feed'); + $this->_extensions['DublinCore\\Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); foreach ($this->_extensions as $extension) { $extension->setXpathPrefix(rtrim($xpathPrefix, '/') . '/atom:source'); } diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index e1b7bddb..dd67fc05 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -13,44 +13,33 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_Feed_Reader + * @package Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Rss.php 22300 2010-05-26 10:13:34Z padraic $ */ /** - * @see Zend_Feed_Reader_FeedAbstract - */ -require_once 'Zend/Feed/Reader/FeedAbstract.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Feed; +use Zend\Feed\Reader; +use Zend\Date; /** - * @see Zend_feed_Reader_Extension_Atom_Feed - */ -require_once 'Zend/Feed/Reader/Extension/Atom/Feed.php'; - -/** - * @see Zend_Feed_Reader_Extension_DublinCore_Feed - */ -require_once 'Zend/Feed/Reader/Extension/DublinCore/Feed.php'; - -/** - * @see Zend_Date - */ -require_once 'Zend/Date.php'; - -/** - * @see Zend_Feed_Reader_Collection_Author - */ -require_once 'Zend/Feed/Reader/Collection/Author.php'; - -/** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract +* @uses \Zend\Date\Date +* @uses \Zend\Feed\Reader\Exception +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Collection\Author +* @uses \Zend\Feed\Reader\Extension\Atom\Feed +* @uses \Zend\Feed\Reader\Extension\DublinCore\Feed +* @uses \Zend\Feed\Reader\Feed\AbstractFeed +* @category Zend +* @package Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Rss extends AbstractFeed { /** @@ -59,16 +48,16 @@ class Zend_Feed_Reader_Feed_Rss extends Zend_Feed_Reader_FeedAbstract * @param DOMDocument $dom * @param string $type */ - public function __construct(DomDocument $dom, $type = null) + public function __construct(\DomDocument $dom, $type = null) { parent::__construct($dom, $type); - $dublinCoreClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Feed'); - $this->_extensions['DublinCore_Feed'] = new $dublinCoreClass($dom, $this->_data['type'], $this->_xpath); - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Feed'); - $this->_extensions['Atom_Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); + $dublinCoreClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\\Feed'); + $this->_extensions['DublinCore\\Feed'] = new $dublinCoreClass($dom, $this->_data['type'], $this->_xpath); + $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\\Feed'); + $this->_extensions['Atom\\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { $xpathPrefix = '/rss/channel'; } else { $xpathPrefix = '/rdf:RDF/rss:channel'; @@ -120,8 +109,8 @@ public function getAuthors() * Technically RSS doesn't specific author element use at the feed level * but it's supported on a "just in case" basis. */ - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090) { $list = $this->_xpath->query('//author'); } else { $list = $this->_xpath->query('//rss:author'); @@ -146,8 +135,8 @@ public function getAuthors() if (count($authors) == 0) { $authors = $this->getExtension('Atom')->getAuthors(); } else { - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) + $authors = new Reader\Collection\Author( + Reader\Reader::arrayUnique($authors) ); } @@ -173,8 +162,8 @@ public function getCopyright() $copyright = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $copyright = $this->_xpath->evaluate('string(/rss/channel/copyright)'); } @@ -208,7 +197,7 @@ public function getDateCreated() /** * Get the feed modification date * - * @return Zend_Date + * @return Date\Date */ public function getDateModified() { @@ -219,8 +208,8 @@ public function getDateModified() $dateModified = null; $date = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $dateModified = $this->_xpath->evaluate('string(/rss/channel/pubDate)'); if (!$dateModified) { $dateModified = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)'); @@ -228,19 +217,18 @@ public function getDateModified() if ($dateModified) { $dateModifiedParsed = strtotime($dateModified); if ($dateModifiedParsed) { - $date = new Zend_Date($dateModifiedParsed); + $date = new Date\Date($dateModifiedParsed); } else { - $dateStandards = array(Zend_Date::RSS, Zend_Date::RFC_822, - Zend_Date::RFC_2822, Zend_Date::DATES); - $date = new Zend_Date; + $dateStandards = array(Date\Date::RSS, Date\Date::RFC_822, + Date\Date::RFC_2822, Date\Date::DATES); + $date = new Date\Date; foreach ($dateStandards as $standard) { try { $date->set($dateModified, $standard); break; - } catch (Zend_Date_Exception $e) { - if ($standard == Zend_Date::DATES) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception( + } catch (Date\Exception $e) { + if ($standard == Date\Date::DATES) { + throw new Exception( 'Could not load date due to unrecognised' .' format (should follow RFC 822 or 2822):' . $e->getMessage(), @@ -273,7 +261,7 @@ public function getDateModified() /** * Get the feed lastBuild date * - * @return Zend_Date + * @return Date\Date */ public function getLastBuildDate() { @@ -284,25 +272,24 @@ public function getLastBuildDate() $lastBuildDate = null; $date = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $lastBuildDate = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)'); if ($lastBuildDate) { $lastBuildDateParsed = strtotime($lastBuildDate); if ($lastBuildDateParsed) { - $date = new Zend_Date($lastBuildDateParsed); + $date = new Date\Date($lastBuildDateParsed); } else { - $dateStandards = array(Zend_Date::RSS, Zend_Date::RFC_822, - Zend_Date::RFC_2822, Zend_Date::DATES); - $date = new Zend_Date; + $dateStandards = array(Date\Date::RSS, Date\Date::RFC_822, + Date\Date::RFC_2822, Date\Date::DATES); + $date = new Date\Date; foreach ($dateStandards as $standard) { try { $date->set($lastBuildDate, $standard); break; - } catch (Zend_Date_Exception $e) { - if ($standard == Zend_Date::DATES) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception( + } catch (Date\Exception $e) { + if ($standard == Date\Date::DATES) { + throw new Exception( 'Could not load date due to unrecognised' .' format (should follow RFC 822 or 2822):' . $e->getMessage(), @@ -337,8 +324,8 @@ public function getDescription() $description = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $description = $this->_xpath->evaluate('string(/rss/channel/description)'); } else { $description = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:description)'); @@ -374,8 +361,8 @@ public function getId() $id = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $id = $this->_xpath->evaluate('string(/rss/channel/guid)'); } @@ -413,8 +400,8 @@ public function getImage() return $this->_data['image']; } - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $list = $this->_xpath->query('/rss/channel/image'); $prefix = '/rss/channel/image[1]'; } else { @@ -469,8 +456,8 @@ public function getLanguage() $language = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $language = $this->_xpath->evaluate('string(/rss/channel/language)'); } @@ -508,8 +495,8 @@ public function getLink() $link = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $link = $this->_xpath->evaluate('string(/rss/channel/link)'); } else { $link = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:link)'); @@ -565,14 +552,14 @@ public function getGenerator() $generator = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $generator = $this->_xpath->evaluate('string(/rss/channel/generator)'); } if (!$generator) { - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $generator = $this->_xpath->evaluate('string(/rss/channel/atom:generator)'); } else { $generator = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/atom:generator)'); @@ -605,8 +592,8 @@ public function getTitle() $title = null; - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $title = $this->_xpath->evaluate('string(/rss/channel/title)'); } else { $title = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:title)'); @@ -656,7 +643,7 @@ public function getHubs() /** * Get all categories * - * @return Zend_Feed_Reader_Collection_Category + * @return Reader_Collection_Category */ public function getCategories() { @@ -664,15 +651,15 @@ public function getCategories() return $this->_data['categories']; } - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { $list = $this->_xpath->query('/rss/channel//category'); } else { $list = $this->_xpath->query('/rdf:RDF/rss:channel//rss:category'); } if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; + $categoryCollection = new Reader_Collection_Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->nodeValue, @@ -701,7 +688,7 @@ protected function _indexEntries() { $entries = array(); - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { $entries = $this->_xpath->evaluate('//item'); } else { $entries = $this->_xpath->evaluate('//rss:item'); @@ -719,14 +706,14 @@ protected function _indexEntries() protected function _registerNamespaces() { switch ($this->_data['type']) { - case Zend_Feed_Reader::TYPE_RSS_10: - $this->_xpath->registerNamespace('rdf', Zend_Feed_Reader::NAMESPACE_RDF); - $this->_xpath->registerNamespace('rss', Zend_Feed_Reader::NAMESPACE_RSS_10); + case Reader\Reader::TYPE_RSS_10: + $this->_xpath->registerNamespace('rdf', Reader\Reader::NAMESPACE_RDF); + $this->_xpath->registerNamespace('rss', Reader\Reader::NAMESPACE_RSS_10); break; - case Zend_Feed_Reader::TYPE_RSS_090: - $this->_xpath->registerNamespace('rdf', Zend_Feed_Reader::NAMESPACE_RDF); - $this->_xpath->registerNamespace('rss', Zend_Feed_Reader::NAMESPACE_RSS_090); + case Reader\Reader::TYPE_RSS_090: + $this->_xpath->registerNamespace('rdf', Reader\Reader::NAMESPACE_RDF); + $this->_xpath->registerNamespace('rss', Reader\Reader::NAMESPACE_RSS_090); break; } } diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index 3d073c73..472acbc3 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -20,22 +20,20 @@ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; +* @namespace +*/ +namespace Zend\Feed\Reader; +use Zend\URI; /** - * @see Zend_Uri - */ -require_once 'Zend/Uri.php'; - -/** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 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 +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Uri\Uri +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class FeedSet extends \ArrayObject { public $rss = null; @@ -60,7 +58,7 @@ class Zend_Feed_Reader_FeedSet extends ArrayObject * @param string $uri * @return void */ - public function addLinks(DOMNodeList $links, $uri) + public function addLinks(\DOMNodeList $links, $uri) { foreach ($links as $link) { if (strtolower($link->getAttribute('rel')) !== 'alternate' @@ -87,16 +85,16 @@ public function addLinks(DOMNodeList $links, $uri) */ protected function _absolutiseUri($link, $uri = null) { - if (!Zend_Uri::check($link)) { + if (!URI\URL::validate($link)) { if (!is_null($uri)) { - $uri = Zend_Uri::factory($uri); + $uri = new URI\URL($uri); if ($link[0] !== '/') { $link = $uri->getPath() . '/' . $link; } $link = $uri->getScheme() . '://' . $uri->getHost() . '/' . $this->_canonicalizePath($link); - if (!Zend_Uri::check($link)) { + if (!URI\URL::validate($link)) { $link = null; } } @@ -138,7 +136,7 @@ public function offsetGet($offset) if (!$this->offsetExists('href')) { return null; } - $feed = Zend_Feed_Reader::import($this->offsetGet('href')); + $feed = Reader::import($this->offsetGet('href')); $this->offsetSet('feed', $feed); return $feed; } diff --git a/src/Reader.php b/src/Reader/Reader.php similarity index 77% rename from src/Reader.php rename to src/Reader/Reader.php index 9f56a26e..a5f6c931 100644 --- a/src/Reader.php +++ b/src/Reader/Reader.php @@ -20,32 +20,26 @@ */ /** - * @see Zend_Feed - */ -require_once 'Zend/Feed.php'; - -/** - * @see Zend_Feed_Reader_Feed_Rss - */ -require_once 'Zend/Feed/Reader/Feed/Rss.php'; - -/** - * @see Zend_Feed_Reader_Feed_Atom - */ -require_once 'Zend/Feed/Reader/Feed/Atom.php'; - -/** - * @see Zend_Feed_Reader_FeedSet - */ -require_once 'Zend/Feed/Reader/FeedSet.php'; +* @namespace +*/ +namespace Zend\Feed\Reader; +use Zend\HTTP; +use Zend\Loader\PluginLoader; /** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Feed_Reader +* @uses \Zend\Feed\Feed +* @uses \Zend\Feed\Exception +* @uses \Zend\Feed\Reader\FeedSet +* @uses \Zend\Feed\Reader\Feed\Atom\Atom +* @uses \Zend\Feed\Reader\Feed\RSS +* @uses \Zend\HTTP\Client +* @uses \Zend\Loader\PluginLoader\PluginLoader +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Reader { /** * Namespace constants @@ -78,14 +72,14 @@ class Zend_Feed_Reader /** * Cache instance * - * @var Zend_Cache_Core + * @var \Zend\Cache\Core */ protected static $_cache = null; /** * HTTP client object to use for retrieving feeds * - * @var Zend_Http_Client + * @var \Zend\HTTP\Client */ protected static $_httpClient = null; @@ -124,7 +118,7 @@ class Zend_Feed_Reader /** * Get the Feed cache * - * @return Zend_Cache_Core + * @return \Zend\Cache\Core */ public static function getCache() { @@ -134,10 +128,10 @@ public static function getCache() /** * Set the feed cache * - * @param Zend_Cache_Core $cache + * @param \Zend\Cache\Core $cache * @return void */ - public static function setCache(Zend_Cache_Core $cache) + public static function setCache(\Zend\Cache\Core $cache) { self::$_cache = $cache; } @@ -147,28 +141,24 @@ public static function setCache(Zend_Cache_Core $cache) * * Sets the HTTP client object to use for retrieving the feeds. * - * @param Zend_Http_Client $httpClient + * @param \Zend\HTTP\Client $httpClient * @return void */ - public static function setHttpClient(Zend_Http_Client $httpClient) + public static function setHttpClient(\Zend\HTTP\Client $httpClient) { self::$_httpClient = $httpClient; } /** - * Gets the HTTP client object. If none is set, a new Zend_Http_Client will be used. + * Gets the HTTP client object. If none is set, a new \Zend\HTTP\Client will be used. * - * @return Zend_Http_Client_Abstract + * @return \Zend\HTTP\Client */ public static function getHttpClient() { - if (!self::$_httpClient instanceof Zend_Http_Client) { - /** - * @see Zend_Http_Client - */ - require_once 'Zend/Http/Client.php'; - self::$_httpClient = new Zend_Http_Client(); + if (!self::$_httpClient instanceof \Zend\HTTP\Client) { + self::$_httpClient = new \Zend\HTTP\Client(); } return self::$_httpClient; @@ -251,8 +241,7 @@ public static function import($uri, $etag = null, $lastModified = null) } $response = $client->request('GET'); if ($response->getStatus() !== 200 && $response->getStatus() !== 304) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); + throw new Exception('Feed failed to load, got response code ' . $response->getStatus()); } if ($response->getStatus() == 304) { $responseXml = $data; @@ -274,8 +263,7 @@ public static function import($uri, $etag = null, $lastModified = null) } $response = $client->request('GET'); if ($response->getStatus() !== 200) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); + throw new Exception('Feed failed to load, got response code ' . $response->getStatus()); } $responseXml = $response->getBody(); $cache->save($responseXml, $cacheId); @@ -283,8 +271,7 @@ public static function import($uri, $etag = null, $lastModified = null) } else { $response = $client->request('GET'); if ($response->getStatus() !== 200) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); + throw new Exception('Feed failed to load, got response code ' . $response->getStatus()); } $reader = self::importString($response->getBody()); $reader->setOriginalSourceUri($uri); @@ -293,35 +280,15 @@ public static function import($uri, $etag = null, $lastModified = null) } /** - * 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_FeedInterface - */ - public static function importFeed(Zend_Feed_Abstract $feed) - { - $dom = $feed->getDOM()->ownerDocument; - $type = self::detectType($dom); - self::_registerCoreExtensions(); - 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); - } - - return $reader; - } - - /** - * Import a feed froma string + * Import a feed from a string * * @param string $string - * @return Zend_Feed_Reader_FeedInterface + * @return \Zend\Feed\Reader\Feed */ public static function importString($string) { $libxml_errflag = libxml_use_internal_errors(true); - $dom = new DOMDocument; + $dom = new \DOMDocument; $status = $dom->loadXML($string); libxml_use_internal_errors($libxml_errflag); @@ -333,9 +300,7 @@ public static function importString($string) } else { $errormsg = "DOMDocument cannot parse XML: Please check the XML document's validity"; } - - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception($errormsg); + throw new Exception($errormsg); } $type = self::detectType($dom); @@ -343,14 +308,13 @@ public static function importString($string) self::_registerCoreExtensions(); if (substr($type, 0, 3) == 'rss') { - $reader = new Zend_Feed_Reader_Feed_Rss($dom, $type); + $reader = new Feed\Rss($dom, $type); } elseif (substr($type, 8, 5) == 'entry') { - $reader = new Zend_Feed_Reader_Entry_Atom($dom->documentElement, 0, Zend_Feed_Reader::TYPE_ATOM_10); + $reader = new Entry\Atom($dom->documentElement, 0, Reader::TYPE_ATOM_10); } elseif (substr($type, 0, 4) == 'atom') { - $reader = new Zend_Feed_Reader_Feed_Atom($dom, $type); + $reader = new Feed\Atom($dom, $type); } else { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('The URI used does not point to a ' + throw new Exception('The URI used does not point to a ' . 'valid Atom, RSS or RDF feed that Zend_Feed_Reader can parse.'); } return $reader; @@ -369,11 +333,7 @@ public static function importFile($filename) $feed = @file_get_contents($filename); @ini_restore('track_errors'); if ($feed === false) { - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception("File could not be loaded: $php_errormsg"); + throw new Exception("File could not be loaded: $php_errormsg"); } return self::importString($feed); } @@ -385,15 +345,11 @@ public static function findFeedLinks($uri) $client->setUri($uri); $response = $client->request(); if ($response->getStatus() !== 200) { - /** - * @see Zend_Feed_Exception - */ - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception("Failed to access $uri, got response code " . $response->getStatus()); + throw new Exception("Failed to access $uri, got response code " . $response->getStatus()); } $responseHtml = $response->getBody(); $libxml_errflag = libxml_use_internal_errors(true); - $dom = new DOMDocument; + $dom = new \DOMDocument; $status = $dom->loadHTML($responseHtml); libxml_use_internal_errors($libxml_errflag); if (!$status) { @@ -404,11 +360,9 @@ public static function findFeedLinks($uri) } else { $errormsg = "DOMDocument cannot parse HTML: Please check the XML document's validity"; } - - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception($errormsg); + throw new Exception($errormsg); } - $feedSet = new Zend_Feed_Reader_FeedSet; + $feedSet = new Reader\FeedSet; $links = $dom->getElementsByTagName('link'); $feedSet->addLinks($links, $uri); return $feedSet; @@ -422,13 +376,13 @@ public static function findFeedLinks($uri) */ public static function detectType($feed, $specOnly = false) { - if ($feed instanceof Zend_Feed_Reader_FeedInterface) { + if ($feed instanceof Reader\Feed) { $dom = $feed->getDomDocument(); - } elseif($feed instanceof DOMDocument) { + } elseif($feed instanceof \DOMDocument) { $dom = $feed; } elseif(is_string($feed) && !empty($feed)) { @ini_set('track_errors', 1); - $dom = new DOMDocument; + $dom = new \DOMDocument; $status = @$dom->loadXML($feed); @ini_restore('track_errors'); if (!$status) { @@ -439,15 +393,13 @@ public static function detectType($feed, $specOnly = false) $php_errormsg = '(error message not available)'; } } - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg"); + throw new Exception("DOMDocument cannot parse XML: $php_errormsg"); } } else { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid object/scalar provided: must' + throw new Exception('Invalid object/scalar provided: must' . ' be of type Zend_Feed_Reader_FeedInterface, DomDocument or string'); } - $xpath = new DOMXPath($dom); + $xpath = new \DOMXPath($dom); if ($xpath->query('/rss')->length) { $type = self::TYPE_RSS_ANY; @@ -533,7 +485,7 @@ public static function detectType($feed, $specOnly = false) * * @param Zend_Loader_PluginLoader_Interface $loader */ - public static function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader) + public static function setPluginLoader(PluginLoader\PluginLoaderInterface $loader) { self::$_pluginLoader = $loader; } @@ -546,9 +498,8 @@ public static function setPluginLoader(Zend_Loader_PluginLoader_Interface $loade public static function getPluginLoader() { if (!isset(self::$_pluginLoader)) { - require_once 'Zend/Loader/PluginLoader.php'; - self::$_pluginLoader = new Zend_Loader_PluginLoader(array( - 'Zend_Feed_Reader_Extension_' => 'Zend/Feed/Reader/Extension/', + self::$_pluginLoader = PluginLoader(array( + 'Zend\\Feed\\Reader\\Extension\\' => 'Zend/Feed/Reader/Extension/', )); } return self::$_pluginLoader; @@ -563,7 +514,7 @@ public static function getPluginLoader() */ public static function addPrefixPath($prefix, $path) { - $prefix = rtrim($prefix, '_'); + $prefix = rtrim($prefix, '\\'); $path = rtrim($path, DIRECTORY_SEPARATOR); self::getPluginLoader()->addPrefixPath($prefix, $path); } @@ -595,8 +546,8 @@ public static function addPrefixPaths(array $spec) */ public static function registerExtension($name) { - $feedName = $name . '_Feed'; - $entryName = $name . '_Entry'; + $feedName = $name . '\\Feed'; + $entryName = $name . '\\Entry'; if (self::isRegistered($name)) { if (self::getPluginLoader()->isLoaded($feedName) || self::getPluginLoader()->isLoaded($entryName)) { @@ -616,8 +567,7 @@ public static function registerExtension($name) if (!self::getPluginLoader()->isLoaded($feedName) && !self::getPluginLoader()->isLoaded($entryName) ) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Could not load extension: ' . $name + throw new Exception('Could not load extension: ' . $name . 'using Plugin Loader. Check prefix paths are configured and extension exists.'); } } @@ -630,8 +580,8 @@ public static function registerExtension($name) */ public static function isRegistered($extensionName) { - $feedName = $extensionName . '_Feed'; - $entryName = $extensionName . '_Entry'; + $feedName = $extensionName . '\\Feed'; + $entryName = $extensionName . '\\Entry'; if (in_array($feedName, self::$_extensions['feed']) || in_array($entryName, self::$_extensions['entry']) ) { @@ -665,20 +615,20 @@ public static function reset() self::$_prefixPaths = array(); self::$_extensions = array( 'feed' => array( - 'DublinCore_Feed', - 'Atom_Feed' + 'DublinCore\\Feed', + 'Atom\\Feed' ), 'entry' => array( - 'Content_Entry', - 'DublinCore_Entry', - 'Atom_Entry' + 'Content\\Entry', + 'DublinCore\\Entry', + 'Atom\\Entry' ), 'core' => array( - 'DublinCore_Feed', - 'Atom_Feed', - 'Content_Entry', - 'DublinCore_Entry', - 'Atom_Entry' + 'DublinCore\\Feed', + 'Atom\\Feed', + 'Content\\Entry', + 'DublinCore\\Entry', + 'Atom\\Entry' ) ); } From ba7fbdccfa6fcf5585afade9a3a40efcb132e87e Mon Sep 17 00:00:00 2001 From: Padraic Brady Date: Mon, 7 Jun 2010 12:54:33 +0100 Subject: [PATCH 139/238] 2nd pass on Zend\Feed\Reader --- src/Reader/Extension/Content/Entry.php | 34 ++++++------ .../Extension/CreativeCommons/Entry.php | 29 +++++----- src/Reader/Extension/CreativeCommons/Feed.php | 23 ++++---- src/Reader/Extension/DublinCore/Entry.php | 55 +++++++++---------- src/Reader/Extension/DublinCore/Feed.php | 55 +++++++++---------- src/Reader/Extension/Podcast/Entry.php | 28 +++++----- src/Reader/Extension/Podcast/Feed.php | 25 +++++---- src/Reader/Extension/Slash/Entry.php | 27 ++++----- src/Reader/Extension/Syndication/Feed.php | 34 ++++++------ src/Reader/Extension/Thread/Entry.php | 22 ++++---- src/Reader/Extension/WellFormedWeb/Entry.php | 27 ++++----- 11 files changed, 176 insertions(+), 183 deletions(-) diff --git a/src/Reader/Extension/Content/Entry.php b/src/Reader/Extension/Content/Entry.php index cd94f951..f3f8b66a 100644 --- a/src/Reader/Extension/Content/Entry.php +++ b/src/Reader/Extension/Content/Entry.php @@ -13,36 +13,34 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_Feed_Reader + * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Entry.php 22300 2010-05-26 10:13:34Z padraic $ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_Feed_Reader_Entry_EntryAbstract - */ -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Extension\Content; +use Zend\Feed\Reader; +use Zend\Feed\Reader\Extension; /** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_EntryAbstract +* @uses \Zend\Feed\Reader\Reader +* @uses Reader\Reader_Entry_EntryAbstract +* @category Zend +* @package Reader\Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Entry extends Extension\AbstractEntry { public function getContent() { - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { $content = $this->_xpath->evaluate('string('.$this->getXpathPrefix().'/content:encoded)'); } else { diff --git a/src/Reader/Extension/CreativeCommons/Entry.php b/src/Reader/Extension/CreativeCommons/Entry.php index 9c8cd4da..2de8f55a 100644 --- a/src/Reader/Extension/CreativeCommons/Entry.php +++ b/src/Reader/Extension/CreativeCommons/Entry.php @@ -20,22 +20,21 @@ */ /** - * @see Zend_Feed_Reader_Extension_EntryAbstract - */ -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Extension\CreativeCommons; +use Zend\Feed\Reader; +use Zend\Feed\Reader\Extension; /** - * @see Zend_Feed_Reader_Extension_CreativeCommons_Feed - */ -require_once 'Zend/Feed/Reader/Extension/CreativeCommons/Feed.php'; - -/** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 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_Entry extends Zend_Feed_Reader_Extension_EntryAbstract +* @uses \Zend\Feed\Reader\Reader +* @uses Reader\Reader_Entry_EntryAbstract +* @category Zend +* @package Reader\Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Entry extends Extension\AbstractEntry { /** * Get the entry license @@ -75,7 +74,7 @@ public function getLicenses() $licenses = array_unique($licenses); } else { - $cc = new Zend_Feed_Reader_Extension_CreativeCommons_Feed( + $cc = new Feed( $this->_domDocument, $this->_data['type'], $this->_xpath ); $licenses = $cc->getLicenses(); diff --git a/src/Reader/Extension/CreativeCommons/Feed.php b/src/Reader/Extension/CreativeCommons/Feed.php index 4b1c7a9f..82dbd185 100644 --- a/src/Reader/Extension/CreativeCommons/Feed.php +++ b/src/Reader/Extension/CreativeCommons/Feed.php @@ -20,18 +20,21 @@ */ /** - * @see Zend_Feed_Reader_Extension_FeedAbstract - */ -require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Extension\CreativeCommons; +use Zend\Feed\Reader; +use Zend\Feed\Reader\Extension; /** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_FeedAbstract +* @uses \Zend\Feed\Reader\Reader +* @uses Reader\Reader_Entry_EntryAbstract +* @category Zend +* @package Reader\Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Feed extends Extension\AbstractFeed { /** * Get the entry license diff --git a/src/Reader/Extension/DublinCore/Entry.php b/src/Reader/Extension/DublinCore/Entry.php index c2039459..d8d2a175 100644 --- a/src/Reader/Extension/DublinCore/Entry.php +++ b/src/Reader/Extension/DublinCore/Entry.php @@ -13,35 +13,32 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_Feed_Reader + * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; - -/** - * @see Zend_Feed_Reader_Extension_EntryAbstract - */ -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Extension\DublinCore; +use Zend\Feed\Reader\Collection; +use Zend\Feed\Reader\Extension +use Zend\Date; /** - * @see Zend_Date - */ -require_once 'Zend/Date.php'; - -/** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_EntryAbstract +* @uses \Zend\Date\Date +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Collection\Author +* @uses \Zend\Feed\Reader\Collection\Category +* @uses \Zend\Feed\Reader\Extension\EntryAbstract +* @category Zend +* @package Reader\Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Entry extends Extension\AbstractEntry { /** * Get an author entry @@ -91,8 +88,8 @@ public function getAuthors() 'name' => $author->nodeValue ); } - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) + $authors = new Collection\Author( + Reader\Reader::arrayUnique($authors) ); } else { $authors = null; @@ -106,7 +103,7 @@ public function getAuthors() /** * Get categories (subjects under DC) * - * @return Zend_Feed_Reader_Collection_Category + * @return Reader\Reader_Collection_Category */ public function getCategories() { @@ -121,7 +118,7 @@ public function getCategories() } if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; + $categoryCollection = new Collection\Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->nodeValue, @@ -130,7 +127,7 @@ public function getCategories() ); } } else { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; + $categoryCollection = new Collection\Category; } $this->_data['categories'] = $categoryCollection; @@ -228,7 +225,7 @@ public function getTitle() /** * * - * @return Zend_Date|null + * @return Date\Date|null */ public function getDate() { @@ -244,8 +241,8 @@ public function getDate() } if ($date) { - $d = new Zend_Date; - $d->set($date, Zend_Date::ISO_8601); + $d = new Date\Date; + $d->set($date, Date\Date::ISO_8601); } $this->_data['date'] = $d; diff --git a/src/Reader/Extension/DublinCore/Feed.php b/src/Reader/Extension/DublinCore/Feed.php index 5b7816f5..eeba270d 100644 --- a/src/Reader/Extension/DublinCore/Feed.php +++ b/src/Reader/Extension/DublinCore/Feed.php @@ -13,35 +13,32 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_Feed_Reader + * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** - * @see Zend_Feed_Reader_Extension_FeedAbstract - */ -require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; - -/** - * @see Zend_Date - */ -require_once 'Zend/Date.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Extension\DublinCore; +use Zend\Feed\Reader\Collection; +use Zend\Feed\Reader\Extension; +use Zend\Date; /** - * @see Zend_Feed_Reader_Collection_Author - */ -require_once 'Zend/Feed/Reader/Collection/Author.php'; - -/** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_FeedAbstract +* @uses \Zend\Date\Date +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Collection\Author +* @uses \Zend\Feed\Reader\Collection\Category +* @uses \Zend\Feed\Reader\Extension\AbstractEntry +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Feed extends Extension\AbstractFeed { /** * Get a single author @@ -91,8 +88,8 @@ public function getAuthors() 'name' => $author->nodeValue ); } - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) + $authors = new Collection\Author( + Reader\Reader::arrayUnique($authors) ); } else { $authors = null; @@ -237,7 +234,7 @@ public function getTitle() /** * * - * @return Zend_Date|null + * @return Date\Date|null */ public function getDate() { @@ -253,8 +250,8 @@ public function getDate() } if ($date) { - $d = new Zend_Date; - $d->set($date, Zend_Date::ISO_8601); + $d = new Date\Date; + $d->set($date, Date\Date::ISO_8601); } $this->_data['date'] = $d; @@ -265,7 +262,7 @@ public function getDate() /** * Get categories (subjects under DC) * - * @return Zend_Feed_Reader_Collection_Category + * @return Reader\Reader_Collection_Category */ public function getCategories() { @@ -280,7 +277,7 @@ public function getCategories() } if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; + $categoryCollection = new Collection\Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->nodeValue, @@ -289,7 +286,7 @@ public function getCategories() ); } } else { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; + $categoryCollection = new Collection\Category; } $this->_data['categories'] = $categoryCollection; diff --git a/src/Reader/Extension/Podcast/Entry.php b/src/Reader/Extension/Podcast/Entry.php index eeffed2b..3636469f 100644 --- a/src/Reader/Extension/Podcast/Entry.php +++ b/src/Reader/Extension/Podcast/Entry.php @@ -20,22 +20,20 @@ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Extension\Podcast; +use Zend\Feed\Reader\Extension; /** - * @see Zend_Feed_Reader_Extension_EntryAbstract - */ -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; - -/** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Feed_Reader_Extension_Podcast_Entry extends Zend_Feed_Reader_Extension_EntryAbstract +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Extension\EntryAbstract +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Entry extends Extension\AbstractEntry { /** * Get the entry author @@ -199,4 +197,4 @@ protected function _registerNamespaces() { $this->_xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); } -} \ No newline at end of file +} diff --git a/src/Reader/Extension/Podcast/Feed.php b/src/Reader/Extension/Podcast/Feed.php index 01a5a191..a4487053 100644 --- a/src/Reader/Extension/Podcast/Feed.php +++ b/src/Reader/Extension/Podcast/Feed.php @@ -20,17 +20,20 @@ */ /** - * @see Zend_Feed_Reader_Extension_FeedAbstract - */ -require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Extension\Podcast; +use Zend\Feed\Reader\Extension; /** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Feed_Reader_Extension_Podcast_Feed extends Zend_Feed_Reader_Extension_FeedAbstract +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Extension\EntryAbstract +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Feed extends Extension\AbstractFeed { /** * Get the entry author @@ -99,7 +102,7 @@ public function getCategories() $children = array(); foreach ($node->childNodes as $childNode) { - if (!($childNode instanceof DOMText)) { + if (!($childNode instanceof \DOMText)) { $children[$childNode->getAttribute('text')] = null; } } @@ -290,4 +293,4 @@ protected function _registerNamespaces() { $this->_xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); } -} \ No newline at end of file +} diff --git a/src/Reader/Extension/Slash/Entry.php b/src/Reader/Extension/Slash/Entry.php index c5f259fb..43bf1184 100644 --- a/src/Reader/Extension/Slash/Entry.php +++ b/src/Reader/Extension/Slash/Entry.php @@ -20,23 +20,20 @@ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Extension\Slash; +use Zend\Feed\Reader\Extension; /** - * @see Zend_Feed_Reader_Extension_EntryAbstract - */ -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; - -/** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_EntryAbstract +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Extension\EntryAbstract +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Entry extends Extension\AbstractEntry { /** * Get the entry section diff --git a/src/Reader/Extension/Syndication/Feed.php b/src/Reader/Extension/Syndication/Feed.php index 91044865..56214196 100644 --- a/src/Reader/Extension/Syndication/Feed.php +++ b/src/Reader/Extension/Syndication/Feed.php @@ -20,20 +20,22 @@ */ /** - * @see Zend_Feed_Reader_Extension_FeedAbstract - */ -require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; - -require_once 'Zend/Date.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Extension\Syndication; +use Zend\Feed\Reader; +use Zend\Feed\Reader\Extension; +use Zend\Date; /** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_FeedAbstract +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Extension\EntryAbstract +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Feed extends Extension\AbstractFeed { /** * Get update period @@ -57,7 +59,7 @@ public function getUpdatePeriod() case 'yearly': return $period; default: - throw new Zend_Feed_Exception("Feed specified invalid update period: '$period'." + throw new Reader\Exception("Feed specified invalid update period: '$period'." . " Must be one of hourly, daily, weekly or yearly" ); } @@ -119,15 +121,15 @@ public function getUpdateFrequencyAsTicks() /** * Get update base * - * @return Zend_Date|null + * @return Date\Date|null */ public function getUpdateBase() { $updateBase = $this->_getData('updateBase'); $date = null; if ($updateBase) { - $date = new Zend_Date; - $date->set($updateBase, Zend_Date::W3C); + $date = new Date\Date; + $date->set($updateBase, Date\Date::W3C); } return $date; } diff --git a/src/Reader/Extension/Thread/Entry.php b/src/Reader/Extension/Thread/Entry.php index 7b397de7..e81573cf 100644 --- a/src/Reader/Extension/Thread/Entry.php +++ b/src/Reader/Extension/Thread/Entry.php @@ -20,18 +20,20 @@ */ /** - * @see Zend_Feed_Reader_Extension_EntryAbstract - */ -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Extension\Thread; +use Zend\Feed\Reader\Extension; /** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_EntryAbstract +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Extension\EntryAbstract +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Entry extends Extension\AbstractEntry { /** * Get the "in-reply-to" value diff --git a/src/Reader/Extension/WellFormedWeb/Entry.php b/src/Reader/Extension/WellFormedWeb/Entry.php index 24832fee..1bfe9d35 100644 --- a/src/Reader/Extension/WellFormedWeb/Entry.php +++ b/src/Reader/Extension/WellFormedWeb/Entry.php @@ -20,23 +20,20 @@ */ /** - * @see Zend_Feed_Reader - */ -require_once 'Zend/Feed/Reader.php'; +* @namespace +*/ +namespace Zend\Feed\Reader\Extension\WellFormedWeb; +use Zend\Feed\Reader\Extension; /** - * @see Zend_Feed_Reader_Extension_EntryAbstract - */ -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; - -/** - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 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 - extends Zend_Feed_Reader_Extension_EntryAbstract +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Extension\EntryAbstract +* @category Zend +* @package Zend_Feed_Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Entry extends Extension\AbstractEntry { /** * Get the entry comment Uri From 485f5b8d76a74acc0ddcee62ac3f62880900044d Mon Sep 17 00:00:00 2001 From: Padraic Brady Date: Mon, 7 Jun 2010 15:30:07 +0100 Subject: [PATCH 140/238] Completed ReaderTest basics --- src/Reader/Exception.php | 39 +++++ src/Reader/Extension/AbstractFeed.php | 2 +- src/Reader/Extension/DublinCore/Entry.php | 2 +- src/Reader/Feed/AbstractFeed.php | 2 +- src/Reader/Reader.php | 51 +++--- src/Writer/Exception.php | 39 +++++ test/{ => Reader}/ReaderTest.php | 163 +++++++++--------- .../_files/My/Extension/JungleBooks/Entry.php | 10 +- .../_files/My/Extension/JungleBooks/Feed.php | 8 +- 9 files changed, 201 insertions(+), 115 deletions(-) create mode 100644 src/Reader/Exception.php create mode 100644 src/Writer/Exception.php rename test/{ => Reader}/ReaderTest.php (62%) diff --git a/src/Reader/Exception.php b/src/Reader/Exception.php new file mode 100644 index 00000000..64e36a14 --- /dev/null +++ b/src/Reader/Exception.php @@ -0,0 +1,39 @@ + array( - 'DublinCore_Feed', - 'Atom_Feed' + 'DublinCore\\Feed', + 'Atom\\Feed' ), 'entry' => array( - 'Content_Entry', - 'DublinCore_Entry', - 'Atom_Entry' + 'Content\\Entry', + 'DublinCore\\Entry', + 'Atom\\Entry' ), 'core' => array( - 'DublinCore_Feed', - 'Atom_Feed', - 'Content_Entry', - 'DublinCore_Entry', - 'Atom_Entry' + 'DublinCore\\Feed', + 'Atom\\Feed', + 'Content\\Entry', + 'DublinCore\\Entry', + 'Atom\\Entry' ) ); @@ -144,7 +144,7 @@ public static function setCache(\Zend\Cache\Core $cache) * @param \Zend\HTTP\Client $httpClient * @return void */ - public static function setHttpClient(\Zend\HTTP\Client $httpClient) + public static function setHttpClient(HTTP\Client $httpClient) { self::$_httpClient = $httpClient; } @@ -157,8 +157,8 @@ public static function setHttpClient(\Zend\HTTP\Client $httpClient) */ public static function getHttpClient() { - if (!self::$_httpClient instanceof \Zend\HTTP\Client) { - self::$_httpClient = new \Zend\HTTP\Client(); + if (!self::$_httpClient instanceof HTTP\Client) { + self::$_httpClient = new HTTP\Client(); } return self::$_httpClient; @@ -310,7 +310,7 @@ public static function importString($string) if (substr($type, 0, 3) == 'rss') { $reader = new Feed\Rss($dom, $type); } elseif (substr($type, 8, 5) == 'entry') { - $reader = new Entry\Atom($dom->documentElement, 0, Reader::TYPE_ATOM_10); + $reader = new Entry\Atom($dom->documentElement, 0, self::TYPE_ATOM_10); } elseif (substr($type, 0, 4) == 'atom') { $reader = new Feed\Atom($dom, $type); } else { @@ -340,7 +340,6 @@ public static function importFile($filename) public static function findFeedLinks($uri) { - // Get the HTTP response from $uri and save the contents $client = self::getHttpClient(); $client->setUri($uri); $response = $client->request(); @@ -353,16 +352,15 @@ public static function findFeedLinks($uri) $status = $dom->loadHTML($responseHtml); libxml_use_internal_errors($libxml_errflag); if (!$status) { - // Build error message $error = libxml_get_last_error(); if ($error && $error->message) { - $errormsg = "DOMDocument cannot parse HTML: {$error->message}"; + $errormsg = "\DOMDocument cannot parse HTML: {$error->message}"; } else { - $errormsg = "DOMDocument cannot parse HTML: Please check the XML document's validity"; + $errormsg = "\DOMDocument cannot parse HTML: Please check the XML document's validity"; } throw new Exception($errormsg); } - $feedSet = new Reader\FeedSet; + $feedSet = new FeedSet; $links = $dom->getElementsByTagName('link'); $feedSet->addLinks($links, $uri); return $feedSet; @@ -376,7 +374,7 @@ public static function findFeedLinks($uri) */ public static function detectType($feed, $specOnly = false) { - if ($feed instanceof Reader\Feed) { + if ($feed instanceof Feed) { $dom = $feed->getDomDocument(); } elseif($feed instanceof \DOMDocument) { $dom = $feed; @@ -393,11 +391,11 @@ public static function detectType($feed, $specOnly = false) $php_errormsg = '(error message not available)'; } } - throw new Exception("DOMDocument cannot parse XML: $php_errormsg"); + throw new Exception("\DOMDocument cannot parse XML: $php_errormsg"); } } else { throw new Exception('Invalid object/scalar provided: must' - . ' be of type Zend_Feed_Reader_FeedInterface, DomDocument or string'); + . ' be of type \Zend\Feed\Reader\Feed, \DomDocument or string'); } $xpath = new \DOMXPath($dom); @@ -498,7 +496,7 @@ public static function setPluginLoader(PluginLoader\PluginLoaderInterface $loade public static function getPluginLoader() { if (!isset(self::$_pluginLoader)) { - self::$_pluginLoader = PluginLoader(array( + self::$_pluginLoader = new PluginLoader\PluginLoader(array( 'Zend\\Feed\\Reader\\Extension\\' => 'Zend/Feed/Reader/Extension/', )); } @@ -557,18 +555,19 @@ public static function registerExtension($name) try { self::getPluginLoader()->load($feedName); self::$_extensions['feed'][] = $feedName; - } catch (Zend_Loader_PluginLoader_Exception $e) { + } catch (PluginLoader\Exception $e) { } try { self::getPluginLoader()->load($entryName); self::$_extensions['entry'][] = $entryName; - } catch (Zend_Loader_PluginLoader_Exception $e) { + } catch (PluginLoader\Exception $e) { } if (!self::getPluginLoader()->isLoaded($feedName) && !self::getPluginLoader()->isLoaded($entryName) ) { throw new Exception('Could not load extension: ' . $name - . 'using Plugin Loader. Check prefix paths are configured and extension exists.'); + . ' using Plugin Loader. Check prefix paths are configured and' + . ' extension exists.'); } } diff --git a/src/Writer/Exception.php b/src/Writer/Exception.php new file mode 100644 index 00000000..c9c2a8cc --- /dev/null +++ b/src/Writer/Exception.php @@ -0,0 +1,39 @@ +_feedSamplePath = dirname(__FILE__) . '/Reader/_files'; + $this->_feedSamplePath = dirname(__FILE__) . '/_files'; } public function tearDown() { - Zend_Feed_Reader::reset(); + Reader\Reader::reset(); } public function testDetectsFeedIsRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss20.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_20, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_RSS_20, $type); } public function testDetectsFeedIsRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss094.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_094, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_RSS_094, $type); } public function testDetectsFeedIsRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss093.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_093, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_RSS_093, $type); } public function testDetectsFeedIsRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss092.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_092, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_RSS_092, $type); } public function testDetectsFeedIsRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss091.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_091, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_RSS_091, $type); } public function testDetectsFeedIsRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss10.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_10, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_RSS_10, $type); } public function testDetectsFeedIsRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/rss090.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_090, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_RSS_090, $type); } public function testDetectsFeedIsAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/atom10.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_ATOM_10, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_ATOM_10, $type); } public function testDetectsFeedIsAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/Reader/atom03.xml')); - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_ATOM_03, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_ATOM_03, $type); } /** @@ -126,14 +128,14 @@ public function testDetectsFeedIsAtom03() public function testDetectsTypeFromStringOrToRemindPaddyAboutForgettingATestWhichLetsAStupidTypoSurviveUnnoticedForMonths() { $feed = ''; - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_10, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_RSS_10, $type); } public function testGetEncoding() { - $feed = Zend_Feed_Reader::importString( - file_get_contents(dirname(__FILE__) . '/Reader/Entry/_files/Atom/title/plain/atom10.xml') + $feed = Reader\Reader::importString( + file_get_contents(dirname(__FILE__) . '/Entry/_files/Atom/title/plain/atom10.xml') ); $this->assertEquals('utf-8', $feed->getEncoding()); @@ -143,10 +145,10 @@ public function testGetEncoding() public function testImportsFile() { try { - $feed = Zend_Feed_Reader::importFile( - dirname(__FILE__) . '/Reader/Entry/_files/Atom/title/plain/atom10.xml' + $feed = Reader\Reader::importFile( + dirname(__FILE__) . '/Entry/_files/Atom/title/plain/atom10.xml' ); - } catch(Exception $e) { + } catch(\Exception $e) { $this->fail($e->getMessage()); } } @@ -161,8 +163,8 @@ public function testImportsUri() } try { - $feed = Zend_Feed_Reader::import('http://www.planet-php.net/rdf/'); - } catch(Exception $e) { + $feed = Reader\Reader::import('http://www.planet-php.net/rdf/'); + } catch(\Exception $e) { $this->fail($e->getMessage()); } } @@ -180,21 +182,21 @@ public function testImportsUriAndThrowsExceptionIfNotAFeed() return; } - $feed = Zend_Feed_Reader::import('http://twitter.com/alganet'); + $feed = Reader\Reader::import('http://twitter.com/alganet'); } public function testGetsFeedLinksAsValueObject() { - if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + if (!defined('TESTS_Reader\Reader_ONLINE_ENABLED') + || !constant('TESTS_Reader\Reader_ONLINE_ENABLED') ) { $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); return; } try { - $links = Zend_Feed_Reader::findFeedLinks('http://www.planet-php.net'); - } catch(Exception $e) { + $links = Reader\Reader::findFeedLinks('http://www.planet-php.net'); + } catch(\Exception $e) { $this->fail($e->getMessage()); } $this->assertEquals('http://www.planet-php.org/rss/', $links->rss); @@ -202,14 +204,14 @@ public function testGetsFeedLinksAsValueObject() public function testCompilesLinksAsArrayObject() { - if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') + if (!defined('TESTS_Reader\Reader_ONLINE_ENABLED') + || !constant('TESTS_Reader\Reader_ONLINE_ENABLED') ) { $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); return; } - $links = Zend_Feed_Reader::findFeedLinks('http://www.planet-php.net'); - $this->assertTrue($links instanceof Zend_Feed_Reader_FeedSet); + $links = Reader\Reader::findFeedLinks('http://www.planet-php.net'); + $this->assertTrue($links instanceof Reader\FeedSet); $this->assertEquals(array( 'rel' => 'alternate', 'type' => 'application/rss+xml', 'href' => 'http://www.planet-php.org/rss/' ), (array) $links->getIterator()->current()); @@ -223,9 +225,9 @@ public function testFeedSetLoadsFeedObjectWhenFeedArrayKeyAccessed() $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); return; } - $links = Zend_Feed_Reader::findFeedLinks('http://www.planet-php.net'); + $links = Reader\Reader::findFeedLinks('http://www.planet-php.net'); $link = $links->getIterator()->current(); - $this->assertTrue($link['feed'] instanceof Zend_Feed_Reader_Feed_Rss); + $this->assertTrue($link['feed'] instanceof Reader\Feed\Rss); } public function testZeroCountFeedSetReturnedFromEmptyList() @@ -236,7 +238,7 @@ public function testZeroCountFeedSetReturnedFromEmptyList() $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); return; } - $links = Zend_Feed_Reader::findFeedLinks('http://www.example.com'); + $links = Reader\Reader::findFeedLinks('http://www.example.com'); $this->assertEquals(0, count($links)); } @@ -253,8 +255,8 @@ public function testGetsFeedLinksAndTrimsNewlines() } try { - $links = Zend_Feed_Reader::findFeedLinks('http://www.infopod.com.br'); - } catch(Exception $e) { + $links = Reader\Reader::findFeedLinks('http://www.infopod.com.br'); + } catch(\Exception $e) { $this->fail($e->getMessage()); } $this->assertEquals('http://feeds.feedburner.com/jonnyken/infoblog', $links->rss); @@ -273,8 +275,8 @@ public function testGetsFeedLinksAndNormalisesRelativeUrls() } try { - $links = Zend_Feed_Reader::findFeedLinks('http://meiobit.com'); - } catch(Exception $e) { + $links = Reader\Reader::findFeedLinks('http://meiobit.com'); + } catch(\Exception $e) { $this->fail($e->getMessage()); } $this->assertEquals('http://meiobit.com/rss.xml', $links->rss); @@ -285,17 +287,18 @@ public function testGetsFeedLinksAndNormalisesRelativeUrls() */ public function testGetsFeedLinksAndNormalisesRelativeUrlsOnUriWithPath() { + $this->markTestIncomplete('Pending fix to \Zend\URI\URL::validate()'); try { - $currClient = Zend_Feed_Reader::getHttpClient(); + $currClient = Reader\Reader::getHttpClient(); - $testAdapter = new Zend_Http_Client_Adapter_Test(); - $testAdapter->setResponse(new Zend_Http_Response(200, array(), '')); - Zend_Feed_Reader::setHttpClient(new Zend_Http_Client(null, array('adapter' => $testAdapter))); + $testAdapter = new \Zend\HTTP\Client\Adapter\Test(); + $testAdapter->setResponse(new \Zend\HTTP\Response\Response(200, array(), '')); + Reader\Reader::setHttpClient(new \Zend\HTTP\Client(null, array('adapter' => $testAdapter))); - $links = Zend_Feed_Reader::findFeedLinks('http://foo/bar'); + $links = Reader\Reader::findFeedLinks('http://foo/bar'); - Zend_Feed_Reader::setHttpClient($currClient); - } catch(Exception $e) { + Reader\Reader::setHttpClient($currClient); + } catch(\Exception $e) { $this->fail($e->getMessage()); } @@ -305,20 +308,20 @@ public function testGetsFeedLinksAndNormalisesRelativeUrlsOnUriWithPath() public function testAddsPrefixPath() { - Zend_Feed_Reader::addPrefixPath('A_B_C', '/A/B/C'); - $prefixPaths = Zend_Feed_Reader::getPluginLoader()->getPaths(); - $this->assertEquals('/A/B/C/', $prefixPaths['A_B_C_'][0]); + Reader\Reader::addPrefixPath('A\\B\\C', '/A/B/C'); + $prefixPaths = Reader\Reader::getPluginLoader()->getPaths(); + $this->assertEquals('/A/B/C/', $prefixPaths['A\\B\\C\\'][0]); } public function testRegistersUserExtension() { try { - Zend_Feed_Reader::addPrefixPath('My_FeedReader_Extension',dirname(__FILE__) . '/Reader/_files/My/Extension'); - Zend_Feed_Reader::registerExtension('JungleBooks'); - } catch(Exception $e) { + Reader\Reader::addPrefixPath('My\\FeedReader\\Extension', dirname(__FILE__) . '/_files/My/Extension'); + Reader\Reader::registerExtension('JungleBooks'); + } catch(\Exception $e) { $this->fail($e->getMessage()); } - $this->assertTrue(Zend_Feed_Reader::isRegistered('JungleBooks')); + $this->assertTrue(Reader\Reader::isRegistered('JungleBooks')); } protected function _getTempDirectory() diff --git a/test/Reader/_files/My/Extension/JungleBooks/Entry.php b/test/Reader/_files/My/Extension/JungleBooks/Entry.php index ef8ad1cf..dc195129 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Entry.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Entry.php @@ -20,9 +20,11 @@ * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -require_once 'Zend/Feed/Reader.php'; - -require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; +/** + * @namespace + */ +namespace My\FeedReader\Extension\JungleBooks; +use Zend\Feed\Reader\Extension; /** * @category Zend @@ -31,7 +33,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class My_FeedReader_Extension_JungleBooks_Entry extends Zend_Feed_Reader_Extension_EntryAbstract +class Entry extends Extension\AbstractEntry { public function getIsbn() diff --git a/test/Reader/_files/My/Extension/JungleBooks/Feed.php b/test/Reader/_files/My/Extension/JungleBooks/Feed.php index fb460e9c..72954472 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Feed.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Feed.php @@ -20,7 +20,11 @@ * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php'; +/** + * @namespace + */ +namespace My\FeedReader\Extension\JungleBooks; +use Zend\Feed\Reader\Extension; /** * @category Zend @@ -29,7 +33,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class My_FeedReader_Extension_JungleBooks_Feed extends Zend_Feed_Reader_Extension_FeedAbstract +class Feed extends Extension\AbstractFeed { public function getDaysPopularBookLink() From b2584f63fbb12edd6a27ca0080530bd32aa25bfa Mon Sep 17 00:00:00 2001 From: Padraic Brady Date: Mon, 7 Jun 2010 16:03:26 +0100 Subject: [PATCH 141/238] Test pass 1 on Reader\Feed - 2 failures --- src/Reader/Collection/AbstractCollection.php | 5 + src/Reader/Extension/Atom/Entry.php | 2 +- src/Reader/Extension/DublinCore/Feed.php | 1 + src/Reader/Feed/Atom.php | 2 +- src/Reader/Feed/Atom/Source.php | 3 +- src/Reader/Feed/Rss.php | 3 +- test/Reader/Feed/AtomSourceTest.php | 78 +- test/Reader/Feed/AtomTest.php | 140 ++-- test/Reader/Feed/CommonTest.php | 58 +- test/Reader/Feed/RssTest.php | 767 ++++++++++--------- 10 files changed, 540 insertions(+), 519 deletions(-) diff --git a/src/Reader/Collection/AbstractCollection.php b/src/Reader/Collection/AbstractCollection.php index ec54fe7e..0e1886a2 100644 --- a/src/Reader/Collection/AbstractCollection.php +++ b/src/Reader/Collection/AbstractCollection.php @@ -18,6 +18,11 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: CollectionAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $ */ + +/** + * @namespace + */ +namespace Zend\Feed\Reader\Collection; /** * @category Zend diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 5b0711d5..0dcc0309 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -554,7 +554,7 @@ public function getSource() $list = $this->getXpath()->query($this->getXpathPrefix() . '/atom:source[1]'); if ($list->length) { $element = $list->item(0); - $source = new Reader\Reader_Feed_Atom_Source($element, $this->getXpathPrefix()); + $source = new Reader\Feed\Atom\Source($element, $this->getXpathPrefix()); } } diff --git a/src/Reader/Extension/DublinCore/Feed.php b/src/Reader/Extension/DublinCore/Feed.php index eeba270d..4a80b40a 100644 --- a/src/Reader/Extension/DublinCore/Feed.php +++ b/src/Reader/Extension/DublinCore/Feed.php @@ -23,6 +23,7 @@ * @namespace */ namespace Zend\Feed\Reader\Extension\DublinCore; +use Zend\Feed\Reader; use Zend\Feed\Reader\Collection; use Zend\Feed\Reader\Extension; use Zend\Date; diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index 3b7ec9a6..ee33029e 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -48,7 +48,7 @@ public function __construct(\DOMDocument $dom, $type = null) { parent::__construct($dom, $type); $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\\Feed'); - $this->_extensions['Atom_Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); + $this->_extensions['Atom\\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); $atomClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\\Feed'); $this->_extensions['DublinCore\\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); foreach ($this->_extensions as $extension) { diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php index c744ba7b..5ba0184b 100644 --- a/src/Reader/Feed/Atom/Source.php +++ b/src/Reader/Feed/Atom/Source.php @@ -24,6 +24,7 @@ */ namespace Zend\Feed\Reader\Feed\Atom; use Zend\Feed\Reader; +use Zend\Feed\Reader\Feed; use Zend\Date; /** @@ -35,7 +36,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Source extends Atom +class Source extends Feed\Atom { /** diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index dd67fc05..357440fc 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -24,6 +24,7 @@ */ namespace Zend\Feed\Reader\Feed; use Zend\Feed\Reader; +use Zend\Feed\Reader\Collection; use Zend\Date; /** @@ -659,7 +660,7 @@ public function getCategories() } if ($list->length) { - $categoryCollection = new Reader_Collection_Category; + $categoryCollection = new Collection\Category; foreach ($list as $category) { $categoryCollection[] = array( 'term' => $category->nodeValue, diff --git a/test/Reader/Feed/AtomSourceTest.php b/test/Reader/Feed/AtomSourceTest.php index 1255ee2c..fc1f7057 100644 --- a/test/Reader/Feed/AtomSourceTest.php +++ b/test/Reader/Feed/AtomSourceTest.php @@ -20,19 +20,23 @@ * @version $Id: AtomTest.php 19168 2009-11-21 17:17:18Z padraic $ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; +/** +* @namespace +*/ +namespace ZendTest\Feed\Reader\Feed; +use Zend\Feed\Reader; +use Zend\Date; /** - * @category Zend - * @package Zend_Feed - * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @group Zend_Feed - * @group Zend_Feed_Reader - */ -class Zend_Feed_Reader_Feed_AtomSourceTest extends PHPUnit_Framework_TestCase +* @category Zend +* @package Zend_Feed +* @subpackage UnitTests +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +* @group Zend_Feed +* @group Zend_Feed_Reader +*/ +class AtomSourceTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -45,19 +49,19 @@ class Zend_Feed_Reader_Feed_AtomSourceTest extends PHPUnit_Framework_TestCase public function setup() { - Zend_Feed_Reader::reset(); - if (Zend_Registry::isRegistered('Zend_Locale')) { - $registry = Zend_Registry::getInstance(); + Reader\Reader::reset(); + if (\Zend\Registry::isRegistered('Zend_Locale')) { + $registry = \Zend\Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/AtomSource'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -91,16 +95,16 @@ public function setup() public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } public function testGetsSourceFromEntry() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/atom10.xml') ); $source = $feed->current()->getSource(); - $this->assertTrue($source instanceof Zend_Feed_Reader_Feed_Atom_Source); + $this->assertTrue($source instanceof Reader\Feed\Atom\Source); } /** @@ -109,7 +113,7 @@ public function testGetsSourceFromEntry() public function testGetsTitleFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/atom10.xml') ); $source = $feed->current()->getSource(); @@ -122,7 +126,7 @@ public function testGetsTitleFromAtom10() public function testGetsAuthorArrayFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/atom10.xml') ); $source = $feed->current()->getSource(); @@ -145,7 +149,7 @@ public function testGetsAuthorArrayFromAtom10() public function testGetsSingleAuthorFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/atom10.xml') ); $source = $feed->current()->getSource(); @@ -159,13 +163,13 @@ public function testGetsSingleAuthorFromAtom10() public function testGetsDateCreatedFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/atom10.xml') ); $source = $feed->current()->getSource(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($source->getDateCreated())); } @@ -175,13 +179,13 @@ public function testGetsDateCreatedFromAtom10() public function testGetsDateModifiedFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/atom10.xml') ); $source = $feed->current()->getSource(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($source->getDateModified())); } @@ -191,7 +195,7 @@ public function testGetsDateModifiedFromAtom10() public function testGetsGeneratorFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/atom10.xml') ); $source = $feed->current()->getSource(); @@ -204,7 +208,7 @@ public function testGetsGeneratorFromAtom10() public function testGetsCopyrightFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/atom10.xml') ); $source = $feed->current()->getSource(); @@ -217,7 +221,7 @@ public function testGetsCopyrightFromAtom10() public function testGetsDescriptionFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/atom10.xml') ); $source = $feed->current()->getSource(); @@ -230,7 +234,7 @@ public function testGetsDescriptionFromAtom10() public function testGetsIdFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/atom10.xml') ); $source = $feed->current()->getSource(); @@ -243,7 +247,7 @@ public function testGetsIdFromAtom10() public function testGetsLanguageFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/atom10.xml') ); $source = $feed->current()->getSource(); @@ -256,7 +260,7 @@ public function testGetsLanguageFromAtom10() public function testGetsLinkFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/atom10.xml') ); $source = $feed->current()->getSource(); @@ -269,7 +273,7 @@ public function testGetsLinkFromAtom10() public function testGetsFeedLinkFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/atom10.xml') ); $source = $feed->current()->getSource(); @@ -281,7 +285,7 @@ public function testGetsFeedLinkFromAtom10() */ public function testGetsHubsFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/atom10.xml') ); $source = $feed->current()->getSource(); @@ -296,7 +300,7 @@ public function testGetsHubsFromAtom10() */ public function testGetsCategoriesFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/atom10.xml') ); $source = $feed->current()->getSource(); diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 237b254d..e1b850c3 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -20,19 +20,23 @@ * @version $Id: AtomTest.php 22107 2010-05-05 13:42:20Z padraic $ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; +/** +* @namespace +*/ +namespace ZendTest\Feed\Reader\Feed; +use Zend\Feed\Reader; +use Zend\Date; /** - * @category Zend - * @package Zend_Feed - * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @group Zend_Feed - * @group Zend_Feed_Reader - */ -class Zend_Feed_Reader_Feed_AtomTest extends PHPUnit_Framework_TestCase +* @category Zend +* @package Zend_Feed +* @subpackage UnitTests +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +* @group Zend_Feed +* @group Zend_Feed_Reader +*/ +class AtomTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -45,19 +49,19 @@ class Zend_Feed_Reader_Feed_AtomTest extends PHPUnit_Framework_TestCase public function setup() { - Zend_Feed_Reader::reset(); - if (Zend_Registry::isRegistered('Zend_Locale')) { - $registry = Zend_Registry::getInstance(); + Reader\Reader::reset(); + if (\Zend\Registry::isRegistered('Zend_Locale')) { + $registry = \Zend\Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Atom'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -91,7 +95,7 @@ public function setup() public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } /** @@ -99,7 +103,7 @@ public function teardown() */ public function testGetsTitleFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom03.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -107,7 +111,7 @@ public function testGetsTitleFromAtom03() public function testGetsTitleFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -118,7 +122,7 @@ public function testGetsTitleFromAtom10() */ public function testGetsAuthorArrayFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom03.xml') ); @@ -136,7 +140,7 @@ public function testGetsAuthorArrayFromAtom03() public function testGetsAuthorArrayFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10.xml') ); @@ -157,7 +161,7 @@ public function testGetsAuthorArrayFromAtom10() */ public function testGetsSingleAuthorFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom03.xml') ); @@ -166,7 +170,7 @@ public function testGetsSingleAuthorFromAtom03() public function testGetsSingleAuthorFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10.xml') ); @@ -178,22 +182,22 @@ public function testGetsSingleAuthorFromAtom10() */ public function testGetsDateCreatedFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom03.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateCreated())); } public function testGetsDateCreatedFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom10.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateCreated())); } @@ -202,23 +206,23 @@ public function testGetsDateCreatedFromAtom10() */ public function testGetsDateModifiedFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom03.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom10.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } @@ -227,7 +231,7 @@ public function testGetsDateModifiedFromAtom10() */ public function testGetsLastBuildDateAlwaysReturnsNullForAtom() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10.xml') ); $this->assertNull($feed->getLastBuildDate()); @@ -238,7 +242,7 @@ public function testGetsLastBuildDateAlwaysReturnsNullForAtom() */ public function testGetsGeneratorFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/atom03.xml') ); $this->assertEquals('Zend_Feed', $feed->getGenerator()); @@ -246,7 +250,7 @@ public function testGetsGeneratorFromAtom03() public function testGetsGeneratorFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/atom10.xml') ); $this->assertEquals('Zend_Feed', $feed->getGenerator()); @@ -257,7 +261,7 @@ public function testGetsGeneratorFromAtom10() */ public function testGetsCopyrightFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/atom03.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -265,7 +269,7 @@ public function testGetsCopyrightFromAtom03() public function testGetsCopyrightFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/atom10.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -276,7 +280,7 @@ public function testGetsCopyrightFromAtom10() */ public function testGetsDescriptionFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/atom03.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -284,7 +288,7 @@ public function testGetsDescriptionFromAtom03() public function testGetsDescriptionFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/atom10.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -295,7 +299,7 @@ public function testGetsDescriptionFromAtom10() */ public function testGetsIdFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/atom03.xml') ); $this->assertEquals('123', $feed->getId()); @@ -303,7 +307,7 @@ public function testGetsIdFromAtom03() public function testGetsIdFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/atom10.xml') ); $this->assertEquals('123', $feed->getId()); @@ -314,7 +318,7 @@ public function testGetsIdFromAtom10() */ public function testGetsLanguageFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/atom03.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -322,7 +326,7 @@ public function testGetsLanguageFromAtom03() public function testGetsLanguageFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/atom10.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -333,7 +337,7 @@ public function testGetsLanguageFromAtom10() */ public function testGetsLinkFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/atom03.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -341,7 +345,7 @@ public function testGetsLinkFromAtom03() public function testGetsLinkFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/atom10.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -349,7 +353,7 @@ public function testGetsLinkFromAtom10() public function testGetsLinkFromAtom10WithNoRelAttribute() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/atom10-norel.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -357,7 +361,7 @@ public function testGetsLinkFromAtom10WithNoRelAttribute() public function testGetsLinkFromAtom10WithRelativeUrl() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/atom10-relative.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -368,7 +372,7 @@ public function testGetsLinkFromAtom10WithRelativeUrl() */ public function testGetsBaseUriFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom10-relative.xml') ); $this->assertEquals('http://www.example.com/', $feed->getBaseUrl()); @@ -379,7 +383,7 @@ public function testGetsBaseUriFromAtom10() */ public function testGetsFeedLinkFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom03.xml') ); $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); @@ -387,7 +391,7 @@ public function testGetsFeedLinkFromAtom03() public function testGetsFeedLinkFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom10.xml') ); $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); @@ -395,7 +399,7 @@ public function testGetsFeedLinkFromAtom10() public function testGetsFeedLinkFromAtom10IfRelativeUri() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom10-relative.xml') ); $this->assertEquals('http://www.example.com/feed/atom', $feed->getFeedLink()); @@ -403,7 +407,7 @@ public function testGetsFeedLinkFromAtom10IfRelativeUri() public function testGetsOriginalSourceUriIfFeedLinkNotAvailableFromFeed() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom10_NoFeedLink.xml') ); $feed->setOriginalSourceUri('http://www.example.com/feed/atom'); @@ -415,7 +419,7 @@ public function testGetsOriginalSourceUriIfFeedLinkNotAvailableFromFeed() */ public function testGetsHubsFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom03.xml') ); $this->assertEquals(array( @@ -426,7 +430,7 @@ public function testGetsHubsFromAtom03() public function testGetsHubsFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10.xml') ); $this->assertEquals(array( @@ -442,7 +446,7 @@ public function testGetsHubsFromAtom10() public function testCountableInterface() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/atom10.xml') ); $this->assertEquals(0, count($feed)); @@ -456,7 +460,7 @@ public function testCountableInterface() public function testGetsCategoriesFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10.xml') ); $this->assertEquals($this->_expectedCats, (array) $feed->getCategories()); @@ -465,7 +469,7 @@ public function testGetsCategoriesFromAtom10() public function testGetsCategoriesFromAtom03_Atom10Extension() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom03.xml') ); $this->assertEquals($this->_expectedCats, (array) $feed->getCategories()); @@ -476,7 +480,7 @@ public function testGetsCategoriesFromAtom03_Atom10Extension() public function testGetsCategoriesFromAtom03_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/atom03.xml') ); $this->assertEquals($this->_expectedCatsDc, (array) $feed->getCategories()); @@ -485,7 +489,7 @@ public function testGetsCategoriesFromAtom03_Dc10() public function testGetsCategoriesFromAtom03_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/atom03.xml') ); $this->assertEquals($this->_expectedCatsDc, (array) $feed->getCategories()); @@ -496,7 +500,7 @@ public function testGetsCategoriesFromAtom03_Dc11() public function testGetsCategoriesFromAtom10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/atom10.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -505,7 +509,7 @@ public function testGetsCategoriesFromAtom10_None() public function testGetsCategoriesFromAtom03_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/atom03.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -517,7 +521,7 @@ public function testGetsCategoriesFromAtom03_None() */ public function testGetsImageFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/atom03.xml') ); $this->assertEquals(array('uri'=>'http://www.example.com/logo.gif'), $feed->getImage()); @@ -525,7 +529,7 @@ public function testGetsImageFromAtom03() public function testGetsImageFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/atom10.xml') ); $this->assertEquals(array('uri'=>'http://www.example.com/logo.gif'), $feed->getImage()); @@ -536,7 +540,7 @@ public function testGetsImageFromAtom10() */ public function testGetsImageFromAtom03_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/none/atom03.xml') ); $this->assertEquals(null, $feed->getImage()); @@ -544,7 +548,7 @@ public function testGetsImageFromAtom03_None() public function testGetsImageFromAtom10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/none/atom10.xml') ); $this->assertEquals(null, $feed->getImage()); diff --git a/test/Reader/Feed/CommonTest.php b/test/Reader/Feed/CommonTest.php index d70d34c6..3766824a 100644 --- a/test/Reader/Feed/CommonTest.php +++ b/test/Reader/Feed/CommonTest.php @@ -20,29 +20,31 @@ * @version $Id: CommonTest.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; -require_once 'Zend/Registry.php'; +/** +* @namespace +*/ +namespace ZendTest\Feed\Reader\Feed; +use Zend\Feed\Reader; /** - * @category Zend - * @package Zend_Feed - * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @group Zend_Feed - * @group Zend_Feed_Reader - */ -class Zend_Feed_Reader_Feed_CommonTest extends PHPUnit_Framework_TestCase +* @category Zend +* @package Zend_Feed +* @subpackage UnitTests +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +* @group Zend_Feed +* @group Reader\Reader +*/ +class CommonTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Zend_Feed_Reader::reset(); - if (Zend_Registry::isRegistered('Zend_Locale')) { - $registry = Zend_Registry::getInstance(); + Reader\Reader::reset(); + if (\Zend\Registry::isRegistered('Zend_Locale')) { + $registry = \Zend\Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Common'; @@ -53,23 +55,23 @@ public function setup() */ public function testGetsDomDocumentObject() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); - $this->assertTrue($feed->getDomDocument() instanceof DOMDocument); + $this->assertTrue($feed->getDomDocument() instanceof \DOMDocument); } public function testGetsDomXpathObject() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); - $this->assertTrue($feed->getXpath() instanceof DOMXPath); + $this->assertTrue($feed->getXpath() instanceof \DOMXPath); } public function testGetsXpathPrefixString() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $this->assertTrue($feed->getXpathPrefix() == '/atom:feed'); @@ -77,15 +79,15 @@ public function testGetsXpathPrefixString() public function testGetsDomElementObject() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); - $this->assertTrue($feed->getElement() instanceof DOMElement); + $this->assertTrue($feed->getElement() instanceof \DOMElement); } public function testSaveXmlOutputsXmlStringForFeed() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $this->assertEquals($feed->saveXml(), file_get_contents($this->_feedSamplePath.'/atom_rewrittenbydom.xml')); @@ -93,15 +95,15 @@ public function testSaveXmlOutputsXmlStringForFeed() public function testGetsNamedExtension() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); - $this->assertTrue($feed->getExtension('Atom') instanceof Zend_Feed_Reader_Extension_Atom_Feed); + $this->assertTrue($feed->getExtension('Atom') instanceof Reader\Extension\Atom\Feed); } public function testReturnsNullIfExtensionDoesNotExist() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $this->assertEquals(null, $feed->getExtension('Foo')); @@ -112,7 +114,7 @@ public function testReturnsNullIfExtensionDoesNotExist() */ public function testReturnsEncodingOfFeed() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $this->assertEquals('UTF-8', $feed->getEncoding()); @@ -123,7 +125,7 @@ public function testReturnsEncodingOfFeed() */ public function testReturnsEncodingOfFeedAsUtf8IfUndefined() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom_noencodingdefined.xml') ); $this->assertEquals('UTF-8', $feed->getEncoding()); diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index e8dc3d2c..c6426306 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -20,20 +20,23 @@ * @version $Id: RssTest.php 22297 2010-05-25 21:33:38Z padraic $ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; -require_once 'Zend/Registry.php'; +/** +* @namespace +*/ +namespace ZendTest\Feed\Reader\Feed; +use Zend\Feed\Reader; +use Zend\Date; /** - * @category Zend - * @package Zend_Feed - * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @group Zend_Feed - * @group Zend_Feed_Reader - */ -class Zend_Feed_Reader_Feed_RssTest extends PHPUnit_Framework_TestCase +* @category Zend +* @package Zend_Feed +* @subpackage UnitTests +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +* @group Zend_Feed +* @group Zend_Feed_Reader +*/ +class RssTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -46,19 +49,19 @@ class Zend_Feed_Reader_Feed_RssTest extends PHPUnit_Framework_TestCase public function setup() { - Zend_Feed_Reader::reset(); - if (Zend_Registry::isRegistered('Zend_Locale')) { - $registry = Zend_Registry::getInstance(); + Reader\Reader::reset(); + if (\Zend\Registry::isRegistered('Zend_Locale')) { + $registry = \Zend\Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Rss'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -109,7 +112,7 @@ public function setup() public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } /** @@ -117,7 +120,7 @@ public function teardown() */ public function testGetsTitleFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss20.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -125,7 +128,7 @@ public function testGetsTitleFromRss20() public function testGetsTitleFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss094.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -133,7 +136,7 @@ public function testGetsTitleFromRss094() public function testGetsTitleFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss093.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -141,7 +144,7 @@ public function testGetsTitleFromRss093() public function testGetsTitleFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss092.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -149,7 +152,7 @@ public function testGetsTitleFromRss092() public function testGetsTitleFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss091.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -157,7 +160,7 @@ public function testGetsTitleFromRss091() public function testGetsTitleFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss10.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -165,7 +168,7 @@ public function testGetsTitleFromRss10() public function testGetsTitleFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss090.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -175,7 +178,7 @@ public function testGetsTitleFromRss090() public function testGetsTitleFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss20.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -183,7 +186,7 @@ public function testGetsTitleFromRss20_Dc10() public function testGetsTitleFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss094.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -191,7 +194,7 @@ public function testGetsTitleFromRss094_Dc10() public function testGetsTitleFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss093.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -199,7 +202,7 @@ public function testGetsTitleFromRss093_Dc10() public function testGetsTitleFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss092.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -207,7 +210,7 @@ public function testGetsTitleFromRss092_Dc10() public function testGetsTitleFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss091.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -215,7 +218,7 @@ public function testGetsTitleFromRss091_Dc10() public function testGetsTitleFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss10.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -223,7 +226,7 @@ public function testGetsTitleFromRss10_Dc10() public function testGetsTitleFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss090.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -233,7 +236,7 @@ public function testGetsTitleFromRss090_Dc10() public function testGetsTitleFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss20.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -241,7 +244,7 @@ public function testGetsTitleFromRss20_Dc11() public function testGetsTitleFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss094.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -249,7 +252,7 @@ public function testGetsTitleFromRss094_Dc11() public function testGetsTitleFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss093.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -257,7 +260,7 @@ public function testGetsTitleFromRss093_Dc11() public function testGetsTitleFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss092.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -265,7 +268,7 @@ public function testGetsTitleFromRss092_Dc11() public function testGetsTitleFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss091.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -273,7 +276,7 @@ public function testGetsTitleFromRss091_Dc11() public function testGetsTitleFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss10.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -281,7 +284,7 @@ public function testGetsTitleFromRss10_Dc11() public function testGetsTitleFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss090.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -291,7 +294,7 @@ public function testGetsTitleFromRss090_Dc11() public function testGetsTitleFromRss20_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss20.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -299,7 +302,7 @@ public function testGetsTitleFromRss20_atom10() public function testGetsTitleFromRss094_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss094.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -307,7 +310,7 @@ public function testGetsTitleFromRss094_atom10() public function testGetsTitleFromRss093_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss093.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -315,7 +318,7 @@ public function testGetsTitleFromRss093_atom10() public function testGetsTitleFromRss092_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss092.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -323,7 +326,7 @@ public function testGetsTitleFromRss092_atom10() public function testGetsTitleFromRss091_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss091.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -331,7 +334,7 @@ public function testGetsTitleFromRss091_atom10() public function testGetsTitleFromRss10_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss10.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -339,7 +342,7 @@ public function testGetsTitleFromRss10_atom10() public function testGetsTitleFromRss090_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/atom10/rss090.xml') ); $this->assertEquals('My Title', $feed->getTitle()); @@ -349,7 +352,7 @@ public function testGetsTitleFromRss090_atom10() public function testGetsTitleFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -357,7 +360,7 @@ public function testGetsTitleFromRss20_None() public function testGetsTitleFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -365,7 +368,7 @@ public function testGetsTitleFromRss094_None() public function testGetsTitleFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -373,7 +376,7 @@ public function testGetsTitleFromRss093_None() public function testGetsTitleFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -381,7 +384,7 @@ public function testGetsTitleFromRss092_None() public function testGetsTitleFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -389,7 +392,7 @@ public function testGetsTitleFromRss091_None() public function testGetsTitleFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -397,7 +400,7 @@ public function testGetsTitleFromRss10_None() public function testGetsTitleFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getTitle()); @@ -408,7 +411,7 @@ public function testGetsTitleFromRss090_None() */ public function testGetsAuthorArrayFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') ); $this->assertEquals(array( @@ -420,7 +423,7 @@ public function testGetsAuthorArrayFromRss20() public function testGetsAuthorArrayFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') ); $this->assertEquals(array( @@ -432,7 +435,7 @@ public function testGetsAuthorArrayFromRss094() public function testGetsAuthorArrayFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') ); $this->assertEquals(array( @@ -444,7 +447,7 @@ public function testGetsAuthorArrayFromRss093() public function testGetsAuthorArrayFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') ); $this->assertEquals(array( @@ -456,7 +459,7 @@ public function testGetsAuthorArrayFromRss092() public function testGetsAuthorArrayFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') ); $this->assertEquals(array( @@ -468,7 +471,7 @@ public function testGetsAuthorArrayFromRss091() public function testGetsAuthorArrayFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') ); $this->assertEquals(array( @@ -480,7 +483,7 @@ public function testGetsAuthorArrayFromRss10() public function testGetsAuthorArrayFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') ); $this->assertEquals(array( @@ -494,7 +497,7 @@ public function testGetsAuthorArrayFromRss090() public function testGetsAuthorArrayFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') ); $this->assertEquals(array( @@ -505,7 +508,7 @@ public function testGetsAuthorArrayFromRss20_Dc10() public function testGetsAuthorArrayFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') ); $this->assertEquals(array( @@ -516,7 +519,7 @@ public function testGetsAuthorArrayFromRss094_Dc10() public function testGetsAuthorArrayFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') ); $this->assertEquals(array( @@ -527,7 +530,7 @@ public function testGetsAuthorArrayFromRss093_Dc10() public function testGetsAuthorArrayFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') ); $this->assertEquals(array( @@ -538,7 +541,7 @@ public function testGetsAuthorArrayFromRss092_Dc10() public function testGetsAuthorArrayFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') ); $this->assertEquals(array( @@ -549,7 +552,7 @@ public function testGetsAuthorArrayFromRss091_Dc10() public function testGetsAuthorArrayFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') ); $this->assertEquals(array( @@ -560,7 +563,7 @@ public function testGetsAuthorArrayFromRss10_Dc10() public function testGetsAuthorArrayFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') ); $this->assertEquals(array( @@ -573,7 +576,7 @@ public function testGetsAuthorArrayFromRss090_Dc10() public function testGetsAuthorArrayFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') ); $this->assertEquals(array( @@ -584,7 +587,7 @@ public function testGetsAuthorArrayFromRss20_Dc11() public function testGetsAuthorArrayFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') ); $this->assertEquals(array( @@ -595,7 +598,7 @@ public function testGetsAuthorArrayFromRss094_Dc11() public function testGetsAuthorArrayFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') ); $this->assertEquals(array( @@ -606,7 +609,7 @@ public function testGetsAuthorArrayFromRss093_Dc11() public function testGetsAuthorArrayFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') ); $this->assertEquals(array( @@ -617,7 +620,7 @@ public function testGetsAuthorArrayFromRss092_Dc11() public function testGetsAuthorArrayFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') ); $this->assertEquals(array( @@ -628,7 +631,7 @@ public function testGetsAuthorArrayFromRss091_Dc11() public function testGetsAuthorArrayFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') ); $this->assertEquals(array( @@ -639,7 +642,7 @@ public function testGetsAuthorArrayFromRss10_Dc11() public function testGetsAuthorArrayFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') ); $this->assertEquals(array( @@ -652,7 +655,7 @@ public function testGetsAuthorArrayFromRss090_Dc11() public function testGetsAuthorArrayFromRss20_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss20.xml') ); $this->assertEquals(array( @@ -663,7 +666,7 @@ public function testGetsAuthorArrayFromRss20_Atom10() public function testGetsAuthorArrayFromRss094_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss094.xml') ); $this->assertEquals(array( @@ -674,7 +677,7 @@ public function testGetsAuthorArrayFromRss094_Atom10() public function testGetsAuthorArrayFromRss093_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss093.xml') ); $this->assertEquals(array( @@ -685,7 +688,7 @@ public function testGetsAuthorArrayFromRss093_Atom10() public function testGetsAuthorArrayFromRss092_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss092.xml') ); $this->assertEquals(array( @@ -696,7 +699,7 @@ public function testGetsAuthorArrayFromRss092_Atom10() public function testGetsAuthorArrayFromRss091_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss091.xml') ); $this->assertEquals(array( @@ -707,7 +710,7 @@ public function testGetsAuthorArrayFromRss091_Atom10() public function testGetsAuthorArrayFromRss10_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss10.xml') ); $this->assertEquals(array( @@ -718,7 +721,7 @@ public function testGetsAuthorArrayFromRss10_Atom10() public function testGetsAuthorArrayFromRss090_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/atom10/rss090.xml') ); $this->assertEquals(array( @@ -731,7 +734,7 @@ public function testGetsAuthorArrayFromRss090_Atom10() public function testGetsAuthorArrayFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -739,7 +742,7 @@ public function testGetsAuthorArrayFromRss20_None() public function testGetsAuthorArrayFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -747,7 +750,7 @@ public function testGetsAuthorArrayFromRss094_None() public function testGetsAuthorArrayFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -755,7 +758,7 @@ public function testGetsAuthorArrayFromRss093_None() public function testGetsAuthorArrayFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -763,7 +766,7 @@ public function testGetsAuthorArrayFromRss092_None() public function testGetsAuthorArrayFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -771,7 +774,7 @@ public function testGetsAuthorArrayFromRss091_None() public function testGetsAuthorArrayFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -779,7 +782,7 @@ public function testGetsAuthorArrayFromRss10_None() public function testGetsAuthorArrayFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getAuthors()); @@ -790,7 +793,7 @@ public function testGetsAuthorArrayFromRss090_None() */ public function testGetsSingleAuthorFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -798,7 +801,7 @@ public function testGetsSingleAuthorFromRss20() public function testGetsSingleAuthorFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -806,7 +809,7 @@ public function testGetsSingleAuthorFromRss094() public function testGetsSingleAuthorFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -814,7 +817,7 @@ public function testGetsSingleAuthorFromRss093() public function testGetsSingleAuthorFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -822,7 +825,7 @@ public function testGetsSingleAuthorFromRss092() public function testGetsSingleAuthorFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -830,7 +833,7 @@ public function testGetsSingleAuthorFromRss091() public function testGetsSingleAuthorFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -838,7 +841,7 @@ public function testGetsSingleAuthorFromRss10() public function testGetsSingleAuthorFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com'), $feed->getAuthor()); @@ -848,7 +851,7 @@ public function testGetsSingleAuthorFromRss090() public function testGetsSingleAuthorFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -856,7 +859,7 @@ public function testGetsSingleAuthorFromRss20_Dc10() public function testGetsSingleAuthorFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -864,7 +867,7 @@ public function testGetsSingleAuthorFromRss094_Dc10() public function testGetsSingleAuthorFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -872,7 +875,7 @@ public function testGetsSingleAuthorFromRss093_Dc10() public function testGetsSingleAuthorFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -880,7 +883,7 @@ public function testGetsSingleAuthorFromRss092_Dc10() public function testGetsSingleAuthorFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -888,7 +891,7 @@ public function testGetsSingleAuthorFromRss091_Dc10() public function testGetsSingleAuthorFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -896,7 +899,7 @@ public function testGetsSingleAuthorFromRss10_Dc10() public function testGetsSingleAuthorFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -906,7 +909,7 @@ public function testGetsSingleAuthorFromRss090_Dc10() public function testGetsSingleAuthorFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -914,7 +917,7 @@ public function testGetsSingleAuthorFromRss20_Dc11() public function testGetsSingleAuthorFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -922,7 +925,7 @@ public function testGetsSingleAuthorFromRss094_Dc11() public function testGetsSingleAuthorFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -930,7 +933,7 @@ public function testGetsSingleAuthorFromRss093_Dc11() public function testGetsSingleAuthorFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -938,7 +941,7 @@ public function testGetsSingleAuthorFromRss092_Dc11() public function testGetsSingleAuthorFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -946,7 +949,7 @@ public function testGetsSingleAuthorFromRss091_Dc11() public function testGetsSingleAuthorFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -954,7 +957,7 @@ public function testGetsSingleAuthorFromRss10_Dc11() public function testGetsSingleAuthorFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs'), $feed->getAuthor()); @@ -964,7 +967,7 @@ public function testGetsSingleAuthorFromRss090_Dc11() public function testGetsSingleAuthorFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -972,7 +975,7 @@ public function testGetsSingleAuthorFromRss20_None() public function testGetsSingleAuthorFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -980,7 +983,7 @@ public function testGetsSingleAuthorFromRss094_None() public function testGetsSingleAuthorFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -988,7 +991,7 @@ public function testGetsSingleAuthorFromRss093_None() public function testGetsSingleAuthorFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -996,7 +999,7 @@ public function testGetsSingleAuthorFromRss092_None() public function testGetsSingleAuthorFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -1004,7 +1007,7 @@ public function testGetsSingleAuthorFromRss091_None() public function testGetsSingleAuthorFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -1012,7 +1015,7 @@ public function testGetsSingleAuthorFromRss10_None() public function testGetsSingleAuthorFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getAuthor()); @@ -1023,7 +1026,7 @@ public function testGetsSingleAuthorFromRss090_None() */ public function testGetsCopyrightFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss20.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1031,7 +1034,7 @@ public function testGetsCopyrightFromRss20() public function testGetsCopyrightFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss094.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1039,7 +1042,7 @@ public function testGetsCopyrightFromRss094() public function testGetsCopyrightFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss093.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1047,7 +1050,7 @@ public function testGetsCopyrightFromRss093() public function testGetsCopyrightFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss092.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1055,7 +1058,7 @@ public function testGetsCopyrightFromRss092() public function testGetsCopyrightFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss091.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1063,7 +1066,7 @@ public function testGetsCopyrightFromRss091() public function testGetsCopyrightFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss10.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1071,7 +1074,7 @@ public function testGetsCopyrightFromRss10() public function testGetsCopyrightFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/rss090.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1081,7 +1084,7 @@ public function testGetsCopyrightFromRss090() public function testGetsCopyrightFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss20.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1089,7 +1092,7 @@ public function testGetsCopyrightFromRss20_Dc10() public function testGetsCopyrightFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss094.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1097,7 +1100,7 @@ public function testGetsCopyrightFromRss094_Dc10() public function testGetsCopyrightFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss093.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1105,7 +1108,7 @@ public function testGetsCopyrightFromRss093_Dc10() public function testGetsCopyrightFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss092.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1113,7 +1116,7 @@ public function testGetsCopyrightFromRss092_Dc10() public function testGetsCopyrightFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss091.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1121,7 +1124,7 @@ public function testGetsCopyrightFromRss091_Dc10() public function testGetsCopyrightFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss10.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1129,7 +1132,7 @@ public function testGetsCopyrightFromRss10_Dc10() public function testGetsCopyrightFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc10/rss090.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1139,7 +1142,7 @@ public function testGetsCopyrightFromRss090_Dc10() public function testGetsCopyrightFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss20.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1147,7 +1150,7 @@ public function testGetsCopyrightFromRss20_Dc11() public function testGetsCopyrightFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss094.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1155,7 +1158,7 @@ public function testGetsCopyrightFromRss094_Dc11() public function testGetsCopyrightFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss093.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1163,7 +1166,7 @@ public function testGetsCopyrightFromRss093_Dc11() public function testGetsCopyrightFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss092.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1171,7 +1174,7 @@ public function testGetsCopyrightFromRss092_Dc11() public function testGetsCopyrightFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss091.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1179,7 +1182,7 @@ public function testGetsCopyrightFromRss091_Dc11() public function testGetsCopyrightFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss10.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1187,7 +1190,7 @@ public function testGetsCopyrightFromRss10_Dc11() public function testGetsCopyrightFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/dc11/rss090.xml') ); $this->assertEquals('Copyright 2008', $feed->getCopyright()); @@ -1197,7 +1200,7 @@ public function testGetsCopyrightFromRss090_Dc11() public function testGetsCopyrightFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1205,7 +1208,7 @@ public function testGetsCopyrightFromRss20_None() public function testGetsCopyrightFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1213,7 +1216,7 @@ public function testGetsCopyrightFromRss094_None() public function testGetsCopyrightFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1221,7 +1224,7 @@ public function testGetsCopyrightFromRss093_None() public function testGetsCopyrightFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1229,7 +1232,7 @@ public function testGetsCopyrightFromRss092_None() public function testGetsCopyrightFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1237,7 +1240,7 @@ public function testGetsCopyrightFromRss091_None() public function testGetsCopyrightFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1245,7 +1248,7 @@ public function testGetsCopyrightFromRss10_None() public function testGetsCopyrightFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/copyright/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getCopyright()); @@ -1256,7 +1259,7 @@ public function testGetsCopyrightFromRss090_None() */ public function testGetsDescriptionFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss20.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1264,7 +1267,7 @@ public function testGetsDescriptionFromRss20() public function testGetsDescriptionFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss094.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1272,7 +1275,7 @@ public function testGetsDescriptionFromRss094() public function testGetsDescriptionFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss093.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1280,7 +1283,7 @@ public function testGetsDescriptionFromRss093() public function testGetsDescriptionFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss092.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1288,7 +1291,7 @@ public function testGetsDescriptionFromRss092() public function testGetsDescriptionFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss091.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1296,7 +1299,7 @@ public function testGetsDescriptionFromRss091() public function testGetsDescriptionFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss10.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1304,7 +1307,7 @@ public function testGetsDescriptionFromRss10() public function testGetsDescriptionFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss090.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1314,7 +1317,7 @@ public function testGetsDescriptionFromRss090() public function testGetsDescriptionFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss20.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1322,7 +1325,7 @@ public function testGetsDescriptionFromRss20_Dc10() public function testGetsDescriptionFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss094.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1330,7 +1333,7 @@ public function testGetsDescriptionFromRss094_Dc10() public function testGetsDescriptionFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss093.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1338,7 +1341,7 @@ public function testGetsDescriptionFromRss093_Dc10() public function testGetsDescriptionFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss092.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1346,7 +1349,7 @@ public function testGetsDescriptionFromRss092_Dc10() public function testGetsDescriptionFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss091.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1354,7 +1357,7 @@ public function testGetsDescriptionFromRss091_Dc10() public function testGetsDescriptionFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss10.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1362,7 +1365,7 @@ public function testGetsDescriptionFromRss10_Dc10() public function testGetsDescriptionFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss090.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1372,7 +1375,7 @@ public function testGetsDescriptionFromRss090_Dc10() public function testGetsDescriptionFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss20.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1380,7 +1383,7 @@ public function testGetsDescriptionFromRss20_Dc11() public function testGetsDescriptionFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss094.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1388,7 +1391,7 @@ public function testGetsDescriptionFromRss094_Dc11() public function testGetsDescriptionFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss093.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1396,7 +1399,7 @@ public function testGetsDescriptionFromRss093_Dc11() public function testGetsDescriptionFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss092.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1404,7 +1407,7 @@ public function testGetsDescriptionFromRss092_Dc11() public function testGetsDescriptionFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss091.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1412,7 +1415,7 @@ public function testGetsDescriptionFromRss091_Dc11() public function testGetsDescriptionFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss10.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1420,7 +1423,7 @@ public function testGetsDescriptionFromRss10_Dc11() public function testGetsDescriptionFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss090.xml') ); $this->assertEquals('My Description', $feed->getDescription()); @@ -1430,7 +1433,7 @@ public function testGetsDescriptionFromRss090_Dc11() public function testGetsDescriptionFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1438,7 +1441,7 @@ public function testGetsDescriptionFromRss20_None() public function testGetsDescriptionFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1446,7 +1449,7 @@ public function testGetsDescriptionFromRss094_None() public function testGetsDescriptionFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1454,7 +1457,7 @@ public function testGetsDescriptionFromRss093_None() public function testGetsDescriptionFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1462,7 +1465,7 @@ public function testGetsDescriptionFromRss092_None() public function testGetsDescriptionFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1470,7 +1473,7 @@ public function testGetsDescriptionFromRss091_None() public function testGetsDescriptionFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1478,7 +1481,7 @@ public function testGetsDescriptionFromRss10_None() public function testGetsDescriptionFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getDescription()); @@ -1489,7 +1492,7 @@ public function testGetsDescriptionFromRss090_None() */ public function testGetsLanguageFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss20.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1497,7 +1500,7 @@ public function testGetsLanguageFromRss20() public function testGetsLanguageFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss094.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1505,7 +1508,7 @@ public function testGetsLanguageFromRss094() public function testGetsLanguageFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss093.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1513,7 +1516,7 @@ public function testGetsLanguageFromRss093() public function testGetsLanguageFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss092.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1521,7 +1524,7 @@ public function testGetsLanguageFromRss092() public function testGetsLanguageFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss091.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1529,7 +1532,7 @@ public function testGetsLanguageFromRss091() public function testGetsLanguageFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss10.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1537,7 +1540,7 @@ public function testGetsLanguageFromRss10() public function testGetsLanguageFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rss090.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1547,7 +1550,7 @@ public function testGetsLanguageFromRss090() public function testGetsLanguageFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss20.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1555,7 +1558,7 @@ public function testGetsLanguageFromRss20_Dc10() public function testGetsLanguageFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss094.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1563,7 +1566,7 @@ public function testGetsLanguageFromRss094_Dc10() public function testGetsLanguageFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss093.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1571,7 +1574,7 @@ public function testGetsLanguageFromRss093_Dc10() public function testGetsLanguageFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss092.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1579,7 +1582,7 @@ public function testGetsLanguageFromRss092_Dc10() public function testGetsLanguageFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss091.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1587,7 +1590,7 @@ public function testGetsLanguageFromRss091_Dc10() public function testGetsLanguageFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss10.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1595,7 +1598,7 @@ public function testGetsLanguageFromRss10_Dc10() public function testGetsLanguageFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc10/rss090.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1605,7 +1608,7 @@ public function testGetsLanguageFromRss090_Dc10() public function testGetsLanguageFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss20.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1613,7 +1616,7 @@ public function testGetsLanguageFromRss20_Dc11() public function testGetsLanguageFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss094.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1621,7 +1624,7 @@ public function testGetsLanguageFromRss094_Dc11() public function testGetsLanguageFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss093.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1629,7 +1632,7 @@ public function testGetsLanguageFromRss093_Dc11() public function testGetsLanguageFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss092.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1637,7 +1640,7 @@ public function testGetsLanguageFromRss092_Dc11() public function testGetsLanguageFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss091.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1645,7 +1648,7 @@ public function testGetsLanguageFromRss091_Dc11() public function testGetsLanguageFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss10.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1653,7 +1656,7 @@ public function testGetsLanguageFromRss10_Dc11() public function testGetsLanguageFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/dc11/rss090.xml') ); $this->assertEquals('en-GB', $feed->getLanguage()); @@ -1663,7 +1666,7 @@ public function testGetsLanguageFromRss090_Dc11() public function testGetsLanguageFromRss10_XmlLang() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/rdf/rss10.xml') ); $this->assertEquals('en', $feed->getLanguage()); @@ -1673,7 +1676,7 @@ public function testGetsLanguageFromRss10_XmlLang() public function testGetsLanguageFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1681,7 +1684,7 @@ public function testGetsLanguageFromRss20_None() public function testGetsLanguageFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1689,7 +1692,7 @@ public function testGetsLanguageFromRss094_None() public function testGetsLanguageFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1697,7 +1700,7 @@ public function testGetsLanguageFromRss093_None() public function testGetsLanguageFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1705,7 +1708,7 @@ public function testGetsLanguageFromRss092_None() public function testGetsLanguageFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1713,7 +1716,7 @@ public function testGetsLanguageFromRss091_None() public function testGetsLanguageFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1721,7 +1724,7 @@ public function testGetsLanguageFromRss10_None() public function testGetsLanguageFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/language/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getLanguage()); @@ -1732,7 +1735,7 @@ public function testGetsLanguageFromRss090_None() */ public function testGetsLinkFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss20.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1740,7 +1743,7 @@ public function testGetsLinkFromRss20() public function testGetsLinkFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss094.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1748,7 +1751,7 @@ public function testGetsLinkFromRss094() public function testGetsLinkFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss093.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1756,7 +1759,7 @@ public function testGetsLinkFromRss093() public function testGetsLinkFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss092.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1764,7 +1767,7 @@ public function testGetsLinkFromRss092() public function testGetsLinkFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss091.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1772,7 +1775,7 @@ public function testGetsLinkFromRss091() public function testGetsLinkFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss10.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1780,7 +1783,7 @@ public function testGetsLinkFromRss10() public function testGetsLinkFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss090.xml') ); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -1790,7 +1793,7 @@ public function testGetsLinkFromRss090() public function testGetsLinkFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1798,7 +1801,7 @@ public function testGetsLinkFromRss20_None() public function testGetsLinkFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1806,7 +1809,7 @@ public function testGetsLinkFromRss094_None() public function testGetsLinkFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1814,7 +1817,7 @@ public function testGetsLinkFromRss093_None() public function testGetsLinkFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1822,7 +1825,7 @@ public function testGetsLinkFromRss092_None() public function testGetsLinkFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1830,7 +1833,7 @@ public function testGetsLinkFromRss091_None() public function testGetsLinkFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1838,7 +1841,7 @@ public function testGetsLinkFromRss10_None() public function testGetsLinkFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getLink()); @@ -1850,7 +1853,7 @@ public function testGetsLinkFromRss090_None() public function testCountableInterface() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss090.xml') ); $this->assertEquals(0, count($feed)); @@ -1861,7 +1864,7 @@ public function testCountableInterface() */ public function testGetsFeedLinkFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss20.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1869,7 +1872,7 @@ public function testGetsFeedLinkFromRss20() public function testGetsOriginalSourceUriIfFeedLinkNotAvailableFromFeed() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss20_NoFeedLink.xml') ); $feed->setOriginalSourceUri('http://www.example.com/feed/rss'); @@ -1878,7 +1881,7 @@ public function testGetsOriginalSourceUriIfFeedLinkNotAvailableFromFeed() public function testGetsFeedLinkFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss094.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1886,7 +1889,7 @@ public function testGetsFeedLinkFromRss094() public function testGetsFeedLinkFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss093.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1894,7 +1897,7 @@ public function testGetsFeedLinkFromRss093() public function testGetsFeedLinkFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss092.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1902,7 +1905,7 @@ public function testGetsFeedLinkFromRss092() public function testGetsFeedLinkFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss091.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1910,7 +1913,7 @@ public function testGetsFeedLinkFromRss091() public function testGetsFeedLinkFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss10.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1918,7 +1921,7 @@ public function testGetsFeedLinkFromRss10() public function testGetsFeedLinkFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/rss090.xml') ); $this->assertEquals('http://www.example.com/feed/rss', $feed->getFeedLink()); @@ -1928,7 +1931,7 @@ public function testGetsFeedLinkFromRss090() public function testGetsFeedLinkFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1936,7 +1939,7 @@ public function testGetsFeedLinkFromRss20_None() public function testGetsFeedLinkFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1944,7 +1947,7 @@ public function testGetsFeedLinkFromRss094_None() public function testGetsFeedLinkFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1952,7 +1955,7 @@ public function testGetsFeedLinkFromRss093_None() public function testGetsFeedLinkFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1960,7 +1963,7 @@ public function testGetsFeedLinkFromRss092_None() public function testGetsFeedLinkFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1968,7 +1971,7 @@ public function testGetsFeedLinkFromRss091_None() public function testGetsFeedLinkFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1976,7 +1979,7 @@ public function testGetsFeedLinkFromRss10_None() public function testGetsFeedLinkFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getFeedLink()); @@ -1987,7 +1990,7 @@ public function testGetsFeedLinkFromRss090_None() */ public function testGetsGeneratorFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss20.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -1995,7 +1998,7 @@ public function testGetsGeneratorFromRss20() public function testGetsGeneratorFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss094.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -2003,7 +2006,7 @@ public function testGetsGeneratorFromRss094() public function testGetsGeneratorFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss093.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -2011,7 +2014,7 @@ public function testGetsGeneratorFromRss093() public function testGetsGeneratorFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss092.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -2019,7 +2022,7 @@ public function testGetsGeneratorFromRss092() public function testGetsGeneratorFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss091.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -2027,7 +2030,7 @@ public function testGetsGeneratorFromRss091() public function testGetsGeneratorFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss10.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -2035,7 +2038,7 @@ public function testGetsGeneratorFromRss10() public function testGetsGeneratorFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/rss090.xml') ); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -2045,7 +2048,7 @@ public function testGetsGeneratorFromRss090() public function testGetsGeneratorFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2053,7 +2056,7 @@ public function testGetsGeneratorFromRss20_None() public function testGetsGeneratorFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2061,7 +2064,7 @@ public function testGetsGeneratorFromRss094_None() public function testGetsGeneratorFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2069,7 +2072,7 @@ public function testGetsGeneratorFromRss093_None() public function testGetsGeneratorFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2077,7 +2080,7 @@ public function testGetsGeneratorFromRss092_None() public function testGetsGeneratorFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2085,7 +2088,7 @@ public function testGetsGeneratorFromRss091_None() public function testGetsGeneratorFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2093,7 +2096,7 @@ public function testGetsGeneratorFromRss10_None() public function testGetsGeneratorFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/generator/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getGenerator()); @@ -2104,17 +2107,17 @@ public function testGetsGeneratorFromRss090_None() */ public function testGetsLastBuildDateFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/lastbuilddate/plain/rss20.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getLastBuildDate())); } public function testGetsLastBuildDateFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/lastbuilddate/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getLastBuildDate()); @@ -2125,11 +2128,11 @@ public function testGetsLastBuildDateFromRss20_None() */ public function testGetsDateModifiedFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } @@ -2138,15 +2141,15 @@ public function testGetsDateModifiedFromRss20() */ public function testParsesCorrectDateIfMissingOffsetWhenSystemUsesUSLocale() { - $locale = new Zend_Locale('en_US'); - Zend_Registry::set('Zend_Locale', $locale); - $feed = Zend_Feed_Reader::importString( + $locale = new \Zend\Locale\Locale('en_US'); + \Zend\Registry::set('Zend_Locale', $locale); + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20_en_US.xml') ); $fdate = $feed->getDateModified(); - $edate = new Zend_Date; - $edate->set('2010-01-04T08:14:00-0600', Zend_Date::ISO_8601); - Zend_Registry::getInstance()->offsetUnset('Zend_Locale'); + $edate = new Date\Date; + $edate->set('2010-01-04T08:14:00-0600', Date\Date::ISO_8601); + \Zend\Registry::getInstance()->offsetUnset('Zend_Locale'); $this->assertTrue($edate->equals($fdate)); } @@ -2154,71 +2157,71 @@ public function testParsesCorrectDateIfMissingOffsetWhenSystemUsesUSLocale() public function testGetsDateModifiedFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss20.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss094.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss093.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss092.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss091.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss10.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss090.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } @@ -2226,71 +2229,71 @@ public function testGetsDateModifiedFromRss090_Dc10() public function testGetsDateModifiedFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss20.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss094.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss093.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss092.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss091.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss10.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss090.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } @@ -2298,71 +2301,71 @@ public function testGetsDateModifiedFromRss090_Dc11() public function testGetsDateModifiedFromRss20_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss20.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss094_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss094.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss093_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss093.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss092_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss092.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss091_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss091.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss10_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss10.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } public function testGetsDateModifiedFromRss090_atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss090.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($feed->getDateModified())); } @@ -2370,7 +2373,7 @@ public function testGetsDateModifiedFromRss090_atom10() public function testGetsDateModifiedFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2378,7 +2381,7 @@ public function testGetsDateModifiedFromRss20_None() public function testGetsDateModifiedFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2386,7 +2389,7 @@ public function testGetsDateModifiedFromRss094_None() public function testGetsDateModifiedFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2394,7 +2397,7 @@ public function testGetsDateModifiedFromRss093_None() public function testGetsDateModifiedFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2402,7 +2405,7 @@ public function testGetsDateModifiedFromRss092_None() public function testGetsDateModifiedFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2410,7 +2413,7 @@ public function testGetsDateModifiedFromRss091_None() public function testGetsDateModifiedFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2418,7 +2421,7 @@ public function testGetsDateModifiedFromRss10_None() public function testGetsDateModifiedFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getDateModified()); @@ -2429,7 +2432,7 @@ public function testGetsDateModifiedFromRss090_None() */ public function testGetsHubsFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss20.xml') ); $this->assertEquals(array( @@ -2440,7 +2443,7 @@ public function testGetsHubsFromRss20() public function testGetsHubsFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss094.xml') ); $this->assertEquals(array( @@ -2451,7 +2454,7 @@ public function testGetsHubsFromRss094() public function testGetsHubsFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss093.xml') ); $this->assertEquals(array( @@ -2462,7 +2465,7 @@ public function testGetsHubsFromRss093() public function testGetsHubsFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss092.xml') ); $this->assertEquals(array( @@ -2473,7 +2476,7 @@ public function testGetsHubsFromRss092() public function testGetsHubsFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss091.xml') ); $this->assertEquals(array( @@ -2484,7 +2487,7 @@ public function testGetsHubsFromRss091() public function testGetsHubsFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss10.xml') ); $this->assertEquals(array( @@ -2495,7 +2498,7 @@ public function testGetsHubsFromRss10() public function testGetsHubsFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/atom10/rss090.xml') ); $this->assertEquals(array( @@ -2508,7 +2511,7 @@ public function testGetsHubsFromRss090() public function testGetsHubsFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2516,7 +2519,7 @@ public function testGetsHubsFromRss20_None() public function testGetsHubsFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2524,7 +2527,7 @@ public function testGetsHubsFromRss094_None() public function testGetsHubsFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2532,7 +2535,7 @@ public function testGetsHubsFromRss093_None() public function testGetsHubsFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2540,7 +2543,7 @@ public function testGetsHubsFromRss092_None() public function testGetsHubsFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2548,7 +2551,7 @@ public function testGetsHubsFromRss091_None() public function testGetsHubsFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2556,7 +2559,7 @@ public function testGetsHubsFromRss10_None() public function testGetsHubsFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/hubs/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getHubs()); @@ -2570,7 +2573,7 @@ public function testGetsHubsFromRss090_None() public function testGetsCategoriesFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/rss20.xml') ); $this->assertEquals($this->_expectedCats, (array) $feed->getCategories()); @@ -2581,7 +2584,7 @@ public function testGetsCategoriesFromRss20() public function testGetsCategoriesFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss090.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2590,7 +2593,7 @@ public function testGetsCategoriesFromRss090_Dc10() public function testGetsCategoriesFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss091.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2599,7 +2602,7 @@ public function testGetsCategoriesFromRss091_Dc10() public function testGetsCategoriesFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss092.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2608,7 +2611,7 @@ public function testGetsCategoriesFromRss092_Dc10() public function testGetsCategoriesFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss093.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2617,7 +2620,7 @@ public function testGetsCategoriesFromRss093_Dc10() public function testGetsCategoriesFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss094.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2626,7 +2629,7 @@ public function testGetsCategoriesFromRss094_Dc10() public function testGetsCategoriesFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss10.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2637,7 +2640,7 @@ public function testGetsCategoriesFromRss10_Dc10() public function testGetsCategoriesFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss090.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2646,7 +2649,7 @@ public function testGetsCategoriesFromRss090_Dc11() public function testGetsCategoriesFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss091.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2655,7 +2658,7 @@ public function testGetsCategoriesFromRss091_Dc11() public function testGetsCategoriesFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss092.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2664,7 +2667,7 @@ public function testGetsCategoriesFromRss092_Dc11() public function testGetsCategoriesFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss093.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2673,7 +2676,7 @@ public function testGetsCategoriesFromRss093_Dc11() public function testGetsCategoriesFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss094.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2682,7 +2685,7 @@ public function testGetsCategoriesFromRss094_Dc11() public function testGetsCategoriesFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss10.xml') ); $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); @@ -2693,7 +2696,7 @@ public function testGetsCategoriesFromRss10_Dc11() public function testGetsCategoriesFromRss090_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss090.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2702,7 +2705,7 @@ public function testGetsCategoriesFromRss090_Atom10() public function testGetsCategoriesFromRss091_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss091.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2711,7 +2714,7 @@ public function testGetsCategoriesFromRss091_Atom10() public function testGetsCategoriesFromRss092_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss092.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2720,7 +2723,7 @@ public function testGetsCategoriesFromRss092_Atom10() public function testGetsCategoriesFromRss093_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss093.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2729,7 +2732,7 @@ public function testGetsCategoriesFromRss093_Atom10() public function testGetsCategoriesFromRss094_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss094.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2738,7 +2741,7 @@ public function testGetsCategoriesFromRss094_Atom10() public function testGetsCategoriesFromRss10_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss10.xml') ); $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); @@ -2749,7 +2752,7 @@ public function testGetsCategoriesFromRss10_Atom10() public function testGetsCategoriesFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss20.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2758,7 +2761,7 @@ public function testGetsCategoriesFromRss20_None() public function testGetsCategoriesFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss090.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2767,7 +2770,7 @@ public function testGetsCategoriesFromRss090_None() public function testGetsCategoriesFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss091.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2776,7 +2779,7 @@ public function testGetsCategoriesFromRss091_None() public function testGetsCategoriesFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss092.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2785,7 +2788,7 @@ public function testGetsCategoriesFromRss092_None() public function testGetsCategoriesFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss093.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2794,7 +2797,7 @@ public function testGetsCategoriesFromRss093_None() public function testGetsCategoriesFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss094.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2803,7 +2806,7 @@ public function testGetsCategoriesFromRss094_None() public function testGetsCategoriesFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss10.xml') ); $this->assertEquals(array(), (array) $feed->getCategories()); @@ -2815,7 +2818,7 @@ public function testGetsCategoriesFromRss10_None() */ public function testGetsImageFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/rss20.xml') ); $this->assertEquals(array( @@ -2830,7 +2833,7 @@ public function testGetsImageFromRss20() public function testGetsImageFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/rss094.xml') ); $this->assertEquals(array( @@ -2845,7 +2848,7 @@ public function testGetsImageFromRss094() public function testGetsImageFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/rss093.xml') ); $this->assertEquals(array( @@ -2860,7 +2863,7 @@ public function testGetsImageFromRss093() public function testGetsImageFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/rss092.xml') ); $this->assertEquals(array( @@ -2875,7 +2878,7 @@ public function testGetsImageFromRss092() public function testGetsImageFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/rss091.xml') ); $this->assertEquals(array( @@ -2890,7 +2893,7 @@ public function testGetsImageFromRss091() /*public function testGetsImageFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/rss10.xml') ); $this->assertEquals(array( @@ -2905,7 +2908,7 @@ public function testGetsImageFromRss091() public function testGetsImageFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/rss090.xml') ); $this->assertEquals(array( @@ -2923,7 +2926,7 @@ public function testGetsImageFromRss090() */ public function testGetsImageFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/none/rss20.xml') ); $this->assertEquals(null, $feed->getImage()); @@ -2931,7 +2934,7 @@ public function testGetsImageFromRss20_None() public function testGetsImageFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/none/rss094.xml') ); $this->assertEquals(null, $feed->getImage()); @@ -2939,7 +2942,7 @@ public function testGetsImageFromRss094_None() public function testGetsImageFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/none/rss093.xml') ); $this->assertEquals(null, $feed->getImage()); @@ -2947,7 +2950,7 @@ public function testGetsImageFromRss093_None() public function testGetsImageFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/none/rss092.xml') ); $this->assertEquals(null, $feed->getImage()); @@ -2955,7 +2958,7 @@ public function testGetsImageFromRss092_None() public function testGetsImageFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/none/rss091.xml') ); $this->assertEquals(null, $feed->getImage()); @@ -2963,7 +2966,7 @@ public function testGetsImageFromRss091_None() public function testGetsImageFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/none/rss10.xml') ); $this->assertEquals(null, $feed->getImage()); @@ -2971,7 +2974,7 @@ public function testGetsImageFromRss10_None() public function testGetsImageFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/none/rss090.xml') ); $this->assertEquals(null, $feed->getImage()); From 17390ea68ad99e57bfdc696e48579bff0913480d Mon Sep 17 00:00:00 2001 From: Padraic Brady Date: Mon, 7 Jun 2010 16:56:48 +0100 Subject: [PATCH 142/238] Test pass 3 on Zend\Feed\Reader --- src/Reader/Entry/Rss.php | 2 +- src/Reader/Extension/Atom/Entry.php | 4 +- src/Reader/Extension/DublinCore/Entry.php | 1 + test/Reader/Entry/AtomStandaloneEntryTest.php | 82 +- test/Reader/Entry/AtomTest.php | 130 ++-- test/Reader/Entry/CommonTest.php | 57 +- test/Reader/Entry/RssTest.php | 714 +++++++++--------- test/Reader/Feed/AtomTest.php | 2 + .../Integration/H-OnlineComAtom10Test.php | 72 +- test/Reader/Integration/LautDeRdfTest.php | 70 +- test/Reader/Integration/PodcastRss2Test.php | 87 +-- .../Integration/WordpressAtom10Test.php | 72 +- .../Integration/WordpressRss2DcAtomTest.php | 65 +- 13 files changed, 697 insertions(+), 661 deletions(-) diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index ed4b3b0f..fe2f36a7 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -327,7 +327,7 @@ public function getEnclosure() $nodeList = $this->_xpath->query($this->_xpathQueryRss . '/enclosure'); if ($nodeList->length > 0) { - $enclosure = new stdClass(); + $enclosure = new \stdClass(); $enclosure->url = $nodeList->item(0)->getAttribute('url'); $enclosure->length = $nodeList->item(0)->getAttribute('length'); $enclosure->type = $nodeList->item(0)->getAttribute('type'); diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 0dcc0309..869b5002 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -96,7 +96,7 @@ public function getAuthors() if (count($authors) == 0) { $authors = null; } else { - $authors = new Reader\Reader_Collection_Author( + $authors = new Collection\Author( Reader\Reader::arrayUnique($authors) ); } @@ -268,7 +268,7 @@ public function getEnclosure() $nodeList = $this->getXpath()->query($this->getXpathPrefix() . '/atom:link[@rel="enclosure"]'); if ($nodeList->length > 0) { - $enclosure = new stdClass(); + $enclosure = new \stdClass(); $enclosure->url = $nodeList->item(0)->getAttribute('href'); $enclosure->length = $nodeList->item(0)->getAttribute('length'); $enclosure->type = $nodeList->item(0)->getAttribute('type'); diff --git a/src/Reader/Extension/DublinCore/Entry.php b/src/Reader/Extension/DublinCore/Entry.php index 923a448b..923996e0 100644 --- a/src/Reader/Extension/DublinCore/Entry.php +++ b/src/Reader/Extension/DublinCore/Entry.php @@ -23,6 +23,7 @@ * @namespace */ namespace Zend\Feed\Reader\Extension\DublinCore; +use Zend\Feed\Reader; use Zend\Feed\Reader\Collection; use Zend\Feed\Reader\Extension; use Zend\Date; diff --git a/test/Reader/Entry/AtomStandaloneEntryTest.php b/test/Reader/Entry/AtomStandaloneEntryTest.php index d5a5a452..d4fb2664 100644 --- a/test/Reader/Entry/AtomStandaloneEntryTest.php +++ b/test/Reader/Entry/AtomStandaloneEntryTest.php @@ -20,19 +20,23 @@ * @version $Id: AtomTest.php 19159 2009-11-21 14:23:15Z padraic $ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; +/** +* @namespace +*/ +namespace ZendTest\Feed\Reader\Entry; +use Zend\Feed\Reader; +use Zend\Date; /** - * @category Zend - * @package Zend_Feed - * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @group Zend_Feed - * @group Zend_Feed_Reader - */ -class Zend_Feed_Reader_Entry_AtomStandaloneEntryTest extends PHPUnit_Framework_TestCase +* @category Zend +* @package Zend_Feed +* @subpackage UnitTests +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +* @group Zend_Feed +* @group Zend_Feed_Reader +*/ +class AtomStandaloneEntryTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -43,19 +47,19 @@ class Zend_Feed_Reader_Entry_AtomStandaloneEntryTest extends PHPUnit_Framework_T public function setup() { - Zend_Feed_Reader::reset(); - if (Zend_Registry::isRegistered('Zend_Locale')) { - $registry = Zend_Registry::getInstance(); + Reader\Reader::reset(); + if (\Zend\Registry::isRegistered('Zend_Locale')) { + $registry = \Zend\Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/AtomStandaloneEntry'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -89,15 +93,15 @@ public function setup() public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } public function testReaderImportOfAtomEntryDocumentReturnsEntryClass() { - $object = Zend_Feed_Reader::importString( + $object = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/id/atom10.xml') ); - $this->assertTrue($object instanceof Zend_Feed_Reader_Entry_Atom); + $this->assertTrue($object instanceof \Reader\Entry\Atom); } /** @@ -106,7 +110,7 @@ public function testReaderImportOfAtomEntryDocumentReturnsEntryClass() */ public function testGetsIdFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/id/atom10.xml') ); $this->assertEquals('1', $entry->getId()); @@ -118,11 +122,11 @@ public function testGetsIdFromAtom10() */ public function testGetsDateCreatedFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/atom10.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateCreated())); } @@ -132,11 +136,11 @@ public function testGetsDateCreatedFromAtom10() */ public function testGetsDateModifiedFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/atom10.xml') ); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } @@ -146,7 +150,7 @@ public function testGetsDateModifiedFromAtom10() */ public function testGetsTitleFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/title/atom10.xml') ); $this->assertEquals('Entry Title', $entry->getTitle()); @@ -158,7 +162,7 @@ public function testGetsTitleFromAtom10() */ public function testGetsAuthorsFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/author/atom10.xml') ); @@ -180,7 +184,7 @@ public function testGetsAuthorsFromAtom10() */ public function testGetsAuthorFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/author/atom10.xml') ); $this->assertEquals(array('name'=>'Joe Bloggs','email'=>'joe@example.com','uri'=>'http://www.example.com'), $entry->getAuthor()); @@ -192,7 +196,7 @@ public function testGetsAuthorFromAtom10() */ public function testGetsDescriptionFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/description/atom10.xml') ); $this->assertEquals('Entry Description', $entry->getDescription()); @@ -204,11 +208,11 @@ public function testGetsDescriptionFromAtom10() */ public function testGetsEnclosureFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/enclosure/atom10.xml') ); - $expected = new stdClass(); + $expected = new \stdClass(); $expected->url = 'http://www.example.org/myaudiofile.mp3'; $expected->length = '1234'; $expected->type = 'audio/mpeg'; @@ -222,7 +226,7 @@ public function testGetsEnclosureFromAtom10() */ public function testGetsContentFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/atom10.xml') ); $this->assertEquals('Entry Content &', $entry->getContent()); @@ -234,7 +238,7 @@ public function testGetsContentFromAtom10() */ public function testGetsContentFromAtom10Html() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/atom10_Html.xml') ); $this->assertEquals('

Entry Content &

', $entry->getContent()); @@ -246,7 +250,7 @@ public function testGetsContentFromAtom10Html() */ public function testGetsContentFromAtom10HtmlCdata() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/atom10_HtmlCdata.xml') ); $this->assertEquals('

Entry Content &

', $entry->getContent()); @@ -258,7 +262,7 @@ public function testGetsContentFromAtom10HtmlCdata() */ public function testGetsContentFromAtom10XhtmlNamespaced() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/atom10_Xhtml.xml') ); $this->assertEquals('

Entry Content &x:

', $entry->getContent()); @@ -270,7 +274,7 @@ public function testGetsContentFromAtom10XhtmlNamespaced() */ public function testGetsLinkFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/link/atom10.xml') ); $this->assertEquals('http://www.example.com/entry', $entry->getLink()); @@ -282,7 +286,7 @@ public function testGetsLinkFromAtom10() */ public function testGetsCommentLinkFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/commentlink/atom10.xml') ); $this->assertEquals('http://www.example.com/entry/comments', $entry->getCommentLink()); @@ -294,7 +298,7 @@ public function testGetsCommentLinkFromAtom10() */ public function testGetsCategoriesFromAtom10() { - $entry = Zend_Feed_Reader::importString( + $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/atom10.xml') ); $this->assertEquals($this->_expectedCats, (array) $entry->getCategories()); diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index 57ffe9d4..9e867850 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -20,19 +20,23 @@ * @version $Id: AtomTest.php 20462 2010-01-21 15:23:52Z padraic $ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; +/** +* @namespace +*/ +namespace ZendTest\Feed\Reader\Entry; +use Zend\Feed\Reader; +use Zend\Date; /** - * @category Zend - * @package Zend_Feed - * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @group Zend_Feed - * @group Zend_Feed_Reader - */ -class Zend_Feed_Reader_Entry_AtomTest extends PHPUnit_Framework_TestCase +* @category Zend +* @package Zend_Feed +* @subpackage UnitTests +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +* @group Zend_Feed +* @group Zend_Feed_Reader +*/ +class AtomTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -43,19 +47,19 @@ class Zend_Feed_Reader_Entry_AtomTest extends PHPUnit_Framework_TestCase public function setup() { - Zend_Feed_Reader::reset(); - if (Zend_Registry::isRegistered('Zend_Locale')) { - $registry = Zend_Registry::getInstance(); + Reader\Reader::reset(); + if (\Zend\Registry::isRegistered('Zend_Locale')) { + $registry = \Zend\Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Atom'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -89,7 +93,7 @@ public function setup() public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } /** @@ -98,7 +102,7 @@ public function teardown() */ public function testGetsIdFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/id/plain/atom03.xml') ); $entry = $feed->current(); @@ -107,7 +111,7 @@ public function testGetsIdFromAtom03() public function testGetsIdFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/id/plain/atom10.xml') ); $entry = $feed->current(); @@ -119,23 +123,23 @@ public function testGetsIdFromAtom10() */ public function testGetsDateCreatedFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom03.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateCreated())); } public function testGetsDateCreatedFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom10.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateCreated())); } @@ -144,23 +148,23 @@ public function testGetsDateCreatedFromAtom10() */ public function testGetsDateModifiedFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom03.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom10.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } @@ -169,7 +173,7 @@ public function testGetsDateModifiedFromAtom10() */ public function testGetsTitleFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/title/plain/atom03.xml') ); $entry = $feed->current(); @@ -178,7 +182,7 @@ public function testGetsTitleFromAtom03() public function testGetsTitleFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/title/plain/atom10.xml') ); $entry = $feed->current(); @@ -190,7 +194,7 @@ public function testGetsTitleFromAtom10() */ public function testGetsAuthorsFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/author/plain/atom03.xml') ); @@ -209,7 +213,7 @@ public function testGetsAuthorsFromAtom03() public function testGetsAuthorsFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/author/plain/atom10.xml') ); @@ -231,7 +235,7 @@ public function testGetsAuthorsFromAtom10() */ public function testGetsAuthorFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/author/plain/atom03.xml') ); $entry = $feed->current(); @@ -240,7 +244,7 @@ public function testGetsAuthorFromAtom03() public function testGetsAuthorFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/author/plain/atom10.xml') ); $entry = $feed->current(); @@ -252,7 +256,7 @@ public function testGetsAuthorFromAtom10() */ public function testGetsDescriptionFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/description/plain/atom03.xml') ); $entry = $feed->current(); @@ -261,7 +265,7 @@ public function testGetsDescriptionFromAtom03() public function testGetsDescriptionFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/description/plain/atom10.xml') ); $entry = $feed->current(); @@ -273,12 +277,12 @@ public function testGetsDescriptionFromAtom10() */ public function testGetsEnclosureFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/enclosure/plain/atom03.xml') ); $entry = $feed->current(); - $expected = new stdClass(); + $expected = new \stdClass(); $expected->url = 'http://www.example.org/myaudiofile.mp3'; $expected->length = '1234'; $expected->type = 'audio/mpeg'; @@ -288,12 +292,12 @@ public function testGetsEnclosureFromAtom03() public function testGetsEnclosureFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/enclosure/plain/atom10.xml') ); $entry = $feed->current(); - $expected = new stdClass(); + $expected = new \stdClass(); $expected->url = 'http://www.example.org/myaudiofile.mp3'; $expected->length = '1234'; $expected->type = 'audio/mpeg'; @@ -306,7 +310,7 @@ public function testGetsEnclosureFromAtom10() */ public function testGetsContentFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/plain/atom03.xml') ); $entry = $feed->current(); @@ -319,7 +323,7 @@ public function testGetsContentFromAtom03() */ public function testGetsContentFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/plain/atom10.xml') ); $entry = $feed->current(); @@ -332,7 +336,7 @@ public function testGetsContentFromAtom10() */ public function testGetsContentFromAtom10Html() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/plain/atom10_Html.xml') ); $entry = $feed->current(); @@ -345,7 +349,7 @@ public function testGetsContentFromAtom10Html() */ public function testGetsContentFromAtom10HtmlCdata() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/plain/atom10_HtmlCdata.xml') ); $entry = $feed->current(); @@ -358,7 +362,7 @@ public function testGetsContentFromAtom10HtmlCdata() */ public function testGetsContentFromAtom10XhtmlNamespaced() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/content/plain/atom10_Xhtml.xml') ); $entry = $feed->current(); @@ -370,7 +374,7 @@ public function testGetsContentFromAtom10XhtmlNamespaced() */ public function testGetsLinkFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/link/plain/atom03.xml') ); $entry = $feed->current(); @@ -379,7 +383,7 @@ public function testGetsLinkFromAtom03() public function testGetsLinkFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/link/plain/atom10.xml') ); $entry = $feed->current(); @@ -388,7 +392,7 @@ public function testGetsLinkFromAtom10() public function testGetsLinkFromAtom10_WithNoRelAttribute() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/link/plain/atom10-norel.xml') ); $entry = $feed->current(); @@ -397,7 +401,7 @@ public function testGetsLinkFromAtom10_WithNoRelAttribute() public function testGetsLinkFromAtom10_WithRelativeUrl() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/link/plain/atom10-relative.xml') ); $entry = $feed->current(); @@ -409,7 +413,7 @@ public function testGetsLinkFromAtom10_WithRelativeUrl() */ public function testGetsBaseUriFromAtom10_FromFeedElement() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/baseurl/plain/atom10-feedlevel.xml') ); $entry = $feed->current(); @@ -418,7 +422,7 @@ public function testGetsBaseUriFromAtom10_FromFeedElement() public function testGetsBaseUriFromAtom10_FromEntryElement() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/baseurl/plain/atom10-entrylevel.xml') ); $entry = $feed->current(); @@ -430,7 +434,7 @@ public function testGetsBaseUriFromAtom10_FromEntryElement() */ public function testGetsCommentLinkFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/commentlink/plain/atom03.xml') ); $entry = $feed->current(); @@ -439,7 +443,7 @@ public function testGetsCommentLinkFromAtom03() public function testGetsCommentLinkFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/commentlink/plain/atom10.xml') ); $entry = $feed->current(); @@ -448,7 +452,7 @@ public function testGetsCommentLinkFromAtom10() public function testGetsCommentLinkFromAtom10_RelativeLinks() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/commentlink/plain/atom10-relative.xml') ); $entry = $feed->current(); @@ -463,7 +467,7 @@ public function testGetsCommentLinkFromAtom10_RelativeLinks() public function testGetsCategoriesFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10.xml') ); $entry = $feed->current(); @@ -473,7 +477,7 @@ public function testGetsCategoriesFromAtom10() public function testGetsCategoriesFromAtom03_Atom10Extension() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom03.xml') ); $entry = $feed->current(); @@ -485,7 +489,7 @@ public function testGetsCategoriesFromAtom03_Atom10Extension() public function testGetsCategoriesFromAtom03_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/atom03.xml') ); $entry = $feed->current(); @@ -495,7 +499,7 @@ public function testGetsCategoriesFromAtom03_Dc10() public function testGetsCategoriesFromAtom03_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/atom03.xml') ); $entry = $feed->current(); @@ -507,7 +511,7 @@ public function testGetsCategoriesFromAtom03_Dc11() public function testGetsCategoriesFromAtom10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/atom10.xml') ); $entry = $feed->current(); @@ -517,7 +521,7 @@ public function testGetsCategoriesFromAtom10_None() public function testGetsCategoriesFromAtom03_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/atom03.xml') ); $entry = $feed->current(); diff --git a/test/Reader/Entry/CommonTest.php b/test/Reader/Entry/CommonTest.php index ba5c9802..a11aea3e 100644 --- a/test/Reader/Entry/CommonTest.php +++ b/test/Reader/Entry/CommonTest.php @@ -20,28 +20,31 @@ * @version $Id: CommonTest.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; +/** +* @namespace +*/ +namespace ZendTest\Feed\Reader\Entry; +use Zend\Feed\Reader; /** - * @category Zend - * @package Zend_Feed - * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @group Zend_Feed - * @group Zend_Feed_Reader - */ -class Zend_Feed_Reader_Entry_CommonTest extends PHPUnit_Framework_TestCase +* @category Zend +* @package Zend_Feed +* @subpackage UnitTests +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +* @group Zend_Feed +* @group Zend_Feed_Reader +*/ +class CommonTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Zend_Feed_Reader::reset(); - if (Zend_Registry::isRegistered('Zend_Locale')) { - $registry = Zend_Registry::getInstance(); + Reader\Reader::reset(); + if (\Zend\Registry::isRegistered('Zend_Locale')) { + $registry = \Zend\Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Common'; @@ -52,25 +55,25 @@ public function setup() */ public function testGetsDomDocumentObject() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); - $this->assertTrue($entry->getDomDocument() instanceof DOMDocument); + $this->assertTrue($entry->getDomDocument() instanceof \DOMDocument); } public function testGetsDomXpathObject() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); - $this->assertTrue($entry->getXpath() instanceof DOMXPath); + $this->assertTrue($entry->getXpath() instanceof \DOMXPath); } public function testGetsXpathPrefixString() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); @@ -79,16 +82,16 @@ public function testGetsXpathPrefixString() public function testGetsDomElementObject() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); - $this->assertTrue($entry->getElement() instanceof DOMElement); + $this->assertTrue($entry->getElement() instanceof \DOMElement); } public function testSaveXmlOutputsXmlStringForEntry() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); @@ -97,16 +100,16 @@ public function testSaveXmlOutputsXmlStringForEntry() public function testGetsNamedExtension() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); - $this->assertTrue($entry->getExtension('Atom') instanceof Zend_Feed_Reader_Extension_Atom_Entry); + $this->assertTrue($entry->getExtension('Atom') instanceof Reader\Reader_Extension_Atom_Entry); } public function testReturnsNullIfExtensionDoesNotExist() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); @@ -118,7 +121,7 @@ public function testReturnsNullIfExtensionDoesNotExist() */ public function testReturnsEncodingOfFeed() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); @@ -130,7 +133,7 @@ public function testReturnsEncodingOfFeed() */ public function testReturnsEncodingOfFeedAsUtf8IfUndefined() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom_noencodingdefined.xml') ); $entry = $feed->current(); diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index 48f01e24..6712190c 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -20,19 +20,23 @@ * @version $Id: RssTest.php 22086 2010-05-04 11:25:54Z padraic $ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; +/** + * @namespace + */ +namespace ZendTest\Feed\Reader\Entry; +use Zend\Feed\Reader; +use Zend\Date; /** - * @category Zend - * @package Zend_Feed + * @category Zend + * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @group Zend_Feed - * @group Zend_Feed_Reader + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @group Zend_Feed + * @group Zend_Feed_Reader */ -class Zend_Feed_Reader_Entry_RssTest extends PHPUnit_Framework_TestCase +class RssTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; @@ -45,19 +49,19 @@ class Zend_Feed_Reader_Entry_RssTest extends PHPUnit_Framework_TestCase public function setup() { - Zend_Feed_Reader::reset(); - if (Zend_Registry::isRegistered('Zend_Locale')) { - $registry = Zend_Registry::getInstance(); + Reader\Reader::reset(); + if (\Zend\Registry::isRegistered('Zend_Locale')) { + $registry = \Zend\Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Rss'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -108,7 +112,7 @@ public function setup() public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } /** @@ -116,7 +120,7 @@ public function teardown() */ public function testGetsIdFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss20.xml') ); $entry = $feed->current(); @@ -125,7 +129,7 @@ public function testGetsIdFromRss20() public function testGetsIdFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss094.xml') ); $entry = $feed->current(); @@ -134,7 +138,7 @@ public function testGetsIdFromRss094() public function testGetsIdFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss093.xml') ); $entry = $feed->current(); @@ -143,7 +147,7 @@ public function testGetsIdFromRss093() public function testGetsIdFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss092.xml') ); $entry = $feed->current(); @@ -152,7 +156,7 @@ public function testGetsIdFromRss092() public function testGetsIdFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss091.xml') ); $entry = $feed->current(); @@ -161,7 +165,7 @@ public function testGetsIdFromRss091() public function testGetsIdFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss10.xml') ); $entry = $feed->current(); @@ -170,7 +174,7 @@ public function testGetsIdFromRss10() public function testGetsIdFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/rss090.xml') ); $entry = $feed->current(); @@ -181,7 +185,7 @@ public function testGetsIdFromRss090() public function testGetsIdFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss20.xml') ); $entry = $feed->current(); @@ -190,7 +194,7 @@ public function testGetsIdFromRss20_Dc10() public function testGetsIdFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -199,7 +203,7 @@ public function testGetsIdFromRss094_Dc10() public function testGetsIdFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -208,7 +212,7 @@ public function testGetsIdFromRss093_Dc10() public function testGetsIdFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -217,7 +221,7 @@ public function testGetsIdFromRss092_Dc10() public function testGetsIdFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -226,7 +230,7 @@ public function testGetsIdFromRss091_Dc10() public function testGetsIdFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -235,7 +239,7 @@ public function testGetsIdFromRss10_Dc10() public function testGetsIdFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -246,7 +250,7 @@ public function testGetsIdFromRss090_Dc10() public function testGetsIdFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss20.xml') ); $entry = $feed->current(); @@ -255,7 +259,7 @@ public function testGetsIdFromRss20_Dc11() public function testGetsIdFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -264,7 +268,7 @@ public function testGetsIdFromRss094_Dc11() public function testGetsIdFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -273,7 +277,7 @@ public function testGetsIdFromRss093_Dc11() public function testGetsIdFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -282,7 +286,7 @@ public function testGetsIdFromRss092_Dc11() public function testGetsIdFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -291,7 +295,7 @@ public function testGetsIdFromRss091_Dc11() public function testGetsIdFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -300,7 +304,7 @@ public function testGetsIdFromRss10_Dc11() public function testGetsIdFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -311,7 +315,7 @@ public function testGetsIdFromRss090_Dc11() public function testGetsIdFromRss20_Title() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss20.xml') ); $entry = $feed->current(); @@ -320,7 +324,7 @@ public function testGetsIdFromRss20_Title() public function testGetsIdFromRss094_Title() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss094.xml') ); $entry = $feed->current(); @@ -329,7 +333,7 @@ public function testGetsIdFromRss094_Title() public function testGetsIdFromRss093_Title() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss093.xml') ); $entry = $feed->current(); @@ -338,7 +342,7 @@ public function testGetsIdFromRss093_Title() public function testGetsIdFromRss092_Title() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss092.xml') ); $entry = $feed->current(); @@ -347,7 +351,7 @@ public function testGetsIdFromRss092_Title() public function testGetsIdFromRss091_Title() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss091.xml') ); $entry = $feed->current(); @@ -356,7 +360,7 @@ public function testGetsIdFromRss091_Title() public function testGetsIdFromRss10_Title() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss10.xml') ); $entry = $feed->current(); @@ -365,7 +369,7 @@ public function testGetsIdFromRss10_Title() public function testGetsIdFromRss090_Title() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/title/rss090.xml') ); $entry = $feed->current(); @@ -376,7 +380,7 @@ public function testGetsIdFromRss090_Title() public function testGetsIdFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -385,7 +389,7 @@ public function testGetsIdFromRss20_None() public function testGetsIdFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -394,7 +398,7 @@ public function testGetsIdFromRss094_None() public function testGetsIdFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -403,7 +407,7 @@ public function testGetsIdFromRss093_None() public function testGetsIdFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -412,7 +416,7 @@ public function testGetsIdFromRss092_None() public function testGetsIdFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -421,7 +425,7 @@ public function testGetsIdFromRss091_None() public function testGetsIdFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -430,7 +434,7 @@ public function testGetsIdFromRss10_None() public function testGetsIdFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/id/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -442,7 +446,7 @@ public function testGetsIdFromRss090_None() */ public function testGetsTitleFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss20.xml') ); $entry = $feed->current(); @@ -451,7 +455,7 @@ public function testGetsTitleFromRss20() public function testGetsTitleFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss094.xml') ); $entry = $feed->current(); @@ -460,7 +464,7 @@ public function testGetsTitleFromRss094() public function testGetsTitleFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss093.xml') ); $entry = $feed->current(); @@ -469,7 +473,7 @@ public function testGetsTitleFromRss093() public function testGetsTitleFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss092.xml') ); $entry = $feed->current(); @@ -478,7 +482,7 @@ public function testGetsTitleFromRss092() public function testGetsTitleFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss091.xml') ); $entry = $feed->current(); @@ -487,7 +491,7 @@ public function testGetsTitleFromRss091() public function testGetsTitleFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss10.xml') ); $entry = $feed->current(); @@ -496,7 +500,7 @@ public function testGetsTitleFromRss10() public function testGetsTitleFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/rss090.xml') ); $entry = $feed->current(); @@ -507,7 +511,7 @@ public function testGetsTitleFromRss090() public function testGetsTitleFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss20.xml') ); $entry = $feed->current(); @@ -516,7 +520,7 @@ public function testGetsTitleFromRss20_Dc10() public function testGetsTitleFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -525,7 +529,7 @@ public function testGetsTitleFromRss094_Dc10() public function testGetsTitleFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -534,7 +538,7 @@ public function testGetsTitleFromRss093_Dc10() public function testGetsTitleFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -543,7 +547,7 @@ public function testGetsTitleFromRss092_Dc10() public function testGetsTitleFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -552,7 +556,7 @@ public function testGetsTitleFromRss091_Dc10() public function testGetsTitleFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -561,7 +565,7 @@ public function testGetsTitleFromRss10_Dc10() public function testGetsTitleFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -572,7 +576,7 @@ public function testGetsTitleFromRss090_Dc10() public function testGetsTitleFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss20.xml') ); $entry = $feed->current(); @@ -581,7 +585,7 @@ public function testGetsTitleFromRss20_Dc11() public function testGetsTitleFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -590,7 +594,7 @@ public function testGetsTitleFromRss094_Dc11() public function testGetsTitleFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -599,7 +603,7 @@ public function testGetsTitleFromRss093_Dc11() public function testGetsTitleFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -608,7 +612,7 @@ public function testGetsTitleFromRss092_Dc11() public function testGetsTitleFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -617,7 +621,7 @@ public function testGetsTitleFromRss091_Dc11() public function testGetsTitleFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -626,7 +630,7 @@ public function testGetsTitleFromRss10_Dc11() public function testGetsTitleFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -637,7 +641,7 @@ public function testGetsTitleFromRss090_Dc11() public function testGetsTitleFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -646,7 +650,7 @@ public function testGetsTitleFromRss20_None() public function testGetsTitleFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -655,7 +659,7 @@ public function testGetsTitleFromRss094_None() public function testGetsTitleFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -664,7 +668,7 @@ public function testGetsTitleFromRss093_None() public function testGetsTitleFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -673,7 +677,7 @@ public function testGetsTitleFromRss092_None() public function testGetsTitleFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -682,7 +686,7 @@ public function testGetsTitleFromRss091_None() public function testGetsTitleFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -691,7 +695,7 @@ public function testGetsTitleFromRss10_None() public function testGetsTitleFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/title/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -703,7 +707,7 @@ public function testGetsTitleFromRss090_None() */ public function testGetsAuthorsFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') ); $entry = $feed->current(); @@ -716,7 +720,7 @@ public function testGetsAuthorsFromRss20() public function testGetsAuthorsFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') ); $entry = $feed->current(); @@ -725,7 +729,7 @@ public function testGetsAuthorsFromRss094() public function testGetsAuthorsFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') ); $entry = $feed->current(); @@ -734,7 +738,7 @@ public function testGetsAuthorsFromRss093() public function testGetsAuthorsFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') ); $entry = $feed->current(); @@ -743,7 +747,7 @@ public function testGetsAuthorsFromRss092() public function testGetsAuthorsFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') ); $entry = $feed->current(); @@ -752,7 +756,7 @@ public function testGetsAuthorsFromRss091() public function testGetsAuthorsFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') ); $entry = $feed->current(); @@ -761,7 +765,7 @@ public function testGetsAuthorsFromRss10() public function testGetsAuthorsFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') ); $entry = $feed->current(); @@ -772,7 +776,7 @@ public function testGetsAuthorsFromRss090() public function testGetsAuthorsFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') ); $entry = $feed->current(); @@ -784,7 +788,7 @@ public function testGetsAuthorsFromRss20_Dc10() public function testGetsAuthorsFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -796,7 +800,7 @@ public function testGetsAuthorsFromRss094_Dc10() public function testGetsAuthorsFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -808,7 +812,7 @@ public function testGetsAuthorsFromRss093_Dc10() public function testGetsAuthorsFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -820,7 +824,7 @@ public function testGetsAuthorsFromRss092_Dc10() public function testGetsAuthorsFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -832,7 +836,7 @@ public function testGetsAuthorsFromRss091_Dc10() public function testGetsAuthorsFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -844,7 +848,7 @@ public function testGetsAuthorsFromRss10_Dc10() public function testGetsAuthorsFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -858,7 +862,7 @@ public function testGetsAuthorsFromRss090_Dc10() public function testGetsAuthorsFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') ); $entry = $feed->current(); @@ -870,7 +874,7 @@ public function testGetsAuthorsFromRss20_Dc11() public function testGetsAuthorsFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -882,7 +886,7 @@ public function testGetsAuthorsFromRss094_Dc11() public function testGetsAuthorsFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -894,7 +898,7 @@ public function testGetsAuthorsFromRss093_Dc11() public function testGetsAuthorsFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -906,7 +910,7 @@ public function testGetsAuthorsFromRss092_Dc11() public function testGetsAuthorsFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -918,7 +922,7 @@ public function testGetsAuthorsFromRss091_Dc11() public function testGetsAuthorsFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -930,7 +934,7 @@ public function testGetsAuthorsFromRss10_Dc11() public function testGetsAuthorsFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -944,7 +948,7 @@ public function testGetsAuthorsFromRss090_Dc11() public function testGetsAuthorsFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -953,7 +957,7 @@ public function testGetsAuthorsFromRss20_None() public function testGetsAuthorsFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -962,7 +966,7 @@ public function testGetsAuthorsFromRss094_None() public function testGetsAuthorsFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -971,7 +975,7 @@ public function testGetsAuthorsFromRss093_None() public function testGetsAuthorsFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -980,7 +984,7 @@ public function testGetsAuthorsFromRss092_None() public function testGetsAuthorsFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -989,7 +993,7 @@ public function testGetsAuthorsFromRss091_None() public function testGetsAuthorsFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -998,7 +1002,7 @@ public function testGetsAuthorsFromRss10_None() public function testGetsAuthorsFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -1011,7 +1015,7 @@ public function testGetsAuthorsFromRss090_None() */ public function testGetsAuthorFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss20.xml') ); $entry = $feed->current(); @@ -1020,7 +1024,7 @@ public function testGetsAuthorFromRss20() public function testGetsAuthorFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss094.xml') ); $entry = $feed->current(); @@ -1029,7 +1033,7 @@ public function testGetsAuthorFromRss094() public function testGetsAuthorFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss093.xml') ); $entry = $feed->current(); @@ -1038,7 +1042,7 @@ public function testGetsAuthorFromRss093() public function testGetsAuthorFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss092.xml') ); $entry = $feed->current(); @@ -1047,7 +1051,7 @@ public function testGetsAuthorFromRss092() public function testGetsAuthorFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss091.xml') ); $entry = $feed->current(); @@ -1056,7 +1060,7 @@ public function testGetsAuthorFromRss091() public function testGetsAuthorFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss10.xml') ); $entry = $feed->current(); @@ -1065,7 +1069,7 @@ public function testGetsAuthorFromRss10() public function testGetsAuthorFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/rss090.xml') ); $entry = $feed->current(); @@ -1076,7 +1080,7 @@ public function testGetsAuthorFromRss090() public function testGetsAuthorFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss20.xml') ); $entry = $feed->current(); @@ -1085,7 +1089,7 @@ public function testGetsAuthorFromRss20_Dc10() public function testGetsAuthorFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -1094,7 +1098,7 @@ public function testGetsAuthorFromRss094_Dc10() public function testGetsAuthorFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -1103,7 +1107,7 @@ public function testGetsAuthorFromRss093_Dc10() public function testGetsAuthorFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -1112,7 +1116,7 @@ public function testGetsAuthorFromRss092_Dc10() public function testGetsAuthorFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -1121,7 +1125,7 @@ public function testGetsAuthorFromRss091_Dc10() public function testGetsAuthorFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -1130,7 +1134,7 @@ public function testGetsAuthorFromRss10_Dc10() public function testGetsAuthorFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -1141,7 +1145,7 @@ public function testGetsAuthorFromRss090_Dc10() public function testGetsAuthorFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss20.xml') ); $entry = $feed->current(); @@ -1150,7 +1154,7 @@ public function testGetsAuthorFromRss20_Dc11() public function testGetsAuthorFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -1159,7 +1163,7 @@ public function testGetsAuthorFromRss094_Dc11() public function testGetsAuthorFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -1168,7 +1172,7 @@ public function testGetsAuthorFromRss093_Dc11() public function testGetsAuthorFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -1177,7 +1181,7 @@ public function testGetsAuthorFromRss092_Dc11() public function testGetsAuthorFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -1186,7 +1190,7 @@ public function testGetsAuthorFromRss091_Dc11() public function testGetsAuthorFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -1195,7 +1199,7 @@ public function testGetsAuthorFromRss10_Dc11() public function testGetsAuthorFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -1206,7 +1210,7 @@ public function testGetsAuthorFromRss090_Dc11() public function testGetsAuthorFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -1215,7 +1219,7 @@ public function testGetsAuthorFromRss20_None() public function testGetsAuthorFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -1224,7 +1228,7 @@ public function testGetsAuthorFromRss094_None() public function testGetsAuthorFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -1233,7 +1237,7 @@ public function testGetsAuthorFromRss093_None() public function testGetsAuthorFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -1242,7 +1246,7 @@ public function testGetsAuthorFromRss092_None() public function testGetsAuthorFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -1251,7 +1255,7 @@ public function testGetsAuthorFromRss091_None() public function testGetsAuthorFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -1260,7 +1264,7 @@ public function testGetsAuthorFromRss10_None() public function testGetsAuthorFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/author/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -1272,7 +1276,7 @@ public function testGetsAuthorFromRss090_None() */ public function testGetsDescriptionFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss20.xml') ); $entry = $feed->current(); @@ -1281,7 +1285,7 @@ public function testGetsDescriptionFromRss20() public function testGetsDescriptionFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss094.xml') ); $entry = $feed->current(); @@ -1290,7 +1294,7 @@ public function testGetsDescriptionFromRss094() public function testGetsDescriptionFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss093.xml') ); $entry = $feed->current(); @@ -1299,7 +1303,7 @@ public function testGetsDescriptionFromRss093() public function testGetsDescriptionFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss092.xml') ); $entry = $feed->current(); @@ -1308,7 +1312,7 @@ public function testGetsDescriptionFromRss092() public function testGetsDescriptionFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss091.xml') ); $entry = $feed->current(); @@ -1317,7 +1321,7 @@ public function testGetsDescriptionFromRss091() public function testGetsDescriptionFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss10.xml') ); $entry = $feed->current(); @@ -1326,7 +1330,7 @@ public function testGetsDescriptionFromRss10() public function testGetsDescriptionFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/rss090.xml') ); $entry = $feed->current(); @@ -1337,7 +1341,7 @@ public function testGetsDescriptionFromRss090() public function testGetsDescriptionFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss20.xml') ); $entry = $feed->current(); @@ -1346,7 +1350,7 @@ public function testGetsDescriptionFromRss20_Dc10() public function testGetsDescriptionFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -1355,7 +1359,7 @@ public function testGetsDescriptionFromRss094_Dc10() public function testGetsDescriptionFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -1364,7 +1368,7 @@ public function testGetsDescriptionFromRss093_Dc10() public function testGetsDescriptionFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -1373,7 +1377,7 @@ public function testGetsDescriptionFromRss092_Dc10() public function testGetsDescriptionFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -1382,7 +1386,7 @@ public function testGetsDescriptionFromRss091_Dc10() public function testGetsDescriptionFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -1391,7 +1395,7 @@ public function testGetsDescriptionFromRss10_Dc10() public function testGetsDescriptionFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -1402,7 +1406,7 @@ public function testGetsDescriptionFromRss090_Dc10() public function testGetsDescriptionFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss20.xml') ); $entry = $feed->current(); @@ -1411,7 +1415,7 @@ public function testGetsDescriptionFromRss20_Dc11() public function testGetsDescriptionFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -1420,7 +1424,7 @@ public function testGetsDescriptionFromRss094_Dc11() public function testGetsDescriptionFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -1429,7 +1433,7 @@ public function testGetsDescriptionFromRss093_Dc11() public function testGetsDescriptionFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -1438,7 +1442,7 @@ public function testGetsDescriptionFromRss092_Dc11() public function testGetsDescriptionFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -1447,7 +1451,7 @@ public function testGetsDescriptionFromRss091_Dc11() public function testGetsDescriptionFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -1456,7 +1460,7 @@ public function testGetsDescriptionFromRss10_Dc11() public function testGetsDescriptionFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -1467,7 +1471,7 @@ public function testGetsDescriptionFromRss090_Dc11() public function testGetsDescriptionFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -1476,7 +1480,7 @@ public function testGetsDescriptionFromRss20_None() public function testGetsDescriptionFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -1485,7 +1489,7 @@ public function testGetsDescriptionFromRss094_None() public function testGetsDescriptionFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -1494,7 +1498,7 @@ public function testGetsDescriptionFromRss093_None() public function testGetsDescriptionFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -1503,7 +1507,7 @@ public function testGetsDescriptionFromRss092_None() public function testGetsDescriptionFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -1512,7 +1516,7 @@ public function testGetsDescriptionFromRss091_None() public function testGetsDescriptionFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -1521,7 +1525,7 @@ public function testGetsDescriptionFromRss10_None() public function testGetsDescriptionFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/description/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -1533,12 +1537,12 @@ public function testGetsDescriptionFromRss090_None() */ public function testGetsEnclosureFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/enclosure/plain/rss20.xml') ); $entry = $feed->current(); - $expected = new stdClass(); + $expected = new \stdClass(); $expected->url = 'http://www.scripting.com/mp3s/weatherReportSuite.mp3'; $expected->length = '12216320'; $expected->type = 'audio/mpeg'; @@ -1548,7 +1552,7 @@ public function testGetsEnclosureFromRss20() public function testGetsEnclosureFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/enclosure/plain/rss10.xml') ); $entry = $feed->current(); @@ -1560,7 +1564,7 @@ public function testGetsEnclosureFromRss10() */ public function testGetsContentFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss20.xml') ); $entry = $feed->current(); @@ -1569,7 +1573,7 @@ public function testGetsContentFromRss20() public function testGetsContentFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss094.xml') ); $entry = $feed->current(); @@ -1578,7 +1582,7 @@ public function testGetsContentFromRss094() public function testGetsContentFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss093.xml') ); $entry = $feed->current(); @@ -1587,7 +1591,7 @@ public function testGetsContentFromRss093() public function testGetsContentFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss092.xml') ); $entry = $feed->current(); @@ -1596,7 +1600,7 @@ public function testGetsContentFromRss092() public function testGetsContentFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss091.xml') ); $entry = $feed->current(); @@ -1605,7 +1609,7 @@ public function testGetsContentFromRss091() public function testGetsContentFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss10.xml') ); $entry = $feed->current(); @@ -1614,7 +1618,7 @@ public function testGetsContentFromRss10() public function testGetsContentFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/rss090.xml') ); $entry = $feed->current(); @@ -1625,7 +1629,7 @@ public function testGetsContentFromRss090() public function testGetsContentFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss20.xml') ); $entry = $feed->current(); @@ -1634,7 +1638,7 @@ public function testGetsContentFromRss20_Dc10() public function testGetsContentFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss094.xml') ); $entry = $feed->current(); @@ -1643,7 +1647,7 @@ public function testGetsContentFromRss094_Dc10() public function testGetsContentFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss093.xml') ); $entry = $feed->current(); @@ -1652,7 +1656,7 @@ public function testGetsContentFromRss093_Dc10() public function testGetsContentFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss092.xml') ); $entry = $feed->current(); @@ -1661,7 +1665,7 @@ public function testGetsContentFromRss092_Dc10() public function testGetsContentFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss091.xml') ); $entry = $feed->current(); @@ -1670,7 +1674,7 @@ public function testGetsContentFromRss091_Dc10() public function testGetsContentFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss10.xml') ); $entry = $feed->current(); @@ -1679,7 +1683,7 @@ public function testGetsContentFromRss10_Dc10() public function testGetsContentFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/description/rss090.xml') ); $entry = $feed->current(); @@ -1690,7 +1694,7 @@ public function testGetsContentFromRss090_Dc10() public function testGetsContentFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -1699,7 +1703,7 @@ public function testGetsContentFromRss20_None() public function testGetsContentFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -1708,7 +1712,7 @@ public function testGetsContentFromRss094_None() public function testGetsContentFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -1717,7 +1721,7 @@ public function testGetsContentFromRss093_None() public function testGetsContentFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -1726,7 +1730,7 @@ public function testGetsContentFromRss092_None() public function testGetsContentFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -1735,7 +1739,7 @@ public function testGetsContentFromRss091_None() public function testGetsContentFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -1744,7 +1748,7 @@ public function testGetsContentFromRss10_None() public function testGetsContentFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/content/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -1756,7 +1760,7 @@ public function testGetsContentFromRss090_None() */ public function testGetsLinkFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss20.xml') ); $entry = $feed->current(); @@ -1765,7 +1769,7 @@ public function testGetsLinkFromRss20() public function testGetsLinkFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss094.xml') ); $entry = $feed->current(); @@ -1774,7 +1778,7 @@ public function testGetsLinkFromRss094() public function testGetsLinkFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss093.xml') ); $entry = $feed->current(); @@ -1783,7 +1787,7 @@ public function testGetsLinkFromRss093() public function testGetsLinkFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss092.xml') ); $entry = $feed->current(); @@ -1792,7 +1796,7 @@ public function testGetsLinkFromRss092() public function testGetsLinkFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss091.xml') ); $entry = $feed->current(); @@ -1801,7 +1805,7 @@ public function testGetsLinkFromRss091() public function testGetsLinkFromRss10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss10.xml') ); $entry = $feed->current(); @@ -1810,7 +1814,7 @@ public function testGetsLinkFromRss10() public function testGetsLinkFromRss090() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/rss090.xml') ); $entry = $feed->current(); @@ -1821,7 +1825,7 @@ public function testGetsLinkFromRss090() public function testGetsLinkFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -1830,7 +1834,7 @@ public function testGetsLinkFromRss20_None() public function testGetsLinkFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -1839,7 +1843,7 @@ public function testGetsLinkFromRss094_None() public function testGetsLinkFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -1848,7 +1852,7 @@ public function testGetsLinkFromRss093_None() public function testGetsLinkFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -1857,7 +1861,7 @@ public function testGetsLinkFromRss092_None() public function testGetsLinkFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -1866,7 +1870,7 @@ public function testGetsLinkFromRss091_None() public function testGetsLinkFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -1875,7 +1879,7 @@ public function testGetsLinkFromRss10_None() public function testGetsLinkFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -1887,12 +1891,12 @@ public function testGetsLinkFromRss090_None() */ public function testGetsDateModifiedFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } @@ -1901,16 +1905,16 @@ public function testGetsDateModifiedFromRss20() */ public function testParsesCorrectDateIfMissingOffsetWhenSystemUsesUSLocale() { - $locale = new Zend_Locale('en_US'); - Zend_Registry::set('Zend_Locale', $locale); - $feed = Zend_Feed_Reader::importString( + $locale = new \Zend\Locale\Locale('en_US'); + \Zend\Registry::set('Zend_Locale', $locale); + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20_en_US.xml') ); $entry = $feed->current(); $fdate = $entry->getDateModified(); - $edate = new Zend_Date; - $edate->set('2010-01-04T08:14:00-0600', Zend_Date::ISO_8601); - Zend_Registry::getInstance()->offsetUnset('Zend_Locale'); + $edate = new Date\Date; + $edate->set('2010-01-04T08:14:00-0600', Date\Date::ISO_8601); + \Zend\Registry::getInstance()->offsetUnset('Zend_Locale'); $this->assertTrue($edate->equals($fdate)); } @@ -1918,78 +1922,78 @@ public function testParsesCorrectDateIfMissingOffsetWhenSystemUsesUSLocale() public function testGetsDateModifiedFromRss20_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss20.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss094.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss093.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss092.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss091.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss10.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss090.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } @@ -1997,78 +2001,78 @@ public function testGetsDateModifiedFromRss090_Dc10() public function testGetsDateModifiedFromRss20_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss20.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss094.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss093.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss092.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss091.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss10.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } public function testGetsDateModifiedFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss090.xml') ); $entry = $feed->current(); - $edate = new Zend_Date; - $edate->set('2009-03-07T08:03:50Z', Zend_Date::ISO_8601); + $edate = new Date\Date; + $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); $this->assertTrue($edate->equals($entry->getDateModified())); } @@ -2076,7 +2080,7 @@ public function testGetsDateModifiedFromRss090_Dc11() public function testGetsDateModifiedFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -2085,7 +2089,7 @@ public function testGetsDateModifiedFromRss20_None() public function testGetsDateModifiedFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -2094,7 +2098,7 @@ public function testGetsDateModifiedFromRss094_None() public function testGetsDateModifiedFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -2103,7 +2107,7 @@ public function testGetsDateModifiedFromRss093_None() public function testGetsDateModifiedFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -2112,7 +2116,7 @@ public function testGetsDateModifiedFromRss092_None() public function testGetsDateModifiedFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -2121,7 +2125,7 @@ public function testGetsDateModifiedFromRss091_None() public function testGetsDateModifiedFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -2130,7 +2134,7 @@ public function testGetsDateModifiedFromRss10_None() public function testGetsDateModifiedFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -2142,13 +2146,13 @@ public function testGetsDateModifiedFromRss090_None() */ public function testGetsDateModifiedFromRss20_UnrecognisedGmtFormat() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20-zf-7908.xml') ); $entry = $feed->current(); //$this->assertEquals('Sunday 11 January 2009 09 55 59 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); - $edate = new Zend_Date; - $edate->set('Sun, 11 Jan 2009 09:55:59 GMT', Zend_Date::RSS); + $edate = new Date\Date; + $edate->set('Sun, 11 Jan 2009 09:55:59 GMT', Date\Date::RSS); $this->assertTrue($edate->equals($entry->getDateModified())); } @@ -2160,7 +2164,7 @@ public function testGetsDateModifiedFromRss20_UnrecognisedGmtFormat() public function testGetsCommentCountFromRss20_Slash10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss20.xml') ); $entry = $feed->current(); @@ -2169,7 +2173,7 @@ public function testGetsCommentCountFromRss20_Slash10() public function testGetsCommentCountFromRss094_Slash10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss094.xml') ); $entry = $feed->current(); @@ -2178,7 +2182,7 @@ public function testGetsCommentCountFromRss094_Slash10() public function testGetsCommentCountFromRss093_Slash10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss093.xml') ); $entry = $feed->current(); @@ -2187,7 +2191,7 @@ public function testGetsCommentCountFromRss093_Slash10() public function testGetsCommentCountFromRss092_Slash10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss092.xml') ); $entry = $feed->current(); @@ -2196,7 +2200,7 @@ public function testGetsCommentCountFromRss092_Slash10() public function testGetsCommentCountFromRss091_Slash10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss091.xml') ); $entry = $feed->current(); @@ -2205,7 +2209,7 @@ public function testGetsCommentCountFromRss091_Slash10() public function testGetsCommentCountFromRss10_Slash10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss10.xml') ); $entry = $feed->current(); @@ -2214,7 +2218,7 @@ public function testGetsCommentCountFromRss10_Slash10() public function testGetsCommentCountFromRss090_Slash10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/slash10/rss090.xml') ); $entry = $feed->current(); @@ -2225,7 +2229,7 @@ public function testGetsCommentCountFromRss090_Slash10() public function testGetsCommentCountFromRss20_Thread10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss20.xml') ); $entry = $feed->current(); @@ -2234,7 +2238,7 @@ public function testGetsCommentCountFromRss20_Thread10() public function testGetsCommentCountFromRss094_Thread10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss094.xml') ); $entry = $feed->current(); @@ -2243,7 +2247,7 @@ public function testGetsCommentCountFromRss094_Thread10() public function testGetsCommentCountFromRss093_Thread10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss093.xml') ); $entry = $feed->current(); @@ -2252,7 +2256,7 @@ public function testGetsCommentCountFromRss093_Thread10() public function testGetsCommentCountFromRss092_Thread10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss092.xml') ); $entry = $feed->current(); @@ -2261,7 +2265,7 @@ public function testGetsCommentCountFromRss092_Thread10() public function testGetsCommentCountFromRss091_Thread10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss091.xml') ); $entry = $feed->current(); @@ -2270,7 +2274,7 @@ public function testGetsCommentCountFromRss091_Thread10() public function testGetsCommentCountFromRss10_Thread10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss10.xml') ); $entry = $feed->current(); @@ -2279,7 +2283,7 @@ public function testGetsCommentCountFromRss10_Thread10() public function testGetsCommentCountFromRss090_Thread10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/thread10/rss090.xml') ); $entry = $feed->current(); @@ -2290,7 +2294,7 @@ public function testGetsCommentCountFromRss090_Thread10() public function testGetsCommentCountFromRss20_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss20.xml') ); $entry = $feed->current(); @@ -2299,7 +2303,7 @@ public function testGetsCommentCountFromRss20_Atom10() public function testGetsCommentCountFromRss094_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss094.xml') ); $entry = $feed->current(); @@ -2308,7 +2312,7 @@ public function testGetsCommentCountFromRss094_Atom10() public function testGetsCommentCountFromRss093_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss093.xml') ); $entry = $feed->current(); @@ -2317,7 +2321,7 @@ public function testGetsCommentCountFromRss093_Atom10() public function testGetsCommentCountFromRss092_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss092.xml') ); $entry = $feed->current(); @@ -2326,7 +2330,7 @@ public function testGetsCommentCountFromRss092_Atom10() public function testGetsCommentCountFromRss091_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss091.xml') ); $entry = $feed->current(); @@ -2335,7 +2339,7 @@ public function testGetsCommentCountFromRss091_Atom10() public function testGetsCommentCountFromRss10_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss10.xml') ); $entry = $feed->current(); @@ -2344,7 +2348,7 @@ public function testGetsCommentCountFromRss10_Atom10() public function testGetsCommentCountFromRss090_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/atom10/rss090.xml') ); $entry = $feed->current(); @@ -2355,7 +2359,7 @@ public function testGetsCommentCountFromRss090_Atom10() public function testGetsCommentCountFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -2364,7 +2368,7 @@ public function testGetsCommentCountFromRss20_None() public function testGetsCommentCountFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -2373,7 +2377,7 @@ public function testGetsCommentCountFromRss094_None() public function testGetsCommentCountFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -2382,7 +2386,7 @@ public function testGetsCommentCountFromRss093_None() public function testGetsCommentCountFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -2391,7 +2395,7 @@ public function testGetsCommentCountFromRss092_None() public function testGetsCommentCountFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -2400,7 +2404,7 @@ public function testGetsCommentCountFromRss091_None() public function testGetsCommentCountFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -2409,7 +2413,7 @@ public function testGetsCommentCountFromRss10_None() public function testGetsCommentCountFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentcount/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -2422,7 +2426,7 @@ public function testGetsCommentCountFromRss090_None() public function testGetsCommentLinkFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss20.xml') ); $entry = $feed->current(); @@ -2431,7 +2435,7 @@ public function testGetsCommentLinkFromRss20() public function testGetsCommentLinkFromRss094() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss094.xml') ); $entry = $feed->current(); @@ -2440,7 +2444,7 @@ public function testGetsCommentLinkFromRss094() public function testGetsCommentLinkFromRss093() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss093.xml') ); $entry = $feed->current(); @@ -2449,7 +2453,7 @@ public function testGetsCommentLinkFromRss093() public function testGetsCommentLinkFromRss092() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss092.xml') ); $entry = $feed->current(); @@ -2458,7 +2462,7 @@ public function testGetsCommentLinkFromRss092() public function testGetsCommentLinkFromRss091() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/rss091.xml') ); $entry = $feed->current(); @@ -2469,7 +2473,7 @@ public function testGetsCommentLinkFromRss091() public function testGetsCommentLinkFromRss20_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss20.xml') ); $entry = $feed->current(); @@ -2478,7 +2482,7 @@ public function testGetsCommentLinkFromRss20_Atom10() public function testGetsCommentLinkFromRss094_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss094.xml') ); $entry = $feed->current(); @@ -2487,7 +2491,7 @@ public function testGetsCommentLinkFromRss094_Atom10() public function testGetsCommentLinkFromRss093_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss093.xml') ); $entry = $feed->current(); @@ -2496,7 +2500,7 @@ public function testGetsCommentLinkFromRss093_Atom10() public function testGetsCommentLinkFromRss092_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss092.xml') ); $entry = $feed->current(); @@ -2505,7 +2509,7 @@ public function testGetsCommentLinkFromRss092_Atom10() public function testGetsCommentLinkFromRss091_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss091.xml') ); $entry = $feed->current(); @@ -2514,7 +2518,7 @@ public function testGetsCommentLinkFromRss091_Atom10() public function testGetsCommentLinkFromRss10_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss10.xml') ); $entry = $feed->current(); @@ -2523,7 +2527,7 @@ public function testGetsCommentLinkFromRss10_Atom10() public function testGetsCommentLinkFromRss090_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/atom10/rss090.xml') ); $entry = $feed->current(); @@ -2534,7 +2538,7 @@ public function testGetsCommentLinkFromRss090_Atom10() public function testGetsCommentLinkFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -2543,7 +2547,7 @@ public function testGetsCommentLinkFromRss20_None() public function testGetsCommentLinkFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -2552,7 +2556,7 @@ public function testGetsCommentLinkFromRss094_None() public function testGetsCommentLinkFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -2561,7 +2565,7 @@ public function testGetsCommentLinkFromRss093_None() public function testGetsCommentLinkFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -2570,7 +2574,7 @@ public function testGetsCommentLinkFromRss092_None() public function testGetsCommentLinkFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -2579,7 +2583,7 @@ public function testGetsCommentLinkFromRss091_None() public function testGetsCommentLinkFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -2588,7 +2592,7 @@ public function testGetsCommentLinkFromRss10_None() public function testGetsCommentLinkFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentlink/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -2603,7 +2607,7 @@ public function testGetsCommentLinkFromRss090_None() public function testGetsCommentFeedLinkFromRss20_WellFormedWeb10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss20.xml') ); $entry = $feed->current(); @@ -2612,7 +2616,7 @@ public function testGetsCommentFeedLinkFromRss20_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss094_WellFormedWeb10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss094.xml') ); $entry = $feed->current(); @@ -2621,7 +2625,7 @@ public function testGetsCommentFeedLinkFromRss094_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss093_WellFormedWeb10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss093.xml') ); $entry = $feed->current(); @@ -2630,7 +2634,7 @@ public function testGetsCommentFeedLinkFromRss093_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss092_WellFormedWeb10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss092.xml') ); $entry = $feed->current(); @@ -2639,7 +2643,7 @@ public function testGetsCommentFeedLinkFromRss092_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss091_WellFormedWeb10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss091.xml') ); $entry = $feed->current(); @@ -2648,7 +2652,7 @@ public function testGetsCommentFeedLinkFromRss091_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss10_WellFormedWeb10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss10.xml') ); $entry = $feed->current(); @@ -2657,7 +2661,7 @@ public function testGetsCommentFeedLinkFromRss10_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss090_WellFormedWeb10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/wellformedweb/rss090.xml') ); $entry = $feed->current(); @@ -2668,7 +2672,7 @@ public function testGetsCommentFeedLinkFromRss090_WellFormedWeb10() public function testGetsCommentFeedLinkFromRss20_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss20.xml') ); $entry = $feed->current(); @@ -2677,7 +2681,7 @@ public function testGetsCommentFeedLinkFromRss20_Atom10() public function testGetsCommentFeedLinkFromRss094_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss094.xml') ); $entry = $feed->current(); @@ -2686,7 +2690,7 @@ public function testGetsCommentFeedLinkFromRss094_Atom10() public function testGetsCommentFeedLinkFromRss093_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss093.xml') ); $entry = $feed->current(); @@ -2695,7 +2699,7 @@ public function testGetsCommentFeedLinkFromRss093_Atom10() public function testGetsCommentFeedLinkFromRss092_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss092.xml') ); $entry = $feed->current(); @@ -2704,7 +2708,7 @@ public function testGetsCommentFeedLinkFromRss092_Atom10() public function testGetsCommentFeedLinkFromRss091_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss091.xml') ); $entry = $feed->current(); @@ -2713,7 +2717,7 @@ public function testGetsCommentFeedLinkFromRss091_Atom10() public function testGetsCommentFeedLinkFromRss10_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss10.xml') ); $entry = $feed->current(); @@ -2722,7 +2726,7 @@ public function testGetsCommentFeedLinkFromRss10_Atom10() public function testGetsCommentFeedLinkFromRss090_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/atom10/rss090.xml') ); $entry = $feed->current(); @@ -2733,7 +2737,7 @@ public function testGetsCommentFeedLinkFromRss090_Atom10() public function testGetsCommentFeedLinkFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -2742,7 +2746,7 @@ public function testGetsCommentFeedLinkFromRss20_None() public function testGetsCommentFeedLinkFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -2751,7 +2755,7 @@ public function testGetsCommentFeedLinkFromRss094_None() public function testGetsCommentFeedLinkFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -2760,7 +2764,7 @@ public function testGetsCommentFeedLinkFromRss093_None() public function testGetsCommentFeedLinkFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -2769,7 +2773,7 @@ public function testGetsCommentFeedLinkFromRss092_None() public function testGetsCommentFeedLinkFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -2778,7 +2782,7 @@ public function testGetsCommentFeedLinkFromRss091_None() public function testGetsCommentFeedLinkFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss10.xml') ); $entry = $feed->current(); @@ -2787,7 +2791,7 @@ public function testGetsCommentFeedLinkFromRss10_None() public function testGetsCommentFeedLinkFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/commentfeedlink/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -2802,7 +2806,7 @@ public function testGetsCommentFeedLinkFromRss090_None() public function testGetsCategoriesFromRss20() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/rss20.xml') ); $entry = $feed->current(); @@ -2814,7 +2818,7 @@ public function testGetsCategoriesFromRss20() public function testGetsCategoriesFromRss090_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss090.xml') ); $entry = $feed->current(); @@ -2824,7 +2828,7 @@ public function testGetsCategoriesFromRss090_Dc10() public function testGetsCategoriesFromRss091_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss091.xml') ); $entry = $feed->current(); @@ -2834,7 +2838,7 @@ public function testGetsCategoriesFromRss091_Dc10() public function testGetsCategoriesFromRss092_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss092.xml') ); $entry = $feed->current(); @@ -2844,7 +2848,7 @@ public function testGetsCategoriesFromRss092_Dc10() public function testGetsCategoriesFromRss093_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss093.xml') ); $entry = $feed->current(); @@ -2854,7 +2858,7 @@ public function testGetsCategoriesFromRss093_Dc10() public function testGetsCategoriesFromRss094_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss094.xml') ); $entry = $feed->current(); @@ -2864,7 +2868,7 @@ public function testGetsCategoriesFromRss094_Dc10() public function testGetsCategoriesFromRss10_Dc10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc10/rss10.xml') ); $entry = $feed->current(); @@ -2876,7 +2880,7 @@ public function testGetsCategoriesFromRss10_Dc10() public function testGetsCategoriesFromRss090_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss090.xml') ); $entry = $feed->current(); @@ -2886,7 +2890,7 @@ public function testGetsCategoriesFromRss090_Dc11() public function testGetsCategoriesFromRss091_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss091.xml') ); $entry = $feed->current(); @@ -2896,7 +2900,7 @@ public function testGetsCategoriesFromRss091_Dc11() public function testGetsCategoriesFromRss092_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss092.xml') ); $entry = $feed->current(); @@ -2906,7 +2910,7 @@ public function testGetsCategoriesFromRss092_Dc11() public function testGetsCategoriesFromRss093_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss093.xml') ); $entry = $feed->current(); @@ -2916,7 +2920,7 @@ public function testGetsCategoriesFromRss093_Dc11() public function testGetsCategoriesFromRss094_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss094.xml') ); $entry = $feed->current(); @@ -2926,7 +2930,7 @@ public function testGetsCategoriesFromRss094_Dc11() public function testGetsCategoriesFromRss10_Dc11() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/dc11/rss10.xml') ); $entry = $feed->current(); @@ -2938,7 +2942,7 @@ public function testGetsCategoriesFromRss10_Dc11() public function testGetsCategoriesFromRss090_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss090.xml') ); $entry = $feed->current(); @@ -2948,7 +2952,7 @@ public function testGetsCategoriesFromRss090_Atom10() public function testGetsCategoriesFromRss091_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss091.xml') ); $entry = $feed->current(); @@ -2958,7 +2962,7 @@ public function testGetsCategoriesFromRss091_Atom10() public function testGetsCategoriesFromRss092_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss092.xml') ); $entry = $feed->current(); @@ -2968,7 +2972,7 @@ public function testGetsCategoriesFromRss092_Atom10() public function testGetsCategoriesFromRss093_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss093.xml') ); $entry = $feed->current(); @@ -2978,7 +2982,7 @@ public function testGetsCategoriesFromRss093_Atom10() public function testGetsCategoriesFromRss094_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss094.xml') ); $entry = $feed->current(); @@ -2988,7 +2992,7 @@ public function testGetsCategoriesFromRss094_Atom10() public function testGetsCategoriesFromRss10_Atom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/atom10/rss10.xml') ); $entry = $feed->current(); @@ -3000,7 +3004,7 @@ public function testGetsCategoriesFromRss10_Atom10() public function testGetsCategoriesFromRss20_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss20.xml') ); $entry = $feed->current(); @@ -3010,7 +3014,7 @@ public function testGetsCategoriesFromRss20_None() public function testGetsCategoriesFromRss090_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss090.xml') ); $entry = $feed->current(); @@ -3020,7 +3024,7 @@ public function testGetsCategoriesFromRss090_None() public function testGetsCategoriesFromRss091_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss091.xml') ); $entry = $feed->current(); @@ -3030,7 +3034,7 @@ public function testGetsCategoriesFromRss091_None() public function testGetsCategoriesFromRss092_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss092.xml') ); $entry = $feed->current(); @@ -3040,7 +3044,7 @@ public function testGetsCategoriesFromRss092_None() public function testGetsCategoriesFromRss093_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss093.xml') ); $entry = $feed->current(); @@ -3050,7 +3054,7 @@ public function testGetsCategoriesFromRss093_None() public function testGetsCategoriesFromRss094_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss094.xml') ); $entry = $feed->current(); @@ -3060,7 +3064,7 @@ public function testGetsCategoriesFromRss094_None() public function testGetsCategoriesFromRss10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/category/plain/none/rss10.xml') ); $entry = $feed->current(); diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index e1b850c3..7dc793d2 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -361,6 +361,7 @@ public function testGetsLinkFromAtom10WithNoRelAttribute() public function testGetsLinkFromAtom10WithRelativeUrl() { + $this->markTestIncomplete('Pending fix for \Zend\URI\URL::validate()'); $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/link/plain/atom10-relative.xml') ); @@ -399,6 +400,7 @@ public function testGetsFeedLinkFromAtom10() public function testGetsFeedLinkFromAtom10IfRelativeUri() { + $this->markTestIncomplete('Pending fix for \Zend\URI\URL::validate()'); $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom10-relative.xml') ); diff --git a/test/Reader/Integration/H-OnlineComAtom10Test.php b/test/Reader/Integration/H-OnlineComAtom10Test.php index 8918bf16..572d19f5 100644 --- a/test/Reader/Integration/H-OnlineComAtom10Test.php +++ b/test/Reader/Integration/H-OnlineComAtom10Test.php @@ -20,44 +20,48 @@ * @version $Id: H-OnlineComAtom10Test.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; +/** +* @namespace +*/ +namespace ZendTest\Feed\Reader\Integration; +use Zend\Feed\Reader; +use Zend\Date; /** - * @category Zend - * @package Zend_Feed - * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @group Zend_Feed - * @group Zend_Feed_Reader - */ -class Zend_Feed_Reader_Integration_HOnlineComAtom10Test extends PHPUnit_Framework_TestCase +* @category Zend +* @package Zend_Feed +* @subpackage UnitTests +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +* @group Zend_Feed +* @group Zend_Feed_Reader +*/ +class HOnlineComAtom10Test extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Zend_Feed_Reader::reset(); + Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/h-online.com-atom10.xml'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); } public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } public function testGetsTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('The H - news feed', $feed->getTitle()); @@ -65,7 +69,7 @@ public function testGetsTitle() public function testGetsAuthors() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array(array('name'=>'The H')), (array) $feed->getAuthors()); @@ -73,7 +77,7 @@ public function testGetsAuthors() public function testGetsSingleAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array('name'=>'The H'), $feed->getAuthor()); @@ -81,7 +85,7 @@ public function testGetsSingleAuthor() public function testGetsCopyright() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(null, $feed->getCopyright()); @@ -89,7 +93,7 @@ public function testGetsCopyright() public function testGetsDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Technology news', $feed->getDescription()); @@ -97,7 +101,7 @@ public function testGetsDescription() public function testGetsLanguage() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(null, $feed->getLanguage()); @@ -105,7 +109,7 @@ public function testGetsLanguage() public function testGetsLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://www.h-online.com', $feed->getLink()); @@ -113,7 +117,7 @@ public function testGetsLink() public function testGetsEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('UTF-8', $feed->getEncoding()); @@ -121,7 +125,7 @@ public function testGetsEncoding() public function testGetsEntryCount() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(60, $feed->count()); @@ -133,7 +137,7 @@ public function testGetsEntryCount() public function testGetsEntryId() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -142,7 +146,7 @@ public function testGetsEntryId() public function testGetsEntryTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -151,7 +155,7 @@ public function testGetsEntryTitle() public function testGetsEntryAuthors() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -160,7 +164,7 @@ public function testGetsEntryAuthors() public function testGetsEntrySingleAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -169,7 +173,7 @@ public function testGetsEntrySingleAuthor() public function testGetsEntryDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -181,7 +185,7 @@ public function testGetsEntryDescription() public function testGetsEntryContent() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -190,7 +194,7 @@ public function testGetsEntryContent() public function testGetsEntryLinks() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -199,7 +203,7 @@ public function testGetsEntryLinks() public function testGetsEntryLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -208,7 +212,7 @@ public function testGetsEntryLink() public function testGetsEntryPermaLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -218,7 +222,7 @@ public function testGetsEntryPermaLink() public function testGetsEntryEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); diff --git a/test/Reader/Integration/LautDeRdfTest.php b/test/Reader/Integration/LautDeRdfTest.php index 5604b193..81d6b209 100644 --- a/test/Reader/Integration/LautDeRdfTest.php +++ b/test/Reader/Integration/LautDeRdfTest.php @@ -20,39 +20,43 @@ * @version $Id: LautDeRdfTest.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; +/** +* @namespace +*/ +namespace ZendTest\Feed\Reader\Integration; +use Zend\Feed\Reader; +use Zend\Date; /** - * @category Zend - * @package Zend_Feed - * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @group Zend_Feed - * @group Zend_Feed_Reader - */ -class Zend_Feed_Reader_Integration_LautDeRdfTest extends PHPUnit_Framework_TestCase +* @category Zend +* @package Zend_Feed +* @subpackage UnitTests +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +* @group Zend_Feed +* @group Zend_Feed_Reader +*/ +class LautDeRdfTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Zend_Feed_Reader::reset(); + Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/laut.de-rdf.xml'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); } public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } /** @@ -61,7 +65,7 @@ public function teardown() public function testGetsTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('laut.de - news', $feed->getTitle()); @@ -69,7 +73,7 @@ public function testGetsTitle() public function testGetsAuthors() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array(array('name'=>'laut.de')), (array) $feed->getAuthors()); @@ -77,7 +81,7 @@ public function testGetsAuthors() public function testGetsSingleAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array('name'=>'laut.de'), $feed->getAuthor()); @@ -85,7 +89,7 @@ public function testGetsSingleAuthor() public function testGetsCopyright() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Copyright © 2004 laut.de', $feed->getCopyright()); @@ -93,7 +97,7 @@ public function testGetsCopyright() public function testGetsDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('laut.de: aktuelle News', $feed->getDescription()); @@ -101,7 +105,7 @@ public function testGetsDescription() public function testGetsLanguage() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(null, $feed->getLanguage()); @@ -109,7 +113,7 @@ public function testGetsLanguage() public function testGetsLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://www.laut.de', $feed->getLink()); @@ -117,7 +121,7 @@ public function testGetsLink() public function testGetsEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('ISO-8859-1', $feed->getEncoding()); @@ -131,7 +135,7 @@ public function testGetsEncoding() public function testGetsEntryId() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -140,7 +144,7 @@ public function testGetsEntryId() public function testGetsEntryTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -149,7 +153,7 @@ public function testGetsEntryTitle() public function testGetsEntryAuthors() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -158,7 +162,7 @@ public function testGetsEntryAuthors() public function testGetsEntrySingleAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -172,7 +176,7 @@ public function testGetsEntrySingleAuthor() public function testGetsEntryDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -181,7 +185,7 @@ public function testGetsEntryDescription() public function testGetsEntryContent() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -190,7 +194,7 @@ public function testGetsEntryContent() public function testGetsEntryLinks() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -199,7 +203,7 @@ public function testGetsEntryLinks() public function testGetsEntryLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -208,7 +212,7 @@ public function testGetsEntryLink() public function testGetsEntryPermaLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -218,7 +222,7 @@ public function testGetsEntryPermaLink() public function testGetsEntryEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); diff --git a/test/Reader/Integration/PodcastRss2Test.php b/test/Reader/Integration/PodcastRss2Test.php index fb08fe03..da4510a7 100644 --- a/test/Reader/Integration/PodcastRss2Test.php +++ b/test/Reader/Integration/PodcastRss2Test.php @@ -20,40 +20,43 @@ * @version $Id: PodcastRss2Test.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -require_once dirname(__FILE__) . '/../../../../TestHelper.php'; -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; +/** +* @namespace +*/ +namespace ZendTest\Feed\Reader\Integration; +use Zend\Feed\Reader; +use Zend\Date; /** - * @category Zend - * @package Zend_Feed - * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @group Zend_Feed - * @group Zend_Feed_Reader - */ -class Zend_Feed_Reader_Integration_PodcastRss2Test extends PHPUnit_Framework_TestCase +* @category Zend +* @package Zend_Feed +* @subpackage UnitTests +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +* @group Zend_Feed +* @group Zend_Feed_Reader +*/ +class PodcastRss2Test extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Zend_Feed_Reader::reset(); + Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/podcast.xml'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); } public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } /** @@ -62,7 +65,7 @@ public function teardown() public function testGetsNewFeedUrl() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://newlocation.com/example.rss', $feed->getNewFeedUrl()); @@ -70,7 +73,7 @@ public function testGetsNewFeedUrl() public function testGetsOwner() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('john.doe@example.com (John Doe)', $feed->getOwner()); @@ -78,7 +81,7 @@ public function testGetsOwner() public function testGetsCategories() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array( @@ -91,7 +94,7 @@ public function testGetsCategories() public function testGetsTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('All About Everything', $feed->getTitle()); @@ -99,7 +102,7 @@ public function testGetsTitle() public function testGetsCastAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('John Doe', $feed->getCastAuthor()); @@ -107,7 +110,7 @@ public function testGetsCastAuthor() public function testGetsFeedBlock() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('no', $feed->getBlock()); @@ -115,7 +118,7 @@ public function testGetsFeedBlock() public function testGetsCopyright() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('℗ & © 2005 John Doe & Family', $feed->getCopyright()); @@ -123,7 +126,7 @@ public function testGetsCopyright() public function testGetsDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('All About Everything is a show about everything. @@ -134,7 +137,7 @@ public function testGetsDescription() public function testGetsLanguage() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('en-us', $feed->getLanguage()); @@ -142,7 +145,7 @@ public function testGetsLanguage() public function testGetsLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://www.example.com/podcasts/everything/index.html', $feed->getLink()); @@ -150,7 +153,7 @@ public function testGetsLink() public function testGetsEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('UTF-8', $feed->getEncoding()); @@ -158,7 +161,7 @@ public function testGetsEncoding() public function testGetsFeedExplicit() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('yes', $feed->getExplicit()); @@ -166,7 +169,7 @@ public function testGetsFeedExplicit() public function testGetsEntryCount() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(3, $feed->count()); @@ -174,7 +177,7 @@ public function testGetsEntryCount() public function testGetsImage() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://example.com/podcasts/everything/AllAboutEverything.jpg', $feed->getImage()); @@ -186,7 +189,7 @@ public function testGetsImage() public function testGetsEntryBlock() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -195,7 +198,7 @@ public function testGetsEntryBlock() public function testGetsEntryId() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -204,7 +207,7 @@ public function testGetsEntryId() public function testGetsEntryTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -213,7 +216,7 @@ public function testGetsEntryTitle() public function testGetsEntryCastAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -222,7 +225,7 @@ public function testGetsEntryCastAuthor() public function testGetsEntryExplicit() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -231,7 +234,7 @@ public function testGetsEntryExplicit() public function testGetsSubtitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -241,7 +244,7 @@ public function testGetsSubtitle() public function testGetsSummary() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -253,7 +256,7 @@ public function testGetsSummary() public function testGetsDuration() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -262,7 +265,7 @@ public function testGetsDuration() public function testGetsKeywords() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -272,7 +275,7 @@ public function testGetsKeywords() public function testGetsEntryEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -281,12 +284,12 @@ public function testGetsEntryEncoding() public function testGetsEnclosure() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); - $expected = new stdClass(); + $expected = new \stdClass(); $expected->url = 'http://example.com/podcasts/everything/AllAboutEverythingEpisode3.m4a'; $expected->length = '8727310'; $expected->type = 'audio/x-m4a'; diff --git a/test/Reader/Integration/WordpressAtom10Test.php b/test/Reader/Integration/WordpressAtom10Test.php index c3a2a134..0a38add9 100644 --- a/test/Reader/Integration/WordpressAtom10Test.php +++ b/test/Reader/Integration/WordpressAtom10Test.php @@ -20,44 +20,48 @@ * @version $Id: WordpressAtom10Test.php 22300 2010-05-26 10:13:34Z padraic $ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; +/** +* @namespace +*/ +namespace ZendTest\Feed\Reader\Integration; +use Zend\Feed\Reader; +use Zend\Date; /** - * @category Zend - * @package Zend_Feed - * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @group Zend_Feed - * @group Zend_Feed_Reader - */ -class Zend_Feed_Reader_Integration_WordpressAtom10Test extends PHPUnit_Framework_TestCase +* @category Zend +* @package Zend_Feed +* @subpackage UnitTests +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +* @group Zend_Feed +* @group Zend_Feed_Reader +*/ +class WordpressAtom10Test extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Zend_Feed_Reader::reset(); + Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/wordpress-atom10.xml'; - $this->_options = Zend_Date::setOptions(); + $this->_options = Date\Date::setOptions(); foreach($this->_options as $k=>$v) { if (is_null($v)) { unset($this->_options[$k]); } } - Zend_Date::setOptions(array('format_type'=>'iso')); + Date\Date::setOptions(array('format_type'=>'iso')); } public function teardown() { - Zend_Date::setOptions($this->_options); + Date\Date::setOptions($this->_options); } public function testGetsTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Norm 2782', $feed->getTitle()); @@ -65,7 +69,7 @@ public function testGetsTitle() public function testGetsAuthors() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array( @@ -75,7 +79,7 @@ public function testGetsAuthors() public function testGetsSingleAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array('name'=>'norm2782','uri'=>'http://www.norm2782.com'), $feed->getAuthor()); @@ -83,7 +87,7 @@ public function testGetsSingleAuthor() public function testGetsCopyright() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(null, $feed->getCopyright()); @@ -91,7 +95,7 @@ public function testGetsCopyright() public function testGetsDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Why are you here?', $feed->getDescription()); @@ -99,7 +103,7 @@ public function testGetsDescription() public function testGetsLanguage() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('en', $feed->getLanguage()); @@ -107,7 +111,7 @@ public function testGetsLanguage() public function testGetsLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://www.norm2782.com', $feed->getLink()); @@ -115,7 +119,7 @@ public function testGetsLink() public function testGetsEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('UTF-8', $feed->getEncoding()); @@ -123,7 +127,7 @@ public function testGetsEncoding() public function testGetsEntryCount() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(10, $feed->count()); @@ -135,7 +139,7 @@ public function testGetsEntryCount() public function testGetsEntryId() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -144,7 +148,7 @@ public function testGetsEntryId() public function testGetsEntryTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -157,7 +161,7 @@ public function testGetsEntryTitle() public function testGetsEntryAuthors() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -166,7 +170,7 @@ public function testGetsEntryAuthors() public function testGetsEntrySingleAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -175,7 +179,7 @@ public function testGetsEntrySingleAuthor() public function testGetsEntryDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -187,7 +191,7 @@ public function testGetsEntryDescription() public function testGetsEntryContent() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -196,7 +200,7 @@ public function testGetsEntryContent() public function testGetsEntryLinks() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -205,7 +209,7 @@ public function testGetsEntryLinks() public function testGetsEntryLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -214,7 +218,7 @@ public function testGetsEntryLink() public function testGetsEntryPermaLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -224,7 +228,7 @@ public function testGetsEntryPermaLink() public function testGetsEntryEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); diff --git a/test/Reader/Integration/WordpressRss2DcAtomTest.php b/test/Reader/Integration/WordpressRss2DcAtomTest.php index 3bead6ae..5cfa5611 100644 --- a/test/Reader/Integration/WordpressRss2DcAtomTest.php +++ b/test/Reader/Integration/WordpressRss2DcAtomTest.php @@ -20,26 +20,29 @@ * @version $Id: WordpressRss2DcAtomTest.php 22300 2010-05-26 10:13:34Z padraic $ */ -require_once 'PHPUnit/Framework/TestCase.php'; -require_once 'Zend/Feed/Reader.php'; +/** +* @namespace +*/ +namespace ZendTest\Feed\Reader\Integration; +use Zend\Feed\Reader; /** - * @category Zend - * @package Zend_Feed - * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @group Zend_Feed - * @group Zend_Feed_Reader - */ -class Zend_Feed_Reader_Integration_WordpressRss2DcAtomTest extends PHPUnit_Framework_TestCase +* @category Zend +* @package Zend_Feed +* @subpackage UnitTests +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +* @group Zend_Feed +* @group Zend_Feed_Reader +*/ +class WordpressRss2DcAtomTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; public function setup() { - Zend_Feed_Reader::reset(); + Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/wordpress-rss2-dc-atom.xml'; } @@ -49,7 +52,7 @@ public function setup() public function testGetsTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Norm 2782', $feed->getTitle()); @@ -57,7 +60,7 @@ public function testGetsTitle() public function testGetsAuthors() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array( @@ -67,7 +70,7 @@ public function testGetsAuthors() public function testGetsSingleAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(array('name'=>'norm2782'), $feed->getAuthor()); @@ -75,7 +78,7 @@ public function testGetsSingleAuthor() public function testGetsCopyright() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(null, $feed->getCopyright()); @@ -83,7 +86,7 @@ public function testGetsCopyright() public function testGetsDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('Why are you here?', $feed->getDescription()); @@ -91,7 +94,7 @@ public function testGetsDescription() public function testGetsLanguage() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('en', $feed->getLanguage()); @@ -99,7 +102,7 @@ public function testGetsLanguage() public function testGetsLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('http://www.norm2782.com', $feed->getLink()); @@ -107,7 +110,7 @@ public function testGetsLink() public function testGetsEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals('UTF-8', $feed->getEncoding()); @@ -115,7 +118,7 @@ public function testGetsEncoding() public function testGetsEntryCount() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $this->assertEquals(10, $feed->count()); @@ -127,7 +130,7 @@ public function testGetsEntryCount() public function testGetsEntryId() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -136,7 +139,7 @@ public function testGetsEntryId() public function testGetsEntryTitle() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -149,7 +152,7 @@ public function testGetsEntryTitle() public function testGetsEntryAuthors() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -158,7 +161,7 @@ public function testGetsEntryAuthors() public function testGetsEntrySingleAuthor() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -167,7 +170,7 @@ public function testGetsEntrySingleAuthor() public function testGetsEntryDescription() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -179,7 +182,7 @@ public function testGetsEntryDescription() public function testGetsEntryContent() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -188,7 +191,7 @@ public function testGetsEntryContent() public function testGetsEntryLinks() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -197,7 +200,7 @@ public function testGetsEntryLinks() public function testGetsEntryLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -206,7 +209,7 @@ public function testGetsEntryLink() public function testGetsEntryPermaLink() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); @@ -216,7 +219,7 @@ public function testGetsEntryPermaLink() public function testGetsEntryEncoding() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath) ); $entry = $feed->current(); From eb32b68ac2dad5b510aac0a82ab423b64823c68f Mon Sep 17 00:00:00 2001 From: ramon Date: Wed, 30 Jun 2010 19:11:27 +0000 Subject: [PATCH 143/238] [ZF-10069] Zend_Feed_Pubsubhubbub: - Fixed condition wrong git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22507 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/Model/Subscription.php | 31 ++++--- test/Pubsubhubbub/AllTests.php | 2 + test/Pubsubhubbub/Model/AllTests.php | 56 +++++++++++ test/Pubsubhubbub/Model/SubscriptionTest.php | 97 ++++++++++++++++++++ 4 files changed, 172 insertions(+), 14 deletions(-) create mode 100644 test/Pubsubhubbub/Model/AllTests.php create mode 100644 test/Pubsubhubbub/Model/SubscriptionTest.php diff --git a/src/Pubsubhubbub/Model/Subscription.php b/src/Pubsubhubbub/Model/Subscription.php index 0ba23e01..2db4c209 100644 --- a/src/Pubsubhubbub/Model/Subscription.php +++ b/src/Pubsubhubbub/Model/Subscription.php @@ -26,6 +26,9 @@ /** @see Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface */ require_once 'Zend/Feed/Pubsubhubbub/Model/SubscriptionInterface.php'; +/** @see Zend_Date */ +require_once 'Zend/Date.php'; + /** * @category Zend * @package Zend_Feed_Pubsubhubbub @@ -37,7 +40,7 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription extends Zend_Feed_Pubsubhubbub_Model_ModelAbstract implements Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface { - + /** * Save subscription to RDMBS * @@ -53,10 +56,10 @@ public function setSubscription(array $data) ); } $result = $this->_db->find($data['id']); - if ($result) { + if (count($result)) { $data['created_time'] = $result->current()->created_time; $now = new Zend_Date; - if ($data['lease_seconds']) { + if (isset($data['lease_seconds'])) { $data['expiration_time'] = $now->add($data['lease_seconds'], Zend_Date::SECOND) ->get('yyyy-MM-dd HH:mm:ss'); } @@ -70,11 +73,11 @@ public function setSubscription(array $data) $this->_db->insert($data); return true; } - + /** * Get subscription by ID/key - * - * @param string $key + * + * @param string $key * @return array */ public function getSubscription($key) @@ -85,16 +88,16 @@ public function getSubscription($key) .' of "' . $key . '" must be a non-empty string'); } $result = $this->_db->find($key); - if ($result) { - return (array) $result->current(); + if (count($result)) { + return $result->current()->toArray(); } return false; } /** * Determine if a subscription matching the key exists - * - * @param string $key + * + * @param string $key * @return bool */ public function hasSubscription($key) @@ -105,12 +108,12 @@ public function hasSubscription($key) .' of "' . $key . '" must be a non-empty string'); } $result = $this->_db->find($key); - if ($result) { + if (count($result)) { return true; } return false; } - + /** * Delete a subscription * @@ -120,7 +123,7 @@ public function hasSubscription($key) public function deleteSubscription($key) { $result = $this->_db->find($key); - if ($result) { + if (count($result)) { $this->_db->delete( $this->_db->getAdapter()->quoteInto('id = ?', $key) ); @@ -128,5 +131,5 @@ public function deleteSubscription($key) } return false; } - + } diff --git a/test/Pubsubhubbub/AllTests.php b/test/Pubsubhubbub/AllTests.php index 29585731..28d630ca 100644 --- a/test/Pubsubhubbub/AllTests.php +++ b/test/Pubsubhubbub/AllTests.php @@ -29,6 +29,7 @@ require_once 'Zend/Feed/Pubsubhubbub/PublisherTest.php'; require_once 'Zend/Feed/Pubsubhubbub/SubscriberTest.php'; require_once 'Zend/Feed/Pubsubhubbub/SubscriberHttpTest.php'; +require_once 'Zend/Feed/Pubsubhubbub/Model/AllTests.php'; require_once 'Zend/Feed/Pubsubhubbub/Subscriber/CallbackTest.php'; @@ -56,6 +57,7 @@ public static function suite() $suite->addTestSuite('Zend_Feed_Pubsubhubbub_PublisherTest'); $suite->addTestSuite('Zend_Feed_Pubsubhubbub_SubscriberTest'); $suite->addTestSuite('Zend_Feed_Pubsubhubbub_SubscriberHttpTest'); + $suite->addTest(Zend_Feed_Pubsubhubbub_Model_AllTests::suite()); $suite->addTestSuite('Zend_Feed_Pubsubhubbub_Subscriber_CallbackTest'); return $suite; diff --git a/test/Pubsubhubbub/Model/AllTests.php b/test/Pubsubhubbub/Model/AllTests.php new file mode 100644 index 00000000..d86e5d3b --- /dev/null +++ b/test/Pubsubhubbub/Model/AllTests.php @@ -0,0 +1,56 @@ +addTestSuite('Zend_Feed_Pubsubhubbub_Model_SubscriptionTest'); + return $suite; + } +} + +if (PHPUnit_MAIN_METHOD == 'Zend_Feed_Pubsubhubbub_Model_AllTests::main') { + Zend_Feed_Pubsubhubbub_AllTests::main(); +} diff --git a/test/Pubsubhubbub/Model/SubscriptionTest.php b/test/Pubsubhubbub/Model/SubscriptionTest.php new file mode 100644 index 00000000..974c1af2 --- /dev/null +++ b/test/Pubsubhubbub/Model/SubscriptionTest.php @@ -0,0 +1,97 @@ +_initDb(); + $subscription = new Zend_Feed_Pubsubhubbub_Model_Subscription(); + $id = uniqid(); + $this->assertFalse($subscription->hasSubscription($id)); + $this->assertFalse($subscription->getSubscription($id)); + $this->assertFalse($subscription->deleteSubscription($id)); + $this->assertTrue($subscription->setSubscription(array('id' => $id))); + + $this->assertTrue($subscription->hasSubscription($id)); + $dataSubscription = $subscription->getSubscription($id); + $this->assertType('array', $dataSubscription); + $keys = array('id', 'topic_url', 'hub_url', + 'created_time', 'lease_seconds', + 'verify_token', 'secret', + 'expiration_time', 'subscription_state'); + + $this->assertSame($keys, array_keys($dataSubscription)); + $this->assertFalse($subscription->setSubscription(array('id' => $id))); + $this->assertTrue($subscription->deleteSubscription($id)); + } + + public function testImpemetsSubscriptionInterface() + { + $reflection = new ReflectionClass('Zend_Feed_Pubsubhubbub_Model_Subscription'); + $this->assertTrue($reflection->implementsInterface('Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface')); + unset($reflection); + } + + protected function _initDb() + { + if (!extension_loaded('pdo') + && !in_array('sqlite', PDO::getAvailableDrivers())) { + $this->markTestSkipped('Test only with pdo_sqlite'); + } + $db = Zend_Db::factory('Pdo_Sqlite', array('dbname' => ':memory:')); + Zend_Db_Table::setDefaultAdapter($db); + $this->_createTable(); + } + + protected function _createTable() + { + $sql = "CREATE TABLE subscription (" + . "id varchar(32) NOT NULL DEFAULT '', " + . "topic_url varchar(255) DEFAULT NULL, " + . "hub_url varchar(255) DEFAULT NULL, " + . "created_time datetime DEFAULT NULL, " + . "lease_seconds bigint(20) DEFAULT NULL, " + . "verify_token varchar(255) DEFAULT NULL, " + . "secret varchar(255) DEFAULT NULL, " + . "expiration_time datetime DEFAULT NULL, " + . "subscription_state varchar(12) DEFAULT NULL, " + . "PRIMARY KEY (id) " + . ");"; + + Zend_Db_Table::getDefaultAdapter()->getConnection()->query($sql); + } +} \ No newline at end of file From ce88f151d59ae31b26bb038c22f3b76d7fbba4a2 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 1 Jul 2010 07:47:00 -0400 Subject: [PATCH 144/238] PluginLoader cleanup - Added Zend\Loader\ShortNameLocater - s/Zend\Loader\PluginLoader\PluginLoaderInterface/Zend\Loader\PrefixPathMapper/ Extends Zend\Loader\ShortNameLocater - s/Zend\Loader\PluginLoader\PluginLoader/Zend\Loader\PluginLoader/ Implements Zend\Loader\PrefixPathMapper - s/Zend\Loader\PluginLoader\Exception/Zend\Loader\PluginLoaderException/ - Updated all classes and tests to reflect the above --- src/Reader/Reader.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Reader/Reader.php b/src/Reader/Reader.php index eaea7a9c..08484f16 100644 --- a/src/Reader/Reader.php +++ b/src/Reader/Reader.php @@ -23,8 +23,11 @@ * @namespace */ namespace Zend\Feed\Reader; -use Zend\HTTP; -use Zend\Loader\PluginLoader; + +use Zend\HTTP, + Zend\Loader\PluginLoader, + Zend\Loader\PluginLoaderException, + Zend\Loader\PrefixPathMapper; /** * @uses \Zend\Feed\Feed @@ -33,7 +36,7 @@ * @uses \Zend\Feed\Reader\Feed\Atom\Atom * @uses \Zend\Feed\Reader\Feed\RSS * @uses \Zend\HTTP\Client -* @uses \Zend\Loader\PluginLoader\PluginLoader +* @uses \Zend\Loader\PluginLoader * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -481,9 +484,9 @@ public static function detectType($feed, $specOnly = false) /** * Set plugin loader for use with Extensions * - * @param Zend_Loader_PluginLoader_Interface $loader + * @param Zend\Loader\PrefixPathMapper $loader */ - public static function setPluginLoader(PluginLoader\PluginLoaderInterface $loader) + public static function setPluginLoader(PrefixPathMapper $loader) { self::$_pluginLoader = $loader; } @@ -491,12 +494,12 @@ public static function setPluginLoader(PluginLoader\PluginLoaderInterface $loade /** * Get plugin loader for use with Extensions * - * @return Zend_Loader_PluginLoader_Interface $loader + * @return Zend\Loader\PrefixPathMapper $loader */ public static function getPluginLoader() { if (!isset(self::$_pluginLoader)) { - self::$_pluginLoader = new PluginLoader\PluginLoader(array( + self::$_pluginLoader = new PluginLoader(array( 'Zend\\Feed\\Reader\\Extension\\' => 'Zend/Feed/Reader/Extension/', )); } @@ -555,12 +558,12 @@ public static function registerExtension($name) try { self::getPluginLoader()->load($feedName); self::$_extensions['feed'][] = $feedName; - } catch (PluginLoader\Exception $e) { + } catch (PluginLoaderException $e) { } try { self::getPluginLoader()->load($entryName); self::$_extensions['entry'][] = $entryName; - } catch (PluginLoader\Exception $e) { + } catch (PluginLoaderException $e) { } if (!self::getPluginLoader()->isLoaded($feedName) && !self::getPluginLoader()->isLoaded($entryName) From d2346582188fc47521c4d0bb67ae481e750e6735 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 6 Jul 2010 16:11:44 -0400 Subject: [PATCH 145/238] Zend\Feed cleanup - Renamed all interfaces - Most abstracts were named "ComponentAbstract", instead of "AbstractComponent"; updated all of these - Updated code and tests to reflect the above --- src/Reader/{EntryAbstract.php => AbstractEntry.php} | 8 ++++---- src/Reader/{FeedAbstract.php => AbstractFeed.php} | 8 ++++---- ...CollectionAbstract.php => AbstractCollection.php} | 2 +- src/Reader/Collection/Author.php | 5 ++--- src/Reader/Collection/Category.php | 5 ++--- src/Reader/{EntryInterface.php => Entry.php} | 2 +- src/Reader/Entry/Atom.php | 7 +++---- src/Reader/Entry/RSS.php | 8 +++----- .../{EntryAbstract.php => AbstractEntry.php} | 6 +++--- .../Extension/{FeedAbstract.php => AbstractFeed.php} | 6 +++--- src/Reader/Extension/Atom/Entry.php | 5 ++--- src/Reader/Extension/Atom/Feed.php | 5 ++--- src/Reader/Extension/Content/Entry.php | 5 ++--- src/Reader/Extension/CreativeCommons/Entry.php | 4 ++-- src/Reader/Extension/CreativeCommons/Feed.php | 5 ++--- src/Reader/Extension/DublinCore/Entry.php | 5 ++--- src/Reader/Extension/DublinCore/Feed.php | 5 ++--- src/Reader/Extension/Podcast/Entry.php | 4 ++-- src/Reader/Extension/Podcast/Feed.php | 4 ++-- src/Reader/Extension/Slash/Entry.php | 5 ++--- src/Reader/Extension/Syndication/Feed.php | 5 ++--- src/Reader/Extension/Thread/Entry.php | 5 ++--- src/Reader/Extension/WellFormedWeb/Entry.php | 5 ++--- src/Reader/{FeedInterface.php => Feed.php} | 2 +- src/Reader/Feed/Atom/Atom.php | 4 ++-- src/Reader/Feed/Atom/Source.php | 2 +- src/Reader/Feed/RSS.php | 4 ++-- src/Reader/Reader.php | 12 ++++++------ .../Reader/_files/My/Extension/JungleBooks/Entry.php | 2 +- test/Reader/_files/My/Extension/JungleBooks/Feed.php | 2 +- 30 files changed, 66 insertions(+), 81 deletions(-) rename src/Reader/{EntryAbstract.php => AbstractEntry.php} (96%) rename src/Reader/{FeedAbstract.php => AbstractFeed.php} (96%) rename src/Reader/Collection/{CollectionAbstract.php => AbstractCollection.php} (96%) rename src/Reader/{EntryInterface.php => Entry.php} (99%) rename src/Reader/Extension/{EntryAbstract.php => AbstractEntry.php} (96%) rename src/Reader/Extension/{FeedAbstract.php => AbstractFeed.php} (95%) rename src/Reader/{FeedInterface.php => Feed.php} (97%) diff --git a/src/Reader/EntryAbstract.php b/src/Reader/AbstractEntry.php similarity index 96% rename from src/Reader/EntryAbstract.php rename to src/Reader/AbstractEntry.php index a6f66c13..efbec614 100644 --- a/src/Reader/EntryAbstract.php +++ b/src/Reader/AbstractEntry.php @@ -32,7 +32,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class EntryAbstract +abstract class AbstractEntry { /** * Feed entry data @@ -51,7 +51,7 @@ abstract class EntryAbstract /** * Entry instance * - * @var Zend_Feed_Entry_Interface + * @var Zend\Feed\Entry */ protected $_entry = null; @@ -171,7 +171,7 @@ public function getXpath() * Set the XPath query * * @param DOMXPath $xpath - * @return Zend_Feed_Reader_Entry_EntryAbstract + * @return Zend\Feed\Reader\AbstractEntry */ public function setXpath(\DOMXPath $xpath) { @@ -193,7 +193,7 @@ public function getExtensions() * Return an Extension object with the matching name (postfixed with _Entry) * * @param string $name - * @return \Zend\Feed\Reader\Extension\EntryAbstract + * @return \Zend\Feed\Reader\Extension\AbstractEntry */ public function getExtension($name) { diff --git a/src/Reader/FeedAbstract.php b/src/Reader/AbstractFeed.php similarity index 96% rename from src/Reader/FeedAbstract.php rename to src/Reader/AbstractFeed.php index 48791cf5..1c0873ce 100644 --- a/src/Reader/FeedAbstract.php +++ b/src/Reader/AbstractFeed.php @@ -27,13 +27,13 @@ /** * @uses \Zend\Feed\Exception * @uses \Zend\Feed\Reader\Reader - * @uses Zend_feed_Reader_FeedInterface + * @uses Zend\Feed\Reader\Feed * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class FeedAbstract implements FeedInterface +abstract class AbstractFeed implements Feed { /** * Parsed feed data @@ -112,7 +112,7 @@ public function count() /** * Return the current entry * - * @return \Zend\Feed\Reader\EntryInterface + * @return \Zend\Feed\Reader\Entry */ public function current() { @@ -249,7 +249,7 @@ public function __call($method, $args) * Return an Extension object with the matching name (postfixed with _Feed) * * @param string $name - * @return \Zend\Feed\Reader\Extension\FeedAbstract + * @return \Zend\Feed\Reader\Extension\AbstractFeed */ public function getExtension($name) { diff --git a/src/Reader/Collection/CollectionAbstract.php b/src/Reader/Collection/AbstractCollection.php similarity index 96% rename from src/Reader/Collection/CollectionAbstract.php rename to src/Reader/Collection/AbstractCollection.php index dcb5bad4..0d95aa27 100644 --- a/src/Reader/Collection/CollectionAbstract.php +++ b/src/Reader/Collection/AbstractCollection.php @@ -31,7 +31,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class CollectionAbstract extends \ArrayObject +abstract class AbstractCollection extends \ArrayObject { /** diff --git a/src/Reader/Collection/Author.php b/src/Reader/Collection/Author.php index 38b5d861..6362a25a 100644 --- a/src/Reader/Collection/Author.php +++ b/src/Reader/Collection/Author.php @@ -25,14 +25,13 @@ namespace Zend\Feed\Reader\Collection; /** - * @uses \Zend\Feed\Reader\Collection\CollectionAbstract + * @uses \Zend\Feed\Reader\Collection\AbstractCollection * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Author - extends CollectionAbstract +class Author extends AbstractCollection { /** diff --git a/src/Reader/Collection/Category.php b/src/Reader/Collection/Category.php index ebd76ab9..06a870f9 100644 --- a/src/Reader/Collection/Category.php +++ b/src/Reader/Collection/Category.php @@ -25,14 +25,13 @@ namespace Zend\Feed\Reader\Collection; /** - * @uses \Zend\Feed\Reader\Collection\CollectionAbstract + * @uses \Zend\Feed\Reader\Collection\AbstractCollection * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Category - extends CollectionAbstract +class Category extends AbstractCollection { /** diff --git a/src/Reader/EntryInterface.php b/src/Reader/Entry.php similarity index 99% rename from src/Reader/EntryInterface.php rename to src/Reader/Entry.php index 5d72bcdd..f93d56ff 100644 --- a/src/Reader/EntryInterface.php +++ b/src/Reader/Entry.php @@ -30,7 +30,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface EntryInterface +interface Entry { /** * Get the specified author diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index 36af8378..671957b1 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -27,16 +27,15 @@ /** * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\EntryAbstract - * @uses \Zend\Feed\Reader\EntryInterface + * @uses \Zend\Feed\Reader\AbstractEntry + * @uses \Zend\Feed\Reader\Entry * @uses \Zend\Feed\Reader\Extension\Atom\Entry * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Atom - extends Reader\EntryAbstract +class Atom extends Reader\AbstractEntry { /** * XPath query diff --git a/src/Reader/Entry/RSS.php b/src/Reader/Entry/RSS.php index 27e5e190..764d3f76 100644 --- a/src/Reader/Entry/RSS.php +++ b/src/Reader/Entry/RSS.php @@ -31,8 +31,8 @@ * @uses \Zend\Feed\Exception * @uses \Zend\Feed\Reader\Reader * @uses \Zend\Feed\Reader\Collection\Category - * @uses \Zend\Feed\Reader\EntryAbstract - * @uses \Zend\Feed\Reader\EntryInterface + * @uses \Zend\Feed\Reader\AbstractEntry + * @uses \Zend\Feed\Reader\Entry * @uses \Zend\Feed\Reader\Extension\Atom\Entry * @uses \Zend\Feed\Reader\Extension\Content\Entry * @uses \Zend\Feed\Reader\Extension\DublinCore\Entry @@ -44,9 +44,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class RSS - extends Reader\EntryAbstract - implements Reader\EntryInterface +class RSS extends Reader\AbstractEntry implements Reader\Entry { /** * XPath query for RDF diff --git a/src/Reader/Extension/EntryAbstract.php b/src/Reader/Extension/AbstractEntry.php similarity index 96% rename from src/Reader/Extension/EntryAbstract.php rename to src/Reader/Extension/AbstractEntry.php index 775ed8f9..d79d57f7 100644 --- a/src/Reader/Extension/EntryAbstract.php +++ b/src/Reader/Extension/AbstractEntry.php @@ -32,7 +32,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class EntryAbstract +abstract class AbstractEntry { /** * Feed entry data @@ -144,7 +144,7 @@ public function getType() * Set the XPath query * * @param DOMXPath $xpath - * @return \Zend\Feed\Reader\Extension\EntryAbstract + * @return \Zend\Feed\Reader\Extension\AbstractEntry */ public function setXpath(\DOMXPath $xpath) { @@ -190,7 +190,7 @@ public function getXpathPrefix() * Set the XPath prefix * * @param string $prefix - * @return \Zend\Feed\Reader\Extension\EntryAbstract + * @return \Zend\Feed\Reader\Extension\AbstractEntry */ public function setXpathPrefix($prefix) { diff --git a/src/Reader/Extension/FeedAbstract.php b/src/Reader/Extension/AbstractFeed.php similarity index 95% rename from src/Reader/Extension/FeedAbstract.php rename to src/Reader/Extension/AbstractFeed.php index 0472b39b..dd2bc963 100644 --- a/src/Reader/Extension/FeedAbstract.php +++ b/src/Reader/Extension/AbstractFeed.php @@ -34,7 +34,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class FeedAbstract +abstract class AbstractFeed { /** * Parsed feed data @@ -67,7 +67,7 @@ abstract class FeedAbstract /** * Constructor * - * @param \Zend\Feed\Feed_Abstract $feed The source \Zend\Feed\Feed object + * @param \Zend\Feed\Reader\AbstractFeed $feed The source \Zend\Feed\Feed object * @param string $type Feed type * @return void */ @@ -136,7 +136,7 @@ public function toArray() // untested * Set the XPath query * * @param DOMXPath $xpath - * @return \Zend\Feed\Reader\Extension\EntryAbstract + * @return \Zend\Feed\Reader\Extension\AbstractEntry */ public function setXpath(\DOMXPath $xpath) { diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 4a9a11b0..f139bd42 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -36,15 +36,14 @@ * @uses \Zend\Feed\Reader\Feed\Atom\Source * @uses \Zend\Feed\Reader\Collection\Author * @uses \Zend\Feed\Reader\Collection\Category - * @uses \Zend\Feed\Reader\Extension\EntryAbstract + * @uses \Zend\Feed\Reader\Extension\AbstractEntry * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends Reader\Extension\EntryAbstract +class Entry extends Reader\Extension\AbstractEntry { /** * Get the specified author diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index 4912190d..82445447 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -33,15 +33,14 @@ * @uses \Zend\Feed\Reader\Reader * @uses \Zend\Feed\Reader\Collection\Author * @uses \Zend\Feed\Reader\Collection\Category - * @uses \Zend\Feed\Reader\Extension\FeedAbstract + * @uses \Zend\Feed\Reader\Extension\AbstractFeed * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed - extends Reader\Extension\FeedAbstract +class Feed extends Reader\Extension\AbstractFeed { /** * Get a single author diff --git a/src/Reader/Extension/Content/Entry.php b/src/Reader/Extension/Content/Entry.php index 8b0ddd64..b5a0c6cd 100644 --- a/src/Reader/Extension/Content/Entry.php +++ b/src/Reader/Extension/Content/Entry.php @@ -27,14 +27,13 @@ /** * @uses \Zend\Feed\Reader\Reader - * @uses Zend_Feed_Reader_Entry_EntryAbstract + * @uses Zend\Feed\Reader\Entry\AbstractEntry * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends Reader\Extension\EntryAbstract +class Entry extends Reader\Extension\AbstractEntry { public function getContent() diff --git a/src/Reader/Extension/CreativeCommons/Entry.php b/src/Reader/Extension/CreativeCommons/Entry.php index 8f45fa15..b319c4c0 100644 --- a/src/Reader/Extension/CreativeCommons/Entry.php +++ b/src/Reader/Extension/CreativeCommons/Entry.php @@ -26,13 +26,13 @@ /** * @uses \Zend\Feed\Reader\Extension\CreativeCommons\Feed - * @uses \Zend\Feed\Reader\Extension\EntryAbstract + * @uses \Zend\Feed\Reader\Extension\AbstractEntry * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry extends \Zend\Feed\Reader\Extension\EntryAbstract +class Entry extends \Zend\Feed\Reader\Extension\AbstractEntry { /** * Get the entry license diff --git a/src/Reader/Extension/CreativeCommons/Feed.php b/src/Reader/Extension/CreativeCommons/Feed.php index 3ded5019..621f3864 100644 --- a/src/Reader/Extension/CreativeCommons/Feed.php +++ b/src/Reader/Extension/CreativeCommons/Feed.php @@ -25,14 +25,13 @@ namespace Zend\Feed\Reader\Extension\CreativeCommons; /** - * @uses \Zend\Feed\Reader\Extension\FeedAbstract + * @uses \Zend\Feed\Reader\Extension\AbstractFeed * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed - extends \Zend\Feed\Reader\Extension\FeedAbstract +class Feed extends \Zend\Feed\Reader\Extension\AbstractFeed { /** * Get the entry license diff --git a/src/Reader/Extension/DublinCore/Entry.php b/src/Reader/Extension/DublinCore/Entry.php index f42e2eb6..fb5884f5 100644 --- a/src/Reader/Extension/DublinCore/Entry.php +++ b/src/Reader/Extension/DublinCore/Entry.php @@ -31,14 +31,13 @@ * @uses \Zend\Feed\Reader\Reader * @uses \Zend\Feed\Reader\Collection\Author * @uses \Zend\Feed\Reader\Collection\Category - * @uses \Zend\Feed\Reader\Extension\EntryAbstract + * @uses \Zend\Feed\Reader\Extension\AbstractEntry * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Reader\Extension\EntryAbstract +class Entry extends \Zend\Feed\Reader\Extension\AbstractEntry { /** * Get an author entry diff --git a/src/Reader/Extension/DublinCore/Feed.php b/src/Reader/Extension/DublinCore/Feed.php index 958faee9..5f2f82d4 100644 --- a/src/Reader/Extension/DublinCore/Feed.php +++ b/src/Reader/Extension/DublinCore/Feed.php @@ -31,14 +31,13 @@ * @uses \Zend\Feed\Reader\Reader * @uses \Zend\Feed\Reader\Collection\Author * @uses \Zend\Feed\Reader\Collection\Category - * @uses \Zend\Feed\Reader\Extension\FeedAbstract + * @uses \Zend\Feed\Reader\Extension\AbstractFeed * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed - extends \Zend\Feed\Reader\Extension\FeedAbstract +class Feed extends \Zend\Feed\Reader\Extension\AbstractFeed { /** * Get a single author diff --git a/src/Reader/Extension/Podcast/Entry.php b/src/Reader/Extension/Podcast/Entry.php index 22ef4897..dc90369c 100644 --- a/src/Reader/Extension/Podcast/Entry.php +++ b/src/Reader/Extension/Podcast/Entry.php @@ -26,13 +26,13 @@ /** * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Extension\EntryAbstract + * @uses \Zend\Feed\Reader\Extension\AbstractEntry * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry extends \Zend\Feed\Reader\Extension\EntryAbstract +class Entry extends \Zend\Feed\Reader\Extension\AbstractEntry { /** * Get the entry author diff --git a/src/Reader/Extension/Podcast/Feed.php b/src/Reader/Extension/Podcast/Feed.php index 96a712be..78ee3ce2 100644 --- a/src/Reader/Extension/Podcast/Feed.php +++ b/src/Reader/Extension/Podcast/Feed.php @@ -25,13 +25,13 @@ namespace Zend\Feed\Reader\Extension\Podcast; /** - * @uses \Zend\Feed\Reader\Extension\FeedAbstract + * @uses \Zend\Feed\Reader\Extension\AbstractFeed * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed extends \Zend\Feed\Reader\Extension\FeedAbstract +class Feed extends \Zend\Feed\Reader\Extension\AbstractFeed { /** * Get the entry author diff --git a/src/Reader/Extension/Slash/Entry.php b/src/Reader/Extension/Slash/Entry.php index 717bab23..6ec94d21 100644 --- a/src/Reader/Extension/Slash/Entry.php +++ b/src/Reader/Extension/Slash/Entry.php @@ -26,14 +26,13 @@ /** * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Extension\EntryAbstract + * @uses \Zend\Feed\Reader\Extension\AbstractEntry * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Reader\Extension\EntryAbstract +class Entry extends \Zend\Feed\Reader\Extension\AbstractEntry { /** * Get the entry section diff --git a/src/Reader/Extension/Syndication/Feed.php b/src/Reader/Extension/Syndication/Feed.php index ec43e24d..fb1b043c 100644 --- a/src/Reader/Extension/Syndication/Feed.php +++ b/src/Reader/Extension/Syndication/Feed.php @@ -27,14 +27,13 @@ /** * @uses \Zend\Date\Date - * @uses \Zend\Feed\Reader\Extension\FeedAbstract + * @uses \Zend\Feed\Reader\Extension\AbstractFeed * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed - extends \Zend\Feed\Reader\Extension\FeedAbstract +class Feed extends \Zend\Feed\Reader\Extension\AbstractFeed { /** * Get update period diff --git a/src/Reader/Extension/Thread/Entry.php b/src/Reader/Extension/Thread/Entry.php index 89f3a65d..66d18421 100644 --- a/src/Reader/Extension/Thread/Entry.php +++ b/src/Reader/Extension/Thread/Entry.php @@ -25,14 +25,13 @@ namespace Zend\Feed\Reader\Extension\Thread; /** - * @uses \Zend\Feed\Reader\Extension\EntryAbstract + * @uses \Zend\Feed\Reader\Extension\AbstractEntry * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Reader\Extension\EntryAbstract +class Entry extends \Zend\Feed\Reader\Extension\AbstractEntry { /** * Get the "in-reply-to" value diff --git a/src/Reader/Extension/WellFormedWeb/Entry.php b/src/Reader/Extension/WellFormedWeb/Entry.php index fbae9638..777eb3c4 100644 --- a/src/Reader/Extension/WellFormedWeb/Entry.php +++ b/src/Reader/Extension/WellFormedWeb/Entry.php @@ -26,14 +26,13 @@ /** * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Extension\EntryAbstract + * @uses \Zend\Feed\Reader\Extension\AbstractEntry * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Reader\Extension\EntryAbstract +class Entry extends \Zend\Feed\Reader\Extension\AbstractEntry { /** * Get the entry comment Uri diff --git a/src/Reader/FeedInterface.php b/src/Reader/Feed.php similarity index 97% rename from src/Reader/FeedInterface.php rename to src/Reader/Feed.php index e8f299a5..c513f86d 100644 --- a/src/Reader/FeedInterface.php +++ b/src/Reader/Feed.php @@ -32,7 +32,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface FeedInterface extends \Iterator, \Countable +interface Feed extends \Iterator, \Countable { /** * Get a single author diff --git a/src/Reader/Feed/Atom/Atom.php b/src/Reader/Feed/Atom/Atom.php index fbad6038..e1e3306b 100644 --- a/src/Reader/Feed/Atom/Atom.php +++ b/src/Reader/Feed/Atom/Atom.php @@ -28,13 +28,13 @@ /** * @uses \Zend\Feed\Reader\Reader * @uses \Zend\Feed\Reader\Extension\Atom\Feed - * @uses \Zend\Feed\Reader\FeedAbstract + * @uses \Zend\Feed\Reader\AbstractFeed * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Atom extends Reader\FeedAbstract +class Atom extends Reader\AbstractFeed { /** diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php index 5a33d9dc..5f3426b6 100644 --- a/src/Reader/Feed/Atom/Source.php +++ b/src/Reader/Feed/Atom/Source.php @@ -38,7 +38,7 @@ class Source extends Atom /** * Constructor: Create a Source object which is largely just a normal - * Zend_Feed_Reader_FeedAbstract object only designed to retrieve feed level + * Zend\Feed\Reader\AbstractFeed object only designed to retrieve feed level * metadata from an Atom entry's source element. * * @param DOMElement $source diff --git a/src/Reader/Feed/RSS.php b/src/Reader/Feed/RSS.php index fd48753e..6d0c13d7 100644 --- a/src/Reader/Feed/RSS.php +++ b/src/Reader/Feed/RSS.php @@ -33,13 +33,13 @@ * @uses \Zend\Feed\Reader\Collection\Author * @uses \Zend\Feed\Reader\Extension\Atom\Feed * @uses \Zend\Feed\Reader\Extension\DublinCore\Feed - * @uses \Zend\Feed\Reader\FeedAbstract + * @uses \Zend\Feed\Reader\AbstractFeed * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class RSS extends Reader\FeedAbstract +class RSS extends Reader\AbstractFeed { /** diff --git a/src/Reader/Reader.php b/src/Reader/Reader.php index 3b3ec343..341ba540 100644 --- a/src/Reader/Reader.php +++ b/src/Reader/Reader.php @@ -212,7 +212,7 @@ public static function useHttpConditionalGet($bool = true) * @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\FeedInterface + * @return \Zend\Feed\Reader\Feed */ public static function import($uri, $etag = null, $lastModified = null) { @@ -284,7 +284,7 @@ public static function import($uri, $etag = null, $lastModified = null) * Import a feed by providing a Zend_Feed_Abstract object * * @param \Zend\Feed\Feed_Abstract $feed A fully instantiated \Zend\Feed\Feed object - * @return \Zend\Feed\Reader\FeedInterface + * @return \Zend\Feed\Reader\Feed */ public static function importFeed(Feed\AbstractFeed $feed) { @@ -304,7 +304,7 @@ public static function importFeed(Feed\AbstractFeed $feed) * Import a feed froma string * * @param string $string - * @return \Zend\Feed\Reader\FeedInterface + * @return \Zend\Feed\Reader\Feed */ public static function importString($string) { @@ -347,7 +347,7 @@ public static function importString($string) * * @param string $filename * @throws \Zend\Feed\Exception - * @return \Zend\Feed\Reader\FeedInterface + * @return \Zend\Feed\Reader\Feed */ public static function importFile($filename) { @@ -399,7 +399,7 @@ public static function findFeedLinks($uri) */ public static function detectType($feed, $specOnly = false) { - if ($feed instanceof FeedInterface) { + if ($feed instanceof Feed) { $dom = $feed->getDomDocument(); } elseif($feed instanceof \DOMDocument) { $dom = $feed; @@ -420,7 +420,7 @@ public static function detectType($feed, $specOnly = false) } } else { throw new \Zend\Feed\Exception('Invalid object/scalar provided: must' - . ' be of type Zend_Feed_Reader_FeedInterface, DomDocument or string'); + . ' be of type Zend\Feed\Reader\Feed, DomDocument or string'); } $xpath = new \DOMXPath($dom); diff --git a/test/Reader/_files/My/Extension/JungleBooks/Entry.php b/test/Reader/_files/My/Extension/JungleBooks/Entry.php index f9c22d6a..ae707852 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Entry.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Entry.php @@ -32,7 +32,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry extends \Zend\Feed\Reader\Extension\EntryAbstract +class Entry extends \Zend\Feed\Reader\Extension\AbstractEntry { public function getIsbn() diff --git a/test/Reader/_files/My/Extension/JungleBooks/Feed.php b/test/Reader/_files/My/Extension/JungleBooks/Feed.php index 960f42b0..6f70c62f 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Feed.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Feed.php @@ -32,7 +32,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed extends \Zend\Feed\Reader\Extension\FeedAbstract +class Feed extends \Zend\Feed\Reader\Extension\AbstractFeed { public function getDaysPopularBookLink() From 15055ff1b92a9bd1b509cbd0ac8f47eb725ac9dc Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 6 Jul 2010 16:34:35 -0400 Subject: [PATCH 146/238] Zend\Feed\PubSubHubbub cleanup - Renamed interfaces to remove "Interface" suffix - Renamed "ComponentAbstract" to "AbstractComponent" throughout - Fixed areas where names were artificially pushed down a level in the hierarchy --- ...lbackAbstract.php => AbstractCallback.php} | 55 +++++------ .../{CallbackInterface.php => Callback.php} | 6 +- .../{ModelAbstract.php => AbstractModel.php} | 2 +- src/PubSubHubbub/Model/Subscription.php | 8 +- ...erface.php => SubscriptionPersistence.php} | 2 +- src/PubSubHubbub/PubSubHubbub.php | 5 +- .../{Subscriber => }/Subscriber.php | 98 +++++++++---------- src/PubSubHubbub/Subscriber/Callback.php | 5 +- test/PubSubHubbub/Subscriber/CallbackTest.php | 2 +- test/PubSubHubbub/SubscriberTest.php | 2 +- 10 files changed, 90 insertions(+), 95 deletions(-) rename src/PubSubHubbub/{CallbackAbstract.php => AbstractCallback.php} (82%) rename src/PubSubHubbub/{CallbackInterface.php => Callback.php} (94%) rename src/PubSubHubbub/Model/{ModelAbstract.php => AbstractModel.php} (98%) rename src/PubSubHubbub/Model/{SubscriptionInterface.php => SubscriptionPersistence.php} (98%) rename src/PubSubHubbub/{Subscriber => }/Subscriber.php (87%) diff --git a/src/PubSubHubbub/CallbackAbstract.php b/src/PubSubHubbub/AbstractCallback.php similarity index 82% rename from src/PubSubHubbub/CallbackAbstract.php rename to src/PubSubHubbub/AbstractCallback.php index 9a8d2764..81b05f91 100644 --- a/src/PubSubHubbub/CallbackAbstract.php +++ b/src/PubSubHubbub/AbstractCallback.php @@ -26,7 +26,7 @@ namespace Zend\Feed\PubSubHubbub; /** - * @uses \Zend\Feed\PubSubHubbub\CallbackInterface + * @uses \Zend\Feed\PubSubHubbub\Callback * @uses \Zend\Feed\PubSubHubbub\Exception * @uses \Zend\Feed\PubSubHubbub\HttpResponse * @category Zend @@ -35,24 +35,23 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class CallbackAbstract - implements CallbackInterface +abstract class AbstractCallback implements Callback { /** - * An instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used + * An instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionPersistence used * to background save any verification tokens associated with a subscription * or other. * - * @var \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface + * @var \Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence */ protected $_storage = null; /** * An instance of a class handling Http Responses. This is implemented in - * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with - * (i.e. not inherited from) Zend_Controller_Response_Http. + * Zend\Feed\Pubsubhubbub\HttpResponse which shares an unenforced interface with + * (i.e. not inherited from) Zend\Controller\Response\HTTP. * - * @var Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http + * @var Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\HTTP */ protected $_httpResponse = null; @@ -64,7 +63,7 @@ abstract class CallbackAbstract protected $_subscriberCount = 1; /** - * Constructor; accepts an array or Zend_Config instance to preset + * Constructor; accepts an array or Zend\Config instance to preset * options for the Subscriber without calling all supported setter * methods in turn. * @@ -81,7 +80,7 @@ public function __construct($config = null) * Process any injected configuration options * * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance - * @return \Zend\Feed\PubSubHubbub\CallbackAbstract + * @return \Zend\Feed\PubSubHubbub\AbstractCallback */ public function setConfig($config) { @@ -111,52 +110,52 @@ public function sendResponse() } /** - * Sets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used + * Sets an instance of Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence used * to background save any verification tokens associated with a subscription * or other. * - * @param \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface $storage - * @return \Zend\Feed\PubSubHubbub\CallbackAbstract + * @param \Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence $storage + * @return \Zend\Feed\PubSubHubbub\AbstractCallback */ - public function setStorage(Model\SubscriptionInterface $storage) + public function setStorage(Model\SubscriptionPersistence $storage) { $this->_storage = $storage; return $this; } /** - * Gets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used + * Gets an instance of Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence used * to background save any verification tokens associated with a subscription * or other. * - * @return \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface + * @return \Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence */ public function getStorage() { if ($this->_storage === null) { throw new Exception('No storage object has been' - . ' set that subclasses Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface'); + . ' set that subclasses Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence'); } return $this->_storage; } /** * An instance of a class handling Http Responses. This is implemented in - * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with - * (i.e. not inherited from) Zend_Controller_Response_Http. + * Zend\Feed\Pubsubhubbub\HttpResponse which shares an unenforced interface with + * (i.e. not inherited from) Zend\Controller\Response\HTTP. * - * @param Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http $httpResponse - * @return \Zend\Feed\PubSubHubbub\CallbackAbstract + * @param Zend\Feed\Pubsubhubbub\HttpResponse|\Zend\Controller\Response\HTTP $httpResponse + * @return \Zend\Feed\PubSubHubbub\AbstractCallback */ public function setHttpResponse($httpResponse) { if (!is_object($httpResponse) || (!$httpResponse instanceof HttpResponse - && !$httpResponse instanceof \Zend\Controller\Response\Http) + && !$httpResponse instanceof \Zend\Controller\Response\HTTP) ) { throw new Exception('HTTP Response object must' - . ' implement one of Zend_Feed_Pubsubhubbub_HttpResponse or' - . ' Zend_Controller_Response_Http'); + . ' implement one of Zend\Feed\Pubsubhubbub\HttpResponse or' + . ' Zend\Controller\Response\HTTP'); } $this->_httpResponse = $httpResponse; return $this; @@ -164,10 +163,10 @@ public function setHttpResponse($httpResponse) /** * An instance of a class handling Http Responses. This is implemented in - * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with - * (i.e. not inherited from) Zend_Controller_Response_Http. + * Zend\Feed\Pubsubhubbub\HttpResponse which shares an unenforced interface with + * (i.e. not inherited from) Zend\Controller\Response\HTTP. * - * @return Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http + * @return Zend\Feed\Pubsubhubbub\HttpResponse|\Zend\Controller\Response\HTTP */ public function getHttpResponse() { @@ -183,7 +182,7 @@ public function getHttpResponse() * Defaults to 1 if left unchanged. * * @param string|int $count - * @return \Zend\Feed\PubSubHubbub\CallbackAbstract + * @return \Zend\Feed\PubSubHubbub\AbstractCallback */ public function setSubscriberCount($count) { diff --git a/src/PubSubHubbub/CallbackInterface.php b/src/PubSubHubbub/Callback.php similarity index 94% rename from src/PubSubHubbub/CallbackInterface.php rename to src/PubSubHubbub/Callback.php index 51d82a96..d1402ec1 100644 --- a/src/PubSubHubbub/CallbackInterface.php +++ b/src/PubSubHubbub/Callback.php @@ -32,7 +32,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface CallbackInterface +interface Callback { /** * Handle any callback from a Hub Server responding to a subscription or @@ -59,7 +59,7 @@ public function sendResponse(); * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with * (i.e. not inherited from) Zend_Controller_Response_Http. * - * @param Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http $httpResponse + * @param Zend\Feed\PubSubHubbub\HttpResponse|\Zend\Controller\Response\Http $httpResponse */ public function setHttpResponse($httpResponse); @@ -68,7 +68,7 @@ public function setHttpResponse($httpResponse); * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with * (i.e. not inherited from) Zend_Controller_Response_Http. * - * @return Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http + * @return Zend\Feed\PubSubHubbub\HttpResponse|\Zend\Controller\Response\Http */ public function getHttpResponse(); } diff --git a/src/PubSubHubbub/Model/ModelAbstract.php b/src/PubSubHubbub/Model/AbstractModel.php similarity index 98% rename from src/PubSubHubbub/Model/ModelAbstract.php rename to src/PubSubHubbub/Model/AbstractModel.php index a9c897f1..00ec2e2d 100644 --- a/src/PubSubHubbub/Model/ModelAbstract.php +++ b/src/PubSubHubbub/Model/AbstractModel.php @@ -32,7 +32,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class ModelAbstract +class AbstractModel { /** * Zend_Db_Table instance to host database methods diff --git a/src/PubSubHubbub/Model/Subscription.php b/src/PubSubHubbub/Model/Subscription.php index cc049378..3abb3e47 100644 --- a/src/PubSubHubbub/Model/Subscription.php +++ b/src/PubSubHubbub/Model/Subscription.php @@ -30,17 +30,15 @@ /** * @uses \Zend\Date\Date * @uses \Zend\Feed\PubSubHubbub\Exception - * @uses \Zend\Feed\PubSubHubbub\Model\ModelAbstract - * @uses \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface + * @uses \Zend\Feed\PubSubHubbub\Model\AbstractModel + * @uses \Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence * @category Zend * @package Zend_Feed_Pubsubhubbub * @subpackage Entity * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Subscription - extends ModelAbstract - implements SubscriptionInterface +class Subscription extends AbstractModel implements SubscriptionPersistence { /** diff --git a/src/PubSubHubbub/Model/SubscriptionInterface.php b/src/PubSubHubbub/Model/SubscriptionPersistence.php similarity index 98% rename from src/PubSubHubbub/Model/SubscriptionInterface.php rename to src/PubSubHubbub/Model/SubscriptionPersistence.php index bf318407..4d450c0f 100644 --- a/src/PubSubHubbub/Model/SubscriptionInterface.php +++ b/src/PubSubHubbub/Model/SubscriptionPersistence.php @@ -32,7 +32,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface SubscriptionInterface +interface SubscriptionPersistence { /** diff --git a/src/PubSubHubbub/PubSubHubbub.php b/src/PubSubHubbub/PubSubHubbub.php index 947c6a75..4eb678c6 100644 --- a/src/PubSubHubbub/PubSubHubbub.php +++ b/src/PubSubHubbub/PubSubHubbub.php @@ -73,15 +73,14 @@ public static function detectHubs($source) { if (is_string($source)) { $feed = Reader\Reader::import($source); - } elseif (is_object($source) && $source instanceof Reader\FeedAbstract) { + } elseif (is_object($source) && $source instanceof Reader\AbstractFeed) { $feed = $source; } elseif (is_object($source) && $source instanceof \Zend\Feed\AbstractFeed) { $feed = Reader\Reader::importFeed($source); } else { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Exception('The source parameter was' . ' invalid, i.e. not a URL string or an instance of type' - . ' Zend_Feed_Reader_FeedAbstract or Zend_Feed_Abstract'); + . ' Zend\Feed\Reader\FeedAbstract or Zend\Feed\Abstract'); } return $feed->getHubs(); } diff --git a/src/PubSubHubbub/Subscriber/Subscriber.php b/src/PubSubHubbub/Subscriber.php similarity index 87% rename from src/PubSubHubbub/Subscriber/Subscriber.php rename to src/PubSubHubbub/Subscriber.php index 05410ff1..ebcdd127 100644 --- a/src/PubSubHubbub/Subscriber/Subscriber.php +++ b/src/PubSubHubbub/Subscriber.php @@ -22,8 +22,8 @@ /** * @namespace */ -namespace Zend\Feed\PubSubHubbub\Subscriber; -use Zend\Feed\PubSubHubbub; +namespace Zend\Feed\PubSubHubbub; + use Zend\URI; use Zend\Date; @@ -86,17 +86,17 @@ class Subscriber * Subscriber prefers synchronous verification, but is considered * desireable to support asynchronous verification if possible. * - * Zend_Feed_Pubsubhubbub_Subscriber will always send both modes, whose + * Zend\Feed\Pubsubhubbub\Subscriber will always send both modes, whose * order of occurance in the parameter list determines this preference. * * @var string */ protected $_preferredVerificationMode - = PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_SYNC; + = PubSubHubbub::VERIFICATION_MODE_SYNC; /** * An array of any errors including keys for 'response', 'hubUrl'. - * The response is the actual Zend_Http_Response object. + * The response is the actual Zend\Http\Response object. * * @var array */ @@ -111,10 +111,10 @@ class Subscriber protected $_asyncHubs = array(); /** - * An instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used to background + * An instance of Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence used to background * save any verification tokens associated with a subscription or other. * - * @var \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface + * @var \Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence */ protected $_storage = null; @@ -135,9 +135,9 @@ class Subscriber * * This is required for all Hubs using the Pubsubhubbub 0.1 Specification. * It should be manually intercepted and passed to the Callback class using - * Zend_Feed_Pubsubhubbub_Subscriber_Callback::setSubscriptionKey(). Will + * Zend\Feed\Pubsubhubbub\Subscriber\Callback::setSubscriptionKey(). Will * require a route in the form "callback/:subkey" to allow the parameter be - * retrieved from an action using the Zend_Controller_Action::_getParam() + * retrieved from an action using the Zend\Controller\Action::\getParam() * method. * * @var string @@ -145,7 +145,7 @@ class Subscriber protected $_usePathParameter = false; /** - * Constructor; accepts an array or Zend_Config instance to preset + * Constructor; accepts an array or Zend\Config instance to preset * options for the Subscriber without calling all supported setter * methods in turn. * @@ -170,7 +170,7 @@ public function setConfig($config) if ($config instanceof \Zend\Config\Config) { $config = $config->toArray(); } elseif (!is_array($config)) { - throw new PubSubHubbub\Exception('Array or Zend_Config object' + throw new Exception('Array or Zend\Config object' . ' expected, got ' . gettype($config)); } if (array_key_exists('hubUrls', $config)) { @@ -215,7 +215,7 @@ public function setConfig($config) public function setTopicUrl($url) { if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { - throw new PubSubHubbub\Exception('Invalid parameter "url"' + throw new Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .' URL'); } @@ -232,7 +232,7 @@ public function setTopicUrl($url) public function getTopicUrl() { if (empty($this->_topicUrl)) { - throw new PubSubHubbub\Exception('A valid Topic (RSS or Atom' + throw new Exception('A valid Topic (RSS or Atom' . ' feed) URL MUST be set before attempting any operation'); } return $this->_topicUrl; @@ -248,7 +248,7 @@ public function setLeaseSeconds($seconds) { $seconds = intval($seconds); if ($seconds <= 0) { - throw new PubSubHubbub\Exception('Expected lease seconds' + throw new Exception('Expected lease seconds' . ' must be an integer greater than zero'); } $this->_leaseSeconds = $seconds; @@ -275,7 +275,7 @@ public function getLeaseSeconds() public function setCallbackUrl($url) { if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { - throw new PubSubHubbub\Exception('Invalid parameter "url"' + throw new Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); } @@ -292,7 +292,7 @@ public function setCallbackUrl($url) public function getCallbackUrl() { if (empty($this->_callbackUrl)) { - throw new PubSubHubbub\Exception('A valid Callback URL MUST be' + throw new Exception('A valid Callback URL MUST be' . ' set before attempting any operation'); } return $this->_callbackUrl; @@ -303,7 +303,7 @@ public function getCallbackUrl() * Subscriber prefers synchronous verification, but does support * asynchronous if that's the Hub Server's utilised mode. * - * Zend_Feed_Pubsubhubbub_Subscriber will always send both modes, whose + * Zend\Feed\Pubsubhubbub\Subscriber will always send both modes, whose * order of occurance in the parameter list determines this preference. * * @param string $mode Should be 'sync' or 'async' @@ -311,12 +311,12 @@ public function getCallbackUrl() */ public function setPreferredVerificationMode($mode) { - if ($mode !== PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_SYNC - && $mode !== PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_ASYNC) { - throw new PubSubHubbub\Exception('Invalid preferred' + if ($mode !== PubSubHubbub::VERIFICATION_MODE_SYNC + && $mode !== PubSubHubbub::VERIFICATION_MODE_ASYNC) { + throw new Exception('Invalid preferred' . ' mode specified: "' . $mode . '" but should be one of' - . ' Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC or' - . ' Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC'); + . ' Zend\Feed\Pubsubhubbub::VERIFICATION\MODE\SYNC or' + . ' Zend\Feed\Pubsubhubbub::VERIFICATION\MODE\ASYNC'); } $this->_preferredVerificationMode = $mode; return $this; @@ -341,7 +341,7 @@ public function getPreferredVerificationMode() public function addHubUrl($url) { if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { - throw new PubSubHubbub\Exception('Invalid parameter "url"' + throw new Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); } @@ -400,7 +400,7 @@ public function getHubUrls() public function addAuthentication($url, array $authentication) { if (empty($url) || !is_string($url) || !URI\Zend\Uri\Uri::check($url)) { - throw new PubSubHubbub\Exception('Invalid parameter "url"' + throw new Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); } @@ -458,7 +458,7 @@ public function setParameter($name, $value = null) return $this; } if (empty($name) || !is_string($name)) { - throw new PubSubHubbub\Exception('Invalid parameter "name"' + throw new Exception('Invalid parameter "name"' . ' of "' . $name . '" must be a non-empty string'); } if ($value === null) { @@ -466,7 +466,7 @@ public function setParameter($name, $value = null) return $this; } if (empty($value) || (!is_string($value) && !is_null($value))) { - throw new PubSubHubbub\Exception('Invalid parameter "value"' + throw new Exception('Invalid parameter "value"' . ' of "' . $value . '" must be a non-empty string'); } $this->_parameters[$name] = $value; @@ -497,7 +497,7 @@ public function setParameters(array $parameters) public function removeParameter($name) { if (empty($name) || !is_string($name)) { - throw new PubSubHubbub\Exception('Invalid parameter "name"' + throw new Exception('Invalid parameter "name"' . ' of "' . $name . '" must be a non-empty string'); } if (array_key_exists($name, $this->_parameters)) { @@ -517,29 +517,29 @@ public function getParameters() } /** - * Sets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used to background + * Sets an instance of Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence used to background * save any verification tokens associated with a subscription or other. * - * @param \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface $storage + * @param \Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence $storage * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber */ - public function setStorage(PubSubHubbub\Model\SubscriptionInterface $storage) + public function setStorage(Model\SubscriptionPersistence $storage) { $this->_storage = $storage; return $this; } /** - * Gets an instance of Zend_Feed_Pubsubhubbub_Storage_StorageInterface used + * Gets an instance of Zend\Feed\Pubsubhubbub\Storage\StoragePersistence used * to background save any verification tokens associated with a subscription * or other. * - * @return \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface + * @return \Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence */ public function getStorage() { if ($this->_storage === null) { - throw new PubSubHubbub\Exception('No storage vehicle ' + throw new Exception('No storage vehicle ' . 'has been set.'); } return $this->_storage; @@ -583,7 +583,7 @@ public function isSuccess() /** * Return an array of errors met from any failures, including keys: - * 'response' => the Zend_Http_Response object from the failure + * 'response' => the Zend\Http\Response object from the failure * 'hubUrl' => the URL of the Hub Server whose notification failed * * @return array @@ -617,7 +617,7 @@ protected function _doRequest($mode) $client = $this->_getHttpClient(); $hubs = $this->getHubUrls(); if (empty($hubs)) { - throw new PubSubHubbub\Exception('No Hub Server URLs' + throw new Exception('No Hub Server URLs' . ' have been set so no subscriptions can be attempted'); } $this->_errors = array(); @@ -661,7 +661,7 @@ protected function _doRequest($mode) */ protected function _getHttpClient() { - $client = PubSubHubbub\PubSubHubbub::getHttpClient(); + $client = PubSubHubbub::getHttpClient(); $client->setMethod(\Zend\HTTP\Client::POST); $client->setConfig(array('useragent' => 'Zend_Feed_Pubsubhubbub_Subscriber/' . \Zend\Version::VERSION)); @@ -679,7 +679,7 @@ protected function _getHttpClient() protected function _getRequestParameters($hubUrl, $mode) { if (!in_array($mode, array('subscribe', 'unsubscribe'))) { - throw new PubSubHubbub\Exception('Invalid mode specified: "' + throw new Exception('Invalid mode specified: "' . $mode . '" which should have been "subscribe" or "unsubscribe"'); } @@ -689,16 +689,16 @@ protected function _getRequestParameters($hubUrl, $mode) ); if ($this->getPreferredVerificationMode() - == PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_SYNC + == PubSubHubbub::VERIFICATION_MODE_SYNC ) { $vmodes = array( - PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_SYNC, - PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_ASYNC, + PubSubHubbub::VERIFICATION_MODE_SYNC, + PubSubHubbub::VERIFICATION_MODE_ASYNC, ); } else { $vmodes = array( - PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_ASYNC, - PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_SYNC, + PubSubHubbub::VERIFICATION_MODE_ASYNC, + PubSubHubbub::VERIFICATION_MODE_SYNC, ); } $params['hub.verify'] = array(); @@ -717,10 +717,10 @@ protected function _getRequestParameters($hubUrl, $mode) // Note: query string only usable with PuSH 0.2 Hubs if (!$this->_usePathParameter) { $params['hub.callback'] = $this->getCallbackUrl() - . '?xhub.subscription=' . PubSubHubbub\PubSubHubbub::urlencode($key); + . '?xhub.subscription=' . PubSubHubbub::urlencode($key); } else { $params['hub.callback'] = rtrim($this->getCallbackUrl(), '/') - . '/' . PubSubHubbub\PubSubHubbub::urlencode($key); + . '/' . PubSubHubbub::urlencode($key); } if ($mode == 'subscribe' && !is_null($this->getLeaseSeconds())) { $params['hub.lease_seconds'] = $this->getLeaseSeconds(); @@ -748,7 +748,7 @@ protected function _getRequestParameters($hubUrl, $mode) 'verify_token' => hash('sha256', $params['hub.verify_token']), 'secret' => null, 'expiration_time' => $expires, - 'subscription_state' => PubSubHubbub\PubSubHubbub::SUBSCRIPTION_NOTVERIFIED, + 'subscription_state' => PubSubHubbub::SUBSCRIPTION_NOTVERIFIED, ); $this->getStorage()->setSubscription($data); @@ -798,15 +798,15 @@ protected function _urlEncode(array $params) $encoded = array(); foreach ($params as $key => $value) { if (is_array($value)) { - $ekey = PubSubHubbub\PubSubHubbub::urlencode($key); + $ekey = PubSubHubbub::urlencode($key); $encoded[$ekey] = array(); foreach ($value as $duplicateKey) { $encoded[$ekey][] - = PubSubHubbub\PubSubHubbub::urlencode($duplicateKey); + = PubSubHubbub::urlencode($duplicateKey); } } else { - $encoded[PubSubHubbub\PubSubHubbub::urlencode($key)] - = PubSubHubbub\PubSubHubbub::urlencode($value); + $encoded[PubSubHubbub::urlencode($key)] + = PubSubHubbub::urlencode($value); } } return $encoded; diff --git a/src/PubSubHubbub/Subscriber/Callback.php b/src/PubSubHubbub/Subscriber/Callback.php index a29850cd..409c231e 100644 --- a/src/PubSubHubbub/Subscriber/Callback.php +++ b/src/PubSubHubbub/Subscriber/Callback.php @@ -26,7 +26,7 @@ /** * @uses \Zend\Feed\PubSubHubbub\PubSubHubbub - * @uses \Zend\Feed\PubSubHubbub\CallbackAbstract + * @uses \Zend\Feed\PubSubHubbub\AbstractCallback * @uses \Zend\Feed\Reader\Reader * @uses \Zend\Uri\Uri * @category Zend @@ -34,8 +34,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Callback - extends \Zend\Feed\PubSubHubbub\CallbackAbstract +class Callback extends \Zend\Feed\PubSubHubbub\AbstractCallback { /** * Contains the content of any feeds sent as updates to the Callback URL diff --git a/test/PubSubHubbub/Subscriber/CallbackTest.php b/test/PubSubHubbub/Subscriber/CallbackTest.php index e50958fd..451ea711 100644 --- a/test/PubSubHubbub/Subscriber/CallbackTest.php +++ b/test/PubSubHubbub/Subscriber/CallbackTest.php @@ -52,7 +52,7 @@ public function setUp() '\Zend\DB\Table\AbstractTable' ); $this->_rowset = $this->_getCleanMock( - '\Zend\DB\Table\Rowset\AbstractRowset' + '\Zend\DB\Table\AbstractRowset' ); $this->_tableGateway->expects($this->any())->method('getAdapter') diff --git a/test/PubSubHubbub/SubscriberTest.php b/test/PubSubHubbub/SubscriberTest.php index 6cec92ba..6d097e02 100644 --- a/test/PubSubHubbub/SubscriberTest.php +++ b/test/PubSubHubbub/SubscriberTest.php @@ -51,7 +51,7 @@ public function setUp() { $client = new \Zend\HTTP\Client; PubSubHubbub\PubSubHubbub::setHttpClient($client); - $this->_subscriber = new \Zend\Feed\PubSubHubbub\Subscriber\Subscriber; + $this->_subscriber = new \Zend\Feed\PubSubHubbub\Subscriber; $this->_adapter = $this->_getCleanMock( '\Zend\DB\Adapter\AbstractAdapter' ); From 1ba10740287f306ccc639313fd3f8c7abdfdd72a Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 7 Jul 2010 08:22:55 -0400 Subject: [PATCH 147/238] Zend\Feed\Writer cleanup - Swapped "ComponentAbstract" for "AbstractComponent" throughout - Renamed and reorg'd Component/Component naming instances - Moved InvalidMethodException up one level - Updated code and tests to reflect the above --- .../FeedAbstract.php => AbstractFeed.php} | 16 +- src/Writer/Deleted.php | 17 +- src/Writer/Entry.php | 59 +++---- ...dererAbstract.php => AbstractRenderer.php} | 13 +- src/Writer/Extension/Atom/Renderer/Feed.php | 5 +- .../Extension/Content/Renderer/Entry.php | 5 +- .../Extension/DublinCore/Renderer/Entry.php | 5 +- .../Extension/DublinCore/Renderer/Feed.php | 5 +- src/Writer/Extension/ITunes/Entry.php | 4 +- src/Writer/Extension/ITunes/Feed.php | 4 +- .../Extension/ITunes/Renderer/Entry.php | 5 +- src/Writer/Extension/ITunes/Renderer/Feed.php | 5 +- .../{RendererInterface.php => Renderer.php} | 2 +- src/Writer/Extension/Slash/Renderer/Entry.php | 5 +- .../Extension/Threading/Renderer/Entry.php | 5 +- .../WellFormedWeb/Renderer/Entry.php | 5 +- src/Writer/{Feed => }/Feed.php | 24 ++- .../InvalidMethodException.php | 4 +- .../RendererInterface.php => Renderer.php} | 4 +- ...dererAbstract.php => AbstractRenderer.php} | 6 +- src/Writer/Renderer/Entry/{Atom => }/Atom.php | 12 +- src/Writer/Renderer/Entry/Atom/Deleted.php | 10 +- src/Writer/Renderer/Entry/RSS.php | 8 +- src/Writer/Renderer/Feed/{Atom => }/Atom.php | 24 ++- .../{AtomAbstract.php => AbstractAtom.php} | 13 +- src/Writer/Renderer/Feed/Atom/Source.php | 10 +- src/Writer/Renderer/Feed/RSS.php | 14 +- src/Writer/Source.php | 4 +- src/Writer/Writer.php | 34 ++-- test/Writer/Extension/ITunes/FeedTest.php | 66 ++++---- test/Writer/FeedTest.php | 148 +++++++++--------- test/Writer/Renderer/Entry/AtomTest.php | 46 +++--- test/Writer/Renderer/Entry/RSSTest.php | 2 +- test/Writer/Renderer/Feed/AtomTest.php | 74 ++++----- test/Writer/Renderer/Feed/RSSTest.php | 6 +- 35 files changed, 328 insertions(+), 341 deletions(-) rename src/Writer/{Feed/FeedAbstract.php => AbstractFeed.php} (97%) rename src/Writer/Extension/{RendererAbstract.php => AbstractRenderer.php} (90%) rename src/Writer/Extension/{RendererInterface.php => Renderer.php} (98%) rename src/Writer/{Feed => }/Feed.php (92%) rename src/Writer/{Exception => }/InvalidMethodException.php (93%) rename src/Writer/{Renderer/RendererInterface.php => Renderer.php} (97%) rename src/Writer/Renderer/{RendererAbstract.php => AbstractRenderer.php} (97%) rename src/Writer/Renderer/Entry/{Atom => }/Atom.php (97%) rename src/Writer/Renderer/Feed/{Atom => }/Atom.php (85%) rename src/Writer/Renderer/Feed/Atom/{AtomAbstract.php => AbstractAtom.php} (97%) diff --git a/src/Writer/Feed/FeedAbstract.php b/src/Writer/AbstractFeed.php similarity index 97% rename from src/Writer/Feed/FeedAbstract.php rename to src/Writer/AbstractFeed.php index d17cefe0..d0a31bc6 100644 --- a/src/Writer/Feed/FeedAbstract.php +++ b/src/Writer/AbstractFeed.php @@ -22,8 +22,8 @@ /** * @namespace */ -namespace Zend\Feed\Writer\Feed; -use Zend\Feed\Writer; +namespace Zend\Feed\Writer; + use Zend\Feed; use Zend\URI; use Zend\Date; @@ -33,7 +33,7 @@ * @uses \Zend\Feed\Exception * @uses \Zend\Feed\Writer\Writer * @uses \Zend\Feed\Writer\Entry - * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Atom + * @uses \Zend\Feed\Writer\Renderer\Feed\Atom * @uses \Zend\Feed\Writer\Renderer\Feed\RSS * @uses \Zend\Uri\Uri * @category Zend @@ -41,7 +41,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class FeedAbstract +class AbstractFeed { /** * Contains all Feed level date to append in feed output @@ -66,7 +66,7 @@ class FeedAbstract */ public function __construct() { - Writer\Writer::registerCoreExtensions(); + Writer::registerCoreExtensions(); $this->_loadExtensions(); } @@ -652,7 +652,7 @@ public function __call($method, $args) foreach ($this->_extensions as $extension) { try { return call_user_func_array(array($extension, $method), $args); - } catch (Feed\Writer\Exception\InvalidMethodException $e) { + } catch (InvalidMethodException $e) { } } throw new Feed\Exception('Method: ' . $method @@ -666,10 +666,10 @@ public function __call($method, $args) */ protected function _loadExtensions() { - $all = Writer\Writer::getExtensions(); + $all = Writer::getExtensions(); $exts = $all['feed']; foreach ($exts as $ext) { - $className = Writer\Writer::getPluginLoader()->getClassName($ext); + $className = Writer::getPluginLoader()->getClassName($ext); $this->_extensions[$ext] = new $className(); $this->_extensions[$ext]->setEncoding($this->getEncoding()); } diff --git a/src/Writer/Deleted.php b/src/Writer/Deleted.php index df7b5140..b40a48e7 100644 --- a/src/Writer/Deleted.php +++ b/src/Writer/Deleted.php @@ -23,8 +23,9 @@ * @namespace */ namespace Zend\Feed\Writer; -use Zend\Feed; -use Zend\Date; + +use Zend\Feed\Exception as FeedException, + Zend\Date; /** * @uses \Zend\Date\Date @@ -61,7 +62,7 @@ class Deleted public function setEncoding($encoding) { if (empty($encoding) || !is_string($encoding)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + throw new FeedException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['encoding'] = $encoding; } @@ -116,7 +117,7 @@ public function getType() public function setReference($reference) { if (empty($reference) || !is_string($reference)) { - throw new Feed\Exception('Invalid parameter: reference must be a non-empty string'); + throw new FeedException('Invalid parameter: reference must be a non-empty string'); } $this->_data['reference'] = $reference; } @@ -139,7 +140,7 @@ public function setWhen($date = null) } elseif ($date instanceof Date\Date) { $zdate = $date; } else { - throw new Feed\Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + throw new FeedException('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['when'] = $zdate; } @@ -159,12 +160,12 @@ public function setBy(array $by) || empty($by['name']) || !is_string($by['name']) ) { - throw new Feed\Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); + throw new FeedException('Invalid parameter: author array must include a "name" key with a non-empty string value'); } $author['name'] = $by['name']; if (isset($by['email'])) { if (empty($by['email']) || !is_string($by['email'])) { - throw new Feed\Exception('Invalid parameter: "email" array value must be a non-empty string'); + throw new FeedException('Invalid parameter: "email" array value must be a non-empty string'); } $author['email'] = $by['email']; } @@ -173,7 +174,7 @@ public function setBy(array $by) || !is_string($by['uri']) || !\Zend\URI\URL::validate($by['uri']) ) { - throw new Feed\Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); + throw new FeedException('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $by['uri']; } diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index 541fcd81..63c4291c 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -23,7 +23,8 @@ * @namespace */ namespace Zend\Feed\Writer; -use Zend\Feed; + +use Zend\Feed\Exception as FeedException; use Zend\URI; use Zend\Date; @@ -89,12 +90,12 @@ public function addAuthor($name, $email = null, $uri = null) || empty($name['name']) || !is_string($name['name']) ) { - throw new Feed\Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); + throw new FeedException('Invalid parameter: author array must include a "name" key with a non-empty string value'); } $author['name'] = $name['name']; if (isset($name['email'])) { if (empty($name['email']) || !is_string($name['email'])) { - throw new Feed\Exception('Invalid parameter: "email" array value must be a non-empty string'); + throw new FeedException('Invalid parameter: "email" array value must be a non-empty string'); } $author['email'] = $name['email']; } @@ -103,7 +104,7 @@ public function addAuthor($name, $email = null, $uri = null) || !is_string($name['uri']) || !\Zend\URI\URL::validate($name['uri']) ) { - throw new Feed\Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); + throw new FeedException('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $name['uri']; } @@ -113,18 +114,18 @@ public function addAuthor($name, $email = null, $uri = null) */ } else { if (empty($name['name']) || !is_string($name['name'])) { - throw new Feed\Exception('Invalid parameter: "name" must be a non-empty string value'); + throw new FeedException('Invalid parameter: "name" must be a non-empty string value'); } $author['name'] = $name; if (isset($email)) { if (empty($email) || !is_string($email)) { - throw new Feed\Exception('Invalid parameter: "email" value must be a non-empty string'); + throw new FeedException('Invalid parameter: "email" value must be a non-empty string'); } $author['email'] = $email; } if (isset($uri)) { if (empty($uri) || !is_string($uri) || !\Zend\URI\URL::validate($uri)) { - throw new Feed\Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); + throw new FeedException('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $uri; } @@ -152,7 +153,7 @@ public function addAuthors(array $authors) public function setEncoding($encoding) { if (empty($encoding) || !is_string($encoding)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + throw new FeedException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['encoding'] = $encoding; } @@ -178,7 +179,7 @@ public function getEncoding() public function setCopyright($copyright) { if (empty($copyright) || !is_string($copyright)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + throw new FeedException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['copyright'] = $copyright; } @@ -191,7 +192,7 @@ public function setCopyright($copyright) public function setContent($content) { if (empty($content) || !is_string($content)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + throw new FeedException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['content'] = $content; } @@ -211,7 +212,7 @@ public function setDateCreated($date = null) } elseif ($date instanceof Date\Date) { $zdate = $date; } else { - throw new Feed\Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + throw new FeedException('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateCreated'] = $zdate; } @@ -231,7 +232,7 @@ public function setDateModified($date = null) } elseif ($date instanceof Date\Date) { $zdate = $date; } else { - throw new Feed\Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); + throw new FeedException('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateModified'] = $zdate; } @@ -244,7 +245,7 @@ public function setDateModified($date = null) public function setDescription($description) { if (empty($description) || !is_string($description)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + throw new FeedException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['description'] = $description; } @@ -257,7 +258,7 @@ public function setDescription($description) public function setId($id) { if (empty($id) || !is_string($id)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + throw new FeedException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['id'] = $id; } @@ -270,7 +271,7 @@ public function setId($id) public function setLink($link) { if (empty($link) || !is_string($link) || !\Zend\URI\URL::validate($link)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + throw new FeedException('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['link'] = $link; } @@ -283,7 +284,7 @@ public function setLink($link) public function setCommentCount($count) { if (empty($count) || !is_numeric($count) || (int) $count < 0) { - throw new Feed\Exception('Invalid parameter: "count" must be a non-empty integer number'); + throw new FeedException('Invalid parameter: "count" must be a non-empty integer number'); } $this->_data['commentCount'] = (int) $count; } @@ -296,7 +297,7 @@ public function setCommentCount($count) public function setCommentLink($link) { if (empty($link) || !is_string($link) || !\Zend\URI\URL::validate($link)) { - throw new Feed\Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); + throw new FeedException('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); } $this->_data['commentLink'] = $link; } @@ -309,10 +310,10 @@ public function setCommentLink($link) public function setCommentFeedLink(array $link) { if (!isset($link['uri']) || !is_string($link['uri']) || !\Zend\URI\URL::validate($link['uri'])) { - throw new Feed\Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); + throw new FeedException('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); } if (!isset($link['type']) || !in_array($link['type'], array('atom', 'rss', 'rdf'))) { - throw new Feed\Exception('Invalid parameter: "type" must be one' + throw new FeedException('Invalid parameter: "type" must be one' . ' of "atom", "rss" or "rdf"'); } if (!isset($this->_data['commentFeedLinks'])) { @@ -343,7 +344,7 @@ public function setCommentFeedLinks(array $links) public function setTitle($title) { if (empty($title) || !is_string($title)) { - throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string'); + throw new FeedException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['title'] = $title; } @@ -527,7 +528,7 @@ public function getCommentFeedLinks() public function addCategory(array $category) { if (!isset($category['term'])) { - throw new Feed\Exception('Each category must be an array and ' + throw new FeedException('Each category must be an array and ' . 'contain at least a "term" element containing the machine ' . ' readable category name'); } @@ -536,7 +537,7 @@ public function addCategory(array $category) || !is_string($category['scheme']) || !\Zend\URI\URL::validate($category['scheme']) ) { - throw new Feed\Exception('The Atom scheme or RSS domain of' + throw new FeedException('The Atom scheme or RSS domain of' . ' a category must be a valid URI'); } } @@ -579,19 +580,19 @@ public function getCategories() public function setEnclosure(array $enclosure) { if (!isset($enclosure['type'])) { - throw new Feed\Exception('Enclosure "type" is not set'); + throw new FeedException('Enclosure "type" is not set'); } if (!isset($enclosure['length'])) { - throw new Feed\Exception('Enclosure "length" is not set'); + throw new FeedException('Enclosure "length" is not set'); } if (!isset($enclosure['uri'])) { - throw new Feed\Exception('Enclosure "uri" is not set'); + throw new FeedException('Enclosure "uri" is not set'); } if (!\Zend\URI\URL::validate($enclosure['uri'])) { - throw new Feed\Exception('Enclosure "uri" is not a valid URI/IRI'); + throw new FeedException('Enclosure "uri" is not a valid URI/IRI'); } if ((int) $enclosure['length'] <= 0) { - throw new Feed\Exception('Enclosure "length" must be an integer' + throw new FeedException('Enclosure "length" must be an integer' . ' indicating the content\'s length in bytes'); } $this->_data['enclosure'] = $enclosure; @@ -681,10 +682,10 @@ public function __call($method, $args) foreach ($this->_extensions as $extension) { try { return call_user_func_array(array($extension, $method), $args); - } catch (Exception\InvalidMethodException $e) { + } catch (InvalidMethodException $e) { } } - throw new Feed\Exception('Method: ' . $method + throw new FeedException('Method: ' . $method . ' does not exist and could not be located on a registered Extension'); } diff --git a/src/Writer/Extension/RendererAbstract.php b/src/Writer/Extension/AbstractRenderer.php similarity index 90% rename from src/Writer/Extension/RendererAbstract.php rename to src/Writer/Extension/AbstractRenderer.php index 28a3fbe0..0befd7f0 100644 --- a/src/Writer/Extension/RendererAbstract.php +++ b/src/Writer/Extension/AbstractRenderer.php @@ -25,14 +25,13 @@ namespace Zend\Feed\Writer\Extension; /** - * @uses \Zend\Feed\Writer\Extension\RendererInterface + * @uses \Zend\Feed\Writer\Extension * @category Zend * @package Zend_Feed_Writer_Entry_Rss * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class RendererAbstract - implements RendererInterface +abstract class AbstractRenderer implements Renderer { /** * @var DOMDocument @@ -86,7 +85,7 @@ public function __construct($container) * Set feed encoding * * @param string $enc - * @return \Zend\Feed\Writer\Extension\RendererAbstract + * @return \Zend\Feed\Writer\Extension\AbstractRenderer */ public function setEncoding($enc) { @@ -109,7 +108,7 @@ public function getEncoding() * * @param DOMDocument $dom * @param DOMElement $base - * @return \Zend\Feed\Writer\Extension\RendererAbstract + * @return \Zend\Feed\Writer\Extension\AbstractRenderer */ public function setDomDocument(\DOMDocument $dom, \DOMElement $base) { @@ -132,7 +131,7 @@ public function getDataContainer() * Set feed type * * @param string $type - * @return \Zend\Feed\Writer\Extension\RendererAbstract + * @return \Zend\Feed\Writer\Extension\AbstractRenderer */ public function setType($type) { @@ -154,7 +153,7 @@ public function getType() * Set root element of document * * @param DOMElement $root - * @return \Zend\Feed\Writer\Extension\RendererAbstract + * @return \Zend\Feed\Writer\Extension\AbstractRenderer */ public function setRootElement(\DOMElement $root) { diff --git a/src/Writer/Extension/Atom/Renderer/Feed.php b/src/Writer/Extension/Atom/Renderer/Feed.php index 6574177c..4118b08b 100644 --- a/src/Writer/Extension/Atom/Renderer/Feed.php +++ b/src/Writer/Extension/Atom/Renderer/Feed.php @@ -25,14 +25,13 @@ namespace Zend\Feed\Writer\Extension\Atom\Renderer; /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract + * @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Feed extends \Zend\Feed\Writer\Extension\AbstractRenderer { /** diff --git a/src/Writer/Extension/Content/Renderer/Entry.php b/src/Writer/Extension/Content/Renderer/Entry.php index c559b635..ad1454cc 100644 --- a/src/Writer/Extension/Content/Renderer/Entry.php +++ b/src/Writer/Extension/Content/Renderer/Entry.php @@ -25,14 +25,13 @@ namespace Zend\Feed\Writer\Extension\Content\Renderer; /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract + * @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Entry extends \Zend\Feed\Writer\Extension\AbstractRenderer { /** diff --git a/src/Writer/Extension/DublinCore/Renderer/Entry.php b/src/Writer/Extension/DublinCore/Renderer/Entry.php index f2484e05..6c18f10c 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Entry.php +++ b/src/Writer/Extension/DublinCore/Renderer/Entry.php @@ -25,14 +25,13 @@ namespace Zend\Feed\Writer\Extension\DublinCore\Renderer; /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract + * @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Entry extends \Zend\Feed\Writer\Extension\AbstractRenderer { /** diff --git a/src/Writer/Extension/DublinCore/Renderer/Feed.php b/src/Writer/Extension/DublinCore/Renderer/Feed.php index c3a41473..4281d7e8 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Feed.php +++ b/src/Writer/Extension/DublinCore/Renderer/Feed.php @@ -25,14 +25,13 @@ namespace Zend\Feed\Writer\Extension\DublinCore\Renderer; /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract + * @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Feed extends \Zend\Feed\Writer\Extension\AbstractRenderer { /** diff --git a/src/Writer/Extension/ITunes/Entry.php b/src/Writer/Extension/ITunes/Entry.php index bac16703..61746bd1 100644 --- a/src/Writer/Extension/ITunes/Entry.php +++ b/src/Writer/Extension/ITunes/Entry.php @@ -28,7 +28,7 @@ /** * @uses \Zend\Feed\Exception * @uses \Zend\Feed\Writer\Writer - * @uses \Zend\Feed\Writer\Exception\InvalidMethodException + * @uses \Zend\Feed\Writer\InvalidMethodException * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -227,7 +227,7 @@ public function __call($method, array $params) if (!method_exists($this, 'setItunes' . ucfirst($point)) && !method_exists($this, 'addItunes' . ucfirst($point)) ) { - throw new \Zend\Feed\Writer\Exception\InvalidMethodException( + throw new \Zend\Feed\Writer\InvalidMethodException( 'invalid method: ' . $method ); } diff --git a/src/Writer/Extension/ITunes/Feed.php b/src/Writer/Extension/ITunes/Feed.php index 4624fdb7..0dd71ed9 100644 --- a/src/Writer/Extension/ITunes/Feed.php +++ b/src/Writer/Extension/ITunes/Feed.php @@ -28,7 +28,7 @@ /** * @uses \Zend\Feed\Exception * @uses \Zend\Feed\Writer\Writer - * @uses \Zend\Feed\Writer\Exception\InvalidMethodException + * @uses \Zend\Feed\Writer\InvalidMethodException * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Writer @@ -341,7 +341,7 @@ public function __call($method, array $params) if (!method_exists($this, 'setItunes' . ucfirst($point)) && !method_exists($this, 'addItunes' . ucfirst($point)) ) { - throw new \Zend\Feed\Writer\Exception\InvalidMethodException( + throw new \Zend\Feed\Writer\InvalidMethodException( 'invalid method: ' . $method ); } diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php index 2fd19e79..150decb4 100644 --- a/src/Writer/Extension/ITunes/Renderer/Entry.php +++ b/src/Writer/Extension/ITunes/Renderer/Entry.php @@ -25,14 +25,13 @@ namespace Zend\Feed\Writer\Extension\ITunes\Renderer; /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract + * @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Entry extends \Zend\Feed\Writer\Extension\AbstractRenderer { /** * Set to TRUE if a rendering method actually renders something. This diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php index 9173dfb2..561397ba 100644 --- a/src/Writer/Extension/ITunes/Renderer/Feed.php +++ b/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -25,14 +25,13 @@ namespace Zend\Feed\Writer\Extension\ITunes\Renderer; /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract + * @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Feed extends \Zend\Feed\Writer\Extension\AbstractRenderer { /** diff --git a/src/Writer/Extension/RendererInterface.php b/src/Writer/Extension/Renderer.php similarity index 98% rename from src/Writer/Extension/RendererInterface.php rename to src/Writer/Extension/Renderer.php index 618da1ff..a0a1c131 100644 --- a/src/Writer/Extension/RendererInterface.php +++ b/src/Writer/Extension/Renderer.php @@ -30,7 +30,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface RendererInterface +interface Renderer { /** * Constructor diff --git a/src/Writer/Extension/Slash/Renderer/Entry.php b/src/Writer/Extension/Slash/Renderer/Entry.php index 914fdf13..17001440 100644 --- a/src/Writer/Extension/Slash/Renderer/Entry.php +++ b/src/Writer/Extension/Slash/Renderer/Entry.php @@ -25,14 +25,13 @@ namespace Zend\Feed\Writer\Extension\Slash\Renderer; /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract + * @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Entry extends \Zend\Feed\Writer\Extension\AbstractRenderer { /** diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php index 1baf27d9..9e5584a6 100644 --- a/src/Writer/Extension/Threading/Renderer/Entry.php +++ b/src/Writer/Extension/Threading/Renderer/Entry.php @@ -25,14 +25,13 @@ namespace Zend\Feed\Writer\Extension\Threading\Renderer; /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract + * @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Entry extends \Zend\Feed\Writer\Extension\AbstractRenderer { /** diff --git a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php index a20baa80..d0e16cd0 100644 --- a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php +++ b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php @@ -25,14 +25,13 @@ namespace Zend\Feed\Writer\Extension\WellFormedWeb\Renderer; /** - * @uses \Zend\Feed\Writer\Extension\RendererAbstract + * @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Entry - extends \Zend\Feed\Writer\Extension\RendererAbstract +class Entry extends \Zend\Feed\Writer\Extension\AbstractRenderer { /** diff --git a/src/Writer/Feed/Feed.php b/src/Writer/Feed.php similarity index 92% rename from src/Writer/Feed/Feed.php rename to src/Writer/Feed.php index c735147a..bb2db90f 100644 --- a/src/Writer/Feed/Feed.php +++ b/src/Writer/Feed.php @@ -22,8 +22,8 @@ /** * @namespace */ -namespace Zend\Feed\Writer\Feed; -use Zend\Feed\Writer; +namespace Zend\Feed\Writer; + use Zend\Feed as ZendFeed; use Zend\Date; @@ -35,8 +35,8 @@ * @uses \Zend\Feed\Writer\Writer * @uses \Zend\Feed\Writer\Deleted * @uses \Zend\Feed\Writer\Entry - * @uses \Zend\Feed\Writer\Feed\FeedAbstract - * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Atom + * @uses \Zend\Feed\Writer\Feed\AbstractFeed + * @uses \Zend\Feed\Writer\Renderer\Feed\Atom * @uses \Zend\Feed\Writer\Renderer\Feed\RSS * @uses \Zend\Uri\Uri * @category Zend @@ -44,9 +44,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Feed - extends FeedAbstract - implements \Iterator, \Countable +class Feed extends AbstractFeed implements \Iterator, \Countable { /** @@ -72,7 +70,7 @@ class Feed */ public function createEntry() { - $entry = new Writer\Entry; + $entry = new Entry; if ($this->getEncoding()) { $entry->setEncoding($this->getEncoding()); } @@ -86,7 +84,7 @@ public function createEntry() * * @param \Zend\Feed\Writer\Deleted $entry */ - public function addTombstone(Writer\Deleted $deleted) + public function addTombstone(Deleted $deleted) { $this->_entries[] = $deleted; } @@ -100,7 +98,7 @@ public function addTombstone(Writer\Deleted $deleted) */ public function createTombstone() { - $deleted = new Writer\Deleted; + $deleted = new Deleted; if ($this->getEncoding()) { $deleted->setEncoding($this->getEncoding()); } @@ -114,7 +112,7 @@ public function createTombstone() * * @param \Zend\Feed\Writer\Entry $entry */ - public function addEntry(Writer\Entry $entry) + public function addEntry(Entry $entry) { $this->_entries[] = $entry; } @@ -189,7 +187,7 @@ public function count() /** * Return the current entry * - * @return Zend_Feed_Reader_Entry_Interface + * @return Zend\Feed\Reader\Entry */ public function current() { @@ -250,7 +248,7 @@ public function export($type, $ignoreExceptions = false) throw new ZendFeed\Exception('Invalid feed type specified: ' . $type . '.' . ' Should be one of "rss" or "atom".'); } - $renderClass = 'Zend_Feed_Writer_Renderer_Feed_' . $type; + $renderClass = 'Zend\Feed\Writer\Renderer\Feed\\' . $type; $renderer = new $renderClass($this); if ($ignoreExceptions) { $renderer->ignoreExceptions(); diff --git a/src/Writer/Exception/InvalidMethodException.php b/src/Writer/InvalidMethodException.php similarity index 93% rename from src/Writer/Exception/InvalidMethodException.php rename to src/Writer/InvalidMethodException.php index ff301762..6475e484 100644 --- a/src/Writer/Exception/InvalidMethodException.php +++ b/src/Writer/InvalidMethodException.php @@ -23,14 +23,14 @@ /** * @namespace */ -namespace Zend\Feed\Writer\Exception; +namespace Zend\Feed\Writer; /** * Feed exceptions * * Class to represent exceptions that occur during Feed operations. * - * @uses \Zend\Feed\Exception + * @uses \Zend\Exception * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Writer/Renderer/RendererInterface.php b/src/Writer/Renderer.php similarity index 97% rename from src/Writer/Renderer/RendererInterface.php rename to src/Writer/Renderer.php index 70c304bd..9104bcfe 100644 --- a/src/Writer/Renderer/RendererInterface.php +++ b/src/Writer/Renderer.php @@ -22,7 +22,7 @@ /** * @namespace */ -namespace Zend\Feed\Writer\Renderer; +namespace Zend\Feed\Writer; /** * @category Zend @@ -30,7 +30,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface RendererInterface +interface Renderer { /** * Render feed/entry diff --git a/src/Writer/Renderer/RendererAbstract.php b/src/Writer/Renderer/AbstractRenderer.php similarity index 97% rename from src/Writer/Renderer/RendererAbstract.php rename to src/Writer/Renderer/AbstractRenderer.php index ea9bdfd3..4631fb3d 100644 --- a/src/Writer/Renderer/RendererAbstract.php +++ b/src/Writer/Renderer/AbstractRenderer.php @@ -34,7 +34,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class RendererAbstract +class AbstractRenderer { /** * Extensions @@ -139,7 +139,7 @@ public function getDataContainer() * Set feed encoding * * @param string $enc - * @return \Zend\Feed\Writer\Renderer\RendererAbstract + * @return \Zend\Feed\Writer\Renderer\AbstractRenderer */ public function setEncoding($enc) { @@ -161,7 +161,7 @@ public function getEncoding() * Indicate whether or not to ignore exceptions * * @param bool $bool - * @return \Zend\Feed\Writer\Renderer\RendererAbstract + * @return \Zend\Feed\Writer\Renderer\AbstractRenderer */ public function ignoreExceptions($bool = true) { diff --git a/src/Writer/Renderer/Entry/Atom/Atom.php b/src/Writer/Renderer/Entry/Atom.php similarity index 97% rename from src/Writer/Renderer/Entry/Atom/Atom.php rename to src/Writer/Renderer/Entry/Atom.php index 24c1a383..2b4215c8 100644 --- a/src/Writer/Renderer/Entry/Atom/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -22,7 +22,7 @@ /** * @namespace */ -namespace Zend\Feed\Writer\Renderer\Entry\Atom; +namespace Zend\Feed\Writer\Renderer\Entry; use Zend\Feed; use Zend\Date; @@ -32,8 +32,8 @@ * @uses \Zend\Feed\Exception * @uses \Zend\Feed\Writer\Writer * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Source - * @uses \Zend\Feed\Writer\Renderer\RendererAbstract - * @uses \Zend\Feed\Writer\Renderer\RendererInterface + * @uses \Zend\Feed\Writer\Renderer\AbstractRenderer + * @uses \Zend\Feed\Writer\Renderer * @uses \Zend\Uri\Uri * @uses tidy * @category Zend @@ -42,8 +42,8 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Atom - extends Feed\Writer\Renderer\RendererAbstract - implements Feed\Writer\Renderer\RendererInterface + extends Feed\Writer\Renderer\AbstractRenderer + implements Feed\Writer\Renderer { /** * Constructor @@ -59,7 +59,7 @@ public function __construct (Feed\Writer\Entry $container) /** * Render atom entry * - * @return \Zend\Feed\Writer\Renderer\Entry\Atom\Atom + * @return \Zend\Feed\Writer\Renderer\Entry\Atom */ public function render() { diff --git a/src/Writer/Renderer/Entry/Atom/Deleted.php b/src/Writer/Renderer/Entry/Atom/Deleted.php index e76fc221..099d5eda 100644 --- a/src/Writer/Renderer/Entry/Atom/Deleted.php +++ b/src/Writer/Renderer/Entry/Atom/Deleted.php @@ -27,16 +27,16 @@ /** * @uses DOMDocument * @uses \Zend\Date\Date - * @uses \Zend\Feed\Writer\Renderer\RendererAbstract - * @uses \Zend\Feed\Writer\Renderer\RendererInterface + * @uses \Zend\Feed\Writer\Renderer\AbstractRenderer + * @uses \Zend\Feed\Writer\Renderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Deleted - extends \Zend\Feed\Writer\Renderer\RendererAbstract - implements \Zend\Feed\Writer\Renderer\RendererInterface + extends \Zend\Feed\Writer\Renderer\AbstractRenderer + implements \Zend\Feed\Writer\Renderer { /** * Constructor @@ -52,7 +52,7 @@ public function __construct (\Zend\Feed\Writer\Deleted $container) /** * Render atom entry * - * @return \Zend\Feed\Writer\Renderer\Entry\Atom\Atom + * @return \Zend\Feed\Writer\Renderer\Entry\Atom */ public function render() { diff --git a/src/Writer/Renderer/Entry/RSS.php b/src/Writer/Renderer/Entry/RSS.php index 3de04058..0129cc68 100644 --- a/src/Writer/Renderer/Entry/RSS.php +++ b/src/Writer/Renderer/Entry/RSS.php @@ -28,8 +28,8 @@ /** * @uses \Zend\Date\Date * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Writer\Renderer\RendererAbstract - * @uses \Zend\Feed\Writer\Renderer\RendererInterface + * @uses \Zend\Feed\Writer\Renderer\AbstractRenderer + * @uses \Zend\Feed\Writer\Renderer * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Writer @@ -37,8 +37,8 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class RSS - extends Feed\Writer\Renderer\RendererAbstract - implements Feed\Writer\Renderer\RendererInterface + extends Feed\Writer\Renderer\AbstractRenderer + implements Feed\Writer\Renderer { /** * Constructor diff --git a/src/Writer/Renderer/Feed/Atom/Atom.php b/src/Writer/Renderer/Feed/Atom.php similarity index 85% rename from src/Writer/Renderer/Feed/Atom/Atom.php rename to src/Writer/Renderer/Feed/Atom.php index 3381d8b4..f8b72b48 100644 --- a/src/Writer/Renderer/Feed/Atom/Atom.php +++ b/src/Writer/Renderer/Feed/Atom.php @@ -22,34 +22,32 @@ /** * @namespace */ -namespace Zend\Feed\Writer\Renderer\Feed\Atom; +namespace Zend\Feed\Writer\Renderer\Feed; /** * @uses DOMDocument * @uses \Zend\Feed\Writer\Writer - * @uses \Zend\Feed\Writer\Feed\Feed - * @uses \Zend\Feed\Writer\Renderer\Entry\Atom\Atom + * @uses \Zend\Feed\Writer\Feed + * @uses \Zend\Feed\Writer\Renderer\Entry\Atom * @uses \Zend\Feed\Writer\Renderer\Entry\Atom\Deleted - * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\AtomAbstract - * @uses \Zend\Feed\Writer\Renderer\RendererAbstract - * @uses \Zend\Feed\Writer\Renderer\RendererInterface + * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\AbstractAtom + * @uses \Zend\Feed\Writer\Renderer\AbstractRenderer + * @uses \Zend\Feed\Writer\Renderer * @uses \Zend\Version * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Atom - extends AtomAbstract - implements \Zend\Feed\Writer\Renderer\RendererInterface +class Atom extends Atom\AbstractAtom implements \Zend\Feed\Writer\Renderer { /** * Constructor * - * @param \Zend\Feed\Writer\Feed\Feed $container + * @param \Zend\Feed\Writer\Feed $container * @return void */ - public function __construct (\Zend\Feed\Writer\Feed\Feed $container) + public function __construct (\Zend\Feed\Writer\Feed $container) { parent::__construct($container); } @@ -57,7 +55,7 @@ public function __construct (\Zend\Feed\Writer\Feed\Feed $container) /** * Render Atom feed * - * @return \Zend\Feed\Writer\Renderer\Feed\Atom\Atom + * @return \Zend\Feed\Writer\Renderer\Feed\Atom */ public function render() { @@ -98,7 +96,7 @@ public function render() $entry->setEncoding($this->getDataContainer()->getEncoding()); } if ($entry instanceof \Zend\Feed\Writer\Entry) { - $renderer = new \Zend\Feed\Writer\Renderer\Entry\Atom\Atom($entry); + $renderer = new \Zend\Feed\Writer\Renderer\Entry\Atom($entry); } else { if (!$this->_dom->documentElement->hasAttribute('xmlns:at')) { $this->_dom->documentElement->setAttribute( diff --git a/src/Writer/Renderer/Feed/Atom/AtomAbstract.php b/src/Writer/Renderer/Feed/Atom/AbstractAtom.php similarity index 97% rename from src/Writer/Renderer/Feed/Atom/AtomAbstract.php rename to src/Writer/Renderer/Feed/Atom/AbstractAtom.php index 0f8922df..b4493bea 100644 --- a/src/Writer/Renderer/Feed/Atom/AtomAbstract.php +++ b/src/Writer/Renderer/Feed/Atom/AbstractAtom.php @@ -28,23 +28,22 @@ /** * @uses \Zend\Date\Date * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Writer\Feed\Feed - * @uses \Zend\Feed\Writer\Renderer\Entry\Atom\Atom - * @uses \Zend\Feed\Writer\Renderer\RendererAbstract - * @uses \Zend\Feed\Writer\Renderer\RendererInterface + * @uses \Zend\Feed\Writer\Feed + * @uses \Zend\Feed\Writer\Renderer\Entry\Atom + * @uses \Zend\Feed\Writer\Renderer\AbstractRenderer + * @uses \Zend\Feed\Writer\Renderer * @uses \Zend\Version * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class AtomAbstract - extends Feed\Writer\Renderer\RendererAbstract +class AbstractAtom extends Feed\Writer\Renderer\AbstractRenderer { /** * Constructor * - * @param \Zend\Feed\Writer\Feed\Feed $container + * @param \Zend\Feed\Writer\Feed $container * @return void */ public function __construct ($container) diff --git a/src/Writer/Renderer/Feed/Atom/Source.php b/src/Writer/Renderer/Feed/Atom/Source.php index 649bac91..df3b0685 100644 --- a/src/Writer/Renderer/Feed/Atom/Source.php +++ b/src/Writer/Renderer/Feed/Atom/Source.php @@ -26,16 +26,14 @@ /** * @uses DOMDocument - * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\AtomAbstract - * @uses \Zend\Feed\Writer\Renderer\RendererInterface + * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\AbstractAtom + * @uses \Zend\Feed\Writer\Renderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Source - extends AtomAbstract - implements \Zend\Feed\Writer\Renderer\RendererInterface +class Source extends AbstractAtom implements \Zend\Feed\Writer\Renderer { /** @@ -52,7 +50,7 @@ public function __construct (\Zend\Feed\Writer\Source $container) /** * Render Atom Feed Metadata (Source element) * - * @return \Zend\Feed\Writer\Renderer\Feed\Atom\Atom + * @return \Zend\Feed\Writer\Renderer\Feed\Atom */ public function render() { diff --git a/src/Writer/Renderer/Feed/RSS.php b/src/Writer/Renderer/Feed/RSS.php index 0ec37a60..5f40e2ad 100644 --- a/src/Writer/Renderer/Feed/RSS.php +++ b/src/Writer/Renderer/Feed/RSS.php @@ -29,10 +29,10 @@ * @uses DOMDocument * @uses \Zend\Date\Date * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Writer\Feed\Feed + * @uses \Zend\Feed\Writer\Feed * @uses \Zend\Feed\Writer\Renderer\Entry\RSS - * @uses \Zend\Feed\Writer\Renderer\RendererAbstract - * @uses \Zend\Feed\Writer\Renderer\RendererInterface + * @uses \Zend\Feed\Writer\Renderer\AbstractRenderer + * @uses \Zend\Feed\Writer\Renderer * @uses \Zend\Uri\Uri * @uses \Zend\Version * @category Zend @@ -41,16 +41,16 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class RSS - extends Feed\Writer\Renderer\RendererAbstract - implements Feed\Writer\Renderer\RendererInterface + extends Feed\Writer\Renderer\AbstractRenderer + implements Feed\Writer\Renderer { /** * Constructor * - * @param \Zend\Feed\Writer\Feed\Feed $container + * @param \Zend\Feed\Writer\Feed $container * @return void */ - public function __construct (Feed\Writer\Feed\Feed $container) + public function __construct (Feed\Writer\Feed $container) { parent::__construct($container); } diff --git a/src/Writer/Source.php b/src/Writer/Source.php index 0e41d125..df2a607a 100644 --- a/src/Writer/Source.php +++ b/src/Writer/Source.php @@ -25,13 +25,13 @@ namespace Zend\Feed\Writer; /** - * @uses \Zend\Feed\Writer\Feed\FeedAbstract + * @uses \Zend\Feed\Writer\Feed\AbstractFeed * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Source extends Feed\FeedAbstract +class Source extends Feed\AbstractFeed { } diff --git a/src/Writer/Writer.php b/src/Writer/Writer.php index f52deb1f..ede122ec 100644 --- a/src/Writer/Writer.php +++ b/src/Writer/Writer.php @@ -23,11 +23,13 @@ * @namespace */ namespace Zend\Feed\Writer; -use Zend\Loader\PluginLoader; +use Zend\Loader\PrefixPathMapper, + Zend\Loader\PluginLoader, + Zend\Loader\PluginLoaderException; /** * @uses \Zend\Feed\Exception - * @uses \Zend\Loader\PluginLoader\PluginLoader + * @uses \Zend\Loader\PluginLoader * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -65,7 +67,7 @@ class Writer /** * PluginLoader instance used by component * - * @var \Zend\Loader\PluginLoader\PluginLoaderInterface + * @var \Zend\Loader\PrefixPathMapper */ protected static $_pluginLoader = null; @@ -93,9 +95,9 @@ class Writer /** * Set plugin loader for use with Extensions * - * @param \Zend\Loader\PluginLoader\PluginLoaderInterface + * @param \Zend\Loader\PrefixPathMapper */ - public static function setPluginLoader(PluginLoader\PluginLoaderInterface $loader) + public static function setPluginLoader(PrefixPathMapper $loader) { self::$_pluginLoader = $loader; } @@ -103,12 +105,12 @@ public static function setPluginLoader(PluginLoader\PluginLoaderInterface $loade /** * Get plugin loader for use with Extensions * - * @return \Zend\Loader\PluginLoader\PluginLoaderInterface + * @return \Zend\Loader\PrefixPathMapper */ public static function getPluginLoader() { if (!isset(self::$_pluginLoader)) { - self::$_pluginLoader = new PluginLoader\PluginLoader(array( + self::$_pluginLoader = new PluginLoader(array( 'Zend\Feed\Writer\Extension\\' => 'Zend/Feed/Writer/Extension/', )); } @@ -124,7 +126,7 @@ public static function getPluginLoader() */ public static function addPrefixPath($prefix, $path) { - $prefix = rtrim($prefix, '_'); + $prefix = rtrim($prefix, '\\'); $path = rtrim($path, DIRECTORY_SEPARATOR); self::getPluginLoader()->addPrefixPath($prefix, $path); } @@ -172,22 +174,22 @@ public static function registerExtension($name) try { self::getPluginLoader()->load($feedName); self::$_extensions['feed'][] = $feedName; - } catch (PluginLoader\Exception $e) { + } catch (PluginLoaderException $e) { } try { self::getPluginLoader()->load($entryName); self::$_extensions['entry'][] = $entryName; - } catch (PluginLoader\Exception $e) { + } catch (PluginLoaderException $e) { } try { self::getPluginLoader()->load($feedRendererName); self::$_extensions['feedRenderer'][] = $feedRendererName; - } catch (PluginLoader\Exception $e) { + } catch (PluginLoaderException $e) { } try { self::getPluginLoader()->load($entryRendererName); self::$_extensions['entryRenderer'][] = $entryRendererName; - } catch (PluginLoader\Exception $e) { + } catch (PluginLoaderException $e) { } if (!self::getPluginLoader()->isLoaded($feedName) && !self::getPluginLoader()->isLoaded($entryName) @@ -207,10 +209,10 @@ public static function registerExtension($name) */ public static function isRegistered($extensionName) { - $feedName = $extensionName . '_Feed'; - $entryName = $extensionName . '_Entry'; - $feedRendererName = $extensionName . '_Renderer_Feed'; - $entryRendererName = $extensionName . '_Renderer_Entry'; + $feedName = $extensionName . '\Feed'; + $entryName = $extensionName . '\Entry'; + $feedRendererName = $extensionName . '\Renderer\Feed'; + $entryRendererName = $extensionName . '\Renderer\Entry'; if (in_array($feedName, self::$_extensions['feed']) || in_array($entryName, self::$_extensions['entry']) || in_array($feedRendererName, self::$_extensions['feedRenderer']) diff --git a/test/Writer/Extension/ITunes/FeedTest.php b/test/Writer/Extension/ITunes/FeedTest.php index 8eaaff49..a8ba9971 100644 --- a/test/Writer/Extension/ITunes/FeedTest.php +++ b/test/Writer/Extension/ITunes/FeedTest.php @@ -40,7 +40,7 @@ class FeedTest extends \PHPUnit_Framework_TestCase public function testSetBlock() { - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesBlock('yes'); $this->assertEquals('yes', $feed->getItunesBlock()); } @@ -48,27 +48,27 @@ public function testSetBlock() public function testSetBlockThrowsExceptionOnNonAlphaValue() { $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesBlock('123'); } public function testSetBlockThrowsExceptionIfValueGreaterThan255CharsLength() { $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesBlock(str_repeat('a', 256)); } public function testAddAuthors() { - $feed = new Feed\Feed; + $feed = new Feed; $feed->addItunesAuthors(array('joe', 'jane')); $this->assertEquals(array('joe', 'jane'), $feed->getItunesAuthors()); } public function testAddAuthor() { - $feed = new Feed\Feed; + $feed = new Feed; $feed->addItunesAuthor('joe'); $this->assertEquals(array('joe'), $feed->getItunesAuthors()); } @@ -76,13 +76,13 @@ public function testAddAuthor() public function testAddAuthorThrowsExceptionIfValueGreaterThan255CharsLength() { $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Feed; $feed->addItunesAuthor(str_repeat('a', 256)); } public function testSetCategories() { - $feed = new Feed\Feed; + $feed = new Feed; $cats = array( 'cat1', 'cat2' => array('cat2-1', 'cat2-a&b') @@ -94,7 +94,7 @@ public function testSetCategories() public function testSetCategoriesThrowsExceptionIfAnyCatNameGreaterThan255CharsLength() { $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Feed; $cats = array( 'cat1', 'cat2' => array('cat2-1', str_repeat('a', 256)) @@ -105,14 +105,14 @@ public function testSetCategoriesThrowsExceptionIfAnyCatNameGreaterThan255CharsL public function testSetImageAsPngFile() { - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesImage('http://www.example.com/image.png'); $this->assertEquals('http://www.example.com/image.png', $feed->getItunesImage()); } public function testSetImageAsJpgFile() { - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesImage('http://www.example.com/image.jpg'); $this->assertEquals('http://www.example.com/image.jpg', $feed->getItunesImage()); } @@ -120,34 +120,34 @@ public function testSetImageAsJpgFile() public function testSetImageThrowsExceptionOnInvalidUri() { $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesImage('http://'); } public function testSetImageThrowsExceptionOnInvalidImageExtension() { $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesImage('http://www.example.com/image.gif'); } public function testSetDurationAsSeconds() { - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesDuration(23); $this->assertEquals(23, $feed->getItunesDuration()); } public function testSetDurationAsMinutesAndSeconds() { - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesDuration('23:23'); $this->assertEquals('23:23', $feed->getItunesDuration()); } public function testSetDurationAsHoursMinutesAndSeconds() { - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesDuration('23:23:23'); $this->assertEquals('23:23:23', $feed->getItunesDuration()); } @@ -155,41 +155,41 @@ public function testSetDurationAsHoursMinutesAndSeconds() public function testSetDurationThrowsExceptionOnUnknownFormat() { $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesDuration('abc'); } public function testSetDurationThrowsExceptionOnInvalidSeconds() { $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesDuration('23:456'); } public function testSetDurationThrowsExceptionOnInvalidMinutes() { $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesDuration('23:234:45'); } public function testSetExplicitToYes() { - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesExplicit('yes'); $this->assertEquals('yes', $feed->getItunesExplicit()); } public function testSetExplicitToNo() { - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesExplicit('no'); $this->assertEquals('no', $feed->getItunesExplicit()); } public function testSetExplicitToClean() { - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesExplicit('clean'); $this->assertEquals('clean', $feed->getItunesExplicit()); } @@ -197,13 +197,13 @@ public function testSetExplicitToClean() public function testSetExplicitThrowsExceptionOnUnknownTerm() { $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesExplicit('abc'); } public function testSetKeywords() { - $feed = new Feed\Feed; + $feed = new Feed; $words = array( 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12' ); @@ -214,7 +214,7 @@ public function testSetKeywords() public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded() { $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Feed; $words = array( 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12', 'a13' ); @@ -224,7 +224,7 @@ public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded() public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharLength() { $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Feed; $words = array( str_repeat('a', 253), str_repeat('b', 2) ); @@ -233,7 +233,7 @@ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharL public function testSetNewFeedUrl() { - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesNewFeedUrl('http://example.com/feed'); $this->assertEquals('http://example.com/feed', $feed->getItunesNewFeedUrl()); } @@ -241,27 +241,27 @@ public function testSetNewFeedUrl() public function testSetNewFeedUrlThrowsExceptionOnInvalidUri() { $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesNewFeedUrl('http://'); } public function testAddOwner() { - $feed = new Feed\Feed; + $feed = new Feed; $feed->addItunesOwner(array('name'=>'joe','email'=>'joe@example.com')); $this->assertEquals(array(array('name'=>'joe','email'=>'joe@example.com')), $feed->getItunesOwners()); } public function testAddOwners() { - $feed = new Feed\Feed; + $feed = new Feed; $feed->addItunesOwners(array(array('name'=>'joe','email'=>'joe@example.com'))); $this->assertEquals(array(array('name'=>'joe','email'=>'joe@example.com')), $feed->getItunesOwners()); } public function testSetSubtitle() { - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesSubtitle('abc'); $this->assertEquals('abc', $feed->getItunesSubtitle()); } @@ -269,13 +269,13 @@ public function testSetSubtitle() public function testSetSubtitleThrowsExceptionWhenValueExceeds255Chars() { $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesSubtitle(str_repeat('a', 256)); } public function testSetSummary() { - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesSummary('abc'); $this->assertEquals('abc', $feed->getItunesSummary()); } @@ -283,7 +283,7 @@ public function testSetSummary() public function testSetSummaryThrowsExceptionWhenValueExceeds4000Chars() { $this->setExpectedException('Zend\Feed\Exception'); - $feed = new Feed\Feed; + $feed = new Feed; $feed->setItunesSummary(str_repeat('a',4001)); } diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php index a92f8fc1..ac7ca46d 100644 --- a/test/Writer/FeedTest.php +++ b/test/Writer/FeedTest.php @@ -44,33 +44,33 @@ class FeedTest extends \PHPUnit_Framework_TestCase public function setup() { - $this->_feedSamplePath = dirname(__FILE__) . '/Writer/_files'; + $this->_feedSamplePath = __DIR__ . '/../_files'; } public function testAddsAuthorName() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->addAuthor('Joe'); $this->assertEquals(array('name'=>'Joe'), $writer->getAuthor()); } public function testAddsAuthorEmail() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->addAuthor('Joe', 'joe@example.com'); $this->assertEquals(array('name'=>'Joe', 'email' => 'joe@example.com'), $writer->getAuthor()); } public function testAddsAuthorUri() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->addAuthor('Joe', null, 'http://www.example.com'); $this->assertEquals(array('name'=>'Joe', 'uri' => 'http://www.example.com'), $writer->getAuthor()); } public function testAddAuthorThrowsExceptionOnInvalidName() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->addAuthor(''); $this->fail(); @@ -80,7 +80,7 @@ public function testAddAuthorThrowsExceptionOnInvalidName() public function testAddAuthorThrowsExceptionOnInvalidEmail() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->addAuthor('Joe', ''); $this->fail(); @@ -91,7 +91,7 @@ public function testAddAuthorThrowsExceptionOnInvalidEmail() public function testAddAuthorThrowsExceptionOnInvalidUri() { $this->markTestSkipped('Skipped until Zend\URI is refactored for validation'); - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->addAuthor('Joe', null, 'notauri'); $this->fail(); @@ -101,28 +101,28 @@ public function testAddAuthorThrowsExceptionOnInvalidUri() public function testAddsAuthorNameFromArray() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->addAuthor(array('name'=>'Joe')); $this->assertEquals(array('name'=>'Joe'), $writer->getAuthor()); } public function testAddsAuthorEmailFromArray() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->addAuthor(array('name'=>'Joe','email'=>'joe@example.com')); $this->assertEquals(array('name'=>'Joe', 'email' => 'joe@example.com'), $writer->getAuthor()); } public function testAddsAuthorUriFromArray() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->addAuthor(array('name'=>'Joe','uri'=>'http://www.example.com')); $this->assertEquals(array('name'=>'Joe', 'uri' => 'http://www.example.com'), $writer->getAuthor()); } public function testAddAuthorThrowsExceptionOnInvalidNameFromArray() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->addAuthor(array('name'=>'')); $this->fail(); @@ -132,7 +132,7 @@ public function testAddAuthorThrowsExceptionOnInvalidNameFromArray() public function testAddAuthorThrowsExceptionOnInvalidEmailFromArray() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->addAuthor(array('name'=>'Joe','email'=>'')); $this->fail(); @@ -143,7 +143,7 @@ public function testAddAuthorThrowsExceptionOnInvalidEmailFromArray() public function testAddAuthorThrowsExceptionOnInvalidUriFromArray() { $this->markTestSkipped('Skipped until Zend\URI is refactored for validation'); - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->addAuthor(array('name'=>'Joe','uri'=>'notauri')); $this->fail(); @@ -153,7 +153,7 @@ public function testAddAuthorThrowsExceptionOnInvalidUriFromArray() public function testAddAuthorThrowsExceptionIfNameOmittedFromArray() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->addAuthor(array('uri'=>'notauri')); $this->fail(); @@ -163,7 +163,7 @@ public function testAddAuthorThrowsExceptionIfNameOmittedFromArray() public function testAddsAuthorsFromArrayOfAuthors() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->addAuthors(array( array('name'=>'Joe','uri'=>'http://www.example.com'), array('name'=>'Jane','uri'=>'http://www.example.com') @@ -173,14 +173,14 @@ public function testAddsAuthorsFromArrayOfAuthors() public function testSetsCopyright() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setCopyright('Copyright (c) 2009 Paddy Brady'); $this->assertEquals('Copyright (c) 2009 Paddy Brady', $writer->getCopyright()); } public function testSetCopyrightThrowsExceptionOnInvalidParam() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->setCopyright(''); $this->fail(); @@ -190,7 +190,7 @@ public function testSetCopyrightThrowsExceptionOnInvalidParam() public function testSetDateCreatedDefaultsToCurrentTime() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setDateCreated(); $dateNow = new Date\Date; $this->assertTrue($dateNow->isLater($writer->getDateCreated()) || $dateNow->equals($writer->getDateCreated())); @@ -198,7 +198,7 @@ public function testSetDateCreatedDefaultsToCurrentTime() public function testSetDateCreatedUsesGivenUnixTimestamp() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setDateCreated(1234567890); $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($writer->getDateCreated())); @@ -206,7 +206,7 @@ public function testSetDateCreatedUsesGivenUnixTimestamp() public function testSetDateCreatedUsesZendDateObject() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setDateCreated(new Date\Date('1234567890', Date\Date::TIMESTAMP)); $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($writer->getDateCreated())); @@ -214,7 +214,7 @@ public function testSetDateCreatedUsesZendDateObject() public function testSetDateModifiedDefaultsToCurrentTime() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setDateModified(); $dateNow = new Date\Date; $this->assertTrue($dateNow->isLater($writer->getDateModified()) || $dateNow->equals($writer->getDateModified())); @@ -222,7 +222,7 @@ public function testSetDateModifiedDefaultsToCurrentTime() public function testSetDateModifiedUsesGivenUnixTimestamp() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setDateModified(1234567890); $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($writer->getDateModified())); @@ -230,7 +230,7 @@ public function testSetDateModifiedUsesGivenUnixTimestamp() public function testSetDateModifiedUsesZendDateObject() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setDateModified(new Date\Date('1234567890', Date\Date::TIMESTAMP)); $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($writer->getDateModified())); @@ -238,7 +238,7 @@ public function testSetDateModifiedUsesZendDateObject() public function testSetDateCreatedThrowsExceptionOnInvalidParameter() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->setDateCreated('abc'); $this->fail(); @@ -248,7 +248,7 @@ public function testSetDateCreatedThrowsExceptionOnInvalidParameter() public function testSetDateModifiedThrowsExceptionOnInvalidParameter() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->setDateModified('abc'); $this->fail(); @@ -258,32 +258,32 @@ public function testSetDateModifiedThrowsExceptionOnInvalidParameter() public function testGetDateCreatedReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $this->assertTrue(is_null($writer->getDateCreated())); } public function testGetDateModifiedReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $this->assertTrue(is_null($writer->getDateModified())); } public function testGetCopyrightReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $this->assertTrue(is_null($writer->getCopyright())); } public function testSetsDescription() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setDescription('abc'); $this->assertEquals('abc', $writer->getDescription()); } public function testSetDescriptionThrowsExceptionOnInvalidParameter() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->setDescription(''); $this->fail(); @@ -293,27 +293,27 @@ public function testSetDescriptionThrowsExceptionOnInvalidParameter() public function testGetDescriptionReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $this->assertTrue(is_null($writer->getDescription())); } public function testSetsId() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setId('http://www.example.com/id'); $this->assertEquals('http://www.example.com/id', $writer->getId()); } public function testSetsIdAcceptsUrns() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $writer->getId()); } public function testSetIdThrowsExceptionOnInvalidParameter() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->setId(''); $this->fail(); @@ -323,7 +323,7 @@ public function testSetIdThrowsExceptionOnInvalidParameter() public function testSetIdThrowsExceptionOnInvalidUri() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->setId('http://'); $this->fail(); @@ -333,20 +333,20 @@ public function testSetIdThrowsExceptionOnInvalidUri() public function testGetIdReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $this->assertTrue(is_null($writer->getId())); } public function testSetsLanguage() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setLanguage('abc'); $this->assertEquals('abc', $writer->getLanguage()); } public function testSetLanguageThrowsExceptionOnInvalidParameter() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->setLanguage(''); $this->fail(); @@ -356,20 +356,20 @@ public function testSetLanguageThrowsExceptionOnInvalidParameter() public function testGetLanguageReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $this->assertTrue(is_null($writer->getLanguage())); } public function testSetsLink() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setLink('http://www.example.com/id'); $this->assertEquals('http://www.example.com/id', $writer->getLink()); } public function testSetLinkThrowsExceptionOnEmptyString() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->setLink(''); $this->fail(); @@ -379,7 +379,7 @@ public function testSetLinkThrowsExceptionOnEmptyString() public function testSetLinkThrowsExceptionOnInvalidUri() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->setLink('http://'); $this->fail(); @@ -389,20 +389,20 @@ public function testSetLinkThrowsExceptionOnInvalidUri() public function testGetLinkReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $this->assertTrue(is_null($writer->getLink())); } public function testSetsEncoding() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setEncoding('utf-16'); $this->assertEquals('utf-16', $writer->getEncoding()); } public function testSetEncodingThrowsExceptionOnInvalidParameter() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->setEncoding(''); $this->fail(); @@ -412,20 +412,20 @@ public function testSetEncodingThrowsExceptionOnInvalidParameter() public function testGetEncodingReturnsUtf8IfNotSet() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $this->assertEquals('UTF-8', $writer->getEncoding()); } public function testSetsTitle() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setTitle('abc'); $this->assertEquals('abc', $writer->getTitle()); } public function testSetTitleThrowsExceptionOnInvalidParameter() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->setTitle(''); $this->fail(); @@ -435,34 +435,34 @@ public function testSetTitleThrowsExceptionOnInvalidParameter() public function testGetTitleReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $this->assertTrue(is_null($writer->getTitle())); } public function testSetsGeneratorName() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setGenerator('ZFW'); $this->assertEquals(array('name'=>'ZFW'), $writer->getGenerator()); } public function testSetsGeneratorVersion() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setGenerator('ZFW', '1.0'); $this->assertEquals(array('name'=>'ZFW', 'version' => '1.0'), $writer->getGenerator()); } public function testSetsGeneratorUri() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setGenerator('ZFW', null, 'http://www.example.com'); $this->assertEquals(array('name'=>'ZFW', 'uri' => 'http://www.example.com'), $writer->getGenerator()); } public function testSetsGeneratorThrowsExceptionOnInvalidName() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->setGenerator(''); $this->fail(); @@ -472,7 +472,7 @@ public function testSetsGeneratorThrowsExceptionOnInvalidName() public function testSetsGeneratorThrowsExceptionOnInvalidVersion() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->addAuthor('ZFW', ''); $this->fail(); @@ -483,7 +483,7 @@ public function testSetsGeneratorThrowsExceptionOnInvalidVersion() public function testSetsGeneratorThrowsExceptionOnInvalidUri() { $this->markTestSkipped('Skipped until Zend\URI is refactored for validation'); - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->setGenerator('ZFW', null, 'notauri'); $this->fail(); @@ -493,20 +493,20 @@ public function testSetsGeneratorThrowsExceptionOnInvalidUri() public function testGetGeneratorReturnsNullIfDateNotSet() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $this->assertTrue(is_null($writer->getGenerator())); } public function testSetsFeedLink() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setFeedLink('http://www.example.com/rss', 'RSS'); $this->assertEquals(array('rss'=>'http://www.example.com/rss'), $writer->getFeedLinks()); } public function testSetsFeedLinkThrowsExceptionOnInvalidType() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->setFeedLink('http://www.example.com/rss', 'abc'); $this->fail(); @@ -516,7 +516,7 @@ public function testSetsFeedLinkThrowsExceptionOnInvalidType() public function testSetsFeedLinkThrowsExceptionOnInvalidUri() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->setFeedLink('http://', 'rss'); $this->fail(); @@ -526,20 +526,20 @@ public function testSetsFeedLinkThrowsExceptionOnInvalidUri() public function testGetFeedLinksReturnsNullIfNotSet() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $this->assertTrue(is_null($writer->getFeedLinks())); } public function testSetsBaseUrl() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->setBaseUrl('http://www.example.com'); $this->assertEquals('http://www.example.com', $writer->getBaseUrl()); } public function testSetsBaseUrlThrowsExceptionOnInvalidUri() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->setBaseUrl('http://'); $this->fail(); @@ -549,27 +549,27 @@ public function testSetsBaseUrlThrowsExceptionOnInvalidUri() public function testGetBaseUrlReturnsNullIfNotSet() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $this->assertTrue(is_null($writer->getBaseUrl())); } public function testAddsHubUrl() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->addHub('http://www.example.com/hub'); $this->assertEquals(array('http://www.example.com/hub'), $writer->getHubs()); } public function testAddsManyHubUrls() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->addHubs(array('http://www.example.com/hub', 'http://www.example.com/hub2')); $this->assertEquals(array('http://www.example.com/hub', 'http://www.example.com/hub2'), $writer->getHubs()); } public function testAddingHubUrlThrowsExceptionOnInvalidUri() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->addHub('http://'); $this->fail(); @@ -579,34 +579,34 @@ public function testAddingHubUrlThrowsExceptionOnInvalidUri() public function testAddingHubUrlReturnsNullIfNotSet() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $this->assertTrue(is_null($writer->getHubs())); } public function testCreatesNewEntryDataContainer() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $entry = $writer->createEntry(); $this->assertTrue($entry instanceof \Zend\Feed\Writer\Entry); } public function testAddsCategory() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->addCategory(array('term'=>'cat_dog')); $this->assertEquals(array(array('term'=>'cat_dog')), $writer->getCategories()); } public function testAddsManyCategories() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $writer->addCategories(array(array('term'=>'cat_dog'),array('term'=>'cat_mouse'))); $this->assertEquals(array(array('term'=>'cat_dog'),array('term'=>'cat_mouse')), $writer->getCategories()); } public function testAddingCategoryWithoutTermThrowsException() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->addCategory(array('label' => 'Cats & Dogs', 'scheme' => 'http://www.example.com/schema1')); $this->fail(); @@ -616,7 +616,7 @@ public function testAddingCategoryWithoutTermThrowsException() public function testAddingCategoryWithInvalidUriAsSchemeThrowsException() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; try { $writer->addCategory(array('term' => 'cat_dog', 'scheme' => 'http://')); $this->fail(); @@ -626,13 +626,13 @@ public function testAddingCategoryWithInvalidUriAsSchemeThrowsException() public function testGetCategoriesReturnsNullIfNotSet() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $this->assertTrue(is_null($writer->getCategories())); } public function testAddsAndOrdersEntriesByDateIfRequested() { - $writer = new WriterFeed\Feed; + $writer = new WriterFeed; $entry = $writer->createEntry(); $entry->setDateCreated(1234567890); $entry2 = $writer->createEntry(); diff --git a/test/Writer/Renderer/Entry/AtomTest.php b/test/Writer/Renderer/Entry/AtomTest.php index e083a80e..89e2bbef 100644 --- a/test/Writer/Renderer/Entry/AtomTest.php +++ b/test/Writer/Renderer/Entry/AtomTest.php @@ -45,7 +45,7 @@ class AtomTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->_validWriter = new \Zend\Feed\Writer\Feed\Feed; + $this->_validWriter = new \Zend\Feed\Writer\Feed; $this->_validWriter->setType('atom'); @@ -74,7 +74,7 @@ public function tearDown() public function testRenderMethodRunsMinimalWriterContainerProperlyBeforeICheckAtomCompliance() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Atom($this->_validWriter); try { $renderer->render(); } catch (\Zend\Feed\Exception $e) { @@ -85,7 +85,7 @@ public function testRenderMethodRunsMinimalWriterContainerProperlyBeforeICheckAt public function testEntryEncodingHasBeenSet() { $this->_validWriter->setEncoding('iso-8859-1'); - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Atom($this->_validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('iso-8859-1', $entry->getEncoding()); @@ -93,7 +93,7 @@ public function testEntryEncodingHasBeenSet() public function testEntryEncodingDefaultIsUsedIfEncodingNotSetByHand() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Atom($this->_validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('UTF-8', $entry->getEncoding()); @@ -101,7 +101,7 @@ public function testEntryEncodingDefaultIsUsedIfEncodingNotSetByHand() public function testEntryTitleHasBeenSet() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Atom($this->_validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('This is a test entry.', $entry->getTitle()); @@ -110,14 +110,14 @@ public function testEntryTitleHasBeenSet() public function testFeedTitleIfMissingThrowsException() { $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $this->_validEntry->remove('title'); $atomFeed->render(); } public function testEntrySummaryDescriptionHasBeenSet() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Atom($this->_validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('This is a test entry description.', $entry->getDescription()); @@ -128,7 +128,7 @@ public function testEntrySummaryDescriptionHasBeenSet() */ public function testEntryContentHasBeenSet_Xhtml() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Atom($this->_validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('

This is test content for xhtml:

', $entry->getContent()); @@ -137,7 +137,7 @@ public function testEntryContentHasBeenSet_Xhtml() public function testFeedContentIfMissingThrowsExceptionIfThereIsNoLink() { $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $this->_validEntry->remove('content'); $this->_validEntry->remove('link'); $atomFeed->render(); @@ -145,7 +145,7 @@ public function testFeedContentIfMissingThrowsExceptionIfThereIsNoLink() public function testEntryUpdatedDateHasBeenSet() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Atom($this->_validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals(1234567890, $entry->getDateModified()->get(Date\Date::TIMESTAMP)); @@ -154,14 +154,14 @@ public function testEntryUpdatedDateHasBeenSet() public function testFeedUpdatedDateIfMissingThrowsException() { $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $this->_validEntry->remove('dateModified'); $atomFeed->render(); } public function testEntryPublishedDateHasBeenSet() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Atom($this->_validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals(1234567000, $entry->getDateCreated()->get(Date\Date::TIMESTAMP)); @@ -169,7 +169,7 @@ public function testEntryPublishedDateHasBeenSet() public function testEntryIncludesLinkToHtmlVersionOfFeed() { - $renderer= new Atom\Atom($this->_validWriter); + $renderer= new Atom($this->_validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('http://www.example.com/1', $entry->getLink()); @@ -177,7 +177,7 @@ public function testEntryIncludesLinkToHtmlVersionOfFeed() public function testEntryHoldsAnyAuthorAdded() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Atom($this->_validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $author = $entry->getAuthor(); @@ -189,7 +189,7 @@ public function testEntryHoldsAnyAuthorAdded() public function testEntryHoldsAnyEnclosureAdded() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Atom($this->_validWriter); $this->_validEntry->setEnclosure(array( 'type' => 'audio/mpeg', 'length' => '1337', @@ -206,7 +206,7 @@ public function testEntryHoldsAnyEnclosureAdded() public function testEntryIdHasBeenSet() { $this->_validEntry->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Atom($this->_validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $entry->getId()); @@ -214,7 +214,7 @@ public function testEntryIdHasBeenSet() public function testFeedIdDefaultIsUsedIfNotSetByHand() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Atom($this->_validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); $this->assertEquals($entry->getLink(), $entry->getId()); @@ -223,7 +223,7 @@ public function testFeedIdDefaultIsUsedIfNotSetByHand() public function testFeedIdIfMissingThrowsException() { $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $this->_validEntry->remove('id'); $this->_validEntry->remove('link'); $atomFeed->render(); @@ -233,7 +233,7 @@ public function testFeedIdThrowsExceptionIfNotUri() { $this->markTestSkipped('Skipped until Zend\URI is refactored for validation'); $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $this->_validEntry->remove('id'); $this->_validEntry->remove('link'); $this->_validEntry->setId('not-a-uri'); @@ -242,7 +242,7 @@ public function testFeedIdThrowsExceptionIfNotUri() public function testCommentLinkRendered() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Atom($this->_validWriter); $this->_validEntry->setCommentLink('http://www.example.com/id/1'); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); @@ -251,7 +251,7 @@ public function testCommentLinkRendered() public function testCommentCountRendered() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Atom($this->_validWriter); $this->_validEntry->setCommentCount(22); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); @@ -264,7 +264,7 @@ public function testCategoriesCanBeSet() array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2') )); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $entry = $feed->current(); @@ -277,7 +277,7 @@ public function testCategoriesCanBeSet() public function testCommentFeedLinksRendered() { - $renderer = new Atom\Atom($this->_validWriter); + $renderer = new Atom($this->_validWriter); $this->_validEntry->setCommentFeedLinks(array( array('uri'=>'http://www.example.com/atom/id/1','type'=>'atom'), array('uri'=>'http://www.example.com/rss/id/1','type'=>'rss'), diff --git a/test/Writer/Renderer/Entry/RSSTest.php b/test/Writer/Renderer/Entry/RSSTest.php index 550d067b..8257285d 100644 --- a/test/Writer/Renderer/Entry/RSSTest.php +++ b/test/Writer/Renderer/Entry/RSSTest.php @@ -45,7 +45,7 @@ class RSSTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->_validWriter = new \Zend\Feed\Writer\Feed\Feed; + $this->_validWriter = new \Zend\Feed\Writer\Feed; $this->_validWriter->setType('rss'); diff --git a/test/Writer/Renderer/Feed/AtomTest.php b/test/Writer/Renderer/Feed/AtomTest.php index 54063133..0982d0ad 100644 --- a/test/Writer/Renderer/Feed/AtomTest.php +++ b/test/Writer/Renderer/Feed/AtomTest.php @@ -44,7 +44,7 @@ class AtomTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->_validWriter = new Feed\Feed; + $this->_validWriter = new Feed; $this->_validWriter->setTitle('This is a test feed.'); $this->_validWriter->setDescription('This is a test description.'); $this->_validWriter->setDateModified(1234567890); @@ -62,14 +62,14 @@ public function tearDown() public function testSetsWriterInConstructor() { - $writer = new Feed\Feed; - $feed = new Atom\Atom($writer); - $this->assertTrue($feed->getDataContainer() instanceof Feed\Feed); + $writer = new Feed; + $feed = new Atom($writer); + $this->assertTrue($feed->getDataContainer() instanceof Feed); } public function testBuildMethodRunsMinimalWriterContainerProperlyBeforeICheckAtomCompliance() { - $feed = new Atom\Atom($this->_validWriter); + $feed = new Atom($this->_validWriter); try { $feed->render(); } catch (\Zend\Feed\Exception $e) { @@ -80,7 +80,7 @@ public function testBuildMethodRunsMinimalWriterContainerProperlyBeforeICheckAto public function testFeedEncodingHasBeenSet() { $this->_validWriter->setEncoding('iso-8859-1'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('iso-8859-1', $feed->getEncoding()); @@ -88,7 +88,7 @@ public function testFeedEncodingHasBeenSet() public function testFeedEncodingDefaultIsUsedIfEncodingNotSetByHand() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('UTF-8', $feed->getEncoding()); @@ -96,7 +96,7 @@ public function testFeedEncodingDefaultIsUsedIfEncodingNotSetByHand() public function testFeedTitleHasBeenSet() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('This is a test feed.', $feed->getTitle()); @@ -105,7 +105,7 @@ public function testFeedTitleHasBeenSet() public function testFeedTitleIfMissingThrowsException() { $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $this->_validWriter->remove('title'); $atomFeed->render(); } @@ -115,7 +115,7 @@ public function testFeedTitleIfMissingThrowsException() */ public function testFeedTitleCharDataEncoding() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $this->_validWriter->setTitle('<>&\'"áéíóú'); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); @@ -124,7 +124,7 @@ public function testFeedTitleCharDataEncoding() public function testFeedSubtitleHasBeenSet() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('This is a test description.', $feed->getDescription()); @@ -132,7 +132,7 @@ public function testFeedSubtitleHasBeenSet() public function testFeedSubtitleThrowsNoExceptionIfMissing() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $this->_validWriter->remove('description'); $atomFeed->render(); } @@ -142,7 +142,7 @@ public function testFeedSubtitleThrowsNoExceptionIfMissing() */ public function testFeedSubtitleCharDataEncoding() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $this->_validWriter->setDescription('<>&\'"áéíóú'); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); @@ -151,7 +151,7 @@ public function testFeedSubtitleCharDataEncoding() public function testFeedUpdatedDateHasBeenSet() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals(1234567890, $feed->getDateModified()->get(\Zend\Date\Date::TIMESTAMP)); @@ -160,7 +160,7 @@ public function testFeedUpdatedDateHasBeenSet() public function testFeedUpdatedDateIfMissingThrowsException() { $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $this->_validWriter->remove('dateModified'); $atomFeed->render(); } @@ -168,7 +168,7 @@ public function testFeedUpdatedDateIfMissingThrowsException() public function testFeedGeneratorHasBeenSet() { $this->_validWriter->setGenerator('FooFeedBuilder', '1.00', 'http://www.example.com'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('FooFeedBuilder', $feed->getGenerator()); @@ -176,14 +176,14 @@ public function testFeedGeneratorHasBeenSet() public function testFeedGeneratorIfMissingThrowsNoException() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $this->_validWriter->remove('generator'); $atomFeed->render(); } public function testFeedGeneratorDefaultIsUsedIfGeneratorNotSetByHand() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('Zend_Feed_Writer', $feed->getGenerator()); @@ -195,7 +195,7 @@ public function testFeedGeneratorDefaultIsUsedIfGeneratorNotSetByHand() public function testFeedGeneratorCharDataEncoding() { $this->_validWriter->setGenerator('<>&\'"áéíóú', '1.00', 'http://www.example.com'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('<>&\'"áéíóú', $feed->getGenerator()); @@ -204,7 +204,7 @@ public function testFeedGeneratorCharDataEncoding() public function testFeedLanguageHasBeenSet() { $this->_validWriter->setLanguage('fr'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('fr', $feed->getLanguage()); @@ -212,14 +212,14 @@ public function testFeedLanguageHasBeenSet() public function testFeedLanguageIfMissingThrowsNoException() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $this->_validWriter->remove('language'); $atomFeed->render(); } public function testFeedLanguageDefaultIsUsedIfGeneratorNotSetByHand() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals(null, $feed->getLanguage()); @@ -227,7 +227,7 @@ public function testFeedLanguageDefaultIsUsedIfGeneratorNotSetByHand() public function testFeedIncludesLinkToHtmlVersionOfFeed() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('http://www.example.com', $feed->getLink()); @@ -235,7 +235,7 @@ public function testFeedIncludesLinkToHtmlVersionOfFeed() public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsNoExceptionIfIdSet() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $this->_validWriter->setId('http://www.example.com'); $this->_validWriter->remove('link'); $atomFeed->render(); @@ -244,14 +244,14 @@ public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsNoExceptionIfIdSet public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsExceptionIfIdMissing() { $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $this->_validWriter->remove('link'); $atomFeed->render(); } public function testFeedIncludesLinkToXmlAtomWhereTheFeedWillBeAvailable() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('http://www.example.com/atom', $feed->getFeedLink()); @@ -260,14 +260,14 @@ public function testFeedIncludesLinkToXmlAtomWhereTheFeedWillBeAvailable() public function testFeedLinkToXmlAtomWhereTheFeedWillBeAvailableIfMissingThrowsException() { $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $this->_validWriter->remove('feedLinks'); $atomFeed->render(); } public function testFeedHoldsAnyAuthorAdded() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $author = $feed->getAuthor(); @@ -282,7 +282,7 @@ public function testFeedHoldsAnyAuthorAdded() */ public function testFeedAuthorCharDataEncoding() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $this->_validWriter->remove('authors'); $this->_validWriter->addAuthor(array( 'email'=>'<>&\'"áéíóú', @@ -310,7 +310,7 @@ public function testFeedAuthorIfNotSetThrowsNoExceptionIfAllEntriesIncludeAtLeas public function testFeedIdHasBeenSet() { $this->_validWriter->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $feed->getId()); @@ -318,7 +318,7 @@ public function testFeedIdHasBeenSet() public function testFeedIdDefaultOfHtmlLinkIsUsedIfNotSetByHand() { - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals($feed->getLink(), $feed->getId()); @@ -327,7 +327,7 @@ public function testFeedIdDefaultOfHtmlLinkIsUsedIfNotSetByHand() public function testBaseUrlCanBeSet() { $this->_validWriter->setBaseUrl('http://www.example.com/base'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('http://www.example.com/base', $feed->getBaseUrl()); @@ -336,7 +336,7 @@ public function testBaseUrlCanBeSet() public function testCopyrightCanBeSet() { $this->_validWriter->setCopyright('Copyright © 2009 Paddy'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('Copyright © 2009 Paddy', $feed->getCopyright()); @@ -345,7 +345,7 @@ public function testCopyrightCanBeSet() public function testCopyrightCharDataEncoding() { $this->_validWriter->setCopyright('<>&\'"áéíóú'); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $this->assertEquals('<>&\'"áéíóú', $feed->getCopyright()); @@ -357,7 +357,7 @@ public function testCategoriesCanBeSet() array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2') )); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $expected = array( @@ -373,7 +373,7 @@ public function testCategoriesCharDataEncoding() array('term'=>'cat_dog', 'label' => '<>&\'"áéíóú', 'scheme' => 'http://example.com/schema1'), array('term'=>'cat_dog2') )); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $expected = array( @@ -388,7 +388,7 @@ public function testHubsCanBeSet() $this->_validWriter->addHubs( array('http://www.example.com/hub', 'http://www.example.com/hub2') ); - $atomFeed = new Atom\Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); $expected = array( diff --git a/test/Writer/Renderer/Feed/RSSTest.php b/test/Writer/Renderer/Feed/RSSTest.php index a8c19b9c..6ff6a13c 100644 --- a/test/Writer/Renderer/Feed/RSSTest.php +++ b/test/Writer/Renderer/Feed/RSSTest.php @@ -44,7 +44,7 @@ class RSSTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->_validWriter = new Feed\Feed; + $this->_validWriter = new Feed; $this->_validWriter->setTitle('This is a test feed.'); $this->_validWriter->setDescription('This is a test description.'); $this->_validWriter->setLink('http://www.example.com'); @@ -59,9 +59,9 @@ public function tearDown() public function testSetsWriterInConstructor() { - $writer = new Feed\Feed; + $writer = new Feed; $feed = new RendererFeed\RSS($writer); - $this->assertTrue($feed->getDataContainer() instanceof Feed\Feed); + $this->assertTrue($feed->getDataContainer() instanceof Feed); } public function testBuildMethodRunsMinimalWriterContainerProperlyBeforeICheckRssCompliance() From 8743e00dd56e67eccc1f2d98a2552ed3c0b7fb97 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Mon, 12 Jul 2010 17:20:47 -0400 Subject: [PATCH 148/238] Renamed abstract classes - Found last remaining cases of Abstract, and renamed to Abstract; updated all code that referenced these instances, including tests. --- src/Writer/Feed/FeedAbstract.php | 805 ------------------------------- 1 file changed, 805 deletions(-) delete mode 100644 src/Writer/Feed/FeedAbstract.php diff --git a/src/Writer/Feed/FeedAbstract.php b/src/Writer/Feed/FeedAbstract.php deleted file mode 100644 index 3699283a..00000000 --- a/src/Writer/Feed/FeedAbstract.php +++ /dev/null @@ -1,805 +0,0 @@ -_loadExtensions(); - } - - /** - * Set a single author - * - * @param int $index - * @return string|null - */ - public function addAuthor($name, $email = null, $uri = null) - { - $author = array(); - if (is_array($name)) { - if (!array_key_exists('name', $name) || empty($name['name']) || !is_string($name['name'])) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); - } - $author['name'] = $name['name']; - if (isset($name['email'])) { - if (empty($name['email']) || !is_string($name['email'])) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); - } - $author['email'] = $name['email']; - } - if (isset($name['uri'])) { - if (empty($name['uri']) || !is_string($name['uri']) || !Zend_Uri::check($name['uri'])) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); - } - $author['uri'] = $name['uri']; - } - } else { - if (empty($name['name']) || !is_string($name['name'])) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string value'); - } - $author['name'] = $name; - if (isset($email)) { - if (empty($email) || !is_string($email)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "email" value must be a non-empty string'); - } - $author['email'] = $email; - } - if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); - } - $author['uri'] = $uri; - } - } - $this->_data['authors'][] = $author; - } - - /** - * Set an array with feed authors - * - * @return array - */ - public function addAuthors(array $authors) - { - foreach($authors as $author) { - $this->addAuthor($author); - } - } - - /** - * Set the copyright entry - * - * @return string|null - */ - public function setCopyright($copyright) - { - if (empty($copyright) || !is_string($copyright)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['copyright'] = $copyright; - } - - /** - * Set the feed creation date - * - * @param null|integer|Zend_Date - */ - public function setDateCreated($date = null) - { - $zdate = null; - if (is_null($date)) { - $zdate = new Zend_Date; - } elseif (ctype_digit($date) && strlen($date) == 10) { - $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); - } elseif ($date instanceof Zend_Date) { - $zdate = $date; - } else { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); - } - $this->_data['dateCreated'] = $zdate; - } - - /** - * Set the feed modification date - * - * @param null|integer|Zend_Date - */ - public function setDateModified($date = null) - { - $zdate = null; - if (is_null($date)) { - $zdate = new Zend_Date; - } elseif (ctype_digit($date) && strlen($date) == 10) { - $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); - } elseif ($date instanceof Zend_Date) { - $zdate = $date; - } else { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); - } - $this->_data['dateModified'] = $zdate; - } - - /** - * Set the feed last-build date. Ignored for Atom 1.0. - * - * @param null|integer|Zend_Date - */ - public function setLastBuildDate($date = null) - { - $zdate = null; - if (is_null($date)) { - $zdate = new Zend_Date; - } elseif (ctype_digit($date) && strlen($date) == 10) { - $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); - } elseif ($date instanceof Zend_Date) { - $zdate = $date; - } else { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); - } - $this->_data['lastBuildDate'] = $zdate; - } - - /** - * Set the feed description - * - * @return string|null - */ - public function setDescription($description) - { - if (empty($description) || !is_string($description)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['description'] = $description; - } - - /** - * Set the feed generator entry - * - * @return string|null - */ - public function setGenerator($name, $version = null, $uri = null) - { - if (is_array($name)) { - $data = $name; - if (empty($data['name']) || !is_string($data['name'])) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string'); - } - $generator = array('name' => $data['name']); - if (isset($data['version'])) { - if (empty($data['version']) || !is_string($data['version'])) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "version" must be a non-empty string'); - } - $generator['version'] = $data['version']; - } - if (isset($data['uri'])) { - if (empty($data['uri']) || !is_string($data['uri']) || !Zend_Uri::check($data['uri'])) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); - } - $generator['uri'] = $data['uri']; - } - } else { - if (empty($name) || !is_string($name)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string'); - } - $generator = array('name' => $name); - if (isset($version)) { - if (empty($version) || !is_string($version)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "version" must be a non-empty string'); - } - $generator['version'] = $version; - } - if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); - } - $generator['uri'] = $uri; - } - } - $this->_data['generator'] = $generator; - } - - /** - * Set the feed ID - URI or URN (via PCRE pattern) supported - * - * @param string $id - */ - public function setId($id) - { - if ((empty($id) || !is_string($id) || !Zend_Uri::check($id)) && - !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); - } - $this->_data['id'] = $id; - } - - /** - * Set a feed image (URI at minimum). Parameter is a single array with the - * required key 'uri'. When rendering as RSS, the required keys are 'uri', - * 'title' and 'link'. RSS also specifies three optional parameters 'width', - * 'height' and 'description'. Only 'uri' is required and used for Atom rendering. - * - * @param array $data - */ - public function setImage(array $data) - { - if (empty($data['uri']) || !is_string($data['uri']) - || !Zend_Uri::check($data['uri'])) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: parameter \'uri\'' - . ' must be a non-empty string and valid URI/IRI'); - } - $this->_data['image'] = $data; - } - - /** - * Set the feed language - * - * @return string|null - */ - public function setLanguage($language) - { - if (empty($language) || !is_string($language)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['language'] = $language; - } - - /** - * Set a link to the HTML source - * - * @param string $link - */ - public function setLink($link) - { - if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); - } - $this->_data['link'] = $link; - } - - /** - * Set a link to an XML feed for any feed type/version - * - * @return string|null - */ - public function setFeedLink($link, $type) - { - if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "link"" must be a non-empty string and valid URI/IRI'); - } - if (!in_array(strtolower($type), array('rss', 'rdf', 'atom'))) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom'); - } - $this->_data['feedLinks'][strtolower($type)] = $link; - } - - /** - * Set the feed title - * - * @return string|null - */ - public function setTitle($title) - { - if (empty($title) || !is_string($title)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['title'] = $title; - } - - /** - * Set the feed character encoding - * - * @param string $encoding - */ - public function setEncoding($encoding) - { - if (empty($encoding) || !is_string($encoding)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['encoding'] = $encoding; - } - - /** - * Set the feed's base URL - * - * @param string $url - */ - public function setBaseUrl($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "url" array value' - . ' must be a non-empty string and valid URI/IRI'); - } - $this->_data['baseUrl'] = $url; - } - - /** - * Add a Pubsubhubbub hub endpoint URL - * - * @param string $url - */ - public function addHub($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Invalid parameter: "url" array value' - . ' must be a non-empty string and valid URI/IRI'); - } - if (!isset($this->_data['hubs'])) { - $this->_data['hubs'] = array(); - } - $this->_data['hubs'][] = $url; - } - - /** - * Add Pubsubhubbub hub endpoint URLs - * - * @param array $urls - */ - public function addHubs(array $urls) - { - foreach ($urls as $url) { - $this->addHub($url); - } - } - - /** - * Add a feed category - * - * @param string $category - */ - public function addCategory(array $category) - { - if (!isset($category['term'])) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Each category must be an array and ' - . 'contain at least a "term" element containing the machine ' - . ' readable category name'); - } - if (isset($category['scheme'])) { - if (empty($category['scheme']) - || !is_string($category['scheme']) - || !Zend_Uri::check($category['scheme']) - ) { - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('The Atom scheme or RSS domain of' - . ' a category must be a valid URI'); - } - } - if (!isset($this->_data['categories'])) { - $this->_data['categories'] = array(); - } - $this->_data['categories'][] = $category; - } - - /** - * Set an array of feed categories - * - * @param array $categories - */ - public function addCategories(array $categories) - { - foreach ($categories as $category) { - $this->addCategory($category); - } - } - - /** - * Get a single author - * - * @param int $index - * @return string|null - */ - public function getAuthor($index = 0) - { - if (isset($this->_data['authors'][$index])) { - return $this->_data['authors'][$index]; - } else { - return null; - } - } - - /** - * Get an array with feed authors - * - * @return array - */ - public function getAuthors() - { - if (!array_key_exists('authors', $this->_data)) { - return null; - } - return $this->_data['authors']; - } - - /** - * Get the copyright entry - * - * @return string|null - */ - public function getCopyright() - { - if (!array_key_exists('copyright', $this->_data)) { - return null; - } - return $this->_data['copyright']; - } - - /** - * Get the feed creation date - * - * @return string|null - */ - public function getDateCreated() - { - if (!array_key_exists('dateCreated', $this->_data)) { - return null; - } - return $this->_data['dateCreated']; - } - - /** - * Get the feed modification date - * - * @return string|null - */ - public function getDateModified() - { - if (!array_key_exists('dateModified', $this->_data)) { - return null; - } - return $this->_data['dateModified']; - } - - /** - * Get the feed last-build date - * - * @return string|null - */ - public function getLastBuildDate() - { - if (!array_key_exists('lastBuildDate', $this->_data)) { - return null; - } - return $this->_data['lastBuildDate']; - } - - /** - * Get the feed description - * - * @return string|null - */ - public function getDescription() - { - if (!array_key_exists('description', $this->_data)) { - return null; - } - return $this->_data['description']; - } - - /** - * Get the feed generator entry - * - * @return string|null - */ - public function getGenerator() - { - if (!array_key_exists('generator', $this->_data)) { - return null; - } - return $this->_data['generator']; - } - - /** - * Get the feed ID - * - * @return string|null - */ - public function getId() - { - if (!array_key_exists('id', $this->_data)) { - return null; - } - return $this->_data['id']; - } - - /** - * Get the feed image URI - * - * @return array - */ - public function getImage() - { - if (!array_key_exists('image', $this->_data)) { - return null; - } - return $this->_data['image']; - } - - /** - * Get the feed language - * - * @return string|null - */ - public function getLanguage() - { - if (!array_key_exists('language', $this->_data)) { - return null; - } - return $this->_data['language']; - } - - /** - * Get a link to the HTML source - * - * @return string|null - */ - public function getLink() - { - if (!array_key_exists('link', $this->_data)) { - return null; - } - return $this->_data['link']; - } - - /** - * Get a link to the XML feed - * - * @return string|null - */ - public function getFeedLinks() - { - if (!array_key_exists('feedLinks', $this->_data)) { - return null; - } - return $this->_data['feedLinks']; - } - - /** - * Get the feed title - * - * @return string|null - */ - public function getTitle() - { - if (!array_key_exists('title', $this->_data)) { - return null; - } - return $this->_data['title']; - } - - /** - * Get the feed character encoding - * - * @return string|null - */ - public function getEncoding() - { - if (!array_key_exists('encoding', $this->_data)) { - return 'UTF-8'; - } - return $this->_data['encoding']; - } - - /** - * Get the feed's base url - * - * @return string|null - */ - public function getBaseUrl() - { - if (!array_key_exists('baseUrl', $this->_data)) { - return null; - } - return $this->_data['baseUrl']; - } - - /** - * Get the URLs used as Pubsubhubbub hubs endpoints - * - * @return string|null - */ - public function getHubs() - { - if (!array_key_exists('hubs', $this->_data)) { - return null; - } - return $this->_data['hubs']; - } - - /** - * Get the feed categories - * - * @return string|null - */ - public function getCategories() - { - if (!array_key_exists('categories', $this->_data)) { - return null; - } - return $this->_data['categories']; - } - - /** - * Resets the instance and deletes all data - * - * @return void - */ - public function reset() - { - $this->_data = array(); - } - - /** - * Set the current feed type being exported to "rss" or "atom". This allows - * other objects to gracefully choose whether to execute or not, depending - * on their appropriateness for the current type, e.g. renderers. - * - * @param string $type - */ - public function setType($type) - { - $this->_type = $type; - } - - /** - * Retrieve the current or last feed type exported. - * - * @return string Value will be "rss" or "atom" - */ - public function getType() - { - return $this->_type; - } - - /** - * Unset a specific data point - * - * @param string $name - */ - public function remove($name) - { - if (isset($this->_data[$name])) { - unset($this->_data[$name]); - } - } - - /** - * Method overloading: call given method on first extension implementing it - * - * @param string $method - * @param array $args - * @return mixed - * @throws Zend_Feed_Exception if no extensions implements the method - */ - public function __call($method, $args) - { - foreach ($this->_extensions as $extension) { - try { - return call_user_func_array(array($extension, $method), $args); - } catch (Zend_Feed_Writer_Exception_InvalidMethodException $e) { - } - } - require_once 'Zend/Feed/Exception.php'; - throw new Zend_Feed_Exception('Method: ' . $method - . ' does not exist and could not be located on a registered Extension'); - } - - /** - * Load extensions from Zend_Feed_Writer - * - * @return void - */ - protected function _loadExtensions() - { - $all = Zend_Feed_Writer::getExtensions(); - $exts = $all['feed']; - foreach ($exts as $ext) { - $className = Zend_Feed_Writer::getPluginLoader()->getClassName($ext); - $this->_extensions[$ext] = new $className(); - $this->_extensions[$ext]->setEncoding($this->getEncoding()); - } - } -} From 0a094b077a298f36480b30d17c5a8063e1f11e1e Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 13 Jul 2010 09:11:03 -0400 Subject: [PATCH 149/238] Moved Reader\Feed\Atom\Atom up one level - Moved Reader\Feed\Atom\Atom to Reader\Feed\Atom - Fixed related tests, as well as other failing tests encountered --- src/Reader/Extension/AbstractFeed.php | 2 +- src/Reader/Feed/{Atom => }/Atom.php | 2 +- src/Reader/Feed/Atom/Source.php | 6 ++++-- src/Reader/Reader.php | 6 +++--- test/Reader/Feed/AtomTest.php | 12 ++++++------ test/ReaderTest.php | 4 ++-- 6 files changed, 17 insertions(+), 15 deletions(-) rename src/Reader/Feed/{Atom => }/Atom.php (99%) diff --git a/src/Reader/Extension/AbstractFeed.php b/src/Reader/Extension/AbstractFeed.php index dd2bc963..ce03b717 100644 --- a/src/Reader/Extension/AbstractFeed.php +++ b/src/Reader/Extension/AbstractFeed.php @@ -168,7 +168,7 @@ public function getXpathPrefix() /** * Set the XPath prefix * - * @return \Zend\Feed\Reader\Feed\Atom\Atom + * @return \Zend\Feed\Reader\Feed\Atom */ public function setXpathPrefix($prefix) { diff --git a/src/Reader/Feed/Atom/Atom.php b/src/Reader/Feed/Atom.php similarity index 99% rename from src/Reader/Feed/Atom/Atom.php rename to src/Reader/Feed/Atom.php index aa0c3f1a..4c968beb 100644 --- a/src/Reader/Feed/Atom/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -22,7 +22,7 @@ /** * @namespace */ -namespace Zend\Feed\Reader\Feed\Atom; +namespace Zend\Feed\Reader\Feed; use Zend\Feed\Reader; /** diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php index 5f3426b6..4164f9c3 100644 --- a/src/Reader/Feed/Atom/Source.php +++ b/src/Reader/Feed/Atom/Source.php @@ -23,11 +23,13 @@ * @namespace */ namespace Zend\Feed\Reader\Feed\Atom; -use Zend\Feed\Reader; + +use Zend\Feed\Reader\Feed\Atom, + Zend\Feed\Reader; /** * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Feed\Atom\Atom + * @uses \Zend\Feed\Reader\Feed\Atom * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Reader/Reader.php b/src/Reader/Reader.php index 115ecdf9..5a5d366a 100644 --- a/src/Reader/Reader.php +++ b/src/Reader/Reader.php @@ -33,7 +33,7 @@ * @uses \Zend\Feed\Feed * @uses \Zend\Feed\Exception * @uses \Zend\Feed\Reader\FeedSet - * @uses \Zend\Feed\Reader\Feed\Atom\Atom + * @uses \Zend\Feed\Reader\Feed\Atom * @uses \Zend\Feed\Reader\Feed\RSS * @uses \Zend\HTTP\Client * @uses \Zend\Loader\PluginLoader @@ -296,7 +296,7 @@ public static function importFeed(Feed\AbstractFeed $feed) if (substr($type, 0, 3) == 'rss') { $reader = new Feed\RSS($dom, $type); } else { - $reader = new Feed\Atom\Atom($dom, $type); + $reader = new Feed\Atom($dom, $type); } return $reader; @@ -336,7 +336,7 @@ public static function importString($string) } elseif (substr($type, 8, 5) == 'entry') { $reader = new Entry\Atom($dom->documentElement, 0, self::TYPE_ATOM_10); } elseif (substr($type, 0, 4) == 'atom') { - $reader = new Feed\Atom\Atom($dom, $type); + $reader = new Feed\Atom($dom, $type); } else { 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.'); diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 29369f3a..7e1549c9 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -231,7 +231,7 @@ public function testGetsDateModifiedFromAtom10() */ public function testGetsLastBuildDateAlwaysReturnsNullForAtom() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10.xml') ); $this->assertNull($feed->getLastBuildDate()); @@ -407,7 +407,7 @@ public function testGetsFeedLinkFromAtom10IfRelativeUri() public function testGetsOriginalSourceUriIfFeedLinkNotAvailableFromFeed() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/feedlink/plain/atom10_NoFeedLink.xml') ); $feed->setOriginalSourceUri('http://www.example.com/feed/atom'); @@ -521,7 +521,7 @@ public function testGetsCategoriesFromAtom03_None() */ public function testGetsImageFromAtom03() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/atom03.xml') ); $this->assertEquals(array('uri'=>'http://www.example.com/logo.gif'), $feed->getImage()); @@ -529,7 +529,7 @@ public function testGetsImageFromAtom03() public function testGetsImageFromAtom10() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/atom10.xml') ); $this->assertEquals(array('uri'=>'http://www.example.com/logo.gif'), $feed->getImage()); @@ -540,7 +540,7 @@ public function testGetsImageFromAtom10() */ public function testGetsImageFromAtom03_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/none/atom03.xml') ); $this->assertEquals(null, $feed->getImage()); @@ -548,7 +548,7 @@ public function testGetsImageFromAtom03_None() public function testGetsImageFromAtom10_None() { - $feed = Zend_Feed_Reader::importString( + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/image/plain/none/atom10.xml') ); $this->assertEquals(null, $feed->getImage()); diff --git a/test/ReaderTest.php b/test/ReaderTest.php index 9ce94575..f01d0cf0 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -128,8 +128,8 @@ public function testDetectsFeedIsAtom03() public function testDetectsTypeFromStringOrToRemindPaddyAboutForgettingATestWhichLetsAStupidTypoSurviveUnnoticedForMonths() { $feed = ''; - $type = Zend_Feed_Reader::detectType($feed); - $this->assertEquals(Zend_Feed_Reader::TYPE_RSS_10, $type); + $type = Reader\Reader::detectType($feed); + $this->assertEquals(Reader\Reader::TYPE_RSS_10, $type); } public function testGetEncoding() From e07d73bd621d2255cadba4dce17fa592c0d006cc Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 13 Jul 2010 09:14:36 -0400 Subject: [PATCH 150/238] Moved Collection up one level - moved Zend\Feed\Reader\Collection\Collection to Zend\Feed\Reader\Collection Is this class even used anywhere? found no references... --- src/Reader/{Collection => }/Collection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/Reader/{Collection => }/Collection.php (96%) diff --git a/src/Reader/Collection/Collection.php b/src/Reader/Collection.php similarity index 96% rename from src/Reader/Collection/Collection.php rename to src/Reader/Collection.php index bbc976ed..101b12cd 100644 --- a/src/Reader/Collection/Collection.php +++ b/src/Reader/Collection.php @@ -22,7 +22,7 @@ /** * @namespace */ -namespace Zend\Feed\Reader\Collection; +namespace Zend\Feed\Reader; /** * @uses ArrayObject From 8b72a508cce8a96502be5cf94bdde3f1dcbf14fc Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 13 Jul 2010 09:21:50 -0400 Subject: [PATCH 151/238] Removed Zend\Feed\Builder - Removed Zend\Feed\Builder; functionality superceded by Writer --- src/AbstractFeed.php | 11 +- src/Builder/Builder.php | 370 ------------------------------ src/Builder/BuilderInterface.php | 55 ----- src/Builder/Entry.php | 294 ------------------------ src/Builder/Exception.php | 38 --- src/Builder/Header/Header.php | 382 ------------------------------- src/Builder/Header/iTunes.php | 267 --------------------- src/Feed.php | 39 ---- test/ImportTest.php | 180 --------------- 9 files changed, 1 insertion(+), 1635 deletions(-) delete mode 100644 src/Builder/Builder.php delete mode 100644 src/Builder/BuilderInterface.php delete mode 100644 src/Builder/Entry.php delete mode 100644 src/Builder/Exception.php delete mode 100644 src/Builder/Header/Header.php delete mode 100644 src/Builder/Header/iTunes.php diff --git a/src/AbstractFeed.php b/src/AbstractFeed.php index 8e73a826..0ee12761 100644 --- a/src/AbstractFeed.php +++ b/src/AbstractFeed.php @@ -68,11 +68,10 @@ abstract class AbstractFeed extends Element implements \Iterator, \Countable * * @param string $uri The full URI of the feed to load, or NULL if not retrieved via HTTP or as an array. * @param string $string The feed as a string, or NULL if retrieved via HTTP or as an array. - * @param \Zend\Feed\Builder\BuilderInterface $builder The feed as a builder instance or NULL if retrieved as a string or via HTTP. * @return void * @throws \Zend\Feed\Exception If loading the feed failed. */ - public function __construct($uri = null, $string = null, Builder\BuilderInterface $builder = null) + public function __construct($uri = null, $string = null) { if ($uri !== null) { // Retrieve the feed via HTTP @@ -88,14 +87,6 @@ public function __construct($uri = null, $string = null, Builder\BuilderInterfac // Retrieve the feed from $string $this->_element = $string; $this->__wakeup(); - } else { - // Generate the feed from the array - $header = $builder->getHeader(); - $this->_element = new \DOMDocument('1.0', $header['charset']); - $root = $this->_mapFeedHeaders($header); - $this->_mapFeedEntries($root, $builder->getEntries()); - $this->_element = $root; - $this->_buildEntryCache(); } } diff --git a/src/Builder/Builder.php b/src/Builder/Builder.php deleted file mode 100644 index 8d4e78d0..00000000 --- a/src/Builder/Builder.php +++ /dev/null @@ -1,370 +0,0 @@ - - * array( - * 'title' => 'title of the feed', //required - * 'link' => 'canonical url to the feed', //required - * 'lastUpdate' => 'timestamp of the update date', // optional - * 'published' => 'timestamp of the publication date', //optional - * 'charset' => 'charset', // required - * 'description' => 'short description of the feed', //optional - * 'author' => 'author/publisher of the feed', //optional - * 'email' => 'email of the author', //optional - * 'webmaster' => 'email address for person responsible for technical issues' // optional, ignored if atom is used - * 'copyright' => 'copyright notice', //optional - * 'image' => 'url to image', //optional - * 'generator' => 'generator', // optional - * 'language' => 'language the feed is written in', // optional - * 'ttl' => 'how long in minutes a feed can be cached before refreshing', // optional, ignored if atom is used - * 'rating' => 'The PICS rating for the channel.', // optional, ignored if atom is used - * 'cloud' => array( - * 'domain' => 'domain of the cloud, e.g. rpc.sys.com' // required - * 'port' => 'port to connect to' // optional, default to 80 - * 'path' => 'path of the cloud, e.g. /RPC2 //required - * 'registerProcedure' => 'procedure to call, e.g. myCloud.rssPleaseNotify' // required - * 'protocol' => 'protocol to use, e.g. soap or xml-rpc' // required - * ), a cloud to be notified of updates // optional, ignored if atom is used - * 'textInput' => array( - * 'title' => 'the label of the Submit button in the text input area' // required, - * 'description' => 'explains the text input area' // required - * 'name' => 'the name of the text object in the text input area' // required - * 'link' => 'the URL of the CGI script that processes text input requests' // required - * ) // a text input box that can be displayed with the feed // optional, ignored if atom is used - * 'skipHours' => array( - * 'hour in 24 format', // e.g 13 (1pm) - * // up to 24 rows whose value is a number between 0 and 23 - * ) // Hint telling aggregators which hours they can skip // optional, ignored if atom is used - * 'skipDays ' => array( - * 'a day to skip', // e.g Monday - * // up to 7 rows whose value is a Monday, Tuesday, Wednesday, Thursday, Friday, Saturday or Sunday - * ) // Hint telling aggregators which days they can skip // optional, ignored if atom is used - * 'itunes' => array( - * 'author' => 'Artist column' // optional, default to the main author value - * 'owner' => array( - * 'name' => 'name of the owner' // optional, default to main author value - * 'email' => 'email of the owner' // optional, default to main email value - * ) // Owner of the podcast // optional - * 'image' => 'album/podcast art' // optional, default to the main image value - * 'subtitle' => 'short description' // optional, default to the main description value - * 'summary' => 'longer description' // optional, default to the main description value - * 'block' => 'Prevent an episode from appearing (yes|no)' // optional - * 'category' => array( - * array('main' => 'main category', // required - * 'sub' => 'sub category' // optional - * ), - * // up to 3 rows - * ) // 'Category column and in iTunes Music Store Browse' // required - * 'explicit' => 'parental advisory graphic (yes|no|clean)' // optional - * 'keywords' => 'a comma separated list of 12 keywords maximum' // optional - * 'new-feed-url' => 'used to inform iTunes of new feed URL location' // optional - * ) // Itunes extension data // optional, ignored if atom is used - * 'entries' => array( - * array( - * 'title' => 'title of the feed entry', //required - * 'link' => 'url to a feed entry', //required - * 'description' => 'short version of a feed entry', // only text, no html, required - * 'guid' => 'id of the article, if not given link value will used', //optional - * 'content' => 'long version', // can contain html, optional - * 'lastUpdate' => 'timestamp of the publication date', // optional - * 'comments' => 'comments page of the feed entry', // optional - * 'commentRss' => 'the feed url of the associated comments', // optional - * 'source' => array( - * 'title' => 'title of the original source' // required, - * 'url' => 'url of the original source' // required - * ) // original source of the feed entry // optional - * 'category' => array( - * array( - * 'term' => 'first category label' // required, - * 'scheme' => 'url that identifies a categorization scheme' // optional - * ), - * array( - * //data for the second category and so on - * ) - * ) // list of the attached categories // optional - * 'enclosure' => array( - * array( - * 'url' => 'url of the linked enclosure' // required - * 'type' => 'mime type of the enclosure' // optional - * 'length' => 'length of the linked content in octets' // optional - * ), - * array( - * //data for the second enclosure and so on - * ) - * ) // list of the enclosures of the feed entry // optional - * ), - * array( - * //data for the second entry and so on - * ) - * ) - * ); - * - * - * @param array $data - * @return void - */ - public function __construct(array $data) - { - $this->_data = $data; - $this->_createHeader($data); - if (isset($data['entries'])) { - $this->_createEntries($data['entries']); - } - } - - /** - * Returns an instance of Zend_Feed_Builder_Header - * describing the header of the feed - * - * @return \Zend\Feed\Builder\Header\Header - */ - public function getHeader() - { - return $this->_header; - } - - /** - * Returns an array of Zend_Feed_Builder_Entry instances - * describing the entries of the feed - * - * @return array of \Zend\Feed\Builder\Entry - */ - public function getEntries() - { - return $this->_entries; - } - - /** - * Create the Zend_Feed_Builder_Header instance - * - * @param array $data - * @throws \Zend\Feed\Builder\Exception - * @return void - */ - protected function _createHeader(array $data) - { - $mandatories = array('title', 'link', 'charset'); - foreach ($mandatories as $mandatory) { - if (!isset($data[$mandatory])) { - throw new Exception("$mandatory key is missing"); - } - } - $this->_header = new Header\Header($data['title'], $data['link'], $data['charset']); - if (isset($data['lastUpdate'])) { - $this->_header->setLastUpdate($data['lastUpdate']); - } - if (isset($data['published'])) { - $this->_header->setPublishedDate($data['published']); - } - if (isset($data['description'])) { - $this->_header->setDescription($data['description']); - } - if (isset($data['author'])) { - $this->_header->setAuthor($data['author']); - } - if (isset($data['email'])) { - $this->_header->setEmail($data['email']); - } - if (isset($data['webmaster'])) { - $this->_header->setWebmaster($data['webmaster']); - } - if (isset($data['copyright'])) { - $this->_header->setCopyright($data['copyright']); - } - if (isset($data['image'])) { - $this->_header->setImage($data['image']); - } - if (isset($data['generator'])) { - $this->_header->setGenerator($data['generator']); - } - if (isset($data['language'])) { - $this->_header->setLanguage($data['language']); - } - if (isset($data['ttl'])) { - $this->_header->setTtl($data['ttl']); - } - if (isset($data['rating'])) { - $this->_header->setRating($data['rating']); - } - if (isset($data['cloud'])) { - $mandatories = array('domain', 'path', 'registerProcedure', 'protocol'); - foreach ($mandatories as $mandatory) { - if (!isset($data['cloud'][$mandatory])) { - throw new Exception("you have to define $mandatory property of your cloud"); - } - } - $uri_str = 'http://' . $data['cloud']['domain'] . $data['cloud']['path']; - $this->_header->setCloud($uri_str, $data['cloud']['registerProcedure'], $data['cloud']['protocol']); - } - if (isset($data['textInput'])) { - $mandatories = array('title', 'description', 'name', 'link'); - foreach ($mandatories as $mandatory) { - if (!isset($data['textInput'][$mandatory])) { - throw new Exception("you have to define $mandatory property of your textInput"); - } - } - $this->_header->setTextInput($data['textInput']['title'], - $data['textInput']['description'], - $data['textInput']['name'], - $data['textInput']['link']); - } - if (isset($data['skipHours'])) { - $this->_header->setSkipHours($data['skipHours']); - } - if (isset($data['skipDays'])) { - $this->_header->setSkipDays($data['skipDays']); - } - if (isset($data['itunes'])) { - $itunes = new Header\iTunes($data['itunes']['category']); - if (isset($data['itunes']['author'])) { - $itunes->setAuthor($data['itunes']['author']); - } - if (isset($data['itunes']['owner'])) { - $name = isset($data['itunes']['owner']['name']) ? $data['itunes']['owner']['name'] : ''; - $email = isset($data['itunes']['owner']['email']) ? $data['itunes']['owner']['email'] : ''; - $itunes->setOwner($name, $email); - } - if (isset($data['itunes']['image'])) { - $itunes->setImage($data['itunes']['image']); - } - if (isset($data['itunes']['subtitle'])) { - $itunes->setSubtitle($data['itunes']['subtitle']); - } - if (isset($data['itunes']['summary'])) { - $itunes->setSummary($data['itunes']['summary']); - } - if (isset($data['itunes']['block'])) { - $itunes->setBlock($data['itunes']['block']); - } - if (isset($data['itunes']['explicit'])) { - $itunes->setExplicit($data['itunes']['explicit']); - } - if (isset($data['itunes']['keywords'])) { - $itunes->setKeywords($data['itunes']['keywords']); - } - if (isset($data['itunes']['new-feed-url'])) { - $itunes->setNewFeedUrl($data['itunes']['new-feed-url']); - } - - $this->_header->setITunes($itunes); - } - } - - /** - * Create the array of article entries - * - * @param array $data - * @throws \Zend\Feed\Builder\Exception - * @return void - */ - protected function _createEntries(array $data) - { - foreach ($data as $row) { - $mandatories = array('title', 'link', 'description'); - foreach ($mandatories as $mandatory) { - if (!isset($row[$mandatory])) { - throw new Exception("$mandatory key is missing"); - } - } - $entry = new Entry($row['title'], $row['link'], $row['description']); - if (isset($row['author'])) { - $entry->setAuthor($row['author']); - } - if (isset($row['guid'])) { - $entry->setId($row['guid']); - } - if (isset($row['content'])) { - $entry->setContent($row['content']); - } - if (isset($row['lastUpdate'])) { - $entry->setLastUpdate($row['lastUpdate']); - } - if (isset($row['comments'])) { - $entry->setCommentsUrl($row['comments']); - } - if (isset($row['commentRss'])) { - $entry->setCommentsRssUrl($row['commentRss']); - } - if (isset($row['source'])) { - $mandatories = array('title', 'url'); - foreach ($mandatories as $mandatory) { - if (!isset($row['source'][$mandatory])) { - throw new Exception("$mandatory key of source property is missing"); - } - } - $entry->setSource($row['source']['title'], $row['source']['url']); - } - if (isset($row['category'])) { - $entry->setCategories($row['category']); - } - if (isset($row['enclosure'])) { - $entry->setEnclosures($row['enclosure']); - } - - $this->_entries[] = $entry; - } - } -} diff --git a/src/Builder/BuilderInterface.php b/src/Builder/BuilderInterface.php deleted file mode 100644 index a53107a1..00000000 --- a/src/Builder/BuilderInterface.php +++ /dev/null @@ -1,55 +0,0 @@ -offsetSet('title', $title); - $this->offsetSet('link', $link); - $this->offsetSet('description', $description); - $this->setLastUpdate(time()); - } - - /** - * Read only properties accessor - * - * @param string $name property to read - * @return mixed - */ - public function __get($name) - { - if (!$this->offsetExists($name)) { - return NULL; - } - - return $this->offsetGet($name); - } - - /** - * Write properties accessor - * - * @param string $name name of the property to set - * @param mixed $value value to set - * @return void - */ - public function __set($name, $value) - { - $this->offsetSet($name, $value); - } - - /** - * Isset accessor - * - * @param string $key - * @return boolean - */ - public function __isset($key) - { - return $this->offsetExists($key); - } - - /** - * Unset accessor - * - * @param string $key - * @return void - */ - public function __unset($key) - { - if ($this->offsetExists($key)) { - $this->offsetUnset($key); - } - } - - /** - * 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 - * - * @param string $id - * @return \Zend\Feed\Builder\Entry - */ - public function setId($id) - { - $this->offsetSet('guid', $id); - return $this; - } - - /** - * Sets the full html content of the entry - * - * @param string $content - * @return \Zend\Feed\Builder\Entry - */ - public function setContent($content) - { - $this->offsetSet('content', $content); - return $this; - } - - /** - * Timestamp of the update date - * - * @param int $lastUpdate - * @return \Zend\Feed\Builder\Entry - */ - public function setLastUpdate($lastUpdate) - { - $this->offsetSet('lastUpdate', $lastUpdate); - return $this; - } - - /** - * Sets the url of the commented page associated to the entry - * - * @param string $comments - * @return \Zend\Feed\Builder\Entry - */ - public function setCommentsUrl($comments) - { - $this->offsetSet('comments', $comments); - return $this; - } - - /** - * Sets the url of the comments feed link - * - * @param string $commentRss - * @return \Zend\Feed\Builder\Entry - */ - public function setCommentsRssUrl($commentRss) - { - $this->offsetSet('commentRss', $commentRss); - return $this; - } - - /** - * Defines a reference to the original source - * - * @param string $title - * @param string $url - * @return \Zend\Feed\Builder\Entry - */ - public function setSource($title, $url) - { - $this->offsetSet('source', array('title' => $title, - 'url' => $url)); - return $this; - } - - /** - * Sets the categories of the entry - * Format of the array: - * - * array( - * array( - * 'term' => 'first category label', - * 'scheme' => 'url that identifies a categorization scheme' // optional - * ), - * // second category and so one - * ) - * - * - * @param array $categories - * @return \Zend\Feed\Builder\Entry - */ - public function setCategories(array $categories) - { - foreach ($categories as $category) { - $this->addCategory($category); - } - return $this; - } - - /** - * Add a category to the entry - * - * @param array $category see \Zend\Feed\Builder\Entry::setCategories() for format - * @return \Zend\Feed\Builder\Entry - * @throws \Zend\Feed\Builder\Exception - */ - public function addCategory(array $category) - { - if (empty($category['term'])) { - throw new Exception("you have to define the name of the category"); - } - - if (!$this->offsetExists('category')) { - $categories = array($category); - } else { - $categories = $this->offsetGet('category'); - $categories[] = $category; - } - $this->offsetSet('category', $categories); - return $this; - } - - /** - * Sets the enclosures of the entry - * Format of the array: - * - * array( - * array( - * 'url' => 'url of the linked enclosure', - * 'type' => 'mime type of the enclosure' // optional - * 'length' => 'length of the linked content in octets' // optional - * ), - * // second enclosure and so one - * ) - * - * - * @param array $enclosures - * @return \Zend\Feed\Builder\Entry - * @throws \Zend\Feed\Builder\Exception - */ - public function setEnclosures(array $enclosures) - { - foreach ($enclosures as $enclosure) { - if (empty($enclosure['url'])) { - throw new Exception("you have to supply an url for your enclosure"); - } - $type = isset($enclosure['type']) ? $enclosure['type'] : ''; - $length = isset($enclosure['length']) ? $enclosure['length'] : ''; - $this->addEnclosure($enclosure['url'], $type, $length); - } - return $this; - } - - /** - * Add an enclosure to the entry - * - * @param string $url - * @param string $type - * @param string $length - * @return \Zend\Feed\Builder\Entry - */ - public function addEnclosure($url, $type = '', $length = '') - { - if (!$this->offsetExists('enclosure')) { - $enclosure = array(); - } else { - $enclosure = $this->offsetGet('enclosure'); - } - $enclosure[] = array('url' => $url, - 'type' => $type, - 'length' => $length); - $this->offsetSet('enclosure', $enclosure); - return $this; - } -} diff --git a/src/Builder/Exception.php b/src/Builder/Exception.php deleted file mode 100644 index 8d718b04..00000000 --- a/src/Builder/Exception.php +++ /dev/null @@ -1,38 +0,0 @@ -offsetSet('title', $title); - $this->offsetSet('link', $link); - $this->offsetSet('charset', $charset); - $this->setLastUpdate(time()) - ->setGenerator('Zend_Feed'); - } - - /** - * Read only properties accessor - * - * @param string $name property to read - * @return mixed - */ - public function __get($name) - { - if (!$this->offsetExists($name)) { - return NULL; - } - - return $this->offsetGet($name); - } - - /** - * Write properties accessor - * - * @param string $name name of the property to set - * @param mixed $value value to set - * @return void - */ - public function __set($name, $value) - { - $this->offsetSet($name, $value); - } - - /** - * Isset accessor - * - * @param string $key - * @return boolean - */ - public function __isset($key) - { - return $this->offsetExists($key); - } - - /** - * Unset accessor - * - * @param string $key - * @return void - */ - public function __unset($key) - { - if ($this->offsetExists($key)) { - $this->offsetUnset($key); - } - } - - /** - * Timestamp of the update date - * - * @param int $lastUpdate - * @return \Zend\Feed\Builder\Header\Header - */ - public function setLastUpdate($lastUpdate) - { - $this->offsetSet('lastUpdate', $lastUpdate); - return $this; - } - - /** - * Timestamp of the publication date - * - * @param int $published - * @return \Zend\Feed\Builder\Header\Header - */ - public function setPublishedDate($published) - { - $this->offsetSet('published', $published); - return $this; - } - - /** - * Short description of the feed - * - * @param string $description - * @return \Zend\Feed\Builder\Header\Header - */ - public function setDescription($description) - { - $this->offsetSet('description', $description); - return $this; - } - - /** - * Sets the author of the feed - * - * @param string $author - * @return \Zend\Feed\Builder\Header\Header - */ - public function setAuthor($author) - { - $this->offsetSet('author', $author); - return $this; - } - - /** - * Sets the author's email - * - * @param string $email - * @return \Zend\Feed\Builder\Header\Header - * @throws \Zend\Feed\Builder\Exception - */ - public function setEmail($email) - { - $validate = new Validator\EmailAddress(); - if (!$validate->isValid($email)) { - throw new Builder\Exception("you have to set a valid email address into the email property"); - } - $this->offsetSet('email', $email); - return $this; - } - - /** - * Sets the copyright notice - * - * @param string $copyright - * @return \Zend\Feed\Builder\Header\Header - */ - public function setCopyright($copyright) - { - $this->offsetSet('copyright', $copyright); - return $this; - } - - /** - * Sets the image of the feed - * - * @param string $image - * @return \Zend\Feed\Builder\Header\Header - */ - public function setImage($image) - { - $this->offsetSet('image', $image); - return $this; - } - - /** - * Sets the generator of the feed - * - * @param string $generator - * @return \Zend\Feed\Builder\Header\Header - */ - public function setGenerator($generator) - { - $this->offsetSet('generator', $generator); - return $this; - } - - /** - * Sets the language of the feed - * - * @param string $language - * @return \Zend\Feed\Builder\Header\Header - */ - public function setLanguage($language) - { - $this->offsetSet('language', $language); - return $this; - } - - /** - * Email address for person responsible for technical issues - * Ignored if atom is used - * - * @param string $webmaster - * @return \Zend\Feed\Builder\Header\Header - * @throws \Zend\Feed\Builder\Exception - */ - public function setWebmaster($webmaster) - { - $validate = new Validator\EmailAddress(); - if (!$validate->isValid($webmaster)) { - throw new Builder\Exception("you have to set a valid email address into the webmaster property"); - } - $this->offsetSet('webmaster', $webmaster); - return $this; - } - - /** - * How long in minutes a feed can be cached before refreshing - * Ignored if atom is used - * - * @param int $ttl - * @return \Zend\Feed\Builder\Header\Header - * @throws \Zend\Feed\Builder\Exception - */ - public function setTtl($ttl) - { - $validate = new Validator\Int(); - if (!$validate->isValid($ttl)) { - throw new Builder\Exception("you have to set an integer value to the ttl property"); - } - $this->offsetSet('ttl', $ttl); - return $this; - } - - /** - * PICS rating for the feed - * Ignored if atom is used - * - * @param string $rating - * @return \Zend\Feed\Builder\Header\Header - */ - public function setRating($rating) - { - $this->offsetSet('rating', $rating); - return $this; - } - - /** - * Cloud to be notified of updates of the feed - * Ignored if atom is used - * - * @param string|\Zend\URI\URL $uri - * @param string $procedure procedure to call, e.g. myCloud.rssPleaseNotify - * @param string $protocol protocol to use, e.g. soap or xml-rpc - * @return \Zend\Feed\Builder\Header\Header - * @throws \Zend\Feed\Builder\Exception - */ - public function setCloud($uri, $procedure, $protocol) - { - if (is_string($uri)) { - $uri = new \Zend\URI\URL($uri); - } - if (!$uri instanceof URI\URL) { - throw new Builder\Exception('Passed parameter is not a valid HTTP URI'); - } - if (!$uri->getPort()) { - $uri->setPort(80); - } - $this->offsetSet('cloud', array('uri' => $uri, - 'procedure' => $procedure, - 'protocol' => $protocol)); - return $this; - } - - /** - * A text input box that can be displayed with the feed - * Ignored if atom is used - * - * @param string $title the label of the Submit button in the text input area - * @param string $description explains the text input area - * @param string $name the name of the text object in the text input area - * @param string $link the URL of the CGI script that processes text input requests - * @return \Zend\Feed\Builder\Header\Header - */ - public function setTextInput($title, $description, $name, $link) - { - $this->offsetSet('textInput', array('title' => $title, - 'description' => $description, - 'name' => $name, - 'link' => $link)); - return $this; - } - - /** - * Hint telling aggregators which hours they can skip - * Ignored if atom is used - * - * @param array $hours list of hours in 24 format - * @return \Zend\Feed\Builder\Header\Header - * @throws \Zend\Feed\Builder\Exception - */ - public function setSkipHours(array $hours) - { - if (count($hours) > 24) { - throw new Builder\Exception("you can not have more than 24 rows in the skipHours property"); - } - foreach ($hours as $hour) { - if ($hour < 0 || $hour > 23) { - throw new Builder\Exception("$hour has te be between 0 and 23"); - } - } - $this->offsetSet('skipHours', $hours); - return $this; - } - - /** - * Hint telling aggregators which days they can skip - * Ignored if atom is used - * - * @param array $days list of days to skip, e.g. Monday - * @return \Zend\Feed\Builder\Header\Header - * @throws \Zend\Feed\Builder\Exception - */ - public function setSkipDays(array $days) - { - if (count($days) > 7) { - throw new Builder\Exception("you can not have more than 7 days in the skipDays property"); - } - $valid = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'); - foreach ($days as $day) { - if (!in_array(strtolower($day), $valid)) { - throw new Builder\Exception("$day is not a valid day"); - } - } - $this->offsetSet('skipDays', $days); - return $this; - } - - /** - * Sets the iTunes rss extension - * - * @param \Zend\Feed\Builder\Header\iTunes $itunes - * @return \Zend\Feed\Builder\Header\Header - */ - public function setITunes(iTunes $itunes) - { - $this->offsetSet('itunes', $itunes); - return $this; - } -} diff --git a/src/Builder/Header/iTunes.php b/src/Builder/Header/iTunes.php deleted file mode 100644 index ec6f94a6..00000000 --- a/src/Builder/Header/iTunes.php +++ /dev/null @@ -1,267 +0,0 @@ -setCategories($categories); - } - - /** - * Sets the categories column and in iTunes Music Store Browse - * $categories must conform to the following format: - * - * array(array('main' => 'main category', - * 'sub' => 'sub category' // optionnal - * ), - * // up to 3 rows - * ) - * - * - * @param array $categories - * @return \Zend\Feed\Builder\Header\iTunes - * @throws \Zend\Feed\Builder\Exception - */ - public function setCategories(array $categories) - { - $nb = count($categories); - if (0 === $nb) { - throw new Builder\Exception("you have to set at least one itunes category"); - } - if ($nb > 3) { - throw new Builder\Exception("you have to set at most three itunes categories"); - } - foreach ($categories as $i => $category) { - if (empty($category['main'])) { - throw new Builder\Exception("you have to set the main category (category #$i)"); - } - } - $this->offsetSet('category', $categories); - return $this; - } - - /** - * Sets the artist value, default to the feed's author value - * - * @param string $author - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setAuthor($author) - { - $this->offsetSet('author', $author); - return $this; - } - - /** - * Sets the owner of the postcast - * - * @param string $name default to the feed's author value - * @param string $email default to the feed's email value - * @return \Zend\Feed\Builder\Header\iTunes - * @throws \Zend\Feed\Builder\Exception - */ - public function setOwner($name = '', $email = '') - { - if (!empty($email)) { - $validate = new \Zend\Validator\EmailAddress(); - if (!$validate->isValid($email)) { - throw new Builder\Exception("you have to set a valid email address into the itunes owner's email property"); - } - } - $this->offsetSet('owner', array('name' => $name, 'email' => $email)); - return $this; - } - - /** - * Sets the album/podcast art picture - * Default to the feed's image value - * - * @param string $image - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setImage($image) - { - $this->offsetSet('image', $image); - return $this; - } - - /** - * Sets the short description of the podcast - * Default to the feed's description - * - * @param string $subtitle - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setSubtitle($subtitle) - { - $this->offsetSet('subtitle', $subtitle); - return $this; - } - - /** - * Sets the longer description of the podcast - * Default to the feed's description - * - * @param string $summary - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setSummary($summary) - { - $this->offsetSet('summary', $summary); - return $this; - } - - /** - * Prevent a feed from appearing - * - * @param string $block can be 'yes' or 'no' - * @return \Zend\Feed\Builder\Header\iTunes - * @throws \Zend\Feed\Builder\Exception - */ - public function setBlock($block) - { - $block = strtolower($block); - if (!in_array($block, array('yes', 'no'))) { - throw new Builder\Exception("you have to set yes or no to the itunes block property"); - } - $this->offsetSet('block', $block); - return $this; - } - - /** - * Configuration of the parental advisory graphic - * - * @param string $explicit can be 'yes', 'no' or 'clean' - * @return \Zend\Feed\Builder\Header\iTunes - * @throws \Zend\Feed\Builder\Exception - */ - public function setExplicit($explicit) - { - $explicit = strtolower($explicit); - if (!in_array($explicit, array('yes', 'no', 'clean'))) { - throw new Builder\Exception("you have to set yes, no or clean to the itunes explicit property"); - } - $this->offsetSet('explicit', $explicit); - return $this; - } - - /** - * Sets a comma separated list of 12 keywords maximum - * - * @param string $keywords - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setKeywords($keywords) - { - $this->offsetSet('keywords', $keywords); - return $this; - } - - /** - * Sets the new feed URL location - * - * @param string $url - * @return \Zend\Feed\Builder\Header\iTunes - */ - public function setNewFeedUrl($url) - { - $this->offsetSet('new_feed_url', $url); - return $this; - } - - /** - * Read only properties accessor - * - * @param string $name property to read - * @return mixed - */ - public function __get($name) - { - if (!$this->offsetExists($name)) { - return NULL; - } - - return $this->offsetGet($name); - } - - /** - * Write properties accessor - * - * @param string $name name of the property to set - * @param mixed $value value to set - * @return void - */ - public function __set($name, $value) - { - $this->offsetSet($name, $value); - } - - /** - * Isset accessor - * - * @param string $key - * @return boolean - */ - public function __isset($key) - { - return $this->offsetExists($key); - } - - /** - * Unset accessor - * - * @param string $key - * @return void - */ - public function __unset($key) - { - if ($this->offsetExists($key)) { - $this->offsetUnset($key); - } - } - -} diff --git a/src/Feed.php b/src/Feed.php index ddeef1fa..3fd0e95b 100644 --- a/src/Feed.php +++ b/src/Feed.php @@ -35,7 +35,6 @@ * accessor. * * @uses \Zend\Feed\Atom - * @uses \Zend\Feed\Builder\Builder * @uses \Zend\Feed\Exception * @uses \Zend\Feed\RSS * @uses \Zend\HTTP\Client @@ -344,42 +343,4 @@ public static function findFeeds($uri) // Return the fetched feeds return $feeds; } - - /** - * Construct a new Zend_Feed_Abstract object from a custom array - * - * @param array $data - * @param string $format (rss|atom) the requested output format - * @return \Zend\Feed\AbstractFeed - */ - public static function importArray(array $data, $format = 'Atom') - { - if (strtolower($format) == 'rss') { - $format = 'RSS'; - } else { - $format = ucfirst(strtolower($format)); - } - $obj = 'Zend\Feed\\' . $format; - - return new $obj(null, null, new Builder\Builder($data)); - } - - /** - * Construct a new Zend_Feed_Abstract object from a Zend_Feed_Builder_Interface data source - * - * @param \Zend\Feed\Builder\BuilderInterface $builder this object will be used to extract the data of the feed - * @param string $format (rss|atom) the requested output format - * @return \Zend\Feed\AbstractFeed - */ - public static function importBuilder(Builder\BuilderInterface $builder, $format = 'atom') - { - if (strtolower($format) == 'rss') { - $format = 'RSS'; - } else { - $format = ucfirst(strtolower($format)); - } - $obj = 'Zend\Feed\\' . $format; - - return new $obj(null, null, $builder); - } } diff --git a/test/ImportTest.php b/test/ImportTest.php index 7f5b4696..c6891f54 100644 --- a/test/ImportTest.php +++ b/test/ImportTest.php @@ -26,7 +26,6 @@ namespace ZendTest\Feed; use Zend\Feed; use Zend\HTTP; -use Zend\Feed\Builder; use Zend\HTTP\Response; /** @@ -195,106 +194,6 @@ public function testRss200Sample1() $this->_importRssValid('RssTest200Sample1.xml'); } - /** - * Test the import of a RSS feed from an array - */ - public function testRssImportFullArray() - { - $feed = Feed\Feed::importArray($this->_getFullArray(), 'rss'); - $this->assertType('Zend\Feed\RSS', $feed); - } - - /** - * Test the import of a RSS feed from an array - * @group ZF-5833 - */ - public function testRssImportSetsIsPermaLinkAsFalseIfGuidNotAUri() - { - $feed = Feed\Feed::importArray($this->_getFullArray(), 'rss'); - $entry = $feed->current(); - $this->assertEquals('false', $entry->guid['isPermaLink']); - } - - /** - * Test the import of a RSS feed from an array - */ - public function testAtomImportFullArray() - { - $feed = Feed\Feed::importArray($this->_getFullArray(), 'atom'); - } - - /** - * Test the import of a RSS feed from a builder - */ - public function testRssImportFullBuilder() - { - $feed = Feed\Feed::importBuilder(new Builder\Builder($this->_getFullArray()), 'rss'); - $this->assertType('Zend\Feed\RSS', $feed); - } - - /** - * Test the import of a full iTunes RSS feed from a builder - */ - public function testRssImportFulliTunesBuilder() - { - $array = $this->_getFullArray(); - $array['itunes']['author'] = 'iTunes Author'; - $array['itunes']['owner'] = array('name' => 'iTunes Owner', - 'email' => 'itunes@example.com'); - $array['itunes']['image'] = 'http://www.example/itunes.png'; - $array['itunes']['subtitle'] = 'iTunes subtitle'; - $array['itunes']['summary'] = 'iTunes summary'; - $array['itunes']['explicit'] = 'clean'; - $array['itunes']['block'] = 'no'; - $array['itunes']['new-feed-url'] = 'http://www.example/itunes.xml'; - $feed = Feed\Feed::importBuilder(new Builder\Builder($array), 'rss'); - $this->assertType('Zend\Feed\RSS', $feed); - } - - /** - * Test the import of an Atom feed from a builder - */ - public function testAtomImportFullBuilder() - { - $feed = Feed\Feed::importBuilder(new Builder\Builder($this->_getFullArray()), 'atom'); - - } - - /** - * Test the import of an Atom feed from a builder - */ - public function testAtomImportFullBuilderValid() - { - $feed = Feed\Feed::importBuilder(new Builder\Builder($this->_getFullArray()), 'atom'); - - $feed = Feed\Feed::importString($feed->saveXml()); - $this->assertType('Zend\Feed\Atom', $feed); - } - - /** - * Check the validity of the builder import (rss) - */ - public function testRssImportFullBuilderValid() - { - $feed = Feed\Feed::importBuilder(new Builder\Builder($this->_getFullArray()), 'rss'); - $this->assertType('Zend\Feed\RSS', $feed); - $feed = Feed\Feed::importString($feed->saveXml()); - $this->assertType('Zend\Feed\RSS', $feed); - } - - /** - * Test the return of a link() call (atom) - */ - public function testAtomGetLink() - { - $feed = Feed\Feed::importBuilder(new Builder\Builder($this->_getFullArray()), 'atom'); - $this->assertType('Zend\Feed\Atom', $feed); - $feed = Feed\Feed::importString($feed->saveXml()); - $this->assertType('Zend\Feed\Atom', $feed); - $href = $feed->link('self'); - $this->assertEquals('http://www.example.com', $href); - } - /** * Imports an invalid feed and ensure everything works as expected * even if XDebug is running (ZF-2590). @@ -317,85 +216,6 @@ public function testImportInvalidIsXdebugAware() } } - /** - * Returns the array used by Zend_Feed::importArray - * and Zend_Feed::importBuilder tests - * - * @return array - */ - protected function _getFullArray() - { - $array = array('title' => 'Title of the feed', - 'link' => 'http://www.example.com', - 'description' => 'Description of the feed', - 'author' => 'Olivier Sirven', - 'email' => 'olivier@elma.fr', - 'webmaster' => 'olivier@elma.fr', - 'charset' => 'iso-8859-15', - 'lastUpdate' => time(), - 'published' => strtotime('2007-02-27'), - 'copyright' => 'Common Creative', - 'image' => 'http://www.example/images/icon.png', - 'language' => 'en', - 'ttl' => 60, - 'rating' => ' (PICS-1.1 "http://www.gcf.org/v2.5" labels - on "1994.11.05T08:15-0500" - exp "1995.12.31T23:59-0000" - for "http://www.greatdocs.com/foo.html" - by "George Sanderson, Jr." - ratings (suds 0.5 density 0 color/hue 1))', - 'cloud' => array('domain' => 'rpc.sys.com', - 'path' => '/rpc', - 'registerProcedure' => 'webServices.pingMe', - 'protocol' => 'xml-rpc'), - 'textInput' => array('title' => 'subscribe', - 'description' => 'enter your email address to subscribe by mail', - 'name' => 'email', - 'link' => 'http://www.example.com/subscribe'), - 'skipHours' => array(1, 13, 17), - 'skipDays' => array('Saturday', 'Sunday'), - 'itunes' => array('block' => 'no', - 'keywords' => 'example,itunes,podcast', - 'category' => array(array('main' => 'Technology', - 'sub' => 'Gadgets'), - array('main' => 'Music'))), - 'entries' => array(array('guid' => time(), - 'title' => 'First article', - 'link' => 'http://www.example.com', - 'description' => 'First article description', - 'content' => 'First article content', - 'lastUpdate' => time(), - 'comments' => 'http://www.example.com/#comments', - 'commentRss' => 'http://www.example.com/comments.xml', - 'source' => array('title' => 'Original title', - 'url' => 'http://www.domain.com'), - 'category' => array(array('term' => 'test category', - 'scheme' => 'http://www.example.com/scheme'), - array('term' => 'another category') - ), - 'enclosure' => array(array('url' => 'http://www.example.com/podcast.mp3', - 'type' => 'audio/mpeg', - 'length' => '12216320' - ), - array('url' => 'http://www.example.com/podcast2.mp3', - 'type' => 'audio/mpeg', - 'length' => '1221632' - ) - ) - ), - array('title' => 'Second article', - 'link' => 'http://www.example.com/two', - 'description' => 'Second article description', - 'content' => 'Second article content', - 'lastUpdate' => time(), - 'comments' => 'http://www.example.com/two/#comments', - 'category' => array(array('term' => 'test category')), - ) - ) - ); - return $array; - } - /** * Import an invalid atom feed */ From 9c92fccc91a0021e345fb3559976b25f11390e9e Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 13 Jul 2010 09:37:09 -0400 Subject: [PATCH 152/238] Removed Zend\Feed\Feed - Superceded by Zend\Feed\Reader --- src/AbstractFeed.php | 247 -------- src/Atom.php | 378 ------------ src/Element.php | 441 -------------- src/Entry/AbstractEntry.php | 113 ---- src/Entry/Atom.php | 249 -------- src/Entry/RSS.php | 120 ---- src/Feed.php | 346 ----------- src/RSS.php | 517 ---------------- test/ArrayAccessTest.php | 110 ---- test/AtomEntryOnlyTest.php | 56 -- test/AtomPublishingTest.php | 140 ----- test/CountTest.php | 63 -- test/ElementTest.php | 175 ------ test/Entry/RSSTest.php | 75 --- test/ImportTest.php | 277 --------- test/IteratorTest.php | 126 ---- .../Model/SubscriptionTest.php | 24 +- test/Writer/FeedTest.php | 88 ++- test/Writer/Renderer/Feed/AtomTest.php | 4 +- test/_files/AtomHOnline.xml | 554 ------------------ .../AtomPublishingTest-before-update.xml | 7 - .../AtomPublishingTest-created-entry.xml | 15 - .../AtomPublishingTest-expected-update.xml | 7 - .../AtomPublishingTest-updated-entry.xml | 18 - test/_files/AtomTestGoogle.xml | 148 ----- test/_files/AtomTestMozillazine.xml | 213 ------- test/_files/AtomTestOReilly.xml | 214 ------- test/_files/AtomTestPlanetPHP.xml | 125 ---- test/_files/AtomTestSample1.xml | 22 - test/_files/AtomTestSample2.xml | 15 - test/_files/AtomTestSample3.xml | 17 - test/_files/AtomTestSample4.xml | 31 - test/_files/RssTest091Sample1.xml | 50 -- test/_files/RssTest092Sample1.xml | 103 ---- test/_files/RssTest100Sample1.xml | 62 -- test/_files/RssTest100Sample2.xml | 67 --- test/_files/RssTest200Sample1.xml | 41 -- test/_files/RssTestCNN.xml | 80 --- test/_files/RssTestHarvardLaw.xml | 142 ----- test/_files/RssTestPlanetPHP.xml | 126 ---- test/_files/RssTestSlashdot.xml | 178 ------ test/_files/TestAtomFeed.xml | 34 -- test/_files/TestAtomFeedEntryOnly.xml | 1 - test/_files/TestAtomFeedNamespaced.xml | 34 -- .../_files/TestFeedEntryRssContentEncoded.xml | 61 -- test/_files/htmlPage.html | 16 - 46 files changed, 50 insertions(+), 5880 deletions(-) delete mode 100644 src/AbstractFeed.php delete mode 100644 src/Atom.php delete mode 100644 src/Element.php delete mode 100644 src/Entry/AbstractEntry.php delete mode 100644 src/Entry/Atom.php delete mode 100644 src/Entry/RSS.php delete mode 100644 src/Feed.php delete mode 100644 src/RSS.php delete mode 100644 test/ArrayAccessTest.php delete mode 100644 test/AtomEntryOnlyTest.php delete mode 100644 test/AtomPublishingTest.php delete mode 100644 test/CountTest.php delete mode 100644 test/ElementTest.php delete mode 100644 test/Entry/RSSTest.php delete mode 100644 test/ImportTest.php delete mode 100644 test/IteratorTest.php rename test/{Pubsubhubbub => PubSubHubbub}/Model/SubscriptionTest.php (81%) delete mode 100644 test/_files/AtomHOnline.xml delete mode 100644 test/_files/AtomPublishingTest-before-update.xml delete mode 100644 test/_files/AtomPublishingTest-created-entry.xml delete mode 100644 test/_files/AtomPublishingTest-expected-update.xml delete mode 100644 test/_files/AtomPublishingTest-updated-entry.xml delete mode 100644 test/_files/AtomTestGoogle.xml delete mode 100644 test/_files/AtomTestMozillazine.xml delete mode 100644 test/_files/AtomTestOReilly.xml delete mode 100644 test/_files/AtomTestPlanetPHP.xml delete mode 100644 test/_files/AtomTestSample1.xml delete mode 100644 test/_files/AtomTestSample2.xml delete mode 100644 test/_files/AtomTestSample3.xml delete mode 100644 test/_files/AtomTestSample4.xml delete mode 100644 test/_files/RssTest091Sample1.xml delete mode 100644 test/_files/RssTest092Sample1.xml delete mode 100644 test/_files/RssTest100Sample1.xml delete mode 100644 test/_files/RssTest100Sample2.xml delete mode 100644 test/_files/RssTest200Sample1.xml delete mode 100644 test/_files/RssTestCNN.xml delete mode 100644 test/_files/RssTestHarvardLaw.xml delete mode 100644 test/_files/RssTestPlanetPHP.xml delete mode 100644 test/_files/RssTestSlashdot.xml delete mode 100644 test/_files/TestAtomFeed.xml delete mode 100644 test/_files/TestAtomFeedEntryOnly.xml delete mode 100644 test/_files/TestAtomFeedNamespaced.xml delete mode 100644 test/_files/TestFeedEntryRssContentEncoded.xml delete mode 100644 test/_files/htmlPage.html diff --git a/src/AbstractFeed.php b/src/AbstractFeed.php deleted file mode 100644 index 0ee12761..00000000 --- a/src/AbstractFeed.php +++ /dev/null @@ -1,247 +0,0 @@ -setUri($uri); - $response = $client->request('GET'); - if ($response->getStatus() !== 200) { - throw new Exception('Feed failed to load, got response code ' . $response->getStatus()); - } - $this->_element = $response->getBody(); - $this->__wakeup(); - } elseif ($string !== null) { - // Retrieve the feed from $string - $this->_element = $string; - $this->__wakeup(); - } - } - - - /** - * Load the feed as an XML DOMDocument object - * - * @return void - * @throws \Zend\Feed\Exception - */ - public function __wakeup() - { - @ini_set('track_errors', 1); - $doc = new \DOMDocument; - $status = @$doc->loadXML($this->_element); - @ini_restore('track_errors'); - - if (!$status) { - // prevent the class to generate an undefined variable notice (ZF-2590) - 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)'; - } - } - - throw new Exception("DOMDocument cannot parse XML: $php_errormsg"); - } - - $this->_element = $doc; - } - - - /** - * Prepare for serialiation - * - * @return array - */ - public function __sleep() - { - $this->_element = $this->saveXML(); - - return array('_element'); - } - - - /** - * Cache the individual feed elements so they don't need to be - * searched for on every operation. - * - * @return void - */ - protected function _buildEntryCache() - { - $this->_entries = array(); - foreach ($this->_element->childNodes as $child) { - if ($child->localName == $this->_entryElementName) { - $this->_entries[] = $child; - } - } - } - - - /** - * Get the number of entries in this feed object. - * - * @return integer Entry count. - */ - public function count() - { - return count($this->_entries); - } - - - /** - * Required by the Iterator interface. - * - * @return void - */ - public function rewind() - { - $this->_entryIndex = 0; - } - - - /** - * Required by the Iterator interface. - * - * @return mixed The current row, or null if no rows. - */ - public function current() - { - //$entryClassName = ; - return new $this->_entryClassName( - null, - $this->_entries[$this->_entryIndex] - ); - } - - - /** - * Required by the Iterator interface. - * - * @return mixed The current row number (starts at 0), or NULL if no rows - */ - public function key() - { - return $this->_entryIndex; - } - - - /** - * Required by the Iterator interface. - * - * @return mixed The next row, or null if no more rows. - */ - public function next() - { - ++$this->_entryIndex; - } - - - /** - * Required by the Iterator interface. - * - * @return boolean Whether the iteration is valid - */ - public function valid() - { - return 0 <= $this->_entryIndex && $this->_entryIndex < $this->count(); - } - - /** - * Generate the header of the feed when working in write mode - * - * @param array $array the data to use - * @return DOMElement root node - */ - abstract protected function _mapFeedHeaders($array); - - /** - * Generate the entries of the feed when working in write mode - * - * @param DOMElement $root the root node to use - * @param array $array the data to use - * @return DOMElement root node - */ - abstract protected function _mapFeedEntries(\DOMElement $root, $array); - - /** - * Send feed to a http client with the correct header - * - * @throws \Zend\Feed\Exception if headers have already been sent - * @return void - */ - abstract public function send(); -} diff --git a/src/Atom.php b/src/Atom.php deleted file mode 100644 index 4af9998c..00000000 --- a/src/Atom.php +++ /dev/null @@ -1,378 +0,0 @@ - - * elements). - * - * @var string - */ - protected $_entryElementName = 'entry'; - - /** - * The default namespace for Atom feeds. - * - * @var string - */ - protected $_defaultNamespace = 'atom'; - - - /** - * Override Zend_Feed_Abstract to set up the $_element and $_entries aliases. - * - * @return void - * @throws \Zend\Feed\Exception - */ - public function __wakeup() - { - parent::__wakeup(); - - // Find the base feed element and create an alias to it. - $element = $this->_element->getElementsByTagName('feed')->item(0); - if (!$element) { - // Try to find a single instead. - $element = $this->_element->getElementsByTagName($this->_entryElementName)->item(0); - if (!$element) { - throw new Exception('No root or <' . $this->_entryElementName - . '> element found, cannot parse feed.'); - } - - $doc = new \DOMDocument($this->_element->version, - $this->_element->actualEncoding); - $feed = $doc->appendChild($doc->createElement('feed')); - $feed->appendChild($doc->importNode($element, true)); - $element = $feed; - } - - $this->_element = $element; - - // Find the entries and save a pointer to them for speed and - // simplicity. - $this->_buildEntryCache(); - } - - - /** - * Easy access to tags keyed by "rel" attributes. - * - * If $elt->link() is called with no arguments, we will attempt to - * return the value of the tag(s) like all other - * method-syntax attribute access. If an argument is passed to - * link(), however, then we will return the "href" value of the - * first tag that has a "rel" attribute matching $rel: - * - * $elt->link(): returns the value of the link tag. - * $elt->link('self'): returns the href from the first in the entry. - * - * @param string $rel The "rel" attribute to look for. - * @return mixed - */ - public function link($rel = null) - { - if ($rel === null) { - return parent::__call('link', null); - } - - // index link tags by their "rel" attribute. - $links = parent::__get('link'); - if (!is_array($links)) { - if ($links instanceof Element) { - $links = array($links); - } else { - return $links; - } - } - - foreach ($links as $link) { - if (empty($link['rel'])) { - continue; - } - if ($rel == $link['rel']) { - return $link['href']; - } - } - - return null; - } - - - /** - * Make accessing some individual elements of the feed easier. - * - * Special accessors 'entry' and 'entries' are provided so that if - * you wish to iterate over an Atom feed's entries, you can do so - * using foreach ($feed->entries as $entry) or foreach - * ($feed->entry as $entry). - * - * @param string $var The property to access. - * @return mixed - */ - public function __get($var) - { - switch ($var) { - case 'entry': - // fall through to the next case - case 'entries': - return $this; - - default: - return parent::__get($var); - } - } - - /** - * Generate the header of the feed when working in write mode - * - * @param array $array the data to use - * @return DOMElement root node - */ - protected function _mapFeedHeaders($array) - { - $feed = $this->_element->createElement('feed'); - $feed->setAttribute('xmlns', 'http://www.w3.org/2005/Atom'); - - $id = $this->_element->createElement('id', $array->link); - $feed->appendChild($id); - - $title = $this->_element->createElement('title'); - $title->appendChild($this->_element->createCDATASection($array->title)); - $feed->appendChild($title); - - if (isset($array->author)) { - $author = $this->_element->createElement('author'); - $name = $this->_element->createElement('name', $array->author); - $author->appendChild($name); - if (isset($array->email)) { - $email = $this->_element->createElement('email', $array->email); - $author->appendChild($email); - } - $feed->appendChild($author); - } - - $updated = isset($array->lastUpdate) ? $array->lastUpdate : time(); - $updated = $this->_element->createElement('updated', date(DATE_ATOM, $updated)); - $feed->appendChild($updated); - - if (isset($array->published)) { - $published = $this->_element->createElement('published', date(DATE_ATOM, $array->published)); - $feed->appendChild($published); - } - - $link = $this->_element->createElement('link'); - $link->setAttribute('rel', 'self'); - $link->setAttribute('href', $array->link); - if (isset($array->language)) { - $link->setAttribute('hreflang', $array->language); - } - $feed->appendChild($link); - - if (isset($array->description)) { - $subtitle = $this->_element->createElement('subtitle'); - $subtitle->appendChild($this->_element->createCDATASection($array->description)); - $feed->appendChild($subtitle); - } - - if (isset($array->copyright)) { - $copyright = $this->_element->createElement('rights', $array->copyright); - $feed->appendChild($copyright); - } - - if (isset($array->image)) { - $image = $this->_element->createElement('logo', $array->image); - $feed->appendChild($image); - } - - $generator = !empty($array->generator) ? $array->generator : 'Zend\Feed'; - $generator = $this->_element->createElement('generator', $generator); - $feed->appendChild($generator); - - return $feed; - } - - /** - * Generate the entries of the feed when working in write mode - * - * The following nodes are constructed for each feed entry - * - * url to feed entry - * entry title - * last update - * - * short text - * long version, can contain html - * - * - * @param array $array the data to use - * @param DOMElement $root the root node to use - * @return void - */ - protected function _mapFeedEntries(\DOMElement $root, $array) - { - foreach ($array as $dataentry) { - $entry = $this->_element->createElement('entry'); - - $id = $this->_element->createElement('id', isset($dataentry->guid) ? $dataentry->guid : $dataentry->link); - $entry->appendChild($id); - - $title = $this->_element->createElement('title'); - $title->appendChild($this->_element->createCDATASection($dataentry->title)); - $entry->appendChild($title); - - $updated = isset($dataentry->lastUpdate) ? $dataentry->lastUpdate : time(); - $updated = $this->_element->createElement('updated', date(DATE_ATOM, $updated)); - $entry->appendChild($updated); - - $link = $this->_element->createElement('link'); - $link->setAttribute('rel', 'alternate'); - $link->setAttribute('href', $dataentry->link); - $entry->appendChild($link); - - $summary = $this->_element->createElement('summary'); - $summary->appendChild($this->_element->createCDATASection($dataentry->description)); - $entry->appendChild($summary); - - if (isset($dataentry->content)) { - $content = $this->_element->createElement('content'); - $content->setAttribute('type', 'html'); - $content->appendChild($this->_element->createCDATASection($dataentry->content)); - $entry->appendChild($content); - } - - if (isset($dataentry->category)) { - foreach ($dataentry->category as $category) { - $node = $this->_element->createElement('category'); - $node->setAttribute('term', $category['term']); - if (isset($category['scheme'])) { - $node->setAttribute('scheme', $category['scheme']); - } - $entry->appendChild($node); - } - } - - if (isset($dataentry->source)) { - $source = $this->_element->createElement('source'); - $title = $this->_element->createElement('title', $dataentry->source['title']); - $source->appendChild($title); - $link = $this->_element->createElement('link', $dataentry->source['title']); - $link->setAttribute('rel', 'alternate'); - $link->setAttribute('href', $dataentry->source['url']); - $source->appendChild($link); - } - - if (isset($dataentry->enclosure)) { - foreach ($dataentry->enclosure as $enclosure) { - $node = $this->_element->createElement('link'); - $node->setAttribute('rel', 'enclosure'); - $node->setAttribute('href', $enclosure['url']); - if (isset($enclosure['type'])) { - $node->setAttribute('type', $enclosure['type']); - } - if (isset($enclosure['length'])) { - $node->setAttribute('length', $enclosure['length']); - } - $entry->appendChild($node); - } - } - - if (isset($dataentry->comments)) { - $comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/', - 'wfw:comment', - $dataentry->comments); - $entry->appendChild($comments); - } - if (isset($dataentry->commentRss)) { - $comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/', - 'wfw:commentRss', - $dataentry->commentRss); - $entry->appendChild($comments); - } - - $root->appendChild($entry); - } - } - - /** - * Override Zend_Feed_Element to allow formated feeds - * - * @return string - */ - public function saveXml() - { - // Return a complete document including XML prologue. - $doc = new \DOMDocument($this->_element->ownerDocument->version, - $this->_element->ownerDocument->actualEncoding); - $doc->appendChild($doc->importNode($this->_element, true)); - $doc->formatOutput = true; - - return $doc->saveXML(); - } - - /** - * Send feed to a http client with the correct header - * - * @return void - * @throws \Zend\Feed\Exception if headers have already been sent - */ - public function send() - { - if (headers_sent()) { - throw new Exception('Cannot send ATOM because headers have already been sent.'); - } - - header('Content-Type: application/atom+xml; charset=' . $this->_element->ownerDocument->actualEncoding); - - echo $this->saveXML(); - } -} diff --git a/src/Element.php b/src/Element.php deleted file mode 100644 index ba0ac10e..00000000 --- a/src/Element.php +++ /dev/null @@ -1,441 +0,0 @@ -_element = $element; - } - - - /** - * Get a DOM representation of the element - * - * Returns the underlying DOM object, which can then be - * manipulated with full DOM methods. - * - * @return DOMDocument - */ - public function getDOM() - { - return $this->_element; - } - - - /** - * Update the object from a DOM element - * - * Take a DOMElement object, which may be originally from a call - * to getDOM() or may be custom created, and use it as the - * DOM tree for this Zend_Feed_Element. - * - * @param DOMElement $element - * @return void - */ - public function setDOM(\DOMElement $element) - { - $this->_element = $this->_element->ownerDocument->importNode($element, true); - } - - /** - * Set the parent element of this object to another - * Zend_Feed_Element. - * - * @param \Zend\Feed\Element $element - * @return void - */ - public function setParent(Element $element) - { - $this->_parentElement = $element; - $this->_appended = false; - } - - - /** - * Appends this element to its parent if necessary. - * - * @return void - */ - protected function ensureAppended() - { - if (!$this->_appended) { - $this->_parentElement->getDOM()->appendChild($this->_element); - $this->_appended = true; - $this->_parentElement->ensureAppended(); - } - } - - - /** - * Get an XML string representation of this element - * - * Returns a string of this element's XML, including the XML - * prologue. - * - * @return string - */ - public function saveXml() - { - // Return a complete document including XML prologue. - $doc = new \DOMDocument($this->_element->ownerDocument->version, - $this->_element->ownerDocument->actualEncoding); - $doc->appendChild($doc->importNode($this->_element, true)); - return $doc->saveXML(); - } - - - /** - * Get the XML for only this element - * - * Returns a string of this element's XML without prologue. - * - * @return string - */ - public function saveXmlFragment() - { - return $this->_element->ownerDocument->saveXML($this->_element); - } - - /** - * Get encoding - * - * @return string - */ - public function getEncoding() - { - return $this->_encoding; - } - - /** - * Set encoding - * - * @param string $value Encoding to use - * @return \Zend\Feed\Element - */ - public function setEncoding($value) - { - $this->_encoding = (string) $value; - return $this; - } - - /** - * Map variable access onto the underlying entry representation. - * - * Get-style access returns a Zend_Feed_Element representing the - * child element accessed. To get string values, use method syntax - * with the __call() overriding. - * - * @param string $var The property to access. - * @return mixed - */ - public function __get($var) - { - $nodes = $this->_children($var); - $length = count($nodes); - - if ($length == 1) { - return new Element($nodes[0]); - } elseif ($length > 1) { - return array_map(create_function('$e', 'return new \Zend\Feed\Element($e);'), $nodes); - } else { - // When creating anonymous nodes for __set chaining, don't - // call appendChild() on them. Instead we pass the current - // element to them as an extra reference; the child is - // then responsible for appending itself when it is - // actually set. This way "if ($foo->bar)" doesn't create - // a phantom "bar" element in our tree. - if (strpos($var, ':') !== false) { - list($ns, $elt) = explode(':', $var, 2); - $node = $this->_element->ownerDocument->createElementNS(Feed::lookupNamespace($ns), $elt); - } else { - $node = $this->_element->ownerDocument->createElement($var); - } - $node = new self($node); - $node->setParent($this); - return $node; - } - } - - - /** - * Map variable sets onto the underlying entry representation. - * - * @param string $var The property to change. - * @param string $val The property's new value. - * @return void - * @throws \Zend\Feed\Exception - */ - public function __set($var, $val) - { - $this->ensureAppended(); - - $nodes = $this->_children($var); - if (!$nodes) { - if (strpos($var, ':') !== false) { - list($ns, $elt) = explode(':', $var, 2); - $node = $this->_element->ownerDocument->createElementNS(Feed::lookupNamespace($ns), - $var, htmlspecialchars($val, ENT_NOQUOTES, $this->getEncoding())); - $this->_element->appendChild($node); - } else { - $node = $this->_element->ownerDocument->createElement($var, - htmlspecialchars($val, ENT_NOQUOTES, $this->getEncoding())); - $this->_element->appendChild($node); - } - } elseif (count($nodes) > 1) { - throw new Exception('Cannot set the value of multiple tags simultaneously.'); - } else { - $nodes[0]->nodeValue = $val; - } - } - - - /** - * Map isset calls onto the underlying entry representation. - * - * @param string $var - * @return boolean - */ - public function __isset($var) - { - // Look for access of the form {ns:var}. We don't use - // _children() here because we can break out of the loop - // immediately once we find something. - if (strpos($var, ':') !== false) { - list($ns, $elt) = explode(':', $var, 2); - foreach ($this->_element->childNodes as $child) { - if ($child->localName == $elt && $child->prefix == $ns) { - return true; - } - } - } else { - foreach ($this->_element->childNodes as $child) { - if ($child->localName == $var) { - return true; - } - } - } - } - - - /** - * Get the value of an element with method syntax. - * - * Map method calls to get the string value of the requested - * element. If there are multiple elements that match, this will - * return an array of those objects. - * - * @param string $var The element to get the string value of. - * @param mixed $unused This parameter is not used. - * @return mixed The node's value, null, or an array of nodes. - */ - public function __call($var, $unused) - { - $nodes = $this->_children($var); - - if (!$nodes) { - return null; - } elseif (count($nodes) > 1) { - return $nodes; - } else { - return $nodes[0]->nodeValue; - } - } - - - /** - * Remove all children matching $var. - * - * @param string $var - * @return void - */ - public function __unset($var) - { - $nodes = $this->_children($var); - foreach ($nodes as $node) { - $parent = $node->parentNode; - $parent->removeChild($node); - } - } - - - /** - * Returns the nodeValue of this element when this object is used - * in a string context. - * - * @return string - */ - public function __toString() - { - return $this->_element->nodeValue; - } - - - /** - * Finds children with tagnames matching $var - * - * Similar to SimpleXML's children() method. - * - * @param string $var Tagname to match, can be either namespace:tagName or just tagName. - * @return array - */ - protected function _children($var) - { - $found = array(); - - // Look for access of the form {ns:var}. - if (strpos($var, ':') !== false) { - list($ns, $elt) = explode(':', $var, 2); - foreach ($this->_element->childNodes as $child) { - if ($child->localName == $elt && $child->prefix == $ns) { - $found[] = $child; - } - } - } else { - foreach ($this->_element->childNodes as $child) { - if ($child->localName == $var) { - $found[] = $child; - } - } - } - - return $found; - } - - - /** - * Required by the ArrayAccess interface. - * - * @param string $offset - * @return boolean - */ - public function offsetExists($offset) - { - if (strpos($offset, ':') !== false) { - list($ns, $attr) = explode(':', $offset, 2); - return $this->_element->hasAttributeNS(Feed::lookupNamespace($ns), $attr); - } else { - return $this->_element->hasAttribute($offset); - } - } - - - /** - * Required by the ArrayAccess interface. - * - * @param string $offset - * @return string - */ - public function offsetGet($offset) - { - if (strpos($offset, ':') !== false) { - list($ns, $attr) = explode(':', $offset, 2); - return $this->_element->getAttributeNS(Feed::lookupNamespace($ns), $attr); - } else { - return $this->_element->getAttribute($offset); - } - } - - - /** - * Required by the ArrayAccess interface. - * - * @param string $offset - * @param string $value - * @return string - */ - public function offsetSet($offset, $value) - { - $this->ensureAppended(); - - if (strpos($offset, ':') !== false) { - list($ns, $attr) = explode(':', $offset, 2); - // DOMElement::setAttributeNS() requires $qualifiedName to have a prefix - return $this->_element->setAttributeNS(Feed::lookupNamespace($ns), $offset, $value); - } else { - return $this->_element->setAttribute($offset, $value); - } - } - - - /** - * Required by the ArrayAccess interface. - * - * @param string $offset - * @return boolean - */ - public function offsetUnset($offset) - { - if (strpos($offset, ':') !== false) { - list($ns, $attr) = explode(':', $offset, 2); - return $this->_element->removeAttributeNS(Feed::lookupNamespace($ns), $attr); - } else { - return $this->_element->removeAttribute($offset); - } - } - -} diff --git a/src/Entry/AbstractEntry.php b/src/Entry/AbstractEntry.php deleted file mode 100644 index 756687bf..00000000 --- a/src/Entry/AbstractEntry.php +++ /dev/null @@ -1,113 +0,0 @@ -loadXML($element); - @ini_restore('track_errors'); - - if (!$status) { - // prevent the class to generate an undefined variable notice (ZF-2590) - 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)'; - } - } - - throw new Feed\Exception("DOMDocument cannot parse XML: $php_errormsg"); - } - - $element = $doc->getElementsByTagName($this->_rootElement)->item(0); - if (!$element) { - throw new Feed\Exception('No root <' . $this->_rootElement . '> element found, cannot parse feed.'); - } - } else { - $doc = new \DOMDocument('1.0', 'utf-8'); - if ($this->_rootNamespace !== null) { - $element = $doc->createElementNS(Feed\Feed::lookupNamespace($this->_rootNamespace), $this->_rootElement); - } else { - $element = $doc->createElement($this->_rootElement); - } - } - } - - parent::__construct($element); - } - -} diff --git a/src/Entry/Atom.php b/src/Entry/Atom.php deleted file mode 100644 index f63fd75e..00000000 --- a/src/Entry/Atom.php +++ /dev/null @@ -1,249 +0,0 @@ -link('edit'); - if (!$deleteUri) { - throw new Feed\Exception('Cannot delete entry; no link rel="edit" is present.'); - } - - // DELETE - $client = Feed\Feed::getHttpClient(); - do { - $client->setUri($deleteUri); - if (Feed\Feed::getHttpMethodOverride()) { - $client->setHeader('X-HTTP-Method-Override', 'DELETE'); - $response = $client->request('POST'); - } else { - $response = $client->request('DELETE'); - } - $httpStatus = $response->getStatus(); - switch ((int) $httpStatus / 100) { - // Success - case 2: - return true; - // Redirect - case 3: - $deleteUri = $response->getHeader('Location'); - continue; - // Error - default: - throw new Feed\Exception("Expected response code 2xx, got $httpStatus"); - } - } while (true); - } - - - /** - * Save a new or updated Atom entry. - * - * Save is used to either create new entries or to save changes to - * existing ones. If we have a link rel="edit", we are changing - * an existing entry. In this case we re-serialize the entry and - * PUT it to the edit URI, checking for a 200 OK result. - * - * For posting new entries, you must specify the $postUri - * parameter to save() to tell the object where to post itself. - * We use $postUri and POST the serialized entry there, checking - * for a 201 Created response. If the insert is successful, we - * then parse the response from the POST to get any values that - * the server has generated: an id, an updated time, and its new - * link rel="edit". - * - * @param string $postUri Location to POST for creating new entries. - * @return void - * @throws \Zend\Feed\Exception - */ - public function save($postUri = null) - { - if ($this->id()) { - // If id is set, look for link rel="edit" in the - // entry object and PUT. - $editUri = $this->link('edit'); - if (!$editUri) { - throw new Feed\Exception('Cannot edit entry; no link rel="edit" is present.'); - } - - $client = Feed\Feed::getHttpClient(); - $client->setUri($editUri); - if (Feed\Feed::getHttpMethodOverride()) { - $client->setHeaders(array('X-HTTP-Method-Override: PUT', - 'Content-Type: ' . self::CONTENT_TYPE)); - $client->setRawData($this->saveXML()); - $response = $client->request('POST'); - } else { - $client->setHeaders('Content-Type', self::CONTENT_TYPE); - $client->setRawData($this->saveXML()); - $response = $client->request('PUT'); - } - if ($response->getStatus() !== 200) { - throw new Feed\Exception('Expected response code 200, got ' . $response->getStatus()); - } - } else { - if ($postUri === null) { - throw new Feed\Exception('PostURI must be specified to save new entries.'); - } - $client = Feed\Feed::getHttpClient(); - $client->setUri($postUri); - $client->setHeaders('Content-Type', self::CONTENT_TYPE); - $client->setRawData($this->saveXML()); - $response = $client->request('POST'); - - if ($response->getStatus() !== 201) { - throw new Feed\Exception('Expected response code 201, got ' - . $response->getStatus()); - } - } - - // Update internal properties using $client->responseBody; - @ini_set('track_errors', 1); - $newEntry = new \DOMDocument; - $status = @$newEntry->loadXML($response->getBody()); - @ini_restore('track_errors'); - - if (!$status) { - // prevent the class to generate an undefined variable notice (ZF-2590) - 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)'; - } - } - - throw new Feed\Exception('XML cannot be parsed: ' . $php_errormsg); - } - - $newEntry = $newEntry->getElementsByTagName($this->_rootElement)->item(0); - if (!$newEntry) { - throw new Feed\Exception('No root element found in server response:' - . "\n\n" . $client->responseBody); - } - - if ($this->_element->parentNode) { - $oldElement = $this->_element; - $this->_element = $oldElement->ownerDocument->importNode($newEntry, true); - $oldElement->parentNode->replaceChild($this->_element, $oldElement); - } else { - $this->_element = $newEntry; - } - } - - - /** - * Easy access to tags keyed by "rel" attributes. - * - * If $elt->link() is called with no arguments, we will attempt to - * return the value of the tag(s) like all other - * method-syntax attribute access. If an argument is passed to - * link(), however, then we will return the "href" value of the - * first tag that has a "rel" attribute matching $rel: - * - * $elt->link(): returns the value of the link tag. - * $elt->link('self'): returns the href from the first in the entry. - * - * @param string $rel The "rel" attribute to look for. - * @return mixed - */ - public function link($rel = null) - { - if ($rel === null) { - return parent::__call('link', null); - } - - // index link tags by their "rel" attribute. - $links = parent::__get('link'); - if (!is_array($links)) { - if ($links instanceof Feed\Element) { - $links = array($links); - } else { - return $links; - } - } - - foreach ($links as $link) { - if (empty($link['rel'])) { - $link['rel'] = 'alternate'; // see Atom 1.0 spec - } - if ($rel == $link['rel']) { - return $link['href']; - } - } - - return null; - } - -} diff --git a/src/Entry/RSS.php b/src/Entry/RSS.php deleted file mode 100644 index 7954b5bc..00000000 --- a/src/Entry/RSS.php +++ /dev/null @@ -1,120 +0,0 @@ -_element->lookupPrefix('http://purl.org/rss/1.0/modules/content/'); - return parent::__get("$prefix:encoded"); - default: - return parent::__get($var); - } - } - - /** - * Overwrites parent::_set method to enable write access - * to content:encoded element. - * - * @param string $var The property to change. - * @param string $val The property's new value. - * @return void - */ - public function __set($var, $value) - { - switch ($var) { - case 'content': - parent::__set('content:encoded', $value); - break; - default: - parent::__set($var, $value); - } - } - - /** - * Overwrites parent::_isset method to enable access - * to content:encoded element. - * - * @param string $var - * @return boolean - */ - public function __isset($var) - { - switch ($var) { - case 'content': - // don't use other callback to prevent invalid returned value - return $this->content() !== null; - default: - return parent::__isset($var); - } - } - - /** - * Overwrites parent::_call method to enable read access - * to content:encoded element. - * Please note that method-style write access is not currently supported - * by parent method, consequently this method doesn't as well. - * - * @param string $var The element to get the string value of. - * @param mixed $unused This parameter is not used. - * @return mixed The node's value, null, or an array of nodes. - */ - public function __call($var, $unused) - { - switch ($var) { - case 'content': - $prefix = $this->_element->lookupPrefix('http://purl.org/rss/1.0/modules/content/'); - return parent::__call("$prefix:encoded", $unused); - default: - return parent::__call($var, $unused); - } - } -} diff --git a/src/Feed.php b/src/Feed.php deleted file mode 100644 index 3fd0e95b..00000000 --- a/src/Feed.php +++ /dev/null @@ -1,346 +0,0 @@ - 'http://a9.com/-/spec/opensearchrss/1.0/', - 'atom' => 'http://www.w3.org/2005/Atom', - 'rss' => 'http://blogs.law.harvard.edu/tech/rss', - ); - - - /** - * Set the HTTP client instance - * - * Sets the HTTP client object to use for retrieving the feeds. - * - * @param \Zend\HTTP\Client $httpClient - * @return void - */ - public static function setHttpClient(HTTP\Client $httpClient) - { - self::$_httpClient = $httpClient; - } - - - /** - * Gets the HTTP client object. If none is set, a new Zend_Http_Client will be used. - * - * @return Zend_Http_Client_Abstract - */ - public static function getHttpClient() - { - if (!self::$_httpClient instanceof HTTP\Client) { - self::$_httpClient = new HTTP\Client(); - } - - return self::$_httpClient; - } - - - /** - * Toggle using POST instead of PUT and DELETE HTTP methods - * - * Some feed implementations do not accept PUT and DELETE HTTP - * methods, or they can't be used because of proxies or other - * measures. This allows turning on using POST where PUT and - * DELETE would normally be used; in addition, an - * X-Method-Override header will be sent with a value of PUT or - * DELETE as appropriate. - * - * @param boolean $override Whether to override PUT and DELETE. - * @return void - */ - public static function setHttpMethodOverride($override = true) - { - self::$_httpMethodOverride = $override; - } - - - /** - * Get the HTTP override state - * - * @return boolean - */ - public static function getHttpMethodOverride() - { - return self::$_httpMethodOverride; - } - - - /** - * Get the full version of a namespace prefix - * - * Looks up a prefix (atom:, etc.) in the list of registered - * namespaces and returns the full namespace URI if - * available. Returns the prefix, unmodified, if it's not - * registered. - * - * @return string - */ - public static function lookupNamespace($prefix) - { - return isset(self::$_namespaces[$prefix]) ? - self::$_namespaces[$prefix] : - $prefix; - } - - - /** - * Add a namespace and prefix to the registered list - * - * Takes a prefix and a full namespace URI and adds them to the - * list of registered namespaces for use by - * Zend_Feed::lookupNamespace(). - * - * @param string $prefix The namespace prefix - * @param string $namespaceURI The full namespace URI - * @return void - */ - public static function registerNamespace($prefix, $namespaceURI) - { - self::$_namespaces[$prefix] = $namespaceURI; - } - - - /** - * Imports a feed located at $uri. - * - * @param string $uri - * @throws \Zend\Feed\Exception - * @return \Zend\Feed\AbstractFeed - */ - public static function import($uri) - { - $client = self::getHttpClient(); - $client->setUri($uri); - $response = $client->request('GET'); - if ($response->getStatus() !== 200) { - throw new Exception('Feed failed to load, got response code ' . $response->getStatus()); - } - $feed = $response->getBody(); - return self::importString($feed); - } - - - /** - * Imports a feed represented by $string. - * - * @param string $string - * @throws \Zend\Feed\Exception - * @return \Zend\Feed\AbstractFeed - */ - public static function importString($string) - { - // Load the feed as an XML DOMDocument object - $libxml_errflag = libxml_use_internal_errors(true); - $doc = new \DOMDocument; - if (trim($string) == '') { - throw new Exception('Document/string being imported' - . ' is an Empty string or comes from an empty HTTP response'); - } - $status = $doc->loadXML($string); - libxml_use_internal_errors($libxml_errflag); - - - if (!$status) { - // prevent the class to generate an undefined variable notice (ZF-2590) - // Build error message - $error = libxml_get_last_error(); - if ($error && $error->message) { - $errormsg = "DOMDocument cannot parse XML: {$error->message}"; - } else { - $errormsg = "DOMDocument cannot parse XML"; - } - - throw new Exception($errormsg); - } - - // Try to find the base feed element or a single of an Atom feed - if ($doc->getElementsByTagName('feed')->item(0) || - $doc->getElementsByTagName('entry')->item(0)) { - // return a newly created Zend_Feed_Atom object - return new Atom(null, $string); - } - - // Try to find the base feed element of an RSS feed - if ($doc->getElementsByTagName('channel')->item(0)) { - // return a newly created Zend_Feed_Rss object - return new RSS(null, $string); - } - - // $string does not appear to be a valid feed of the supported types - throw new Exception('Invalid or unsupported feed format'); - } - - - /** - * Imports a feed from a file located at $filename. - * - * @param string $filename - * @throws \Zend\Feed\Exception - * @return \Zend\Feed\AbstractFeed - */ - public static function importFile($filename) - { - @ini_set('track_errors', 1); - $feed = @file_get_contents($filename); - @ini_restore('track_errors'); - if ($feed === false) { - throw new Exception("File could not be loaded: $php_errormsg"); - } - return self::importString($feed); - } - - - /** - * Attempts to find feeds at $uri referenced by tags. Returns an - * array of the feeds referenced at $uri. - * - * @todo Allow findFeeds() to follow one, but only one, code 302. - * - * @param string $uri - * @throws \Zend\Feed\Exception - * @return array - */ - public static function findFeeds($uri) - { - // Get the HTTP response from $uri and save the contents - $client = self::getHttpClient(); - $client->setUri($uri); - $response = $client->request(); - if ($response->getStatus() !== 200) { - throw new Exception("Failed to access $uri, got response code " . $response->getStatus()); - } - $contents = $response->getBody(); - - // Parse the contents for appropriate tags - @ini_set('track_errors', 1); - $pattern = '~(]+)/?>~i'; - $result = @preg_match_all($pattern, $contents, $matches); - @ini_restore('track_errors'); - if ($result === false) { - throw new Exception("Internal error: $php_errormsg"); - } - - // Try to fetch a feed for each link tag that appears to refer to a feed - $feeds = array(); - if (isset($matches[1]) && count($matches[1]) > 0) { - foreach ($matches[1] as $link) { - // force string to be an utf-8 one - if (!mb_check_encoding($link, 'UTF-8')) { - $link = mb_convert_encoding($link, 'UTF-8'); - } - $xml = @simplexml_load_string(rtrim($link, ' /') . ' />'); - if ($xml === false) { - continue; - } - $attributes = $xml->attributes(); - if (!isset($attributes['rel']) || !@preg_match('~^(?:alternate|service\.feed)~i', $attributes['rel'])) { - continue; - } - if (!isset($attributes['type']) || - !@preg_match('~^application/(?:atom|rss|rdf)\+xml~', $attributes['type'])) { - continue; - } - if (!isset($attributes['href'])) { - continue; - } - try { - // checks if we need to canonize the given uri - try { - $uri = URI\Zend\Uri\Uri::factory((string) $attributes['href']); - } catch (end\URI\Exception $e) { - // canonize the uri - $path = (string) $attributes['href']; - $query = $fragment = ''; - if (substr($path, 0, 1) != '/') { - // add the current root path to this one - $path = rtrim($client->getUri()->getPath(), '/') . '/' . $path; - } - if (strpos($path, '?') !== false) { - list($path, $query) = explode('?', $path, 2); - } - if (strpos($query, '#') !== false) { - list($query, $fragment) = explode('#', $query, 2); - } - $uri = URI\Zend\Uri\Uri::factory($client->getUri(true)); - $uri->setPath($path); - $uri->setQuery($query); - $uri->setFragment($fragment); - } - - $feed = self::import($uri); - } catch (\Exception $e) { - continue; - } - $feeds[$uri->getUri()] = $feed; - } - } - - // Return the fetched feeds - return $feeds; - } -} diff --git a/src/RSS.php b/src/RSS.php deleted file mode 100644 index deb809e1..00000000 --- a/src/RSS.php +++ /dev/null @@ -1,517 +0,0 @@ -s). - * - * @var string - */ - protected $_entryElementName = 'item'; - - /** - * The default namespace for RSS channels. - * - * @var string - */ - protected $_defaultNamespace = 'rss'; - - /** - * Override Zend_Feed_Abstract to set up the $_element and $_entries aliases. - * - * @return void - * @throws \Zend\Feed\Exception - */ - public function __wakeup() - { - parent::__wakeup(); - - // 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); - } else { - $this->_element = $this->_element->getElementsByTagName('channel')->item(0); - } - if (!$this->_element) { - throw new Exception('No root element found, cannot parse channel.'); - } - - // Find the entries and save a pointer to them for speed and - // simplicity. - $this->_buildEntryCache(); - } - - - /** - * Make accessing some individual elements of the channel easier. - * - * Special accessors 'item' and 'items' are provided so that if - * you wish to iterate over an RSS channel's items, you can do so - * using foreach ($channel->items as $item) or foreach - * ($channel->item as $item). - * - * @param string $var The property to access. - * @return mixed - */ - public function __get($var) - { - switch ($var) { - case 'item': - // fall through to the next case - case 'items': - return $this; - - default: - return parent::__get($var); - } - } - - /** - * Generate the header of the feed when working in write mode - * - * @param array $array the data to use - * @return DOMElement root node - */ - protected function _mapFeedHeaders($array) - { - $channel = $this->_element->createElement('channel'); - - $title = $this->_element->createElement('title'); - $title->appendChild($this->_element->createCDATASection($array->title)); - $channel->appendChild($title); - - $link = $this->_element->createElement('link', $array->link); - $channel->appendChild($link); - - $desc = isset($array->description) ? $array->description : ''; - $description = $this->_element->createElement('description'); - $description->appendChild($this->_element->createCDATASection($desc)); - $channel->appendChild($description); - - $pubdate = isset($array->lastUpdate) ? $array->lastUpdate : time(); - $pubdate = $this->_element->createElement('pubDate', date(DATE_RSS, $pubdate)); - $channel->appendChild($pubdate); - - if (isset($array->published)) { - $lastBuildDate = $this->_element->createElement('lastBuildDate', date(DATE_RSS, $array->published)); - $channel->appendChild($lastBuildDate); - } - - $editor = ''; - if (!empty($array->email)) { - $editor .= $array->email; - } - if (!empty($array->author)) { - $editor .= ' (' . $array->author . ')'; - } - if (!empty($editor)) { - $author = $this->_element->createElement('managingEditor', ltrim($editor)); - $channel->appendChild($author); - } - if (isset($array->webmaster)) { - $channel->appendChild($this->_element->createElement('webMaster', $array->webmaster)); - } - - if (!empty($array->copyright)) { - $copyright = $this->_element->createElement('copyright', $array->copyright); - $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'); - $imagetitle->appendChild($this->_element->createCDATASection($array->title)); - $image->appendChild($imagetitle); - $imagelink = $this->_element->createElement('link', $array->link); - $image->appendChild($imagelink); - - $channel->appendChild($image); - } - - $generator = !empty($array->generator) ? $array->generator : 'Zend_Feed'; - $generator = $this->_element->createElement('generator', $generator); - $channel->appendChild($generator); - - if (!empty($array->language)) { - $language = $this->_element->createElement('language', $array->language); - $channel->appendChild($language); - } - - $doc = $this->_element->createElement('docs', 'http://blogs.law.harvard.edu/tech/rss'); - $channel->appendChild($doc); - - if (isset($array->cloud)) { - $cloud = $this->_element->createElement('cloud'); - $cloud->setAttribute('domain', $array->cloud['uri']->getHost()); - $cloud->setAttribute('port', $array->cloud['uri']->getPort()); - $cloud->setAttribute('path', $array->cloud['uri']->getPath()); - $cloud->setAttribute('registerProcedure', $array->cloud['procedure']); - $cloud->setAttribute('protocol', $array->cloud['protocol']); - $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); - } - - if (isset($array->textInput)) { - $textinput = $this->_element->createElement('textInput'); - $textinput->appendChild($this->_element->createElement('title', $array->textInput['title'])); - $textinput->appendChild($this->_element->createElement('description', $array->textInput['description'])); - $textinput->appendChild($this->_element->createElement('name', $array->textInput['name'])); - $textinput->appendChild($this->_element->createElement('link', $array->textInput['link'])); - $channel->appendChild($textinput); - } - - if (isset($array->skipHours)) { - $skipHours = $this->_element->createElement('skipHours'); - foreach ($array->skipHours as $hour) { - $skipHours->appendChild($this->_element->createElement('hour', $hour)); - } - $channel->appendChild($skipHours); - } - - if (isset($array->skipDays)) { - $skipDays = $this->_element->createElement('skipDays'); - foreach ($array->skipDays as $day) { - $skipDays->appendChild($this->_element->createElement('day', $day)); - } - $channel->appendChild($skipDays); - } - - if (isset($array->itunes)) { - $this->_buildiTunes($channel, $array); - } - - return $channel; - } - - /** - * Adds the iTunes extensions to a root node - * - * @param DOMElement $root - * @param array $array - * @return void - */ - private function _buildiTunes(\DOMElement $root, $array) - { - /* author node */ - $author = ''; - if (isset($array->itunes->author)) { - $author = $array->itunes->author; - } elseif (isset($array->author)) { - $author = $array->author; - } - if (!empty($author)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:author', $author); - $root->appendChild($node); - } - - /* owner node */ - $author = ''; - $email = ''; - if (isset($array->itunes->owner)) { - if (isset($array->itunes->owner['name'])) { - $author = $array->itunes->owner['name']; - } - if (isset($array->itunes->owner['email'])) { - $email = $array->itunes->owner['email']; - } - } - if (empty($author) && isset($array->author)) { - $author = $array->author; - } - if (empty($email) && isset($array->email)) { - $email = $array->email; - } - if (!empty($author) || !empty($email)) { - $owner = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:owner'); - if (!empty($author)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:name', $author); - $owner->appendChild($node); - } - if (!empty($email)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:email', $email); - $owner->appendChild($node); - } - $root->appendChild($owner); - } - $image = ''; - if (isset($array->itunes->image)) { - $image = $array->itunes->image; - } elseif (isset($array->image)) { - $image = $array->image; - } - if (!empty($image)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:image'); - $node->setAttribute('href', $image); - $root->appendChild($node); - } - $subtitle = ''; - if (isset($array->itunes->subtitle)) { - $subtitle = $array->itunes->subtitle; - } elseif (isset($array->description)) { - $subtitle = $array->description; - } - if (!empty($subtitle)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:subtitle', $subtitle); - $root->appendChild($node); - } - $summary = ''; - if (isset($array->itunes->summary)) { - $summary = $array->itunes->summary; - } elseif (isset($array->description)) { - $summary = $array->description; - } - if (!empty($summary)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:summary', $summary); - $root->appendChild($node); - } - if (isset($array->itunes->block)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:block', $array->itunes->block); - $root->appendChild($node); - } - if (isset($array->itunes->explicit)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:explicit', $array->itunes->explicit); - $root->appendChild($node); - } - if (isset($array->itunes->keywords)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:keywords', $array->itunes->keywords); - $root->appendChild($node); - } - if (isset($array->itunes->new_feed_url)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:new-feed-url', $array->itunes->new_feed_url); - $root->appendChild($node); - } - if (isset($array->itunes->category)) { - foreach ($array->itunes->category as $i => $category) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); - $node->setAttribute('text', $category['main']); - $root->appendChild($node); - $add_end_category = false; - if (!empty($category['sub'])) { - $add_end_category = true; - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); - $node->setAttribute('text', $category['sub']); - $root->appendChild($node); - } - if ($i > 0 || $add_end_category) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); - $root->appendChild($node); - } - } - } - } - - /** - * Generate the entries of the feed when working in write mode - * - * The following nodes are constructed for each feed entry - * - * entry title - * url to feed entry - * url to feed entry - * short text - * long version, can contain html - * - * - * @param DOMElement $root the root node to use - * @param array $array the data to use - * @return void - */ - protected function _mapFeedEntries(\DOMElement $root, $array) - { - Feed::registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/'); - - foreach ($array as $dataentry) { - $item = $this->_element->createElement('item'); - - $title = $this->_element->createElement('title'); - $title->appendChild($this->_element->createCDATASection($dataentry->title)); - $item->appendChild($title); - - if (isset($dataentry->author)) { - $author = $this->_element->createElement('author', $dataentry->author); - $item->appendChild($author); - } - - $link = $this->_element->createElement('link', $dataentry->link); - $item->appendChild($link); - - if (isset($dataentry->guid)) { - $guid = $this->_element->createElement('guid', $dataentry->guid); - //if (!\Zend\Uri\Uri::check($dataentry->guid)) { - $guid->setAttribute('isPermaLink', 'false'); - //} - $item->appendChild($guid); - } - - $description = $this->_element->createElement('description'); - $description->appendChild($this->_element->createCDATASection($dataentry->description)); - $item->appendChild($description); - - if (isset($dataentry->content)) { - $content = $this->_element->createElement('content:encoded'); - $content->appendChild($this->_element->createCDATASection($dataentry->content)); - $item->appendChild($content); - } - - $pubdate = isset($dataentry->lastUpdate) ? $dataentry->lastUpdate : time(); - $pubdate = $this->_element->createElement('pubDate', date(DATE_RSS, $pubdate)); - $item->appendChild($pubdate); - - if (isset($dataentry->category)) { - foreach ($dataentry->category as $category) { - $node = $this->_element->createElement('category', $category['term']); - if (isset($category['scheme'])) { - $node->setAttribute('domain', $category['scheme']); - } - $item->appendChild($node); - } - } - - if (isset($dataentry->source)) { - $source = $this->_element->createElement('source', $dataentry->source['title']); - $source->setAttribute('url', $dataentry->source['url']); - $item->appendChild($source); - } - - if (isset($dataentry->comments)) { - $comments = $this->_element->createElement('comments', $dataentry->comments); - $item->appendChild($comments); - } - if (isset($dataentry->commentRss)) { - $comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/', - 'wfw:commentRss', - $dataentry->commentRss); - $item->appendChild($comments); - } - - - if (isset($dataentry->enclosure)) { - foreach ($dataentry->enclosure as $enclosure) { - $node = $this->_element->createElement('enclosure'); - $node->setAttribute('url', $enclosure['url']); - if (isset($enclosure['type'])) { - $node->setAttribute('type', $enclosure['type']); - } - if (isset($enclosure['length'])) { - $node->setAttribute('length', $enclosure['length']); - } - $item->appendChild($node); - } - } - - $root->appendChild($item); - } - } - - /** - * Override Zend_Feed_Element to include root node - * - * @return string - */ - public function saveXml() - { - // Return a complete document including XML prologue. - $doc = new \DOMDocument($this->_element->ownerDocument->version, - $this->_element->ownerDocument->actualEncoding); - $root = $doc->createElement('rss'); - - // Use rss version 2.0 - $root->setAttribute('version', '2.0'); - - // Content namespace - $root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:content', 'http://purl.org/rss/1.0/modules/content/'); - $root->appendChild($doc->importNode($this->_element, true)); - - // Append root node - $doc->appendChild($root); - - // Format output - $doc->formatOutput = true; - - return $doc->saveXML(); - } - - /** - * Send feed to a http client with the correct header - * - * @return void - * @throws \Zend\Feed\Exception if headers have already been sent - */ - public function send() - { - if (headers_sent()) { - throw new Exception('Cannot send RSS because headers have already been sent.'); - } - - header('Content-Type: application/rss+xml; charset=' . $this->_element->ownerDocument->actualEncoding); - - echo $this->saveXml(); - } - -} diff --git a/test/ArrayAccessTest.php b/test/ArrayAccessTest.php deleted file mode 100644 index 0b9d9541..00000000 --- a/test/ArrayAccessTest.php +++ /dev/null @@ -1,110 +0,0 @@ -_feed = Feed\Feed::importFile(__DIR__ . '/_files/TestAtomFeed.xml'); - $this->_nsfeed = Feed\Feed::importFile(__DIR__ . '/_files/TestAtomFeedNamespaced.xml'); - } - - public function testExists() - { - $this->assertFalse(isset($this->_feed[-1]), 'Negative array access should fail'); - $this->assertTrue(isset($this->_feed['version']), 'Feed version should be set'); - - $this->assertFalse(isset($this->_nsfeed[-1]), 'Negative array access should fail'); - $this->assertTrue(isset($this->_nsfeed['version']), 'Feed version should be set'); - } - - public function testGet() - { - $this->assertEquals($this->_feed['version'], '1.0', 'Feed version should be 1.0'); - $this->assertEquals($this->_nsfeed['version'], '1.0', 'Feed version should be 1.0'); - } - - public function testSet() - { - $this->_feed['category'] = 'tests'; - $this->assertTrue(isset($this->_feed['category']), 'Feed category should be set'); - $this->assertEquals($this->_feed['category'], 'tests', 'Feed category should be tests'); - - $this->_nsfeed['atom:category'] = 'tests'; - $this->assertTrue(isset($this->_nsfeed['atom:category']), 'Feed category should be set'); - $this->assertEquals($this->_nsfeed['atom:category'], 'tests', 'Feed category should be tests'); - - // Changing an existing index. - $oldEntry = $this->_feed['version']; - $this->_feed['version'] = '1.1'; - $this->assertTrue($oldEntry != $this->_feed['version'], 'Version should have changed'); - } - - public function testUnset() - { - $feed = Feed\Feed::importFile(__DIR__ . '/_files/TestAtomFeed.xml'); - unset($feed['version']); - $this->assertFalse(isset($feed['version']), 'Version should be unset'); - $this->assertEquals('', $feed['version'], 'Version should be equal to the empty string'); - - $nsfeed = Feed\Feed::importFile(__DIR__ . '/_files/TestAtomFeedNamespaced.xml'); - unset($nsfeed['version']); - $this->assertFalse(isset($nsfeed['version']), 'Version should be unset'); - $this->assertEquals('', $nsfeed['version'], 'Version should be equal to the empty string'); - } - - /** - * @issue ZF-5354 - */ - public function testGetsLinkWithEmptyOrMissingRelAsAlternateRel() - { - $feed = Feed\Feed::importFile(__DIR__ . '/_files/AtomHOnline.xml'); - $entry = $feed->current(); - $this->assertEquals('http://www.h-online.com/security/Google-acquires-reCAPTCHA--/news/114266/from/rss', $entry->link('alternate')); - } - -} diff --git a/test/AtomEntryOnlyTest.php b/test/AtomEntryOnlyTest.php deleted file mode 100644 index 1f2b5208..00000000 --- a/test/AtomEntryOnlyTest.php +++ /dev/null @@ -1,56 +0,0 @@ -assertEquals(1, $feed->count(), 'The entry-only feed should report one entry.'); - - $feed->current(); - - foreach ($feed as $entry); - $this->assertEquals('Zend\Feed\Entry\Atom', get_class($entry), - 'The single entry should be an instance of Zend_Feed_Entry_Atom'); - - $this->assertEquals('1', $entry->id(), 'The single entry should have id 1'); - $this->assertEquals('Bug', $entry->title(), 'The entry\'s title should be "Bug"'); - } - -} diff --git a/test/AtomPublishingTest.php b/test/AtomPublishingTest.php deleted file mode 100644 index ed25715c..00000000 --- a/test/AtomPublishingTest.php +++ /dev/null @@ -1,140 +0,0 @@ -_uri = 'http://fubar.com/myFeed'; - } - - public function tearDown() - { - Feed\Feed::setHttpClient(new HTTP\Client()); - } - - public function testPost() - { - Feed\Feed::setHttpClient(new TestClient()); - - $entry = new Entry\Atom(); - - /* Give the entry its initial values. */ - $entry->title = 'Entry 1'; - $entry->content = '1.1'; - $entry->content['type'] = 'text'; - - /* Do the initial post. The base feed URI is the same as the - * POST URI, so just supply save() with that. */ - $entry->save($this->_uri); - - /* $entry will be filled in with any elements returned by the - * server (id, updated, link rel="edit", etc). */ - $this->assertEquals('1', $entry->id(), 'Expected id to be 1'); - $this->assertEquals('Entry 1', $entry->title(), 'Expected title to be "Entry 1"'); - $this->assertEquals('1.1', $entry->content(), 'Expected content to be "1.1"'); - $this->assertEquals('text', $entry->content['type'], 'Expected content/type to be "text"'); - $this->assertEquals('2005-05-23T16:26:00-08:00', $entry->updated(), 'Expected updated date of 2005-05-23T16:26:00-08:00'); - $this->assertEquals('http://fubar.com/myFeed/1/1/', $entry->link('edit'), 'Expected edit URI of http://fubar.com/myFeed/1/1/'); - } - - public function testEdit() - { - Feed\Feed::setHttpClient(new TestClient()); - $contents = file_get_contents(__DIR__ . '/_files/AtomPublishingTest-before-update.xml'); - - /* The base feed URI is the same as the POST URI, so just supply the - * Zend_Feed_Entry_Atom object with that. */ - $entry = new Entry\Atom($this->_uri, $contents); - - /* Initial state. */ - $this->assertEquals('2005-05-23T16:26:00-08:00', $entry->updated(), 'Initial state of updated timestamp does not match'); - $this->assertEquals('http://fubar.com/myFeed/1/1/', $entry->link('edit'), 'Initial state of edit link does not match'); - - /* Just change the entry's properties directly. */ - $entry->content = '1.2'; - - /* Then save the changes. */ - $entry->save(); - - /* New state. */ - $this->assertEquals('1.2', $entry->content(), 'Content change did not stick'); - $this->assertEquals('2005-05-23T16:27:00-08:00', $entry->updated(), 'New updated link is not correct'); - $this->assertEquals('http://fubar.com/myFeed/1/2/', $entry->link('edit'), 'New edit link is not correct'); - } -} - -/** - * A test wrapper around Zend_Http_Client, not actually performing - * the request. - * - */ -class TestClient extends HTTP\Client -{ - public function request($method = null) - { - $code = 400; - $body = ''; - - switch ($method) { - case self::POST: - $code = 201; - $body = file_get_contents(__DIR__ . '/_files/AtomPublishingTest-created-entry.xml'); - break; - - case self::PUT: - $doc1 = new \DOMDocument(); - $doc1->load(__DIR__ . '/_files/AtomPublishingTest-expected-update.xml'); - $doc2 = new \DOMDocument(); - $doc2->loadXML($this->raw_post_data); - if ($doc1->saveXml() == $doc2->saveXml()) { - $code = 200; - $body = file_get_contents(__DIR__ . '/_files/AtomPublishingTest-updated-entry.xml'); - } - break; - - default: - break; - } - - return new \Zend\HTTP\Response\Response($code, array(), $body); - } -} diff --git a/test/CountTest.php b/test/CountTest.php deleted file mode 100644 index 11618f34..00000000 --- a/test/CountTest.php +++ /dev/null @@ -1,63 +0,0 @@ -assertEquals($f->count(), 2, 'Feed count should be 2'); - } - - /** - * ZF-3848 - */ - public function testCountableInterface() - { - $f = Feed\Feed::importFile(__DIR__ . '/_files/TestAtomFeed.xml'); - $this->assertEquals(count($f), 2, 'Feed count should be 2'); - } - -} diff --git a/test/ElementTest.php b/test/ElementTest.php deleted file mode 100644 index f09f85cf..00000000 --- a/test/ElementTest.php +++ /dev/null @@ -1,175 +0,0 @@ -author->name['last'] = 'hagenbuch'; - $e->author->name['first'] = 'chuck'; - $e->author->name->{'chuck:url'} = 'marina.horde.org'; - - $e->author->title['foo'] = 'bar'; - if ($e->pants()) { - $this->fail(' does not exist, it should not have a true value'); - // This should not create an element in the actual tree. - } - if ($e->pants()) { - $this->fail(' should not have been created by testing for it'); - // This should not create an element in the actual tree. - } - - $xml = $e->saveXml(); - - $this->assertFalse(strpos($xml, 'pants'), ' should not be in the xml output'); - $this->assertTrue(strpos($xml, 'marina.horde.org') !== false, 'the url attribute should be set'); - } - - public function testStrings() - { - $xml = " - Using C++ Intrinsic Functions for Pipelined Text Processing - http://www.oreillynet.com/pub/wlg/8356 - - -
- A good C++ programming technique that has almost no published material available on the WWW relates to using the special pipeline instructions in modern CPUs for faster text processing. Here's example code using C++ intrinsic functions to give a fourfold speed increase for a UTF-8 to UTF-16 converter compared to the original C/C++ code. -
-
- Rick Jelliffe - 2005-11-07T08:15:57-08:00 -
"; - - $entry = new Entry\Atom('uri', $xml); - - $this->assertTrue($entry->summary instanceof Feed\Element, '__get access should return an Zend_Feed_Element instance'); - $this->assertFalse($entry->summary() instanceof Feed\Element, 'method access should not return an Zend_Feed_Element instance'); - $this->assertTrue(is_string($entry->summary()), 'method access should return a string'); - $this->assertFalse(is_string($entry->summary), '__get access should not return a string'); - } - - public function testSetNamespacedAttributes() - { - $value = 'value'; - - $e = new Entry\Atom(); - $e->test['attr'] = $value; - $e->test['namespace1:attr'] = $value; - $e->test['namespace2:attr'] = $value; - - $this->assertEquals($value, $e->test['attr']); - $this->assertEquals($value, $e->test['namespace1:attr']); - $this->assertEquals($value, $e->test['namespace2:attr']); - } - - public function testUnsetNamespacedAttributes() - { - $value = 'value'; - - $e = new Entry\Atom(); - $e->test['attr'] = $value; - $e->test['namespace1:attr'] = $value; - $e->test['namespace2:attr'] = $value; - - $this->assertEquals($value, $e->test['attr']); - $this->assertEquals($value, $e->test['namespace1:attr']); - $this->assertEquals($value, $e->test['namespace2:attr']); - - unset($e->test['attr']); - unset($e->test['namespace1:attr']); - unset($e->test['namespace2:attr']); - - $this->assertEquals('', $e->test['attr']); - $this->assertEquals('', $e->test['namespace1:attr']); - $this->assertEquals('', $e->test['namespace1:attr']); - } - - /** - * @group ZF-2606 - */ - public function testValuesWithXmlSpecialChars() - { - $testAmp = '&'; - $testLt = '<'; - $testGt = '>'; - - $e = new Entry\Atom(); - $e->testAmp = $testAmp; - $e->{'namespace1:lt'} = $testLt; - $e->{'namespace1:gt'} = $testGt; - - $this->assertEquals($testAmp, $e->testAmp()); - $this->assertEquals($testLt, $e->{'namespace1:lt'}()); - $this->assertEquals($testGt, $e->{'namespace1:gt'}()); - } - - /** - * @group ZF-2606 - */ - public function testAttributesWithXmlSpecialChars() - { - $testAmp = '&'; - $testLt = '<'; - $testGt = '>'; - $testQuot = '"'; - $testSquot = "'"; - - $e = new Entry\Atom(); - $e->test['amp'] = $testAmp; - $e->test['namespace1:lt'] = $testLt; - $e->test['namespace1:gt'] = $testGt; - $e->test['namespace1:quot'] = $testQuot; - $e->test['namespace1:squot'] = $testSquot; - - $this->assertEquals($testAmp, $e->test['amp']); - $this->assertEquals($testLt, $e->test['namespace1:lt']); - $this->assertEquals($testGt, $e->test['namespace1:gt']); - $this->assertEquals($testQuot, $e->test['namespace1:quot']); - $this->assertEquals($testSquot, $e->test['namespace1:squot']); - } - -} diff --git a/test/Entry/RSSTest.php b/test/Entry/RSSTest.php deleted file mode 100644 index 59b97e83..00000000 --- a/test/Entry/RSSTest.php +++ /dev/null @@ -1,75 +0,0 @@ -assertType('Zend\Feed\RSS', $feed); - - $item = $feed->current(); - $this->assertType('Zend\Feed\Entry\RSS', $item); - - $this->assertTrue(isset($item->content)); - $this->assertContains( - 'http://framework.zend.com/fisheye/changelog/Zend_Framework/?cs=7757', - $item->content->__toString() - ); - $this->assertContains( - 'http://framework.zend.com/fisheye/changelog/Zend_Framework/?cs=7757', - $item->content() - ); - $item->content = 'foo'; - $this->assertEquals('foo', $item->content->__toString()); - } - - public function testContentEncodedNullIfEmpty() - { - $feed = Feed\Feed::importFile(__DIR__ . '/../_files/TestFeedEntryRssContentEncoded.xml'); - $this->assertType('Zend\Feed\RSS', $feed); - - $feed->next(); - $item = $feed->current(); - $this->assertType('Zend\Feed\Entry\RSS', $item); - $this->assertFalse(isset($item->content)); - $this->assertNull($item->content()); - // $this->assertNull($item->content); // always return DOMElement Object - } - -} diff --git a/test/ImportTest.php b/test/ImportTest.php deleted file mode 100644 index c6891f54..00000000 --- a/test/ImportTest.php +++ /dev/null @@ -1,277 +0,0 @@ -_adapter = new \Zend\HTTP\Client\Adapter\Test(); - Feed\Feed::setHttpClient(new HTTP\Client(null, array('adapter' => $this->_adapter))); - $this->_client = Feed\Feed::getHttpClient(); - $this->_feedDir = __DIR__ . '/_files'; - } - - /** - * Test an atom feed generated by google's Blogger platform - */ - public function testAtomGoogle() - { - $this->_importAtomValid('AtomTestGoogle.xml'); - } - - /** - * Test an atom feed generated by mozillaZine.org - */ - public function testAtomMozillazine() - { - $this->_importAtomValid('AtomTestMozillazine.xml'); - } - - /** - * Test an atom feed generated by O'Reilly - */ - public function testAtomOReilly() - { - $this->_importAtomValid('AtomTestOReilly.xml'); - } - - /** - * Test an atom feed generated by PlanetPHP - */ - public function testAtomPlanetPHP() - { - $this->_importAtomValid('AtomTestPlanetPHP.xml'); - } - - /** - * Test a small atom feed - */ - public function testAtomSample1() - { - $this->_importAtomValid('AtomTestSample1.xml'); - } - - /** - * Test a small atom feed without any entries - */ - public function testAtomSample2() - { - $this->_importAtomValid('AtomTestSample2.xml'); - } - - /** - * Test an atom feed with a
tag missing - */ - public function testAtomSample3() - { - $this->_importInvalid('AtomTestSample3.xml'); - } - - /** - * Test an atom feed with links within entries - */ - public function testAtomSample4() - { - $this->_importAtomValid('AtomTestSample4.xml'); - } - - /** - * Test a RSS feed generated by UserLand Frontier v9.5 - */ - public function testRssHarvardLaw() - { - $this->_importRssValid('RssTestHarvardLaw.xml'); - } - - /** - * Test a RSS feed generated by PlanetPHP - */ - public function testRssPlanetPHP() - { - $this->_importRssValid('RssTestPlanetPHP.xml'); - } - - /** - * Test a RSS feed generated by Slashdot - */ - public function testRssSlashdot() - { - $this->_importRssValid('RssTestSlashdot.xml'); - } - - /** - * Test a RSS feed generated by CNN - */ - public function testRssCNN() - { - $this->_importRssValid('RssTestCNN.xml'); - } - - /** - * Test a valid RSS 0.91 sample - */ - public function testRss091Sample1() - { - $this->_importRssValid('RssTest091Sample1.xml'); - } - - /** - * Test a valid RSS 0.91 sample - */ - public function testRss092Sample1() - { - $this->_importRssValid('RssTest092Sample1.xml'); - } - - /** - * Test a valid RSS 1.0 sample - */ - public function testRss100Sample1() - { - $feed = $this->_importRssValid('RssTest100Sample1.xml'); - $this->assertEquals(2, $feed->count()); - } - - /** - * Test a valid RSS 1.0 sample with some extensions in it - */ - public function testRss100Sample2() - { - $feed = $this->_importRssValid('RssTest100Sample2.xml'); - $this->assertEquals(1, $feed->count()); - } - - /** - * Test a valid RSS 2.0 sample - */ - public function testRss200Sample1() - { - $this->_importRssValid('RssTest200Sample1.xml'); - } - - /** - * Imports an invalid feed and ensure everything works as expected - * even if XDebug is running (ZF-2590). - */ - public function testImportInvalidIsXdebugAware() - { - if (!function_exists('xdebug_is_enabled')) { - $this->markTestIncomplete('XDebug not installed'); - } - - $response = new Response\Response(200, array(), ''); - $this->_adapter->setResponse($response); - - try { - $feed = Feed\Feed::import('http://localhost'); - $this->fail('Expected Zend_Feed_Exception not thrown'); - } catch (Feed\Exception $e) { - $this->assertType('Zend\Feed\Exception', $e); - $this->assertRegExp('/(XDebug is running|Empty string)/', $e->getMessage()); - } - } - - /** - * Import an invalid atom feed - */ - protected function _importAtomValid($filename) - { - $response = new Response\Response(200, array(), file_get_contents("$this->_feedDir/$filename")); - $this->_adapter->setResponse($response); - - $feed = Feed\Feed::import('http://localhost'); - $this->assertType('Zend\Feed\Atom', $feed); - } - - /** - * Import a valid rss feed - */ - protected function _importRssValid($filename) - { - $response = new Response\Response(200, array(), file_get_contents("$this->_feedDir/$filename")); - $this->_adapter->setResponse($response); - - $feed = Feed\Feed::import('http://localhost'); - $this->assertType('Zend\Feed\RSS', $feed); - return $feed; - } - - /** - * Imports an invalid feed - */ - protected function _importInvalid($filename) - { - $response = new Response\Response(200, array(), file_get_contents("$this->_feedDir/$filename")); - $this->_adapter->setResponse($response); - - try { - $feed = Feed\Feed::import('http://localhost'); - $this->fail('Expected Zend_Feed_Exception not thrown'); - } catch (Feed\Exception $e) { - $this->assertType('Zend\Feed\Exception', $e); - } - } - - /** - * @issue ZF-5903 - */ - public function testFindFeedsIncludesUriAsArrayKey() - { - if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - ) { - $this->markTestSkipped('testFindFeedsIncludesUriAsArrayKey() requires a network connection'); - return; - } - Feed\Feed::setHttpClient(new HTTP\Client); - $feeds = Feed\Feed::findFeeds('http://www.planet-php.net'); - $this->assertEquals(array( - 'http://www.planet-php.org:80/rss/', 'http://www.planet-php.org:80/rdf/' - ), array_keys($feeds)); - } -} diff --git a/test/IteratorTest.php b/test/IteratorTest.php deleted file mode 100644 index 99daa962..00000000 --- a/test/IteratorTest.php +++ /dev/null @@ -1,126 +0,0 @@ -_feed = Feed\Feed::importFile(__DIR__ . '/_files/TestAtomFeed.xml'); - $this->_nsfeed = Feed\Feed::importFile(__DIR__ . '/_files/TestAtomFeedNamespaced.xml'); - } - - public function testRewind() - { - $times = 0; - foreach ($this->_feed as $f) { - ++$times; - } - - $times2 = 0; - foreach ($this->_feed as $f) { - ++$times2; - } - - $this->assertEquals($times, $times2, 'Feed should have the same number of iterations multiple times through'); - - $times = 0; - foreach ($this->_nsfeed as $f) { - ++$times; - } - - $times2 = 0; - foreach ($this->_nsfeed as $f) { - ++$times2; - } - - $this->assertEquals($times, $times2, 'Feed should have the same number of iterations multiple times through'); - } - - public function testCurrent() - { - foreach ($this->_feed as $f) { - $this->assertType('Zend\Feed\Entry\Atom', $f, 'Each feed entry should be an instance of Zend_Feed_Entry_Atom'); - break; - } - - foreach ($this->_nsfeed as $f) { - $this->assertType('Zend\Feed\Entry\Atom', $f, 'Each feed entry should be an instance of Zend_Feed_Entry_Atom'); - break; - } - } - - public function testKey() - { - $keys = array(); - foreach ($this->_feed as $k => $f) { - $keys[] = $k; - } - $this->assertEquals($keys, array(0, 1), 'Feed should have keys 0 and 1'); - - $keys = array(); - foreach ($this->_nsfeed as $k => $f) { - $keys[] = $k; - } - $this->assertEquals($keys, array(0, 1), 'Feed should have keys 0 and 1'); - } - - public function testNext() - { - $last = null; - foreach ($this->_feed as $current) { - $this->assertFalse($last === $current, 'Iteration should produce a new object each entry'); - $last = $current; - } - - $last = null; - foreach ($this->_nsfeed as $current) { - $this->assertFalse($last === $current, 'Iteration should produce a new object each entry'); - $last = $current; - } - } - -} diff --git a/test/Pubsubhubbub/Model/SubscriptionTest.php b/test/PubSubHubbub/Model/SubscriptionTest.php similarity index 81% rename from test/Pubsubhubbub/Model/SubscriptionTest.php rename to test/PubSubHubbub/Model/SubscriptionTest.php index 284281e4..dd198e1d 100644 --- a/test/Pubsubhubbub/Model/SubscriptionTest.php +++ b/test/PubSubHubbub/Model/SubscriptionTest.php @@ -19,9 +19,10 @@ * @version $Id$ */ -require_once dirname(dirname(dirname(dirname(__DIR__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php'; +namespace ZendTest\Feed\PubSubHubbub\Model; + +use Zend\Feed\PubSubHubbub\Model\Subscription; -require_once 'Zend/Feed/Pubsubhubbub/Model/Subscription.php'; /** * @category Zend * @package Zend_Feed @@ -31,7 +32,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Pubsubhubbub_Model_SubscriptionTest extends PHPUnit_Framework_TestCase +class SubscriptionTest extends \PHPUnit_Framework_TestCase { /** * @group ZF-10069 @@ -39,7 +40,7 @@ class Zend_Feed_Pubsubhubbub_Model_SubscriptionTest extends PHPUnit_Framework_Te public function testAllOperations() { $this->_initDb(); - $subscription = new Zend_Feed_Pubsubhubbub_Model_Subscription(); + $subscription = new Subscription(); $id = uniqid(); $this->assertFalse($subscription->hasSubscription($id)); $this->assertFalse($subscription->getSubscription($id)); @@ -61,19 +62,20 @@ public function testAllOperations() public function testImpemetsSubscriptionInterface() { - $reflection = new ReflectionClass('Zend_Feed_Pubsubhubbub_Model_Subscription'); - $this->assertTrue($reflection->implementsInterface('Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface')); + $reflection = new \ReflectionClass('Zend\Feed\PubSubHubbub\Model\Subscription'); + $this->assertTrue($reflection->implementsInterface('Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence')); unset($reflection); } protected function _initDb() { if (!extension_loaded('pdo') - && !in_array('sqlite', PDO::getAvailableDrivers())) { + && !in_array('sqlite', \PDO::getAvailableDrivers()) + ) { $this->markTestSkipped('Test only with pdo_sqlite'); } - $db = Zend_Db::factory('Pdo_Sqlite', array('dbname' => ':memory:')); - Zend_Db_Table::setDefaultAdapter($db); + $db = \Zend\DB\DB::factory('PDO\SQLite', array('dbname' => ':memory:')); + \Zend\DB\Table\AbstractTable::setDefaultAdapter($db); $this->_createTable(); } @@ -92,6 +94,6 @@ protected function _createTable() . "PRIMARY KEY (id) " . ");"; - Zend_Db_Table::getDefaultAdapter()->getConnection()->query($sql); + \Zend\DB\Table\AbstractTable::getDefaultAdapter()->getConnection()->query($sql); } -} \ No newline at end of file +} diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php index 597effde..b68e10df 100644 --- a/test/Writer/FeedTest.php +++ b/test/Writer/FeedTest.php @@ -270,41 +270,38 @@ public function testGetDateModifiedReturnsNullIfDateNotSet() public function testSetLastBuildDateDefaultsToCurrentTime() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed; $writer->setLastBuildDate(); - $dateNow = new Zend_Date; + $dateNow = new Date\Date; $this->assertTrue($dateNow->isLater($writer->getLastBuildDate()) || $dateNow->equals($writer->getLastBuildDate())); } public function testSetLastBuildDateUsesGivenUnixTimestamp() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed; $writer->setLastBuildDate(1234567890); - $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($writer->getLastBuildDate())); } public function testSetLastBuildDateUsesZendDateObject() { - $writer = new Zend_Feed_Writer_Feed; - $writer->setLastBuildDate(new Zend_Date('1234567890', Zend_Date::TIMESTAMP)); - $myDate = new Zend_Date('1234567890', Zend_Date::TIMESTAMP); + $writer = new WriterFeed; + $writer->setLastBuildDate(new Date\Date('1234567890', Date\Date::TIMESTAMP)); + $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($writer->getLastBuildDate())); } public function testSetLastBuildDateThrowsExceptionOnInvalidParameter() { - $writer = new Zend_Feed_Writer_Feed; - try { - $writer->setLastBuildDate('abc'); - $this->fail(); - } catch (Zend_Feed_Exception $e) { - } + $this->setExpectedException('Zend\Feed\Exception'); + $writer = new WriterFeed; + $writer->setLastBuildDate('abc'); } public function testGetLastBuildDateReturnsNullIfDateNotSet() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed; $this->assertTrue(is_null($writer->getLastBuildDate())); } @@ -536,7 +533,7 @@ public function testSetsGeneratorThrowsExceptionOnInvalidUri() */ public function testSetsGeneratorName_Deprecated() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed; $writer->setGenerator('ZFW'); $this->assertEquals(array('name'=>'ZFW'), $writer->getGenerator()); } @@ -546,7 +543,7 @@ public function testSetsGeneratorName_Deprecated() */ public function testSetsGeneratorVersion_Deprecated() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed; $writer->setGenerator('ZFW', '1.0'); $this->assertEquals(array('name'=>'ZFW', 'version' => '1.0'), $writer->getGenerator()); } @@ -556,7 +553,7 @@ public function testSetsGeneratorVersion_Deprecated() */ public function testSetsGeneratorUri_Deprecated() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed; $writer->setGenerator('ZFW', null, 'http://www.example.com'); $this->assertEquals(array('name'=>'ZFW', 'uri' => 'http://www.example.com'), $writer->getGenerator()); } @@ -566,12 +563,9 @@ public function testSetsGeneratorUri_Deprecated() */ public function testSetsGeneratorThrowsExceptionOnInvalidName_Deprecated() { - $writer = new Zend_Feed_Writer_Feed; - try { - $writer->setGenerator(''); - $this->fail(); - } catch (Zend_Feed_Exception $e) { - } + $this->setExpectedException('Zend\Feed\Exception'); + $writer = new WriterFeed; + $writer->setGenerator(''); } /** @@ -579,12 +573,9 @@ public function testSetsGeneratorThrowsExceptionOnInvalidName_Deprecated() */ public function testSetsGeneratorThrowsExceptionOnInvalidVersion_Deprecated() { - $writer = new Zend_Feed_Writer_Feed; - try { - $writer->setGenerator('ZFW', ''); - $this->fail(); - } catch (Zend_Feed_Exception $e) { - } + $this->setExpectedException('Zend\Feed\Exception'); + $writer = new WriterFeed; + $writer->setGenerator('ZFW', ''); } /** @@ -592,12 +583,9 @@ public function testSetsGeneratorThrowsExceptionOnInvalidVersion_Deprecated() */ public function testSetsGeneratorThrowsExceptionOnInvalidUri_Deprecated() { - $writer = new Zend_Feed_Writer_Feed; - try { - $writer->setGenerator('ZFW', null, 'notauri'); - $this->fail(); - } catch (Feed\Exception $e) { - } + $this->setExpectedException('Zend\Feed\Exception'); + $writer = new WriterFeed; + $writer->setGenerator('ZFW', null, 'notauri'); } public function testGetGeneratorReturnsNullIfDateNotSet() @@ -737,7 +725,7 @@ public function testAddingCategoryWithInvalidUriAsSchemeThrowsException() public function testSetsImageUri() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed; $writer->setImage(array( 'uri' => 'http://www.example.com/logo.gif' )); @@ -746,32 +734,26 @@ public function testSetsImageUri() ), $writer->getImage()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetsImageUriThrowsExceptionOnEmptyUri() { - $writer = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $writer = new WriterFeed; $writer->setImage(array( 'uri' => '' )); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetsImageUriThrowsExceptionOnMissingUri() { - $writer = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $writer = new WriterFeed; $writer->setImage(array()); } - /** - * @expectedException Zend_Feed_Exception - */ public function testSetsImageUriThrowsExceptionOnInvalidUri() { - $writer = new Zend_Feed_Writer_Feed; + $this->setExpectedException('Zend\Feed\Exception'); + $writer = new WriterFeed; $writer->setImage(array( 'uri' => 'http://' )); @@ -779,7 +761,7 @@ public function testSetsImageUriThrowsExceptionOnInvalidUri() public function testSetsImageLink() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed; $writer->setImage(array( 'uri' => 'http://www.example.com/logo.gif', 'link' => 'http://www.example.com' @@ -792,7 +774,7 @@ public function testSetsImageLink() public function testSetsImageTitle() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed; $writer->setImage(array( 'uri' => 'http://www.example.com/logo.gif', 'title' => 'Image title' @@ -805,7 +787,7 @@ public function testSetsImageTitle() public function testSetsImageHeight() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed; $writer->setImage(array( 'uri' => 'http://www.example.com/logo.gif', 'height' => '88' @@ -818,7 +800,7 @@ public function testSetsImageHeight() public function testSetsImageWidth() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed; $writer->setImage(array( 'uri' => 'http://www.example.com/logo.gif', 'width' => '88' @@ -831,7 +813,7 @@ public function testSetsImageWidth() public function testSetsImageDescription() { - $writer = new Zend_Feed_Writer_Feed; + $writer = new WriterFeed; $writer->setImage(array( 'uri' => 'http://www.example.com/logo.gif', 'description' => 'Image description' diff --git a/test/Writer/Renderer/Feed/AtomTest.php b/test/Writer/Renderer/Feed/AtomTest.php index 2d455ee6..5d2d33b6 100644 --- a/test/Writer/Renderer/Feed/AtomTest.php +++ b/test/Writer/Renderer/Feed/AtomTest.php @@ -402,9 +402,9 @@ public function testImageCanBeSet() $this->_validWriter->setImage( array('uri'=>'http://www.example.com/logo.gif') ); - $atomFeed = new Zend_Feed_Writer_Renderer_Feed_Atom($this->_validWriter); + $atomFeed = new Atom($this->_validWriter); $atomFeed->render(); - $feed = Zend_Feed_Reader::importString($atomFeed->saveXml()); + $feed = Reader\Reader::importString($atomFeed->saveXml()); $expected = array( 'uri' => 'http://www.example.com/logo.gif' ); diff --git a/test/_files/AtomHOnline.xml b/test/_files/AtomHOnline.xml deleted file mode 100644 index c1d6daa5..00000000 --- a/test/_files/AtomHOnline.xml +++ /dev/null @@ -1,554 +0,0 @@ - - - - -The H - news feed -Technology news - - -2009-09-17T17:39:21+02:00 - -The H - -http://www.h-online.com/security/Google-acquires-reCAPTCHA--/news/114266/from/rss - - - Google acquires reCAPTCHA - - Google has announced that it has acquired reCAPTCHA, one of the leading providers of CAPTCHAs which are used in authentication tests - http://www.h-online.com/security/Google-acquires-reCAPTCHA--/news/114266/from/rss - 2009-09-17T17:39:21+02:00 - - - - - Lost+Found: Password shaking, macro viruses and comment spam - - Too short for news, too good to lose; lost+found is a round up of useful security information. Today, Password shaking, macro viruses and comment spam - http://www.h-online.com/security/Lost-Found-Password-shaking-macro-viruses-and-comment-spam--/news/114265/from/rss - 2009-09-17T16:29:59+02:00 - - - - - Free Microsoft tools for detecting security problems - - Microsoft has made two free tools for detecting holes in applications available to developers. For quite some time Redmond's own developers have been using these tools within the Security Development Life cycle - http://www.h-online.com/security/Free-Microsoft-tools-for-detecting-security-problems--/news/114264/from/rss - 2009-09-17T16:00:48+02:00 - - - - - Chatting with a phisher - - After Man-in-the-Middle attacks we now have Chat-in-the-Middle attacks on online banking customers. These pop up a chat window in the browser - and a phisher, posing as a bank representative, starts asking probing questions - http://www.h-online.com/security/Chatting-with-a-phisher--/news/114263/from/rss - 2009-09-17T15:20:05+02:00 - - - - - Noop - a new language for the JVM - - Noop is a new language for the JVM which aims to make coding more productive and reliable by making dependency injection and testing fundamental to the language - http://www.h-online.com/open/Noop-a-new-language-for-the-JVM--/news/114262/from/rss - 2009-09-17T13:14:06+02:00 - - - - - Version 4.2 of OSGi Java component technology available - - Version 4.2 of the OSGi component technology, which is popular in the Java world, is now available to download. Almost all Java EE application servers are based on this specification - http://www.h-online.com/open/Version-4-2-of-OSGi-Java-component-technology-available--/news/114261/from/rss - 2009-09-17T11:53:12+02:00 - - - - - DragonFly BSD 2.4 released - - The DragonFly BSD project has announced the availability of version 2.4 of their FreeBSD fork, a major update that includes several bug fixes, performance improvements and a new 64-bit port - http://www.h-online.com/open/DragonFly-BSD-2-4-released--/news/114260/from/rss - 2009-09-17T11:16:08+02:00 - - - - - Privacy for RFID tags - - Wholesale RFID tagging poses a risk to privacy. A research team has proposed distributing keys as a method of ensuring privacy - http://www.h-online.com/security/Privacy-for-RFID-tags--/news/114259/from/rss - 2009-09-17T09:48:38+02:00 - - - - - Firefox Flash check working - - In one week, ten million Firefox users have responded to Firefox's recently added Adobe Flash checks - http://www.h-online.com/security/Firefox-Flash-check-working--/news/114258/from/rss - 2009-09-17T10:44:58+02:00 - - - - - Nominations open for the Free Software Awards - - The FSF has opened nominations for 2009's Free Software Awards, and is looking for nominations for individuals and projects - http://www.h-online.com/open/Nominations-open-for-the-Free-Software-Awards--/news/114257/from/rss - 2009-09-16T20:06:38+02:00 - - - - - ClarkConnect becomes ClearOS - - The ClearFoundation is hoping to scale new heights with ClearOS [--] the Linux-based small business server, a successor to ClarkConnect, which will now be free to use, with the income stream coming from related services - http://www.h-online.com/open/ClarkConnect-becomes-ClearOS--/news/114256/from/rss - 2009-09-16T18:58:00+02:00 - - - - - GitHub to move to Rackspace - - GitHub co-founder Tom Preston-Werner has announced that the open source code hosting service will be moving its servers from Engine Yard to Rackspace - http://www.h-online.com/open/GitHub-to-move-to-Rackspace--/news/114255/from/rss - 2009-09-16T18:23:09+02:00 - - - - - KOffice 2.1 Beta 2 released - - The KOffice developers have released the second beta of version 2.1 of their open source office suite, which includes a number of bug fixes, new features and performance improvements - http://www.h-online.com/open/KOffice-2-1-Beta-2-released--/news/114253/from/rss - 2009-09-16T16:34:45+02:00 - - - - - MonitoringForge uncovered by GroundWork - - GroundWork has revealed its new community for open source network monitoring and management - http://www.h-online.com/open/MonitoringForge-uncovered-by-GroundWork--/news/114254/from/rss - 2009-09-16T16:32:06+02:00 - - - - - Companies have wrong priorities for security updates - - Although attacks on Windows PCs nowadays almost exclusively exploit vulnerabilities in applications, it takes twice as long for security updates for applications to be installed as it does to plug vulnerabilities in the operating system - http://www.h-online.com/security/Companies-have-wrong-priorities-for-security-updates--/news/114252/from/rss - 2009-09-16T15:07:52+02:00 - - - - - Jaspersoft launches JasperReports Professional Developer Edition - - Open source Business Intelligence software specialist Jaspersoft has announced the immediate availability of a new version of JasperReports Professional and has introduced JasperReports Professional Developer Edition - http://www.h-online.com/open/Jaspersoft-launches-JasperReports-Professional-Developer-Edition--/news/114251/from/rss - 2009-09-16T13:12:54+02:00 - - - - - Google Android 1.6 SDK released - - The Google Android Developers have announced the release of the Android 1.6, code name Donut, software development kit - http://www.h-online.com/open/Google-Android-1-6-SDK-released--/news/114249/from/rss - 2009-09-16T12:30:13+02:00 - - - - - Oracle Enterprise Linux updated - - Oracle updates its RHEL clone, Unbreakable Linux, to keep in step with Red Hat Enterprise Linux - http://www.h-online.com/open/Oracle-Enterprise-Linux-updated--/news/114250/from/rss - 2009-09-16T11:46:25+02:00 - - - - - Terracotta 3.1 supports Hibernate - - Distributed caching for Hibernate queries comes to Terracotta's caching system with version 3.1's new Hibernate plug-in - http://www.h-online.com/open/Terracotta-3-1-supports-Hibernate--/news/114248/from/rss - 2009-09-16T11:30:17+02:00 - - - - - Google Chrome 3.0 released - - Just over one year after Google's Chrome web browser was originally launched, Google has announced the release of Chrome version 3 which includes several bug fixes, improvements and new features - http://www.h-online.com/security/Google-Chrome-3-0-released--/news/114247/from/rss - 2009-09-16T11:18:46+02:00 - - - - - MySpace bring open source MapReduce to .NET - - MySpace have released Quizmt, an implementation of MapReduce algorithms for clustered computing running on Windows and .NET - http://www.h-online.com/open/MySpace-bring-open-source-MapReduce-to-NET--/news/114246/from/rss - 2009-09-17T12:07:01+02:00 - - - - - GNOME Foundation releases first quarterly report - - The GNOME Foundation has released its first quarterly report. The Q2 2009 Quarterly report spans June, July and August and covers several topics, including the projects migration to Git - http://www.h-online.com/open/GNOME-Foundation-releases-first-quarterly-report--/news/114244/from/rss - 2009-09-15T17:29:49+02:00 - - - - - Live video stream of LinuxCon 2009 highlights - - Highlights of the Linux Foundation conference LinuxCon 2009, taking place from the 21st to the 23rd of September are to be available as a live internet broadcast. Keynote speakers include Joe Brockmeier, Bdale Garbee and Mark Shuttleworth - http://www.h-online.com/open/Live-video-stream-of-LinuxCon-2009-highlights--/news/114245/from/rss - 2009-09-15T17:22:22+02:00 - - - - - Anonymous browsing on Android - - A group of developers at the Digital Technology Group at the University of Cambridge have released two Android applications that allow users browse the web anonymously using The Onion Router - http://www.h-online.com/security/Anonymous-browsing-on-Android--/news/114243/from/rss - 2009-09-15T16:25:05+02:00 - - - - - New York Times shows bad banner ad - - Over the weekend, visitors to the newspaper's website were confronted with scareware pop-ups telling them that their PCs had an infection. In order to place their fake banner ad, the scammers had passed themselves off as a well-known company - http://www.h-online.com/security/New-York-Times-shows-bad-banner-ad--/news/114242/from/rss - 2009-09-15T14:31:25+02:00 - - - - - Referential integrity for Berkeley DB - - Oracle has added foreign keys and a C# interface to its free Berkeley DB - http://www.h-online.com/open/Referential-integrity-for-Berkeley-DB--/news/114241/from/rss - 2009-09-15T13:49:10+02:00 - - - - - Horde vulnerabilities fixed - - New versions of the Horde Application Framework, Horde Groupware and various other Horde applications fix two cross-site scripting vulnerabilities and one vulnerability which allows files to be overwritten - http://www.h-online.com/security/Horde-vulnerabilities-fixed--/news/114240/from/rss - 2009-09-15T11:59:43+02:00 - - - - - openSUSE 11.2 Milestone 7 released - - The openSUSE project has released the seventh milestone in the development of openSUSE 11.2, code named Fichte - http://www.h-online.com/open/openSUSE-11-2-Milestone-7-released--/news/114238/from/rss - 2009-09-15T11:51:52+02:00 - - - - - Security updates for Bugzilla - - The developers of the Bugzilla open source bug tracking system have released versions 3.0.9, 3.2.5 and 3.4.2, which fix SQL injection vulnerabilities and remove a means of sniffing out a user's password - http://www.h-online.com/security/Security-updates-for-Bugzilla--/news/114239/from/rss - 2009-09-15T11:12:10+02:00 - - - - - Microsoft says "We are working on our Linux drivers" - - Microsoft's Sam Ramji says the company is working on their Linux Hyper-V drivers and has not abandoned them - http://www.h-online.com/open/Microsoft-says-We-are-working-on-our-Linux-drivers--/news/114237/from/rss - 2009-09-15T09:48:54+02:00 - - - - - The Linux Foundation welcomes ARM - - The microprocessor and microcontroller manufacturer has joined the Linux Foundation. ARM processors are used in a large number of Linux driven mobile devices - http://www.h-online.com/open/The-Linux-Foundation-welcomes-ARM--/news/114236/from/rss - 2009-09-15T12:43:47+02:00 - - - - - CodePlex Foundation founding flawed says legal expert - - Andrew Updegrove, of Gesmer Updegrove LLP, has documented his concerns with the founding of Microsoft's CodePlex Foundation - http://www.h-online.com/open/CodePlex-Foundation-founding-flawed-says-legal-expert--/news/114235/from/rss - 2009-09-14T18:05:10+02:00 - - - - - SystemRescueCd 1.3.0 released - - The SystemRescueCD developers have released version 1.3.0 of their Linux distribution for administering or repairing an operating system and recovering data after a system crash - http://www.h-online.com/open/SystemRescueCd-1-3-0-released--/news/114234/from/rss - 2009-09-14T17:30:13+02:00 - - - - - First Alpha of BeOS-inspired Haiku released - - After eight years of development, the Haiku Project developers have announced the availability of the first official development release of Haiku - http://www.h-online.com/open/First-Alpha-of-BeOS-inspired-Haiku-released--/news/114232/from/rss - 2009-09-14T17:09:46+02:00 - - - - - eyeOS 2.0 rethinks its webtop for 2010 - - In 2010, eyeOS, the webtop operating system, is getting a new desktop, easier collaboration, real time notifications and more - http://www.h-online.com/open/eyeOS-2-0-rethinks-its-webtop-for-2010--/news/114231/from/rss - 2009-09-14T16:44:43+02:00 - - - - - WebKit adds support for WebGL - - The WebKit developers have begun to integrate GPU-accelerated 3D capabilities via WebGL into their open source browser engine - http://www.h-online.com/open/WebKit-adds-support-for-WebGL--/news/114230/from/rss - 2009-09-14T16:13:02+02:00 - - - - - MonoTouch 1.0 released for iPhone developers - - Novell's Mono on iPhone package arrives, with prices ranging from $399 to $3,999 - http://www.h-online.com/open/MonoTouch-1-0-released-for-iPhone-developers--/news/114229/from/rss - 2009-09-14T17:00:13+02:00 - - - - - Survey: Three out of four administrators don't trust anti-virus software - - In a study, 89 per cent of respondents use a standard anti-virus product, but half of them only because it is "better than nothing". The other half felt compelled to use an anti-virus product due to company guidelines - http://www.h-online.com/security/Survey-Three-out-of-four-administrators-don-t-trust-anti-virus-software--/news/114227/from/rss - 2009-09-14T13:51:54+02:00 - - - - - Twitapps.com to close, code to be open sourced - - The Twitter notification by email service will close in the next few weeks, but the code behind it will be released as open source - http://www.h-online.com/open/Twitapps-com-to-close-code-to-be-open-sourced--/news/114228/from/rss - 2009-09-14T12:50:26+02:00 - - - - - Linux Mint 7 XFCE released - - The Mint development team have released Linux Mint 7 XFCE, a Community Edition based on Xfce 4.6 - http://www.h-online.com/open/Linux-Mint-7-XFCE-released--/news/114226/from/rss - 2009-09-14T12:34:12+02:00 - - - - - Botnet discovered on Linux servers - - The servers in question register with dynamic DNS services to distribute malware - http://www.h-online.com/security/Botnet-discovered-on-Linux-servers--/news/114225/from/rss - 2009-09-14T10:52:46+02:00 - - - - - Mozilla releases SeaMonkey 2.0 Beta 2 - - Mozilla has announced the release of version 2.0 beta 2 of their SeaMonkey "all-in-one internet application suite", completing the planned feature set - http://www.h-online.com/open/Mozilla-releases-SeaMonkey-2-0-Beta-2--/news/114224/from/rss - 2009-09-14T11:07:47+02:00 - - - - - Creature comforts for Ubuntu - - Ubuntu's community manager Jono Bacon discusses a number of features designed to make the popular Linux distribution more user-friendly and productive - http://www.h-online.com/open/Creature-comforts-for-Ubuntu--/news/114223/from/rss - 2009-09-14T09:34:09+02:00 - - - - - The H Week - - Linux Kernel 2.6.31 is released, The H looks at Linux and Digital Rights Management, Microsoft confirmed an SMB vulnerability can be exploited to remotely reboot Windows and announced the formation of the new CodePlex Foundation for open source - http://www.h-online.com/news/The-H-Week--/114222/from/rss - 2009-09-12T14:40:15+02:00 - - - - - Apple open source Grand Central - - The engine behind Snow Leopards multi-core support is released as Apache 2.0 licensed open source - http://www.h-online.com/open/Apple-open-source-Grand-Central--/news/114221/from/rss - 2009-09-13T11:01:28+02:00 - - - - - Chrome adds new defence for cross-site scripting attacks - - Google has released Chrome 4.0.207.0 for Mac and Linux into its developer channel, adding a new a reflective XSS filter to defend against cross-site scripting attacks - http://www.h-online.com/security/Chrome-adds-new-defence-for-cross-site-scripting-attacks--/news/114220/from/rss - 2009-09-11T17:09:26+02:00 - - - - - openSUSE planned outage this weekend - - A planned power outage in the projects office in Nuernberg, Germany will take several of its servers off line from the 11th to the 14th of September - http://www.h-online.com/open/openSUSE-planned-outage-this-weekend--/news/114219/from/rss - 2009-09-11T16:07:36+02:00 - - - - - Apple's iPhone 3.1 anti-phishing ineffective? - - According to several reports, the new anti-phishing feature Apple introduced in iPhone OS 3.1 for its mobile version of the Safari web browser is unreliable - http://www.h-online.com/security/Apple-s-iPhone-3-1-anti-phishing-ineffective--/news/114218/from/rss - 2009-09-11T13:25:23+02:00 - - - - - New Google Summer of Code statistics posted - - Google has posted new statistics about its 2005 to 2009 Summer of Code contests which offer university students stipends to write and develop code for various open source projects - http://www.h-online.com/open/New-Google-Summer-of-Code-statistics-posted--/news/114217/from/rss - 2009-09-11T13:11:34+02:00 - - - - - Report says IBM is switching from Microsoft Office to Lotus Symphony - - According to German daily "Handelsblatt", the Lotus office suite has to be installed on all company PCs within the next ten days. Reportedly, some 330,000 employees have already switched - http://www.h-online.com/open/Report-says-IBM-is-switching-from-Microsoft-Office-to-Lotus-Symphony--/news/114216/from/rss - 2009-09-11T12:59:14+02:00 - - - - - VirtualBox 3.0.6 released - - Sun Microsystems has released version 3.0.6, a maintenance update of its open source VirtualBox desktop virtualisation application for x86 hardware - http://www.h-online.com/open/VirtualBox-3-0-6-released--/news/114215/from/rss - 2009-09-11T13:09:42+02:00 - - - - - First update for Apple's Snow Leopard released - - Apple has released Mac OS X 10.6.1 for Snow Leopard and Security Update 2009-005 for 10.4.11 Tiger and 10.5.8 Leopard systems, fixing several bugs and security vulnerabilities - http://www.h-online.com/security/First-update-for-Apple-s-Snow-Leopard-released--/news/114213/from/rss - 2009-09-11T11:39:55+02:00 - - - - - Tornado let loose by Facebook - - Facebook shake up the Python web framework sector by open sourcing Tornado Web Server, the Python server behind the FriendFeed social network aggregator - http://www.h-online.com/open/Tornado-let-loose-by-Facebook--/news/114214/from/rss - 2009-09-14T15:24:28+02:00 - - - - - Survey: "Open Core" least popular open source option - - A survey says that the "Open Core" model for open source licensing trails behind dual licensing and open source with commercial support in terms of acceptability to the enterprise - http://www.h-online.com/open/Survey-Open-Core-least-popular-open-source-option--/news/114212/from/rss - 2009-09-11T10:50:37+02:00 - - - - - Microsoft announces open source foundation - - The new CodePlex Foundation aims to bring together commercial software vendors and the open source community - http://www.h-online.com/open/Microsoft-announces-open-source-foundation--/news/114211/from/rss - 2009-09-11T11:02:35+02:00 - - - - - Four Critical Holes in QuickTime Closed - - The update closes errors which could allow crafted video files to be used to spread infection - http://www.h-online.com/security/Four-Critical-Holes-in-QuickTime-Closed--/news/114209/from/rss - 2009-09-10T15:56:10+02:00 - - - - - Google begins launch of Chrome Extensions - - Extensions for Google Chrome and Chromium are clearly on their way as the feature is now switched on by default in the developer builds of the open source browsers - http://www.h-online.com/open/Google-begins-launch-of-Chrome-Extensions--/news/114208/from/rss - 2009-09-10T14:43:53+02:00 - - - - - iPhone OS 3.1 available - - iPhone OS 3.1 and iPhone OS 3.1.1 for all iPod touch devices are now available for download at iTunes. The new systems come with numerous improvements and functions and close several security holes, some of them critical - http://www.h-online.com/security/iPhone-OS-3-1-available--/news/114207/from/rss - 2009-09-10T12:54:42+02:00 - - - - - Numerous holes in Firefox 3.0 and 3.5 fixed - - Attackers were able to use manipulated websites to infect PCs. The new versions now also warn users if they are using outdated versions of the Flash plug-in - http://www.h-online.com/security/Numerous-holes-in-Firefox-3-0-and-3-5-fixed--/news/114206/from/rss - 2009-09-10T12:18:54+02:00 - - - - - Better query analysis in MySQL Enterprise - - The commercial Enterprise Fall Release 2009 of the open source MySQL database will feature query filtering and analysis using new correlation graphs - http://www.h-online.com/open/Better-query-analysis-in-MySQL-Enterprise--/news/114205/from/rss - 2009-09-10T11:40:38+02:00 - - - diff --git a/test/_files/AtomPublishingTest-before-update.xml b/test/_files/AtomPublishingTest-before-update.xml deleted file mode 100644 index cd6591d5..00000000 --- a/test/_files/AtomPublishingTest-before-update.xml +++ /dev/null @@ -1,7 +0,0 @@ - - 1 - - 2005-05-23T16:26:00-08:00 - Entry 1 - 1.2 - diff --git a/test/_files/AtomPublishingTest-created-entry.xml b/test/_files/AtomPublishingTest-created-entry.xml deleted file mode 100644 index e8e8e810..00000000 --- a/test/_files/AtomPublishingTest-created-entry.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - 1 - - 2005-05-23T16:26:00-08:00 - Entry 1 - 1.1 - diff --git a/test/_files/AtomPublishingTest-expected-update.xml b/test/_files/AtomPublishingTest-expected-update.xml deleted file mode 100644 index cd6591d5..00000000 --- a/test/_files/AtomPublishingTest-expected-update.xml +++ /dev/null @@ -1,7 +0,0 @@ - - 1 - - 2005-05-23T16:26:00-08:00 - Entry 1 - 1.2 - diff --git a/test/_files/AtomPublishingTest-updated-entry.xml b/test/_files/AtomPublishingTest-updated-entry.xml deleted file mode 100644 index 629dc7cb..00000000 --- a/test/_files/AtomPublishingTest-updated-entry.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - 1 - - 2005-05-23T16:27:00-08:00 - Entry 1 - 1.2 - diff --git a/test/_files/AtomTestGoogle.xml b/test/_files/AtomTestGoogle.xml deleted file mode 100644 index 669ff221..00000000 --- a/test/_files/AtomTestGoogle.xml +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - -Official Google Blog -Googler insights into product and technology news and our culture. - -tag:blogger.com,1999:blog-10861780 -2006-01-12T19:55:20Z -Blogger - -
This is an Atom formatted XML site feed. It is intended to be viewed in a Newsreader or syndicated to another site. Please visit the Blogger Help for more info.
-
-true - - - -A Googler - -2006-01-12T11:53:00-08:00 -2006-01-12T19:55:20Z -2006-01-11T03:07:43Z - -tag:blogger.com,1999:blog-10861780.post-113694886327994245 -Your Google homepage, to go - -
- -
-
Anyone who's ever tried to browse the web on their cell phone knows that it isn't always the best user experience. That's why I'm excited to tell you about Google Mobile Personalized Home. We've designed a way for you to view the things that you really care about, from your Gmail inbox to news headlines, weather, stock quotes, and feeds (Atom or RSS). The interface is optimized for small screens, and we've arranged things so you don't have to click on a bunch of links to locate what you're after -– your personalized content appears on top, right where it should be. Give it a try, and let us know how you like it.
-
-false -
- - - -A Googler - -2006-01-12T09:15:00-08:00 -2006-01-12T17:18:46Z -2006-01-03T20:50:32Z - -tag:blogger.com,1999:blog-10861780.post-113632143275337066 -Many Minis - -
- -
-
Today is the one year anniversary of the Google Mini, Google's solution for website and corporate network search, and to celebrate we thought we'd announce a few more of them. The standard Mini lets you search up to 100,000 documents. Now organizations that constantly crank out new content can opt for either of two new Minis: one searches up to 200,000 documents, and another that can manage up to 300,000. All three deliver the same easy setup, intuitive interface and fast, relevant results that the Mini is already bringing to thousands of websites and corporate networks. You're growing, and the Mini is growing with you.
-
-false -
- - - -A Googler - -2006-01-10T12:49:00-08:00 -2006-01-10T21:02:47Z -2005-12-31T01:44:54Z - -tag:blogger.com,1999:blog-10861780.post-113599349496410640 -Google Earth in a Mac world (PC too) - -
- -
-
We feel like proud parents around here. Our eldest, Google Earth for the PC, is officially leaving beta status today, and we couldn't be more pleased. For those of you who downloaded early, upgrade to the latest and discover Google Earth all over again.
-
And we have a brand new member of the family -- Google Earth for Macintosh. We're happy to finally have some good news for the, ahem, vocal Mac enthusiasts we've been hearing from. Let's just say that we have gotten more than a few "requests" for a Mac version of Google Earth. They've gone something like this:
-
1) "When is it coming out? Your website says that you are working on it."
-
2) "You know, Mac users are very heavy graphics/mapping/visualization/design/ architecture/education/real estate/geocaching/social-geo-video-networking fans who would certainly use Google Earth a lot."
-
3) "So when is it coming out?"
-
We heard you loud and clear. The Mac version runs on OS X 10.4 and up. Happy travels throughout Google Earth, whether you're on a Mac or a PC.
-
-false -
- - - -A Googler - -2006-01-09T22:16:00-08:00 -2006-01-11T20:30:26Z -2005-12-31T18:25:16Z - -tag:blogger.com,1999:blog-10861780.post-113605351620153422 -A new year for Google Video -<span class="byline-author">Posted by Sanjay Raman, Google Video Team</span><br /><br />Till now, Google Video has been about watching videos and clips online, which is really convenient for videos <a href="http://video.google.com/videoplay?docid=-3496860874967925614&q=fastfocus">like this</a>. But wouldn't it be awesome to watch that episode of <span style="font-style: italic;"><a href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCSI">CSI</a></span> that you missed when even your trusty DVR failed you? This is one reason we've launched the Google Video store, where you can rent or buy from such well-known media partners as <a href="http://video.google.com/cbs.html">CBS</a>, the <a href="http://video.google.com/nba.html">NBA</a>, The <a href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCharlie_Rose">Charlie Rose Show</a>, and <a href="http://video.google.com/videosearch?q=Sony+BMG">SONY BMG</a>.<br /><br />We’re not only about mainstream content, though -– we have thousands of titles available (and more coming every day) from every imaginable type of producer, including <a href="http://video.google.com/videosearch?q=1896+tsar+nicholas&so=0">this 1896 clip</a> of the coronation of Tsar Nicholas II – one of the earliest known moving images. We’re especially pleased to offer such quality indie features as Ben Rekhi’s <span style="font-style: italic;"><a href="http://video.google.com/videoplay?docid=-1607114503824678810&q=waterborne ">Waterborne</a></span> (Drops Entertainment) and Lerone Wilson’s <span style="font-style: italic;"><a href="http://video.google.com/videoplay?docid=-4929215594503422280&q=aardvark%27d ">Aardvark’d: 12 Weeks with Geeks</a></span> (Boondoggle Films).<br /><br />When we launched our <a href="https://upload.video.google.com">Upload Program</a> earlier this year, people sent in a huge number of free and compelling videos. But since there's a ton of video that can't be offered for free, we built the <a href="http://video.google.com/">Google Video store</a> to give content owners the option to charge for downloads if they'd like. This means producers large and small can distribute their great content in an easy, secure way. Some of your favorite prime time and classic TV shows, sports, music videos, and documentaries are at your fingertips. Want to see how Shaq scored 30 points last night? Download and watch it (and every <a href="http://video.google.com/nba.html">NBA</a> game for the rest of the season) through Google Video.<br /><br />You can play all the videos you download using the all-new Google Video Player. We're especially pleased about the thumbnail navigation for browsing an entire video so you can play any portion with a single click. And there's another thing: if the content is not copy-protected, you can take your favorite videos with you on your <a href="http://www.apple.com/ipod/">iPod</a> or <a href="http://www.us.playstation.com/psp.aspx">PSP</a> -- our "to go" option.<br /><br />Since it's so early in the year, here's a resolution we intend to keep: make sure new features and content continue to roll out, so that you think Google Video is one of the best ways to find video on the web.<br /><br />These video providers are getting us off to a great start:<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Daquarius">Aquarius Health Care Media</a></span>: A leading producer and distributor of healthcare-related videos will pilot with Google Video using a variety of titles covering SIDS, diabetes, and blindness, among other health issues.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=ardustry">Ardustry Home Entertainment</a></span>: Offers substantial libraries of theatrical motion pictures, television series, documentaries and reality programming, music and sports specials, lifestyle titles, and a wide array of “how-to†products.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=bluehighways">BlueHighways TV</a></span>: Programming service that explores the people, stories, traditions and cultures of America. Discovering the sights and sounds of communities across the country with an up-close, laid-back programming style, BlueHighways TV presents a collage of remarkable music, folklore and information for audiences interested in all aspects of American life and heritage. Programming includes <span style="font-style: italic;">Reno's Old Time Music Festival,</span> <span style="font-style: italic;">American Journeys,</span> <span style="font-style: italic;">Stan Hitchcock's Heart to Heart,</span> and <span style="font-style: italic;">Gospel Sampler</span>.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dcaretalk">CareTALK</a></span>: A multimedia brand dedicated to consumer-directed health care offering programming and tools to help modern family caregivers; initially offering 10-20 hours of health and caregiving-related content (10-20 minutes in length).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/cbs.html">CBS</a>: Includes prime time hits such as <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCSI">CSI</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3Dncis">NCIS</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DSurvivor_Guatemala">Survivor: Guatemala</a>, and The Amazing Race (available spring ’06), as well as classics like <a style="font-style: italic;" href="http://video.google.com/videosearch?q=I+Love+Lucy">I Love Lucy</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DTwilight_Zone">Twilight Zone</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DBrady_Bunch">Brady Bunch</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=Have+Gun+Will+Travel">Have Gun Will Travel</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DMacGyver">MacGyver</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DStar_Trek_Deep_Space_Nine">Star Trek: Deep Space Nine</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DStar_Trek_Voyager">Star Trek: Voyager</a>, and My Three Sons (coming soon).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCharlie_Rose">The Charlie Rose Show</a>: Includes interviews with Henry Kissinger, Oliver Stone, Quentin Tarantino, Martha Stewart, Martin Scorsese, Harrison Ford, Dan Rather, Charles M. Schulz, Steve Jobs, Jay Leno, Tom Brokaw, and others.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Cine+Excel&so=0">Cine Excel</a>: Independent producer will trial on Google Video with 3 DVD movie titles: <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=6833548605067650376&q=Cine+Excel">Bikini Hotel </a>(1997), <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=-9198267889833807992&q=Cine+Excel">Tao of Karate</a> (short-film, 1998) and <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=8241854949946868864&q=Cine+Excel">Karate Wars</a> (1998).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=classic+media">Classic Media</a>: Classic Media owns and manages some of the world's most recognizable family properties across all media including feature film, television, home video and consumer products. The company's extensive library features a diverse collection of popular animated and live-action characters. For lentaries are at your fingertips. Want to see how Shaq scored 30 points last night? Download and watch it (and every <a href="http://video.google.com/nba.html">NBA</a> game for the rest of the season) through Google Video.<br /><br />You can play all the videos you download using the all-new Google Video Player. We're especially pleased about the thumbnail navigation for browsing an entire video so you can play any portion with a single click. And there's another thing: if the content is not copy-protected, you can take your favorite videos with you on your <a href="http://www.apple.com/ipod/">iPod</a> or <a href="http://www.us.playstation.com/psp.aspx">PSP</a> -- our "to go" option.<br /><br />Since it's so early in the year, here's a resolution we intend to keep: make sure new features and content continue to roll out, so that you think Google Video is one of the best ways to find video on the web.<br /><br />These video providers are getting us off to a great start:<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Daquarius">Aquarius Health Care Media</a></span>: A leading producer and distributor of healthcare-related videos will pilot with Google Video using a variety of titles covering SIDS, diabetes, and blindness, among other health issues.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=ardustry">Ardustry Home Entertainment</a></span>: Offers substantial libraries of theatrical motion pictures, television series, documentaries and reality programming, music and sports specials, lifestyle titles, and a wide array of “how-to†products.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=bluehighways">BlueHighways TV</a></span>: Programming service that explores the people, stories, traditions and cultures of America. Discovering the sights and sounds of communities across the country with an up-close, laid-back programming style, BlueHighways TV presents a collage of remarkable music, folklore and information for audiences interested in all aspects of American life and heritage. Programming includes <span style="font-style: italic;">Reno's Old Time Music Festival,</span> <span style="font-style: italic;">American Journeys,</span> <span style="font-style: italic;">Stan Hitchcock's Heart to Heart,</span> and <span style="font-style: italic;">Gospel Sampler</span>.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dcaretalk">CareTALK</a></span>: A multimedia brand dedicated to consumer-directed health care offering programming and tools to help modern family caregivers; initially offering 10-20 hours of health and caregiving-related content (10-20 minutes in length).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/cbs.html">CBS</a>: Includes prime time hits such as <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCSI">CSI</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3Dncis">NCIS</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DSurvivor_Guatemala">Survivor: Guatemala</a>, and The Amazing Race (available spring ’06), as well as classics like <a style="font-style: italic;" href="http://video.google.com/videosearch?q=I+Love+Lucy">I Love Lucy</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DTwilight_Zone">Twilight Zone</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DBrady_Bunch">Brady Bunch</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=Have+Gun+Will+Travel">Have Gun Will Travel</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DMacGyver">MacGyver</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DStar_Trek_Deep_Space_Nine">Star Trek: Deep Space Nine</a>, <a style="font-style: italic;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DStar_Trek_Voyager">Star Trek: Voyager</a>, and My Three Sons (coming soon).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Atvshow%3DCharlie_Rose">The Charlie Rose Show</a>: Includes interviews with Henry Kissinger, Oliver Stone, Quentin Tarantino, Martha Stewart, Martin Scorsese, Harrison Ford, Dan Rather, Charles M. Schulz, Steve Jobs, Jay Leno, Tom Brokaw, and others.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Cine+Excel&so=0">Cine Excel</a>: Independent producer will trial on Google Video with 3 DVD movie titles: <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=6833548605067650376&q=Cine+Excel">Bikini Hotel </a>(1997), <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=-9198267889833807992&q=Cine+Excel">Tao of Karate</a> (short-film, 1998) and <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=8241854949946868864&q=Cine+Excel">Karate Wars</a> (1998).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=classic+media">Classic Media</a>: Classic Media owns and manages some of the world's most recognizable family properties across all media including feature film, television, home video and consumer products. The company's extensive library features a diverse collection of popular animated and live-action characters. For launch we will have <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=2700527067868455741&q=classic+media">Rocky &amp; Bullwinkle</a>, <span style="font-style: italic;">Casper</span>, <span style="font-style: italic;">Wendy</span>, <span style="font-style: italic;">Richie Rich</span>, <span style="font-style: italic;">Herman & Katnip</span>, <span style="font-style: italic;">Baby Huey</span>, <span style="font-style: italic;">Little Audrey</span>, <a style="font-style: italic;" href="http://video.google.com/videoplay?docid=-3466783103686653836&q=Mighty+Hercules">Mighty Hercules</a>, <span style="font-style: italic;">Little Lulu</span>, and <span style="font-style: italic;">Felix the Cat</span>.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=clearvue">CLEARVUE & SVE</a>: A leading provider of educational K-12 educational video content. They sell DVDs and run a subscription media-on-demand website with video, audio, and images. CLEARVUE &amp; SVE primarily serves large clients such as schools, school districts or entire states. Leveraging Google Video, they have embarked on a new and bold strategy to target individual customers directly. Among the hundreds of videos you will find on Google, topics vary from classic children's literature to detailed explanations about the workings of the human body.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dechelon">Echelon Home Entertainment 2</a></span>: Focuses on independently produced films made by filmmakers from around the world which offer a unique perspective to the traditional genres: drama, action, thriller, comedy, family, animation, classic, B&W, foreign.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dimage_entertainment">Egami Media</a></span>: A subsidiary of Image Entertainment and a leading independent licensee, producer and distributor of home entertainment programming with over 3,000 titles released in North America. Highlighted content in Google Video includes live concert programs include <span style="font-style: italic;">Kiss: Rock the Nation: Live!</span>, <span style="font-style: italic;">Chick Corea: Rendezvous in New York</span>, <span style="font-style: italic;">Roy Orbison: Black & White Night</span>, and dozens more. Other titles include IMAX programs from MacGillivray Freeman, stand-up comedy and independent, foreign and silent film classics.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dfashion_tv">Fashion TV</a>: The only 24 hours a day, 7 days a week fashion, beauty and style TV station worldwide provides glamorous entertainment with emphasis on the latest trends. Google Video content includes fashion show clips and behind the scenes footage from many fashion shows.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dgetty_images">Getty Images' Archive Films Collection</a>: A diverse collection of short clips that capture personalities, moments and eras throughout history -- selected from vintage newsreels and educational film, as well as contemporary news and events from around the world.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dgreencine">GreenCine.com</a>: Feature length independent films, documentaries and classic titles, including works by legendary Polish director Andrzej Wajda (<span style="font-style: italic;">Zemsta</span>) and award-winning actor-director Caveh Zahedi (<span style="font-style: italic;">In the Bathtub of the World</span>).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=HDNet&so=0">HDNet</a>: Co-founded by Mark Cuban, HDNet has agreed to make select original programming from its library available for the launch of Google's first commercial video offering. The programs to be made available come from HDNet's ever growing library of original content including the <span style="font-style: italic;">HDNet World Report</span>, a groundbreaking series featuring news in HD from around the globe; <span style="font-style: italic;">True Music</span>, a popular weekly music series highlighting up-and-coming bands; <span style="font-style: italic;">Higher Definition</span>, a celebrity interview series hosted by Robert Wilonsky; <span style="font-style: italic;">Young, Beautiful and Trying to Make it in Hollywood</span>, following actresses through the hectic process of getting hired in Hollywood; and <span style="font-style: italic;">Deadline</span>, delivering current events and news from around the world from an irreverent point of view.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=heretv">here!</a>: Gay and lesbian U.S. television network featuring original movies and series and film library (independent and foreign films, documentaries and shorts).<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=hollywood+licensing">Hollywood Licensing's HilariousDownloads.com</a></span>: Hollywood Licensing is the entertainment licensing agency which represents the best and most extensive library of hilarious videos in the world. Tapping into a library boasting tens of thousands of clips, they have custom produced 20 packages of funny themes a celebrity interview series hosted by Robert Wilonsky; <span style="font-style: italic;">Young, Beautiful and Trying to Make it in Hollywood</span>, following actresses through the hectic process of getting hired in Hollywood; and <span style="font-style: italic;">Deadline</span>, delivering current events and news from around the world from an irreverent point of view.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=heretv">here!</a>: Gay and lesbian U.S. television network featuring original movies and series and film library (independent and foreign films, documentaries and shorts).<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=hollywood+licensing">Hollywood Licensing's HilariousDownloads.com</a></span>: Hollywood Licensing is the entertainment licensing agency which represents the best and most extensive library of hilarious videos in the world. Tapping into a library boasting tens of thousands of clips, they have custom produced 20 packages of funny themes for Google Video. For example, if you think that your recent home improvements was nothing but a miserable experience, wait until you see a bucket of wet plaster land on a man's face, a house collapsing or a door falling of its hinges for no particular reason.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Ditn">ITN</a>: One of the world's leading news producers, providing news programming for the main commercial broadcasters in the U.K. and its combined news broadcasts reach over two-thirds of the U.K. population. The company has a strong reputation for the creative and innovative use of modern technology, winning the Royal Television Society's 2004 Innovation Award.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Diwatchnow">iWatchNow.com</a>: Titles include Night of the Living Dead (George Romero), The Chronicles of Narnia: The Lion, Witch, and the Wardrobe (original animated film BBC from1979), The Man Who Knew Too Much (Hitchcock), the hard-to-find Comedy's Dirtiest Dozen (with Chris Rock and Tim Allen), and The Little Shop of Horrors (1960).<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=kantola&so=0">Kantola Productions</a>: Captures unique speaking events given by well-known experts at Stanford University. Topics focus on innovative and practical business advice, such as How Leaders Boost Productivity by John H. (Jack) Zenger and <span style="font-style: italic;">Mastery of Speaking as a Leader</span> by Terry Pearce.<br /><br />• <span style="font-weight: bold;"><a href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dlime">LIME</a></span>: “Healthy Living with a Twist†offers entertaining and revealing programming focused on a greener, healthier, more balanced lifestyle. Programming features inspiration from leading experts, authors, and pop culture icons and covers topics including the environment and sustainability, personal growth, alternative health, healthy foods, and business ethics.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=mediazone.com&so=0">MediaZone.com</a>: Programming covers sporting events, TV episodes, movies, how-to programs. Content includes <span style="font-style: italic;">The Rugby Channel presents ‘The Best Tries of 2004’</span> and <span style="font-style: italic;">The All Blacks of New Zealand Vs. Springboks of South Africa</span>.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dtwi+nobel">Nobel Video Library</a>: A library focused on the achievements of individual Nobel Laureate. The series was developed to introduce students to the work of the laureates as well as to support classroom discussion regarding important issues addressed by Nobel Prize winners in recent decades.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=open+championship&so=0">Open Championship</a>: Official programs from the classic golf tournament, the British Open, such as<span style="font-style: italic;"> </span><span style="font-style: italic;">Reflections: Past Open Champions</span>.<br /><br />•<a style="font-weight: bold;" href="http://video.google.com/videosearch?q=plum+tv"> Plum TV</a>: Provides highly localized programming to the nation’s most influential consumers, and strives to be an incubator of groundbreaking new television programming. Each Plum TV station shares branding which links each station as a network, but still provides original programming customized to reflect each community. Plum TV’s programming includes regionally-focused feature pieces, tourist information (weather, traffic reports, restaurant reviews, retail and lodging information), a real estate show, local news and specially targeted entertainment for each community’s interests.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=porchlight+entertainment">PorchLight Entertainment</a>: Porchlight produces family-oriented motion pictures and TV specials. Google Video will offer 36 titles including <span style="font-style: italic;">Enough Already</span> and <span style="font-style: italic;">Role of a Lifetime</span>.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=SOFA+Entertainment&so=0">SOFA Entertainment</a>: Represents pop culture at its best. Featuring several titles from the classic <span style="font-style: italic;">The Ed Sullivan Show</span> along with documentaries, feature films and music programming. SOFA Entertainment truly offers something for everyone. Some highlights include <span style="font-style: italic;">The Very Best of The Ed Sullivan Show - Vol. 1 & Vol. 2.</span><br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Sony+BMG">SONY BMG MUSIC ENTERTAINMENT</a>: The lineup of launch videos includes offerings from some of SONY BMG's largest global superstar artists, including Christina Aguilera, Beyonce, Kenny Chesney, Destiny's Child, Kelly Clarkson, Alicia Keys, Lil' Flip, Jessica Simpson, Shakira, System of a Down, Switchfoot, Usher, and many more.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Tai+Seng&so=0">Tai Seng Entertainment</a>: The definitive Asian cinema powerhouse. Known as the best source for Hong Kong films, Tai Seng also releases cinematic masterpieces from all over the Asia region in a variety of languages. Tai Seng brings to your home the best in class from high-octane action to bone-crushing martial arts, from chilling horror to lush swordplay epics. We are proud to showcase with Google some of Asia's biggest hits like Johnnie To's <span style="font-style: italic;">Running On Karma</span>, Korea's sensuously emotional drama <span style="font-style: italic;">Addicted</span>, martial arts Master Yuen Wo Ping's highly acclaimed <span style="font-style: italic;">Tai Chi Master</span>, and Michelle Yeoh's violently elegant <span style="font-style: italic;">Butterfly Sword</span>.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Teen+Kids+news">Teen Kids News</a>: A dynamic television news program for teens and pre-teens, by teens. The half-hour weekly program provides 10 eyewitness news segments to students in a way that's educational as well as entertaining. Thirty shows with kids reporting on camera are available on Google Video.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=Trinity+Broadcasting+&so=0">Trinity Broadcasting Network</a>: The world's largest religious network and America's most watched faith channel, TBN offers 24 hours of commercial-free inspirational programming that appeal to people in a wide variety of Protestant, Catholic and Messianic Jewish denominations. <span style="font-style: italic;">The Praise the Lord Program</span> is the only live two-hour Christian program in the world. The program brings the highest caliber of guests from well-known celebrities to laypersons for interview, as well as, singers, musicians, evangelists and the coverage of revivals and crusades from around the world. This award-winning program has been on each week night for over 30 years.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videoplay?docid=8592392906577495616&q=in_label%3Aowner%3Dunion">Union</a>: Offers the best of breed from the world of action sports, including snow, skate, bmx, moto, and surfing. Union is owned by Quiksilver Entertainment, Inc. and Global Media Ventures, LLC.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=wilderness+films+india">WFIL</a>: Wilderness Films India Ltd. is a leading producer and library of stock footage captured in India and across Asia. WFIL will offer 100 hours of high quality video, both free and for sale, on Google Video. Topics vary from helicopter skiing in the Himalaya, broadcast coverage of an Everest climb, and rare wildlife such as the takin and the clouded leopard to imagery spanning India's art, culture, technology, peoples, cities, and rural areas.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=wgbh+boston">WGBH</a>: WGBH Boston is America's preeminent public broadcasting producer, the source of fully one-third of PBS's prime-time lineup, along with some of public television's best-known lifestyle shows and children's programs and many public radio favorites. Programming available includes <span style="font-style: italic;">Nova</span>, <span style="font-style: italic;">La Plaza</span> (the longest running Latino program in the country), <span style="font-style: italic;">Thinking Big</span>, and <span style="font-style: italic;">Basic Black</span>. WGBH is the number one producer of Web sites on pbs.org, one of the most trafficked dot-org Web sites in the world. WGBH is a pioneer in educational multimedia and in technologies and services that make media accessible to the 36 million Americans who rely on captioning or video descriptions. WGBH has been recognized with hundreds of honors: Emmys, Peabodys, duPont-Columbia Awards.even two Oscars. In 2002, WGBH was honored with a special institutional Peabody Award for 50 years of excellence.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=WheelsTV&so=0">WheelsTV</a>: Serves both the general audience and the enthusiast with a wide spectrum of vehicle-based entertainment, news and information. WheelsTV Network, WheelsTV On Demand and WheelsTV.net have been developed by the producers of multi-awarding winning automotive programming for Discovery, PBS, Speedvision, Fox and Outdoor Life Networks including <span style="font-style: italic;">Wild About Wheels</span>, <span style="font-style: italic;">Wheels</span>, and <span style="font-style: italic;">Motor Trend Television</span>. WheelsTV Network’s valuable consumer programs include <span style="font-style: italic;">Top 200™ New Vehicle Test Drives</span>. With <span style="font-style: italic;">Top 200</span> on Google, consumers will be able to download virtual test drives of the best selling and most exciting cars on the road today, saving time and money.<br /><br />• <a style="font-weight: bold;" href="http://video.google.com/videosearch?q=in_label%3Aowner%3Dtwi">Wimbledon</a>: Official programs from the Wimbledon Tennis Championships such as <span style="font-style: italic;">Legends of Wimbledon: Bjorn Borg</span>. -false - - - - -A Googler - -2006-01-09T06:27:00-08:00 -2006-01-09T14:30:23Z -2005-12-18T23:47:55Z - -tag:blogger.com,1999:blog-10861780.post-113494967528450491 -The 2006 Anita Borg Scholarships - -
- -
-
The wonderfully-named Dr. Anita Borg (1949 - 2003) was a rebel with a cause: ensuring that technology itself has positive outcomes, and dismantling barriers that keep women and minorities from entering computing and technology fields. Today the Anita Borg Institute for Women and Technology carries on her vision. And because Google shares that passion, we are pleased to sponsor the 2006 Anita Borg Scholarship program. We are inspired by the past scholarship recipients -- and in hopes of finding more, the program is expanded this year to accept applications from students entering their senior year of undergraduate study as well as those enrolled in a graduate program. Last year we awarded 23 scholarships; this year we'd like to do more.
-
Tell your friends, or apply yourself - the deadline is January 20.
-
-false -
- - - -A Googler - -2006-01-06T16:51:00-08:00 -2006-01-07T00:54:51Z -2005-12-31T18:24:44Z - -tag:blogger.com,1999:blog-10861780.post-113605348414874975 -Make your computer just work -<span class="byline-author">Posted by Jesse Savage, Google Pack team</span><br /> <br />So you bought a new PC for yourself or a relative during the holidays. There was the initial excitement about its speed and the nice screen – and then it came time to actually get it running. Which meant embarking on some real work -– downloading a browser, a couple of multimedia players, a PDF reader, a toolbar, and maybe something for voice and instant messaging. Don’t forget the anti-spyware and anti-virus apps – you’ve got to have those. Hours, maybe even days, go by. How many wizards have you clicked through, not to mention license agreements and preference pickers? And then you have to ask: did I get everything? And how am I going to keep all of this up to date?<br /> <br />This was the experience both Sergey and Larry had a year ago. And they’re computer guys, after all. Which led them to ask more of us to make it easier for everyone. So we created the <a href="http://pack.google.com">Google Pack</a> -- a one-stop software package that helps you discover, install, and maintain a wide range of essential PC programs. It’s yours today – and it’s something we hope you find to be painless, easy, and even fun (if computer setup can ever be called that). And it’s free. <br /> <br />We worked with a number of technology companies to identify products that are the best of their type to create <a href="http://www.google.com/support/pack">this suite</a>. (We didn’t pay them, and they aren’t paying us.) For PC users running Windows XP, it downloads in minutes and installs in just a few clicks. There’s only one license agreement – and no wizards. And there’s a new tool called the <a href="http://www.google.com/support/pack/bin/answer.py?answer=30252&topic=8326/">Google Updater</a> that keeps all the software in the Google Pack current. Even if you already have some of the software in the Pack, you can use the Google Updater to update and manage it.<br /> <br />There’s one more thing in the Pack that we think you’ll like. The Pack team asked people what kind of screensavers they like best. They kept saying, “I want my own photos as a screensaver, why can’t I do that?†Good question -- lots of people have trouble with this. So we made the <a href="http://www.google.com/support/pack/bin/answer.py?answer=28076&topic=8315">Google Pack Screensaver</a>, which is the easiest possible way to make your photos into an animated photo collage. And now the question for you is: what will you do with all that time you've saved? -false - - - - -A Googler - -2005-12-30T17:18:00-08:00 -2006-01-05T21:52:34Z -2005-12-31T01:31:39Z - -tag:blogger.com,1999:blog-10861780.post-113599269991367646 -A year of Google blogging - -
- -
-
This is the 201st post to be published on the Google Blog in 2005. In closing out the first full year of our company-wide effort to share news and views, we thought you might be interested in a few factoids. Since we've had Google Analytics running on this blog since June, some of these numbers reflect only half a year. In that time, 4.3 million unique visitors have generated 8.7 million pageviews. Readers have come from all over the world, not just English-speaking countries: 53,001 visitors from Turkey have stopped by, for example; so have 155,691 from France, 29,614 from Thailand and 8,233 from Peru.
-
The most popular posts? Here are a few that have yielded scores of backlinks:

- Our explanation of "Googlebombing"
- A celebration of email and Gmail
- Google Earth's partnership with National Geographic about Africa
-
Several on Google Book Search (formerly known as Google Print), including:
- Preserving public domain books
- Our statement on the Authors' Guild suit
- and Eric Schmidt's op-ed about Book Search.

During the year, we've published 38 how-to tips, announced 77 new products and services, and addressed policy questions and legal matters 17 times. We've featured 11 guest bloggers. Forty posts have illuminated something about day to day life at Google; 19 have offered some international perspective.

In 2006, we'll keep up the Google Blog with more posts, more bloggers, and even more topics. Meanwhile, we really appreciate your interest and feedback, now visible through "Links to this post." We know some of you would like to offer comments directly, and we would like that too, when we can add resources to the blog crew. Meanwhile, our best to you and yours for the New Year.
-
-false -
-
diff --git a/test/_files/AtomTestMozillazine.xml b/test/_files/AtomTestMozillazine.xml deleted file mode 100644 index 2fa18ece..00000000 --- a/test/_files/AtomTestMozillazine.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - mozillaZine.org - - 2006-01-23T04:04:45-08:00 - Your Source for Daily Mozilla News and Advocacy - tag:mozillazine.org,2004:1 - Copyright (c) 2004, The Mozillazine Organization - - Minutes of the mozilla.org Staff Meeting of Monday 9th January 2006 - - 2006-01-22T20:04:42-08:00 - 2006-01-22T20:04:42-08:00 - 2006-01-22T20:04:42-08:00 - tag:mozillazine.org,2004:article7935 - - mozillaZine.org - - - The minutes of the mozilla.org staff meeting held on Monday 9th January 2006 are now online. Issues discussed include Firefox 1.5.0.1 release schedule, Thunderbird 1.5 release and Marketing.

]]> - Talkback

]]> -
-
- - - Minutes of the mozilla.org Staff Meeting of Wednesday 4th January 2006 - - 2006-01-12T09:29:47-08:00 - 2006-01-12T09:29:47-08:00 - 2006-01-12T09:29:47-08:00 - tag:mozillazine.org,2004:article7895 - - mozillaZine.org - - - The minutes of the mozilla.org staff meeting held on Wednesday 4th January 2006 are now available. Issues discussed include Upcoming Releases, Marketing, Thunderbird, 1.9 Roadmap, Firefox 2 Process and Calendar.

-

The minutes have been posted to the new mozilla.dev.general newsgroup, which is accessible via news.mozilla.org. The previously announced newsgroup migration is in progress. Once mozilla.dev.planning is created, minutes will be posted there.

]]> - Talkback

]]> -
-
- - - Thunderbird 1.5 Released - - 2006-01-11T18:19:13-08:00 - 2006-01-11T18:19:13-08:00 - 2006-01-11T18:19:13-08:00 - tag:mozillazine.org,2004:article7892 - - mozillaZine.org - - - Scott MacGregor writes: "The final release of Mozilla Thunderbird 1.5 is now available for download from getthunderbird.com. Users of RC1 should see the update soon. If you are using RC2, then you already have 1.5 final."

-

"Thunderbird 1.5 introduces several new features including a software update system, spell check as you type, built in phishing detector, auto save as draft, and support for deleting attachments from email messages. Message filtering has also been improved with new filter actions for replying and forwarding. Saved search folders can now search folders across multiple accounts."

-

"More details can be found in the Mozilla Thunderbird 1.5 Release Notes, and the support forum staff is available for questions. "

-

"I wanted to thank everyone in the mozillaZine community who helped test the alphas, the betas, and the release candidates that went into this release. Thank you for trusting Thunderbird with your email throughout the development and release cycle for 1.5. I'm looking forward to working with all of you on 2.0 and beyond!"

]]> - Talkback

]]> -
-
- - - Firefox Smoketest Day Planned for January 6, 2006 - - 2006-01-04T14:14:20-08:00 - 2006-01-04T14:14:20-08:00 - 2006-01-04T14:14:20-08:00 - tag:mozillazine.org,2004:article7859 - - mozillaZine.org - - - The Mozilla QA team has announced a community test day with focus on smoketesting nightly Firefox 1.5.0.1 builds.

-

Litmus tool will be used for this testing event. There is a FAQ posted on the QA community wiki that will have specific instructions on how this testing day will run.

]]> - Talkback

]]> -
-
- - - Camino 1.0 Beta 2 Released - - 2006-01-02T15:23:18-08:00 - 2006-01-02T15:23:18-08:00 - 2006-01-02T15:23:18-08:00 - tag:mozillazine.org,2004:article7850 - - mozillaZine.org - - - Camino 1.0 beta 2 has been released. This latest version of the native Mac OS X browser is replacing 0.8.4 as the stable Camino release on all systems 10.2+. See the Camino 1.0 Beta 2 Release Notes for more details.

]]> - Talkback

]]> -
-
- - - Mozilla Newsgroups Migration Scheduled - - 2006-01-02T15:07:27-08:00 - 2006-01-02T15:07:27-08:00 - 2006-01-02T15:07:27-08:00 - tag:mozillazine.org,2004:article7849 - - mozillaZine.org - - - Frank Wein has announced that the migration and reorganization of Mozilla newsgroups will take place in January 2006. As announced earlier, the new newsgroups will be hosted by Giganews. Access to the news server news.mozilla.org will remain free. The new groups will only be propogated to news.mozilla.org, Giganews Servers and Google Groups in an effort to combat news spam. For more information, refer to the FAQ and the list of new newsgroups. -

]]> - Talkback

]]> -
-
- - - Mozilla Thunderbird 1.5 Release Candidate 2 Available - - 2005-12-21T13:58:07-08:00 - 2005-12-21T13:58:07-08:00 - 2005-12-21T13:58:07-08:00 - tag:mozillazine.org,2004:article7823 - - mozillaZine.org - - - Scott MacGregor writes: "The second release candidate of Mozilla Thunderbird 1.5 is now available for download. Mozilla Thunderbird 1.5 RC2 is intended to allow testers to ensure that there are no last-minute problems with the Thunderbird 1.5 code. "

-

"RC2 contains several key bug fixes that were identified during the RC1 testing cycle. There are no new features or enchancements from RC1. Users of Thunderbird 1.5 RC1 will be offered RC 2 through the software update system."

-

"Thunderbird 1.5 RC2 can be downloaded from the Thunderbird 1.5 RC2 Release Notes page, or the Thunderbird 1.5rc2 directory on ftp.mozilla.org. More details can be found in the Release Notes."

-

"I'd like to single out all of the folks who participated in our QA testing day and our localization testing day. We wouldn't have been able to release RC2 before the holidays without all the volunteers who pitched in. Thank you!"

]]> - Talkback

]]> -
-
- - - Interview with Mike Beltzner - - 2005-12-20T23:00:29-08:00 - 2005-12-20T23:00:29-08:00 - 2005-12-20T23:00:29-08:00 - tag:mozillazine.org,2004:article7820 - - mozillaZine.org - - - David Tenser has posted an interview with Mozilla Foundation's User Experience Lead, Mike Beltzner. The interview was conducted over instant messaging sessions during the last week of November. Mike talks about usability studies, design of the Mozilla Developer Central, and the new bookmark system planned for Firefox 2.

]]> - Talkback

]]> -
-
- - - Gecko 1.9 Trunk and 1.8 Branch Management Plan Posted - - 2005-12-20T18:08:36-08:00 - 2005-12-20T18:08:36-08:00 - 2005-12-20T18:08:36-08:00 - tag:mozillazine.org,2004:article7819 - - mozillaZine.org - - - Brendan Eich has posted a draft plan for Gecko 1.9 Trunk and 1.8 Branch Management, including a FAQ at the mozilla wiki. Comments should be directed as followups to the newsgroup post. -

]]> - Talkback

]]> -
-
- - - Minutes of the mozilla.org Staff Meeting of Monday 12th December 2005 - - 2005-12-20T18:04:08-08:00 - 2005-12-20T18:04:08-08:00 - 2005-12-20T18:04:08-08:00 - tag:mozillazine.org,2004:article7818 - - mozillaZine.org - - - The minutes of the mozilla.org staff meeting held on Monday 12th December 2005 are now online. Issues discussed include Firefox Summit, Engineering, Upgrading, Awards and Newsgroups reorganisation

]]> - Talkback

]]> -
-
- - - Minutes of the mozilla.org Staff Meeting of Monday 5th December 2005 - - 2005-12-20T18:02:08-08:00 - 2005-12-20T18:02:08-08:00 - 2005-12-20T18:02:08-08:00 - tag:mozillazine.org,2004:article7817 - - mozillaZine.org - - - The minutes of the mozilla.org staff meeting held on Monday 5th December 2005 are now online. Issues discussed include Firefox Summit and Engineering.

]]> - Talkback

]]> -
-
- - - SeaMonkey 1.0 Beta Released - - 2005-12-20T17:41:12-08:00 - 2005-12-20T17:41:12-08:00 - 2005-12-20T17:41:12-08:00 - tag:mozillazine.org,2004:article7815 - - mozillaZine.org - - - Robert Kaiser writes: "Today, the SeaMonkey Council announces a new developer release, SeaMonkey 1.0 Beta. Compared to the Alpha version released in September, SeaMonkey 1.0 Beta enhances the product with new features like tab drag and drop, but also is the first release branded with the new SeaMonkey logo, which was unveiled earlier this month."

-

"The SeaMonkey 1.0 Beta Release Notes have more information about this test version. All the builds are available from the SeaMonkey 1.0b directory on ftp.mozilla.org."

]]> - Talkback

]]> -
-
- -
diff --git a/test/_files/AtomTestOReilly.xml b/test/_files/AtomTestOReilly.xml deleted file mode 100644 index bc9645ee..00000000 --- a/test/_files/AtomTestOReilly.xml +++ /dev/null @@ -1,214 +0,0 @@ - - - - -weblogs.oreilly.com - -The O'Reilly Network Weblogs -Copyright 2005, O'Reilly Media, Inc. -http://weblogs.oreilly.com/ -2006-01-23T09:16:40-08:00 - -O'Reilly Media, Inc. - -no - - - Delightful Javascript Libs -- LGPL, Too. - http://www.oreillynet.com/pub/wlg/9085 - - -
- Here are some fundamental, well made JS goodies: Vectorgraphics Library, Drag'nDrop & DHTML Library, Tooltips with JavaScript Lib, and Rotate Image Lib. A pleasure to work with, and LGPL'ed. Also check out the JS Online Function Grapher. -
-
- Sid Steward - 2006-01-23T09:16:40-08:00 -
- - - Web 2.0: Simple division? - http://www.oreillynet.com/pub/wlg/9084 - - -
- There's been a lot of talk about the revolutionary change Web 2.0 promises, and it's time to look at the architecture that's leading to that change: a greater split between client and server logic. -
-
- Simon St. Laurent - 2006-01-23T08:15:34-08:00 -
- - - Don't Give us your Tired Your Poor - http://www.oreillynet.com/pub/wlg/9083 - - -
- Give us your vibrant, exciting, cool, open source Java submissions for this year's OSCON. -
-
- Daniel H. Steinberg - 2006-01-23T07:45:36-08:00 -
- - - Cutting Through the Patent Thicket - http://www.oreillynet.com/pub/wlg/9082 - - -
- Good succinct summary of the anti-patent argument, including how VC's look at patents and get duped by them. -
-
- Damien Stolarz - 2006-01-23T00:45:30-08:00 -
- - - The addslashes() Versus mysql_real_escape_string() Debate - http://www.oreillynet.com/pub/wlg/9081 - - -
- Last month, I discussed Google's XSS Vulnerability and provided an example that demonstrates it. I was hoping to highlight why character encoding consistency is important, but apparently the addslashes() versus mysql_real_escape_string() debate continues. -
-
- Chris Shiflett - 2006-01-22T22:45:11-08:00 -
- - - RPM Rollback in Fedora Core 4/5 - http://www.oreillynet.com/pub/wlg/9080 - - -
- Fedora's yum/rpm system includes a little-known capability: it can rollback a system to a previously-installed state. -
-
- Chris Tyler - 2006-01-22T13:15:12-08:00 -
- - - Shifting Gears: Switching to Django - http://www.oreillynet.com/pub/wlg/9075 - - -
- I've been using TurboGears since its public debut around September of last year. I believe it has incredible potential, but I'm finding myself needing something a little different. That something is Django. -
-
- Jeremy Jones - 2006-01-22T12:15:19-08:00 -
- - - Are We In A Productivity Crisis? - http://www.oreillynet.com/pub/wlg/9079 - - -
- Are we in a new kind of productivity crisis, one in which there is not too little productivity, but too much? -
-
- Spencer Critchley - 2006-01-22T09:45:58-08:00 -
- - - What Happens When You Edit an Image Stored Outside of iPhoto 6 - http://www.oreillynet.com/pub/wlg/9078 - - -
- Is the edited image stored inside or outside of your iPhoto 6 library? -
-
- Derrick Story - 2006-01-22T07:45:58-08:00 -
- - - Building emacs22 on Mac OS X - http://www.oreillynet.com/pub/wlg/9074 - - -
- Emacs 22 is Mac OS X aware, and can be built either as a Carbon .app double-clickable, or as a typical X11 program. Problem is, the information about how to build it is pretty scattered. Here's what works for me. -
-
- Chris Adamson - 2006-01-21T19:45:53-08:00 -
- - - hip to bash web2.0, are we? - http://www.oreillynet.com/pub/wlg/9034 - - -
- It's hip to take some "diggs" at Web 2.0. -
-
- Timothy M. O'Brien - 2006-01-21T15:46:26-08:00 -
- - - My New Game Development Course at Tufts - http://www.oreillynet.com/pub/wlg/9076 - - -
- I am teaching a new course at the Tufts University, "Introduction to Game Development," this semester. -
-
- Ming Chow - 2006-01-21T12:46:56-08:00 -
- - - Tune in to Radio Babylon - http://www.oreillynet.com/pub/wlg/9073 - - -
- Hardware hacks we'd like to see in iPods, #1 -
-
- Giles Turnbull - 2006-01-20T14:15:54-08:00 -
- - - A resource for Google maphacks and mashers now at Maphacks,net - http://www.oreillynet.com/pub/wlg/9072 - - -
- -
-
- Glenn Letham - 2006-01-20T12:16:05-08:00 -
- - - UK film studio on the hunt for Google earth programmers - http://www.oreillynet.com/pub/wlg/9071 - - -
- -
-
- Glenn Letham - 2006-01-20T11:47:03-08:00 -
- -
- diff --git a/test/_files/AtomTestPlanetPHP.xml b/test/_files/AtomTestPlanetPHP.xml deleted file mode 100644 index 762f0101..00000000 --- a/test/_files/AtomTestPlanetPHP.xml +++ /dev/null @@ -1,125 +0,0 @@ - -Planet PHPPeople blogging about PHPhttp://www.planet-php.net/ - Planet PHP Aggregator - 2006-01-23T16:40:00ZeZ components in Gentoo LinuxSebastian Bergmannhttp://www.sebastian-bergmann.de/blog/archives/565-guid.html2006-01-23T16:40:00Z2006-01-23T16:40:00ZeZ components, which provide an enterprise ready general purpose PHP platform, are now available through Gentoo Linux's portage system:
wopr-mobile ~ # emerge -vp ezc-eZcomponents
-
-These are the packages that I would merge, in order:
-
-Calculating dependencies ...done!
-[ebuild  N    ] app-admin/php-toolkit-1.0-r2  0 kB
-[ebuild  N    ] dev-lang/php-5.1.2  0 kB [3]
-[ebuild  N    ] dev-php/PEAR-PEAR-1.4.6  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Base-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Database-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-PhpGenerator-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Configuration-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-ImageAnalysis-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Archive-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Translation-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Cache-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-ConsoleTools-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-PersistentObject-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-ImageConversion-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Mail-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-UserInput-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Debug-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-EventLog-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Execution-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-eZcomponents-1.0_rc1  0 kB [2]
-
-Total size of downloads: 0 kB
-Portage overlays:
- [1] /usr/local/overlay/personal
- [2] /usr/local/overlay/cvs
- [3] /usr/local/overlay/php/testing
- [4] /usr/local/overlay/php/experimental
- [5] /usr/local/overlay/gentopia
- [6] /usr/local/overlay/xgl
- ]]>
PHP InsecurityChris Shifletthttp://shiflett.org/archive/1852006-01-23T16:15:00Z2006-01-23T16:15:00ZAndrew van der Stock has written a strong criticism of PHP's insecurity. Andrew is a seasoned security expert and a major contributor to OWASP, and he states:

-
After writing PHP forum software for three years now, I've come to the conclusion that it is basically impossible for normal programmers to write secure PHP code. It takes far too much effort.
-

He continues, citing specific areas where he thinks PHP is weak and asserting that "PHP must now mature and take on a proper security architecture."

-

Many of the insecure features he cites (register_globals, magic_quotes_gpc, and safe_mode) are slated to be removed in PHP 6, but his core complaint seems to revolve around the fact that PHP makes too much power too easily accessible, often granting developers more power and flexibility than they realize (e.g., wrappers).

-

Aside from minor language features like taint mode, I don't see what other platforms offer to help prevent inexperienced developers from writing insecure code. Anyone care to enlighten me? :-)

- Posted Mon, 23 Jan 2006 16:15:56 GMT in Chris Shiflett: The PHP Blog
- [ -   - - Discuss -   - | -   - - Tag -   - | -   - - Digg -   - | -   - - Furl -   - | -   - - Cosmos -   - ] -

]]>
Beta release of mobile webmail client (MIMP)Horde Newshttp://janschneider.de/cweb/home/index,channel,25,story,255.html2006-01-23T10:01:00Z2006-01-23T10:01:00ZMeet me at php|tekThinkPHP /dev/blog - PHPhttp://blog.thinkphp.de/archives/81-guid.html2006-01-22T22:34:00Z2006-01-22T22:34:00Zphp|tek, the next conference from the php|arch -guys around Marco Tabini who already organized the php|cruise and php|tropics -conferences, will be from April 26th to 28th at Orlando, Florida. As -you can read on the recently published schedule -I'll hold two talks. The first talk will be about PHP on the command -line, showing PHP's strength beyond the web which can be helpful to -build, deploy and scale your web-application and even for building apps -completely independent from anything on the web. My second talk will be -about PHP's reflection API. In that session I'll give an introduction -into the API and show how to use it to build modular, dynamic -applications.

-

If you're in reachable distance you should take the chance to listen and meet PHP developers from all over the world. (Hint: Till January 31st you can get early-bird rates!)

johannes

]]>
Quick LookupJohn Coxhttp://wyome.com/index.php?module=articles&func=display&ptid=10&catid=29-31&aid=5072006-01-22T19:23:00Z2006-01-22T19:23:00ZQuick lookup is a very nice little reference tool for lookups of web development documentation. It installs as a simple bookmark which can be changed to your sidebar for look ups of php / css / javascript / mysql documentation. It has a limited scope of features (which isn't a bad thing in my mind):

-

* Multiple tabs
-* PHP / MySQL / CSS / JS reference (MySQL is 55% complete)
-* Examples
-* Search as you type
-* Fast results
-* Remembers your last tab on your revisit
-* Access keys, [alt + (p, m, j, c)]
-

-

I did a cursory install, and it appears to be pretty fast. I think it might be better as part of the Web Developer Extension for Firefox, but as is, I can see the uses.

- ]]>
mysql_real_escape_string() versus Prepared StatementsIlia Alshanetskyhttp://ilia.ws/archives/103-guid.html2006-01-22T18:03:00Z2006-01-22T18:03:00ZChris has written a compelling piece about how the use of addslashes() for string escaping in MySQL queries can lead to SQL injection through the abuse of multibyte character sets. In his example he relies on addslashes() to convert an invalid multibyte sequence into a valid one, which also has an embedded ' that is not escaped. And in an ironic twist, the function intended to protect against SQL injection is used to actually trigger it.

-The problem demonstrated, actually goes a bit further, which even makes the prescribed escaping mechanism, mysql_real_escape_string() prone to the same kind of issues affecting addslashes(). The main advantage of the mysql_real_escape_string() over addslashes() lies in the fact that it takes character set into account and thus is able to determine how to properly escape the data. For example, if GBK character set is being used, it will not convert an invalid multibyte sequence 0xbf27 (¿’) into 0xbf5c27 (¿\’ or in GBK a single valid multibyte character followed by a single quote). To determine the proper escaping methodology mysql_real_escape_string() needs to know the character set used, which is normally retrieved from the database connection cursor. Herein lies the “trick”. In MySQL there are two ways to change the character set, you can do it by changing in MySQL configuration file (my.cnf) by doing:

CODE:
[client]
-default-character-set=GBK


-Or you can change on a per-connection basis, which is a common practice done by people without admin level access to the server via the following query:

CODE:
SET CHARACTER SET 'GBK'


-The problem with the latter, is that while it most certainly modified the charset it didnÂ’t let the escaping facilities know about it. Which means that mysql_real_escape_string() still works on the basis of the default charset, which if set to latin1 (common default) will make the function work in a manner identical to addslashes() for our purposes. Another word, 0xbf27 will be converted to 0xbf5c27 facilitating the SQL injection. Here is a brief proof of concept.

PHP:

<?php

-$c 
= mysql_connect("localhost", "user", "pass");
mysql_select_db("database", $c);

// change our character set
mysql_query("SET CHARACTER SET 'gbk'", $c);

// create demo table
mysql_query("CREATE TABLE users (
-    username VARCHAR(32) PRIMARY KEY,
-    password VARCHAR(32)
-) CHARACTER SET 'GBK'"
, $c);
mysql_query("INSERT INTO users VALUES('foo','bar'), ('baz','test')", $c);

// now the exploit code
$_POST['username'] = chr(0xbf) . chr(0x27) . ' OR username = username /*'; 
$_POST['password'] = 'anything'; 

Truncated by Planet PHP, read more at the original (another 2694 bytes)

]]>
The addslashes() Versus mysql_real_escape_string() DebateChris Shifletthttp://shiflett.org/archive/1842006-01-22T04:15:00Z2006-01-22T04:15:00ZLast month, I discussed Google's XSS Vulnerability and provided an example that demonstrates it. I was hoping to highlight why character encoding consistency is important, but apparently the addslashes() versus mysql_real_escape_string() debate continues. Demonstrating Google's XSS vulnerability was pretty easy. Demonstrating an SQL injection attack that is immune to addslashes() is a bit more involved, but still pretty straightforward.

-

In GBK, 0xbf27 is not a valid multi-byte character, but 0xbf5c is. Interpreted as single-byte characters, 0xbf27 is 0xbf (¿) followed by 0x27 ('), and 0xbf5c is 0xbf (¿) followed by 0x5c (\).

-

How does this help? If I want to attempt an SQL injection attack against a MySQL database, having single quotes escaped with a backslash is a bummer. If you're using addslashes(), however, I'm in luck. All I need to do is inject something like 0xbf27, and addslashes() modifies this to become 0xbf5c27, a valid multi-byte character followed by a single quote. In other words, I can successfully inject a single quote despite your escaping. That's because 0xbf5c is considered to be a single character, not two. Oops, there goes the backslash.

-

I'm going to use MySQL 5.0 and PHP's mysqli extension for this demonstration. If you want to try this yourself, make sure you're using GBK. I just changed /etc/my.cnf, but that's because I'm testing locally:

-
[client]
-default-character-set=GBK
-

Create a table called users:

-
CREATE TABLE users
-(
-    username VARCHAR(32) CHARACTER SET GBK,
-    password VARCHAR(32) CHARACTER SET GBK,
-    PRIMARY KEY (username)
-);
-
-

The following script mimics a situation where only addslashes() is used to escape the data being used in a query:

-
<?php 

$mysql 
= array();

$db = mysqli_init();
$db->real_connect('localhost', 'myuser', 'mypass', 'mydb');

$_POST['username'] = chr(0xbf) .
                     
chr(0x27) .
                     
' OR username = username /*';
$_POST['password'] = 'guess';

$mysql['username'] = addslashes($_POST['username']);
$mysql['password'] = addslashes($_POST

Truncated by Planet PHP, read more at the original (another 4165 bytes)

]]>
PHP ConferencesJason E. Sweathttp://blog.casey-sweat.us/?p=692006-01-22T04:04:00Z2006-01-22T04:04:00ZBack from NorwayTobias Schlitthttp://www.schlitt.info/applications/blog/index.php?/archives/407-guid.html2006-01-22T00:30:00Z2006-01-22T00:30:00ZNorway is a somewhat strange country. When I got there - 2 weeks ago to work with Amos, Derick, Fred and Ray on the eZ components - it had the expected amount of snow. A few days later, there was nothing anymore. We had positive celsius values and the weather was really crappy... until Monday. Since then it has been snowing all the time and yesterday we left when it looked like this:

- -

pict1285.jpg

- -

Nice to watch, but not real fun to walk onto. :) Anyway, it's been another great stay in Skien, where the eZ headquarter is and I'm pretty much looking forward to our summer conference, where we plan to have the complete eZ team there and lots of people from the PHP world. Thanks for the great time, folks!

- - ]]>
Solar 0.10.0 ReleasedPaul M. Joneshttp://paul-m-jones.com/blog/?p=1922006-01-21T21:44:00Z2006-01-21T21:44:00Z
diff --git a/test/_files/AtomTestSample1.xml b/test/_files/AtomTestSample1.xml deleted file mode 100644 index 40aa3671..00000000 --- a/test/_files/AtomTestSample1.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - Example Feed - Insert witty or insightful remark here - - 2003-12-13T18:30:02Z - - John Doe - johndoe@example.com - - urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 - - - Atom-Powered Robots Run Amok - - urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a - 2003-12-13T18:30:02Z - Some text. - - - \ No newline at end of file diff --git a/test/_files/AtomTestSample2.xml b/test/_files/AtomTestSample2.xml deleted file mode 100644 index 7a7a6285..00000000 --- a/test/_files/AtomTestSample2.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - Example Atom Feed - 2006-01-23T23:04:33Z - - http://www.example.com - - - John Doe - John@Example.com - http://www.example.com - - - \ No newline at end of file diff --git a/test/_files/AtomTestSample3.xml b/test/_files/AtomTestSample3.xml deleted file mode 100644 index 0accba88..00000000 --- a/test/_files/AtomTestSample3.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - Example Atom Feed - 2006-01-23T23:04:33Z - - http://www.example.com - - - John Doe - John@Example.com - http://www.example.com - - - - - \ No newline at end of file diff --git a/test/_files/AtomTestSample4.xml b/test/_files/AtomTestSample4.xml deleted file mode 100644 index 8af5593f..00000000 --- a/test/_files/AtomTestSample4.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - http://www.example.com - Example Atom Feed - 2006-01-23T23:04:33Z - - - - John Doe - John@Example.com - http://www.example.com - - - - tag:www.example.com,2006-01-23:/post/1234 - Mars Attacks Pluto Probe - 2006-01-23T23:04:33Z - In upheaval of the tenuous peace between Earth and Mars over the last century, it has been confirmed that a rogue Martian fighter ship suddenly attacked Earth's 2006 probe to Pluto today. Martian delegates have been dispatched to Earth in an effort to quell the political firestorm that has ensued. - - - - - tag:www.example.com,2006-01-23:/post/1235 - Quake Rocks Io - 2006-01-23T23:04:33Z - A strong tremor rocked Io this afternoon, and officials are saying that no one has been found alive on Io since the quake. - - - - \ No newline at end of file diff --git a/test/_files/RssTest091Sample1.xml b/test/_files/RssTest091Sample1.xml deleted file mode 100644 index 65788c3d..00000000 --- a/test/_files/RssTest091Sample1.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - WriteTheWeb - http://writetheweb.com - News for web users that write back - en-us - Copyright 2000, WriteTheWeb team. - editor@writetheweb.com - webmaster@writetheweb.com - - WriteTheWeb - http://writetheweb.com/images/mynetscape88.gif - http://writetheweb.com - 88 - 31 - News for web users that write back - - - Giving the world a pluggable Gnutella - http://writetheweb.com/read.php?item=24 - WorldOS is a framework on which to build programs that work like Freenet or Gnutella -allowing distributed applications using peer-to-peer routing. - - - Syndication discussions hot up - http://writetheweb.com/read.php?item=23 - After a period of dormancy, the Syndication mailing list has become active again, with contributions from leaders in traditional media and Web syndication. - - - Personal web server integrates file sharing and messaging - http://writetheweb.com/read.php?item=22 - The Magi Project is an innovative project to create a combined personal web server and messaging system that enables the sharing and synchronization of information across desktop, laptop and palmtop devices. - - - Syndication and Metadata - http://writetheweb.com/read.php?item=21 - RSS is probably the best known metadata format around. RDF is probably one of the least understood. In this essay, published on my O'Reilly Network weblog, I argue that the next generation of RSS should be based on RDF. - - - UK bloggers get organised - http://writetheweb.com/read.php?item=20 - Looks like the weblogs scene is gathering pace beyond the shores of the US. There's now a UK-specific page on weblogs.com, and a mailing list at egroups. - - - Yournamehere.com more important than anything - http://writetheweb.com/read.php?item=19 - Whatever you're publishing on the web, your site name is the most valuable asset you have, according to Carl Steadman. - - - diff --git a/test/_files/RssTest092Sample1.xml b/test/_files/RssTest092Sample1.xml deleted file mode 100644 index 5d75c352..00000000 --- a/test/_files/RssTest092Sample1.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - Dave Winer: Grateful Dead - http://www.scripting.com/blog/categories/gratefulDead.html - A high-fidelity Grateful Dead song every day. This is where we're experimenting with enclosures on RSS news items that download when you're not using your computer. If it works (it will) it will be the end of the Click-And-Wait multimedia experience on the Internet. - Fri, 13 Apr 2001 19:23:02 GMT - http://backend.userland.com/rss092 - dave@userland.com (Dave Winer) - dave@userland.com (Dave Winer) - - - It's been a few days since I added a song to the Grateful Dead channel. Now that there are all these new Radio users, many of whom are tuned into this channel (it's #16 on the hotlist of upstreaming Radio users, there's no way of knowing how many non-upstreaming users are subscribing, have to do something about this..). Anyway, tonight's song is a live version of Weather Report Suite from Dick's Picks Volume 7. It's wistful music. Of course a beautiful song, oft-quoted here on Scripting News. <i>A little change, the wind and rain.</i> - - - - - Kevin Drennan started a <a href="http://deadend.editthispage.com/">Grateful Dead Weblog</a>. Hey it's cool, he even has a <a href="http://deadend.editthispage.com/directory/61">directory</a>. <i>A Frontier 7 feature.</i> - Scripting News - - - <a href="http://arts.ucsc.edu/GDead/AGDL/other1.html">The Other One</a>, live instrumental, One From The Vault. Very rhythmic very spacy, you can listen to it many times, and enjoy something new every time. - - - - This is a test of a change I just made. Still diggin.. - - - The HTML rendering almost <a href="http://validator.w3.org/check/referer">validates</a>. Close. Hey I wonder if anyone has ever published a style guide for ALT attributes on images? What are you supposed to say in the ALT attribute? I sure don't know. If you're blind send me an email if u cn rd ths. - - - <a href="http://www.cs.cmu.edu/~mleone/gdead/dead-lyrics/Franklin's_Tower.txt">Franklin's Tower</a>, a live version from One From The Vault. - - - - Moshe Weitzman says Shakedown Street is what I'm lookin for for tonight. I'm listening right now. It's one of my favorites. "Don't tell me this town ain't got no heart." Too bright. I like the jazziness of Weather Report Suite. Dreamy and soft. How about The Other One? "Spanish lady come to me.." - Scripting News - - - <a href="http://www.scripting.com/mp3s/youWinAgain.mp3">The news is out</a>, all over town..<p> -You've been seen, out runnin round. <p> -The lyrics are <a href="http://www.cs.cmu.edu/~mleone/gdead/dead-lyrics/You_Win_Again.txt">here</a>, short and sweet. <p> -<i>You win again!</i> - - - - - <a href="http://www.getlyrics.com/lyrics/grateful-dead/wake-of-the-flood/07.htm">Weather Report Suite</a>: "Winter rain, now tell me why, summers fade, and roses die? The answer came. The wind and rain. Golden hills, now veiled in grey, summer leaves have blown away. Now what remains? The wind and rain." - - - - <a href="http://arts.ucsc.edu/gdead/agdl/darkstar.html">Dark Star</a> crashes, pouring its light into ashes. - - - - DaveNet: <a href="http://davenet.userland.com/2001/01/21/theUsBlues">The U.S. Blues</a>. - - - Still listening to the US Blues. <i>"Wave that flag, wave it wide and high.."</i> Mistake made in the 60s. We gave our country to the assholes. Ah ah. Let's take it back. Hey I'm still a hippie. <i>"You could call this song The United States Blues."</i> - - - <a href="http://www.sixties.com/html/garcia_stack_0.html"><img src="http://www.scripting.com/images/captainTripsSmall.gif" height="51" width="42" border="0" hspace="10" vspace="10" align="right"></a>In celebration of today's inauguration, after hearing all those great patriotic songs, America the Beautiful, even The Star Spangled Banner made my eyes mist up. It made my choice of Grateful Dead song of the night realllly easy. Here are the <a href="http://searchlyrics2.homestead.com/gd_usblues.html">lyrics</a>. Click on the audio icon to the left to give it a listen. "Red and white, blue suede shoes, I'm Uncle Sam, how do you do?" It's a different kind of patriotic music, but man I love my country and I love Jerry and the band. <i>I truly do!</i> - - - - Grateful Dead: "Tennessee, Tennessee, ain't no place I'd rather be." - - - - Ed Cone: "Had a nice Deadhead experience with my wife, who never was one but gets the vibe and knows and likes a lot of the music. Somehow she made it to the age of 40 without ever hearing Wharf Rat. We drove to Jersey and back over Christmas with the live album commonly known as Skull and Roses in the CD player much of the way, and it was cool to see her discover one the band's finest moments. That song is unique and underappreciated. Fun to hear that disc again after a few years off -- you get Jerry as blues-guitar hero on Big Railroad Blues and a nice version of Bertha." - - - - <a href="http://arts.ucsc.edu/GDead/AGDL/fotd.html">Tonight's Song</a>: "If I get home before daylight I just might get some sleep tonight." - - - - <a href="http://arts.ucsc.edu/GDead/AGDL/uncle.html">Tonight's song</a>: "Come hear Uncle John's Band by the river side. Got some things to talk about here beside the rising tide." - - - - <a href="http://www.cs.cmu.edu/~mleone/gdead/dead-lyrics/Me_and_My_Uncle.txt">Me and My Uncle</a>: "I loved my uncle, God rest his soul, taught me good, Lord, taught me all I know. Taught me so well, I grabbed that gold and I left his dead ass there by the side of the road." - - - - - Truckin, like the doo-dah man, once told me gotta play your hand. Sometimes the cards ain't worth a dime, if you don't lay em down. - - - - Two-Way-Web: <a href="http://www.thetwowayweb.com/payloadsForRss">Payloads for RSS</a>. "When I started talking with Adam late last year, he wanted me to think about high quality video on the Internet, and I totally didn't want to hear about it." - - - A touch of gray, kinda suits you anyway.. - - - - <a href="http://www.sixties.com/html/garcia_stack_0.html"><img src="http://www.scripting.com/images/captainTripsSmall.gif" height="51" width="42" border="0" hspace="10" vspace="10" align="right"></a>In celebration of today's inauguration, after hearing all those great patriotic songs, America the Beautiful, even The Star Spangled Banner made my eyes mist up. It made my choice of Grateful Dead song of the night realllly easy. Here are the <a href="http://searchlyrics2.homestead.com/gd_usblues.html">lyrics</a>. Click on the audio icon to the left to give it a listen. "Red and white, blue suede shoes, I'm Uncle Sam, how do you do?" It's a different kind of patriotic music, but man I love my country and I love Jerry and the band. <i>I truly do!</i> - - - - \ No newline at end of file diff --git a/test/_files/RssTest100Sample1.xml b/test/_files/RssTest100Sample1.xml deleted file mode 100644 index cd884501..00000000 --- a/test/_files/RssTest100Sample1.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - XML.com - http://xml.com/pub - - XML.com features a rich mix of information and services - for the XML community. - - - - - - - - - - - - - - - - - XML.com - http://www.xml.com - http://xml.com/universal/images/xml_tiny.gif - - - - Processing Inclusions with XSLT - http://xml.com/pub/2000/08/09/xslt/xslt.html - - Processing document inclusions with general XML tools can be - problematic. This article proposes a way of preserving inclusion - information through SAX-based processing. - - - - - Putting RDF to Work - http://xml.com/pub/2000/08/09/rdfdb/index.html - - Tool and API support for the Resource Description Framework - is slowly coming of age. Edd Dumbill takes a look at RDFDB, - one of the most exciting new RDF toolkits. - - - - - Search XML.com - Search XML.com's XML collection - s - http://search.xml.com - - - \ No newline at end of file diff --git a/test/_files/RssTest100Sample2.xml b/test/_files/RssTest100Sample2.xml deleted file mode 100644 index 5b4cbc46..00000000 --- a/test/_files/RssTest100Sample2.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - Meerkat - http://meerkat.oreillynet.com - Meerkat: An Open Wire Service - The O'Reilly Network - Rael Dornfest (mailto:rael@oreilly.com) - Copyright © 2000 O'Reilly & Associates, Inc. - 2000-01-01T12:00+00:00 - hourly - 2 - 2000-01-01T12:00+00:00 - - - - - - - - - - - - - - - Meerkat Powered! - http://meerkat.oreillynet.com/icons/meerkat-powered.jpg - http://meerkat.oreillynet.com - - - - XML: A Disruptive Technology - http://c.moreover.com/click/here.pl?r123 - - XML is placing increasingly heavy loads on the existing technical - infrastructure of the Internet. - - The O'Reilly Network - Simon St.Laurent (mailto:simonstl@simonstl.com) - Copyright © 2000 O'Reilly & Associates, Inc. - XML - XML.com - NASDAQ - XML - - - - Search Meerkat - Search Meerkat's RSS Database... - s - http://meerkat.oreillynet.com/ - search - regex - - - \ No newline at end of file diff --git a/test/_files/RssTest200Sample1.xml b/test/_files/RssTest200Sample1.xml deleted file mode 100644 index 7eedaf81..00000000 --- a/test/_files/RssTest200Sample1.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - Liftoff News - http://liftoff.msfc.nasa.gov/ - Liftoff to Space Exploration. - en-us - Tue, 10 Jun 2003 04:00:00 GMT - Tue, 10 Jun 2003 09:41:01 GMT - http://blogs.law.harvard.edu/tech/rss - Weblog Editor 2.0 - editor@example.com - webmaster@example.com - - Star City - http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp - How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia's <a href="http://howe.iki.rssi.ru/GCTC/gctc_e.htm">Star City</a>. - Tue, 03 Jun 2003 09:39:21 GMT - http://liftoff.msfc.nasa.gov/2003/06/03.html#item573 - - - Sky watchers in Europe, Asia, and parts of Alaska and Canada will experience a <a href="http://science.nasa.gov/headlines/y2003/30may_solareclipse.htm">partial eclipse of the Sun</a> on Saturday, May 31st. - Fri, 30 May 2003 11:06:42 GMT - http://liftoff.msfc.nasa.gov/2003/05/30.html#item572 - - - The Engine That Does More - http://liftoff.msfc.nasa.gov/news/2003/news-VASIMR.asp - Before man travels to Mars, NASA hopes to design new engines that will let us fly through the Solar System more quickly. The proposed VASIMR engine would do that. - Tue, 27 May 2003 08:37:32 GMT - http://liftoff.msfc.nasa.gov/2003/05/27.html#item571 - - - Astronauts' Dirty Laundry - http://liftoff.msfc.nasa.gov/news/2003/news-laundry.asp - Compared to earlier spacecraft, the International Space Station has many luxuries, but laundry facilities are not one of them. Instead, astronauts have other options. - Tue, 20 May 2003 08:56:02 GMT - http://liftoff.msfc.nasa.gov/2003/05/20.html#item570 - - - \ No newline at end of file diff --git a/test/_files/RssTestCNN.xml b/test/_files/RssTestCNN.xml deleted file mode 100644 index b7992aa0..00000000 --- a/test/_files/RssTestCNN.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - -CNN.com -http://www.cnn.com/rssclick/?section=cnn_topstories -CNN.com delivers up-to-the-minute news and information on the latest top stories, weather, entertainment, politics and more. -en-us -© 2006 Cable News Network LP, LLLP. -Mon, 23 Jan 2006 15:11:09 EST -5 - -CNN.com -http://www.cnn.com/rssclick/?section=cnn_topstories -http://i.cnn.net/cnn/.element/img/1.0/logo/cnn.logo.rss.gif -144 -33 -CNN.com delivers up-to-the-minute news and information on the latest top stories, weather, entertainment, politics and more. - - -Court ruling could lead to BlackBerry shutdown -http://www.cnn.com/rssclick/money/2006/01/23/technology/rim/index.htm?section=cnn_topstories -BlackBerry maker Research in Motion was dealt a setback today when the U.S. Supreme Court turned down a request to review a major patent infringement ruling against the company. Research In Motion (RIM) had petitioned the Supreme Court to review a federal appeals court ruling that could lead to a shutdown of most U.S. BlackBerry sales and service. -Mon, 23 Jan 2006 15:09:23 EST - - -Ford owners not told how to reduce fire risk -http://www.cnn.com/rssclick/2006/US/01/23/ford.fires/index.html?section=cnn_topstories -The parents of three sisters burned to death in a rear-end crash are asking Ford Motor Co. to install the same gas tank protective devices in regular models as it did for its police cars. -Mon, 23 Jan 2006 12:30:45 EST - - -Ford cutting up to 30,000 jobs -http://www.cnn.com/rssclick/money/2006/01/23/news/companies/ford_closings/index.htm?section=cnn_topstories -Ford will close 14 manufacturing plants in North America and cut up to 30,000 jobs in the coming years to try to stem losses and adjust to a new, significantly lower market share. "If we build it, they'll buy it. That's business as usual and it's wrong," said Ford Chairman and CEO Bill Ford . "Our product plans for too long have been defined by our capacity. That's why we must reduce capacity in North America." -Mon, 23 Jan 2006 11:56:19 EST - - -Bush rejects warrantless wiretaps furor -http://www.cnn.com/rssclick/2006/POLITICS/01/23/bush.ap/index.html?section=cnn_topstories -Read full story for latest details. -Mon, 23 Jan 2006 14:25:26 EST - - -Rescuers dig for survivors in collapsed Nairobi building -http://www.cnn.com/rssclick/2006/WORLD/africa/01/23/kenya.building/index.html?section=cnn_topstories -Rescuers are desperately trying to dig out construction workers trapped under the rubble of a five-story building that collapsed today in Nairobi, Kenya. At least 60 people are injured. It was unclear if any workers had died. Witnesses told news agencies they had seen between four and eight bodies but police have given no official death toll yet. Dozens of rescuers dug into the rubble with their bare hands while the injured were taken to hospitals in cars. -Mon, 23 Jan 2006 15:06:36 EST - - -DNA frees man 24 years into 130-year sentence -http://www.cnn.com/rssclick/2006/LAW/01/23/dna.exoneration.ap/index.html?section=cnn_topstories -Read full story for latest details. -Mon, 23 Jan 2006 14:05:16 EST - - -School nurse crisis putting kids at risk -http://www.cnn.com/rssclick/2006/HEALTH/01/23/btsc.cohen/index.html?section=cnn_topstories -A few months ago, I was interviewing a principal at a Chicago, Illinois, public elementary school, when from outside her office came the sounds of a child coughing. -Mon, 23 Jan 2006 12:54:40 EST - - -Russia: Britain used 'rock' to spy -http://www.cnn.com/rssclick/2006/WORLD/europe/01/23/uk.russia.row/index.html?section=cnn_topstories -British official say they are "concerned and surprised" at allegations by a Russian state TV program that UK diplomats used a transmitter embedded in a fake rock as part of a high-tech spying operation in Moscow, news agencies report. -Mon, 23 Jan 2006 14:21:29 EST - - -Buttafuocos plan TV reunion with Amy Fisher -http://www.cnn.com/rssclick/2006/SHOWBIZ/TV/01/23/people.fisher.buttafuoco.reunion.ap/index.html?section=cnn_topstories -Read full story for latest details. -Mon, 23 Jan 2006 13:31:06 EST - - -Could you love the 'world's worst dog'? -http://www.cnn.com/rssclick/2006/SHOWBIZ/books/01/23/books.marley.me.ap/index.html?section=cnn_topstories -Read full story for latest details. -Mon, 23 Jan 2006 12:35:01 EST - - - diff --git a/test/_files/RssTestHarvardLaw.xml b/test/_files/RssTestHarvardLaw.xml deleted file mode 100644 index 842ba27a..00000000 --- a/test/_files/RssTestHarvardLaw.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - - Really Simple Syndication - http://blogs.law.harvard.edu/tech/ - RSS Advisory Board announcements and RSS news - http://creativecommons.org/licenses/by-sa/1.0/ - en-us - Sat, 21 Jan 2006 05:00:00 GMT - Sun, 22 Jan 2006 02:01:58 GMT - http://backend.userland.com/rss - UserLand Frontier v9.5 - rssUpdates - rcade@yahoo.com - rcade@yahoo.com - - Simple Syndication in Communist China - http://english.peopledaily.com.cn/rss/rss.html - The English language edition of <a href="http://english.peopledaily.com.cn/">People's Daily</a>, the official newspaper of the Communist Party of China, offers <a href="http://english.peopledaily.com.cn/rss/rss.html">18 RSS 2.0 newsfeeds</a>.<br> -<br> -In addition to feeds on current events in news, business, sports, and -other areas, the paper devotes feeds to party leaders such as Chinese -President <a href="http://english.people.com.cn/rss/hujintao.xml">Hu Jintao</a> and Premier <a href="http://english.peopledaily.com.cn/rss/rss.html">Wen Jiabao</a>.<br> -<br> -Outside observers of China often look to <span style="font-style: italic;">People's Daily</span> for clues about the inner workings of the government, as described in <a href="http://en.wikipedia.org/wiki/People%27s_Daily">Wikipedia</a>:<br> -<p style="margin-left: 40px;">Newspaper articles in the <span style="font-style: italic;">People's Daily</span> are often not read for -content, so much as placement. A large number of articles devoted to a -political figure or idea is often taken as a sign that that official is -rising.</p><br><br><div style="margin-left: 40px;">In addition, editorials in the <i>People's Daily</i> are also still regarded as fairly authoritative statements of government policy.<br> -</div> - Rogers Cadenhead - http://blogs.law.harvard.edu/tech/2005/07/10#a852 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=852&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2005%2F07%2F10%23a852 - - - RSS Takes Flight at NASA - http://www.nasa.gov/rss/ - The National Aeronautics and Space Administration makes extensive use -of RSS 2.0 to provide news, photographs, and press releases on upcoming -missions and other space-related topics.<br> -<br> -People looking ahead to the planned July 13 launch of the space shuttle Discovery can subscribe to a <a href="http://www.nasa.gov/rss/rtf_news.rss">Return to Flight RSS feed</a>.<br> -<br> -NASA's RSS information page also includes an interesting demonstration of an RSS viewer created in Macromedia Flash.<br> - Rogers Cadenhead - http://blogs.law.harvard.edu/tech/2005/07/09#a851 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=851&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2005%2F07%2F09%23a851 - - - RSS Usage Skyrockets in the U.S. - http://blogs.law.harvard.edu/tech/2005/01/04#a821 - Six million Americans get news and information from RSS aggregators, according to a <a href="http://www.pewinternet.org/pdfs/PIP_blogging_data.pdf">nationwide telephone survey</a> conducted by the Pew Internet and American Life Project in November.<br> -<br> -The project, an ongoing survey of the 120 million Americans using the -Internet, found that 5 percent follow their favorite sources through -RSS syndication. "This is a first-time measurement from our surveys and -is an indicator that this application is gaining an impressive -foothold."<br> -<br> -The survey also found that 27 percent of those polled are weblog -readers, a 58 percent jump in the 9 months since the preceding poll was -conducted.<br> - Rogers Cadenhead - http://blogs.law.harvard.edu/tech/2005/01/04#a821 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=821&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2005%2F01%2F04%23a821 - - - Added link to encoding examples in RSS 2.0 spec - http://blogs.law.harvard.edu/tech/2004/06/19#a683 - <P>We added a link to a page of <A href="http://blogs.law.harvard.edu/tech/encodingDescriptions">encoding examples</A> for descriptions, <A href="http://blogs.law.harvard.edu/tech/rss#hrelementsOfLtitemgt">under</A> Elements of &lt;item>. The change is also <A href="http://blogs.law.harvard.edu/tech/rssChangeNotes#61904Dw">noted</A> on the Change Notes page.</P> - Dave Winer - http://blogs.law.harvard.edu/tech/2004/06/19#a683 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=683&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F06%2F19%23a683 - - - Proposed clarification for RSS 2.0 spec (revised) - http://blogs.law.harvard.edu/tech/2004/06/15#a648 - <P>Here's a revised proposal for a clarification to the RSS 2.0 spec.</P> -<P>Under <A href="http://blogs.law.harvard.edu/tech/rss#hrelementsOfLtitemgt">Elements of &lt;item></A>, replace the lead paragraph with the following.<BR></P> -<BLOCKQUOTE> -<P>A channel may contain any number of &lt;item>s. An item may represent a "story" -- much like a story in a newspaper or magazine; if so its description is a synopsis of the story, and the link points to the full story. An item may also be complete in itself, if so, the description contains the text (entity-encoded HTML is allowed<FONT color=green><B>; see <A style="COLOR: green" href="http://blogs.law.harvard.edu/tech/encodingDescriptions">examples</A></B></FONT>), and the link and title may be omitted. All elements of an item are optional, however at least one of title or description must be present.</P></BLOCKQUOTE> -<P><STRONG>Notes</STRONG>: The new text is in green. The word examples links to a <A href="http://blogs.law.harvard.edu/tech/encodingDescriptions">page</A> of examples of encodings. We'd like to make the changes to the spec early next week.&nbsp;&nbsp;If you have concerns about this change, please post a comment below, and we will review them before making the change. Thanks to everyone who has participated in the discussion thus far.</P> - Andrew Grumet - http://blogs.law.harvard.edu/tech/2004/06/15#a648 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=648&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F06%2F15%23a648 - - - Proposed clarification for RSS 2.0 spec - http://blogs.law.harvard.edu/tech/2004/06/04#a553 - <P>Requesting comments on a couple of proposed clarifications to the <A href="http://blogs.law.harvard.edu/tech/rss#hrelementsOfLtitemgt">RSS 2.0 spec</A>.</P> -<P>1. Under Elements of &lt;item>, replace the lead paragraph with the following. The new text is highlighted in green.</P> -<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"> -<P>A channel may contain any number of &lt;item>s. An item may represent a "story" -- much like a story in a newspaper or magazine; if so its description is a synopsis of the story, and the link points to the full story. An item may also be complete in itself, if so, the description contains the text, and the link and title may be omitted. <B><FONT color=green>Either way, &lt;description> contains entity-encoded HTML</FONT>.</B> All elements of an item are optional, however at least one of title or description must be present.</P></BLOCKQUOTE> -<P>2. Immediately following that section, a link to a <A href="http://blogs.law.harvard.edu/tech/encodingDescriptions">page of examples</A>, authored by Nick Bradbury, author of the FeedDemon aggregator.</P> -<P><STRONG>Notes: </STRONG>We believe aggregators already assume the&nbsp;item-level description contains entity-encoded HTML.&nbsp; We'd like to make the changes to the spec early next week and if there are no deal-stoppers, we will. Please comment below. Off-topic and personal comments will be deleted.</P> -<P><STRONG>Thanks to:</STRONG> Nick Bradbury, Brent Simmons, Greg Reinacker, Jake Savin, Dare Obasanjo, Matt Mullenweg for their help working out this proposed clarification.</P> - Dave Winer - http://blogs.law.harvard.edu/tech/2004/06/04#a553 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=553&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F06%2F04%23a553 - - - RSS documentation updates - http://blogs.law.harvard.edu/tech/2004/05/31#a550 - If you're not tracking this site's <A href="http://blogs.law.harvard.edu/tech/rssChangeNotes">change notes page</A>, you might have missed a few minor edits to the documentation for RSS 2.0:<BR> -<UL> -<LI>The <A href="http://cyber.law.harvard.edu/blogs/gems/tech/rss2sample.xml">RSS 2.0 sample file</A> has been updated. -<LI>An <A href="http://blogs.law.harvard.edu/tech/rssChangeNotes#53104Dw">encoding issue</A> has been fixed on the <A href="http://blogs.law.harvard.edu/tech/skipHoursDays">skipHours and skipDays</A> page. </LI></UL>Suggestions for further improvements to the documentation are encouraged.<BR><BR> - Rogers Cadenhead - http://blogs.law.harvard.edu/tech/2004/05/31#a550 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=550&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F05%2F31%23a550 - - - The role of the advisory board - http://blogs.law.harvard.edu/tech/2004/05/18#a540 - There's been some confusion about the role of the advisory board. The purpose of this post to try to clear it up.<BR><BR>1. It's got a very conservative mission, to answer questions about RSS, to help people use it, to promote its use. It's basically a support function. <BR><BR>2. Anyone can extend RSS through namespaces. We suggest that people look first to see if there is a core element that already does what they need to do, and if so, use that instead of inventing a new one. That will keep the work of aggregator developers to a minimum, keep the barriers to entry low, help keep the market competitive. Competition should be based on features, performance and price, not compatibility. Compatibility should be easy.<BR><BR>3. Emphatically, this group is not a standards organization. It does not own RSS, or the spec, it has no more or less authority than any other group of people who wish to promote RSS. - Dave Winer - http://blogs.law.harvard.edu/tech/2004/05/18#a540 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=540&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F05%2F18%23a540 - - - Why are dates RFC 822? - http://blogs.law.harvard.edu/tech/2004/05/16#a534 - <P>Gene Saunders writes: "Why does RSS 2.0 use RFC 822 instead of the (infinitely more modern) RFC 2822?"</P> -<P>Here's why we went with RFC 822:</P> -<P>1. Any scripting software that was used in Internet applications would already have to deal with RFC 822 dates, since that was the format used in email. For most app developers, I imagined, they already had library routines that dealt with 822 format dates. The script environment I was using certainly did. Over the years I've never heard a complaint that people were unable to process 822 dates. <img src="http://static.userland.com/shortcuts/images/qbullets/sidesmiley.gif"></P> -<P>2. 822 dates are not only machine readable, they are also human readable. One of the <A href="http://davenet.scripting.com/2000/09/02/whatToDoAboutRss#rssIsAboutSimplicity">goals</A> of RSS was to be non-intimidating for non-technical users -- they should be able to look at a file and make sense of what's there, where ever possible. </P> -<P>3. Believe it or not, the decision was made in 1997, seven years ago. RSS is a venerable institution, so its anachronisms should be appreciated&nbsp;as one respects a fine wine or an elder statesman, or a format that spawned an incredible market.</P> - Dave Winer - http://blogs.law.harvard.edu/tech/2004/05/16#a534 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=534&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F05%2F16%23a534 - - - Speed Meets Feed in Download Tool - http://blogs.law.harvard.edu/tech/2004/03/15#a519 - <A href="http://www.wired.com/news/infostructure/0,1377,62651,00.html">Wired</A>: "A demo publishing system launched Friday by a popular programmer and blogger merges two of this season's hottest tech fads -- RSS news syndication and BitTorrent file sharing -- to create a cheap publishing system for what its author calls 'big media objects.' The hybrid system is meant to eliminate both the publisher's need for fat bandwidth, and the consumer's need to wait through a grueling download." - Dave Winer - http://blogs.law.harvard.edu/tech/2004/03/15#a519 - http://blogs.law.harvard.edu/tech/comments?u=tech&amp;p=519&amp;link=http%3A%2F%2Fblogs.law.harvard.edu%2Ftech%2F2004%2F03%2F15%23a519 - - - \ No newline at end of file diff --git a/test/_files/RssTestPlanetPHP.xml b/test/_files/RssTestPlanetPHP.xml deleted file mode 100644 index 762f9877..00000000 --- a/test/_files/RssTestPlanetPHP.xml +++ /dev/null @@ -1,126 +0,0 @@ - - -Planet PHPhttp://planet-php.netPeople blogging about PHPeneZ components in Gentoo Linux - Sebastian Bergmannhttp://www.sebastian-bergmann.de/blog/archives/565-eZ-components-in-Gentoo-Linux.htmlMon, 23 Jan 2006 16:40:00 +0000eZ components, which provide an enterprise ready general purpose PHP platform, are now available through Gentoo Linux's portage system:
wopr-mobile ~ # emerge -vp ezc-eZcomponents
-
-These are the packages that I would merge, in order:
-
-Calculating dependencies ...done!
-[ebuild  N    ] app-admin/php-toolkit-1.0-r2  0 kB
-[ebuild  N    ] dev-lang/php-5.1.2  0 kB [3]
-[ebuild  N    ] dev-php/PEAR-PEAR-1.4.6  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Base-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Database-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-PhpGenerator-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Configuration-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-ImageAnalysis-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Archive-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Translation-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Cache-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-ConsoleTools-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-PersistentObject-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-ImageConversion-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Mail-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-UserInput-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Debug-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-EventLog-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-Execution-1.0_rc1  0 kB [2]
-[ebuild  N    ] dev-php5/ezc-eZcomponents-1.0_rc1  0 kB [2]
-
-Total size of downloads: 0 kB
-Portage overlays:
- [1] /usr/local/overlay/personal
- [2] /usr/local/overlay/cvs
- [3] /usr/local/overlay/php/testing
- [4] /usr/local/overlay/php/experimental
- [5] /usr/local/overlay/gentopia
- [6] /usr/local/overlay/xgl
- ]]>
PHP Insecurity - Chris Shifletthttp://shiflett.org/archive/185Mon, 23 Jan 2006 16:15:56 +0000Andrew van der Stock has written a strong criticism of PHP's insecurity. Andrew is a seasoned security expert and a major contributor to OWASP, and he states:

-
After writing PHP forum software for three years now, I've come to the conclusion that it is basically impossible for normal programmers to write secure PHP code. It takes far too much effort.
-

He continues, citing specific areas where he thinks PHP is weak and asserting that "PHP must now mature and take on a proper security architecture."

-

Many of the insecure features he cites (register_globals, magic_quotes_gpc, and safe_mode) are slated to be removed in PHP 6, but his core complaint seems to revolve around the fact that PHP makes too much power too easily accessible, often granting developers more power and flexibility than they realize (e.g., wrappers).

-

Aside from minor language features like taint mode, I don't see what other platforms offer to help prevent inexperienced developers from writing insecure code. Anyone care to enlighten me? :-)

- Posted Mon, 23 Jan 2006 16:15:56 GMT in Chris Shiflett: The PHP Blog
- [ -   - - Discuss -   - | -   - - Tag -   - | -   - - Digg -   - | -   - - Furl -   - | -   - - Cosmos -   - ] -

]]>
Beta release of mobile webmail client (MIMP) - Horde Newshttp://janschneider.de/cweb/home/index,channel,25,story,255.htmlMon, 23 Jan 2006 10:01:16 +0000Meet me at php|tek - ThinkPHP /dev/blog - PHPhttp://blog.thinkphp.de/archives/81-Meet-me-at-phptek.htmlSun, 22 Jan 2006 22:34:00 +0000php|tek, the next conference from the php|arch -guys around Marco Tabini who already organized the php|cruise and php|tropics -conferences, will be from April 26th to 28th at Orlando, Florida. As -you can read on the recently published schedule -I'll hold two talks. The first talk will be about PHP on the command -line, showing PHP's strength beyond the web which can be helpful to -build, deploy and scale your web-application and even for building apps -completely independent from anything on the web. My second talk will be -about PHP's reflection API. In that session I'll give an introduction -into the API and show how to use it to build modular, dynamic -applications.

-

If you're in reachable distance you should take the chance to listen and meet PHP developers from all over the world. (Hint: Till January 31st you can get early-bird rates!)

johannes

]]>
Quick Lookup - John Coxhttp://wyome.com/index.php?module=articles&func=display&ptid=10&catid=29-31&aid=507Sun, 22 Jan 2006 19:23:31 +0000Quick lookup is a very nice little reference tool for lookups of web development documentation. It installs as a simple bookmark which can be changed to your sidebar for look ups of php / css / javascript / mysql documentation. It has a limited scope of features (which isn't a bad thing in my mind):

-

* Multiple tabs
-* PHP / MySQL / CSS / JS reference (MySQL is 55% complete)
-* Examples
-* Search as you type
-* Fast results
-* Remembers your last tab on your revisit
-* Access keys, [alt + (p, m, j, c)]
-

-

I did a cursory install, and it appears to be pretty fast. I think it might be better as part of the Web Developer Extension for Firefox, but as is, I can see the uses.

- ]]>
mysql_real_escape_string() versus Prepared Statements - Ilia Alshanetskyhttp://ilia.ws/archives/103-mysql_real_escape_string-versus-Prepared-Statements.htmlSun, 22 Jan 2006 18:03:59 +0000Chris has written a compelling piece about how the use of addslashes() for string escaping in MySQL queries can lead to SQL injection through the abuse of multibyte character sets. In his example he relies on addslashes() to convert an invalid multibyte sequence into a valid one, which also has an embedded ' that is not escaped. And in an ironic twist, the function intended to protect against SQL injection is used to actually trigger it.

-The problem demonstrated, actually goes a bit further, which even makes the prescribed escaping mechanism, mysql_real_escape_string() prone to the same kind of issues affecting addslashes(). The main advantage of the mysql_real_escape_string() over addslashes() lies in the fact that it takes character set into account and thus is able to determine how to properly escape the data. For example, if GBK character set is being used, it will not convert an invalid multibyte sequence 0xbf27 (¿’) into 0xbf5c27 (¿\’ or in GBK a single valid multibyte character followed by a single quote). To determine the proper escaping methodology mysql_real_escape_string() needs to know the character set used, which is normally retrieved from the database connection cursor. Herein lies the “trick”. In MySQL there are two ways to change the character set, you can do it by changing in MySQL configuration file (my.cnf) by doing:

CODE:
[client]
-default-character-set=GBK


-Or you can change on a per-connection basis, which is a common practice done by people without admin level access to the server via the following query:

CODE:
SET CHARACTER SET 'GBK'


-The problem with the latter, is that while it most certainly modified the charset it didnÂ’t let the escaping facilities know about it. Which means that mysql_real_escape_string() still works on the basis of the default charset, which if set to latin1 (common default) will make the function work in a manner identical to addslashes() for our purposes. Another word, 0xbf27 will be converted to 0xbf5c27 facilitating the SQL injection. Here is a brief proof of concept.

PHP:

<?php

-$c 
= mysql_connect("localhost", "user", "pass");
mysql_select_db("database", $c);

// change our character set
mysql_query("SET CHARACTER SET 'gbk'", $c);

// create demo table
mysql_query("CREATE TABLE users (
-    username VARCHAR(32) PRIMARY KEY,
-    password VARCHAR(32)
-) CHARACTER SET 'GBK'"
, $c);
mysql_query("INSERT INTO users VALUES('foo','bar'), ('baz','test')", $c);

// now the exploit code
$_POST['username'] = chr(0xbf) . chr(0x27) . ' OR username = username /*'; 
$_POST['password'] = 'anything'; 

Truncated by Planet PHP, read more at the original (another 2694 bytes)

]]>
The addslashes() Versus mysql_real_escape_string() Debate - Chris Shifletthttp://shiflett.org/archive/184Sun, 22 Jan 2006 04:15:58 +0000Last month, I discussed Google's XSS Vulnerability and provided an example that demonstrates it. I was hoping to highlight why character encoding consistency is important, but apparently the addslashes() versus mysql_real_escape_string() debate continues. Demonstrating Google's XSS vulnerability was pretty easy. Demonstrating an SQL injection attack that is immune to addslashes() is a bit more involved, but still pretty straightforward.

-

In GBK, 0xbf27 is not a valid multi-byte character, but 0xbf5c is. Interpreted as single-byte characters, 0xbf27 is 0xbf (¿) followed by 0x27 ('), and 0xbf5c is 0xbf (¿) followed by 0x5c (\).

-

How does this help? If I want to attempt an SQL injection attack against a MySQL database, having single quotes escaped with a backslash is a bummer. If you're using addslashes(), however, I'm in luck. All I need to do is inject something like 0xbf27, and addslashes() modifies this to become 0xbf5c27, a valid multi-byte character followed by a single quote. In other words, I can successfully inject a single quote despite your escaping. That's because 0xbf5c is considered to be a single character, not two. Oops, there goes the backslash.

-

I'm going to use MySQL 5.0 and PHP's mysqli extension for this demonstration. If you want to try this yourself, make sure you're using GBK. I just changed /etc/my.cnf, but that's because I'm testing locally:

-
[client]
-default-character-set=GBK
-

Create a table called users:

-
CREATE TABLE users
-(
-    username VARCHAR(32) CHARACTER SET GBK,
-    password VARCHAR(32) CHARACTER SET GBK,
-    PRIMARY KEY (username)
-);
-
-

The following script mimics a situation where only addslashes() is used to escape the data being used in a query:

-
<?php 

$mysql 
= array();

$db = mysqli_init();
$db->real_connect('localhost', 'myuser', 'mypass', 'mydb');

$_POST['username'] = chr(0xbf) .
                     
chr(0x27) .
                     
' OR username = username /*';
$_POST['password'] = 'guess';

$mysql['username'] = addslashes($_POST['username']);
$mysql['password'] = addslashes($_POST

Truncated by Planet PHP, read more at the original (another 4165 bytes)

]]>
PHP Conferences - Jason E. Sweathttp://blog.casey-sweat.us/?p=69Sun, 22 Jan 2006 04:04:14 +0000Back from Norway - Tobias Schlitthttp://www.schlitt.info/applications/blog/index.php?/archives/407-Back-from-Norway.htmlSun, 22 Jan 2006 00:30:57 +0000Norway is a somewhat strange country. When I got there - 2 weeks ago to work with Amos, Derick, Fred and Ray on the eZ components - it had the expected amount of snow. A few days later, there was nothing anymore. We had positive celsius values and the weather was really crappy... until Monday. Since then it has been snowing all the time and yesterday we left when it looked like this:

- -

pict1285.jpg

- -

Nice to watch, but not real fun to walk onto. :) Anyway, it's been another great stay in Skien, where the eZ headquarter is and I'm pretty much looking forward to our summer conference, where we plan to have the complete eZ team there and lots of people from the PHP world. Thanks for the great time, folks!

- - ]]>
Solar 0.10.0 Released - Paul M. Joneshttp://paul-m-jones.com/blog/?p=192Sat, 21 Jan 2006 21:44:43 +0000
diff --git a/test/_files/RssTestSlashdot.xml b/test/_files/RssTestSlashdot.xml deleted file mode 100644 index 2ae85d9a..00000000 --- a/test/_files/RssTestSlashdot.xml +++ /dev/null @@ -1,178 +0,0 @@ - - - - Slashdot - http://slashdot.org/ - News for nerds, stuff that matters - en-us - Copyright 1997-2005, OSTG - Open Source Technology Group, Inc. All Rights Reserved. - 2006-01-23T20:11:00+00:00 - OSTG - pater@slashdot.org - Technology - hourly - 1 - 1970-01-01T00:00+00:00 - - - - - - - - - - - - - - - - - - - Slashdot - http://images.slashdot.org/topics/topicslashdot.gif - http://slashdot.org/ - - - Interview with Mark Spencer of Asterisk - http://rss.slashdot.org/Slashdot/slashdot?m=3264 - comforteagle writes "OSDir has published an interview with Mark Spencer of Asterisk and Gaim about why and how he got started coding up the software platform PBX system and how it has become much more than -just- another phone system. He also shares his insights for the opportunities within the telecom industry for open source."<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3264"/> - ScuttleMonkey - 2006-01-23T19:47:00+00:00 - communications - ripe-for-open-source - mainpage - 15 - 15,13,11,6,2,1,1 - http://slashdot.org/article.pl?sid=06/01/23/1517205&from=rss - - - The Adobe Photoshop Elements Crafts Book - http://rss.slashdot.org/Slashdot/slashdot?m=3263 - Sdurham writes "Adobe Photoshop and its many siblings have long been a staple of artists, photographers, and programmers interested in doing serious image manipulation. Increasingly, Photoshop's younger sister Photoshop Elements comes prepackaged with digital cameras. Yet many of the users of these cameras lack the time or patience to tackle the steep learning curve of the Photoshop family and are left asking "How do I do ... ?". Elizabeth Bulger's The Adobe Photoshop Elements Crafts Book attempts to bridge the gap between Photoshop skill level and personal creativity by stepping the reader through 14 different craft projects. In doing so, Bulger tries to provide the basic Photoshop Elements skills necessary for readers to pursue their own projects after finishing the book." Read the rest of Sdurham's review.<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3263"/> - samzenpus - 2006-01-23T18:54:00+00:00 - books - update-your-prom-pictures - books - 18 - 18,15,9,5,3,1,0 - http://books.slashdot.org/article.pl?sid=06/01/23/1411250&from=rss - - - Supreme Court spurns RIM - http://rss.slashdot.org/Slashdot/slashdot?m=3262 - l2718 writes "NTP has just won the latest round in its court battle against Research in Motion (makers of the Blackberry). Today's Order List from the US Supreme Court includes a denial of certiorary for RIM's appeal. This follows the Circuit Court of Appeals' denial of review en banc we have covered previously. As sometimes happens, the court nevertheless accepted amicus curiae briefs from several groups, including Intel and the Canadian government." The potential impact of this may mean the shutdown of Blackberry's network. I hope the crackberry addicts have lots of methadone onhand. -<p><a href="http://rss.slashdot.org/~c/Slashdot/slashdot?a=fYMCju"><img src="http://rss.slashdot.org/~c/Slashdot/slashdot?i=fYMCju" border="0"></img></a></p><img src="http://rss.slashdot.org/Slashdot/slashdot?g=3262"/> - Hemos - 2006-01-23T18:22:00+00:00 - patents - good-bye-black-berry - yro - 138 - 138,131,116,73,15,9,5 - http://yro.slashdot.org/article.pl?sid=06/01/23/1744258&from=rss - - - Adult Entertainment Antes Up In DRM War - http://rss.slashdot.org/Slashdot/slashdot?m=3261 - At the recent adult entertainment awards, host Greg Fitzsimmons highlighted the deep relationship between the internet and pornography stating "'The Internet was completely funded by porn,' he said [...] And if it wasn't for the Internet, he added, 'you guys would be completely out of business.' The audience, packed with porn actors and adult entertainment moguls like Jenna Jameson and Larry Flynt, roared with laughter." Now it appears that the adult entertainment industry has chosen to ante up in the DRM battle as well. Some companies have chosen to take sides, like Digital Playground who will be supporting Sony's Blu-Ray. Others, like Vivid Entertainment, seem to think that the answer is diversity and will be supporting both Blu-Ray and HD-DVD.<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3261"/> - ScuttleMonkey - 2006-01-23T17:37:00+00:00 - media - can't-we-all-just-get-along - hardware - 152 - 152,146,124,84,34,17,12 - http://hardware.slashdot.org/article.pl?sid=06/01/23/1544235&from=rss - - - Slashdot Index Code Update - http://rss.slashdot.org/Slashdot/slashdot?m=3259 - For years now Slashdot has posted what we call "Sectional Content". That is to say, stories that we think are good, but since we try to keep the Slashdot Main Page to around 15 stories per day, some stuff just gets put into the sections. This content is mostly lost to readers who simply don't know it exists. Today we're deploying new code to help you find that content (and alternatively, to disable it).<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3259"/> - CmdrTaco - 2006-01-23T17:00:00+00:00 - slashdot - zomg-you-got-some-ajax-in-our-ui - mainpage - 247 - 247,231,192,142,41,21,14 - http://slashdot.org/article.pl?sid=06/01/19/175253&from=rss - - - IE7 Leaked - http://rss.slashdot.org/Slashdot/slashdot?m=3260 - lju writes "IE7 has been leaked according to pcpro. From the article: '...last Friday it was revealed that a build of the new browser - version 5299 - along with numerous screenshots, was available online.' " -<p><a href="http://rss.slashdot.org/~c/Slashdot/slashdot?a=jVTbOh"><img src="http://rss.slashdot.org/~c/Slashdot/slashdot?i=jVTbOh" border="0"></img></a></p><img src="http://rss.slashdot.org/Slashdot/slashdot?g=3260"/> - CmdrTaco - 2006-01-23T16:41:00+00:00 - microsoft - hate-when-that-happens - it - 265 - 265,257,202,137,52,31,19 - http://it.slashdot.org/article.pl?sid=06/01/23/152211&from=rss - - - The Future of e-Commerce and e-Information? - http://rss.slashdot.org/Slashdot/slashdot?m=3257 - An anonymous reader writes "The Washington Post has an interesting article on what they label 'The Coming Tug of War Over the Internet. From the article: 'Do you prefer to search for information online with Google or Yahoo? What about bargain shopping -- do you go to Amazon or eBay? Many of us make these kinds of decisions several times a day, based on who knows what -- maybe you don't like bidding, or maybe Google's clean white search page suits you better than Yahoo's colorful clutter. But the nation's largest telephone companies have a new business plan, and if it comes to pass you may one day discover that Yahoo suddenly responds much faster to your inquiries, overriding your affinity for Google. Or that Amazon's Web site seems sluggish compared with eBay's.'" Seems like the idea of the 2-tier internet is really catching on with the market-droids.<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3257"/> - ScuttleMonkey - 2006-01-23T15:46:00+00:00 - biz - bad-for-the-internet-good-for-business - yro - 159 - 159,157,140,90,25,16,10 - http://yro.slashdot.org/article.pl?sid=06/01/23/1450249&from=rss - - - MacWorld MacBook Only a Prototype? - http://rss.slashdot.org/Slashdot/slashdot?m=3256 - mahju writes "Hard Mac is reporting that Apple's, unoffical, response in Paris to the the lack of information on battery life, is that the MacBook Pro that were demoed at Mac World SF are only prototypes and the final versions are still under development. " -<p><a href="http://rss.slashdot.org/~c/Slashdot/slashdot?a=qEOB5Q"><img src="http://rss.slashdot.org/~c/Slashdot/slashdot?i=qEOB5Q" border="0"></img></a></p><img src="http://rss.slashdot.org/Slashdot/slashdot?g=3256"/> - CmdrTaco - 2006-01-23T14:12:00+00:00 - intel - well-thats-not-surprising - apple - 160 - 160,150,136,102,35,21,14 - http://apple.slashdot.org/article.pl?sid=06/01/23/1333220&from=rss - - - Has Microsoft 'Solved' Spam? - http://rss.slashdot.org/Slashdot/slashdot?m=3254 - MsWillow writes to tell us the Seattle PI is running a story looking back at Bill Gates promise to have the spam problem "solved" in two years. Well, it looks like time is up, and the verdict is -- an emphatic "maybe". From the article: "Microsoft says it sees things differently. To "solve" the problem for consumers in the short run doesn't require eliminating spam entirely, said Ryan Hamlin, the general manager who oversees the company's anti-spam programs. Rather, he said, the idea is to contain it to the point that its impact on in-boxes is minor. In that way, Hamlin said, Gates' prediction has come true for people using the right tactics and advanced filtering technology."<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3254"/> - ScuttleMonkey - 2006-01-23T13:37:00+00:00 - spam - depends-on-your-definition-of-solved - it - 283 - 283,277,240,152,57,27,15 - http://it.slashdot.org/article.pl?sid=06/01/23/0340241&from=rss - - - World of Warcraft AQ Gates Open! - http://rss.slashdot.org/Slashdot/slashdot?m=3255 - Tayman writes "Wow...who didn't see this one coming? The players on the World of Warcraft Medivh server opened the gates to AQ. What happened next? The server crashed repeatedly. Why create content the servers can't handle? The very first time I read about this patch, I knew the servers would crash. The more people who open the gates, the more angry customers Blizzard will have in my opinion. With 5million+ subscribers, you would think Blizzard would have the best servers/connection money can buy. Although, I'm sure it's more complicated than simply plugging in a few ram chips and faster processors though. Most of the people involved in the raid are having a great time though. Could this be the most epic battle ever introduced to the mmorpg market? All signs point to yes. Let's see how long the mobs will respawn. Hopefully, the people of the Medivh server haven't seen anything yet. Either way, I would hate to be a network admin for Blizzard atm. ^_^ Here are some pics of the event. Thanks go out to all of those who took these pics. World of Warcraft AQ Pics Check out MMORPG Veteran to keep up with the events as they unfold." Update: 01/23 13:44 GMT by Z : Additionally, brandor wrote in with a link to some video of the event.<img src="http://rss.slashdot.org/Slashdot/slashdot?g=3255"/> - Hemos - 2006-01-23T13:33:00+00:00 - rpg - of-course-it-will-blow-up - games - 330 - 330,313,258,158,46,27,20 - http://games.slashdot.org/article.pl?sid=06/01/23/1244201&from=rss - - - Search Slashdot - Search Slashdot stories - query - http://slashdot.org/search.pl - - - diff --git a/test/_files/TestAtomFeed.xml b/test/_files/TestAtomFeed.xml deleted file mode 100644 index 69afce7a..00000000 --- a/test/_files/TestAtomFeed.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - Atom Example - This is a simple Atom Feed made by XML_Feed_Writer. - - - - 4 - 3 - 2 - 2005-04-25T00:00:00+02:00 - - 1 - - The Item Title - 2004-09-25T16:03:00+02:00 - 2005-12-25T16:03:00+01:00 - - David Coallier - - Testing something before releasing - - - 2 - - Second item added to the builder/feeded.. - 2004-01-04T00:00:00+01:00 - 1970-01-01T01:00:00+01:00 - - David Coallier - - Jaws project, visit the website for infos... - - diff --git a/test/_files/TestAtomFeedEntryOnly.xml b/test/_files/TestAtomFeedEntryOnly.xml deleted file mode 100644 index 9088137d..00000000 --- a/test/_files/TestAtomFeedEntryOnly.xml +++ /dev/null @@ -1 +0,0 @@ -1Bug1BuggyLong time debugging2005-09-152005-09-18RESOLVEDnormalP2FIXEDexample@example.comThe bug has been fixed. diff --git a/test/_files/TestAtomFeedNamespaced.xml b/test/_files/TestAtomFeedNamespaced.xml deleted file mode 100644 index 02d0ee25..00000000 --- a/test/_files/TestAtomFeedNamespaced.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - Atom Example - This is a simple Atom Feed made by XML_Feed_Writer. - - - - 4 - 3 - 2 - 2005-04-25T00:00:00+02:00 - - 1 - - The Item Title - 2004-09-25T16:03:00+02:00 - 2005-12-25T16:03:00+01:00 - - David Coallier - - Testing something before releasing - - - 2 - - Second item added to the builder/feeded.. - 2004-01-04T00:00:00+01:00 - 1970-01-01T01:00:00+01:00 - - David Coallier - - Jaws project, visit the website for infos... - - diff --git a/test/_files/TestFeedEntryRssContentEncoded.xml b/test/_files/TestFeedEntryRssContentEncoded.xml deleted file mode 100644 index baa70a73..00000000 --- a/test/_files/TestFeedEntryRssContentEncoded.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - Zend Framework IT - http://www.zend-framework.it - Just another Zend Framework (Italian) weblog. - Sun, 03 Feb 2008 21:07:35 +0000 - http://wordpress.org/?v=2.3.1 - en - - Zend_Service_Technorati promosso in Core - http://www.zend-framework.it/2008/02/03/zend_service_technorati-promosso-in-core/ - http://www.zend-framework.it/2008/02/03/zend_service_technorati-promosso-in-core/#comments - Sun, 03 Feb 2008 21:06:15 +0000 - weppos - - - - - http://www.zend-framework.it/2008/02/03/zend_service_technorati-promosso-in-core/ - - Il commit r7757 ha ufficialmente decretato la promozione nella core library di un componente al quale sono molto affezionato: Zend_Service_Technorati.
-Non solo si tratta della prima libreria completamente proposta e sviluppata dal sottoscritto, ma è anche un lavoro che mi ha visto occupato per diversi giorni nel tentativo di risolvere i vari problemi di inconsistenza delle API di Technorati, come dimostra il ticket #ZF-2334. (more…)

-]]>
- http://www.zend-framework.it/2008/02/03/zend_service_technorati-promosso-in-core/feed/ -
- - Proposta per la struttura predefinita di un nuovo progetto Zend Framework - http://www.zend-framework.it/2008/02/02/proposta-per-la-struttura-predefinita-di-un-nuovo-progetto-zend-framework/ - http://www.zend-framework.it/2008/02/02/proposta-per-la-struttura-predefinita-di-un-nuovo-progetto-zend-framework/#comments - Sat, 02 Feb 2008 14:21:15 +0000 - weppos - - - http://www.zend-framework.it/2008/02/02/proposta-per-la-struttura-predefinita-di-un-nuovo-progetto-zend-framework/ - - - http://www.zend-framework.it/2008/02/02/proposta-per-la-struttura-predefinita-di-un-nuovo-progetto-zend-framework/feed/ - - - Installare Zend Framework via PEAR - http://www.zend-framework.it/2008/01/29/installare-zend-framework-via-pear/ - http://www.zend-framework.it/2008/01/29/installare-zend-framework-via-pear/#comments - Tue, 29 Jan 2008 08:42:37 +0000 - weppos - - - - http://www.zend-framework.it/2008/01/29/installare-zend-framework-via-pear/ - - Introduzione a PEAR -

Chiunque programmi in PHP avrà sentito parlare, prima o poi, di PEAR.
-PEAR è un enorme repository di librerie PHP. Vi si trovano applicazioni complete, librerie complete ma, ahimè, anche molti componenti abbandonati sul nascere.

-

PEAR offre un eccellente sistema di packaging che consente di installare facilmente una libreria parte del repository ufficiale o una qualsiasi libreria su un altro repository che sia compatibile con gli standard definiti.
-Per chi programma in altri linguaggi, questo sistema è molto simile al concetto di GEM in Ruby o ai moduli di PERL. (more…)

-]]>
- http://www.zend-framework.it/2008/01/29/installare-zend-framework-via-pear/feed/ -
-
-
diff --git a/test/_files/htmlPage.html b/test/_files/htmlPage.html deleted file mode 100644 index 467d534d..00000000 --- a/test/_files/htmlPage.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - Blog - - - - - - - - From 19501a171b3e0da8abb1a8dac211e994bfeaa0fd Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Mon, 19 Jul 2010 13:54:03 -0400 Subject: [PATCH 153/238] DB -> Db - Renamed Zend\DB to Zend\Db; updated all dependent classes - Also renamed all adapters to use MixedCase instead of ACRONYM case (PDO, MySQLi, etc.) --- src/PubSubHubbub/Model/AbstractModel.php | 10 +++++----- src/PubSubHubbub/Model/Subscription.php | 6 ++++-- test/PubSubHubbub/Model/SubscriptionTest.php | 11 +++++------ test/PubSubHubbub/Subscriber/CallbackTest.php | 6 +++--- test/PubSubHubbub/SubscriberTest.php | 8 ++++---- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/PubSubHubbub/Model/AbstractModel.php b/src/PubSubHubbub/Model/AbstractModel.php index 00ec2e2d..af29406d 100644 --- a/src/PubSubHubbub/Model/AbstractModel.php +++ b/src/PubSubHubbub/Model/AbstractModel.php @@ -37,7 +37,7 @@ class AbstractModel /** * Zend_Db_Table instance to host database methods * - * @var \Zend\DB\Table\Table + * @var \Zend\Db\Table\Table */ protected $_db = null; @@ -45,15 +45,15 @@ class AbstractModel * Constructor * * @param array $data - * @param \Zend\DB\Table\AbstractTable $tableGateway + * @param \Zend\Db\Table\AbstractTable $tableGateway * @return void */ - public function __construct(\Zend\DB\Table\AbstractTable $tableGateway = null) + public function __construct(\Zend\Db\Table\AbstractTable $tableGateway = null) { if (is_null($tableGateway)) { - $parts = explode('_', get_class($this)); + $parts = explode('\\', get_class($this)); $table = strtolower(array_pop($parts)); - $this->_db = new \Zend\DB\Table\Table($table); + $this->_db = new \Zend\Db\Table\Table($table); } else { $this->_db = $tableGateway; } diff --git a/src/PubSubHubbub/Model/Subscription.php b/src/PubSubHubbub/Model/Subscription.php index 983f6b8f..58f4a367 100644 --- a/src/PubSubHubbub/Model/Subscription.php +++ b/src/PubSubHubbub/Model/Subscription.php @@ -55,10 +55,12 @@ public function setSubscription(array $data) ); } $result = $this->_db->find($data['id']); - if ($result) { + if ($result && (0 < count($result))) { $data['created_time'] = $result->current()->created_time; $now = new Date\Date; - if ($data['lease_seconds']) { + if (array_key_exists('lease_seconds', $data) + && $data['lease_seconds'] + ) { $data['expiration_time'] = $now->add($data['lease_seconds'], Date\Date::SECOND) ->get('yyyy-MM-dd HH:mm:ss'); } diff --git a/test/PubSubHubbub/Model/SubscriptionTest.php b/test/PubSubHubbub/Model/SubscriptionTest.php index dd198e1d..21726dac 100644 --- a/test/PubSubHubbub/Model/SubscriptionTest.php +++ b/test/PubSubHubbub/Model/SubscriptionTest.php @@ -74,15 +74,15 @@ protected function _initDb() ) { $this->markTestSkipped('Test only with pdo_sqlite'); } - $db = \Zend\DB\DB::factory('PDO\SQLite', array('dbname' => ':memory:')); - \Zend\DB\Table\AbstractTable::setDefaultAdapter($db); + $db = \Zend\Db\Db::factory('Pdo\Sqlite', array('dbname' => ':memory:')); + \Zend\Db\Table\AbstractTable::setDefaultAdapter($db); $this->_createTable(); } protected function _createTable() { $sql = "CREATE TABLE subscription (" - . "id varchar(32) NOT NULL DEFAULT '', " + . "id varchar(32) PRIMARY KEY NOT NULL DEFAULT '', " . "topic_url varchar(255) DEFAULT NULL, " . "hub_url varchar(255) DEFAULT NULL, " . "created_time datetime DEFAULT NULL, " @@ -90,10 +90,9 @@ protected function _createTable() . "verify_token varchar(255) DEFAULT NULL, " . "secret varchar(255) DEFAULT NULL, " . "expiration_time datetime DEFAULT NULL, " - . "subscription_state varchar(12) DEFAULT NULL, " - . "PRIMARY KEY (id) " + . "subscription_state varchar(12) DEFAULT NULL" . ");"; - \Zend\DB\Table\AbstractTable::getDefaultAdapter()->getConnection()->query($sql); + \Zend\Db\Table\AbstractTable::getDefaultAdapter()->getConnection()->query($sql); } } diff --git a/test/PubSubHubbub/Subscriber/CallbackTest.php b/test/PubSubHubbub/Subscriber/CallbackTest.php index 8bf9b999..a641c690 100644 --- a/test/PubSubHubbub/Subscriber/CallbackTest.php +++ b/test/PubSubHubbub/Subscriber/CallbackTest.php @@ -46,13 +46,13 @@ public function setUp() $this->_callback = new \Zend\Feed\PubSubHubbub\Subscriber\Callback; $this->_adapter = $this->_getCleanMock( - '\Zend\DB\Adapter\AbstractAdapter' + '\Zend\Db\Adapter\AbstractAdapter' ); $this->_tableGateway = $this->_getCleanMock( - '\Zend\DB\Table\AbstractTable' + '\Zend\Db\Table\AbstractTable' ); $this->_rowset = $this->_getCleanMock( - '\Zend\DB\Table\AbstractRowset' + '\Zend\Db\Table\AbstractRowset' ); $this->_tableGateway->expects($this->any())->method('getAdapter') diff --git a/test/PubSubHubbub/SubscriberTest.php b/test/PubSubHubbub/SubscriberTest.php index 6d097e02..fd6811f3 100644 --- a/test/PubSubHubbub/SubscriberTest.php +++ b/test/PubSubHubbub/SubscriberTest.php @@ -23,9 +23,9 @@ * @namespace */ namespace ZendTest\Feed\PubSubHubbub; -use Zend\DB\Adapter; +use Zend\Db\Adapter; -use Zend\DB\Table; +use Zend\Db\Table; use Zend\Feed\PubSubHubbub; @@ -53,10 +53,10 @@ public function setUp() PubSubHubbub\PubSubHubbub::setHttpClient($client); $this->_subscriber = new \Zend\Feed\PubSubHubbub\Subscriber; $this->_adapter = $this->_getCleanMock( - '\Zend\DB\Adapter\AbstractAdapter' + '\Zend\Db\Adapter\AbstractAdapter' ); $this->_tableGateway = $this->_getCleanMock( - '\Zend\DB\Table\AbstractTable' + '\Zend\Db\Table\AbstractTable' ); $this->_tableGateway->expects($this->any())->method('getAdapter') ->will($this->returnValue($this->_adapter)); From 6fc55cf764d890dbee1eacc71346fafe2d002b45 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 20 Jul 2010 08:19:13 -0400 Subject: [PATCH 154/238] HTTP -> Http - Found all instances of HTTP, in directory and filenames as well as namespace and classnames, and converted to Http --- src/PubSubHubbub/AbstractCallback.php | 16 ++++++++-------- src/PubSubHubbub/PubSubHubbub.php | 14 +++++++------- src/PubSubHubbub/Publisher.php | 6 +++--- src/PubSubHubbub/Subscriber.php | 6 +++--- src/Reader/Reader.php | 14 +++++++------- test/PubSubHubbub/PubSubHubbubTest.php | 2 +- test/PubSubHubbub/PublisherTest.php | 8 ++++---- test/PubSubHubbub/Subscriber/CallbackTest.php | 9 +++++---- test/PubSubHubbub/SubscriberHttpTest.php | 2 +- test/PubSubHubbub/SubscriberTest.php | 2 +- test/ReaderTest.php | 6 +++--- 11 files changed, 43 insertions(+), 42 deletions(-) diff --git a/src/PubSubHubbub/AbstractCallback.php b/src/PubSubHubbub/AbstractCallback.php index 81b05f91..726e2f9d 100644 --- a/src/PubSubHubbub/AbstractCallback.php +++ b/src/PubSubHubbub/AbstractCallback.php @@ -49,9 +49,9 @@ abstract class AbstractCallback implements Callback /** * An instance of a class handling Http Responses. This is implemented in * Zend\Feed\Pubsubhubbub\HttpResponse which shares an unenforced interface with - * (i.e. not inherited from) Zend\Controller\Response\HTTP. + * (i.e. not inherited from) Zend\Controller\Response\Http. * - * @var Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\HTTP + * @var Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http */ protected $_httpResponse = null; @@ -142,20 +142,20 @@ public function getStorage() /** * An instance of a class handling Http Responses. This is implemented in * Zend\Feed\Pubsubhubbub\HttpResponse which shares an unenforced interface with - * (i.e. not inherited from) Zend\Controller\Response\HTTP. + * (i.e. not inherited from) Zend\Controller\Response\Http. * - * @param Zend\Feed\Pubsubhubbub\HttpResponse|\Zend\Controller\Response\HTTP $httpResponse + * @param Zend\Feed\Pubsubhubbub\HttpResponse|\Zend\Controller\Response\Http $httpResponse * @return \Zend\Feed\PubSubHubbub\AbstractCallback */ public function setHttpResponse($httpResponse) { if (!is_object($httpResponse) || (!$httpResponse instanceof HttpResponse - && !$httpResponse instanceof \Zend\Controller\Response\HTTP) + && !$httpResponse instanceof \Zend\Controller\Response\Http) ) { throw new Exception('HTTP Response object must' . ' implement one of Zend\Feed\Pubsubhubbub\HttpResponse or' - . ' Zend\Controller\Response\HTTP'); + . ' Zend\Controller\Response\Http'); } $this->_httpResponse = $httpResponse; return $this; @@ -164,9 +164,9 @@ public function setHttpResponse($httpResponse) /** * An instance of a class handling Http Responses. This is implemented in * Zend\Feed\Pubsubhubbub\HttpResponse which shares an unenforced interface with - * (i.e. not inherited from) Zend\Controller\Response\HTTP. + * (i.e. not inherited from) Zend\Controller\Response\Http. * - * @return Zend\Feed\Pubsubhubbub\HttpResponse|\Zend\Controller\Response\HTTP + * @return Zend\Feed\Pubsubhubbub\HttpResponse|\Zend\Controller\Response\Http */ public function getHttpResponse() { diff --git a/src/PubSubHubbub/PubSubHubbub.php b/src/PubSubHubbub/PubSubHubbub.php index 4eb678c6..ff13d433 100644 --- a/src/PubSubHubbub/PubSubHubbub.php +++ b/src/PubSubHubbub/PubSubHubbub.php @@ -24,10 +24,10 @@ */ namespace Zend\Feed\PubSubHubbub; use Zend\Feed\Reader; -use Zend\HTTP; +use Zend\Http; /** - * @uses \Zend\HTTP\Client + * @uses \Zend\Http\Client * @uses \Zend\Feed\AbstractFeed * @uses \Zend\Feed\PubSubHubbub\Exception * @uses \Zend\Feed\Reader\Reader @@ -56,7 +56,7 @@ class PubSubHubbub /** * Singleton instance if required of the HTTP client * - * @var \Zend\HTTP\Client + * @var \Zend\Http\Client */ protected static $httpClient = null; @@ -89,10 +89,10 @@ public static function detectHubs($source) * Allows the external environment to make Zend_Oauth use a specific * Client instance. * - * @param \Zend\HTTP\Client $httpClient + * @param \Zend\Http\Client $httpClient * @return void */ - public static function setHttpClient(HTTP\Client $httpClient) + public static function setHttpClient(Http\Client $httpClient) { self::$httpClient = $httpClient; } @@ -102,12 +102,12 @@ public static function setHttpClient(HTTP\Client $httpClient) * the instance is reset and cleared of previous parameters GET/POST. * Headers are NOT reset but handled by this component if applicable. * - * @return \Zend\HTTP\Client + * @return \Zend\Http\Client */ public static function getHttpClient() { if (!isset(self::$httpClient)): - self::$httpClient = new HTTP\Client; + self::$httpClient = new Http\Client; else: self::$httpClient->resetParameters(); endif; diff --git a/src/PubSubHubbub/Publisher.php b/src/PubSubHubbub/Publisher.php index f482a679..a88828d6 100644 --- a/src/PubSubHubbub/Publisher.php +++ b/src/PubSubHubbub/Publisher.php @@ -28,7 +28,7 @@ /** * @uses \Zend\Feed\PubSubHubbub\PubSubHubbub * @uses \Zend\Feed\PubSubHubbub\Exception - * @uses \Zend\HTTP\Client + * @uses \Zend\Http\Client * @uses \Zend\Uri\Uri * @uses \Zend\Version * @category Zend @@ -384,12 +384,12 @@ public function getErrors() /** * Get a basic prepared HTTP client for use * - * @return \Zend\HTTP\Client + * @return \Zend\Http\Client */ protected function _getHttpClient() { $client = PubSubHubbub::getHttpClient(); - $client->setMethod(\Zend\HTTP\Client::POST); + $client->setMethod(\Zend\Http\Client::POST); $client->setConfig(array( 'useragent' => 'Zend_Feed_Pubsubhubbub_Publisher/' . \Zend\Version::VERSION, )); diff --git a/src/PubSubHubbub/Subscriber.php b/src/PubSubHubbub/Subscriber.php index ebcdd127..415a2bea 100644 --- a/src/PubSubHubbub/Subscriber.php +++ b/src/PubSubHubbub/Subscriber.php @@ -31,7 +31,7 @@ * @uses \Zend\Date\Date * @uses \Zend\Feed\PubSubHubbub\PubSubHubbub * @uses \Zend\Feed\PubSubHubbub\Exception - * @uses \Zend\HTTP\Client + * @uses \Zend\Http\Client * @uses \Zend\Uri\Uri * @uses \Zend\Version * @category Zend @@ -657,12 +657,12 @@ protected function _doRequest($mode) * Get a basic prepared HTTP client for use * * @param string $mode Must be "subscribe" or "unsubscribe" - * @return \Zend\HTTP\Client + * @return \Zend\Http\Client */ protected function _getHttpClient() { $client = PubSubHubbub::getHttpClient(); - $client->setMethod(\Zend\HTTP\Client::POST); + $client->setMethod(\Zend\Http\Client::POST); $client->setConfig(array('useragent' => 'Zend_Feed_Pubsubhubbub_Subscriber/' . \Zend\Version::VERSION)); return $client; diff --git a/src/Reader/Reader.php b/src/Reader/Reader.php index 5a5d366a..b1b88d70 100644 --- a/src/Reader/Reader.php +++ b/src/Reader/Reader.php @@ -24,7 +24,7 @@ */ namespace Zend\Feed\Reader; -use Zend\HTTP, +use Zend\Http, Zend\Loader\PluginLoader, Zend\Loader\PluginLoaderException, Zend\Loader\PrefixPathMapper; @@ -35,7 +35,7 @@ * @uses \Zend\Feed\Reader\FeedSet * @uses \Zend\Feed\Reader\Feed\Atom * @uses \Zend\Feed\Reader\Feed\RSS - * @uses \Zend\HTTP\Client + * @uses \Zend\Http\Client * @uses \Zend\Loader\PluginLoader * @category Zend * @package Zend_Feed_Reader @@ -82,7 +82,7 @@ class Reader /** * HTTP client object to use for retrieving feeds * - * @var \Zend\HTTP\Client + * @var \Zend\Http\Client */ protected static $_httpClient = null; @@ -144,10 +144,10 @@ public static function setCache(\Zend\Cache\Frontend\Core $cache) * * Sets the HTTP client object to use for retrieving the feeds. * - * @param \Zend\HTTP\Client $httpClient + * @param \Zend\Http\Client $httpClient * @return void */ - public static function setHttpClient(HTTP\Client $httpClient) + public static function setHttpClient(Http\Client $httpClient) { self::$_httpClient = $httpClient; } @@ -160,8 +160,8 @@ public static function setHttpClient(HTTP\Client $httpClient) */ public static function getHttpClient() { - if (!self::$_httpClient instanceof HTTP\Client) { - self::$_httpClient = new HTTP\Client(); + if (!self::$_httpClient instanceof Http\Client) { + self::$_httpClient = new Http\Client(); } return self::$_httpClient; diff --git a/test/PubSubHubbub/PubSubHubbubTest.php b/test/PubSubHubbub/PubSubHubbubTest.php index 32284ed5..3163e95c 100644 --- a/test/PubSubHubbub/PubSubHubbubTest.php +++ b/test/PubSubHubbub/PubSubHubbubTest.php @@ -58,4 +58,4 @@ public function testCanDetectHubs() } -class Pubsub extends \Zend\HTTP\Client {} +class Pubsub extends \Zend\Http\Client {} diff --git a/test/PubSubHubbub/PublisherTest.php b/test/PubSubHubbub/PublisherTest.php index 27e0ac40..6b52f450 100644 --- a/test/PubSubHubbub/PublisherTest.php +++ b/test/PubSubHubbub/PublisherTest.php @@ -23,7 +23,7 @@ * @namespace */ namespace ZendTest\Feed\PubSubHubbub; -use Zend\HTTP; +use Zend\Http; use Zend\Feed\PubSubHubbub; /** @@ -45,7 +45,7 @@ class PublisherTest extends \PHPUnit_Framework_TestCase public function setUp() { - $client = new HTTP\Client; + $client = new Http\Client; PubSubHubbub\PubSubHubbub::setHttpClient($client); $this->_publisher = new PubSubHubbub\Publisher; } @@ -304,7 +304,7 @@ public function testNotifiesHubAndReportsFail() // Some stubs for what Http_Client would be doing -class ClientSuccess extends HTTP\Client +class ClientSuccess extends Http\Client { public function request($method = null) { $response = new ResponseSuccess; @@ -312,7 +312,7 @@ public function request($method = null) { } public function getBody(){return $this->_prepareBody();} } -class ClientFail extends HTTP\Client +class ClientFail extends Http\Client { public function request($method = null) { $response = new ResponseFail; diff --git a/test/PubSubHubbub/Subscriber/CallbackTest.php b/test/PubSubHubbub/Subscriber/CallbackTest.php index a641c690..55a69c7d 100644 --- a/test/PubSubHubbub/Subscriber/CallbackTest.php +++ b/test/PubSubHubbub/Subscriber/CallbackTest.php @@ -46,13 +46,13 @@ public function setUp() $this->_callback = new \Zend\Feed\PubSubHubbub\Subscriber\Callback; $this->_adapter = $this->_getCleanMock( - '\Zend\Db\Adapter\AbstractAdapter' + 'Zend\Db\Adapter\AbstractAdapter' ); $this->_tableGateway = $this->_getCleanMock( - '\Zend\Db\Table\AbstractTable' + 'Zend\Db\Table\AbstractTable' ); $this->_rowset = $this->_getCleanMock( - '\Zend\Db\Table\AbstractRowset' + 'Zend\Db\Table\AbstractRowset' ); $this->_tableGateway->expects($this->any())->method('getAdapter') @@ -412,7 +412,8 @@ public function testRespondsToValidFeedUpdateWithXHubOnBehalfOfHeader() $this->assertTrue($this->_callback->getHttpResponse()->getHeader('X-Hub-On-Behalf-Of') == 1); } - protected function _getCleanMock($className) { + protected function _getCleanMock($className) + { $class = new \ReflectionClass($className); $methods = $class->getMethods(); $stubMethods = array(); diff --git a/test/PubSubHubbub/SubscriberHttpTest.php b/test/PubSubHubbub/SubscriberHttpTest.php index d77cdf98..5eb08687 100644 --- a/test/PubSubHubbub/SubscriberHttpTest.php +++ b/test/PubSubHubbub/SubscriberHttpTest.php @@ -68,7 +68,7 @@ public function setUp() } $uri = $this->_baseuri . $name . '.php'; $this->_adapter = new $this->_config['adapter']; - $this->_client = new \Zend\HTTP\Client($uri, $this->_config); + $this->_client = new \Zend\Http\Client($uri, $this->_config); $this->_client->setAdapter($this->_adapter); \Zend\Feed\PubSubHubbub\PubSubHubbub::setHttpClient($this->_client); $this->_subscriber = new \Zend\Feed\PubSubHubbub\Subscriber\Subscriber; diff --git a/test/PubSubHubbub/SubscriberTest.php b/test/PubSubHubbub/SubscriberTest.php index fd6811f3..b476fc89 100644 --- a/test/PubSubHubbub/SubscriberTest.php +++ b/test/PubSubHubbub/SubscriberTest.php @@ -49,7 +49,7 @@ class SubscriberTest extends \PHPUnit_Framework_TestCase public function setUp() { - $client = new \Zend\HTTP\Client; + $client = new \Zend\Http\Client; PubSubHubbub\PubSubHubbub::setHttpClient($client); $this->_subscriber = new \Zend\Feed\PubSubHubbub\Subscriber; $this->_adapter = $this->_getCleanMock( diff --git a/test/ReaderTest.php b/test/ReaderTest.php index f01d0cf0..387b7281 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -290,9 +290,9 @@ public function testGetsFeedLinksAndNormalisesRelativeUrlsOnUriWithPath() try { $currClient = Reader\Reader::getHttpClient(); - $testAdapter = new \Zend\HTTP\Client\Adapter\Test(); - $testAdapter->setResponse(new \Zend\HTTP\Response(200, array(), '')); - Reader\Reader::setHttpClient(new \Zend\HTTP\Client(null, array('adapter' => $testAdapter))); + $testAdapter = new \Zend\Http\Client\Adapter\Test(); + $testAdapter->setResponse(new \Zend\Http\Response(200, array(), '')); + Reader\Reader::setHttpClient(new \Zend\Http\Client(null, array('adapter' => $testAdapter))); $links = Reader\Reader::findFeedLinks('http://foo/bar'); From 352e2cd37d04d09fa9474307da3e07724f87fe35 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 20 Jul 2010 16:36:47 -0400 Subject: [PATCH 155/238] URI -> Uri; URL -> Url - Renamed all directories and filenames from URI to Uri - Renamed all namespaces and classnames from URI to Uri - Renamed all directories and filenames from URL to Url - Renamed all namespaces and classnames from URL to Url --- src/PubSubHubbub/Publisher.php | 6 +++--- src/PubSubHubbub/Subscriber.php | 8 ++++---- src/PubSubHubbub/Subscriber/Callback.php | 2 +- src/Reader/Extension/Atom/Entry.php | 6 +++--- src/Reader/Extension/Atom/Feed.php | 6 +++--- src/Reader/FeedSet.php | 6 +++--- src/Writer/AbstractFeed.php | 26 ++++++++++++------------ src/Writer/Deleted.php | 2 +- src/Writer/Entry.php | 16 +++++++-------- src/Writer/Extension/ITunes/Feed.php | 6 +++--- src/Writer/Renderer/Entry/Atom.php | 2 +- src/Writer/Renderer/Entry/RSS.php | 2 +- src/Writer/Renderer/Feed/RSS.php | 4 ++-- test/PubSubHubbub/SubscriberHttpTest.php | 2 +- test/Reader/Entry/RSSTest.php | 2 +- test/Reader/Feed/RSSTest.php | 2 +- 16 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/PubSubHubbub/Publisher.php b/src/PubSubHubbub/Publisher.php index a88828d6..57748c94 100644 --- a/src/PubSubHubbub/Publisher.php +++ b/src/PubSubHubbub/Publisher.php @@ -23,7 +23,7 @@ * @namespace */ namespace Zend\Feed\PubSubHubbub; -use Zend\URI; +use Zend\Uri; /** * @uses \Zend\Feed\PubSubHubbub\PubSubHubbub @@ -119,7 +119,7 @@ public function setConfig($config) */ public function addHubUrl($url) { - if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { + if (empty($url) || !is_string($url) || !\Zend\Uri\Url::validate($url)) { throw new Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .'URL'); @@ -177,7 +177,7 @@ public function getHubUrls() */ public function addUpdatedTopicUrl($url) { - if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { + if (empty($url) || !is_string($url) || !\Zend\Uri\Url::validate($url)) { throw new Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .'URL'); diff --git a/src/PubSubHubbub/Subscriber.php b/src/PubSubHubbub/Subscriber.php index 415a2bea..290f230a 100644 --- a/src/PubSubHubbub/Subscriber.php +++ b/src/PubSubHubbub/Subscriber.php @@ -24,7 +24,7 @@ */ namespace Zend\Feed\PubSubHubbub; -use Zend\URI; +use Zend\Uri; use Zend\Date; /** @@ -214,7 +214,7 @@ public function setConfig($config) */ public function setTopicUrl($url) { - if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { + if (empty($url) || !is_string($url) || !\Zend\Uri\Url::validate($url)) { throw new Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .' URL'); @@ -274,7 +274,7 @@ public function getLeaseSeconds() */ public function setCallbackUrl($url) { - if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { + if (empty($url) || !is_string($url) || !\Zend\Uri\Url::validate($url)) { throw new Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); @@ -340,7 +340,7 @@ public function getPreferredVerificationMode() */ public function addHubUrl($url) { - if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { + if (empty($url) || !is_string($url) || !\Zend\Uri\Url::validate($url)) { throw new Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); diff --git a/src/PubSubHubbub/Subscriber/Callback.php b/src/PubSubHubbub/Subscriber/Callback.php index 409c231e..85e42ac6 100644 --- a/src/PubSubHubbub/Subscriber/Callback.php +++ b/src/PubSubHubbub/Subscriber/Callback.php @@ -167,7 +167,7 @@ public function isValidHubVerification(array $httpGetData) ) { return false; } - if (!\Zend\URI\URL::validate($httpGetData['hub_topic'])) { + if (!\Zend\Uri\Url::validate($httpGetData['hub_topic'])) { return false; } diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 24c86356..e0b765a2 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -26,7 +26,7 @@ use Zend\Feed\Reader; use Zend\Date; use Zend\Feed\Reader\Collection; -use Zend\URI; +use Zend\Uri; /** * @uses DOMDocument @@ -570,10 +570,10 @@ public function getSource() */ protected function _absolutiseUri($link) { - if (!\Zend\URI\URL::validate($link)) { + if (!\Zend\Uri\Url::validate($link)) { if (!is_null($this->getBaseUrl())) { $link = $this->getBaseUrl() . $link; - if (!\Zend\URI\URL::validate($link)) { + if (!\Zend\Uri\Url::validate($link)) { $link = null; } } diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index 62931fa0..7daba6ab 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -26,7 +26,7 @@ use Zend\Feed\Reader; use Zend\Date; use Zend\Feed\Reader\Collection; -use Zend\URI; +use Zend\Uri; /** * @uses \Zend\Date\Date @@ -508,10 +508,10 @@ protected function _getAuthor(\DOMElement $element) */ protected function _absolutiseUri($link) { - if (!\Zend\URI\URL::validate($link)) { + if (!\Zend\Uri\Url::validate($link)) { if (!is_null($this->getBaseUrl())) { $link = $this->getBaseUrl() . $link; - if (!\Zend\URI\URL::validate($link)) { + if (!\Zend\Uri\Url::validate($link)) { $link = null; } } diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index abcc16e4..eab98b3e 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -23,7 +23,7 @@ * @namespace */ namespace Zend\Feed\Reader; -use Zend\URI; +use Zend\Uri; /** * @uses \Zend\Feed\Reader\Reader @@ -85,9 +85,9 @@ public function addLinks(\DOMNodeList $links, $uri) */ protected function _absolutiseUri($link, $uri = null) { - if (!URI\URL::validate($link)) { + if (!Uri\Url::validate($link)) { if (!is_null($uri)) { - $uri = new URI\URL($uri); + $uri = new Uri\Url($uri); if ($link[0] !== '/') { $link = $uri->getPath() . '/' . $link; diff --git a/src/Writer/AbstractFeed.php b/src/Writer/AbstractFeed.php index d0feea42..8bce173d 100644 --- a/src/Writer/AbstractFeed.php +++ b/src/Writer/AbstractFeed.php @@ -25,7 +25,7 @@ namespace Zend\Feed\Writer; use Zend\Feed; -use Zend\URI; +use Zend\Uri; use Zend\Date; /** @@ -91,7 +91,7 @@ public function addAuthor($name, $email = null, $uri = null) $author['email'] = $name['email']; } if (isset($name['uri'])) { - if (empty($name['uri']) || !is_string($name['uri']) || !\Zend\URI\URL::validate($name['uri'])) { + if (empty($name['uri']) || !is_string($name['uri']) || !\Zend\Uri\Url::validate($name['uri'])) { throw new Feed\Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $name['uri']; @@ -108,7 +108,7 @@ public function addAuthor($name, $email = null, $uri = null) $author['email'] = $email; } if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !\Zend\URI\URL::validate($uri)) { + if (empty($uri) || !is_string($uri) || !\Zend\Uri\Url::validate($uri)) { throw new Feed\Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $uri; @@ -235,7 +235,7 @@ public function setGenerator($name, $version = null, $uri = null) $generator['version'] = $data['version']; } if (isset($data['uri'])) { - if (empty($data['uri']) || !is_string($data['uri']) || !\Zend\URI\URL::validate($data['uri'])) { + if (empty($data['uri']) || !is_string($data['uri']) || !\Zend\Uri\Url::validate($data['uri'])) { throw new \Zend\Feed\Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); } $generator['uri'] = $data['uri']; @@ -252,8 +252,8 @@ public function setGenerator($name, $version = null, $uri = null) $generator['version'] = $version; } if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !\Zend\URI\URL::validate($uri)) { - throw new Zend_Feed_Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); + if (empty($uri) || !is_string($uri) || !\Zend\Uri\Url::validate($uri)) { + throw new \Zend\Feed\Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); } $generator['uri'] = $uri; } @@ -268,7 +268,7 @@ public function setGenerator($name, $version = null, $uri = null) */ public function setId($id) { - if ((empty($id) || !is_string($id) || !\Zend\URI\URL::validate($id)) && + if ((empty($id) || !is_string($id) || !\Zend\Uri\Url::validate($id)) && !preg_match('#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#', $id)) { throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } @@ -286,7 +286,7 @@ public function setId($id) public function setImage(array $data) { if (empty($data['uri']) || !is_string($data['uri']) - || !\Zend\URI\URL::validate($data['uri'])) { + || !\Zend\Uri\Url::validate($data['uri'])) { throw new \Zend\Feed\Exception('Invalid parameter: parameter \'uri\'' . ' must be a non-empty string and valid URI/IRI'); } @@ -313,7 +313,7 @@ public function setLanguage($language) */ public function setLink($link) { - if (empty($link) || !is_string($link) || !\Zend\URI\URL::validate($link)) { + if (empty($link) || !is_string($link) || !\Zend\Uri\Url::validate($link)) { throw new Feed\Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['link'] = $link; @@ -326,7 +326,7 @@ public function setLink($link) */ public function setFeedLink($link, $type) { - if (empty($link) || !is_string($link) || !\Zend\URI\URL::validate($link)) { + if (empty($link) || !is_string($link) || !\Zend\Uri\Url::validate($link)) { throw new Feed\Exception('Invalid parameter: "link"" must be a non-empty string and valid URI/IRI'); } if (!in_array(strtolower($type), array('rss', 'rdf', 'atom'))) { @@ -368,7 +368,7 @@ public function setEncoding($encoding) */ public function setBaseUrl($url) { - if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { + if (empty($url) || !is_string($url) || !\Zend\Uri\Url::validate($url)) { throw new Feed\Exception('Invalid parameter: "url" array value' . ' must be a non-empty string and valid URI/IRI'); } @@ -382,7 +382,7 @@ public function setBaseUrl($url) */ public function addHub($url) { - if (empty($url) || !is_string($url) || !\Zend\URI\URL::validate($url)) { + if (empty($url) || !is_string($url) || !\Zend\Uri\Url::validate($url)) { throw new Feed\Exception('Invalid parameter: "url" array value' . ' must be a non-empty string and valid URI/IRI'); } @@ -419,7 +419,7 @@ public function addCategory(array $category) if (isset($category['scheme'])) { if (empty($category['scheme']) || !is_string($category['scheme']) - || !\Zend\URI\URL::validate($category['scheme']) + || !\Zend\Uri\Url::validate($category['scheme']) ) { throw new Feed\Exception('The Atom scheme or RSS domain of' . ' a category must be a valid URI'); diff --git a/src/Writer/Deleted.php b/src/Writer/Deleted.php index b40a48e7..5483827f 100644 --- a/src/Writer/Deleted.php +++ b/src/Writer/Deleted.php @@ -172,7 +172,7 @@ public function setBy(array $by) if (isset($by['uri'])) { if (empty($by['uri']) || !is_string($by['uri']) - || !\Zend\URI\URL::validate($by['uri']) + || !\Zend\Uri\Url::validate($by['uri']) ) { throw new FeedException('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); } diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index 7e0baeb0..5e4503d0 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -25,7 +25,7 @@ namespace Zend\Feed\Writer; use Zend\Feed\Exception as FeedException; -use Zend\URI; +use Zend\Uri; use Zend\Date; /** @@ -102,7 +102,7 @@ public function addAuthor($name, $email = null, $uri = null) if (isset($name['uri'])) { if (empty($name['uri']) || !is_string($name['uri']) - || !\Zend\URI\URL::validate($name['uri']) + || !\Zend\Uri\Url::validate($name['uri']) ) { throw new FeedException('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); } @@ -124,7 +124,7 @@ public function addAuthor($name, $email = null, $uri = null) $author['email'] = $email; } if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !\Zend\URI\URL::validate($uri)) { + if (empty($uri) || !is_string($uri) || !\Zend\Uri\Url::validate($uri)) { throw new FeedException('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $uri; @@ -270,7 +270,7 @@ public function setId($id) */ public function setLink($link) { - if (empty($link) || !is_string($link) || !\Zend\URI\URL::validate($link)) { + if (empty($link) || !is_string($link) || !\Zend\Uri\Url::validate($link)) { throw new FeedException('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['link'] = $link; @@ -296,7 +296,7 @@ public function setCommentCount($count) */ public function setCommentLink($link) { - if (empty($link) || !is_string($link) || !\Zend\URI\URL::validate($link)) { + if (empty($link) || !is_string($link) || !\Zend\Uri\Url::validate($link)) { throw new FeedException('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); } $this->_data['commentLink'] = $link; @@ -309,7 +309,7 @@ public function setCommentLink($link) */ public function setCommentFeedLink(array $link) { - if (!isset($link['uri']) || !is_string($link['uri']) || !\Zend\URI\URL::validate($link['uri'])) { + if (!isset($link['uri']) || !is_string($link['uri']) || !\Zend\Uri\Url::validate($link['uri'])) { throw new FeedException('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); } if (!isset($link['type']) || !in_array($link['type'], array('atom', 'rss', 'rdf'))) { @@ -535,7 +535,7 @@ public function addCategory(array $category) if (isset($category['scheme'])) { if (empty($category['scheme']) || !is_string($category['scheme']) - || !\Zend\URI\URL::validate($category['scheme']) + || !\Zend\Uri\Url::validate($category['scheme']) ) { throw new FeedException('The Atom scheme or RSS domain of' . ' a category must be a valid URI'); @@ -585,7 +585,7 @@ public function setEnclosure(array $enclosure) if (!isset($enclosure['uri'])) { throw new FeedException('Enclosure "uri" is not set'); } - if (!\Zend\URI\URL::validate($enclosure['uri'])) { + if (!\Zend\Uri\Url::validate($enclosure['uri'])) { throw new FeedException('Enclosure "uri" is not a valid URI/IRI'); } $this->_data['enclosure'] = $enclosure; diff --git a/src/Writer/Extension/ITunes/Feed.php b/src/Writer/Extension/ITunes/Feed.php index 0dd71ed9..235d7679 100644 --- a/src/Writer/Extension/ITunes/Feed.php +++ b/src/Writer/Extension/ITunes/Feed.php @@ -23,7 +23,7 @@ * @namespace */ namespace Zend\Feed\Writer\Extension\ITunes; -use Zend\URI; +use Zend\Uri; /** * @uses \Zend\Feed\Exception @@ -170,7 +170,7 @@ public function setItunesCategories(array $values) */ public function setItunesImage($value) { - if (!\Zend\URI\URL::validate($value)) { + if (!\Zend\Uri\Url::validate($value)) { throw new \Zend\Feed\Exception('invalid parameter: "image" may only' . ' be a valid URI/IRI'); } @@ -249,7 +249,7 @@ public function setItunesKeywords(array $value) */ public function setItunesNewFeedUrl($value) { - if (!\Zend\URI\URL::validate($value)) { + if (!\Zend\Uri\Url::validate($value)) { throw new \Zend\Feed\Exception('invalid parameter: "newFeedUrl" may only' . ' be a valid URI/IRI'); } diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom.php index 1d650634..a383db3e 100644 --- a/src/Writer/Renderer/Entry/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -291,7 +291,7 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) $this->getDataContainer()->setId( $this->getDataContainer()->getLink()); } - if (!\Zend\URI\URL::validate($this->getDataContainer()->getId()) && + if (!\Zend\Uri\Url::validate($this->getDataContainer()->getId()) && !preg_match('#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#', $this->getDataContainer()->getId())) { throw new Feed\Exception('Atom 1.0 IDs must be a valid URI/IRI'); } diff --git a/src/Writer/Renderer/Entry/RSS.php b/src/Writer/Renderer/Entry/RSS.php index 555a41d2..127821f3 100644 --- a/src/Writer/Renderer/Entry/RSS.php +++ b/src/Writer/Renderer/Entry/RSS.php @@ -297,7 +297,7 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) } $text = $dom->createTextNode($this->getDataContainer()->getId()); $id->appendChild($text); - if (!\Zend\URI\URL::validate($this->getDataContainer()->getId())) { + if (!\Zend\Uri\Url::validate($this->getDataContainer()->getId())) { $id->setAttribute('isPermaLink', 'false'); } } diff --git a/src/Writer/Renderer/Feed/RSS.php b/src/Writer/Renderer/Feed/RSS.php index f2a868bf..b97aec4a 100644 --- a/src/Writer/Renderer/Feed/RSS.php +++ b/src/Writer/Renderer/Feed/RSS.php @@ -263,7 +263,7 @@ protected function _setLink(\DOMDocument $dom, \DOMElement $root) $root->appendChild($link); $text = $dom->createTextNode($value); $link->appendChild($text); - if (!\Zend\URI\URL::validate($value)) { + if (!\Zend\Uri\Url::validate($value)) { $link->setAttribute('isPermaLink', 'false'); } } @@ -337,7 +337,7 @@ protected function _setImage(\DOMDocument $dom, \DOMElement $root) } } if (empty($image['link']) || !is_string($image['link']) - || !\Zend\URI\URL::validate($image['link'])) { + || !\Zend\Uri\Url::validate($image['link'])) { $message = 'Invalid parameter: parameter \'link\'' . ' must be a non-empty string and valid URI/IRI'; $exception = new \Zend\Feed\Exception($message); diff --git a/test/PubSubHubbub/SubscriberHttpTest.php b/test/PubSubHubbub/SubscriberHttpTest.php index 5eb08687..a792c2f6 100644 --- a/test/PubSubHubbub/SubscriberHttpTest.php +++ b/test/PubSubHubbub/SubscriberHttpTest.php @@ -59,7 +59,7 @@ class SubscriberHttpTest extends \PHPUnit_Framework_TestCase public function setUp() { if (defined('TESTS_Zend_Feed_PubSubHubbub_BASEURI') && - \Zend\URI\URL::check(TESTS_Zend_Feed_PubSubHubbub_BASEURI)) { + \Zend\Uri\Url::check(TESTS_Zend_Feed_PubSubHubbub_BASEURI)) { $this->_baseuri = TESTS_Zend_Feed_PubSubHubbub_BASEURI; if (substr($this->_baseuri, -1) != '/') $this->_baseuri .= '/'; $name = $this->getName(); diff --git a/test/Reader/Entry/RSSTest.php b/test/Reader/Entry/RSSTest.php index a5d67695..b761aed8 100644 --- a/test/Reader/Entry/RSSTest.php +++ b/test/Reader/Entry/RSSTest.php @@ -1913,7 +1913,7 @@ public function testParsesCorrectDateIfMissingOffsetWhenSystemUsesUSLocale() $entry = $feed->current(); $fdate = $entry->getDateModified(); $edate = new Date\Date; - $edate->set('2010-01-04T08:14:00-0600', Date\Date::ISO_8601); + $edate->set('2010-01-04T02:14:00-0600', Date\Date::ISO_8601); \Zend\Registry::getInstance()->offsetUnset('Zend_Locale'); $this->assertTrue($edate->equals($fdate), $edate->get(Date\Date::ISO_8601) . ' :: ' . $fdate->get(Date\Date::ISO_8601) . "\n"); } diff --git a/test/Reader/Feed/RSSTest.php b/test/Reader/Feed/RSSTest.php index 3d4aefd7..1fa0309f 100644 --- a/test/Reader/Feed/RSSTest.php +++ b/test/Reader/Feed/RSSTest.php @@ -2148,7 +2148,7 @@ public function testParsesCorrectDateIfMissingOffsetWhenSystemUsesUSLocale() ); $fdate = $feed->getDateModified(); $edate = new Date\Date; - $edate->set('2010-01-04T08:14:00-0600', Date\Date::ISO_8601); + $edate->set('2010-01-04T02:14:00-0600', Date\Date::ISO_8601); \Zend\Registry::getInstance()->offsetUnset('Zend_Locale'); $this->assertTrue($edate->equals($fdate)); } From 1847116d780b6ec917fee90cf78b698f2aa67529 Mon Sep 17 00:00:00 2001 From: mabe Date: Sat, 24 Jul 2010 16:37:10 +0000 Subject: [PATCH 156/238] ZF-5413: use "$var === null" instaed of "is_null($var)" git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22660 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/CallbackAbstract.php | 2 +- src/Pubsubhubbub/Model/ModelAbstract.php | 2 +- src/Pubsubhubbub/Publisher.php | 4 ++-- src/Pubsubhubbub/Subscriber.php | 4 ++-- src/Pubsubhubbub/Subscriber/Callback.php | 2 +- src/Reader.php | 4 ++-- src/Reader/Extension/EntryAbstract.php | 2 +- src/Reader/Feed/Atom.php | 2 +- src/Reader/Feed/Rss.php | 2 +- src/Reader/FeedSet.php | 2 +- src/Writer/Deleted.php | 2 +- src/Writer/Entry.php | 4 ++-- src/Writer/Extension/ITunes/Renderer/Entry.php | 4 ++-- src/Writer/Extension/ITunes/Renderer/Feed.php | 4 ++-- src/Writer/Extension/Threading/Renderer/Entry.php | 6 +++--- src/Writer/Feed/FeedAbstract.php | 6 +++--- 16 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Pubsubhubbub/CallbackAbstract.php b/src/Pubsubhubbub/CallbackAbstract.php index 850a7322..28bbbf08 100644 --- a/src/Pubsubhubbub/CallbackAbstract.php +++ b/src/Pubsubhubbub/CallbackAbstract.php @@ -74,7 +74,7 @@ abstract class Zend_Feed_Pubsubhubbub_CallbackAbstract */ public function __construct($config = null) { - if (!is_null($config)) { + if (($config !== NULL)) { $this->setConfig($config); } } diff --git a/src/Pubsubhubbub/Model/ModelAbstract.php b/src/Pubsubhubbub/Model/ModelAbstract.php index 0e552db8..344adf5b 100644 --- a/src/Pubsubhubbub/Model/ModelAbstract.php +++ b/src/Pubsubhubbub/Model/ModelAbstract.php @@ -53,7 +53,7 @@ class Zend_Feed_Pubsubhubbub_Model_ModelAbstract */ public function __construct(Zend_Db_Table_Abstract $tableGateway = null) { - if (is_null($tableGateway)) { + if ($tableGateway === NULL)) { $parts = explode('_', get_class($this)); $table = strtolower(array_pop($parts)); $this->_db = new Zend_Db_Table($table); diff --git a/src/Pubsubhubbub/Publisher.php b/src/Pubsubhubbub/Publisher.php index b9524e07..54fc9b97 100644 --- a/src/Pubsubhubbub/Publisher.php +++ b/src/Pubsubhubbub/Publisher.php @@ -74,7 +74,7 @@ class Zend_Feed_Pubsubhubbub_Publisher */ public function __construct($config = null) { - if (!is_null($config)) { + if (($config !== NULL)) { $this->setConfig($config); } } @@ -306,7 +306,7 @@ public function setParameter($name, $value = null) $this->removeParameter($name); return $this; } - if (empty($value) || (!is_string($value) && !is_null($value))) { + if (empty($value) || (!is_string($value) && ($value !== NULL))) { require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "value"' .' of "' . $value . '" must be a non-empty string'); diff --git a/src/Pubsubhubbub/Subscriber.php b/src/Pubsubhubbub/Subscriber.php index 2e8846d8..c0626075 100644 --- a/src/Pubsubhubbub/Subscriber.php +++ b/src/Pubsubhubbub/Subscriber.php @@ -150,7 +150,7 @@ class Zend_Feed_Pubsubhubbub_Subscriber */ public function __construct($config = null) { - if (!is_null($config)) { + if (($config !== NULL)) { $this->setConfig($config); } } @@ -471,7 +471,7 @@ public function setParameter($name, $value = null) $this->removeParameter($name); return $this; } - if (empty($value) || (!is_string($value) && !is_null($value))) { + if (empty($value) || (!is_string($value) && ($value !== NULL))) { require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "value"' . ' of "' . $value . '" must be a non-empty string'); diff --git a/src/Pubsubhubbub/Subscriber/Callback.php b/src/Pubsubhubbub/Subscriber/Callback.php index 9e9b2636..c122a992 100644 --- a/src/Pubsubhubbub/Subscriber/Callback.php +++ b/src/Pubsubhubbub/Subscriber/Callback.php @@ -208,7 +208,7 @@ public function setFeedUpdate($feed) */ public function hasFeedUpdate() { - if (is_null($this->_feedUpdate)) { + if ($this->_feedUpdate === NULL)) { return false; } return true; diff --git a/src/Reader.php b/src/Reader.php index 1308278e..31d6554c 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -236,10 +236,10 @@ public static function import($uri, $etag = null, $lastModified = null) if (self::$_httpConditionalGet && $cache) { $data = $cache->load($cacheId); if ($data) { - if (is_null($etag)) { + if ($etag === NULL)) { $etag = $cache->load($cacheId.'_etag'); } - if (is_null($lastModified)) { + if ($lastModified === NULL)) { $lastModified = $cache->load($cacheId.'_lastmodified');; } if ($etag) { diff --git a/src/Reader/Extension/EntryAbstract.php b/src/Reader/Extension/EntryAbstract.php index ca5c47a8..7a74f6f1 100644 --- a/src/Reader/Extension/EntryAbstract.php +++ b/src/Reader/Extension/EntryAbstract.php @@ -83,7 +83,7 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) $this->_entryKey = $entryKey; $this->_domDocument = $entry->ownerDocument; - if (!is_null($type)) { + if (($type !== NULL)) { $this->_data['type'] = $type; } else { $this->_data['type'] = Zend_Feed_Reader::detectType($entry->ownerDocument, true); diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index 7e895ec5..dde2d374 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -318,7 +318,7 @@ public function getFeedLink() $link = $this->getExtension('Atom')->getFeedLink(); - if (is_null($link) || empty($link)) { + if ($link === NULL) || empty($link)) { $link = $this->getOriginalSourceUri(); } diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 273347b4..47217dcb 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -543,7 +543,7 @@ public function getFeedLink() $link = $this->getExtension('Atom')->getFeedLink(); - if (is_null($link) || empty($link)) { + if ($link === NULL) || empty($link)) { $link = $this->getOriginalSourceUri(); } diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index dcf43ff3..02a8acd4 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -88,7 +88,7 @@ public function addLinks(DOMNodeList $links, $uri) protected function _absolutiseUri($link, $uri = null) { if (!Zend_Uri::check($link)) { - if (!is_null($uri)) { + if (($uri !== NULL)) { $uri = Zend_Uri::factory($uri); if ($link[0] !== '/') { diff --git a/src/Writer/Deleted.php b/src/Writer/Deleted.php index ce5b00f8..2dd6d10a 100644 --- a/src/Writer/Deleted.php +++ b/src/Writer/Deleted.php @@ -126,7 +126,7 @@ public function getReference() public function setWhen($date = null) { $zdate = null; - if (is_null($date)) { + if ($date === NULL)) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index 836069ee..c6741190 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -212,7 +212,7 @@ public function setContent($content) public function setDateCreated($date = null) { $zdate = null; - if (is_null($date)) { + if ($date === NULL)) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); @@ -233,7 +233,7 @@ public function setDateCreated($date = null) public function setDateModified($date = null) { $zdate = null; - if (is_null($date)) { + if ($date === NULL)) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php index a300ff1b..33e06b8b 100644 --- a/src/Writer/Extension/ITunes/Renderer/Entry.php +++ b/src/Writer/Extension/ITunes/Renderer/Entry.php @@ -104,7 +104,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) protected function _setBlock(DOMDocument $dom, DOMElement $root) { $block = $this->getDataContainer()->getItunesBlock(); - if (is_null($block)) { + if ($block === NULL)) { return; } $el = $dom->createElement('itunes:block'); @@ -144,7 +144,7 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root) protected function _setExplicit(DOMDocument $dom, DOMElement $root) { $explicit = $this->getDataContainer()->getItunesExplicit(); - if (is_null($explicit)) { + if ($explicit === NULL)) { return; } $el = $dom->createElement('itunes:explicit'); diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php index 236d6af8..665f1d8a 100644 --- a/src/Writer/Extension/ITunes/Renderer/Feed.php +++ b/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -109,7 +109,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) protected function _setBlock(DOMDocument $dom, DOMElement $root) { $block = $this->getDataContainer()->getItunesBlock(); - if (is_null($block)) { + if ($block === NULL)) { return; } $el = $dom->createElement('itunes:block'); @@ -200,7 +200,7 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root) protected function _setExplicit(DOMDocument $dom, DOMElement $root) { $explicit = $this->getDataContainer()->getItunesExplicit(); - if (is_null($explicit)) { + if ($explicit === NULL)) { return; } $el = $dom->createElement('itunes:explicit'); diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php index 93a3666e..ec600842 100644 --- a/src/Writer/Extension/Threading/Renderer/Entry.php +++ b/src/Writer/Extension/Threading/Renderer/Entry.php @@ -90,7 +90,7 @@ protected function _setCommentLink(DOMDocument $dom, DOMElement $root) $clink->setAttribute('type', 'text/html'); $clink->setAttribute('href', $link); $count = $this->getDataContainer()->getCommentCount(); - if (!is_null($count)) { + if (($count !== NULL)) { $clink->setAttribute('thr:count', $count); } $root->appendChild($clink); @@ -116,7 +116,7 @@ protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) $flink->setAttribute('type', 'application/'. $link['type'] .'+xml'); $flink->setAttribute('href', $link['uri']); $count = $this->getDataContainer()->getCommentCount(); - if (!is_null($count)) { + if (($count !== NULL)) { $flink->setAttribute('thr:count', $count); } $root->appendChild($flink); @@ -134,7 +134,7 @@ protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) protected function _setCommentCount(DOMDocument $dom, DOMElement $root) { $count = $this->getDataContainer()->getCommentCount(); - if (is_null($count)) { + if ($count === NULL)) { return; } $tcount = $this->_dom->createElement('thr:total'); diff --git a/src/Writer/Feed/FeedAbstract.php b/src/Writer/Feed/FeedAbstract.php index 3699283a..b640bace 100644 --- a/src/Writer/Feed/FeedAbstract.php +++ b/src/Writer/Feed/FeedAbstract.php @@ -171,7 +171,7 @@ public function setCopyright($copyright) public function setDateCreated($date = null) { $zdate = null; - if (is_null($date)) { + if ($date === NULL)) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); @@ -192,7 +192,7 @@ public function setDateCreated($date = null) public function setDateModified($date = null) { $zdate = null; - if (is_null($date)) { + if ($date === NULL)) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); @@ -213,7 +213,7 @@ public function setDateModified($date = null) public function setLastBuildDate($date = null) { $zdate = null; - if (is_null($date)) { + if ($date === NULL)) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); From eafe9ab06fa8eaaf256695e2e314e1a0ac8613f7 Mon Sep 17 00:00:00 2001 From: mabe Date: Sat, 24 Jul 2010 16:55:09 +0000 Subject: [PATCH 157/238] ZF-5413: fixed my last commit is_null -> === null git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22661 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/Model/ModelAbstract.php | 2 +- src/Pubsubhubbub/Subscriber/Callback.php | 2 +- src/Reader.php | 4 ++-- src/Reader/Feed/Atom.php | 2 +- src/Reader/Feed/Rss.php | 2 +- src/Writer/Deleted.php | 2 +- src/Writer/Entry.php | 4 ++-- src/Writer/Extension/ITunes/Renderer/Entry.php | 4 ++-- src/Writer/Extension/ITunes/Renderer/Feed.php | 4 ++-- src/Writer/Extension/Threading/Renderer/Entry.php | 2 +- src/Writer/Feed/FeedAbstract.php | 6 +++--- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Pubsubhubbub/Model/ModelAbstract.php b/src/Pubsubhubbub/Model/ModelAbstract.php index 344adf5b..7d6ead95 100644 --- a/src/Pubsubhubbub/Model/ModelAbstract.php +++ b/src/Pubsubhubbub/Model/ModelAbstract.php @@ -53,7 +53,7 @@ class Zend_Feed_Pubsubhubbub_Model_ModelAbstract */ public function __construct(Zend_Db_Table_Abstract $tableGateway = null) { - if ($tableGateway === NULL)) { + if (($tableGateway === NULL)) { $parts = explode('_', get_class($this)); $table = strtolower(array_pop($parts)); $this->_db = new Zend_Db_Table($table); diff --git a/src/Pubsubhubbub/Subscriber/Callback.php b/src/Pubsubhubbub/Subscriber/Callback.php index c122a992..3f70687c 100644 --- a/src/Pubsubhubbub/Subscriber/Callback.php +++ b/src/Pubsubhubbub/Subscriber/Callback.php @@ -208,7 +208,7 @@ public function setFeedUpdate($feed) */ public function hasFeedUpdate() { - if ($this->_feedUpdate === NULL)) { + if (($this->_feedUpdate === NULL)) { return false; } return true; diff --git a/src/Reader.php b/src/Reader.php index 31d6554c..3453bed6 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -236,10 +236,10 @@ public static function import($uri, $etag = null, $lastModified = null) if (self::$_httpConditionalGet && $cache) { $data = $cache->load($cacheId); if ($data) { - if ($etag === NULL)) { + if (($etag === NULL)) { $etag = $cache->load($cacheId.'_etag'); } - if ($lastModified === NULL)) { + if (($lastModified === NULL)) { $lastModified = $cache->load($cacheId.'_lastmodified');; } if ($etag) { diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index dde2d374..ef7eb196 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -318,7 +318,7 @@ public function getFeedLink() $link = $this->getExtension('Atom')->getFeedLink(); - if ($link === NULL) || empty($link)) { + if (($link === NULL) || empty($link)) { $link = $this->getOriginalSourceUri(); } diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 47217dcb..558cbd19 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -543,7 +543,7 @@ public function getFeedLink() $link = $this->getExtension('Atom')->getFeedLink(); - if ($link === NULL) || empty($link)) { + if (($link === NULL) || empty($link)) { $link = $this->getOriginalSourceUri(); } diff --git a/src/Writer/Deleted.php b/src/Writer/Deleted.php index 2dd6d10a..cbb6f775 100644 --- a/src/Writer/Deleted.php +++ b/src/Writer/Deleted.php @@ -126,7 +126,7 @@ public function getReference() public function setWhen($date = null) { $zdate = null; - if ($date === NULL)) { + if (($date === NULL)) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index c6741190..32d2a895 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -212,7 +212,7 @@ public function setContent($content) public function setDateCreated($date = null) { $zdate = null; - if ($date === NULL)) { + if (($date === NULL)) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); @@ -233,7 +233,7 @@ public function setDateCreated($date = null) public function setDateModified($date = null) { $zdate = null; - if ($date === NULL)) { + if (($date === NULL)) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php index 33e06b8b..34343386 100644 --- a/src/Writer/Extension/ITunes/Renderer/Entry.php +++ b/src/Writer/Extension/ITunes/Renderer/Entry.php @@ -104,7 +104,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) protected function _setBlock(DOMDocument $dom, DOMElement $root) { $block = $this->getDataContainer()->getItunesBlock(); - if ($block === NULL)) { + if (($block === NULL)) { return; } $el = $dom->createElement('itunes:block'); @@ -144,7 +144,7 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root) protected function _setExplicit(DOMDocument $dom, DOMElement $root) { $explicit = $this->getDataContainer()->getItunesExplicit(); - if ($explicit === NULL)) { + if (($explicit === NULL)) { return; } $el = $dom->createElement('itunes:explicit'); diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php index 665f1d8a..56372bb6 100644 --- a/src/Writer/Extension/ITunes/Renderer/Feed.php +++ b/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -109,7 +109,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) protected function _setBlock(DOMDocument $dom, DOMElement $root) { $block = $this->getDataContainer()->getItunesBlock(); - if ($block === NULL)) { + if (($block === NULL)) { return; } $el = $dom->createElement('itunes:block'); @@ -200,7 +200,7 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root) protected function _setExplicit(DOMDocument $dom, DOMElement $root) { $explicit = $this->getDataContainer()->getItunesExplicit(); - if ($explicit === NULL)) { + if (($explicit === NULL)) { return; } $el = $dom->createElement('itunes:explicit'); diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php index ec600842..1f60bb4b 100644 --- a/src/Writer/Extension/Threading/Renderer/Entry.php +++ b/src/Writer/Extension/Threading/Renderer/Entry.php @@ -134,7 +134,7 @@ protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) protected function _setCommentCount(DOMDocument $dom, DOMElement $root) { $count = $this->getDataContainer()->getCommentCount(); - if ($count === NULL)) { + if (($count === NULL)) { return; } $tcount = $this->_dom->createElement('thr:total'); diff --git a/src/Writer/Feed/FeedAbstract.php b/src/Writer/Feed/FeedAbstract.php index b640bace..85dfdf2b 100644 --- a/src/Writer/Feed/FeedAbstract.php +++ b/src/Writer/Feed/FeedAbstract.php @@ -171,7 +171,7 @@ public function setCopyright($copyright) public function setDateCreated($date = null) { $zdate = null; - if ($date === NULL)) { + if (($date === NULL)) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); @@ -192,7 +192,7 @@ public function setDateCreated($date = null) public function setDateModified($date = null) { $zdate = null; - if ($date === NULL)) { + if (($date === NULL)) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); @@ -213,7 +213,7 @@ public function setDateModified($date = null) public function setLastBuildDate($date = null) { $zdate = null; - if ($date === NULL)) { + if (($date === NULL)) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); From 218d5268044c18e273d6cd003720c6c6eb253881 Mon Sep 17 00:00:00 2001 From: mabe Date: Sat, 24 Jul 2010 17:37:36 +0000 Subject: [PATCH 158/238] ZF-5413: no double parentheses | NULL -> null git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22662 44c647ce-9c0f-0410-b52a-842ac1e357ba --- src/Pubsubhubbub/CallbackAbstract.php | 2 +- src/Pubsubhubbub/Model/ModelAbstract.php | 2 +- src/Pubsubhubbub/Publisher.php | 4 ++-- src/Pubsubhubbub/Subscriber.php | 4 ++-- src/Pubsubhubbub/Subscriber/Callback.php | 2 +- src/Reader.php | 4 ++-- src/Reader/Extension/EntryAbstract.php | 2 +- src/Reader/Feed/Atom.php | 2 +- src/Reader/Feed/Rss.php | 2 +- src/Reader/FeedSet.php | 2 +- src/Writer/Deleted.php | 2 +- src/Writer/Entry.php | 4 ++-- src/Writer/Extension/ITunes/Renderer/Entry.php | 4 ++-- src/Writer/Extension/ITunes/Renderer/Feed.php | 4 ++-- src/Writer/Extension/Threading/Renderer/Entry.php | 6 +++--- src/Writer/Feed/FeedAbstract.php | 6 +++--- 16 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Pubsubhubbub/CallbackAbstract.php b/src/Pubsubhubbub/CallbackAbstract.php index 28bbbf08..fd832b5a 100644 --- a/src/Pubsubhubbub/CallbackAbstract.php +++ b/src/Pubsubhubbub/CallbackAbstract.php @@ -74,7 +74,7 @@ abstract class Zend_Feed_Pubsubhubbub_CallbackAbstract */ public function __construct($config = null) { - if (($config !== NULL)) { + if ($config !== null) { $this->setConfig($config); } } diff --git a/src/Pubsubhubbub/Model/ModelAbstract.php b/src/Pubsubhubbub/Model/ModelAbstract.php index 7d6ead95..e15496e0 100644 --- a/src/Pubsubhubbub/Model/ModelAbstract.php +++ b/src/Pubsubhubbub/Model/ModelAbstract.php @@ -53,7 +53,7 @@ class Zend_Feed_Pubsubhubbub_Model_ModelAbstract */ public function __construct(Zend_Db_Table_Abstract $tableGateway = null) { - if (($tableGateway === NULL)) { + if ($tableGateway === null) { $parts = explode('_', get_class($this)); $table = strtolower(array_pop($parts)); $this->_db = new Zend_Db_Table($table); diff --git a/src/Pubsubhubbub/Publisher.php b/src/Pubsubhubbub/Publisher.php index 54fc9b97..192f6b0d 100644 --- a/src/Pubsubhubbub/Publisher.php +++ b/src/Pubsubhubbub/Publisher.php @@ -74,7 +74,7 @@ class Zend_Feed_Pubsubhubbub_Publisher */ public function __construct($config = null) { - if (($config !== NULL)) { + if ($config !== null) { $this->setConfig($config); } } @@ -306,7 +306,7 @@ public function setParameter($name, $value = null) $this->removeParameter($name); return $this; } - if (empty($value) || (!is_string($value) && ($value !== NULL))) { + if (empty($value) || (!is_string($value) && $value !== null)) { require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "value"' .' of "' . $value . '" must be a non-empty string'); diff --git a/src/Pubsubhubbub/Subscriber.php b/src/Pubsubhubbub/Subscriber.php index c0626075..3d74ebe7 100644 --- a/src/Pubsubhubbub/Subscriber.php +++ b/src/Pubsubhubbub/Subscriber.php @@ -150,7 +150,7 @@ class Zend_Feed_Pubsubhubbub_Subscriber */ public function __construct($config = null) { - if (($config !== NULL)) { + if ($config !== null) { $this->setConfig($config); } } @@ -471,7 +471,7 @@ public function setParameter($name, $value = null) $this->removeParameter($name); return $this; } - if (empty($value) || (!is_string($value) && ($value !== NULL))) { + if (empty($value) || (!is_string($value) && $value !== null)) { require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "value"' . ' of "' . $value . '" must be a non-empty string'); diff --git a/src/Pubsubhubbub/Subscriber/Callback.php b/src/Pubsubhubbub/Subscriber/Callback.php index 3f70687c..456fe1ea 100644 --- a/src/Pubsubhubbub/Subscriber/Callback.php +++ b/src/Pubsubhubbub/Subscriber/Callback.php @@ -208,7 +208,7 @@ public function setFeedUpdate($feed) */ public function hasFeedUpdate() { - if (($this->_feedUpdate === NULL)) { + if ($this->_feedUpdate === null) { return false; } return true; diff --git a/src/Reader.php b/src/Reader.php index 3453bed6..3ed54d3f 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -236,10 +236,10 @@ public static function import($uri, $etag = null, $lastModified = null) if (self::$_httpConditionalGet && $cache) { $data = $cache->load($cacheId); if ($data) { - if (($etag === NULL)) { + if ($etag === null) { $etag = $cache->load($cacheId.'_etag'); } - if (($lastModified === NULL)) { + if ($lastModified === null) { $lastModified = $cache->load($cacheId.'_lastmodified');; } if ($etag) { diff --git a/src/Reader/Extension/EntryAbstract.php b/src/Reader/Extension/EntryAbstract.php index 7a74f6f1..b46bb713 100644 --- a/src/Reader/Extension/EntryAbstract.php +++ b/src/Reader/Extension/EntryAbstract.php @@ -83,7 +83,7 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) $this->_entryKey = $entryKey; $this->_domDocument = $entry->ownerDocument; - if (($type !== NULL)) { + if ($type !== null) { $this->_data['type'] = $type; } else { $this->_data['type'] = Zend_Feed_Reader::detectType($entry->ownerDocument, true); diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index ef7eb196..2b560707 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -318,7 +318,7 @@ public function getFeedLink() $link = $this->getExtension('Atom')->getFeedLink(); - if (($link === NULL) || empty($link)) { + if ($link === null || empty($link)) { $link = $this->getOriginalSourceUri(); } diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 558cbd19..6865b794 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -543,7 +543,7 @@ public function getFeedLink() $link = $this->getExtension('Atom')->getFeedLink(); - if (($link === NULL) || empty($link)) { + if ($link === null || empty($link)) { $link = $this->getOriginalSourceUri(); } diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index 02a8acd4..df174111 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -88,7 +88,7 @@ public function addLinks(DOMNodeList $links, $uri) protected function _absolutiseUri($link, $uri = null) { if (!Zend_Uri::check($link)) { - if (($uri !== NULL)) { + if ($uri !== null) { $uri = Zend_Uri::factory($uri); if ($link[0] !== '/') { diff --git a/src/Writer/Deleted.php b/src/Writer/Deleted.php index cbb6f775..dcf93c15 100644 --- a/src/Writer/Deleted.php +++ b/src/Writer/Deleted.php @@ -126,7 +126,7 @@ public function getReference() public function setWhen($date = null) { $zdate = null; - if (($date === NULL)) { + if ($date === null) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index 32d2a895..e09790a9 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -212,7 +212,7 @@ public function setContent($content) public function setDateCreated($date = null) { $zdate = null; - if (($date === NULL)) { + if ($date === null) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); @@ -233,7 +233,7 @@ public function setDateCreated($date = null) public function setDateModified($date = null) { $zdate = null; - if (($date === NULL)) { + if ($date === null) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php index 34343386..ca9dd2a7 100644 --- a/src/Writer/Extension/ITunes/Renderer/Entry.php +++ b/src/Writer/Extension/ITunes/Renderer/Entry.php @@ -104,7 +104,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) protected function _setBlock(DOMDocument $dom, DOMElement $root) { $block = $this->getDataContainer()->getItunesBlock(); - if (($block === NULL)) { + if ($block === null) { return; } $el = $dom->createElement('itunes:block'); @@ -144,7 +144,7 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root) protected function _setExplicit(DOMDocument $dom, DOMElement $root) { $explicit = $this->getDataContainer()->getItunesExplicit(); - if (($explicit === NULL)) { + if ($explicit === null) { return; } $el = $dom->createElement('itunes:explicit'); diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php index 56372bb6..e7611a1e 100644 --- a/src/Writer/Extension/ITunes/Renderer/Feed.php +++ b/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -109,7 +109,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) protected function _setBlock(DOMDocument $dom, DOMElement $root) { $block = $this->getDataContainer()->getItunesBlock(); - if (($block === NULL)) { + if ($block === null) { return; } $el = $dom->createElement('itunes:block'); @@ -200,7 +200,7 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root) protected function _setExplicit(DOMDocument $dom, DOMElement $root) { $explicit = $this->getDataContainer()->getItunesExplicit(); - if (($explicit === NULL)) { + if ($explicit === null) { return; } $el = $dom->createElement('itunes:explicit'); diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php index 1f60bb4b..d4e3b5fb 100644 --- a/src/Writer/Extension/Threading/Renderer/Entry.php +++ b/src/Writer/Extension/Threading/Renderer/Entry.php @@ -90,7 +90,7 @@ protected function _setCommentLink(DOMDocument $dom, DOMElement $root) $clink->setAttribute('type', 'text/html'); $clink->setAttribute('href', $link); $count = $this->getDataContainer()->getCommentCount(); - if (($count !== NULL)) { + if ($count !== null) { $clink->setAttribute('thr:count', $count); } $root->appendChild($clink); @@ -116,7 +116,7 @@ protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) $flink->setAttribute('type', 'application/'. $link['type'] .'+xml'); $flink->setAttribute('href', $link['uri']); $count = $this->getDataContainer()->getCommentCount(); - if (($count !== NULL)) { + if ($count !== null) { $flink->setAttribute('thr:count', $count); } $root->appendChild($flink); @@ -134,7 +134,7 @@ protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) protected function _setCommentCount(DOMDocument $dom, DOMElement $root) { $count = $this->getDataContainer()->getCommentCount(); - if (($count === NULL)) { + if ($count === null) { return; } $tcount = $this->_dom->createElement('thr:total'); diff --git a/src/Writer/Feed/FeedAbstract.php b/src/Writer/Feed/FeedAbstract.php index 85dfdf2b..b6ca97d1 100644 --- a/src/Writer/Feed/FeedAbstract.php +++ b/src/Writer/Feed/FeedAbstract.php @@ -171,7 +171,7 @@ public function setCopyright($copyright) public function setDateCreated($date = null) { $zdate = null; - if (($date === NULL)) { + if ($date === null) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); @@ -192,7 +192,7 @@ public function setDateCreated($date = null) public function setDateModified($date = null) { $zdate = null; - if (($date === NULL)) { + if ($date === null) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); @@ -213,7 +213,7 @@ public function setDateModified($date = null) public function setLastBuildDate($date = null) { $zdate = null; - if (($date === NULL)) { + if ($date === null) { $zdate = new Zend_Date; } elseif (ctype_digit($date) && strlen($date) == 10) { $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); From 2b495a8f2c55e9106c36fe9b12867225858f8317 Mon Sep 17 00:00:00 2001 From: Padraic Brady Date: Sun, 25 Jul 2010 12:41:59 +0100 Subject: [PATCH 159/238] Zend\Feed conflicts from master merge resolved --- src/Reader/Collection/Author.php | 9 - src/Reader/Collection/Category.php | 9 - src/Reader/Entry/Atom.php | 13 - src/Reader/Extension/Atom/Entry.php | 21 - src/Reader/Extension/Atom/Feed.php | 18 - src/Reader/Extension/Content/Entry.php | 11 - .../Extension/CreativeCommons/Entry.php | 11 - src/Reader/Extension/CreativeCommons/Feed.php | 10 - src/Reader/Extension/Podcast/Entry.php | 11 - src/Reader/Extension/Podcast/Feed.php | 10 - src/Reader/Extension/Slash/Entry.php | 11 - src/Reader/Extension/Thread/Entry.php | 10 - src/Reader/Extension/WellFormedWeb/Entry.php | 11 - src/Reader/Feed/Atom/Source.php | 20 - src/Reader/Feed/RSS.php | 722 ------------------ src/Reader/Reader.php | 34 +- src/Writer/AbstractFeed.php | 24 +- src/Writer/Deleted.php | 36 +- src/Writer/Entry.php | 124 +-- .../Exception/InvalidMethodException.php | 4 +- src/Writer/Extension/AbstractRenderer.php | 8 +- src/Writer/Extension/Atom/Renderer/Feed.php | 12 +- .../Extension/Content/Renderer/Entry.php | 12 +- .../Extension/DublinCore/Renderer/Entry.php | 12 +- .../Extension/DublinCore/Renderer/Feed.php | 12 +- src/Writer/Extension/ITunes/Entry.php | 15 - src/Writer/Extension/ITunes/Feed.php | 37 +- .../Extension/ITunes/Renderer/Entry.php | 12 +- src/Writer/Extension/ITunes/Renderer/Feed.php | 12 +- src/Writer/Extension/Renderer.php | 4 +- src/Writer/Extension/Slash/Renderer/Entry.php | 12 +- .../Extension/Threading/Renderer/Entry.php | 12 +- .../WellFormedWeb/Renderer/Entry.php | 10 - src/Writer/Renderer/Entry/AtomDeleted.php | 21 +- src/Writer/Renderer/Entry/Rss.php | 2 +- src/Writer/Renderer/Feed/AtomSource.php | 16 - src/Writer/Renderer/Feed/Rss.php | 6 +- src/Writer/Source.php | 10 - src/Writer/Writer.php | 60 +- test/Writer/Renderer/Entry/RSSTest.php | 362 --------- 40 files changed, 77 insertions(+), 1689 deletions(-) delete mode 100644 src/Reader/Feed/RSS.php delete mode 100644 test/Writer/Renderer/Entry/RSSTest.php diff --git a/src/Reader/Collection/Author.php b/src/Reader/Collection/Author.php index 5fa9fff9..979349bb 100644 --- a/src/Reader/Collection/Author.php +++ b/src/Reader/Collection/Author.php @@ -25,21 +25,12 @@ namespace Zend\Feed\Reader\Collection; /** -<<<<<<< HEAD * @uses \Zend\Feed\Reader\Collection\AbstractCollection * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -======= - * @uses \Zend\Feed\Reader\Collection\AbstractCollection - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ ->>>>>>> master class Author extends AbstractCollection { diff --git a/src/Reader/Collection/Category.php b/src/Reader/Collection/Category.php index fb852148..fd172c03 100644 --- a/src/Reader/Collection/Category.php +++ b/src/Reader/Collection/Category.php @@ -25,21 +25,12 @@ namespace Zend\Feed\Reader\Collection; /** -<<<<<<< HEAD * @uses \Zend\Feed\Reader\Collection\CollectionAbstract * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -======= - * @uses \Zend\Feed\Reader\Collection\AbstractCollection - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ ->>>>>>> master class Category extends AbstractCollection { diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index 49219f12..9169f14d 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -26,7 +26,6 @@ use Zend\Feed\Reader; /** -<<<<<<< HEAD * @uses \Zend\Feed\Reader\Reader * @uses \Zend\Feed\Reader\Entry\AbstractEntry * @uses \Zend\Feed\Reader\Entry @@ -37,18 +36,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Atom extends AbstractEntry implements Reader\Entry -======= - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\AbstractEntry - * @uses \Zend\Feed\Reader\Entry - * @uses \Zend\Feed\Reader\Extension\Atom\Entry - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Atom extends Reader\AbstractEntry ->>>>>>> master { /** * XPath query diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index ae470763..f6b0d6f5 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -26,7 +26,6 @@ use Zend\Feed\Reader; use Zend\Date; use Zend\Feed\Reader\Collection; -<<<<<<< HEAD use Zend\Feed\Reader\Extension; use Zend\URI; @@ -46,26 +45,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Entry extends Extension\AbstractEntry -======= -use Zend\Uri; - -/** - * @uses DOMDocument - * @uses stdClass - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Feed\Atom\Source - * @uses \Zend\Feed\Reader\Collection\Author - * @uses \Zend\Feed\Reader\Collection\Category - * @uses \Zend\Feed\Reader\Extension\AbstractEntry - * @uses \Zend\Uri\Uri - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Entry extends Reader\Extension\AbstractEntry ->>>>>>> master { /** * Get the specified author diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index f1105b4a..5d9cd68e 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -26,7 +26,6 @@ use Zend\Feed\Reader; use Zend\Date; use Zend\Feed\Reader\Collection; -<<<<<<< HEAD use Zend\Feed\Reader\Extension; use Zend\URI; @@ -43,23 +42,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Feed extends Extension\AbstractFeed -======= -use Zend\Uri; - -/** - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Collection\Author - * @uses \Zend\Feed\Reader\Collection\Category - * @uses \Zend\Feed\Reader\Extension\AbstractFeed - * @uses \Zend\Uri\Uri - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Feed extends Reader\Extension\AbstractFeed ->>>>>>> master { /** * Get a single author diff --git a/src/Reader/Extension/Content/Entry.php b/src/Reader/Extension/Content/Entry.php index 3f61e707..f3f8b66a 100644 --- a/src/Reader/Extension/Content/Entry.php +++ b/src/Reader/Extension/Content/Entry.php @@ -27,7 +27,6 @@ use Zend\Feed\Reader\Extension; /** -<<<<<<< HEAD * @uses \Zend\Feed\Reader\Reader * @uses Reader\Reader_Entry_EntryAbstract * @category Zend @@ -36,16 +35,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Entry extends Extension\AbstractEntry -======= - * @uses \Zend\Feed\Reader\Reader - * @uses Zend\Feed\Reader\Entry\AbstractEntry - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Entry extends Reader\Extension\AbstractEntry ->>>>>>> master { public function getContent() diff --git a/src/Reader/Extension/CreativeCommons/Entry.php b/src/Reader/Extension/CreativeCommons/Entry.php index e07450c8..2de8f55a 100644 --- a/src/Reader/Extension/CreativeCommons/Entry.php +++ b/src/Reader/Extension/CreativeCommons/Entry.php @@ -27,7 +27,6 @@ use Zend\Feed\Reader\Extension; /** -<<<<<<< HEAD * @uses \Zend\Feed\Reader\Reader * @uses Reader\Reader_Entry_EntryAbstract * @category Zend @@ -36,16 +35,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Entry extends Extension\AbstractEntry -======= - * @uses \Zend\Feed\Reader\Extension\CreativeCommons\Feed - * @uses \Zend\Feed\Reader\Extension\AbstractEntry - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Entry extends \Zend\Feed\Reader\Extension\AbstractEntry ->>>>>>> master { /** * Get the entry license diff --git a/src/Reader/Extension/CreativeCommons/Feed.php b/src/Reader/Extension/CreativeCommons/Feed.php index e1bde5b6..82dbd185 100644 --- a/src/Reader/Extension/CreativeCommons/Feed.php +++ b/src/Reader/Extension/CreativeCommons/Feed.php @@ -27,7 +27,6 @@ use Zend\Feed\Reader\Extension; /** -<<<<<<< HEAD * @uses \Zend\Feed\Reader\Reader * @uses Reader\Reader_Entry_EntryAbstract * @category Zend @@ -36,15 +35,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Feed extends Extension\AbstractFeed -======= - * @uses \Zend\Feed\Reader\Extension\AbstractFeed - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Feed extends \Zend\Feed\Reader\Extension\AbstractFeed ->>>>>>> master { /** * Get the entry license diff --git a/src/Reader/Extension/Podcast/Entry.php b/src/Reader/Extension/Podcast/Entry.php index 223f58ad..3636469f 100644 --- a/src/Reader/Extension/Podcast/Entry.php +++ b/src/Reader/Extension/Podcast/Entry.php @@ -26,7 +26,6 @@ use Zend\Feed\Reader\Extension; /** -<<<<<<< HEAD * @uses \Zend\Feed\Reader\Reader * @uses \Zend\Feed\Reader\Extension\EntryAbstract * @category Zend @@ -35,16 +34,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Entry extends Extension\AbstractEntry -======= - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Extension\AbstractEntry - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Entry extends \Zend\Feed\Reader\Extension\AbstractEntry ->>>>>>> master { /** * Get the entry author diff --git a/src/Reader/Extension/Podcast/Feed.php b/src/Reader/Extension/Podcast/Feed.php index d4080a80..292e8f71 100644 --- a/src/Reader/Extension/Podcast/Feed.php +++ b/src/Reader/Extension/Podcast/Feed.php @@ -26,7 +26,6 @@ use Zend\Feed\Reader\Extension; /** -<<<<<<< HEAD * @uses \Zend\Feed\Reader\Reader * @uses \Zend\Feed\Reader\Extension\EntryAbstract * @category Zend @@ -35,15 +34,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Feed extends Extension\AbstractFeed -======= - * @uses \Zend\Feed\Reader\Extension\AbstractFeed - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Feed extends \Zend\Feed\Reader\Extension\AbstractFeed ->>>>>>> master { /** * Get the entry author diff --git a/src/Reader/Extension/Slash/Entry.php b/src/Reader/Extension/Slash/Entry.php index 38938d7b..43bf1184 100644 --- a/src/Reader/Extension/Slash/Entry.php +++ b/src/Reader/Extension/Slash/Entry.php @@ -26,7 +26,6 @@ use Zend\Feed\Reader\Extension; /** -<<<<<<< HEAD * @uses \Zend\Feed\Reader\Reader * @uses \Zend\Feed\Reader\Extension\EntryAbstract * @category Zend @@ -35,16 +34,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Entry extends Extension\AbstractEntry -======= - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Extension\AbstractEntry - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Entry extends \Zend\Feed\Reader\Extension\AbstractEntry ->>>>>>> master { /** * Get the entry section diff --git a/src/Reader/Extension/Thread/Entry.php b/src/Reader/Extension/Thread/Entry.php index abcfbda0..e81573cf 100644 --- a/src/Reader/Extension/Thread/Entry.php +++ b/src/Reader/Extension/Thread/Entry.php @@ -26,7 +26,6 @@ use Zend\Feed\Reader\Extension; /** -<<<<<<< HEAD * @uses \Zend\Feed\Reader\Reader * @uses \Zend\Feed\Reader\Extension\EntryAbstract * @category Zend @@ -35,15 +34,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Entry extends Extension\AbstractEntry -======= - * @uses \Zend\Feed\Reader\Extension\AbstractEntry - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Entry extends \Zend\Feed\Reader\Extension\AbstractEntry ->>>>>>> master { /** * Get the "in-reply-to" value diff --git a/src/Reader/Extension/WellFormedWeb/Entry.php b/src/Reader/Extension/WellFormedWeb/Entry.php index e692b4e0..1bfe9d35 100644 --- a/src/Reader/Extension/WellFormedWeb/Entry.php +++ b/src/Reader/Extension/WellFormedWeb/Entry.php @@ -26,7 +26,6 @@ use Zend\Feed\Reader\Extension; /** -<<<<<<< HEAD * @uses \Zend\Feed\Reader\Reader * @uses \Zend\Feed\Reader\Extension\EntryAbstract * @category Zend @@ -35,16 +34,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Entry extends Extension\AbstractEntry -======= - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Extension\AbstractEntry - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Entry extends \Zend\Feed\Reader\Extension\AbstractEntry ->>>>>>> master { /** * Get the entry comment Uri diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php index 5975127c..25c8cd31 100644 --- a/src/Reader/Feed/Atom/Source.php +++ b/src/Reader/Feed/Atom/Source.php @@ -23,7 +23,6 @@ * @namespace */ namespace Zend\Feed\Reader\Feed\Atom; -<<<<<<< HEAD use Zend\Feed\Reader; use Zend\Feed\Reader\Feed; use Zend\Date; @@ -38,30 +37,11 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Source extends Feed\Atom -======= - -use Zend\Feed\Reader\Feed\Atom, - Zend\Feed\Reader; - -/** - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Feed\Atom - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Source extends Atom ->>>>>>> master { /** * Constructor: Create a Source object which is largely just a normal -<<<<<<< HEAD - * Reader\Reader_FeedAbstract object only designed to retrieve feed level -======= * Zend\Feed\Reader\AbstractFeed object only designed to retrieve feed level ->>>>>>> master * metadata from an Atom entry's source element. * * @param DOMElement $source diff --git a/src/Reader/Feed/RSS.php b/src/Reader/Feed/RSS.php deleted file mode 100644 index bbf9e0de..00000000 --- a/src/Reader/Feed/RSS.php +++ /dev/null @@ -1,722 +0,0 @@ -getClassName('DublinCore\Feed'); - $this->_extensions['DublinCore\Feed'] = new $dublinCoreClass($dom, $this->_data['type'], $this->_xpath); - $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\Feed'); - $this->_extensions['Atom\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $xpathPrefix = '/rss/channel'; - } else { - $xpathPrefix = '/rdf:RDF/rss:channel'; - } - foreach ($this->_extensions as $extension) { - $extension->setXpathPrefix($xpathPrefix); - } - } - - /** - * Get a single author - * - * @param int $index - * @return string|null - */ - public function getAuthor($index = 0) - { - $authors = $this->getAuthors(); - - if (isset($authors[$index])) { - return $authors[$index]; - } - - return null; - } - - /** - * Get an array with feed authors - * - * @return array - */ - public function getAuthors() - { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; - } - - $authors = array(); - $authors_dc = $this->getExtension('DublinCore')->getAuthors(); - if (!empty($authors_dc)) { - foreach ($authors_dc as $author) { - $authors[] = array( - 'name' => $author['name'] - ); - } - } - - /** - * Technically RSS doesn't specific author element use at the feed level - * but it's supported on a "just in case" basis. - */ - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $list = $this->_xpath->query('//author'); - } else { - $list = $this->_xpath->query('//rss:author'); - } - if ($list->length) { - foreach ($list as $author) { - $string = trim($author->nodeValue); - $email = null; - $name = null; - $data = array(); - // Pretty rough parsing - but it's a catchall - if (preg_match("/^.*@[^ ]*/", $string, $matches)) { - $data['email'] = trim($matches[0]); - if (preg_match('/\((.*)\)$/', $string, $matches)) { - $data['name'] = $matches[1]; - } - $authors[] = $data; - } - } - } - - if (count($authors) == 0) { - $authors = $this->getExtension('Atom')->getAuthors(); - } else { - $authors = new Reader\Collection\Author( - Reader\Reader::arrayUnique($authors) - ); - } - - if (count($authors) == 0) { - $authors = null; - } - - $this->_data['authors'] = $authors; - - return $this->_data['authors']; - } - - /** - * Get the copyright entry - * - * @return string|null - */ - public function getCopyright() - { - if (array_key_exists('copyright', $this->_data)) { - return $this->_data['copyright']; - } - - $copyright = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $copyright = $this->_xpath->evaluate('string(/rss/channel/copyright)'); - } - - if (!$copyright && !is_null($this->getExtension('DublinCore'))) { - $copyright = $this->getExtension('DublinCore')->getCopyright(); - } - - if (empty($copyright)) { - $copyright = $this->getExtension('Atom')->getCopyright(); - } - - if (!$copyright) { - $copyright = null; - } - - $this->_data['copyright'] = $copyright; - - return $this->_data['copyright']; - } - - /** - * Get the feed creation date - * - * @return string|null - */ - public function getDateCreated() - { - return $this->getDateModified(); - } - - /** - * Get the feed modification date - * - * @return \Zend\Date\Date - */ - public function getDateModified() - { - if (array_key_exists('datemodified', $this->_data)) { - return $this->_data['datemodified']; - } - - $dateModified = null; - $date = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $dateModified = $this->_xpath->evaluate('string(/rss/channel/pubDate)'); - if (!$dateModified) { - $dateModified = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)'); - } - if ($dateModified) { - $dateModifiedParsed = strtotime($dateModified); - if ($dateModifiedParsed) { - $date = new Date\Date($dateModifiedParsed); - } else { - $dateStandards = array( - Date\Date::RSS, Date\Date::RFC_822, - Date\Date::RFC_2822, Date\Date::DATES, - ); - $date = new Date\Date; - foreach ($dateStandards as $standard) { - try { - $date->set($dateModified, $standard); - break; - } catch (Date\Exception $e) { - if ($standard == Date\Date::DATES) { - throw new \Zend\Feed\Exception( - 'Could not load date due to unrecognised' - .' format (should follow RFC 822 or 2822):' - . $e->getMessage(), - 0, $e - ); - } - } - } - } - } - } - - if (!$date) { - $date = $this->getExtension('DublinCore')->getDate(); - } - - if (!$date) { - $date = $this->getExtension('Atom')->getDateModified(); - } - - if (!$date) { - $date = null; - } - - $this->_data['datemodified'] = $date; - - return $this->_data['datemodified']; - } - - /** - * Get the feed lastBuild date - * - * @return Zend\Date\Date - */ - public function getLastBuildDate() - { - if (array_key_exists('lastBuildDate', $this->_data)) { - return $this->_data['lastBuildDate']; - } - - $lastBuildDate = null; - $date = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $lastBuildDate = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)'); - if ($lastBuildDate) { - $lastBuildDateParsed = strtotime($lastBuildDate); - if ($lastBuildDateParsed) { - $date = new Date\Date($lastBuildDateParsed); - } else { - $dateStandards = array(Date\Date::RSS, Date\Date::RFC_822, - Date\Date::RFC_2822, Date\Date::DATES); - $date = new Date\Date; - foreach ($dateStandards as $standard) { - try { - $date->set($lastBuildDate, $standard); - break; - } catch (Date\Exception $e) { - if ($standard == Date\Date::DATES) { - throw new \Zend\Feed\Exception( - 'Could not load date due to unrecognised' - .' format (should follow RFC 822 or 2822):' - . $e->getMessage(), - 0, $e - ); - } - } - } - } - } - } - - if (!$date) { - $date = null; - } - - $this->_data['lastBuildDate'] = $date; - - return $this->_data['lastBuildDate']; - } - - /** - * Get the feed description - * - * @return string|null - */ - public function getDescription() - { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; - } - - $description = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $description = $this->_xpath->evaluate('string(/rss/channel/description)'); - } else { - $description = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:description)'); - } - - if (!$description && !is_null($this->getExtension('DublinCore'))) { - $description = $this->getExtension('DublinCore')->getDescription(); - } - - if (empty($description)) { - $description = $this->getExtension('Atom')->getDescription(); - } - - if (!$description) { - $description = null; - } - - $this->_data['description'] = $description; - - return $this->_data['description']; - } - - /** - * Get the feed ID - * - * @return string|null - */ - public function getId() - { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; - } - - $id = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $id = $this->_xpath->evaluate('string(/rss/channel/guid)'); - } - - if (!$id && !is_null($this->getExtension('DublinCore'))) { - $id = $this->getExtension('DublinCore')->getId(); - } - - if (empty($id)) { - $id = $this->getExtension('Atom')->getId(); - } - - if (!$id) { - if ($this->getLink()) { - $id = $this->getLink(); - } elseif ($this->getTitle()) { - $id = $this->getTitle(); - } else { - $id = null; - } - } - - $this->_data['id'] = $id; - - return $this->_data['id']; - } - - /** - * Get the feed image data - * - * @return array|null - */ - public function getImage() - { - if (array_key_exists('image', $this->_data)) { - return $this->_data['image']; - } - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $list = $this->_xpath->query('/rss/channel/image'); - $prefix = '/rss/channel/image[1]'; - } else { - $list = $this->_xpath->query('/rdf:RDF/rss:channel/rss:image'); - $prefix = '/rdf:RDF/rss:channel/rss:image[1]'; - } - if ($list->length > 0) { - $image = array(); - $value = $this->_xpath->evaluate('string(' . $prefix . '/url)'); - if ($value) { - $image['uri'] = $value; - } - $value = $this->_xpath->evaluate('string(' . $prefix . '/link)'); - if ($value) { - $image['link'] = $value; - } - $value = $this->_xpath->evaluate('string(' . $prefix . '/title)'); - if ($value) { - $image['title'] = $value; - } - $value = $this->_xpath->evaluate('string(' . $prefix . '/height)'); - if ($value) { - $image['height'] = $value; - } - $value = $this->_xpath->evaluate('string(' . $prefix . '/width)'); - if ($value) { - $image['width'] = $value; - } - $value = $this->_xpath->evaluate('string(' . $prefix . '/description)'); - if ($value) { - $image['description'] = $value; - } - } else { - $image = null; - } - - $this->_data['image'] = $image; - - return $this->_data['image']; - } - - /** - * Get the feed language - * - * @return string|null - */ - public function getLanguage() - { - if (array_key_exists('language', $this->_data)) { - return $this->_data['language']; - } - - $language = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $language = $this->_xpath->evaluate('string(/rss/channel/language)'); - } - - if (!$language && !is_null($this->getExtension('DublinCore'))) { - $language = $this->getExtension('DublinCore')->getLanguage(); - } - - if (empty($language)) { - $language = $this->getExtension('Atom')->getLanguage(); - } - - if (!$language) { - $language = $this->_xpath->evaluate('string(//@xml:lang[1])'); - } - - if (!$language) { - $language = null; - } - - $this->_data['language'] = $language; - - return $this->_data['language']; - } - - /** - * Get a link to the feed - * - * @return string|null - */ - public function getLink() - { - if (array_key_exists('link', $this->_data)) { - return $this->_data['link']; - } - - $link = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $link = $this->_xpath->evaluate('string(/rss/channel/link)'); - } else { - $link = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:link)'); - } - - if (empty($link)) { - $link = $this->getExtension('Atom')->getLink(); - } - - if (!$link) { - $link = null; - } - - $this->_data['link'] = $link; - - return $this->_data['link']; - } - - /** - * Get a link to the feed XML - * - * @return string|null - */ - public function getFeedLink() - { - if (array_key_exists('feedlink', $this->_data)) { - return $this->_data['feedlink']; - } - - $link = null; - - $link = $this->getExtension('Atom')->getFeedLink(); - - if (is_null($link) || empty($link)) { - $link = $this->getOriginalSourceUri(); - } - - $this->_data['feedlink'] = $link; - - return $this->_data['feedlink']; - } - - /** - * Get the feed generator entry - * - * @return string|null - */ - public function getGenerator() - { - if (array_key_exists('generator', $this->_data)) { - return $this->_data['generator']; - } - - $generator = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $generator = $this->_xpath->evaluate('string(/rss/channel/generator)'); - } - - if (!$generator) { - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $generator = $this->_xpath->evaluate('string(/rss/channel/atom:generator)'); - } else { - $generator = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/atom:generator)'); - } - } - - if (empty($generator)) { - $generator = $this->getExtension('Atom')->getGenerator(); - } - - if (!$generator) { - $generator = null; - } - - $this->_data['generator'] = $generator; - - return $this->_data['generator']; - } - - /** - * Get the feed title - * - * @return string|null - */ - public function getTitle() - { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; - } - - $title = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $title = $this->_xpath->evaluate('string(/rss/channel/title)'); - } else { - $title = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:title)'); - } - - if (!$title && !is_null($this->getExtension('DublinCore'))) { - $title = $this->getExtension('DublinCore')->getTitle(); - } - - if (!$title) { - $title = $this->getExtension('Atom')->getTitle(); - } - - if (!$title) { - $title = null; - } - - $this->_data['title'] = $title; - - return $this->_data['title']; - } - - /** - * Get an array of any supported Pusubhubbub endpoints - * - * @return array|null - */ - public function getHubs() - { - if (array_key_exists('hubs', $this->_data)) { - return $this->_data['hubs']; - } - - $hubs = $this->getExtension('Atom')->getHubs(); - - if (empty($hubs)) { - $hubs = null; - } else { - $hubs = array_unique($hubs); - } - - $this->_data['hubs'] = $hubs; - - return $this->_data['hubs']; - } - - /** - * Get all categories - * - * @return \Zend\Feed\Reader\Collection\Category - */ - public function getCategories() - { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; - } - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $list = $this->_xpath->query('/rss/channel//category'); - } else { - $list = $this->_xpath->query('/rdf:RDF/rss:channel//rss:category'); - } - - if ($list->length) { - $categoryCollection = new Reader\Collection\Category; - foreach ($list as $category) { - $categoryCollection[] = array( - 'term' => $category->nodeValue, - 'scheme' => $category->getAttribute('domain'), - 'label' => $category->nodeValue, - ); - } - } else { - $categoryCollection = $this->getExtension('DublinCore')->getCategories(); - } - - if (count($categoryCollection) == 0) { - $categoryCollection = $this->getExtension('Atom')->getCategories(); - } - - $this->_data['categories'] = $categoryCollection; - - return $this->_data['categories']; - } - - /** - * Read all entries to the internal entries array - * - */ - 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 { - $entries = $this->_xpath->evaluate('//rss:item'); - } - - foreach($entries as $index=>$entry) { - $this->_entries[$index] = $entry; - } - } - - /** - * Register the default namespaces for the current feed format - * - */ - protected function _registerNamespaces() - { - switch ($this->_data['type']) { - case Reader\Reader::TYPE_RSS_10: - $this->_xpath->registerNamespace('rdf', Reader\Reader::NAMESPACE_RDF); - $this->_xpath->registerNamespace('rss', Reader\Reader::NAMESPACE_RSS_10); - break; - - case Reader\Reader::TYPE_RSS_090: - $this->_xpath->registerNamespace('rdf', Reader\Reader::NAMESPACE_RDF); - $this->_xpath->registerNamespace('rss', Reader\Reader::NAMESPACE_RSS_090); - break; - } - } -} diff --git a/src/Reader/Reader.php b/src/Reader/Reader.php index 26fdff69..f1e7315f 100644 --- a/src/Reader/Reader.php +++ b/src/Reader/Reader.php @@ -33,7 +33,7 @@ * @uses \Zend\Feed\Reader\Feed\Atom\Atom * @uses \Zend\Feed\Reader\Feed\RSS * @uses \Zend\HTTP\Client -* @uses \Zend\Loader\PluginLoader\PluginLoader +* @uses \Zend\Loader\PluginLoader * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -481,9 +481,9 @@ public static function detectType($feed, $specOnly = false) /** * Set plugin loader for use with Extensions * - * @param Zend_Loader_PluginLoader_Interface $loader + * @param \Zend\Loader\ShortNameLocater $loader */ - public static function setPluginLoader(PluginLoader\PluginLoaderInterface $loader) + public static function setPluginLoader(Loader\ShortNameLocater $loader) { self::$_pluginLoader = $loader; } @@ -512,9 +512,12 @@ public static function getPluginLoader() */ public static function addPrefixPath($prefix, $path) { - $prefix = rtrim($prefix, '\\'); - $path = rtrim($path, DIRECTORY_SEPARATOR); - self::getPluginLoader()->addPrefixPath($prefix, $path); + $pluginLoader = self::getPluginLoader(); + if ($pluginLoader instanceof Loader\PrefixPathMapper) { + $prefix = rtrim($prefix, '\\'); + $path = rtrim($path, DIRECTORY_SEPARATOR); + $pluginLoader->addPrefixPath($prefix, $path); + } } /** @@ -525,6 +528,10 @@ public static function addPrefixPath($prefix, $path) */ public static function addPrefixPaths(array $spec) { + $pluginLoader = self::getPluginLoader(); + if (!$pluginLoader instanceof Loader\PrefixPathMapper) { + return; + } if (isset($spec['prefix']) && isset($spec['path'])) { self::addPrefixPath($spec['prefix'], $spec['path']); } @@ -540,12 +547,12 @@ public static function addPrefixPaths(array $spec) * * @param string $name * @return void - * @throws Zend_Feed_Exception if unable to resolve Extension class + * @throws \Zend\Feed\Exception if unable to resolve Extension class */ public static function registerExtension($name) { - $feedName = $name . '\\Feed'; - $entryName = $name . '\\Entry'; + $feedName = $name . '\Feed'; + $entryName = $name . '\Entry'; if (self::isRegistered($name)) { if (self::getPluginLoader()->isLoaded($feedName) || self::getPluginLoader()->isLoaded($entryName)) { @@ -555,19 +562,18 @@ public static function registerExtension($name) try { self::getPluginLoader()->load($feedName); self::$_extensions['feed'][] = $feedName; - } catch (PluginLoader\Exception $e) { + } catch (Loader\PluginLoaderException $e) { } try { self::getPluginLoader()->load($entryName); self::$_extensions['entry'][] = $entryName; - } catch (PluginLoader\Exception $e) { + } catch (Loader\PluginLoaderException $e) { } if (!self::getPluginLoader()->isLoaded($feedName) && !self::getPluginLoader()->isLoaded($entryName) ) { - throw new Exception('Could not load extension: ' . $name - . ' using Plugin Loader. Check prefix paths are configured and' - . ' extension exists.'); + throw new \Zend\Feed\Exception('Could not load extension: ' . $name + . 'using Plugin Loader. Check prefix paths are configured and extension exists.'); } } diff --git a/src/Writer/AbstractFeed.php b/src/Writer/AbstractFeed.php index eec939d5..3d2bf4a4 100644 --- a/src/Writer/AbstractFeed.php +++ b/src/Writer/AbstractFeed.php @@ -23,7 +23,7 @@ * @namespace */ namespace Zend\Feed\Writer; -use Zend\URI; +use Zend\Uri; use Zend\Date; /** @@ -89,7 +89,7 @@ public function addAuthor($name, $email = null, $uri = null) $author['email'] = $name['email']; } if (isset($name['uri'])) { - if (empty($name['uri']) || !is_string($name['uri']) || !URI\URL::validate($name['uri'])) { + if (empty($name['uri']) || !is_string($name['uri']) || !Uri\Url::validate($name['uri'])) { throw new Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $name['uri']; @@ -106,7 +106,7 @@ public function addAuthor($name, $email = null, $uri = null) $author['email'] = $email; } if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !URI\URL::validate($uri)) { + if (empty($uri) || !is_string($uri) || !Uri\Url::validate($uri)) { throw new Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); } $author['uri'] = $uri; @@ -233,7 +233,7 @@ public function setGenerator($name, $version = null, $uri = null) $generator['version'] = $data['version']; } if (isset($data['uri'])) { - if (empty($data['uri']) || !is_string($data['uri']) || !URI\URL::validate($data['uri'])) { + if (empty($data['uri']) || !is_string($data['uri']) || !Uri\Url::validate($data['uri'])) { throw new Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); } $generator['uri'] = $data['uri']; @@ -250,7 +250,7 @@ public function setGenerator($name, $version = null, $uri = null) $generator['version'] = $version; } if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !URI\URL::validate($uri)) { + if (empty($uri) || !is_string($uri) || !Uri\Url::validate($uri)) { throw new Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); } $generator['uri'] = $uri; @@ -266,7 +266,7 @@ public function setGenerator($name, $version = null, $uri = null) */ public function setId($id) { - if ((empty($id) || !is_string($id) || !URI\URL::validate($id)) && + if ((empty($id) || !is_string($id) || !Uri\Url::validate($id)) && !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id)) { throw new Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } @@ -284,7 +284,7 @@ public function setId($id) public function setImage(array $data) { if (empty($data['uri']) || !is_string($data['uri']) - || !URI\URL::validate($data['uri'])) { + || !Uri\Url::validate($data['uri'])) { throw new Exception('Invalid parameter: parameter \'uri\'' . ' must be a non-empty string and valid URI/IRI'); } @@ -311,7 +311,7 @@ public function setLanguage($language) */ public function setLink($link) { - if (empty($link) || !is_string($link) || !URI\URL::validate($link)) { + if (empty($link) || !is_string($link) || !Uri\Url::validate($link)) { throw new Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['link'] = $link; @@ -324,7 +324,7 @@ public function setLink($link) */ public function setFeedLink($link, $type) { - if (empty($link) || !is_string($link) || !URI\URL::validate($link)) { + if (empty($link) || !is_string($link) || !Uri\Url::validate($link)) { throw new Exception('Invalid parameter: "link"" must be a non-empty string and valid URI/IRI'); } if (!in_array(strtolower($type), array('rss', 'rdf', 'atom'))) { @@ -366,7 +366,7 @@ public function setEncoding($encoding) */ public function setBaseUrl($url) { - if (empty($url) || !is_string($url) || !URI\URL::validate($url)) { + if (empty($url) || !is_string($url) || !Uri\Url::validate($url)) { throw new Exception('Invalid parameter: "url" array value' . ' must be a non-empty string and valid URI/IRI'); } @@ -380,7 +380,7 @@ public function setBaseUrl($url) */ public function addHub($url) { - if (empty($url) || !is_string($url) || !URI\URL::validate($url)) { + if (empty($url) || !is_string($url) || !Uri\Url::validate($url)) { throw new Exception('Invalid parameter: "url" array value' . ' must be a non-empty string and valid URI/IRI'); } @@ -417,7 +417,7 @@ public function addCategory(array $category) if (isset($category['scheme'])) { if (empty($category['scheme']) || !is_string($category['scheme']) - || !URI\URL::validate($category['scheme']) + || !Uri\Url::validate($category['scheme']) ) { throw new Exception('The Atom scheme or RSS domain of' . ' a category must be a valid URI'); diff --git a/src/Writer/Deleted.php b/src/Writer/Deleted.php index e473d524..897d506c 100644 --- a/src/Writer/Deleted.php +++ b/src/Writer/Deleted.php @@ -23,14 +23,8 @@ * @namespace */ namespace Zend\Feed\Writer; -<<<<<<< HEAD use Zend\Date; -use Zend\URI; -======= - -use Zend\Feed\Exception as FeedException, - Zend\Date; ->>>>>>> master +use Zend\Uri; /** * @uses \Zend\Date\Date @@ -67,11 +61,7 @@ class Deleted public function setEncoding($encoding) { if (empty($encoding) || !is_string($encoding)) { -<<<<<<< HEAD throw new Exception('Invalid parameter: parameter must be a non-empty string'); -======= - throw new FeedException('Invalid parameter: parameter must be a non-empty string'); ->>>>>>> master } $this->_data['encoding'] = $encoding; } @@ -126,11 +116,7 @@ public function getType() public function setReference($reference) { if (empty($reference) || !is_string($reference)) { -<<<<<<< HEAD throw new Exception('Invalid parameter: reference must be a non-empty string'); -======= - throw new FeedException('Invalid parameter: reference must be a non-empty string'); ->>>>>>> master } $this->_data['reference'] = $reference; } @@ -153,12 +139,8 @@ public function setWhen($date = null) } elseif ($date instanceof Date\Date) { $zdate = $date; } else { -<<<<<<< HEAD throw new Exception('Invalid Date\Date object or UNIX Timestamp' . ' passed as parameter'); -======= - throw new FeedException('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); ->>>>>>> master } $this->_data['when'] = $zdate; } @@ -178,38 +160,24 @@ public function setBy(array $by) || empty($by['name']) || !is_string($by['name']) ) { -<<<<<<< HEAD throw new Exception('Invalid parameter: author array must include a' . ' "name" key with a non-empty string value'); -======= - throw new FeedException('Invalid parameter: author array must include a "name" key with a non-empty string value'); ->>>>>>> master } $author['name'] = $by['name']; if (isset($by['email'])) { if (empty($by['email']) || !is_string($by['email'])) { -<<<<<<< HEAD throw new Exception('Invalid parameter: "email" array' . ' value must be a non-empty string'); -======= - throw new FeedException('Invalid parameter: "email" array value must be a non-empty string'); ->>>>>>> master } $author['email'] = $by['email']; } if (isset($by['uri'])) { if (empty($by['uri']) || !is_string($by['uri']) -<<<<<<< HEAD - || !URI\URL::validate($by['uri']) + || !Uri\Url::validate($by['uri']) ) { throw new Exception('Invalid parameter: "uri" array value must' . ' be a non-empty string and valid URI/IRI'); -======= - || !\Zend\Uri\Url::validate($by['uri']) - ) { - throw new FeedException('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); ->>>>>>> master } $author['uri'] = $by['uri']; } diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index 046c631d..eeb9bb63 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -23,14 +23,8 @@ * @namespace */ namespace Zend\Feed\Writer; -<<<<<<< HEAD use Zend\Feed\Writer\Exception; -use Zend\URI; -======= - -use Zend\Feed\Exception as FeedException; use Zend\Uri; ->>>>>>> master use Zend\Date; /** @@ -95,35 +89,21 @@ public function addAuthor($name, $email = null, $uri = null) || empty($name['name']) || !is_string($name['name']) ) { -<<<<<<< HEAD throw new Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); -======= - throw new FeedException('Invalid parameter: author array must include a "name" key with a non-empty string value'); ->>>>>>> master } $author['name'] = $name['name']; if (isset($name['email'])) { if (empty($name['email']) || !is_string($name['email'])) { -<<<<<<< HEAD throw new Exception('Invalid parameter: "email" array value must be a non-empty string'); -======= - throw new FeedException('Invalid parameter: "email" array value must be a non-empty string'); ->>>>>>> master } $author['email'] = $name['email']; } if (isset($name['uri'])) { if (empty($name['uri']) || !is_string($name['uri']) -<<<<<<< HEAD - || !URI\URL::validate($name['uri']) + || !Uri\Url::validate($name['uri']) ) { throw new Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); -======= - || !\Zend\Uri\Url::validate($name['uri']) - ) { - throw new FeedException('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); ->>>>>>> master } $author['uri'] = $name['uri']; } @@ -133,31 +113,18 @@ public function addAuthor($name, $email = null, $uri = null) */ } else { if (empty($name['name']) || !is_string($name['name'])) { -<<<<<<< HEAD throw new Exception('Invalid parameter: "name" must be a non-empty string value'); -======= - throw new FeedException('Invalid parameter: "name" must be a non-empty string value'); ->>>>>>> master } $author['name'] = $name; if (isset($email)) { if (empty($email) || !is_string($email)) { -<<<<<<< HEAD throw new Exception('Invalid parameter: "email" value must be a non-empty string'); -======= - throw new FeedException('Invalid parameter: "email" value must be a non-empty string'); ->>>>>>> master } $author['email'] = $email; } if (isset($uri)) { -<<<<<<< HEAD - if (empty($uri) || !is_string($uri) || !URI\URL::validate($uri)) { + if (empty($uri) || !is_string($uri) || !Uri\Url::validate($uri)) { throw new Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); -======= - if (empty($uri) || !is_string($uri) || !\Zend\Uri\Url::validate($uri)) { - throw new FeedException('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); ->>>>>>> master } $author['uri'] = $uri; } @@ -185,11 +152,7 @@ public function addAuthors(array $authors) public function setEncoding($encoding) { if (empty($encoding) || !is_string($encoding)) { -<<<<<<< HEAD throw new Exception('Invalid parameter: parameter must be a non-empty string'); -======= - throw new FeedException('Invalid parameter: parameter must be a non-empty string'); ->>>>>>> master } $this->_data['encoding'] = $encoding; } @@ -215,11 +178,7 @@ public function getEncoding() public function setCopyright($copyright) { if (empty($copyright) || !is_string($copyright)) { -<<<<<<< HEAD throw new Exception('Invalid parameter: parameter must be a non-empty string'); -======= - throw new FeedException('Invalid parameter: parameter must be a non-empty string'); ->>>>>>> master } $this->_data['copyright'] = $copyright; } @@ -232,11 +191,7 @@ public function setCopyright($copyright) public function setContent($content) { if (empty($content) || !is_string($content)) { -<<<<<<< HEAD throw new Exception('Invalid parameter: parameter must be a non-empty string'); -======= - throw new FeedException('Invalid parameter: parameter must be a non-empty string'); ->>>>>>> master } $this->_data['content'] = $content; } @@ -256,11 +211,7 @@ public function setDateCreated($date = null) } elseif ($date instanceof Date\Date) { $zdate = $date; } else { -<<<<<<< HEAD - throw new Exception('Invalid Date\Date object or UNIX Timestamp passed as parameter'); -======= - throw new FeedException('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); ->>>>>>> master + throw new Exception('Invalid Zend\Date\Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateCreated'] = $zdate; } @@ -280,11 +231,7 @@ public function setDateModified($date = null) } elseif ($date instanceof Date\Date) { $zdate = $date; } else { -<<<<<<< HEAD throw new Exception('Invalid Date\Date object or UNIX Timestamp passed as parameter'); -======= - throw new FeedException('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); ->>>>>>> master } $this->_data['dateModified'] = $zdate; } @@ -297,11 +244,7 @@ public function setDateModified($date = null) public function setDescription($description) { if (empty($description) || !is_string($description)) { -<<<<<<< HEAD throw new Exception('Invalid parameter: parameter must be a non-empty string'); -======= - throw new FeedException('Invalid parameter: parameter must be a non-empty string'); ->>>>>>> master } $this->_data['description'] = $description; } @@ -314,11 +257,7 @@ public function setDescription($description) public function setId($id) { if (empty($id) || !is_string($id)) { -<<<<<<< HEAD throw new Exception('Invalid parameter: parameter must be a non-empty string'); -======= - throw new FeedException('Invalid parameter: parameter must be a non-empty string'); ->>>>>>> master } $this->_data['id'] = $id; } @@ -330,13 +269,8 @@ public function setId($id) */ public function setLink($link) { -<<<<<<< HEAD - if (empty($link) || !is_string($link) || !URI\URL::validate($link)) { + if (empty($link) || !is_string($link) || !Uri\Url::validate($link)) { throw new Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); -======= - if (empty($link) || !is_string($link) || !\Zend\Uri\Url::validate($link)) { - throw new FeedException('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); ->>>>>>> master } $this->_data['link'] = $link; } @@ -349,11 +283,7 @@ public function setLink($link) public function setCommentCount($count) { if (empty($count) || !is_numeric($count) || (int) $count < 0) { -<<<<<<< HEAD throw new Exception('Invalid parameter: "count" must be a non-empty integer number'); -======= - throw new FeedException('Invalid parameter: "count" must be a non-empty integer number'); ->>>>>>> master } $this->_data['commentCount'] = (int) $count; } @@ -365,13 +295,8 @@ public function setCommentCount($count) */ public function setCommentLink($link) { -<<<<<<< HEAD - if (empty($link) || !is_string($link) || !URI\URL::validate($link)) { + if (empty($link) || !is_string($link) || !Uri\Url::validate($link)) { throw new Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); -======= - if (empty($link) || !is_string($link) || !\Zend\Uri\Url::validate($link)) { - throw new FeedException('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); ->>>>>>> master } $this->_data['commentLink'] = $link; } @@ -383,19 +308,11 @@ public function setCommentLink($link) */ public function setCommentFeedLink(array $link) { -<<<<<<< HEAD - if (!isset($link['uri']) || !is_string($link['uri']) || !URI\URL::validate($link['uri'])) { + if (!isset($link['uri']) || !is_string($link['uri']) || !Uri\Url::validate($link['uri'])) { throw new Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); } if (!isset($link['type']) || !in_array($link['type'], array('atom', 'rss', 'rdf'))) { throw new Exception('Invalid parameter: "type" must be one' -======= - if (!isset($link['uri']) || !is_string($link['uri']) || !\Zend\Uri\Url::validate($link['uri'])) { - throw new FeedException('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); - } - if (!isset($link['type']) || !in_array($link['type'], array('atom', 'rss', 'rdf'))) { - throw new FeedException('Invalid parameter: "type" must be one' ->>>>>>> master . ' of "atom", "rss" or "rdf"'); } if (!isset($this->_data['commentFeedLinks'])) { @@ -426,11 +343,7 @@ public function setCommentFeedLinks(array $links) public function setTitle($title) { if (empty($title) || !is_string($title)) { -<<<<<<< HEAD throw new Exception('Invalid parameter: parameter must be a non-empty string'); -======= - throw new FeedException('Invalid parameter: parameter must be a non-empty string'); ->>>>>>> master } $this->_data['title'] = $title; } @@ -614,26 +527,16 @@ public function getCommentFeedLinks() public function addCategory(array $category) { if (!isset($category['term'])) { -<<<<<<< HEAD throw new Exception('Each category must be an array and ' -======= - throw new FeedException('Each category must be an array and ' ->>>>>>> master . 'contain at least a "term" element containing the machine ' . ' readable category name'); } if (isset($category['scheme'])) { if (empty($category['scheme']) || !is_string($category['scheme']) -<<<<<<< HEAD - || !URI\URL::validate($category['scheme']) + || !Uri\Url::validate($category['scheme']) ) { throw new Exception('The Atom scheme or RSS domain of' -======= - || !\Zend\Uri\Url::validate($category['scheme']) - ) { - throw new FeedException('The Atom scheme or RSS domain of' ->>>>>>> master . ' a category must be a valid URI'); } } @@ -679,17 +582,10 @@ public function getCategories() public function setEnclosure(array $enclosure) { if (!isset($enclosure['uri'])) { -<<<<<<< HEAD throw new Exception('Enclosure "uri" is not set'); } - if (!URI\URL::validate($enclosure['uri'])) { + if (!Uri\Url::validate($enclosure['uri'])) { throw new Exception('Enclosure "uri" is not a valid URI/IRI'); -======= - throw new FeedException('Enclosure "uri" is not set'); - } - if (!\Zend\Uri\Url::validate($enclosure['uri'])) { - throw new FeedException('Enclosure "uri" is not a valid URI/IRI'); ->>>>>>> master } $this->_data['enclosure'] = $enclosure; } @@ -781,11 +677,7 @@ public function __call($method, $args) } catch (InvalidMethodException $e) { } } -<<<<<<< HEAD throw new Exception('Method: ' . $method -======= - throw new FeedException('Method: ' . $method ->>>>>>> master . ' does not exist and could not be located on a registered Extension'); } diff --git a/src/Writer/Exception/InvalidMethodException.php b/src/Writer/Exception/InvalidMethodException.php index f6c4f933..c0a87573 100644 --- a/src/Writer/Exception/InvalidMethodException.php +++ b/src/Writer/Exception/InvalidMethodException.php @@ -20,6 +20,8 @@ * @version $Id: InvalidMethodException.php 20096 2010-01-06 02:05:09Z bkarwin $ */ +/* @namespace */ +namespace Zend\Feed\Writer\Exception; /** * @see Zend_Feed_Exception @@ -37,5 +39,5 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Feed_Writer_Exception_InvalidMethodException extends Zend_Exception +class InvalidMethodException extends \Zend\Exception {} diff --git a/src/Writer/Extension/AbstractRenderer.php b/src/Writer/Extension/AbstractRenderer.php index a3bc20fb..c8d66102 100644 --- a/src/Writer/Extension/AbstractRenderer.php +++ b/src/Writer/Extension/AbstractRenderer.php @@ -34,7 +34,7 @@ abstract class AbstractRenderer implements Renderer { /** - * @var DOMDocument + * @var \DOMDocument */ protected $_dom = null; @@ -59,7 +59,7 @@ abstract class AbstractRenderer implements Renderer protected $_type = null; /** - * @var DOMElement + * @var \DOMElement */ protected $_rootElement = null; @@ -106,8 +106,8 @@ public function getEncoding() /** * Set DOMDocument and DOMElement on which to operate * - * @param DOMDocument $dom - * @param DOMElement $base + * @param \DOMDocument $dom + * @param \DOMElement $base * @return Zend_Feed_Writer_Extension_RendererAbstract */ public function setDomDocument(\DOMDocument $dom, \DOMElement $base) diff --git a/src/Writer/Extension/Atom/Renderer/Feed.php b/src/Writer/Extension/Atom/Renderer/Feed.php index 473bfe7c..12b2f2af 100644 --- a/src/Writer/Extension/Atom/Renderer/Feed.php +++ b/src/Writer/Extension/Atom/Renderer/Feed.php @@ -26,23 +26,13 @@ use Zend\Feed\Writer\Extension; /** -<<<<<<< HEAD -* @uses \Zend\Feed\Writer\Extension\RendererAbstract +* @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Feed extends Extension\AbstractRenderer -======= - * @uses \Zend\Feed\Writer\Extension\AbstractRenderer - * @category Zend - * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Feed extends \Zend\Feed\Writer\Extension\AbstractRenderer ->>>>>>> master { /** diff --git a/src/Writer/Extension/Content/Renderer/Entry.php b/src/Writer/Extension/Content/Renderer/Entry.php index 0694af45..3f4567b2 100644 --- a/src/Writer/Extension/Content/Renderer/Entry.php +++ b/src/Writer/Extension/Content/Renderer/Entry.php @@ -26,23 +26,13 @@ use Zend\Feed\Writer\Extension; /** -<<<<<<< HEAD -* @uses \Zend\Feed\Writer\Extension\RendererAbstract +* @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Entry extends Extension\AbstractRenderer -======= - * @uses \Zend\Feed\Writer\Extension\AbstractRenderer - * @category Zend - * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Entry extends \Zend\Feed\Writer\Extension\AbstractRenderer ->>>>>>> master { /** diff --git a/src/Writer/Extension/DublinCore/Renderer/Entry.php b/src/Writer/Extension/DublinCore/Renderer/Entry.php index d8cbd912..6fb40a51 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Entry.php +++ b/src/Writer/Extension/DublinCore/Renderer/Entry.php @@ -26,23 +26,13 @@ use Zend\Feed\Writer\Extension; /** -<<<<<<< HEAD -* @uses \Zend\Feed\Writer\Extension\RendererAbstract +* @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Entry extends Extension\AbstractRenderer -======= - * @uses \Zend\Feed\Writer\Extension\AbstractRenderer - * @category Zend - * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Entry extends \Zend\Feed\Writer\Extension\AbstractRenderer ->>>>>>> master { /** diff --git a/src/Writer/Extension/DublinCore/Renderer/Feed.php b/src/Writer/Extension/DublinCore/Renderer/Feed.php index d7d45d00..3ed1b8f5 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Feed.php +++ b/src/Writer/Extension/DublinCore/Renderer/Feed.php @@ -26,23 +26,13 @@ use Zend\Feed\Writer\Extension; /** -<<<<<<< HEAD -* @uses \Zend\Feed\Writer\Extension\RendererAbstract +* @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Feed extends Extension\AbstractRenderer -======= - * @uses \Zend\Feed\Writer\Extension\AbstractRenderer - * @category Zend - * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Feed extends \Zend\Feed\Writer\Extension\AbstractRenderer ->>>>>>> master { /** diff --git a/src/Writer/Extension/ITunes/Entry.php b/src/Writer/Extension/ITunes/Entry.php index 0048312e..3dbb6eeb 100644 --- a/src/Writer/Extension/ITunes/Entry.php +++ b/src/Writer/Extension/ITunes/Entry.php @@ -28,7 +28,6 @@ /** -<<<<<<< HEAD * @uses \Zend\Feed\Exception * @uses \Zend\Feed\Writer\Writer * @uses \Zend\Feed\Writer\Exception\InvalidMethodException @@ -37,16 +36,6 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -======= - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Writer\Writer - * @uses \Zend\Feed\Writer\InvalidMethodException - * @category Zend - * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ ->>>>>>> master class Entry { /** @@ -240,11 +229,7 @@ public function __call($method, array $params) if (!method_exists($this, 'setItunes' . ucfirst($point)) && !method_exists($this, 'addItunes' . ucfirst($point)) ) { -<<<<<<< HEAD throw new Writer\Exception\InvalidMethodException( -======= - throw new \Zend\Feed\Writer\InvalidMethodException( ->>>>>>> master 'invalid method: ' . $method ); } diff --git a/src/Writer/Extension/ITunes/Feed.php b/src/Writer/Extension/ITunes/Feed.php index ba27f7f7..c7285ba9 100644 --- a/src/Writer/Extension/ITunes/Feed.php +++ b/src/Writer/Extension/ITunes/Feed.php @@ -23,9 +23,8 @@ * @namespace */ namespace Zend\Feed\Writer\Extension\ITunes; -<<<<<<< HEAD use Zend\Feed\Writer; -use Zend\URI; +use Zend\Uri; /** * @uses \Zend\Feed\Exception @@ -37,20 +36,6 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -======= -use Zend\Uri; - -/** - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Writer\Writer - * @uses \Zend\Feed\Writer\InvalidMethodException - * @uses \Zend\Uri\Uri - * @category Zend - * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ ->>>>>>> master class Feed { /** @@ -186,15 +171,9 @@ public function setItunesCategories(array $values) */ public function setItunesImage($value) { -<<<<<<< HEAD - if (!URI\URL::validate($value)) { + if (!Uri\Url::validate($value)) { throw new Writer\Exception('invalid parameter: "image" may only' . ' be a valid URI/IRI'); -======= - if (!\Zend\Uri\Url::validate($value)) { - throw new \Zend\Feed\Exception('invalid parameter: "image" may only' - . ' be a valid URI/IRI'); ->>>>>>> master } if (!in_array(substr($value, -3), array('jpg','png'))) { throw new Writer\Exception('invalid parameter: "image" may only' @@ -271,15 +250,9 @@ public function setItunesKeywords(array $value) */ public function setItunesNewFeedUrl($value) { -<<<<<<< HEAD - if (!URI\URL::validate($value)) { + if (!Uri\Url::validate($value)) { throw new Writer\Exception('invalid parameter: "newFeedUrl" may only' . ' be a valid URI/IRI'); -======= - if (!\Zend\Uri\Url::validate($value)) { - throw new \Zend\Feed\Exception('invalid parameter: "newFeedUrl" may only' - . ' be a valid URI/IRI'); ->>>>>>> master } $this->_data['newFeedUrl'] = $value; return $this; @@ -369,11 +342,7 @@ public function __call($method, array $params) if (!method_exists($this, 'setItunes' . ucfirst($point)) && !method_exists($this, 'addItunes' . ucfirst($point)) ) { -<<<<<<< HEAD throw new Writer\Exception\InvalidMethodException( -======= - throw new \Zend\Feed\Writer\InvalidMethodException( ->>>>>>> master 'invalid method: ' . $method ); } diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php index 160b30d4..1282e4bf 100644 --- a/src/Writer/Extension/ITunes/Renderer/Entry.php +++ b/src/Writer/Extension/ITunes/Renderer/Entry.php @@ -26,23 +26,13 @@ use Zend\Feed\Writer\Extension; /** -<<<<<<< HEAD -* @uses \Zend\Feed\Writer\Extension\RendererAbstract +* @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Entry extends Extension\AbstractRenderer -======= - * @uses \Zend\Feed\Writer\Extension\AbstractRenderer - * @category Zend - * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Entry extends \Zend\Feed\Writer\Extension\AbstractRenderer ->>>>>>> master { /** * Set to TRUE if a rendering method actually renders something. This diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php index 60ea92da..519e23cd 100644 --- a/src/Writer/Extension/ITunes/Renderer/Feed.php +++ b/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -26,23 +26,13 @@ use Zend\Feed\Writer\Extension; /** -<<<<<<< HEAD -* @uses \Zend\Feed\Writer\Extension\RendererAbstract +* @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Feed extends Extension\AbstractRenderer -======= - * @uses \Zend\Feed\Writer\Extension\AbstractRenderer - * @category Zend - * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Feed extends \Zend\Feed\Writer\Extension\AbstractRenderer ->>>>>>> master { /** diff --git a/src/Writer/Extension/Renderer.php b/src/Writer/Extension/Renderer.php index 4ce2ba8a..26dc8e0e 100644 --- a/src/Writer/Extension/Renderer.php +++ b/src/Writer/Extension/Renderer.php @@ -43,8 +43,8 @@ public function __construct($container); /** * Set DOMDocument and DOMElement on which to operate * - * @param DOMDocument $dom - * @param DOMElement $base + * @param \DOMDocument $dom + * @param \DOMElement $base * @return void */ public function setDomDocument(\DOMDocument $dom, \DOMElement $base); diff --git a/src/Writer/Extension/Slash/Renderer/Entry.php b/src/Writer/Extension/Slash/Renderer/Entry.php index 0547f026..0cee8852 100644 --- a/src/Writer/Extension/Slash/Renderer/Entry.php +++ b/src/Writer/Extension/Slash/Renderer/Entry.php @@ -26,23 +26,13 @@ use Zend\Feed\Writer\Extension; /** -<<<<<<< HEAD -* @uses \Zend\Feed\Writer\Extension\RendererAbstract +* @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Entry extends Extension\AbstractRenderer -======= - * @uses \Zend\Feed\Writer\Extension\AbstractRenderer - * @category Zend - * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Entry extends \Zend\Feed\Writer\Extension\AbstractRenderer ->>>>>>> master { /** diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php index 799aa71a..bed71bba 100644 --- a/src/Writer/Extension/Threading/Renderer/Entry.php +++ b/src/Writer/Extension/Threading/Renderer/Entry.php @@ -26,23 +26,13 @@ use Zend\Feed\Writer\Extension; /** -<<<<<<< HEAD -* @uses \Zend\Feed\Writer\Extension\RendererAbstract +* @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Entry extends Extension\AbstractRenderer -======= - * @uses \Zend\Feed\Writer\Extension\AbstractRenderer - * @category Zend - * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Entry extends \Zend\Feed\Writer\Extension\AbstractRenderer ->>>>>>> master { /** diff --git a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php index cb32dfa1..e3e0fb41 100644 --- a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php +++ b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php @@ -26,7 +26,6 @@ use Zend\Feed\Writer\Extension; /** -<<<<<<< HEAD * @uses \Zend\Feed\Writer\Extension\RendererAbstract * @category Zend * @package Zend_Feed_Writer @@ -34,15 +33,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Entry extends Extension\AbstractRenderer -======= - * @uses \Zend\Feed\Writer\Extension\AbstractRenderer - * @category Zend - * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Entry extends \Zend\Feed\Writer\Extension\AbstractRenderer ->>>>>>> master { /** diff --git a/src/Writer/Renderer/Entry/AtomDeleted.php b/src/Writer/Renderer/Entry/AtomDeleted.php index 40200cd7..5bb1bd2f 100644 --- a/src/Writer/Renderer/Entry/AtomDeleted.php +++ b/src/Writer/Renderer/Entry/AtomDeleted.php @@ -27,7 +27,6 @@ use Zend\Feed\Writer; /** -<<<<<<< HEAD:library/Zend/Feed/Writer/Renderer/Entry/AtomDeleted.php * @uses DOMDocument * @uses \Zend\Date\Date * @uses \Zend\Feed\Writer\Renderer\RendererAbstract @@ -38,20 +37,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class AtomDeleted extends Renderer\AbstractRenderer implements Renderer\Renderer -======= - * @uses DOMDocument - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Writer\Renderer\AbstractRenderer - * @uses \Zend\Feed\Writer\Renderer - * @category Zend - * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Deleted - extends \Zend\Feed\Writer\Renderer\AbstractRenderer - implements \Zend\Feed\Writer\Renderer ->>>>>>> master:library/Zend/Feed/Writer/Renderer/Entry/Atom/Deleted.php { /** * Constructor @@ -66,12 +51,8 @@ public function __construct (Writer\Deleted $container) /** * Render atom entry - * -<<<<<<< HEAD:library/Zend/Feed/Writer/Renderer/Entry/AtomDeleted.php - * @return Zend_Feed_Writer_Renderer_Entry_Atom -======= + * * @return \Zend\Feed\Writer\Renderer\Entry\Atom ->>>>>>> master:library/Zend/Feed/Writer/Renderer/Entry/Atom/Deleted.php */ public function render() { diff --git a/src/Writer/Renderer/Entry/Rss.php b/src/Writer/Renderer/Entry/Rss.php index 370ff5a1..8c2ef6ca 100644 --- a/src/Writer/Renderer/Entry/Rss.php +++ b/src/Writer/Renderer/Entry/Rss.php @@ -298,7 +298,7 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) } $text = $dom->createTextNode($this->getDataContainer()->getId()); $id->appendChild($text); - if (!URI\URL::validate($this->getDataContainer()->getId())) { + if (!Uri\Url::validate($this->getDataContainer()->getId())) { $id->setAttribute('isPermaLink', 'false'); } } diff --git a/src/Writer/Renderer/Feed/AtomSource.php b/src/Writer/Renderer/Feed/AtomSource.php index 6831f5c3..763ed5a8 100644 --- a/src/Writer/Renderer/Feed/AtomSource.php +++ b/src/Writer/Renderer/Feed/AtomSource.php @@ -27,7 +27,6 @@ use Zend\Feed\Writer; /** -<<<<<<< HEAD:library/Zend/Feed/Writer/Renderer/Feed/AtomSource.php * @uses DOMDocument * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\AtomAbstract * @uses \Zend\Feed\Writer\Renderer\RendererInterface @@ -37,17 +36,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class AtomSource extends AtomAbstract implements Renderer\Renderer -======= - * @uses DOMDocument - * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\AbstractAtom - * @uses \Zend\Feed\Writer\Renderer - * @category Zend - * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Source extends AbstractAtom implements \Zend\Feed\Writer\Renderer ->>>>>>> master:library/Zend/Feed/Writer/Renderer/Feed/Atom/Source.php { /** @@ -64,11 +52,7 @@ public function __construct (Writer\Source $container) /** * Render Atom Feed Metadata (Source element) * -<<<<<<< HEAD:library/Zend/Feed/Writer/Renderer/Feed/AtomSource.php - * @return Zend_Feed_Writer_Renderer_Feed_Atom -======= * @return \Zend\Feed\Writer\Renderer\Feed\Atom ->>>>>>> master:library/Zend/Feed/Writer/Renderer/Feed/Atom/Source.php */ public function render() { diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index daac1a60..01375b9d 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -25,7 +25,7 @@ namespace Zend\Feed\Writer\Renderer\Feed; use Zend\Feed\Writer\Renderer; use Zend\Feed\Writer; -use Zend\URI; +use Zend\Uri; use Zend\Date; /** @@ -264,7 +264,7 @@ protected function _setLink(\DOMDocument $dom, \DOMElement $root) $root->appendChild($link); $text = $dom->createTextNode($value); $link->appendChild($text); - if (!URI\URL::validate($value)) { + if (!Uri\Url::validate($value)) { $link->setAttribute('isPermaLink', 'false'); } } @@ -338,7 +338,7 @@ protected function _setImage(\DOMDocument $dom, \DOMElement $root) } } if (empty($image['link']) || !is_string($image['link']) - || !URI\URL::validate($image['link'])) { + || !Uri\Url::validate($image['link'])) { $message = 'Invalid parameter: parameter \'link\'' . ' must be a non-empty string and valid URI/IRI'; $exception = new Writer\Exception($message); diff --git a/src/Writer/Source.php b/src/Writer/Source.php index 496d5851..a4eddf50 100644 --- a/src/Writer/Source.php +++ b/src/Writer/Source.php @@ -25,7 +25,6 @@ namespace Zend\Feed\Writer; /** -<<<<<<< HEAD * @uses \Zend\Feed\Writer\Feed\FeedAbstract * @category Zend * @package Zend_Feed_Writer @@ -33,15 +32,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Source extends AbstractFeed -======= - * @uses \Zend\Feed\Writer\Feed\AbstractFeed - * @category Zend - * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Source extends Feed\AbstractFeed ->>>>>>> master { } diff --git a/src/Writer/Writer.php b/src/Writer/Writer.php index 60e06f19..915e731a 100644 --- a/src/Writer/Writer.php +++ b/src/Writer/Writer.php @@ -23,29 +23,16 @@ * @namespace */ namespace Zend\Feed\Writer; -use Zend\Loader\PrefixPathMapper, - Zend\Loader\ShortNameLocater, - Zend\Loader\PluginLoader, - Zend\Loader\PluginLoaderException; +use Zend\Loader; /** -<<<<<<< HEAD * @uses \Zend\Feed\Exception -* @uses \Zend\Loader\PluginLoader\PluginLoader +* @uses \Zend\Loader\PluginLoader * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -======= - * @uses \Zend\Feed\Exception - * @uses \Zend\Loader\PluginLoader - * @category Zend - * @package Zend_Feed_Writer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ ->>>>>>> master class Writer { /** @@ -78,11 +65,7 @@ class Writer /** * PluginLoader instance used by component * -<<<<<<< HEAD - * @var Zend_Loader_PluginLoader_Interface -======= * @var \Zend\Loader\ShortNameLocater ->>>>>>> master */ protected static $_pluginLoader = null; @@ -110,11 +93,7 @@ class Writer /** * Set plugin loader for use with Extensions * -<<<<<<< HEAD - * @param Zend_Loader_PluginLoader_Interface -======= * @param \Zend\Loader\ShortNameLocater ->>>>>>> master */ public static function setPluginLoader(ShortNameLocater $loader) { @@ -124,22 +103,13 @@ public static function setPluginLoader(ShortNameLocater $loader) /** * Get plugin loader for use with Extensions * -<<<<<<< HEAD - * @return Zend_Loader_PluginLoader_Interface -======= * @return \Zend\Loader\ShortNameLocater ->>>>>>> master */ public static function getPluginLoader() { if (!isset(self::$_pluginLoader)) { -<<<<<<< HEAD - self::$_pluginLoader = new PluginLoader\PluginLoader(array( - 'Zend\\Feed\\Writer\\Extension' => 'Zend/Feed/Writer/Extension/', -======= - self::$_pluginLoader = new PluginLoader(array( - 'Zend\Feed\Writer\Extension\\' => 'Zend/Feed/Writer/Extension/', ->>>>>>> master + self::$_pluginLoader = new Loader\PluginLoader(array( + 'Zend\\Feed\\Writer\\Extension\\' => 'Zend/Feed/Writer/Extension/', )); } return self::$_pluginLoader; @@ -154,13 +124,10 @@ public static function getPluginLoader() */ public static function addPrefixPath($prefix, $path) { -<<<<<<< HEAD -======= $pluginLoader = self::getPluginLoader(); - if (!$pluginLoader instanceof PrefixPathMapper) { + if (!$pluginLoader instanceof Loader\PrefixPathMapper) { return; } ->>>>>>> master $prefix = rtrim($prefix, '\\'); $path = rtrim($path, DIRECTORY_SEPARATOR); $pluginLoader->addPrefixPath($prefix, $path); @@ -175,7 +142,7 @@ public static function addPrefixPath($prefix, $path) public static function addPrefixPaths(array $spec) { $pluginLoader = self::getPluginLoader(); - if (!$pluginLoader instanceof PrefixPathMapper) { + if (!$pluginLoader instanceof Loader\PrefixPathMapper) { return; } if (isset($spec['prefix']) && isset($spec['path'])) { @@ -213,22 +180,22 @@ public static function registerExtension($name) try { self::getPluginLoader()->load($feedName); self::$_extensions['feed'][] = $feedName; - } catch (PluginLoaderException $e) { + } catch (Loader\PluginLoaderException $e) { } try { self::getPluginLoader()->load($entryName); self::$_extensions['entry'][] = $entryName; - } catch (PluginLoaderException $e) { + } catch (Loader\PluginLoaderException $e) { } try { self::getPluginLoader()->load($feedRendererName); self::$_extensions['feedRenderer'][] = $feedRendererName; - } catch (PluginLoaderException $e) { + } catch (Loader\PluginLoaderException $e) { } try { self::getPluginLoader()->load($entryRendererName); self::$_extensions['entryRenderer'][] = $entryRendererName; - } catch (PluginLoaderException $e) { + } catch (Loader\PluginLoaderException $e) { } if (!self::getPluginLoader()->isLoaded($feedName) && !self::getPluginLoader()->isLoaded($entryName) @@ -248,17 +215,10 @@ public static function registerExtension($name) */ public static function isRegistered($extensionName) { -<<<<<<< HEAD $feedName = $extensionName . '\\Feed'; $entryName = $extensionName . '\\Entry'; $feedRendererName = $extensionName . '\\Renderer\\Feed'; $entryRendererName = $extensionName . '\\Renderer\\Entry'; -======= - $feedName = $extensionName . '\Feed'; - $entryName = $extensionName . '\Entry'; - $feedRendererName = $extensionName . '\Renderer\Feed'; - $entryRendererName = $extensionName . '\Renderer\Entry'; ->>>>>>> master if (in_array($feedName, self::$_extensions['feed']) || in_array($entryName, self::$_extensions['entry']) || in_array($feedRendererName, self::$_extensions['feedRenderer']) diff --git a/test/Writer/Renderer/Entry/RSSTest.php b/test/Writer/Renderer/Entry/RSSTest.php deleted file mode 100644 index 99bb21fb..00000000 --- a/test/Writer/Renderer/Entry/RSSTest.php +++ /dev/null @@ -1,362 +0,0 @@ -_validWriter = new \Zend\Feed\Writer\Feed; - - $this->_validWriter->setType('rss'); - - $this->_validWriter->setTitle('This is a test feed.'); - $this->_validWriter->setDescription('This is a test description.'); - $this->_validWriter->setLink('http://www.example.com'); - $this->_validEntry = $this->_validWriter->createEntry(); - $this->_validEntry->setTitle('This is a test entry.'); - $this->_validEntry->setDescription('This is a test entry description.'); - $this->_validEntry->setLink('http://www.example.com/1');; - $this->_validWriter->addEntry($this->_validEntry); - } - - public function tearDown() - { - $this->_validWriter = null; - $this->_validEntry = null; - } - - public function testRenderMethodRunsMinimalWriterContainerProperlyBeforeICheckAtomCompliance() - { - $renderer = new Feed\RSS($this->_validWriter); - try { - $renderer->render(); - } catch (\Zend\Feed\Exception $e) { - $this->fail('Valid Writer object caused an exception when building which should never happen'); - } - } - - public function testEntryEncodingHasBeenSet() - { - $this->_validWriter->setEncoding('iso-8859-1'); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $this->assertEquals('iso-8859-1', $entry->getEncoding()); - } - - public function testEntryEncodingDefaultIsUsedIfEncodingNotSetByHand() - { - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $this->assertEquals('UTF-8', $entry->getEncoding()); - } - - public function testEntryTitleHasBeenSet() - { - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $this->assertEquals('This is a test entry.', $entry->getTitle()); - } - - public function testEntryTitleIfMissingThrowsExceptionIfDescriptionAlsoMissing() - { - $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Feed\RSS($this->_validWriter); - $this->_validEntry->remove('title'); - $this->_validEntry->remove('description'); - $atomFeed->render(); - } - - public function testEntryTitleCharDataEncoding() - { - $renderer = new Feed\RSS($this->_validWriter); - $this->_validEntry->setTitle('<>&\'"áéíóú'); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $this->assertEquals('<>&\'"áéíóú', $entry->getTitle()); - } - - public function testEntrySummaryDescriptionHasBeenSet() - { - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $this->assertEquals('This is a test entry description.', $entry->getDescription()); - } - - public function testEntryDescriptionIfMissingThrowsExceptionIfAlsoNoTitle() - { - $this->setExpectedException('Zend\Feed\Exception'); - $atomFeed = new Feed\RSS($this->_validWriter); - $this->_validEntry->remove('description'); - $this->_validEntry->remove('title'); - $atomFeed->render(); - } - - public function testEntryDescriptionCharDataEncoding() - { - $renderer = new Feed\RSS($this->_validWriter); - $this->_validEntry->setDescription('<>&\'"áéíóú'); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $this->assertEquals('<>&\'"áéíóú', $entry->getDescription()); - } - - public function testEntryContentHasBeenSet() - { - $this->_validEntry->setContent('This is test entry content.'); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $this->assertEquals('This is test entry content.', $entry->getContent()); - } - - public function testEntryContentCharDataEncoding() - { - $renderer = new Feed\RSS($this->_validWriter); - $this->_validEntry->setContent('<>&\'"áéíóú'); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $this->assertEquals('<>&\'"áéíóú', $entry->getContent()); - } - - public function testEntryUpdatedDateHasBeenSet() - { - $this->_validEntry->setDateModified(1234567890); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $this->assertEquals(1234567890, $entry->getDateModified()->get(Date\Date::TIMESTAMP)); - } - - public function testEntryPublishedDateHasBeenSet() - { - $this->_validEntry->setDateCreated(1234567000); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $this->assertEquals(1234567000, $entry->getDateCreated()->get(Date\Date::TIMESTAMP)); - } - - public function testEntryIncludesLinkToHtmlVersionOfFeed() - { - $renderer= new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $this->assertEquals('http://www.example.com/1', $entry->getLink()); - } - - public function testEntryHoldsAnyAuthorAdded() - { - $this->_validEntry->addAuthor('Jane', 'jane@example.com', 'http://www.example.com/jane'); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $author = $entry->getAuthor(); - $this->assertEquals(array('name'=>'Jane'), $entry->getAuthor()); - } - - public function testEntryAuthorCharDataEncoding() - { - $this->_validEntry->addAuthor('<>&\'"áéíóú', 'jane@example.com', 'http://www.example.com/jane'); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $author = $entry->getAuthor(); - $this->assertEquals(array('name'=>'<>&\'"áéíóú'), $entry->getAuthor()); - } - - public function testEntryHoldsAnyEnclosureAdded() - { - $renderer = new Feed\RSS($this->_validWriter); - $this->_validEntry->setEnclosure(array( - 'type' => 'audio/mpeg', - 'length' => '1337', - 'uri' => 'http://example.com/audio.mp3' - )); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $enc = $entry->getEnclosure(); - $this->assertEquals('audio/mpeg', $enc->type); - $this->assertEquals('1337', $enc->length); - $this->assertEquals('http://example.com/audio.mp3', $enc->url); - } - - public function testAddsEnclosureThrowsExceptionOnMissingType() - { - $renderer = new Feed\RSS($this->_validWriter); - $this->_validEntry->setEnclosure(array( - 'uri' => 'http://example.com/audio.mp3', - 'length' => '1337' - )); - $this->setExpectedException('Zend\Feed\Exception'); - $renderer->render(); - } - - public function testAddsEnclosureThrowsExceptionOnMissingLength() - { - $renderer = new Feed\RSS($this->_validWriter); - $this->_validEntry->setEnclosure(array( - 'type' => 'audio/mpeg', - 'uri' => 'http://example.com/audio.mp3' - )); - $this->setExpectedException('Zend\Feed\Exception'); - $renderer->render(); - } - - public function testAddsEnclosureThrowsExceptionOnNonNumericLength() - { - $renderer = new Feed\RSS($this->_validWriter); - $this->_validEntry->setEnclosure(array( - 'type' => 'audio/mpeg', - 'uri' => 'http://example.com/audio.mp3', - 'length' => 'abc' - )); - $this->setExpectedException('Zend\Feed\Exception'); - $renderer->render(); - } - - public function testAddsEnclosureThrowsExceptionOnNegativeLength() - { - $renderer = new Feed\RSS($this->_validWriter); - $this->_validEntry->setEnclosure(array( - 'type' => 'audio/mpeg', - 'uri' => 'http://example.com/audio.mp3', - 'length' => -23 - )); - $this->setExpectedException('Zend\Feed\Exception'); - $renderer->render(); - } - - public function testEntryIdHasBeenSet() - { - $this->_validEntry->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $entry->getId()); - } - - public function testEntryIdHasBeenSetWithPermaLinkAsFalseWhenNotUri() - { - $this->markTestIncomplete('Untest due to ZFR potential bug'); - } - - public function testEntryIdDefaultIsUsedIfNotSetByHand() - { - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $this->assertEquals($entry->getLink(), $entry->getId()); - } - - public function testCommentLinkRendered() - { - $renderer = new Feed\RSS($this->_validWriter); - $this->_validEntry->setCommentLink('http://www.example.com/id/1'); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $this->assertEquals('http://www.example.com/id/1', $entry->getCommentLink()); - } - - public function testCommentCountRendered() - { - $renderer = new Feed\RSS($this->_validWriter); - $this->_validEntry->setCommentCount(22); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $this->assertEquals(22, $entry->getCommentCount()); - } - - public function testCommentFeedLinksRendered() - { - $renderer = new Feed\RSS($this->_validWriter); - $this->_validEntry->setCommentFeedLinks(array( - array('uri'=>'http://www.example.com/atom/id/1','type'=>'atom'), - array('uri'=>'http://www.example.com/rss/id/1','type'=>'rss'), - )); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - // Skipped assertion is because RSS has no facility to show Atom feeds without an extension - $this->assertEquals('http://www.example.com/rss/id/1', $entry->getCommentFeedLink('rss')); - //$this->assertEquals('http://www.example.com/atom/id/1', $entry->getCommentFeedLink('atom')); - } - - public function testCategoriesCanBeSet() - { - $this->_validEntry->addCategories(array( - array('term'=>'cat_dog', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), - array('term'=>'cat_dog2') - )); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $expected = array( - array('term'=>'cat_dog', 'label' => 'cat_dog', 'scheme' => 'http://example.com/schema1'), - array('term'=>'cat_dog2', 'label' => 'cat_dog2', 'scheme' => null) - ); - $this->assertEquals($expected, (array) $entry->getCategories()); - } - - /** - * @group ZFWCHARDATA01 - */ - public function testCategoriesCharDataEncoding() - { - $this->_validEntry->addCategories(array( - array('term'=>'<>&\'"áéíóú', 'label' => 'Cats & Dogs', 'scheme' => 'http://example.com/schema1'), - array('term'=>'cat_dog2') - )); - $renderer = new Feed\RSS($this->_validWriter); - $feed = Reader\Reader::importString($renderer->render()->saveXml()); - $entry = $feed->current(); - $expected = array( - array('term'=>'<>&\'"áéíóú', 'label' => '<>&\'"áéíóú', 'scheme' => 'http://example.com/schema1'), - array('term'=>'cat_dog2', 'label' => 'cat_dog2', 'scheme' => null) - ); - $this->assertEquals($expected, (array) $entry->getCategories()); - } - -} From 06387694597eadcd3f001ae2d8125c384f515dfe Mon Sep 17 00:00:00 2001 From: Padraic Brady Date: Sun, 25 Jul 2010 12:46:53 +0100 Subject: [PATCH 160/238] Deleting unnecessary Pubsubhubbub directory --- src/Pubsubhubbub.php | 195 ---- src/Pubsubhubbub/CallbackAbstract.php | 308 ------- src/Pubsubhubbub/CallbackInterface.php | 69 -- src/Pubsubhubbub/Exception.php | 34 - src/Pubsubhubbub/HttpResponse.php | 234 ----- src/Pubsubhubbub/Model/ModelAbstract.php | 65 -- src/Pubsubhubbub/Model/Subscription.php | 132 --- .../Model/SubscriptionInterface.php | 65 -- src/Pubsubhubbub/Publisher.php | 418 --------- src/Pubsubhubbub/Subscriber.php | 857 ------------------ src/Pubsubhubbub/Subscriber/Callback.php | 329 ------- test/Pubsubhubbub/AllTests.php | 67 -- test/Pubsubhubbub/Model/AllTests.php | 56 -- test/Pubsubhubbub/PublisherTest.php | 324 ------- test/Pubsubhubbub/PubsubhubbubTest.php | 59 -- test/Pubsubhubbub/Subscriber/CallbackTest.php | 466 ---------- .../Pubsubhubbub/Subscriber/_files/atom10.xml | 4 - test/Pubsubhubbub/SubscriberHttpTest.php | 139 --- test/Pubsubhubbub/SubscriberTest.php | 355 -------- test/Pubsubhubbub/_files/rss20.xml | 8 - test/Pubsubhubbub/_files/testRawPostData.php | 3 - 21 files changed, 4187 deletions(-) delete mode 100644 src/Pubsubhubbub.php delete mode 100644 src/Pubsubhubbub/CallbackAbstract.php delete mode 100644 src/Pubsubhubbub/CallbackInterface.php delete mode 100644 src/Pubsubhubbub/Exception.php delete mode 100644 src/Pubsubhubbub/HttpResponse.php delete mode 100644 src/Pubsubhubbub/Model/ModelAbstract.php delete mode 100644 src/Pubsubhubbub/Model/Subscription.php delete mode 100644 src/Pubsubhubbub/Model/SubscriptionInterface.php delete mode 100644 src/Pubsubhubbub/Publisher.php delete mode 100644 src/Pubsubhubbub/Subscriber.php delete mode 100644 src/Pubsubhubbub/Subscriber/Callback.php delete mode 100644 test/Pubsubhubbub/AllTests.php delete mode 100644 test/Pubsubhubbub/Model/AllTests.php delete mode 100644 test/Pubsubhubbub/PublisherTest.php delete mode 100644 test/Pubsubhubbub/PubsubhubbubTest.php delete mode 100644 test/Pubsubhubbub/Subscriber/CallbackTest.php delete mode 100644 test/Pubsubhubbub/Subscriber/_files/atom10.xml delete mode 100644 test/Pubsubhubbub/SubscriberHttpTest.php delete mode 100644 test/Pubsubhubbub/SubscriberTest.php delete mode 100644 test/Pubsubhubbub/_files/rss20.xml delete mode 100644 test/Pubsubhubbub/_files/testRawPostData.php diff --git a/src/Pubsubhubbub.php b/src/Pubsubhubbub.php deleted file mode 100644 index 5f8e7d56..00000000 --- a/src/Pubsubhubbub.php +++ /dev/null @@ -1,195 +0,0 @@ ->>>>>> master:library/Zend/Feed/PubSubHubbub/PubSubHubbub.php - * @category Zend - * @package Zend_Feed_Pubsubhubbub - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Feed_Pubsubhubbub -{ - /** - * Verification Modes - */ - const VERIFICATION_MODE_SYNC = 'sync'; - const VERIFICATION_MODE_ASYNC = 'async'; - - /** - * Subscription States - */ - const SUBSCRIPTION_VERIFIED = 'verified'; - const SUBSCRIPTION_NOTVERIFIED = 'not_verified'; - const SUBSCRIPTION_TODELETE = 'to_delete'; - - /** - * Singleton instance if required of the HTTP client - * -<<<<<<< HEAD:library/Zend/Feed/Pubsubhubbub.php - * @var Zend_Http_Client -======= - * @var \Zend\Http\Client ->>>>>>> master:library/Zend/Feed/PubSubHubbub/PubSubHubbub.php - */ - protected static $httpClient = null; - - /** - * Simple utility function which imports any feed URL and - * determines the existence of Hub Server endpoints. This works - * best if directly given an instance of Zend_Feed_Reader_Atom|Rss - * to leverage off. - * - * @param Zend_Feed_Reader_FeedAbstract|Zend_Feed_Abstract|string $source - * @return array - */ - public static function detectHubs($source) - { - if (is_string($source)) { -<<<<<<< HEAD:library/Zend/Feed/Pubsubhubbub.php - $feed = Zend_Feed_Reader::import($source); - } elseif (is_object($source) && $source instanceof Zend_Feed_Reader_FeedAbstract) { -======= - $feed = Reader\Reader::import($source); - } elseif (is_object($source) && $source instanceof Reader\AbstractFeed) { ->>>>>>> master:library/Zend/Feed/PubSubHubbub/PubSubHubbub.php - $feed = $source; - } elseif (is_object($source) && $source instanceof Zend_Feed_Abstract) { - $feed = Zend_Feed_Reader::importFeed($source); - } else { -<<<<<<< HEAD:library/Zend/Feed/Pubsubhubbub.php - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('The source parameter was' -======= - throw new Exception('The source parameter was' ->>>>>>> master:library/Zend/Feed/PubSubHubbub/PubSubHubbub.php - . ' invalid, i.e. not a URL string or an instance of type' - . ' Zend\Feed\Reader\FeedAbstract or Zend\Feed\Abstract'); - } - return $feed->getHubs(); - } - - /** - * Allows the external environment to make Zend_Oauth use a specific - * Client instance. - * -<<<<<<< HEAD:library/Zend/Feed/Pubsubhubbub.php - * @param Zend_Http_Client $httpClient - * @return void - */ - public static function setHttpClient(Zend_Http_Client $httpClient) -======= - * @param \Zend\Http\Client $httpClient - * @return void - */ - public static function setHttpClient(Http\Client $httpClient) ->>>>>>> master:library/Zend/Feed/PubSubHubbub/PubSubHubbub.php - { - self::$httpClient = $httpClient; - } - - /** - * Return the singleton instance of the HTTP Client. Note that - * the instance is reset and cleared of previous parameters GET/POST. - * Headers are NOT reset but handled by this component if applicable. - * -<<<<<<< HEAD:library/Zend/Feed/Pubsubhubbub.php - * @return Zend_Http_Client -======= - * @return \Zend\Http\Client ->>>>>>> master:library/Zend/Feed/PubSubHubbub/PubSubHubbub.php - */ - public static function getHttpClient() - { - if (!isset(self::$httpClient)): -<<<<<<< HEAD:library/Zend/Feed/Pubsubhubbub.php - self::$httpClient = new Zend_Http_Client; -======= - self::$httpClient = new Http\Client; ->>>>>>> master:library/Zend/Feed/PubSubHubbub/PubSubHubbub.php - else: - self::$httpClient->resetParameters(); - endif; - return self::$httpClient; - } - - /** - * Simple mechanism to delete the entire singleton HTTP Client instance - * which forces an new instantiation for subsequent requests. - * - * @return void - */ - public static function clearHttpClient() - { - self::$httpClient = null; - } - - /** - * RFC 3986 safe url encoding method - * - * @param string $string - * @return string - */ - public static function urlencode($string) - { - $rawencoded = rawurlencode($string); - $rfcencoded = str_replace('%7E', '~', $rawencoded); - return $rfcencoded; - } -} diff --git a/src/Pubsubhubbub/CallbackAbstract.php b/src/Pubsubhubbub/CallbackAbstract.php deleted file mode 100644 index 70f2fb92..00000000 --- a/src/Pubsubhubbub/CallbackAbstract.php +++ /dev/null @@ -1,308 +0,0 @@ -setConfig($config); - } - } - - /** - * Process any injected configuration options - * - * @param array|Zend_Config $options Options array or Zend_Config instance - * @return Zend_Feed_Pubsubhubbub_CallbackAbstract - */ - public function setConfig($config) - { - if ($config instanceof Zend_Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' - . 'expected, got ' . gettype($config)); - } - if (array_key_exists('storage', $config)) { - $this->setStorage($config['storage']); - } - return $this; - } - - /** - * Send the response, including all headers. - * If you wish to handle this via Zend_Controller, use the getter methods - * to retrieve any data needed to be set on your HTTP Response object, or - * simply give this object the HTTP Response instance to work with for you! - * - * @return void - */ - public function sendResponse() - { - $this->getHttpResponse()->sendResponse(); - } - - /** - * Sets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used - * to background save any verification tokens associated with a subscription - * or other. - * - * @param Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage - * @return Zend_Feed_Pubsubhubbub_CallbackAbstract - */ - public function setStorage(Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage) - { - $this->_storage = $storage; - return $this; - } - - /** - * Gets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used - * to background save any verification tokens associated with a subscription - * or other. - * - * @return Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface - */ - public function getStorage() - { - if ($this->_storage === null) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('No storage object has been' - . ' set that subclasses Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface'); - } - return $this->_storage; - } - - /** - * An instance of a class handling Http Responses. This is implemented in - * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with - * (i.e. not inherited from) Zend_Controller_Response_Http. - * - * @param Zend_Feed_Pubsubhubbub_HttpResponse|Zend_Controller_Response_Http $httpResponse - * @return Zend_Feed_Pubsubhubbub_CallbackAbstract - */ - public function setHttpResponse($httpResponse) - { - if (!is_object($httpResponse) - || (!$httpResponse instanceof Zend_Feed_Pubsubhubbub_HttpResponse - && !$httpResponse instanceof Zend_Controller_Response_Http) - ) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('HTTP Response object must' - . ' implement one of Zend_Feed_Pubsubhubbub_HttpResponse or' - . ' Zend_Controller_Response_Http'); - } - $this->_httpResponse = $httpResponse; - return $this; - } - - /** - * An instance of a class handling Http Responses. This is implemented in - * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with - * (i.e. not inherited from) Zend_Controller_Response_Http. - * - * @return Zend_Feed_Pubsubhubbub_HttpResponse|Zend_Controller_Response_Http - */ - public function getHttpResponse() - { - if ($this->_httpResponse === null) { - $this->_httpResponse = new Zend_Feed_Pubsubhubbub_HttpResponse; - } - return $this->_httpResponse; - } - - /** - * Sets the number of Subscribers for which any updates are on behalf of. - * In other words, is this class serving one or more subscribers? How many? - * Defaults to 1 if left unchanged. - * - * @param string|int $count - * @return Zend_Feed_Pubsubhubbub_CallbackAbstract - */ - public function setSubscriberCount($count) - { - $count = intval($count); - if ($count <= 0) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Subscriber count must be' - . ' greater than zero'); - } - $this->_subscriberCount = $count; - return $this; - } - - /** - * Gets the number of Subscribers for which any updates are on behalf of. - * In other words, is this class serving one or more subscribers? How many? - * - * @return int - */ - public function getSubscriberCount() - { - return $this->_subscriberCount; - } - - /** - * Attempt to detect the callback URL (specifically the path forward) - */ - protected function _detectCallbackUrl() - { - $callbackUrl = ''; - if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { - $callbackUrl = $_SERVER['HTTP_X_REWRITE_URL']; - } elseif (isset($_SERVER['REQUEST_URI'])) { - $callbackUrl = $_SERVER['REQUEST_URI']; - $scheme = 'http'; - if ($_SERVER['HTTPS'] == 'on') { - $scheme = 'https'; - } - $schemeAndHttpHost = $scheme . '://' . $this->_getHttpHost(); - if (strpos($callbackUrl, $schemeAndHttpHost) === 0) { - $callbackUrl = substr($callbackUrl, strlen($schemeAndHttpHost)); - } - } elseif (isset($_SERVER['ORIG_PATH_INFO'])) { - $callbackUrl= $_SERVER['ORIG_PATH_INFO']; - if (!empty($_SERVER['QUERY_STRING'])) { - $callbackUrl .= '?' . $_SERVER['QUERY_STRING']; - } - } - return $callbackUrl; - } - - /** - * Get the HTTP host - * - * @return string - */ - protected function _getHttpHost() - { - if (!empty($_SERVER['HTTP_HOST'])) { - return $_SERVER['HTTP_HOST']; - } - $scheme = 'http'; - if ($_SERVER['HTTPS'] == 'on') { - $scheme = 'https'; - } - $name = $_SERVER['SERVER_NAME']; - $port = $_SERVER['SERVER_PORT']; - if (($scheme == 'http' && $port == 80) - || ($scheme == 'https' && $port == 443) - ) { - return $name; - } else { - return $name . ':' . $port; - } - } - - /** - * Retrieve a Header value from either $_SERVER or Apache - * - * @param string $header - */ - protected function _getHeader($header) - { - $temp = strtoupper(str_replace('-', '_', $header)); - if (!empty($_SERVER[$temp])) { - return $_SERVER[$temp]; - } - $temp = 'HTTP_' . strtoupper(str_replace('-', '_', $header)); - if (!empty($_SERVER[$temp])) { - return $_SERVER[$temp]; - } - if (function_exists('apache_request_headers')) { - $headers = apache_request_headers(); - if (!empty($headers[$header])) { - return $headers[$header]; - } - } - return false; - } - - /** - * Return the raw body of the request - * - * @return string|false Raw body, or false if not present - */ - protected function _getRawBody() - { - $body = file_get_contents('php://input'); - if (strlen(trim($body)) == 0 && isset($GLOBALS['HTTP_RAW_POST_DATA'])) { - $body = $GLOBALS['HTTP_RAW_POST_DATA']; - } - if (strlen(trim($body)) > 0) { - return $body; - } - return false; - } -} diff --git a/src/Pubsubhubbub/CallbackInterface.php b/src/Pubsubhubbub/CallbackInterface.php deleted file mode 100644 index 15e89f5b..00000000 --- a/src/Pubsubhubbub/CallbackInterface.php +++ /dev/null @@ -1,69 +0,0 @@ -sendHeaders(); - echo $this->getBody(); - } - - /** - * Send all headers - * - * Sends any headers specified. If an {@link setHttpResponseCode() HTTP response code} - * has been specified, it is sent with the first header. - * - * @return void - */ - public function sendHeaders() - { - if (count($this->_headers) || (200 != $this->_httpResponseCode)) { - $this->canSendHeaders(true); - } elseif (200 == $this->_httpResponseCode) { - return; - } - $httpCodeSent = false; - foreach ($this->_headers as $header) { - if (!$httpCodeSent && $this->_httpResponseCode) { - header($header['name'] . ': ' . $header['value'], $header['replace'], $this->_httpResponseCode); - $httpCodeSent = true; - } else { - header($header['name'] . ': ' . $header['value'], $header['replace']); - } - } - if (!$httpCodeSent) { - header('HTTP/1.1 ' . $this->_httpResponseCode); - $httpCodeSent = true; - } - } - - /** - * Set a header - * - * If $replace is true, replaces any headers already defined with that - * $name. - * - * @param string $name - * @param string $value - * @param boolean $replace - * @return Zend_Feed_Pubsubhubbub_HttpResponse - */ - public function setHeader($name, $value, $replace = false) - { - $name = $this->_normalizeHeader($name); - $value = (string) $value; - if ($replace) { - foreach ($this->_headers as $key => $header) { - if ($name == $header['name']) { - unset($this->_headers[$key]); - } - } - } - $this->_headers[] = array( - 'name' => $name, - 'value' => $value, - 'replace' => $replace, - ); - - return $this; - } - - /** - * Check if a specific Header is set and return its value - * - * @param string $name - * @return string|null - */ - public function getHeader($name) - { - $name = $this->_normalizeHeader($name); - foreach ($this->_headers as $header) { - if ($header['name'] == $name) { - return $header['value']; - } - } - } - - /** - * Return array of headers; see {@link $_headers} for format - * - * @return array - */ - public function getHeaders() - { - return $this->_headers; - } - - /** - * Can we send headers? - * - * @param boolean $throw Whether or not to throw an exception if headers have been sent; defaults to false - * @return boolean - * @throws Zend_Feed_Pubsubhubbub_Exception - */ - public function canSendHeaders($throw = false) - { - $ok = headers_sent($file, $line); - if ($ok && $throw) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Cannot send headers; headers already sent in ' . $file . ', line ' . $line); - } - return !$ok; - } - - /** - * Set HTTP response code to use with headers - * - * @param int $code - * @return Zend_Feed_Pubsubhubbub_HttpResponse - */ - public function setHttpResponseCode($code) - { - if (!is_int($code) || (100 > $code) || (599 < $code)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid HTTP response' - . ' code:' . $code); - } - $this->_httpResponseCode = $code; - return $this; - } - - /** - * Retrieve HTTP response code - * - * @return int - */ - public function getHttpResponseCode() - { - return $this->_httpResponseCode; - } - - /** - * Set body content - * - * @param string $content - * @return Zend_Feed_Pubsubhubbub_HttpResponse - */ - public function setBody($content) - { - $this->_body = (string) $content; - $this->setHeader('content-length', strlen($content)); - return $this; - } - - /** - * Return the body content - * - * @return string - */ - public function getBody() - { - return $this->_body; - } - - /** - * Normalizes a header name to X-Capitalized-Names - * - * @param string $name - * @return string - */ - protected function _normalizeHeader($name) - { - $filtered = str_replace(array('-', '_'), ' ', (string) $name); - $filtered = ucwords(strtolower($filtered)); - $filtered = str_replace(' ', '-', $filtered); - return $filtered; - } -} diff --git a/src/Pubsubhubbub/Model/ModelAbstract.php b/src/Pubsubhubbub/Model/ModelAbstract.php deleted file mode 100644 index 951c0d85..00000000 --- a/src/Pubsubhubbub/Model/ModelAbstract.php +++ /dev/null @@ -1,65 +0,0 @@ -_db = new Zend_Db_Table($table); - } else { - $this->_db = $tableGateway; - } - } - -} diff --git a/src/Pubsubhubbub/Model/Subscription.php b/src/Pubsubhubbub/Model/Subscription.php deleted file mode 100644 index 96184f84..00000000 --- a/src/Pubsubhubbub/Model/Subscription.php +++ /dev/null @@ -1,132 +0,0 @@ -_db->find($data['id']); - if ($result) { - $data['created_time'] = $result->current()->created_time; - $now = new Zend_Date; - if ($data['lease_seconds']) { - $data['expiration_time'] = $now->add($data['lease_seconds'], Zend_Date::SECOND) - ->get('yyyy-MM-dd HH:mm:ss'); - } - $this->_db->update( - $data, - $this->_db->getAdapter()->quoteInto('id = ?', $data['id']) - ); - return false; - } - - $this->_db->insert($data); - return true; - } - - /** - * Get subscription by ID/key - * - * @param string $key - * @return array - */ - public function getSubscription($key) - { - if (empty($key) || !is_string($key)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "key"' - .' of "' . $key . '" must be a non-empty string'); - } - $result = $this->_db->find($key); - if ($result) { - return (array) $result->current(); - } - return false; - } - - /** - * Determine if a subscription matching the key exists - * - * @param string $key - * @return bool - */ - public function hasSubscription($key) - { - if (empty($key) || !is_string($key)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "key"' - .' of "' . $key . '" must be a non-empty string'); - } - $result = $this->_db->find($key); - if ($result) { - return true; - } - return false; - } - - /** - * Delete a subscription - * - * @param string $key - * @return bool - */ - public function deleteSubscription($key) - { - $result = $this->_db->find($key); - if ($result) { - $this->_db->delete( - $this->_db->getAdapter()->quoteInto('id = ?', $key) - ); - return true; - } - return false; - } - -} diff --git a/src/Pubsubhubbub/Model/SubscriptionInterface.php b/src/Pubsubhubbub/Model/SubscriptionInterface.php deleted file mode 100644 index 9675880e..00000000 --- a/src/Pubsubhubbub/Model/SubscriptionInterface.php +++ /dev/null @@ -1,65 +0,0 @@ -setConfig($config); - } - } - - /** - * Process any injected configuration options - * - * @param array|Zend_Config $options Options array or Zend_Config instance - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function setConfig($config) - { - if ($config instanceof Zend_Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' - . 'expected, got ' . gettype($config)); - } - if (array_key_exists('hubUrls', $config)) { - $this->addHubUrls($config['hubUrls']); - } - if (array_key_exists('updatedTopicUrls', $config)) { - $this->addUpdatedTopicUrls($config['updatedTopicUrls']); - } - if (array_key_exists('parameters', $config)) { - $this->setParameters($config['parameters']); - } - return $this; - } - - /** - * Add a Hub Server URL supported by Publisher - * - * @param string $url - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function addHubUrl($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' - .' of "' . $url . '" must be a non-empty string and a valid' - .'URL'); - } - $this->_hubUrls[] = $url; - return $this; - } - - /** - * Add an array of Hub Server URLs supported by Publisher - * - * @param array $urls - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function addHubUrls(array $urls) - { - foreach ($urls as $url) { - $this->addHubUrl($url); - } - return $this; - } - - /** - * Remove a Hub Server URL - * - * @param string $url - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function removeHubUrl($url) - { - if (!in_array($url, $this->getHubUrls())) { - return $this; - } - $key = array_search($url, $this->_hubUrls); - unset($this->_hubUrls[$key]); - return $this; - } - - /** - * Return an array of unique Hub Server URLs currently available - * - * @return array - */ - public function getHubUrls() - { - $this->_hubUrls = array_unique($this->_hubUrls); - return $this->_hubUrls; - } - - /** - * Add a URL to a topic (Atom or RSS feed) which has been updated - * - * @param string $url - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function addUpdatedTopicUrl($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' - .' of "' . $url . '" must be a non-empty string and a valid' - .'URL'); - } - $this->_updatedTopicUrls[] = $url; - return $this; - } - - /** - * Add an array of Topic URLs which have been updated - * - * @param array $urls - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function addUpdatedTopicUrls(array $urls) - { - foreach ($urls as $url) { - $this->addUpdatedTopicUrl($url); - } - return $this; - } - - /** - * Remove an updated topic URL - * - * @param string $url - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function removeUpdatedTopicUrl($url) - { - if (!in_array($url, $this->getUpdatedTopicUrls())) { - return $this; - } - $key = array_search($url, $this->_updatedTopicUrls); - unset($this->_updatedTopicUrls[$key]); - return $this; - } - - /** - * Return an array of unique updated topic URLs currently available - * - * @return array - */ - public function getUpdatedTopicUrls() - { - $this->_updatedTopicUrls = array_unique($this->_updatedTopicUrls); - return $this->_updatedTopicUrls; - } - - /** - * Notifies a single Hub Server URL of changes - * - * @param string $url The Hub Server's URL - * @return void - * @throws Zend_Feed_Pubsubhubbub_Exception Thrown on failure - */ - public function notifyHub($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' - .' of "' . $url . '" must be a non-empty string and a valid' - .'URL'); - } - $client = $this->_getHttpClient(); - $client->setUri($url); - $response = $client->request(); - if ($response->getStatus() !== 204) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Notification to Hub Server ' - . 'at "' . $url . '" appears to have failed with a status code of "' - . $response->getStatus() . '" and message "' - . $response->getMessage() . '"'); - } - } - - /** - * Notifies all Hub Server URLs of changes - * - * If a Hub notification fails, certain data will be retained in an - * an array retrieved using getErrors(), if a failure occurs for any Hubs - * the isSuccess() check will return FALSE. This method is designed not - * to needlessly fail with an Exception/Error unless from Zend_Http_Client. - * - * @return void - * @throws Zend_Feed_Pubsubhubbub_Exception Thrown if no hubs attached - */ - public function notifyAll() - { - $client = $this->_getHttpClient(); - $hubs = $this->getHubUrls(); - if (empty($hubs)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('No Hub Server URLs' - . ' have been set so no notifcations can be sent'); - } - $this->_errors = array(); - foreach ($hubs as $url) { - $client->setUri($url); - $response = $client->request(); - if ($response->getStatus() !== 204) { - $this->_errors[] = array( - 'response' => $response, - 'hubUrl' => $url - ); - } - } - } - - /** - * Add an optional parameter to the update notification requests - * - * @param string $name - * @param string|null $value - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function setParameter($name, $value = null) - { - if (is_array($name)) { - $this->setParameters($name); - return $this; - } - if (empty($name) || !is_string($name)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' - .' of "' . $name . '" must be a non-empty string'); - } - if ($value === null) { - $this->removeParameter($name); - return $this; - } - if (empty($value) || (!is_string($value) && !is_null($value))) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "value"' - .' of "' . $value . '" must be a non-empty string'); - } - $this->_parameters[$name] = $value; - return $this; - } - - /** - * Add an optional parameter to the update notification requests - * - * @param array $parameters - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function setParameters(array $parameters) - { - foreach ($parameters as $name => $value) { - $this->setParameter($name, $value); - } - return $this; - } - - /** - * Remove an optional parameter for the notification requests - * - * @param string $name - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function removeParameter($name) - { - if (empty($name) || !is_string($name)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' - .' of "' . $name . '" must be a non-empty string'); - } - if (array_key_exists($name, $this->_parameters)) { - unset($this->_parameters[$name]); - } - return $this; - } - - /** - * Return an array of optional parameters for notification requests - * - * @return array - */ - public function getParameters() - { - return $this->_parameters; - } - - /** - * Returns a boolean indicator of whether the notifications to Hub - * Servers were ALL successful. If even one failed, FALSE is returned. - * - * @return bool - */ - public function isSuccess() - { - if (count($this->_errors) > 0) { - return false; - } - return true; - } - - /** - * Return an array of errors met from any failures, including keys: - * 'response' => the Zend_Http_Response object from the failure - * 'hubUrl' => the URL of the Hub Server whose notification failed - * - * @return array - */ - public function getErrors() - { - return $this->_errors; - } - - /** - * Get a basic prepared HTTP client for use - * - * @return Zend_Http_Client - */ - protected function _getHttpClient() - { - $client = Zend_Feed_Pubsubhubbub::getHttpClient(); - $client->setMethod(Zend_Http_Client::POST); - $client->setConfig(array( - 'useragent' => 'Zend_Feed_Pubsubhubbub_Publisher/' . Zend_Version::VERSION, - )); - $params = array(); - $params[] = 'hub.mode=publish'; - $topics = $this->getUpdatedTopicUrls(); - if (empty($topics)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('No updated topic URLs' - . ' have been set'); - } - foreach ($topics as $topicUrl) { - $params[] = 'hub.url=' . urlencode($topicUrl); - } - $optParams = $this->getParameters(); - foreach ($optParams as $name => $value) { - $params[] = urlencode($name) . '=' . urlencode($value); - } - $paramString = implode('&', $params); - $client->setRawData($paramString); - return $client; - } -} diff --git a/src/Pubsubhubbub/Subscriber.php b/src/Pubsubhubbub/Subscriber.php deleted file mode 100644 index 4f3892a5..00000000 --- a/src/Pubsubhubbub/Subscriber.php +++ /dev/null @@ -1,857 +0,0 @@ -setConfig($config); - } - } - - /** - * Process any injected configuration options - * - * @param array|Zend_Config $options Options array or Zend_Config instance - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function setConfig($config) - { - if ($config instanceof Zend_Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' - . ' expected, got ' . gettype($config)); - } - if (array_key_exists('hubUrls', $config)) { - $this->addHubUrls($config['hubUrls']); - } - if (array_key_exists('callbackUrl', $config)) { - $this->setCallbackUrl($config['callbackUrl']); - } - if (array_key_exists('topicUrl', $config)) { - $this->setTopicUrl($config['topicUrl']); - } - if (array_key_exists('storage', $config)) { - $this->setStorage($config['storage']); - } - if (array_key_exists('leaseSeconds', $config)) { - $this->setLeaseSeconds($config['leaseSeconds']); - } - if (array_key_exists('parameters', $config)) { - $this->setParameters($config['parameters']); - } - if (array_key_exists('authentications', $config)) { - $this->addAuthentications($config['authentications']); - } - if (array_key_exists('usePathParameter', $config)) { - $this->usePathParameter($config['usePathParameter']); - } - if (array_key_exists('preferredVerificationMode', $config)) { - $this->setPreferredVerificationMode( - $config['preferredVerificationMode'] - ); - } - return $this; - } - - /** - * Set the topic URL (RSS or Atom feed) to which the intended (un)subscribe - * event will relate - * - * @param string $url - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function setTopicUrl($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' - .' of "' . $url . '" must be a non-empty string and a valid' - .' URL'); - } - $this->_topicUrl = $url; - return $this; - } - - /** - * Set the topic URL (RSS or Atom feed) to which the intended (un)subscribe - * event will relate - * - * @return string - */ - public function getTopicUrl() - { - if (empty($this->_topicUrl)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('A valid Topic (RSS or Atom' - . ' feed) URL MUST be set before attempting any operation'); - } - return $this->_topicUrl; - } - - /** - * Set the number of seconds for which any subscription will remain valid - * - * @param int $seconds - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function setLeaseSeconds($seconds) - { - $seconds = intval($seconds); - if ($seconds <= 0) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Expected lease seconds' - . ' must be an integer greater than zero'); - } - $this->_leaseSeconds = $seconds; - return $this; - } - - /** - * Get the number of lease seconds on subscriptions - * - * @return int - */ - public function getLeaseSeconds() - { - return $this->_leaseSeconds; - } - - /** - * Set the callback URL to be used by Hub Servers when communicating with - * this Subscriber - * - * @param string $url - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function setCallbackUrl($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' - . ' of "' . $url . '" must be a non-empty string and a valid' - . ' URL'); - } - $this->_callbackUrl = $url; - return $this; - } - - /** - * Get the callback URL to be used by Hub Servers when communicating with - * this Subscriber - * - * @return string - */ - public function getCallbackUrl() - { - if (empty($this->_callbackUrl)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('A valid Callback URL MUST be' - . ' set before attempting any operation'); - } - return $this->_callbackUrl; - } - - /** - * Set preferred verification mode (sync or async). By default, this - * Subscriber prefers synchronous verification, but does support - * asynchronous if that's the Hub Server's utilised mode. - * - * Zend_Feed_Pubsubhubbub_Subscriber will always send both modes, whose - * order of occurance in the parameter list determines this preference. - * - * @param string $mode Should be 'sync' or 'async' - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function setPreferredVerificationMode($mode) - { - if ($mode !== Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC - && $mode !== Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid preferred' - . ' mode specified: "' . $mode . '" but should be one of' - . ' Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC or' - . ' Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC'); - } - $this->_preferredVerificationMode = $mode; - return $this; - } - - /** - * Get preferred verification mode (sync or async). - * - * @return string - */ - public function getPreferredVerificationMode() - { - return $this->_preferredVerificationMode; - } - - /** - * Add a Hub Server URL supported by Publisher - * - * @param string $url - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function addHubUrl($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' - . ' of "' . $url . '" must be a non-empty string and a valid' - . ' URL'); - } - $this->_hubUrls[] = $url; - return $this; - } - - /** - * Add an array of Hub Server URLs supported by Publisher - * - * @param array $urls - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function addHubUrls(array $urls) - { - foreach ($urls as $url) { - $this->addHubUrl($url); - } - return $this; - } - - /** - * Remove a Hub Server URL - * - * @param string $url - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function removeHubUrl($url) - { - if (!in_array($url, $this->getHubUrls())) { - return $this; - } - $key = array_search($url, $this->_hubUrls); - unset($this->_hubUrls[$key]); - return $this; - } - - /** - * Return an array of unique Hub Server URLs currently available - * - * @return array - */ - public function getHubUrls() - { - $this->_hubUrls = array_unique($this->_hubUrls); - return $this->_hubUrls; - } - - /** - * Add authentication credentials for a given URL - * - * @param string $url - * @param array $authentication - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function addAuthentication($url, array $authentication) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' - . ' of "' . $url . '" must be a non-empty string and a valid' - . ' URL'); - } - $this->_authentications[$url] = $authentication; - return $this; - } - - /** - * Add authentication credentials for hub URLs - * - * @param array $authentications - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function addAuthentications(array $authentications) - { - foreach ($authentications as $url => $authentication) { - $this->addAuthentication($url, $authentication); - } - return $this; - } - - /** - * Get all hub URL authentication credentials - * - * @return array - */ - public function getAuthentications() - { - return $this->_authentications; - } - - /** - * Set flag indicating whether or not to use a path parameter - * - * @param bool $bool - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function usePathParameter($bool = true) - { - $this->_usePathParameter = $bool; - return $this; - } - - /** - * Add an optional parameter to the (un)subscribe requests - * - * @param string $name - * @param string|null $value - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function setParameter($name, $value = null) - { - if (is_array($name)) { - $this->setParameters($name); - return $this; - } - if (empty($name) || !is_string($name)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' - . ' of "' . $name . '" must be a non-empty string'); - } - if ($value === null) { - $this->removeParameter($name); - return $this; - } - if (empty($value) || (!is_string($value) && !is_null($value))) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "value"' - . ' of "' . $value . '" must be a non-empty string'); - } - $this->_parameters[$name] = $value; - return $this; - } - - /** - * Add an optional parameter to the (un)subscribe requests - * - * @param string $name - * @param string|null $value - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function setParameters(array $parameters) - { - foreach ($parameters as $name => $value) { - $this->setParameter($name, $value); - } - return $this; - } - - /** - * Remove an optional parameter for the (un)subscribe requests - * - * @param string $name - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function removeParameter($name) - { - if (empty($name) || !is_string($name)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' - . ' of "' . $name . '" must be a non-empty string'); - } - if (array_key_exists($name, $this->_parameters)) { - unset($this->_parameters[$name]); - } - return $this; - } - - /** - * Return an array of optional parameters for (un)subscribe requests - * - * @return array - */ - public function getParameters() - { - return $this->_parameters; - } - - /** - * Sets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used to background - * save any verification tokens associated with a subscription or other. - * - * @param Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function setStorage(Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage) - { - $this->_storage = $storage; - return $this; - } - - /** - * Gets an instance of Zend_Feed_Pubsubhubbub_Storage_StorageInterface used - * to background save any verification tokens associated with a subscription - * or other. - * - * @return Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface - */ - public function getStorage() - { - if ($this->_storage === null) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('No storage vehicle ' - . 'has been set.'); - } - return $this->_storage; - } - - /** - * Subscribe to one or more Hub Servers using the stored Hub URLs - * for the given Topic URL (RSS or Atom feed) - * - * @return void - */ - public function subscribeAll() - { - return $this->_doRequest('subscribe'); - } - - /** - * Unsubscribe from one or more Hub Servers using the stored Hub URLs - * for the given Topic URL (RSS or Atom feed) - * - * @return void - */ - public function unsubscribeAll() - { - return $this->_doRequest('unsubscribe'); - } - - /** - * Returns a boolean indicator of whether the notifications to Hub - * Servers were ALL successful. If even one failed, FALSE is returned. - * - * @return bool - */ - public function isSuccess() - { - if (count($this->_errors) > 0) { - return false; - } - return true; - } - - /** - * Return an array of errors met from any failures, including keys: - * 'response' => the Zend_Http_Response object from the failure - * 'hubUrl' => the URL of the Hub Server whose notification failed - * - * @return array - */ - public function getErrors() - { - return $this->_errors; - } - - /** - * Return an array of Hub Server URLs who returned a response indicating - * operation in Asynchronous Verification Mode, i.e. they will not confirm - * any (un)subscription immediately but at a later time (Hubs may be - * doing this as a batch process when load balancing) - * - * @return array - */ - public function getAsyncHubs() - { - return $this->_asyncHubs; - } - - /** - * Executes an (un)subscribe request - * - * @param string $mode - * @return void - */ - protected function _doRequest($mode) - { - $client = $this->_getHttpClient(); - $hubs = $this->getHubUrls(); - if (empty($hubs)) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('No Hub Server URLs' - . ' have been set so no subscriptions can be attempted'); - } - $this->_errors = array(); - $this->_asyncHubs = array(); - foreach ($hubs as $url) { - if (array_key_exists($url, $this->_authentications)) { - $auth = $this->_authentications[$url]; - $client->setAuth($auth[0], $auth[1]); - } - $client->setUri($url); - $client->setRawData($this->_getRequestParameters($url, $mode)); - $response = $client->request(); - if ($response->getStatus() !== 204 - && $response->getStatus() !== 202 - ) { - $this->_errors[] = array( - 'response' => $response, - 'hubUrl' => $url, - ); - /** - * At first I thought it was needed, but the backend storage will - * allow tracking async without any user interference. It's left - * here in case the user is interested in knowing what Hubs - * are using async verification modes so they may update Models and - * move these to asynchronous processes. - */ - } elseif ($response->getStatus() == 202) { - $this->_asyncHubs[] = array( - 'response' => $response, - 'hubUrl' => $url, - ); - } - } - } - - /** - * Get a basic prepared HTTP client for use - * - * @param string $mode Must be "subscribe" or "unsubscribe" - * @return Zend_Http_Client - */ - protected function _getHttpClient() - { - $client = Zend_Feed_Pubsubhubbub::getHttpClient(); - $client->setMethod(Zend_Http_Client::POST); - $client->setConfig(array('useragent' => 'Zend_Feed_Pubsubhubbub_Subscriber/' - . Zend_Version::VERSION)); - return $client; - } - - /** - * Return a list of standard protocol/optional parameters for addition to - * client's POST body that are specific to the current Hub Server URL - * - * @param string $hubUrl - * @param mode $hubUrl - * @return string - */ - protected function _getRequestParameters($hubUrl, $mode) - { - if (!in_array($mode, array('subscribe', 'unsubscribe'))) { - require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid mode specified: "' - . $mode . '" which should have been "subscribe" or "unsubscribe"'); - } - - $params = array( - 'hub.mode' => $mode, - 'hub.topic' => $this->getTopicUrl(), - ); - - if ($this->getPreferredVerificationMode() - == Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC - ) { - $vmodes = array( - Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC, - Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC, - ); - } else { - $vmodes = array( - Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC, - Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC, - ); - } - $params['hub.verify'] = array(); - foreach($vmodes as $vmode) { - $params['hub.verify'][] = $vmode; - } - - /** - * Establish a persistent verify_token and attach key to callback - * URL's path/querystring - */ - $key = $this->_generateSubscriptionKey($params, $hubUrl); - $token = $this->_generateVerifyToken(); - $params['hub.verify_token'] = $token; - - // Note: query string only usable with PuSH 0.2 Hubs - if (!$this->_usePathParameter) { - $params['hub.callback'] = $this->getCallbackUrl() - . '?xhub.subscription=' . Zend_Feed_Pubsubhubbub::urlencode($key); - } else { - $params['hub.callback'] = rtrim($this->getCallbackUrl(), '/') - . '/' . Zend_Feed_Pubsubhubbub::urlencode($key); - } - if ($mode == 'subscribe' && !is_null($this->getLeaseSeconds())) { - $params['hub.lease_seconds'] = $this->getLeaseSeconds(); - } - - // hub.secret not currently supported - $optParams = $this->getParameters(); - foreach ($optParams as $name => $value) { - $params[$name] = $value; - } - - // store subscription to storage - $now = new Zend_Date; - $expires = null; - if (isset($params['hub.lease_seconds'])) { - $expires = $now->add($params['hub.lease_seconds'], Zend_Date::SECOND) - ->get('yyyy-MM-dd HH:mm:ss'); - } - $data = array( - 'id' => $key, - 'topic_url' => $params['hub.topic'], - 'hub_url' => $hubUrl, - 'created_time' => $now->get('yyyy-MM-dd HH:mm:ss'), - 'lease_seconds' => $expires, - 'verify_token' => hash('sha256', $params['hub.verify_token']), - 'secret' => null, - 'expiration_time' => $expires, - 'subscription_state' => Zend_Feed_Pubsubhubbub::SUBSCRIPTION_NOTVERIFIED, - ); - $this->getStorage()->setSubscription($data); - - return $this->_toByteValueOrderedString( - $this->_urlEncode($params) - ); - } - - /** - * Simple helper to generate a verification token used in (un)subscribe - * requests to a Hub Server. Follows no particular method, which means - * it might be improved/changed in future. - * - * @param string $hubUrl The Hub Server URL for which this token will apply - * @return string - */ - protected function _generateVerifyToken() - { - if (!empty($this->_testStaticToken)) { - return $this->_testStaticToken; - } - return uniqid(rand(), true) . time(); - } - - /** - * Simple helper to generate a verification token used in (un)subscribe - * requests to a Hub Server. - * - * @param string $hubUrl The Hub Server URL for which this token will apply - * @return string - */ - protected function _generateSubscriptionKey(array $params, $hubUrl) - { - $keyBase = $params['hub.topic'] . $hubUrl; - $key = md5($keyBase); - return $key; - } - - /** - * URL Encode an array of parameters - * - * @param array $params - * @return array - */ - protected function _urlEncode(array $params) - { - $encoded = array(); - foreach ($params as $key => $value) { - if (is_array($value)) { - $ekey = Zend_Feed_Pubsubhubbub::urlencode($key); - $encoded[$ekey] = array(); - foreach ($value as $duplicateKey) { - $encoded[$ekey][] - = Zend_Feed_Pubsubhubbub::urlencode($duplicateKey); - } - } else { - $encoded[Zend_Feed_Pubsubhubbub::urlencode($key)] - = Zend_Feed_Pubsubhubbub::urlencode($value); - } - } - return $encoded; - } - - /** - * Order outgoing parameters - * - * @param array $params - * @return array - */ - protected function _toByteValueOrderedString(array $params) - { - $return = array(); - uksort($params, 'strnatcmp'); - foreach ($params as $key => $value) { - if (is_array($value)) { - foreach ($value as $keyduplicate) { - $return[] = $key . '=' . $keyduplicate; - } - } else { - $return[] = $key . '=' . $value; - } - } - return implode('&', $return); - } - - /** - * This is STRICTLY for testing purposes only... - */ - protected $_testStaticToken = null; - - final public function setTestStaticToken($token) - { - $this->_testStaticToken = (string) $token; - } -} diff --git a/src/Pubsubhubbub/Subscriber/Callback.php b/src/Pubsubhubbub/Subscriber/Callback.php deleted file mode 100644 index ef6134a5..00000000 --- a/src/Pubsubhubbub/Subscriber/Callback.php +++ /dev/null @@ -1,329 +0,0 @@ -_subscriptionKey = $key; - return $this; - } - - /** - * Handle any callback from a Hub Server responding to a subscription or - * unsubscription request. This should be the Hub Server confirming the - * the request prior to taking action on it. - * - * @param array $httpGetData GET data if available and not in $_GET - * @param bool $sendResponseNow Whether to send response now or when asked - * @return void - */ - public function handle(array $httpGetData = null, $sendResponseNow = false) - { - if ($httpGetData === null) { - $httpGetData = $_GET; - } - - /** - * Handle any feed updates (sorry for the mess :P) - * - * This DOES NOT attempt to process a feed update. Feed updates - * SHOULD be validated/processed by an asynchronous process so as - * to avoid holding up responses to the Hub. - */ - if (strtolower($_SERVER['REQUEST_METHOD']) == 'post' - && $this->_hasValidVerifyToken(null, false) - && ($this->_getHeader('Content-Type') == 'application/atom+xml' - || $this->_getHeader('Content-Type') == 'application/rss+xml' - || $this->_getHeader('Content-Type') == 'application/xml' - || $this->_getHeader('Content-Type') == 'text/xml' - || $this->_getHeader('Content-Type') == 'application/rdf+xml') - ) { - $this->setFeedUpdate($this->_getRawBody()); - $this->getHttpResponse() - ->setHeader('X-Hub-On-Behalf-Of', $this->getSubscriberCount()); - /** - * Handle any (un)subscribe confirmation requests - */ - } elseif ($this->isValidHubVerification($httpGetData)) { - $data = $this->_currentSubscriptionData; - $this->getHttpResponse()->setBody($httpGetData['hub_challenge']); - $data['subscription_state'] = Zend_Feed_Pubsubhubbub::SUBSCRIPTION_VERIFIED; - if (isset($httpGetData['hub_lease_seconds'])) { - $data['lease_seconds'] = $httpGetData['hub_lease_seconds']; - } - $this->getStorage()->setSubscription($data); - /** - * Hey, C'mon! We tried everything else! - */ - } else { - $this->getHttpResponse()->setHttpResponseCode(404); - } - if ($sendResponseNow) { - $this->sendResponse(); - } - } - - /** - * Checks validity of the request simply by making a quick pass and - * confirming the presence of all REQUIRED parameters. - * - * @param array $httpGetData - * @return bool - */ - public function isValidHubVerification(array $httpGetData) - { - /** - * As per the specification, the hub.verify_token is OPTIONAL. This - * implementation of Pubsubhubbub considers it REQUIRED and will - * always send a hub.verify_token parameter to be echoed back - * by the Hub Server. Therefore, its absence is considered invalid. - */ - if (strtolower($_SERVER['REQUEST_METHOD']) !== 'get') { - return false; - } - $required = array( - 'hub_mode', - 'hub_topic', - 'hub_challenge', - 'hub_verify_token', - ); - foreach ($required as $key) { - if (!array_key_exists($key, $httpGetData)) { - return false; - } - } - if ($httpGetData['hub_mode'] !== 'subscribe' - && $httpGetData['hub_mode'] !== 'unsubscribe' - ) { - return false; - } - if ($httpGetData['hub_mode'] == 'subscribe' - && !array_key_exists('hub_lease_seconds', $httpGetData) - ) { - return false; - } - if (!Zend_Uri::check($httpGetData['hub_topic'])) { - return false; - } - - /** - * Attempt to retrieve any Verification Token Key attached to Callback - * URL's path by our Subscriber implementation - */ - if (!$this->_hasValidVerifyToken($httpGetData)) { - return false; - } - return true; - } - - /** - * Sets a newly received feed (Atom/RSS) sent by a Hub as an update to a - * Topic we've subscribed to. - * - * @param string $feed - * @return Zend_Feed_Pubsubhubbub_Subscriber_Callback - */ - public function setFeedUpdate($feed) - { - $this->_feedUpdate = $feed; - return $this; - } - - /** - * Check if any newly received feed (Atom/RSS) update was received - * - * @return bool - */ - public function hasFeedUpdate() - { - if (is_null($this->_feedUpdate)) { - return false; - } - return true; - } - - /** - * Gets a newly received feed (Atom/RSS) sent by a Hub as an update to a - * Topic we've subscribed to. - * - * @return string - */ - public function getFeedUpdate() - { - return $this->_feedUpdate; - } - - /** - * Check for a valid verify_token. By default attempts to compare values - * with that sent from Hub, otherwise merely ascertains its existence. - * - * @param array $httpGetData - * @param bool $checkValue - * @return bool - */ - protected function _hasValidVerifyToken(array $httpGetData = null, $checkValue = true) - { - $verifyTokenKey = $this->_detectVerifyTokenKey($httpGetData); - if (empty($verifyTokenKey)) { - return false; - } - $verifyTokenExists = $this->getStorage()->hasSubscription($verifyTokenKey); - if (!$verifyTokenExists) { - return false; - } - if ($checkValue) { - $data = $this->getStorage()->getSubscription($verifyTokenKey); - $verifyToken = $data['verify_token']; - if ($verifyToken !== hash('sha256', $httpGetData['hub_verify_token'])) { - return false; - } - $this->_currentSubscriptionData = $data; - return true; - } - return true; - } - - /** - * Attempt to detect the verification token key. This would be passed in - * the Callback URL (which we are handling with this class!) as a URI - * path part (the last part by convention). - * - * @param null|array $httpGetData - * @return false|string - */ - protected function _detectVerifyTokenKey(array $httpGetData = null) - { - /** - * Available when sub keys encoding in Callback URL path - */ - if (isset($this->_subscriptionKey)) { - return $this->_subscriptionKey; - } - - /** - * Available only if allowed by PuSH 0.2 Hubs - */ - if (is_array($httpGetData) - && isset($httpGetData['xhub_subscription']) - ) { - return $httpGetData['xhub_subscription']; - } - - /** - * Available (possibly) if corrupted in transit and not part of $_GET - */ - $params = $this->_parseQueryString(); - if (isset($params['xhub.subscription'])) { - return rawurldecode($params['xhub.subscription']); - } - - return false; - } - - /** - * Build an array of Query String parameters. - * This bypasses $_GET which munges parameter names and cannot accept - * multiple parameters with the same key. - * - * @return array|void - */ - protected function _parseQueryString() - { - $params = array(); - $queryString = ''; - if (isset($_SERVER['QUERY_STRING'])) { - $queryString = $_SERVER['QUERY_STRING']; - } - if (empty($queryString)) { - return array(); - } - $parts = explode('&', $queryString); - foreach ($parts as $kvpair) { - $pair = explode('=', $kvpair); - $key = rawurldecode($pair[0]); - $value = rawurldecode($pair[1]); - if (isset($params[$key])) { - if (is_array($params[$key])) { - $params[$key][] = $value; - } else { - $params[$key] = array($params[$key], $value); - } - } else { - $params[$key] = $value; - } - } - return $params; - } -} diff --git a/test/Pubsubhubbub/AllTests.php b/test/Pubsubhubbub/AllTests.php deleted file mode 100644 index 4a6a161e..00000000 --- a/test/Pubsubhubbub/AllTests.php +++ /dev/null @@ -1,67 +0,0 @@ -addTestSuite('Zend_Feed_Pubsubhubbub_PubsubhubbubTest'); - $suite->addTestSuite('Zend_Feed_Pubsubhubbub_PublisherTest'); - $suite->addTestSuite('Zend_Feed_Pubsubhubbub_SubscriberTest'); - $suite->addTestSuite('Zend_Feed_Pubsubhubbub_SubscriberHttpTest'); - $suite->addTestSuite('Zend_Feed_Pubsubhubbub_Subscriber_CallbackTest'); - - return $suite; - } -} - -if (PHPUnit_MAIN_METHOD == 'Zend_Feed_Pubsubhubbub_AllTests::main') { - Zend_Feed_Pubsubhubbub_AllTests::main(); -} diff --git a/test/Pubsubhubbub/Model/AllTests.php b/test/Pubsubhubbub/Model/AllTests.php deleted file mode 100644 index e3cff109..00000000 --- a/test/Pubsubhubbub/Model/AllTests.php +++ /dev/null @@ -1,56 +0,0 @@ -addTestSuite('Zend_Feed_Pubsubhubbub_Model_SubscriptionTest'); - return $suite; - } -} - -if (PHPUnit_MAIN_METHOD == 'Zend_Feed_Pubsubhubbub_Model_AllTests::main') { - Zend_Feed_Pubsubhubbub_AllTests::main(); -} diff --git a/test/Pubsubhubbub/PublisherTest.php b/test/Pubsubhubbub/PublisherTest.php deleted file mode 100644 index 163936d8..00000000 --- a/test/Pubsubhubbub/PublisherTest.php +++ /dev/null @@ -1,324 +0,0 @@ -_publisher = new Zend_Feed_Pubsubhubbub_Publisher; - } - - public function testAddsHubServerUrl() - { - $this->_publisher->addHubUrl('http://www.example.com/hub'); - $this->assertEquals(array('http://www.example.com/hub'), $this->_publisher->getHubUrls()); - } - - public function testAddsHubServerUrlsFromArray() - { - $this->_publisher->addHubUrls(array( - 'http://www.example.com/hub', 'http://www.example.com/hub2' - )); - $this->assertEquals(array( - 'http://www.example.com/hub', 'http://www.example.com/hub2' - ), $this->_publisher->getHubUrls()); - } - - public function testAddsHubServerUrlsFromArrayUsingSetConfig() - { - $this->_publisher->setConfig(array('hubUrls' => array( - 'http://www.example.com/hub', 'http://www.example.com/hub2' - ))); - $this->assertEquals(array( - 'http://www.example.com/hub', 'http://www.example.com/hub2' - ), $this->_publisher->getHubUrls()); - } - - public function testRemovesHubServerUrl() - { - $this->_publisher->addHubUrls(array( - 'http://www.example.com/hub', 'http://www.example.com/hub2' - )); - $this->_publisher->removeHubUrl('http://www.example.com/hub'); - $this->assertEquals(array( - 1 => 'http://www.example.com/hub2' - ), $this->_publisher->getHubUrls()); - } - - public function testRetrievesUniqueHubServerUrlsOnly() - { - $this->_publisher->addHubUrls(array( - 'http://www.example.com/hub', 'http://www.example.com/hub2', - 'http://www.example.com/hub' - )); - $this->assertEquals(array( - 'http://www.example.com/hub', 'http://www.example.com/hub2' - ), $this->_publisher->getHubUrls()); - } - - public function testThrowsExceptionOnSettingEmptyHubServerUrl() - { - try { - $this->_publisher->addHubUrl(''); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - - public function testThrowsExceptionOnSettingNonStringHubServerUrl() - { - try { - $this->_publisher->addHubUrl(123); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - - public function testThrowsExceptionOnSettingInvalidHubServerUrl() - { - try { - $this->_publisher->addHubUrl('http://'); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - public function testAddsUpdatedTopicUrl() - { - $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); - $this->assertEquals(array('http://www.example.com/topic'), $this->_publisher->getUpdatedTopicUrls()); - } - - public function testAddsUpdatedTopicUrlsFromArray() - { - $this->_publisher->addUpdatedTopicUrls(array( - 'http://www.example.com/topic', 'http://www.example.com/topic2' - )); - $this->assertEquals(array( - 'http://www.example.com/topic', 'http://www.example.com/topic2' - ), $this->_publisher->getUpdatedTopicUrls()); - } - - public function testAddsUpdatedTopicUrlsFromArrayUsingSetConfig() - { - $this->_publisher->setConfig(array('updatedTopicUrls' => array( - 'http://www.example.com/topic', 'http://www.example.com/topic2' - ))); - $this->assertEquals(array( - 'http://www.example.com/topic', 'http://www.example.com/topic2' - ), $this->_publisher->getUpdatedTopicUrls()); - } - - public function testRemovesUpdatedTopicUrl() - { - $this->_publisher->addUpdatedTopicUrls(array( - 'http://www.example.com/topic', 'http://www.example.com/topic2' - )); - $this->_publisher->removeUpdatedTopicUrl('http://www.example.com/topic'); - $this->assertEquals(array( - 1 => 'http://www.example.com/topic2' - ), $this->_publisher->getUpdatedTopicUrls()); - } - - public function testRetrievesUniqueUpdatedTopicUrlsOnly() - { - $this->_publisher->addUpdatedTopicUrls(array( - 'http://www.example.com/topic', 'http://www.example.com/topic2', - 'http://www.example.com/topic' - )); - $this->assertEquals(array( - 'http://www.example.com/topic', 'http://www.example.com/topic2' - ), $this->_publisher->getUpdatedTopicUrls()); - } - - public function testThrowsExceptionOnSettingEmptyUpdatedTopicUrl() - { - try { - $this->_publisher->addUpdatedTopicUrl(''); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - - public function testThrowsExceptionOnSettingNonStringUpdatedTopicUrl() - { - try { - $this->_publisher->addUpdatedTopicUrl(123); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - - public function testThrowsExceptionOnSettingInvalidUpdatedTopicUrl() - { - try { - $this->_publisher->addUpdatedTopicUrl('http://'); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - public function testAddsParameter() - { - $this->_publisher->setParameter('foo', 'bar'); - $this->assertEquals(array('foo'=>'bar'), $this->_publisher->getParameters()); - } - - public function testAddsParametersFromArray() - { - $this->_publisher->setParameters(array( - 'foo' => 'bar', 'boo' => 'baz' - )); - $this->assertEquals(array( - 'foo' => 'bar', 'boo' => 'baz' - ), $this->_publisher->getParameters()); - } - - public function testAddsParametersFromArrayInSingleMethod() - { - $this->_publisher->setParameter(array( - 'foo' => 'bar', 'boo' => 'baz' - )); - $this->assertEquals(array( - 'foo' => 'bar', 'boo' => 'baz' - ), $this->_publisher->getParameters()); - } - - public function testAddsParametersFromArrayUsingSetConfig() - { - $this->_publisher->setConfig(array('parameters' => array( - 'foo' => 'bar', 'boo' => 'baz' - ))); - $this->assertEquals(array( - 'foo' => 'bar', 'boo' => 'baz' - ), $this->_publisher->getParameters()); - } - - public function testRemovesParameter() - { - $this->_publisher->setParameters(array( - 'foo' => 'bar', 'boo' => 'baz' - )); - $this->_publisher->removeParameter('boo'); - $this->assertEquals(array( - 'foo' => 'bar' - ), $this->_publisher->getParameters()); - } - - public function testRemovesParameterIfSetToNull() - { - $this->_publisher->setParameters(array( - 'foo' => 'bar', 'boo' => 'baz' - )); - $this->_publisher->setParameter('boo', null); - $this->assertEquals(array( - 'foo' => 'bar' - ), $this->_publisher->getParameters()); - } - - public function testNotifiesHubWithCorrectParameters() - { - Zend_Feed_Pubsubhubbub::setHttpClient(new Zend_Feed_Pubsubhubbub_PublisherTest_ClientSuccess); - $client = Zend_Feed_Pubsubhubbub::getHttpClient(); - $this->_publisher->addHubUrl('http://www.example.com/hub'); - $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); - $this->_publisher->setParameter('foo', 'bar'); - $this->_publisher->notifyAll(); - $this->assertEquals('hub.mode=publish&hub.url=http%3A%2F%2Fwww.example.com%2Ftopic&foo=bar', $client->getBody()); - } - - public function testNotifiesHubWithCorrectParametersAndMultipleTopics() - { - Zend_Feed_Pubsubhubbub::setHttpClient(new Zend_Feed_Pubsubhubbub_PublisherTest_ClientSuccess); - $client = Zend_Feed_Pubsubhubbub::getHttpClient(); - $this->_publisher->addHubUrl('http://www.example.com/hub'); - $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); - $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic2'); - $this->_publisher->notifyAll(); - $this->assertEquals('hub.mode=publish&hub.url=http%3A%2F%2Fwww.example.com%2Ftopic&hub.url=http%3A%2F%2Fwww.example.com%2Ftopic2', $client->getBody()); - } - - public function testNotifiesHubAndReportsSuccess() - { - Zend_Feed_Pubsubhubbub::setHttpClient(new Zend_Feed_Pubsubhubbub_PublisherTest_ClientSuccess); - $client = Zend_Feed_Pubsubhubbub::getHttpClient(); - $this->_publisher->addHubUrl('http://www.example.com/hub'); - $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); - $this->_publisher->setParameter('foo', 'bar'); - $this->_publisher->notifyAll(); - $this->assertTrue($this->_publisher->isSuccess()); - } - - public function testNotifiesHubAndReportsFail() - { - Zend_Feed_Pubsubhubbub::setHttpClient(new Zend_Feed_Pubsubhubbub_PublisherTest_ClientFail); - $client = Zend_Feed_Pubsubhubbub::getHttpClient(); - $this->_publisher->addHubUrl('http://www.example.com/hub'); - $this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic'); - $this->_publisher->setParameter('foo', 'bar'); - $this->_publisher->notifyAll(); - $this->assertFalse($this->_publisher->isSuccess()); - } - -} - -// Some stubs for what Http_Client would be doing - -class Zend_Feed_Pubsubhubbub_PublisherTest_ClientSuccess extends Zend_Http_Client -{ - public function request($method = null) { - $response = new Zend_Feed_Pubsubhubbub_PublisherTest_ResponseSuccess; - return $response; - } - public function getBody(){return $this->_prepareBody();} -} -class Zend_Feed_Pubsubhubbub_PublisherTest_ClientFail extends Zend_Http_Client -{ - public function request($method = null) { - $response = new Zend_Feed_Pubsubhubbub_PublisherTest_ResponseFail; - return $response; - } - public function getBody(){return $this->_prepareBody();} -} -class Zend_Feed_Pubsubhubbub_PublisherTest_ResponseSuccess -{ - public function getStatus(){return 204;} -} -class Zend_Feed_Pubsubhubbub_PublisherTest_ResponseFail -{ - public function getStatus(){return 404;} -} diff --git a/test/Pubsubhubbub/PubsubhubbubTest.php b/test/Pubsubhubbub/PubsubhubbubTest.php deleted file mode 100644 index 417c77b9..00000000 --- a/test/Pubsubhubbub/PubsubhubbubTest.php +++ /dev/null @@ -1,59 +0,0 @@ -assertType('Test_Http_Client_Pubsub', Zend_Feed_Pubsubhubbub::getHttpClient()); - } - - public function testCanDetectHubs() - { - $feed = Zend_Feed_Reader::importFile(dirname(__FILE__) . '/_files/rss20.xml'); - $this->assertEquals(array( - 'http://www.example.com/hub', 'http://www.example.com/hub2' - ), Zend_Feed_Pubsubhubbub::detectHubs($feed)); - } - -} - -class Test_Http_Client_Pubsub extends Zend_Http_Client {} diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php deleted file mode 100644 index 30ddc2c6..00000000 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ /dev/null @@ -1,466 +0,0 @@ -_callback = new Zend_Feed_Pubsubhubbub_Subscriber_Callback; - - $this->_adapter = $this->_getCleanMock( - 'Zend_Db_Adapter_Abstract' - ); - $this->_tableGateway = $this->_getCleanMock( - 'Zend_Db_Table_Abstract' - ); - $this->_rowset = $this->_getCleanMock( - 'Zend_Db_Table_Rowset_Abstract' - ); - - $this->_tableGateway->expects($this->any())->method('getAdapter') - ->will($this->returnValue($this->_adapter)); - $storage = new Zend_Feed_Pubsubhubbub_Model_Subscription($this->_tableGateway); - $this->_callback->setStorage($storage); - - $this->_get = array( - 'hub_mode' => 'subscribe', - 'hub_topic' => 'http://www.example.com/topic', - 'hub_challenge' => 'abc', - 'hub_verify_token' => 'cba', - 'hub_mode' => 'subscribe', - 'hub_lease_seconds' => '1234567' - ); - - $this->_originalServer = $_SERVER; - $_SERVER['REQUEST_METHOD'] = 'get'; - $_SERVER['QUERY_STRING'] = 'xhub.subscription=verifytokenkey'; - } - - public function tearDown() - { - $_SERVER = $this->_originalServer; - } - - - public function testCanSetHttpResponseObject() - { - $this->_callback->setHttpResponse(new Zend_Feed_Pubsubhubbub_HttpResponse); - $this->assertTrue($this->_callback->getHttpResponse() instanceof Zend_Feed_Pubsubhubbub_HttpResponse); - } - - public function testCanUsesDefaultHttpResponseObject() - { - $this->assertTrue($this->_callback->getHttpResponse() instanceof Zend_Feed_Pubsubhubbub_HttpResponse); - } - - public function testThrowsExceptionOnInvalidHttpResponseObjectSet() - { - try { - $this->_callback->setHttpResponse(new stdClass); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - public function testThrowsExceptionIfNonObjectSetAsHttpResponseObject() - { - try { - $this->_callback->setHttpResponse(''); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - public function testCanSetSubscriberCount() - { - $this->_callback->setSubscriberCount('10000'); - $this->assertEquals(10000, $this->_callback->getSubscriberCount()); - } - - public function testDefaultSubscriberCountIsOne() - { - $this->assertEquals(1, $this->_callback->getSubscriberCount()); - } - - public function testThrowsExceptionOnSettingZeroAsSubscriberCount() - { - try { - $this->_callback->setSubscriberCount(0); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - public function testThrowsExceptionOnSettingLessThanZeroAsSubscriberCount() - { - try { - $this->_callback->setSubscriberCount(-1); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntegerAsSubscriberCount() - { - try { - $this->_callback->setSubscriberCount('0aa'); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - - public function testCanSetStorageImplementation() - { - $storage = new Zend_Feed_Pubsubhubbub_Model_Subscription($this->_tableGateway); - $this->_callback->setStorage($storage); - $this->assertThat($this->_callback->getStorage(), $this->identicalTo($storage)); - } - - public function testValidatesValidHttpGetData() - { - $this->_tableGateway->expects($this->any()) - ->method('find') - ->with($this->equalTo('verifytokenkey')) - ->will($this->returnValue($this->_rowset)); - $this->_rowset->expects($this->any()) - ->method('current') - ->will($this->returnValue(array( - 'verify_token' => hash('sha256', 'cba') - ))); - $this->assertTrue($this->_callback->isValidHubVerification($this->_get)); - } - - public function testReturnsFalseIfHubVerificationNotAGetRequest() - { - $_SERVER['REQUEST_METHOD'] = 'POST'; - $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); - } - - public function testReturnsFalseIfModeMissingFromHttpGetData() - { - unset($this->_get['hub_mode']); - $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); - } - - public function testReturnsFalseIfTopicMissingFromHttpGetData() - { - unset($this->_get['hub_topic']); - $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); - } - - public function testReturnsFalseIfChallengeMissingFromHttpGetData() - { - unset($this->_get['hub_challenge']); - $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); - } - - public function testReturnsFalseIfVerifyTokenMissingFromHttpGetData() - { - unset($this->_get['hub_verify_token']); - $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); - } - - public function testReturnsTrueIfModeSetAsUnsubscribeFromHttpGetData() - { - $this->_get['hub_mode'] = 'unsubscribe'; - $this->_tableGateway->expects($this->any()) - ->method('find') - ->with($this->equalTo('verifytokenkey')) - ->will($this->returnValue($this->_rowset)); - $this->_rowset->expects($this->any()) - ->method('current') - ->will($this->returnValue(array( - 'verify_token' => hash('sha256', 'cba') - ))); - $this->assertTrue($this->_callback->isValidHubVerification($this->_get)); - } - - public function testReturnsFalseIfModeNotRecognisedFromHttpGetData() - { - $this->_get['hub_mode'] = 'abc'; - $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); - } - - public function testReturnsFalseIfLeaseSecondsMissedWhenModeIsSubscribeFromHttpGetData() - { - unset($this->_get['hub_lease_seconds']); - $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); - } - - public function testReturnsFalseIfHubTopicInvalidFromHttpGetData() - { - $this->_get['hub_topic'] = 'http://'; - $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); - } - - public function testReturnsFalseIfVerifyTokenRecordDoesNotExistForConfirmRequest() - { - //$this->_callback->setStorage(new Zend_Feed_Pubsubhubbub_Subscriber_CallbackTestStorageHasNot); - $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); - } - - public function testReturnsFalseIfVerifyTokenRecordDoesNotAgreeWithConfirmRequest() - { - //$this->_callback->setStorage(new Zend_Feed_Pubsubhubbub_Subscriber_CallbackTestStorageHasButWrong); - $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); - } - - public function testRespondsToInvalidConfirmationWith404Response() - { - unset($this->_get['hub_mode']); - $this->_callback->handle($this->_get); - $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 404); - } - - public function testRespondsToValidConfirmationWith200Response() - { - $this->_get['hub_mode'] = 'unsubscribe'; - $this->_tableGateway->expects($this->any()) - ->method('find') - ->with($this->equalTo('verifytokenkey')) - ->will($this->returnValue($this->_rowset)); - $rowdata = new stdClass; - $rowdata->id = 'verifytokenkey'; - $rowdata->verify_token = hash('sha256', 'cba'); - $t = new Zend_Date; - $rowdata->created_time = $t->get(Zend_Date::TIMESTAMP); - $rowdata->lease_seconds = 10000; - $this->_rowset->expects($this->any()) - ->method('current') - ->will($this->returnValue($rowdata)); - - $this->_tableGateway->expects($this->once()) - ->method('update') - ->with( - $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Zend_Date::TIMESTAMP),'lease_seconds'=>1234567,'subscription_state'=>'verified','expiration_time'=>$t->add(1234567,Zend_Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), - $this->equalTo('id = \'verifytokenkey\'') - ); - $this->_adapter->expects($this->once()) - ->method('quoteInto') - ->with($this->equalTo('id = ?'), $this->equalTo('verifytokenkey')) - ->will($this->returnValue('id = \'verifytokenkey\'')); - - $this->_callback->handle($this->_get); - $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 200); - } - - public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() - { - $this->_tableGateway->expects($this->any()) - ->method('find') - ->with($this->equalTo('verifytokenkey')) - ->will($this->returnValue($this->_rowset)); - $rowdata = new stdClass; - $rowdata->id = 'verifytokenkey'; - $rowdata->verify_token = hash('sha256', 'cba'); - $t = new Zend_Date; - $rowdata->created_time = $t->get(Zend_Date::TIMESTAMP); - $rowdata->lease_seconds = 10000; - $this->_rowset->expects($this->any()) - ->method('current') - ->will($this->returnValue($rowdata)); - - $this->_tableGateway->expects($this->once()) - ->method('update') - ->with( - $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Zend_Date::TIMESTAMP),'lease_seconds'=>1234567,'subscription_state'=>'verified','expiration_time'=>$t->add(1234567,Zend_Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), - $this->equalTo('id = \'verifytokenkey\'') - ); - $this->_adapter->expects($this->once()) - ->method('quoteInto') - ->with($this->equalTo('id = ?'), $this->equalTo('verifytokenkey')) - ->will($this->returnValue('id = \'verifytokenkey\'')); - $this->_callback->handle($this->_get); - $this->assertTrue($this->_callback->getHttpResponse()->getBody() == 'abc'); - } - - public function testRespondsToValidFeedUpdateRequestWith200Response() - { - $_SERVER['REQUEST_METHOD'] = 'POST'; - $_SERVER['REQUEST_URI'] = '/some/path/callback/verifytokenkey'; - $_SERVER['CONTENT_TYPE'] = 'application/atom+xml'; - $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); - $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; // dirty alternative to php://input - - $this->_tableGateway->expects($this->any()) - ->method('find') - ->with($this->equalTo('verifytokenkey')) - ->will($this->returnValue($this->_rowset)); - $rowdata = new stdClass; - $rowdata->id = 'verifytokenkey'; - $rowdata->verify_token = hash('sha256', 'cba'); - $t = time(); - $rowdata->created_time = $t; - $this->_rowset->expects($this->any()) - ->method('current') - ->will($this->returnValue($rowdata)); - - $this->_callback->handle(array()); - $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 200); - } - - public function testRespondsToInvalidFeedUpdateNotPostWith404Response() - { // yes, this example makes no sense for GET - I know!!! - $_SERVER['REQUEST_METHOD'] = 'GET'; - $_SERVER['REQUEST_URI'] = '/some/path/callback/verifytokenkey'; - $_SERVER['CONTENT_TYPE'] = 'application/atom+xml'; - $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); - $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; - - $this->_callback->handle(array()); - $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 404); - } - - public function testRespondsToInvalidFeedUpdateWrongMimeWith404Response() - { - $_SERVER['REQUEST_METHOD'] = 'POST'; - $_SERVER['REQUEST_URI'] = '/some/path/callback/verifytokenkey'; - $_SERVER['CONTENT_TYPE'] = 'application/kml+xml'; - $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); - $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; - $this->_callback->handle(array()); - $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 404); - } - - /** - * As a judgement call, we must respond to any successful request, regardless - * of the wellformedness of any XML payload, by returning a 2xx response code. - * The validation of feeds and their processing must occur outside the Hubbub - * protocol. - */ - public function testRespondsToInvalidFeedUpdateWrongFeedTypeForMimeWith200Response() - { - $_SERVER['REQUEST_METHOD'] = 'POST'; - $_SERVER['REQUEST_URI'] = '/some/path/callback/verifytokenkey'; - $_SERVER['CONTENT_TYPE'] = 'application/rss+xml'; - $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); - $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; - - $this->_tableGateway->expects($this->any()) - ->method('find') - ->with($this->equalTo('verifytokenkey')) - ->will($this->returnValue($this->_rowset)); - $rowdata = new stdClass; - $rowdata->id = 'verifytokenkey'; - $rowdata->verify_token = hash('sha256', 'cba'); - $t = time(); - $rowdata->created_time = $t; - $this->_rowset->expects($this->any()) - ->method('current') - ->will($this->returnValue($rowdata)); - - $this->_callback->handle(array()); - $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 200); - } - - public function testRespondsToValidFeedUpdateWithXHubOnBehalfOfHeader() - { - $_SERVER['REQUEST_METHOD'] = 'POST'; - $_SERVER['REQUEST_URI'] = '/some/path/callback/verifytokenkey'; - $_SERVER['CONTENT_TYPE'] = 'application/atom+xml'; - $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); - $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; - - $this->_tableGateway->expects($this->any()) - ->method('find') - ->with($this->equalTo('verifytokenkey')) - ->will($this->returnValue($this->_rowset)); - $rowdata = new stdClass; - $rowdata->id = 'verifytokenkey'; - $rowdata->verify_token = hash('sha256', 'cba'); - $t = time(); - $rowdata->created_time = $t; - $this->_rowset->expects($this->any()) - ->method('current') - ->will($this->returnValue($rowdata)); - - $this->_callback->handle(array()); - $this->assertTrue($this->_callback->getHttpResponse()->getHeader('X-Hub-On-Behalf-Of') == 1); - } - - protected function _getCleanMock($className) { - $class = new ReflectionClass($className); - $methods = $class->getMethods(); - $stubMethods = array(); - foreach ($methods as $method) { - if ($method->isPublic() || ($method->isProtected() - && $method->isAbstract())) { - $stubMethods[] = $method->getName(); - } - } - $mocked = $this->getMock( - $className, - $stubMethods, - array(), - $className . '_PubsubSubscriberMock_' . uniqid(), - false - ); - return $mocked; - } - -} - -/** - * Stubs for storage access - * DEPRECATED -class Zend_Feed_Pubsubhubbub_Subscriber_CallbackTestStorageHas implements Zend_Feed_Pubsubhubbub_Storage_StorageInterface -{ - public function setSubscription($key, array $data){} - public function getSubscription($key){ - if ($key == 'verifytokenkey') { - return array( - 'id' => 'verifytokenkey', - 'verify_token' => hash('sha256', 'cba') - ); - } - } - public function hasSubscription($key){return true;} - public function removeSubscription($key){} - public function cleanup($type){} -} -class Zend_Feed_Pubsubhubbub_Subscriber_CallbackTestStorageHasNot implements Zend_Feed_Pubsubhubbub_Storage_StorageInterface -{ - public function setSubscription($key, array $data){} - public function getSubscription($key){} - public function hasSubscription($key){return false;} - public function removeSubscription($key){} - public function cleanup($type){} -} -class Zend_Feed_Pubsubhubbub_Subscriber_CallbackTestStorageHasButWrong implements Zend_Feed_Pubsubhubbub_Storage_StorageInterface -{ - public function setSubscription($key, array $data){} - public function getSubscription($key){return 'wrong';} - public function hasSubscription($key){return true;} - public function removeSubscription($key){} - public function cleanup($type){} -}*/ diff --git a/test/Pubsubhubbub/Subscriber/_files/atom10.xml b/test/Pubsubhubbub/Subscriber/_files/atom10.xml deleted file mode 100644 index 18683bf9..00000000 --- a/test/Pubsubhubbub/Subscriber/_files/atom10.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/test/Pubsubhubbub/SubscriberHttpTest.php b/test/Pubsubhubbub/SubscriberHttpTest.php deleted file mode 100644 index 9d7e5aec..00000000 --- a/test/Pubsubhubbub/SubscriberHttpTest.php +++ /dev/null @@ -1,139 +0,0 @@ -_baseuri must point to a directory on a web server - * containing all the files under the _files directory. You should symlink - * or copy these files and set '_baseuri' properly using the constant in - * TestConfiguration.php (based on TestConfiguration.php.dist) - * - * You can also set the proper constant in your test configuration file to - * point to the right place. - * - * @category Zend - * @package Zend_Feed - * @subpackage UnitTests - * @group Zend_Feed - * @group Zend_Feed_Subsubhubbub - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Feed_Pubsubhubbub_SubscriberHttpTest extends PHPUnit_Framework_TestCase -{ - - protected $_subscriber = null; - - protected $_baseuri; - - protected $_client = null; - - protected $_adapter = null; - - protected $_config = array( - 'adapter' => 'Zend_Http_Client_Adapter_Socket' - ); - - public function setUp() - { - if (defined('TESTS_Zend_Feed_Pubsubhubbub_BASEURI') && - Zend_Uri_Http::check(TESTS_Zend_Feed_Pubsubhubbub_BASEURI)) { - $this->_baseuri = TESTS_Zend_Feed_Pubsubhubbub_BASEURI; - if (substr($this->_baseuri, -1) != '/') $this->_baseuri .= '/'; - $name = $this->getName(); - if (($pos = strpos($name, ' ')) !== false) { - $name = substr($name, 0, $pos); - } - $uri = $this->_baseuri . $name . '.php'; - $this->_adapter = new $this->_config['adapter']; - $this->_client = new Zend_Http_Client($uri, $this->_config); - $this->_client->setAdapter($this->_adapter); - Zend_Feed_Pubsubhubbub::setHttpClient($this->_client); - $this->_subscriber = new Zend_Feed_Pubsubhubbub_Subscriber; - - - $this->_storage = $this->_getCleanMock('Zend_Feed_Pubsubhubbub_Entity_TopicSubscription'); - $this->_subscriber->setStorage($this->_storage); - - } else { - // Skip tests - $this->markTestSkipped("Zend_Feed_Pubsubhubbub_Subscriber dynamic tests' - . ' are not enabled in TestConfiguration.php"); - } - } - - public function testSubscriptionRequestSendsExpectedPostData() - { - $this->_subscriber->setTopicUrl('http://www.example.com/topic'); - $this->_subscriber->addHubUrl($this->_baseuri . '/testRawPostData.php'); - $this->_subscriber->setCallbackUrl('http://www.example.com/callback'); - $this->_subscriber->setTestStaticToken('abc'); // override for testing - $this->_subscriber->subscribeAll(); - $this->assertEquals( - 'hub.callback=http%3A%2F%2Fwww.example.com%2Fcallback%3Fxhub.subscription%3D5536df06b5d' - .'cb966edab3a4c4d56213c16a8184b&hub.lease_seconds=2592000&hub.mode=' - .'subscribe&hub.topic=http%3A%2F%2Fwww.example.com%2Ftopic&hub.veri' - .'fy=sync&hub.verify=async&hub.verify_token=abc', - $this->_client->getLastResponse()->getBody()); - } - - public function testUnsubscriptionRequestSendsExpectedPostData() - { - $this->_subscriber->setTopicUrl('http://www.example.com/topic'); - $this->_subscriber->addHubUrl($this->_baseuri . '/testRawPostData.php'); - $this->_subscriber->setCallbackUrl('http://www.example.com/callback'); - $this->_subscriber->setTestStaticToken('abc'); //override for testing - $this->_subscriber->unsubscribeAll(); - $this->assertEquals( - 'hub.callback=http%3A%2F%2Fwww.example.com%2Fcallback%3Fxhub.subscription%3D5536df06b5d' - .'cb966edab3a4c4d56213c16a8184b&hub.mode=unsubscribe&hub.topic=http' - .'%3A%2F%2Fwww.example.com%2Ftopic&hub.verify=sync&hub.verify=async' - .'&hub.verify_token=abc', - $this->_client->getLastResponse()->getBody()); - } - - protected function _getCleanMock($className) { - $class = new ReflectionClass($className); - $methods = $class->getMethods(); - $stubMethods = array(); - foreach ($methods as $method) { - if ($method->isPublic() || ($method->isProtected() - && $method->isAbstract())) { - $stubMethods[] = $method->getName(); - } - } - $mocked = $this->getMock( - $className, - $stubMethods, - array(), - $className . '_SubscriberHttpTestMock_' . uniqid(), - false - ); - return $mocked; - } - -} diff --git a/test/Pubsubhubbub/SubscriberTest.php b/test/Pubsubhubbub/SubscriberTest.php deleted file mode 100644 index 1ebedf29..00000000 --- a/test/Pubsubhubbub/SubscriberTest.php +++ /dev/null @@ -1,355 +0,0 @@ -_subscriber = new Zend_Feed_Pubsubhubbub_Subscriber; - $this->_adapter = $this->_getCleanMock( - 'Zend_Db_Adapter_Abstract' - ); - $this->_tableGateway = $this->_getCleanMock( - 'Zend_Db_Table_Abstract' - ); - $this->_tableGateway->expects($this->any())->method('getAdapter') - ->will($this->returnValue($this->_adapter)); - } - - - public function testAddsHubServerUrl() - { - $this->_subscriber->addHubUrl('http://www.example.com/hub'); - $this->assertEquals(array('http://www.example.com/hub'), $this->_subscriber->getHubUrls()); - } - - public function testAddsHubServerUrlsFromArray() - { - $this->_subscriber->addHubUrls(array( - 'http://www.example.com/hub', 'http://www.example.com/hub2' - )); - $this->assertEquals(array( - 'http://www.example.com/hub', 'http://www.example.com/hub2' - ), $this->_subscriber->getHubUrls()); - } - - public function testAddsHubServerUrlsFromArrayUsingSetConfig() - { - $this->_subscriber->setConfig(array('hubUrls' => array( - 'http://www.example.com/hub', 'http://www.example.com/hub2' - ))); - $this->assertEquals(array( - 'http://www.example.com/hub', 'http://www.example.com/hub2' - ), $this->_subscriber->getHubUrls()); - } - - public function testRemovesHubServerUrl() - { - $this->_subscriber->addHubUrls(array( - 'http://www.example.com/hub', 'http://www.example.com/hub2' - )); - $this->_subscriber->removeHubUrl('http://www.example.com/hub'); - $this->assertEquals(array( - 1 => 'http://www.example.com/hub2' - ), $this->_subscriber->getHubUrls()); - } - - public function testRetrievesUniqueHubServerUrlsOnly() - { - $this->_subscriber->addHubUrls(array( - 'http://www.example.com/hub', 'http://www.example.com/hub2', - 'http://www.example.com/hub' - )); - $this->assertEquals(array( - 'http://www.example.com/hub', 'http://www.example.com/hub2' - ), $this->_subscriber->getHubUrls()); - } - - public function testThrowsExceptionOnSettingEmptyHubServerUrl() - { - try { - $this->_subscriber->addHubUrl(''); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - public function testThrowsExceptionOnSettingNonStringHubServerUrl() - { - try { - $this->_subscriber->addHubUrl(123); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - public function testThrowsExceptionOnSettingInvalidHubServerUrl() - { - try { - $this->_subscriber->addHubUrl('http://'); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - public function testAddsParameter() - { - $this->_subscriber->setParameter('foo', 'bar'); - $this->assertEquals(array('foo'=>'bar'), $this->_subscriber->getParameters()); - } - - public function testAddsParametersFromArray() - { - $this->_subscriber->setParameters(array( - 'foo' => 'bar', 'boo' => 'baz' - )); - $this->assertEquals(array( - 'foo' => 'bar', 'boo' => 'baz' - ), $this->_subscriber->getParameters()); - } - - public function testAddsParametersFromArrayInSingleMethod() - { - $this->_subscriber->setParameter(array( - 'foo' => 'bar', 'boo' => 'baz' - )); - $this->assertEquals(array( - 'foo' => 'bar', 'boo' => 'baz' - ), $this->_subscriber->getParameters()); - } - - public function testAddsParametersFromArrayUsingSetConfig() - { - $this->_subscriber->setConfig(array('parameters' => array( - 'foo' => 'bar', 'boo' => 'baz' - ))); - $this->assertEquals(array( - 'foo' => 'bar', 'boo' => 'baz' - ), $this->_subscriber->getParameters()); - } - - public function testRemovesParameter() - { - $this->_subscriber->setParameters(array( - 'foo' => 'bar', 'boo' => 'baz' - )); - $this->_subscriber->removeParameter('boo'); - $this->assertEquals(array( - 'foo' => 'bar' - ), $this->_subscriber->getParameters()); - } - - public function testRemovesParameterIfSetToNull() - { - $this->_subscriber->setParameters(array( - 'foo' => 'bar', 'boo' => 'baz' - )); - $this->_subscriber->setParameter('boo', null); - $this->assertEquals(array( - 'foo' => 'bar' - ), $this->_subscriber->getParameters()); - } - - public function testCanSetTopicUrl() - { - $this->_subscriber->setTopicUrl('http://www.example.com/topic'); - $this->assertEquals('http://www.example.com/topic', $this->_subscriber->getTopicUrl()); - } - - public function testThrowsExceptionOnSettingEmptyTopicUrl() - { - try { - $this->_subscriber->setTopicUrl(''); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - - public function testThrowsExceptionOnSettingNonStringTopicUrl() - { - try { - $this->_subscriber->setTopicUrl(123); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - - public function testThrowsExceptionOnSettingInvalidTopicUrl() - { - try { - $this->_subscriber->setTopicUrl('http://'); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - public function testThrowsExceptionOnMissingTopicUrl() - { - try { - $this->_subscriber->getTopicUrl(); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - public function testCanSetCallbackUrl() - { - $this->_subscriber->setCallbackUrl('http://www.example.com/callback'); - $this->assertEquals('http://www.example.com/callback', $this->_subscriber->getCallbackUrl()); - } - - public function testThrowsExceptionOnSettingEmptyCallbackUrl() - { - try { - $this->_subscriber->setCallbackUrl(''); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - - public function testThrowsExceptionOnSettingNonStringCallbackUrl() - { - try { - $this->_subscriber->setCallbackUrl(123); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - - public function testThrowsExceptionOnSettingInvalidCallbackUrl() - { - try { - $this->_subscriber->setCallbackUrl('http://'); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - public function testThrowsExceptionOnMissingCallbackUrl() - { - try { - $this->_subscriber->getCallbackUrl(); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - public function testCanSetLeaseSeconds() - { - $this->_subscriber->setLeaseSeconds('10000'); - $this->assertEquals(10000, $this->_subscriber->getLeaseSeconds()); - } - - public function testThrowsExceptionOnSettingZeroAsLeaseSeconds() - { - try { - $this->_subscriber->setLeaseSeconds(0); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - public function testThrowsExceptionOnSettingLessThanZeroAsLeaseSeconds() - { - try { - $this->_subscriber->setLeaseSeconds(-1); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntegerAsLeaseSeconds() - { - try { - $this->_subscriber->setLeaseSeconds('0aa'); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - public function testCanSetPreferredVerificationMode() - { - $this->_subscriber->setPreferredVerificationMode(Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC); - $this->assertEquals(Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC, $this->_subscriber->getPreferredVerificationMode()); - } - - public function testSetsPreferredVerificationModeThrowsExceptionOnSettingBadMode() - { - try { - $this->_subscriber->setPreferredVerificationMode('abc'); - $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (Zend_Feed_Pubsubhubbub_Exception $e) {} - } - - public function testPreferredVerificationModeDefaultsToSync() - { - $this->assertEquals(Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC, $this->_subscriber->getPreferredVerificationMode()); - } - - public function testCanSetStorageImplementation() - { - $storage = new Zend_Feed_Pubsubhubbub_Model_Subscription($this->_tableGateway); - $this->_subscriber->setStorage($storage); - $this->assertThat($this->_subscriber->getStorage(), $this->identicalTo($storage)); - } - - /** - * @expectedException Zend_Feed_Pubsubhubbub_Exception - */ - public function testGetStorageThrowsExceptionIfNoneSet() - { - $this->_subscriber->getStorage(); - } - - protected function _getCleanMock($className) { - $class = new ReflectionClass($className); - $methods = $class->getMethods(); - $stubMethods = array(); - foreach ($methods as $method) { - if ($method->isPublic() || ($method->isProtected() - && $method->isAbstract())) { - $stubMethods[] = $method->getName(); - } - } - $mocked = $this->getMock( - $className, - $stubMethods, - array(), - $className . '_PubsubSubscriberMock_' . uniqid(), - false - ); - return $mocked; - } - -} diff --git a/test/Pubsubhubbub/_files/rss20.xml b/test/Pubsubhubbub/_files/rss20.xml deleted file mode 100644 index 80b98e12..00000000 --- a/test/Pubsubhubbub/_files/rss20.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - diff --git a/test/Pubsubhubbub/_files/testRawPostData.php b/test/Pubsubhubbub/_files/testRawPostData.php deleted file mode 100644 index 990f7360..00000000 --- a/test/Pubsubhubbub/_files/testRawPostData.php +++ /dev/null @@ -1,3 +0,0 @@ - Date: Sun, 25 Jul 2010 13:08:00 +0100 Subject: [PATCH 161/238] A few fixes to PubSubHubbub - note DB model may be broken --- src/PubSubHubbub/Model/AbstractModel.php | 2 +- src/PubSubHubbub/PubSubHubbub.php | 6 ++---- src/PubSubHubbub/Subscriber/Callback.php | 5 +++-- test/PubSubHubbub/Model/SubscriptionTest.php | 2 +- test/PubSubHubbub/Subscriber/CallbackTest.php | 3 +++ test/PubSubHubbub/_files/rss20.xml | 3 +-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/PubSubHubbub/Model/AbstractModel.php b/src/PubSubHubbub/Model/AbstractModel.php index af29406d..2dddb734 100644 --- a/src/PubSubHubbub/Model/AbstractModel.php +++ b/src/PubSubHubbub/Model/AbstractModel.php @@ -25,7 +25,7 @@ namespace Zend\Feed\PubSubHubbub\Model; /** - * @uses \Zend\DB\Table\Table + * @uses \Zend\Db\Table\Table * @uses \Zend\Registry * @category Zend * @package Zend_Feed_Pubsubhubbub diff --git a/src/PubSubHubbub/PubSubHubbub.php b/src/PubSubHubbub/PubSubHubbub.php index ff13d433..83876062 100644 --- a/src/PubSubHubbub/PubSubHubbub.php +++ b/src/PubSubHubbub/PubSubHubbub.php @@ -66,17 +66,15 @@ class PubSubHubbub * best if directly given an instance of Zend_Feed_Reader_Atom|Rss * to leverage off. * - * @param Zend_Feed_Reader_FeedAbstract|\Zend\Feed\AbstractFeed|string $source + * @param \Zend\Feed\Reader\AbstractFeed|string $source * @return array */ public static function detectHubs($source) { if (is_string($source)) { $feed = Reader\Reader::import($source); - } elseif (is_object($source) && $source instanceof Reader\AbstractFeed) { + } elseif (is_object($source) && $source instanceof Reader\Feed\AbstractFeed) { $feed = $source; - } elseif (is_object($source) && $source instanceof \Zend\Feed\AbstractFeed) { - $feed = Reader\Reader::importFeed($source); } else { throw new Exception('The source parameter was' . ' invalid, i.e. not a URL string or an instance of type' diff --git a/src/PubSubHubbub/Subscriber/Callback.php b/src/PubSubHubbub/Subscriber/Callback.php index 85e42ac6..c578f63d 100644 --- a/src/PubSubHubbub/Subscriber/Callback.php +++ b/src/PubSubHubbub/Subscriber/Callback.php @@ -23,6 +23,7 @@ * @namespace */ namespace Zend\Feed\PubSubHubbub\Subscriber; +use Zend\Feed\PubSubHubbub; /** * @uses \Zend\Feed\PubSubHubbub\PubSubHubbub @@ -34,7 +35,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Callback extends \Zend\Feed\PubSubHubbub\AbstractCallback +class Callback extends PubSubHubbub\AbstractCallback { /** * Contains the content of any feeds sent as updates to the Callback URL @@ -112,7 +113,7 @@ public function handle(array $httpGetData = null, $sendResponseNow = false) } elseif ($this->isValidHubVerification($httpGetData)) { $data = $this->_currentSubscriptionData; $this->getHttpResponse()->setBody($httpGetData['hub_challenge']); - $data['subscription_state'] = \Zend\Feed\PubSubHubbub\PubSubHubbub::SUBSCRIPTION_VERIFIED; + $data['subscription_state'] = PubSubHubbub\PubSubHubbub::SUBSCRIPTION_VERIFIED; if (isset($httpGetData['hub_lease_seconds'])) { $data['lease_seconds'] = $httpGetData['hub_lease_seconds']; } diff --git a/test/PubSubHubbub/Model/SubscriptionTest.php b/test/PubSubHubbub/Model/SubscriptionTest.php index 21726dac..441dd5dd 100644 --- a/test/PubSubHubbub/Model/SubscriptionTest.php +++ b/test/PubSubHubbub/Model/SubscriptionTest.php @@ -70,7 +70,7 @@ public function testImpemetsSubscriptionInterface() protected function _initDb() { if (!extension_loaded('pdo') - && !in_array('sqlite', \PDO::getAvailableDrivers()) + || !in_array('sqlite', \PDO::getAvailableDrivers()) ) { $this->markTestSkipped('Test only with pdo_sqlite'); } diff --git a/test/PubSubHubbub/Subscriber/CallbackTest.php b/test/PubSubHubbub/Subscriber/CallbackTest.php index 55a69c7d..4b4cf6a2 100644 --- a/test/PubSubHubbub/Subscriber/CallbackTest.php +++ b/test/PubSubHubbub/Subscriber/CallbackTest.php @@ -150,6 +150,9 @@ public function testCanSetStorageImplementation() $this->assertThat($this->_callback->getStorage(), $this->identicalTo($storage)); } + /** + * @group ZF2_CONFLICT + */ public function testValidatesValidHttpGetData() { $this->_tableGateway->expects($this->any()) diff --git a/test/PubSubHubbub/_files/rss20.xml b/test/PubSubHubbub/_files/rss20.xml index 80b98e12..b50f91fd 100644 --- a/test/PubSubHubbub/_files/rss20.xml +++ b/test/PubSubHubbub/_files/rss20.xml @@ -1,6 +1,5 @@ - + From 32250d7b0b06e3c00a7f8583040b8876063fe0b9 Mon Sep 17 00:00:00 2001 From: ralph Date: Mon, 26 Jul 2010 19:12:53 +0000 Subject: [PATCH 162/238] ZF-10231 Fixed various unit test issues as a result of ZF-10069 and ZF-9891 git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22688 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Pubsubhubbub/Subscriber/CallbackTest.php | 138 +++++++++++++----- test/Reader/Entry/RssTest.php | 2 +- test/Reader/Feed/RssTest.php | 2 +- 3 files changed, 102 insertions(+), 40 deletions(-) diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php index da864fdb..de28de0e 100644 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -148,15 +148,23 @@ public function testCanSetStorageImplementation() public function testValidatesValidHttpGetData() { + + $mockReturnValue = $this->getMock('Result', array('toArray')); + $mockReturnValue->expects($this->any())->method('toArray')->will($this->returnValue(array( + 'verify_token' => hash('sha256', 'cba') + ))); + $this->_tableGateway->expects($this->any()) ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); $this->_rowset->expects($this->any()) ->method('current') - ->will($this->returnValue(array( - 'verify_token' => hash('sha256', 'cba') - ))); + ->will($this->returnValue($mockReturnValue)); + $this->_rowset->expects($this->any()) + ->method('count') + ->will($this->returnValue(1)); + $this->assertTrue($this->_callback->isValidHubVerification($this->_get)); } @@ -192,6 +200,12 @@ public function testReturnsFalseIfVerifyTokenMissingFromHttpGetData() public function testReturnsTrueIfModeSetAsUnsubscribeFromHttpGetData() { + + $mockReturnValue = $this->getMock('Result', array('toArray')); + $mockReturnValue->expects($this->any())->method('toArray')->will($this->returnValue(array( + 'verify_token' => hash('sha256', 'cba') + ))); + $this->_get['hub_mode'] = 'unsubscribe'; $this->_tableGateway->expects($this->any()) ->method('find') @@ -199,9 +213,12 @@ public function testReturnsTrueIfModeSetAsUnsubscribeFromHttpGetData() ->will($this->returnValue($this->_rowset)); $this->_rowset->expects($this->any()) ->method('current') - ->will($this->returnValue(array( - 'verify_token' => hash('sha256', 'cba') - ))); + ->will($this->returnValue($mockReturnValue)); + // require for the count call on the rowset in Model/Subscription + $this->_rowset->expects($this->any()) + ->method('count') + ->will($this->returnValue(1)); + $this->assertTrue($this->_callback->isValidHubVerification($this->_get)); } @@ -249,15 +266,24 @@ public function testRespondsToValidConfirmationWith200Response() ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); - $rowdata = new stdClass; - $rowdata->id = 'verifytokenkey'; - $rowdata->verify_token = hash('sha256', 'cba'); + $t = new Zend_Date; - $rowdata->created_time = $t->get(Zend_Date::TIMESTAMP); - $rowdata->lease_seconds = 10000; + $rowdata = array( + 'id' => 'verifytokenkey', + 'verify_token' => hash('sha256', 'cba'), + 'created_time' => $t->get(Zend_Date::TIMESTAMP), + 'lease_seconds' => 10000 + ); + + $row = new Zend_Db_Table_Row(array('data' => $rowdata)); + $this->_rowset->expects($this->any()) ->method('current') - ->will($this->returnValue($rowdata)); + ->will($this->returnValue($row)); + // require for the count call on the rowset in Model/Subscription + $this->_rowset->expects($this->any()) + ->method('count') + ->will($this->returnValue(1)); $this->_tableGateway->expects($this->once()) ->method('update') @@ -280,16 +306,25 @@ public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); - $rowdata = new stdClass; - $rowdata->id = 'verifytokenkey'; - $rowdata->verify_token = hash('sha256', 'cba'); + $t = new Zend_Date; - $rowdata->created_time = $t->get(Zend_Date::TIMESTAMP); - $rowdata->lease_seconds = 10000; + $rowdata = array( + 'id' => 'verifytokenkey', + 'verify_token' => hash('sha256', 'cba'), + 'created_time' => $t->get(Zend_Date::TIMESTAMP), + 'lease_seconds' => 10000 + ); + + $row = new Zend_Db_Table_Row(array('data' => $rowdata)); + $this->_rowset->expects($this->any()) ->method('current') - ->will($this->returnValue($rowdata)); - + ->will($this->returnValue($row)); + // require for the count call on the rowset in Model/Subscription + $this->_rowset->expects($this->any()) + ->method('count') + ->will($this->returnValue(1)); + $this->_tableGateway->expects($this->once()) ->method('update') ->with( @@ -316,14 +351,23 @@ public function testRespondsToValidFeedUpdateRequestWith200Response() ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); - $rowdata = new stdClass; - $rowdata->id = 'verifytokenkey'; - $rowdata->verify_token = hash('sha256', 'cba'); - $t = time(); - $rowdata->created_time = $t; + + $t = new Zend_Date; + $rowdata = array( + 'id' => 'verifytokenkey', + 'verify_token' => hash('sha256', 'cba'), + 'created_time' => time() + ); + + $row = new Zend_Db_Table_Row(array('data' => $rowdata)); + $this->_rowset->expects($this->any()) ->method('current') - ->will($this->returnValue($rowdata)); + ->will($this->returnValue($row)); + // require for the count call on the rowset in Model/Subscription + $this->_rowset->expects($this->any()) + ->method('count') + ->will($this->returnValue(1)); $this->_callback->handle(array()); $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 200); @@ -370,15 +414,24 @@ public function testRespondsToInvalidFeedUpdateWrongFeedTypeForMimeWith200Respon ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); - $rowdata = new stdClass; - $rowdata->id = 'verifytokenkey'; - $rowdata->verify_token = hash('sha256', 'cba'); - $t = time(); - $rowdata->created_time = $t; + + $rowdata = array( + 'id' => 'verifytokenkey', + 'verify_token' => hash('sha256', 'cba'), + 'created_time' => time(), + 'lease_seconds' => 10000 + ); + + $row = new Zend_Db_Table_Row(array('data' => $rowdata)); + $this->_rowset->expects($this->any()) ->method('current') - ->will($this->returnValue($rowdata)); - + ->will($this->returnValue($row)); + // require for the count call on the rowset in Model/Subscription + $this->_rowset->expects($this->any()) + ->method('count') + ->will($this->returnValue(1)); + $this->_callback->handle(array()); $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 200); } @@ -395,14 +448,23 @@ public function testRespondsToValidFeedUpdateWithXHubOnBehalfOfHeader() ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); - $rowdata = new stdClass; - $rowdata->id = 'verifytokenkey'; - $rowdata->verify_token = hash('sha256', 'cba'); - $t = time(); - $rowdata->created_time = $t; + + $rowdata = array( + 'id' => 'verifytokenkey', + 'verify_token' => hash('sha256', 'cba'), + 'created_time' => time(), + 'lease_seconds' => 10000 + ); + + $row = new Zend_Db_Table_Row(array('data' => $rowdata)); + $this->_rowset->expects($this->any()) ->method('current') - ->will($this->returnValue($rowdata)); + ->will($this->returnValue($row)); + // require for the count call on the rowset in Model/Subscription + $this->_rowset->expects($this->any()) + ->method('count') + ->will($this->returnValue(1)); $this->_callback->handle(array()); $this->assertTrue($this->_callback->getHttpResponse()->getHeader('X-Hub-On-Behalf-Of') == 1); diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index 13c3f8c1..80bfe822 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -1909,7 +1909,7 @@ public function testParsesCorrectDateIfMissingOffsetWhenSystemUsesUSLocale() $entry = $feed->current(); $fdate = $entry->getDateModified(); $edate = new Zend_Date; - $edate->set('2010-01-04T08:14:00-0600', Zend_Date::ISO_8601); + $edate->set('2010-01-04T02:14:00-0600', Zend_Date::ISO_8601); Zend_Registry::getInstance()->offsetUnset('Zend_Locale'); $this->assertTrue($edate->equals($fdate)); } diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index d09d8dee..e766a559 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -2145,7 +2145,7 @@ public function testParsesCorrectDateIfMissingOffsetWhenSystemUsesUSLocale() ); $fdate = $feed->getDateModified(); $edate = new Zend_Date; - $edate->set('2010-01-04T08:14:00-0600', Zend_Date::ISO_8601); + $edate->set('2010-01-04T02:14:00-0600', Zend_Date::ISO_8601); Zend_Registry::getInstance()->offsetUnset('Zend_Locale'); $this->assertTrue($edate->equals($fdate)); } From cd50dd836f0ed3d08d9f1734a67bbbf8321c9d27 Mon Sep 17 00:00:00 2001 From: ramon Date: Tue, 27 Jul 2010 04:36:47 +0000 Subject: [PATCH 163/238] [ZF-10231] Unitests: - tests yet presented some failures. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22698 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Pubsubhubbub/Model/SubscriptionTest.php | 10 ++- test/Pubsubhubbub/Subscriber/CallbackTest.php | 67 ++++++++++--------- 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/test/Pubsubhubbub/Model/SubscriptionTest.php b/test/Pubsubhubbub/Model/SubscriptionTest.php index 974c1af2..efd0ac38 100644 --- a/test/Pubsubhubbub/Model/SubscriptionTest.php +++ b/test/Pubsubhubbub/Model/SubscriptionTest.php @@ -68,10 +68,14 @@ public function testImpemetsSubscriptionInterface() protected function _initDb() { - if (!extension_loaded('pdo') - && !in_array('sqlite', PDO::getAvailableDrivers())) { - $this->markTestSkipped('Test only with pdo_sqlite'); + if (!extension_loaded('pdo')) { + $this->markTestSkipped("extension 'PDO' is not loaded"); } + + if (!in_array('sqlite', PDO::getAvailableDrivers())) { + $this->markTestSkipped("PDO driver 'sqlite' is not available"); + } + $db = Zend_Db::factory('Pdo_Sqlite', array('dbname' => ':memory:')); Zend_Db_Table::setDefaultAdapter($db); $this->_createTable(); diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php index de28de0e..3611e101 100644 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -40,7 +40,7 @@ class Zend_Feed_Pubsubhubbub_Subscriber_CallbackTest extends PHPUnit_Framework_T public function setUp() { $this->_callback = new Zend_Feed_Pubsubhubbub_Subscriber_Callback; - + $this->_adapter = $this->_getCleanMock( 'Zend_Db_Adapter_Abstract' ); @@ -50,7 +50,7 @@ public function setUp() $this->_rowset = $this->_getCleanMock( 'Zend_Db_Table_Rowset_Abstract' ); - + $this->_tableGateway->expects($this->any())->method('getAdapter') ->will($this->returnValue($this->_adapter)); $storage = new Zend_Feed_Pubsubhubbub_Model_Subscription($this->_tableGateway); @@ -148,7 +148,7 @@ public function testCanSetStorageImplementation() public function testValidatesValidHttpGetData() { - + $mockReturnValue = $this->getMock('Result', array('toArray')); $mockReturnValue->expects($this->any())->method('toArray')->will($this->returnValue(array( 'verify_token' => hash('sha256', 'cba') @@ -197,15 +197,15 @@ public function testReturnsFalseIfVerifyTokenMissingFromHttpGetData() unset($this->_get['hub_verify_token']); $this->assertFalse($this->_callback->isValidHubVerification($this->_get)); } - + public function testReturnsTrueIfModeSetAsUnsubscribeFromHttpGetData() { - + $mockReturnValue = $this->getMock('Result', array('toArray')); $mockReturnValue->expects($this->any())->method('toArray')->will($this->returnValue(array( 'verify_token' => hash('sha256', 'cba') ))); - + $this->_get['hub_mode'] = 'unsubscribe'; $this->_tableGateway->expects($this->any()) ->method('find') @@ -218,7 +218,7 @@ public function testReturnsTrueIfModeSetAsUnsubscribeFromHttpGetData() $this->_rowset->expects($this->any()) ->method('count') ->will($this->returnValue(1)); - + $this->assertTrue($this->_callback->isValidHubVerification($this->_get)); } @@ -266,7 +266,7 @@ public function testRespondsToValidConfirmationWith200Response() ->method('find') ->with($this->equalTo('verifytokenkey')) ->will($this->returnValue($this->_rowset)); - + $t = new Zend_Date; $rowdata = array( 'id' => 'verifytokenkey', @@ -274,9 +274,10 @@ public function testRespondsToValidConfirmationWith200Response() 'created_time' => $t->get(Zend_Date::TIMESTAMP), 'lease_seconds' => 10000 ); - + + require_once 'Zend/Db/Table/Row.php'; $row = new Zend_Db_Table_Row(array('data' => $rowdata)); - + $this->_rowset->expects($this->any()) ->method('current') ->will($this->returnValue($row)); @@ -284,7 +285,7 @@ public function testRespondsToValidConfirmationWith200Response() $this->_rowset->expects($this->any()) ->method('count') ->will($this->returnValue(1)); - + $this->_tableGateway->expects($this->once()) ->method('update') ->with( @@ -294,8 +295,8 @@ public function testRespondsToValidConfirmationWith200Response() $this->_adapter->expects($this->once()) ->method('quoteInto') ->with($this->equalTo('id = ?'), $this->equalTo('verifytokenkey')) - ->will($this->returnValue('id = \'verifytokenkey\'')); - + ->will($this->returnValue('id = \'verifytokenkey\'')); + $this->_callback->handle($this->_get); $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 200); } @@ -314,9 +315,9 @@ public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() 'created_time' => $t->get(Zend_Date::TIMESTAMP), 'lease_seconds' => 10000 ); - - $row = new Zend_Db_Table_Row(array('data' => $rowdata)); - + + $row = new Zend_Db_Table_Row(array('data' => $rowdata)); + $this->_rowset->expects($this->any()) ->method('current') ->will($this->returnValue($row)); @@ -346,7 +347,7 @@ public function testRespondsToValidFeedUpdateRequestWith200Response() $_SERVER['CONTENT_TYPE'] = 'application/atom+xml'; $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; // dirty alternative to php://input - + $this->_tableGateway->expects($this->any()) ->method('find') ->with($this->equalTo('verifytokenkey')) @@ -358,9 +359,9 @@ public function testRespondsToValidFeedUpdateRequestWith200Response() 'verify_token' => hash('sha256', 'cba'), 'created_time' => time() ); - - $row = new Zend_Db_Table_Row(array('data' => $rowdata)); - + + $row = new Zend_Db_Table_Row(array('data' => $rowdata)); + $this->_rowset->expects($this->any()) ->method('current') ->will($this->returnValue($row)); @@ -368,11 +369,11 @@ public function testRespondsToValidFeedUpdateRequestWith200Response() $this->_rowset->expects($this->any()) ->method('count') ->will($this->returnValue(1)); - + $this->_callback->handle(array()); $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 200); } - + public function testRespondsToInvalidFeedUpdateNotPostWith404Response() { // yes, this example makes no sense for GET - I know!!! $_SERVER['REQUEST_METHOD'] = 'GET'; @@ -380,7 +381,7 @@ public function testRespondsToInvalidFeedUpdateNotPostWith404Response() $_SERVER['CONTENT_TYPE'] = 'application/atom+xml'; $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; - + $this->_callback->handle(array()); $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 404); } @@ -409,7 +410,7 @@ public function testRespondsToInvalidFeedUpdateWrongFeedTypeForMimeWith200Respon $_SERVER['CONTENT_TYPE'] = 'application/rss+xml'; $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; - + $this->_tableGateway->expects($this->any()) ->method('find') ->with($this->equalTo('verifytokenkey')) @@ -421,9 +422,9 @@ public function testRespondsToInvalidFeedUpdateWrongFeedTypeForMimeWith200Respon 'created_time' => time(), 'lease_seconds' => 10000 ); - - $row = new Zend_Db_Table_Row(array('data' => $rowdata)); - + + $row = new Zend_Db_Table_Row(array('data' => $rowdata)); + $this->_rowset->expects($this->any()) ->method('current') ->will($this->returnValue($row)); @@ -443,7 +444,7 @@ public function testRespondsToValidFeedUpdateWithXHubOnBehalfOfHeader() $_SERVER['CONTENT_TYPE'] = 'application/atom+xml'; $feedXml = file_get_contents(dirname(__FILE__) . '/_files/atom10.xml'); $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; - + $this->_tableGateway->expects($this->any()) ->method('find') ->with($this->equalTo('verifytokenkey')) @@ -455,9 +456,9 @@ public function testRespondsToValidFeedUpdateWithXHubOnBehalfOfHeader() 'created_time' => time(), 'lease_seconds' => 10000 ); - - $row = new Zend_Db_Table_Row(array('data' => $rowdata)); - + + $row = new Zend_Db_Table_Row(array('data' => $rowdata)); + $this->_rowset->expects($this->any()) ->method('current') ->will($this->returnValue($row)); @@ -465,11 +466,11 @@ public function testRespondsToValidFeedUpdateWithXHubOnBehalfOfHeader() $this->_rowset->expects($this->any()) ->method('count') ->will($this->returnValue(1)); - + $this->_callback->handle(array()); $this->assertTrue($this->_callback->getHttpResponse()->getHeader('X-Hub-On-Behalf-Of') == 1); } - + protected function _getCleanMock($className) { $class = new ReflectionClass($className); $methods = $class->getMethods(); From f308a0d6dcb5f6ae5a3f16059c541280fe8d351b Mon Sep 17 00:00:00 2001 From: ramon Date: Tue, 27 Jul 2010 04:55:29 +0000 Subject: [PATCH 164/238] [ZF-10231] Unittests: improvement moved require_once to top. git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22699 44c647ce-9c0f-0410-b52a-842ac1e357ba --- test/Pubsubhubbub/Subscriber/CallbackTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Pubsubhubbub/Subscriber/CallbackTest.php b/test/Pubsubhubbub/Subscriber/CallbackTest.php index 3611e101..186549a0 100644 --- a/test/Pubsubhubbub/Subscriber/CallbackTest.php +++ b/test/Pubsubhubbub/Subscriber/CallbackTest.php @@ -22,6 +22,7 @@ require_once 'Zend/Feed/Pubsubhubbub/Subscriber/Callback.php'; require_once 'Zend/Feed/Pubsubhubbub/Model/Subscription.php'; require_once 'Zend/Db/Table/Rowset/Abstract.php'; +require_once 'Zend/Db/Table/Row.php'; /** * @category Zend @@ -275,7 +276,6 @@ public function testRespondsToValidConfirmationWith200Response() 'lease_seconds' => 10000 ); - require_once 'Zend/Db/Table/Row.php'; $row = new Zend_Db_Table_Row(array('data' => $rowdata)); $this->_rowset->expects($this->any()) From 91c4b6b65b098725f8c0d3816c332cef69026ac8 Mon Sep 17 00:00:00 2001 From: Victor Farazdagi Date: Tue, 27 Jul 2010 20:04:18 +0400 Subject: [PATCH 165/238] Removed redundant files (that did raise problems on case insensitive FSs). --- src/Reader/Entry/RSS.php | 632 ------------------------------ src/Writer/Renderer/Entry/RSS.php | 347 ---------------- src/Writer/Renderer/Feed/RSS.php | 498 ----------------------- 3 files changed, 1477 deletions(-) delete mode 100644 src/Reader/Entry/RSS.php delete mode 100644 src/Writer/Renderer/Entry/RSS.php delete mode 100644 src/Writer/Renderer/Feed/RSS.php diff --git a/src/Reader/Entry/RSS.php b/src/Reader/Entry/RSS.php deleted file mode 100644 index 16c4baeb..00000000 --- a/src/Reader/Entry/RSS.php +++ /dev/null @@ -1,632 +0,0 @@ -_xpathQueryRss = '//item[' . ($this->_entryKey+1) . ']'; - $this->_xpathQueryRdf = '//rss:item[' . ($this->_entryKey+1) . ']'; - - $pluginLoader = Reader\Reader::getPluginLoader(); - - $dublinCoreClass = $pluginLoader->getClassName('DublinCore\Entry'); - $this->_extensions['DublinCore\Entry'] = new $dublinCoreClass($entry, $entryKey, $type); - - $contentClass = $pluginLoader->getClassName('Content\Entry'); - $this->_extensions['Content\Entry'] = new $contentClass($entry, $entryKey, $type); - - $atomClass = $pluginLoader->getClassName('Atom\Entry'); - $this->_extensions['Atom\Entry'] = new $atomClass($entry, $entryKey, $type); - - $wfwClass = $pluginLoader->getClassName('WellFormedWeb\Entry'); - $this->_extensions['WellFormedWeb\Entry'] = new $wfwClass($entry, $entryKey, $type); - - $slashClass = $pluginLoader->getClassName('Slash\Entry'); - $this->_extensions['Slash\Entry'] = new $slashClass($entry, $entryKey, $type); - - $threadClass = $pluginLoader->getClassName('Thread\Entry'); - $this->_extensions['Thread\Entry'] = new $threadClass($entry, $entryKey, $type); - } - - /** - * Get an author entry - * - * @param DOMElement $element - * @return string - */ - public function getAuthor($index = 0) - { - $authors = $this->getAuthors(); - - if (isset($authors[$index])) { - return $authors[$index]; - } - - return null; - } - - /** - * Get an array with feed authors - * - * @return array - */ - public function getAuthors() - { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; - } - - $authors = array(); - $authors_dc = $this->getExtension('DublinCore')->getAuthors(); - if (!empty($authors_dc)) { - foreach ($authors_dc as $author) { - $authors[] = array( - 'name' => $author['name'] - ); - } - } - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $list = $this->_xpath->query($this->_xpathQueryRss . '//author'); - } else { - $list = $this->_xpath->query($this->_xpathQueryRdf . '//rss:author'); - } - if ($list->length) { - foreach ($list as $author) { - $string = trim($author->nodeValue); - $email = null; - $name = null; - $data = array(); - // Pretty rough parsing - but it's a catchall - if (preg_match("/^.*@[^ ]*/", $string, $matches)) { - $data['email'] = trim($matches[0]); - if (preg_match("/\((.*)\)$/", $string, $matches)) { - $data['name'] = $matches[1]; - } - $authors[] = $data; - } - } - } - - if (count($authors) == 0) { - $authors = $this->getExtension('Atom')->getAuthors(); - } else { - $authors = new Reader\Collection\Author( - Reader\Reader::arrayUnique($authors) - ); - } - - if (count($authors) == 0) { - $authors = null; - } - - $this->_data['authors'] = $authors; - - return $this->_data['authors']; - } - - /** - * Get the entry content - * - * @return string - */ - public function getContent() - { - if (array_key_exists('content', $this->_data)) { - return $this->_data['content']; - } - - $content = $this->getExtension('Content')->getContent(); - - if (!$content) { - $content = $this->getDescription(); - } - - if (empty($content)) { - $content = $this->getExtension('Atom')->getContent(); - } - - $this->_data['content'] = $content; - - return $this->_data['content']; - } - - /** - * Get the entry's date of creation - * - * @return string - */ - public function getDateCreated() - { - return $this->getDateModified(); - } - - /** - * Get the entry's date of modification - * - * @return string - */ - public function getDateModified() - { - if (array_key_exists('datemodified', $this->_data)) { - return $this->_data['datemodified']; - } - - $dateModified = null; - $date = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090 - ) { - $dateModified = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/pubDate)'); - if ($dateModified) { - $dateModifiedParsed = strtotime($dateModified); - if ($dateModifiedParsed) { - $date = new Date\Date($dateModifiedParsed); - } else { - $dateStandards = array( - Date\Date::RSS, Date\Date::RFC_822, - Date\Date::RFC_2822, Date\Date::DATES, - ); - $date = new Date\Date; - foreach ($dateStandards as $standard) { - try { - $date->set($dateModified, $standard); - break; - } catch (Date\Exception $e) { - if ($standard == Date\Date::DATES) { - throw new \Zend\Feed\Exception( - 'Could not load date due to unrecognised' - .' format (should follow RFC 822 or 2822):' - . $e->getMessage(), - 0, $e - ); - } - } - } - } - } - } - - if (!$date) { - $date = $this->getExtension('DublinCore')->getDate(); - } - - if (!$date) { - $date = $this->getExtension('Atom')->getDateModified(); - } - - if (!$date) { - $date = null; - } - - $this->_data['datemodified'] = $date; - - return $this->_data['datemodified']; - } - - /** - * Get the entry description - * - * @return string - */ - public function getDescription() - { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; - } - - $description = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090 - ) { - $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/description)'); - } else { - $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRdf.'/rss:description)'); - } - - if (!$description) { - $description = $this->getExtension('DublinCore')->getDescription(); - } - - if (empty($description)) { - $description = $this->getExtension('Atom')->getDescription(); - } - - if (!$description) { - $description = null; - } - - $this->_data['description'] = $description; - - return $this->_data['description']; - } - - /** - * Get the entry enclosure - * @return string - */ - public function getEnclosure() - { - if (array_key_exists('enclosure', $this->_data)) { - return $this->_data['enclosure']; - } - - $enclosure = null; - - if ($this->getType() == Reader\Reader::TYPE_RSS_20) { - $nodeList = $this->_xpath->query($this->_xpathQueryRss . '/enclosure'); - - if ($nodeList->length > 0) { - $enclosure = new \stdClass(); - $enclosure->url = $nodeList->item(0)->getAttribute('url'); - $enclosure->length = $nodeList->item(0)->getAttribute('length'); - $enclosure->type = $nodeList->item(0)->getAttribute('type'); - } - } - - if (!$enclosure) { - $enclosure = $this->getExtension('Atom')->getEnclosure(); - } - - $this->_data['enclosure'] = $enclosure; - - return $this->_data['enclosure']; - } - - /** - * Get the entry ID - * - * @return string - */ - public function getId() - { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; - } - - $id = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090 - ) { - $id = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/guid)'); - } - - if (!$id) { - $id = $this->getExtension('DublinCore')->getId(); - } - - if (empty($id)) { - $id = $this->getExtension('Atom')->getId(); - } - - if (!$id) { - if ($this->getPermalink()) { - $id = $this->getPermalink(); - } elseif ($this->getTitle()) { - $id = $this->getTitle(); - } else { - $id = null; - } - } - - $this->_data['id'] = $id; - - return $this->_data['id']; - } - - /** - * Get a specific link - * - * @param int $index - * @return string - */ - public function getLink($index = 0) - { - if (!array_key_exists('links', $this->_data)) { - $this->getLinks(); - } - - if (isset($this->_data['links'][$index])) { - return $this->_data['links'][$index]; - } - - return null; - } - - /** - * Get all links - * - * @return array - */ - public function getLinks() - { - if (array_key_exists('links', $this->_data)) { - return $this->_data['links']; - } - - $links = array(); - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $list = $this->_xpath->query($this->_xpathQueryRss.'//link'); - } else { - $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:link'); - } - - if (!$list->length) { - $links = $this->getExtension('Atom')->getLinks(); - } else { - foreach ($list as $link) { - $links[] = $link->nodeValue; - } - } - - $this->_data['links'] = $links; - - return $this->_data['links']; - } - - /** - * Get all categories - * - * @return \Zend\Feed\Reader\Collection\Category - */ - public function getCategories() - { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; - } - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && - $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $list = $this->_xpath->query($this->_xpathQueryRss.'//category'); - } else { - $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:category'); - } - - if ($list->length) { - $categoryCollection = new Reader\Collection\Category; - foreach ($list as $category) { - $categoryCollection[] = array( - 'term' => $category->nodeValue, - 'scheme' => $category->getAttribute('domain'), - 'label' => $category->nodeValue, - ); - } - } else { - $categoryCollection = $this->getExtension('DublinCore')->getCategories(); - } - - if (count($categoryCollection) == 0) { - $categoryCollection = $this->getExtension('Atom')->getCategories(); - } - - $this->_data['categories'] = $categoryCollection; - - return $this->_data['categories']; - } - - /** - * Get a permalink to the entry - * - * @return string - */ - public function getPermalink() - { - return $this->getLink(0); - } - - /** - * Get the entry title - * - * @return string - */ - public function getTitle() - { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; - } - - $title = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090 - ) { - $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/title)'); - } else { - $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRdf.'/rss:title)'); - } - - if (!$title) { - $title = $this->getExtension('DublinCore')->getTitle(); - } - - if (!$title) { - $title = $this->getExtension('Atom')->getTitle(); - } - - if (!$title) { - $title = null; - } - - $this->_data['title'] = $title; - - return $this->_data['title']; - } - - /** - * Get the number of comments/replies for current entry - * - * @return string|null - */ - public function getCommentCount() - { - if (array_key_exists('commentcount', $this->_data)) { - return $this->_data['commentcount']; - } - - $commentcount = $this->getExtension('Slash')->getCommentCount(); - - if (!$commentcount) { - $commentcount = $this->getExtension('Thread')->getCommentCount(); - } - - if (!$commentcount) { - $commentcount = $this->getExtension('Atom')->getCommentCount(); - } - - if (!$commentcount) { - $commentcount = null; - } - - $this->_data['commentcount'] = $commentcount; - - return $this->_data['commentcount']; - } - - /** - * Returns a URI pointing to the HTML page where comments can be made on this entry - * - * @return string - */ - public function getCommentLink() - { - if (array_key_exists('commentlink', $this->_data)) { - return $this->_data['commentlink']; - } - - $commentlink = null; - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 - && $this->getType() !== Reader\Reader::TYPE_RSS_090 - ) { - $commentlink = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/comments)'); - } - - if (!$commentlink) { - $commentlink = $this->getExtension('Atom')->getCommentLink(); - } - - if (!$commentlink) { - $commentlink = null; - } - - $this->_data['commentlink'] = $commentlink; - - return $this->_data['commentlink']; - } - - /** - * Returns a URI pointing to a feed of all comments for this entry - * - * @return string - */ - public function getCommentFeedLink() - { - if (array_key_exists('commentfeedlink', $this->_data)) { - return $this->_data['commentfeedlink']; - } - - $commentfeedlink = $this->getExtension('WellFormedWeb')->getCommentFeedLink(); - - if (!$commentfeedlink) { - $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink('rss'); - } - - if (!$commentfeedlink) { - $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink('rdf'); - } - - if (!$commentfeedlink) { - $commentfeedlink = null; - } - - $this->_data['commentfeedlink'] = $commentfeedlink; - - return $this->_data['commentfeedlink']; - } - - /** - * Set the XPath query (incl. on all Extensions) - * - * @param DOMXPath $xpath - */ - public function setXpath(\DOMXPath $xpath) - { - parent::setXpath($xpath); - foreach ($this->_extensions as $extension) { - $extension->setXpath($this->_xpath); - } - } -} diff --git a/src/Writer/Renderer/Entry/RSS.php b/src/Writer/Renderer/Entry/RSS.php deleted file mode 100644 index 127821f3..00000000 --- a/src/Writer/Renderer/Entry/RSS.php +++ /dev/null @@ -1,347 +0,0 @@ -_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); - $this->_dom->formatOutput = true; - $this->_dom->substituteEntities = false; - $entry = $this->_dom->createElement('item'); - $this->_dom->appendChild($entry); - - $this->_setTitle($this->_dom, $entry); - $this->_setDescription($this->_dom, $entry); - $this->_setDateCreated($this->_dom, $entry); - $this->_setDateModified($this->_dom, $entry); - $this->_setLink($this->_dom, $entry); - $this->_setId($this->_dom, $entry); - $this->_setAuthors($this->_dom, $entry); - $this->_setEnclosure($this->_dom, $entry); - $this->_setCommentLink($this->_dom, $entry); - $this->_setCategories($this->_dom, $entry); - foreach ($this->_extensions as $ext) { - $ext->setType($this->getType()); - $ext->setRootElement($this->getRootElement()); - $ext->setDomDocument($this->getDomDocument(), $entry); - $ext->render(); - } - - return $this; - } - - /** - * Set entry title - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setTitle(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getDescription() - && !$this->getDataContainer()->getTitle()) { - $message = 'RSS 2.0 entry elements SHOULD contain exactly one' - . ' title element but a title has not been set. In addition, there' - . ' is no description as required in the absence of a title.'; - $exception = new Feed\Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $title = $dom->createElement('title'); - $root->appendChild($title); - $text = $dom->createTextNode($this->getDataContainer()->getTitle()); - $title->appendChild($text); - } - - /** - * Set entry description - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDescription(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getDescription() - && !$this->getDataContainer()->getTitle()) { - $message = 'RSS 2.0 entry elements SHOULD contain exactly one' - . ' description element but a description has not been set. In' - . ' addition, there is no title element as required in the absence' - . ' of a description.'; - $exception = new Feed\Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - if (!$this->getDataContainer()->getDescription()) { - return; - } - $subtitle = $dom->createElement('description'); - $root->appendChild($subtitle); - $text = $dom->createCDATASection($this->getDataContainer()->getDescription()); - $subtitle->appendChild($text); - } - - /** - * Set date entry was last modified - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getDateModified()) { - return; - } - - $updated = $dom->createElement('pubDate'); - $root->appendChild($updated); - $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(\Zend\Date\Date::RSS) - ); - $updated->appendChild($text); - } - - /** - * Set date entry was created - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) - { - if (!$this->getDataContainer()->getDateCreated()) { - return; - } - if (!$this->getDataContainer()->getDateModified()) { - $this->getDataContainer()->setDateModified( - $this->getDataContainer()->getDateCreated() - ); - } - } - - /** - * Set entry authors - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) - { - $authors = $this->_container->getAuthors(); - if ((!$authors || empty($authors))) { - return; - } - foreach ($authors as $data) { - $author = $this->_dom->createElement('author'); - $name = $data['name']; - if (array_key_exists('email', $data)) { - $name = $data['email'] . ' (' . $data['name'] . ')'; - } - $text = $dom->createTextNode($name); - $author->appendChild($text); - $root->appendChild($author); - } - } - - /** - * Set entry enclosure - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setEnclosure(\DOMDocument $dom, \DOMElement $root) - { - $data = $this->_container->getEnclosure(); - if ((!$data || empty($data))) { - return; - } - if (!isset($data['type'])) { - $exception = new \Zend\Feed\Exception('Enclosure "type" is not set'); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - if (!isset($data['length'])) { - $exception = new \Zend\Feed\Exception('Enclosure "length" is not set'); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - if (isset($data['length']) && (int) $data['length'] <= 0) { - $exception = new \Zend\Feed\Exception('Enclosure "length" must be an integer' - . ' indicating the content\'s length in bytes'); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $enclosure = $this->_dom->createElement('enclosure'); - $enclosure->setAttribute('type', $data['type']); - $enclosure->setAttribute('length', $data['length']); - $enclosure->setAttribute('url', $data['uri']); - $root->appendChild($enclosure); - } - - /** - * Set link to entry - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setLink(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getLink()) { - return; - } - $link = $dom->createElement('link'); - $root->appendChild($link); - $text = $dom->createTextNode($this->getDataContainer()->getLink()); - $link->appendChild($text); - } - - /** - * Set entry identifier - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setId(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getId() - && !$this->getDataContainer()->getLink()) { - return; - } - - $id = $dom->createElement('guid'); - $root->appendChild($id); - if (!$this->getDataContainer()->getId()) { - $this->getDataContainer()->setId( - $this->getDataContainer()->getLink()); - } - $text = $dom->createTextNode($this->getDataContainer()->getId()); - $id->appendChild($text); - if (!\Zend\Uri\Url::validate($this->getDataContainer()->getId())) { - $id->setAttribute('isPermaLink', 'false'); - } - } - - /** - * Set link to entry comments - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCommentLink(\DOMDocument $dom, \DOMElement $root) - { - $link = $this->getDataContainer()->getCommentLink(); - if (!$link) { - return; - } - $clink = $this->_dom->createElement('comments'); - $text = $dom->createTextNode($link); - $clink->appendChild($text); - $root->appendChild($clink); - } - - /** - * Set entry categories - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCategories(\DOMDocument $dom, \DOMElement $root) - { - $categories = $this->getDataContainer()->getCategories(); - if (!$categories) { - return; - } - foreach ($categories as $cat) { - $category = $dom->createElement('category'); - if (isset($cat['scheme'])) { - $category->setAttribute('domain', $cat['scheme']); - } - $text = $dom->createCDATASection($cat['term']); - $category->appendChild($text); - $root->appendChild($category); - } - } -} diff --git a/src/Writer/Renderer/Feed/RSS.php b/src/Writer/Renderer/Feed/RSS.php deleted file mode 100644 index b97aec4a..00000000 --- a/src/Writer/Renderer/Feed/RSS.php +++ /dev/null @@ -1,498 +0,0 @@ -_container->getEncoding()) { - $this->_container->setEncoding('UTF-8'); - } - $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); - $this->_dom->formatOutput = true; - $this->_dom->substituteEntities = false; - $rss = $this->_dom->createElement('rss'); - $this->setRootElement($rss); - $rss->setAttribute('version', '2.0'); - - $channel = $this->_dom->createElement('channel'); - $rss->appendChild($channel); - $this->_dom->appendChild($rss); - $this->_setLanguage($this->_dom, $channel); - $this->_setBaseUrl($this->_dom, $channel); - $this->_setTitle($this->_dom, $channel); - $this->_setDescription($this->_dom, $channel); - $this->_setImage($this->_dom, $channel); - $this->_setDateCreated($this->_dom, $channel); - $this->_setDateModified($this->_dom, $channel); - $this->_setLastBuildDate($this->_dom, $channel); - $this->_setGenerator($this->_dom, $channel); - $this->_setLink($this->_dom, $channel); - $this->_setAuthors($this->_dom, $channel); - $this->_setCopyright($this->_dom, $channel); - $this->_setCategories($this->_dom, $channel); - - foreach ($this->_extensions as $ext) { - $ext->setType($this->getType()); - $ext->setRootElement($this->getRootElement()); - $ext->setDomDocument($this->getDomDocument(), $channel); - $ext->render(); - } - - foreach ($this->_container as $entry) { - if ($this->getDataContainer()->getEncoding()) { - $entry->setEncoding($this->getDataContainer()->getEncoding()); - } - if ($entry instanceof Feed\Writer\Entry) { - $renderer = new Feed\Writer\Renderer\Entry\RSS($entry); - } else { - continue; - } - if ($this->_ignoreExceptions === true) { - $renderer->ignoreExceptions(); - } - $renderer->setType($this->getType()); - $renderer->setRootElement($this->_dom->documentElement); - $renderer->render(); - $element = $renderer->getElement(); - $imported = $this->_dom->importNode($element, true); - $channel->appendChild($imported); - } - return $this; - } - - /** - * Set feed language - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setLanguage(\DOMDocument $dom, \DOMElement $root) - { - $lang = $this->getDataContainer()->getLanguage(); - if (!$lang) { - return; - } - $language = $dom->createElement('language'); - $root->appendChild($language); - $language->nodeValue = $lang; - } - - /** - * Set feed title - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setTitle(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getTitle()) { - $message = 'RSS 2.0 feed elements MUST contain exactly one' - . ' title element but a title has not been set'; - $exception = new Feed\Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - - $title = $dom->createElement('title'); - $root->appendChild($title); - $text = $dom->createTextNode($this->getDataContainer()->getTitle()); - $title->appendChild($text); - } - - /** - * Set feed description - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDescription(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getDescription()) { - $message = 'RSS 2.0 feed elements MUST contain exactly one' - . ' description element but one has not been set'; - $exception = new Feed\Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $subtitle = $dom->createElement('description'); - $root->appendChild($subtitle); - $text = $dom->createTextNode($this->getDataContainer()->getDescription()); - $subtitle->appendChild($text); - } - - /** - * Set date feed was last modified - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getDateModified()) { - return; - } - - $updated = $dom->createElement('pubDate'); - $root->appendChild($updated); - $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(\Zend\Date\Date::RSS) - ); - $updated->appendChild($text); - } - - /** - * Set feed generator string - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getGenerator()) { - $this->getDataContainer()->setGenerator('Zend_Feed_Writer', - \Zend\Version::VERSION, 'http://framework.zend.com'); - } - - $gdata = $this->getDataContainer()->getGenerator(); - $generator = $dom->createElement('generator'); - $root->appendChild($generator); - $name = $gdata['name']; - if (array_key_exists('version', $gdata)) { - $name .= ' ' . $gdata['version']; - } - if (array_key_exists('uri', $gdata)) { - $name .= ' (' . $gdata['uri'] . ')'; - } - $text = $dom->createTextNode($name); - $generator->appendChild($text); - } - - /** - * Set link to feed - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setLink(\DOMDocument $dom, \DOMElement $root) - { - $value = $this->getDataContainer()->getLink(); - if(!$value) { - $message = 'RSS 2.0 feed elements MUST contain exactly one' - . ' link element but one has not been set'; - $exception = new Feed\Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $link = $dom->createElement('link'); - $root->appendChild($link); - $text = $dom->createTextNode($value); - $link->appendChild($text); - if (!\Zend\Uri\Url::validate($value)) { - $link->setAttribute('isPermaLink', 'false'); - } - } - - /** - * Set feed authors - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) - { - $authors = $this->getDataContainer()->getAuthors(); - if (!$authors || empty($authors)) { - return; - } - foreach ($authors as $data) { - $author = $this->_dom->createElement('author'); - $name = $data['name']; - if (array_key_exists('email', $data)) { - $name = $data['email'] . ' (' . $data['name'] . ')'; - } - $text = $dom->createTextNode($name); - $author->appendChild($text); - $root->appendChild($author); - } - } - - /** - * Set feed copyright - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCopyright(\DOMDocument $dom, \DOMElement $root) - { - $copyright = $this->getDataContainer()->getCopyright(); - if (!$copyright) { - return; - } - $copy = $dom->createElement('copyright'); - $root->appendChild($copy); - $text = $dom->createTextNode($copyright); - $copy->appendChild($text); - } - - /** - * Set feed channel image - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setImage(\DOMDocument $dom, \DOMElement $root) - { - $image = $this->getDataContainer()->getImage(); - if (!$image) { - return; - } - if (!isset($image['title']) || empty($image['title']) - || !is_string($image['title'])) { - $message = 'RSS 2.0 feed images must include a title'; - $exception = new \Zend\Feed\Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - if (empty($image['link']) || !is_string($image['link']) - || !\Zend\Uri\Url::validate($image['link'])) { - $message = 'Invalid parameter: parameter \'link\'' - . ' must be a non-empty string and valid URI/IRI'; - $exception = new \Zend\Feed\Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $img = $dom->createElement('image'); - $root->appendChild($img); - $url = $dom->createElement('url'); - $text = $dom->createTextNode($image['uri']); - $url->appendChild($text); - $title = $dom->createElement('title'); - $text = $dom->createTextNode($image['title']); - $title->appendChild($text); - $link = $dom->createElement('link'); - $text = $dom->createTextNode($image['link']); - $link->appendChild($text); - $img->appendChild($url); - $img->appendChild($title); - $img->appendChild($link); - if (isset($image['height'])) { - if (!ctype_digit((string) $image['height']) || $image['height'] > 400) { - $message = 'Invalid parameter: parameter \'height\'' - . ' must be an integer not exceeding 400'; - $exception = new \Zend\Feed\Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $height = $dom->createElement('height'); - $text = $dom->createTextNode($image['height']); - $height->appendChild($text); - $img->appendChild($height); - } - if (isset($image['width'])) { - if (!ctype_digit((string) $image['width']) || $image['width'] > 144) { - $message = 'Invalid parameter: parameter \'width\'' - . ' must be an integer not exceeding 144'; - $exception = new \Zend\Feed\Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $width = $dom->createElement('width'); - $text = $dom->createTextNode($image['width']); - $width->appendChild($text); - $img->appendChild($width); - } - if (isset($image['description'])) { - if (empty($image['description']) || !is_string($image['description'])) { - $message = 'Invalid parameter: parameter \'description\'' - . ' must be a non-empty string'; - $exception = new \Zend\Feed\Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $desc = $dom->createElement('description'); - $text = $dom->createTextNode($image['description']); - $desc->appendChild($text); - $img->appendChild($desc); - } - } - - - /** - * Set date feed was created - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getDateCreated()) { - return; - } - if(!$this->getDataContainer()->getDateModified()) { - $this->getDataContainer()->setDateModified( - $this->getDataContainer()->getDateCreated() - ); - } - } - - /** - * Set date feed last build date - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setLastBuildDate(\DOMDocument $dom, \DOMElement $root) - { - if(!$this->getDataContainer()->getLastBuildDate()) { - return; - } - - $lastBuildDate = $dom->createElement('lastBuildDate'); - $root->appendChild($lastBuildDate); - $text = $dom->createTextNode( - $this->getDataContainer()->getLastBuildDate()->get(\Zend\Date\Date::RSS) - ); - $lastBuildDate->appendChild($text); - } - - /** - * Set base URL to feed links - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setBaseUrl(\DOMDocument $dom, \DOMElement $root) - { - $baseUrl = $this->getDataContainer()->getBaseUrl(); - if (!$baseUrl) { - return; - } - $root->setAttribute('xml:base', $baseUrl); - } - - /** - * Set feed categories - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCategories(\DOMDocument $dom, \DOMElement $root) - { - $categories = $this->getDataContainer()->getCategories(); - if (!$categories) { - return; - } - foreach ($categories as $cat) { - $category = $dom->createElement('category'); - if (isset($cat['scheme'])) { - $category->setAttribute('domain', $cat['scheme']); - } - $text = $dom->createTextNode($cat['term']); - $category->appendChild($text); - $root->appendChild($category); - } - } -} From 6139e10f9a893f46603ffbba66b6e2ef8fe51b5e Mon Sep 17 00:00:00 2001 From: marc-mabe Date: Wed, 28 Jul 2010 13:48:43 +0200 Subject: [PATCH 166/238] code optimations: replaced call_user_func[_array] by () or ->() or ::() if possible | replaced call_user_funx_array by call_user_func if possible | removed double ';;' | check if DIRECTORY_SEPARATOR is already a backslash (windows) | replaced strripos by strrpos to find the last backslash --- src/Reader/Reader.php | 2 +- test/Reader/Feed/RssTest.php | 2 +- test/Writer/Renderer/Entry/RssTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Reader/Reader.php b/src/Reader/Reader.php index f1e7315f..7fe85ae9 100644 --- a/src/Reader/Reader.php +++ b/src/Reader/Reader.php @@ -230,7 +230,7 @@ public static function import($uri, $etag = null, $lastModified = null) $etag = $cache->load($cacheId.'_etag'); } if (is_null($lastModified)) { - $lastModified = $cache->load($cacheId.'_lastmodified');; + $lastModified = $cache->load($cacheId.'_lastmodified'); } if ($etag) { $client->setHeaders('If-None-Match', $etag); diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index c6426306..4b89d6b2 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -569,7 +569,7 @@ public function testGetsAuthorArrayFromRss090_Dc10() $this->assertEquals(array( array('name'=>'Joe Bloggs'), array('name'=>'Jane Bloggs') ), (array) $feed->getAuthors()); - $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues());; + $this->assertEquals(array('Joe Bloggs','Jane Bloggs'), $feed->getAuthors()->getValues()); } // DC 1.1 diff --git a/test/Writer/Renderer/Entry/RssTest.php b/test/Writer/Renderer/Entry/RssTest.php index 1116bd6b..329288a9 100644 --- a/test/Writer/Renderer/Entry/RssTest.php +++ b/test/Writer/Renderer/Entry/RssTest.php @@ -56,7 +56,7 @@ public function setUp() $this->_validEntry = $this->_validWriter->createEntry(); $this->_validEntry->setTitle('This is a test entry.'); $this->_validEntry->setDescription('This is a test entry description.'); - $this->_validEntry->setLink('http://www.example.com/1');; + $this->_validEntry->setLink('http://www.example.com/1'); $this->_validWriter->addEntry($this->_validEntry); } From 0804292f027e84f172014ba057c1075349dc4d0e Mon Sep 17 00:00:00 2001 From: Stefan Gehrig Date: Sat, 31 Jul 2010 18:02:59 +0200 Subject: [PATCH 167/238] updateing --- src/Reader/Entry/Rss.php | 84 ++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index fe2f36a7..16c4baeb 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -13,40 +13,39 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Reader\Reader + * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Rss.php 22300 2010-05-26 10:13:34Z padraic $ + * @version $Id$ */ /** -* @namespace -*/ + * @namespace + */ namespace Zend\Feed\Reader\Entry; use Zend\Feed\Reader; use Zend\Date; /** -* @uses \Zend\Date\Date -* @uses \Zend\Feed\Exception -* @uses \Zend\Feed\Reader\Reader -* @uses \Zend\Feed\Reader\Collection\Category -* @uses \Zend\Feed\Reader\EntryAbstract -* @uses \Zend\Feed\Reader\EntryInterface -* @uses \Zend\Feed\Reader\Extension\Atom\Entry -* @uses \Zend\Feed\Reader\Extension\Content\Entry -* @uses \Zend\Feed\Reader\Extension\DublinCore\Entry -* @uses \Zend\Feed\Reader\Extension\Slash\Entry -* @uses \Zend\Feed\Reader\Extension\Thread\Entry -* @uses \Zend\Feed\Reader\Extension\WellformedWeb\Entry -* @category Zend -* @package Reader\Reader -* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License -*/ -class Rss extends AbstractEntry implements Reader\Entry + * @uses \Zend\Date\Date + * @uses \Zend\Feed\Exception + * @uses \Zend\Feed\Reader\Reader + * @uses \Zend\Feed\Reader\Collection\Category + * @uses \Zend\Feed\Reader\AbstractEntry + * @uses \Zend\Feed\Reader\Entry + * @uses \Zend\Feed\Reader\Extension\Atom\Entry + * @uses \Zend\Feed\Reader\Extension\Content\Entry + * @uses \Zend\Feed\Reader\Extension\DublinCore\Entry + * @uses \Zend\Feed\Reader\Extension\Slash\Entry + * @uses \Zend\Feed\Reader\Extension\Thread\Entry + * @uses Zend_Feed_Reader_Extension_WellformedWeb_Entry + * @category Zend + * @package Zend_Feed_Reader + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class RSS extends Reader\AbstractEntry implements Reader\Entry { - /** * XPath query for RDF * @@ -64,7 +63,7 @@ class Rss extends AbstractEntry implements Reader\Entry /** * Constructor * - * @param Zend_Feed_Entry_Abstract $entry + * @param \Zend\Feed\Entry\AbstractEntry $entry * @param string $entryKey * @param string $type * @return void @@ -77,23 +76,23 @@ public function __construct(\DOMElement $entry, $entryKey, $type = null) $pluginLoader = Reader\Reader::getPluginLoader(); - $dublinCoreClass = $pluginLoader->getClassName('DublinCore\\Entry'); - $this->_extensions['DublinCore\\Entry'] = new $dublinCoreClass($entry, $entryKey, $type); + $dublinCoreClass = $pluginLoader->getClassName('DublinCore\Entry'); + $this->_extensions['DublinCore\Entry'] = new $dublinCoreClass($entry, $entryKey, $type); - $contentClass = $pluginLoader->getClassName('Content\\Entry'); - $this->_extensions['Content\\Entry'] = new $contentClass($entry, $entryKey, $type); + $contentClass = $pluginLoader->getClassName('Content\Entry'); + $this->_extensions['Content\Entry'] = new $contentClass($entry, $entryKey, $type); - $atomClass = $pluginLoader->getClassName('Atom\\Entry'); - $this->_extensions['Atom\\Entry'] = new $atomClass($entry, $entryKey, $type); + $atomClass = $pluginLoader->getClassName('Atom\Entry'); + $this->_extensions['Atom\Entry'] = new $atomClass($entry, $entryKey, $type); - $wfwClass = $pluginLoader->getClassName('WellFormedWeb\\Entry'); - $this->_extensions['WellFormedWeb\\Entry'] = new $wfwClass($entry, $entryKey, $type); + $wfwClass = $pluginLoader->getClassName('WellFormedWeb\Entry'); + $this->_extensions['WellFormedWeb\Entry'] = new $wfwClass($entry, $entryKey, $type); - $slashClass = $pluginLoader->getClassName('Slash\\Entry'); - $this->_extensions['Slash\\Entry'] = new $slashClass($entry, $entryKey, $type); + $slashClass = $pluginLoader->getClassName('Slash\Entry'); + $this->_extensions['Slash\Entry'] = new $slashClass($entry, $entryKey, $type); - $threadClass = $pluginLoader->getClassName('Thread\\Entry'); - $this->_extensions['Thread\\Entry'] = new $threadClass($entry, $entryKey, $type); + $threadClass = $pluginLoader->getClassName('Thread\Entry'); + $this->_extensions['Thread\Entry'] = new $threadClass($entry, $entryKey, $type); } /** @@ -233,8 +232,10 @@ public function getDateModified() if ($dateModifiedParsed) { $date = new Date\Date($dateModifiedParsed); } else { - $dateStandards = array(Date\Date::RSS, Date\Date::RFC_822, - Date\Date::RFC_2822, Date\Date::DATES); + $dateStandards = array( + Date\Date::RSS, Date\Date::RFC_822, + Date\Date::RFC_2822, Date\Date::DATES, + ); $date = new Date\Date; foreach ($dateStandards as $standard) { try { @@ -242,8 +243,7 @@ public function getDateModified() break; } catch (Date\Exception $e) { if ($standard == Date\Date::DATES) { - require_once 'Zend/Feed/Exception.php'; - throw new Exception( + throw new \Zend\Feed\Exception( 'Could not load date due to unrecognised' .' format (should follow RFC 822 or 2822):' . $e->getMessage(), @@ -440,7 +440,7 @@ public function getLinks() /** * Get all categories * - * @return Reader\Reader_Collection_Category + * @return \Zend\Feed\Reader\Collection\Category */ public function getCategories() { @@ -620,7 +620,7 @@ public function getCommentFeedLink() /** * Set the XPath query (incl. on all Extensions) * - * @param \DOMXPath $xpath + * @param DOMXPath $xpath */ public function setXpath(\DOMXPath $xpath) { From d9859ee8c976ed680e298e55f0f54354a21e375c Mon Sep 17 00:00:00 2001 From: Stefan Gehrig Date: Sat, 31 Jul 2010 18:11:28 +0200 Subject: [PATCH 168/238] Revert "updateing" This reverts commit 7f7c19da825c7771f685ba594b506414bf8e9cb4. --- src/Reader/Entry/Rss.php | 84 ++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index 16c4baeb..fe2f36a7 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -13,39 +13,40 @@ * to license@zend.com so we can send you a copy immediately. * * @category Zend - * @package Zend_Feed_Reader + * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: Rss.php 22300 2010-05-26 10:13:34Z padraic $ */ /** - * @namespace - */ +* @namespace +*/ namespace Zend\Feed\Reader\Entry; use Zend\Feed\Reader; use Zend\Date; /** - * @uses \Zend\Date\Date - * @uses \Zend\Feed\Exception - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Feed\Reader\Collection\Category - * @uses \Zend\Feed\Reader\AbstractEntry - * @uses \Zend\Feed\Reader\Entry - * @uses \Zend\Feed\Reader\Extension\Atom\Entry - * @uses \Zend\Feed\Reader\Extension\Content\Entry - * @uses \Zend\Feed\Reader\Extension\DublinCore\Entry - * @uses \Zend\Feed\Reader\Extension\Slash\Entry - * @uses \Zend\Feed\Reader\Extension\Thread\Entry - * @uses Zend_Feed_Reader_Extension_WellformedWeb_Entry - * @category Zend - * @package Zend_Feed_Reader - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class RSS extends Reader\AbstractEntry implements Reader\Entry +* @uses \Zend\Date\Date +* @uses \Zend\Feed\Exception +* @uses \Zend\Feed\Reader\Reader +* @uses \Zend\Feed\Reader\Collection\Category +* @uses \Zend\Feed\Reader\EntryAbstract +* @uses \Zend\Feed\Reader\EntryInterface +* @uses \Zend\Feed\Reader\Extension\Atom\Entry +* @uses \Zend\Feed\Reader\Extension\Content\Entry +* @uses \Zend\Feed\Reader\Extension\DublinCore\Entry +* @uses \Zend\Feed\Reader\Extension\Slash\Entry +* @uses \Zend\Feed\Reader\Extension\Thread\Entry +* @uses \Zend\Feed\Reader\Extension\WellformedWeb\Entry +* @category Zend +* @package Reader\Reader +* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) +* @license http://framework.zend.com/license/new-bsd New BSD License +*/ +class Rss extends AbstractEntry implements Reader\Entry { + /** * XPath query for RDF * @@ -63,7 +64,7 @@ class RSS extends Reader\AbstractEntry implements Reader\Entry /** * Constructor * - * @param \Zend\Feed\Entry\AbstractEntry $entry + * @param Zend_Feed_Entry_Abstract $entry * @param string $entryKey * @param string $type * @return void @@ -76,23 +77,23 @@ public function __construct(\DOMElement $entry, $entryKey, $type = null) $pluginLoader = Reader\Reader::getPluginLoader(); - $dublinCoreClass = $pluginLoader->getClassName('DublinCore\Entry'); - $this->_extensions['DublinCore\Entry'] = new $dublinCoreClass($entry, $entryKey, $type); + $dublinCoreClass = $pluginLoader->getClassName('DublinCore\\Entry'); + $this->_extensions['DublinCore\\Entry'] = new $dublinCoreClass($entry, $entryKey, $type); - $contentClass = $pluginLoader->getClassName('Content\Entry'); - $this->_extensions['Content\Entry'] = new $contentClass($entry, $entryKey, $type); + $contentClass = $pluginLoader->getClassName('Content\\Entry'); + $this->_extensions['Content\\Entry'] = new $contentClass($entry, $entryKey, $type); - $atomClass = $pluginLoader->getClassName('Atom\Entry'); - $this->_extensions['Atom\Entry'] = new $atomClass($entry, $entryKey, $type); + $atomClass = $pluginLoader->getClassName('Atom\\Entry'); + $this->_extensions['Atom\\Entry'] = new $atomClass($entry, $entryKey, $type); - $wfwClass = $pluginLoader->getClassName('WellFormedWeb\Entry'); - $this->_extensions['WellFormedWeb\Entry'] = new $wfwClass($entry, $entryKey, $type); + $wfwClass = $pluginLoader->getClassName('WellFormedWeb\\Entry'); + $this->_extensions['WellFormedWeb\\Entry'] = new $wfwClass($entry, $entryKey, $type); - $slashClass = $pluginLoader->getClassName('Slash\Entry'); - $this->_extensions['Slash\Entry'] = new $slashClass($entry, $entryKey, $type); + $slashClass = $pluginLoader->getClassName('Slash\\Entry'); + $this->_extensions['Slash\\Entry'] = new $slashClass($entry, $entryKey, $type); - $threadClass = $pluginLoader->getClassName('Thread\Entry'); - $this->_extensions['Thread\Entry'] = new $threadClass($entry, $entryKey, $type); + $threadClass = $pluginLoader->getClassName('Thread\\Entry'); + $this->_extensions['Thread\\Entry'] = new $threadClass($entry, $entryKey, $type); } /** @@ -232,10 +233,8 @@ public function getDateModified() if ($dateModifiedParsed) { $date = new Date\Date($dateModifiedParsed); } else { - $dateStandards = array( - Date\Date::RSS, Date\Date::RFC_822, - Date\Date::RFC_2822, Date\Date::DATES, - ); + $dateStandards = array(Date\Date::RSS, Date\Date::RFC_822, + Date\Date::RFC_2822, Date\Date::DATES); $date = new Date\Date; foreach ($dateStandards as $standard) { try { @@ -243,7 +242,8 @@ public function getDateModified() break; } catch (Date\Exception $e) { if ($standard == Date\Date::DATES) { - throw new \Zend\Feed\Exception( + require_once 'Zend/Feed/Exception.php'; + throw new Exception( 'Could not load date due to unrecognised' .' format (should follow RFC 822 or 2822):' . $e->getMessage(), @@ -440,7 +440,7 @@ public function getLinks() /** * Get all categories * - * @return \Zend\Feed\Reader\Collection\Category + * @return Reader\Reader_Collection_Category */ public function getCategories() { @@ -620,7 +620,7 @@ public function getCommentFeedLink() /** * Set the XPath query (incl. on all Extensions) * - * @param DOMXPath $xpath + * @param \DOMXPath $xpath */ public function setXpath(\DOMXPath $xpath) { From 55b4e5a00b20ad55c422e531a7f72e1eee60ce83 Mon Sep 17 00:00:00 2001 From: Padraic Brady Date: Sun, 1 Aug 2010 14:13:44 +0100 Subject: [PATCH 169/238] Added Tag URI support to Zend\Feed\Writer --- src/Writer/AbstractFeed.php | 41 ++++++++++++++++++++++++++++++++++--- src/Writer/Feed.php | 2 +- test/Writer/FeedTest.php | 14 +++++++++++++ 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/src/Writer/AbstractFeed.php b/src/Writer/AbstractFeed.php index 3d2bf4a4..06254c23 100644 --- a/src/Writer/AbstractFeed.php +++ b/src/Writer/AbstractFeed.php @@ -25,6 +25,7 @@ namespace Zend\Feed\Writer; use Zend\Uri; use Zend\Date; +use Zend\Validator; /** * @uses \Zend\Date\Date @@ -32,8 +33,9 @@ * @uses \Zend\Feed\Writer\Writer * @uses \Zend\Feed\Writer\Entry * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Atom -* @uses \Zend\Feed\Writer\Renderer\Feed\RSS -* @uses \Zend\Uri\Uri +* @uses \Zend\Feed\Writer\Renderer\Feed\Rss +* @uses \Zend\Uri\Url +* @uses \Zend\Validator\EmailAddress * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -267,11 +269,44 @@ public function setGenerator($name, $version = null, $uri = null) public function setId($id) { if ((empty($id) || !is_string($id) || !Uri\Url::validate($id)) && - !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id)) { + !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id) + && !$this->_validateTagUri($id)) { throw new Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['id'] = $id; } + + /** + * Validate a URI using the tag scheme (RFC 4151) + * + * @param string $id + * @return bool + */ + protected function _validateTagUri($id) + { + if (preg_match('/^tag:(?.*),(?\d{4}-?\d{0,2}-?\d{0,2}):(?.*)(.*:)*$/', $id, $matches)) { + $dvalid = false; + $nvalid = false; + $date = $matches['date']; + $d6 = strtotime($date); + if ((strlen($date) == 4) && $date <= date('Y')) { + $dvalid = true; + } elseif ((strlen($date) == 7) && ($d6 < strtotime("now"))) { + $dvalid = true; + } elseif ((strlen($date) == 10) && ($d6 < strtotime("now"))) { + $dvalid = true; + } + $validator = new Validator\EmailAddress; + if ($validator->isValid($matches['name'])) { + $nvalid = true; + } else { + $nvalid = $validator->isValid('info@' . $matches['name']); + } + return $dvalid && $nvalid; + + } + return false; + } /** * Set a feed image (URI at minimum). Parameter is a single array with the diff --git a/src/Writer/Feed.php b/src/Writer/Feed.php index cedc7908..caf58bcf 100644 --- a/src/Writer/Feed.php +++ b/src/Writer/Feed.php @@ -37,7 +37,7 @@ * @uses \Zend\Feed\Writer\Feed\FeedAbstract * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Atom * @uses \Zend\Feed\Writer\Renderer\Feed\RSS -* @uses \Zend\Uri\Uri +* @uses \Zend\Uri\Url * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php index a9b1f3b1..f356d1c9 100644 --- a/test/Writer/FeedTest.php +++ b/test/Writer/FeedTest.php @@ -350,6 +350,20 @@ public function testSetsIdAcceptsUrns() $writer->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $writer->getId()); } + + public function testSetsIdAcceptsSimpleTagUri() + { + $writer = new Writer\Feed; + $writer->setId('tag:example.org,2010:/foo/bar/'); + $this->assertEquals('tag:example.org,2010:/foo/bar/', $writer->getId()); + } + + public function testSetsIdAcceptsComplexTagUri() + { + $writer = new Writer\Feed; + $writer->setId('tag:diveintomark.org,2004-05-27:/archives/2004/05/27/howto-atom-linkblog'); + $this->assertEquals('tag:diveintomark.org,2004-05-27:/archives/2004/05/27/howto-atom-linkblog', $writer->getId()); + } public function testSetIdThrowsExceptionOnInvalidParameter() { From fe58bcbf46a4bc7a9d95f443fdda370710662c76 Mon Sep 17 00:00:00 2001 From: Padraic Brady Date: Sun, 1 Aug 2010 20:21:09 +0100 Subject: [PATCH 170/238] Added Tag URI support when rendering Atom Entries - fixes ZF-10246 --- src/Writer/Renderer/Entry/Atom.php | 40 +++++++++++++++++++++++-- test/Writer/Renderer/Entry/AtomTest.php | 18 +++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom.php index 47fbc05a..68d6f2f6 100644 --- a/src/Writer/Renderer/Entry/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -27,6 +27,7 @@ use Zend\Feed\Writer; use Zend\Date; use Zend\URI; +use Zend\Validator; /** * @uses DOMDocument @@ -36,7 +37,8 @@ * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Source * @uses \Zend\Feed\Writer\Renderer\RendererAbstract * @uses \Zend\Feed\Writer\Renderer\RendererInterface -* @uses \Zend\Uri\Uri +* @uses \Zend\Uri\Url +* @uses \Zend\Validator * @uses tidy * @category Zend * @package Zend_Feed_Writer @@ -292,7 +294,9 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) $this->getDataContainer()->getLink()); } if (!URI\URL::validate($this->getDataContainer()->getId()) && - !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $this->getDataContainer()->getId())) { + !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", + $this->getDataContainer()->getId() + ) && !$this->_validateTagUri($this->getDataContainer()->getId())) { throw new Exception('Atom 1.0 IDs must be a valid URI/IRI'); } $id = $dom->createElement('id'); @@ -301,6 +305,38 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) $id->appendChild($text); } + /** + * Validate a URI using the tag scheme (RFC 4151) + * + * @param string $id + * @return bool + */ + protected function _validateTagUri($id) + { + if (preg_match('/^tag:(?.*),(?\d{4}-?\d{0,2}-?\d{0,2}):(?.*)(.*:)*$/', $id, $matches)) { + $dvalid = false; + $nvalid = false; + $date = $matches['date']; + $d6 = strtotime($date); + if ((strlen($date) == 4) && $date <= date('Y')) { + $dvalid = true; + } elseif ((strlen($date) == 7) && ($d6 < strtotime("now"))) { + $dvalid = true; + } elseif ((strlen($date) == 10) && ($d6 < strtotime("now"))) { + $dvalid = true; + } + $validator = new Validator\EmailAddress; + if ($validator->isValid($matches['name'])) { + $nvalid = true; + } else { + $nvalid = $validator->isValid('info@' . $matches['name']); + } + return $dvalid && $nvalid; + + } + return false; + } + /** * Set entry content * diff --git a/test/Writer/Renderer/Entry/AtomTest.php b/test/Writer/Renderer/Entry/AtomTest.php index a647f428..18783c0d 100644 --- a/test/Writer/Renderer/Entry/AtomTest.php +++ b/test/Writer/Renderer/Entry/AtomTest.php @@ -218,6 +218,24 @@ public function testEntryIdHasBeenSet() $entry = $feed->current(); $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $entry->getId()); } + + public function testEntryIdHasBeenSetUsingSimpleTagUri() + { + $this->_validEntry->setId('tag:example.org,2010:/foo/bar/'); + $renderer = new Renderer\Feed\Atom($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('tag:example.org,2010:/foo/bar/', $entry->getId()); + } + + public function testEntryIdHasBeenSetUsingComplexTagUri() + { + $this->_validEntry->setId('tag:diveintomark.org,2004-05-27:/archives/2004/05/27/howto-atom-linkblog'); + $renderer = new Renderer\Feed\Atom($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('tag:diveintomark.org,2004-05-27:/archives/2004/05/27/howto-atom-linkblog', $entry->getId()); + } public function testFeedIdDefaultIsUsedIfNotSetByHand() { From e360379470b308fd65c131817fec88a0fc19e200 Mon Sep 17 00:00:00 2001 From: Jonathan Maron Date: Wed, 18 Aug 2010 09:22:26 +0200 Subject: [PATCH 171/238] merging --- src/Reader/Entry/RSS.php | 632 +++++++++++++++++++++++++++++ src/Writer/AbstractFeed.php | 41 +- src/Writer/Feed.php | 2 +- src/Writer/Renderer/Entry/Atom.php | 40 +- src/Writer/Renderer/Entry/RSS.php | 347 ++++++++++++++++ src/Writer/Renderer/Feed/RSS.php | 498 +++++++++++++++++++++++ 6 files changed, 1483 insertions(+), 77 deletions(-) create mode 100644 src/Reader/Entry/RSS.php create mode 100644 src/Writer/Renderer/Entry/RSS.php create mode 100644 src/Writer/Renderer/Feed/RSS.php diff --git a/src/Reader/Entry/RSS.php b/src/Reader/Entry/RSS.php new file mode 100644 index 00000000..16c4baeb --- /dev/null +++ b/src/Reader/Entry/RSS.php @@ -0,0 +1,632 @@ +_xpathQueryRss = '//item[' . ($this->_entryKey+1) . ']'; + $this->_xpathQueryRdf = '//rss:item[' . ($this->_entryKey+1) . ']'; + + $pluginLoader = Reader\Reader::getPluginLoader(); + + $dublinCoreClass = $pluginLoader->getClassName('DublinCore\Entry'); + $this->_extensions['DublinCore\Entry'] = new $dublinCoreClass($entry, $entryKey, $type); + + $contentClass = $pluginLoader->getClassName('Content\Entry'); + $this->_extensions['Content\Entry'] = new $contentClass($entry, $entryKey, $type); + + $atomClass = $pluginLoader->getClassName('Atom\Entry'); + $this->_extensions['Atom\Entry'] = new $atomClass($entry, $entryKey, $type); + + $wfwClass = $pluginLoader->getClassName('WellFormedWeb\Entry'); + $this->_extensions['WellFormedWeb\Entry'] = new $wfwClass($entry, $entryKey, $type); + + $slashClass = $pluginLoader->getClassName('Slash\Entry'); + $this->_extensions['Slash\Entry'] = new $slashClass($entry, $entryKey, $type); + + $threadClass = $pluginLoader->getClassName('Thread\Entry'); + $this->_extensions['Thread\Entry'] = new $threadClass($entry, $entryKey, $type); + } + + /** + * Get an author entry + * + * @param DOMElement $element + * @return string + */ + public function getAuthor($index = 0) + { + $authors = $this->getAuthors(); + + if (isset($authors[$index])) { + return $authors[$index]; + } + + return null; + } + + /** + * Get an array with feed authors + * + * @return array + */ + public function getAuthors() + { + if (array_key_exists('authors', $this->_data)) { + return $this->_data['authors']; + } + + $authors = array(); + $authors_dc = $this->getExtension('DublinCore')->getAuthors(); + if (!empty($authors_dc)) { + foreach ($authors_dc as $author) { + $authors[] = array( + 'name' => $author['name'] + ); + } + } + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $list = $this->_xpath->query($this->_xpathQueryRss . '//author'); + } else { + $list = $this->_xpath->query($this->_xpathQueryRdf . '//rss:author'); + } + if ($list->length) { + foreach ($list as $author) { + $string = trim($author->nodeValue); + $email = null; + $name = null; + $data = array(); + // Pretty rough parsing - but it's a catchall + if (preg_match("/^.*@[^ ]*/", $string, $matches)) { + $data['email'] = trim($matches[0]); + if (preg_match("/\((.*)\)$/", $string, $matches)) { + $data['name'] = $matches[1]; + } + $authors[] = $data; + } + } + } + + if (count($authors) == 0) { + $authors = $this->getExtension('Atom')->getAuthors(); + } else { + $authors = new Reader\Collection\Author( + Reader\Reader::arrayUnique($authors) + ); + } + + if (count($authors) == 0) { + $authors = null; + } + + $this->_data['authors'] = $authors; + + return $this->_data['authors']; + } + + /** + * Get the entry content + * + * @return string + */ + public function getContent() + { + if (array_key_exists('content', $this->_data)) { + return $this->_data['content']; + } + + $content = $this->getExtension('Content')->getContent(); + + if (!$content) { + $content = $this->getDescription(); + } + + if (empty($content)) { + $content = $this->getExtension('Atom')->getContent(); + } + + $this->_data['content'] = $content; + + return $this->_data['content']; + } + + /** + * Get the entry's date of creation + * + * @return string + */ + public function getDateCreated() + { + return $this->getDateModified(); + } + + /** + * Get the entry's date of modification + * + * @return string + */ + public function getDateModified() + { + if (array_key_exists('datemodified', $this->_data)) { + return $this->_data['datemodified']; + } + + $dateModified = null; + $date = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 + ) { + $dateModified = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/pubDate)'); + if ($dateModified) { + $dateModifiedParsed = strtotime($dateModified); + if ($dateModifiedParsed) { + $date = new Date\Date($dateModifiedParsed); + } else { + $dateStandards = array( + Date\Date::RSS, Date\Date::RFC_822, + Date\Date::RFC_2822, Date\Date::DATES, + ); + $date = new Date\Date; + foreach ($dateStandards as $standard) { + try { + $date->set($dateModified, $standard); + break; + } catch (Date\Exception $e) { + if ($standard == Date\Date::DATES) { + throw new \Zend\Feed\Exception( + 'Could not load date due to unrecognised' + .' format (should follow RFC 822 or 2822):' + . $e->getMessage(), + 0, $e + ); + } + } + } + } + } + } + + if (!$date) { + $date = $this->getExtension('DublinCore')->getDate(); + } + + if (!$date) { + $date = $this->getExtension('Atom')->getDateModified(); + } + + if (!$date) { + $date = null; + } + + $this->_data['datemodified'] = $date; + + return $this->_data['datemodified']; + } + + /** + * Get the entry description + * + * @return string + */ + public function getDescription() + { + if (array_key_exists('description', $this->_data)) { + return $this->_data['description']; + } + + $description = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 + ) { + $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/description)'); + } else { + $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRdf.'/rss:description)'); + } + + if (!$description) { + $description = $this->getExtension('DublinCore')->getDescription(); + } + + if (empty($description)) { + $description = $this->getExtension('Atom')->getDescription(); + } + + if (!$description) { + $description = null; + } + + $this->_data['description'] = $description; + + return $this->_data['description']; + } + + /** + * Get the entry enclosure + * @return string + */ + public function getEnclosure() + { + if (array_key_exists('enclosure', $this->_data)) { + return $this->_data['enclosure']; + } + + $enclosure = null; + + if ($this->getType() == Reader\Reader::TYPE_RSS_20) { + $nodeList = $this->_xpath->query($this->_xpathQueryRss . '/enclosure'); + + if ($nodeList->length > 0) { + $enclosure = new \stdClass(); + $enclosure->url = $nodeList->item(0)->getAttribute('url'); + $enclosure->length = $nodeList->item(0)->getAttribute('length'); + $enclosure->type = $nodeList->item(0)->getAttribute('type'); + } + } + + if (!$enclosure) { + $enclosure = $this->getExtension('Atom')->getEnclosure(); + } + + $this->_data['enclosure'] = $enclosure; + + return $this->_data['enclosure']; + } + + /** + * Get the entry ID + * + * @return string + */ + public function getId() + { + if (array_key_exists('id', $this->_data)) { + return $this->_data['id']; + } + + $id = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 + ) { + $id = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/guid)'); + } + + if (!$id) { + $id = $this->getExtension('DublinCore')->getId(); + } + + if (empty($id)) { + $id = $this->getExtension('Atom')->getId(); + } + + if (!$id) { + if ($this->getPermalink()) { + $id = $this->getPermalink(); + } elseif ($this->getTitle()) { + $id = $this->getTitle(); + } else { + $id = null; + } + } + + $this->_data['id'] = $id; + + return $this->_data['id']; + } + + /** + * Get a specific link + * + * @param int $index + * @return string + */ + public function getLink($index = 0) + { + if (!array_key_exists('links', $this->_data)) { + $this->getLinks(); + } + + if (isset($this->_data['links'][$index])) { + return $this->_data['links'][$index]; + } + + return null; + } + + /** + * Get all links + * + * @return array + */ + public function getLinks() + { + if (array_key_exists('links', $this->_data)) { + return $this->_data['links']; + } + + $links = array(); + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $list = $this->_xpath->query($this->_xpathQueryRss.'//link'); + } else { + $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:link'); + } + + if (!$list->length) { + $links = $this->getExtension('Atom')->getLinks(); + } else { + foreach ($list as $link) { + $links[] = $link->nodeValue; + } + } + + $this->_data['links'] = $links; + + return $this->_data['links']; + } + + /** + * Get all categories + * + * @return \Zend\Feed\Reader\Collection\Category + */ + public function getCategories() + { + if (array_key_exists('categories', $this->_data)) { + return $this->_data['categories']; + } + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && + $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $list = $this->_xpath->query($this->_xpathQueryRss.'//category'); + } else { + $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:category'); + } + + if ($list->length) { + $categoryCollection = new Reader\Collection\Category; + foreach ($list as $category) { + $categoryCollection[] = array( + 'term' => $category->nodeValue, + 'scheme' => $category->getAttribute('domain'), + 'label' => $category->nodeValue, + ); + } + } else { + $categoryCollection = $this->getExtension('DublinCore')->getCategories(); + } + + if (count($categoryCollection) == 0) { + $categoryCollection = $this->getExtension('Atom')->getCategories(); + } + + $this->_data['categories'] = $categoryCollection; + + return $this->_data['categories']; + } + + /** + * Get a permalink to the entry + * + * @return string + */ + public function getPermalink() + { + return $this->getLink(0); + } + + /** + * Get the entry title + * + * @return string + */ + public function getTitle() + { + if (array_key_exists('title', $this->_data)) { + return $this->_data['title']; + } + + $title = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 + ) { + $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/title)'); + } else { + $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRdf.'/rss:title)'); + } + + if (!$title) { + $title = $this->getExtension('DublinCore')->getTitle(); + } + + if (!$title) { + $title = $this->getExtension('Atom')->getTitle(); + } + + if (!$title) { + $title = null; + } + + $this->_data['title'] = $title; + + return $this->_data['title']; + } + + /** + * Get the number of comments/replies for current entry + * + * @return string|null + */ + public function getCommentCount() + { + if (array_key_exists('commentcount', $this->_data)) { + return $this->_data['commentcount']; + } + + $commentcount = $this->getExtension('Slash')->getCommentCount(); + + if (!$commentcount) { + $commentcount = $this->getExtension('Thread')->getCommentCount(); + } + + if (!$commentcount) { + $commentcount = $this->getExtension('Atom')->getCommentCount(); + } + + if (!$commentcount) { + $commentcount = null; + } + + $this->_data['commentcount'] = $commentcount; + + return $this->_data['commentcount']; + } + + /** + * Returns a URI pointing to the HTML page where comments can be made on this entry + * + * @return string + */ + public function getCommentLink() + { + if (array_key_exists('commentlink', $this->_data)) { + return $this->_data['commentlink']; + } + + $commentlink = null; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 + ) { + $commentlink = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/comments)'); + } + + if (!$commentlink) { + $commentlink = $this->getExtension('Atom')->getCommentLink(); + } + + if (!$commentlink) { + $commentlink = null; + } + + $this->_data['commentlink'] = $commentlink; + + return $this->_data['commentlink']; + } + + /** + * Returns a URI pointing to a feed of all comments for this entry + * + * @return string + */ + public function getCommentFeedLink() + { + if (array_key_exists('commentfeedlink', $this->_data)) { + return $this->_data['commentfeedlink']; + } + + $commentfeedlink = $this->getExtension('WellFormedWeb')->getCommentFeedLink(); + + if (!$commentfeedlink) { + $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink('rss'); + } + + if (!$commentfeedlink) { + $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink('rdf'); + } + + if (!$commentfeedlink) { + $commentfeedlink = null; + } + + $this->_data['commentfeedlink'] = $commentfeedlink; + + return $this->_data['commentfeedlink']; + } + + /** + * Set the XPath query (incl. on all Extensions) + * + * @param DOMXPath $xpath + */ + public function setXpath(\DOMXPath $xpath) + { + parent::setXpath($xpath); + foreach ($this->_extensions as $extension) { + $extension->setXpath($this->_xpath); + } + } +} diff --git a/src/Writer/AbstractFeed.php b/src/Writer/AbstractFeed.php index c5c27f16..daa916f6 100644 --- a/src/Writer/AbstractFeed.php +++ b/src/Writer/AbstractFeed.php @@ -25,7 +25,6 @@ namespace Zend\Feed\Writer; use Zend\Uri; use Zend\Date; -use Zend\Validator; /** * @uses \Zend\Date\Date @@ -33,9 +32,8 @@ * @uses \Zend\Feed\Writer\Writer * @uses \Zend\Feed\Writer\Entry * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Atom -* @uses \Zend\Feed\Writer\Renderer\Feed\Rss -* @uses \Zend\Uri\Url -* @uses \Zend\Validator\EmailAddress +* @uses \Zend\Feed\Writer\Renderer\Feed\RSS +* @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -269,44 +267,11 @@ public function setGenerator($name, $version = null, $uri = null) public function setId($id) { if ((empty($id) || !is_string($id) || !Uri\Url::validate($id)) && - !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id) - && !$this->_validateTagUri($id)) { + !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id)) { throw new Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['id'] = $id; } - - /** - * Validate a URI using the tag scheme (RFC 4151) - * - * @param string $id - * @return bool - */ - protected function _validateTagUri($id) - { - if (preg_match('/^tag:(?.*),(?\d{4}-?\d{0,2}-?\d{0,2}):(?.*)(.*:)*$/', $id, $matches)) { - $dvalid = false; - $nvalid = false; - $date = $matches['date']; - $d6 = strtotime($date); - if ((strlen($date) == 4) && $date <= date('Y')) { - $dvalid = true; - } elseif ((strlen($date) == 7) && ($d6 < strtotime("now"))) { - $dvalid = true; - } elseif ((strlen($date) == 10) && ($d6 < strtotime("now"))) { - $dvalid = true; - } - $validator = new Validator\EmailAddress; - if ($validator->isValid($matches['name'])) { - $nvalid = true; - } else { - $nvalid = $validator->isValid('info@' . $matches['name']); - } - return $dvalid && $nvalid; - - } - return false; - } /** * Set a feed image (URI at minimum). Parameter is a single array with the diff --git a/src/Writer/Feed.php b/src/Writer/Feed.php index caf58bcf..cedc7908 100644 --- a/src/Writer/Feed.php +++ b/src/Writer/Feed.php @@ -37,7 +37,7 @@ * @uses \Zend\Feed\Writer\Feed\FeedAbstract * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Atom * @uses \Zend\Feed\Writer\Renderer\Feed\RSS -* @uses \Zend\Uri\Url +* @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom.php index 68d6f2f6..47fbc05a 100644 --- a/src/Writer/Renderer/Entry/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -27,7 +27,6 @@ use Zend\Feed\Writer; use Zend\Date; use Zend\URI; -use Zend\Validator; /** * @uses DOMDocument @@ -37,8 +36,7 @@ * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Source * @uses \Zend\Feed\Writer\Renderer\RendererAbstract * @uses \Zend\Feed\Writer\Renderer\RendererInterface -* @uses \Zend\Uri\Url -* @uses \Zend\Validator +* @uses \Zend\Uri\Uri * @uses tidy * @category Zend * @package Zend_Feed_Writer @@ -294,9 +292,7 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) $this->getDataContainer()->getLink()); } if (!URI\URL::validate($this->getDataContainer()->getId()) && - !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", - $this->getDataContainer()->getId() - ) && !$this->_validateTagUri($this->getDataContainer()->getId())) { + !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $this->getDataContainer()->getId())) { throw new Exception('Atom 1.0 IDs must be a valid URI/IRI'); } $id = $dom->createElement('id'); @@ -305,38 +301,6 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) $id->appendChild($text); } - /** - * Validate a URI using the tag scheme (RFC 4151) - * - * @param string $id - * @return bool - */ - protected function _validateTagUri($id) - { - if (preg_match('/^tag:(?.*),(?\d{4}-?\d{0,2}-?\d{0,2}):(?.*)(.*:)*$/', $id, $matches)) { - $dvalid = false; - $nvalid = false; - $date = $matches['date']; - $d6 = strtotime($date); - if ((strlen($date) == 4) && $date <= date('Y')) { - $dvalid = true; - } elseif ((strlen($date) == 7) && ($d6 < strtotime("now"))) { - $dvalid = true; - } elseif ((strlen($date) == 10) && ($d6 < strtotime("now"))) { - $dvalid = true; - } - $validator = new Validator\EmailAddress; - if ($validator->isValid($matches['name'])) { - $nvalid = true; - } else { - $nvalid = $validator->isValid('info@' . $matches['name']); - } - return $dvalid && $nvalid; - - } - return false; - } - /** * Set entry content * diff --git a/src/Writer/Renderer/Entry/RSS.php b/src/Writer/Renderer/Entry/RSS.php new file mode 100644 index 00000000..127821f3 --- /dev/null +++ b/src/Writer/Renderer/Entry/RSS.php @@ -0,0 +1,347 @@ +_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom->formatOutput = true; + $this->_dom->substituteEntities = false; + $entry = $this->_dom->createElement('item'); + $this->_dom->appendChild($entry); + + $this->_setTitle($this->_dom, $entry); + $this->_setDescription($this->_dom, $entry); + $this->_setDateCreated($this->_dom, $entry); + $this->_setDateModified($this->_dom, $entry); + $this->_setLink($this->_dom, $entry); + $this->_setId($this->_dom, $entry); + $this->_setAuthors($this->_dom, $entry); + $this->_setEnclosure($this->_dom, $entry); + $this->_setCommentLink($this->_dom, $entry); + $this->_setCategories($this->_dom, $entry); + foreach ($this->_extensions as $ext) { + $ext->setType($this->getType()); + $ext->setRootElement($this->getRootElement()); + $ext->setDomDocument($this->getDomDocument(), $entry); + $ext->render(); + } + + return $this; + } + + /** + * Set entry title + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setTitle(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getDescription() + && !$this->getDataContainer()->getTitle()) { + $message = 'RSS 2.0 entry elements SHOULD contain exactly one' + . ' title element but a title has not been set. In addition, there' + . ' is no description as required in the absence of a title.'; + $exception = new Feed\Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $title = $dom->createElement('title'); + $root->appendChild($title); + $text = $dom->createTextNode($this->getDataContainer()->getTitle()); + $title->appendChild($text); + } + + /** + * Set entry description + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setDescription(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getDescription() + && !$this->getDataContainer()->getTitle()) { + $message = 'RSS 2.0 entry elements SHOULD contain exactly one' + . ' description element but a description has not been set. In' + . ' addition, there is no title element as required in the absence' + . ' of a description.'; + $exception = new Feed\Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + if (!$this->getDataContainer()->getDescription()) { + return; + } + $subtitle = $dom->createElement('description'); + $root->appendChild($subtitle); + $text = $dom->createCDATASection($this->getDataContainer()->getDescription()); + $subtitle->appendChild($text); + } + + /** + * Set date entry was last modified + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getDateModified()) { + return; + } + + $updated = $dom->createElement('pubDate'); + $root->appendChild($updated); + $text = $dom->createTextNode( + $this->getDataContainer()->getDateModified()->get(\Zend\Date\Date::RSS) + ); + $updated->appendChild($text); + } + + /** + * Set date entry was created + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) + { + if (!$this->getDataContainer()->getDateCreated()) { + return; + } + if (!$this->getDataContainer()->getDateModified()) { + $this->getDataContainer()->setDateModified( + $this->getDataContainer()->getDateCreated() + ); + } + } + + /** + * Set entry authors + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + { + $authors = $this->_container->getAuthors(); + if ((!$authors || empty($authors))) { + return; + } + foreach ($authors as $data) { + $author = $this->_dom->createElement('author'); + $name = $data['name']; + if (array_key_exists('email', $data)) { + $name = $data['email'] . ' (' . $data['name'] . ')'; + } + $text = $dom->createTextNode($name); + $author->appendChild($text); + $root->appendChild($author); + } + } + + /** + * Set entry enclosure + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setEnclosure(\DOMDocument $dom, \DOMElement $root) + { + $data = $this->_container->getEnclosure(); + if ((!$data || empty($data))) { + return; + } + if (!isset($data['type'])) { + $exception = new \Zend\Feed\Exception('Enclosure "type" is not set'); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + if (!isset($data['length'])) { + $exception = new \Zend\Feed\Exception('Enclosure "length" is not set'); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + if (isset($data['length']) && (int) $data['length'] <= 0) { + $exception = new \Zend\Feed\Exception('Enclosure "length" must be an integer' + . ' indicating the content\'s length in bytes'); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $enclosure = $this->_dom->createElement('enclosure'); + $enclosure->setAttribute('type', $data['type']); + $enclosure->setAttribute('length', $data['length']); + $enclosure->setAttribute('url', $data['uri']); + $root->appendChild($enclosure); + } + + /** + * Set link to entry + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setLink(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getLink()) { + return; + } + $link = $dom->createElement('link'); + $root->appendChild($link); + $text = $dom->createTextNode($this->getDataContainer()->getLink()); + $link->appendChild($text); + } + + /** + * Set entry identifier + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setId(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getId() + && !$this->getDataContainer()->getLink()) { + return; + } + + $id = $dom->createElement('guid'); + $root->appendChild($id); + if (!$this->getDataContainer()->getId()) { + $this->getDataContainer()->setId( + $this->getDataContainer()->getLink()); + } + $text = $dom->createTextNode($this->getDataContainer()->getId()); + $id->appendChild($text); + if (!\Zend\Uri\Url::validate($this->getDataContainer()->getId())) { + $id->setAttribute('isPermaLink', 'false'); + } + } + + /** + * Set link to entry comments + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setCommentLink(\DOMDocument $dom, \DOMElement $root) + { + $link = $this->getDataContainer()->getCommentLink(); + if (!$link) { + return; + } + $clink = $this->_dom->createElement('comments'); + $text = $dom->createTextNode($link); + $clink->appendChild($text); + $root->appendChild($clink); + } + + /** + * Set entry categories + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setCategories(\DOMDocument $dom, \DOMElement $root) + { + $categories = $this->getDataContainer()->getCategories(); + if (!$categories) { + return; + } + foreach ($categories as $cat) { + $category = $dom->createElement('category'); + if (isset($cat['scheme'])) { + $category->setAttribute('domain', $cat['scheme']); + } + $text = $dom->createCDATASection($cat['term']); + $category->appendChild($text); + $root->appendChild($category); + } + } +} diff --git a/src/Writer/Renderer/Feed/RSS.php b/src/Writer/Renderer/Feed/RSS.php new file mode 100644 index 00000000..b97aec4a --- /dev/null +++ b/src/Writer/Renderer/Feed/RSS.php @@ -0,0 +1,498 @@ +_container->getEncoding()) { + $this->_container->setEncoding('UTF-8'); + } + $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom->formatOutput = true; + $this->_dom->substituteEntities = false; + $rss = $this->_dom->createElement('rss'); + $this->setRootElement($rss); + $rss->setAttribute('version', '2.0'); + + $channel = $this->_dom->createElement('channel'); + $rss->appendChild($channel); + $this->_dom->appendChild($rss); + $this->_setLanguage($this->_dom, $channel); + $this->_setBaseUrl($this->_dom, $channel); + $this->_setTitle($this->_dom, $channel); + $this->_setDescription($this->_dom, $channel); + $this->_setImage($this->_dom, $channel); + $this->_setDateCreated($this->_dom, $channel); + $this->_setDateModified($this->_dom, $channel); + $this->_setLastBuildDate($this->_dom, $channel); + $this->_setGenerator($this->_dom, $channel); + $this->_setLink($this->_dom, $channel); + $this->_setAuthors($this->_dom, $channel); + $this->_setCopyright($this->_dom, $channel); + $this->_setCategories($this->_dom, $channel); + + foreach ($this->_extensions as $ext) { + $ext->setType($this->getType()); + $ext->setRootElement($this->getRootElement()); + $ext->setDomDocument($this->getDomDocument(), $channel); + $ext->render(); + } + + foreach ($this->_container as $entry) { + if ($this->getDataContainer()->getEncoding()) { + $entry->setEncoding($this->getDataContainer()->getEncoding()); + } + if ($entry instanceof Feed\Writer\Entry) { + $renderer = new Feed\Writer\Renderer\Entry\RSS($entry); + } else { + continue; + } + if ($this->_ignoreExceptions === true) { + $renderer->ignoreExceptions(); + } + $renderer->setType($this->getType()); + $renderer->setRootElement($this->_dom->documentElement); + $renderer->render(); + $element = $renderer->getElement(); + $imported = $this->_dom->importNode($element, true); + $channel->appendChild($imported); + } + return $this; + } + + /** + * Set feed language + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setLanguage(\DOMDocument $dom, \DOMElement $root) + { + $lang = $this->getDataContainer()->getLanguage(); + if (!$lang) { + return; + } + $language = $dom->createElement('language'); + $root->appendChild($language); + $language->nodeValue = $lang; + } + + /** + * Set feed title + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setTitle(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getTitle()) { + $message = 'RSS 2.0 feed elements MUST contain exactly one' + . ' title element but a title has not been set'; + $exception = new Feed\Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + + $title = $dom->createElement('title'); + $root->appendChild($title); + $text = $dom->createTextNode($this->getDataContainer()->getTitle()); + $title->appendChild($text); + } + + /** + * Set feed description + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setDescription(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getDescription()) { + $message = 'RSS 2.0 feed elements MUST contain exactly one' + . ' description element but one has not been set'; + $exception = new Feed\Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $subtitle = $dom->createElement('description'); + $root->appendChild($subtitle); + $text = $dom->createTextNode($this->getDataContainer()->getDescription()); + $subtitle->appendChild($text); + } + + /** + * Set date feed was last modified + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getDateModified()) { + return; + } + + $updated = $dom->createElement('pubDate'); + $root->appendChild($updated); + $text = $dom->createTextNode( + $this->getDataContainer()->getDateModified()->get(\Zend\Date\Date::RSS) + ); + $updated->appendChild($text); + } + + /** + * Set feed generator string + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getGenerator()) { + $this->getDataContainer()->setGenerator('Zend_Feed_Writer', + \Zend\Version::VERSION, 'http://framework.zend.com'); + } + + $gdata = $this->getDataContainer()->getGenerator(); + $generator = $dom->createElement('generator'); + $root->appendChild($generator); + $name = $gdata['name']; + if (array_key_exists('version', $gdata)) { + $name .= ' ' . $gdata['version']; + } + if (array_key_exists('uri', $gdata)) { + $name .= ' (' . $gdata['uri'] . ')'; + } + $text = $dom->createTextNode($name); + $generator->appendChild($text); + } + + /** + * Set link to feed + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setLink(\DOMDocument $dom, \DOMElement $root) + { + $value = $this->getDataContainer()->getLink(); + if(!$value) { + $message = 'RSS 2.0 feed elements MUST contain exactly one' + . ' link element but one has not been set'; + $exception = new Feed\Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $link = $dom->createElement('link'); + $root->appendChild($link); + $text = $dom->createTextNode($value); + $link->appendChild($text); + if (!\Zend\Uri\Url::validate($value)) { + $link->setAttribute('isPermaLink', 'false'); + } + } + + /** + * Set feed authors + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + { + $authors = $this->getDataContainer()->getAuthors(); + if (!$authors || empty($authors)) { + return; + } + foreach ($authors as $data) { + $author = $this->_dom->createElement('author'); + $name = $data['name']; + if (array_key_exists('email', $data)) { + $name = $data['email'] . ' (' . $data['name'] . ')'; + } + $text = $dom->createTextNode($name); + $author->appendChild($text); + $root->appendChild($author); + } + } + + /** + * Set feed copyright + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setCopyright(\DOMDocument $dom, \DOMElement $root) + { + $copyright = $this->getDataContainer()->getCopyright(); + if (!$copyright) { + return; + } + $copy = $dom->createElement('copyright'); + $root->appendChild($copy); + $text = $dom->createTextNode($copyright); + $copy->appendChild($text); + } + + /** + * Set feed channel image + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setImage(\DOMDocument $dom, \DOMElement $root) + { + $image = $this->getDataContainer()->getImage(); + if (!$image) { + return; + } + if (!isset($image['title']) || empty($image['title']) + || !is_string($image['title'])) { + $message = 'RSS 2.0 feed images must include a title'; + $exception = new \Zend\Feed\Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + if (empty($image['link']) || !is_string($image['link']) + || !\Zend\Uri\Url::validate($image['link'])) { + $message = 'Invalid parameter: parameter \'link\'' + . ' must be a non-empty string and valid URI/IRI'; + $exception = new \Zend\Feed\Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $img = $dom->createElement('image'); + $root->appendChild($img); + $url = $dom->createElement('url'); + $text = $dom->createTextNode($image['uri']); + $url->appendChild($text); + $title = $dom->createElement('title'); + $text = $dom->createTextNode($image['title']); + $title->appendChild($text); + $link = $dom->createElement('link'); + $text = $dom->createTextNode($image['link']); + $link->appendChild($text); + $img->appendChild($url); + $img->appendChild($title); + $img->appendChild($link); + if (isset($image['height'])) { + if (!ctype_digit((string) $image['height']) || $image['height'] > 400) { + $message = 'Invalid parameter: parameter \'height\'' + . ' must be an integer not exceeding 400'; + $exception = new \Zend\Feed\Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $height = $dom->createElement('height'); + $text = $dom->createTextNode($image['height']); + $height->appendChild($text); + $img->appendChild($height); + } + if (isset($image['width'])) { + if (!ctype_digit((string) $image['width']) || $image['width'] > 144) { + $message = 'Invalid parameter: parameter \'width\'' + . ' must be an integer not exceeding 144'; + $exception = new \Zend\Feed\Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $width = $dom->createElement('width'); + $text = $dom->createTextNode($image['width']); + $width->appendChild($text); + $img->appendChild($width); + } + if (isset($image['description'])) { + if (empty($image['description']) || !is_string($image['description'])) { + $message = 'Invalid parameter: parameter \'description\'' + . ' must be a non-empty string'; + $exception = new \Zend\Feed\Exception($message); + if (!$this->_ignoreExceptions) { + throw $exception; + } else { + $this->_exceptions[] = $exception; + return; + } + } + $desc = $dom->createElement('description'); + $text = $dom->createTextNode($image['description']); + $desc->appendChild($text); + $img->appendChild($desc); + } + } + + + /** + * Set date feed was created + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getDateCreated()) { + return; + } + if(!$this->getDataContainer()->getDateModified()) { + $this->getDataContainer()->setDateModified( + $this->getDataContainer()->getDateCreated() + ); + } + } + + /** + * Set date feed last build date + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setLastBuildDate(\DOMDocument $dom, \DOMElement $root) + { + if(!$this->getDataContainer()->getLastBuildDate()) { + return; + } + + $lastBuildDate = $dom->createElement('lastBuildDate'); + $root->appendChild($lastBuildDate); + $text = $dom->createTextNode( + $this->getDataContainer()->getLastBuildDate()->get(\Zend\Date\Date::RSS) + ); + $lastBuildDate->appendChild($text); + } + + /** + * Set base URL to feed links + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setBaseUrl(\DOMDocument $dom, \DOMElement $root) + { + $baseUrl = $this->getDataContainer()->getBaseUrl(); + if (!$baseUrl) { + return; + } + $root->setAttribute('xml:base', $baseUrl); + } + + /** + * Set feed categories + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + protected function _setCategories(\DOMDocument $dom, \DOMElement $root) + { + $categories = $this->getDataContainer()->getCategories(); + if (!$categories) { + return; + } + foreach ($categories as $cat) { + $category = $dom->createElement('category'); + if (isset($cat['scheme'])) { + $category->setAttribute('domain', $cat['scheme']); + } + $text = $dom->createTextNode($cat['term']); + $category->appendChild($text); + $root->appendChild($category); + } + } +} From 40961258de48e04f83b5b462a33331bdac2c3c40 Mon Sep 17 00:00:00 2001 From: Shawn Stratton Date: Sat, 4 Sep 2010 18:38:34 -0400 Subject: [PATCH 172/238] Cleaned up merge from branch 'farazdagi' --- src/Reader/Extension/Syndication/Feed.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Reader/Extension/Syndication/Feed.php b/src/Reader/Extension/Syndication/Feed.php index d877a801..af7e3aba 100644 --- a/src/Reader/Extension/Syndication/Feed.php +++ b/src/Reader/Extension/Syndication/Feed.php @@ -28,16 +28,6 @@ use Zend\Date; /** -<<<<<<< HEAD -* @uses \Zend\Feed\Reader\Reader -* @uses \Zend\Feed\Reader\Extension\EntryAbstract -* @category Zend -* @package Zend_Feed_Reader -* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License -*/ -class Feed extends Extension\AbstractFeed -======= * @uses \Zend\Date\Date * @uses \Zend\Feed\Reader\Extension\AbstractFeed * @category Zend @@ -46,7 +36,6 @@ class Feed extends Extension\AbstractFeed * @license http://framework.zend.com/license/new-bsd New BSD License */ class Feed extends \Zend\Feed\Reader\Extension\AbstractFeed ->>>>>>> master { /** * Get update period From 60debf28d618fef4da6c5ed7815abe8152dcf54a Mon Sep 17 00:00:00 2001 From: Ben Scholzen Date: Fri, 17 Sep 2010 19:34:14 +0200 Subject: [PATCH 173/238] Removed SVN keywords from all files --- src/Exception.php | 1 - src/PubSubHubbub/AbstractCallback.php | 1 - src/PubSubHubbub/Callback.php | 1 - src/PubSubHubbub/Exception.php | 1 - src/PubSubHubbub/HttpResponse.php | 1 - src/PubSubHubbub/Model/AbstractModel.php | 1 - src/PubSubHubbub/Model/Subscription.php | 1 - src/PubSubHubbub/Model/SubscriptionPersistence.php | 1 - src/PubSubHubbub/PubSubHubbub.php | 1 - src/PubSubHubbub/Publisher.php | 1 - src/PubSubHubbub/Subscriber.php | 1 - src/PubSubHubbub/Subscriber/Callback.php | 1 - src/Reader/AbstractEntry.php | 1 - src/Reader/AbstractFeed.php | 1 - src/Reader/Collection.php | 1 - src/Reader/Collection/AbstractCollection.php | 1 - src/Reader/Collection/Author.php | 1 - src/Reader/Collection/Category.php | 1 - src/Reader/Collection/Collection.php | 1 - src/Reader/Entry.php | 1 - src/Reader/Entry/AbstractEntry.php | 1 - src/Reader/Entry/Atom.php | 1 - src/Reader/Entry/Rss.php | 1 - src/Reader/Exception.php | 1 - src/Reader/Extension/AbstractEntry.php | 1 - src/Reader/Extension/AbstractFeed.php | 1 - src/Reader/Extension/Atom/Entry.php | 1 - src/Reader/Extension/Atom/Feed.php | 1 - src/Reader/Extension/Content/Entry.php | 1 - src/Reader/Extension/CreativeCommons/Entry.php | 1 - src/Reader/Extension/CreativeCommons/Feed.php | 1 - src/Reader/Extension/DublinCore/Entry.php | 1 - src/Reader/Extension/DublinCore/Feed.php | 1 - src/Reader/Extension/Podcast/Entry.php | 1 - src/Reader/Extension/Podcast/Feed.php | 1 - src/Reader/Extension/Slash/Entry.php | 1 - src/Reader/Extension/Syndication/Feed.php | 1 - src/Reader/Extension/Thread/Entry.php | 1 - src/Reader/Extension/WellFormedWeb/Entry.php | 1 - src/Reader/Feed.php | 1 - src/Reader/Feed/AbstractFeed.php | 1 - src/Reader/Feed/Atom.php | 1 - src/Reader/Feed/Atom/Source.php | 1 - src/Reader/Feed/Rss.php | 1 - src/Reader/FeedSet.php | 1 - src/Reader/Reader.php | 1 - src/Writer/AbstractFeed.php | 1 - src/Writer/Deleted.php | 1 - src/Writer/Entry.php | 1 - src/Writer/Exception.php | 1 - src/Writer/Exception/InvalidMethodException.php | 1 - src/Writer/Extension/AbstractRenderer.php | 1 - src/Writer/Extension/Atom/Renderer/Feed.php | 1 - src/Writer/Extension/Content/Renderer/Entry.php | 1 - src/Writer/Extension/DublinCore/Renderer/Entry.php | 1 - src/Writer/Extension/DublinCore/Renderer/Feed.php | 1 - src/Writer/Extension/ITunes/Entry.php | 1 - src/Writer/Extension/ITunes/Feed.php | 1 - src/Writer/Extension/ITunes/Renderer/Entry.php | 1 - src/Writer/Extension/ITunes/Renderer/Feed.php | 1 - src/Writer/Extension/Renderer.php | 1 - src/Writer/Extension/Slash/Renderer/Entry.php | 1 - src/Writer/Extension/Threading/Renderer/Entry.php | 1 - src/Writer/Extension/WellFormedWeb/Renderer/Entry.php | 1 - src/Writer/Feed.php | 1 - src/Writer/InvalidMethodException.php | 1 - src/Writer/Renderer.php | 1 - src/Writer/Renderer/AbstractRenderer.php | 1 - src/Writer/Renderer/Entry/Atom.php | 1 - src/Writer/Renderer/Entry/Atom/Deleted.php | 1 - src/Writer/Renderer/Entry/AtomDeleted.php | 1 - src/Writer/Renderer/Entry/Rss.php | 1 - src/Writer/Renderer/Feed/AbstractAtom.php | 1 - src/Writer/Renderer/Feed/Atom.php | 1 - src/Writer/Renderer/Feed/Atom/AbstractAtom.php | 1 - src/Writer/Renderer/Feed/Atom/Source.php | 1 - src/Writer/Renderer/Feed/AtomSource.php | 1 - src/Writer/Renderer/Feed/Rss.php | 1 - src/Writer/Renderer/Renderer.php | 1 - src/Writer/Source.php | 1 - src/Writer/Writer.php | 1 - test/PubSubHubbub/Model/SubscriptionTest.php | 1 - test/PubSubHubbub/PubSubHubbubTest.php | 1 - test/PubSubHubbub/PublisherTest.php | 1 - test/PubSubHubbub/Subscriber/CallbackTest.php | 1 - test/PubSubHubbub/SubscriberHttpTest.php | 1 - test/PubSubHubbub/SubscriberTest.php | 1 - test/Reader/Entry/AtomStandaloneEntryTest.php | 1 - test/Reader/Entry/AtomTest.php | 1 - test/Reader/Entry/CommonTest.php | 1 - test/Reader/Entry/RssTest.php | 1 - test/Reader/Feed/AtomSourceTest.php | 1 - test/Reader/Feed/AtomTest.php | 1 - test/Reader/Feed/CommonTest.php | 1 - test/Reader/Feed/RssTest.php | 1 - test/Reader/Integration/H-OnlineComAtom10Test.php | 1 - test/Reader/Integration/LautDeRdfTest.php | 1 - test/Reader/Integration/PodcastRss2Test.php | 1 - test/Reader/Integration/WordpressAtom10Test.php | 1 - test/Reader/Integration/WordpressRss2DcAtomTest.php | 1 - test/Reader/ReaderTest.php | 1 - test/Reader/_files/My/Extension/JungleBooks/Entry.php | 1 - test/Reader/_files/My/Extension/JungleBooks/Feed.php | 1 - test/ReaderTest.php | 1 - test/Writer/DeletedTest.php | 1 - test/Writer/EntryTest.php | 1 - test/Writer/Extension/ITunes/EntryTest.php | 1 - test/Writer/Extension/ITunes/FeedTest.php | 1 - test/Writer/FeedTest.php | 1 - test/Writer/Renderer/Entry/AtomTest.php | 1 - test/Writer/Renderer/Entry/RssTest.php | 1 - test/Writer/Renderer/Feed/AtomTest.php | 1 - test/Writer/Renderer/Feed/RssTest.php | 1 - 113 files changed, 113 deletions(-) diff --git a/src/Exception.php b/src/Exception.php index 4bfa9ec1..bdc0f3d7 100644 --- a/src/Exception.php +++ b/src/Exception.php @@ -16,7 +16,6 @@ * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/PubSubHubbub/AbstractCallback.php b/src/PubSubHubbub/AbstractCallback.php index ad531030..f5b8c32a 100644 --- a/src/PubSubHubbub/AbstractCallback.php +++ b/src/PubSubHubbub/AbstractCallback.php @@ -17,7 +17,6 @@ * @subpackage Callback * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/PubSubHubbub/Callback.php b/src/PubSubHubbub/Callback.php index d1402ec1..54f18c76 100644 --- a/src/PubSubHubbub/Callback.php +++ b/src/PubSubHubbub/Callback.php @@ -17,7 +17,6 @@ * @subpackage Callback * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/PubSubHubbub/Exception.php b/src/PubSubHubbub/Exception.php index 22dfc283..04155c21 100644 --- a/src/PubSubHubbub/Exception.php +++ b/src/PubSubHubbub/Exception.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/PubSubHubbub/HttpResponse.php b/src/PubSubHubbub/HttpResponse.php index afceeed0..7c705171 100644 --- a/src/PubSubHubbub/HttpResponse.php +++ b/src/PubSubHubbub/HttpResponse.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/PubSubHubbub/Model/AbstractModel.php b/src/PubSubHubbub/Model/AbstractModel.php index 704deb75..f6b4b2d4 100644 --- a/src/PubSubHubbub/Model/AbstractModel.php +++ b/src/PubSubHubbub/Model/AbstractModel.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/PubSubHubbub/Model/Subscription.php b/src/PubSubHubbub/Model/Subscription.php index 58f4a367..23a162e8 100644 --- a/src/PubSubHubbub/Model/Subscription.php +++ b/src/PubSubHubbub/Model/Subscription.php @@ -17,7 +17,6 @@ * @subpackage Entity * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/PubSubHubbub/Model/SubscriptionPersistence.php b/src/PubSubHubbub/Model/SubscriptionPersistence.php index 4d450c0f..ea7f49f8 100644 --- a/src/PubSubHubbub/Model/SubscriptionPersistence.php +++ b/src/PubSubHubbub/Model/SubscriptionPersistence.php @@ -17,7 +17,6 @@ * @subpackage Entity * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/PubSubHubbub/PubSubHubbub.php b/src/PubSubHubbub/PubSubHubbub.php index 83876062..d471b323 100644 --- a/src/PubSubHubbub/PubSubHubbub.php +++ b/src/PubSubHubbub/PubSubHubbub.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/PubSubHubbub/Publisher.php b/src/PubSubHubbub/Publisher.php index c69a3f8d..7d76d4ec 100644 --- a/src/PubSubHubbub/Publisher.php +++ b/src/PubSubHubbub/Publisher.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/PubSubHubbub/Subscriber.php b/src/PubSubHubbub/Subscriber.php index 47c485b3..cd6a3ffa 100644 --- a/src/PubSubHubbub/Subscriber.php +++ b/src/PubSubHubbub/Subscriber.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/PubSubHubbub/Subscriber/Callback.php b/src/PubSubHubbub/Subscriber/Callback.php index c578f63d..c583f157 100644 --- a/src/PubSubHubbub/Subscriber/Callback.php +++ b/src/PubSubHubbub/Subscriber/Callback.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/Reader/AbstractEntry.php b/src/Reader/AbstractEntry.php index efbec614..056d815d 100644 --- a/src/Reader/AbstractEntry.php +++ b/src/Reader/AbstractEntry.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/Reader/AbstractFeed.php b/src/Reader/AbstractFeed.php index 4eac6499..0fa81309 100644 --- a/src/Reader/AbstractFeed.php +++ b/src/Reader/AbstractFeed.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/Reader/Collection.php b/src/Reader/Collection.php index 101b12cd..8cfe5d9a 100644 --- a/src/Reader/Collection.php +++ b/src/Reader/Collection.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/Reader/Collection/AbstractCollection.php b/src/Reader/Collection/AbstractCollection.php index 0e1886a2..947ab620 100644 --- a/src/Reader/Collection/AbstractCollection.php +++ b/src/Reader/Collection/AbstractCollection.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: CollectionAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Collection/Author.php b/src/Reader/Collection/Author.php index 979349bb..1bb45f38 100644 --- a/src/Reader/Collection/Author.php +++ b/src/Reader/Collection/Author.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Author.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Collection/Category.php b/src/Reader/Collection/Category.php index fd172c03..a96af3ae 100644 --- a/src/Reader/Collection/Category.php +++ b/src/Reader/Collection/Category.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Category.php 20953 2010-02-06 17:55:34Z padraic $ */ /** diff --git a/src/Reader/Collection/Collection.php b/src/Reader/Collection/Collection.php index 7d024aed..6d852d84 100644 --- a/src/Reader/Collection/Collection.php +++ b/src/Reader/Collection/Collection.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Collection.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ /** diff --git a/src/Reader/Entry.php b/src/Reader/Entry.php index 753db670..22a8a5c7 100644 --- a/src/Reader/Entry.php +++ b/src/Reader/Entry.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: EntryInterface.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Entry/AbstractEntry.php b/src/Reader/Entry/AbstractEntry.php index fb950743..4af35644 100644 --- a/src/Reader/Entry/AbstractEntry.php +++ b/src/Reader/Entry/AbstractEntry.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: EntryAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index 9169f14d..99a48ffe 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -16,7 +16,6 @@ * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Atom.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index fe2f36a7..f6341b1c 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -16,7 +16,6 @@ * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Rss.php 22300 2010-05-26 10:13:34Z padraic $ */ /** diff --git a/src/Reader/Exception.php b/src/Reader/Exception.php index 64e36a14..10fe80c5 100644 --- a/src/Reader/Exception.php +++ b/src/Reader/Exception.php @@ -16,7 +16,6 @@ * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License -* @version $Id$ */ /** diff --git a/src/Reader/Extension/AbstractEntry.php b/src/Reader/Extension/AbstractEntry.php index 56562bb6..e963be67 100644 --- a/src/Reader/Extension/AbstractEntry.php +++ b/src/Reader/Extension/AbstractEntry.php @@ -16,7 +16,6 @@ * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: EntryAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Extension/AbstractFeed.php b/src/Reader/Extension/AbstractFeed.php index 9a50b72f..16655c5c 100644 --- a/src/Reader/Extension/AbstractFeed.php +++ b/src/Reader/Extension/AbstractFeed.php @@ -16,7 +16,6 @@ * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: FeedAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index f6b0d6f5..f0fe869c 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -16,7 +16,6 @@ * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Entry.php 22300 2010-05-26 10:13:34Z padraic $ */ /** diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index 5d9cd68e..2356d32c 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -16,7 +16,6 @@ * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Feed.php 22300 2010-05-26 10:13:34Z padraic $ */ /** diff --git a/src/Reader/Extension/Content/Entry.php b/src/Reader/Extension/Content/Entry.php index f3f8b66a..980a12cb 100644 --- a/src/Reader/Extension/Content/Entry.php +++ b/src/Reader/Extension/Content/Entry.php @@ -16,7 +16,6 @@ * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Entry.php 22300 2010-05-26 10:13:34Z padraic $ */ /** diff --git a/src/Reader/Extension/CreativeCommons/Entry.php b/src/Reader/Extension/CreativeCommons/Entry.php index 2de8f55a..e9e30caf 100644 --- a/src/Reader/Extension/CreativeCommons/Entry.php +++ b/src/Reader/Extension/CreativeCommons/Entry.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Extension/CreativeCommons/Feed.php b/src/Reader/Extension/CreativeCommons/Feed.php index 82dbd185..1a8b7488 100644 --- a/src/Reader/Extension/CreativeCommons/Feed.php +++ b/src/Reader/Extension/CreativeCommons/Feed.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Extension/DublinCore/Entry.php b/src/Reader/Extension/DublinCore/Entry.php index 923996e0..d530e7c3 100644 --- a/src/Reader/Extension/DublinCore/Entry.php +++ b/src/Reader/Extension/DublinCore/Entry.php @@ -16,7 +16,6 @@ * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Extension/DublinCore/Feed.php b/src/Reader/Extension/DublinCore/Feed.php index 4a80b40a..33a3737a 100644 --- a/src/Reader/Extension/DublinCore/Feed.php +++ b/src/Reader/Extension/DublinCore/Feed.php @@ -16,7 +16,6 @@ * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Extension/Podcast/Entry.php b/src/Reader/Extension/Podcast/Entry.php index 3636469f..7ceefbbc 100644 --- a/src/Reader/Extension/Podcast/Entry.php +++ b/src/Reader/Extension/Podcast/Entry.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Extension/Podcast/Feed.php b/src/Reader/Extension/Podcast/Feed.php index 292e8f71..325b44d7 100644 --- a/src/Reader/Extension/Podcast/Feed.php +++ b/src/Reader/Extension/Podcast/Feed.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Extension/Slash/Entry.php b/src/Reader/Extension/Slash/Entry.php index 43bf1184..032d3da8 100644 --- a/src/Reader/Extension/Slash/Entry.php +++ b/src/Reader/Extension/Slash/Entry.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Extension/Syndication/Feed.php b/src/Reader/Extension/Syndication/Feed.php index af7e3aba..ea1970b2 100644 --- a/src/Reader/Extension/Syndication/Feed.php +++ b/src/Reader/Extension/Syndication/Feed.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Extension/Thread/Entry.php b/src/Reader/Extension/Thread/Entry.php index e81573cf..d0a53bab 100644 --- a/src/Reader/Extension/Thread/Entry.php +++ b/src/Reader/Extension/Thread/Entry.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Extension/WellFormedWeb/Entry.php b/src/Reader/Extension/WellFormedWeb/Entry.php index 1bfe9d35..41b3813a 100644 --- a/src/Reader/Extension/WellFormedWeb/Entry.php +++ b/src/Reader/Extension/WellFormedWeb/Entry.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Feed.php b/src/Reader/Feed.php index 46cc3b3a..ba0f91fe 100644 --- a/src/Reader/Feed.php +++ b/src/Reader/Feed.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: FeedInterface.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Feed/AbstractFeed.php b/src/Reader/Feed/AbstractFeed.php index b5ea3c79..cf0fc8d4 100644 --- a/src/Reader/Feed/AbstractFeed.php +++ b/src/Reader/Feed/AbstractFeed.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: FeedAbstract.php 22092 2010-05-04 12:50:51Z padraic $ */ /** diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index b4dcb4a4..5a12ea59 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -16,7 +16,6 @@ * @package Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Atom.php 22107 2010-05-05 13:42:20Z padraic $ */ /** diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php index 25c8cd31..cfd33d19 100644 --- a/src/Reader/Feed/Atom/Source.php +++ b/src/Reader/Feed/Atom/Source.php @@ -16,7 +16,6 @@ * @package Reader\Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Source.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ /** diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 410409f3..09ea262a 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -16,7 +16,6 @@ * @package Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Rss.php 22300 2010-05-26 10:13:34Z padraic $ */ /** diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index 77def138..20b521da 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: FeedSet.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Reader/Reader.php b/src/Reader/Reader.php index 4982f27d..594ae517 100644 --- a/src/Reader/Reader.php +++ b/src/Reader/Reader.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Reader.php 22092 2010-05-04 12:50:51Z padraic $ */ /** diff --git a/src/Writer/AbstractFeed.php b/src/Writer/AbstractFeed.php index c5c27f16..c6bbabef 100644 --- a/src/Writer/AbstractFeed.php +++ b/src/Writer/AbstractFeed.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: FeedAbstract.php 22107 2010-05-05 13:42:20Z padraic $ */ /** diff --git a/src/Writer/Deleted.php b/src/Writer/Deleted.php index 83ebd929..094a7b27 100644 --- a/src/Writer/Deleted.php +++ b/src/Writer/Deleted.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Deleted.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ /** diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index c16233fd..0502f185 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Entry.php 22064 2010-04-30 14:02:38Z padraic $ */ /** diff --git a/src/Writer/Exception.php b/src/Writer/Exception.php index c9c2a8cc..babca267 100644 --- a/src/Writer/Exception.php +++ b/src/Writer/Exception.php @@ -16,7 +16,6 @@ * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License -* @version $Id$ */ /** diff --git a/src/Writer/Exception/InvalidMethodException.php b/src/Writer/Exception/InvalidMethodException.php index c0a87573..715ddce9 100644 --- a/src/Writer/Exception/InvalidMethodException.php +++ b/src/Writer/Exception/InvalidMethodException.php @@ -17,7 +17,6 @@ * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: InvalidMethodException.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /* @namespace */ diff --git a/src/Writer/Extension/AbstractRenderer.php b/src/Writer/Extension/AbstractRenderer.php index c8d66102..808a84d7 100644 --- a/src/Writer/Extension/AbstractRenderer.php +++ b/src/Writer/Extension/AbstractRenderer.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer_Entry_Rss * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: RendererAbstract.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ /** diff --git a/src/Writer/Extension/Atom/Renderer/Feed.php b/src/Writer/Extension/Atom/Renderer/Feed.php index 12b2f2af..b5a985b7 100644 --- a/src/Writer/Extension/Atom/Renderer/Feed.php +++ b/src/Writer/Extension/Atom/Renderer/Feed.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Feed.php 20325 2010-01-16 00:17:59Z padraic $ */ /** diff --git a/src/Writer/Extension/Content/Renderer/Entry.php b/src/Writer/Extension/Content/Renderer/Entry.php index 3f4567b2..cc07ba5e 100644 --- a/src/Writer/Extension/Content/Renderer/Entry.php +++ b/src/Writer/Extension/Content/Renderer/Entry.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Entry.php 20325 2010-01-16 00:17:59Z padraic $ */ /** diff --git a/src/Writer/Extension/DublinCore/Renderer/Entry.php b/src/Writer/Extension/DublinCore/Renderer/Entry.php index 6fb40a51..9971c8cf 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Entry.php +++ b/src/Writer/Extension/DublinCore/Renderer/Entry.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Entry.php 20325 2010-01-16 00:17:59Z padraic $ */ /** diff --git a/src/Writer/Extension/DublinCore/Renderer/Feed.php b/src/Writer/Extension/DublinCore/Renderer/Feed.php index 3ed1b8f5..016eb6eb 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Feed.php +++ b/src/Writer/Extension/DublinCore/Renderer/Feed.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Feed.php 20325 2010-01-16 00:17:59Z padraic $ */ /** diff --git a/src/Writer/Extension/ITunes/Entry.php b/src/Writer/Extension/ITunes/Entry.php index 3dbb6eeb..82fdae0a 100644 --- a/src/Writer/Extension/ITunes/Entry.php +++ b/src/Writer/Extension/ITunes/Entry.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Writer/Extension/ITunes/Feed.php b/src/Writer/Extension/ITunes/Feed.php index c7285ba9..969a666f 100644 --- a/src/Writer/Extension/ITunes/Feed.php +++ b/src/Writer/Extension/ITunes/Feed.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php index c446c8bc..24e1a2e4 100644 --- a/src/Writer/Extension/ITunes/Renderer/Entry.php +++ b/src/Writer/Extension/ITunes/Renderer/Entry.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Entry.php 20325 2010-01-16 00:17:59Z padraic $ */ /** diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php index 88a55bd2..bcddd1da 100644 --- a/src/Writer/Extension/ITunes/Renderer/Feed.php +++ b/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Feed.php 20325 2010-01-16 00:17:59Z padraic $ */ /** diff --git a/src/Writer/Extension/Renderer.php b/src/Writer/Extension/Renderer.php index 26dc8e0e..ea32ecc1 100644 --- a/src/Writer/Extension/Renderer.php +++ b/src/Writer/Extension/Renderer.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: RendererInterface.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ /** diff --git a/src/Writer/Extension/Slash/Renderer/Entry.php b/src/Writer/Extension/Slash/Renderer/Entry.php index 0cee8852..bfb08153 100644 --- a/src/Writer/Extension/Slash/Renderer/Entry.php +++ b/src/Writer/Extension/Slash/Renderer/Entry.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Entry.php 20325 2010-01-16 00:17:59Z padraic $ */ /** diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php index 8079a39a..1676b1f2 100644 --- a/src/Writer/Extension/Threading/Renderer/Entry.php +++ b/src/Writer/Extension/Threading/Renderer/Entry.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Entry.php 20325 2010-01-16 00:17:59Z padraic $ */ /** diff --git a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php index e3e0fb41..e3b93f48 100644 --- a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php +++ b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Entry.php 20325 2010-01-16 00:17:59Z padraic $ */ /** diff --git a/src/Writer/Feed.php b/src/Writer/Feed.php index caf58bcf..675a6023 100644 --- a/src/Writer/Feed.php +++ b/src/Writer/Feed.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Feed.php 20518 2010-01-22 14:00:30Z padraic $ */ /** diff --git a/src/Writer/InvalidMethodException.php b/src/Writer/InvalidMethodException.php index 6475e484..4f963651 100644 --- a/src/Writer/InvalidMethodException.php +++ b/src/Writer/InvalidMethodException.php @@ -17,7 +17,6 @@ * @package Zend_Feed * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/Writer/Renderer.php b/src/Writer/Renderer.php index 9104bcfe..1e4b244c 100644 --- a/src/Writer/Renderer.php +++ b/src/Writer/Renderer.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/Writer/Renderer/AbstractRenderer.php b/src/Writer/Renderer/AbstractRenderer.php index 1fc436ed..a1f4669a 100644 --- a/src/Writer/Renderer/AbstractRenderer.php +++ b/src/Writer/Renderer/AbstractRenderer.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: RendererAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom.php index 68d6f2f6..16ceea43 100644 --- a/src/Writer/Renderer/Entry/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Atom.php 22064 2010-04-30 14:02:38Z padraic $ */ /** diff --git a/src/Writer/Renderer/Entry/Atom/Deleted.php b/src/Writer/Renderer/Entry/Atom/Deleted.php index 099d5eda..017d366d 100644 --- a/src/Writer/Renderer/Entry/Atom/Deleted.php +++ b/src/Writer/Renderer/Entry/Atom/Deleted.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/Writer/Renderer/Entry/AtomDeleted.php b/src/Writer/Renderer/Entry/AtomDeleted.php index 5bb1bd2f..e94b27db 100644 --- a/src/Writer/Renderer/Entry/AtomDeleted.php +++ b/src/Writer/Renderer/Entry/AtomDeleted.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Deleted.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ /** diff --git a/src/Writer/Renderer/Entry/Rss.php b/src/Writer/Renderer/Entry/Rss.php index 8c2ef6ca..12699dca 100644 --- a/src/Writer/Renderer/Entry/Rss.php +++ b/src/Writer/Renderer/Entry/Rss.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Rss.php 22064 2010-04-30 14:02:38Z padraic $ */ /** diff --git a/src/Writer/Renderer/Feed/AbstractAtom.php b/src/Writer/Renderer/Feed/AbstractAtom.php index 832d9b04..430c258a 100644 --- a/src/Writer/Renderer/Feed/AbstractAtom.php +++ b/src/Writer/Renderer/Feed/AbstractAtom.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: AtomAbstract.php 22099 2010-05-04 18:51:58Z padraic $ */ /** diff --git a/src/Writer/Renderer/Feed/Atom.php b/src/Writer/Renderer/Feed/Atom.php index 2e6f7867..b9c7a4ad 100644 --- a/src/Writer/Renderer/Feed/Atom.php +++ b/src/Writer/Renderer/Feed/Atom.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Atom.php 22097 2010-05-04 17:56:06Z padraic $ */ /** diff --git a/src/Writer/Renderer/Feed/Atom/AbstractAtom.php b/src/Writer/Renderer/Feed/Atom/AbstractAtom.php index 129e5cdb..879c3b14 100644 --- a/src/Writer/Renderer/Feed/Atom/AbstractAtom.php +++ b/src/Writer/Renderer/Feed/Atom/AbstractAtom.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/Writer/Renderer/Feed/Atom/Source.php b/src/Writer/Renderer/Feed/Atom/Source.php index df3b0685..7c4a1b02 100644 --- a/src/Writer/Renderer/Feed/Atom/Source.php +++ b/src/Writer/Renderer/Feed/Atom/Source.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/src/Writer/Renderer/Feed/AtomSource.php b/src/Writer/Renderer/Feed/AtomSource.php index 763ed5a8..24b34e2d 100644 --- a/src/Writer/Renderer/Feed/AtomSource.php +++ b/src/Writer/Renderer/Feed/AtomSource.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Source.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ /** diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index 01375b9d..394e0903 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Rss.php 22107 2010-05-05 13:42:20Z padraic $ */ /** diff --git a/src/Writer/Renderer/Renderer.php b/src/Writer/Renderer/Renderer.php index 85fd1fef..38c38184 100644 --- a/src/Writer/Renderer/Renderer.php +++ b/src/Writer/Renderer/Renderer.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: RendererInterface.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/src/Writer/Source.php b/src/Writer/Source.php index a4eddf50..ba0be24d 100644 --- a/src/Writer/Source.php +++ b/src/Writer/Source.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Source.php 20785 2010-01-31 09:43:03Z mikaelkael $ */ /** diff --git a/src/Writer/Writer.php b/src/Writer/Writer.php index 915e731a..560f91ea 100644 --- a/src/Writer/Writer.php +++ b/src/Writer/Writer.php @@ -16,7 +16,6 @@ * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Writer.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/test/PubSubHubbub/Model/SubscriptionTest.php b/test/PubSubHubbub/Model/SubscriptionTest.php index 441dd5dd..1d361661 100644 --- a/test/PubSubHubbub/Model/SubscriptionTest.php +++ b/test/PubSubHubbub/Model/SubscriptionTest.php @@ -16,7 +16,6 @@ * @package UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ namespace ZendTest\Feed\PubSubHubbub\Model; diff --git a/test/PubSubHubbub/PubSubHubbubTest.php b/test/PubSubHubbub/PubSubHubbubTest.php index 3163e95c..399d73e9 100644 --- a/test/PubSubHubbub/PubSubHubbubTest.php +++ b/test/PubSubHubbub/PubSubHubbubTest.php @@ -16,7 +16,6 @@ * @package UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/test/PubSubHubbub/PublisherTest.php b/test/PubSubHubbub/PublisherTest.php index 6b52f450..e08e0658 100644 --- a/test/PubSubHubbub/PublisherTest.php +++ b/test/PubSubHubbub/PublisherTest.php @@ -16,7 +16,6 @@ * @package UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/test/PubSubHubbub/Subscriber/CallbackTest.php b/test/PubSubHubbub/Subscriber/CallbackTest.php index 5852da76..24883298 100644 --- a/test/PubSubHubbub/Subscriber/CallbackTest.php +++ b/test/PubSubHubbub/Subscriber/CallbackTest.php @@ -16,7 +16,6 @@ * @package UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/test/PubSubHubbub/SubscriberHttpTest.php b/test/PubSubHubbub/SubscriberHttpTest.php index a792c2f6..9682f6d2 100644 --- a/test/PubSubHubbub/SubscriberHttpTest.php +++ b/test/PubSubHubbub/SubscriberHttpTest.php @@ -16,7 +16,6 @@ * @package UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/test/PubSubHubbub/SubscriberTest.php b/test/PubSubHubbub/SubscriberTest.php index b476fc89..e01b9829 100644 --- a/test/PubSubHubbub/SubscriberTest.php +++ b/test/PubSubHubbub/SubscriberTest.php @@ -16,7 +16,6 @@ * @package UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/test/Reader/Entry/AtomStandaloneEntryTest.php b/test/Reader/Entry/AtomStandaloneEntryTest.php index 09dc5182..c083eebf 100644 --- a/test/Reader/Entry/AtomStandaloneEntryTest.php +++ b/test/Reader/Entry/AtomStandaloneEntryTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: AtomTest.php 19159 2009-11-21 14:23:15Z padraic $ */ /** diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index 75dce94c..ae4606b1 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: AtomTest.php 20462 2010-01-21 15:23:52Z padraic $ */ /** diff --git a/test/Reader/Entry/CommonTest.php b/test/Reader/Entry/CommonTest.php index 54e28162..4e9f6ce1 100644 --- a/test/Reader/Entry/CommonTest.php +++ b/test/Reader/Entry/CommonTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: CommonTest.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index 7ef3bde7..c70798c0 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: RssTest.php 22086 2010-05-04 11:25:54Z padraic $ */ /** diff --git a/test/Reader/Feed/AtomSourceTest.php b/test/Reader/Feed/AtomSourceTest.php index fc1f7057..f4c72c7f 100644 --- a/test/Reader/Feed/AtomSourceTest.php +++ b/test/Reader/Feed/AtomSourceTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: AtomTest.php 19168 2009-11-21 17:17:18Z padraic $ */ /** diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 7dc793d2..ec482a5c 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: AtomTest.php 22107 2010-05-05 13:42:20Z padraic $ */ /** diff --git a/test/Reader/Feed/CommonTest.php b/test/Reader/Feed/CommonTest.php index 3766824a..b2b2c116 100644 --- a/test/Reader/Feed/CommonTest.php +++ b/test/Reader/Feed/CommonTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: CommonTest.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index d4992241..e1ec4dbb 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: RssTest.php 22297 2010-05-25 21:33:38Z padraic $ */ /** diff --git a/test/Reader/Integration/H-OnlineComAtom10Test.php b/test/Reader/Integration/H-OnlineComAtom10Test.php index 572d19f5..2d8adf8d 100644 --- a/test/Reader/Integration/H-OnlineComAtom10Test.php +++ b/test/Reader/Integration/H-OnlineComAtom10Test.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: H-OnlineComAtom10Test.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/test/Reader/Integration/LautDeRdfTest.php b/test/Reader/Integration/LautDeRdfTest.php index 81d6b209..9d2dd4d8 100644 --- a/test/Reader/Integration/LautDeRdfTest.php +++ b/test/Reader/Integration/LautDeRdfTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: LautDeRdfTest.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/test/Reader/Integration/PodcastRss2Test.php b/test/Reader/Integration/PodcastRss2Test.php index 429eda89..b66c6f6e 100644 --- a/test/Reader/Integration/PodcastRss2Test.php +++ b/test/Reader/Integration/PodcastRss2Test.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: PodcastRss2Test.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/test/Reader/Integration/WordpressAtom10Test.php b/test/Reader/Integration/WordpressAtom10Test.php index 0a38add9..d491b8a9 100644 --- a/test/Reader/Integration/WordpressAtom10Test.php +++ b/test/Reader/Integration/WordpressAtom10Test.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: WordpressAtom10Test.php 22300 2010-05-26 10:13:34Z padraic $ */ /** diff --git a/test/Reader/Integration/WordpressRss2DcAtomTest.php b/test/Reader/Integration/WordpressRss2DcAtomTest.php index 5cfa5611..87e96609 100644 --- a/test/Reader/Integration/WordpressRss2DcAtomTest.php +++ b/test/Reader/Integration/WordpressRss2DcAtomTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: WordpressRss2DcAtomTest.php 22300 2010-05-26 10:13:34Z padraic $ */ /** diff --git a/test/Reader/ReaderTest.php b/test/Reader/ReaderTest.php index 53594843..4d4cff10 100644 --- a/test/Reader/ReaderTest.php +++ b/test/Reader/ReaderTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ReaderTest.php 22031 2010-04-28 15:47:44Z padraic $ */ /** diff --git a/test/Reader/_files/My/Extension/JungleBooks/Entry.php b/test/Reader/_files/My/Extension/JungleBooks/Entry.php index dc195129..00025ffd 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Entry.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Entry.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/test/Reader/_files/My/Extension/JungleBooks/Feed.php b/test/Reader/_files/My/Extension/JungleBooks/Feed.php index 72954472..030dbd64 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Feed.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Feed.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** diff --git a/test/ReaderTest.php b/test/ReaderTest.php index 387b7281..218bb26c 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/test/Writer/DeletedTest.php b/test/Writer/DeletedTest.php index b4ef079a..e522bd7e 100644 --- a/test/Writer/DeletedTest.php +++ b/test/Writer/DeletedTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/test/Writer/EntryTest.php b/test/Writer/EntryTest.php index a305f07b..464dbf60 100644 --- a/test/Writer/EntryTest.php +++ b/test/Writer/EntryTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/test/Writer/Extension/ITunes/EntryTest.php b/test/Writer/Extension/ITunes/EntryTest.php index 2e169617..7e15070b 100644 --- a/test/Writer/Extension/ITunes/EntryTest.php +++ b/test/Writer/Extension/ITunes/EntryTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/test/Writer/Extension/ITunes/FeedTest.php b/test/Writer/Extension/ITunes/FeedTest.php index 6d9a4b6f..2bc5b5d8 100644 --- a/test/Writer/Extension/ITunes/FeedTest.php +++ b/test/Writer/Extension/ITunes/FeedTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php index f356d1c9..4952a1b9 100644 --- a/test/Writer/FeedTest.php +++ b/test/Writer/FeedTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/test/Writer/Renderer/Entry/AtomTest.php b/test/Writer/Renderer/Entry/AtomTest.php index 18783c0d..59601058 100644 --- a/test/Writer/Renderer/Entry/AtomTest.php +++ b/test/Writer/Renderer/Entry/AtomTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/test/Writer/Renderer/Entry/RssTest.php b/test/Writer/Renderer/Entry/RssTest.php index 329288a9..f18ebeb7 100644 --- a/test/Writer/Renderer/Entry/RssTest.php +++ b/test/Writer/Renderer/Entry/RssTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/test/Writer/Renderer/Feed/AtomTest.php b/test/Writer/Renderer/Feed/AtomTest.php index 8039e518..a2c6c3d4 100644 --- a/test/Writer/Renderer/Feed/AtomTest.php +++ b/test/Writer/Renderer/Feed/AtomTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** diff --git a/test/Writer/Renderer/Feed/RssTest.php b/test/Writer/Renderer/Feed/RssTest.php index 0e9db489..02b23c1e 100644 --- a/test/Writer/Renderer/Feed/RssTest.php +++ b/test/Writer/Renderer/Feed/RssTest.php @@ -17,7 +17,6 @@ * @subpackage UnitTests * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ */ /** From d68d811ee8d46ea984937ffede30884a97e99a1d Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 21 Jul 2011 17:27:45 -0500 Subject: [PATCH 174/238] Zend\Uri: Updated Feed\Reader component to use new URI API --- src/Reader/FeedSet.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index 19ec8a74..114dd5bc 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -22,17 +22,17 @@ * @namespace */ namespace Zend\Feed\Reader; -use Zend\Uri; + +use ArrayObject, + Zend\Uri; /** -* @uses \Zend\Feed\Reader\Reader -* @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class FeedSet extends \ArrayObject +class FeedSet extends ArrayObject { public $rss = null; @@ -84,16 +84,16 @@ public function addLinks(\DOMNodeList $links, $uri) */ protected function _absolutiseUri($link, $uri = null) { - if (!Uri\Url::validate($link)) { + if (!Uri\UriFactory::factory($link)->isValid()) { if ($uri !== null) { - $uri = new Uri\Url($uri); + $uri = Uri\UriFactory::factory($uri); if ($link[0] !== '/') { $link = $uri->getPath() . '/' . $link; } $link = $uri->getScheme() . '://' . $uri->getHost() . '/' . $this->_canonicalizePath($link); - if (!URI\URL::validate($link)) { + if (!Uri\UriFactory::factory($link)->isValid()) { $link = null; } } From 5a9edd353c960e6fcc40999f0d6a79d805f97629 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 21 Jul 2011 17:33:30 -0500 Subject: [PATCH 175/238] Zend\Uri: Updated Feed\PubSubHubbub component to use new URI API --- src/PubSubHubbub/PubSubHubbub.php | 11 +++-------- src/PubSubHubbub/Publisher.php | 12 ++++-------- src/PubSubHubbub/Subscriber.php | 21 +++++++-------------- src/PubSubHubbub/Subscriber/Callback.php | 10 ++++------ 4 files changed, 18 insertions(+), 36 deletions(-) diff --git a/src/PubSubHubbub/PubSubHubbub.php b/src/PubSubHubbub/PubSubHubbub.php index 4640f7c2..0a7608db 100644 --- a/src/PubSubHubbub/PubSubHubbub.php +++ b/src/PubSubHubbub/PubSubHubbub.php @@ -22,16 +22,11 @@ * @namespace */ namespace Zend\Feed\PubSubHubbub; -use Zend\Feed\Reader; -use Zend\Http; + +use Zend\Feed\Reader, + Zend\Http; /** - * @uses \Zend\Http\Client - * @uses \Zend\Feed\AbstractFeed - * @uses \Zend\Feed\PubSubHubbub\Exception - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Uri\Uri - * @uses \Zend\Version * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/PubSubHubbub/Publisher.php b/src/PubSubHubbub/Publisher.php index 74b7e907..3a65ff06 100644 --- a/src/PubSubHubbub/Publisher.php +++ b/src/PubSubHubbub/Publisher.php @@ -22,14 +22,10 @@ * @namespace */ namespace Zend\Feed\PubSubHubbub; + use Zend\Uri; /** - * @uses \Zend\Feed\PubSubHubbub\PubSubHubbub - * @uses \Zend\Feed\PubSubHubbub\Exception - * @uses \Zend\Http\Client - * @uses \Zend\Uri\Uri - * @uses \Zend\Version * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) @@ -118,7 +114,7 @@ public function setConfig($config) */ public function addHubUrl($url) { - if (empty($url) || !is_string($url) || !\Zend\Uri\Url::validate($url)) { + if (empty($url) || !is_string($url) || !Uri\UriFactory::factory($url)->isValid()) { throw new Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .'URL'); @@ -176,7 +172,7 @@ public function getHubUrls() */ public function addUpdatedTopicUrl($url) { - if (empty($url) || !is_string($url) || !\Zend\Uri\Url::validate($url)) { + if (empty($url) || !is_string($url) || !Uri\UriFactory::factory($url)->isValid()) { throw new Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .'URL'); @@ -235,7 +231,7 @@ public function getUpdatedTopicUrls() */ public function notifyHub($url) { - if (empty($url) || !is_string($url) || !Uri\Url::validate($url)) { + if (empty($url) || !is_string($url) || !Uri\UriFactory::factory($url)->isValid()) { throw new Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .'URL'); diff --git a/src/PubSubHubbub/Subscriber.php b/src/PubSubHubbub/Subscriber.php index 230e0f80..0be6de5c 100644 --- a/src/PubSubHubbub/Subscriber.php +++ b/src/PubSubHubbub/Subscriber.php @@ -23,16 +23,10 @@ */ namespace Zend\Feed\PubSubHubbub; -use Zend\Uri; -use Zend\Date; +use Zend\Date, + Zend\Uri; /** - * @uses \Zend\Date\Date - * @uses \Zend\Feed\PubSubHubbub\PubSubHubbub - * @uses \Zend\Feed\PubSubHubbub\Exception - * @uses \Zend\Http\Client - * @uses \Zend\Uri\Uri - * @uses \Zend\Version * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) @@ -90,8 +84,7 @@ class Subscriber * * @var string */ - protected $_preferredVerificationMode - = PubSubHubbub::VERIFICATION_MODE_SYNC; + protected $_preferredVerificationMode = PubSubHubbub::VERIFICATION_MODE_SYNC; /** * An array of any errors including keys for 'response', 'hubUrl'. @@ -213,7 +206,7 @@ public function setConfig($config) */ public function setTopicUrl($url) { - if (empty($url) || !is_string($url) || !\Zend\Uri\Url::validate($url)) { + if (empty($url) || !is_string($url) || !Uri\UriFactory::factory($url)->isValid()) { throw new Exception('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .' URL'); @@ -273,7 +266,7 @@ public function getLeaseSeconds() */ public function setCallbackUrl($url) { - if (empty($url) || !is_string($url) || !\Zend\Uri\Url::validate($url)) { + if (empty($url) || !is_string($url) || !Uri\UriFactory::factory($url)->isValid()) { throw new Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); @@ -340,7 +333,7 @@ public function getPreferredVerificationMode() */ public function addHubUrl($url) { - if (empty($url) || !is_string($url) || !\Zend\Uri\Url::validate($url)) { + if (empty($url) || !is_string($url) || !Uri\UriFactory::factory($url)->isValid()) { throw new Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); @@ -399,7 +392,7 @@ public function getHubUrls() */ public function addAuthentication($url, array $authentication) { - if (empty($url) || !is_string($url) || !URI\Zend\Uri\Uri::check($url)) { + if (empty($url) || !is_string($url) || !Uri\UriFactory::factory($url)->isValid()) { throw new Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); diff --git a/src/PubSubHubbub/Subscriber/Callback.php b/src/PubSubHubbub/Subscriber/Callback.php index 43f5cf33..eeea2011 100644 --- a/src/PubSubHubbub/Subscriber/Callback.php +++ b/src/PubSubHubbub/Subscriber/Callback.php @@ -22,13 +22,11 @@ * @namespace */ namespace Zend\Feed\PubSubHubbub\Subscriber; -use Zend\Feed\PubSubHubbub; + +use Zend\Feed\PubSubHubbub, + Zend\Uri; /** - * @uses \Zend\Feed\PubSubHubbub\PubSubHubbub - * @uses \Zend\Feed\PubSubHubbub\AbstractCallback - * @uses \Zend\Feed\Reader\Reader - * @uses \Zend\Uri\Uri * @category Zend * @package Zend_Feed_Pubsubhubbub * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) @@ -167,7 +165,7 @@ public function isValidHubVerification(array $httpGetData) ) { return false; } - if (!\Zend\Uri\Url::validate($httpGetData['hub_topic'])) { + if (!Uri\UriFactory::factory($httpGetData['hub_topic'])->isValid()) { return false; } From e2546cb188ea5922d8924ae35893aaf7b4b3ab52 Mon Sep 17 00:00:00 2001 From: John Kelly Date: Wed, 17 Aug 2011 11:49:57 -0700 Subject: [PATCH 176/238] Fix PHPUnit 3.6 deprecation errors --- test/PubSubHubbub/Model/SubscriptionTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/PubSubHubbub/Model/SubscriptionTest.php b/test/PubSubHubbub/Model/SubscriptionTest.php index 9240ed4c..727158fa 100644 --- a/test/PubSubHubbub/Model/SubscriptionTest.php +++ b/test/PubSubHubbub/Model/SubscriptionTest.php @@ -48,7 +48,7 @@ public function testAllOperations() $this->assertTrue($subscription->hasSubscription($id)); $dataSubscription = $subscription->getSubscription($id); - $this->assertType('array', $dataSubscription); + $this->assertInternalType('array', $dataSubscription); $keys = array('id', 'topic_url', 'hub_url', 'created_time', 'lease_seconds', 'verify_token', 'secret', From 480ebca4ba5d3dafcd14ca7d62c14d9708b3a844 Mon Sep 17 00:00:00 2001 From: Damien Pitard Date: Tue, 27 Sep 2011 16:32:17 +0200 Subject: [PATCH 177/238] Added use of Zend\Feed\Reader\Exception in Feed/Reader/Entry/AbstractEntry.php --- src/Reader/Entry/AbstractEntry.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Reader/Entry/AbstractEntry.php b/src/Reader/Entry/AbstractEntry.php index a450e715..e79655dd 100644 --- a/src/Reader/Entry/AbstractEntry.php +++ b/src/Reader/Entry/AbstractEntry.php @@ -23,6 +23,7 @@ */ namespace Zend\Feed\Reader\Entry; use Zend\Feed\Reader; +use Zend\Feed\Reader\Exception; /** * @uses \Zend\Feed\Reader\Exception From b63cc6907b094c705bdec9c8313ff8c2c85ea085 Mon Sep 17 00:00:00 2001 From: Damien Pitard Date: Tue, 27 Sep 2011 16:34:13 +0200 Subject: [PATCH 178/238] Fixed typo in an exception in Zend\Feed\Reader\Entry\AbstractEntry --- src/Reader/Entry/AbstractEntry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Reader/Entry/AbstractEntry.php b/src/Reader/Entry/AbstractEntry.php index e79655dd..f308a9da 100644 --- a/src/Reader/Entry/AbstractEntry.php +++ b/src/Reader/Entry/AbstractEntry.php @@ -220,7 +220,7 @@ public function __call($method, $args) } } throw new Exception('Method: ' . $method - . 'does not exist and could not be located on a registered Extension'); + . ' does not exist and could not be located on a registered Extension'); } /** From a28fb17a959d4dfd6940c7d2e2b9e8156c02d7b1 Mon Sep 17 00:00:00 2001 From: Damien Pitard Date: Tue, 27 Sep 2011 16:57:34 +0200 Subject: [PATCH 179/238] Removed obsolete use in Feed\Reader --- src/Reader/Reader.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Reader/Reader.php b/src/Reader/Reader.php index 82babcda..7e67b3ea 100644 --- a/src/Reader/Reader.php +++ b/src/Reader/Reader.php @@ -24,8 +24,7 @@ namespace Zend\Feed\Reader; use Zend\Http, - Zend\Loader, - Zend\Http\Headers; + Zend\Loader; /** * @category Zend @@ -212,7 +211,7 @@ public static function import($uri, $etag = null, $lastModified = null) $responseXml = ''; $client = self::getHttpClient(); $client->resetParameters(); - $headers = new Headers(); + $headers = new Http\Headers(); $client->setHeaders($headers); $client->setUri($uri); $cacheId = 'Zend_Feed_Reader_' . md5($uri); From 7a0847ff2510143371e52c1836bba0ca0800433f Mon Sep 17 00:00:00 2001 From: Marc Bennewitz Date: Sun, 5 Feb 2012 14:43:18 +0100 Subject: [PATCH 180/238] replaced is_null($foo->$bar()) with $foo->$bar() === null --- src/PubSubHubbub/Subscriber.php | 2 +- src/Reader/Extension/Atom/Entry.php | 2 +- src/Reader/Extension/Atom/Feed.php | 2 +- src/Reader/Feed/Rss.php | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/PubSubHubbub/Subscriber.php b/src/PubSubHubbub/Subscriber.php index 8f669290..e64bcfe5 100644 --- a/src/PubSubHubbub/Subscriber.php +++ b/src/PubSubHubbub/Subscriber.php @@ -715,7 +715,7 @@ protected function _getRequestParameters($hubUrl, $mode) $params['hub.callback'] = rtrim($this->getCallbackUrl(), '/') . '/' . PubSubHubbub::urlencode($key); } - if ($mode == 'subscribe' && !is_null($this->getLeaseSeconds())) { + if ($mode == 'subscribe' && $this->getLeaseSeconds() !== null) { $params['hub.lease_seconds'] = $this->getLeaseSeconds(); } diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index f35645dc..becc58b2 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -563,7 +563,7 @@ public function getSource() protected function _absolutiseUri($link) { if (!Uri\UriFactory::factory($link)->isValid()) { - if (!is_null($this->getBaseUrl())) { + if ($this->getBaseUrl() !== null) { $link = $this->getBaseUrl() . $link; if (!Uri\UriFactory::factory($link)->isValid()) { $link = null; diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index 0120b721..fb764af2 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -504,7 +504,7 @@ protected function _getAuthor(\DOMElement $element) protected function _absolutiseUri($link) { if (!Uri\UriFactory::factory($link)->isValid()) { - if (!is_null($this->getBaseUrl())) { + if ($this->getBaseUrl() !== null) { $link = $this->getBaseUrl() . $link; if (!Uri\UriFactory::factory($link)->isValid()) { $link = null; diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index a9e59c87..98360e3c 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -167,7 +167,7 @@ public function getCopyright() $copyright = $this->_xpath->evaluate('string(/rss/channel/copyright)'); } - if (!$copyright && !is_null($this->getExtension('DublinCore'))) { + if (!$copyright && $this->getExtension('DublinCore') !== null) { $copyright = $this->getExtension('DublinCore')->getCopyright(); } @@ -331,7 +331,7 @@ public function getDescription() $description = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:description)'); } - if (!$description && !is_null($this->getExtension('DublinCore'))) { + if (!$description && $this->getExtension('DublinCore') !== null) { $description = $this->getExtension('DublinCore')->getDescription(); } @@ -366,7 +366,7 @@ public function getId() $id = $this->_xpath->evaluate('string(/rss/channel/guid)'); } - if (!$id && !is_null($this->getExtension('DublinCore'))) { + if (!$id && $this->getExtension('DublinCore') !== null) { $id = $this->getExtension('DublinCore')->getId(); } @@ -461,7 +461,7 @@ public function getLanguage() $language = $this->_xpath->evaluate('string(/rss/channel/language)'); } - if (!$language && !is_null($this->getExtension('DublinCore'))) { + if (!$language && $this->getExtension('DublinCore') !== null) { $language = $this->getExtension('DublinCore')->getLanguage(); } @@ -599,7 +599,7 @@ public function getTitle() $title = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:title)'); } - if (!$title && !is_null($this->getExtension('DublinCore'))) { + if (!$title && $this->getExtension('DublinCore') !== null) { $title = $this->getExtension('DublinCore')->getTitle(); } From bf56ddec526a65668ec612d59e3af80cc16d59ac Mon Sep 17 00:00:00 2001 From: Adam Lundrigan Date: Sat, 25 Feb 2012 17:05:08 -0330 Subject: [PATCH 181/238] [ZF-12023] Zend\Feed\Writer\AbstractFeed should accept UNIX timestamps which are <>10 digits --- src/Writer/AbstractFeed.php | 6 +++--- test/Writer/FeedTest.php | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/Writer/AbstractFeed.php b/src/Writer/AbstractFeed.php index a15b6cd3..0ee97fc0 100644 --- a/src/Writer/AbstractFeed.php +++ b/src/Writer/AbstractFeed.php @@ -144,7 +144,7 @@ public function setDateCreated($date = null) $zdate = null; if ($date === null) { $zdate = new Date\Date; - } elseif (ctype_digit($date) && strlen($date) == 10) { + } elseif (ctype_digit($date)) { $zdate = new Date\Date($date, Date\Date::TIMESTAMP); } elseif ($date instanceof Date\Date) { $zdate = $date; @@ -164,7 +164,7 @@ public function setDateModified($date = null) $zdate = null; if ($date === null) { $zdate = new Date\Date; - } elseif (ctype_digit($date) && strlen($date) == 10) { + } elseif (ctype_digit($date)) { $zdate = new Date\Date($date, Date\Date::TIMESTAMP); } elseif ($date instanceof Date\Date) { $zdate = $date; @@ -184,7 +184,7 @@ public function setLastBuildDate($date = null) $zdate = null; if ($date === null) { $zdate = new Date\Date; - } elseif (ctype_digit($date) && strlen($date) == 10) { + } elseif (ctype_digit($date)) { $zdate = new Date\Date($date, Date\Date::TIMESTAMP); } elseif ($date instanceof Date\Date) { $zdate = $date; diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php index 53b4d800..907b6b64 100644 --- a/test/Writer/FeedTest.php +++ b/test/Writer/FeedTest.php @@ -203,6 +203,17 @@ public function testSetDateCreatedUsesGivenUnixTimestamp() $this->assertTrue($myDate->equals($writer->getDateCreated())); } + /** + * @group ZF-12023 + */ + public function testSetDateCreatedUsesGivenUnixTimestampThatIsLessThanTenDigits() + { + $writer = new Writer\Feed; + $writer->setDateCreated(123456789); + $myDate = new Date\Date('123456789', Date\Date::TIMESTAMP); + $this->assertTrue($myDate->equals($writer->getDateCreated())); + } + public function testSetDateCreatedUsesZendDateObject() { $writer = new Writer\Feed; @@ -226,6 +237,17 @@ public function testSetDateModifiedUsesGivenUnixTimestamp() $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($writer->getDateModified())); } + + /** + * @group ZF-12023 + */ + public function testSetDateModifiedUsesGivenUnixTimestampThatIsLessThanTenDigits() + { + $writer = new Writer\Feed; + $writer->setDateModified(123456789); + $myDate = new Date\Date('123456789', Date\Date::TIMESTAMP); + $this->assertTrue($myDate->equals($writer->getDateModified())); + } public function testSetDateModifiedUsesZendDateObject() { @@ -283,6 +305,17 @@ public function testSetLastBuildDateUsesGivenUnixTimestamp() $this->assertTrue($myDate->equals($writer->getLastBuildDate())); } + /** + * @group ZF-12023 + */ + public function testSetLastBuildDateUsesGivenUnixTimestampThatIsLessThanTenDigits() + { + $writer = new Writer\Feed; + $writer->setLastBuildDate(123456789); + $myDate = new Date\Date('123456789', Date\Date::TIMESTAMP); + $this->assertTrue($myDate->equals($writer->getLastBuildDate())); + } + public function testSetLastBuildDateUsesZendDateObject() { $writer = new Writer\Feed; From 00fc5c40d31a9ad4743dd049537a227ace92cf65 Mon Sep 17 00:00:00 2001 From: Adam Lundrigan Date: Sat, 25 Feb 2012 17:44:43 -0330 Subject: [PATCH 182/238] [ZF-12070] Fix remaining classes in Zend\Feed\Writer to accept UNIX timestamps which are <>10 digits --- src/Writer/Deleted.php | 2 +- src/Writer/Entry.php | 4 ++-- test/Writer/DeletedTest.php | 13 ++++++++++++- test/Writer/EntryTest.php | 22 ++++++++++++++++++++++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/Writer/Deleted.php b/src/Writer/Deleted.php index dd2a51a4..1d15b690 100644 --- a/src/Writer/Deleted.php +++ b/src/Writer/Deleted.php @@ -131,7 +131,7 @@ public function setWhen($date = null) $zdate = null; if ($date === null) { $zdate = new Date\Date; - } elseif (ctype_digit($date) && strlen($date) == 10) { + } elseif (ctype_digit($date)) { $zdate = new Date\Date($date, Date\Date::TIMESTAMP); } elseif ($date instanceof Date\Date) { $zdate = $date; diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index 318391a0..34b3bf86 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -197,7 +197,7 @@ public function setDateCreated($date = null) $zdate = null; if ($date === null) { $zdate = new Date\Date; - } elseif (ctype_digit($date) && strlen($date) == 10) { + } elseif (ctype_digit($date)) { $zdate = new Date\Date($date, Date\Date::TIMESTAMP); } elseif ($date instanceof Date\Date) { $zdate = $date; @@ -217,7 +217,7 @@ public function setDateModified($date = null) $zdate = null; if ($date === null) { $zdate = new Date\Date; - } elseif (ctype_digit($date) && strlen($date) == 10) { + } elseif (ctype_digit($date)) { $zdate = new Date\Date($date, Date\Date::TIMESTAMP); } elseif ($date instanceof Date\Date) { $zdate = $date; diff --git a/test/Writer/DeletedTest.php b/test/Writer/DeletedTest.php index 7791e0e9..452c2dcd 100644 --- a/test/Writer/DeletedTest.php +++ b/test/Writer/DeletedTest.php @@ -76,7 +76,18 @@ public function testSetWhenUsesGivenUnixTimestamp() $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); $this->assertTrue($myDate->equals($entry->getWhen())); } - + + /** + * @group ZF-12070 + */ + public function testSetWhenUsesGivenUnixTimestampWhenItIsLessThanTenDigits() + { + $entry = new Writer\Deleted; + $entry->setWhen(123456789); + $myDate = new Date\Date('123456789', Date\Date::TIMESTAMP); + $this->assertTrue($myDate->equals($entry->getWhen())); + } + public function testSetWhenUsesZendDateObject() { $entry = new Writer\Deleted; diff --git a/test/Writer/EntryTest.php b/test/Writer/EntryTest.php index 616ca60c..510c494d 100644 --- a/test/Writer/EntryTest.php +++ b/test/Writer/EntryTest.php @@ -266,6 +266,17 @@ public function testSetDateCreatedUsesGivenUnixTimestamp() $this->assertTrue($myDate->equals($entry->getDateCreated())); } + /** + * @group ZF-12070 + */ + public function testSetDateCreatedUsesGivenUnixTimestampWhenItIsLessThanTenDigits() + { + $entry = new Writer\Entry; + $entry->setDateCreated(123456789); + $myDate = new Date\Date('123456789', Date\Date::TIMESTAMP); + $this->assertTrue($myDate->equals($entry->getDateCreated())); + } + public function testSetDateCreatedUsesZendDateObject() { $entry = new Writer\Entry; @@ -290,6 +301,17 @@ public function testSetDateModifiedUsesGivenUnixTimestamp() $this->assertTrue($myDate->equals($entry->getDateModified())); } + /** + * @group ZF-12070 + */ + public function testSetDateModifiedUsesGivenUnixTimestampWhenItIsLessThanTenDigits() + { + $entry = new Writer\Entry; + $entry->setDateModified(123456789); + $myDate = new Date\Date('123456789', Date\Date::TIMESTAMP); + $this->assertTrue($myDate->equals($entry->getDateModified())); + } + public function testSetDateModifiedUsesZendDateObject() { $entry = new Writer\Entry; From b861e1379110936cac9038f468d7864c101a426f Mon Sep 17 00:00:00 2001 From: Robert Basic Date: Sun, 4 Mar 2012 19:15:42 +0100 Subject: [PATCH 183/238] fix prefix for reader extensions --- test/Reader/ReaderTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Reader/ReaderTest.php b/test/Reader/ReaderTest.php index f127cc5b..f70e8d46 100644 --- a/test/Reader/ReaderTest.php +++ b/test/Reader/ReaderTest.php @@ -315,7 +315,7 @@ public function testAddsPrefixPath() public function testRegistersUserExtension() { try { - Reader\Reader::addPrefixPath('My\\FeedReader\\Extension', dirname(__FILE__) . '/_files/My/Extension'); + Reader\Reader::addPrefixPath('My\\Extension', dirname(__FILE__) . '/_files/My/Extension'); Reader\Reader::registerExtension('JungleBooks'); } catch(\Exception $e) { $this->fail($e->getMessage()); From e35eb58869ada90ae6cfa9498b932fc0d0844e98 Mon Sep 17 00:00:00 2001 From: Robert Basic Date: Sun, 4 Mar 2012 20:04:02 +0100 Subject: [PATCH 184/238] update how a http response is created --- test/ReaderTest.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/ReaderTest.php b/test/ReaderTest.php index a8b13f87..79263e49 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -289,8 +289,12 @@ public function testGetsFeedLinksAndNormalisesRelativeUrlsOnUriWithPath() try { $currClient = Reader\Reader::getHttpClient(); + $response = new \Zend\Http\Response; + $response->setContent(''); + $response->setStatusCode(200); + $testAdapter = new \Zend\Http\Client\Adapter\Test(); - $testAdapter->setResponse(new \Zend\Http\Response(200, array(), '')); + $testAdapter->setResponse($response); Reader\Reader::setHttpClient(new \Zend\Http\Client(null, array('adapter' => $testAdapter))); $links = Reader\Reader::findFeedLinks('http://foo/bar'); From 5b4608a1f55a213cbd83e7468f581c18c40af61d Mon Sep 17 00:00:00 2001 From: Robert Basic Date: Sun, 4 Mar 2012 20:06:17 +0100 Subject: [PATCH 185/238] refactor methods to new coding standards --- src/Reader/FeedSet.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index 83155136..5c5f429e 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -65,16 +65,16 @@ public function addLinks(\DOMNodeList $links, $uri) continue; } if (!isset($this->rss) && $link->getAttribute('type') == 'application/rss+xml') { - $this->rss = $this->_absolutiseUri(trim($link->getAttribute('href')), $uri); + $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); + $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->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), + 'href' => $this->absolutiseUri(trim($link->getAttribute('href')), $uri), )); } } @@ -82,7 +82,7 @@ public function addLinks(\DOMNodeList $links, $uri) /** * Attempt to turn a relative URI into an absolute URI */ - protected function _absolutiseUri($link, $uri = null) + protected function absolutiseUri($link, $uri = null) { if (!Uri\UriFactory::factory($link)->isValid()) { if ($uri !== null) { @@ -92,7 +92,7 @@ protected function _absolutiseUri($link, $uri = null) $link = $uri->getPath() . '/' . $link; } - $link = $uri->getScheme() . '://' . $uri->getHost() . '/' . $this->_canonicalizePath($link); + $link = $uri->getScheme() . '://' . $uri->getHost() . '/' . $this->canonicalizePath($link); if (!Uri\UriFactory::factory($link)->isValid()) { $link = null; } @@ -104,7 +104,7 @@ protected function _absolutiseUri($link, $uri = null) /** * Canonicalize relative path */ - protected function _canonicalizePath($path) + protected function canonicalizePath($path) { $parts = array_filter(explode('/', $path)); $absolutes = array(); From 9eccfc0ba27c966b1b60d34f5b9a3846385b82c1 Mon Sep 17 00:00:00 2001 From: Robert Basic Date: Sun, 4 Mar 2012 21:27:26 +0100 Subject: [PATCH 186/238] Uri::isValid will validate a relative URI too, so first make sure it is not an absolute one. no need to absolutise an absolute uri --- src/Reader/FeedSet.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index 5c5f429e..54378d00 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -84,7 +84,8 @@ public function addLinks(\DOMNodeList $links, $uri) */ protected function absolutiseUri($link, $uri = null) { - if (!Uri\UriFactory::factory($link)->isValid()) { + $linkUri = Uri\UriFactory::factory($link); + if (!$linkUri->isAbsolute() or !$linkUri->isValid()) { if ($uri !== null) { $uri = Uri\UriFactory::factory($uri); From 99a0db334498ec0981d430c2f000ed39f84e28ef Mon Sep 17 00:00:00 2001 From: Robert Basic Date: Sun, 4 Mar 2012 23:00:44 +0100 Subject: [PATCH 187/238] fix most of the zend\feed errors due to old zend\db --- src/PubSubHubbub/Model/AbstractModel.php | 6 ++- src/PubSubHubbub/Model/Subscription.php | 8 +-- test/PubSubHubbub/Subscriber/CallbackTest.php | 54 +++++++++---------- test/PubSubHubbub/SubscriberTest.php | 6 +-- 4 files changed, 38 insertions(+), 36 deletions(-) diff --git a/src/PubSubHubbub/Model/AbstractModel.php b/src/PubSubHubbub/Model/AbstractModel.php index 77dbb1be..add51525 100644 --- a/src/PubSubHubbub/Model/AbstractModel.php +++ b/src/PubSubHubbub/Model/AbstractModel.php @@ -23,6 +23,8 @@ */ namespace Zend\Feed\PubSubHubbub\Model; +use \Zend\Db\TableGateway; + /** * @uses \Zend\Db\Table\Table * @uses \Zend\Registry @@ -47,12 +49,12 @@ class AbstractModel * @param \Zend\Db\Table\AbstractTable $tableGateway * @return void */ - public function __construct(\Zend\Db\Table\AbstractTable $tableGateway = null) + public function __construct(TableGateway\TableGatewayInterface $tableGateway = null) { if ($tableGateway === null) { $parts = explode('\\', get_class($this)); $table = strtolower(array_pop($parts)); - $this->_db = new \Zend\Db\Table\Table($table); + $this->_db = new TableGateway\TableGateway($table); } else { $this->_db = $tableGateway; } diff --git a/src/PubSubHubbub/Model/Subscription.php b/src/PubSubHubbub/Model/Subscription.php index e1181dd6..0b3039d7 100644 --- a/src/PubSubHubbub/Model/Subscription.php +++ b/src/PubSubHubbub/Model/Subscription.php @@ -86,9 +86,9 @@ public function getSubscription($key) throw new PubSubHubbub\Exception('Invalid parameter "key"' .' of "' . $key . '" must be a non-empty string'); } - $result = $this->_db->find($key); + $result = $this->_db->select(array('id' => $key)); if (count($result)) { - return $result->current()->toArray(); + return $result->current()->getArrayCopy(); } return false; } @@ -105,7 +105,7 @@ public function hasSubscription($key) throw new PubSubHubbub\Exception('Invalid parameter "key"' .' of "' . $key . '" must be a non-empty string'); } - $result = $this->_db->find($key); + $result = $this->_db->select(array('id' => $key)); if (count($result)) { return true; } @@ -120,7 +120,7 @@ public function hasSubscription($key) */ public function deleteSubscription($key) { - $result = $this->_db->find($key); + $result = $this->_db->select(array('id' => $key)); if (count($result)) { $this->_db->delete( $this->_db->getAdapter()->quoteInto('id = ?', $key) diff --git a/test/PubSubHubbub/Subscriber/CallbackTest.php b/test/PubSubHubbub/Subscriber/CallbackTest.php index 80308e5a..038e7ea7 100644 --- a/test/PubSubHubbub/Subscriber/CallbackTest.php +++ b/test/PubSubHubbub/Subscriber/CallbackTest.php @@ -45,13 +45,13 @@ public function setUp() $this->_callback = new \Zend\Feed\PubSubHubbub\Subscriber\Callback; $this->_adapter = $this->_getCleanMock( - 'Zend\Db\Adapter\AbstractAdapter' + '\Zend\Db\Adapter\Adapter' ); $this->_tableGateway = $this->_getCleanMock( - 'Zend\Db\Table\AbstractTable' + '\Zend\Db\TableGateway\TableGateway' ); $this->_rowset = $this->_getCleanMock( - 'Zend\Db\Table\AbstractRowset' + 'Zend\Db\ResultSet\ResultSet' ); $this->_tableGateway->expects($this->any())->method('getAdapter') @@ -144,7 +144,7 @@ public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntege public function testCanSetStorageImplementation() { - $storage = new Model\Subscription($this->_tableGateway); + $storage = new Model\Subscription($this->_tableGateway); $this->_callback->setStorage($storage); $this->assertThat($this->_callback->getStorage(), $this->identicalTo($storage)); } @@ -154,14 +154,14 @@ public function testCanSetStorageImplementation() */ public function testValidatesValidHttpGetData() { - $mockReturnValue = $this->getMock('Result', array('toArray')); - $mockReturnValue->expects($this->any())->method('toArray')->will($this->returnValue(array( + $mockReturnValue = $this->getMock('Result', array('getArrayCopy')); + $mockReturnValue->expects($this->any())->method('getArrayCopy')->will($this->returnValue(array( 'verify_token' => hash('sha256', 'cba') ))); $this->_tableGateway->expects($this->any()) - ->method('find') - ->with($this->equalTo('verifytokenkey')) + ->method('select') + ->with($this->equalTo(array('id' => 'verifytokenkey'))) ->will($this->returnValue($this->_rowset)); $this->_rowset->expects($this->any()) ->method('current') @@ -205,15 +205,15 @@ public function testReturnsFalseIfVerifyTokenMissingFromHttpGetData() public function testReturnsTrueIfModeSetAsUnsubscribeFromHttpGetData() { - $mockReturnValue = $this->getMock('Result', array('toArray')); - $mockReturnValue->expects($this->any())->method('toArray')->will($this->returnValue(array( + $mockReturnValue = $this->getMock('Result', array('getArrayCopy')); + $mockReturnValue->expects($this->any())->method('getArrayCopy')->will($this->returnValue(array( 'verify_token' => hash('sha256', 'cba') ))); $this->_get['hub_mode'] = 'unsubscribe'; $this->_tableGateway->expects($this->any()) - ->method('find') - ->with($this->equalTo('verifytokenkey')) + ->method('select') + ->with($this->equalTo(array('id' => 'verifytokenkey'))) ->will($this->returnValue($this->_rowset)); $this->_rowset->expects($this->any()) ->method('current') @@ -267,8 +267,8 @@ public function testRespondsToValidConfirmationWith200Response() { $this->_get['hub_mode'] = 'unsubscribe'; $this->_tableGateway->expects($this->any()) - ->method('find') - ->with($this->equalTo('verifytokenkey')) + ->method('select') + ->with($this->equalTo(array('id' => 'verifytokenkey'))) ->will($this->returnValue($this->_rowset)); $t = new Date\Date; @@ -279,7 +279,7 @@ public function testRespondsToValidConfirmationWith200Response() 'lease_seconds' => 10000 ); - $row = new \Zend\Db\Table\Row(array('data' => $rowdata)); + $row = new \Zend\Db\ResultSet\Row($rowdata); $this->_rowset->expects($this->any()) ->method('current') @@ -307,8 +307,8 @@ public function testRespondsToValidConfirmationWith200Response() public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() { $this->_tableGateway->expects($this->any()) - ->method('find') - ->with($this->equalTo('verifytokenkey')) + ->method('select') + ->with($this->equalTo(array('id' => 'verifytokenkey'))) ->will($this->returnValue($this->_rowset)); $t = new Date\Date; @@ -319,7 +319,7 @@ public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() 'lease_seconds' => 10000 ); - $row = new \Zend\Db\Table\Row(array('data' => $rowdata)); + $row = new \Zend\Db\ResultSet\Row($rowdata); $this->_rowset->expects($this->any()) ->method('current') @@ -352,8 +352,8 @@ public function testRespondsToValidFeedUpdateRequestWith200Response() $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; // dirty alternative to php://input $this->_tableGateway->expects($this->any()) - ->method('find') - ->with($this->equalTo('verifytokenkey')) + ->method('select') + ->with($this->equalTo(array('id' => 'verifytokenkey'))) ->will($this->returnValue($this->_rowset)); $t = new Date\Date; @@ -363,7 +363,7 @@ public function testRespondsToValidFeedUpdateRequestWith200Response() 'created_time' => time() ); - $row = new \Zend\Db\Table\Row(array('data' => $rowdata)); + $row = new \Zend\Db\ResultSet\Row(array('data' => $rowdata)); $this->_rowset->expects($this->any()) ->method('current') @@ -415,8 +415,8 @@ public function testRespondsToInvalidFeedUpdateWrongFeedTypeForMimeWith200Respon $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; $this->_tableGateway->expects($this->any()) - ->method('find') - ->with($this->equalTo('verifytokenkey')) + ->method('select') + ->with($this->equalTo(array('id' => 'verifytokenkey'))) ->will($this->returnValue($this->_rowset)); $rowdata = array( @@ -426,7 +426,7 @@ public function testRespondsToInvalidFeedUpdateWrongFeedTypeForMimeWith200Respon 'lease_seconds' => 10000 ); - $row = new \Zend\Db\Table\Row(array('data' => $rowdata)); + $row = new \Zend\Db\ResultSet\Row(array('data' => $rowdata)); $this->_rowset->expects($this->any()) ->method('current') @@ -449,8 +449,8 @@ public function testRespondsToValidFeedUpdateWithXHubOnBehalfOfHeader() $GLOBALS['HTTP_RAW_POST_DATA'] = $feedXml; $this->_tableGateway->expects($this->any()) - ->method('find') - ->with($this->equalTo('verifytokenkey')) + ->method('select') + ->with($this->equalTo(array('id' => 'verifytokenkey'))) ->will($this->returnValue($this->_rowset)); $rowdata = array( @@ -460,7 +460,7 @@ public function testRespondsToValidFeedUpdateWithXHubOnBehalfOfHeader() 'lease_seconds' => 10000 ); - $row = new \Zend\Db\Table\Row(array('data' => $rowdata)); + $row = new \Zend\Db\ResultSet\Row(array('data' => $rowdata)); $this->_rowset->expects($this->any()) ->method('current') diff --git a/test/PubSubHubbub/SubscriberTest.php b/test/PubSubHubbub/SubscriberTest.php index 284bfbb6..484ad86c 100644 --- a/test/PubSubHubbub/SubscriberTest.php +++ b/test/PubSubHubbub/SubscriberTest.php @@ -52,10 +52,10 @@ public function setUp() PubSubHubbub\PubSubHubbub::setHttpClient($client); $this->_subscriber = new \Zend\Feed\PubSubHubbub\Subscriber; $this->_adapter = $this->_getCleanMock( - '\Zend\Db\Adapter\AbstractAdapter' + '\Zend\Db\Adapter\Adapter' ); $this->_tableGateway = $this->_getCleanMock( - '\Zend\Db\Table\AbstractTable' + '\Zend\Db\TableGateway\TableGateway' ); $this->_tableGateway->expects($this->any())->method('getAdapter') ->will($this->returnValue($this->_adapter)); @@ -323,7 +323,7 @@ public function testPreferredVerificationModeDefaultsToSync() public function testCanSetStorageImplementation() { - $storage = new \Zend\Feed\PubSubHubbub\Model\Subscription($this->_tableGateway); + $storage = new \Zend\Feed\PubSubHubbub\Model\Subscription($this->_tableGateway); $this->_subscriber->setStorage($storage); $this->assertThat($this->_subscriber->getStorage(), $this->identicalTo($storage)); } From 65f763779ffc956f6d0052df3463dbacd75d16ea Mon Sep 17 00:00:00 2001 From: Robert Basic Date: Sun, 4 Mar 2012 23:31:36 +0100 Subject: [PATCH 188/238] fix zend\feed errors due to old zend\db usage --- src/PubSubHubbub/Model/Subscription.php | 6 +++--- test/PubSubHubbub/Subscriber/CallbackTest.php | 19 +++++++------------ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/PubSubHubbub/Model/Subscription.php b/src/PubSubHubbub/Model/Subscription.php index 0b3039d7..d0aa6a3d 100644 --- a/src/PubSubHubbub/Model/Subscription.php +++ b/src/PubSubHubbub/Model/Subscription.php @@ -53,7 +53,7 @@ public function setSubscription(array $data) 'ID must be set before attempting a save' ); } - $result = $this->_db->find($data['id']); + $result = $this->_db->select(array('id' => $data['id'])); if ($result && (0 < count($result))) { $data['created_time'] = $result->current()->created_time; $now = new Date\Date; @@ -65,7 +65,7 @@ public function setSubscription(array $data) } $this->_db->update( $data, - $this->_db->getAdapter()->quoteInto('id = ?', $data['id']) + array('id' => $data['id']) ); return false; } @@ -123,7 +123,7 @@ public function deleteSubscription($key) $result = $this->_db->select(array('id' => $key)); if (count($result)) { $this->_db->delete( - $this->_db->getAdapter()->quoteInto('id = ?', $key) + array('id' => $key) ); return true; } diff --git a/test/PubSubHubbub/Subscriber/CallbackTest.php b/test/PubSubHubbub/Subscriber/CallbackTest.php index 038e7ea7..b08e07e7 100644 --- a/test/PubSubHubbub/Subscriber/CallbackTest.php +++ b/test/PubSubHubbub/Subscriber/CallbackTest.php @@ -279,7 +279,8 @@ public function testRespondsToValidConfirmationWith200Response() 'lease_seconds' => 10000 ); - $row = new \Zend\Db\ResultSet\Row($rowdata); + $row = new \Zend\Db\ResultSet\Row; + $row->exchangeArray($rowdata); $this->_rowset->expects($this->any()) ->method('current') @@ -293,12 +294,8 @@ public function testRespondsToValidConfirmationWith200Response() ->method('update') ->with( $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Date\Date::TIMESTAMP),'lease_seconds'=>1234567,'subscription_state'=>'verified','expiration_time'=>$t->add(1234567,Date\Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), - $this->equalTo('id = \'verifytokenkey\'') + $this->equalTo(array('id' => 'verifytokenkey')) ); - $this->_adapter->expects($this->once()) - ->method('quoteInto') - ->with($this->equalTo('id = ?'), $this->equalTo('verifytokenkey')) - ->will($this->returnValue('id = \'verifytokenkey\'')); $this->_callback->handle($this->_get); $this->assertTrue($this->_callback->getHttpResponse()->getHttpResponseCode() == 200); @@ -319,7 +316,8 @@ public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() 'lease_seconds' => 10000 ); - $row = new \Zend\Db\ResultSet\Row($rowdata); + $row = new \Zend\Db\ResultSet\Row; + $row->exchangeArray($rowdata); $this->_rowset->expects($this->any()) ->method('current') @@ -333,12 +331,9 @@ public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() ->method('update') ->with( $this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Date\Date::TIMESTAMP),'lease_seconds'=>1234567,'subscription_state'=>'verified','expiration_time'=>$t->add(1234567,Date\Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))), - $this->equalTo('id = \'verifytokenkey\'') + $this->equalTo(array('id' => 'verifytokenkey')) ); - $this->_adapter->expects($this->once()) - ->method('quoteInto') - ->with($this->equalTo('id = ?'), $this->equalTo('verifytokenkey')) - ->will($this->returnValue('id = \'verifytokenkey\'')); + $this->_callback->handle($this->_get); $this->assertTrue($this->_callback->getHttpResponse()->getBody() == 'abc'); } From 8bb941b0deb0c708e2de90e2c84761ff5cfbef2e Mon Sep 17 00:00:00 2001 From: Robert Basic Date: Mon, 5 Mar 2012 00:33:19 +0100 Subject: [PATCH 189/238] update to new zend\db, test fails tho, need to figure out whats going on --- test/PubSubHubbub/Model/SubscriptionTest.php | 21 ++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/test/PubSubHubbub/Model/SubscriptionTest.php b/test/PubSubHubbub/Model/SubscriptionTest.php index 781ae11e..763a743c 100644 --- a/test/PubSubHubbub/Model/SubscriptionTest.php +++ b/test/PubSubHubbub/Model/SubscriptionTest.php @@ -21,6 +21,8 @@ namespace ZendTest\Feed\PubSubHubbub\Model; use Zend\Feed\PubSubHubbub\Model\Subscription; +use \Zend\Db\Adapter\Adapter as DbAdapter; +use \Zend\Db\TableGateway\TableGateway; /** * @category Zend @@ -38,8 +40,11 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase */ public function testAllOperations() { - $this->_initDb(); - $subscription = new Subscription(); + $adapter = $this->_initDb(); + $table = new TableGateway('subscription', $adapter); + + $subscription = new Subscription($table); + $id = uniqid(); $this->assertFalse($subscription->hasSubscription($id)); $this->assertFalse($subscription->getSubscription($id)); @@ -68,18 +73,18 @@ public function testImpemetsSubscriptionInterface() protected function _initDb() { - $this->markTestSkipped('Skip until not ported to new Zend\Db'); if (!extension_loaded('pdo') || !in_array('sqlite', \PDO::getAvailableDrivers()) ) { $this->markTestSkipped('Test only with pdo_sqlite'); } - $db = \Zend\Db\Db::factory('Pdo\Sqlite', array('dbname' => ':memory:')); - \Zend\Db\Table\AbstractTable::setDefaultAdapter($db); - $this->_createTable(); + $db = new DbAdapter(array('driver' => 'pdo_sqlite', 'dsn' => 'sqlite::memory:')); + $this->_createTable($db); + + return $db; } - protected function _createTable() + protected function _createTable($db) { $sql = "CREATE TABLE subscription (" . "id varchar(32) PRIMARY KEY NOT NULL DEFAULT '', " @@ -93,6 +98,6 @@ protected function _createTable() . "subscription_state varchar(12) DEFAULT NULL" . ");"; - \Zend\Db\Table\AbstractTable::getDefaultAdapter()->getConnection()->query($sql); + $db->query($sql)->execute(); } } From d49dbc202590ca05838ce42ae59ef3f90adeaacd Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Mon, 5 Mar 2012 13:17:42 -0600 Subject: [PATCH 190/238] Mark test as incomplete - Because PDO_SQLite does not return a row count, it means that count($resultSet) always returns 0, which means hasSubscriptions() always returns false, regardless of whether or not there are items in the resultset. Behavior will be added to the drivers at a later date to correct this situation. --- test/PubSubHubbub/Model/SubscriptionTest.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/PubSubHubbub/Model/SubscriptionTest.php b/test/PubSubHubbub/Model/SubscriptionTest.php index 763a743c..adb7c96c 100644 --- a/test/PubSubHubbub/Model/SubscriptionTest.php +++ b/test/PubSubHubbub/Model/SubscriptionTest.php @@ -40,7 +40,9 @@ class SubscriptionTest extends \PHPUnit_Framework_TestCase */ public function testAllOperations() { - $adapter = $this->_initDb(); + $this->markTestIncomplete('PDO_Sqlite does not return row count, and no solution in Zend\Db yet for this'); + + $adapter = $this->initDb(); $table = new TableGateway('subscription', $adapter); $subscription = new Subscription($table); @@ -71,7 +73,7 @@ public function testImpemetsSubscriptionInterface() unset($reflection); } - protected function _initDb() + protected function initDb() { if (!extension_loaded('pdo') || !in_array('sqlite', \PDO::getAvailableDrivers()) @@ -79,12 +81,12 @@ protected function _initDb() $this->markTestSkipped('Test only with pdo_sqlite'); } $db = new DbAdapter(array('driver' => 'pdo_sqlite', 'dsn' => 'sqlite::memory:')); - $this->_createTable($db); + $this->createTable($db); return $db; } - protected function _createTable($db) + protected function createTable($db) { $sql = "CREATE TABLE subscription (" . "id varchar(32) PRIMARY KEY NOT NULL DEFAULT '', " From 38245faf75dee550c933f3961baddbb8b192358a Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Wed, 4 Apr 2012 00:27:17 +0200 Subject: [PATCH 191/238] Adding shell script to run tests It iterates over tested components and runs phpunit for each of them --- .travis/run-tests.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .travis/run-tests.sh diff --git a/.travis/run-tests.sh b/.travis/run-tests.sh new file mode 100644 index 00000000..47d0c4a0 --- /dev/null +++ b/.travis/run-tests.sh @@ -0,0 +1,8 @@ +#!/bin/bash +travisdir=$(dirname $(readlink /proc/$$/fd/255)) +testdir="$travisdir/../tests" +testedcomponents=(`cat "$travisdir/tested-components"`) + +for tested in "${testedcomponents[@]}" + do phpunit -c $testdir/phpunit.xml $testdir/$tested +done From c92974922a549e8edfb80f9dba5c49aa305a9078 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Wed, 4 Apr 2012 00:29:10 +0200 Subject: [PATCH 192/238] Adding script used to configure the test suite --- .travis/TestConfiguration.php | 825 ++++++++++++++++++++++++++++++++++ 1 file changed, 825 insertions(+) create mode 100644 .travis/TestConfiguration.php diff --git a/.travis/TestConfiguration.php b/.travis/TestConfiguration.php new file mode 100644 index 00000000..fd894704 --- /dev/null +++ b/.travis/TestConfiguration.php @@ -0,0 +1,825 @@ + test disabling output buffering in + * dispatcher + */ +defined('TESTS_ZEND_CONTROLLER_DISPATCHER_OB') || define('TESTS_ZEND_CONTROLLER_DISPATCHER_OB', false); + +/** + * Zend_Crypt related constantes + * + * TESTS_ZEND_CRYPT_OPENSSL_CONF => location of an openssl.cnf file for use + * with RSA encryption + */ +defined('TESTS_ZEND_CRYPT_OPENSSL_CONF') || define('TESTS_ZEND_CRYPT_OPENSSL_CONF', false); + +/** + * Zend_Db_Adapter_Pdo_Mysql and Zend_Db_Adapter_Mysqli + * + * There are separate properties to enable tests for the PDO_MYSQL adapter and + * the native Mysqli adapters, but the other properties are shared between the + * two MySQL-related Zend_Db adapters. + */ +defined('TESTS_ZEND_DB_ADAPTER_PDO_MYSQL_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_PDO_MYSQL_ENABLED', false); +defined('TESTS_ZEND_DB_ADAPTER_MYSQLI_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_MYSQLI_ENABLED', false); +defined('TESTS_ZEND_DB_ADAPTER_MYSQL_HOSTNAME') || define('TESTS_ZEND_DB_ADAPTER_MYSQL_HOSTNAME', '127.0.0.1'); +defined('TESTS_ZEND_DB_ADAPTER_MYSQL_USERNAME') || define('TESTS_ZEND_DB_ADAPTER_MYSQL_USERNAME', null); +defined('TESTS_ZEND_DB_ADAPTER_MYSQL_PASSWORD') || define('TESTS_ZEND_DB_ADAPTER_MYSQL_PASSWORD', null); +defined('TESTS_ZEND_DB_ADAPTER_MYSQL_DATABASE') || define('TESTS_ZEND_DB_ADAPTER_MYSQL_DATABASE', 'test'); +defined('TESTS_ZEND_DB_ADAPTER_MYSQL_PORT') || define('TESTS_ZEND_DB_ADAPTER_MYSQL_PORT', 3306); + +/** + * Zend_Db_Adapter_Pdo_Sqlite + * + * Username and password are irrelevant for SQLite. + */ +defined('TESTS_ZEND_DB_ADAPTER_PDO_SQLITE_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_PDO_SQLITE_ENABLED', false); +defined('TESTS_ZEND_DB_ADAPTER_PDO_SQLITE_DATABASE') || define('TESTS_ZEND_DB_ADAPTER_PDO_SQLITE_DATABASE', ':memory:'); + +/** + * Zend_Db_Adapter_Pdo_Mssql + * + * Note that you need to patch your ntwdblib.dll, the one that + * comes with PHP does not work. See user comments at + * http://us2.php.net/manual/en/ref.mssql.php + */ +defined('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_ENABLED', false); +defined('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_HOSTNAME') || define('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_HOSTNAME', '127.0.0.1'); +defined('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_USERNAME') || define('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_USERNAME', null); +defined('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_PASSWORD') || define('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_PASSWORD', null); +defined('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_DATABASE') || define('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_DATABASE', 'test'); + +/** + * Zend_Db_Adapter_Pdo_Pgsql + */ +defined('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_ENABLED', false); +defined('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_HOSTNAME') || define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_HOSTNAME', '127.0.0.1'); +defined('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_USERNAME') || define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_USERNAME', null); +defined('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_PASSWORD') || define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_PASSWORD', null); +defined('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_DATABASE') || define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_DATABASE', 'postgres'); + +/** + * Zend_Db_Adapter_Oracle and Zend_Db_Adapter_Pdo_Oci + * + * There are separate properties to enable tests for the PDO_OCI adapter and + * the native Oracle adapter, but the other properties are shared between the + * two Oracle-related Zend_Db adapters. + */ +defined('TESTS_ZEND_DB_ADAPTER_PDO_OCI_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_PDO_OCI_ENABLED', false); +defined('TESTS_ZEND_DB_ADAPTER_ORACLE_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_ORACLE_ENABLED', false); +defined('TESTS_ZEND_DB_ADAPTER_ORACLE_HOSTNAME') || define('TESTS_ZEND_DB_ADAPTER_ORACLE_HOSTNAME', '127.0.0.1'); +defined('TESTS_ZEND_DB_ADAPTER_ORACLE_USERNAME') || define('TESTS_ZEND_DB_ADAPTER_ORACLE_USERNAME', null); +defined('TESTS_ZEND_DB_ADAPTER_ORACLE_PASSWORD') || define('TESTS_ZEND_DB_ADAPTER_ORACLE_PASSWORD', null); +defined('TESTS_ZEND_DB_ADAPTER_ORACLE_SID') || define('TESTS_ZEND_DB_ADAPTER_ORACLE_SID', 'xe'); + +/** + * Zend_Db_Adapter_Db2 and Zend_Db_Adapter_Pdo_Ibm + * There are separate properties to enable tests for the PDO_IBM adapter and + * the native DB2 adapter, but the other properties are shared between the + * two related Zend_Db adapters. + */ +defined('TESTS_ZEND_DB_ADAPTER_PDO_IBM_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_PDO_IBM_ENABLED', false); +defined('TESTS_ZEND_DB_ADAPTER_DB2_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_DB2_ENABLED', false); +defined('TESTS_ZEND_DB_ADAPTER_DB2_HOSTNAME') || define('TESTS_ZEND_DB_ADAPTER_DB2_HOSTNAME', '127.0.0.1'); +defined('TESTS_ZEND_DB_ADAPTER_DB2_PORT') || define('TESTS_ZEND_DB_ADAPTER_DB2_PORT', 50000); +defined('TESTS_ZEND_DB_ADAPTER_DB2_USERNAME') || define('TESTS_ZEND_DB_ADAPTER_DB2_USERNAME', null); +defined('TESTS_ZEND_DB_ADAPTER_DB2_PASSWORD') || define('TESTS_ZEND_DB_ADAPTER_DB2_PASSWORD', null); +defined('TESTS_ZEND_DB_ADAPTER_DB2_DATABASE') || define('TESTS_ZEND_DB_ADAPTER_DB2_DATABASE', 'sample'); + +/** + * Zend_Db_Adapter_Sqlsrv + * Note: Make sure that you create the "test" database and set a + * username and password + * + */ +defined('TESTS_ZEND_DB_ADAPTER_SQLSRV_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_SQLSRV_ENABLED', false); +defined('TESTS_ZEND_DB_ADAPTER_SQLSRV_HOSTNAME') || define('TESTS_ZEND_DB_ADAPTER_SQLSRV_HOSTNAME', 'localhost\SQLEXPRESS'); +defined('TESTS_ZEND_DB_ADAPTER_SQLSRV_USERNAME') || define('TESTS_ZEND_DB_ADAPTER_SQLSRV_USERNAME', null); +defined('TESTS_ZEND_DB_ADAPTER_SQLSRV_PASSWORD') || define('TESTS_ZEND_DB_ADAPTER_SQLSRV_PASSWORD', null); +defined('TESTS_ZEND_DB_ADAPTER_SQLSRV_DATABASE') || define('TESTS_ZEND_DB_ADAPTER_SQLSRV_DATABASE', 'test'); + +/** + * Zend_Feed_Reader tests + * + * If the ONLINE_ENABLED property is false, only tests that can be executed + * without network connectivity are run; when enabled, all tests will run. + */ +defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') || define('TESTS_ZEND_FEED_READER_ONLINE_ENABLED', false); + +/** + * Zend_Gdata tests + * + * If the ONLINE_ENABLED property is false, only tests that can be executed with + * a mock HTTP client are run. No request is sent to the Google Gdata servers. + * If ONLINE_ENABLED is true, some tests may make requests to the remote + * servers. This does not work if you are running tests on a disconnected + * client host. Also, the tests may show as failures if the Google servers + * cannot be reached or if they do not respond for another reason. + * + * If the CLIENTLOGIN_ENABLED property below is false, the authenticated + * tests are reported Skipped in the test run. Set this property to true + * to enable tests that require ClientLogin authentication. Enter your + * Google login credentials in the EMAIL and PASSWORD properties below. + * + * Edit TestConfiguration.php, not TestConfiguration.php.dist. + * Never commit plaintext passwords to the source code repository. + * + * Note: the GData tests currently require that the TZID env variable + * be set or the timezone otherwise configured. You'll see errors from the + * tests if this is not the case. + */ +defined('TESTS_ZEND_GDATA_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_ONLINE_ENABLED', false); +defined('TESTS_ZEND_GDATA_CLIENTLOGIN_ENABLED') || define('TESTS_ZEND_GDATA_CLIENTLOGIN_ENABLED', false); + +/* + * The credentials provided here should be only for a TEST account. + * Data for various services in this account may be added to, updated, + * or deleted based upon the actions of these test accounts. + */ +defined('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL') || define('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL', 'example@example.com'); +defined('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD') || define('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD', 'password'); + +/* + * This is the ID of a blank blog. There is no need to have + * any content in this blog. Also, blogs can only be used + * several times for the purpose of these test cases before + * they must be deleted and recreated. Otherwise, the tests + * will start failing, as posts to Blogger will return a 201 Created + * response even though the entry was not posted to the blog. + * This problem is being investigated. + */ +defined('TESTS_ZEND_GDATA_BLOGGER_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_BLOGGER_ONLINE_ENABLED', false); +defined('TESTS_ZEND_GDATA_BLOG_ID') || define('TESTS_ZEND_GDATA_BLOG_ID', '1111111111111111111'); + +/* + * This is the key for a spreadsheet with data only in the first row of + * the spreadsheet. The strings 'a1', 'b1', 'c1', 'd1' should be in the + * corresponding cell locations. + */ +defined('TESTS_ZEND_GDATA_SPREADSHEETS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_SPREADSHEETS_ONLINE_ENABLED', false); +defined('TESTS_ZEND_GDATA_SPREADSHEETS_SPREADSHEETKEY') || define('TESTS_ZEND_GDATA_SPREADSHEETS_SPREADSHEETKEY', 'o01111111111111111111.1111111111111111111'); +defined('TESTS_ZEND_GDATA_SPREADSHEETS_WORKSHEETID') || define('TESTS_ZEND_GDATA_SPREADSHEETS_WORKSHEETID', 'default'); + +/* + * This indicates that online tests for the Google Calendar API should + * be performed. The default calendar will be used. + */ +defined('TESTS_ZEND_GDATA_CALENDAR_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_CALENDAR_ONLINE_ENABLED', false); + +/* + * This is the fully-qualified domain name for a domiain hosted using + * Google Apps. This domain must be registered with Google Apps and + * have API access enabled. This should be a TEST domain only. + */ +defined('TESTS_ZEND_GDATA_GAPPS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_GAPPS_ONLINE_ENABLED', false); +defined('TESTS_ZEND_GDATA_GAPPS_DOMAIN') || define('TESTS_ZEND_GDATA_GAPPS_DOMAIN', 'example.com.invalid'); +defined('TESTS_ZEND_GDATA_GAPPS_EMAIL') || define('TESTS_ZEND_GDATA_GAPPS_EMAIL', 'example@example.com'); +defined('TESTS_ZEND_GDATA_GAPPS_PASSWORD') || define('TESTS_ZEND_GDATA_GAPPS_PASSWORD', 'password'); + +/* + * This is the ONLINE_ENABLED property for Google Base. + */ +defined('TESTS_ZEND_GDATA_GBASE_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_GBASE_ONLINE_ENABLED', false); + +/* + * This indicates that online tests for the Books Search data API + * should be performed. + */ +defined('TESTS_ZEND_GDATA_BOOKS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_BOOKS_ONLINE_ENABLED', false); + +/* + * This indicates that online tests for the YouTube data API should + * be performed. + */ +defined('TESTS_ZEND_GDATA_YOUTUBE_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_YOUTUBE_ONLINE_ENABLED', false); + +/* + * This is the username to use for retrieving subscriptions, etc + */ +defined('TESTS_ZEND_GDATA_YOUTUBE_ACCOUNT') || define('TESTS_ZEND_GDATA_YOUTUBE_ACCOUNT', 'zfgdata'); + +/* + * This is the developer key to access the YouTube API + */ +defined('TESTS_ZEND_GDATA_YOUTUBE_DEVELOPER_KEY') || define('TESTS_ZEND_GDATA_YOUTUBE_DEVELOPER_KEY', 'your_developer_key_here'); + +/* + * This is the client ID to access the YouTube API + */ +defined('TESTS_ZEND_GDATA_YOUTUBE_CLIENT_ID') || define('TESTS_ZEND_GDATA_YOUTUBE_CLIENT_ID', 'ZF_UnitTests_unknown'); + +/* + * This indicates that online tests for the Google Documents API should + * be performed. + */ +defined('TESTS_ZEND_GDATA_DOCS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_DOCS_ONLINE_ENABLED', false); + +/* + * This indicates that online tests for the GData Photos API should + * be performed. + */ +defined('TESTS_ZEND_GDATA_PHOTOS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_PHOTOS_ONLINE_ENABLED', false); + +/* + * This indicates that online tests for the Google Health API should + * be performed. + */ +defined('TESTS_ZEND_GDATA_HEALTH_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_HEALTH_ONLINE_ENABLED', false); + +/** + * Zend_Http_Client tests + * + * To enable the dynamic Zend_Http_Client tests, you will need to symbolically + * link or copy the files in tests/Zend/Http/Client/_files to a directory + * under your web server(s) document root and set this constant to point to the + * URL of this directory. + */ +defined('TESTS_ZEND_HTTP_CLIENT_BASEURI') || define('TESTS_ZEND_HTTP_CLIENT_BASEURI', false); + +/** + * Zend_Http_Client_Proxy tests + * + * HTTP proxy to be used for testing the Proxy adapter. Set to a string of + * the form 'host:port'. Set to null to skip HTTP proxy tests. + */ +defined('TESTS_ZEND_HTTP_CLIENT_HTTP_PROXY') || define('TESTS_ZEND_HTTP_CLIENT_HTTP_PROXY', false); +defined('TESTS_ZEND_HTTP_CLIENT_HTTP_PROXY_USER') || define('TESTS_ZEND_HTTP_CLIENT_HTTP_PROXY_USER', ''); +defined('TESTS_ZEND_HTTP_CLIENT_HTTP_PROXY_PASS') || define('TESTS_ZEND_HTTP_CLIENT_HTTP_PROXY_PASS', ''); + +/** + * Zend_Loader_Autoloader multi-version support tests + * + * ENABLED: whether or not to run the multi-version tests + * PATH: path to a directory containing multiple ZF version installs + * LATEST: most recent ZF version in the PATH + * e.g., "1.9.2" + * LATEST_MAJOR: most recent ZF major version in the PATH to test against + * e.g., "1.9.2" + * LATEST_MINOR: most recent ZF minor version in the PATH to test against + * e.g., "1.8.4PL1" + * SPECIFIC: specific ZF version in the PATH to test against + * e.g., "1.7.6" + * As an example, consider the following tree: + * ZendFramework/ + * |-- 1.9.2 + * |-- ZendFramework-1.9.1-minimal + * |-- 1.8.4PL1 + * |-- 1.8.4 + * |-- ZendFramework-1.8.3 + * |-- 1.7.8 + * |-- 1.7.7 + * |-- 1.7.6 + * You would then set the value of "LATEST" and "LATEST_MAJOR" to "1.9.2", and + * could choose between "1.9.2", "1.8.4PL1", and "1.7.8" for "LATEST_MINOR", + * and any version number for "SPECIFIC". "PATH" would point to the parent + * "ZendFramework" directory. + */ +defined('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_ENABLED') || define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_ENABLED', false); +defined('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_PATH') || define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_PATH', false); +defined('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST') || define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST', false); +defined('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST_MAJOR') || define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST_MAJOR', false); +defined('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST_MINOR') || define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST_MINOR', false); +defined('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_SPECIFIC') || define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_SPECIFIC', false); + +/** + * Zend_Ldap online tests + */ +defined('TESTS_ZEND_LDAP_ONLINE_ENABLED') || define('TESTS_ZEND_LDAP_ONLINE_ENABLED', false); + +/* These largely map to the options described in the Zend_Ldap and + * Zend_Auth_Adapter_Ldap documentation. + * + * Example Configuration for Active Directory: + * HOST: dc1.w.net + * USE_START_TLS: true + * USE_SSL: false + * USERNAME: CN=User 1,CN=Users,DC=w,DC=net + * PRINCIPAL_NAME: user1@w.net + * LDAP_PASSWORD: pass1 + * BASE_DN: CN=Users,DC=w,DC=net + * DOMAIN_NAME: w.net + * ACCOUNT_DOMAIN_NAME_SHORT: W + * ALT_USERNAME: user2 + * ALT_DN: CN=User 2,CN=Users,DC=w,DC=net + * ALT_PASSWORD: pass2 + * + * Example Configuration for OpenLDAP + * HOST: s0.foo.net + * USERNAME: CN=user1,DC=foo,DC=net + * PRINCIPAL_NAME: user1@foo.net + * LDAP_PASSWORD: pass1 + * BIND_REQUIRES_DN: true + * BASE_DN: OU=Sales,DC=w,DC=net + * DOMAIN_NAME: foo.net + * ACCOUNT_DOMAIN_NAME_SHORT: FOO + * ALT_USERNAME: abaker + * ALT_DN: CN=Alice Baker,OU=Sales,DC=foo,DC=net + * ALT_PASSWORD: apass + */ +defined('TESTS_ZEND_LDAP_HOST') || define('TESTS_ZEND_LDAP_HOST', 'localhost'); +//defined('TESTS_ZEND_LDAP_PORT') || define('TESTS_ZEND_LDAP_PORT', 389); +defined('TESTS_ZEND_LDAP_USE_START_TLS') || define('TESTS_ZEND_LDAP_USE_START_TLS', true); +//defined('TESTS_ZEND_LDAP_USE_SSL') || define('TESTS_ZEND_LDAP_USE_SSL', false); +defined('TESTS_ZEND_LDAP_USERNAME') || define('TESTS_ZEND_LDAP_USERNAME', 'CN=someUser,DC=example,DC=com'); +defined('TESTS_ZEND_LDAP_PRINCIPAL_NAME') || define('TESTS_ZEND_LDAP_PRINCIPAL_NAME', 'someUser@example.com'); +defined('TESTS_ZEND_LDAP_PASSWORD') || define('TESTS_ZEND_LDAP_PASSWORD', null); +defined('TESTS_ZEND_LDAP_BIND_REQUIRES_DN') || define('TESTS_ZEND_LDAP_BIND_REQUIRES_DN', true); +defined('TESTS_ZEND_LDAP_BASE_DN') || define('TESTS_ZEND_LDAP_BASE_DN', 'OU=Sales,DC=example,DC=com'); +//defined('TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT') || define('TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT', '(&(objectClass=posixAccount)(uid=%s))'); +defined('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME') || define('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME', 'example.com'); +defined('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT') || define('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT', 'EXAMPLE'); +defined('TESTS_ZEND_LDAP_ALT_USERNAME') || define('TESTS_ZEND_LDAP_ALT_USERNAME', 'anotherUser'); +defined('TESTS_ZEND_LDAP_ALT_DN') || define('TESTS_ZEND_LDAP_ALT_DN', 'CN=Another User,OU=Sales,DC=example,DC=com'); +defined('TESTS_ZEND_LDAP_ALT_PASSWORD') || define('TESTS_ZEND_LDAP_ALT_PASSWORD', null); // Used in Zend_Auth_Adapter_Ldap tests +//(defined('TESTS_ZEND_LDAP_WRITEABLE_SUBTREE') || define('TESTS_ZEND_LDAP_WRITEABLE_SUBTREE', 'OU=Test,OU=Sales,DC=example,DC=com'); + +/** + * Zend_Locale tests + * + * If the TESTS_ZEND_LOCALE_FORMAT_SETLOCALE property below is a valid, + * locally recognized locale (try "locale -a"), then all tests in + * tests/Zend/Locale/ test suites will execute *after* + * setlocale(LC_ALL, TESTS_ZEND_LOCALE_FORMAT_SETLOCALE); + * Primarily, this switches certain PHP functions to emit "localized" output, + * including the built-in "to string" for integer and float conversions. + * Thus, a locale of 'fr_FR' yields number-to-string conversions in a + * localized form with the decimal place separator chosen via: + * setlocale(LC_ALL, 'fr_FR@euro'); + */ +//define('TESTS_ZEND_LOCALE_FORMAT_SETLOCALE', 'fr'); +//define('TESTS_ZEND_LOCALE_FORMAT_SETLOCALE', 'fr_FR@euro'); +defined('TESTS_ZEND_LOCALE_FORMAT_SETLOCALE') || define('TESTS_ZEND_LOCALE_FORMAT_SETLOCALE', false); + +/** + * Zend_Date tests + * + * If the BCMATH_ENABLED property below is false, all arithmetic + * operations will use ordinary PHP math operators and functions. + * Otherwise, the bcmath functions will be used for unlimited precision. + * + * If the EXTENDED_COVERAGE property below is false, most of the I18N + * unit tests will not be computed... this speeds tests up to 80 minutes + * when doing reports. * + * Edit TestConfiguration.php, not TestConfiguration.php.dist. + */ +defined('TESTS_ZEND_LOCALE_BCMATH_ENABLED') || define('TESTS_ZEND_LOCALE_BCMATH_ENABLED', true); +defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || define('TESTS_ZEND_I18N_EXTENDED_COVERAGE', true); + +/** + * Zend_Mail_Storage tests + * + * TESTS_ZEND_MAIL_SERVER_TESTDIR and TESTS_ZEND_MAIL_SERVER_FORMAT are used for POP3 and IMAP tests. + * TESTS_ZEND_MAIL_SERVER_FORMAT is the format your test mail server uses: 'mbox' or 'maildir'. The mail + * storage for the user specified in your POP3 or IMAP tests should be TESTS_ZEND_MAIL_SERVER_TESTDIR. Be + * careful: it's cleared before copying the files. If you want to copy the files manually set the dir + * to null (or anything == null). + * + * TESTS_ZEND_MAIL_TEMPDIR is used for testing write operations in local storages. If not set (== null) + * tempnam() is used. + */ +defined('TESTS_ZEND_MAIL_SERVER_TESTDIR') || define('TESTS_ZEND_MAIL_SERVER_TESTDIR', null); +defined('TESTS_ZEND_MAIL_SERVER_FORMAT') || define('TESTS_ZEND_MAIL_SERVER_FORMAT', 'mbox'); +defined('TESTS_ZEND_MAIL_TEMPDIR') || define('TESTS_ZEND_MAIL_TEMPDIR', null); + +/** + * Zend_Mail_Storage_Pop3 / Zend_Mail_Transport_Pop3 + * + * IMPORTANT: you need to copy tests/Zend/Mail/_files/test.mbox to your mail + * if you haven't set TESTS_ZEND_MAIL_SERVER_TESTDIR + */ +defined('TESTS_ZEND_MAIL_POP3_ENABLED') || define('TESTS_ZEND_MAIL_POP3_ENABLED', false); +defined('TESTS_ZEND_MAIL_POP3_HOST') || define('TESTS_ZEND_MAIL_POP3_HOST', 'localhost'); +defined('TESTS_ZEND_MAIL_POP3_USER') || define('TESTS_ZEND_MAIL_POP3_USER', 'test'); +defined('TESTS_ZEND_MAIL_POP3_PASSWORD') || define('TESTS_ZEND_MAIL_POP3_PASSWORD', ''); +// test SSL connections if enabled in your test server +defined('TESTS_ZEND_MAIL_POP3_SSL') || define('TESTS_ZEND_MAIL_POP3_SSL', true); +defined('TESTS_ZEND_MAIL_POP3_TLS') || define('TESTS_ZEND_MAIL_POP3_TLS', true); +// WRONG_PORT should be an existing server port, +// INVALID_PORT should be a non existing (each on defined host) +defined('TESTS_ZEND_MAIL_POP3_WRONG_PORT') || define('TESTS_ZEND_MAIL_POP3_WRONG_PORT', 80); +defined('TESTS_ZEND_MAIL_POP3_INVALID_PORT') || define('TESTS_ZEND_MAIL_POP3_INVALID_PORT', 3141); + +/** + * Zend_Mail_Storage_Imap / Zend_Mail_Transport_Imap + * + * IMPORTANT: you need to copy tests/Zend/Mail/_files/test.mbox to your mail + * if you haven't set TESTS_ZEND_MAIL_SERVER_TESTDIR + */ +defined('TESTS_ZEND_MAIL_IMAP_ENABLED') || define('TESTS_ZEND_MAIL_IMAP_ENABLED', false); +defined('TESTS_ZEND_MAIL_IMAP_HOST') || define('TESTS_ZEND_MAIL_IMAP_HOST', 'localhost'); +defined('TESTS_ZEND_MAIL_IMAP_USER') || define('TESTS_ZEND_MAIL_IMAP_USER', 'test'); +defined('TESTS_ZEND_MAIL_IMAP_PASSWORD') || define('TESTS_ZEND_MAIL_IMAP_PASSWORD', ''); +// test SSL connections if enabled in your test server +defined('TESTS_ZEND_MAIL_IMAP_SSL') || define('TESTS_ZEND_MAIL_IMAP_SSL', true); +defined('TESTS_ZEND_MAIL_IMAP_TLS') || define('TESTS_ZEND_MAIL_IMAP_TLS', true); +// WRONG_PORT should be an existing server port, +// INVALID_PORT should be a non-existing (each on defined host) +defined('TESTS_ZEND_MAIL_IMAP_WRONG_PORT') || define('TESTS_ZEND_MAIL_IMAP_WRONG_PORT', 80); +defined('TESTS_ZEND_MAIL_IMAP_INVALID_PORT') || define('TESTS_ZEND_MAIL_IMAP_INVALID_PORT', 3141); + + +/** + * Zend_Mail_Storage_Maildir test + * + * Before enabling this test you have to unpack messages.tar in + * Zend/Mail/_files/test.maildir/cur/ and remove the tar for this test to work. + * That's because the messages files have a colon in the filename and that's a + * forbidden character on Windows. + */ +defined('TESTS_ZEND_MAIL_MAILDIR_ENABLED') || define('TESTS_ZEND_MAIL_MAILDIR_ENABLED', false); + +/** + * Zend_Mail_Transport_Smtp + * + * @todo TO be implemented + */ +defined('TESTS_ZEND_MAIL_SMTP_ENABLED') || define('TESTS_ZEND_MAIL_SMTP_ENABLED', false); +defined('TESTS_ZEND_MAIL_SMTP_HOST') || define('TESTS_ZEND_MAIL_SMTP_HOST', 'localhost'); +defined('TESTS_ZEND_MAIL_SMTP_PORT') || define('TESTS_ZEND_MAIL_SMTP_PORT', 25); +defined('TESTS_ZEND_MAIL_SMTP_USER') || define('TESTS_ZEND_MAIL_SMTP_USER', 'testuser'); +defined('TESTS_ZEND_MAIL_SMTP_PASSWORD') || define('TESTS_ZEND_MAIL_SMTP_PASSWORD', 'testpassword'); +defined('TESTS_ZEND_MAIL_SMTP_AUTH') || define('TESTS_ZEND_MAIL_SMTP_AUTH', false); +// AUTH can be set to false or a string of AUTH method (e.g. LOGIN, PLAIN, CRAMMD5 or DIGESTMD5) + +/** + * Zend_Queue Test Configuration constants + * + * The Zend_Queue_Adapter_Db constant should be a JSON-encoded string + * representing a configuration object for Zend_Db::factory(). For example: + * { + * type: "pdo_mysql", + * host: "127.0.0.1", + * port: 3306, + * username: "queue", + * password: "queue", + * dbname: "queue" + * } + * + * The PlatformJobQueue adapter expects two parameters, the host and password. + * The HOST string should include both the host and port (typically 10003): + * 127.0.0.1:10003 + * When running tests against PlatformJobQueue, it's best to do so where + * Platform is installed on localhost and has maximum workers set to 20 + * (default is 5); do so with this zend.ini setting: + * zend_jq.max_num_of_request_workers=20 + * + * Selectively define the below in order to run tests for them. + */ +defined('TESTS_ZEND_QUEUE_ACTIVEMQ_ENABLED') || define('TESTS_ZEND_QUEUE_ACTIVEMQ_ENABLED', false); +defined('TESTS_ZEND_QUEUE_ACTIVEMQ_SCHEME') || define('TESTS_ZEND_QUEUE_ACTIVEMQ_SCHEME', false); +defined('TESTS_ZEND_QUEUE_ACTIVEMQ_HOST') || define('TESTS_ZEND_QUEUE_ACTIVEMQ_HOST', false); +defined('TESTS_ZEND_QUEUE_ACTIVEMQ_PORT') || define('TESTS_ZEND_QUEUE_ACTIVEMQ_PORT', false); +defined('TESTS_ZEND_QUEUE_DB_ENABLED') || define('TESTS_ZEND_QUEUE_DB_ENABLED', false); +defined('TESTS_ZEND_QUEUE_DB') || define('TESTS_ZEND_QUEUE_DB', false); +defined('TESTS_ZEND_QUEUE_MEMCACHEQ_ENABLED') || define('TESTS_ZEND_QUEUE_MEMCACHEQ_ENABLED', false); +defined('TESTS_ZEND_QUEUE_MEMCACHEQ_HOST') || define('TESTS_ZEND_QUEUE_MEMCACHEQ_HOST', false); +defined('TESTS_ZEND_QUEUE_MEMCACHEQ_PORT') || define('TESTS_ZEND_QUEUE_MEMCACHEQ_PORT', false); +defined('TESTS_ZEND_QUEUE_PLATFORMJQ_ENABLED') || define('TESTS_ZEND_QUEUE_PLATFORMJQ_ENABLED', false); +defined('TESTS_ZEND_QUEUE_PLATFORMJQ_HOST') || define('TESTS_ZEND_QUEUE_PLATFORMJQ_HOST', false); +defined('TESTS_ZEND_QUEUE_PLATFORMJQ_PASS') || define('TESTS_ZEND_QUEUE_PLATFORMJQ_PASS', false); + + +/** + * Zend\Service\AgileZen online tests + */ +define('TESTS_ZEND_SERVICE_AGILEZEN_ONLINE_ENABLED',false); +define('TESTS_ZEND_SERVICE_AGILEZEN_ONLINE_APIKEY','insert the API key'); +define('TESTS_ZEND_SERVICE_AGILEZEN_ONLINE_PROJECT_ID','insert the project id'); +define('TESTS_ZEND_SERVICE_AGILEZEN_ONLINE_STORY_ID','insert the story id'); +define('TESTS_ZEND_SERVICE_AGILEZEN_ONLINE_INVITE_EMAIL','insert email for invitation'); +define('TESTS_ZEND_SERVICE_AGILEZEN_ONLINE_INVITE_ROLE_ID','insert role id for invitation'); +define('TESTS_ZEND_SERVICE_AGILEZEN_ONLINE_MEMBER_NAME','insert the member name to add to the project'); + + +/** + * Zend_Service_Amazon online tests + */ +defined('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ENABLED') || define('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ENABLED', false); +defined('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ACCESSKEYID') || define('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ACCESSKEYID', 'Enter AWSAccessKeyId here'); +defined('TESTS_ZEND_SERVICE_AMAZON_ONLINE_SECRETKEY') || define('TESTS_ZEND_SERVICE_AMAZON_ONLINE_SECRETKEY', 'Enter AWSSecretKey here'); +defined('TESTS_ZEND_SERVICE_AMAZON_EC2_IMAGE_ID') || define('TESTS_ZEND_SERVICE_AMAZON_EC2_IMAGE_ID', 'zftestamazonimageid'); +defined('TESTS_ZEND_SERVICE_AMAZON_EC2_ZONE') || define('TESTS_ZEND_SERVICE_AMAZON_EC2_ZONE', 'us-east-1'); +defined('TESTS_ZEND_SERVICE_AMAZON_EC2_SECURITY_GROUP') || define('TESTS_ZEND_SERVICE_AMAZON_EC2_SECURITY_GROUP', 'default'); +defined('TESTS_ZEND_SERVICE_AMAZON_S3_BUCKET') || define('TESTS_ZEND_SERVICE_AMAZON_S3_BUCKET', 'zftestamazons3bucket'); +defined('TESTS_ZEND_SERVICE_AMAZON_SQS_QUEUE') || define('TESTS_ZEND_SERVICE_AMAZON_SQS_QUEUE', 'zftestamazonsqsqueuename'); + +/** + * Zend_Service_Delicious tests + */ +defined('TESTS_ZEND_SERVICE_DELICIOUS_ENABLED') || define('TESTS_ZEND_SERVICE_DELICIOUS_ENABLED', false); + +/** + * Zend_Service_DeveloperGarden tests + * Setup your Username and Password to test this Service + */ +defined('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_ENABLED') || define('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_ENABLED', false); +defined('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_LOGIN') || define('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_LOGIN', 'ZF_Username'); +defined('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_PASSWORD') || define('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_PASSWORD', 'ZF_Password'); + +/** + * Zend_Service_Flickr online tests + */ +defined('TESTS_ZEND_SERVICE_FLICKR_ONLINE_ENABLED') || define('TESTS_ZEND_SERVICE_FLICKR_ONLINE_ENABLED', false); +defined('TESTS_ZEND_SERVICE_FLICKR_ONLINE_APIKEY') || define('TESTS_ZEND_SERVICE_FLICKR_ONLINE_APIKEY', 'Enter API key here'); + +/** + * Zend_Service_GoGrid offline tests + */ + +defined('TESTS_ZEND_SERVICE_GOGRID_ONLINE_ENABLED') || define('TESTS_ZEND_SERVICE_GOGRID_ONLINE_ENABLED', false); +defined('TESTS_ZEND_SERVICE_GOGRID_ONLINE_KEY') || define('TESTS_ZEND_SERVICE_GOGRID_ONLINE_KEY','insert key here'); +defined('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SECRET') || define('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SECRET','insert secret here'); +defined('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SERVER_NAME') || define('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SERVER_NAME','test-zf'); +defined('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SERVER_IMAGE') || define('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SERVER_IMAGE','insert image name here'); +defined('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SERVER_RAM') || define('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SERVER_RAM','insert ram name here'); +defined('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SERVER_IP') || define('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SERVER_IP','insert ip here'); + +/** + * Zend\Service\LiveDocx configuration + * + * Define username and password in order to run unit tests for LiveDocx web services. + * + * phpunit/phpunit will typically work. + */ +defined('TESTS_ZEND_SERVICE_LIVEDOCX_USERNAME') || define('TESTS_ZEND_SERVICE_LIVEDOCX_USERNAME', false); +defined('TESTS_ZEND_SERVICE_LIVEDOCX_PASSWORD') || define('TESTS_ZEND_SERVICE_LIVEDOCX_PASSWORD', false); + +/** + * Zend\Service\LiveDocx premium configuration + * + * Define username, password, WSDL in order to run unit tests for premium LiveDocx web services. + */ +defined('TESTS_ZEND_SERVICE_LIVEDOCX_PREMIUM_USERNAME') || define('TESTS_ZEND_SERVICE_LIVEDOCX_PREMIUM_USERNAME', false); +defined('TESTS_ZEND_SERVICE_LIVEDOCX_PREMIUM_PASSWORD') || define('TESTS_ZEND_SERVICE_LIVEDOCX_PREMIUM_PASSWORD', false); +defined('TESTS_ZEND_SERVICE_LIVEDOCX_PREMIUM_WSDL') || define('TESTS_ZEND_SERVICE_LIVEDOCX_PREMIUM_WSDL', false); + +/** + * Zend_Service_Rackspace tests + */ +defined('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_ENABLED') || define('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_ENABLED', false); +defined('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_USER') || define('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_USER', 'Enter key here'); +defined('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_KEY') || define('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_KEY', 'Enter secret here'); +defined('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_REGION') || define('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_REGION', 'USA'); +defined('TESTS_ZEND_SERVICE_RACKSPACE_CONTAINER_NAME') || define('TESTS_ZEND_SERVICE_RACKSPACE_CONTAINER_NAME', 'zf-unit-test'); +defined('TESTS_ZEND_SERVICE_RACKSPACE_OBJECT_NAME') || define('TESTS_ZEND_SERVICE_RACKSPACE_OBJECT_NAME','zf-object-test'); +defined('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_NAME') || define('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_NAME', 'zf-unit-test'); +defined('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_IMAGEID') || define('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_IMAGEID', '49'); +defined('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_NEW_IMAGEID') || define('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_NEW_IMAGEID', '49'); +defined('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_FLAVORID') || define('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_FLAVORID', '1'); +defined('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_IMAGE_NAME') || define('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_IMAGE_NAME', 'ZFunitTestImage'); +defined('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_SHARED_IP_GROUP_NAME') || define('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_SHARED_IP_GROUP_NAME', 'ZFgroupIP'); +defined('TESTS_ZEND_SERVICE_RACKSPACE_TIMEOUT') || define('TESTS_ZEND_SERVICE_RACKSPACE_TIMEOUT', 60); + +/** + * Zend_Service_ReCaptcha tests + */ +defined('TESTS_ZEND_SERVICE_RECAPTCHA_ENABLED') || define('TESTS_ZEND_SERVICE_RECAPTCHA_ENABLED', false); +defined('TESTS_ZEND_SERVICE_RECAPTCHA_ONLINE_ENABLED') || define('TESTS_ZEND_SERVICE_RECAPTCHA_ONLINE_ENABLED', false); +defined('TESTS_ZEND_SERVICE_RECAPTCHA_PUBLIC_KEY') || define('TESTS_ZEND_SERVICE_RECAPTCHA_PUBLIC_KEY', 'public key'); +defined('TESTS_ZEND_SERVICE_RECAPTCHA_PRIVATE_KEY') || define('TESTS_ZEND_SERVICE_RECAPTCHA_PRIVATE_KEY', 'private key'); +defined('TESTS_ZEND_SERVICE_RECAPTCHA_MAILHIDE_PUBLIC_KEY') || define('TESTS_ZEND_SERVICE_RECAPTCHA_MAILHIDE_PUBLIC_KEY', 'public mailhide key'); +defined('TESTS_ZEND_SERVICE_RECAPTCHA_MAILHIDE_PRIVATE_KEY') || define('TESTS_ZEND_SERVICE_RECAPTCHA_MAILHIDE_PRIVATE_KEY', 'private mailhide key'); + +/** + * Zend_Service_Simpy tests + */ +defined('TESTS_ZEND_SERVICE_SIMPY_ENABLED') || define('TESTS_ZEND_SERVICE_SIMPY_ENABLED', false); +defined('TESTS_ZEND_SERVICE_SIMPY_USERNAME') || define('TESTS_ZEND_SERVICE_SIMPY_USERNAME', 'syapizend'); +defined('TESTS_ZEND_SERVICE_SIMPY_PASSWORD') || define('TESTS_ZEND_SERVICE_SIMPY_PASSWORD', 'mgt37ge'); + +/** + * Zend_Service_SlideShare tests + */ +defined('TESTS_ZEND_SERVICE_SLIDESHARE_USERNAME') || define('TESTS_ZEND_SERVICE_SLIDESHARE_USERNAME', ''); +defined('TESTS_ZEND_SERVICE_SLIDESHARE_PASSWORD') || define('TESTS_ZEND_SERVICE_SLIDESHARE_PASSWORD', ''); +defined('TESTS_ZEND_SERVICE_SLIDESHARE_SHAREDSECRET') || define('TESTS_ZEND_SERVICE_SLIDESHARE_SHAREDSECRET', ''); +defined('TESTS_ZEND_SERVICE_SLIDESHARE_APIKEY') || define('TESTS_ZEND_SERVICE_SLIDESHARE_APIKEY', ''); + +// The slide show ID to retrieve during tests +defined('TESTS_ZEND_SERVICE_SLIDESHARE_SLIDESHOWID') || define('TESTS_ZEND_SERVICE_SLIDESHARE_SLIDESHOWID', 0); + +// The tag to retrieve during tests +defined('TESTS_ZEND_SERVICE_SLIDESHARE_TAG') || define('TESTS_ZEND_SERVICE_SLIDESHARE_TAG', 'zend'); + +// The group to retrieve during tests +defined('TESTS_ZEND_SERVICE_SLIDESHARE_GROUP') || define('TESTS_ZEND_SERVICE_SLIDESHARE_GROUP', ''); + +/** + * Zend_Service_Twitter tests + * + * ONLINE_ENABLED indicates whether or not to run tests requiring a network + * connection. + * + * TWITTER_USER and TWITTER_PASS are valid Twitter credentials you wish to use + * when testing. + */ +defined('TESTS_ZEND_SERVICE_TWITTER_ONLINE_ENABLED') || define('TESTS_ZEND_SERVICE_TWITTER_ONLINE_ENABLED', false); +defined('TESTS_ZEND_SERVICE_TWITTER_USER') || define('TESTS_ZEND_SERVICE_TWITTER_USER', 'zftestuser'); +defined('TESTS_ZEND_SERVICE_TWITTER_PASS') || define('TESTS_ZEND_SERVICE_TWITTER_PASS', 'zftestuser'); + +/** + * Zend_Service_WindowsAzure tests + */ + +/** + * Online + */ + +define('TESTS_ZEND_SERVICE_WINDOWSAZURE_ONLINE_ACCOUNTNAME',''); +define('TESTS_ZEND_SERVICE_WINDOWSAZURE_ONLINE_ACCOUNTKEY',''); +define('TESTS_ZEND_SERVICE_WINDOWSAZURE_ONLINE_TABLE_HOST',''); +define('TESTS_ZEND_SERVICE_WINDOWSAZURE_ONLINE_STORAGE_PROXY_HOST',''); +define('TESTS_ZEND_SERVICE_WINDOWSAZURE_ONLINE_STORAGE_PROXY_PORT',''); +define('TESTS_ZEND_SERVICE_WINDOWSAZURE_ONLINE_STORAGE_PROXY_CREDENTIALS',''); + +/** + * Proxy settings + */ +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_USEPROXY') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_USEPROXY', false); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY', ''); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_PORT') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_PORT', '8080'); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_CREDENTIALS') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_CREDENTIALS', ''); + +/** + * Azure hosts + */ +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_HOST_DEV') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_HOST_DEV', '127.0.0.1:10000'); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_HOST_DEV') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_HOST_DEV', '127.0.0.1:10001'); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_HOST_DEV') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_HOST_DEV', '127.0.0.1:10002'); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_HOST_PROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_HOST_PROD', 'blob.core.windows.net'); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_HOST_PROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_HOST_PROD', 'queue.core.windows.net'); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_HOST_PROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_HOST_PROD', 'table.core.windows.net'); + +/** + * Credentials + */ +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_ACCOUNT_DEV') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_ACCOUNT_DEV', 'devstoreaccount1'); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_KEY_DEV') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_KEY_DEV', 'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=='); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_ACCOUNT_PROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_ACCOUNT_PROD', 'phpazure'); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_KEY_PROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_KEY_PROD', 'I+ebYPcIDB6BsmfAe6pJSpOw8oXA6jMBZv1BEZcSPRqTpldt44refCl65YpKJqcBOiD21Lxsj8d6Ah8Oc2/gKA=='); + +/** + * Blob storage tests + */ +// Enable this tests only when you have a working account +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_RUNTESTS') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_RUNTESTS', false); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_RUNONPROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_RUNONPROD', false); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_RUNLARGEBLOB') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_RUNLARGEBLOB', true); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_CONTAINER_PREFIX') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_CONTAINER_PREFIX', 'phpazuretestblob'); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOBSTREAM_CONTAINER_PREFIX') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOBSTREAM_CONTAINER_PREFIX', 'phpazureteststream'); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOBSA_CONTAINER_PREFIX') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOBSA_CONTAINER_PREFIX', 'phpazuretestshared'); + +/** + * Table storage tests + */ +// Enable this tests only when you have a working account +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_RUNTESTS') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_RUNTESTS', false); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_RUNONPROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_RUNONPROD', false); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_TABLENAME_PREFIX') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_TABLENAME_PREFIX', 'phpazuretesttable'); + +/** + * Queue storage tests + */ +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS', false); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNONPROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNONPROD', false); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_PREFIX') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_PREFIX', 'phpazuretestqueue'); + +/** + * SessionHandler tests + */ +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNTESTS') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNTESTS', false); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNONPROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNONPROD', false); +defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_TABLENAME_PREFIX') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_TABLENAME_PREFIX', 'phpazuretestsession'); + +/** + * Zend_Service_Yahoo online tests + */ +defined('TESTS_ZEND_SERVICE_YAHOO_ONLINE_ENABLED') || define('TESTS_ZEND_SERVICE_YAHOO_ONLINE_ENABLED', false); +defined('TESTS_ZEND_SERVICE_YAHOO_ONLINE_APPID') || define('TESTS_ZEND_SERVICE_YAHOO_ONLINE_APPID', 'Enter APPID here'); + +/** + * Zend_Soap_AutoDiscover scenario tests for complex objects and wsdl generation + * + * Copy all the files of zf/tests/Zend/Soap/_files/fulltests into a directory + * that can be reached by webserver and enter the base uri to this directory + * into the variable. The test "Zend_Soap_AutoDiscover_OnlineTest" makes use + * of the servers and AutoDiscover feature. + * + * NOTE: Make sure the servers are using the correct Zend Framework copy, + * when having more than one version installed and include paths are changing. + */ +defined('TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI') || define('TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI', false); + +/** + * Zend_Uri tests + * + * Setting CRASH_TEST_ENABLED to true will enable some tests that may + * potentially crash PHP on some systems, due to very deep-nesting regular + * expressions. + * + * Only do this if you know what you are doing! + */ +defined('TESTS_ZEND_URI_CRASH_TEST_ENABLED') || define('TESTS_ZEND_URI_CRASH_TEST_ENABLED', false); + +/** + * Zend_Validate tests + * + * Set ONLINE_ENABLED if you wish to run validators that require network + * connectivity. + */ +defined('TESTS_ZEND_VALIDATE_ONLINE_ENABLED') || define('TESTS_ZEND_VALIDATE_ONLINE_ENABLED', false); + +/** + * PHPUnit Code Coverage / Test Report + */ +defined('TESTS_GENERATE_REPORT') || define('TESTS_GENERATE_REPORT', false); +defined('TESTS_GENERATE_REPORT_TARGET') || define('TESTS_GENERATE_REPORT_TARGET', '/path/to/target'); + From 11a72b57653531114a93063a6b02419bdc91b392 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Wed, 4 Apr 2012 00:32:21 +0200 Subject: [PATCH 193/238] Making the run-tests.sh script executable --- .travis/run-tests.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .travis/run-tests.sh diff --git a/.travis/run-tests.sh b/.travis/run-tests.sh old mode 100644 new mode 100755 From 6629cda1b84113c0e473a950425168edc9a09c15 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Wed, 4 Apr 2012 20:56:26 +0200 Subject: [PATCH 194/238] Moving travis test configuration This way it is more obvious to the committer changing test configuration that also travis config should be changed --- .travis/TestConfiguration.php | 825 ---------------------------------- 1 file changed, 825 deletions(-) delete mode 100644 .travis/TestConfiguration.php diff --git a/.travis/TestConfiguration.php b/.travis/TestConfiguration.php deleted file mode 100644 index fd894704..00000000 --- a/.travis/TestConfiguration.php +++ /dev/null @@ -1,825 +0,0 @@ - test disabling output buffering in - * dispatcher - */ -defined('TESTS_ZEND_CONTROLLER_DISPATCHER_OB') || define('TESTS_ZEND_CONTROLLER_DISPATCHER_OB', false); - -/** - * Zend_Crypt related constantes - * - * TESTS_ZEND_CRYPT_OPENSSL_CONF => location of an openssl.cnf file for use - * with RSA encryption - */ -defined('TESTS_ZEND_CRYPT_OPENSSL_CONF') || define('TESTS_ZEND_CRYPT_OPENSSL_CONF', false); - -/** - * Zend_Db_Adapter_Pdo_Mysql and Zend_Db_Adapter_Mysqli - * - * There are separate properties to enable tests for the PDO_MYSQL adapter and - * the native Mysqli adapters, but the other properties are shared between the - * two MySQL-related Zend_Db adapters. - */ -defined('TESTS_ZEND_DB_ADAPTER_PDO_MYSQL_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_PDO_MYSQL_ENABLED', false); -defined('TESTS_ZEND_DB_ADAPTER_MYSQLI_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_MYSQLI_ENABLED', false); -defined('TESTS_ZEND_DB_ADAPTER_MYSQL_HOSTNAME') || define('TESTS_ZEND_DB_ADAPTER_MYSQL_HOSTNAME', '127.0.0.1'); -defined('TESTS_ZEND_DB_ADAPTER_MYSQL_USERNAME') || define('TESTS_ZEND_DB_ADAPTER_MYSQL_USERNAME', null); -defined('TESTS_ZEND_DB_ADAPTER_MYSQL_PASSWORD') || define('TESTS_ZEND_DB_ADAPTER_MYSQL_PASSWORD', null); -defined('TESTS_ZEND_DB_ADAPTER_MYSQL_DATABASE') || define('TESTS_ZEND_DB_ADAPTER_MYSQL_DATABASE', 'test'); -defined('TESTS_ZEND_DB_ADAPTER_MYSQL_PORT') || define('TESTS_ZEND_DB_ADAPTER_MYSQL_PORT', 3306); - -/** - * Zend_Db_Adapter_Pdo_Sqlite - * - * Username and password are irrelevant for SQLite. - */ -defined('TESTS_ZEND_DB_ADAPTER_PDO_SQLITE_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_PDO_SQLITE_ENABLED', false); -defined('TESTS_ZEND_DB_ADAPTER_PDO_SQLITE_DATABASE') || define('TESTS_ZEND_DB_ADAPTER_PDO_SQLITE_DATABASE', ':memory:'); - -/** - * Zend_Db_Adapter_Pdo_Mssql - * - * Note that you need to patch your ntwdblib.dll, the one that - * comes with PHP does not work. See user comments at - * http://us2.php.net/manual/en/ref.mssql.php - */ -defined('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_ENABLED', false); -defined('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_HOSTNAME') || define('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_HOSTNAME', '127.0.0.1'); -defined('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_USERNAME') || define('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_USERNAME', null); -defined('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_PASSWORD') || define('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_PASSWORD', null); -defined('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_DATABASE') || define('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_DATABASE', 'test'); - -/** - * Zend_Db_Adapter_Pdo_Pgsql - */ -defined('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_ENABLED', false); -defined('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_HOSTNAME') || define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_HOSTNAME', '127.0.0.1'); -defined('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_USERNAME') || define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_USERNAME', null); -defined('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_PASSWORD') || define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_PASSWORD', null); -defined('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_DATABASE') || define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_DATABASE', 'postgres'); - -/** - * Zend_Db_Adapter_Oracle and Zend_Db_Adapter_Pdo_Oci - * - * There are separate properties to enable tests for the PDO_OCI adapter and - * the native Oracle adapter, but the other properties are shared between the - * two Oracle-related Zend_Db adapters. - */ -defined('TESTS_ZEND_DB_ADAPTER_PDO_OCI_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_PDO_OCI_ENABLED', false); -defined('TESTS_ZEND_DB_ADAPTER_ORACLE_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_ORACLE_ENABLED', false); -defined('TESTS_ZEND_DB_ADAPTER_ORACLE_HOSTNAME') || define('TESTS_ZEND_DB_ADAPTER_ORACLE_HOSTNAME', '127.0.0.1'); -defined('TESTS_ZEND_DB_ADAPTER_ORACLE_USERNAME') || define('TESTS_ZEND_DB_ADAPTER_ORACLE_USERNAME', null); -defined('TESTS_ZEND_DB_ADAPTER_ORACLE_PASSWORD') || define('TESTS_ZEND_DB_ADAPTER_ORACLE_PASSWORD', null); -defined('TESTS_ZEND_DB_ADAPTER_ORACLE_SID') || define('TESTS_ZEND_DB_ADAPTER_ORACLE_SID', 'xe'); - -/** - * Zend_Db_Adapter_Db2 and Zend_Db_Adapter_Pdo_Ibm - * There are separate properties to enable tests for the PDO_IBM adapter and - * the native DB2 adapter, but the other properties are shared between the - * two related Zend_Db adapters. - */ -defined('TESTS_ZEND_DB_ADAPTER_PDO_IBM_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_PDO_IBM_ENABLED', false); -defined('TESTS_ZEND_DB_ADAPTER_DB2_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_DB2_ENABLED', false); -defined('TESTS_ZEND_DB_ADAPTER_DB2_HOSTNAME') || define('TESTS_ZEND_DB_ADAPTER_DB2_HOSTNAME', '127.0.0.1'); -defined('TESTS_ZEND_DB_ADAPTER_DB2_PORT') || define('TESTS_ZEND_DB_ADAPTER_DB2_PORT', 50000); -defined('TESTS_ZEND_DB_ADAPTER_DB2_USERNAME') || define('TESTS_ZEND_DB_ADAPTER_DB2_USERNAME', null); -defined('TESTS_ZEND_DB_ADAPTER_DB2_PASSWORD') || define('TESTS_ZEND_DB_ADAPTER_DB2_PASSWORD', null); -defined('TESTS_ZEND_DB_ADAPTER_DB2_DATABASE') || define('TESTS_ZEND_DB_ADAPTER_DB2_DATABASE', 'sample'); - -/** - * Zend_Db_Adapter_Sqlsrv - * Note: Make sure that you create the "test" database and set a - * username and password - * - */ -defined('TESTS_ZEND_DB_ADAPTER_SQLSRV_ENABLED') || define('TESTS_ZEND_DB_ADAPTER_SQLSRV_ENABLED', false); -defined('TESTS_ZEND_DB_ADAPTER_SQLSRV_HOSTNAME') || define('TESTS_ZEND_DB_ADAPTER_SQLSRV_HOSTNAME', 'localhost\SQLEXPRESS'); -defined('TESTS_ZEND_DB_ADAPTER_SQLSRV_USERNAME') || define('TESTS_ZEND_DB_ADAPTER_SQLSRV_USERNAME', null); -defined('TESTS_ZEND_DB_ADAPTER_SQLSRV_PASSWORD') || define('TESTS_ZEND_DB_ADAPTER_SQLSRV_PASSWORD', null); -defined('TESTS_ZEND_DB_ADAPTER_SQLSRV_DATABASE') || define('TESTS_ZEND_DB_ADAPTER_SQLSRV_DATABASE', 'test'); - -/** - * Zend_Feed_Reader tests - * - * If the ONLINE_ENABLED property is false, only tests that can be executed - * without network connectivity are run; when enabled, all tests will run. - */ -defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') || define('TESTS_ZEND_FEED_READER_ONLINE_ENABLED', false); - -/** - * Zend_Gdata tests - * - * If the ONLINE_ENABLED property is false, only tests that can be executed with - * a mock HTTP client are run. No request is sent to the Google Gdata servers. - * If ONLINE_ENABLED is true, some tests may make requests to the remote - * servers. This does not work if you are running tests on a disconnected - * client host. Also, the tests may show as failures if the Google servers - * cannot be reached or if they do not respond for another reason. - * - * If the CLIENTLOGIN_ENABLED property below is false, the authenticated - * tests are reported Skipped in the test run. Set this property to true - * to enable tests that require ClientLogin authentication. Enter your - * Google login credentials in the EMAIL and PASSWORD properties below. - * - * Edit TestConfiguration.php, not TestConfiguration.php.dist. - * Never commit plaintext passwords to the source code repository. - * - * Note: the GData tests currently require that the TZID env variable - * be set or the timezone otherwise configured. You'll see errors from the - * tests if this is not the case. - */ -defined('TESTS_ZEND_GDATA_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_ONLINE_ENABLED', false); -defined('TESTS_ZEND_GDATA_CLIENTLOGIN_ENABLED') || define('TESTS_ZEND_GDATA_CLIENTLOGIN_ENABLED', false); - -/* - * The credentials provided here should be only for a TEST account. - * Data for various services in this account may be added to, updated, - * or deleted based upon the actions of these test accounts. - */ -defined('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL') || define('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL', 'example@example.com'); -defined('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD') || define('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD', 'password'); - -/* - * This is the ID of a blank blog. There is no need to have - * any content in this blog. Also, blogs can only be used - * several times for the purpose of these test cases before - * they must be deleted and recreated. Otherwise, the tests - * will start failing, as posts to Blogger will return a 201 Created - * response even though the entry was not posted to the blog. - * This problem is being investigated. - */ -defined('TESTS_ZEND_GDATA_BLOGGER_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_BLOGGER_ONLINE_ENABLED', false); -defined('TESTS_ZEND_GDATA_BLOG_ID') || define('TESTS_ZEND_GDATA_BLOG_ID', '1111111111111111111'); - -/* - * This is the key for a spreadsheet with data only in the first row of - * the spreadsheet. The strings 'a1', 'b1', 'c1', 'd1' should be in the - * corresponding cell locations. - */ -defined('TESTS_ZEND_GDATA_SPREADSHEETS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_SPREADSHEETS_ONLINE_ENABLED', false); -defined('TESTS_ZEND_GDATA_SPREADSHEETS_SPREADSHEETKEY') || define('TESTS_ZEND_GDATA_SPREADSHEETS_SPREADSHEETKEY', 'o01111111111111111111.1111111111111111111'); -defined('TESTS_ZEND_GDATA_SPREADSHEETS_WORKSHEETID') || define('TESTS_ZEND_GDATA_SPREADSHEETS_WORKSHEETID', 'default'); - -/* - * This indicates that online tests for the Google Calendar API should - * be performed. The default calendar will be used. - */ -defined('TESTS_ZEND_GDATA_CALENDAR_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_CALENDAR_ONLINE_ENABLED', false); - -/* - * This is the fully-qualified domain name for a domiain hosted using - * Google Apps. This domain must be registered with Google Apps and - * have API access enabled. This should be a TEST domain only. - */ -defined('TESTS_ZEND_GDATA_GAPPS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_GAPPS_ONLINE_ENABLED', false); -defined('TESTS_ZEND_GDATA_GAPPS_DOMAIN') || define('TESTS_ZEND_GDATA_GAPPS_DOMAIN', 'example.com.invalid'); -defined('TESTS_ZEND_GDATA_GAPPS_EMAIL') || define('TESTS_ZEND_GDATA_GAPPS_EMAIL', 'example@example.com'); -defined('TESTS_ZEND_GDATA_GAPPS_PASSWORD') || define('TESTS_ZEND_GDATA_GAPPS_PASSWORD', 'password'); - -/* - * This is the ONLINE_ENABLED property for Google Base. - */ -defined('TESTS_ZEND_GDATA_GBASE_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_GBASE_ONLINE_ENABLED', false); - -/* - * This indicates that online tests for the Books Search data API - * should be performed. - */ -defined('TESTS_ZEND_GDATA_BOOKS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_BOOKS_ONLINE_ENABLED', false); - -/* - * This indicates that online tests for the YouTube data API should - * be performed. - */ -defined('TESTS_ZEND_GDATA_YOUTUBE_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_YOUTUBE_ONLINE_ENABLED', false); - -/* - * This is the username to use for retrieving subscriptions, etc - */ -defined('TESTS_ZEND_GDATA_YOUTUBE_ACCOUNT') || define('TESTS_ZEND_GDATA_YOUTUBE_ACCOUNT', 'zfgdata'); - -/* - * This is the developer key to access the YouTube API - */ -defined('TESTS_ZEND_GDATA_YOUTUBE_DEVELOPER_KEY') || define('TESTS_ZEND_GDATA_YOUTUBE_DEVELOPER_KEY', 'your_developer_key_here'); - -/* - * This is the client ID to access the YouTube API - */ -defined('TESTS_ZEND_GDATA_YOUTUBE_CLIENT_ID') || define('TESTS_ZEND_GDATA_YOUTUBE_CLIENT_ID', 'ZF_UnitTests_unknown'); - -/* - * This indicates that online tests for the Google Documents API should - * be performed. - */ -defined('TESTS_ZEND_GDATA_DOCS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_DOCS_ONLINE_ENABLED', false); - -/* - * This indicates that online tests for the GData Photos API should - * be performed. - */ -defined('TESTS_ZEND_GDATA_PHOTOS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_PHOTOS_ONLINE_ENABLED', false); - -/* - * This indicates that online tests for the Google Health API should - * be performed. - */ -defined('TESTS_ZEND_GDATA_HEALTH_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_HEALTH_ONLINE_ENABLED', false); - -/** - * Zend_Http_Client tests - * - * To enable the dynamic Zend_Http_Client tests, you will need to symbolically - * link or copy the files in tests/Zend/Http/Client/_files to a directory - * under your web server(s) document root and set this constant to point to the - * URL of this directory. - */ -defined('TESTS_ZEND_HTTP_CLIENT_BASEURI') || define('TESTS_ZEND_HTTP_CLIENT_BASEURI', false); - -/** - * Zend_Http_Client_Proxy tests - * - * HTTP proxy to be used for testing the Proxy adapter. Set to a string of - * the form 'host:port'. Set to null to skip HTTP proxy tests. - */ -defined('TESTS_ZEND_HTTP_CLIENT_HTTP_PROXY') || define('TESTS_ZEND_HTTP_CLIENT_HTTP_PROXY', false); -defined('TESTS_ZEND_HTTP_CLIENT_HTTP_PROXY_USER') || define('TESTS_ZEND_HTTP_CLIENT_HTTP_PROXY_USER', ''); -defined('TESTS_ZEND_HTTP_CLIENT_HTTP_PROXY_PASS') || define('TESTS_ZEND_HTTP_CLIENT_HTTP_PROXY_PASS', ''); - -/** - * Zend_Loader_Autoloader multi-version support tests - * - * ENABLED: whether or not to run the multi-version tests - * PATH: path to a directory containing multiple ZF version installs - * LATEST: most recent ZF version in the PATH - * e.g., "1.9.2" - * LATEST_MAJOR: most recent ZF major version in the PATH to test against - * e.g., "1.9.2" - * LATEST_MINOR: most recent ZF minor version in the PATH to test against - * e.g., "1.8.4PL1" - * SPECIFIC: specific ZF version in the PATH to test against - * e.g., "1.7.6" - * As an example, consider the following tree: - * ZendFramework/ - * |-- 1.9.2 - * |-- ZendFramework-1.9.1-minimal - * |-- 1.8.4PL1 - * |-- 1.8.4 - * |-- ZendFramework-1.8.3 - * |-- 1.7.8 - * |-- 1.7.7 - * |-- 1.7.6 - * You would then set the value of "LATEST" and "LATEST_MAJOR" to "1.9.2", and - * could choose between "1.9.2", "1.8.4PL1", and "1.7.8" for "LATEST_MINOR", - * and any version number for "SPECIFIC". "PATH" would point to the parent - * "ZendFramework" directory. - */ -defined('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_ENABLED') || define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_ENABLED', false); -defined('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_PATH') || define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_PATH', false); -defined('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST') || define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST', false); -defined('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST_MAJOR') || define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST_MAJOR', false); -defined('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST_MINOR') || define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST_MINOR', false); -defined('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_SPECIFIC') || define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_SPECIFIC', false); - -/** - * Zend_Ldap online tests - */ -defined('TESTS_ZEND_LDAP_ONLINE_ENABLED') || define('TESTS_ZEND_LDAP_ONLINE_ENABLED', false); - -/* These largely map to the options described in the Zend_Ldap and - * Zend_Auth_Adapter_Ldap documentation. - * - * Example Configuration for Active Directory: - * HOST: dc1.w.net - * USE_START_TLS: true - * USE_SSL: false - * USERNAME: CN=User 1,CN=Users,DC=w,DC=net - * PRINCIPAL_NAME: user1@w.net - * LDAP_PASSWORD: pass1 - * BASE_DN: CN=Users,DC=w,DC=net - * DOMAIN_NAME: w.net - * ACCOUNT_DOMAIN_NAME_SHORT: W - * ALT_USERNAME: user2 - * ALT_DN: CN=User 2,CN=Users,DC=w,DC=net - * ALT_PASSWORD: pass2 - * - * Example Configuration for OpenLDAP - * HOST: s0.foo.net - * USERNAME: CN=user1,DC=foo,DC=net - * PRINCIPAL_NAME: user1@foo.net - * LDAP_PASSWORD: pass1 - * BIND_REQUIRES_DN: true - * BASE_DN: OU=Sales,DC=w,DC=net - * DOMAIN_NAME: foo.net - * ACCOUNT_DOMAIN_NAME_SHORT: FOO - * ALT_USERNAME: abaker - * ALT_DN: CN=Alice Baker,OU=Sales,DC=foo,DC=net - * ALT_PASSWORD: apass - */ -defined('TESTS_ZEND_LDAP_HOST') || define('TESTS_ZEND_LDAP_HOST', 'localhost'); -//defined('TESTS_ZEND_LDAP_PORT') || define('TESTS_ZEND_LDAP_PORT', 389); -defined('TESTS_ZEND_LDAP_USE_START_TLS') || define('TESTS_ZEND_LDAP_USE_START_TLS', true); -//defined('TESTS_ZEND_LDAP_USE_SSL') || define('TESTS_ZEND_LDAP_USE_SSL', false); -defined('TESTS_ZEND_LDAP_USERNAME') || define('TESTS_ZEND_LDAP_USERNAME', 'CN=someUser,DC=example,DC=com'); -defined('TESTS_ZEND_LDAP_PRINCIPAL_NAME') || define('TESTS_ZEND_LDAP_PRINCIPAL_NAME', 'someUser@example.com'); -defined('TESTS_ZEND_LDAP_PASSWORD') || define('TESTS_ZEND_LDAP_PASSWORD', null); -defined('TESTS_ZEND_LDAP_BIND_REQUIRES_DN') || define('TESTS_ZEND_LDAP_BIND_REQUIRES_DN', true); -defined('TESTS_ZEND_LDAP_BASE_DN') || define('TESTS_ZEND_LDAP_BASE_DN', 'OU=Sales,DC=example,DC=com'); -//defined('TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT') || define('TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT', '(&(objectClass=posixAccount)(uid=%s))'); -defined('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME') || define('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME', 'example.com'); -defined('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT') || define('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT', 'EXAMPLE'); -defined('TESTS_ZEND_LDAP_ALT_USERNAME') || define('TESTS_ZEND_LDAP_ALT_USERNAME', 'anotherUser'); -defined('TESTS_ZEND_LDAP_ALT_DN') || define('TESTS_ZEND_LDAP_ALT_DN', 'CN=Another User,OU=Sales,DC=example,DC=com'); -defined('TESTS_ZEND_LDAP_ALT_PASSWORD') || define('TESTS_ZEND_LDAP_ALT_PASSWORD', null); // Used in Zend_Auth_Adapter_Ldap tests -//(defined('TESTS_ZEND_LDAP_WRITEABLE_SUBTREE') || define('TESTS_ZEND_LDAP_WRITEABLE_SUBTREE', 'OU=Test,OU=Sales,DC=example,DC=com'); - -/** - * Zend_Locale tests - * - * If the TESTS_ZEND_LOCALE_FORMAT_SETLOCALE property below is a valid, - * locally recognized locale (try "locale -a"), then all tests in - * tests/Zend/Locale/ test suites will execute *after* - * setlocale(LC_ALL, TESTS_ZEND_LOCALE_FORMAT_SETLOCALE); - * Primarily, this switches certain PHP functions to emit "localized" output, - * including the built-in "to string" for integer and float conversions. - * Thus, a locale of 'fr_FR' yields number-to-string conversions in a - * localized form with the decimal place separator chosen via: - * setlocale(LC_ALL, 'fr_FR@euro'); - */ -//define('TESTS_ZEND_LOCALE_FORMAT_SETLOCALE', 'fr'); -//define('TESTS_ZEND_LOCALE_FORMAT_SETLOCALE', 'fr_FR@euro'); -defined('TESTS_ZEND_LOCALE_FORMAT_SETLOCALE') || define('TESTS_ZEND_LOCALE_FORMAT_SETLOCALE', false); - -/** - * Zend_Date tests - * - * If the BCMATH_ENABLED property below is false, all arithmetic - * operations will use ordinary PHP math operators and functions. - * Otherwise, the bcmath functions will be used for unlimited precision. - * - * If the EXTENDED_COVERAGE property below is false, most of the I18N - * unit tests will not be computed... this speeds tests up to 80 minutes - * when doing reports. * - * Edit TestConfiguration.php, not TestConfiguration.php.dist. - */ -defined('TESTS_ZEND_LOCALE_BCMATH_ENABLED') || define('TESTS_ZEND_LOCALE_BCMATH_ENABLED', true); -defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || define('TESTS_ZEND_I18N_EXTENDED_COVERAGE', true); - -/** - * Zend_Mail_Storage tests - * - * TESTS_ZEND_MAIL_SERVER_TESTDIR and TESTS_ZEND_MAIL_SERVER_FORMAT are used for POP3 and IMAP tests. - * TESTS_ZEND_MAIL_SERVER_FORMAT is the format your test mail server uses: 'mbox' or 'maildir'. The mail - * storage for the user specified in your POP3 or IMAP tests should be TESTS_ZEND_MAIL_SERVER_TESTDIR. Be - * careful: it's cleared before copying the files. If you want to copy the files manually set the dir - * to null (or anything == null). - * - * TESTS_ZEND_MAIL_TEMPDIR is used for testing write operations in local storages. If not set (== null) - * tempnam() is used. - */ -defined('TESTS_ZEND_MAIL_SERVER_TESTDIR') || define('TESTS_ZEND_MAIL_SERVER_TESTDIR', null); -defined('TESTS_ZEND_MAIL_SERVER_FORMAT') || define('TESTS_ZEND_MAIL_SERVER_FORMAT', 'mbox'); -defined('TESTS_ZEND_MAIL_TEMPDIR') || define('TESTS_ZEND_MAIL_TEMPDIR', null); - -/** - * Zend_Mail_Storage_Pop3 / Zend_Mail_Transport_Pop3 - * - * IMPORTANT: you need to copy tests/Zend/Mail/_files/test.mbox to your mail - * if you haven't set TESTS_ZEND_MAIL_SERVER_TESTDIR - */ -defined('TESTS_ZEND_MAIL_POP3_ENABLED') || define('TESTS_ZEND_MAIL_POP3_ENABLED', false); -defined('TESTS_ZEND_MAIL_POP3_HOST') || define('TESTS_ZEND_MAIL_POP3_HOST', 'localhost'); -defined('TESTS_ZEND_MAIL_POP3_USER') || define('TESTS_ZEND_MAIL_POP3_USER', 'test'); -defined('TESTS_ZEND_MAIL_POP3_PASSWORD') || define('TESTS_ZEND_MAIL_POP3_PASSWORD', ''); -// test SSL connections if enabled in your test server -defined('TESTS_ZEND_MAIL_POP3_SSL') || define('TESTS_ZEND_MAIL_POP3_SSL', true); -defined('TESTS_ZEND_MAIL_POP3_TLS') || define('TESTS_ZEND_MAIL_POP3_TLS', true); -// WRONG_PORT should be an existing server port, -// INVALID_PORT should be a non existing (each on defined host) -defined('TESTS_ZEND_MAIL_POP3_WRONG_PORT') || define('TESTS_ZEND_MAIL_POP3_WRONG_PORT', 80); -defined('TESTS_ZEND_MAIL_POP3_INVALID_PORT') || define('TESTS_ZEND_MAIL_POP3_INVALID_PORT', 3141); - -/** - * Zend_Mail_Storage_Imap / Zend_Mail_Transport_Imap - * - * IMPORTANT: you need to copy tests/Zend/Mail/_files/test.mbox to your mail - * if you haven't set TESTS_ZEND_MAIL_SERVER_TESTDIR - */ -defined('TESTS_ZEND_MAIL_IMAP_ENABLED') || define('TESTS_ZEND_MAIL_IMAP_ENABLED', false); -defined('TESTS_ZEND_MAIL_IMAP_HOST') || define('TESTS_ZEND_MAIL_IMAP_HOST', 'localhost'); -defined('TESTS_ZEND_MAIL_IMAP_USER') || define('TESTS_ZEND_MAIL_IMAP_USER', 'test'); -defined('TESTS_ZEND_MAIL_IMAP_PASSWORD') || define('TESTS_ZEND_MAIL_IMAP_PASSWORD', ''); -// test SSL connections if enabled in your test server -defined('TESTS_ZEND_MAIL_IMAP_SSL') || define('TESTS_ZEND_MAIL_IMAP_SSL', true); -defined('TESTS_ZEND_MAIL_IMAP_TLS') || define('TESTS_ZEND_MAIL_IMAP_TLS', true); -// WRONG_PORT should be an existing server port, -// INVALID_PORT should be a non-existing (each on defined host) -defined('TESTS_ZEND_MAIL_IMAP_WRONG_PORT') || define('TESTS_ZEND_MAIL_IMAP_WRONG_PORT', 80); -defined('TESTS_ZEND_MAIL_IMAP_INVALID_PORT') || define('TESTS_ZEND_MAIL_IMAP_INVALID_PORT', 3141); - - -/** - * Zend_Mail_Storage_Maildir test - * - * Before enabling this test you have to unpack messages.tar in - * Zend/Mail/_files/test.maildir/cur/ and remove the tar for this test to work. - * That's because the messages files have a colon in the filename and that's a - * forbidden character on Windows. - */ -defined('TESTS_ZEND_MAIL_MAILDIR_ENABLED') || define('TESTS_ZEND_MAIL_MAILDIR_ENABLED', false); - -/** - * Zend_Mail_Transport_Smtp - * - * @todo TO be implemented - */ -defined('TESTS_ZEND_MAIL_SMTP_ENABLED') || define('TESTS_ZEND_MAIL_SMTP_ENABLED', false); -defined('TESTS_ZEND_MAIL_SMTP_HOST') || define('TESTS_ZEND_MAIL_SMTP_HOST', 'localhost'); -defined('TESTS_ZEND_MAIL_SMTP_PORT') || define('TESTS_ZEND_MAIL_SMTP_PORT', 25); -defined('TESTS_ZEND_MAIL_SMTP_USER') || define('TESTS_ZEND_MAIL_SMTP_USER', 'testuser'); -defined('TESTS_ZEND_MAIL_SMTP_PASSWORD') || define('TESTS_ZEND_MAIL_SMTP_PASSWORD', 'testpassword'); -defined('TESTS_ZEND_MAIL_SMTP_AUTH') || define('TESTS_ZEND_MAIL_SMTP_AUTH', false); -// AUTH can be set to false or a string of AUTH method (e.g. LOGIN, PLAIN, CRAMMD5 or DIGESTMD5) - -/** - * Zend_Queue Test Configuration constants - * - * The Zend_Queue_Adapter_Db constant should be a JSON-encoded string - * representing a configuration object for Zend_Db::factory(). For example: - * { - * type: "pdo_mysql", - * host: "127.0.0.1", - * port: 3306, - * username: "queue", - * password: "queue", - * dbname: "queue" - * } - * - * The PlatformJobQueue adapter expects two parameters, the host and password. - * The HOST string should include both the host and port (typically 10003): - * 127.0.0.1:10003 - * When running tests against PlatformJobQueue, it's best to do so where - * Platform is installed on localhost and has maximum workers set to 20 - * (default is 5); do so with this zend.ini setting: - * zend_jq.max_num_of_request_workers=20 - * - * Selectively define the below in order to run tests for them. - */ -defined('TESTS_ZEND_QUEUE_ACTIVEMQ_ENABLED') || define('TESTS_ZEND_QUEUE_ACTIVEMQ_ENABLED', false); -defined('TESTS_ZEND_QUEUE_ACTIVEMQ_SCHEME') || define('TESTS_ZEND_QUEUE_ACTIVEMQ_SCHEME', false); -defined('TESTS_ZEND_QUEUE_ACTIVEMQ_HOST') || define('TESTS_ZEND_QUEUE_ACTIVEMQ_HOST', false); -defined('TESTS_ZEND_QUEUE_ACTIVEMQ_PORT') || define('TESTS_ZEND_QUEUE_ACTIVEMQ_PORT', false); -defined('TESTS_ZEND_QUEUE_DB_ENABLED') || define('TESTS_ZEND_QUEUE_DB_ENABLED', false); -defined('TESTS_ZEND_QUEUE_DB') || define('TESTS_ZEND_QUEUE_DB', false); -defined('TESTS_ZEND_QUEUE_MEMCACHEQ_ENABLED') || define('TESTS_ZEND_QUEUE_MEMCACHEQ_ENABLED', false); -defined('TESTS_ZEND_QUEUE_MEMCACHEQ_HOST') || define('TESTS_ZEND_QUEUE_MEMCACHEQ_HOST', false); -defined('TESTS_ZEND_QUEUE_MEMCACHEQ_PORT') || define('TESTS_ZEND_QUEUE_MEMCACHEQ_PORT', false); -defined('TESTS_ZEND_QUEUE_PLATFORMJQ_ENABLED') || define('TESTS_ZEND_QUEUE_PLATFORMJQ_ENABLED', false); -defined('TESTS_ZEND_QUEUE_PLATFORMJQ_HOST') || define('TESTS_ZEND_QUEUE_PLATFORMJQ_HOST', false); -defined('TESTS_ZEND_QUEUE_PLATFORMJQ_PASS') || define('TESTS_ZEND_QUEUE_PLATFORMJQ_PASS', false); - - -/** - * Zend\Service\AgileZen online tests - */ -define('TESTS_ZEND_SERVICE_AGILEZEN_ONLINE_ENABLED',false); -define('TESTS_ZEND_SERVICE_AGILEZEN_ONLINE_APIKEY','insert the API key'); -define('TESTS_ZEND_SERVICE_AGILEZEN_ONLINE_PROJECT_ID','insert the project id'); -define('TESTS_ZEND_SERVICE_AGILEZEN_ONLINE_STORY_ID','insert the story id'); -define('TESTS_ZEND_SERVICE_AGILEZEN_ONLINE_INVITE_EMAIL','insert email for invitation'); -define('TESTS_ZEND_SERVICE_AGILEZEN_ONLINE_INVITE_ROLE_ID','insert role id for invitation'); -define('TESTS_ZEND_SERVICE_AGILEZEN_ONLINE_MEMBER_NAME','insert the member name to add to the project'); - - -/** - * Zend_Service_Amazon online tests - */ -defined('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ENABLED') || define('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ENABLED', false); -defined('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ACCESSKEYID') || define('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ACCESSKEYID', 'Enter AWSAccessKeyId here'); -defined('TESTS_ZEND_SERVICE_AMAZON_ONLINE_SECRETKEY') || define('TESTS_ZEND_SERVICE_AMAZON_ONLINE_SECRETKEY', 'Enter AWSSecretKey here'); -defined('TESTS_ZEND_SERVICE_AMAZON_EC2_IMAGE_ID') || define('TESTS_ZEND_SERVICE_AMAZON_EC2_IMAGE_ID', 'zftestamazonimageid'); -defined('TESTS_ZEND_SERVICE_AMAZON_EC2_ZONE') || define('TESTS_ZEND_SERVICE_AMAZON_EC2_ZONE', 'us-east-1'); -defined('TESTS_ZEND_SERVICE_AMAZON_EC2_SECURITY_GROUP') || define('TESTS_ZEND_SERVICE_AMAZON_EC2_SECURITY_GROUP', 'default'); -defined('TESTS_ZEND_SERVICE_AMAZON_S3_BUCKET') || define('TESTS_ZEND_SERVICE_AMAZON_S3_BUCKET', 'zftestamazons3bucket'); -defined('TESTS_ZEND_SERVICE_AMAZON_SQS_QUEUE') || define('TESTS_ZEND_SERVICE_AMAZON_SQS_QUEUE', 'zftestamazonsqsqueuename'); - -/** - * Zend_Service_Delicious tests - */ -defined('TESTS_ZEND_SERVICE_DELICIOUS_ENABLED') || define('TESTS_ZEND_SERVICE_DELICIOUS_ENABLED', false); - -/** - * Zend_Service_DeveloperGarden tests - * Setup your Username and Password to test this Service - */ -defined('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_ENABLED') || define('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_ENABLED', false); -defined('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_LOGIN') || define('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_LOGIN', 'ZF_Username'); -defined('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_PASSWORD') || define('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_PASSWORD', 'ZF_Password'); - -/** - * Zend_Service_Flickr online tests - */ -defined('TESTS_ZEND_SERVICE_FLICKR_ONLINE_ENABLED') || define('TESTS_ZEND_SERVICE_FLICKR_ONLINE_ENABLED', false); -defined('TESTS_ZEND_SERVICE_FLICKR_ONLINE_APIKEY') || define('TESTS_ZEND_SERVICE_FLICKR_ONLINE_APIKEY', 'Enter API key here'); - -/** - * Zend_Service_GoGrid offline tests - */ - -defined('TESTS_ZEND_SERVICE_GOGRID_ONLINE_ENABLED') || define('TESTS_ZEND_SERVICE_GOGRID_ONLINE_ENABLED', false); -defined('TESTS_ZEND_SERVICE_GOGRID_ONLINE_KEY') || define('TESTS_ZEND_SERVICE_GOGRID_ONLINE_KEY','insert key here'); -defined('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SECRET') || define('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SECRET','insert secret here'); -defined('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SERVER_NAME') || define('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SERVER_NAME','test-zf'); -defined('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SERVER_IMAGE') || define('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SERVER_IMAGE','insert image name here'); -defined('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SERVER_RAM') || define('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SERVER_RAM','insert ram name here'); -defined('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SERVER_IP') || define('TESTS_ZEND_SERVICE_GOGRID_ONLINE_SERVER_IP','insert ip here'); - -/** - * Zend\Service\LiveDocx configuration - * - * Define username and password in order to run unit tests for LiveDocx web services. - * - * phpunit/phpunit will typically work. - */ -defined('TESTS_ZEND_SERVICE_LIVEDOCX_USERNAME') || define('TESTS_ZEND_SERVICE_LIVEDOCX_USERNAME', false); -defined('TESTS_ZEND_SERVICE_LIVEDOCX_PASSWORD') || define('TESTS_ZEND_SERVICE_LIVEDOCX_PASSWORD', false); - -/** - * Zend\Service\LiveDocx premium configuration - * - * Define username, password, WSDL in order to run unit tests for premium LiveDocx web services. - */ -defined('TESTS_ZEND_SERVICE_LIVEDOCX_PREMIUM_USERNAME') || define('TESTS_ZEND_SERVICE_LIVEDOCX_PREMIUM_USERNAME', false); -defined('TESTS_ZEND_SERVICE_LIVEDOCX_PREMIUM_PASSWORD') || define('TESTS_ZEND_SERVICE_LIVEDOCX_PREMIUM_PASSWORD', false); -defined('TESTS_ZEND_SERVICE_LIVEDOCX_PREMIUM_WSDL') || define('TESTS_ZEND_SERVICE_LIVEDOCX_PREMIUM_WSDL', false); - -/** - * Zend_Service_Rackspace tests - */ -defined('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_ENABLED') || define('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_ENABLED', false); -defined('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_USER') || define('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_USER', 'Enter key here'); -defined('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_KEY') || define('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_KEY', 'Enter secret here'); -defined('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_REGION') || define('TESTS_ZEND_SERVICE_RACKSPACE_ONLINE_REGION', 'USA'); -defined('TESTS_ZEND_SERVICE_RACKSPACE_CONTAINER_NAME') || define('TESTS_ZEND_SERVICE_RACKSPACE_CONTAINER_NAME', 'zf-unit-test'); -defined('TESTS_ZEND_SERVICE_RACKSPACE_OBJECT_NAME') || define('TESTS_ZEND_SERVICE_RACKSPACE_OBJECT_NAME','zf-object-test'); -defined('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_NAME') || define('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_NAME', 'zf-unit-test'); -defined('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_IMAGEID') || define('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_IMAGEID', '49'); -defined('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_NEW_IMAGEID') || define('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_NEW_IMAGEID', '49'); -defined('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_FLAVORID') || define('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_FLAVORID', '1'); -defined('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_IMAGE_NAME') || define('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_IMAGE_NAME', 'ZFunitTestImage'); -defined('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_SHARED_IP_GROUP_NAME') || define('TESTS_ZEND_SERVICE_RACKSPACE_SERVER_SHARED_IP_GROUP_NAME', 'ZFgroupIP'); -defined('TESTS_ZEND_SERVICE_RACKSPACE_TIMEOUT') || define('TESTS_ZEND_SERVICE_RACKSPACE_TIMEOUT', 60); - -/** - * Zend_Service_ReCaptcha tests - */ -defined('TESTS_ZEND_SERVICE_RECAPTCHA_ENABLED') || define('TESTS_ZEND_SERVICE_RECAPTCHA_ENABLED', false); -defined('TESTS_ZEND_SERVICE_RECAPTCHA_ONLINE_ENABLED') || define('TESTS_ZEND_SERVICE_RECAPTCHA_ONLINE_ENABLED', false); -defined('TESTS_ZEND_SERVICE_RECAPTCHA_PUBLIC_KEY') || define('TESTS_ZEND_SERVICE_RECAPTCHA_PUBLIC_KEY', 'public key'); -defined('TESTS_ZEND_SERVICE_RECAPTCHA_PRIVATE_KEY') || define('TESTS_ZEND_SERVICE_RECAPTCHA_PRIVATE_KEY', 'private key'); -defined('TESTS_ZEND_SERVICE_RECAPTCHA_MAILHIDE_PUBLIC_KEY') || define('TESTS_ZEND_SERVICE_RECAPTCHA_MAILHIDE_PUBLIC_KEY', 'public mailhide key'); -defined('TESTS_ZEND_SERVICE_RECAPTCHA_MAILHIDE_PRIVATE_KEY') || define('TESTS_ZEND_SERVICE_RECAPTCHA_MAILHIDE_PRIVATE_KEY', 'private mailhide key'); - -/** - * Zend_Service_Simpy tests - */ -defined('TESTS_ZEND_SERVICE_SIMPY_ENABLED') || define('TESTS_ZEND_SERVICE_SIMPY_ENABLED', false); -defined('TESTS_ZEND_SERVICE_SIMPY_USERNAME') || define('TESTS_ZEND_SERVICE_SIMPY_USERNAME', 'syapizend'); -defined('TESTS_ZEND_SERVICE_SIMPY_PASSWORD') || define('TESTS_ZEND_SERVICE_SIMPY_PASSWORD', 'mgt37ge'); - -/** - * Zend_Service_SlideShare tests - */ -defined('TESTS_ZEND_SERVICE_SLIDESHARE_USERNAME') || define('TESTS_ZEND_SERVICE_SLIDESHARE_USERNAME', ''); -defined('TESTS_ZEND_SERVICE_SLIDESHARE_PASSWORD') || define('TESTS_ZEND_SERVICE_SLIDESHARE_PASSWORD', ''); -defined('TESTS_ZEND_SERVICE_SLIDESHARE_SHAREDSECRET') || define('TESTS_ZEND_SERVICE_SLIDESHARE_SHAREDSECRET', ''); -defined('TESTS_ZEND_SERVICE_SLIDESHARE_APIKEY') || define('TESTS_ZEND_SERVICE_SLIDESHARE_APIKEY', ''); - -// The slide show ID to retrieve during tests -defined('TESTS_ZEND_SERVICE_SLIDESHARE_SLIDESHOWID') || define('TESTS_ZEND_SERVICE_SLIDESHARE_SLIDESHOWID', 0); - -// The tag to retrieve during tests -defined('TESTS_ZEND_SERVICE_SLIDESHARE_TAG') || define('TESTS_ZEND_SERVICE_SLIDESHARE_TAG', 'zend'); - -// The group to retrieve during tests -defined('TESTS_ZEND_SERVICE_SLIDESHARE_GROUP') || define('TESTS_ZEND_SERVICE_SLIDESHARE_GROUP', ''); - -/** - * Zend_Service_Twitter tests - * - * ONLINE_ENABLED indicates whether or not to run tests requiring a network - * connection. - * - * TWITTER_USER and TWITTER_PASS are valid Twitter credentials you wish to use - * when testing. - */ -defined('TESTS_ZEND_SERVICE_TWITTER_ONLINE_ENABLED') || define('TESTS_ZEND_SERVICE_TWITTER_ONLINE_ENABLED', false); -defined('TESTS_ZEND_SERVICE_TWITTER_USER') || define('TESTS_ZEND_SERVICE_TWITTER_USER', 'zftestuser'); -defined('TESTS_ZEND_SERVICE_TWITTER_PASS') || define('TESTS_ZEND_SERVICE_TWITTER_PASS', 'zftestuser'); - -/** - * Zend_Service_WindowsAzure tests - */ - -/** - * Online - */ - -define('TESTS_ZEND_SERVICE_WINDOWSAZURE_ONLINE_ACCOUNTNAME',''); -define('TESTS_ZEND_SERVICE_WINDOWSAZURE_ONLINE_ACCOUNTKEY',''); -define('TESTS_ZEND_SERVICE_WINDOWSAZURE_ONLINE_TABLE_HOST',''); -define('TESTS_ZEND_SERVICE_WINDOWSAZURE_ONLINE_STORAGE_PROXY_HOST',''); -define('TESTS_ZEND_SERVICE_WINDOWSAZURE_ONLINE_STORAGE_PROXY_PORT',''); -define('TESTS_ZEND_SERVICE_WINDOWSAZURE_ONLINE_STORAGE_PROXY_CREDENTIALS',''); - -/** - * Proxy settings - */ -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_USEPROXY') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_USEPROXY', false); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY', ''); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_PORT') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_PORT', '8080'); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_CREDENTIALS') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_CREDENTIALS', ''); - -/** - * Azure hosts - */ -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_HOST_DEV') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_HOST_DEV', '127.0.0.1:10000'); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_HOST_DEV') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_HOST_DEV', '127.0.0.1:10001'); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_HOST_DEV') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_HOST_DEV', '127.0.0.1:10002'); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_HOST_PROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_HOST_PROD', 'blob.core.windows.net'); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_HOST_PROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_HOST_PROD', 'queue.core.windows.net'); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_HOST_PROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_HOST_PROD', 'table.core.windows.net'); - -/** - * Credentials - */ -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_ACCOUNT_DEV') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_ACCOUNT_DEV', 'devstoreaccount1'); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_KEY_DEV') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_KEY_DEV', 'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=='); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_ACCOUNT_PROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_ACCOUNT_PROD', 'phpazure'); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_KEY_PROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_KEY_PROD', 'I+ebYPcIDB6BsmfAe6pJSpOw8oXA6jMBZv1BEZcSPRqTpldt44refCl65YpKJqcBOiD21Lxsj8d6Ah8Oc2/gKA=='); - -/** - * Blob storage tests - */ -// Enable this tests only when you have a working account -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_RUNTESTS') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_RUNTESTS', false); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_RUNONPROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_RUNONPROD', false); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_RUNLARGEBLOB') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_RUNLARGEBLOB', true); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_CONTAINER_PREFIX') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_CONTAINER_PREFIX', 'phpazuretestblob'); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOBSTREAM_CONTAINER_PREFIX') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOBSTREAM_CONTAINER_PREFIX', 'phpazureteststream'); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOBSA_CONTAINER_PREFIX') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOBSA_CONTAINER_PREFIX', 'phpazuretestshared'); - -/** - * Table storage tests - */ -// Enable this tests only when you have a working account -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_RUNTESTS') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_RUNTESTS', false); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_RUNONPROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_RUNONPROD', false); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_TABLENAME_PREFIX') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_TABLENAME_PREFIX', 'phpazuretesttable'); - -/** - * Queue storage tests - */ -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS', false); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNONPROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNONPROD', false); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_PREFIX') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_PREFIX', 'phpazuretestqueue'); - -/** - * SessionHandler tests - */ -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNTESTS') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNTESTS', false); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNONPROD') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNONPROD', false); -defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_TABLENAME_PREFIX') || define('TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_TABLENAME_PREFIX', 'phpazuretestsession'); - -/** - * Zend_Service_Yahoo online tests - */ -defined('TESTS_ZEND_SERVICE_YAHOO_ONLINE_ENABLED') || define('TESTS_ZEND_SERVICE_YAHOO_ONLINE_ENABLED', false); -defined('TESTS_ZEND_SERVICE_YAHOO_ONLINE_APPID') || define('TESTS_ZEND_SERVICE_YAHOO_ONLINE_APPID', 'Enter APPID here'); - -/** - * Zend_Soap_AutoDiscover scenario tests for complex objects and wsdl generation - * - * Copy all the files of zf/tests/Zend/Soap/_files/fulltests into a directory - * that can be reached by webserver and enter the base uri to this directory - * into the variable. The test "Zend_Soap_AutoDiscover_OnlineTest" makes use - * of the servers and AutoDiscover feature. - * - * NOTE: Make sure the servers are using the correct Zend Framework copy, - * when having more than one version installed and include paths are changing. - */ -defined('TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI') || define('TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI', false); - -/** - * Zend_Uri tests - * - * Setting CRASH_TEST_ENABLED to true will enable some tests that may - * potentially crash PHP on some systems, due to very deep-nesting regular - * expressions. - * - * Only do this if you know what you are doing! - */ -defined('TESTS_ZEND_URI_CRASH_TEST_ENABLED') || define('TESTS_ZEND_URI_CRASH_TEST_ENABLED', false); - -/** - * Zend_Validate tests - * - * Set ONLINE_ENABLED if you wish to run validators that require network - * connectivity. - */ -defined('TESTS_ZEND_VALIDATE_ONLINE_ENABLED') || define('TESTS_ZEND_VALIDATE_ONLINE_ENABLED', false); - -/** - * PHPUnit Code Coverage / Test Report - */ -defined('TESTS_GENERATE_REPORT') || define('TESTS_GENERATE_REPORT', false); -defined('TESTS_GENERATE_REPORT_TARGET') || define('TESTS_GENERATE_REPORT_TARGET', '/path/to/target'); - From 66a6bed8be064cbf5f156f60597c87d92f1b3a52 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Wed, 4 Apr 2012 21:28:23 +0200 Subject: [PATCH 195/238] Re-enabling components as of @weierophinney suggestions --- .travis/skipped-components | 16 ---------------- .travis/tested-components | 18 ++++++++++++++++-- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.travis/skipped-components b/.travis/skipped-components index 7d38e2de..6ccd1be1 100644 --- a/.travis/skipped-components +++ b/.travis/skipped-components @@ -1,27 +1,11 @@ Zend/Amf Zend/Barcode -Zend/Cache -Zend/Code Zend/Date -Zend/Docbook Zend/Feed -Zend/File -Zend/Filter -Zend/GData -Zend/Json -Zend/Locale -Zend/Mail -Zend/Mime -Zend/Navigation -Zend/OpenId Zend/Paginator Zend/Queue -Zend/RegistryTest.php Zend/Service Zend/Session -Zend/Soap Zend/Test Zend/Translator -Zend/Validator Zend/Wildfire -Zend/XmlRpc diff --git a/.travis/tested-components b/.travis/tested-components index 34047abc..da5b101b 100644 --- a/.travis/tested-components +++ b/.travis/tested-components @@ -1,40 +1,54 @@ -Zend/Mvc -Zend/View Zend/Acl Zend/Authentication +Zend/Cache Zend/Captcha Zend/Cloud +Zend/Code Zend/Config Zend/Console Zend/Crypt Zend/Currency Zend/Db Zend/Di +Zend/Docbook Zend/Dojo Zend/Dom Zend/EventManager +Zend/File +Zend/Filter Zend/Form +Zend/GData Zend/Http Zend/InfoCard +Zend/Json Zend/Ldap Zend/Loader +Zend/Locale Zend/Log +Zend/Mail Zend/Markup Zend/Measure Zend/Memory +Zend/Mime Zend/Module Zend/Mvc +Zend/Navigation Zend/OAuth +Zend/OpenId Zend/Pdf Zend/ProgressBar +Zend/RegistryTest.php Zend/Rest Zend/Search Zend/Serializer Zend/Server +Zend/Soap Zend/Stdlib Zend/Tag Zend/Text Zend/TimeSync Zend/Uri +Zend/Validator Zend/VersionTest.php Zend/View +Zend/XmlRpc From 71bc49529969c8ff3a0a155e9d7be08ae89a9f98 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Wed, 4 Apr 2012 22:16:58 +0200 Subject: [PATCH 196/238] Fixing exit code and output of test runner The test-runner will run all test suites and display their names anyway, then use an appropriate exit code in case of failures. Using the list of components to be tested (was using the skipped components list to be sure that the exit code of the test runner were correct). --- .travis/run-tests.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis/run-tests.sh b/.travis/run-tests.sh index 47d0c4a0..11d98cd6 100755 --- a/.travis/run-tests.sh +++ b/.travis/run-tests.sh @@ -2,7 +2,13 @@ travisdir=$(dirname $(readlink /proc/$$/fd/255)) testdir="$travisdir/../tests" testedcomponents=(`cat "$travisdir/tested-components"`) +result=0 for tested in "${testedcomponents[@]}" - do phpunit -c $testdir/phpunit.xml $testdir/$tested + do + echo "$tested:" + phpunit -c $testdir/phpunit.xml $testdir/$tested + let "result = $result || $?" done + +exit $result \ No newline at end of file From a52dcef35ae3880cd80ed780f0b1ffea2c488e48 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Mon, 9 Apr 2012 11:28:58 -0500 Subject: [PATCH 197/238] [zendframework/zf2#1008] Updated test lists - Moved Session, Paginator to tested-components - Added Zend/Feed/Reader, Writer to tested-components --- .travis/skipped-components | 2 -- .travis/tested-components | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis/skipped-components b/.travis/skipped-components index 6ccd1be1..6847359d 100644 --- a/.travis/skipped-components +++ b/.travis/skipped-components @@ -2,10 +2,8 @@ Zend/Amf Zend/Barcode Zend/Date Zend/Feed -Zend/Paginator Zend/Queue Zend/Service -Zend/Session Zend/Test Zend/Translator Zend/Wildfire diff --git a/.travis/tested-components b/.travis/tested-components index da5b101b..330e5f19 100644 --- a/.travis/tested-components +++ b/.travis/tested-components @@ -14,6 +14,8 @@ Zend/Docbook Zend/Dojo Zend/Dom Zend/EventManager +Zend/Feed/Reader +Zend/Feed/Writer Zend/File Zend/Filter Zend/Form @@ -35,6 +37,7 @@ Zend/Mvc Zend/Navigation Zend/OAuth Zend/OpenId +Zend/Paginator Zend/Pdf Zend/ProgressBar Zend/RegistryTest.php @@ -42,6 +45,7 @@ Zend/Rest Zend/Search Zend/Serializer Zend/Server +Zend/Session Zend/Soap Zend/Stdlib Zend/Tag From 71c5a2d26c6a2e3d14f1b0b7da3ca2777c21fcc8 Mon Sep 17 00:00:00 2001 From: Maks3w Date: Mon, 7 May 2012 00:55:18 +0200 Subject: [PATCH 198/238] [Feed_Writer] Improve comment description --- src/Writer/AbstractFeed.php | 6 +++--- src/Writer/Entry.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Writer/AbstractFeed.php b/src/Writer/AbstractFeed.php index 3452ff3d..b11ed0d8 100644 --- a/src/Writer/AbstractFeed.php +++ b/src/Writer/AbstractFeed.php @@ -63,9 +63,9 @@ public function __construct() * Set a single author * * The following option keys are supported: - * 'name' => The name - * 'email' => An optional email - * 'uri' => An optional uri + * 'name' => (string) The name + * 'email' => (string) An optional email + * 'uri' => (string) An optional and valid URI * * @param array $author * @throws Exception\InvalidArgumentException If any value of $author not follow the format. diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index a1660b5b..0f762b93 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -70,9 +70,9 @@ public function __construct() * Set a single author * * The following option keys are supported: - * 'name' => The name - * 'email' => An optional email - * 'uri' => An optional uri + * 'name' => (string) The name + * 'email' => (string) An optional email + * 'uri' => (string) An optional and valid URI * * @param array $author * @throws Exception\InvalidArgumentException If any value of $author not follow the format. From c566fb498c052082eb87e8322cb954d9d2338bd2 Mon Sep 17 00:00:00 2001 From: Maks3w Date: Wed, 9 May 2012 10:47:00 +0200 Subject: [PATCH 199/238] [Travis] Change Docbook to DocBook --- .travis/tested-components | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/tested-components b/.travis/tested-components index 330e5f19..c0fe6477 100644 --- a/.travis/tested-components +++ b/.travis/tested-components @@ -10,7 +10,7 @@ Zend/Crypt Zend/Currency Zend/Db Zend/Di -Zend/Docbook +Zend/DocBook Zend/Dojo Zend/Dom Zend/EventManager From 9a0d8cf0221bfbac8f486a23d3866cdf9daf0ecd Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 9 May 2012 11:28:05 -0500 Subject: [PATCH 200/238] Remove --stderr switch from Travis test runner - Appears that it may not be necessary --- .travis/run-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/run-tests.sh b/.travis/run-tests.sh index 1ba31be7..9334e959 100755 --- a/.travis/run-tests.sh +++ b/.travis/run-tests.sh @@ -7,7 +7,7 @@ result=0 for tested in "${testedcomponents[@]}" do echo "$tested:" - phpunit -c $testdir/phpunit.xml --stderr $testdir/$tested + phpunit -c $testdir/phpunit.xml $testdir/$tested result=$(($result || $?)) done From 8b321cfb1a1e686bf904466f1e1cf1c2807e6683 Mon Sep 17 00:00:00 2001 From: prolic Date: Wed, 9 May 2012 19:44:20 +0200 Subject: [PATCH 201/238] [zen-27] Renamed interfaces in Zend\Feed --- src/Exception/BadMethodCallException.php | 8 ++ .../ExceptionInterface.php} | 8 +- src/Exception/InvalidArgumentException.php | 8 ++ src/Exception/RuntimeException.php | 8 ++ src/PubSubHubbub/AbstractCallback.php | 40 +++++---- .../{Callback.php => CallbackInterface.php} | 2 +- .../Exception/ExceptionInterface.php | 8 ++ .../Exception/InvalidArgumentException.php | 10 +++ .../Exception/RuntimeException.php | 10 +++ src/PubSubHubbub/HttpResponse.php | 11 +-- src/PubSubHubbub/Model/Subscription.php | 11 ++- ...p => SubscriptionPersistenceInterface.php} | 2 +- src/PubSubHubbub/PubSubHubbub.php | 3 +- src/PubSubHubbub/Publisher.php | 50 ++++++----- src/PubSubHubbub/Subscriber.php | 82 +++++++++++-------- src/PubSubHubbub/Subscriber/Callback.php | 2 +- src/Reader/AbstractEntry.php | 4 +- src/Reader/AbstractFeed.php | 2 +- src/Reader/Entry/Atom.php | 8 +- .../{Entry.php => Entry/EntryInterface.php} | 4 +- src/Reader/Entry/Rss.php | 2 +- src/Reader/Exception.php | 34 -------- .../Exception/BadMethodCallException.php | 10 +++ src/Reader/Exception/ExceptionInterface.php | 8 ++ .../Exception/InvalidArgumentException.php | 10 +++ src/Reader/Extension/AbstractFeed.php | 5 +- src/Reader/Extension/Content/Entry.php | 5 +- src/Reader/Extension/CreativeCommons/Feed.php | 5 +- src/Reader/Extension/DublinCore/Entry.php | 10 ++- src/Reader/Extension/Podcast/Feed.php | 1 + src/Reader/Extension/Syndication/Feed.php | 7 +- src/Reader/Extension/Thread/Entry.php | 1 + src/Reader/Extension/WellFormedWeb/Entry.php | 1 + src/Reader/Feed/AbstractFeed.php | 14 ++-- src/Reader/Feed/Atom.php | 5 +- src/Reader/{ => Feed}/Feed.php | 7 +- src/Reader/Feed/Rss.php | 10 ++- src/Writer/AbstractFeed.php | 9 +- src/Writer/Entry.php | 46 +++++++---- src/Writer/Exception.php | 34 -------- ...ception.php => BadMethodCallException.php} | 6 +- src/Writer/Exception/ExceptionInterface.php | 2 - .../Exception/InvalidArgumentException.php | 4 +- src/Writer/Exception/RuntimeException.php | 10 +++ src/Writer/Extension/ITunes/Entry.php | 2 +- src/Writer/Extension/ITunes/Feed.php | 76 +++++++++-------- src/Writer/InvalidMethodException.php | 35 -------- src/Writer/Renderer/AbstractRenderer.php | 4 +- src/Writer/Renderer/Entry/Atom.php | 7 +- src/Writer/Renderer/Entry/AtomDeleted.php | 2 +- src/Writer/Renderer/Entry/Rss.php | 2 +- src/Writer/Renderer/Feed/Atom.php | 2 +- src/Writer/Renderer/Feed/AtomSource.php | 2 +- src/Writer/Renderer/Feed/Rss.php | 2 +- .../RendererInterface.php} | 19 +++-- 55 files changed, 374 insertions(+), 306 deletions(-) create mode 100644 src/Exception/BadMethodCallException.php rename src/{Exception.php => Exception/ExceptionInterface.php} (85%) create mode 100644 src/Exception/InvalidArgumentException.php create mode 100644 src/Exception/RuntimeException.php rename src/PubSubHubbub/{Callback.php => CallbackInterface.php} (98%) create mode 100644 src/PubSubHubbub/Exception/ExceptionInterface.php create mode 100644 src/PubSubHubbub/Exception/InvalidArgumentException.php create mode 100644 src/PubSubHubbub/Exception/RuntimeException.php rename src/PubSubHubbub/Model/{SubscriptionPersistence.php => SubscriptionPersistenceInterface.php} (97%) rename src/Reader/{Entry.php => Entry/EntryInterface.php} (98%) delete mode 100644 src/Reader/Exception.php create mode 100644 src/Reader/Exception/BadMethodCallException.php create mode 100644 src/Reader/Exception/ExceptionInterface.php create mode 100644 src/Reader/Exception/InvalidArgumentException.php rename src/Reader/{ => Feed}/Feed.php (95%) delete mode 100644 src/Writer/Exception.php rename src/Writer/Exception/{InvalidMethodException.php => BadMethodCallException.php} (88%) create mode 100644 src/Writer/Exception/RuntimeException.php delete mode 100644 src/Writer/InvalidMethodException.php rename src/Writer/{Renderer.php => Renderer/RendererInterface.php} (87%) diff --git a/src/Exception/BadMethodCallException.php b/src/Exception/BadMethodCallException.php new file mode 100644 index 00000000..5f1e9a1b --- /dev/null +++ b/src/Exception/BadMethodCallException.php @@ -0,0 +1,8 @@ +toArray(); } elseif (!is_array($config)) { - throw new Exception('Array or Zend_Config object' + throw new Exception\InvalidArgumentException('Array or Zend_Config object' . 'expected, got ' . gettype($config)); } if (array_key_exists('storage', $config)) { @@ -107,10 +110,10 @@ public function sendResponse() * to background save any verification tokens associated with a subscription * or other. * - * @param \Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence $storage - * @return \Zend\Feed\PubSubHubbub\AbstractCallback + * @param Model\SubscriptionPersistenceInterface $storage + * @return AbstractCallback */ - public function setStorage(Model\SubscriptionPersistence $storage) + public function setStorage(Model\SubscriptionPersistenceInterface $storage) { $this->_storage = $storage; return $this; @@ -121,12 +124,13 @@ public function setStorage(Model\SubscriptionPersistence $storage) * to background save any verification tokens associated with a subscription * or other. * - * @return \Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence + * @return Model\SubscriptionPersistenceInterface + * @throws Exception\RuntimeException */ public function getStorage() { if ($this->_storage === null) { - throw new Exception('No storage object has been' + throw new Exception\RuntimeException('No storage object has been' . ' set that subclasses Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence'); } return $this->_storage; @@ -137,8 +141,9 @@ public function getStorage() * Zend\Feed\Pubsubhubbub\HttpResponse which shares an unenforced interface with * (i.e. not inherited from) Zend\Controller\Response\Http. * - * @param Zend\Feed\Pubsubhubbub\HttpResponse|\Zend\Controller\Response\Http $httpResponse - * @return \Zend\Feed\PubSubHubbub\AbstractCallback + * @param HttpResponse|\Zend\Controller\Response\Http $httpResponse + * @return AbstractCallback + * @throws Exception\InvalidArgumentException */ public function setHttpResponse($httpResponse) { @@ -146,7 +151,7 @@ public function setHttpResponse($httpResponse) || (!$httpResponse instanceof HttpResponse && !$httpResponse instanceof \Zend\Controller\Response\Http) ) { - throw new Exception('HTTP Response object must' + throw new Exception\InvalidArgumentException('HTTP Response object must' . ' implement one of Zend\Feed\Pubsubhubbub\HttpResponse or' . ' Zend\Controller\Response\Http'); } @@ -159,7 +164,7 @@ public function setHttpResponse($httpResponse) * Zend\Feed\Pubsubhubbub\HttpResponse which shares an unenforced interface with * (i.e. not inherited from) Zend\Controller\Response\Http. * - * @return Zend\Feed\Pubsubhubbub\HttpResponse|\Zend\Controller\Response\Http + * @return HttpResponse|\Zend\Controller\Response\Http */ public function getHttpResponse() { @@ -175,13 +180,14 @@ public function getHttpResponse() * Defaults to 1 if left unchanged. * * @param string|int $count - * @return \Zend\Feed\PubSubHubbub\AbstractCallback + * @return AbstractCallback + * @throws Exception\InvalidArgumentException */ public function setSubscriberCount($count) { $count = intval($count); if ($count <= 0) { - throw new Exception('Subscriber count must be' + throw new Exception\InvalidArgumentException('Subscriber count must be' . ' greater than zero'); } $this->_subscriberCount = $count; diff --git a/src/PubSubHubbub/Callback.php b/src/PubSubHubbub/CallbackInterface.php similarity index 98% rename from src/PubSubHubbub/Callback.php rename to src/PubSubHubbub/CallbackInterface.php index bf78f730..f3eb2865 100644 --- a/src/PubSubHubbub/Callback.php +++ b/src/PubSubHubbub/CallbackInterface.php @@ -28,7 +28,7 @@ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface Callback +interface CallbackInterface { /** * Handle any callback from a Hub Server responding to a subscription or diff --git a/src/PubSubHubbub/Exception/ExceptionInterface.php b/src/PubSubHubbub/Exception/ExceptionInterface.php new file mode 100644 index 00000000..389bb0da --- /dev/null +++ b/src/PubSubHubbub/Exception/ExceptionInterface.php @@ -0,0 +1,8 @@ + $code) || (599 < $code)) { - throw new Exception('Invalid HTTP response' + throw new Exception\InvalidArgumentException('Invalid HTTP response' . ' code:' . $code); } $this->_httpResponseCode = $code; diff --git a/src/PubSubHubbub/Model/Subscription.php b/src/PubSubHubbub/Model/Subscription.php index 39c45c24..cf6aba45 100644 --- a/src/PubSubHubbub/Model/Subscription.php +++ b/src/PubSubHubbub/Model/Subscription.php @@ -30,7 +30,7 @@ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Subscription extends AbstractModel implements SubscriptionPersistence +class Subscription extends AbstractModel implements SubscriptionPersistenceInterface { /** @@ -38,11 +38,12 @@ class Subscription extends AbstractModel implements SubscriptionPersistence * * @param array $data * @return bool + * @throws PubSubHubbub\Exception\InvalidArgumentException */ public function setSubscription(array $data) { if (!isset($data['id'])) { - throw new PubSubHubbub\Exception( + throw new PubSubHubbub\Exception\InvalidArgumentException( 'ID must be set before attempting a save' ); } @@ -72,11 +73,12 @@ public function setSubscription(array $data) * * @param string $key * @return array + * @throws PubSubHubbub\Exception\InvalidArgumentException */ public function getSubscription($key) { if (empty($key) || !is_string($key)) { - throw new PubSubHubbub\Exception('Invalid parameter "key"' + throw new PubSubHubbub\Exception\InvalidArgumentException('Invalid parameter "key"' .' of "' . $key . '" must be a non-empty string'); } $result = $this->_db->select(array('id' => $key)); @@ -91,11 +93,12 @@ public function getSubscription($key) * * @param string $key * @return bool + * @throws PubSubHubbub\Exception\InvalidArgumentException */ public function hasSubscription($key) { if (empty($key) || !is_string($key)) { - throw new PubSubHubbub\Exception('Invalid parameter "key"' + throw new PubSubHubbub\Exception\InvalidArgumentException('Invalid parameter "key"' .' of "' . $key . '" must be a non-empty string'); } $result = $this->_db->select(array('id' => $key)); diff --git a/src/PubSubHubbub/Model/SubscriptionPersistence.php b/src/PubSubHubbub/Model/SubscriptionPersistenceInterface.php similarity index 97% rename from src/PubSubHubbub/Model/SubscriptionPersistence.php rename to src/PubSubHubbub/Model/SubscriptionPersistenceInterface.php index 2fc5bd7f..e527a04a 100644 --- a/src/PubSubHubbub/Model/SubscriptionPersistence.php +++ b/src/PubSubHubbub/Model/SubscriptionPersistenceInterface.php @@ -28,7 +28,7 @@ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface SubscriptionPersistence +interface SubscriptionPersistenceInterface { /** diff --git a/src/PubSubHubbub/PubSubHubbub.php b/src/PubSubHubbub/PubSubHubbub.php index 20d86332..9f82cd19 100644 --- a/src/PubSubHubbub/PubSubHubbub.php +++ b/src/PubSubHubbub/PubSubHubbub.php @@ -59,6 +59,7 @@ class PubSubHubbub * * @param \Zend\Feed\Reader\AbstractFeed|string $source * @return array + * @throws Exception\InvalidArgumentException */ public static function detectHubs($source) { @@ -67,7 +68,7 @@ public static function detectHubs($source) } elseif (is_object($source) && $source instanceof Reader\Feed\AbstractFeed) { $feed = $source; } else { - throw new Exception('The source parameter was' + throw new Exception\InvalidArgumentException('The source parameter was' . ' invalid, i.e. not a URL string or an instance of type' . ' Zend\Feed\Reader\FeedAbstract or Zend\Feed\Abstract'); } diff --git a/src/PubSubHubbub/Publisher.php b/src/PubSubHubbub/Publisher.php index c3db1d5a..bb3bc582 100644 --- a/src/PubSubHubbub/Publisher.php +++ b/src/PubSubHubbub/Publisher.php @@ -81,14 +81,15 @@ public function __construct($config = null) * Process any injected configuration options * * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Publisher + * @throws Exception\InvalidArgumentException */ public function setConfig($config) { if ($config instanceof \Zend\Config\Config) { $config = $config->toArray(); } elseif (!is_array($config)) { - throw new Exception('Array or Zend_Config object' + throw new Exception\InvalidArgumentException('Array or Zend_Config object' . 'expected, got ' . gettype($config)); } if (array_key_exists('hubUrls', $config)) { @@ -107,12 +108,13 @@ public function setConfig($config) * Add a Hub Server URL supported by Publisher * * @param string $url - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Publisher + * @throws Exception\InvalidArgumentException */ public function addHubUrl($url) { if (empty($url) || !is_string($url) || !Uri\UriFactory::factory($url)->isValid()) { - throw new Exception('Invalid parameter "url"' + throw new Exception\InvalidArgumentException('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .'URL'); } @@ -124,7 +126,7 @@ public function addHubUrl($url) * Add an array of Hub Server URLs supported by Publisher * * @param array $urls - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Publisher */ public function addHubUrls(array $urls) { @@ -138,7 +140,7 @@ public function addHubUrls(array $urls) * Remove a Hub Server URL * * @param string $url - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Publisher */ public function removeHubUrl($url) { @@ -165,12 +167,13 @@ public function getHubUrls() * Add a URL to a topic (Atom or RSS feed) which has been updated * * @param string $url - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Publisher + * @throws Exception\InvalidArgumentException */ public function addUpdatedTopicUrl($url) { if (empty($url) || !is_string($url) || !Uri\UriFactory::factory($url)->isValid()) { - throw new Exception('Invalid parameter "url"' + throw new Exception\InvalidArgumentException('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .'URL'); } @@ -182,7 +185,7 @@ public function addUpdatedTopicUrl($url) * Add an array of Topic URLs which have been updated * * @param array $urls - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Publisher */ public function addUpdatedTopicUrls(array $urls) { @@ -196,7 +199,7 @@ public function addUpdatedTopicUrls(array $urls) * Remove an updated topic URL * * @param string $url - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Publisher */ public function removeUpdatedTopicUrl($url) { @@ -224,12 +227,12 @@ public function getUpdatedTopicUrls() * * @param string $url The Hub Server's URL * @return void - * @throws \Zend\Feed\PubSubHubbub\Exception Thrown on failure + * @throws Exception\ExceptionInterface */ public function notifyHub($url) { if (empty($url) || !is_string($url) || !Uri\UriFactory::factory($url)->isValid()) { - throw new Exception('Invalid parameter "url"' + throw new Exception\InvalidArgumentException('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .'URL'); } @@ -237,7 +240,7 @@ public function notifyHub($url) $client->setUri($url); $response = $client->request(); if ($response->getStatus() !== 204) { - throw new Exception('Notification to Hub Server ' + throw new Exception\RuntimeException('Notification to Hub Server ' . 'at "' . $url . '" appears to have failed with a status code of "' . $response->getStatus() . '" and message "' . $response->getMessage() . '"'); @@ -253,14 +256,14 @@ public function notifyHub($url) * to needlessly fail with an Exception/Error unless from Zend_Http_Client. * * @return void - * @throws \Zend\Feed\PubSubHubbub\Exception Thrown if no hubs attached + * @throws Exception\RuntimeException */ public function notifyAll() { $client = $this->_getHttpClient(); $hubs = $this->getHubUrls(); if (empty($hubs)) { - throw new Exception('No Hub Server URLs' + throw new Exception\RuntimeException('No Hub Server URLs' . ' have been set so no notifcations can be sent'); } $this->_errors = array(); @@ -281,7 +284,8 @@ public function notifyAll() * * @param string $name * @param string|null $value - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Publisher + * @throws Exception\InvalidArgumentException */ public function setParameter($name, $value = null) { @@ -290,7 +294,7 @@ public function setParameter($name, $value = null) return $this; } if (empty($name) || !is_string($name)) { - throw new Exception('Invalid parameter "name"' + throw new Exception\InvalidArgumentException('Invalid parameter "name"' .' of "' . $name . '" must be a non-empty string'); } if ($value === null) { @@ -298,7 +302,7 @@ public function setParameter($name, $value = null) return $this; } if (empty($value) || (!is_string($value) && $value !== null)) { - throw new Exception('Invalid parameter "value"' + throw new Exception\InvalidArgumentException('Invalid parameter "value"' .' of "' . $value . '" must be a non-empty string'); } $this->_parameters[$name] = $value; @@ -309,7 +313,7 @@ public function setParameter($name, $value = null) * Add an optional parameter to the update notification requests * * @param array $parameters - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Publisher */ public function setParameters(array $parameters) { @@ -323,12 +327,13 @@ public function setParameters(array $parameters) * Remove an optional parameter for the notification requests * * @param string $name - * @return \Zend\Feed\PubSubHubbub\Publisher + * @return Publisher + * @throws Exception\InvalidArgumentException */ public function removeParameter($name) { if (empty($name) || !is_string($name)) { - throw new Exception('Invalid parameter "name"' + throw new Exception\InvalidArgumentException('Invalid parameter "name"' .' of "' . $name . '" must be a non-empty string'); } if (array_key_exists($name, $this->_parameters)) { @@ -377,6 +382,7 @@ public function getErrors() * Get a basic prepared HTTP client for use * * @return \Zend\Http\Client + * @throws Exception\RuntimeException */ protected function _getHttpClient() { @@ -389,7 +395,7 @@ protected function _getHttpClient() $params[] = 'hub.mode=publish'; $topics = $this->getUpdatedTopicUrls(); if (empty($topics)) { - throw new Exception('No updated topic URLs' + throw new Exception\RuntimeException('No updated topic URLs' . ' have been set'); } foreach ($topics as $topicUrl) { diff --git a/src/PubSubHubbub/Subscriber.php b/src/PubSubHubbub/Subscriber.php index 8a665e4b..934191d3 100644 --- a/src/PubSubHubbub/Subscriber.php +++ b/src/PubSubHubbub/Subscriber.php @@ -103,7 +103,7 @@ class Subscriber * An instance of Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence used to background * save any verification tokens associated with a subscription or other. * - * @var \Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence + * @var \Zend\Feed\PubSubHubbub\Model\SubscriptionPersistenceInterface */ protected $_storage = null; @@ -152,14 +152,15 @@ public function __construct($config = null) * Process any injected configuration options * * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Subscriber + * @throws Exception\InvalidArgumentException */ public function setConfig($config) { if ($config instanceof \Zend\Config\Config) { $config = $config->toArray(); } elseif (!is_array($config)) { - throw new Exception('Array or Zend\Config object' + throw new Exception\InvalidArgumentException('Array or Zend\Config object' . ' expected, got ' . gettype($config)); } if (array_key_exists('hubUrls', $config)) { @@ -199,12 +200,13 @@ public function setConfig($config) * event will relate * * @param string $url - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Subscriber + * @throws Exception\InvalidArgumentException */ public function setTopicUrl($url) { if (empty($url) || !is_string($url) || !Uri\UriFactory::factory($url)->isValid()) { - throw new Exception('Invalid parameter "url"' + throw new Exception\InvalidArgumentException('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .' URL'); } @@ -217,11 +219,12 @@ public function setTopicUrl($url) * event will relate * * @return string + * @throws Exception\RuntimeException */ public function getTopicUrl() { if (empty($this->_topicUrl)) { - throw new Exception('A valid Topic (RSS or Atom' + throw new Exception\RuntimeException('A valid Topic (RSS or Atom' . ' feed) URL MUST be set before attempting any operation'); } return $this->_topicUrl; @@ -231,13 +234,14 @@ public function getTopicUrl() * Set the number of seconds for which any subscription will remain valid * * @param int $seconds - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Subscriber + * @throws Exception\InvalidArgumentException */ public function setLeaseSeconds($seconds) { $seconds = intval($seconds); if ($seconds <= 0) { - throw new Exception('Expected lease seconds' + throw new Exception\InvalidArgumentException('Expected lease seconds' . ' must be an integer greater than zero'); } $this->_leaseSeconds = $seconds; @@ -259,12 +263,13 @@ public function getLeaseSeconds() * this Subscriber * * @param string $url - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Subscriber + * @throws Exception\InvalidArgumentException */ public function setCallbackUrl($url) { if (empty($url) || !is_string($url) || !Uri\UriFactory::factory($url)->isValid()) { - throw new Exception('Invalid parameter "url"' + throw new Exception\InvalidArgumentException('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); } @@ -277,11 +282,12 @@ public function setCallbackUrl($url) * this Subscriber * * @return string + * @throws Exception\RuntimeException */ public function getCallbackUrl() { if (empty($this->_callbackUrl)) { - throw new Exception('A valid Callback URL MUST be' + throw new Exception\RuntimeException('A valid Callback URL MUST be' . ' set before attempting any operation'); } return $this->_callbackUrl; @@ -296,14 +302,15 @@ public function getCallbackUrl() * order of occurance in the parameter list determines this preference. * * @param string $mode Should be 'sync' or 'async' - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Subscriber + * @throws Exception\InvalidArgumentException */ public function setPreferredVerificationMode($mode) { if ($mode !== PubSubHubbub::VERIFICATION_MODE_SYNC && $mode !== PubSubHubbub::VERIFICATION_MODE_ASYNC ) { - throw new Exception('Invalid preferred' + throw new Exception\InvalidArgumentException('Invalid preferred' . ' mode specified: "' . $mode . '" but should be one of' . ' Zend\Feed\Pubsubhubbub::VERIFICATION_MODE_SYNC or' . ' Zend\Feed\Pubsubhubbub::VERIFICATION_MODE_ASYNC'); @@ -326,12 +333,13 @@ public function getPreferredVerificationMode() * Add a Hub Server URL supported by Publisher * * @param string $url - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Subscriber + * @throws Exception\InvalidArgumentException */ public function addHubUrl($url) { if (empty($url) || !is_string($url) || !Uri\UriFactory::factory($url)->isValid()) { - throw new Exception('Invalid parameter "url"' + throw new Exception\InvalidArgumentException('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); } @@ -343,7 +351,7 @@ public function addHubUrl($url) * Add an array of Hub Server URLs supported by Publisher * * @param array $urls - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Subscriber */ public function addHubUrls(array $urls) { @@ -357,7 +365,7 @@ public function addHubUrls(array $urls) * Remove a Hub Server URL * * @param string $url - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Subscriber */ public function removeHubUrl($url) { @@ -385,12 +393,13 @@ public function getHubUrls() * * @param string $url * @param array $authentication - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Subscriber + * @throws Exception\InvalidArgumentException */ public function addAuthentication($url, array $authentication) { if (empty($url) || !is_string($url) || !Uri\UriFactory::factory($url)->isValid()) { - throw new Exception('Invalid parameter "url"' + throw new Exception\InvalidArgumentException('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); } @@ -402,7 +411,7 @@ public function addAuthentication($url, array $authentication) * Add authentication credentials for hub URLs * * @param array $authentications - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Subscriber */ public function addAuthentications(array $authentications) { @@ -426,7 +435,7 @@ public function getAuthentications() * Set flag indicating whether or not to use a path parameter * * @param bool $bool - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Subscriber */ public function usePathParameter($bool = true) { @@ -439,7 +448,8 @@ public function usePathParameter($bool = true) * * @param string $name * @param string|null $value - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Subscriber + * @throws Exception\InvalidArgumentException */ public function setParameter($name, $value = null) { @@ -448,7 +458,7 @@ public function setParameter($name, $value = null) return $this; } if (empty($name) || !is_string($name)) { - throw new Exception('Invalid parameter "name"' + throw new Exception\InvalidArgumentException('Invalid parameter "name"' . ' of "' . $name . '" must be a non-empty string'); } if ($value === null) { @@ -456,7 +466,7 @@ public function setParameter($name, $value = null) return $this; } if (empty($value) || (!is_string($value) && $value !== null)) { - throw new Exception('Invalid parameter "value"' + throw new Exception\InvalidArgumentException('Invalid parameter "value"' . ' of "' . $value . '" must be a non-empty string'); } $this->_parameters[$name] = $value; @@ -468,7 +478,7 @@ public function setParameter($name, $value = null) * * @param string $name * @param string|null $value - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Subscriber */ public function setParameters(array $parameters) { @@ -482,12 +492,13 @@ public function setParameters(array $parameters) * Remove an optional parameter for the (un)subscribe requests * * @param string $name - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @return Subscriber + * @throws Exception\InvalidArgumentException */ public function removeParameter($name) { if (empty($name) || !is_string($name)) { - throw new Exception('Invalid parameter "name"' + throw new Exception\InvalidArgumentException('Invalid parameter "name"' . ' of "' . $name . '" must be a non-empty string'); } if (array_key_exists($name, $this->_parameters)) { @@ -510,10 +521,10 @@ public function getParameters() * Sets an instance of Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence used to background * save any verification tokens associated with a subscription or other. * - * @param \Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence $storage - * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber + * @param Model\SubscriptionPersistenceInterface $storage + * @return Subscriber */ - public function setStorage(Model\SubscriptionPersistence $storage) + public function setStorage(Model\SubscriptionPersistenceInterface $storage) { $this->_storage = $storage; return $this; @@ -524,12 +535,13 @@ public function setStorage(Model\SubscriptionPersistence $storage) * to background save any verification tokens associated with a subscription * or other. * - * @return \Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence + * @return Model\SubscriptionPersistenceInterface + * @throws Exception\RuntimeException */ public function getStorage() { if ($this->_storage === null) { - throw new Exception('No storage vehicle ' + throw new Exception\RuntimeException('No storage vehicle ' . 'has been set.'); } return $this->_storage; @@ -601,13 +613,14 @@ public function getAsyncHubs() * * @param string $mode * @return void + * @throws Exception\RuntimeException */ protected function _doRequest($mode) { $client = $this->_getHttpClient(); $hubs = $this->getHubUrls(); if (empty($hubs)) { - throw new Exception('No Hub Server URLs' + throw new Exception\RuntimeException('No Hub Server URLs' . ' have been set so no subscriptions can be attempted'); } $this->_errors = array(); @@ -665,11 +678,12 @@ protected function _getHttpClient() * @param string $hubUrl * @param mode $hubUrl * @return string + * @throws Exception\InvalidArgumentException */ protected function _getRequestParameters($hubUrl, $mode) { if (!in_array($mode, array('subscribe', 'unsubscribe'))) { - throw new Exception('Invalid mode specified: "' + throw new Exception\InvalidArgumentException('Invalid mode specified: "' . $mode . '" which should have been "subscribe" or "unsubscribe"'); } diff --git a/src/PubSubHubbub/Subscriber/Callback.php b/src/PubSubHubbub/Subscriber/Callback.php index 55fbc321..e9ad49a6 100644 --- a/src/PubSubHubbub/Subscriber/Callback.php +++ b/src/PubSubHubbub/Subscriber/Callback.php @@ -29,7 +29,7 @@ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Callback extends PubSubHubbub\AbstractCallback +class Callback extends PubSubHubbub\AbstractCallbackInterface { /** * Contains the content of any feeds sent as updates to the Callback URL diff --git a/src/Reader/AbstractEntry.php b/src/Reader/AbstractEntry.php index 0f4d7288..49469eab 100644 --- a/src/Reader/AbstractEntry.php +++ b/src/Reader/AbstractEntry.php @@ -203,7 +203,7 @@ public function getExtension($name) * @param string $method * @param array $args * @return mixed - * @throws \Zend\Feed\Exception if no extensions implements the method + * @throws Exception\BadMethodCallException if no extensions implements the method */ public function __call($method, $args) { @@ -212,7 +212,7 @@ public function __call($method, $args) return call_user_func_array(array($extension, $method), $args); } } - throw new \Zend\Feed\Exception('Method: ' . $method + throw new Exception\BadMethodCallException('Method: ' . $method . 'does not exist and could not be located on a registered Extension'); } diff --git a/src/Reader/AbstractFeed.php b/src/Reader/AbstractFeed.php index 0e159fd6..39ba7b55 100644 --- a/src/Reader/AbstractFeed.php +++ b/src/Reader/AbstractFeed.php @@ -264,7 +264,7 @@ public function __call($method, $args) return call_user_func_array(array($extension, $method), $args); } } - throw new \Zend\Feed\Exception('Method: ' . $method + throw new Exception\BadMethodCallException('Method: ' . $method . 'does not exist and could not be located on a registered Extension'); } diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index 79295e63..3e4456f2 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -19,7 +19,9 @@ */ namespace Zend\Feed\Reader\Entry; -use Zend\Feed\Reader; + +use Zend\Feed\Reader, + DOMElement; /** * @category Zend @@ -27,7 +29,7 @@ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Atom extends AbstractEntry implements Reader\Entry +class Atom extends AbstractEntry implements EntryInterface { /** * XPath query @@ -44,7 +46,7 @@ class Atom extends AbstractEntry implements Reader\Entry * @param string $type * @return void */ - public function __construct(\DOMElement $entry, $entryKey, $type = null) + public function __construct(DOMElement $entry, $entryKey, $type = null) { parent::__construct($entry, $entryKey, $type); diff --git a/src/Reader/Entry.php b/src/Reader/Entry/EntryInterface.php similarity index 98% rename from src/Reader/Entry.php rename to src/Reader/Entry/EntryInterface.php index 28f26534..6f4db02a 100644 --- a/src/Reader/Entry.php +++ b/src/Reader/Entry/EntryInterface.php @@ -18,7 +18,7 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -namespace Zend\Feed\Reader; +namespace Zend\Feed\Reader\Entry; /** * @category Zend @@ -26,7 +26,7 @@ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface Entry +interface EntryInterface { /** * Get the specified author diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index cb5f1cb6..96ccb8ac 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -28,7 +28,7 @@ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Rss extends AbstractEntry implements Reader\Entry +class Rss extends AbstractEntry implements EntryInterface { /** diff --git a/src/Reader/Exception.php b/src/Reader/Exception.php deleted file mode 100644 index c55392af..00000000 --- a/src/Reader/Exception.php +++ /dev/null @@ -1,34 +0,0 @@ -_domDocument = $domDocument; - $this->_xpath = new \DOMXPath($this->_domDocument); + $this->_xpath = new DOMXPath($this->_domDocument); if ($type !== null) { $this->_data['type'] = $type; @@ -138,7 +140,7 @@ public function count() /** * Return the current entry * - * @return Zend_Feed_Reader_EntryInterface + * @return \Zend\Feed\Reader\Entry\EntryInterface */ public function current() { diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index c33409b7..7f45ca68 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -19,8 +19,9 @@ */ namespace Zend\Feed\Reader\Feed; -use Zend\Feed\Reader; -use Zend\Date; + +use Zend\Feed\Reader, + Zend\Date; /** * @category Zend diff --git a/src/Reader/Feed.php b/src/Reader/Feed/Feed.php similarity index 95% rename from src/Reader/Feed.php rename to src/Reader/Feed/Feed.php index 04e6e4d8..2a78d56a 100644 --- a/src/Reader/Feed.php +++ b/src/Reader/Feed/Feed.php @@ -18,7 +18,10 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -namespace Zend\Feed\Reader; +namespace Zend\Feed\Reader\Feed; + +use Iterator, + Countable; /** * @category Zend @@ -26,7 +29,7 @@ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface Feed extends \Iterator, \Countable +interface FeedInterface extends Iterator, Countable { /** * Get a single author diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 642b88c6..17973649 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -19,9 +19,11 @@ */ namespace Zend\Feed\Reader\Feed; -use Zend\Feed\Reader; -use Zend\Feed\Reader\Collection; -use Zend\Date; + +use Zend\Feed\Reader, + Zend\Feed\Reader\Collection, + Zend\Date, + DOMDocument; /** * @category Zend @@ -38,7 +40,7 @@ class Rss extends AbstractFeed * @param DOMDocument $dom * @param string $type */ - public function __construct(\DomDocument $dom, $type = null) + public function __construct(DOMDocument $dom, $type = null) { parent::__construct($dom, $type); diff --git a/src/Writer/AbstractFeed.php b/src/Writer/AbstractFeed.php index b11ed0d8..d7ad1bdf 100644 --- a/src/Writer/AbstractFeed.php +++ b/src/Writer/AbstractFeed.php @@ -756,11 +756,12 @@ public function __call($method, $args) foreach ($this->_extensions as $extension) { try { return call_user_func_array(array($extension, $method), $args); - } catch (Exception\InvalidMethodException $e) { + } catch (Exception\BadMethodCallException $e) { } } - throw new Exception('Method: ' . $method - . ' does not exist and could not be located on a registered Extension'); + throw new Exception\BadMethodCallException( + 'Method: ' . $method . ' does not exist and could not be located on a registered Extension' + ); } /** @@ -774,7 +775,7 @@ protected function _loadExtensions() $exts = $all['feed']; foreach ($exts as $ext) { if (!$className = Writer::getPluginLoader()->getClassName($ext)) { - throw new Exception(sprintf('Unable to load extension "%s"; could not resolve to class', $ext)); + throw new Exception\RuntimeException(sprintf('Unable to load extension "%s"; could not resolve to class', $ext)); } $this->_extensions[$ext] = new $className(); $this->_extensions[$ext]->setEncoding($this->getEncoding()); diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index 0f762b93..5bb7cc1e 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -19,9 +19,10 @@ */ namespace Zend\Feed\Writer; -use Zend\Feed\Writer\Exception; -use Zend\Uri; -use Zend\Date; + +use Zend\Feed\Writer\Exception, + Zend\Uri, + Zend\Date; /** * @category Zend @@ -129,7 +130,7 @@ public function addAuthors(array $authors) public function setEncoding($encoding) { if (empty($encoding) || !is_string($encoding)) { - throw new Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['encoding'] = $encoding; } @@ -151,11 +152,12 @@ public function getEncoding() * Set the copyright entry * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setCopyright($copyright) { if (empty($copyright) || !is_string($copyright)) { - throw new Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['copyright'] = $copyright; } @@ -164,11 +166,12 @@ public function setCopyright($copyright) * Set the entry's content * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setContent($content) { if (empty($content) || !is_string($content)) { - throw new Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['content'] = $content; } @@ -177,6 +180,7 @@ public function setContent($content) * Set the feed creation date * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setDateCreated($date = null) { @@ -188,7 +192,7 @@ public function setDateCreated($date = null) } elseif ($date instanceof Date\Date) { $zdate = $date; } else { - throw new Exception('Invalid Zend\Date\Date object or UNIX Timestamp passed as parameter'); + throw new Exception\InvalidArgumentException('Invalid Zend\Date\Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateCreated'] = $zdate; } @@ -197,6 +201,7 @@ public function setDateCreated($date = null) * Set the feed modification date * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setDateModified($date = null) { @@ -208,7 +213,7 @@ public function setDateModified($date = null) } elseif ($date instanceof Date\Date) { $zdate = $date; } else { - throw new Exception('Invalid Date\Date object or UNIX Timestamp passed as parameter'); + throw new Exception\InvalidArgumentException('Invalid Date\Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateModified'] = $zdate; } @@ -217,11 +222,12 @@ public function setDateModified($date = null) * Set the feed description * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setDescription($description) { if (empty($description) || !is_string($description)) { - throw new Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['description'] = $description; } @@ -230,11 +236,12 @@ public function setDescription($description) * Set the feed ID * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setId($id) { if (empty($id) || !is_string($id)) { - throw new Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['id'] = $id; } @@ -243,11 +250,12 @@ public function setId($id) * Set a link to the HTML source of this entry * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setLink($link) { if (empty($link) || !is_string($link) || !Uri\UriFactory::factory($link)->isValid()) { - throw new Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['link'] = $link; } @@ -256,11 +264,12 @@ public function setLink($link) * Set the number of comments associated with this entry * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setCommentCount($count) { if (empty($count) || !is_numeric($count) || (int) $count < 0) { - throw new Exception('Invalid parameter: "count" must be a non-empty integer number'); + throw new Exception\InvalidArgumentException('Invalid parameter: "count" must be a non-empty integer number'); } $this->_data['commentCount'] = (int) $count; } @@ -269,11 +278,12 @@ public function setCommentCount($count) * Set a link to a HTML page containing comments associated with this entry * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setCommentLink($link) { if (empty($link) || !is_string($link) || !Uri\UriFactory::factory($link)->isValid()) { - throw new Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); + throw new Exception\InvalidArgumentException('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); } $this->_data['commentLink'] = $link; } @@ -282,14 +292,15 @@ public function setCommentLink($link) * Set a link to an XML feed for any comments associated with this entry * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setCommentFeedLink(array $link) { if (!isset($link['uri']) || !is_string($link['uri']) || !Uri\UriFactory::factory($link['uri'])->isValid()) { - throw new Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); + throw new Exception\InvalidArgumentException('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); } if (!isset($link['type']) || !in_array($link['type'], array('atom', 'rss', 'rdf'))) { - throw new Exception('Invalid parameter: "type" must be one' + throw new Exception\InvalidArgumentException('Invalid parameter: "type" must be one' . ' of "atom", "rss" or "rdf"'); } if (!isset($this->_data['commentFeedLinks'])) { @@ -316,11 +327,12 @@ public function setCommentFeedLinks(array $links) * Set the feed title * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setTitle($title) { if (empty($title) || !is_string($title)) { - throw new Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['title'] = $title; } @@ -651,7 +663,7 @@ public function __call($method, $args) foreach ($this->_extensions as $extension) { try { return call_user_func_array(array($extension, $method), $args); - } catch (InvalidMethodException $e) { + } catch (BadMethodCallException $e) { } } throw new Exception('Method: ' . $method diff --git a/src/Writer/Exception.php b/src/Writer/Exception.php deleted file mode 100644 index 69bd7153..00000000 --- a/src/Writer/Exception.php +++ /dev/null @@ -1,34 +0,0 @@ - 0) { - throw new Writer\Exception('invalid parameter: "block" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "block" may only' . ' contain alphabetic characters'); } if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Writer\Exception('invalid parameter: "block" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "block" may only' . ' contain a maximum of 255 characters'); } $this->_data['block'] = $value; @@ -91,7 +92,7 @@ public function setItunesBlock($value) * Add feed authors * * @param array $values - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return Feed */ public function addItunesAuthors(array $values) { @@ -105,12 +106,13 @@ public function addItunesAuthors(array $values) * Add feed author * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return Feed + * @throws Writer\Exception\InvalidArgumentException */ public function addItunesAuthor($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Writer\Exception('invalid parameter: any "author" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: any "author" may only' . ' contain a maximum of 255 characters each'); } if (!isset($this->_data['authors'])) { @@ -124,7 +126,8 @@ public function addItunesAuthor($value) * Set feed categories * * @param array $values - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return Feed + * @throws Writer\Exception\InvalidArgumentException */ public function setItunesCategories(array $values) { @@ -134,19 +137,19 @@ public function setItunesCategories(array $values) foreach ($values as $key=>$value) { if (!is_array($value)) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Writer\Exception('invalid parameter: any "category" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: any "category" may only' . ' contain a maximum of 255 characters each'); } $this->_data['categories'][] = $value; } else { if (iconv_strlen($key, $this->getEncoding()) > 255) { - throw new Writer\Exception('invalid parameter: any "category" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: any "category" may only' . ' contain a maximum of 255 characters each'); } $this->_data['categories'][$key] = array(); foreach ($value as $val) { if (iconv_strlen($val, $this->getEncoding()) > 255) { - throw new Writer\Exception('invalid parameter: any "category" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: any "category" may only' . ' contain a maximum of 255 characters each'); } $this->_data['categories'][$key][] = $val; @@ -160,16 +163,17 @@ public function setItunesCategories(array $values) * Set feed image (icon) * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return Feed + * @throws Writer\Exception\InvalidArgumentException */ public function setItunesImage($value) { if (!Uri\UriFactory::factory($value)->isValid()) { - throw new Writer\Exception('invalid parameter: "image" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "image" may only' . ' be a valid URI/IRI'); } if (!in_array(substr($value, -3), array('jpg','png'))) { - throw new Writer\Exception('invalid parameter: "image" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "image" may only' . ' use file extension "jpg" or "png" which must be the last three' . ' characters of the URI (i.e. no query string or fragment)'); } @@ -181,7 +185,8 @@ public function setItunesImage($value) * Set feed cumulative duration * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return Feed + * @throws Writer\Exception\InvalidArgumentException */ public function setItunesDuration($value) { @@ -190,7 +195,7 @@ public function setItunesDuration($value) && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value) ) { - throw new Writer\Exception('invalid parameter: "duration" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "duration" may only' . ' be of a specified [[HH:]MM:]SS format'); } $this->_data['duration'] = $value; @@ -201,12 +206,13 @@ public function setItunesDuration($value) * Set "explicit" flag * * @param bool $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return Feed + * @throws Writer\Exception\InvalidArgumentException */ public function setItunesExplicit($value) { if (!in_array($value, array('yes','no','clean'))) { - throw new Writer\Exception('invalid parameter: "explicit" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "explicit" may only' . ' be one of "yes", "no" or "clean"'); } $this->_data['explicit'] = $value; @@ -217,17 +223,18 @@ public function setItunesExplicit($value) * Set feed keywords * * @param array $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return Feed + * @throws Writer\Exception\InvalidArgumentException */ public function setItunesKeywords(array $value) { if (count($value) > 12) { - throw new Writer\Exception('invalid parameter: "keywords" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "keywords" may only' . ' contain a maximum of 12 terms'); } $concat = implode(',', $value); if (iconv_strlen($concat, $this->getEncoding()) > 255) { - throw new Writer\Exception('invalid parameter: "keywords" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "keywords" may only' . ' have a concatenated length of 255 chars where terms are delimited' . ' by a comma'); } @@ -239,12 +246,13 @@ public function setItunesKeywords(array $value) * Set new feed URL * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return Feed + * @throws Writer\Exception\InvalidArgumentException */ public function setItunesNewFeedUrl($value) { if (!Uri\UriFactory::factory($value)->isValid()) { - throw new Writer\Exception('invalid parameter: "newFeedUrl" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "newFeedUrl" may only' . ' be a valid URI/IRI'); } $this->_data['newFeedUrl'] = $value; @@ -255,7 +263,7 @@ public function setItunesNewFeedUrl($value) * Add feed owners * * @param array $values - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return Feed */ public function addItunesOwners(array $values) { @@ -269,18 +277,19 @@ public function addItunesOwners(array $values) * Add feed owner * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return Feed + * @throws Writer\Exception\InvalidArgumentException */ public function addItunesOwner(array $value) { if (!isset($value['name']) || !isset($value['email'])) { - throw new Writer\Exception('invalid parameter: any "owner" must' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: any "owner" must' . ' be an array containing keys "name" and "email"'); } if (iconv_strlen($value['name'], $this->getEncoding()) > 255 || iconv_strlen($value['email'], $this->getEncoding()) > 255 ) { - throw new Writer\Exception('invalid parameter: any "owner" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: any "owner" may only' . ' contain a maximum of 255 characters each for "name" and "email"'); } if (!isset($this->_data['owners'])) { @@ -294,12 +303,13 @@ public function addItunesOwner(array $value) * Set feed subtitle * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return Feed + * @throws Writer\Exception\InvalidArgumentException */ public function setItunesSubtitle($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Writer\Exception('invalid parameter: "subtitle" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "subtitle" may only' . ' contain a maximum of 255 characters'); } $this->_data['subtitle'] = $value; @@ -310,12 +320,13 @@ public function setItunesSubtitle($value) * Set feed summary * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed + * @return Feed + * @throws Writer\Exception\InvalidArgumentException */ public function setItunesSummary($value) { if (iconv_strlen($value, $this->getEncoding()) > 4000) { - throw new Writer\Exception('invalid parameter: "summary" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "summary" may only' . ' contain a maximum of 4000 characters'); } $this->_data['summary'] = $value; @@ -328,6 +339,7 @@ public function setItunesSummary($value) * @param string $method * @param array $params * @return mixed + * @throws Writer\Exception\BadMethodCallException */ public function __call($method, array $params) { @@ -335,7 +347,7 @@ public function __call($method, array $params) if (!method_exists($this, 'setItunes' . ucfirst($point)) && !method_exists($this, 'addItunes' . ucfirst($point)) ) { - throw new Writer\Exception\InvalidMethodException( + throw new Writer\Exception\BadMethodCallException( 'invalid method: ' . $method ); } diff --git a/src/Writer/InvalidMethodException.php b/src/Writer/InvalidMethodException.php deleted file mode 100644 index d99e4c9b..00000000 --- a/src/Writer/InvalidMethodException.php +++ /dev/null @@ -1,35 +0,0 @@ - Date: Wed, 9 May 2012 21:24:02 +0200 Subject: [PATCH 202/238] removed duplicate --- src/Writer/Renderer/Renderer.php | 112 ------------------------------- 1 file changed, 112 deletions(-) delete mode 100644 src/Writer/Renderer/Renderer.php diff --git a/src/Writer/Renderer/Renderer.php b/src/Writer/Renderer/Renderer.php deleted file mode 100644 index fdfd3103..00000000 --- a/src/Writer/Renderer/Renderer.php +++ /dev/null @@ -1,112 +0,0 @@ - Date: Thu, 10 May 2012 22:06:55 +0200 Subject: [PATCH 203/238] [zen-27] Renamed interfaces in Zend\Feed --- .../AbstractCallbackInterface.php | 300 ++++++++++++++++++ src/PubSubHubbub/Subscriber.php | 3 +- src/Reader/AbstractEntry.php | 12 +- src/Reader/AbstractFeed.php | 10 +- src/Reader/Entry/AbstractEntry.php | 22 +- src/Reader/Entry/Atom.php | 11 +- src/Reader/Entry/EntryInterface.php | 4 +- src/Reader/Entry/Rss.php | 21 +- src/Reader/Exception/RuntimeException.php | 10 + src/Reader/Extension/AbstractEntry.php | 14 +- src/Reader/Extension/AbstractFeed.php | 8 +- src/Reader/Extension/Atom/Entry.php | 11 +- src/Reader/Extension/Atom/Feed.php | 7 +- src/Reader/Extension/DublinCore/Entry.php | 2 +- src/Reader/Extension/DublinCore/Feed.php | 11 +- src/Reader/Extension/Podcast/Feed.php | 5 +- src/Reader/Extension/Syndication/Feed.php | 4 +- src/Reader/Feed/AbstractFeed.php | 6 +- src/Reader/Feed/Atom.php | 7 +- src/Reader/Feed/Atom/Source.php | 13 +- src/Reader/Feed/FeedInterface.php | 126 ++++++++ src/Reader/Feed/Rss.php | 8 +- src/Reader/FeedSet.php | 3 +- src/Reader/Reader.php | 60 ++-- src/Writer/AbstractFeed.php | 64 ++-- src/Writer/Deleted.php | 37 ++- src/Writer/Entry.php | 24 +- src/Writer/Extension/AbstractRenderer.php | 25 +- src/Writer/Extension/Atom/Renderer/Feed.php | 9 +- .../Extension/Content/Renderer/Entry.php | 11 +- .../Extension/DublinCore/Renderer/Entry.php | 7 +- .../Extension/DublinCore/Renderer/Feed.php | 7 +- src/Writer/Extension/ITunes/Entry.php | 40 ++- .../Extension/ITunes/Renderer/Entry.php | 19 +- src/Writer/Extension/ITunes/Renderer/Feed.php | 71 +++-- src/Writer/Extension/Renderer.php | 9 +- src/Writer/Extension/Slash/Renderer/Entry.php | 7 +- .../Extension/Threading/Renderer/Entry.php | 11 +- .../WellFormedWeb/Renderer/Entry.php | 7 +- src/Writer/Feed.php | 9 +- src/Writer/FeedFactory.php | 6 +- src/Writer/Renderer/AbstractRenderer.php | 12 +- src/Writer/Renderer/Entry/Atom.php | 8 +- src/Writer/Renderer/Entry/Atom/Deleted.php | 11 +- src/Writer/Renderer/Entry/AtomDeleted.php | 23 +- src/Writer/Renderer/Entry/Rss.php | 80 ++--- src/Writer/Renderer/Feed/AbstractAtom.php | 107 ++++--- src/Writer/Renderer/Feed/Atom.php | 12 +- .../Renderer/Feed/Atom/AbstractAtom.php | 44 +-- src/Writer/Renderer/Feed/Atom/Source.php | 11 +- src/Writer/Renderer/Feed/AtomSource.php | 15 +- src/Writer/Renderer/Feed/Rss.php | 16 +- src/Writer/Writer.php | 4 +- test/PubSubHubbub/Model/SubscriptionTest.php | 2 +- test/PubSubHubbub/PublisherTest.php | 12 +- test/PubSubHubbub/Subscriber/CallbackTest.php | 10 +- test/PubSubHubbub/SubscriberTest.php | 32 +- test/ReaderTest.php | 2 +- test/Writer/DeletedTest.php | 12 +- test/Writer/EntryTest.php | 36 +-- test/Writer/Extension/ITunes/EntryTest.php | 22 +- test/Writer/Extension/ITunes/FeedTest.php | 30 +- test/Writer/FeedTest.php | 54 ++-- test/Writer/Renderer/Entry/AtomTest.php | 10 +- test/Writer/Renderer/Entry/RssTest.php | 12 +- test/Writer/Renderer/Feed/AtomTest.php | 8 +- test/Writer/Renderer/Feed/RssTest.php | 30 +- 67 files changed, 1125 insertions(+), 531 deletions(-) create mode 100644 src/PubSubHubbub/AbstractCallbackInterface.php create mode 100644 src/Reader/Exception/RuntimeException.php create mode 100644 src/Reader/Feed/FeedInterface.php diff --git a/src/PubSubHubbub/AbstractCallbackInterface.php b/src/PubSubHubbub/AbstractCallbackInterface.php new file mode 100644 index 00000000..2872590b --- /dev/null +++ b/src/PubSubHubbub/AbstractCallbackInterface.php @@ -0,0 +1,300 @@ +setConfig($config); + } + } + + /** + * Process any injected configuration options + * + * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance + * @return AbstractCallbackInterface + * @throws Exception\InvalidArgumentException + */ + public function setConfig($config) + { + if ($config instanceof Config) { + $config = $config->toArray(); + } elseif (!is_array($config)) { + throw new Exception\InvalidArgumentException('Array or Zend_Config object' + . 'expected, got ' . gettype($config)); + } + if (array_key_exists('storage', $config)) { + $this->setStorage($config['storage']); + } + return $this; + } + + /** + * Send the response, including all headers. + * If you wish to handle this via Zend_Controller, use the getter methods + * to retrieve any data needed to be set on your HTTP Response object, or + * simply give this object the HTTP Response instance to work with for you! + * + * @return void + */ + public function sendResponse() + { + $this->getHttpResponse()->sendResponse(); + } + + /** + * Sets an instance of Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence used + * to background save any verification tokens associated with a subscription + * or other. + * + * @param Model\SubscriptionPersistenceInterface $storage + * @return AbstractCallbackInterface + */ + public function setStorage(Model\SubscriptionPersistenceInterface $storage) + { + $this->_storage = $storage; + return $this; + } + + /** + * Gets an instance of Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence used + * to background save any verification tokens associated with a subscription + * or other. + * + * @return Model\SubscriptionPersistenceInterface + * @throws Exception\RuntimeException + */ + public function getStorage() + { + if ($this->_storage === null) { + throw new Exception\RuntimeException('No storage object has been' + . ' set that subclasses Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence'); + } + return $this->_storage; + } + + /** + * An instance of a class handling Http Responses. This is implemented in + * Zend\Feed\Pubsubhubbub\HttpResponse which shares an unenforced interface with + * (i.e. not inherited from) Zend\Controller\Response\Http. + * + * @param HttpResponse|\Zend\Controller\Response\Http $httpResponse + * @return AbstractCallbackInterface + * @throws Exception\InvalidArgumentException + */ + public function setHttpResponse($httpResponse) + { + if (!is_object($httpResponse) + || (!$httpResponse instanceof HttpResponse + && !$httpResponse instanceof \Zend\Controller\Response\Http) + ) { + throw new Exception\InvalidArgumentException('HTTP Response object must' + . ' implement one of Zend\Feed\Pubsubhubbub\HttpResponse or' + . ' Zend\Controller\Response\Http'); + } + $this->_httpResponse = $httpResponse; + return $this; + } + + /** + * An instance of a class handling Http Responses. This is implemented in + * Zend\Feed\Pubsubhubbub\HttpResponse which shares an unenforced interface with + * (i.e. not inherited from) Zend\Controller\Response\Http. + * + * @return HttpResponse|\Zend\Controller\Response\Http + */ + public function getHttpResponse() + { + if ($this->_httpResponse === null) { + $this->_httpResponse = new HttpResponse; + } + return $this->_httpResponse; + } + + /** + * Sets the number of Subscribers for which any updates are on behalf of. + * In other words, is this class serving one or more subscribers? How many? + * Defaults to 1 if left unchanged. + * + * @param string|int $count + * @return AbstractCallbackInterface + * @throws Exception\InvalidArgumentException + */ + public function setSubscriberCount($count) + { + $count = intval($count); + if ($count <= 0) { + throw new Exception\InvalidArgumentException('Subscriber count must be' + . ' greater than zero'); + } + $this->_subscriberCount = $count; + return $this; + } + + /** + * Gets the number of Subscribers for which any updates are on behalf of. + * In other words, is this class serving one or more subscribers? How many? + * + * @return int + */ + public function getSubscriberCount() + { + return $this->_subscriberCount; + } + + /** + * Attempt to detect the callback URL (specifically the path forward) + */ + protected function _detectCallbackUrl() + { + $callbackUrl = ''; + if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { + $callbackUrl = $_SERVER['HTTP_X_REWRITE_URL']; + } elseif (isset($_SERVER['REQUEST_URI'])) { + $callbackUrl = $_SERVER['REQUEST_URI']; + $scheme = 'http'; + if ($_SERVER['HTTPS'] == 'on') { + $scheme = 'https'; + } + $schemeAndHttpHost = $scheme . '://' . $this->_getHttpHost(); + if (strpos($callbackUrl, $schemeAndHttpHost) === 0) { + $callbackUrl = substr($callbackUrl, strlen($schemeAndHttpHost)); + } + } elseif (isset($_SERVER['ORIG_PATH_INFO'])) { + $callbackUrl= $_SERVER['ORIG_PATH_INFO']; + if (!empty($_SERVER['QUERY_STRING'])) { + $callbackUrl .= '?' . $_SERVER['QUERY_STRING']; + } + } + return $callbackUrl; + } + + /** + * Get the HTTP host + * + * @return string + */ + protected function _getHttpHost() + { + if (!empty($_SERVER['HTTP_HOST'])) { + return $_SERVER['HTTP_HOST']; + } + $scheme = 'http'; + if ($_SERVER['HTTPS'] == 'on') { + $scheme = 'https'; + } + $name = $_SERVER['SERVER_NAME']; + $port = $_SERVER['SERVER_PORT']; + if (($scheme == 'http' && $port == 80) + || ($scheme == 'https' && $port == 443) + ) { + return $name; + } else { + return $name . ':' . $port; + } + } + + /** + * Retrieve a Header value from either $_SERVER or Apache + * + * @param string $header + */ + protected function _getHeader($header) + { + $temp = strtoupper(str_replace('-', '_', $header)); + if (!empty($_SERVER[$temp])) { + return $_SERVER[$temp]; + } + $temp = 'HTTP_' . strtoupper(str_replace('-', '_', $header)); + if (!empty($_SERVER[$temp])) { + return $_SERVER[$temp]; + } + if (function_exists('apache_request_headers')) { + $headers = apache_request_headers(); + if (!empty($headers[$header])) { + return $headers[$header]; + } + } + return false; + } + + /** + * Return the raw body of the request + * + * @return string|false Raw body, or false if not present + */ + protected function _getRawBody() + { + $body = file_get_contents('php://input'); + if (strlen(trim($body)) == 0 && isset($GLOBALS['HTTP_RAW_POST_DATA'])) { + $body = $GLOBALS['HTTP_RAW_POST_DATA']; + } + if (strlen(trim($body)) > 0) { + return $body; + } + return false; + } +} diff --git a/src/PubSubHubbub/Subscriber.php b/src/PubSubHubbub/Subscriber.php index 934191d3..5a0c5193 100644 --- a/src/PubSubHubbub/Subscriber.php +++ b/src/PubSubHubbub/Subscriber.php @@ -676,7 +676,7 @@ protected function _getHttpClient() * client's POST body that are specific to the current Hub Server URL * * @param string $hubUrl - * @param mode $hubUrl + * @param string $mode * @return string * @throws Exception\InvalidArgumentException */ @@ -766,7 +766,6 @@ protected function _getRequestParameters($hubUrl, $mode) * requests to a Hub Server. Follows no particular method, which means * it might be improved/changed in future. * - * @param string $hubUrl The Hub Server URL for which this token will apply * @return string */ protected function _generateVerifyToken() diff --git a/src/Reader/AbstractEntry.php b/src/Reader/AbstractEntry.php index 49469eab..d95755cb 100644 --- a/src/Reader/AbstractEntry.php +++ b/src/Reader/AbstractEntry.php @@ -20,6 +20,10 @@ namespace Zend\Feed\Reader; +use DOMElement, + DOMDocument, + DOMXPath; + /** * @category Zend * @package Zend_Feed_Reader @@ -78,7 +82,7 @@ abstract class AbstractEntry * @param string $type * @return void */ - public function __construct(\DOMElement $entry, $entryKey, $type = null) + public function __construct(DOMElement $entry, $entryKey, $type = null) { $this->_entry = $entry; $this->_entryKey = $entryKey; @@ -132,7 +136,7 @@ public function getEncoding() */ public function saveXml() { - $dom = new \DOMDocument('1.0', $this->getEncoding()); + $dom = new DOMDocument('1.0', $this->getEncoding()); $entry = $dom->importNode($this->getElement(), true); $dom->appendChild($entry); return $dom->saveXml(); @@ -156,7 +160,7 @@ public function getType() public function getXpath() { if (!$this->_xpath) { - $this->setXpath(new \DOMXPath($this->getDomDocument())); + $this->setXpath(new DOMXPath($this->getDomDocument())); } return $this->_xpath; } @@ -167,7 +171,7 @@ public function getXpath() * @param DOMXPath $xpath * @return Zend\Feed\Reader\AbstractEntry */ - public function setXpath(\DOMXPath $xpath) + public function setXpath(DOMXPath $xpath) { $this->_xpath = $xpath; return $this; diff --git a/src/Reader/AbstractFeed.php b/src/Reader/AbstractFeed.php index 39ba7b55..6623ee58 100644 --- a/src/Reader/AbstractFeed.php +++ b/src/Reader/AbstractFeed.php @@ -20,13 +20,17 @@ namespace Zend\Feed\Reader; +use DOMDocument, + DOMElement, + DOMXPath; + /** * @category Zend * @package Zend_Feed_Reader * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class AbstractFeed implements Feed +abstract class AbstractFeed implements Feed\FeedInterface { /** * Parsed feed data @@ -83,10 +87,10 @@ abstract class AbstractFeed implements Feed * @param DomDocument The DOM object for the feed's XML * @param string $type Feed type */ - public function __construct(\DomDocument $domDocument, $type = null) + public function __construct(DOMDocument $domDocument, $type = null) { $this->_domDocument = $domDocument; - $this->_xpath = new \DOMXPath($this->_domDocument); + $this->_xpath = new DOMXPath($this->_domDocument); if ($type !== null) { $this->_data['type'] = $type; diff --git a/src/Reader/Entry/AbstractEntry.php b/src/Reader/Entry/AbstractEntry.php index 6bd9000c..bf27e6c6 100644 --- a/src/Reader/Entry/AbstractEntry.php +++ b/src/Reader/Entry/AbstractEntry.php @@ -19,8 +19,12 @@ */ namespace Zend\Feed\Reader\Entry; -use Zend\Feed\Reader; -use Zend\Feed\Reader\Exception; + +use Zend\Feed\Reader, + Zend\Feed\Reader\Exception, + DOMElement, + DOMDocument, + DOMXPath; /** * @category Zend @@ -40,7 +44,7 @@ abstract class AbstractEntry /** * DOM document object * - * @var \DOMDocument + * @var DOMDocument */ protected $_domDocument = null; @@ -80,7 +84,7 @@ abstract class AbstractEntry * @param string $type * @return void */ - public function __construct(\DOMElement $entry, $entryKey, $type = null) + public function __construct(DOMElement $entry, $entryKey, $type = null) { $this->_entry = $entry; $this->_entryKey = $entryKey; @@ -134,7 +138,7 @@ public function getEncoding() */ public function saveXml() { - $dom = new \DOMDocument('1.0', $this->getEncoding()); + $dom = new DOMDocument('1.0', $this->getEncoding()); $entry = $dom->importNode($this->getElement(), true); $dom->appendChild($entry); return $dom->saveXml(); @@ -158,7 +162,7 @@ public function getType() public function getXpath() { if (!$this->_xpath) { - $this->setXpath(new \DOMXPath($this->getDomDocument())); + $this->setXpath(new DOMXPath($this->getDomDocument())); } return $this->_xpath; } @@ -169,7 +173,7 @@ public function getXpath() * @param DOMXPath $xpath * @return Zend_Feed_Reader_Entry_EntryAbstract */ - public function setXpath(\DOMXPath $xpath) + public function setXpath(DOMXPath $xpath) { $this->_xpath = $xpath; return $this; @@ -205,7 +209,7 @@ public function getExtension($name) * @param string $method * @param array $args * @return mixed - * @throws Zend_Feed_Exception if no extensions implements the method + * @throws Exception\RuntimeException if no extensions implements the method */ public function __call($method, $args) { @@ -214,7 +218,7 @@ public function __call($method, $args) return call_user_func_array(array($extension, $method), $args); } } - throw new Exception('Method: ' . $method + throw new Exception\RuntimeException('Method: ' . $method . ' does not exist and could not be located on a registered Extension'); } diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index 3e4456f2..3dbc0a07 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -21,7 +21,8 @@ namespace Zend\Feed\Reader\Entry; use Zend\Feed\Reader, - DOMElement; + DOMElement, + DOMXPath; /** * @category Zend @@ -332,7 +333,7 @@ public function getCommentFeedLink() /** * Get category data as a Reader\Reader_Collection_Category object * - * @return Reader\Reader_Collection_Category + * @return Reader\Collection\Category */ public function getCategories() { @@ -354,7 +355,7 @@ public function getCategories() /** * Get source feed metadata from the entry * - * @return Reader\Reader_Feed_Atom_Source|null + * @return Reader\Feed\Atom\Source|null */ public function getSource() { @@ -372,9 +373,9 @@ public function getSource() /** * Set the XPath query (incl. on all Extensions) * - * @param \DOMXPath $xpath + * @param DOMXPath $xpath */ - public function setXpath(\DOMXPath $xpath) + public function setXpath(DOMXPath $xpath) { parent::setXpath($xpath); foreach ($this->_extensions as $extension) { diff --git a/src/Reader/Entry/EntryInterface.php b/src/Reader/Entry/EntryInterface.php index 6f4db02a..0e88d26d 100644 --- a/src/Reader/Entry/EntryInterface.php +++ b/src/Reader/Entry/EntryInterface.php @@ -20,6 +20,8 @@ namespace Zend\Feed\Reader\Entry; +use Zend\Feed\Reader\Collection\Category; + /** * @category Zend * @package Zend_Feed_Reader @@ -138,7 +140,7 @@ public function getCommentFeedLink(); /** * Get all categories * - * @return Zend_Feed_Reader_Collection_Category + * @return Category */ public function getCategories(); } diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index 96ccb8ac..beedac08 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -19,8 +19,12 @@ */ namespace Zend\Feed\Reader\Entry; -use Zend\Feed\Reader; -use Zend\Date; + +use Zend\Feed\Reader, + Zend\Date, + Zend\Feed\Reader\Exception, + DOMElement, + DOMXPath; /** * @category Zend @@ -48,12 +52,12 @@ class Rss extends AbstractEntry implements EntryInterface /** * Constructor * - * @param Zend_Feed_Entry_Abstract $entry + * @param DOMElement $entry * @param string $entryKey * @param string $type * @return void */ - public function __construct(\DOMElement $entry, $entryKey, $type = null) + public function __construct(DOMElement $entry, $entryKey, $type = null) { parent::__construct($entry, $entryKey, $type); $this->_xpathQueryRss = '//item[' . ($this->_entryKey+1) . ']'; @@ -226,8 +230,7 @@ public function getDateModified() break; } catch (Date\Exception $e) { if ($standard == Date\Date::DATES) { - require_once 'Zend/Feed/Exception.php'; - throw new Exception( + throw new Exception\RuntimeException( 'Could not load date due to unrecognised' .' format (should follow RFC 822 or 2822):' . $e->getMessage(), @@ -424,7 +427,7 @@ public function getLinks() /** * Get all categories * - * @return Reader\Reader_Collection_Category + * @return Reader\Collection\Category */ public function getCategories() { @@ -604,9 +607,9 @@ public function getCommentFeedLink() /** * Set the XPath query (incl. on all Extensions) * - * @param \DOMXPath $xpath + * @param DOMXPath $xpath */ - public function setXpath(\DOMXPath $xpath) + public function setXpath(DOMXPath $xpath) { parent::setXpath($xpath); foreach ($this->_extensions as $extension) { diff --git a/src/Reader/Exception/RuntimeException.php b/src/Reader/Exception/RuntimeException.php new file mode 100644 index 00000000..c1aab932 --- /dev/null +++ b/src/Reader/Exception/RuntimeException.php @@ -0,0 +1,10 @@ +_entry = $entry; $this->_entryKey = $entryKey; @@ -107,7 +111,7 @@ public function __construct(\DOMElement $entry, $entryKey, $type = null) /** * Get the DOM * - * @return \DOMDocument + * @return DOMDocument */ public function getDomDocument() { @@ -141,7 +145,7 @@ public function getType() * @param DOMXPath $xpath * @return Reader\Reader_Extension_EntryAbstract */ - public function setXpath(\DOMXPath $xpath) + public function setXpath(DOMXPath $xpath) { $this->_xpath = $xpath; $this->_registerNamespaces(); @@ -156,7 +160,7 @@ public function setXpath(\DOMXPath $xpath) public function getXpath() { if (!$this->_xpath) { - $this->setXpath(new \DOMXPath($this->getDomDocument())); + $this->setXpath(new DOMXPath($this->getDomDocument())); } return $this->_xpath; } diff --git a/src/Reader/Extension/AbstractFeed.php b/src/Reader/Extension/AbstractFeed.php index 9752c12a..c44a5669 100644 --- a/src/Reader/Extension/AbstractFeed.php +++ b/src/Reader/Extension/AbstractFeed.php @@ -67,7 +67,7 @@ abstract class AbstractFeed * @param string $type Feed type * @return void */ - public function __construct(\DomDocument $dom, $type = null, \DOMXPath $xpath = null) + public function __construct(DOMDocument $dom, $type = null, DOMXPath $xpath = null) { $this->_domDocument = $dom; @@ -80,7 +80,7 @@ public function __construct(\DomDocument $dom, $type = null, \DOMXPath $xpath = if ($xpath !== null) { $this->_xpath = $xpath; } else { - $this->_xpath = new \DOMXPath($this->_domDocument); + $this->_xpath = new DOMXPath($this->_domDocument); } $this->_registerNamespaces(); @@ -134,7 +134,7 @@ public function toArray() // untested * @param DOMXPath $xpath * @return Reader\Reader_Extension_EntryAbstract */ - public function setXpath(\DOMXPath $xpath) + public function setXpath(DOMXPath $xpath) { $this->_xpath = $xpath; $this->_registerNamespaces(); @@ -164,7 +164,7 @@ public function getXpathPrefix() /** * Set the XPath prefix * - * @return Reader\Reader_Feed_Atom + * @return void */ public function setXpathPrefix($prefix) { diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index afd633b3..42667b86 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -145,9 +145,13 @@ public function getContent() return $this->_data['content']; } - + /** * Parse out XHTML to remove the namespacing + * + * @param $xhtml + * @param $prefix + * @return mixed */ protected function _collectXhtml($xhtml, $prefix) { @@ -490,7 +494,7 @@ public function getCommentFeedLink($type = 'atom') /** * Get all categories * - * @return Reader\Reader_Collection_Category + * @return Collection\Category */ public function getCategories() { @@ -556,6 +560,9 @@ public function getSource() /** * 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. + * + * @param $link + * @return string */ protected function _absolutiseUri($link) { diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index d26f0651..10f2b860 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -24,7 +24,8 @@ Zend\Feed\Reader, Zend\Feed\Reader\Collection, Zend\Feed\Reader\Extension, - Zend\Uri; + Zend\Uri, + DOMElement; /** * @category Zend @@ -424,7 +425,7 @@ public function getTitle() /** * Get all categories * - * @return Reader\Reader_Collection_Category + * @return Collection\Category */ public function getCategories() { @@ -468,7 +469,7 @@ public function getCategories() * @param DOMElement $element * @return string */ - protected function _getAuthor(\DOMElement $element) + protected function _getAuthor(DOMElement $element) { $author = array(); diff --git a/src/Reader/Extension/DublinCore/Entry.php b/src/Reader/Extension/DublinCore/Entry.php index 8b796343..452f55a1 100644 --- a/src/Reader/Extension/DublinCore/Entry.php +++ b/src/Reader/Extension/DublinCore/Entry.php @@ -97,7 +97,7 @@ public function getAuthors() /** * Get categories (subjects under DC) * - * @return Reader\Reader_Collection_Category + * @return Collection\Category */ public function getCategories() { diff --git a/src/Reader/Extension/DublinCore/Feed.php b/src/Reader/Extension/DublinCore/Feed.php index 6bb567a4..57f9bf61 100644 --- a/src/Reader/Extension/DublinCore/Feed.php +++ b/src/Reader/Extension/DublinCore/Feed.php @@ -19,10 +19,11 @@ */ namespace Zend\Feed\Reader\Extension\DublinCore; -use Zend\Feed\Reader; -use Zend\Feed\Reader\Collection; -use Zend\Feed\Reader\Extension; -use Zend\Date; + +use Zend\Feed\Reader, + Zend\Feed\Reader\Collection, + Zend\Feed\Reader\Extension, + Zend\Date; /** * @category Zend @@ -254,7 +255,7 @@ public function getDate() /** * Get categories (subjects under DC) * - * @return Reader\Reader_Collection_Category + * @return Collection\Category */ public function getCategories() { diff --git a/src/Reader/Extension/Podcast/Feed.php b/src/Reader/Extension/Podcast/Feed.php index 71fd4145..c5b81f36 100644 --- a/src/Reader/Extension/Podcast/Feed.php +++ b/src/Reader/Extension/Podcast/Feed.php @@ -20,7 +20,8 @@ namespace Zend\Feed\Reader\Extension\Podcast; -use Zend\Feed\Reader\Extension; +use Zend\Feed\Reader\Extension, + DOMText; /** * @category Zend @@ -97,7 +98,7 @@ public function getItunesCategories() $children = array(); foreach ($node->childNodes as $childNode) { - if (!($childNode instanceof \DOMText)) { + if (!($childNode instanceof DOMText)) { $children[$childNode->getAttribute('text')] = null; } } diff --git a/src/Reader/Extension/Syndication/Feed.php b/src/Reader/Extension/Syndication/Feed.php index cba1092a..7f2b7ae1 100644 --- a/src/Reader/Extension/Syndication/Feed.php +++ b/src/Reader/Extension/Syndication/Feed.php @@ -34,7 +34,9 @@ class Feed extends \Zend\Feed\Reader\Extension\AbstractFeed { /** * Get update period + * * @return string + * @throws Reader\Exception\InvalidArgumentException */ public function getUpdatePeriod() { @@ -54,7 +56,7 @@ public function getUpdatePeriod() case 'yearly': return $period; default: - throw new Reader\Exception("Feed specified invalid update period: '$period'." + throw new Reader\Exception\InvalidArgumentException("Feed specified invalid update period: '$period'." . " Must be one of hourly, daily, weekly or yearly" ); } diff --git a/src/Reader/Feed/AbstractFeed.php b/src/Reader/Feed/AbstractFeed.php index 79a8a479..500800b2 100644 --- a/src/Reader/Feed/AbstractFeed.php +++ b/src/Reader/Feed/AbstractFeed.php @@ -269,7 +269,7 @@ public function __call($method, $args) return call_user_func_array(array($extension, $method), $args); } } - throw new Exception('Method: ' . $method + throw new Exception\BadMethodCallException('Method: ' . $method . 'does not exist and could not be located on a registered Extension'); } @@ -277,7 +277,7 @@ public function __call($method, $args) * Return an Extension object with the matching name (postfixed with _Feed) * * @param string $name - * @return Zend_Feed_Reader_Extension_FeedAbstract + * @return \Zend\Feed\Reader\Extension\AbstractFeed */ public function getExtension($name) { @@ -299,7 +299,7 @@ protected function _loadExtensions() continue; } if (!class_exists($className)) { - throw new Exception(sprintf('Unable to load extension "%s"; cannot find class', $extension)); + throw new Exception\RuntimeException(sprintf('Unable to load extension "%s"; cannot find class', $extension)); } $this->_extensions[$extension] = new $className( $this->getDomDocument(), $this->_data['type'], $this->_xpath diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index 7f45ca68..b1336381 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -21,7 +21,8 @@ namespace Zend\Feed\Reader\Feed; use Zend\Feed\Reader, - Zend\Date; + Zend\Date, + DOMDocument; /** * @category Zend @@ -38,7 +39,7 @@ class Atom extends AbstractFeed * @param DOMDocument $dom * @param string $type */ - public function __construct(\DOMDocument $dom, $type = null) + public function __construct(DOMDocument $dom, $type = null) { parent::__construct($dom, $type); $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\\Feed'); @@ -360,7 +361,7 @@ public function getHubs() /** * Get all categories * - * @return Reader_Collection_Category + * @return Reader\Collection\Category */ public function getCategories() { diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php index fcd808c5..3731f031 100644 --- a/src/Reader/Feed/Atom/Source.php +++ b/src/Reader/Feed/Atom/Source.php @@ -19,9 +19,12 @@ */ namespace Zend\Feed\Reader\Feed\Atom; -use Zend\Feed\Reader; -use Zend\Feed\Reader\Feed; -use Zend\Date; + +use Zend\Feed\Reader, + Zend\Feed\Reader\Feed, + Zend\Date, + DOMElement, + DOMXPath; /** * @category Zend @@ -41,10 +44,10 @@ class Source extends Feed\Atom * @param string $xpathPrefix Passed from parent Entry object * @param string $type Nearly always Atom 1.0 */ - public function __construct(\DOMElement $source, $xpathPrefix, $type = Reader\Reader::TYPE_ATOM_10) + public function __construct(DOMElement $source, $xpathPrefix, $type = Reader\Reader::TYPE_ATOM_10) { $this->_domDocument = $source->ownerDocument; - $this->_xpath = new \DOMXPath($this->_domDocument); + $this->_xpath = new DOMXPath($this->_domDocument); $this->_data['type'] = $type; $this->_registerNamespaces(); $this->_loadExtensions(); diff --git a/src/Reader/Feed/FeedInterface.php b/src/Reader/Feed/FeedInterface.php new file mode 100644 index 00000000..93e38f22 --- /dev/null +++ b/src/Reader/Feed/FeedInterface.php @@ -0,0 +1,126 @@ +getMessage(), @@ -281,7 +283,7 @@ public function getLastBuildDate() break; } catch (Date\Exception $e) { if ($standard == Date\Date::DATES) { - throw new Exception( + throw new Exception\RuntimeException( 'Could not load date due to unrecognised' .' format (should follow RFC 822 or 2822):' . $e->getMessage(), @@ -635,7 +637,7 @@ public function getHubs() /** * Get all categories * - * @return Reader_Collection_Category + * @return Reader\Collection\Category */ public function getCategories() { diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index 9d326266..cdc51bb8 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -21,6 +21,7 @@ namespace Zend\Feed\Reader; use ArrayObject, + DOMNodeList, Zend\Uri; /** @@ -54,7 +55,7 @@ class FeedSet extends ArrayObject * @param string $uri * @return void */ - public function addLinks(\DOMNodeList $links, $uri) + public function addLinks(DOMNodeList $links, $uri) { foreach ($links as $link) { if (strtolower($link->getAttribute('rel')) !== 'alternate' diff --git a/src/Reader/Reader.php b/src/Reader/Reader.php index 1df40247..56f62378 100644 --- a/src/Reader/Reader.php +++ b/src/Reader/Reader.php @@ -23,7 +23,9 @@ use Zend\Cache\Storage\Adapter\AdapterInterface as CacheAdapter, Zend\Http, Zend\Loader, - Zend\Stdlib\ErrorHandler; + Zend\Stdlib\ErrorHandler, + DOMDocument, + DOMXPath; /** * @category Zend @@ -201,7 +203,8 @@ public static function useHttpConditionalGet($bool = true) * @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_FeedInterface + * @return Reader + * @throws Exception\ExceptionInterface */ public static function import($uri, $etag = null, $lastModified = null) { @@ -233,7 +236,7 @@ public static function import($uri, $etag = null, $lastModified = null) } $response = $client->send(); if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 304) { - throw new Exception('Feed failed to load, got response code ' . $response->getStatusCode()); + throw new Exception\RuntimeException('Feed failed to load, got response code ' . $response->getStatusCode()); } if ($response->getStatusCode() == 304) { $responseXml = $data; @@ -255,7 +258,7 @@ public static function import($uri, $etag = null, $lastModified = null) } $response = $client->send(); if ((int)$response->getStatusCode() !== 200) { - throw new Exception('Feed failed to load, got response code ' . $response->getStatusCode()); + throw new Exception\RuntimeException('Feed failed to load, got response code ' . $response->getStatusCode()); } $responseXml = $response->getBody(); $cache->setItem($cacheId, $responseXml); @@ -263,7 +266,7 @@ public static function import($uri, $etag = null, $lastModified = null) } else { $response = $client->send(); if ((int)$response->getStatusCode() !== 200) { - throw new Exception('Feed failed to load, got response code ' . $response->getStatusCode()); + throw new Exception\RuntimeException('Feed failed to load, got response code ' . $response->getStatusCode()); } $reader = self::importString($response->getBody()); $reader->setOriginalSourceUri($uri); @@ -275,12 +278,13 @@ public static function import($uri, $etag = null, $lastModified = null) * Import a feed from a string * * @param string $string - * @return \Zend\Feed\Reader\Feed + * @return Feed\FeedInterface + * @throws Exception\RuntimeException */ public static function importString($string) { $libxml_errflag = libxml_use_internal_errors(true); - $dom = new \DOMDocument; + $dom = new DOMDocument; $status = $dom->loadXML($string); libxml_use_internal_errors($libxml_errflag); @@ -292,7 +296,7 @@ public static function importString($string) } else { $errormsg = "DOMDocument cannot parse XML: Please check the XML document's validity"; } - throw new Exception($errormsg); + throw new Exception\RuntimeException($errormsg); } $type = self::detectType($dom); @@ -306,7 +310,7 @@ public static function importString($string) } elseif (substr($type, 0, 4) == 'atom') { $reader = new Feed\Atom($dom, $type); } else { - throw new Exception('The URI used does not point to a ' + throw new Exception\RuntimeException('The URI used does not point to a ' . 'valid Atom, RSS or RDF feed that Zend_Feed_Reader can parse.'); } return $reader; @@ -316,8 +320,8 @@ public static function importString($string) * Imports a feed from a file located at $filename. * * @param string $filename - * @throws Zend_Feed_Exception - * @return Zend_Feed_Reader_FeedInterface + * @throws Exception\RuntimeException + * @return Feed\FeedInterface */ public static function importFile($filename) { @@ -325,22 +329,29 @@ public static function importFile($filename) $feed = file_get_contents($filename); $err = ErrorHandler::stop(); if ($feed === false) { - throw new Exception("File '{$filename}' could not be loaded", 0, $err); + throw new Exception\RuntimeException("File '{$filename}' could not be loaded", 0, $err); } return self::importString($feed); } + /** + * Find feed links + * + * @param $uri + * @return FeedSet + * @throws Exception\RuntimeException + */ public static function findFeedLinks($uri) { $client = self::getHttpClient(); $client->setUri($uri); $response = $client->send(); if ($response->getStatusCode() !== 200) { - throw new Exception("Failed to access $uri, got response code " . $response->getStatusCode()); + throw new Exception\RuntimeException("Failed to access $uri, got response code " . $response->getStatusCode()); } $responseHtml = $response->getBody(); $libxml_errflag = libxml_use_internal_errors(true); - $dom = new \DOMDocument; + $dom = new DOMDocument; $status = $dom->loadHTML($responseHtml); libxml_use_internal_errors($libxml_errflag); if (!$status) { @@ -351,7 +362,7 @@ public static function findFeedLinks($uri) } else { $errormsg = "DOMDocument cannot parse HTML: Please check the XML document's validity"; } - throw new Exception($errormsg); + throw new Exception\RuntimeException($errormsg); } $feedSet = new FeedSet; $links = $dom->getElementsByTagName('link'); @@ -362,18 +373,19 @@ public static function findFeedLinks($uri) /** * Detect the feed type of the provided feed * - * @param Zend_Feed_Abstract|DOMDocument|string $feed + * @param Feed\AbstractFeed|DOMDocument|string $feed * @return string + * @throws Exception\ExceptionInterface */ public static function detectType($feed, $specOnly = false) { - if ($feed instanceof Feed) { + if ($feed instanceof Feed\AbstractFeed) { $dom = $feed->getDomDocument(); - } elseif($feed instanceof \DOMDocument) { + } elseif($feed instanceof DOMDocument) { $dom = $feed; } elseif(is_string($feed) && !empty($feed)) { @ini_set('track_errors', 1); - $dom = new \DOMDocument; + $dom = new DOMDocument; $status = @$dom->loadXML($feed); @ini_restore('track_errors'); if (!$status) { @@ -384,13 +396,13 @@ public static function detectType($feed, $specOnly = false) $php_errormsg = '(error message not available)'; } } - throw new Exception("DOMDocument cannot parse XML: $php_errormsg"); + throw new Exception\RuntimeException("DOMDocument cannot parse XML: $php_errormsg"); } } else { - throw new Exception('Invalid object/scalar provided: must' + throw new Exception\InvalidArgumentException('Invalid object/scalar provided: must' . ' be of type Zend\Feed\Reader\Feed, DomDocument or string'); } - $xpath = new \DOMXPath($dom); + $xpath = new DOMXPath($dom); if ($xpath->query('/rss')->length) { $type = self::TYPE_RSS_ANY; @@ -540,7 +552,7 @@ public static function addPrefixPaths(array $spec) * * @param string $name * @return void - * @throws \Zend\Feed\Exception if unable to resolve Extension class + * @throws Exception\RuntimeException if unable to resolve Extension class */ public static function registerExtension($name) { @@ -555,7 +567,7 @@ public static function registerExtension($name) $loader->load($feedName); $loader->load($entryName); if (!$loader->isLoaded($feedName) && !$loader->isLoaded($entryName)) { - throw new \Zend\Feed\Exception('Could not load extension: ' . $name + throw new Exception\RuntimeException('Could not load extension: ' . $name . ' using Plugin Loader. Check prefix paths are configured and extension exists.'); } if ($loader->isLoaded($feedName)) { diff --git a/src/Writer/AbstractFeed.php b/src/Writer/AbstractFeed.php index d7ad1bdf..48c43351 100644 --- a/src/Writer/AbstractFeed.php +++ b/src/Writer/AbstractFeed.php @@ -118,11 +118,12 @@ public function addAuthors(array $authors) * Set the copyright entry * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setCopyright($copyright) { if (empty($copyright) || !is_string($copyright)) { - throw new Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['copyright'] = $copyright; } @@ -131,6 +132,7 @@ public function setCopyright($copyright) * Set the feed creation date * * @param null|integer|Date\Date + * @throws Exception\InvalidArgumentException */ public function setDateCreated($date = null) { @@ -142,7 +144,7 @@ public function setDateCreated($date = null) } elseif ($date instanceof Date\Date) { $zdate = $date; } else { - throw new Exception('Invalid Date\Date object or UNIX Timestamp passed as parameter'); + throw new Exception\InvalidArgumentException('Invalid Date\Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateCreated'] = $zdate; } @@ -151,6 +153,7 @@ public function setDateCreated($date = null) * Set the feed modification date * * @param null|integer|Date\Date + * @throws Exception\InvalidArgumentException */ public function setDateModified($date = null) { @@ -162,7 +165,7 @@ public function setDateModified($date = null) } elseif ($date instanceof Date\Date) { $zdate = $date; } else { - throw new Exception('Invalid Date\Date object or UNIX Timestamp passed as parameter'); + throw new Exception\InvalidArgumentException('Invalid Date\Date object or UNIX Timestamp passed as parameter'); } $this->_data['dateModified'] = $zdate; } @@ -171,6 +174,7 @@ public function setDateModified($date = null) * Set the feed last-build date. Ignored for Atom 1.0. * * @param null|integer|Date\Date + * @throws Exception\InvalidArgumentException */ public function setLastBuildDate($date = null) { @@ -182,7 +186,7 @@ public function setLastBuildDate($date = null) } elseif ($date instanceof Date\Date) { $zdate = $date; } else { - throw new Exception('Invalid Date\Date object or UNIX Timestamp passed as parameter'); + throw new Exception\InvalidArgumentException('Invalid Date\Date object or UNIX Timestamp passed as parameter'); } $this->_data['lastBuildDate'] = $zdate; } @@ -191,11 +195,12 @@ public function setLastBuildDate($date = null) * Set the feed description * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setDescription($description) { if (empty($description) || !is_string($description)) { - throw new Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['description'] = $description; } @@ -204,41 +209,42 @@ public function setDescription($description) * Set the feed generator entry * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setGenerator($name, $version = null, $uri = null) { if (is_array($name)) { $data = $name; if (empty($data['name']) || !is_string($data['name'])) { - throw new Exception('Invalid parameter: "name" must be a non-empty string'); + throw new Exception\InvalidArgumentException('Invalid parameter: "name" must be a non-empty string'); } $generator = array('name' => $data['name']); if (isset($data['version'])) { if (empty($data['version']) || !is_string($data['version'])) { - throw new Exception('Invalid parameter: "version" must be a non-empty string'); + throw new Exception\InvalidArgumentException('Invalid parameter: "version" must be a non-empty string'); } $generator['version'] = $data['version']; } if (isset($data['uri'])) { if (empty($data['uri']) || !is_string($data['uri']) || !Uri\UriFactory::factory($data['uri'])->isValid()) { - throw new Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); + throw new Exception\InvalidArgumentException('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); } $generator['uri'] = $data['uri']; } } else { if (empty($name) || !is_string($name)) { - throw new Exception('Invalid parameter: "name" must be a non-empty string'); + throw new Exception\InvalidArgumentException('Invalid parameter: "name" must be a non-empty string'); } $generator = array('name' => $name); if (isset($version)) { if (empty($version) || !is_string($version)) { - throw new Exception('Invalid parameter: "version" must be a non-empty string'); + throw new Exception\InvalidArgumentException('Invalid parameter: "version" must be a non-empty string'); } $generator['version'] = $version; } if (isset($uri)) { if (empty($uri) || !is_string($uri) || !Uri\UriFactory::factory($uri)->isValid()) { - throw new Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); + throw new Exception\InvalidArgumentException('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); } $generator['uri'] = $uri; } @@ -250,6 +256,7 @@ public function setGenerator($name, $version = null, $uri = null) * Set the feed ID - URI or URN (via PCRE pattern) supported * * @param string $id + * @throws Exception\InvalidArgumentException */ public function setId($id) { @@ -257,7 +264,7 @@ public function setId($id) && !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id) && !$this->_validateTagUri($id) ) { - throw new Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['id'] = $id; } @@ -301,13 +308,14 @@ protected function _validateTagUri($id) * 'height' and 'description'. Only 'uri' is required and used for Atom rendering. * * @param array $data + * @throws Exception\InvalidArgumentException */ public function setImage(array $data) { if (empty($data['uri']) || !is_string($data['uri']) || !Uri\UriFactory::factory($data['uri'])->isValid() ) { - throw new Exception('Invalid parameter: parameter \'uri\'' + throw new Exception\InvalidArgumentException('Invalid parameter: parameter \'uri\'' . ' must be a non-empty string and valid URI/IRI'); } $this->_data['image'] = $data; @@ -317,11 +325,12 @@ public function setImage(array $data) * Set the feed language * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setLanguage($language) { if (empty($language) || !is_string($language)) { - throw new Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['language'] = $language; } @@ -330,11 +339,12 @@ public function setLanguage($language) * Set a link to the HTML source * * @param string $link + * @throws Exception\InvalidArgumentException */ public function setLink($link) { if (empty($link) || !is_string($link) || !Uri\UriFactory::factory($link)->isValid()) { - throw new Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['link'] = $link; } @@ -343,14 +353,15 @@ public function setLink($link) * Set a link to an XML feed for any feed type/version * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setFeedLink($link, $type) { if (empty($link) || !is_string($link) || !Uri\UriFactory::factory($link)->isValid()) { - throw new Exception('Invalid parameter: "link"" must be a non-empty string and valid URI/IRI'); + throw new Exception\InvalidArgumentException('Invalid parameter: "link"" must be a non-empty string and valid URI/IRI'); } if (!in_array(strtolower($type), array('rss', 'rdf', 'atom'))) { - throw new Exception('Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom'); + throw new Exception\InvalidArgumentException('Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom'); } $this->_data['feedLinks'][strtolower($type)] = $link; } @@ -359,11 +370,12 @@ public function setFeedLink($link, $type) * Set the feed title * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setTitle($title) { if (empty($title) || !is_string($title)) { - throw new Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['title'] = $title; } @@ -372,11 +384,12 @@ public function setTitle($title) * Set the feed character encoding * * @param string $encoding + * @throws Exception\InvalidArgumentException */ public function setEncoding($encoding) { if (empty($encoding) || !is_string($encoding)) { - throw new Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['encoding'] = $encoding; } @@ -385,11 +398,12 @@ public function setEncoding($encoding) * Set the feed's base URL * * @param string $url + * @throws Exception\InvalidArgumentException */ public function setBaseUrl($url) { if (empty($url) || !is_string($url) || !Uri\UriFactory::factory($url)->isValid()) { - throw new Exception('Invalid parameter: "url" array value' + throw new Exception\InvalidArgumentException('Invalid parameter: "url" array value' . ' must be a non-empty string and valid URI/IRI'); } $this->_data['baseUrl'] = $url; @@ -399,11 +413,12 @@ public function setBaseUrl($url) * Add a Pubsubhubbub hub endpoint URL * * @param string $url + * @throws Exception\InvalidArgumentException */ public function addHub($url) { if (empty($url) || !is_string($url) || !Uri\UriFactory::factory($url)->isValid()) { - throw new Exception('Invalid parameter: "url" array value' + throw new Exception\InvalidArgumentException('Invalid parameter: "url" array value' . ' must be a non-empty string and valid URI/IRI'); } if (!isset($this->_data['hubs'])) { @@ -428,11 +443,12 @@ public function addHubs(array $urls) * Add a feed category * * @param string $category + * @throws Exception\InvalidArgumentException */ public function addCategory(array $category) { if (!isset($category['term'])) { - throw new Exception('Each category must be an array and ' + throw new Exception\InvalidArgumentException('Each category must be an array and ' . 'contain at least a "term" element containing the machine ' . ' readable category name'); } @@ -441,7 +457,7 @@ public function addCategory(array $category) || !is_string($category['scheme']) || !Uri\UriFactory::factory($category['scheme'])->isValid() ) { - throw new Exception('The Atom scheme or RSS domain of' + throw new Exception\InvalidArgumentException('The Atom scheme or RSS domain of' . ' a category must be a valid URI'); } } @@ -749,7 +765,7 @@ public function remove($name) * @param string $method * @param array $args * @return mixed - * @throws Exception if no extensions implements the method + * @throws Exception\BadMethodCallException if no extensions implements the method */ public function __call($method, $args) { diff --git a/src/Writer/Deleted.php b/src/Writer/Deleted.php index bc9de64c..4dc82be6 100644 --- a/src/Writer/Deleted.php +++ b/src/Writer/Deleted.php @@ -51,11 +51,12 @@ class Deleted * Set the feed character encoding * * @return string|null + * @throws Exception\InvalidArgumentException */ public function setEncoding($encoding) { if (empty($encoding) || !is_string($encoding)) { - throw new Exception('Invalid parameter: parameter must be a non-empty string'); + throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->_data['encoding'] = $encoding; } @@ -106,11 +107,17 @@ public function getType() { return $this->_type; } - + + /** + * Set reference + * + * @param $reference + * @throws Exception\InvalidArgumentException + */ public function setReference($reference) { if (empty($reference) || !is_string($reference)) { - throw new Exception('Invalid parameter: reference must be a non-empty string'); + throw new Exception\InvalidArgumentException('Invalid parameter: reference must be a non-empty string'); } $this->_data['reference'] = $reference; } @@ -122,7 +129,13 @@ public function getReference() } return $this->_data['reference']; } - + + /** + * Set when + * + * @param null|string|Date\Date $date + * @throws Exception\InvalidArgumentException + */ public function setWhen($date = null) { $zdate = null; @@ -133,7 +146,7 @@ public function setWhen($date = null) } elseif ($date instanceof Date\Date) { $zdate = $date; } else { - throw new Exception('Invalid Date\Date object or UNIX Timestamp' + throw new Exception\InvalidArgumentException('Invalid Date\Date object or UNIX Timestamp' . ' passed as parameter'); } $this->_data['when'] = $zdate; @@ -146,7 +159,13 @@ public function getWhen() } return $this->_data['when']; } - + + /** + * Set by + * + * @param array $by + * @throws Exception\InvalidArgumentException + */ public function setBy(array $by) { $author = array(); @@ -154,13 +173,13 @@ public function setBy(array $by) || empty($by['name']) || !is_string($by['name']) ) { - throw new Exception('Invalid parameter: author array must include a' + throw new Exception\InvalidArgumentException('Invalid parameter: author array must include a' . ' "name" key with a non-empty string value'); } $author['name'] = $by['name']; if (isset($by['email'])) { if (empty($by['email']) || !is_string($by['email'])) { - throw new Exception('Invalid parameter: "email" array' + throw new Exception\InvalidArgumentException('Invalid parameter: "email" array' . ' value must be a non-empty string'); } $author['email'] = $by['email']; @@ -170,7 +189,7 @@ public function setBy(array $by) || !is_string($by['uri']) || !Uri\UriFactory::factory($by['uri'])->isValid() ) { - throw new Exception('Invalid parameter: "uri" array value must' + throw new Exception\InvalidArgumentException('Invalid parameter: "uri" array value must' . ' be a non-empty string and valid URI/IRI'); } $author['uri'] = $by['uri']; diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index 5bb7cc1e..a07b76d4 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -179,7 +179,7 @@ public function setContent($content) /** * Set the feed creation date * - * @return string|null + * @return string|null|Date\Date * @throws Exception\InvalidArgumentException */ public function setDateCreated($date = null) @@ -512,11 +512,12 @@ public function getCommentFeedLinks() * Add a entry category * * @param string $category + * @throws Exception\InvalidArgumentException */ public function addCategory(array $category) { if (!isset($category['term'])) { - throw new Exception('Each category must be an array and ' + throw new Exception\InvalidArgumentException('Each category must be an array and ' . 'contain at least a "term" element containing the machine ' . ' readable category name'); } @@ -525,7 +526,7 @@ public function addCategory(array $category) || !is_string($category['scheme']) || !Uri\UriFactory::factory($category['scheme'])->isValid() ) { - throw new Exception('The Atom scheme or RSS domain of' + throw new Exception\InvalidArgumentException('The Atom scheme or RSS domain of' . ' a category must be a valid URI'); } } @@ -567,14 +568,15 @@ public function getCategories() * will throw an Exception. * * @param array $enclosure + * @throws Exception\InvalidArgumentException */ public function setEnclosure(array $enclosure) { if (!isset($enclosure['uri'])) { - throw new Exception('Enclosure "uri" is not set'); + throw new Exception\InvalidArgumentException('Enclosure "uri" is not set'); } if (!Uri\UriFactory::factory($enclosure['uri'])->isValid()) { - throw new Exception('Enclosure "uri" is not a valid URI/IRI'); + throw new Exception\InvalidArgumentException('Enclosure "uri" is not a valid URI/IRI'); } $this->_data['enclosure'] = $enclosure; } @@ -656,17 +658,17 @@ public function getType() * @param string $method * @param array $args * @return mixed - * @throws Exception if no extensions implements the method + * @throws Exception\BadMethodCallException if no extensions implements the method */ public function __call($method, $args) { foreach ($this->_extensions as $extension) { try { return call_user_func_array(array($extension, $method), $args); - } catch (BadMethodCallException $e) { + } catch (\BadMethodCallException $e) { } } - throw new Exception('Method: ' . $method + throw new Exception\BadMethodCallException('Method: ' . $method . ' does not exist and could not be located on a registered Extension'); } @@ -675,7 +677,7 @@ public function __call($method, $args) * added to the current feed automatically, but is necessary to create a * container with some initial values preset based on the current feed data. * - * @return Zend_Feed_Writer_Source + * @return Source */ public function createSource() { @@ -691,7 +693,7 @@ public function createSource() * Appends a Zend_Feed_Writer_Entry object representing a new entry/item * the feed data container's internal group of entries. * - * @param Zend_Feed_Writer_Source $source + * @param Source $source */ public function setSource(Source $source) { @@ -699,7 +701,7 @@ public function setSource(Source $source) } /** - * @return Zend_Feed_Writer_Source + * @return Source */ public function getSource() { diff --git a/src/Writer/Extension/AbstractRenderer.php b/src/Writer/Extension/AbstractRenderer.php index 44e7879d..baa56639 100644 --- a/src/Writer/Extension/AbstractRenderer.php +++ b/src/Writer/Extension/AbstractRenderer.php @@ -20,6 +20,9 @@ namespace Zend\Feed\Writer\Extension; +use DOMDocument, + DOMElement; + /** * @category Zend * @package Zend_Feed_Writer_Entry_Rss @@ -29,7 +32,7 @@ abstract class AbstractRenderer implements Renderer { /** - * @var \DOMDocument + * @var DOMDocument */ protected $_dom = null; @@ -54,7 +57,7 @@ abstract class AbstractRenderer implements Renderer protected $_type = null; /** - * @var \DOMElement + * @var DOMElement */ protected $_rootElement = null; @@ -80,7 +83,7 @@ public function __construct($container) * Set feed encoding * * @param string $enc - * @return Zend_Feed_Writer_Extension_RendererAbstract + * @return AbstractRenderer */ public function setEncoding($enc) { @@ -91,7 +94,7 @@ public function setEncoding($enc) /** * Get feed encoding * - * @return void + * @return string */ public function getEncoding() { @@ -101,11 +104,11 @@ public function getEncoding() /** * Set DOMDocument and DOMElement on which to operate * - * @param \DOMDocument $dom - * @param \DOMElement $base - * @return Zend_Feed_Writer_Extension_RendererAbstract + * @param DOMDocument $dom + * @param DOMElement $base + * @return AbstractRenderer */ - public function setDomDocument(\DOMDocument $dom, \DOMElement $base) + public function setDomDocument(DOMDocument $dom, DOMElement $base) { $this->_dom = $dom; $this->_base = $base; @@ -126,7 +129,7 @@ public function getDataContainer() * Set feed type * * @param string $type - * @return Zend_Feed_Writer_Extension_RendererAbstract + * @return AbstractRenderer */ public function setType($type) { @@ -148,9 +151,9 @@ public function getType() * Set root element of document * * @param DOMElement $root - * @return Zend_Feed_Writer_Extension_RendererAbstract + * @return AbstractRenderer */ - public function setRootElement(\DOMElement $root) + public function setRootElement(DOMElement $root) { $this->_rootElement = $root; return $this; diff --git a/src/Writer/Extension/Atom/Renderer/Feed.php b/src/Writer/Extension/Atom/Renderer/Feed.php index 6870f894..5a9b5b9e 100644 --- a/src/Writer/Extension/Atom/Renderer/Feed.php +++ b/src/Writer/Extension/Atom/Renderer/Feed.php @@ -19,7 +19,10 @@ */ namespace Zend\Feed\Writer\Extension\Atom\Renderer; -use Zend\Feed\Writer\Extension; + +use Zend\Feed\Writer\Extension, + DOMDocument, + DOMElement; /** * @category Zend @@ -78,7 +81,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setFeedLinks(\DOMDocument $dom, \DOMElement $root) + protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) { $flinks = $this->getDataContainer()->getFeedLinks(); if(!$flinks || empty($flinks)) { @@ -102,7 +105,7 @@ protected function _setFeedLinks(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setHubs(\DOMDocument $dom, \DOMElement $root) + protected function _setHubs(DOMDocument $dom, DOMElement $root) { $hubs = $this->getDataContainer()->getHubs(); if (!$hubs || empty($hubs)) { diff --git a/src/Writer/Extension/Content/Renderer/Entry.php b/src/Writer/Extension/Content/Renderer/Entry.php index b8533333..a7669f97 100644 --- a/src/Writer/Extension/Content/Renderer/Entry.php +++ b/src/Writer/Extension/Content/Renderer/Entry.php @@ -19,7 +19,10 @@ */ namespace Zend\Feed\Writer\Extension\Content\Renderer; -use Zend\Feed\Writer\Extension; + +use Zend\Feed\Writer\Extension, + DOMDocument, + DOMElement; /** * @category Zend @@ -69,11 +72,11 @@ protected function _appendNamespaces() /** * Set entry content * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setContent(\DOMDocument $dom, \DOMElement $root) + protected function _setContent(DOMDocument $dom, DOMElement $root) { $content = $this->getDataContainer()->getContent(); if (!$content) { diff --git a/src/Writer/Extension/DublinCore/Renderer/Entry.php b/src/Writer/Extension/DublinCore/Renderer/Entry.php index af33f43c..8a2be91c 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Entry.php +++ b/src/Writer/Extension/DublinCore/Renderer/Entry.php @@ -19,7 +19,10 @@ */ namespace Zend\Feed\Writer\Extension\DublinCore\Renderer; -use Zend\Feed\Writer\Extension; + +use Zend\Feed\Writer\Extension, + DOMDocument, + DOMElement; /** * @category Zend @@ -73,7 +76,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->getDataContainer()->getAuthors(); if (!$authors || empty($authors)) { diff --git a/src/Writer/Extension/DublinCore/Renderer/Feed.php b/src/Writer/Extension/DublinCore/Renderer/Feed.php index 577d08fa..05edddc0 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Feed.php +++ b/src/Writer/Extension/DublinCore/Renderer/Feed.php @@ -19,7 +19,10 @@ */ namespace Zend\Feed\Writer\Extension\DublinCore\Renderer; -use Zend\Feed\Writer\Extension; + +use Zend\Feed\Writer\Extension, + DOMDocument, + DOMElement; /** * @category Zend @@ -73,7 +76,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->getDataContainer()->getAuthors(); if (!$authors || empty($authors)) { diff --git a/src/Writer/Extension/ITunes/Entry.php b/src/Writer/Extension/ITunes/Entry.php index 61ed4aef..1d2308b2 100644 --- a/src/Writer/Extension/ITunes/Entry.php +++ b/src/Writer/Extension/ITunes/Entry.php @@ -71,16 +71,17 @@ public function getEncoding() * Set a block value of "yes" or "no". You may also set an empty string. * * @param string - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return Entry + * @throws Writer\Exception\InvalidArgumentException */ public function setItunesBlock($value) { if (!ctype_alpha($value) && strlen($value) > 0) { - throw new Writer\Exception('invalid parameter: "block" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "block" may only' . ' contain alphabetic characters'); } if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Writer\Exception('invalid parameter: "block" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "block" may only' . ' contain a maximum of 255 characters'); } $this->_data['block'] = $value; @@ -90,7 +91,7 @@ public function setItunesBlock($value) * Add authors to itunes entry * * @param array $values - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return Entry */ public function addItunesAuthors(array $values) { @@ -104,12 +105,13 @@ public function addItunesAuthors(array $values) * Add author to itunes entry * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return Entry + * @throws Writer\Exception\InvalidArgumentException */ public function addItunesAuthor($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Writer\Exception('invalid parameter: any "author" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: any "author" may only' . ' contain a maximum of 255 characters each'); } if (!isset($this->_data['authors'])) { @@ -123,7 +125,8 @@ public function addItunesAuthor($value) * Set duration * * @param int $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return Entry + * @throws Writer\Exception\InvalidArgumentException */ public function setItunesDuration($value) { @@ -132,7 +135,7 @@ public function setItunesDuration($value) && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value) ) { - throw new Writer\Exception('invalid parameter: "duration" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "duration" may only' . ' be of a specified [[HH:]MM:]SS format'); } $this->_data['duration'] = $value; @@ -143,12 +146,13 @@ public function setItunesDuration($value) * Set "explicit" flag * * @param bool $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return Entry + * @throws Writer\Exception\InvalidArgumentException */ public function setItunesExplicit($value) { if (!in_array($value, array('yes','no','clean'))) { - throw new Writer\Exception('invalid parameter: "explicit" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "explicit" may only' . ' be one of "yes", "no" or "clean"'); } $this->_data['explicit'] = $value; @@ -159,17 +163,18 @@ public function setItunesExplicit($value) * Set keywords * * @param array $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return Entry + * @throws Writer\Exception\InvalidArgumentException */ public function setItunesKeywords(array $value) { if (count($value) > 12) { - throw new Writer\Exception('invalid parameter: "keywords" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "keywords" may only' . ' contain a maximum of 12 terms'); } $concat = implode(',', $value); if (iconv_strlen($concat, $this->getEncoding()) > 255) { - throw new Writer\Exception('invalid parameter: "keywords" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "keywords" may only' . ' have a concatenated length of 255 chars where terms are delimited' . ' by a comma'); } @@ -181,12 +186,12 @@ public function setItunesKeywords(array $value) * Set subtitle * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return Entry */ public function setItunesSubtitle($value) { if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Writer\Exception('invalid parameter: "subtitle" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "subtitle" may only' . ' contain a maximum of 255 characters'); } $this->_data['subtitle'] = $value; @@ -197,12 +202,13 @@ public function setItunesSubtitle($value) * Set summary * * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return Entry + * @throws Writer\Exception\InvalidArgumentException */ public function setItunesSummary($value) { if (iconv_strlen($value, $this->getEncoding()) > 4000) { - throw new Writer\Exception('invalid parameter: "summary" may only' + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "summary" may only' . ' contain a maximum of 4000 characters'); } $this->_data['summary'] = $value; diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php index 5e8faea7..dab3105a 100644 --- a/src/Writer/Extension/ITunes/Renderer/Entry.php +++ b/src/Writer/Extension/ITunes/Renderer/Entry.php @@ -19,7 +19,10 @@ */ namespace Zend\Feed\Writer\Extension\ITunes\Renderer; -use Zend\Feed\Writer\Extension; + +use Zend\Feed\Writer\Extension, + DOMDocument, + DOMElement; /** * @category Zend @@ -75,7 +78,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->getDataContainer()->getItunesAuthors(); if (!$authors || empty($authors)) { @@ -97,7 +100,7 @@ protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setBlock(\DOMDocument $dom, \DOMElement $root) + protected function _setBlock(DOMDocument $dom, DOMElement $root) { $block = $this->getDataContainer()->getItunesBlock(); if ($block === null) { @@ -117,7 +120,7 @@ protected function _setBlock(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDuration(\DOMDocument $dom, \DOMElement $root) + protected function _setDuration(DOMDocument $dom, DOMElement $root) { $duration = $this->getDataContainer()->getItunesDuration(); if (!$duration) { @@ -137,7 +140,7 @@ protected function _setDuration(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setExplicit(\DOMDocument $dom, \DOMElement $root) + protected function _setExplicit(DOMDocument $dom, DOMElement $root) { $explicit = $this->getDataContainer()->getItunesExplicit(); if ($explicit === null) { @@ -157,7 +160,7 @@ protected function _setExplicit(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setKeywords(\DOMDocument $dom, \DOMElement $root) + protected function _setKeywords(DOMDocument $dom, DOMElement $root) { $keywords = $this->getDataContainer()->getItunesKeywords(); if (!$keywords || empty($keywords)) { @@ -177,7 +180,7 @@ protected function _setKeywords(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setSubtitle(\DOMDocument $dom, \DOMElement $root) + protected function _setSubtitle(DOMDocument $dom, DOMElement $root) { $subtitle = $this->getDataContainer()->getItunesSubtitle(); if (!$subtitle) { @@ -197,7 +200,7 @@ protected function _setSubtitle(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setSummary(\DOMDocument $dom, \DOMElement $root) + protected function _setSummary(DOMDocument $dom, DOMElement $root) { $summary = $this->getDataContainer()->getItunesSummary(); if (!$summary) { diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php index 48cd046b..77cabdbf 100644 --- a/src/Writer/Extension/ITunes/Renderer/Feed.php +++ b/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -19,7 +19,10 @@ */ namespace Zend\Feed\Writer\Extension\ITunes\Renderer; -use Zend\Feed\Writer\Extension; + +use Zend\Feed\Writer\Extension, + DOMDocument, + DOMElement; /** * @category Zend @@ -76,11 +79,11 @@ protected function _appendNamespaces() /** * Set feed authors * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->getDataContainer()->getItunesAuthors(); if (!$authors || empty($authors)) { @@ -98,11 +101,11 @@ protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) /** * Set feed itunes block * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setBlock(\DOMDocument $dom, \DOMElement $root) + protected function _setBlock(DOMDocument $dom, DOMElement $root) { $block = $this->getDataContainer()->getItunesBlock(); if ($block === null) { @@ -118,11 +121,11 @@ protected function _setBlock(\DOMDocument $dom, \DOMElement $root) /** * Set feed categories * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setCategories(\DOMDocument $dom, \DOMElement $root) + protected function _setCategories(DOMDocument $dom, DOMElement $root) { $cats = $this->getDataContainer()->getItunesCategories(); if (!$cats || empty($cats)) { @@ -150,11 +153,11 @@ protected function _setCategories(\DOMDocument $dom, \DOMElement $root) /** * Set feed image (icon) * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setImage(\DOMDocument $dom, \DOMElement $root) + protected function _setImage(DOMDocument $dom, DOMElement $root) { $image = $this->getDataContainer()->getItunesImage(); if (!$image) { @@ -169,11 +172,11 @@ protected function _setImage(\DOMDocument $dom, \DOMElement $root) /** * Set feed cumulative duration * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setDuration(\DOMDocument $dom, \DOMElement $root) + protected function _setDuration(DOMDocument $dom, DOMElement $root) { $duration = $this->getDataContainer()->getItunesDuration(); if (!$duration) { @@ -189,11 +192,11 @@ protected function _setDuration(\DOMDocument $dom, \DOMElement $root) /** * Set explicit flag * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setExplicit(\DOMDocument $dom, \DOMElement $root) + protected function _setExplicit(DOMDocument $dom, DOMElement $root) { $explicit = $this->getDataContainer()->getItunesExplicit(); if ($explicit === null) { @@ -209,11 +212,11 @@ protected function _setExplicit(\DOMDocument $dom, \DOMElement $root) /** * Set feed keywords * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setKeywords(\DOMDocument $dom, \DOMElement $root) + protected function _setKeywords(DOMDocument $dom, DOMElement $root) { $keywords = $this->getDataContainer()->getItunesKeywords(); if (!$keywords || empty($keywords)) { @@ -229,11 +232,11 @@ protected function _setKeywords(\DOMDocument $dom, \DOMElement $root) /** * Set feed's new URL * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setNewFeedUrl(\DOMDocument $dom, \DOMElement $root) + protected function _setNewFeedUrl(DOMDocument $dom, DOMElement $root) { $url = $this->getDataContainer()->getItunesNewFeedUrl(); if (!$url) { @@ -249,11 +252,11 @@ protected function _setNewFeedUrl(\DOMDocument $dom, \DOMElement $root) /** * Set feed owners * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setOwners(\DOMDocument $dom, \DOMElement $root) + protected function _setOwners(DOMDocument $dom, DOMElement $root) { $owners = $this->getDataContainer()->getItunesOwners(); if (!$owners || empty($owners)) { @@ -277,11 +280,11 @@ protected function _setOwners(\DOMDocument $dom, \DOMElement $root) /** * Set feed subtitle * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setSubtitle(\DOMDocument $dom, \DOMElement $root) + protected function _setSubtitle(DOMDocument $dom, DOMElement $root) { $subtitle = $this->getDataContainer()->getItunesSubtitle(); if (!$subtitle) { @@ -297,11 +300,11 @@ protected function _setSubtitle(\DOMDocument $dom, \DOMElement $root) /** * Set feed summary * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setSummary(\DOMDocument $dom, \DOMElement $root) + protected function _setSummary(DOMDocument $dom, DOMElement $root) { $summary = $this->getDataContainer()->getItunesSummary(); if (!$summary) { diff --git a/src/Writer/Extension/Renderer.php b/src/Writer/Extension/Renderer.php index 2a27bced..297664c4 100644 --- a/src/Writer/Extension/Renderer.php +++ b/src/Writer/Extension/Renderer.php @@ -20,6 +20,9 @@ namespace Zend\Feed\Writer\Extension; +use DOMDocument, + DOMElement; + /** * @category Zend * @package Zend_Feed_Writer @@ -39,11 +42,11 @@ public function __construct($container); /** * Set DOMDocument and DOMElement on which to operate * - * @param \DOMDocument $dom - * @param \DOMElement $base + * @param DOMDocument $dom + * @param DOMElement $base * @return void */ - public function setDomDocument(\DOMDocument $dom, \DOMElement $base); + public function setDomDocument(DOMDocument $dom, DOMElement $base); /** * Render diff --git a/src/Writer/Extension/Slash/Renderer/Entry.php b/src/Writer/Extension/Slash/Renderer/Entry.php index eba22bc3..d0b27c0e 100644 --- a/src/Writer/Extension/Slash/Renderer/Entry.php +++ b/src/Writer/Extension/Slash/Renderer/Entry.php @@ -19,7 +19,10 @@ */ namespace Zend\Feed\Writer\Extension\Slash\Renderer; -use Zend\Feed\Writer\Extension; + +use Zend\Feed\Writer\Extension, + DOMDocument, + DOMElement; /** * @category Zend @@ -73,7 +76,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setCommentCount(\DOMDocument $dom, \DOMElement $root) + protected function _setCommentCount(DOMDocument $dom, DOMElement $root) { $count = $this->getDataContainer()->getCommentCount(); if (!$count) { diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php index fbb8ba14..24f90471 100644 --- a/src/Writer/Extension/Threading/Renderer/Entry.php +++ b/src/Writer/Extension/Threading/Renderer/Entry.php @@ -19,7 +19,10 @@ */ namespace Zend\Feed\Writer\Extension\Threading\Renderer; -use Zend\Feed\Writer\Extension; + +use Zend\Feed\Writer\Extension, + DOMDocument, + DOMElement; /** * @category Zend @@ -75,7 +78,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setCommentLink(\DOMDocument $dom, \DOMElement $root) + protected function _setCommentLink(DOMDocument $dom, DOMElement $root) { $link = $this->getDataContainer()->getCommentLink(); if (!$link) { @@ -100,7 +103,7 @@ protected function _setCommentLink(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCommentFeedLinks(\DOMDocument $dom, \DOMElement $root) + protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) { $links = $this->getDataContainer()->getCommentFeedLinks(); if (!$links || empty($links)) { @@ -127,7 +130,7 @@ protected function _setCommentFeedLinks(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCommentCount(\DOMDocument $dom, \DOMElement $root) + protected function _setCommentCount(DOMDocument $dom, DOMElement $root) { $count = $this->getDataContainer()->getCommentCount(); if ($count === null) { diff --git a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php index f6f52d00..38ac7ad9 100644 --- a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php +++ b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php @@ -19,7 +19,10 @@ */ namespace Zend\Feed\Writer\Extension\WellFormedWeb\Renderer; -use Zend\Feed\Writer\Extension; + +use Zend\Feed\Writer\Extension, + DOMDocument, + DOMElement; /** * @category Zend @@ -73,7 +76,7 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ - protected function _setCommentFeedLinks(\DOMDocument $dom, \DOMElement $root) + protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) { $links = $this->getDataContainer()->getCommentFeedLinks(); if (!$links || empty($links)) { diff --git a/src/Writer/Feed.php b/src/Writer/Feed.php index 7376f5f8..8fd2bb85 100644 --- a/src/Writer/Feed.php +++ b/src/Writer/Feed.php @@ -109,13 +109,14 @@ public function addEntry(Entry $entry) * added to a feed container in order to be indexed. * * @param int $index + * @throws Exception\InvalidArgumentException */ public function removeEntry($index) { if (isset($this->_entries[$index])) { unset($this->_entries[$index]); } - throw new Exception('Undefined index: ' . $index . '. Entry does not exist.'); + throw new Exception\InvalidArgumentException('Undefined index: ' . $index . '. Entry does not exist.'); } /** @@ -123,13 +124,14 @@ public function removeEntry($index) * added to a feed container in order to be indexed. * * @param int $index + * @throws Exception\InvalidArgumentException */ public function getEntry($index = 0) { if (isset($this->_entries[$index])) { return $this->_entries[$index]; } - throw new Exception('Undefined index: ' . $index . '. Entry does not exist.'); + throw new Exception\InvalidArgumentException('Undefined index: ' . $index . '. Entry does not exist.'); } /** @@ -226,13 +228,14 @@ public function valid() * * @param $type The feed type "rss" or "atom" to export as * @return string + * @throws Exception\InvalidArgumentException */ public function export($type, $ignoreExceptions = false) { $this->setType(strtolower($type)); $type = ucfirst($this->getType()); if ($type !== 'Rss' && $type !== 'Atom') { - throw new Exception('Invalid feed type specified: ' . $type . '.' + throw new Exception\InvalidArgumentException('Invalid feed type specified: ' . $type . '.' . ' Should be one of "rss" or "atom".'); } $renderClass = 'Zend\\Feed\\Writer\\Renderer\\Feed\\' . $type; diff --git a/src/Writer/FeedFactory.php b/src/Writer/FeedFactory.php index 2b239cde..35718c3e 100644 --- a/src/Writer/FeedFactory.php +++ b/src/Writer/FeedFactory.php @@ -21,6 +21,8 @@ namespace Zend\Feed\Writer; +use Traversable; + /** * @category Zend * @package Zend_Feed @@ -39,7 +41,7 @@ abstract class FeedFactory public static function factory($data) { if (!is_array($data) && !$data instanceof Traversable) { - throw Exception\InvalidArgumentException(sprintf( + throw new Exception\InvalidArgumentException(sprintf( '%s expects an array or Traversable argument; received "%s"', __METHOD__, (is_object($data) ? get_class($data) : gettype($data)) @@ -113,7 +115,7 @@ protected static function createEntries($entries, Feed $feed) foreach ($entries as $data) { if (!is_array($data) && !$data instanceof Traversable && !$data instanceof Entry) { - throw Exception\InvalidArgumentException(sprintf( + throw new Exception\InvalidArgumentException(sprintf( '%s expects an array, Traversable, or Zend\Feed\Writer\Entry argument; received "%s"', __METHOD__, (is_object($data) ? get_class($data) : gettype($data)) diff --git a/src/Writer/Renderer/AbstractRenderer.php b/src/Writer/Renderer/AbstractRenderer.php index 999e176f..fede98b9 100644 --- a/src/Writer/Renderer/AbstractRenderer.php +++ b/src/Writer/Renderer/AbstractRenderer.php @@ -21,7 +21,8 @@ namespace Zend\Feed\Writer\Renderer; use Zend\Feed\Writer, - DOMDocument; + DOMDocument, + DOMElement; /** * @category Zend @@ -134,7 +135,7 @@ public function getDataContainer() * Set feed encoding * * @param string $enc - * @return Zend_Feed_Writer_Renderer_RendererAbstract + * @return AbstractRenderer */ public function setEncoding($enc) { @@ -156,12 +157,13 @@ public function getEncoding() * Indicate whether or not to ignore exceptions * * @param bool $bool - * @return Zend_Feed_Writer_Renderer_RendererAbstract + * @return AbstractRenderer + * @throws Writer\Exception\InvalidArgumentException */ public function ignoreExceptions($bool = true) { if (!is_bool($bool)) { - throw new Writer\Exception('Invalid parameter: $bool. Should be TRUE or FALSE (defaults to TRUE if null)'); + throw new Writer\Exception\InvalidArgumentException('Invalid parameter: $bool. Should be TRUE or FALSE (defaults to TRUE if null)'); } $this->_ignoreExceptions = $bool; return $this; @@ -207,7 +209,7 @@ public function getType() * * @param DOMElement $root */ - public function setRootElement(\DOMElement $root) + public function setRootElement(DOMElement $root) { $this->_rootElement = $root; } diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom.php index 0cb9e08d..5e4b5d47 100644 --- a/src/Writer/Renderer/Entry/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -92,7 +92,7 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) if(!$this->getDataContainer()->getTitle()) { $message = 'Atom 1.0 entry elements MUST contain exactly one' . ' atom:title element but a title has not been set'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -140,7 +140,7 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) if(!$this->getDataContainer()->getDateModified()) { $message = 'Atom 1.0 entry elements MUST contain exactly one' . ' atom:updated element but a modification date has not been set'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -268,7 +268,7 @@ protected function _setId(DOMDocument $dom, DOMElement $root) . 'atom:id element, or as an alternative, we can use the same ' . 'value as atom:link however neither a suitable link nor an ' . 'id have been set'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -342,7 +342,7 @@ protected function _setContent(DOMDocument $dom, DOMElement $root) . 'atom:content element, or as an alternative, at least one link ' . 'with a rel attribute of "alternate" to indicate an alternate ' . 'method to consume the content.'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { diff --git a/src/Writer/Renderer/Entry/Atom/Deleted.php b/src/Writer/Renderer/Entry/Atom/Deleted.php index 56cbdfa9..1b702091 100644 --- a/src/Writer/Renderer/Entry/Atom/Deleted.php +++ b/src/Writer/Renderer/Entry/Atom/Deleted.php @@ -20,6 +20,9 @@ namespace Zend\Feed\Writer\Renderer\Entry\Atom; +use DOMDocument, + DOMElement; + /** * @category Zend * @package Zend_Feed_Writer @@ -28,7 +31,7 @@ */ class Deleted extends \Zend\Feed\Writer\Renderer\AbstractRenderer - implements \Zend\Feed\Writer\Renderer + implements \Zend\Feed\Writer\Renderer\RendererInterface { /** * Constructor @@ -48,7 +51,7 @@ public function __construct (\Zend\Feed\Writer\Deleted $container) */ public function render() { - $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; $entry = $this->_dom->createElement('at:deleted-entry'); $this->_dom->appendChild($entry); @@ -69,7 +72,7 @@ public function render() * @param DOMElement $root * @return void */ - protected function _setComment(\DOMDocument $dom, \DOMElement $root) + protected function _setComment(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getComment()) { return; @@ -88,7 +91,7 @@ protected function _setComment(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setBy(\DOMDocument $dom, \DOMElement $root) + protected function _setBy(DOMDocument $dom, DOMElement $root) { $data = $this->_container->getBy(); if ((!$data || empty($data))) { diff --git a/src/Writer/Renderer/Entry/AtomDeleted.php b/src/Writer/Renderer/Entry/AtomDeleted.php index 58530eb6..f6912697 100644 --- a/src/Writer/Renderer/Entry/AtomDeleted.php +++ b/src/Writer/Renderer/Entry/AtomDeleted.php @@ -19,8 +19,11 @@ */ namespace Zend\Feed\Writer\Renderer\Entry; -use Zend\Feed\Writer\Renderer; -use Zend\Feed\Writer; + +use Zend\Feed\Writer\Renderer, + Zend\Feed\Writer, + DOMDocument, + DOMElement; /** * @category Zend @@ -33,7 +36,7 @@ class AtomDeleted extends Renderer\AbstractRenderer implements Renderer\Renderer /** * Constructor * - * @param Zend_Feed_Writer_Deleted $container + * @param Writer\Deleted $container * @return void */ public function __construct (Writer\Deleted $container) @@ -48,7 +51,7 @@ public function __construct (Writer\Deleted $container) */ public function render() { - $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; $entry = $this->_dom->createElement('at:deleted-entry'); $this->_dom->appendChild($entry); @@ -65,11 +68,11 @@ public function render() /** * Set tombstone comment * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setComment(\DOMDocument $dom, \DOMElement $root) + protected function _setComment(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getComment()) { return; @@ -84,11 +87,11 @@ protected function _setComment(\DOMDocument $dom, \DOMElement $root) /** * Set entry authors * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setBy(\DOMDocument $dom, \DOMElement $root) + protected function _setBy(DOMDocument $dom, DOMElement $root) { $data = $this->_container->getBy(); if ((!$data || empty($data))) { diff --git a/src/Writer/Renderer/Entry/Rss.php b/src/Writer/Renderer/Entry/Rss.php index 0d4cb5fc..5d4b1d0b 100644 --- a/src/Writer/Renderer/Entry/Rss.php +++ b/src/Writer/Renderer/Entry/Rss.php @@ -23,7 +23,9 @@ use Zend\Date, Zend\Feed\Writer, Zend\Feed\Writer\Renderer, - Zend\Uri; + Zend\Uri, + DOMDocument, + DOMElement; /** * @category Zend @@ -36,7 +38,7 @@ class Rss extends Renderer\AbstractRenderer implements Renderer\RendererInterfac /** * Constructor * - * @param Zend_Feed_Writer_Entry $container + * @param Writer\Entry $container * @return void */ public function __construct (Writer\Entry $container) @@ -47,11 +49,11 @@ public function __construct (Writer\Entry $container) /** * Render RSS entry * - * @return Zend_Feed_Writer_Renderer_Entry_Rss + * @return Rss */ public function render() { - $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; $this->_dom->substituteEntities = false; $entry = $this->_dom->createElement('item'); @@ -80,18 +82,18 @@ public function render() /** * Set entry title * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setTitle(\DOMDocument $dom, \DOMElement $root) + protected function _setTitle(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDescription() && !$this->getDataContainer()->getTitle()) { $message = 'RSS 2.0 entry elements SHOULD contain exactly one' . ' title element but a title has not been set. In addition, there' . ' is no description as required in the absence of a title.'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -108,11 +110,11 @@ protected function _setTitle(\DOMDocument $dom, \DOMElement $root) /** * Set entry description * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setDescription(\DOMDocument $dom, \DOMElement $root) + protected function _setDescription(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDescription() && !$this->getDataContainer()->getTitle()) { @@ -120,7 +122,7 @@ protected function _setDescription(\DOMDocument $dom, \DOMElement $root) . ' description element but a description has not been set. In' . ' addition, there is no title element as required in the absence' . ' of a description.'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -140,11 +142,11 @@ protected function _setDescription(\DOMDocument $dom, \DOMElement $root) /** * Set date entry was last modified * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) + protected function _setDateModified(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateModified()) { return; @@ -161,11 +163,11 @@ protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) /** * Set date entry was created * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) + protected function _setDateCreated(DOMDocument $dom, DOMElement $root) { if (!$this->getDataContainer()->getDateCreated()) { return; @@ -180,11 +182,11 @@ protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) /** * Set entry authors * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->_container->getAuthors(); if ((!$authors || empty($authors))) { @@ -205,18 +207,18 @@ protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) /** * Set entry enclosure * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setEnclosure(\DOMDocument $dom, \DOMElement $root) + protected function _setEnclosure(DOMDocument $dom, DOMElement $root) { $data = $this->_container->getEnclosure(); if ((!$data || empty($data))) { return; } if (!isset($data['type'])) { - $exception = new Writer\Exception('Enclosure "type" is not set'); + $exception = new Writer\Exception\InvalidArgumentException('Enclosure "type" is not set'); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -225,7 +227,7 @@ protected function _setEnclosure(\DOMDocument $dom, \DOMElement $root) } } if (!isset($data['length'])) { - $exception = new Writer\Exception('Enclosure "length" is not set'); + $exception = new Writer\Exception\InvalidArgumentException('Enclosure "length" is not set'); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -234,7 +236,7 @@ protected function _setEnclosure(\DOMDocument $dom, \DOMElement $root) } } if (isset($data['length']) && (int) $data['length'] <= 0) { - $exception = new Writer\Exception('Enclosure "length" must be an integer' + $exception = new Writer\Exception\InvalidArgumentException('Enclosure "length" must be an integer' . ' indicating the content\'s length in bytes'); if (!$this->_ignoreExceptions) { throw $exception; @@ -253,11 +255,11 @@ protected function _setEnclosure(\DOMDocument $dom, \DOMElement $root) /** * Set link to entry * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setLink(\DOMDocument $dom, \DOMElement $root) + protected function _setLink(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getLink()) { return; @@ -271,11 +273,11 @@ protected function _setLink(\DOMDocument $dom, \DOMElement $root) /** * Set entry identifier * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setId(\DOMDocument $dom, \DOMElement $root) + protected function _setId(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getId() && !$this->getDataContainer()->getLink()) { @@ -298,11 +300,11 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) /** * Set link to entry comments * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setCommentLink(\DOMDocument $dom, \DOMElement $root) + protected function _setCommentLink(DOMDocument $dom, DOMElement $root) { $link = $this->getDataContainer()->getCommentLink(); if (!$link) { @@ -317,11 +319,11 @@ protected function _setCommentLink(\DOMDocument $dom, \DOMElement $root) /** * Set entry categories * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setCategories(\DOMDocument $dom, \DOMElement $root) + protected function _setCategories(DOMDocument $dom, DOMElement $root) { $categories = $this->getDataContainer()->getCategories(); if (!$categories) { diff --git a/src/Writer/Renderer/Feed/AbstractAtom.php b/src/Writer/Renderer/Feed/AbstractAtom.php index 48632333..e6b82659 100644 --- a/src/Writer/Renderer/Feed/AbstractAtom.php +++ b/src/Writer/Renderer/Feed/AbstractAtom.php @@ -19,9 +19,12 @@ */ namespace Zend\Feed\Writer\Renderer\Feed; -use Zend\Feed\Writer\Renderer; -use Zend\Date; -use Zend\Feed\Writer; + +use Zend\Feed\Writer\Renderer, + Zend\Date, + Zend\Feed\Writer, + DOMDocument, + DOMElement; /** * @category Zend @@ -45,11 +48,11 @@ public function __construct ($container) /** * Set feed language * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setLanguage(\DOMDocument $dom, \DOMElement $root) + protected function _setLanguage(DOMDocument $dom, DOMElement $root) { if ($this->getDataContainer()->getLanguage()) { $root->setAttribute('xml:lang', $this->getDataContainer() @@ -60,16 +63,16 @@ protected function _setLanguage(\DOMDocument $dom, \DOMElement $root) /** * Set feed title * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setTitle(\DOMDocument $dom, \DOMElement $root) + protected function _setTitle(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getTitle()) { $message = 'Atom 1.0 feed elements MUST contain exactly one' . ' atom:title element but a title has not been set'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -88,11 +91,11 @@ protected function _setTitle(\DOMDocument $dom, \DOMElement $root) /** * Set feed description * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setDescription(\DOMDocument $dom, \DOMElement $root) + protected function _setDescription(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDescription()) { return; @@ -107,16 +110,16 @@ protected function _setDescription(\DOMDocument $dom, \DOMElement $root) /** * Set date feed was last modified * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) + protected function _setDateModified(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateModified()) { $message = 'Atom 1.0 feed elements MUST contain exactly one' . ' atom:updated element but a modification date has not been set'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -136,11 +139,11 @@ protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) /** * Set feed generator string * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) + protected function _setGenerator(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getGenerator()) { $this->getDataContainer()->setGenerator('Zend_Feed_Writer', @@ -163,11 +166,11 @@ protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) /** * Set link to feed * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setLink(\DOMDocument $dom, \DOMElement $root) + protected function _setLink(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getLink()) { return; @@ -182,11 +185,11 @@ protected function _setLink(\DOMDocument $dom, \DOMElement $root) /** * Set feed links * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setFeedLinks(\DOMDocument $dom, \DOMElement $root) + protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) { $flinks = $this->getDataContainer()->getFeedLinks(); if(!$flinks || !array_key_exists('atom', $flinks)) { @@ -194,7 +197,7 @@ protected function _setFeedLinks(\DOMDocument $dom, \DOMElement $root) . 'element with a rel attribute value of "self". This is the ' . 'preferred URI for retrieving Atom Feed Documents representing ' . 'this Atom feed but a feed link has not been set'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -216,11 +219,11 @@ protected function _setFeedLinks(\DOMDocument $dom, \DOMElement $root) /** * Set feed authors * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->_container->getAuthors(); if (!$authors || empty($authors)) { @@ -256,11 +259,11 @@ protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) /** * Set feed identifier * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setId(\DOMDocument $dom, \DOMElement $root) + protected function _setId(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getId() && !$this->getDataContainer()->getLink()) { @@ -268,7 +271,7 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) . 'atom:id element, or as an alternative, we can use the same ' . 'value as atom:link however neither a suitable link nor an ' . 'id have been set'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -290,11 +293,11 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) /** * Set feed copyright * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setCopyright(\DOMDocument $dom, \DOMElement $root) + protected function _setCopyright(DOMDocument $dom, DOMElement $root) { $copyright = $this->getDataContainer()->getCopyright(); if (!$copyright) { @@ -309,11 +312,11 @@ protected function _setCopyright(\DOMDocument $dom, \DOMElement $root) /** * Set feed level logo (image) * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setImage(\DOMDocument $dom, \DOMElement $root) + protected function _setImage(DOMDocument $dom, DOMElement $root) { $image = $this->getDataContainer()->getImage(); if (!$image) { @@ -328,11 +331,11 @@ protected function _setImage(\DOMDocument $dom, \DOMElement $root) /** * Set date feed was created * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) + protected function _setDateCreated(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateCreated()) { return; @@ -347,11 +350,11 @@ protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) /** * Set base URL to feed links * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setBaseUrl(\DOMDocument $dom, \DOMElement $root) + protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) { $baseUrl = $this->getDataContainer()->getBaseUrl(); if (!$baseUrl) { @@ -363,11 +366,11 @@ protected function _setBaseUrl(\DOMDocument $dom, \DOMElement $root) /** * Set hubs to which this feed pushes * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setHubs(\DOMDocument $dom, \DOMElement $root) + protected function _setHubs(DOMDocument $dom, DOMElement $root) { $hubs = $this->getDataContainer()->getHubs(); if (!$hubs) { @@ -384,11 +387,11 @@ protected function _setHubs(\DOMDocument $dom, \DOMElement $root) /** * Set feed cateories * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setCategories(\DOMDocument $dom, \DOMElement $root) + protected function _setCategories(DOMDocument $dom, DOMElement $root) { $categories = $this->getDataContainer()->getCategories(); if (!$categories) { diff --git a/src/Writer/Renderer/Feed/Atom.php b/src/Writer/Renderer/Feed/Atom.php index efc13723..ef113b0f 100644 --- a/src/Writer/Renderer/Feed/Atom.php +++ b/src/Writer/Renderer/Feed/Atom.php @@ -19,8 +19,10 @@ */ namespace Zend\Feed\Writer\Renderer\Feed; -use Zend\Feed\Writer\Renderer; -use Zend\Feed\Writer; + +use Zend\Feed\Writer\Renderer, + Zend\Feed\Writer, + DOMDocument; /** * @category Zend @@ -33,7 +35,7 @@ class Atom extends AbstractAtom implements Renderer\RendererInterface /** * Constructor * - * @param Zend_Feed_Writer_Feed $container + * @param Writer\Feed $container * @return void */ public function __construct (Writer\Feed $container) @@ -44,14 +46,14 @@ public function __construct (Writer\Feed $container) /** * Render Atom feed * - * @return Zend_Feed_Writer_Renderer_Feed_Atom + * @return Atom */ public function render() { if (!$this->_container->getEncoding()) { $this->_container->setEncoding('UTF-8'); } - $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; $root = $this->_dom->createElementNS( Writer\Writer::NAMESPACE_ATOM_10, 'feed' diff --git a/src/Writer/Renderer/Feed/Atom/AbstractAtom.php b/src/Writer/Renderer/Feed/Atom/AbstractAtom.php index 7655a505..032d8390 100644 --- a/src/Writer/Renderer/Feed/Atom/AbstractAtom.php +++ b/src/Writer/Renderer/Feed/Atom/AbstractAtom.php @@ -19,7 +19,10 @@ */ namespace Zend\Feed\Writer\Renderer\Feed\Atom; -use Zend\Feed; + +use Zend\Feed, + DOMDocument, + DOMElement; /** * @category Zend @@ -47,7 +50,7 @@ public function __construct ($container) * @param DOMElement $root * @return void */ - protected function _setLanguage(\DOMDocument $dom, \DOMElement $root) + protected function _setLanguage(DOMDocument $dom, DOMElement $root) { if ($this->getDataContainer()->getLanguage()) { $root->setAttribute('xml:lang', $this->getDataContainer() @@ -61,13 +64,14 @@ protected function _setLanguage(\DOMDocument $dom, \DOMElement $root) * @param DOMDocument $dom * @param DOMElement $root * @return void + * @throws Feed\Exception\InvalidArgumentException */ - protected function _setTitle(\DOMDocument $dom, \DOMElement $root) + protected function _setTitle(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getTitle()) { $message = 'Atom 1.0 feed elements MUST contain exactly one' . ' atom:title element but a title has not been set'; - $exception = new Feed\Exception($message); + $exception = new Feed\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -90,7 +94,7 @@ protected function _setTitle(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDescription(\DOMDocument $dom, \DOMElement $root) + protected function _setDescription(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDescription()) { return; @@ -109,12 +113,12 @@ protected function _setDescription(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) + protected function _setDateModified(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateModified()) { $message = 'Atom 1.0 feed elements MUST contain exactly one' . ' atom:updated element but a modification date has not been set'; - $exception = new Feed\Exception($message); + $exception = new Feed\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -138,7 +142,7 @@ protected function _setDateModified(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) + protected function _setGenerator(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getGenerator()) { $this->getDataContainer()->setGenerator('Zend_Feed_Writer', @@ -165,7 +169,7 @@ protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setLink(\DOMDocument $dom, \DOMElement $root) + protected function _setLink(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getLink()) { return; @@ -184,7 +188,7 @@ protected function _setLink(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setFeedLinks(\DOMDocument $dom, \DOMElement $root) + protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) { $flinks = $this->getDataContainer()->getFeedLinks(); if(!$flinks || !array_key_exists('atom', $flinks)) { @@ -192,7 +196,7 @@ protected function _setFeedLinks(\DOMDocument $dom, \DOMElement $root) . 'element with a rel attribute value of "self". This is the ' . 'preferred URI for retrieving Atom Feed Documents representing ' . 'this Atom feed but a feed link has not been set'; - $exception = new Feed\Exception($message); + $exception = new Feed\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -218,7 +222,7 @@ protected function _setFeedLinks(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) + protected function _setAuthors(DOMDocument $dom, DOMElement $root) { $authors = $this->_container->getAuthors(); if (!$authors || empty($authors)) { @@ -258,7 +262,7 @@ protected function _setAuthors(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setId(\DOMDocument $dom, \DOMElement $root) + protected function _setId(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getId() && !$this->getDataContainer()->getLink()) { @@ -266,7 +270,7 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) . 'atom:id element, or as an alternative, we can use the same ' . 'value as atom:link however neither a suitable link nor an ' . 'id have been set'; - $exception = new Feed\Exception($message); + $exception = new Feed\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -292,7 +296,7 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCopyright(\DOMDocument $dom, \DOMElement $root) + protected function _setCopyright(DOMDocument $dom, DOMElement $root) { $copyright = $this->getDataContainer()->getCopyright(); if (!$copyright) { @@ -310,7 +314,7 @@ protected function _setCopyright(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setImage(\DOMDocument $dom, \DOMElement $root) + protected function _setImage(DOMDocument $dom, DOMElement $root) { $image = $this->getDataContainer()->getImage(); if (!$image) { @@ -330,7 +334,7 @@ protected function _setImage(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) + protected function _setDateCreated(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getDateCreated()) { return; @@ -349,7 +353,7 @@ protected function _setDateCreated(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setBaseUrl(\DOMDocument $dom, \DOMElement $root) + protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) { $baseUrl = $this->getDataContainer()->getBaseUrl(); if (!$baseUrl) { @@ -365,7 +369,7 @@ protected function _setBaseUrl(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setHubs(\DOMDocument $dom, \DOMElement $root) + protected function _setHubs(DOMDocument $dom, DOMElement $root) { $hubs = $this->getDataContainer()->getHubs(); if (!$hubs) { @@ -386,7 +390,7 @@ protected function _setHubs(\DOMDocument $dom, \DOMElement $root) * @param DOMElement $root * @return void */ - protected function _setCategories(\DOMDocument $dom, \DOMElement $root) + protected function _setCategories(DOMDocument $dom, DOMElement $root) { $categories = $this->getDataContainer()->getCategories(); if (!$categories) { diff --git a/src/Writer/Renderer/Feed/Atom/Source.php b/src/Writer/Renderer/Feed/Atom/Source.php index 564a5604..5e34e05b 100644 --- a/src/Writer/Renderer/Feed/Atom/Source.php +++ b/src/Writer/Renderer/Feed/Atom/Source.php @@ -20,19 +20,22 @@ namespace Zend\Feed\Writer\Renderer\Feed\Atom; +use DOMDocument, + DOMElement; + /** * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Source extends AbstractAtom implements \Zend\Feed\Writer\Renderer +class Source extends AbstractAtom implements \Zend\Feed\Writer\Renderer\RendererInterface { /** * Constructor * - * @param Zend_Feed_Writer_Feed_Source $container + * @param \Zend\Feed\Writer\Source $container * @return void */ public function __construct (\Zend\Feed\Writer\Source $container) @@ -50,7 +53,7 @@ public function render() if (!$this->_container->getEncoding()) { $this->_container->setEncoding('UTF-8'); } - $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; $root = $this->_dom->createElement('source'); $this->setRootElement($root); @@ -85,7 +88,7 @@ public function render() * @param DOMElement $root * @return void */ - protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) + protected function _setGenerator(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getGenerator()) { return; diff --git a/src/Writer/Renderer/Feed/AtomSource.php b/src/Writer/Renderer/Feed/AtomSource.php index dc5253b2..005d000c 100644 --- a/src/Writer/Renderer/Feed/AtomSource.php +++ b/src/Writer/Renderer/Feed/AtomSource.php @@ -19,8 +19,11 @@ */ namespace Zend\Feed\Writer\Renderer\Feed; -use Zend\Feed\Writer\Renderer; -use Zend\Feed\Writer; + +use Zend\Feed\Writer\Renderer, + Zend\Feed\Writer, + DOMElement, + DOMDocument; /** * @category Zend @@ -52,7 +55,7 @@ public function render() if (!$this->_container->getEncoding()) { $this->_container->setEncoding('UTF-8'); } - $this->_dom = new \DOMDocument('1.0', $this->_container->getEncoding()); + $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); $this->_dom->formatOutput = true; $root = $this->_dom->createElement('source'); $this->setRootElement($root); @@ -83,11 +86,11 @@ public function render() /** * Set feed generator string * - * @param \DOMDocument $dom - * @param \DOMElement $root + * @param DOMDocument $dom + * @param DOMElement $root * @return void */ - protected function _setGenerator(\DOMDocument $dom, \DOMElement $root) + protected function _setGenerator(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getGenerator()) { return; diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index 7dd77c89..94c94c2e 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -139,7 +139,7 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) if(!$this->getDataContainer()->getTitle()) { $message = 'RSS 2.0 feed elements MUST contain exactly one' . ' title element but a title has not been set'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -166,7 +166,7 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) if(!$this->getDataContainer()->getDescription()) { $message = 'RSS 2.0 feed elements MUST contain exactly one' . ' description element but one has not been set'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -242,7 +242,7 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) if(!$value) { $message = 'RSS 2.0 feed elements MUST contain exactly one' . ' link element but one has not been set'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -321,7 +321,7 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) || !is_string($image['title']) ) { $message = 'RSS 2.0 feed images must include a title'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -335,7 +335,7 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) ) { $message = 'Invalid parameter: parameter \'link\'' . ' must be a non-empty string and valid URI/IRI'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -367,7 +367,7 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) if (!ctype_digit((string) $image['height']) || $image['height'] > 400) { $message = 'Invalid parameter: parameter \'height\'' . ' must be an integer not exceeding 400'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -384,7 +384,7 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) if (!ctype_digit((string) $image['width']) || $image['width'] > 144) { $message = 'Invalid parameter: parameter \'width\'' . ' must be an integer not exceeding 144'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { @@ -401,7 +401,7 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) if (empty($image['description']) || !is_string($image['description'])) { $message = 'Invalid parameter: parameter \'description\'' . ' must be a non-empty string'; - $exception = new Writer\Exception($message); + $exception = new Writer\Exception\InvalidArgumentException($message); if (!$this->_ignoreExceptions) { throw $exception; } else { diff --git a/src/Writer/Writer.php b/src/Writer/Writer.php index 77b73746..fbb472ef 100644 --- a/src/Writer/Writer.php +++ b/src/Writer/Writer.php @@ -158,7 +158,7 @@ public static function addPrefixPaths(array $spec) * * @param string $name * @return void - * @throws Zend_Feed_Exception if unable to resolve Extension class + * @throws Exception\RuntimeException if unable to resolve Extension class */ public static function registerExtension($name) { @@ -185,7 +185,7 @@ public static function registerExtension($name) && !$loader->isLoaded($feedRendererName) && !$loader->isLoaded($entryRendererName) ) { - throw new Exception('Could not load extension: ' . $name + throw new Exception\RuntimeException('Could not load extension: ' . $name . 'using Plugin Loader. Check prefix paths are configured and extension exists.'); } if ($loader->isLoaded($feedName)) { diff --git a/test/PubSubHubbub/Model/SubscriptionTest.php b/test/PubSubHubbub/Model/SubscriptionTest.php index adb7c96c..96f6c874 100644 --- a/test/PubSubHubbub/Model/SubscriptionTest.php +++ b/test/PubSubHubbub/Model/SubscriptionTest.php @@ -69,7 +69,7 @@ public function testAllOperations() public function testImpemetsSubscriptionInterface() { $reflection = new \ReflectionClass('Zend\Feed\PubSubHubbub\Model\Subscription'); - $this->assertTrue($reflection->implementsInterface('Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence')); + $this->assertTrue($reflection->implementsInterface('Zend\Feed\PubSubHubbub\Model\SubscriptionPersistenceInterface')); unset($reflection); } diff --git a/test/PubSubHubbub/PublisherTest.php b/test/PubSubHubbub/PublisherTest.php index d8faae4b..a73ddc8e 100644 --- a/test/PubSubHubbub/PublisherTest.php +++ b/test/PubSubHubbub/PublisherTest.php @@ -99,7 +99,7 @@ public function testThrowsExceptionOnSettingEmptyHubServerUrl() try { $this->_publisher->addHubUrl(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } @@ -108,7 +108,7 @@ public function testThrowsExceptionOnSettingNonStringHubServerUrl() try { $this->_publisher->addHubUrl(123); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } @@ -117,7 +117,7 @@ public function testThrowsExceptionOnSettingInvalidHubServerUrl() try { $this->_publisher->addHubUrl('http://'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } public function testAddsUpdatedTopicUrl() @@ -173,7 +173,7 @@ public function testThrowsExceptionOnSettingEmptyUpdatedTopicUrl() try { $this->_publisher->addUpdatedTopicUrl(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } @@ -182,7 +182,7 @@ public function testThrowsExceptionOnSettingNonStringUpdatedTopicUrl() try { $this->_publisher->addUpdatedTopicUrl(123); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } @@ -191,7 +191,7 @@ public function testThrowsExceptionOnSettingInvalidUpdatedTopicUrl() try { $this->_publisher->addUpdatedTopicUrl('http://'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } public function testAddsParameter() diff --git a/test/PubSubHubbub/Subscriber/CallbackTest.php b/test/PubSubHubbub/Subscriber/CallbackTest.php index 38fea99e..64a10eee 100644 --- a/test/PubSubHubbub/Subscriber/CallbackTest.php +++ b/test/PubSubHubbub/Subscriber/CallbackTest.php @@ -92,7 +92,7 @@ public function testThrowsExceptionOnInvalidHttpResponseObjectSet() try { $this->_callback->setHttpResponse(new \stdClass); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } public function testThrowsExceptionIfNonObjectSetAsHttpResponseObject() @@ -100,7 +100,7 @@ public function testThrowsExceptionIfNonObjectSetAsHttpResponseObject() try { $this->_callback->setHttpResponse(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } public function testCanSetSubscriberCount() @@ -119,7 +119,7 @@ public function testThrowsExceptionOnSettingZeroAsSubscriberCount() try { $this->_callback->setSubscriberCount(0); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } public function testThrowsExceptionOnSettingLessThanZeroAsSubscriberCount() @@ -127,7 +127,7 @@ public function testThrowsExceptionOnSettingLessThanZeroAsSubscriberCount() try { $this->_callback->setSubscriberCount(-1); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntegerAsSubscriberCount() @@ -135,7 +135,7 @@ public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntege try { $this->_callback->setSubscriberCount('0aa'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } diff --git a/test/PubSubHubbub/SubscriberTest.php b/test/PubSubHubbub/SubscriberTest.php index 83715aa9..b7670f73 100644 --- a/test/PubSubHubbub/SubscriberTest.php +++ b/test/PubSubHubbub/SubscriberTest.php @@ -112,7 +112,7 @@ public function testThrowsExceptionOnSettingEmptyHubServerUrl() try { $this->_subscriber->addHubUrl(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } public function testThrowsExceptionOnSettingNonStringHubServerUrl() @@ -120,7 +120,7 @@ public function testThrowsExceptionOnSettingNonStringHubServerUrl() try { $this->_subscriber->addHubUrl(123); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } public function testThrowsExceptionOnSettingInvalidHubServerUrl() @@ -128,7 +128,7 @@ public function testThrowsExceptionOnSettingInvalidHubServerUrl() try { $this->_subscriber->addHubUrl('http://'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } public function testAddsParameter() @@ -200,7 +200,7 @@ public function testThrowsExceptionOnSettingEmptyTopicUrl() try { $this->_subscriber->setTopicUrl(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } @@ -209,7 +209,7 @@ public function testThrowsExceptionOnSettingNonStringTopicUrl() try { $this->_subscriber->setTopicUrl(123); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } @@ -218,7 +218,7 @@ public function testThrowsExceptionOnSettingInvalidTopicUrl() try { $this->_subscriber->setTopicUrl('http://'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } public function testThrowsExceptionOnMissingTopicUrl() @@ -226,7 +226,7 @@ public function testThrowsExceptionOnMissingTopicUrl() try { $this->_subscriber->getTopicUrl(); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } public function testCanSetCallbackUrl() @@ -240,7 +240,7 @@ public function testThrowsExceptionOnSettingEmptyCallbackUrl() try { $this->_subscriber->setCallbackUrl(''); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } @@ -249,7 +249,7 @@ public function testThrowsExceptionOnSettingNonStringCallbackUrl() try { $this->_subscriber->setCallbackUrl(123); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } @@ -258,7 +258,7 @@ public function testThrowsExceptionOnSettingInvalidCallbackUrl() try { $this->_subscriber->setCallbackUrl('http://'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } public function testThrowsExceptionOnMissingCallbackUrl() @@ -266,7 +266,7 @@ public function testThrowsExceptionOnMissingCallbackUrl() try { $this->_subscriber->getCallbackUrl(); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } public function testCanSetLeaseSeconds() @@ -280,7 +280,7 @@ public function testThrowsExceptionOnSettingZeroAsLeaseSeconds() try { $this->_subscriber->setLeaseSeconds(0); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } public function testThrowsExceptionOnSettingLessThanZeroAsLeaseSeconds() @@ -288,7 +288,7 @@ public function testThrowsExceptionOnSettingLessThanZeroAsLeaseSeconds() try { $this->_subscriber->setLeaseSeconds(-1); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntegerAsLeaseSeconds() @@ -296,7 +296,7 @@ public function testThrowsExceptionOnSettingAnyScalarTypeCastToAZeroOrLessIntege try { $this->_subscriber->setLeaseSeconds('0aa'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } public function testCanSetPreferredVerificationMode() @@ -310,7 +310,7 @@ public function testSetsPreferredVerificationModeThrowsExceptionOnSettingBadMode try { $this->_subscriber->setPreferredVerificationMode('abc'); $this->fail('Should not fail as an Exception would be raised and caught'); - } catch (PubSubHubbub\Exception $e) {} + } catch (PubSubHubbub\Exception\ExceptionInterface $e) {} } public function testPreferredVerificationModeDefaultsToSync() @@ -328,7 +328,7 @@ public function testCanSetStorageImplementation() public function testGetStorageThrowsExceptionIfNoneSet() { - $this->setExpectedException('Zend\Feed\PubSubHubbub\Exception'); + $this->setExpectedException('Zend\Feed\PubSubHubbub\Exception\ExceptionInterface'); $this->_subscriber->getStorage(); } diff --git a/test/ReaderTest.php b/test/ReaderTest.php index e55b2941..2a5c6f4c 100644 --- a/test/ReaderTest.php +++ b/test/ReaderTest.php @@ -170,7 +170,7 @@ public function testImportsUri() */ public function testImportsUriAndThrowsExceptionIfNotAFeed() { - $this->setExpectedException('Zend\Feed\Exception'); + $this->setExpectedException('Zend\Feed\Exception\ExceptionInterface'); if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') ) { diff --git a/test/Writer/DeletedTest.php b/test/Writer/DeletedTest.php index ac5f5527..55b6ad8d 100644 --- a/test/Writer/DeletedTest.php +++ b/test/Writer/DeletedTest.php @@ -48,7 +48,7 @@ public function testSetReferenceThrowsExceptionOnInvalidParameter() try { $entry->setReference(''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -110,7 +110,7 @@ public function testSetWhenThrowsExceptionOnInvalidParameter() try { $entry->setWhen('abc'); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -147,7 +147,7 @@ public function testAddByThrowsExceptionOnInvalidNameFromArray() try { $entry->setBy(array('name'=>'')); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -157,7 +157,7 @@ public function testAddByThrowsExceptionOnInvalidEmailFromArray() try { $entry->setBy(array('name'=>'Joe','email'=>'')); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -168,7 +168,7 @@ public function testAddByThrowsExceptionOnInvalidUriFromArray() try { $entry->setBy(array('name'=>'Joe','uri'=>'notauri')); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -178,7 +178,7 @@ public function testAddByThrowsExceptionIfNameOmittedFromArray() try { $entry->setBy(array('uri'=>'notauri')); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } diff --git a/test/Writer/EntryTest.php b/test/Writer/EntryTest.php index dd68d7dd..382cabdb 100644 --- a/test/Writer/EntryTest.php +++ b/test/Writer/EntryTest.php @@ -146,7 +146,7 @@ public function testAddsEnclosure() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testAddsEnclosureThrowsExceptionOnMissingUri() { @@ -159,7 +159,7 @@ public function testAddsEnclosureThrowsExceptionOnMissingUri() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testAddsEnclosureThrowsExceptionWhenUriIsInvalid() { @@ -185,7 +185,7 @@ public function testSetCopyrightThrowsExceptionOnInvalidParam() try { $entry->setCopyright(''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -202,7 +202,7 @@ public function testSetContentThrowsExceptionOnInvalidParam() try { $entry->setContent(''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -304,7 +304,7 @@ public function testSetDateCreatedThrowsExceptionOnInvalidParameter() try { $entry->setDateCreated('abc'); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -314,7 +314,7 @@ public function testSetDateModifiedThrowsExceptionOnInvalidParameter() try { $entry->setDateModified('abc'); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -355,7 +355,7 @@ public function testSetDescriptionThrowsExceptionOnInvalidParameter() try { $entry->setDescription(''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -378,7 +378,7 @@ public function testSetIdThrowsExceptionOnInvalidParameter() try { $entry->setId(''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -401,7 +401,7 @@ public function testSetLinkThrowsExceptionOnEmptyString() try { $entry->setLink(''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -411,7 +411,7 @@ public function testSetLinkThrowsExceptionOnInvalidUri() try { $entry->setLink('http://'); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -434,7 +434,7 @@ public function testSetCommentLinkThrowsExceptionOnEmptyString() try { $entry->setCommentLink(''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -444,7 +444,7 @@ public function testSetCommentLinkThrowsExceptionOnInvalidUri() try { $entry->setCommentLink('http://'); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -472,7 +472,7 @@ public function testSetCommentFeedLinkThrowsExceptionOnEmptyString() $entry->setCommentFeedLink(array('uri' => '', 'type'=> 'rdf')); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -483,7 +483,7 @@ public function testSetCommentFeedLinkThrowsExceptionOnInvalidUri() $entry->setCommentFeedLink(array('uri' => 'http://', 'type'=> 'rdf')); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -494,7 +494,7 @@ public function testSetCommentFeedLinkThrowsExceptionOnInvalidType() $entry->setCommentFeedLink(array('uri' => 'http://www.example.com/id/comments', 'type'=> 'foo')); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -517,7 +517,7 @@ public function testSetTitleThrowsExceptionOnInvalidParameter() try { $entry->setTitle(''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -540,7 +540,7 @@ public function testSetCommentCountThrowsExceptionOnInvalidEmptyParameter() try { $entry->setCommentCount(''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -550,7 +550,7 @@ public function testSetCommentCountThrowsExceptionOnInvalidNonIntegerParameter() try { $entry->setCommentCount('a'); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } diff --git a/test/Writer/Extension/ITunes/EntryTest.php b/test/Writer/Extension/ITunes/EntryTest.php index 01379d24..a7f45265 100644 --- a/test/Writer/Extension/ITunes/EntryTest.php +++ b/test/Writer/Extension/ITunes/EntryTest.php @@ -42,7 +42,7 @@ public function testSetBlock() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetBlockThrowsExceptionOnNonAlphaValue() { @@ -51,7 +51,7 @@ public function testSetBlockThrowsExceptionOnNonAlphaValue() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetBlockThrowsExceptionIfValueGreaterThan255CharsLength() { @@ -74,7 +74,7 @@ public function testAddAuthor() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testAddAuthorThrowsExceptionIfValueGreaterThan255CharsLength() { @@ -104,7 +104,7 @@ public function testSetDurationAsHoursMinutesAndSeconds() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetDurationThrowsExceptionOnUnknownFormat() { @@ -113,7 +113,7 @@ public function testSetDurationThrowsExceptionOnUnknownFormat() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetDurationThrowsExceptionOnInvalidSeconds() { @@ -122,7 +122,7 @@ public function testSetDurationThrowsExceptionOnInvalidSeconds() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetDurationThrowsExceptionOnInvalidMinutes() { @@ -152,7 +152,7 @@ public function testSetExplicitToClean() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetExplicitThrowsExceptionOnUnknownTerm() { @@ -171,7 +171,7 @@ public function testSetKeywords() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded() { @@ -183,7 +183,7 @@ public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharLength() { @@ -202,7 +202,7 @@ public function testSetSubtitle() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetSubtitleThrowsExceptionWhenValueExceeds255Chars() { @@ -218,7 +218,7 @@ public function testSetSummary() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetSummaryThrowsExceptionWhenValueExceeds255Chars() { diff --git a/test/Writer/Extension/ITunes/FeedTest.php b/test/Writer/Extension/ITunes/FeedTest.php index 8c863d00..50f5107e 100644 --- a/test/Writer/Extension/ITunes/FeedTest.php +++ b/test/Writer/Extension/ITunes/FeedTest.php @@ -42,7 +42,7 @@ public function testSetBlock() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetBlockThrowsExceptionOnNonAlphaValue() { @@ -51,7 +51,7 @@ public function testSetBlockThrowsExceptionOnNonAlphaValue() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetBlockThrowsExceptionIfValueGreaterThan255CharsLength() { @@ -74,7 +74,7 @@ public function testAddAuthor() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testAddAuthorThrowsExceptionIfValueGreaterThan255CharsLength() { @@ -94,7 +94,7 @@ public function testSetCategories() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetCategoriesThrowsExceptionIfAnyCatNameGreaterThan255CharsLength() { @@ -122,7 +122,7 @@ public function testSetImageAsJpgFile() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetImageThrowsExceptionOnInvalidUri() { @@ -131,7 +131,7 @@ public function testSetImageThrowsExceptionOnInvalidUri() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetImageThrowsExceptionOnInvalidImageExtension() { @@ -161,7 +161,7 @@ public function testSetDurationAsHoursMinutesAndSeconds() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetDurationThrowsExceptionOnUnknownFormat() { @@ -170,7 +170,7 @@ public function testSetDurationThrowsExceptionOnUnknownFormat() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetDurationThrowsExceptionOnInvalidSeconds() { @@ -179,7 +179,7 @@ public function testSetDurationThrowsExceptionOnInvalidSeconds() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetDurationThrowsExceptionOnInvalidMinutes() { @@ -209,7 +209,7 @@ public function testSetExplicitToClean() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetExplicitThrowsExceptionOnUnknownTerm() { @@ -228,7 +228,7 @@ public function testSetKeywords() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded() { @@ -240,7 +240,7 @@ public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharLength() { @@ -259,7 +259,7 @@ public function testSetNewFeedUrl() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetNewFeedUrlThrowsExceptionOnInvalidUri() { @@ -289,7 +289,7 @@ public function testSetSubtitle() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetSubtitleThrowsExceptionWhenValueExceeds255Chars() { @@ -305,7 +305,7 @@ public function testSetSummary() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetSummaryThrowsExceptionWhenValueExceeds4000Chars() { diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php index 7deb27c3..28f93571 100644 --- a/test/Writer/FeedTest.php +++ b/test/Writer/FeedTest.php @@ -138,7 +138,7 @@ public function testSetCopyrightThrowsExceptionOnInvalidParam() try { $writer->setCopyright(''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -241,7 +241,7 @@ public function testSetDateCreatedThrowsExceptionOnInvalidParameter() try { $writer->setDateCreated('abc'); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -251,7 +251,7 @@ public function testSetDateModifiedThrowsExceptionOnInvalidParameter() try { $writer->setDateModified('abc'); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -320,7 +320,7 @@ public function testSetLastBuildDateThrowsExceptionOnInvalidParameter() try { $writer->setLastBuildDate('abc'); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -349,7 +349,7 @@ public function testSetDescriptionThrowsExceptionOnInvalidParameter() try { $writer->setDescription(''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -394,7 +394,7 @@ public function testSetIdThrowsExceptionOnInvalidParameter() try { $writer->setId(''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -404,7 +404,7 @@ public function testSetIdThrowsExceptionOnInvalidUri() try { $writer->setId('http://'); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -427,7 +427,7 @@ public function testSetLanguageThrowsExceptionOnInvalidParameter() try { $writer->setLanguage(''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -450,7 +450,7 @@ public function testSetLinkThrowsExceptionOnEmptyString() try { $writer->setLink(''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -460,7 +460,7 @@ public function testSetLinkThrowsExceptionOnInvalidUri() try { $writer->setLink('http://'); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -483,7 +483,7 @@ public function testSetEncodingThrowsExceptionOnInvalidParameter() try { $writer->setEncoding(''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -506,7 +506,7 @@ public function testSetTitleThrowsExceptionOnInvalidParameter() try { $writer->setTitle(''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -547,7 +547,7 @@ public function testSetsGeneratorThrowsExceptionOnInvalidName() try { $writer->setGenerator(array()); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -558,7 +558,7 @@ public function testSetsGeneratorThrowsExceptionOnInvalidVersion() $writer->setGenerator(array('name' => 'ZFW', 'version'=> '')); $this->fail('Should have failed since version is empty'); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -570,7 +570,7 @@ public function testSetsGeneratorThrowsExceptionOnInvalidUri() $writer->setGenerator(array('name'=> 'ZFW', 'uri' => 'notauri')); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -615,7 +615,7 @@ public function testSetsGeneratorThrowsExceptionOnInvalidName_Deprecated() try { $writer->setGenerator(''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -628,7 +628,7 @@ public function testSetsGeneratorThrowsExceptionOnInvalidVersion_Deprecated() try { $writer->setGenerator('ZFW', ''); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -642,7 +642,7 @@ public function testSetsGeneratorThrowsExceptionOnInvalidUri_Deprecated() try { $writer->setGenerator('ZFW', null, 'notauri'); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -665,7 +665,7 @@ public function testSetsFeedLinkThrowsExceptionOnInvalidType() try { $writer->setFeedLink('http://www.example.com/rss', 'abc'); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -675,7 +675,7 @@ public function testSetsFeedLinkThrowsExceptionOnInvalidUri() try { $writer->setFeedLink('http://', 'rss'); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -698,7 +698,7 @@ public function testSetsBaseUrlThrowsExceptionOnInvalidUri() try { $writer->setBaseUrl('http://'); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -728,7 +728,7 @@ public function testAddingHubUrlThrowsExceptionOnInvalidUri() try { $writer->addHub('http://'); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -766,7 +766,7 @@ public function testAddingCategoryWithoutTermThrowsException() $writer->addCategory(array('label' => 'Cats & Dogs', 'scheme' => 'http://www.example.com/schema1')); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -777,7 +777,7 @@ public function testAddingCategoryWithInvalidUriAsSchemeThrowsException() $writer->addCategory(array('term' => 'cat_dog', 'scheme' => 'http://')); $this->fail(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { } } @@ -795,7 +795,7 @@ public function testSetsImageUri() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetsImageUriThrowsExceptionOnEmptyUri() { @@ -806,7 +806,7 @@ public function testSetsImageUriThrowsExceptionOnEmptyUri() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetsImageUriThrowsExceptionOnMissingUri() { @@ -815,7 +815,7 @@ public function testSetsImageUriThrowsExceptionOnMissingUri() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testSetsImageUriThrowsExceptionOnInvalidUri() { diff --git a/test/Writer/Renderer/Entry/AtomTest.php b/test/Writer/Renderer/Entry/AtomTest.php index 89bac233..43fc23c0 100644 --- a/test/Writer/Renderer/Entry/AtomTest.php +++ b/test/Writer/Renderer/Entry/AtomTest.php @@ -109,7 +109,7 @@ public function testEntryTitleHasBeenSet() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testFeedTitleIfMissingThrowsException() { @@ -138,7 +138,7 @@ public function testEntryContentHasBeenSet_Xhtml() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testFeedContentIfMissingThrowsExceptionIfThereIsNoLink() { @@ -157,7 +157,7 @@ public function testEntryUpdatedDateHasBeenSet() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testFeedUpdatedDateIfMissingThrowsException() { @@ -247,7 +247,7 @@ public function testFeedIdDefaultIsUsedIfNotSetByHand() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testFeedIdIfMissingThrowsException() { @@ -258,7 +258,7 @@ public function testFeedIdIfMissingThrowsException() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testFeedIdThrowsExceptionIfNotUri() { diff --git a/test/Writer/Renderer/Entry/RssTest.php b/test/Writer/Renderer/Entry/RssTest.php index da80a7ef..11eaffa8 100644 --- a/test/Writer/Renderer/Entry/RssTest.php +++ b/test/Writer/Renderer/Entry/RssTest.php @@ -98,7 +98,7 @@ public function testEntryTitleHasBeenSet() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testEntryTitleIfMissingThrowsExceptionIfDescriptionAlsoMissing() { @@ -126,7 +126,7 @@ public function testEntrySummaryDescriptionHasBeenSet() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testEntryDescriptionIfMissingThrowsExceptionIfAlsoNoTitle() { @@ -230,7 +230,7 @@ public function testEntryHoldsAnyEnclosureAdded() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testAddsEnclosureThrowsExceptionOnMissingType() { @@ -243,7 +243,7 @@ public function testAddsEnclosureThrowsExceptionOnMissingType() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testAddsEnclosureThrowsExceptionOnMissingLength() { @@ -256,7 +256,7 @@ public function testAddsEnclosureThrowsExceptionOnMissingLength() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testAddsEnclosureThrowsExceptionOnNonNumericLength() { @@ -270,7 +270,7 @@ public function testAddsEnclosureThrowsExceptionOnNonNumericLength() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testAddsEnclosureThrowsExceptionOnNegativeLength() { diff --git a/test/Writer/Renderer/Feed/AtomTest.php b/test/Writer/Renderer/Feed/AtomTest.php index 92754a43..10f50581 100644 --- a/test/Writer/Renderer/Feed/AtomTest.php +++ b/test/Writer/Renderer/Feed/AtomTest.php @@ -102,7 +102,7 @@ public function testFeedTitleHasBeenSet() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testFeedTitleIfMissingThrowsException() { @@ -159,7 +159,7 @@ public function testFeedUpdatedDateHasBeenSet() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testFeedUpdatedDateIfMissingThrowsException() { @@ -245,7 +245,7 @@ public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsNoExceptionIfIdSet } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsExceptionIfIdMissing() { @@ -263,7 +263,7 @@ public function testFeedIncludesLinkToXmlAtomWhereTheFeedWillBeAvailable() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testFeedLinkToXmlAtomWhereTheFeedWillBeAvailableIfMissingThrowsException() { diff --git a/test/Writer/Renderer/Feed/RssTest.php b/test/Writer/Renderer/Feed/RssTest.php index e6f870a1..6a360093 100644 --- a/test/Writer/Renderer/Feed/RssTest.php +++ b/test/Writer/Renderer/Feed/RssTest.php @@ -67,7 +67,7 @@ public function testBuildMethodRunsMinimalWriterContainerProperlyBeforeICheckRss $feed = new Renderer\Feed\Rss($this->_validWriter); try { $feed->render(); - } catch (Writer\Exception $e) { + } catch (Writer\Exception\ExceptionInterface $e) { $this->fail('Valid Writer object caused an exception when building which should never happen'); } } @@ -98,7 +98,7 @@ public function testFeedTitleHasBeenSet() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testFeedTitleIfMissingThrowsException() { @@ -128,7 +128,7 @@ public function testFeedDescriptionHasBeenSet() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testFeedDescriptionThrowsExceptionIfMissing() { @@ -232,7 +232,7 @@ public function testFeedIncludesLinkToHtmlVersionOfFeed() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsException() { @@ -421,7 +421,7 @@ public function testImageCanBeSetWithOnlyRequiredElements() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testImageThrowsExceptionOnMissingLink() { @@ -434,7 +434,7 @@ public function testImageThrowsExceptionOnMissingLink() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testImageThrowsExceptionOnMissingTitle() { @@ -447,7 +447,7 @@ public function testImageThrowsExceptionOnMissingTitle() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testImageThrowsExceptionOnMissingUri() { @@ -460,7 +460,7 @@ public function testImageThrowsExceptionOnMissingUri() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testImageThrowsExceptionIfOptionalDescriptionInvalid() { @@ -475,7 +475,7 @@ public function testImageThrowsExceptionIfOptionalDescriptionInvalid() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testImageThrowsExceptionIfOptionalDescriptionEmpty() { @@ -490,7 +490,7 @@ public function testImageThrowsExceptionIfOptionalDescriptionEmpty() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testImageThrowsExceptionIfOptionalHeightNotAnInteger() { @@ -506,7 +506,7 @@ public function testImageThrowsExceptionIfOptionalHeightNotAnInteger() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testImageThrowsExceptionIfOptionalHeightEmpty() { @@ -522,7 +522,7 @@ public function testImageThrowsExceptionIfOptionalHeightEmpty() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testImageThrowsExceptionIfOptionalHeightGreaterThan400() { @@ -538,7 +538,7 @@ public function testImageThrowsExceptionIfOptionalHeightGreaterThan400() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testImageThrowsExceptionIfOptionalWidthNotAnInteger() { @@ -554,7 +554,7 @@ public function testImageThrowsExceptionIfOptionalWidthNotAnInteger() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testImageThrowsExceptionIfOptionalWidthEmpty() { @@ -570,7 +570,7 @@ public function testImageThrowsExceptionIfOptionalWidthEmpty() } /** - * @expectedException Zend\Feed\Writer\Exception + * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ public function testImageThrowsExceptionIfOptionalWidthGreaterThan144() { From 92afa1ec98ebc31d7990939c9ac44926774dc6e9 Mon Sep 17 00:00:00 2001 From: prolic Date: Thu, 10 May 2012 22:07:54 +0200 Subject: [PATCH 204/238] [zen-27] Renamed interfaces in Zend\Feed --- src/PubSubHubbub/AbstractCallback.php | 300 -------------------------- src/PubSubHubbub/Exception.php | 30 --- src/Reader/Feed/Feed.php | 126 ----------- 3 files changed, 456 deletions(-) delete mode 100644 src/PubSubHubbub/AbstractCallback.php delete mode 100644 src/PubSubHubbub/Exception.php delete mode 100644 src/Reader/Feed/Feed.php diff --git a/src/PubSubHubbub/AbstractCallback.php b/src/PubSubHubbub/AbstractCallback.php deleted file mode 100644 index a2baa336..00000000 --- a/src/PubSubHubbub/AbstractCallback.php +++ /dev/null @@ -1,300 +0,0 @@ -setConfig($config); - } - } - - /** - * Process any injected configuration options - * - * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance - * @return AbstractCallback - * @throws Exception\InvalidArgumentException - */ - public function setConfig($config) - { - if ($config instanceof Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - throw new Exception\InvalidArgumentException('Array or Zend_Config object' - . 'expected, got ' . gettype($config)); - } - if (array_key_exists('storage', $config)) { - $this->setStorage($config['storage']); - } - return $this; - } - - /** - * Send the response, including all headers. - * If you wish to handle this via Zend_Controller, use the getter methods - * to retrieve any data needed to be set on your HTTP Response object, or - * simply give this object the HTTP Response instance to work with for you! - * - * @return void - */ - public function sendResponse() - { - $this->getHttpResponse()->sendResponse(); - } - - /** - * Sets an instance of Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence used - * to background save any verification tokens associated with a subscription - * or other. - * - * @param Model\SubscriptionPersistenceInterface $storage - * @return AbstractCallback - */ - public function setStorage(Model\SubscriptionPersistenceInterface $storage) - { - $this->_storage = $storage; - return $this; - } - - /** - * Gets an instance of Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence used - * to background save any verification tokens associated with a subscription - * or other. - * - * @return Model\SubscriptionPersistenceInterface - * @throws Exception\RuntimeException - */ - public function getStorage() - { - if ($this->_storage === null) { - throw new Exception\RuntimeException('No storage object has been' - . ' set that subclasses Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence'); - } - return $this->_storage; - } - - /** - * An instance of a class handling Http Responses. This is implemented in - * Zend\Feed\Pubsubhubbub\HttpResponse which shares an unenforced interface with - * (i.e. not inherited from) Zend\Controller\Response\Http. - * - * @param HttpResponse|\Zend\Controller\Response\Http $httpResponse - * @return AbstractCallback - * @throws Exception\InvalidArgumentException - */ - public function setHttpResponse($httpResponse) - { - if (!is_object($httpResponse) - || (!$httpResponse instanceof HttpResponse - && !$httpResponse instanceof \Zend\Controller\Response\Http) - ) { - throw new Exception\InvalidArgumentException('HTTP Response object must' - . ' implement one of Zend\Feed\Pubsubhubbub\HttpResponse or' - . ' Zend\Controller\Response\Http'); - } - $this->_httpResponse = $httpResponse; - return $this; - } - - /** - * An instance of a class handling Http Responses. This is implemented in - * Zend\Feed\Pubsubhubbub\HttpResponse which shares an unenforced interface with - * (i.e. not inherited from) Zend\Controller\Response\Http. - * - * @return HttpResponse|\Zend\Controller\Response\Http - */ - public function getHttpResponse() - { - if ($this->_httpResponse === null) { - $this->_httpResponse = new HttpResponse; - } - return $this->_httpResponse; - } - - /** - * Sets the number of Subscribers for which any updates are on behalf of. - * In other words, is this class serving one or more subscribers? How many? - * Defaults to 1 if left unchanged. - * - * @param string|int $count - * @return AbstractCallback - * @throws Exception\InvalidArgumentException - */ - public function setSubscriberCount($count) - { - $count = intval($count); - if ($count <= 0) { - throw new Exception\InvalidArgumentException('Subscriber count must be' - . ' greater than zero'); - } - $this->_subscriberCount = $count; - return $this; - } - - /** - * Gets the number of Subscribers for which any updates are on behalf of. - * In other words, is this class serving one or more subscribers? How many? - * - * @return int - */ - public function getSubscriberCount() - { - return $this->_subscriberCount; - } - - /** - * Attempt to detect the callback URL (specifically the path forward) - */ - protected function _detectCallbackUrl() - { - $callbackUrl = ''; - if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { - $callbackUrl = $_SERVER['HTTP_X_REWRITE_URL']; - } elseif (isset($_SERVER['REQUEST_URI'])) { - $callbackUrl = $_SERVER['REQUEST_URI']; - $scheme = 'http'; - if ($_SERVER['HTTPS'] == 'on') { - $scheme = 'https'; - } - $schemeAndHttpHost = $scheme . '://' . $this->_getHttpHost(); - if (strpos($callbackUrl, $schemeAndHttpHost) === 0) { - $callbackUrl = substr($callbackUrl, strlen($schemeAndHttpHost)); - } - } elseif (isset($_SERVER['ORIG_PATH_INFO'])) { - $callbackUrl= $_SERVER['ORIG_PATH_INFO']; - if (!empty($_SERVER['QUERY_STRING'])) { - $callbackUrl .= '?' . $_SERVER['QUERY_STRING']; - } - } - return $callbackUrl; - } - - /** - * Get the HTTP host - * - * @return string - */ - protected function _getHttpHost() - { - if (!empty($_SERVER['HTTP_HOST'])) { - return $_SERVER['HTTP_HOST']; - } - $scheme = 'http'; - if ($_SERVER['HTTPS'] == 'on') { - $scheme = 'https'; - } - $name = $_SERVER['SERVER_NAME']; - $port = $_SERVER['SERVER_PORT']; - if (($scheme == 'http' && $port == 80) - || ($scheme == 'https' && $port == 443) - ) { - return $name; - } else { - return $name . ':' . $port; - } - } - - /** - * Retrieve a Header value from either $_SERVER or Apache - * - * @param string $header - */ - protected function _getHeader($header) - { - $temp = strtoupper(str_replace('-', '_', $header)); - if (!empty($_SERVER[$temp])) { - return $_SERVER[$temp]; - } - $temp = 'HTTP_' . strtoupper(str_replace('-', '_', $header)); - if (!empty($_SERVER[$temp])) { - return $_SERVER[$temp]; - } - if (function_exists('apache_request_headers')) { - $headers = apache_request_headers(); - if (!empty($headers[$header])) { - return $headers[$header]; - } - } - return false; - } - - /** - * Return the raw body of the request - * - * @return string|false Raw body, or false if not present - */ - protected function _getRawBody() - { - $body = file_get_contents('php://input'); - if (strlen(trim($body)) == 0 && isset($GLOBALS['HTTP_RAW_POST_DATA'])) { - $body = $GLOBALS['HTTP_RAW_POST_DATA']; - } - if (strlen(trim($body)) > 0) { - return $body; - } - return false; - } -} diff --git a/src/PubSubHubbub/Exception.php b/src/PubSubHubbub/Exception.php deleted file mode 100644 index 25a93a61..00000000 --- a/src/PubSubHubbub/Exception.php +++ /dev/null @@ -1,30 +0,0 @@ - Date: Fri, 11 May 2012 00:35:19 +0200 Subject: [PATCH 205/238] [Config] Remove uses of Zend\Config\Config in favor of Traversable --- src/PubSubHubbub/AbstractCallback.php | 36 +++++++++------ src/PubSubHubbub/Publisher.php | 44 ++++++++++-------- src/PubSubHubbub/Subscriber.php | 66 +++++++++++++++------------ src/Writer/FeedFactory.php | 9 ++-- test/PubSubHubbub/PublisherTest.php | 6 +-- 5 files changed, 92 insertions(+), 69 deletions(-) diff --git a/src/PubSubHubbub/AbstractCallback.php b/src/PubSubHubbub/AbstractCallback.php index 45aa5f78..75ea8efd 100644 --- a/src/PubSubHubbub/AbstractCallback.php +++ b/src/PubSubHubbub/AbstractCallback.php @@ -21,6 +21,9 @@ namespace Zend\Feed\PubSubHubbub; +use Traversable; +use Zend\Stdlib\ArrayUtils; + /** * @category Zend * @package Zend_Feed_Pubsubhubbub @@ -56,35 +59,40 @@ abstract class AbstractCallback implements Callback protected $_subscriberCount = 1; /** - * Constructor; accepts an array or Zend\Config instance to preset + * Constructor; accepts an array or Traversable object to preset * options for the Subscriber without calling all supported setter * methods in turn. * - * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance + * @param array|Traversable $options Options array or Traversable object */ - public function __construct($config = null) + public function __construct($options = null) { - if ($config !== null) { - $this->setConfig($config); + if ($options !== null) { + $this->setOptions($options); } } /** * Process any injected configuration options * - * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance + * @param array|Traversable $options Options array or Traversable object * @return \Zend\Feed\PubSubHubbub\AbstractCallback */ - public function setConfig($config) + public function setOptions($options) { - if ($config instanceof \Zend\Config\Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - throw new Exception('Array or Zend_Config object' - . 'expected, got ' . gettype($config)); + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } + if (is_array($options)) { + $this->setOptions($options); + } + + if (!is_array($options)) { + throw new Exception('Array or Traversable object' + . 'expected, got ' . gettype($options)); } - if (array_key_exists('storage', $config)) { - $this->setStorage($config['storage']); + if (array_key_exists('storage', $options)) { + $this->setStorage($options['storage']); } return $this; } diff --git a/src/PubSubHubbub/Publisher.php b/src/PubSubHubbub/Publisher.php index c3db1d5a..71e3d3e4 100644 --- a/src/PubSubHubbub/Publisher.php +++ b/src/PubSubHubbub/Publisher.php @@ -20,6 +20,8 @@ namespace Zend\Feed\PubSubHubbub; +use Traversable; +use Zend\Stdlib\ArrayUtils; use Zend\Uri; /** @@ -67,38 +69,42 @@ class Publisher * options for the Publisher without calling all supported setter * methods in turn. * - * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance - * @return void + * @param array|Traversable $options */ - public function __construct($config = null) + public function __construct($options = null) { - if ($config !== null) { - $this->setConfig($config); + if ($options !== null) { + $this->setOptions($options); } } /** * Process any injected configuration options * - * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance + * @param array|Traversable $options Options array or Traversable object * @return \Zend\Feed\PubSubHubbub\Publisher */ - public function setConfig($config) + public function setOptions($options) { - if ($config instanceof \Zend\Config\Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - throw new Exception('Array or Zend_Config object' - . 'expected, got ' . gettype($config)); + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } + if (is_array($options)) { + $this->setOptions($options); + } + + if (!is_array($options)) { + throw new Exception('Array or Traversable object' + . 'expected, got ' . gettype($options)); } - if (array_key_exists('hubUrls', $config)) { - $this->addHubUrls($config['hubUrls']); + if (array_key_exists('hubUrls', $options)) { + $this->addHubUrls($options['hubUrls']); } - if (array_key_exists('updatedTopicUrls', $config)) { - $this->addUpdatedTopicUrls($config['updatedTopicUrls']); + if (array_key_exists('updatedTopicUrls', $options)) { + $this->addUpdatedTopicUrls($options['updatedTopicUrls']); } - if (array_key_exists('parameters', $config)) { - $this->setParameters($config['parameters']); + if (array_key_exists('parameters', $options)) { + $this->setParameters($options['parameters']); } return $this; } @@ -382,7 +388,7 @@ protected function _getHttpClient() { $client = PubSubHubbub::getHttpClient(); $client->setMethod(\Zend\Http\Request::METHOD_POST); - $client->setConfig(array( + $client->setOptions(array( 'useragent' => 'Zend_Feed_Pubsubhubbub_Publisher/' . \Zend\Version::VERSION, )); $params = array(); diff --git a/src/PubSubHubbub/Subscriber.php b/src/PubSubHubbub/Subscriber.php index 8a665e4b..000bda38 100644 --- a/src/PubSubHubbub/Subscriber.php +++ b/src/PubSubHubbub/Subscriber.php @@ -20,6 +20,8 @@ namespace Zend\Feed\PubSubHubbub; +use Traversable; +use Zend\Stdlib\ArrayUtils; use Zend\Date, Zend\Uri; @@ -134,61 +136,65 @@ class Subscriber protected $_usePathParameter = false; /** - * Constructor; accepts an array or Zend\Config instance to preset + * Constructor; accepts an array or Traversable instance to preset * options for the Subscriber without calling all supported setter * methods in turn. * - * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance - * @return void + * @param array|Traversable $options */ public function __construct($config = null) { if ($config !== null) { - $this->setConfig($config); + $this->setOptions($config); } } /** * Process any injected configuration options * - * @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance + * @param array|Traversable $options * @return \Zend\Feed\PubSubHubbub\Subscriber\Subscriber */ - public function setConfig($config) + public function setOptions($options) { - if ($config instanceof \Zend\Config\Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - throw new Exception('Array or Zend\Config object' - . ' expected, got ' . gettype($config)); + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } + if (is_array($options)) { + $this->setOptions($options); + } + + if (!is_array($options)) { + throw new Exception('Array or Traversable object' + . 'expected, got ' . gettype($options)); } - if (array_key_exists('hubUrls', $config)) { - $this->addHubUrls($config['hubUrls']); + if (array_key_exists('hubUrls', $options)) { + $this->addHubUrls($options['hubUrls']); } - if (array_key_exists('callbackUrl', $config)) { - $this->setCallbackUrl($config['callbackUrl']); + if (array_key_exists('callbackUrl', $options)) { + $this->setCallbackUrl($options['callbackUrl']); } - if (array_key_exists('topicUrl', $config)) { - $this->setTopicUrl($config['topicUrl']); + if (array_key_exists('topicUrl', $options)) { + $this->setTopicUrl($options['topicUrl']); } - if (array_key_exists('storage', $config)) { - $this->setStorage($config['storage']); + if (array_key_exists('storage', $options)) { + $this->setStorage($options['storage']); } - if (array_key_exists('leaseSeconds', $config)) { - $this->setLeaseSeconds($config['leaseSeconds']); + if (array_key_exists('leaseSeconds', $options)) { + $this->setLeaseSeconds($options['leaseSeconds']); } - if (array_key_exists('parameters', $config)) { - $this->setParameters($config['parameters']); + if (array_key_exists('parameters', $options)) { + $this->setParameters($options['parameters']); } - if (array_key_exists('authentications', $config)) { - $this->addAuthentications($config['authentications']); + if (array_key_exists('authentications', $options)) { + $this->addAuthentications($options['authentications']); } - if (array_key_exists('usePathParameter', $config)) { - $this->usePathParameter($config['usePathParameter']); + if (array_key_exists('usePathParameter', $options)) { + $this->usePathParameter($options['usePathParameter']); } - if (array_key_exists('preferredVerificationMode', $config)) { + if (array_key_exists('preferredVerificationMode', $options)) { $this->setPreferredVerificationMode( - $config['preferredVerificationMode'] + $options['preferredVerificationMode'] ); } return $this; @@ -653,7 +659,7 @@ protected function _getHttpClient() { $client = PubSubHubbub::getHttpClient(); $client->setMethod(\Zend\Http\Client::POST); - $client->setConfig(array('useragent' => 'Zend_Feed_Pubsubhubbub_Subscriber/' + $client->setOptions(array('useragent' => 'Zend_Feed_Pubsubhubbub_Subscriber/' . \Zend\Version::VERSION)); return $client; } diff --git a/src/Writer/FeedFactory.php b/src/Writer/FeedFactory.php index 2b239cde..171d92f0 100644 --- a/src/Writer/FeedFactory.php +++ b/src/Writer/FeedFactory.php @@ -19,8 +19,11 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ + namespace Zend\Feed\Writer; +use Traversable; + /** * @category Zend * @package Zend_Feed @@ -31,15 +34,15 @@ abstract class FeedFactory { /** - * Create and return a Feed basd on data provided. + * Create and return a Feed based on data provided. * - * @param array|Traversable $data + * @param array|\Traversable $data * @return Feed */ public static function factory($data) { if (!is_array($data) && !$data instanceof Traversable) { - throw Exception\InvalidArgumentException(sprintf( + throw new Exception\InvalidArgumentException(sprintf( '%s expects an array or Traversable argument; received "%s"', __METHOD__, (is_object($data) ? get_class($data) : gettype($data)) diff --git a/test/PubSubHubbub/PublisherTest.php b/test/PubSubHubbub/PublisherTest.php index d8faae4b..39a13473 100644 --- a/test/PubSubHubbub/PublisherTest.php +++ b/test/PubSubHubbub/PublisherTest.php @@ -64,7 +64,7 @@ public function testAddsHubServerUrlsFromArray() public function testAddsHubServerUrlsFromArrayUsingSetConfig() { - $this->_publisher->setConfig(array('hubUrls' => array( + $this->_publisher->setOptions(array('hubUrls' => array( 'http://www.example.com/hub', 'http://www.example.com/hub2' ))); $this->assertEquals(array( @@ -138,7 +138,7 @@ public function testAddsUpdatedTopicUrlsFromArray() public function testAddsUpdatedTopicUrlsFromArrayUsingSetConfig() { - $this->_publisher->setConfig(array('updatedTopicUrls' => array( + $this->_publisher->setOptions(array('updatedTopicUrls' => array( 'http://www.example.com/topic', 'http://www.example.com/topic2' ))); $this->assertEquals(array( @@ -222,7 +222,7 @@ public function testAddsParametersFromArrayInSingleMethod() public function testAddsParametersFromArrayUsingSetConfig() { - $this->_publisher->setConfig(array('parameters' => array( + $this->_publisher->setOptions(array('parameters' => array( 'foo' => 'bar', 'boo' => 'baz' ))); $this->assertEquals(array( From b5929cdd8a221c2fd899007839962d14c2b6a685 Mon Sep 17 00:00:00 2001 From: Maks3w Date: Fri, 11 May 2012 01:22:53 +0200 Subject: [PATCH 206/238] [Config] Fix some mistakes --- src/PubSubHubbub/Publisher.php | 3 --- src/PubSubHubbub/Subscriber.php | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/PubSubHubbub/Publisher.php b/src/PubSubHubbub/Publisher.php index 71e3d3e4..f84458bb 100644 --- a/src/PubSubHubbub/Publisher.php +++ b/src/PubSubHubbub/Publisher.php @@ -89,9 +89,6 @@ public function setOptions($options) if ($options instanceof Traversable) { $options = ArrayUtils::iteratorToArray($options); } - if (is_array($options)) { - $this->setOptions($options); - } if (!is_array($options)) { throw new Exception('Array or Traversable object' diff --git a/src/PubSubHubbub/Subscriber.php b/src/PubSubHubbub/Subscriber.php index 000bda38..a030e5c5 100644 --- a/src/PubSubHubbub/Subscriber.php +++ b/src/PubSubHubbub/Subscriber.php @@ -160,9 +160,6 @@ public function setOptions($options) if ($options instanceof Traversable) { $options = ArrayUtils::iteratorToArray($options); } - if (is_array($options)) { - $this->setOptions($options); - } if (!is_array($options)) { throw new Exception('Array or Traversable object' From 3a86fa516b276becbc9e3a6d4fba9c02faabf4e1 Mon Sep 17 00:00:00 2001 From: Maks3w Date: Fri, 11 May 2012 11:06:08 +0200 Subject: [PATCH 207/238] [Tests] Update Travis script --- .travis/run-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/run-tests.sh b/.travis/run-tests.sh index 9334e959..7e1baa3b 100755 --- a/.travis/run-tests.sh +++ b/.travis/run-tests.sh @@ -7,7 +7,7 @@ result=0 for tested in "${testedcomponents[@]}" do echo "$tested:" - phpunit -c $testdir/phpunit.xml $testdir/$tested + phpunit -c $testdir/phpunit.xml.dist $testdir/$tested result=$(($result || $?)) done From e3c05d9d81285a166469d0518e4c3a9bb4632f42 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Fri, 11 May 2012 11:41:23 -0500 Subject: [PATCH 208/238] [zen-27][zendframework/zf2#1198] travis update - Remove Zend\Feed from skipped components list --- .travis/skipped-components | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis/skipped-components b/.travis/skipped-components index 6847359d..0790ed22 100644 --- a/.travis/skipped-components +++ b/.travis/skipped-components @@ -1,7 +1,6 @@ Zend/Amf Zend/Barcode Zend/Date -Zend/Feed Zend/Queue Zend/Service Zend/Test From d818c50e06e33f952c5d990df2bee0eae94b9c0a Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Fri, 11 May 2012 11:57:50 -0500 Subject: [PATCH 209/238] [zendframework/zf2#1199] Allow testing barcode - also changed tested-components to merely list "Zend\Feed", so all of feed is executed --- .travis/skipped-components | 1 - .travis/tested-components | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis/skipped-components b/.travis/skipped-components index 0790ed22..c4cd7065 100644 --- a/.travis/skipped-components +++ b/.travis/skipped-components @@ -1,5 +1,4 @@ Zend/Amf -Zend/Barcode Zend/Date Zend/Queue Zend/Service diff --git a/.travis/tested-components b/.travis/tested-components index c0fe6477..d1d71333 100644 --- a/.travis/tested-components +++ b/.travis/tested-components @@ -1,5 +1,6 @@ Zend/Acl Zend/Authentication +Zend/Barcode Zend/Cache Zend/Captcha Zend/Cloud @@ -14,8 +15,7 @@ Zend/DocBook Zend/Dojo Zend/Dom Zend/EventManager -Zend/Feed/Reader -Zend/Feed/Writer +Zend/Feed Zend/File Zend/Filter Zend/Form From 16de889fb19f1207744f892a2216663a6a82330c Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Fri, 11 May 2012 12:00:06 -0500 Subject: [PATCH 210/238] [zen-27][zendframework/zf2#1199] Fix failing subscriber test - s/setConfig/setOptions/ in test --- test/PubSubHubbub/SubscriberTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/PubSubHubbub/SubscriberTest.php b/test/PubSubHubbub/SubscriberTest.php index b7670f73..d227da7c 100644 --- a/test/PubSubHubbub/SubscriberTest.php +++ b/test/PubSubHubbub/SubscriberTest.php @@ -75,9 +75,9 @@ public function testAddsHubServerUrlsFromArray() ), $this->_subscriber->getHubUrls()); } - public function testAddsHubServerUrlsFromArrayUsingSetConfig() + public function testAddsHubServerUrlsFromArrayUsingSetOptions() { - $this->_subscriber->setConfig(array('hubUrls' => array( + $this->_subscriber->setOptions(array('hubUrls' => array( 'http://www.example.com/hub', 'http://www.example.com/hub2' ))); $this->assertEquals(array( @@ -157,9 +157,9 @@ public function testAddsParametersFromArrayInSingleMethod() ), $this->_subscriber->getParameters()); } - public function testAddsParametersFromArrayUsingSetConfig() + public function testAddsParametersFromArrayUsingSetOptions() { - $this->_subscriber->setConfig(array('parameters' => array( + $this->_subscriber->setOptions(array('parameters' => array( 'foo' => 'bar', 'boo' => 'baz' ))); $this->assertEquals(array( From 35d87f2e790ed06ebb17758b3c07eb0a2a7c8904 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Fri, 11 May 2012 12:18:48 -0500 Subject: [PATCH 211/238] [zen-27][zendframework/zf2#1199] Fix Translator tests - Fixes log setup and usage in tests and code for Translator - Re-enabled Translator tests, as they now appear to work --- .travis/skipped-components | 1 - .travis/tested-components | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/skipped-components b/.travis/skipped-components index c4cd7065..31bcaa87 100644 --- a/.travis/skipped-components +++ b/.travis/skipped-components @@ -3,5 +3,4 @@ Zend/Date Zend/Queue Zend/Service Zend/Test -Zend/Translator Zend/Wildfire diff --git a/.travis/tested-components b/.travis/tested-components index d1d71333..b1f4a794 100644 --- a/.travis/tested-components +++ b/.travis/tested-components @@ -51,6 +51,7 @@ Zend/Stdlib Zend/Tag Zend/Text Zend/TimeSync +Zend/Translator Zend/Uri Zend/Validator Zend/VersionTest.php From 38de7120751b214b9d4cc6e3d3d0f0fb9d8f4527 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Fri, 11 May 2012 08:17:31 -0500 Subject: [PATCH 212/238] [zen-12] Removed Dojo from test suite - Dojo integration largely relied on integration with Zend\Form; removing from testing for now, as it has not been refactored to work with the new Zend\Form code. --- .travis/skipped-components | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis/skipped-components b/.travis/skipped-components index 31bcaa87..171dfe9d 100644 --- a/.travis/skipped-components +++ b/.travis/skipped-components @@ -1,5 +1,6 @@ Zend/Amf Zend/Date +Zend/Dojo Zend/Queue Zend/Service Zend/Test From e239ac7faef511933b58320f20fd6e22a756459a Mon Sep 17 00:00:00 2001 From: Maks3w Date: Sun, 13 May 2012 10:43:04 +0200 Subject: [PATCH 213/238] [Feed] Remove duplicate test This is duplicate with Reader/ReaderTest --- test/ReaderTest.php | 373 -------------------------------------------- 1 file changed, 373 deletions(-) delete mode 100644 test/ReaderTest.php diff --git a/test/ReaderTest.php b/test/ReaderTest.php deleted file mode 100644 index 2a5c6f4c..00000000 --- a/test/ReaderTest.php +++ /dev/null @@ -1,373 +0,0 @@ -_feedSamplePath = __DIR__ . '/Reader/_files'; - } - - public function tearDown() - { - Reader\Reader::reset(); - } - - public function testDetectsFeedIsRss20() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/Reader/rss20.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_RSS_20, $type); - } - - public function testDetectsFeedIsRss094() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/Reader/rss094.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_RSS_094, $type); - } - - public function testDetectsFeedIsRss093() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/Reader/rss093.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_RSS_093, $type); - } - - public function testDetectsFeedIsRss092() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/Reader/rss092.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_RSS_092, $type); - } - - public function testDetectsFeedIsRss091() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/Reader/rss091.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_RSS_091, $type); - } - - public function testDetectsFeedIsRss10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/Reader/rss10.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_RSS_10, $type); - } - - public function testDetectsFeedIsRss090() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/Reader/rss090.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_RSS_090, $type); - } - - public function testDetectsFeedIsAtom10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/Reader/atom10.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_ATOM_10, $type); - } - - public function testDetectsFeedIsAtom03() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/Reader/atom03.xml')); - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_ATOM_03, $type); - } - - /** - * @group ZF-9723 - */ - public function testDetectsTypeFromStringOrToRemindPaddyAboutForgettingATestWhichLetsAStupidTypoSurviveUnnoticedForMonths() - { - $feed = ''; - $type = Reader\Reader::detectType($feed); - $this->assertEquals(Reader\Reader::TYPE_RSS_10, $type); - } - - public function testGetEncoding() - { - $feed = Reader\Reader::importString( - file_get_contents(__DIR__ . '/Reader/Entry/_files/Atom/title/plain/atom10.xml') - ); - - $this->assertEquals('utf-8', $feed->getEncoding()); - $this->assertEquals('utf-8', $feed->current()->getEncoding()); - } - - public function testImportsFile() - { - try { - $feed = Reader\Reader::importFile( - __DIR__ . '/Reader/Entry/_files/Atom/title/plain/atom10.xml' - ); - } catch(\Exception $e) { - $this->fail($e->getMessage()); - } - } - - public function testImportsUri() - { - if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - ) { - $this->markTestSkipped('testImportsUri() requires a network connection'); - return; - } - - try { - $feed = Reader\Reader::import('http://www.planet-php.net/rdf/'); - } catch(\Exception $e) { - $this->fail($e->getMessage()); - } - } - - /** - * @group ZF-8328 - */ - public function testImportsUriAndThrowsExceptionIfNotAFeed() - { - $this->setExpectedException('Zend\Feed\Exception\ExceptionInterface'); - if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - ) { - $this->markTestSkipped('testImportsUri() requires a network connection'); - return; - } - - $feed = Reader\Reader::import('http://twitter.com/alganet'); - } - - public function testGetsFeedLinksAsValueObject() - { - if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - ) { - $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); - return; - } - - try { - $links = Reader\Reader::findFeedLinks('http://www.planet-php.net'); - } catch(\Exception $e) { - $this->fail($e->getMessage()); - } - $this->assertEquals('http://www.planet-php.org/rss/', $links->rss); - } - - public function testCompilesLinksAsArrayObject() - { - if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - ) { - $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); - return; - } - $links = Reader\Reader::findFeedLinks('http://www.planet-php.net'); - $this->assertTrue($links instanceof Reader\FeedSet); - $this->assertEquals(array( - 'rel' => 'alternate', 'type' => 'application/rss+xml', 'href' => 'http://www.planet-php.org/rss/' - ), (array) $links->getIterator()->current()); - } - - public function testFeedSetLoadsFeedObjectWhenFeedArrayKeyAccessed() - { - if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - ) { - $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); - return; - } - $links = Reader\Reader::findFeedLinks('http://www.planet-php.net'); - $link = $links->getIterator()->current(); - $this->assertTrue($link['feed'] instanceof \Zend\Feed\Reader\Feed\RSS); - } - - public function testZeroCountFeedSetReturnedFromEmptyList() - { - if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - ) { - $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); - return; - } - $links = Reader\Reader::findFeedLinks('http://www.example.com'); - $this->assertEquals(0, count($links)); - } - - /** - * @group ZF-8327 - */ - public function testGetsFeedLinksAndTrimsNewlines() - { - if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - ) { - $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); - return; - } - - try { - $links = Reader\Reader::findFeedLinks('http://www.infopod.com.br'); - } catch(\Exception $e) { - $this->fail($e->getMessage()); - } - $this->assertEquals('http://feeds.feedburner.com/jonnyken/infoblog', $links->rss); - } - - /** - * @group ZF-8330 - */ - public function testGetsFeedLinksAndNormalisesRelativeUrls() - { - if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') - ) { - $this->markTestSkipped('testGetsFeedLinksAsValueObject() requires a network connection'); - return; - } - - try { - $links = Reader\Reader::findFeedLinks('http://meiobit.com'); - } catch(\Exception $e) { - $this->fail($e->getMessage()); - } - $this->assertEquals('http://meiobit.com/rss.xml', $links->rss); - } - - /** - * @group ZF-8330 - */ - public function testGetsFeedLinksAndNormalisesRelativeUrlsOnUriWithPath() - { - try { - $currClient = Reader\Reader::getHttpClient(); - - $response = new \Zend\Http\Response; - $response->setContent(''); - $response->setStatusCode(200); - - $testAdapter = new \Zend\Http\Client\Adapter\Test(); - $testAdapter->setResponse($response); - Reader\Reader::setHttpClient(new \Zend\Http\Client(null, array('adapter' => $testAdapter))); - - $links = Reader\Reader::findFeedLinks('http://foo/bar'); - - Reader\Reader::setHttpClient($currClient); - } catch(\Exception $e) { - $this->fail($e->getMessage()); - } - - $this->assertEquals('http://foo/test.rss', $links->rss); - $this->assertEquals('http://foo/test.atom', $links->atom); - } - - public function testAddsPrefixPath() - { - Reader\Reader::addPrefixPath('A\B\C', '/A/B/C'); - $prefixPaths = Reader\Reader::getPluginLoader()->getPaths(); - $this->assertEquals('/A/B/C/', $prefixPaths['A\B\C\\'][0]); - } - - public function testRegistersUserExtension() - { - try { - Reader\Reader::addPrefixPath('My\Extension', __DIR__ . '/Reader/_files/My/Extension'); - Reader\Reader::registerExtension('JungleBooks'); - } catch(\Exception $e) { - $this->fail($e->getMessage()); - } - $this->assertTrue(Reader\Reader::isRegistered('JungleBooks')); - } - - protected function _getTempDirectory() - { - $tmpdir = array(); - foreach (array($_ENV, $_SERVER) as $tab) { - foreach (array('TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot') as $key) { - if (isset($tab[$key])) { - if (($key == 'windir') or ($key == 'SystemRoot')) { - $dir = realpath($tab[$key] . '\\temp'); - } else { - $dir = realpath($tab[$key]); - } - if ($this->_isGoodTmpDir($dir)) { - return $dir; - } - } - } - } - if (function_exists('sys_get_temp_dir')) { - $dir = sys_get_temp_dir(); - if ($this->_isGoodTmpDir($dir)) { - return $dir; - } - } - $tempFile = tempnam(md5(uniqid(rand(), TRUE)), ''); - if ($tempFile) { - $dir = realpath(dirname($tempFile)); - unlink($tempFile); - if ($this->_isGoodTmpDir($dir)) { - return $dir; - } - } - if ($this->_isGoodTmpDir('/tmp')) { - return '/tmp'; - } - if ($this->_isGoodTmpDir('\\temp')) { - return '\\temp'; - } - } - - protected function _isGoodTmpDir($dir) - { - if (is_readable($dir) && is_writable($dir)) { - return true; - } - return false; - } - -} From 6a25e0829ef515baecb8fbc02c98e5a42055515a Mon Sep 17 00:00:00 2001 From: Maks3w Date: Fri, 18 May 2012 00:22:37 +0200 Subject: [PATCH 214/238] [Travis] Enable Zend\Math tests --- .travis/tested-components | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis/tested-components b/.travis/tested-components index b1f4a794..9b338206 100644 --- a/.travis/tested-components +++ b/.travis/tested-components @@ -29,6 +29,7 @@ Zend/Locale Zend/Log Zend/Mail Zend/Markup +Zend/Math Zend/Measure Zend/Memory Zend/Mime From d86e3722d7e11d415020f02f3a3f9ed7c29521e8 Mon Sep 17 00:00:00 2001 From: prolic Date: Wed, 23 May 2012 22:11:04 +0200 Subject: [PATCH 215/238] Zend\Feed replaced "get_class()" with "get_called_class()" because it's faster, fixed some phpdoc --- src/PubSubHubbub/Model/AbstractModel.php | 8 ++++---- src/Writer/Renderer/AbstractRenderer.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/PubSubHubbub/Model/AbstractModel.php b/src/PubSubHubbub/Model/AbstractModel.php index 6b07a06d..64b8a221 100644 --- a/src/PubSubHubbub/Model/AbstractModel.php +++ b/src/PubSubHubbub/Model/AbstractModel.php @@ -20,7 +20,7 @@ namespace Zend\Feed\PubSubHubbub\Model; -use \Zend\Db\TableGateway; +use Zend\Db\TableGateway; /** * @category Zend @@ -33,7 +33,7 @@ class AbstractModel /** * Zend_Db_Table instance to host database methods * - * @var \Zend\Db\Table\Table + * @var TableGateway\TableGatewayInterface */ protected $_db = null; @@ -41,13 +41,13 @@ class AbstractModel * Constructor * * @param array $data - * @param \Zend\Db\Table\AbstractTable $tableGateway + * @param TableGateway\TableGatewayInterface $tableGateway * @return void */ public function __construct(TableGateway\TableGatewayInterface $tableGateway = null) { if ($tableGateway === null) { - $parts = explode('\\', get_class($this)); + $parts = explode('\\', get_called_class()); $table = strtolower(array_pop($parts)); $this->_db = new TableGateway\TableGateway($table); } else { diff --git a/src/Writer/Renderer/AbstractRenderer.php b/src/Writer/Renderer/AbstractRenderer.php index fede98b9..96d6e4b8 100644 --- a/src/Writer/Renderer/AbstractRenderer.php +++ b/src/Writer/Renderer/AbstractRenderer.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Writer\Renderer; -use Zend\Feed\Writer, - DOMDocument, - DOMElement; +use DOMDocument; +use DOMElement; +use Zend\Feed\Writer; /** * @category Zend @@ -233,7 +233,7 @@ protected function _loadExtensions() { Writer\Writer::registerCoreExtensions(); $all = Writer\Writer::getExtensions(); - if (stripos(get_class($this), 'entry')) { + if (stripos(get_called_class(), 'entry')) { $exts = $all['entryRenderer']; } else { $exts = $all['feedRenderer']; From 9e114083b8dca3ed6e36dcac0ca7bada615975b9 Mon Sep 17 00:00:00 2001 From: Marc Bennewitz Date: Mon, 28 May 2012 22:14:00 +0200 Subject: [PATCH 216/238] updated Zend\Feed & Zend\Memory to use the simplified cache API --- src/Reader/Reader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Reader/Reader.php b/src/Reader/Reader.php index 56f62378..fc5aecd9 100644 --- a/src/Reader/Reader.php +++ b/src/Reader/Reader.php @@ -253,7 +253,7 @@ public static function import($uri, $etag = null, $lastModified = null) return self::importString($responseXml); } elseif ($cache) { $data = $cache->getItem($cacheId); - if ($data !== false) { + if ($data) { return self::importString($data); } $response = $client->send(); From c2198f5cdf7ec996f46413de439ba3ea7d208e2f Mon Sep 17 00:00:00 2001 From: Marc Bennewitz Date: Mon, 28 May 2012 23:30:09 +0200 Subject: [PATCH 217/238] updated Zend\Feed to use the simplified cache API --- src/Reader/Reader.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Reader/Reader.php b/src/Reader/Reader.php index fc5aecd9..ee42b652 100644 --- a/src/Reader/Reader.php +++ b/src/Reader/Reader.php @@ -20,7 +20,7 @@ namespace Zend\Feed\Reader; -use Zend\Cache\Storage\Adapter\AdapterInterface as CacheAdapter, +use Zend\Cache\Storage\StorageInterface as CacheStorage, Zend\Http, Zend\Loader, Zend\Stdlib\ErrorHandler, @@ -66,7 +66,7 @@ class Reader /** * Cache instance * - * @var CacheAdapter + * @var CacheStorage */ protected static $_cache = null; @@ -112,7 +112,7 @@ class Reader /** * Get the Feed cache * - * @return CacheAdapter + * @return CacheStorage */ public static function getCache() { @@ -122,10 +122,10 @@ public static function getCache() /** * Set the feed cache * - * @param CacheAdapter $cache + * @param CacheStorage $cache * @return void */ - public static function setCache(CacheAdapter $cache) + public static function setCache(CacheStorage $cache) { self::$_cache = $cache; } From 469ba46bd520050191e424027618be1455fceb00 Mon Sep 17 00:00:00 2001 From: prolic Date: Sat, 23 Jun 2012 15:03:06 +0200 Subject: [PATCH 218/238] fixed use statements in Zend\Feed --- src/PubSubHubbub/PubSubHubbub.php | 4 ++-- src/PubSubHubbub/Subscriber/Callback.php | 4 ++-- src/Reader/AbstractEntry.php | 6 +++--- src/Reader/AbstractFeed.php | 6 +++--- src/Reader/Entry/AbstractEntry.php | 10 +++++----- src/Reader/Entry/Atom.php | 6 +++--- src/Reader/Entry/Rss.php | 10 +++++----- src/Reader/Extension/AbstractEntry.php | 8 ++++---- src/Reader/Extension/AbstractFeed.php | 6 +++--- src/Reader/Extension/Atom/Entry.php | 16 ++++++++-------- src/Reader/Extension/Atom/Feed.php | 12 ++++++------ src/Reader/Extension/Content/Entry.php | 4 ++-- src/Reader/Extension/CreativeCommons/Feed.php | 4 ++-- src/Reader/Extension/DublinCore/Entry.php | 10 +++++----- src/Reader/Extension/DublinCore/Feed.php | 8 ++++---- src/Reader/Extension/Podcast/Feed.php | 4 ++-- src/Reader/Extension/Syndication/Feed.php | 6 +++--- src/Reader/Feed/AbstractFeed.php | 8 ++++---- src/Reader/Feed/Atom.php | 6 +++--- src/Reader/Feed/Atom/Source.php | 10 +++++----- src/Reader/Feed/FeedInterface.php | 4 ++-- src/Reader/Feed/Rss.php | 10 +++++----- src/Reader/FeedSet.php | 6 +++--- src/Reader/Reader.php | 12 ++++++------ src/Writer/AbstractFeed.php | 6 +++--- src/Writer/Deleted.php | 4 ++-- src/Writer/Entry.php | 6 +++--- src/Writer/Extension/AbstractRenderer.php | 4 ++-- src/Writer/Extension/Atom/Renderer/Feed.php | 6 +++--- src/Writer/Extension/Content/Renderer/Entry.php | 6 +++--- .../Extension/DublinCore/Renderer/Entry.php | 6 +++--- .../Extension/DublinCore/Renderer/Feed.php | 6 +++--- src/Writer/Extension/ITunes/Feed.php | 4 ++-- src/Writer/Extension/ITunes/Renderer/Entry.php | 6 +++--- src/Writer/Extension/ITunes/Renderer/Feed.php | 6 +++--- src/Writer/Extension/Renderer.php | 4 ++-- src/Writer/Extension/Slash/Renderer/Entry.php | 6 +++--- .../Extension/Threading/Renderer/Entry.php | 6 +++--- .../Extension/WellFormedWeb/Renderer/Entry.php | 6 +++--- src/Writer/Feed.php | 8 ++++---- src/Writer/Renderer/Entry/Atom.php | 14 +++++++------- src/Writer/Renderer/Entry/Atom/Deleted.php | 4 ++-- src/Writer/Renderer/Entry/Rss.php | 12 ++++++------ src/Writer/Renderer/Feed/AbstractAtom.php | 10 +++++----- src/Writer/Renderer/Feed/Atom.php | 6 +++--- src/Writer/Renderer/Feed/Atom/AbstractAtom.php | 6 +++--- src/Writer/Renderer/Feed/Atom/Source.php | 4 ++-- src/Writer/Renderer/Feed/AtomSource.php | 8 ++++---- src/Writer/Renderer/Feed/Rss.php | 12 ++++++------ src/Writer/Renderer/RendererInterface.php | 4 ++-- src/Writer/Writer.php | 8 ++++---- 51 files changed, 179 insertions(+), 179 deletions(-) diff --git a/src/PubSubHubbub/PubSubHubbub.php b/src/PubSubHubbub/PubSubHubbub.php index cc40e61a..90c2f723 100644 --- a/src/PubSubHubbub/PubSubHubbub.php +++ b/src/PubSubHubbub/PubSubHubbub.php @@ -20,8 +20,8 @@ namespace Zend\Feed\PubSubHubbub; -use Zend\Feed\Reader, - Zend\Http; +use Zend\Feed\Reader; +use Zend\Http; /** * @category Zend diff --git a/src/PubSubHubbub/Subscriber/Callback.php b/src/PubSubHubbub/Subscriber/Callback.php index f39e97d3..63337920 100644 --- a/src/PubSubHubbub/Subscriber/Callback.php +++ b/src/PubSubHubbub/Subscriber/Callback.php @@ -20,8 +20,8 @@ namespace Zend\Feed\PubSubHubbub\Subscriber; -use Zend\Feed\PubSubHubbub, - Zend\Uri; +use Zend\Feed\PubSubHubbub; +use Zend\Uri; /** * @category Zend diff --git a/src/Reader/AbstractEntry.php b/src/Reader/AbstractEntry.php index d95755cb..09b1a36b 100644 --- a/src/Reader/AbstractEntry.php +++ b/src/Reader/AbstractEntry.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Reader; -use DOMElement, - DOMDocument, - DOMXPath; +use DOMElement; +use DOMDocument; +use DOMXPath; /** * @category Zend diff --git a/src/Reader/AbstractFeed.php b/src/Reader/AbstractFeed.php index 6623ee58..b14d83bb 100644 --- a/src/Reader/AbstractFeed.php +++ b/src/Reader/AbstractFeed.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Reader; -use DOMDocument, - DOMElement, - DOMXPath; +use DOMDocument; +use DOMElement; +use DOMXPath; /** * @category Zend diff --git a/src/Reader/Entry/AbstractEntry.php b/src/Reader/Entry/AbstractEntry.php index bf27e6c6..d10774f3 100644 --- a/src/Reader/Entry/AbstractEntry.php +++ b/src/Reader/Entry/AbstractEntry.php @@ -20,11 +20,11 @@ namespace Zend\Feed\Reader\Entry; -use Zend\Feed\Reader, - Zend\Feed\Reader\Exception, - DOMElement, - DOMDocument, - DOMXPath; +use Zend\Feed\Reader; +use Zend\Feed\Reader\Exception; +use DOMElement; +use DOMDocument; +use DOMXPath; /** * @category Zend diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index fe46ff1f..9e09d0d9 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Reader\Entry; -use Zend\Feed\Reader, - DOMElement, - DOMXPath; +use Zend\Feed\Reader; +use DOMElement; +use DOMXPath; /** * @category Zend diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index c266d4fb..a5e90da1 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -20,11 +20,11 @@ namespace Zend\Feed\Reader\Entry; -use Zend\Feed\Reader, - Zend\Date, - Zend\Feed\Reader\Exception, - DOMElement, - DOMXPath; +use Zend\Feed\Reader; +use Zend\Date; +use Zend\Feed\Reader\Exception; +use DOMElement; +use DOMXPath; /** * @category Zend diff --git a/src/Reader/Extension/AbstractEntry.php b/src/Reader/Extension/AbstractEntry.php index 7b08ffd6..95f43f7c 100644 --- a/src/Reader/Extension/AbstractEntry.php +++ b/src/Reader/Extension/AbstractEntry.php @@ -20,10 +20,10 @@ namespace Zend\Feed\Reader\Extension; -use Zend\Feed\Reader, - DOMXPath, - DOMDocument, - DOMElement; +use Zend\Feed\Reader; +use DOMXPath; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Reader/Extension/AbstractFeed.php b/src/Reader/Extension/AbstractFeed.php index c44a5669..934e856d 100644 --- a/src/Reader/Extension/AbstractFeed.php +++ b/src/Reader/Extension/AbstractFeed.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Reader\Extension; -use Zend\Feed\Reader, - DOMDocument, - DOMXPath; +use Zend\Feed\Reader; +use DOMDocument; +use DOMXPath; /** * @category Zend diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 42667b86..1e0872ad 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -20,14 +20,14 @@ namespace Zend\Feed\Reader\Extension\Atom; -use DOMDocument, - DOMElement, - stdClass, - Zend\Date, - Zend\Feed\Reader, - Zend\Feed\Reader\Collection, - Zend\Feed\Reader\Extension, - Zend\Uri; +use DOMDocument; +use DOMElement; +use stdClass; +use Zend\Date; +use Zend\Feed\Reader; +use Zend\Feed\Reader\Collection; +use Zend\Feed\Reader\Extension; +use Zend\Uri; /** * @category Zend diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index 10f2b860..f3d4101e 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -20,12 +20,12 @@ namespace Zend\Feed\Reader\Extension\Atom; -use Zend\Date, - Zend\Feed\Reader, - Zend\Feed\Reader\Collection, - Zend\Feed\Reader\Extension, - Zend\Uri, - DOMElement; +use Zend\Date; +use Zend\Feed\Reader; +use Zend\Feed\Reader\Collection; +use Zend\Feed\Reader\Extension; +use Zend\Uri; +use DOMElement; /** * @category Zend diff --git a/src/Reader/Extension/Content/Entry.php b/src/Reader/Extension/Content/Entry.php index f83d5ff9..80e58737 100644 --- a/src/Reader/Extension/Content/Entry.php +++ b/src/Reader/Extension/Content/Entry.php @@ -20,8 +20,8 @@ namespace Zend\Feed\Reader\Extension\Content; -use Zend\Feed\Reader, - Zend\Feed\Reader\Extension; +use Zend\Feed\Reader; +use Zend\Feed\Reader\Extension; /** * @category Zend diff --git a/src/Reader/Extension/CreativeCommons/Feed.php b/src/Reader/Extension/CreativeCommons/Feed.php index b6634145..84afa1fc 100644 --- a/src/Reader/Extension/CreativeCommons/Feed.php +++ b/src/Reader/Extension/CreativeCommons/Feed.php @@ -20,8 +20,8 @@ namespace Zend\Feed\Reader\Extension\CreativeCommons; -use Zend\Feed\Reader, - Zend\Feed\Reader\Extension; +use Zend\Feed\Reader; +use Zend\Feed\Reader\Extension; /** * @category Zend diff --git a/src/Reader/Extension/DublinCore/Entry.php b/src/Reader/Extension/DublinCore/Entry.php index 452f55a1..e2e6db13 100644 --- a/src/Reader/Extension/DublinCore/Entry.php +++ b/src/Reader/Extension/DublinCore/Entry.php @@ -20,11 +20,11 @@ namespace Zend\Feed\Reader\Extension\DublinCore; -use Zend\Feed\Reader, - Zend\Feed\Reader\Collection, - Zend\Feed\Reader\Extension, - Zend\Date, - DOMElement; +use Zend\Feed\Reader; +use Zend\Feed\Reader\Collection; +use Zend\Feed\Reader\Extension; +use Zend\Date; +use DOMElement; /** * @category Zend diff --git a/src/Reader/Extension/DublinCore/Feed.php b/src/Reader/Extension/DublinCore/Feed.php index 57f9bf61..d0542350 100644 --- a/src/Reader/Extension/DublinCore/Feed.php +++ b/src/Reader/Extension/DublinCore/Feed.php @@ -20,10 +20,10 @@ namespace Zend\Feed\Reader\Extension\DublinCore; -use Zend\Feed\Reader, - Zend\Feed\Reader\Collection, - Zend\Feed\Reader\Extension, - Zend\Date; +use Zend\Feed\Reader; +use Zend\Feed\Reader\Collection; +use Zend\Feed\Reader\Extension; +use Zend\Date; /** * @category Zend diff --git a/src/Reader/Extension/Podcast/Feed.php b/src/Reader/Extension/Podcast/Feed.php index c5b81f36..59fdfb0b 100644 --- a/src/Reader/Extension/Podcast/Feed.php +++ b/src/Reader/Extension/Podcast/Feed.php @@ -20,8 +20,8 @@ namespace Zend\Feed\Reader\Extension\Podcast; -use Zend\Feed\Reader\Extension, - DOMText; +use Zend\Feed\Reader\Extension; +use DOMText; /** * @category Zend diff --git a/src/Reader/Extension/Syndication/Feed.php b/src/Reader/Extension/Syndication/Feed.php index 7f2b7ae1..c0b65b1e 100644 --- a/src/Reader/Extension/Syndication/Feed.php +++ b/src/Reader/Extension/Syndication/Feed.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Reader\Extension\Syndication; -use Zend\Feed\Reader, - Zend\Feed\Reader\Extension, - Zend\Date; +use Zend\Feed\Reader; +use Zend\Feed\Reader\Extension; +use Zend\Date; /** * @category Zend diff --git a/src/Reader/Feed/AbstractFeed.php b/src/Reader/Feed/AbstractFeed.php index 500800b2..7f948241 100644 --- a/src/Reader/Feed/AbstractFeed.php +++ b/src/Reader/Feed/AbstractFeed.php @@ -20,10 +20,10 @@ namespace Zend\Feed\Reader\Feed; -use Zend\Feed\Reader, - Zend\Feed\Reader\Exception, - DOMXPath, - DOMDocument; +use Zend\Feed\Reader; +use Zend\Feed\Reader\Exception; +use DOMXPath; +use DOMDocument; /** * @category Zend diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index b1336381..4c5c0833 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Reader\Feed; -use Zend\Feed\Reader, - Zend\Date, - DOMDocument; +use Zend\Feed\Reader; +use Zend\Date; +use DOMDocument; /** * @category Zend diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php index 3731f031..d8153867 100644 --- a/src/Reader/Feed/Atom/Source.php +++ b/src/Reader/Feed/Atom/Source.php @@ -20,11 +20,11 @@ namespace Zend\Feed\Reader\Feed\Atom; -use Zend\Feed\Reader, - Zend\Feed\Reader\Feed, - Zend\Date, - DOMElement, - DOMXPath; +use Zend\Feed\Reader; +use Zend\Feed\Reader\Feed; +use Zend\Date; +use DOMElement; +use DOMXPath; /** * @category Zend diff --git a/src/Reader/Feed/FeedInterface.php b/src/Reader/Feed/FeedInterface.php index 93e38f22..dbc70c7d 100644 --- a/src/Reader/Feed/FeedInterface.php +++ b/src/Reader/Feed/FeedInterface.php @@ -20,8 +20,8 @@ namespace Zend\Feed\Reader\Feed; -use Iterator, - Countable; +use Iterator; +use Countable; /** * @category Zend diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index f4b77b9e..2667cea4 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -20,11 +20,11 @@ namespace Zend\Feed\Reader\Feed; -use Zend\Feed\Reader, - Zend\Feed\Reader\Collection, - Zend\Feed\Reader\Exception, - Zend\Date, - DOMDocument; +use Zend\Feed\Reader; +use Zend\Feed\Reader\Collection; +use Zend\Feed\Reader\Exception; +use Zend\Date; +use DOMDocument; /** * @category Zend diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php index cdc51bb8..d0776d8b 100644 --- a/src/Reader/FeedSet.php +++ b/src/Reader/FeedSet.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Reader; -use ArrayObject, - DOMNodeList, - Zend\Uri; +use ArrayObject; +use DOMNodeList; +use Zend\Uri; /** * @category Zend diff --git a/src/Reader/Reader.php b/src/Reader/Reader.php index ee42b652..e9521c1f 100644 --- a/src/Reader/Reader.php +++ b/src/Reader/Reader.php @@ -20,12 +20,12 @@ namespace Zend\Feed\Reader; -use Zend\Cache\Storage\StorageInterface as CacheStorage, - Zend\Http, - Zend\Loader, - Zend\Stdlib\ErrorHandler, - DOMDocument, - DOMXPath; +use Zend\Cache\Storage\StorageInterface as CacheStorage; +use Zend\Http; +use Zend\Loader; +use Zend\Stdlib\ErrorHandler; +use DOMDocument; +use DOMXPath; /** * @category Zend diff --git a/src/Writer/AbstractFeed.php b/src/Writer/AbstractFeed.php index 48c43351..e2f42523 100644 --- a/src/Writer/AbstractFeed.php +++ b/src/Writer/AbstractFeed.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Writer; -use Zend\Uri, - Zend\Date, - Zend\Validator; +use Zend\Uri; +use Zend\Date; +use Zend\Validator; /** * @category Zend diff --git a/src/Writer/Deleted.php b/src/Writer/Deleted.php index 4dc82be6..83e81b69 100644 --- a/src/Writer/Deleted.php +++ b/src/Writer/Deleted.php @@ -20,8 +20,8 @@ namespace Zend\Feed\Writer; -use Zend\Date, - Zend\Uri; +use Zend\Date; +use Zend\Uri; /** * @category Zend diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index a3cb0c6a..97343769 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Writer; -use Zend\Feed\Writer\Exception, - Zend\Uri, - Zend\Date; +use Zend\Feed\Writer\Exception; +use Zend\Uri; +use Zend\Date; /** * @category Zend diff --git a/src/Writer/Extension/AbstractRenderer.php b/src/Writer/Extension/AbstractRenderer.php index baa56639..88907a85 100644 --- a/src/Writer/Extension/AbstractRenderer.php +++ b/src/Writer/Extension/AbstractRenderer.php @@ -20,8 +20,8 @@ namespace Zend\Feed\Writer\Extension; -use DOMDocument, - DOMElement; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Writer/Extension/Atom/Renderer/Feed.php b/src/Writer/Extension/Atom/Renderer/Feed.php index 5a9b5b9e..86e910b2 100644 --- a/src/Writer/Extension/Atom/Renderer/Feed.php +++ b/src/Writer/Extension/Atom/Renderer/Feed.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Writer\Extension\Atom\Renderer; -use Zend\Feed\Writer\Extension, - DOMDocument, - DOMElement; +use Zend\Feed\Writer\Extension; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Writer/Extension/Content/Renderer/Entry.php b/src/Writer/Extension/Content/Renderer/Entry.php index a7669f97..5dd5ccbc 100644 --- a/src/Writer/Extension/Content/Renderer/Entry.php +++ b/src/Writer/Extension/Content/Renderer/Entry.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Writer\Extension\Content\Renderer; -use Zend\Feed\Writer\Extension, - DOMDocument, - DOMElement; +use Zend\Feed\Writer\Extension; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Writer/Extension/DublinCore/Renderer/Entry.php b/src/Writer/Extension/DublinCore/Renderer/Entry.php index 8a2be91c..fcb03000 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Entry.php +++ b/src/Writer/Extension/DublinCore/Renderer/Entry.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Writer\Extension\DublinCore\Renderer; -use Zend\Feed\Writer\Extension, - DOMDocument, - DOMElement; +use Zend\Feed\Writer\Extension; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Writer/Extension/DublinCore/Renderer/Feed.php b/src/Writer/Extension/DublinCore/Renderer/Feed.php index 05edddc0..4c02f81b 100644 --- a/src/Writer/Extension/DublinCore/Renderer/Feed.php +++ b/src/Writer/Extension/DublinCore/Renderer/Feed.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Writer\Extension\DublinCore\Renderer; -use Zend\Feed\Writer\Extension, - DOMDocument, - DOMElement; +use Zend\Feed\Writer\Extension; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Writer/Extension/ITunes/Feed.php b/src/Writer/Extension/ITunes/Feed.php index 4f33f123..c57c9319 100644 --- a/src/Writer/Extension/ITunes/Feed.php +++ b/src/Writer/Extension/ITunes/Feed.php @@ -20,8 +20,8 @@ namespace Zend\Feed\Writer\Extension\ITunes; -use Zend\Feed\Writer, - Zend\Uri; +use Zend\Feed\Writer; +use Zend\Uri; /** * @category Zend diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php index dab3105a..4c2b860a 100644 --- a/src/Writer/Extension/ITunes/Renderer/Entry.php +++ b/src/Writer/Extension/ITunes/Renderer/Entry.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Writer\Extension\ITunes\Renderer; -use Zend\Feed\Writer\Extension, - DOMDocument, - DOMElement; +use Zend\Feed\Writer\Extension; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php index 77cabdbf..63c2d643 100644 --- a/src/Writer/Extension/ITunes/Renderer/Feed.php +++ b/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Writer\Extension\ITunes\Renderer; -use Zend\Feed\Writer\Extension, - DOMDocument, - DOMElement; +use Zend\Feed\Writer\Extension; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Writer/Extension/Renderer.php b/src/Writer/Extension/Renderer.php index 297664c4..5de01266 100644 --- a/src/Writer/Extension/Renderer.php +++ b/src/Writer/Extension/Renderer.php @@ -20,8 +20,8 @@ namespace Zend\Feed\Writer\Extension; -use DOMDocument, - DOMElement; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Writer/Extension/Slash/Renderer/Entry.php b/src/Writer/Extension/Slash/Renderer/Entry.php index d0b27c0e..51594837 100644 --- a/src/Writer/Extension/Slash/Renderer/Entry.php +++ b/src/Writer/Extension/Slash/Renderer/Entry.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Writer\Extension\Slash\Renderer; -use Zend\Feed\Writer\Extension, - DOMDocument, - DOMElement; +use Zend\Feed\Writer\Extension; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php index 24f90471..36db2d9f 100644 --- a/src/Writer/Extension/Threading/Renderer/Entry.php +++ b/src/Writer/Extension/Threading/Renderer/Entry.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Writer\Extension\Threading\Renderer; -use Zend\Feed\Writer\Extension, - DOMDocument, - DOMElement; +use Zend\Feed\Writer\Extension; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php index 38ac7ad9..25e99504 100644 --- a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php +++ b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Writer\Extension\WellFormedWeb\Renderer; -use Zend\Feed\Writer\Extension, - DOMDocument, - DOMElement; +use Zend\Feed\Writer\Extension; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Writer/Feed.php b/src/Writer/Feed.php index 8fd2bb85..9900abee 100644 --- a/src/Writer/Feed.php +++ b/src/Writer/Feed.php @@ -20,10 +20,10 @@ namespace Zend\Feed\Writer; -use Countable, - Iterator, - Zend\Date, - Zend\Feed\Writer\Renderer; +use Countable; +use Iterator; +use Zend\Date; +use Zend\Feed\Writer\Renderer; /** * @category Zend diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom.php index eeb1cbe1..d6fc1f9c 100644 --- a/src/Writer/Renderer/Entry/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -20,13 +20,13 @@ namespace Zend\Feed\Writer\Renderer\Entry; -use DOMDocument, - DOMElement, - Zend\Date, - Zend\Feed\Writer, - Zend\Feed\Writer\Renderer, - Zend\Uri, - Zend\Validator; +use DOMDocument; +use DOMElement; +use Zend\Date; +use Zend\Feed\Writer; +use Zend\Feed\Writer\Renderer; +use Zend\Uri; +use Zend\Validator; /** * @category Zend diff --git a/src/Writer/Renderer/Entry/Atom/Deleted.php b/src/Writer/Renderer/Entry/Atom/Deleted.php index 1b702091..0a151abb 100644 --- a/src/Writer/Renderer/Entry/Atom/Deleted.php +++ b/src/Writer/Renderer/Entry/Atom/Deleted.php @@ -20,8 +20,8 @@ namespace Zend\Feed\Writer\Renderer\Entry\Atom; -use DOMDocument, - DOMElement; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Writer/Renderer/Entry/Rss.php b/src/Writer/Renderer/Entry/Rss.php index 32ce4953..6744e874 100644 --- a/src/Writer/Renderer/Entry/Rss.php +++ b/src/Writer/Renderer/Entry/Rss.php @@ -20,12 +20,12 @@ namespace Zend\Feed\Writer\Renderer\Entry; -use Zend\Date, - Zend\Feed\Writer, - Zend\Feed\Writer\Renderer, - Zend\Uri, - DOMDocument, - DOMElement; +use Zend\Date; +use Zend\Feed\Writer; +use Zend\Feed\Writer\Renderer; +use Zend\Uri; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Writer/Renderer/Feed/AbstractAtom.php b/src/Writer/Renderer/Feed/AbstractAtom.php index fde2e6eb..1a26d30f 100644 --- a/src/Writer/Renderer/Feed/AbstractAtom.php +++ b/src/Writer/Renderer/Feed/AbstractAtom.php @@ -20,11 +20,11 @@ namespace Zend\Feed\Writer\Renderer\Feed; -use Zend\Feed\Writer\Renderer, - Zend\Date, - Zend\Feed\Writer, - DOMDocument, - DOMElement; +use Zend\Feed\Writer\Renderer; +use Zend\Date; +use Zend\Feed\Writer; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Writer/Renderer/Feed/Atom.php b/src/Writer/Renderer/Feed/Atom.php index ef113b0f..981b85cb 100644 --- a/src/Writer/Renderer/Feed/Atom.php +++ b/src/Writer/Renderer/Feed/Atom.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Writer\Renderer\Feed; -use Zend\Feed\Writer\Renderer, - Zend\Feed\Writer, - DOMDocument; +use Zend\Feed\Writer\Renderer; +use Zend\Feed\Writer; +use DOMDocument; /** * @category Zend diff --git a/src/Writer/Renderer/Feed/Atom/AbstractAtom.php b/src/Writer/Renderer/Feed/Atom/AbstractAtom.php index 3a9f0963..eb817664 100644 --- a/src/Writer/Renderer/Feed/Atom/AbstractAtom.php +++ b/src/Writer/Renderer/Feed/Atom/AbstractAtom.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Writer\Renderer\Feed\Atom; -use Zend\Feed, - DOMDocument, - DOMElement; +use Zend\Feed; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Writer/Renderer/Feed/Atom/Source.php b/src/Writer/Renderer/Feed/Atom/Source.php index 5e34e05b..8958cd38 100644 --- a/src/Writer/Renderer/Feed/Atom/Source.php +++ b/src/Writer/Renderer/Feed/Atom/Source.php @@ -20,8 +20,8 @@ namespace Zend\Feed\Writer\Renderer\Feed\Atom; -use DOMDocument, - DOMElement; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Writer/Renderer/Feed/AtomSource.php b/src/Writer/Renderer/Feed/AtomSource.php index 005d000c..cff02b45 100644 --- a/src/Writer/Renderer/Feed/AtomSource.php +++ b/src/Writer/Renderer/Feed/AtomSource.php @@ -20,10 +20,10 @@ namespace Zend\Feed\Writer\Renderer\Feed; -use Zend\Feed\Writer\Renderer, - Zend\Feed\Writer, - DOMElement, - DOMDocument; +use Zend\Feed\Writer\Renderer; +use Zend\Feed\Writer; +use DOMElement; +use DOMDocument; /** * @category Zend diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index a129cb7f..56420c96 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -20,12 +20,12 @@ namespace Zend\Feed\Writer\Renderer\Feed; -use DOMDocument, - DOMElement, - Zend\Date, - Zend\Feed\Writer, - Zend\Feed\Writer\Renderer, - Zend\Uri; +use DOMDocument; +use DOMElement; +use Zend\Date; +use Zend\Feed\Writer; +use Zend\Feed\Writer\Renderer; +use Zend\Uri; /** * @category Zend diff --git a/src/Writer/Renderer/RendererInterface.php b/src/Writer/Renderer/RendererInterface.php index c2468aec..1d0f76c8 100644 --- a/src/Writer/Renderer/RendererInterface.php +++ b/src/Writer/Renderer/RendererInterface.php @@ -20,8 +20,8 @@ namespace Zend\Feed\Writer\Renderer; -use DOMDocument, - DOMElement; +use DOMDocument; +use DOMElement; /** * @category Zend diff --git a/src/Writer/Writer.php b/src/Writer/Writer.php index fbb472ef..c6b8b0ba 100644 --- a/src/Writer/Writer.php +++ b/src/Writer/Writer.php @@ -20,10 +20,10 @@ namespace Zend\Feed\Writer; -use Zend\Loader\ShortNameLocator, - Zend\Loader\PrefixPathLoader, - Zend\Loader\PrefixPathMapper, - Zend\Loader\Exception\PluginLoaderException; +use Zend\Loader\ShortNameLocator; +use Zend\Loader\PrefixPathLoader; +use Zend\Loader\PrefixPathMapper; +use Zend\Loader\Exception\PluginLoaderException; /** * @category Zend From 545292f695969f6753cc405e7475e0d280c2c05c Mon Sep 17 00:00:00 2001 From: Maks3w Date: Wed, 27 Jun 2012 14:09:14 +0200 Subject: [PATCH 219/238] [Feed] Remove Zend\Date in favor of DateTime --- src/PubSubHubbub/Model/Subscription.php | 23 +- src/PubSubHubbub/Subscriber.php | 11 +- src/Reader/Entry/Rss.php | 15 +- src/Reader/Extension/Atom/Entry.php | 8 +- src/Reader/Extension/Atom/Feed.php | 14 +- src/Reader/Extension/DublinCore/Entry.php | 7 +- src/Reader/Extension/DublinCore/Feed.php | 9 +- src/Reader/Extension/Syndication/Feed.php | 9 +- src/Reader/Feed/Atom.php | 1 - src/Reader/Feed/Atom/Source.php | 1 - src/Reader/Feed/Rss.php | 32 +- src/Writer/AbstractFeed.php | 58 ++- src/Writer/Deleted.php | 26 +- src/Writer/Entry.php | 40 +- src/Writer/Feed.php | 6 +- src/Writer/Renderer/Entry/Atom.php | 6 +- src/Writer/Renderer/Entry/Atom/Deleted.php | 3 +- src/Writer/Renderer/Entry/AtomDeleted.php | 3 +- src/Writer/Renderer/Entry/Rss.php | 4 +- src/Writer/Renderer/Feed/AbstractAtom.php | 4 +- .../Renderer/Feed/Atom/AbstractAtom.php | 3 +- src/Writer/Renderer/Feed/Rss.php | 6 +- test/PubSubHubbub/Model/SubscriptionTest.php | 4 +- test/PubSubHubbub/Subscriber/CallbackTest.php | 23 +- test/Reader/Entry/AtomStandaloneEntryTest.php | 28 +- test/Reader/Entry/AtomTest.php | 35 +- test/Reader/Entry/RssTest.php | 320 +++------------ test/Reader/Feed/AtomSourceTest.php | 27 +- test/Reader/Feed/AtomTest.php | 39 +- test/Reader/Feed/RssTest.php | 365 +++--------------- .../Integration/H-OnlineComAtom10Test.php | 14 +- test/Reader/Integration/LautDeRdfTest.php | 14 +- test/Reader/Integration/PodcastRss2Test.php | 14 +- .../Integration/WordpressAtom10Test.php | 14 +- test/Writer/DeletedTest.php | 27 +- test/Writer/EntryTest.php | 50 +-- test/Writer/FeedTest.php | 82 ++-- test/Writer/Renderer/Entry/AtomTest.php | 6 +- test/Writer/Renderer/Entry/RssTest.php | 6 +- test/Writer/Renderer/Feed/AtomTest.php | 4 +- test/Writer/Renderer/Feed/RssTest.php | 5 +- 41 files changed, 375 insertions(+), 991 deletions(-) diff --git a/src/PubSubHubbub/Model/Subscription.php b/src/PubSubHubbub/Model/Subscription.php index 2ca2fa7b..fcdd3bc5 100644 --- a/src/PubSubHubbub/Model/Subscription.php +++ b/src/PubSubHubbub/Model/Subscription.php @@ -21,7 +21,8 @@ namespace Zend\Feed\PubSubHubbub\Model; -use Zend\Date; +use DateInterval; +use DateTime; use Zend\Feed\PubSubHubbub; /** @@ -34,9 +35,9 @@ class Subscription extends AbstractModel implements SubscriptionPersistenceInterface { /** - * Common Date\Date object to assist with unit testing + * Common DateTime object to assist with unit testing * - * @var Date\Date + * @var DateTime */ protected $now; @@ -61,8 +62,8 @@ public function setSubscription(array $data) if (array_key_exists('lease_seconds', $data) && $data['lease_seconds'] ) { - $data['expiration_time'] = $now->add($data['lease_seconds'], Date\Date::SECOND) - ->get('yyyy-MM-dd HH:mm:ss'); + $data['expiration_time'] = $now->add(new DateInterval('PT' . $data['lease_seconds'] . 'S')) + ->format('Y-m-d H:i:s'); } $this->_db->update( $data, @@ -134,25 +135,25 @@ public function deleteSubscription($key) } /** - * Get a new Date\Date or the one injected for testing + * Get a new DateTime or the one injected for testing * - * @return Date\Date + * @return DateTime */ public function getNow() { if (null === $this->now) { - return new Date\Date; + return new DateTime(); } return $this->now; } /** - * Set a Date\Date instance for assisting with unit testing + * Set a DateTime instance for assisting with unit testing * - * @param Date\Date $now + * @param DateTime $now * @return Subscription */ - public function setNow(Date\Date $now) + public function setNow(DateTime $now) { $this->now = $now; return $this; diff --git a/src/PubSubHubbub/Subscriber.php b/src/PubSubHubbub/Subscriber.php index 9bbfef7b..75fdfcdb 100644 --- a/src/PubSubHubbub/Subscriber.php +++ b/src/PubSubHubbub/Subscriber.php @@ -20,9 +20,10 @@ namespace Zend\Feed\PubSubHubbub; +use DateInterval; +use DateTime; use Traversable; use Zend\Stdlib\ArrayUtils; -use Zend\Date; use Zend\Http\Request as HttpRequest; use Zend\Uri; use Zend\Version; @@ -740,17 +741,17 @@ protected function _getRequestParameters($hubUrl, $mode) } // store subscription to storage - $now = new Date\Date; + $now = new DateTime(); $expires = null; if (isset($params['hub.lease_seconds'])) { - $expires = $now->add($params['hub.lease_seconds'], Date\Date::SECOND) - ->get('yyyy-MM-dd HH:mm:ss'); + $expires = $now->add(new DateInterval('PT' . $params['hub.lease_seconds'] . 'S')) + ->format('Y-m-d H:i:s'); } $data = array( 'id' => $key, 'topic_url' => $params['hub.topic'], 'hub_url' => $hubUrl, - 'created_time' => $now->get('yyyy-MM-dd HH:mm:ss'), + 'created_time' => $now->format('Y-m-d H:i:s'), 'lease_seconds' => $expires, 'verify_token' => hash('sha256', $params['hub.verify_token']), 'secret' => null, diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index beedac08..ed01b237 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -20,8 +20,8 @@ namespace Zend\Feed\Reader\Entry; +use DateTime; use Zend\Feed\Reader, - Zend\Date, Zend\Feed\Reader\Exception, DOMElement, DOMXPath; @@ -219,17 +219,16 @@ public function getDateModified() if ($dateModified) { $dateModifiedParsed = strtotime($dateModified); if ($dateModifiedParsed) { - $date = new Date\Date($dateModifiedParsed); + $date = new DateTime('@' . $dateModifiedParsed); } else { - $dateStandards = array(Date\Date::RSS, Date\Date::RFC_822, - Date\Date::RFC_2822, Date\Date::DATES); - $date = new Date\Date; + $dateStandards = array(DateTime::RSS, DateTime::RFC822, + DateTime::RFC2822, null); foreach ($dateStandards as $standard) { try { - $date->set($dateModified, $standard); + $date = date_create_from_format($standard, $dateModified); break; - } catch (Date\Exception $e) { - if ($standard == Date\Date::DATES) { + } catch (\Exception $e) { + if ($standard == null) { throw new Exception\RuntimeException( 'Could not load date due to unrecognised' .' format (should follow RFC 822 or 2822):' diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 42667b86..31b9fb78 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -20,10 +20,10 @@ namespace Zend\Feed\Reader\Extension\Atom; +use DateTime; use DOMDocument, DOMElement, stdClass, - Zend\Date, Zend\Feed\Reader, Zend\Feed\Reader\Collection, Zend\Feed\Reader\Extension, @@ -187,8 +187,7 @@ public function getDateCreated() } if ($dateCreated) { - $date = new Date\Date; - $date->set($dateCreated, Date\Date::ISO_8601); + $date = DateTime::createFromFormat(DateTime::ISO8601, $dateCreated); } $this->_data['datecreated'] = $date; @@ -216,8 +215,7 @@ public function getDateModified() } if ($dateModified) { - $date = new Date\Date; - $date->set($dateModified, Date\Date::ISO_8601); + $date = DateTime::createFromFormat(DateTime::ISO8601, $dateModified); } $this->_data['datemodified'] = $date; diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index 10f2b860..92a440b1 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -20,8 +20,8 @@ namespace Zend\Feed\Reader\Extension\Atom; -use Zend\Date, - Zend\Feed\Reader, +use DateTime; +use Zend\Feed\Reader, Zend\Feed\Reader\Collection, Zend\Feed\Reader\Extension, Zend\Uri, @@ -120,7 +120,7 @@ public function getCopyright() /** * Get the feed creation date * - * @return Date\Date|null + * @return DateTime|null */ public function getDateCreated() { @@ -137,8 +137,7 @@ public function getDateCreated() } if ($dateCreated) { - $date = new Date\Date; - $date->set($dateCreated, Date\Date::ISO_8601); + $date = DateTime::createFromFormat(DateTime::ISO8601, $dateCreated); } $this->_data['datecreated'] = $date; @@ -149,7 +148,7 @@ public function getDateCreated() /** * Get the feed modification date * - * @return Date\Date|null + * @return DateTime|null */ public function getDateModified() { @@ -166,8 +165,7 @@ public function getDateModified() } if ($dateModified) { - $date = new Date\Date; - $date->set($dateModified, Date\Date::ISO_8601); + $date = DateTime::createFromFormat(DateTime::ISO8601, $dateModified); } $this->_data['datemodified'] = $date; diff --git a/src/Reader/Extension/DublinCore/Entry.php b/src/Reader/Extension/DublinCore/Entry.php index 452f55a1..0bfde674 100644 --- a/src/Reader/Extension/DublinCore/Entry.php +++ b/src/Reader/Extension/DublinCore/Entry.php @@ -20,10 +20,10 @@ namespace Zend\Feed\Reader\Extension\DublinCore; +use DateTime; use Zend\Feed\Reader, Zend\Feed\Reader\Collection, Zend\Feed\Reader\Extension, - Zend\Date, DOMElement; /** @@ -219,7 +219,7 @@ public function getTitle() /** * * - * @return Date\Date|null + * @return DateTime|null */ public function getDate() { @@ -235,8 +235,7 @@ public function getDate() } if ($date) { - $d = new Date\Date; - $d->set($date, Date\Date::ISO_8601); + $d = DateTime::createFromFormat(DateTime::ISO8601, $date); } $this->_data['date'] = $d; diff --git a/src/Reader/Extension/DublinCore/Feed.php b/src/Reader/Extension/DublinCore/Feed.php index 57f9bf61..1917d7da 100644 --- a/src/Reader/Extension/DublinCore/Feed.php +++ b/src/Reader/Extension/DublinCore/Feed.php @@ -20,10 +20,10 @@ namespace Zend\Feed\Reader\Extension\DublinCore; +use DateTime; use Zend\Feed\Reader, Zend\Feed\Reader\Collection, - Zend\Feed\Reader\Extension, - Zend\Date; + Zend\Feed\Reader\Extension; /** * @category Zend @@ -227,7 +227,7 @@ public function getTitle() /** * * - * @return Date\Date|null + * @return DateTime|null */ public function getDate() { @@ -243,8 +243,7 @@ public function getDate() } if ($date) { - $d = new Date\Date; - $d->set($date, Date\Date::ISO_8601); + $d = DateTime::createFromFormat(DateTime::ISO8601, $date); } $this->_data['date'] = $d; diff --git a/src/Reader/Extension/Syndication/Feed.php b/src/Reader/Extension/Syndication/Feed.php index 7f2b7ae1..b7e623a2 100644 --- a/src/Reader/Extension/Syndication/Feed.php +++ b/src/Reader/Extension/Syndication/Feed.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Reader\Extension\Syndication; +use DateTime; use Zend\Feed\Reader, - Zend\Feed\Reader\Extension, - Zend\Date; + Zend\Feed\Reader\Extension; /** * @category Zend @@ -118,15 +118,14 @@ public function getUpdateFrequencyAsTicks() /** * Get update base * - * @return Date\Date|null + * @return DateTime|null */ public function getUpdateBase() { $updateBase = $this->_getData('updateBase'); $date = null; if ($updateBase) { - $date = new Date\Date; - $date->set($updateBase, Date\Date::W3C); + $date = DateTime::createFromFormat(DateTime::W3C, $updateBase); } return $date; } diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index b1336381..2b035c3e 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -21,7 +21,6 @@ namespace Zend\Feed\Reader\Feed; use Zend\Feed\Reader, - Zend\Date, DOMDocument; /** diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php index 3731f031..2b26d093 100644 --- a/src/Reader/Feed/Atom/Source.php +++ b/src/Reader/Feed/Atom/Source.php @@ -22,7 +22,6 @@ use Zend\Feed\Reader, Zend\Feed\Reader\Feed, - Zend\Date, DOMElement, DOMXPath; diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 03c36cd3..2ccaa970 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -20,10 +20,10 @@ namespace Zend\Feed\Reader\Feed; +use DateTime; use Zend\Feed\Reader, Zend\Feed\Reader\Collection, Zend\Feed\Reader\Exception, - Zend\Date, DOMDocument; /** @@ -190,7 +190,7 @@ public function getDateCreated() /** * Get the feed modification date * - * @return Date\Date + * @return DateTime * @throws Exception\RuntimeException */ public function getDateModified() @@ -211,17 +211,16 @@ public function getDateModified() if ($dateModified) { $dateModifiedParsed = strtotime($dateModified); if ($dateModifiedParsed) { - $date = new Date\Date($dateModifiedParsed); + $date = new DateTime('@' . $dateModifiedParsed); } else { - $dateStandards = array(Date\Date::RSS, Date\Date::RFC_822, - Date\Date::RFC_2822, Date\Date::DATES); - $date = new Date\Date; + $dateStandards = array(DateTime::RSS, DateTime::RFC822, + DateTime::RFC2822, null); foreach ($dateStandards as $standard) { try { - $date->set($dateModified, $standard); + $date = DateTime::createFromFormat($standard, $dateModified); break; - } catch (Date\Exception $e) { - if ($standard == Date\Date::DATES) { + } catch (\Exception $e) { + if ($standard == null) { throw new Exception\RuntimeException( 'Could not load date due to unrecognised' .' format (should follow RFC 822 or 2822):' @@ -255,7 +254,7 @@ public function getDateModified() /** * Get the feed lastBuild date * - * @return Date\Date + * @return DateTime */ public function getLastBuildDate() { @@ -272,17 +271,16 @@ public function getLastBuildDate() if ($lastBuildDate) { $lastBuildDateParsed = strtotime($lastBuildDate); if ($lastBuildDateParsed) { - $date = new Date\Date($lastBuildDateParsed); + $date = new DateTime('@' . $lastBuildDateParsed); } else { - $dateStandards = array(Date\Date::RSS, Date\Date::RFC_822, - Date\Date::RFC_2822, Date\Date::DATES); - $date = new Date\Date; + $dateStandards = array(DateTime::RSS, DateTime::RFC822, + DateTime::RFC2822, null); foreach ($dateStandards as $standard) { try { - $date->set($lastBuildDate, $standard); + $date = DateTime::createFromFormat($standard, $lastBuildDateParsed); break; - } catch (Date\Exception $e) { - if ($standard == Date\Date::DATES) { + } catch (\Exception $e) { + if ($standard == null) { throw new Exception\RuntimeException( 'Could not load date due to unrecognised' .' format (should follow RFC 822 or 2822):' diff --git a/src/Writer/AbstractFeed.php b/src/Writer/AbstractFeed.php index 48c43351..787df879 100644 --- a/src/Writer/AbstractFeed.php +++ b/src/Writer/AbstractFeed.php @@ -20,8 +20,8 @@ namespace Zend\Feed\Writer; +use DateTime; use Zend\Uri, - Zend\Date, Zend\Validator; /** @@ -131,64 +131,58 @@ public function setCopyright($copyright) /** * Set the feed creation date * - * @param null|integer|Date\Date + * @param null|integer|DateTime * @throws Exception\InvalidArgumentException */ public function setDateCreated($date = null) { - $zdate = null; if ($date === null) { - $zdate = new Date\Date; - } elseif (ctype_digit((string)$date)) { - $zdate = new Date\Date($date, Date\Date::TIMESTAMP); - } elseif ($date instanceof Date\Date) { - $zdate = $date; - } else { - throw new Exception\InvalidArgumentException('Invalid Date\Date object or UNIX Timestamp passed as parameter'); + $date = new DateTime(); + } elseif (is_int($date)) { + $date = new DateTime('@' . $date); + } elseif (!$date instanceof DateTime) { + throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp' + . ' passed as parameter'); } - $this->_data['dateCreated'] = $zdate; + $this->_data['dateCreated'] = $date; } /** * Set the feed modification date * - * @param null|integer|Date\Date + * @param null|integer|DateTime * @throws Exception\InvalidArgumentException */ public function setDateModified($date = null) { - $zdate = null; if ($date === null) { - $zdate = new Date\Date; - } elseif (ctype_digit((string)$date)) { - $zdate = new Date\Date($date, Date\Date::TIMESTAMP); - } elseif ($date instanceof Date\Date) { - $zdate = $date; - } else { - throw new Exception\InvalidArgumentException('Invalid Date\Date object or UNIX Timestamp passed as parameter'); + $date = new DateTime(); + } elseif (is_int($date)) { + $date = new DateTime('@' . $date); + } elseif (!$date instanceof DateTime) { + throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp' + . ' passed as parameter'); } - $this->_data['dateModified'] = $zdate; + $this->_data['dateModified'] = $date; } /** * Set the feed last-build date. Ignored for Atom 1.0. * - * @param null|integer|Date\Date + * @param null|integer|DateTime * @throws Exception\InvalidArgumentException */ public function setLastBuildDate($date = null) { - $zdate = null; if ($date === null) { - $zdate = new Date\Date; - } elseif (ctype_digit((string)$date)) { - $zdate = new Date\Date($date, Date\Date::TIMESTAMP); - } elseif ($date instanceof Date\Date) { - $zdate = $date; - } else { - throw new Exception\InvalidArgumentException('Invalid Date\Date object or UNIX Timestamp passed as parameter'); - } - $this->_data['lastBuildDate'] = $zdate; + $date = new DateTime(); + } elseif (is_int($date)) { + $date = new DateTime('@' . $date); + } elseif (!$date instanceof DateTime) { + throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp' + . ' passed as parameter'); + } + $this->_data['lastBuildDate'] = $date; } /** diff --git a/src/Writer/Deleted.php b/src/Writer/Deleted.php index 4dc82be6..c16ea393 100644 --- a/src/Writer/Deleted.php +++ b/src/Writer/Deleted.php @@ -20,8 +20,8 @@ namespace Zend\Feed\Writer; -use Zend\Date, - Zend\Uri; +use DateTime; +use Zend\Uri; /** * @category Zend @@ -133,25 +133,25 @@ public function getReference() /** * Set when * - * @param null|string|Date\Date $date + * @param null|string|DateTime $date * @throws Exception\InvalidArgumentException */ public function setWhen($date = null) { - $zdate = null; if ($date === null) { - $zdate = new Date\Date; - } elseif (ctype_digit((string)$date)) { - $zdate = new Date\Date($date, Date\Date::TIMESTAMP); - } elseif ($date instanceof Date\Date) { - $zdate = $date; - } else { - throw new Exception\InvalidArgumentException('Invalid Date\Date object or UNIX Timestamp' + $date = new DateTime(); + } elseif (is_int($date)) { + $date = new DateTime('@' . $date); + } elseif (!$date instanceof DateTime) { + throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp' . ' passed as parameter'); } - $this->_data['when'] = $zdate; + $this->_data['when'] = $date; } - + + /** + * @return \DateTime + */ public function getWhen() { if (!array_key_exists('when', $this->_data)) { diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index a07b76d4..51767907 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Writer; +use DateTime; use Zend\Feed\Writer\Exception, - Zend\Uri, - Zend\Date; + Zend\Uri; /** * @category Zend @@ -179,43 +179,37 @@ public function setContent($content) /** * Set the feed creation date * - * @return string|null|Date\Date + * @return string|null|DateTime * @throws Exception\InvalidArgumentException */ public function setDateCreated($date = null) { - $zdate = null; if ($date === null) { - $zdate = new Date\Date; - } elseif (ctype_digit((string)$date)) { - $zdate = new Date\Date($date, Date\Date::TIMESTAMP); - } elseif ($date instanceof Date\Date) { - $zdate = $date; - } else { - throw new Exception\InvalidArgumentException('Invalid Zend\Date\Date object or UNIX Timestamp passed as parameter'); + $date = new DateTime(); + } elseif (is_int($date)) { + $date = new DateTime('@' . $date); + } elseif (!$date instanceof DateTime) { + throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp passed as parameter'); } - $this->_data['dateCreated'] = $zdate; + $this->_data['dateCreated'] = $date; } /** * Set the feed modification date * - * @return string|null + * @return string|null|DateTime * @throws Exception\InvalidArgumentException */ public function setDateModified($date = null) { - $zdate = null; if ($date === null) { - $zdate = new Date\Date; - } elseif (ctype_digit((string)$date)) { - $zdate = new Date\Date($date, Date\Date::TIMESTAMP); - } elseif ($date instanceof Date\Date) { - $zdate = $date; - } else { - throw new Exception\InvalidArgumentException('Invalid Date\Date object or UNIX Timestamp passed as parameter'); - } - $this->_data['dateModified'] = $zdate; + $date = new DateTime(); + } elseif (is_int($date)) { + $date = new DateTime('@' . $date); + } elseif (!$date instanceof DateTime) { + throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp passed as parameter'); + } + $this->_data['dateModified'] = $date; } /** diff --git a/src/Writer/Feed.php b/src/Writer/Feed.php index 8fd2bb85..e7ee4e20 100644 --- a/src/Writer/Feed.php +++ b/src/Writer/Feed.php @@ -21,8 +21,8 @@ namespace Zend\Feed\Writer; use Countable, + DateTime, Iterator, - Zend\Date, Zend\Feed\Writer\Renderer; /** @@ -152,9 +152,9 @@ public function orderByDate() $entries = array(); foreach ($this->_entries as $entry) { if ($entry->getDateModified()) { - $timestamp = (int) $entry->getDateModified()->get(Date\Date::TIMESTAMP); + $timestamp = (int) $entry->getDateModified()->getTimestamp(); } elseif ($entry->getDateCreated()) { - $timestamp = (int) $entry->getDateCreated()->get(Date\Date::TIMESTAMP); + $timestamp = (int) $entry->getDateCreated()->getTimestamp(); } $entries[$timestamp] = $entry; } diff --git a/src/Writer/Renderer/Entry/Atom.php b/src/Writer/Renderer/Entry/Atom.php index 5e4b5d47..0491b42b 100644 --- a/src/Writer/Renderer/Entry/Atom.php +++ b/src/Writer/Renderer/Entry/Atom.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Writer\Renderer\Entry; +use DateTime; use DOMDocument, DOMElement, - Zend\Date, Zend\Feed\Writer, Zend\Feed\Writer\Renderer, Zend\Uri, @@ -152,7 +152,7 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) $updated = $dom->createElement('updated'); $root->appendChild($updated); $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(Date\Date::ISO_8601) + $this->getDataContainer()->getDateModified()->format(DateTime::ISO8601) ); $updated->appendChild($text); } @@ -172,7 +172,7 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) $el = $dom->createElement('published'); $root->appendChild($el); $text = $dom->createTextNode( - $this->getDataContainer()->getDateCreated()->get(Date\Date::ISO_8601) + $this->getDataContainer()->getDateCreated()->format(DateTime::ISO8601) ); $el->appendChild($text); } diff --git a/src/Writer/Renderer/Entry/Atom/Deleted.php b/src/Writer/Renderer/Entry/Atom/Deleted.php index 1b702091..f1307a63 100644 --- a/src/Writer/Renderer/Entry/Atom/Deleted.php +++ b/src/Writer/Renderer/Entry/Atom/Deleted.php @@ -20,6 +20,7 @@ namespace Zend\Feed\Writer\Renderer\Entry\Atom; +use DateTime; use DOMDocument, DOMElement; @@ -57,7 +58,7 @@ public function render() $this->_dom->appendChild($entry); $entry->setAttribute('ref', $this->_container->getReference()); - $entry->setAttribute('when', $this->_container->getWhen()->get(\Zend\Date\Date::ISO_8601)); + $entry->setAttribute('when', $this->_container->getWhen()->format(DateTime::ISO8601)); $this->_setBy($this->_dom, $entry); $this->_setComment($this->_dom, $entry); diff --git a/src/Writer/Renderer/Entry/AtomDeleted.php b/src/Writer/Renderer/Entry/AtomDeleted.php index f6912697..a796e728 100644 --- a/src/Writer/Renderer/Entry/AtomDeleted.php +++ b/src/Writer/Renderer/Entry/AtomDeleted.php @@ -20,6 +20,7 @@ namespace Zend\Feed\Writer\Renderer\Entry; +use DateTime; use Zend\Feed\Writer\Renderer, Zend\Feed\Writer, DOMDocument, @@ -57,7 +58,7 @@ public function render() $this->_dom->appendChild($entry); $entry->setAttribute('ref', $this->_container->getReference()); - $entry->setAttribute('when', $this->_container->getWhen()->get(Date\Date::ISO_8601)); + $entry->setAttribute('when', $this->_container->getWhen()->format(DateTime::ISO8601)); $this->_setBy($this->_dom, $entry); $this->_setComment($this->_dom, $entry); diff --git a/src/Writer/Renderer/Entry/Rss.php b/src/Writer/Renderer/Entry/Rss.php index 5d4b1d0b..8ee41a34 100644 --- a/src/Writer/Renderer/Entry/Rss.php +++ b/src/Writer/Renderer/Entry/Rss.php @@ -20,7 +20,7 @@ namespace Zend\Feed\Writer\Renderer\Entry; -use Zend\Date, +use DateTime, Zend\Feed\Writer, Zend\Feed\Writer\Renderer, Zend\Uri, @@ -155,7 +155,7 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) $updated = $dom->createElement('pubDate'); $root->appendChild($updated); $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(Date\Date::RSS) + $this->getDataContainer()->getDateModified()->format(DateTime::RSS) ); $updated->appendChild($text); } diff --git a/src/Writer/Renderer/Feed/AbstractAtom.php b/src/Writer/Renderer/Feed/AbstractAtom.php index e6b82659..d18100ff 100644 --- a/src/Writer/Renderer/Feed/AbstractAtom.php +++ b/src/Writer/Renderer/Feed/AbstractAtom.php @@ -20,8 +20,8 @@ namespace Zend\Feed\Writer\Renderer\Feed; +use DateTime; use Zend\Feed\Writer\Renderer, - Zend\Date, Zend\Feed\Writer, DOMDocument, DOMElement; @@ -131,7 +131,7 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) $updated = $dom->createElement('updated'); $root->appendChild($updated); $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(Date\Date::ISO_8601) + $this->getDataContainer()->getDateModified()->format(DateTime::ISO8601) ); $updated->appendChild($text); } diff --git a/src/Writer/Renderer/Feed/Atom/AbstractAtom.php b/src/Writer/Renderer/Feed/Atom/AbstractAtom.php index 032d8390..d20eda31 100644 --- a/src/Writer/Renderer/Feed/Atom/AbstractAtom.php +++ b/src/Writer/Renderer/Feed/Atom/AbstractAtom.php @@ -20,6 +20,7 @@ namespace Zend\Feed\Writer\Renderer\Feed\Atom; +use Datetime; use Zend\Feed, DOMDocument, DOMElement; @@ -130,7 +131,7 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) $updated = $dom->createElement('updated'); $root->appendChild($updated); $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(\Zend\Date\Date::ISO_8601) + $this->getDataContainer()->getDateModified()->format(DateTime::ISO8601) ); $updated->appendChild($text); } diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index 94c94c2e..e27bbf12 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -20,9 +20,9 @@ namespace Zend\Feed\Writer\Renderer\Feed; +use DateTime; use DOMDocument, DOMElement, - Zend\Date, Zend\Feed\Writer, Zend\Feed\Writer\Renderer, Zend\Uri; @@ -196,7 +196,7 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) $updated = $dom->createElement('pubDate'); $root->appendChild($updated); $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(Date\Date::RSS) + $this->getDataContainer()->getDateModified()->format(DateTime::RSS) ); $updated->appendChild($text); } @@ -451,7 +451,7 @@ protected function _setLastBuildDate(DOMDocument $dom, DOMElement $root) $lastBuildDate = $dom->createElement('lastBuildDate'); $root->appendChild($lastBuildDate); $text = $dom->createTextNode( - $this->getDataContainer()->getLastBuildDate()->get(Date\Date::RSS) + $this->getDataContainer()->getLastBuildDate()->format(DateTime::RSS) ); $lastBuildDate->appendChild($text); } diff --git a/test/PubSubHubbub/Model/SubscriptionTest.php b/test/PubSubHubbub/Model/SubscriptionTest.php index 2d486584..fcd5ca5b 100644 --- a/test/PubSubHubbub/Model/SubscriptionTest.php +++ b/test/PubSubHubbub/Model/SubscriptionTest.php @@ -20,8 +20,8 @@ namespace ZendTest\Feed\PubSubHubbub\Model; +use DateTime; use PDO; -use Zend\Date\Date; use Zend\Db\Adapter\Adapter as DbAdapter; use Zend\Db\TableGateway\TableGateway; use Zend\Feed\PubSubHubbub\Model\Subscription; @@ -75,7 +75,7 @@ public function testImpemetsSubscriptionInterface() public function testCurrentTimeSetterAndGetter() { - $now = new Date; + $now = new DateTime(); $subscription = new Subscription(new TableGateway('subscription', $this->initDb())); $subscription->setNow($now); $this->assertSame($subscription->getNow(), $now); diff --git a/test/PubSubHubbub/Subscriber/CallbackTest.php b/test/PubSubHubbub/Subscriber/CallbackTest.php index abe24bdc..0a2d9319 100644 --- a/test/PubSubHubbub/Subscriber/CallbackTest.php +++ b/test/PubSubHubbub/Subscriber/CallbackTest.php @@ -20,7 +20,8 @@ namespace ZendTest\Feed\PubSubHubbub\Subscriber; -use Zend\Date\Date; +use DateInterval; +use DateTime; use Zend\Feed\PubSubHubbub\HttpResponse; use Zend\Feed\PubSubHubbub\Model; use Zend\Feed\PubSubHubbub\Subscriber\Callback as CallbackSubscriber; @@ -47,7 +48,7 @@ class CallbackTest extends \PHPUnit_Framework_TestCase public $_rowset; /** @var array */ public $_get; - /** @var Date */ + /** @var DateTime */ public $now; public function setUp() @@ -69,7 +70,7 @@ public function setUp() ->will($this->returnValue($this->_adapter)); $storage = new Model\Subscription($this->_tableGateway); - $this->now = new Date; + $this->now = new DateTime(); $storage->setNow(clone $this->now); $this->_callback->setStorage($storage); @@ -276,7 +277,7 @@ public function testRespondsToValidConfirmationWith200Response() $rowdata = array( 'id' => 'verifytokenkey', 'verify_token' => hash('sha256', 'cba'), - 'created_time' => $t->get(Date::TIMESTAMP), + 'created_time' => $t->getTimestamp(), 'lease_seconds' => 10000 ); @@ -295,11 +296,11 @@ public function testRespondsToValidConfirmationWith200Response() ->with( $this->equalTo(array('id' => 'verifytokenkey', 'verify_token' => hash('sha256', 'cba'), - 'created_time' => $t->get(Date::TIMESTAMP), + 'created_time' => $t->getTimestamp(), 'lease_seconds' => 1234567, 'subscription_state'=> 'verified', - 'expiration_time' => $t->add(1234567, Date::SECOND) - ->get('yyyy-MM-dd HH:mm:ss'))), + 'expiration_time' => $t->add(new DateInterval('PT1234567S')) + ->format('Y-m-d H:i:s'))), $this->equalTo(array('id' => 'verifytokenkey')) ); @@ -318,7 +319,7 @@ public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() $rowdata = array( 'id' => 'verifytokenkey', 'verify_token' => hash('sha256', 'cba'), - 'created_time' => $t->get(Date::TIMESTAMP), + 'created_time' => $t->getTimestamp(), 'lease_seconds' => 10000 ); @@ -337,11 +338,11 @@ public function testRespondsToValidConfirmationWithBodyContainingHubChallenge() ->with( $this->equalTo(array('id' => 'verifytokenkey', 'verify_token' => hash('sha256', 'cba'), - 'created_time' => $t->get(Date::TIMESTAMP), + 'created_time' => $t->getTimestamp(), 'lease_seconds' => 1234567, 'subscription_state'=> 'verified', - 'expiration_time' => $t->add(1234567, Date::SECOND) - ->get('yyyy-MM-dd HH:mm:ss'))), + 'expiration_time' => $t->add(new DateInterval('PT1234567S')) + ->format('Y-m-d H:i:s'))), $this->equalTo(array('id' => 'verifytokenkey')) ); diff --git a/test/Reader/Entry/AtomStandaloneEntryTest.php b/test/Reader/Entry/AtomStandaloneEntryTest.php index a05e95d3..712db051 100644 --- a/test/Reader/Entry/AtomStandaloneEntryTest.php +++ b/test/Reader/Entry/AtomStandaloneEntryTest.php @@ -20,8 +20,9 @@ */ namespace ZendTest\Feed\Reader\Entry; + +use DateTime; use Zend\Feed\Reader; -use Zend\Date; /** * @category Zend @@ -45,13 +46,7 @@ public function setup() { Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/AtomStandaloneEntry'; - $this->_options = Date\Date::setOptions(); - foreach($this->_options as $k=>$v) { - if (is_null($v)) { - unset($this->_options[$k]); - } - } - Date\Date::setOptions(array('format_type'=>'iso')); + $this->_expectedCats = array( array( 'term' => 'topic1', @@ -82,12 +77,7 @@ public function setup() ) ); } - - public function teardown() - { - Date\Date::setOptions($this->_options); - } - + public function testReaderImportOfAtomEntryDocumentReturnsEntryClass() { $object = Reader\Reader::importString( @@ -117,9 +107,8 @@ public function testGetsDateCreatedFromAtom10() $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/atom10.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateCreated())); + $edate = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z'); + $this->assertEquals($edate, $entry->getDateCreated()); } /** @@ -131,9 +120,8 @@ public function testGetsDateModifiedFromAtom10() $entry = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/atom10.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); + $edate = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z'); + $this->assertEquals($edate, $entry->getDateModified()); } /** diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index f7af17c6..aa07667e 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -20,8 +20,9 @@ */ namespace ZendTest\Feed\Reader\Entry; + +use DateTime; use Zend\Feed\Reader; -use Zend\Date; /** * @category Zend @@ -45,13 +46,6 @@ public function setup() { Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/Atom'; - $this->_options = Date\Date::setOptions(); - foreach($this->_options as $k=>$v) { - if (is_null($v)) { - unset($this->_options[$k]); - } - } - Date\Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -82,11 +76,6 @@ public function setup() ) ); } - - public function teardown() - { - Date\Date::setOptions($this->_options); - } /** * Get Id (Unencoded Text) @@ -119,9 +108,8 @@ public function testGetsDateCreatedFromAtom03() file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom03.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateCreated())); + $edate = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z'); + $this->assertEquals($edate, $entry->getDateCreated()); } public function testGetsDateCreatedFromAtom10() @@ -130,9 +118,8 @@ public function testGetsDateCreatedFromAtom10() file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom10.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateCreated())); + $edate = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z'); + $this->assertEquals($edate, $entry->getDateCreated()); } /** @@ -144,9 +131,8 @@ public function testGetsDateModifiedFromAtom03() file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom03.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); + $edate = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z'); + $this->assertEquals($edate, $entry->getDateModified()); } public function testGetsDateModifiedFromAtom10() @@ -155,9 +141,8 @@ public function testGetsDateModifiedFromAtom10() file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom10.xml') ); $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); + $edate = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z'); + $this->assertEquals($edate, $entry->getDateModified()); } /** diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index 3457b686..f17d31a8 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -20,8 +20,9 @@ */ namespace ZendTest\Feed\Reader\Entry; + +use DateTime; use Zend\Feed\Reader; -use Zend\Date; /** * @category Zend @@ -47,13 +48,7 @@ public function setup() { Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/Rss'; - $this->_options = Date\Date::setOptions(); - foreach($this->_options as $k=>$v) { - if (is_null($v)) { - unset($this->_options[$k]); - } - } - Date\Date::setOptions(array('format_type'=>'iso')); + $this->_expectedCats = array( array( 'term' => 'topic1', @@ -101,11 +96,6 @@ public function setup() ) ); } - - public function teardown() - { - Date\Date::setOptions($this->_options); - } /** * Get Id (Unencoded Text) @@ -1880,270 +1870,50 @@ public function testGetsLinkFromRss090_None() /** * Get DateModified (Unencoded Text) + * @dataProvider dateModifiedProvider */ - public function testGetsDateModifiedFromRss20() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20.xml') - ); - $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); - } - - /** - * @group ZF-8702 - */ - public function testParsesCorrectDateIfMissingOffsetWhenSystemUsesUSLocale() - { - $locale = new \Zend\Locale\Locale('en_US'); - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20_en_US.xml') - ); - $entry = $feed->current(); - $fdate = $entry->getDateModified(); - $edate = new Date\Date; - $edate->set('2010-01-04T02:14:00-0600', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($fdate)); - } - - // DC 1.0 - - public function testGetsDateModifiedFromRss20_Dc10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss20.xml') - ); - $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); - } - - public function testGetsDateModifiedFromRss094_Dc10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss094.xml') - ); - $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); - } - - public function testGetsDateModifiedFromRss093_Dc10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss093.xml') - ); - $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); - } - - public function testGetsDateModifiedFromRss092_Dc10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss092.xml') - ); - $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); - } - - public function testGetsDateModifiedFromRss091_Dc10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss091.xml') - ); - $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); - } - - public function testGetsDateModifiedFromRss10_Dc10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss10.xml') - ); - $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); - } - - public function testGetsDateModifiedFromRss090_Dc10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss090.xml') + public function testGetsDateModified($path, $edate) + { + $feed = Reader\Reader::importString( + file_get_contents($this->_feedSamplePath . $path) + ); + $entry = $feed->current(); + + $this->assertTrue($edate == $entry->getDateModified()); + } + + public function dateModifiedProvider() { + $iso = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z'); + $us = DateTime::createFromFormat(DateTime::ISO8601, '2010-01-04T02:14:00-0600'); + $rss = DateTime::createFromFormat(DateTime::RSS, 'Sun, 11 Jan 2009 09:55:59 GMT'); + return array( + array('/datemodified/plain/rss20.xml', $iso), + array('/datemodified/plain/rss20_en_US.xml', $us), + array('/datemodified/plain/dc10/rss20.xml', $iso), + array('/datemodified/plain/dc10/rss094.xml', $iso), + array('/datemodified/plain/dc10/rss093.xml', $iso), + array('/datemodified/plain/dc10/rss092.xml', $iso), + array('/datemodified/plain/dc10/rss091.xml', $iso), + array('/datemodified/plain/dc10/rss10.xml', $iso), + array('/datemodified/plain/dc10/rss090.xml', $iso), + array('/datemodified/plain/dc11/rss20.xml', $iso), + array('/datemodified/plain/dc11/rss094.xml', $iso), + array('/datemodified/plain/dc11/rss093.xml', $iso), + array('/datemodified/plain/dc11/rss092.xml', $iso), + array('/datemodified/plain/dc11/rss091.xml', $iso), + array('/datemodified/plain/dc11/rss10.xml', $iso), + array('/datemodified/plain/dc11/rss090.xml', $iso), + + array('/datemodified/plain/none/rss20.xml', null), + array('/datemodified/plain/none/rss094.xml', null), + array('/datemodified/plain/none/rss093.xml', null), + array('/datemodified/plain/none/rss092.xml', null), + array('/datemodified/plain/none/rss091.xml', null), + array('/datemodified/plain/none/rss10.xml', null), + array('/datemodified/plain/none/rss090.xml', null), + + array('/datemodified/plain/rss20-zf-7908.xml', $rss), ); - $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); - } - - // DC 1.1 - - public function testGetsDateModifiedFromRss20_Dc11() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss20.xml') - ); - $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); - } - - public function testGetsDateModifiedFromRss094_Dc11() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss094.xml') - ); - $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); - } - - public function testGetsDateModifiedFromRss093_Dc11() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss093.xml') - ); - $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); - } - - public function testGetsDateModifiedFromRss092_Dc11() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss092.xml') - ); - $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); - } - - public function testGetsDateModifiedFromRss091_Dc11() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss091.xml') - ); - $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); - } - - public function testGetsDateModifiedFromRss10_Dc11() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss10.xml') - ); - $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); - } - - public function testGetsDateModifiedFromRss090_Dc11() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss090.xml') - ); - $entry = $feed->current(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($entry->getDateModified())); - } - - // Missing DateModified - - public function testGetsDateModifiedFromRss20_None() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss20.xml') - ); - $entry = $feed->current(); - $this->assertEquals(null, $entry->getDateModified()); - } - - public function testGetsDateModifiedFromRss094_None() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss094.xml') - ); - $entry = $feed->current(); - $this->assertEquals(null, $entry->getDateModified()); - } - - public function testGetsDateModifiedFromRss093_None() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss093.xml') - ); - $entry = $feed->current(); - $this->assertEquals(null, $entry->getDateModified()); - } - - public function testGetsDateModifiedFromRss092_None() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss092.xml') - ); - $entry = $feed->current(); - $this->assertEquals(null, $entry->getDateModified()); - } - - public function testGetsDateModifiedFromRss091_None() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss091.xml') - ); - $entry = $feed->current(); - $this->assertEquals(null, $entry->getDateModified()); - } - - public function testGetsDateModifiedFromRss10_None() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss10.xml') - ); - $entry = $feed->current(); - $this->assertEquals(null, $entry->getDateModified()); - } - - public function testGetsDateModifiedFromRss090_None() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss090.xml') - ); - $entry = $feed->current(); - $this->assertEquals(null, $entry->getDateModified()); - } - - /** - * @issue ZF-7908 - */ - public function testGetsDateModifiedFromRss20_UnrecognisedGmtFormat() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20-zf-7908.xml') - ); - $entry = $feed->current(); - //$this->assertEquals('Sunday 11 January 2009 09 55 59 +0000', $entry->getDateModified()->toString('EEEE dd MMMM YYYY HH mm ss ZZZ')); - $edate = new Date\Date; - $edate->set('Sun, 11 Jan 2009 09:55:59 GMT', Date\Date::RSS); - $this->assertTrue($edate->equals($entry->getDateModified())); } /** diff --git a/test/Reader/Feed/AtomSourceTest.php b/test/Reader/Feed/AtomSourceTest.php index 486fb30b..916f6248 100644 --- a/test/Reader/Feed/AtomSourceTest.php +++ b/test/Reader/Feed/AtomSourceTest.php @@ -20,8 +20,9 @@ */ namespace ZendTest\Feed\Reader\Feed; + +use DateTime; use Zend\Feed\Reader; -use Zend\Date; /** * @category Zend @@ -47,13 +48,6 @@ public function setup() { Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/AtomSource'; - $this->_options = Date\Date::setOptions(); - foreach($this->_options as $k=>$v) { - if (is_null($v)) { - unset($this->_options[$k]); - } - } - Date\Date::setOptions(array('format_type'=>'iso')); $this->_expectedCats = array( array( 'term' => 'topic1', @@ -84,12 +78,7 @@ public function setup() ) ); } - - public function teardown() - { - Date\Date::setOptions($this->_options); - } - + public function testGetsSourceFromEntry() { $feed = Reader\Reader::importString( @@ -160,9 +149,8 @@ public function testGetsDateCreatedFromAtom10() ); $source = $feed->current()->getSource(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($source->getDateCreated())); + $edate = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z'); + $this->assertEquals($edate, $source->getDateCreated()); } /** @@ -176,9 +164,8 @@ public function testGetsDateModifiedFromAtom10() ); $source = $feed->current()->getSource(); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($source->getDateModified())); + $edate = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z'); + $this->assertEquals($edate, $source->getDateModified()); } /** diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 59247071..24d95646 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -20,8 +20,9 @@ */ namespace ZendTest\Feed\Reader\Feed; + +use DateTime; use Zend\Feed\Reader; -use Zend\Date; /** * @category Zend @@ -47,13 +48,7 @@ public function setup() { Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/Atom'; - $this->_options = Date\Date::setOptions(); - foreach($this->_options as $k=>$v) { - if (is_null($v)) { - unset($this->_options[$k]); - } - } - Date\Date::setOptions(array('format_type'=>'iso')); + $this->_expectedCats = array( array( 'term' => 'topic1', @@ -84,11 +79,6 @@ public function setup() ) ); } - - public function teardown() - { - Date\Date::setOptions($this->_options); - } /** * Get Title (Unencoded Text) @@ -177,9 +167,8 @@ public function testGetsDateCreatedFromAtom03() $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom03.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateCreated())); + $edate = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z'); + $this->assertEquals($edate, $feed->getDateCreated()); } public function testGetsDateCreatedFromAtom10() @@ -187,10 +176,8 @@ public function testGetsDateCreatedFromAtom10() $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datecreated/plain/atom10.xml') ); - - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateCreated())); + $edate = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z'); + $this->assertEquals($edate, $feed->getDateCreated()); } /** @@ -201,10 +188,8 @@ public function testGetsDateModifiedFromAtom03() $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom03.xml') ); - - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); + $edate = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z'); + $this->assertEquals($edate, $feed->getDateModified()); } public function testGetsDateModifiedFromAtom10() @@ -212,10 +197,8 @@ public function testGetsDateModifiedFromAtom10() $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath . '/datemodified/plain/atom10.xml') ); - - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); + $edate = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z'); + $this->assertEquals($edate, $feed->getDateModified()); } /** diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index 34735890..d683d65b 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -20,8 +20,9 @@ */ namespace ZendTest\Feed\Reader\Feed; + +use DateTime; use Zend\Feed\Reader; -use Zend\Date; /** * @category Zend @@ -47,13 +48,7 @@ public function setup() { Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/Rss'; - $this->_options = Date\Date::setOptions(); - foreach($this->_options as $k=>$v) { - if (is_null($v)) { - unset($this->_options[$k]); - } - } - Date\Date::setOptions(array('format_type'=>'iso')); + $this->_expectedCats = array( array( 'term' => 'topic1', @@ -101,11 +96,6 @@ public function setup() ) ); } - - public function teardown() - { - Date\Date::setOptions($this->_options); - } /** * Get Title (Unencoded Text) @@ -2102,9 +2092,8 @@ public function testGetsLastBuildDateFromRss20() $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/lastbuilddate/plain/rss20.xml') ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getLastBuildDate())); + $edate = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z'); + $this->assertTrue($edate == $feed->getLastBuildDate()); } public function testGetsLastBuildDateFromRss20_None() @@ -2116,305 +2105,55 @@ public function testGetsLastBuildDateFromRss20_None() } /** - * Get Date Modified (Unencoded Text) + * Get DateModified (Unencoded Text) + * @dataProvider dateModifiedProvider */ - public function testGetsDateModifiedFromRss20() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - /** - * @group ZF-8702 - */ - public function testParsesCorrectDateIfMissingOffsetWhenSystemUsesUSLocale() - { - $locale = new \Zend\Locale\Locale('en_US'); - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/rss20_en_US.xml') - ); - $fdate = $feed->getDateModified(); - $edate = new Date\Date; - $edate->set('2010-01-04T02:14:00-0600', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($fdate)); - } - - // DC 1.0 - - public function testGetsDateModifiedFromRss20_Dc10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss20.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss094_Dc10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss094.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss093_Dc10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss093.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss092_Dc10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss092.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss091_Dc10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss091.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss10_Dc10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss10.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss090_Dc10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc10/rss090.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - // DC 1.1 - - public function testGetsDateModifiedFromRss20_Dc11() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss20.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss094_Dc11() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss094.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss093_Dc11() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss093.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss092_Dc11() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss092.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss091_Dc11() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss091.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss10_Dc11() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss10.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss090_Dc11() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/dc11/rss090.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - // Atom 1.0 - - public function testGetsDateModifiedFromRss20_atom10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss20.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss094_atom10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss094.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss093_atom10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss093.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss092_atom10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss092.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss091_atom10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss091.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss10_atom10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss10.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - public function testGetsDateModifiedFromRss090_atom10() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/atom10/rss090.xml') - ); - $edate = new Date\Date; - $edate->set('2009-03-07T08:03:50Z', Date\Date::ISO_8601); - $this->assertTrue($edate->equals($feed->getDateModified())); - } - - // Missing DateModified - - public function testGetsDateModifiedFromRss20_None() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss20.xml') - ); - $this->assertEquals(null, $feed->getDateModified()); - } - - public function testGetsDateModifiedFromRss094_None() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss094.xml') - ); - $this->assertEquals(null, $feed->getDateModified()); - } - - public function testGetsDateModifiedFromRss093_None() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss093.xml') - ); - $this->assertEquals(null, $feed->getDateModified()); - } - - public function testGetsDateModifiedFromRss092_None() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss092.xml') - ); - $this->assertEquals(null, $feed->getDateModified()); - } - - public function testGetsDateModifiedFromRss091_None() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss091.xml') - ); - $this->assertEquals(null, $feed->getDateModified()); - } - - public function testGetsDateModifiedFromRss10_None() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss10.xml') - ); - $this->assertEquals(null, $feed->getDateModified()); - } - - public function testGetsDateModifiedFromRss090_None() - { - $feed = Reader\Reader::importString( - file_get_contents($this->_feedSamplePath.'/datemodified/plain/none/rss090.xml') + public function testGetsDateModified($path, $edate) + { + $feed = Reader\Reader::importString( + file_get_contents($this->_feedSamplePath . $path) + ); + + $this->assertTrue($edate == $feed->getDateModified()); + } + + public function dateModifiedProvider() { + $iso = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z'); + $us = DateTime::createFromFormat(DateTime::ISO8601, '2010-01-04T02:14:00-0600'); + return array( + array('/datemodified/plain/rss20.xml', $iso), + array('/datemodified/plain/rss20_en_US.xml', $us), + array('/datemodified/plain/dc10/rss20.xml', $iso), + array('/datemodified/plain/dc10/rss094.xml', $iso), + array('/datemodified/plain/dc10/rss093.xml', $iso), + array('/datemodified/plain/dc10/rss092.xml', $iso), + array('/datemodified/plain/dc10/rss091.xml', $iso), + array('/datemodified/plain/dc10/rss10.xml', $iso), + array('/datemodified/plain/dc10/rss090.xml', $iso), + array('/datemodified/plain/dc11/rss20.xml', $iso), + array('/datemodified/plain/dc11/rss094.xml', $iso), + array('/datemodified/plain/dc11/rss093.xml', $iso), + array('/datemodified/plain/dc11/rss092.xml', $iso), + array('/datemodified/plain/dc11/rss091.xml', $iso), + array('/datemodified/plain/dc11/rss10.xml', $iso), + array('/datemodified/plain/dc11/rss090.xml', $iso), + + array('/datemodified/plain/atom10/rss20.xml', $iso), + array('/datemodified/plain/atom10/rss094.xml', $iso), + array('/datemodified/plain/atom10/rss093.xml', $iso), + array('/datemodified/plain/atom10/rss092.xml', $iso), + array('/datemodified/plain/atom10/rss091.xml', $iso), + array('/datemodified/plain/atom10/rss10.xml', $iso), + array('/datemodified/plain/atom10/rss090.xml', $iso), + + array('/datemodified/plain/none/rss20.xml', null), + array('/datemodified/plain/none/rss094.xml', null), + array('/datemodified/plain/none/rss093.xml', null), + array('/datemodified/plain/none/rss092.xml', null), + array('/datemodified/plain/none/rss091.xml', null), + array('/datemodified/plain/none/rss10.xml', null), + array('/datemodified/plain/none/rss090.xml', null), ); - $this->assertEquals(null, $feed->getDateModified()); } /** diff --git a/test/Reader/Integration/H-OnlineComAtom10Test.php b/test/Reader/Integration/H-OnlineComAtom10Test.php index 96df4f0e..5d0efd50 100644 --- a/test/Reader/Integration/H-OnlineComAtom10Test.php +++ b/test/Reader/Integration/H-OnlineComAtom10Test.php @@ -20,8 +20,8 @@ */ namespace ZendTest\Feed\Reader\Integration; + use Zend\Feed\Reader; -use Zend\Date; /** * @category Zend @@ -41,18 +41,6 @@ public function setup() { Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/h-online.com-atom10.xml'; - $this->_options = Date\Date::setOptions(); - foreach($this->_options as $k=>$v) { - if (is_null($v)) { - unset($this->_options[$k]); - } - } - Date\Date::setOptions(array('format_type'=>'iso')); - } - - public function teardown() - { - Date\Date::setOptions($this->_options); } public function testGetsTitle() diff --git a/test/Reader/Integration/LautDeRdfTest.php b/test/Reader/Integration/LautDeRdfTest.php index 635bc4b1..29cc7ea9 100644 --- a/test/Reader/Integration/LautDeRdfTest.php +++ b/test/Reader/Integration/LautDeRdfTest.php @@ -20,8 +20,8 @@ */ namespace ZendTest\Feed\Reader\Integration; + use Zend\Feed\Reader; -use Zend\Date; /** * @category Zend @@ -41,18 +41,6 @@ public function setup() { Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/laut.de-rdf.xml'; - $this->_options = Date\Date::setOptions(); - foreach($this->_options as $k=>$v) { - if (is_null($v)) { - unset($this->_options[$k]); - } - } - Date\Date::setOptions(array('format_type'=>'iso')); - } - - public function teardown() - { - Date\Date::setOptions($this->_options); } /** diff --git a/test/Reader/Integration/PodcastRss2Test.php b/test/Reader/Integration/PodcastRss2Test.php index 70fae25c..66989bd3 100644 --- a/test/Reader/Integration/PodcastRss2Test.php +++ b/test/Reader/Integration/PodcastRss2Test.php @@ -20,8 +20,8 @@ */ namespace ZendTest\Feed\Reader\Integration; + use Zend\Feed\Reader; -use Zend\Date; /** * @category Zend @@ -41,18 +41,6 @@ public function setup() { Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/podcast.xml'; - $this->_options = Date\Date::setOptions(); - foreach($this->_options as $k=>$v) { - if (is_null($v)) { - unset($this->_options[$k]); - } - } - Date\Date::setOptions(array('format_type'=>'iso')); - } - - public function teardown() - { - Date\Date::setOptions($this->_options); } /** diff --git a/test/Reader/Integration/WordpressAtom10Test.php b/test/Reader/Integration/WordpressAtom10Test.php index 33451c28..d3cb1499 100644 --- a/test/Reader/Integration/WordpressAtom10Test.php +++ b/test/Reader/Integration/WordpressAtom10Test.php @@ -20,8 +20,8 @@ */ namespace ZendTest\Feed\Reader\Integration; + use Zend\Feed\Reader; -use Zend\Date; /** * @category Zend @@ -41,18 +41,6 @@ public function setup() { Reader\Reader::reset(); $this->_feedSamplePath = dirname(__FILE__) . '/_files/wordpress-atom10.xml'; - $this->_options = Date\Date::setOptions(); - foreach($this->_options as $k=>$v) { - if (is_null($v)) { - unset($this->_options[$k]); - } - } - Date\Date::setOptions(array('format_type'=>'iso')); - } - - public function teardown() - { - Date\Date::setOptions($this->_options); } public function testGetsTitle() diff --git a/test/Writer/DeletedTest.php b/test/Writer/DeletedTest.php index 55b6ad8d..b2a52943 100644 --- a/test/Writer/DeletedTest.php +++ b/test/Writer/DeletedTest.php @@ -20,8 +20,9 @@ */ namespace ZendTest\Feed\Writer; + +use DateTime; use Zend\Feed\Writer; -use Zend\Date; /** * @category Zend @@ -62,16 +63,16 @@ public function testSetWhenDefaultsToCurrentTime() { $entry = new Writer\Deleted; $entry->setWhen(); - $dateNow = new Date\Date; - $this->assertTrue($dateNow->isLater($entry->getWhen()) || $dateNow->equals($entry->getWhen())); + $dateNow = new DateTime(); + $this->assertTrue($dateNow >= $entry->getWhen()); } public function testSetWhenUsesGivenUnixTimestamp() { $entry = new Writer\Deleted; $entry->setWhen(1234567890); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($entry->getWhen())); + $myDate = new DateTime('@' . 1234567890); + $this->assertEquals($myDate, $entry->getWhen()); } /** @@ -81,8 +82,8 @@ public function testSetWhenUsesGivenUnixTimestampWhenItIsLessThanTenDigits() { $entry = new Writer\Deleted; $entry->setWhen(123456789); - $myDate = new Date\Date('123456789', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($entry->getWhen())); + $myDate = new DateTime('@' . 123456789); + $this->assertEquals($myDate, $entry->getWhen()); } /** @@ -92,16 +93,16 @@ public function testSetWhenUsesGivenUnixTimestampWhenItIsAVerySmallInteger() { $entry = new Writer\Deleted; $entry->setWhen(123); - $myDate = new Date\Date('123', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($entry->getWhen())); + $myDate = new DateTime('@' . 123); + $this->assertEquals($myDate, $entry->getWhen()); } - public function testSetWhenUsesZendDateObject() + public function testSetWhenUsesDateTimeObject() { + $myDate = new DateTime('@' . 1234567890); $entry = new Writer\Deleted; - $entry->setWhen(new Date\Date('1234567890', Date\Date::TIMESTAMP)); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($entry->getWhen())); + $entry->setWhen($myDate); + $this->assertEquals($myDate, $entry->getWhen()); } public function testSetWhenThrowsExceptionOnInvalidParameter() diff --git a/test/Writer/EntryTest.php b/test/Writer/EntryTest.php index 382cabdb..ac00b9a9 100644 --- a/test/Writer/EntryTest.php +++ b/test/Writer/EntryTest.php @@ -21,8 +21,8 @@ namespace ZendTest\Feed\Writer; +use DateTime; use Zend\Feed\Writer; -use Zend\Date; /** * @category Zend @@ -210,16 +210,16 @@ public function testSetDateCreatedDefaultsToCurrentTime() { $entry = new Writer\Entry; $entry->setDateCreated(); - $dateNow = new Date\Date; - $this->assertTrue($dateNow->isLater($entry->getDateCreated()) || $dateNow->equals($entry->getDateCreated())); + $dateNow = new DateTime(); + $this->assertTrue($dateNow >= $entry->getDateCreated()); } public function testSetDateCreatedUsesGivenUnixTimestamp() { $entry = new Writer\Entry; $entry->setDateCreated(1234567890); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($entry->getDateCreated())); + $myDate = new DateTime('@' . 1234567890); + $this->assertEquals($myDate, $entry->getDateCreated()); } /** @@ -229,8 +229,8 @@ public function testSetDateCreatedUsesGivenUnixTimestampWhenItIsLessThanTenDigit { $entry = new Writer\Entry; $entry->setDateCreated(123456789); - $myDate = new Date\Date('123456789', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($entry->getDateCreated())); + $myDate = new DateTime('@' . 123456789); + $this->assertEquals($myDate, $entry->getDateCreated()); } /** @@ -240,32 +240,32 @@ public function testSetDateCreatedUsesGivenUnixTimestampWhenItIsAVerySmallIntege { $entry = new Writer\Entry; $entry->setDateCreated(123); - $myDate = new Date\Date('123', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($entry->getDateCreated())); + $myDate = new DateTime('@' . 123); + $this->assertEquals($myDate, $entry->getDateCreated()); } - public function testSetDateCreatedUsesZendDateObject() + public function testSetDateCreatedUsesDateTimeObject() { + $myDate = new DateTime('@' . 1234567890); $entry = new Writer\Entry; - $entry->setDateCreated(new Date\Date('1234567890', Date\Date::TIMESTAMP)); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($entry->getDateCreated())); + $entry->setDateCreated($myDate); + $this->assertEquals($myDate, $entry->getDateCreated()); } public function testSetDateModifiedDefaultsToCurrentTime() { $entry = new Writer\Entry; $entry->setDateModified(); - $dateNow = new Date\Date; - $this->assertTrue($dateNow->isLater($entry->getDateModified()) || $dateNow->equals($entry->getDateModified())); + $dateNow = new DateTime(); + $this->assertTrue($dateNow >= $entry->getDateModified()); } public function testSetDateModifiedUsesGivenUnixTimestamp() { $entry = new Writer\Entry; $entry->setDateModified(1234567890); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($entry->getDateModified())); + $myDate = new DateTime('@' . 1234567890); + $this->assertEquals($myDate, $entry->getDateModified()); } /** @@ -275,8 +275,8 @@ public function testSetDateModifiedUsesGivenUnixTimestampWhenItIsLessThanTenDigi { $entry = new Writer\Entry; $entry->setDateModified(123456789); - $myDate = new Date\Date('123456789', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($entry->getDateModified())); + $myDate = new DateTime('@' . 123456789); + $this->assertEquals($myDate, $entry->getDateModified()); } /** @@ -286,16 +286,16 @@ public function testSetDateModifiedUsesGivenUnixTimestampWhenItIsAVerySmallInteg { $entry = new Writer\Entry; $entry->setDateModified(123); - $myDate = new Date\Date('123', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($entry->getDateModified())); + $myDate = new DateTime('@' . 123); + $this->assertEquals($myDate, $entry->getDateModified()); } - public function testSetDateModifiedUsesZendDateObject() + public function testSetDateModifiedUsesDateTimeObject() { + $myDate = new DateTime('@' . 1234567890); $entry = new Writer\Entry; - $entry->setDateModified(new Date\Date('1234567890', Date\Date::TIMESTAMP)); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($entry->getDateModified())); + $entry->setDateModified($myDate); + $this->assertEquals($myDate, $entry->getDateModified()); } public function testSetDateCreatedThrowsExceptionOnInvalidParameter() diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php index 28f93571..b886350f 100644 --- a/test/Writer/FeedTest.php +++ b/test/Writer/FeedTest.php @@ -21,9 +21,9 @@ namespace ZendTest\Feed\Writer; +use DateTime; use Zend\Feed\Writer; use Zend\Feed\Writer\Feed; -use Zend\Date; /** * @category Zend @@ -146,16 +146,16 @@ public function testSetDateCreatedDefaultsToCurrentTime() { $writer = new Writer\Feed; $writer->setDateCreated(); - $dateNow = new Date\Date; - $this->assertTrue($dateNow->isLater($writer->getDateCreated()) || $dateNow->equals($writer->getDateCreated())); + $dateNow = new DateTime(); + $this->assertTrue($dateNow >= $writer->getDateCreated()); } public function testSetDateCreatedUsesGivenUnixTimestamp() { $writer = new Writer\Feed; $writer->setDateCreated(1234567890); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($writer->getDateCreated())); + $myDate = new DateTime('@' . 1234567890); + $this->assertEquals($myDate, $writer->getDateCreated()); } /** @@ -165,8 +165,8 @@ public function testSetDateCreatedUsesGivenUnixTimestampThatIsLessThanTenDigits( { $writer = new Writer\Feed; $writer->setDateCreated(123456789); - $myDate = new Date\Date('123456789', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($writer->getDateCreated())); + $myDate = new DateTime('@' . 123456789); + $this->assertEquals($myDate, $writer->getDateCreated()); } /** @@ -176,33 +176,32 @@ public function testSetDateCreatedUsesGivenUnixTimestampThatIsAVerySmallInteger( { $writer = new Writer\Feed; $writer->setDateCreated(123); - $myDate = new Date\Date('123', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($writer->getDateCreated())); + $myDate = new DateTime('@' . 123); + $this->assertEquals($myDate, $writer->getDateCreated()); } - public function testSetDateCreatedUsesZendDateObject() + public function testSetDateCreatedUsesDateTimeObject() { + $myDate = new DateTime('@' . 1234567890); $writer = new Writer\Feed; - $writer->setDateCreated(new Date\Date('1234567890', Date\Date::TIMESTAMP)); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($writer->getDateCreated())); + $writer->setDateCreated($myDate); + $this->assertEquals($myDate, $writer->getDateCreated()); } public function testSetDateModifiedDefaultsToCurrentTime() { $writer = new Writer\Feed; $writer->setDateModified(); - $dateNow = new Date\Date; - $this->assertTrue( - $dateNow->isLater($writer->getDateModified()) || $dateNow->equals($writer->getDateModified())); + $dateNow = new DateTime(); + $this->assertTrue($dateNow >= $writer->getDateModified()); } public function testSetDateModifiedUsesGivenUnixTimestamp() { $writer = new Writer\Feed; $writer->setDateModified(1234567890); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($writer->getDateModified())); + $myDate = new DateTime('@' . 1234567890); + $this->assertEquals($myDate, $writer->getDateModified()); } /** @@ -212,8 +211,8 @@ public function testSetDateModifiedUsesGivenUnixTimestampThatIsLessThanTenDigits { $writer = new Writer\Feed; $writer->setDateModified(123456789); - $myDate = new Date\Date('123456789', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($writer->getDateModified())); + $myDate = new DateTime('@' . 123456789); + $this->assertEquals($myDate, $writer->getDateModified()); } /** @@ -221,18 +220,19 @@ public function testSetDateModifiedUsesGivenUnixTimestampThatIsLessThanTenDigits */ public function testSetDateModifiedUsesGivenUnixTimestampThatIsAVerySmallInteger() { + $writer = new Writer\Feed; $writer->setDateModified(123); - $myDate = new Date\Date('123', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($writer->getDateModified())); + $myDate = new DateTime('@' . 123); + $this->assertEquals($myDate, $writer->getDateModified()); } - public function testSetDateModifiedUsesZendDateObject() + public function testSetDateModifiedUsesDateTimeObject() { + $myDate = new DateTime('@' . 1234567890); $writer = new Writer\Feed; - $writer->setDateModified(new Date\Date('1234567890', Date\Date::TIMESTAMP)); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($writer->getDateModified())); + $writer->setDateModified($myDate); + $this->assertEquals($myDate, $writer->getDateModified()); } public function testSetDateCreatedThrowsExceptionOnInvalidParameter() @@ -271,17 +271,16 @@ public function testSetLastBuildDateDefaultsToCurrentTime() { $writer = new Writer\Feed; $writer->setLastBuildDate(); - $dateNow = new Date\Date; - $this->assertTrue( - $dateNow->isLater($writer->getLastBuildDate()) || $dateNow->equals($writer->getLastBuildDate())); + $dateNow = new DateTime(); + $this->assertTrue($dateNow >= $writer->getLastBuildDate()); } public function testSetLastBuildDateUsesGivenUnixTimestamp() { $writer = new Writer\Feed; $writer->setLastBuildDate(1234567890); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($writer->getLastBuildDate())); + $myDate = new DateTime('@' . 1234567890); + $this->assertEquals($myDate, $writer->getLastBuildDate()); } /** @@ -291,8 +290,8 @@ public function testSetLastBuildDateUsesGivenUnixTimestampThatIsLessThanTenDigit { $writer = new Writer\Feed; $writer->setLastBuildDate(123456789); - $myDate = new Date\Date('123456789', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($writer->getLastBuildDate())); + $myDate = new DateTime('@' . 123456789); + $this->assertEquals($myDate, $writer->getLastBuildDate()); } /** @@ -302,16 +301,16 @@ public function testSetLastBuildDateUsesGivenUnixTimestampThatIsAVerySmallIntege { $writer = new Writer\Feed; $writer->setLastBuildDate(123); - $myDate = new Date\Date('123', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($writer->getLastBuildDate())); + $myDate = new DateTime('@' . 123); + $this->assertEquals($myDate, $writer->getLastBuildDate()); } - public function testSetLastBuildDateUsesZendDateObject() + public function testSetLastBuildDateUsesDateTimeObject() { + $myDate = new DateTime('@' . 1234567890); $writer = new Writer\Feed; - $writer->setLastBuildDate(new Date\Date('1234567890', Date\Date::TIMESTAMP)); - $myDate = new Date\Date('1234567890', Date\Date::TIMESTAMP); - $this->assertTrue($myDate->equals($writer->getLastBuildDate())); + $writer->setLastBuildDate($myDate); + $this->assertEquals($myDate, $writer->getLastBuildDate()); } public function testSetLastBuildDateThrowsExceptionOnInvalidParameter() @@ -906,7 +905,6 @@ public function testAddsAndOrdersEntriesByDateIfRequested() $writer->addEntry($entry); $writer->addEntry($entry2); $writer->orderByDate(); - $this->assertEquals(1230000000, $writer->getEntry(1)->getDateCreated()->get(Date\Date::TIMESTAMP)); + $this->assertEquals(1230000000, $writer->getEntry(1)->getDateCreated()->getTimestamp()); } - -} +} \ No newline at end of file diff --git a/test/Writer/Renderer/Entry/AtomTest.php b/test/Writer/Renderer/Entry/AtomTest.php index 43fc23c0..a3cc8518 100644 --- a/test/Writer/Renderer/Entry/AtomTest.php +++ b/test/Writer/Renderer/Entry/AtomTest.php @@ -20,10 +20,10 @@ */ namespace ZendTest\Feed\Writer\Renderer\Entry; + use Zend\Feed\Writer\Renderer; use Zend\Feed\Writer; use Zend\Feed\Reader; -use Zend\Date; /** * @category Zend @@ -153,7 +153,7 @@ public function testEntryUpdatedDateHasBeenSet() $renderer = new Renderer\Feed\Atom($this->_validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); - $this->assertEquals(1234567890, $entry->getDateModified()->get(Date\Date::TIMESTAMP)); + $this->assertEquals(1234567890, $entry->getDateModified()->getTimestamp()); } /** @@ -171,7 +171,7 @@ public function testEntryPublishedDateHasBeenSet() $renderer = new Renderer\Feed\Atom($this->_validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); - $this->assertEquals(1234567000, $entry->getDateCreated()->get(Date\Date::TIMESTAMP)); + $this->assertEquals(1234567000, $entry->getDateCreated()->getTimestamp()); } public function testEntryIncludesLinkToHtmlVersionOfFeed() diff --git a/test/Writer/Renderer/Entry/RssTest.php b/test/Writer/Renderer/Entry/RssTest.php index 11eaffa8..7fb7c37b 100644 --- a/test/Writer/Renderer/Entry/RssTest.php +++ b/test/Writer/Renderer/Entry/RssTest.php @@ -20,10 +20,10 @@ */ namespace ZendTest\Feed\Writer\Renderer\Entry; + use Zend\Feed\Writer\Renderer; use Zend\Feed\Writer; use Zend\Feed\Reader; -use Zend\Date; /** * @category Zend @@ -169,7 +169,7 @@ public function testEntryUpdatedDateHasBeenSet() $renderer = new Renderer\Feed\Rss($this->_validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); - $this->assertEquals(1234567890, $entry->getDateModified()->get(Date\Date::TIMESTAMP)); + $this->assertEquals(1234567890, $entry->getDateModified()->getTimestamp()); } public function testEntryPublishedDateHasBeenSet() @@ -178,7 +178,7 @@ public function testEntryPublishedDateHasBeenSet() $renderer = new Renderer\Feed\Rss($this->_validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); - $this->assertEquals(1234567000, $entry->getDateCreated()->get(Date\Date::TIMESTAMP)); + $this->assertEquals(1234567000, $entry->getDateCreated()->getTimestamp()); } public function testEntryIncludesLinkToHtmlVersionOfFeed() diff --git a/test/Writer/Renderer/Feed/AtomTest.php b/test/Writer/Renderer/Feed/AtomTest.php index 10f50581..62a706e3 100644 --- a/test/Writer/Renderer/Feed/AtomTest.php +++ b/test/Writer/Renderer/Feed/AtomTest.php @@ -20,10 +20,10 @@ */ namespace ZendTest\Feed\Writer\Renderer\Feed; + use Zend\Feed\Writer; use Zend\Feed\Writer\Renderer; use Zend\Feed\Reader; -use Zend\Date; /** * @category Zend @@ -155,7 +155,7 @@ public function testFeedUpdatedDateHasBeenSet() $atomFeed = new Renderer\Feed\Atom($this->_validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); - $this->assertEquals(1234567890, $feed->getDateModified()->get(Date\Date::TIMESTAMP)); + $this->assertEquals(1234567890, $feed->getDateModified()->getTimestamp()); } /** diff --git a/test/Writer/Renderer/Feed/RssTest.php b/test/Writer/Renderer/Feed/RssTest.php index 6a360093..af88dffc 100644 --- a/test/Writer/Renderer/Feed/RssTest.php +++ b/test/Writer/Renderer/Feed/RssTest.php @@ -24,7 +24,6 @@ use Zend\Feed\Writer; use Zend\Feed\Writer\Renderer; use Zend\Feed\Reader; -use Zend\Date; /** * @category Zend @@ -155,7 +154,7 @@ public function testFeedUpdatedDateHasBeenSet() $rssFeed = new Renderer\Feed\Rss($this->_validWriter); $rssFeed->render(); $feed = Reader\Reader::importString($rssFeed->saveXml()); - $this->assertEquals(1234567890, $feed->getDateModified()->get(Date\Date::TIMESTAMP)); + $this->assertEquals(1234567890, $feed->getDateModified()->getTimestamp()); } public function testFeedUpdatedDateIfMissingThrowsNoException() @@ -171,7 +170,7 @@ public function testFeedLastBuildDateHasBeenSet() $rssFeed = new Renderer\Feed\Rss($this->_validWriter); $rssFeed->render(); $feed = Reader\Reader::importString($rssFeed->saveXml()); - $this->assertEquals(1234567890, $feed->getLastBuildDate()->get(Date\Date::TIMESTAMP)); + $this->assertEquals(1234567890, $feed->getLastBuildDate()->getTimestamp()); } public function testFeedGeneratorHasBeenSet() From ba0a4ff00d7d7db53df94063431f2d448b4476fd Mon Sep 17 00:00:00 2001 From: Fritz Gerneth Date: Thu, 5 Jul 2012 00:09:03 +0200 Subject: [PATCH 220/238] Applied fix for previously failing test Zend\Feed\Reader\Entry\CommonTest::testFeedEntryCanDetectFeedType --- src/Reader/Entry/AbstractEntry.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Reader/Entry/AbstractEntry.php b/src/Reader/Entry/AbstractEntry.php index d10774f3..89942bba 100644 --- a/src/Reader/Entry/AbstractEntry.php +++ b/src/Reader/Entry/AbstractEntry.php @@ -91,8 +91,8 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) $this->_domDocument = $entry->ownerDocument; if ($type !== null) { $this->_data['type'] = $type; - } else { - $this->_data['type'] = Reader\Reader::detectType($feed); + } else if($this->_domDocument !== null) { + $this->_data['type'] = Reader\Reader::detectType($this->_domDocument); } $this->_loadExtensions(); } From 9f7b68af469c1c7f39a1fb230c272854837bed1b Mon Sep 17 00:00:00 2001 From: Fritz Gerneth Date: Thu, 5 Jul 2012 22:08:06 +0200 Subject: [PATCH 221/238] * AbstractEntry::__construct sets type to any if unable to detect type * Added test for changed behavior of AbstractEntry::__construct * Fixed spacing issues --- src/Reader/Entry/AbstractEntry.php | 6 +++-- test/Reader/Entry/CommonTest.php | 35 +++++++++++++++++++++++++----- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/Reader/Entry/AbstractEntry.php b/src/Reader/Entry/AbstractEntry.php index 89942bba..e2a3299f 100644 --- a/src/Reader/Entry/AbstractEntry.php +++ b/src/Reader/Entry/AbstractEntry.php @@ -91,8 +91,10 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) $this->_domDocument = $entry->ownerDocument; if ($type !== null) { $this->_data['type'] = $type; - } else if($this->_domDocument !== null) { - $this->_data['type'] = Reader\Reader::detectType($this->_domDocument); + } else if ($this->_domDocument !== null) { + $this->_data['type'] = Reader\Reader::detectType($this->_domDocument); + } else { + $this->_data['type'] = Reader\Reader::TYPE_ANY; } $this->_loadExtensions(); } diff --git a/test/Reader/Entry/CommonTest.php b/test/Reader/Entry/CommonTest.php index 32949202..b0a41e17 100644 --- a/test/Reader/Entry/CommonTest.php +++ b/test/Reader/Entry/CommonTest.php @@ -133,13 +133,36 @@ public function testReturnsEncodingOfFeedAsUtf8IfUndefined() $this->assertEquals('UTF-8', $entry->getEncoding()); } - public function testFeedEntryCanDetectFeedType() - { - $feed = Reader\Reader::importString( + /** + * When not passing the optional argument type + */ + public function testFeedEntryCanDetectFeedType() + { + $feed = Reader\Reader::importString( file_get_contents($this->_feedSamplePath.'/atom.xml') ); $entry = $feed->current(); - $stub = $this->getMockForAbstractClass('Zend\Feed\Reader\Entry\AbstractEntry', array($entry->getElement(), $entry->getId())); - $this->assertEquals($entry->getType(), $stub->getType()); - } + $stub = $this->getMockForAbstractClass( + 'Zend\Feed\Reader\Entry\AbstractEntry', + array($entry->getElement(), $entry->getId()) + ); + $this->assertEquals($entry->getType(), $stub->getType()); + } + + /** + * When passing a newly created DOMElement without any DOMDocument assigned + */ + public function testFeedEntryCanSetAnyType() + { + $feed = Reader\Reader::importString( + file_get_contents($this->_feedSamplePath.'/atom.xml') + ); + $entry = $feed->current(); + $domElement = new \DOMElement($entry->getElement()->tagName); + $stub = $this->getMockForAbstractClass( + 'Zend\Feed\Reader\Entry\AbstractEntry', + array($domElement, $entry->getId()) + ); + $this->assertEquals($stub->getType(), Reader\Reader::TYPE_ANY); + } } From f989aa31417189ace303366a97c6d7510069e524 Mon Sep 17 00:00:00 2001 From: Maks3w Date: Mon, 9 Jul 2012 16:19:42 +0200 Subject: [PATCH 222/238] [CS][Library] Set File Header http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards#CodingStandards-Files The following script replaces the content between PHP open tag and namespace declaration. for COMPONENT in $(ls -d *) do for FILE in $(find $COMPONENT -name "*.php") do BLOCK="\/\*\*\n \* Zend Framework \(http:\/\/framework\.zend\.com\/\)\n \*\n \* \@link http:\/\/github\.com\/zendframework\/zf2 for the canonical source repository\n \* \@copyright Copyright \(c\) 2005-2012 Zend Technologies USA Inc\. \(http:\/\/www\.zend\.com\)\n \* \@license http:\/\/framework\.zend\.com\/license\/new-bsd New BSD License\n \* \@package Zend_$COMPONENT\n \*\/" perl -0777 -i -pe "s/(<\?php(\s*.*)*\nn)/ Date: Mon, 9 Jul 2012 16:34:21 +0200 Subject: [PATCH 223/238] [CS][test] Remove @copyright & @license for fl in $(find . -name "*.php"); do mv $fl $fl.old; sed '/@copyright/d' $fl.old > $fl; rm -f $fl.old; done; for fl in $(find . -name "*.php"); do mv $fl $fl.old; sed '/@license/d' $fl.old > $fl; rm -f $fl.old; done; --- test/PubSubHubbub/Model/SubscriptionTest.php | 4 ---- test/PubSubHubbub/PubSubHubbubTest.php | 4 ---- test/PubSubHubbub/PublisherTest.php | 6 +----- test/PubSubHubbub/Subscriber/CallbackTest.php | 4 ---- test/PubSubHubbub/SubscriberHttpTest.php | 4 ---- test/PubSubHubbub/SubscriberTest.php | 4 ---- test/Reader/Entry/AtomStandaloneEntryTest.php | 4 ---- test/Reader/Entry/AtomTest.php | 4 ---- test/Reader/Entry/CommonTest.php | 4 ---- test/Reader/Entry/RssTest.php | 4 ---- test/Reader/Feed/AtomSourceTest.php | 4 ---- test/Reader/Feed/AtomTest.php | 4 ---- test/Reader/Feed/CommonTest.php | 4 ---- test/Reader/Feed/RssTest.php | 4 ---- test/Reader/Integration/H-OnlineComAtom10Test.php | 4 ---- test/Reader/Integration/LautDeRdfTest.php | 4 ---- test/Reader/Integration/PodcastRss2Test.php | 4 ---- test/Reader/Integration/WordpressAtom10Test.php | 4 ---- test/Reader/Integration/WordpressRss2DcAtomTest.php | 4 ---- test/Reader/ReaderTest.php | 4 ---- test/Reader/_files/My/Extension/JungleBooks/Entry.php | 4 ---- test/Reader/_files/My/Extension/JungleBooks/Feed.php | 4 ---- test/Writer/DeletedTest.php | 4 ---- test/Writer/EntryTest.php | 4 ---- test/Writer/Extension/ITunes/EntryTest.php | 4 ---- test/Writer/Extension/ITunes/FeedTest.php | 4 ---- test/Writer/FeedTest.php | 6 +----- test/Writer/Renderer/Entry/AtomTest.php | 4 ---- test/Writer/Renderer/Entry/RssTest.php | 4 ---- test/Writer/Renderer/Feed/AtomTest.php | 4 ---- test/Writer/Renderer/Feed/RssTest.php | 4 ---- 31 files changed, 2 insertions(+), 126 deletions(-) diff --git a/test/PubSubHubbub/Model/SubscriptionTest.php b/test/PubSubHubbub/Model/SubscriptionTest.php index fcd5ca5b..a75ac589 100644 --- a/test/PubSubHubbub/Model/SubscriptionTest.php +++ b/test/PubSubHubbub/Model/SubscriptionTest.php @@ -14,8 +14,6 @@ * * @category Zend * @package UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\PubSubHubbub\Model; @@ -32,8 +30,6 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Pubsubhubbub_Model - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class SubscriptionTest extends \PHPUnit_Framework_TestCase { diff --git a/test/PubSubHubbub/PubSubHubbubTest.php b/test/PubSubHubbub/PubSubHubbubTest.php index 80c76c19..19aec95d 100644 --- a/test/PubSubHubbub/PubSubHubbubTest.php +++ b/test/PubSubHubbub/PubSubHubbubTest.php @@ -14,8 +14,6 @@ * * @category Zend * @package UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\PubSubHubbub; @@ -29,8 +27,6 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Subsubhubbub - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class PubSubHubbubTest extends \PHPUnit_Framework_TestCase { diff --git a/test/PubSubHubbub/PublisherTest.php b/test/PubSubHubbub/PublisherTest.php index a2b7d136..88d0ff48 100644 --- a/test/PubSubHubbub/PublisherTest.php +++ b/test/PubSubHubbub/PublisherTest.php @@ -14,8 +14,6 @@ * * @category Zend * @package UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\PubSubHubbub; @@ -31,8 +29,6 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Subsubhubbub - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class PublisherTest extends \PHPUnit_Framework_TestCase { @@ -314,4 +310,4 @@ class ClientNotReset extends HttpClient public function resetParameters($clearCookies = false) { // Do nothing } -} \ No newline at end of file +} diff --git a/test/PubSubHubbub/Subscriber/CallbackTest.php b/test/PubSubHubbub/Subscriber/CallbackTest.php index 0a2d9319..b3a62296 100644 --- a/test/PubSubHubbub/Subscriber/CallbackTest.php +++ b/test/PubSubHubbub/Subscriber/CallbackTest.php @@ -14,8 +14,6 @@ * * @category Zend * @package UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\PubSubHubbub\Subscriber; @@ -33,8 +31,6 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Subsubhubbub - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class CallbackTest extends \PHPUnit_Framework_TestCase { diff --git a/test/PubSubHubbub/SubscriberHttpTest.php b/test/PubSubHubbub/SubscriberHttpTest.php index 1d159df6..688038dd 100644 --- a/test/PubSubHubbub/SubscriberHttpTest.php +++ b/test/PubSubHubbub/SubscriberHttpTest.php @@ -14,8 +14,6 @@ * * @category Zend * @package UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\PubSubHubbub; @@ -38,8 +36,6 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Subsubhubbub - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class SubscriberHttpTest extends \PHPUnit_Framework_TestCase { diff --git a/test/PubSubHubbub/SubscriberTest.php b/test/PubSubHubbub/SubscriberTest.php index 4c33c9e1..22517d71 100644 --- a/test/PubSubHubbub/SubscriberTest.php +++ b/test/PubSubHubbub/SubscriberTest.php @@ -14,8 +14,6 @@ * * @category Zend * @package UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\PubSubHubbub; @@ -31,8 +29,6 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Subsubhubbub - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class SubscriberTest extends \PHPUnit_Framework_TestCase { diff --git a/test/Reader/Entry/AtomStandaloneEntryTest.php b/test/Reader/Entry/AtomStandaloneEntryTest.php index 712db051..56e63975 100644 --- a/test/Reader/Entry/AtomStandaloneEntryTest.php +++ b/test/Reader/Entry/AtomStandaloneEntryTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Reader\Entry; @@ -28,8 +26,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests -* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader */ diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index 2f77eba0..4d584538 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Reader\Entry; @@ -28,8 +26,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests -* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader */ diff --git a/test/Reader/Entry/CommonTest.php b/test/Reader/Entry/CommonTest.php index b0a41e17..be416ccd 100644 --- a/test/Reader/Entry/CommonTest.php +++ b/test/Reader/Entry/CommonTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Reader\Entry; @@ -27,8 +25,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests -* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader */ diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index f17d31a8..bccb350f 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Reader\Entry; @@ -28,8 +26,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader */ diff --git a/test/Reader/Feed/AtomSourceTest.php b/test/Reader/Feed/AtomSourceTest.php index 916f6248..cc633a02 100644 --- a/test/Reader/Feed/AtomSourceTest.php +++ b/test/Reader/Feed/AtomSourceTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Reader\Feed; @@ -28,8 +26,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests -* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader */ diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 13a67d32..f69f8d84 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Reader\Feed; @@ -28,8 +26,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests -* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader */ diff --git a/test/Reader/Feed/CommonTest.php b/test/Reader/Feed/CommonTest.php index f152ac22..98daa431 100644 --- a/test/Reader/Feed/CommonTest.php +++ b/test/Reader/Feed/CommonTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Reader\Feed; @@ -26,8 +24,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests -* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Reader\Reader */ diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index d683d65b..8030d9dd 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Reader\Feed; @@ -28,8 +26,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests -* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader */ diff --git a/test/Reader/Integration/H-OnlineComAtom10Test.php b/test/Reader/Integration/H-OnlineComAtom10Test.php index 5d0efd50..c28a307a 100644 --- a/test/Reader/Integration/H-OnlineComAtom10Test.php +++ b/test/Reader/Integration/H-OnlineComAtom10Test.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Reader\Integration; @@ -27,8 +25,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests -* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader */ diff --git a/test/Reader/Integration/LautDeRdfTest.php b/test/Reader/Integration/LautDeRdfTest.php index 29cc7ea9..7da2a866 100644 --- a/test/Reader/Integration/LautDeRdfTest.php +++ b/test/Reader/Integration/LautDeRdfTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Reader\Integration; @@ -27,8 +25,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests -* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader */ diff --git a/test/Reader/Integration/PodcastRss2Test.php b/test/Reader/Integration/PodcastRss2Test.php index 66989bd3..6e9b354c 100644 --- a/test/Reader/Integration/PodcastRss2Test.php +++ b/test/Reader/Integration/PodcastRss2Test.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Reader\Integration; @@ -27,8 +25,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests -* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader */ diff --git a/test/Reader/Integration/WordpressAtom10Test.php b/test/Reader/Integration/WordpressAtom10Test.php index d3cb1499..9c3647e6 100644 --- a/test/Reader/Integration/WordpressAtom10Test.php +++ b/test/Reader/Integration/WordpressAtom10Test.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Reader\Integration; @@ -27,8 +25,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests -* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader */ diff --git a/test/Reader/Integration/WordpressRss2DcAtomTest.php b/test/Reader/Integration/WordpressRss2DcAtomTest.php index b8e81482..2b3337c1 100644 --- a/test/Reader/Integration/WordpressRss2DcAtomTest.php +++ b/test/Reader/Integration/WordpressRss2DcAtomTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Reader\Integration; @@ -26,8 +24,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests -* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader */ diff --git a/test/Reader/ReaderTest.php b/test/Reader/ReaderTest.php index 4237d1e4..e4f54e1f 100644 --- a/test/Reader/ReaderTest.php +++ b/test/Reader/ReaderTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Reader; @@ -30,8 +28,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests -* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Feed * @group Zend_Feed_Reader */ diff --git a/test/Reader/_files/My/Extension/JungleBooks/Entry.php b/test/Reader/_files/My/Extension/JungleBooks/Entry.php index a38f2e16..a82965b7 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Entry.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Entry.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace My\Extension\JungleBooks; @@ -26,8 +24,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class Entry extends Extension\AbstractEntry { diff --git a/test/Reader/_files/My/Extension/JungleBooks/Feed.php b/test/Reader/_files/My/Extension/JungleBooks/Feed.php index 22b0be4d..a7f3a974 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Feed.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Feed.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace My\Extension\JungleBooks; @@ -26,8 +24,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class Feed extends Extension\AbstractFeed { diff --git a/test/Writer/DeletedTest.php b/test/Writer/DeletedTest.php index b2a52943..e31f40b4 100644 --- a/test/Writer/DeletedTest.php +++ b/test/Writer/DeletedTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Writer; @@ -30,8 +28,6 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Writer -* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License */ class DeletedTest extends \PHPUnit_Framework_TestCase { diff --git a/test/Writer/EntryTest.php b/test/Writer/EntryTest.php index ac00b9a9..3bf4371b 100644 --- a/test/Writer/EntryTest.php +++ b/test/Writer/EntryTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Writer; @@ -30,8 +28,6 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Writer - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class EntryTest extends \PHPUnit_Framework_TestCase { diff --git a/test/Writer/Extension/ITunes/EntryTest.php b/test/Writer/Extension/ITunes/EntryTest.php index a7f45265..d2fca62b 100644 --- a/test/Writer/Extension/ITunes/EntryTest.php +++ b/test/Writer/Extension/ITunes/EntryTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Writer\Extension\ITunes; @@ -28,8 +26,6 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Writer -* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License */ class EntryTest extends \PHPUnit_Framework_TestCase { diff --git a/test/Writer/Extension/ITunes/FeedTest.php b/test/Writer/Extension/ITunes/FeedTest.php index 50f5107e..b77754c8 100644 --- a/test/Writer/Extension/ITunes/FeedTest.php +++ b/test/Writer/Extension/ITunes/FeedTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Json * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Writer\Extension\ITunes; @@ -28,8 +26,6 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Writer -* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) -* @license http://framework.zend.com/license/new-bsd New BSD License */ class FeedTest extends \PHPUnit_Framework_TestCase { diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php index b886350f..ce7d1824 100644 --- a/test/Writer/FeedTest.php +++ b/test/Writer/FeedTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Writer; @@ -31,8 +29,6 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Writer - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class FeedTest extends \PHPUnit_Framework_TestCase { @@ -907,4 +903,4 @@ public function testAddsAndOrdersEntriesByDateIfRequested() $writer->orderByDate(); $this->assertEquals(1230000000, $writer->getEntry(1)->getDateCreated()->getTimestamp()); } -} \ No newline at end of file +} diff --git a/test/Writer/Renderer/Entry/AtomTest.php b/test/Writer/Renderer/Entry/AtomTest.php index abc9f26d..79251def 100644 --- a/test/Writer/Renderer/Entry/AtomTest.php +++ b/test/Writer/Renderer/Entry/AtomTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Writer\Renderer\Entry; @@ -31,8 +29,6 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Writer - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class AtomTest extends \PHPUnit_Framework_TestCase { diff --git a/test/Writer/Renderer/Entry/RssTest.php b/test/Writer/Renderer/Entry/RssTest.php index 426f0c90..157f6adc 100644 --- a/test/Writer/Renderer/Entry/RssTest.php +++ b/test/Writer/Renderer/Entry/RssTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Writer\Renderer\Entry; @@ -31,8 +29,6 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Writer - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class RssTest extends \PHPUnit_Framework_TestCase { diff --git a/test/Writer/Renderer/Feed/AtomTest.php b/test/Writer/Renderer/Feed/AtomTest.php index 73774086..f68ef3a4 100644 --- a/test/Writer/Renderer/Feed/AtomTest.php +++ b/test/Writer/Renderer/Feed/AtomTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Writer\Renderer\Feed; @@ -31,8 +29,6 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Writer - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class AtomTest extends \PHPUnit_Framework_TestCase { diff --git a/test/Writer/Renderer/Feed/RssTest.php b/test/Writer/Renderer/Feed/RssTest.php index 95ff42bf..25d08f5c 100644 --- a/test/Writer/Renderer/Feed/RssTest.php +++ b/test/Writer/Renderer/Feed/RssTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Feed * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Feed\Writer\Renderer\Feed; @@ -31,8 +29,6 @@ * @subpackage UnitTests * @group Zend_Feed * @group Zend_Feed_Writer - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class RssTest extends \PHPUnit_Framework_TestCase { From f2f74ddfd10fbca47a85ed4f8f7e31d1b7044147 Mon Sep 17 00:00:00 2001 From: Maks3w Date: Mon, 9 Jul 2012 16:41:27 +0200 Subject: [PATCH 224/238] [CS][Tests] Set File Header http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards#CodingStandards-Files The following script replaces the content between PHP open tag and namespace declaration. for COMPONENT in $(ls -d *) do for FILE in $(find $COMPONENT -name "*.php") do BLOCK="\/\*\*\n \* Zend Framework \(http:\/\/framework\.zend\.com\/\)\n \*\n \* \@link http:\/\/github\.com\/zendframework\/zf2 for the canonical source repository\n \* \@copyright Copyright \(c\) 2005-2012 Zend Technologies USA Inc\. \(http:\/\/www\.zend\.com\)\n \* \@license http:\/\/framework\.zend\.com\/license\/new-bsd New BSD License\n \* \@package Zend_$COMPONENT\n \*\/" perl -0777 -i -pe "s/(<\?php(\s*.*)*\nn)/ Date: Mon, 9 Jul 2012 16:56:33 +0200 Subject: [PATCH 225/238] [CS][Tests] Rest of files --- test/Reader/Entry/_files/Common/atom.xml | 30 ++++--------------- .../_files/Common/atom_noencodingdefined.xml | 30 ++++--------------- test/Reader/Entry/_files/Common/rss.xml | 30 ++++--------------- test/Reader/Feed/_files/Common/atom.xml | 30 ++++--------------- .../_files/Common/atom_noencodingdefined.xml | 30 ++++--------------- .../_files/Common/atom_rewrittenbydom.xml | 30 ++++--------------- test/Reader/Feed/_files/Common/rss.xml | 30 ++++--------------- .../Integration/_files/wordpress-atom10.xml | 30 ++++--------------- .../_files/wordpress-rss2-dc-atom.xml | 30 ++++--------------- 9 files changed, 45 insertions(+), 225 deletions(-) diff --git a/test/Reader/Entry/_files/Common/atom.xml b/test/Reader/Entry/_files/Common/atom.xml index 1f2c99e6..29c4fe30 100644 --- a/test/Reader/Entry/_files/Common/atom.xml +++ b/test/Reader/Entry/_files/Common/atom.xml @@ -424,32 +424,12 @@ My programming adventure started out with Visual Basic 3 back in 1993. I was jus
 <?php
 /**
- * BSD LICENSE
+ * Zend Framework (http://framework.zend.com/)
  *
- * Copyright (c) 2009, norm2782
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of norm2782 nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * @link      http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license   http://framework.zend.com/license/new-bsd New BSD License
+ * @package   Zend_Feed
  */
 
 /**
diff --git a/test/Reader/Entry/_files/Common/atom_noencodingdefined.xml b/test/Reader/Entry/_files/Common/atom_noencodingdefined.xml
index 3e31cbaf..69dcd46b 100644
--- a/test/Reader/Entry/_files/Common/atom_noencodingdefined.xml
+++ b/test/Reader/Entry/_files/Common/atom_noencodingdefined.xml
@@ -424,32 +424,12 @@ My programming adventure started out with Visual Basic 3 back in 1993. I was jus
 
 <?php
 /**
- * BSD LICENSE
+ * Zend Framework (http://framework.zend.com/)
  *
- * Copyright (c) 2009, norm2782
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of norm2782 nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * @link      http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license   http://framework.zend.com/license/new-bsd New BSD License
+ * @package   Zend_Feed
  */
 
 /**
diff --git a/test/Reader/Entry/_files/Common/rss.xml b/test/Reader/Entry/_files/Common/rss.xml
index 3d1fdfae..75f0e70c 100644
--- a/test/Reader/Entry/_files/Common/rss.xml
+++ b/test/Reader/Entry/_files/Common/rss.xml
@@ -403,32 +403,12 @@ My programming adventure started out with Visual Basic 3 back in 1993. I was jus
 
 <?php
 /**
- * BSD LICENSE
+ * Zend Framework (http://framework.zend.com/)
  *
- * Copyright (c) 2009, norm2782
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of norm2782 nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * @link      http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license   http://framework.zend.com/license/new-bsd New BSD License
+ * @package   Zend_Feed
  */
 
 /**
diff --git a/test/Reader/Feed/_files/Common/atom.xml b/test/Reader/Feed/_files/Common/atom.xml
index 1f2c99e6..29c4fe30 100644
--- a/test/Reader/Feed/_files/Common/atom.xml
+++ b/test/Reader/Feed/_files/Common/atom.xml
@@ -424,32 +424,12 @@ My programming adventure started out with Visual Basic 3 back in 1993. I was jus
 
 <?php
 /**
- * BSD LICENSE
+ * Zend Framework (http://framework.zend.com/)
  *
- * Copyright (c) 2009, norm2782
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of norm2782 nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * @link      http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license   http://framework.zend.com/license/new-bsd New BSD License
+ * @package   Zend_Feed
  */
 
 /**
diff --git a/test/Reader/Feed/_files/Common/atom_noencodingdefined.xml b/test/Reader/Feed/_files/Common/atom_noencodingdefined.xml
index 3e31cbaf..69dcd46b 100644
--- a/test/Reader/Feed/_files/Common/atom_noencodingdefined.xml
+++ b/test/Reader/Feed/_files/Common/atom_noencodingdefined.xml
@@ -424,32 +424,12 @@ My programming adventure started out with Visual Basic 3 back in 1993. I was jus
 
 <?php
 /**
- * BSD LICENSE
+ * Zend Framework (http://framework.zend.com/)
  *
- * Copyright (c) 2009, norm2782
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of norm2782 nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * @link      http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license   http://framework.zend.com/license/new-bsd New BSD License
+ * @package   Zend_Feed
  */
 
 /**
diff --git a/test/Reader/Feed/_files/Common/atom_rewrittenbydom.xml b/test/Reader/Feed/_files/Common/atom_rewrittenbydom.xml
index fd9da5f0..378e71b4 100644
--- a/test/Reader/Feed/_files/Common/atom_rewrittenbydom.xml
+++ b/test/Reader/Feed/_files/Common/atom_rewrittenbydom.xml
@@ -420,32 +420,12 @@ My programming adventure started out with Visual Basic 3 back in 1993. I was jus
 
 <?php
 /**
- * BSD LICENSE
+ * Zend Framework (http://framework.zend.com/)
  *
- * Copyright (c) 2009, norm2782
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of norm2782 nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * @link      http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license   http://framework.zend.com/license/new-bsd New BSD License
+ * @package   Zend_Feed
  */
 
 /**
diff --git a/test/Reader/Feed/_files/Common/rss.xml b/test/Reader/Feed/_files/Common/rss.xml
index 3d1fdfae..75f0e70c 100644
--- a/test/Reader/Feed/_files/Common/rss.xml
+++ b/test/Reader/Feed/_files/Common/rss.xml
@@ -403,32 +403,12 @@ My programming adventure started out with Visual Basic 3 back in 1993. I was jus
 
 <?php
 /**
- * BSD LICENSE
+ * Zend Framework (http://framework.zend.com/)
  *
- * Copyright (c) 2009, norm2782
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of norm2782 nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * @link      http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license   http://framework.zend.com/license/new-bsd New BSD License
+ * @package   Zend_Feed
  */
 
 /**
diff --git a/test/Reader/Integration/_files/wordpress-atom10.xml b/test/Reader/Integration/_files/wordpress-atom10.xml
index 1f2c99e6..29c4fe30 100644
--- a/test/Reader/Integration/_files/wordpress-atom10.xml
+++ b/test/Reader/Integration/_files/wordpress-atom10.xml
@@ -424,32 +424,12 @@ My programming adventure started out with Visual Basic 3 back in 1993. I was jus
 
 <?php
 /**
- * BSD LICENSE
+ * Zend Framework (http://framework.zend.com/)
  *
- * Copyright (c) 2009, norm2782
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of norm2782 nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * @link      http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license   http://framework.zend.com/license/new-bsd New BSD License
+ * @package   Zend_Feed
  */
 
 /**
diff --git a/test/Reader/Integration/_files/wordpress-rss2-dc-atom.xml b/test/Reader/Integration/_files/wordpress-rss2-dc-atom.xml
index 3d1fdfae..75f0e70c 100644
--- a/test/Reader/Integration/_files/wordpress-rss2-dc-atom.xml
+++ b/test/Reader/Integration/_files/wordpress-rss2-dc-atom.xml
@@ -403,32 +403,12 @@ My programming adventure started out with Visual Basic 3 back in 1993. I was jus
 
 <?php
 /**
- * BSD LICENSE
+ * Zend Framework (http://framework.zend.com/)
  *
- * Copyright (c) 2009, norm2782
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of norm2782 nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY norm2782 ''AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL norm2782 BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * @link      http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license   http://framework.zend.com/license/new-bsd New BSD License
+ * @package   Zend_Feed
  */
 
 /**

From c5a5d19043c3dcd3ddc9a3118db91fa464d42b4f Mon Sep 17 00:00:00 2001
From: Matthew Weier O'Phinney 
Date: Mon, 9 Jul 2012 16:46:59 -0500
Subject: [PATCH 226/238] [zen-49] Correct import statements across framework

- Ran a script that would create multiple import statements out of multi-line
  import statements, and which would sort all import statements in alphabetic
  order. Script is at https://gist.github.com/3079222 and was run by dropping
  into the library/Zend folder and typing (in zsh)
  "for file in **/*.php;do php /path/to/replace-uses.php $file; done"
---
 src/PubSubHubbub/AbstractCallback.php                 | 2 +-
 src/PubSubHubbub/Publisher.php                        | 2 +-
 src/PubSubHubbub/Subscriber.php                       | 2 +-
 src/Reader/AbstractEntry.php                          | 2 +-
 src/Reader/Entry/AbstractEntry.php                    | 6 +++---
 src/Reader/Entry/Atom.php                             | 2 +-
 src/Reader/Extension/AbstractEntry.php                | 4 ++--
 src/Reader/Extension/AbstractFeed.php                 | 2 +-
 src/Reader/Extension/Podcast/Feed.php                 | 2 +-
 src/Reader/Feed/AbstractFeed.php                      | 4 ++--
 src/Reader/Feed/FeedInterface.php                     | 2 +-
 src/Reader/Reader.php                                 | 4 ++--
 src/Writer/Extension/Atom/Renderer/Feed.php           | 2 +-
 src/Writer/Extension/Content/Renderer/Entry.php       | 2 +-
 src/Writer/Extension/DublinCore/Renderer/Entry.php    | 2 +-
 src/Writer/Extension/DublinCore/Renderer/Feed.php     | 2 +-
 src/Writer/Extension/ITunes/Entry.php                 | 3 +--
 src/Writer/Extension/ITunes/Renderer/Entry.php        | 2 +-
 src/Writer/Extension/ITunes/Renderer/Feed.php         | 2 +-
 src/Writer/Extension/Slash/Renderer/Entry.php         | 2 +-
 src/Writer/Extension/Threading/Renderer/Entry.php     | 2 +-
 src/Writer/Extension/WellFormedWeb/Renderer/Entry.php | 2 +-
 src/Writer/Renderer/Entry/AtomDeleted.php             | 2 +-
 src/Writer/Renderer/Feed/Atom.php                     | 4 ++--
 src/Writer/Renderer/Feed/AtomSource.php               | 6 +++---
 src/Writer/Writer.php                                 | 4 ++--
 26 files changed, 35 insertions(+), 36 deletions(-)

diff --git a/src/PubSubHubbub/AbstractCallback.php b/src/PubSubHubbub/AbstractCallback.php
index 39ca955e..0f85b58a 100644
--- a/src/PubSubHubbub/AbstractCallback.php
+++ b/src/PubSubHubbub/AbstractCallback.php
@@ -11,8 +11,8 @@
 namespace Zend\Feed\PubSubHubbub;
 
 use Traversable;
-use Zend\Stdlib\ArrayUtils;
 use Zend\Http\PhpEnvironment\Response as PhpResponse;
+use Zend\Stdlib\ArrayUtils;
 
 /**
  * @category   Zend
diff --git a/src/PubSubHubbub/Publisher.php b/src/PubSubHubbub/Publisher.php
index eb4fd86c..551acc33 100644
--- a/src/PubSubHubbub/Publisher.php
+++ b/src/PubSubHubbub/Publisher.php
@@ -11,8 +11,8 @@
 namespace Zend\Feed\PubSubHubbub;
 
 use Traversable;
-use Zend\Stdlib\ArrayUtils;
 use Zend\Http\Request as HttpRequest;
+use Zend\Stdlib\ArrayUtils;
 use Zend\Uri;
 use Zend\Version;
 
diff --git a/src/PubSubHubbub/Subscriber.php b/src/PubSubHubbub/Subscriber.php
index 6077edc6..088076aa 100644
--- a/src/PubSubHubbub/Subscriber.php
+++ b/src/PubSubHubbub/Subscriber.php
@@ -13,8 +13,8 @@
 use DateInterval;
 use DateTime;
 use Traversable;
-use Zend\Stdlib\ArrayUtils;
 use Zend\Http\Request as HttpRequest;
+use Zend\Stdlib\ArrayUtils;
 use Zend\Uri;
 use Zend\Version;
 
diff --git a/src/Reader/AbstractEntry.php b/src/Reader/AbstractEntry.php
index fa499bd5..35e49d72 100644
--- a/src/Reader/AbstractEntry.php
+++ b/src/Reader/AbstractEntry.php
@@ -10,8 +10,8 @@
 
 namespace Zend\Feed\Reader;
 
-use DOMElement;
 use DOMDocument;
+use DOMElement;
 use DOMXPath;
 
 /**
diff --git a/src/Reader/Entry/AbstractEntry.php b/src/Reader/Entry/AbstractEntry.php
index 5950752f..9371f061 100644
--- a/src/Reader/Entry/AbstractEntry.php
+++ b/src/Reader/Entry/AbstractEntry.php
@@ -10,11 +10,11 @@
 
 namespace Zend\Feed\Reader\Entry;
 
-use Zend\Feed\Reader;
-use Zend\Feed\Reader\Exception;
-use DOMElement;
 use DOMDocument;
+use DOMElement;
 use DOMXPath;
+use Zend\Feed\Reader;
+use Zend\Feed\Reader\Exception;
 
 /**
 * @category Zend
diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php
index 76646b01..417204d6 100644
--- a/src/Reader/Entry/Atom.php
+++ b/src/Reader/Entry/Atom.php
@@ -10,9 +10,9 @@
 
 namespace Zend\Feed\Reader\Entry;
 
-use Zend\Feed\Reader;
 use DOMElement;
 use DOMXPath;
+use Zend\Feed\Reader;
 
 /**
 * @category Zend
diff --git a/src/Reader/Extension/AbstractEntry.php b/src/Reader/Extension/AbstractEntry.php
index e61beacd..207773c0 100644
--- a/src/Reader/Extension/AbstractEntry.php
+++ b/src/Reader/Extension/AbstractEntry.php
@@ -10,10 +10,10 @@
 
 namespace Zend\Feed\Reader\Extension;
 
-use Zend\Feed\Reader;
-use DOMXPath;
 use DOMDocument;
 use DOMElement;
+use DOMXPath;
+use Zend\Feed\Reader;
 
 /**
 * @category Zend
diff --git a/src/Reader/Extension/AbstractFeed.php b/src/Reader/Extension/AbstractFeed.php
index 4953784d..c219836f 100644
--- a/src/Reader/Extension/AbstractFeed.php
+++ b/src/Reader/Extension/AbstractFeed.php
@@ -10,9 +10,9 @@
 
 namespace Zend\Feed\Reader\Extension;
 
-use Zend\Feed\Reader;
 use DOMDocument;
 use DOMXPath;
+use Zend\Feed\Reader;
 
 /**
 * @category Zend
diff --git a/src/Reader/Extension/Podcast/Feed.php b/src/Reader/Extension/Podcast/Feed.php
index 0d45c52b..a79207b5 100644
--- a/src/Reader/Extension/Podcast/Feed.php
+++ b/src/Reader/Extension/Podcast/Feed.php
@@ -10,8 +10,8 @@
 
 namespace Zend\Feed\Reader\Extension\Podcast;
 
-use Zend\Feed\Reader\Extension;
 use DOMText;
+use Zend\Feed\Reader\Extension;
 
 /**
 * @category Zend
diff --git a/src/Reader/Feed/AbstractFeed.php b/src/Reader/Feed/AbstractFeed.php
index 51bc300d..36a2bd02 100644
--- a/src/Reader/Feed/AbstractFeed.php
+++ b/src/Reader/Feed/AbstractFeed.php
@@ -10,10 +10,10 @@
 
 namespace Zend\Feed\Reader\Feed;
 
+use DOMDocument;
+use DOMXPath;
 use Zend\Feed\Reader;
 use Zend\Feed\Reader\Exception;
-use DOMXPath;
-use DOMDocument;
 
 /**
 * @category Zend
diff --git a/src/Reader/Feed/FeedInterface.php b/src/Reader/Feed/FeedInterface.php
index 592c5202..7da249ce 100644
--- a/src/Reader/Feed/FeedInterface.php
+++ b/src/Reader/Feed/FeedInterface.php
@@ -10,8 +10,8 @@
 
 namespace Zend\Feed\Reader\Feed;
 
-use Iterator;
 use Countable;
+use Iterator;
 
 /**
 * @category Zend
diff --git a/src/Reader/Reader.php b/src/Reader/Reader.php
index 52f7a43b..519ef676 100644
--- a/src/Reader/Reader.php
+++ b/src/Reader/Reader.php
@@ -10,12 +10,12 @@
 
 namespace Zend\Feed\Reader;
 
+use DOMDocument;
+use DOMXPath;
 use Zend\Cache\Storage\StorageInterface as CacheStorage;
 use Zend\Http;
 use Zend\Loader;
 use Zend\Stdlib\ErrorHandler;
-use DOMDocument;
-use DOMXPath;
 
 /**
 * @category Zend
diff --git a/src/Writer/Extension/Atom/Renderer/Feed.php b/src/Writer/Extension/Atom/Renderer/Feed.php
index c81b969f..91a08b4f 100644
--- a/src/Writer/Extension/Atom/Renderer/Feed.php
+++ b/src/Writer/Extension/Atom/Renderer/Feed.php
@@ -10,9 +10,9 @@
 
 namespace Zend\Feed\Writer\Extension\Atom\Renderer;
 
-use Zend\Feed\Writer\Extension;
 use DOMDocument;
 use DOMElement;
+use Zend\Feed\Writer\Extension;
 
 /**
 * @category Zend
diff --git a/src/Writer/Extension/Content/Renderer/Entry.php b/src/Writer/Extension/Content/Renderer/Entry.php
index 0490380a..424112de 100644
--- a/src/Writer/Extension/Content/Renderer/Entry.php
+++ b/src/Writer/Extension/Content/Renderer/Entry.php
@@ -10,9 +10,9 @@
 
 namespace Zend\Feed\Writer\Extension\Content\Renderer;
 
-use Zend\Feed\Writer\Extension;
 use DOMDocument;
 use DOMElement;
+use Zend\Feed\Writer\Extension;
 
 /**
 * @category Zend
diff --git a/src/Writer/Extension/DublinCore/Renderer/Entry.php b/src/Writer/Extension/DublinCore/Renderer/Entry.php
index 93c7788c..6f756c60 100644
--- a/src/Writer/Extension/DublinCore/Renderer/Entry.php
+++ b/src/Writer/Extension/DublinCore/Renderer/Entry.php
@@ -10,9 +10,9 @@
 
 namespace Zend\Feed\Writer\Extension\DublinCore\Renderer;
 
-use Zend\Feed\Writer\Extension;
 use DOMDocument;
 use DOMElement;
+use Zend\Feed\Writer\Extension;
 
 /**
 * @category Zend
diff --git a/src/Writer/Extension/DublinCore/Renderer/Feed.php b/src/Writer/Extension/DublinCore/Renderer/Feed.php
index 1b969aa2..81c9f056 100644
--- a/src/Writer/Extension/DublinCore/Renderer/Feed.php
+++ b/src/Writer/Extension/DublinCore/Renderer/Feed.php
@@ -10,9 +10,9 @@
 
 namespace Zend\Feed\Writer\Extension\DublinCore\Renderer;
 
-use Zend\Feed\Writer\Extension;
 use DOMDocument;
 use DOMElement;
+use Zend\Feed\Writer\Extension;
 
 /**
 * @category Zend
diff --git a/src/Writer/Extension/ITunes/Entry.php b/src/Writer/Extension/ITunes/Entry.php
index 33c719ca..de62da19 100644
--- a/src/Writer/Extension/ITunes/Entry.php
+++ b/src/Writer/Extension/ITunes/Entry.php
@@ -9,9 +9,8 @@
  */
 
 namespace Zend\Feed\Writer\Extension\ITunes;
-use Zend\Feed\Writer\Extension;
 use Zend\Feed\Writer;
-
+use Zend\Feed\Writer\Extension;
 
 /**
 * @category Zend
diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php
index 195c20b8..33410ceb 100644
--- a/src/Writer/Extension/ITunes/Renderer/Entry.php
+++ b/src/Writer/Extension/ITunes/Renderer/Entry.php
@@ -10,9 +10,9 @@
 
 namespace Zend\Feed\Writer\Extension\ITunes\Renderer;
 
-use Zend\Feed\Writer\Extension;
 use DOMDocument;
 use DOMElement;
+use Zend\Feed\Writer\Extension;
 
 /**
 * @category Zend
diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php
index 9cba799f..32186a86 100644
--- a/src/Writer/Extension/ITunes/Renderer/Feed.php
+++ b/src/Writer/Extension/ITunes/Renderer/Feed.php
@@ -10,9 +10,9 @@
 
 namespace Zend\Feed\Writer\Extension\ITunes\Renderer;
 
-use Zend\Feed\Writer\Extension;
 use DOMDocument;
 use DOMElement;
+use Zend\Feed\Writer\Extension;
 
 /**
 * @category Zend
diff --git a/src/Writer/Extension/Slash/Renderer/Entry.php b/src/Writer/Extension/Slash/Renderer/Entry.php
index 1a9528a0..694ef070 100644
--- a/src/Writer/Extension/Slash/Renderer/Entry.php
+++ b/src/Writer/Extension/Slash/Renderer/Entry.php
@@ -10,9 +10,9 @@
 
 namespace Zend\Feed\Writer\Extension\Slash\Renderer;
 
-use Zend\Feed\Writer\Extension;
 use DOMDocument;
 use DOMElement;
+use Zend\Feed\Writer\Extension;
 
 /**
 * @category Zend
diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php
index 26c69370..61bfa117 100644
--- a/src/Writer/Extension/Threading/Renderer/Entry.php
+++ b/src/Writer/Extension/Threading/Renderer/Entry.php
@@ -10,9 +10,9 @@
 
 namespace Zend\Feed\Writer\Extension\Threading\Renderer;
 
-use Zend\Feed\Writer\Extension;
 use DOMDocument;
 use DOMElement;
+use Zend\Feed\Writer\Extension;
 
 /**
 * @category Zend
diff --git a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php
index 9bbbd59b..814d815e 100644
--- a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php
+++ b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php
@@ -10,9 +10,9 @@
 
 namespace Zend\Feed\Writer\Extension\WellFormedWeb\Renderer;
 
-use Zend\Feed\Writer\Extension;
 use DOMDocument;
 use DOMElement;
+use Zend\Feed\Writer\Extension;
 
 /**
 * @category Zend
diff --git a/src/Writer/Renderer/Entry/AtomDeleted.php b/src/Writer/Renderer/Entry/AtomDeleted.php
index 782cfcc9..1ac0e1fb 100644
--- a/src/Writer/Renderer/Entry/AtomDeleted.php
+++ b/src/Writer/Renderer/Entry/AtomDeleted.php
@@ -13,8 +13,8 @@
 use DateTime;
 use DOMDocument;
 use DOMElement;
-use Zend\Feed\Writer\Renderer;
 use Zend\Feed\Writer;
+use Zend\Feed\Writer\Renderer;
 
 /**
 * @category Zend
diff --git a/src/Writer/Renderer/Feed/Atom.php b/src/Writer/Renderer/Feed/Atom.php
index d1721446..aa687fd6 100644
--- a/src/Writer/Renderer/Feed/Atom.php
+++ b/src/Writer/Renderer/Feed/Atom.php
@@ -10,9 +10,9 @@
 
 namespace Zend\Feed\Writer\Renderer\Feed;
 
-use Zend\Feed\Writer\Renderer;
-use Zend\Feed\Writer;
 use DOMDocument;
+use Zend\Feed\Writer;
+use Zend\Feed\Writer\Renderer;
 
 /**
 * @category Zend
diff --git a/src/Writer/Renderer/Feed/AtomSource.php b/src/Writer/Renderer/Feed/AtomSource.php
index 0f9e0214..f0659403 100644
--- a/src/Writer/Renderer/Feed/AtomSource.php
+++ b/src/Writer/Renderer/Feed/AtomSource.php
@@ -10,10 +10,10 @@
 
 namespace Zend\Feed\Writer\Renderer\Feed;
 
-use Zend\Feed\Writer\Renderer;
-use Zend\Feed\Writer;
-use DOMElement;
 use DOMDocument;
+use DOMElement;
+use Zend\Feed\Writer;
+use Zend\Feed\Writer\Renderer;
 
 /**
 * @category Zend
diff --git a/src/Writer/Writer.php b/src/Writer/Writer.php
index 967c5d03..3d47bd70 100644
--- a/src/Writer/Writer.php
+++ b/src/Writer/Writer.php
@@ -10,10 +10,10 @@
 
 namespace Zend\Feed\Writer;
 
-use Zend\Loader\ShortNameLocator;
+use Zend\Loader\Exception\PluginLoaderException;
 use Zend\Loader\PrefixPathLoader;
 use Zend\Loader\PrefixPathMapper;
-use Zend\Loader\Exception\PluginLoaderException;
+use Zend\Loader\ShortNameLocator;
 
 /**
 * @category Zend

From bab7086a0b007b36767ea4fda5f357772a6da635 Mon Sep 17 00:00:00 2001
From: Maks3w 
Date: Thu, 12 Jul 2012 21:11:36 +0200
Subject: [PATCH 227/238] [PSR-2]
 fixers=braces,elseif,short_tag,php_closing_tag,trailing_spaces,linefeed

Applied php-cs-fixer --fixers=braces,elseif,short_tag,php_closing_tag,trailing_spaces,linefeed
---
 src/PubSubHubbub/Model/Subscription.php       |  20 +--
 .../SubscriptionPersistenceInterface.php      |  16 +--
 src/PubSubHubbub/PubSubHubbub.php             |   2 +-
 src/PubSubHubbub/Subscriber.php               |  30 ++---
 src/PubSubHubbub/Subscriber/Callback.php      |  10 +-
 src/Reader/Collection.php                     |   2 +-
 src/Reader/Collection/Author.php              |   3 +-
 src/Reader/Collection/Category.php            |   3 +-
 src/Reader/Collection/Collection.php          |   2 +-
 src/Reader/Entry/AbstractEntry.php            |   4 +-
 src/Reader/Entry/Atom.php                     |  10 +-
 src/Reader/Entry/EntryInterface.php           |   2 +-
 src/Reader/Entry/Rss.php                      |  10 +-
 src/Reader/Extension/Atom/Entry.php           |  16 +--
 src/Reader/Extension/Atom/Feed.php            |   6 +-
 src/Reader/Extension/DublinCore/Entry.php     |  12 +-
 src/Reader/Extension/DublinCore/Feed.php      |  12 +-
 src/Reader/Extension/Podcast/Feed.php         |   2 +-
 src/Reader/Extension/Syndication/Feed.php     |   6 +-
 src/Reader/Feed/Atom.php                      |   4 +-
 src/Reader/Feed/Atom/Source.php               |  12 +-
 src/Reader/Feed/FeedInterface.php             |   2 +-
 src/Reader/Feed/Rss.php                       |   8 +-
 src/Reader/FeedSet.php                        |   4 +-
 src/Writer/Deleted.php                        |  26 ++--
 .../Exception/InvalidArgumentException.php    |   2 +-
 src/Writer/Extension/AbstractRenderer.php     |  60 ++++-----
 src/Writer/Extension/Atom/Renderer/Feed.php   |  24 ++--
 .../Extension/Content/Renderer/Entry.php      |  12 +-
 .../Extension/DublinCore/Renderer/Entry.php   |  18 +--
 .../Extension/DublinCore/Renderer/Feed.php    |  18 +--
 src/Writer/Extension/ITunes/Entry.php         |  68 +++++-----
 src/Writer/Extension/ITunes/Feed.php          | 100 +++++++--------
 .../Extension/ITunes/Renderer/Entry.php       |  64 +++++-----
 src/Writer/Extension/ITunes/Renderer/Feed.php | 100 +++++++--------
 src/Writer/Extension/Renderer.php             |  18 +--
 src/Writer/Extension/Slash/Renderer/Entry.php |  16 +--
 .../Extension/Threading/Renderer/Entry.php    |  32 ++---
 .../WellFormedWeb/Renderer/Entry.php          |  18 +--
 src/Writer/Feed.php                           |   2 +-
 src/Writer/FeedFactory.php                    |  12 +-
 src/Writer/Renderer/AbstractRenderer.php      |  48 ++++----
 src/Writer/Renderer/Entry/Atom/Deleted.php    |  32 ++---
 src/Writer/Renderer/Entry/AtomDeleted.php     |  28 ++---
 src/Writer/Renderer/Entry/Rss.php             |  84 ++++++-------
 src/Writer/Renderer/Feed/AbstractAtom.php     | 114 ++++++++---------
 src/Writer/Renderer/Feed/Atom.php             |   8 +-
 .../Renderer/Feed/Atom/AbstractAtom.php       | 116 +++++++++---------
 src/Writer/Renderer/Feed/Atom/Source.php      |  16 +--
 src/Writer/Renderer/Feed/AtomSource.php       |  14 +--
 src/Writer/Renderer/Feed/Rss.php              | 100 +++++++--------
 src/Writer/Renderer/RendererInterface.php     |  24 ++--
 src/Writer/Writer.php                         |   6 +-
 test/PubSubHubbub/Model/SubscriptionTest.php  |   6 +-
 test/PubSubHubbub/PublisherTest.php           |   3 +-
 test/PubSubHubbub/SubscriberHttpTest.php      |   7 +-
 test/PubSubHubbub/SubscriberTest.php          |   9 +-
 test/Reader/Entry/AtomStandaloneEntryTest.php |  16 +--
 test/Reader/Entry/AtomTest.php                |  32 ++---
 test/Reader/Entry/CommonTest.php              |  10 +-
 test/Reader/Entry/RssTest.php                 |  77 ++++++------
 test/Reader/Feed/AtomSourceTest.php           |  12 +-
 test/Reader/Feed/AtomTest.php                 |  26 ++--
 test/Reader/Feed/CommonTest.php               |   4 +-
 test/Reader/Feed/RssTest.php                  |  73 +++++------
 .../_files/Atom/category/plain/atom03.xml     |   2 +-
 test/Reader/ReaderTest.php                    |   8 +-
 test/Writer/DeletedTest.php                   |  12 +-
 test/Writer/Extension/ITunes/EntryTest.php    |  44 +++----
 test/Writer/Extension/ITunes/FeedTest.php     |  64 +++++-----
 70 files changed, 894 insertions(+), 889 deletions(-)

diff --git a/src/PubSubHubbub/Model/Subscription.php b/src/PubSubHubbub/Model/Subscription.php
index c4682770..07fb7947 100644
--- a/src/PubSubHubbub/Model/Subscription.php
+++ b/src/PubSubHubbub/Model/Subscription.php
@@ -23,11 +23,11 @@ class Subscription extends AbstractModel implements SubscriptionPersistenceInter
 {
     /**
      * Common DateTime object to assist with unit testing
-     * 
+     *
      * @var DateTime
      */
     protected $now;
-    
+
     /**
      * Save subscription to RDMBS
      *
@@ -46,7 +46,7 @@ public function setSubscription(array $data)
         if ($result && (0 < count($result))) {
             $data['created_time'] = $result->current()->created_time;
             $now = $this->getNow();
-            if (array_key_exists('lease_seconds', $data) 
+            if (array_key_exists('lease_seconds', $data)
                 && $data['lease_seconds']
             ) {
                 $data['expiration_time'] = $now->add(new DateInterval('PT' . $data['lease_seconds'] . 'S'))
@@ -62,11 +62,11 @@ public function setSubscription(array $data)
         $this->_db->insert($data);
         return true;
     }
-    
+
     /**
      * Get subscription by ID/key
-     * 
-     * @param  string $key 
+     *
+     * @param  string $key
      * @return array
      * @throws PubSubHubbub\Exception\InvalidArgumentException
      */
@@ -85,8 +85,8 @@ public function getSubscription($key)
 
     /**
      * Determine if a subscription matching the key exists
-     * 
-     * @param  string $key 
+     *
+     * @param  string $key
      * @return bool
      * @throws PubSubHubbub\Exception\InvalidArgumentException
      */
@@ -123,7 +123,7 @@ public function deleteSubscription($key)
 
     /**
      * Get a new DateTime or the one injected for testing
-     * 
+     *
      * @return DateTime
      */
     public function getNow()
@@ -136,7 +136,7 @@ public function getNow()
 
     /**
      * Set a DateTime instance for assisting with unit testing
-     * 
+     *
      * @param DateTime $now
      * @return Subscription
      */
diff --git a/src/PubSubHubbub/Model/SubscriptionPersistenceInterface.php b/src/PubSubHubbub/Model/SubscriptionPersistenceInterface.php
index 9c4d29fb..7b0e58e5 100644
--- a/src/PubSubHubbub/Model/SubscriptionPersistenceInterface.php
+++ b/src/PubSubHubbub/Model/SubscriptionPersistenceInterface.php
@@ -17,7 +17,7 @@
  */
 interface SubscriptionPersistenceInterface
 {
-    
+
     /**
      * Save subscription to RDMBS
      *
@@ -25,23 +25,23 @@ interface SubscriptionPersistenceInterface
      * @return bool
      */
     public function setSubscription(array $data);
-    
+
     /**
      * Get subscription by ID/key
-     * 
-     * @param  string $key 
+     *
+     * @param  string $key
      * @return array
      */
     public function getSubscription($key);
 
     /**
      * Determine if a subscription matching the key exists
-     * 
-     * @param  string $key 
+     *
+     * @param  string $key
      * @return bool
      */
     public function hasSubscription($key);
-    
+
     /**
      * Delete a subscription
      *
@@ -49,5 +49,5 @@ public function hasSubscription($key);
      * @return bool
      */
     public function deleteSubscription($key);
-    
+
 }
diff --git a/src/PubSubHubbub/PubSubHubbub.php b/src/PubSubHubbub/PubSubHubbub.php
index d9b1c25f..114f563b 100644
--- a/src/PubSubHubbub/PubSubHubbub.php
+++ b/src/PubSubHubbub/PubSubHubbub.php
@@ -24,7 +24,7 @@ class PubSubHubbub
      */
     const VERIFICATION_MODE_SYNC  = 'sync';
     const VERIFICATION_MODE_ASYNC = 'async';
-    
+
     /**
      * Subscription States
      */
diff --git a/src/PubSubHubbub/Subscriber.php b/src/PubSubHubbub/Subscriber.php
index 088076aa..b7d1126b 100644
--- a/src/PubSubHubbub/Subscriber.php
+++ b/src/PubSubHubbub/Subscriber.php
@@ -108,7 +108,7 @@ class Subscriber
      * @var array
      */
     protected $_authentications = array();
-    
+
     /**
      * Tells the Subscriber to append any subscription identifier to the path
      * of the base Callback URL. E.g. an identifier "subkey1" would be added
@@ -381,12 +381,12 @@ public function getHubUrls()
         $this->_hubUrls = array_unique($this->_hubUrls);
         return $this->_hubUrls;
     }
-    
+
     /**
      * Add authentication credentials for a given URL
-     * 
-     * @param  string $url 
-     * @param  array $authentication 
+     *
+     * @param  string $url
+     * @param  array $authentication
      * @return Subscriber
      * @throws Exception\InvalidArgumentException
      */
@@ -400,11 +400,11 @@ public function addAuthentication($url, array $authentication)
         $this->_authentications[$url] = $authentication;
         return $this;
     }
-    
+
     /**
      * Add authentication credentials for hub URLs
-     * 
-     * @param  array $authentications 
+     *
+     * @param  array $authentications
      * @return Subscriber
      */
     public function addAuthentications(array $authentications)
@@ -414,21 +414,21 @@ public function addAuthentications(array $authentications)
         }
         return $this;
     }
-    
+
     /**
      * Get all hub URL authentication credentials
-     * 
+     *
      * @return array
      */
     public function getAuthentications()
     {
         return $this->_authentications;
     }
-    
+
     /**
      * Set flag indicating whether or not to use a path parameter
-     * 
-     * @param  bool $bool 
+     *
+     * @param  bool $bool
      * @return Subscriber
      */
     public function usePathParameter($bool = true)
@@ -524,7 +524,7 @@ public function setStorage(Model\SubscriptionPersistenceInterface $storage)
     }
 
     /**
-     * Gets an instance of Zend\Feed\Pubsubhubbub\Storage\StoragePersistence used 
+     * Gets an instance of Zend\Feed\Pubsubhubbub\Storage\StoragePersistence used
      * to background save any verification tokens associated with a subscription
      * or other.
      *
@@ -727,7 +727,7 @@ protected function _getRequestParameters($hubUrl, $mode)
         foreach ($optParams as $name => $value) {
             $params[$name] = $value;
         }
-        
+
         // store subscription to storage
         $now = new DateTime();
         $expires = null;
diff --git a/src/PubSubHubbub/Subscriber/Callback.php b/src/PubSubHubbub/Subscriber/Callback.php
index 9ce688c0..d552455a 100644
--- a/src/PubSubHubbub/Subscriber/Callback.php
+++ b/src/PubSubHubbub/Subscriber/Callback.php
@@ -25,7 +25,7 @@ class Callback extends PubSubHubbub\AbstractCallback
      * @var string
      */
     protected $_feedUpdate = null;
-    
+
     /**
      * Holds a manually set subscription key (i.e. identifies a unique
      * subscription) which is typical when it is not passed in the query string
@@ -35,14 +35,14 @@ class Callback extends PubSubHubbub\AbstractCallback
      * @var string
      */
     protected $_subscriptionKey = null;
-    
+
     /**
      * After verification, this is set to the verified subscription's data.
      *
      * @var array
      */
     protected $_currentSubscriptionData = null;
-    
+
     /**
      * Set a subscription key to use for the current callback request manually.
      * Required if usePathParameter is enabled for the Subscriber.
@@ -129,9 +129,9 @@ public function isValidHubVerification(array $httpGetData)
             return false;
         }
         $required = array(
-            'hub_mode', 
+            'hub_mode',
             'hub_topic',
-            'hub_challenge', 
+            'hub_challenge',
             'hub_verify_token',
         );
         foreach ($required as $key) {
diff --git a/src/Reader/Collection.php b/src/Reader/Collection.php
index 2033ece7..2dada9a0 100644
--- a/src/Reader/Collection.php
+++ b/src/Reader/Collection.php
@@ -17,6 +17,6 @@
 class Collection extends \ArrayObject
 {
 
-    
+
 
 }
diff --git a/src/Reader/Collection/Author.php b/src/Reader/Collection/Author.php
index 17d3a61b..133b9871 100644
--- a/src/Reader/Collection/Author.php
+++ b/src/Reader/Collection/Author.php
@@ -23,7 +23,8 @@ class Author extends AbstractCollection
      *
      * @return array
      */
-    public function getValues() {
+    public function getValues()
+    {
         $authors = array();
         foreach ($this->getIterator() as $element) {
             $authors[] = $element['name'];
diff --git a/src/Reader/Collection/Category.php b/src/Reader/Collection/Category.php
index 377da0bc..92efad94 100644
--- a/src/Reader/Collection/Category.php
+++ b/src/Reader/Collection/Category.php
@@ -25,7 +25,8 @@ class Category extends AbstractCollection
      *
      * @return array
      */
-    public function getValues() {
+    public function getValues()
+    {
         $categories = array();
         foreach ($this->getIterator() as $element) {
             if (isset($element['label']) && !empty($element['label'])) {
diff --git a/src/Reader/Collection/Collection.php b/src/Reader/Collection/Collection.php
index 8fe3ad0f..6fee75f8 100644
--- a/src/Reader/Collection/Collection.php
+++ b/src/Reader/Collection/Collection.php
@@ -17,6 +17,6 @@
 class Collection extends \ArrayObject
 {
 
-    
+
 
 }
diff --git a/src/Reader/Entry/AbstractEntry.php b/src/Reader/Entry/AbstractEntry.php
index 9371f061..7448c226 100644
--- a/src/Reader/Entry/AbstractEntry.php
+++ b/src/Reader/Entry/AbstractEntry.php
@@ -79,10 +79,10 @@ public function __construct(DOMElement $entry, $entryKey, $type = null)
         $this->_domDocument = $entry->ownerDocument;
         if ($type !== null) {
             $this->_data['type'] = $type;
-        } else if ($this->_domDocument !== null) {
+        } elseif ($this->_domDocument !== null) {
             $this->_data['type'] = Reader\Reader::detectType($this->_domDocument);
         } else {
-            $this->_data['type'] = Reader\Reader::TYPE_ANY;		
+            $this->_data['type'] = Reader\Reader::TYPE_ANY;
         }
         $this->_loadExtensions();
     }
diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php
index 417204d6..7e499181 100644
--- a/src/Reader/Entry/Atom.php
+++ b/src/Reader/Entry/Atom.php
@@ -47,7 +47,7 @@ public function __construct(DOMElement $entry, $entryKey, $type = null)
 
         $threadClass = Reader\Reader::getPluginLoader()->getClassName('Thread\\Entry');
         $this->_extensions['Thread\\Entry'] = new $threadClass($entry, $entryKey, $type);
-        
+
         $threadClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\\Entry');
         $this->_extensions['DublinCore\\Entry'] = new $threadClass($entry, $entryKey, $type);
     }
@@ -317,7 +317,7 @@ public function getCommentFeedLink()
 
         return $this->_data['commentfeedlink'];
     }
-    
+
     /**
      * Get category data as a Reader\Reader_Collection_Category object
      *
@@ -330,7 +330,7 @@ public function getCategories()
         }
 
         $categoryCollection = $this->getExtension('Atom')->getCategories();
-        
+
         if (count($categoryCollection) == 0) {
             $categoryCollection = $this->getExtension('DublinCore')->getCategories();
         }
@@ -339,7 +339,7 @@ public function getCategories()
 
         return $this->_data['categories'];
     }
-    
+
     /**
      * Get source feed metadata from the entry
      *
@@ -355,7 +355,7 @@ public function getSource()
 
         $this->_data['source'] = $source;
 
-        return $this->_data['source']; 
+        return $this->_data['source'];
     }
 
     /**
diff --git a/src/Reader/Entry/EntryInterface.php b/src/Reader/Entry/EntryInterface.php
index 41a43fc1..4d0fc31d 100644
--- a/src/Reader/Entry/EntryInterface.php
+++ b/src/Reader/Entry/EntryInterface.php
@@ -124,7 +124,7 @@ public function getCommentLink();
      * @return string
      */
     public function getCommentFeedLink();
-    
+
     /**
      * Get all categories
      *
diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php
index 9c7132ae..3adc8955 100644
--- a/src/Reader/Entry/Rss.php
+++ b/src/Reader/Entry/Rss.php
@@ -99,7 +99,7 @@ public function getAuthors()
         if (array_key_exists('authors', $this->_data)) {
             return $this->_data['authors'];
         }
-        
+
         $authors = array();
         $authors_dc = $this->getExtension('DublinCore')->getAuthors();
         if (!empty($authors_dc)) {
@@ -109,7 +109,7 @@ public function getAuthors()
                 );
             }
         }
-        
+
         if ($this->getType() !== Reader\Reader::TYPE_RSS_10
         && $this->getType() !== Reader\Reader::TYPE_RSS_090) {
             $list = $this->_xpath->query($this->_xpathQueryRss . '//author');
@@ -129,7 +129,7 @@ public function getAuthors()
                         $data['name'] = $matches[1];
                     }
                     $authors[] = $data;
-                } 
+                }
             }
         }
 
@@ -410,7 +410,7 @@ public function getLinks()
 
         return $this->_data['links'];
     }
-    
+
     /**
      * Get all categories
      *
@@ -441,7 +441,7 @@ public function getCategories()
         } else {
             $categoryCollection = $this->getExtension('DublinCore')->getCategories();
         }
-        
+
         if (count($categoryCollection) == 0) {
             $categoryCollection = $this->getExtension('Atom')->getCategories();
         }
diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php
index cbedbc76..d0be4b1f 100644
--- a/src/Reader/Extension/Atom/Entry.php
+++ b/src/Reader/Extension/Atom/Entry.php
@@ -94,9 +94,9 @@ public function getContent()
         if (array_key_exists('content', $this->_data)) {
             return $this->_data['content'];
         }
-        
+
         $content = null;
-        
+
         $el = $this->getXpath()->query($this->getXpathPrefix() . '/atom:content');
         if($el->length > 0) {
             $el = $el->item(0);
@@ -476,7 +476,7 @@ public function getCommentFeedLink($type = 'atom')
 
         return $this->_data['commentfeedlink'];
     }
-    
+
     /**
      * Get all categories
      *
@@ -517,7 +517,7 @@ public function getCategories()
 
         return $this->_data['categories'];
     }
-    
+
     /**
      * Get source feed metadata from the entry
      *
@@ -528,7 +528,7 @@ public function getSource()
         if (array_key_exists('source', $this->_data)) {
             return $this->_data['source'];
         }
-        
+
         $source = null;
         // TODO: Investigate why _getAtomType() fails here. Is it even needed?
         if ($this->getType() == Reader\Reader::TYPE_ATOM_10) {
@@ -538,9 +538,9 @@ public function getSource()
                 $source = new Reader\Feed\Atom\Source($element, $this->getXpathPrefix());
             }
         }
-        
+
         $this->_data['source'] = $source;
-        return $this->_data['source']; 
+        return $this->_data['source'];
     }
 
     /**
@@ -576,7 +576,7 @@ protected function _getAuthor(DOMElement $element)
         $emailNode = $element->getElementsByTagName('email');
         $nameNode  = $element->getElementsByTagName('name');
         $uriNode   = $element->getElementsByTagName('uri');
-        
+
         if ($emailNode->length && strlen($emailNode->item(0)->nodeValue) > 0) {
             $author['email'] = $emailNode->item(0)->nodeValue;
         }
diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php
index 36aaa6a7..0f82880f 100644
--- a/src/Reader/Extension/Atom/Feed.php
+++ b/src/Reader/Extension/Atom/Feed.php
@@ -369,7 +369,7 @@ public function getHubs()
             return $this->_data['hubs'];
         }
         $hubs = array();
-        
+
         $list = $this->_xpath->query($this->getXpathPrefix()
             . '//atom:link[@rel="hub"]/@href');
 
@@ -407,7 +407,7 @@ public function getTitle()
 
         return $this->_data['title'];
     }
-    
+
     /**
      * Get all categories
      *
@@ -462,7 +462,7 @@ protected function _getAuthor(DOMElement $element)
         $emailNode = $element->getElementsByTagName('email');
         $nameNode  = $element->getElementsByTagName('name');
         $uriNode   = $element->getElementsByTagName('uri');
-        
+
         if ($emailNode->length && strlen($emailNode->item(0)->nodeValue) > 0) {
             $author['email'] = $emailNode->item(0)->nodeValue;
         }
diff --git a/src/Reader/Extension/DublinCore/Entry.php b/src/Reader/Extension/DublinCore/Entry.php
index 0cddec33..9e9248c2 100644
--- a/src/Reader/Extension/DublinCore/Entry.php
+++ b/src/Reader/Extension/DublinCore/Entry.php
@@ -81,7 +81,7 @@ public function getAuthors()
 
         return $this->_data['authors'];
     }
-    
+
     /**
      * Get categories (subjects under DC)
      *
@@ -92,13 +92,13 @@ public function getCategories()
         if (array_key_exists('categories', $this->_data)) {
             return $this->_data['categories'];
         }
-        
+
         $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc11:subject');
 
         if (!$list->length) {
             $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc10:subject');
         }
-        
+
         if ($list->length) {
             $categoryCollection = new Collection\Category;
             foreach ($list as $category) {
@@ -111,11 +111,11 @@ public function getCategories()
         } else {
             $categoryCollection = new Collection\Category;
         }
-        
+
         $this->_data['categories'] = $categoryCollection;
-        return $this->_data['categories'];  
+        return $this->_data['categories'];
     }
-    
+
 
     /**
      * Get the entry content
diff --git a/src/Reader/Extension/DublinCore/Feed.php b/src/Reader/Extension/DublinCore/Feed.php
index fb58ecf4..ec2133ab 100644
--- a/src/Reader/Extension/DublinCore/Feed.php
+++ b/src/Reader/Extension/DublinCore/Feed.php
@@ -62,7 +62,7 @@ public function getAuthors()
                 $list = $this->_xpath->query('//dc10:publisher');
             }
         }
-        
+
         if ($list->length) {
             foreach ($list as $author) {
                 $authors[] = array(
@@ -238,7 +238,7 @@ public function getDate()
 
         return $this->_data['date'];
     }
-    
+
     /**
      * Get categories (subjects under DC)
      *
@@ -249,13 +249,13 @@ public function getCategories()
         if (array_key_exists('categories', $this->_data)) {
             return $this->_data['categories'];
         }
-        
+
         $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc11:subject');
 
         if (!$list->length) {
             $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc10:subject');
         }
-        
+
         if ($list->length) {
             $categoryCollection = new Collection\Category;
             foreach ($list as $category) {
@@ -268,9 +268,9 @@ public function getCategories()
         } else {
             $categoryCollection = new Collection\Category;
         }
-        
+
         $this->_data['categories'] = $categoryCollection;
-        return $this->_data['categories'];  
+        return $this->_data['categories'];
     }
 
     /**
diff --git a/src/Reader/Extension/Podcast/Feed.php b/src/Reader/Extension/Podcast/Feed.php
index a79207b5..8dda6750 100644
--- a/src/Reader/Extension/Podcast/Feed.php
+++ b/src/Reader/Extension/Podcast/Feed.php
@@ -212,7 +212,7 @@ public function getOwner()
 
         if (!empty($email)) {
             $owner = $email . (empty($name) ? '' : ' (' . $name . ')');
-        } else if (!empty($name)) {
+        } elseif (!empty($name)) {
             $owner = $name;
         }
 
diff --git a/src/Reader/Extension/Syndication/Feed.php b/src/Reader/Extension/Syndication/Feed.php
index b3f2e649..2e88d0ab 100644
--- a/src/Reader/Extension/Syndication/Feed.php
+++ b/src/Reader/Extension/Syndication/Feed.php
@@ -36,8 +36,7 @@ public function getUpdatePeriod()
             return 'daily'; //Default specified by spec
         }
 
-        switch ($period)
-        {
+        switch ($period) {
             case 'hourly':
             case 'daily':
             case 'weekly':
@@ -84,8 +83,7 @@ public function getUpdateFrequencyAsTicks()
         $period = $this->getUpdatePeriod();
         $ticks = 1;
 
-        switch ($period)
-        {
+        switch ($period) {
             //intentional fall through
             case 'yearly':
                 $ticks *= 52; //TODO: fix generalisation, how?
diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php
index 0b864b22..8490c1d6 100644
--- a/src/Reader/Feed/Atom.php
+++ b/src/Reader/Feed/Atom.php
@@ -344,7 +344,7 @@ public function getHubs()
 
         return $this->_data['hubs'];
     }
-    
+
     /**
      * Get all categories
      *
@@ -357,7 +357,7 @@ public function getCategories()
         }
 
         $categoryCollection = $this->getExtension('Atom')->getCategories();
-        
+
         if (count($categoryCollection) == 0) {
             $categoryCollection = $this->getExtension('DublinCore')->getCategories();
         }
diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php
index a221f4a4..7aa3f528 100644
--- a/src/Reader/Feed/Atom/Source.php
+++ b/src/Reader/Feed/Atom/Source.php
@@ -38,7 +38,7 @@ public function __construct(DOMElement $source, $xpathPrefix, $type = Reader\Rea
         $this->_data['type'] = $type;
         $this->_registerNamespaces();
         $this->_loadExtensions();
-        
+
         $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\\Feed');
         $this->_extensions['Atom\\Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath);
         $atomClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\\Feed');
@@ -47,12 +47,12 @@ public function __construct(DOMElement $source, $xpathPrefix, $type = Reader\Rea
             $extension->setXpathPrefix(rtrim($xpathPrefix, '/') . '/atom:source');
         }
     }
-    
+
     /**
      * Since this is not an Entry carrier but a vehicle for Feed metadata, any
      * applicable Entry methods are stubbed out and do nothing.
      */
-     
+
     /**
      * @return void
      */
@@ -62,7 +62,7 @@ public function count() {}
      * @return void
      */
     public function current() {}
-    
+
     /**
      * @return void
      */
@@ -77,12 +77,12 @@ public function next() {}
      * @return void
      */
     public function rewind() {}
-    
+
     /**
      * @return void
      */
     public function valid() {}
-    
+
     /**
      * @return void
      */
diff --git a/src/Reader/Feed/FeedInterface.php b/src/Reader/Feed/FeedInterface.php
index 7da249ce..a1331a1f 100644
--- a/src/Reader/Feed/FeedInterface.php
+++ b/src/Reader/Feed/FeedInterface.php
@@ -103,7 +103,7 @@ public function getFeedLink();
      * @return string|null
      */
     public function getTitle();
-    
+
     /**
      * Get all categories
      *
diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php
index db6f5a5f..96b16462 100644
--- a/src/Reader/Feed/Rss.php
+++ b/src/Reader/Feed/Rss.php
@@ -75,7 +75,7 @@ public function getAuthors()
         if (array_key_exists('authors', $this->_data)) {
             return $this->_data['authors'];
         }
-        
+
         $authors = array();
         $authors_dc = $this->getExtension('DublinCore')->getAuthors();
         if (!empty($authors_dc)) {
@@ -109,7 +109,7 @@ public function getAuthors()
                         $data['name'] = $matches[1];
                     }
                     $authors[] = $data;
-                } 
+                }
             }
         }
 
@@ -619,7 +619,7 @@ public function getHubs()
 
         return $this->_data['hubs'];
     }
-    
+
     /**
      * Get all categories
      *
@@ -650,7 +650,7 @@ public function getCategories()
         } else {
             $categoryCollection = $this->getExtension('DublinCore')->getCategories();
         }
-        
+
         if (count($categoryCollection) == 0) {
             $categoryCollection = $this->getExtension('Atom')->getCategories();
         }
diff --git a/src/Reader/FeedSet.php b/src/Reader/FeedSet.php
index 7e9badb7..a73f5235 100644
--- a/src/Reader/FeedSet.php
+++ b/src/Reader/FeedSet.php
@@ -64,7 +64,7 @@ public function addLinks(DOMNodeList $links, $uri)
             ));
         }
     }
-    
+
     /**
      *  Attempt to turn a relative URI into an absolute URI
      */
@@ -87,7 +87,7 @@ protected function absolutiseUri($link, $uri = null)
         }
         return $link;
     }
-    
+
     /**
      *  Canonicalize relative path
      */
diff --git a/src/Writer/Deleted.php b/src/Writer/Deleted.php
index 86cadfeb..29606a94 100644
--- a/src/Writer/Deleted.php
+++ b/src/Writer/Deleted.php
@@ -26,7 +26,7 @@ class Deleted
      * @var array
      */
     protected $_data = array();
-    
+
     /**
      * Holds the value "atom" or "rss" depending on the feed type set when
      * when last exported.
@@ -34,7 +34,7 @@ class Deleted
      * @var string
      */
     protected $_type = null;
-    
+
     /**
      * Set the feed character encoding
      *
@@ -61,7 +61,7 @@ public function getEncoding()
         }
         return $this->_data['encoding'];
     }
-    
+
     /**
      * Unset a specific data point
      *
@@ -73,7 +73,7 @@ public function remove($name)
             unset($this->_data[$name]);
         }
     }
-    
+
     /**
      * Set the current feed type being exported to "rss" or "atom". This allows
      * other objects to gracefully choose whether to execute or not, depending
@@ -85,7 +85,7 @@ public function setType($type)
     {
         $this->_type = $type;
     }
-    
+
     /**
      * Retrieve the current or last feed type exported.
      *
@@ -109,7 +109,7 @@ public function setReference($reference)
         }
         $this->_data['reference'] = $reference;
     }
-    
+
     public function getReference()
     {
         if (!array_key_exists('reference', $this->_data)) {
@@ -157,8 +157,8 @@ public function getWhen()
     public function setBy(array $by)
     {
         $author = array();
-        if (!array_key_exists('name', $by) 
-            || empty($by['name']) 
+        if (!array_key_exists('name', $by)
+            || empty($by['name'])
             || !is_string($by['name'])
         ) {
             throw new Exception\InvalidArgumentException('Invalid parameter: author array must include a'
@@ -173,8 +173,8 @@ public function setBy(array $by)
             $author['email'] = $by['email'];
         }
         if (isset($by['uri'])) {
-            if (empty($by['uri']) 
-                || !is_string($by['uri']) 
+            if (empty($by['uri'])
+                || !is_string($by['uri'])
                 || !Uri\UriFactory::factory($by['uri'])->isValid()
             ) {
                 throw new Exception\InvalidArgumentException('Invalid parameter: "uri" array value must'
@@ -184,7 +184,7 @@ public function setBy(array $by)
         }
         $this->_data['by'] = $author;
     }
-    
+
     public function getBy()
     {
         if (!array_key_exists('by', $this->_data)) {
@@ -192,12 +192,12 @@ public function getBy()
         }
         return $this->_data['by'];
     }
-    
+
     public function setComment($comment)
     {
         $this->_data['comment'] = $comment;
     }
-    
+
     public function getComment()
     {
         if (!array_key_exists('comment', $this->_data)) {
diff --git a/src/Writer/Exception/InvalidArgumentException.php b/src/Writer/Exception/InvalidArgumentException.php
index 787b309f..8df048f2 100644
--- a/src/Writer/Exception/InvalidArgumentException.php
+++ b/src/Writer/Exception/InvalidArgumentException.php
@@ -21,7 +21,7 @@
  * @package    Zend_Feed
  * @subpackage Writer
  */
-class InvalidArgumentException 
+class InvalidArgumentException
     extends Exception\InvalidArgumentException
     implements ExceptionInterface
 {}
diff --git a/src/Writer/Extension/AbstractRenderer.php b/src/Writer/Extension/AbstractRenderer.php
index 6ed9938b..e7811149 100644
--- a/src/Writer/Extension/AbstractRenderer.php
+++ b/src/Writer/Extension/AbstractRenderer.php
@@ -23,32 +23,32 @@ abstract class AbstractRenderer implements Renderer
      * @var DOMDocument
      */
     protected $_dom = null;
-    
+
     /**
      * @var mixed
      */
     protected $_entry = null;
-    
+
     /**
      * @var DOMElement
      */
     protected $_base = null;
-    
+
     /**
      * @var mixed
      */
     protected $_container = null;
-    
+
     /**
      * @var string
      */
     protected $_type = null;
-    
+
     /**
      * @var DOMElement
      */
     protected $_rootElement = null;
-    
+
     /**
      * Encoding of all text values
      *
@@ -58,19 +58,19 @@ abstract class AbstractRenderer implements Renderer
 
     /**
      * Constructor
-     * 
-     * @param  mixed $container 
+     *
+     * @param  mixed $container
      * @return void
      */
     public function __construct($container)
     {
         $this->_container = $container;
     }
-    
+
     /**
      * Set feed encoding
-     * 
-     * @param  string $enc 
+     *
+     * @param  string $enc
      * @return AbstractRenderer
      */
     public function setEncoding($enc)
@@ -78,20 +78,20 @@ public function setEncoding($enc)
         $this->_encoding = $enc;
         return $this;
     }
-    
+
     /**
      * Get feed encoding
-     * 
+     *
      * @return string
      */
     public function getEncoding()
     {
         return $this->_encoding;
     }
-    
+
     /**
      * Set DOMDocument and DOMElement on which to operate
-     * 
+     *
      * @param  DOMDocument $dom
      * @param  DOMElement $base
      * @return AbstractRenderer
@@ -102,21 +102,21 @@ public function setDomDocument(DOMDocument $dom, DOMElement $base)
         $this->_base = $base;
         return $this;
     }
-    
+
     /**
      * Get data container being rendered
-     * 
+     *
      * @return mixed
      */
     public function getDataContainer()
     {
         return $this->_container;
     }
-    
+
     /**
      * Set feed type
-     * 
-     * @param  string $type 
+     *
+     * @param  string $type
      * @return AbstractRenderer
      */
     public function setType($type)
@@ -124,21 +124,21 @@ public function setType($type)
         $this->_type = $type;
         return $this;
     }
-    
+
     /**
      * Get feedtype
-     * 
+     *
      * @return string
      */
     public function getType()
     {
         return $this->_type;
     }
-    
+
     /**
-     * Set root element of document 
-     * 
-     * @param  DOMElement $root 
+     * Set root element of document
+     *
+     * @param  DOMElement $root
      * @return AbstractRenderer
      */
     public function setRootElement(DOMElement $root)
@@ -146,20 +146,20 @@ public function setRootElement(DOMElement $root)
         $this->_rootElement = $root;
         return $this;
     }
-    
+
     /**
      * Get root element
-     * 
+     *
      * @return DOMElement
      */
     public function getRootElement()
     {
         return $this->_rootElement;
     }
-    
+
     /**
      * Append namespaces to feed
-     * 
+     *
      * @return void
      */
     abstract protected function _appendNamespaces();
diff --git a/src/Writer/Extension/Atom/Renderer/Feed.php b/src/Writer/Extension/Atom/Renderer/Feed.php
index 91a08b4f..a5b58ae0 100644
--- a/src/Writer/Extension/Atom/Renderer/Feed.php
+++ b/src/Writer/Extension/Atom/Renderer/Feed.php
@@ -29,10 +29,10 @@ class Feed extends Extension\AbstractRenderer
      * @var bool
      */
     protected $_called = false;
-    
+
     /**
      * Render feed
-     * 
+     *
      * @return void
      */
     public function render()
@@ -50,23 +50,23 @@ public function render()
             $this->_appendNamespaces();
         }
     }
-    
+
     /**
      * Append namespaces to root element of feed
-     * 
+     *
      * @return void
      */
     protected function _appendNamespaces()
     {
         $this->getRootElement()->setAttribute('xmlns:atom',
-            'http://www.w3.org/2005/Atom');  
+            'http://www.w3.org/2005/Atom');
     }
 
     /**
      * Set feed link elements
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setFeedLinks(DOMDocument $dom, DOMElement $root)
@@ -85,12 +85,12 @@ protected function _setFeedLinks(DOMDocument $dom, DOMElement $root)
         }
         $this->_called = true;
     }
-    
+
     /**
      * Set PuSH hubs
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setHubs(DOMDocument $dom, DOMElement $root)
diff --git a/src/Writer/Extension/Content/Renderer/Entry.php b/src/Writer/Extension/Content/Renderer/Entry.php
index 424112de..6eb611bb 100644
--- a/src/Writer/Extension/Content/Renderer/Entry.php
+++ b/src/Writer/Extension/Content/Renderer/Entry.php
@@ -29,10 +29,10 @@ class Entry extends Extension\AbstractRenderer
      * @var bool
      */
     protected $_called = false;
-    
+
     /**
      * Render entry
-     * 
+     *
      * @return void
      */
     public function render()
@@ -45,21 +45,21 @@ public function render()
             $this->_appendNamespaces();
         }
     }
-    
+
     /**
      * Append namespaces to root element
-     * 
+     *
      * @return void
      */
     protected function _appendNamespaces()
     {
         $this->getRootElement()->setAttribute('xmlns:content',
-            'http://purl.org/rss/1.0/modules/content/');  
+            'http://purl.org/rss/1.0/modules/content/');
     }
 
     /**
      * Set entry content
-     * 
+     *
      * @param  DOMDocument $dom
      * @param  DOMElement $root
      * @return void
diff --git a/src/Writer/Extension/DublinCore/Renderer/Entry.php b/src/Writer/Extension/DublinCore/Renderer/Entry.php
index 6f756c60..44dbb97e 100644
--- a/src/Writer/Extension/DublinCore/Renderer/Entry.php
+++ b/src/Writer/Extension/DublinCore/Renderer/Entry.php
@@ -29,10 +29,10 @@ class Entry extends Extension\AbstractRenderer
      * @var bool
      */
     protected $_called = false;
-    
+
     /**
      * Render entry
-     * 
+     *
      * @return void
      */
     public function render()
@@ -45,23 +45,23 @@ public function render()
             $this->_appendNamespaces();
         }
     }
-    
+
     /**
      * Append namespaces to entry
-     * 
+     *
      * @return void
      */
     protected function _appendNamespaces()
     {
         $this->getRootElement()->setAttribute('xmlns:dc',
-            'http://purl.org/dc/elements/1.1/');  
+            'http://purl.org/dc/elements/1.1/');
     }
 
     /**
      * Set entry author elements
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setAuthors(DOMDocument $dom, DOMElement $root)
@@ -75,7 +75,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root)
             if (array_key_exists('name', $data)) {
                 $text = $dom->createTextNode($data['name']);
                 $author->appendChild($text);
-                $root->appendChild($author);   
+                $root->appendChild($author);
             }
         }
         $this->_called = true;
diff --git a/src/Writer/Extension/DublinCore/Renderer/Feed.php b/src/Writer/Extension/DublinCore/Renderer/Feed.php
index 81c9f056..5a2714fb 100644
--- a/src/Writer/Extension/DublinCore/Renderer/Feed.php
+++ b/src/Writer/Extension/DublinCore/Renderer/Feed.php
@@ -29,10 +29,10 @@ class Feed extends Extension\AbstractRenderer
      * @var bool
      */
     protected $_called = false;
-    
+
     /**
      * Render feed
-     * 
+     *
      * @return void
      */
     public function render()
@@ -45,23 +45,23 @@ public function render()
             $this->_appendNamespaces();
         }
     }
-    
+
     /**
      * Append namespaces to feed element
-     * 
+     *
      * @return void
      */
     protected function _appendNamespaces()
     {
         $this->getRootElement()->setAttribute('xmlns:dc',
-            'http://purl.org/dc/elements/1.1/');  
+            'http://purl.org/dc/elements/1.1/');
     }
 
     /**
      * Set feed authors
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setAuthors(DOMDocument $dom, DOMElement $root)
@@ -75,7 +75,7 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root)
             if (array_key_exists('name', $data)) {
                 $text = $dom->createTextNode($data['name']);
                 $author->appendChild($text);
-                $root->appendChild($author);  
+                $root->appendChild($author);
             }
         }
         $this->_called = true;
diff --git a/src/Writer/Extension/ITunes/Entry.php b/src/Writer/Extension/ITunes/Entry.php
index d580f2af..84de093f 100644
--- a/src/Writer/Extension/ITunes/Entry.php
+++ b/src/Writer/Extension/ITunes/Entry.php
@@ -25,18 +25,18 @@ class Entry
      * @var array
      */
     protected $_data = array();
-    
+
     /**
      * Encoding of all text values
      *
      * @var string
      */
     protected $_encoding = 'UTF-8';
-    
+
     /**
      * Set feed encoding
-     * 
-     * @param  string $enc 
+     *
+     * @param  string $enc
      * @return Zend_Feed_Writer_Extension_ITunes_Entry
      */
     public function setEncoding($enc)
@@ -44,17 +44,17 @@ public function setEncoding($enc)
         $this->_encoding = $enc;
         return $this;
     }
-    
+
     /**
      * Get feed encoding
-     * 
+     *
      * @return string
      */
     public function getEncoding()
     {
         return $this->_encoding;
     }
-    
+
     /**
      * Set a block value of "yes" or "no". You may also set an empty string.
      *
@@ -74,11 +74,11 @@ public function setItunesBlock($value)
         }
         $this->_data['block'] = $value;
     }
-    
+
     /**
      * Add authors to itunes entry
-     * 
-     * @param  array $values 
+     *
+     * @param  array $values
      * @return Entry
      */
     public function addItunesAuthors(array $values)
@@ -88,11 +88,11 @@ public function addItunesAuthors(array $values)
         }
         return $this;
     }
-    
+
     /**
      * Add author to itunes entry
-     * 
-     * @param  string $value 
+     *
+     * @param  string $value
      * @return Entry
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -105,14 +105,14 @@ public function addItunesAuthor($value)
         if (!isset($this->_data['authors'])) {
             $this->_data['authors'] = array();
         }
-        $this->_data['authors'][] = $value;   
+        $this->_data['authors'][] = $value;
         return $this;
     }
-    
+
     /**
      * Set duration
-     * 
-     * @param  int $value 
+     *
+     * @param  int $value
      * @return Entry
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -129,11 +129,11 @@ public function setItunesDuration($value)
         $this->_data['duration'] = $value;
         return $this;
     }
-    
+
     /**
      * Set "explicit" flag
-     * 
-     * @param  bool $value 
+     *
+     * @param  bool $value
      * @return Entry
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -146,11 +146,11 @@ public function setItunesExplicit($value)
         $this->_data['explicit'] = $value;
         return $this;
     }
-    
+
     /**
      * Set keywords
-     * 
-     * @param  array $value 
+     *
+     * @param  array $value
      * @return Entry
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -169,11 +169,11 @@ public function setItunesKeywords(array $value)
         $this->_data['keywords'] = $value;
         return $this;
     }
-    
+
     /**
      * Set subtitle
-     * 
-     * @param  string $value 
+     *
+     * @param  string $value
      * @return Entry
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -186,11 +186,11 @@ public function setItunesSubtitle($value)
         $this->_data['subtitle'] = $value;
         return $this;
     }
-    
+
     /**
      * Set summary
-     * 
-     * @param  string $value 
+     *
+     * @param  string $value
      * @return Entry
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -203,12 +203,12 @@ public function setItunesSummary($value)
         $this->_data['summary'] = $value;
         return $this;
     }
-    
+
     /**
      * Overloading to itunes specific setters
-     * 
-     * @param  string $method 
-     * @param  array $params 
+     *
+     * @param  string $method
+     * @param  array $params
      * @return mixed
      */
     public function __call($method, array $params)
@@ -221,7 +221,7 @@ public function __call($method, array $params)
                 'invalid method: ' . $method
             );
         }
-        if (!array_key_exists($point, $this->_data) 
+        if (!array_key_exists($point, $this->_data)
             || empty($this->_data[$point])
         ) {
             return null;
diff --git a/src/Writer/Extension/ITunes/Feed.php b/src/Writer/Extension/ITunes/Feed.php
index a369a4c4..08e6337d 100644
--- a/src/Writer/Extension/ITunes/Feed.php
+++ b/src/Writer/Extension/ITunes/Feed.php
@@ -25,18 +25,18 @@ class Feed
      * @var array
      */
     protected $_data = array();
-    
+
     /**
      * Encoding of all text values
      *
      * @var string
      */
     protected $_encoding = 'UTF-8';
-    
+
     /**
      * Set feed encoding
-     * 
-     * @param  string $enc 
+     *
+     * @param  string $enc
      * @return Feed
      */
     public function setEncoding($enc)
@@ -44,17 +44,17 @@ public function setEncoding($enc)
         $this->_encoding = $enc;
         return $this;
     }
-    
+
     /**
      * Get feed encoding
-     * 
+     *
      * @return string
      */
     public function getEncoding()
     {
         return $this->_encoding;
     }
-    
+
     /**
      * Set a block value of "yes" or "no". You may also set an empty string.
      *
@@ -75,11 +75,11 @@ public function setItunesBlock($value)
         $this->_data['block'] = $value;
         return $this;
     }
-    
+
     /**
      * Add feed authors
-     * 
-     * @param  array $values 
+     *
+     * @param  array $values
      * @return Feed
      */
     public function addItunesAuthors(array $values)
@@ -89,11 +89,11 @@ public function addItunesAuthors(array $values)
         }
         return $this;
     }
-    
+
     /**
      * Add feed author
-     * 
-     * @param  string $value 
+     *
+     * @param  string $value
      * @return Feed
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -106,14 +106,14 @@ public function addItunesAuthor($value)
         if (!isset($this->_data['authors'])) {
             $this->_data['authors'] = array();
         }
-        $this->_data['authors'][] = $value;   
+        $this->_data['authors'][] = $value;
         return $this;
     }
-    
+
     /**
      * Set feed categories
-     * 
-     * @param  array $values 
+     *
+     * @param  array $values
      * @return Feed
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -141,16 +141,16 @@ public function setItunesCategories(array $values)
                         . ' contain a maximum of 255 characters each');
                     }
                     $this->_data['categories'][$key][] = $val;
-                } 
+                }
             }
         }
         return $this;
     }
-    
+
     /**
      * Set feed image (icon)
-     * 
-     * @param  string $value 
+     *
+     * @param  string $value
      * @return Feed
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -168,11 +168,11 @@ public function setItunesImage($value)
         $this->_data['image'] = $value;
         return $this;
     }
-    
+
     /**
      * Set feed cumulative duration
-     * 
-     * @param  string $value 
+     *
+     * @param  string $value
      * @return Feed
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -189,11 +189,11 @@ public function setItunesDuration($value)
         $this->_data['duration'] = $value;
         return $this;
     }
-    
+
     /**
      * Set "explicit" flag
-     * 
-     * @param  bool $value 
+     *
+     * @param  bool $value
      * @return Feed
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -206,11 +206,11 @@ public function setItunesExplicit($value)
         $this->_data['explicit'] = $value;
         return $this;
     }
-    
+
     /**
      * Set feed keywords
-     * 
-     * @param  array $value 
+     *
+     * @param  array $value
      * @return Feed
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -229,11 +229,11 @@ public function setItunesKeywords(array $value)
         $this->_data['keywords'] = $value;
         return $this;
     }
-    
+
     /**
      * Set new feed URL
-     * 
-     * @param  string $value 
+     *
+     * @param  string $value
      * @return Feed
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -246,25 +246,25 @@ public function setItunesNewFeedUrl($value)
         $this->_data['newFeedUrl'] = $value;
         return $this;
     }
-    
+
     /**
      * Add feed owners
-     * 
-     * @param  array $values 
+     *
+     * @param  array $values
      * @return Feed
      */
     public function addItunesOwners(array $values)
     {
         foreach ($values as $value) {
-            $this->addItunesOwner($value); 
+            $this->addItunesOwner($value);
         }
         return $this;
     }
-    
+
     /**
      * Add feed owner
-     * 
-     * @param  string $value 
+     *
+     * @param  string $value
      * @return Feed
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -286,11 +286,11 @@ public function addItunesOwner(array $value)
         $this->_data['owners'][] = $value;
         return $this;
     }
-    
+
     /**
      * Set feed subtitle
-     * 
-     * @param  string $value 
+     *
+     * @param  string $value
      * @return Feed
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -303,11 +303,11 @@ public function setItunesSubtitle($value)
         $this->_data['subtitle'] = $value;
         return $this;
     }
-    
+
     /**
      * Set feed summary
-     * 
-     * @param  string $value 
+     *
+     * @param  string $value
      * @return Feed
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -320,12 +320,12 @@ public function setItunesSummary($value)
         $this->_data['summary'] = $value;
         return $this;
     }
-    
+
     /**
      * Overloading: proxy to internal setters
-     * 
-     * @param  string $method 
-     * @param  array $params 
+     *
+     * @param  string $method
+     * @param  array $params
      * @return mixed
      * @throws Writer\Exception\BadMethodCallException
      */
diff --git a/src/Writer/Extension/ITunes/Renderer/Entry.php b/src/Writer/Extension/ITunes/Renderer/Entry.php
index 33410ceb..c91812ac 100644
--- a/src/Writer/Extension/ITunes/Renderer/Entry.php
+++ b/src/Writer/Extension/ITunes/Renderer/Entry.php
@@ -28,10 +28,10 @@ class Entry extends Extension\AbstractRenderer
      * @var bool
      */
     protected $_called = false;
-    
+
     /**
      * Render entry
-     * 
+     *
      * @return void
      */
     public function render()
@@ -47,23 +47,23 @@ public function render()
             $this->_appendNamespaces();
         }
     }
-    
+
     /**
      * Append namespaces to entry root
-     * 
+     *
      * @return void
      */
     protected function _appendNamespaces()
     {
         $this->getRootElement()->setAttribute('xmlns:itunes',
-            'http://www.itunes.com/dtds/podcast-1.0.dtd');  
+            'http://www.itunes.com/dtds/podcast-1.0.dtd');
     }
 
     /**
      * Set entry authors
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setAuthors(DOMDocument $dom, DOMElement $root)
@@ -80,12 +80,12 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root)
             $this->_called = true;
         }
     }
-    
+
     /**
      * Set itunes block
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setBlock(DOMDocument $dom, DOMElement $root)
@@ -100,12 +100,12 @@ protected function _setBlock(DOMDocument $dom, DOMElement $root)
         $root->appendChild($el);
         $this->_called = true;
     }
-    
+
     /**
      * Set entry duration
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setDuration(DOMDocument $dom, DOMElement $root)
@@ -120,12 +120,12 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root)
         $root->appendChild($el);
         $this->_called = true;
     }
-    
+
     /**
      * Set explicit flag
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setExplicit(DOMDocument $dom, DOMElement $root)
@@ -140,12 +140,12 @@ protected function _setExplicit(DOMDocument $dom, DOMElement $root)
         $root->appendChild($el);
         $this->_called = true;
     }
-    
+
     /**
      * Set entry keywords
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setKeywords(DOMDocument $dom, DOMElement $root)
@@ -160,12 +160,12 @@ protected function _setKeywords(DOMDocument $dom, DOMElement $root)
         $root->appendChild($el);
         $this->_called = true;
     }
-    
+
     /**
      * Set entry subtitle
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setSubtitle(DOMDocument $dom, DOMElement $root)
@@ -180,12 +180,12 @@ protected function _setSubtitle(DOMDocument $dom, DOMElement $root)
         $root->appendChild($el);
         $this->_called = true;
     }
-    
+
     /**
      * Set entry summary
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setSummary(DOMDocument $dom, DOMElement $root)
diff --git a/src/Writer/Extension/ITunes/Renderer/Feed.php b/src/Writer/Extension/ITunes/Renderer/Feed.php
index 32186a86..977c0192 100644
--- a/src/Writer/Extension/ITunes/Renderer/Feed.php
+++ b/src/Writer/Extension/ITunes/Renderer/Feed.php
@@ -20,7 +20,7 @@
 */
 class Feed extends Extension\AbstractRenderer
 {
-    
+
     /**
      * Set to TRUE if a rendering method actually renders something. This
      * is used to prevent premature appending of a XML namespace declaration
@@ -29,10 +29,10 @@ class Feed extends Extension\AbstractRenderer
      * @var bool
      */
     protected $_called = false;
-    
+
     /**
      * Render feed
-     * 
+     *
      * @return void
      */
     public function render()
@@ -52,23 +52,23 @@ public function render()
             $this->_appendNamespaces();
         }
     }
-    
+
     /**
      * Append feed namespaces
-     * 
+     *
      * @return void
      */
     protected function _appendNamespaces()
     {
         $this->getRootElement()->setAttribute('xmlns:itunes',
-            'http://www.itunes.com/dtds/podcast-1.0.dtd');  
+            'http://www.itunes.com/dtds/podcast-1.0.dtd');
     }
 
     /**
      * Set feed authors
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setAuthors(DOMDocument $dom, DOMElement $root)
@@ -85,12 +85,12 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root)
         }
         $this->_called = true;
     }
-    
+
     /**
      * Set feed itunes block
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setBlock(DOMDocument $dom, DOMElement $root)
@@ -105,12 +105,12 @@ protected function _setBlock(DOMDocument $dom, DOMElement $root)
         $root->appendChild($el);
         $this->_called = true;
     }
-    
+
     /**
      * Set feed categories
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setCategories(DOMDocument $dom, DOMElement $root)
@@ -137,12 +137,12 @@ protected function _setCategories(DOMDocument $dom, DOMElement $root)
         }
         $this->_called = true;
     }
-    
+
     /**
      * Set feed image (icon)
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setImage(DOMDocument $dom, DOMElement $root)
@@ -156,12 +156,12 @@ protected function _setImage(DOMDocument $dom, DOMElement $root)
         $root->appendChild($el);
         $this->_called = true;
     }
-    
+
     /**
      * Set feed cumulative duration
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setDuration(DOMDocument $dom, DOMElement $root)
@@ -176,12 +176,12 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root)
         $root->appendChild($el);
         $this->_called = true;
     }
-    
+
     /**
      * Set explicit flag
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setExplicit(DOMDocument $dom, DOMElement $root)
@@ -196,12 +196,12 @@ protected function _setExplicit(DOMDocument $dom, DOMElement $root)
         $root->appendChild($el);
         $this->_called = true;
     }
-    
+
     /**
      * Set feed keywords
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setKeywords(DOMDocument $dom, DOMElement $root)
@@ -216,12 +216,12 @@ protected function _setKeywords(DOMDocument $dom, DOMElement $root)
         $root->appendChild($el);
         $this->_called = true;
     }
-    
+
     /**
      * Set feed's new URL
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setNewFeedUrl(DOMDocument $dom, DOMElement $root)
@@ -236,12 +236,12 @@ protected function _setNewFeedUrl(DOMDocument $dom, DOMElement $root)
         $root->appendChild($el);
         $this->_called = true;
     }
-    
+
     /**
-     * Set feed owners 
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     * Set feed owners
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setOwners(DOMDocument $dom, DOMElement $root)
@@ -264,12 +264,12 @@ protected function _setOwners(DOMDocument $dom, DOMElement $root)
         }
         $this->_called = true;
     }
-    
+
     /**
      * Set feed subtitle
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setSubtitle(DOMDocument $dom, DOMElement $root)
@@ -284,12 +284,12 @@ protected function _setSubtitle(DOMDocument $dom, DOMElement $root)
         $root->appendChild($el);
         $this->_called = true;
     }
-    
+
     /**
      * Set feed summary
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setSummary(DOMDocument $dom, DOMElement $root)
diff --git a/src/Writer/Extension/Renderer.php b/src/Writer/Extension/Renderer.php
index dcb40b3e..414d92e5 100644
--- a/src/Writer/Extension/Renderer.php
+++ b/src/Writer/Extension/Renderer.php
@@ -22,30 +22,30 @@ interface Renderer
     /**
      * Constructor
      *
-     * @param  mixed $container 
+     * @param  mixed $container
      * @return void
      */
     public function __construct($container);
-    
+
     /**
      * Set DOMDocument and DOMElement on which to operate
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $base 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $base
      * @return void
      */
     public function setDomDocument(DOMDocument $dom, DOMElement $base);
-    
+
     /**
      * Render
-     * 
+     *
      * @return void
      */
     public function render();
-    
+
     /**
      * Retrieve container
-     * 
+     *
      * @return mixed
      */
     public function getDataContainer();
diff --git a/src/Writer/Extension/Slash/Renderer/Entry.php b/src/Writer/Extension/Slash/Renderer/Entry.php
index 694ef070..d29c55e0 100644
--- a/src/Writer/Extension/Slash/Renderer/Entry.php
+++ b/src/Writer/Extension/Slash/Renderer/Entry.php
@@ -29,10 +29,10 @@ class Entry extends Extension\AbstractRenderer
      * @var bool
      */
     protected $_called = false;
-    
+
     /**
      * Render entry
-     * 
+     *
      * @return void
      */
     public function render()
@@ -45,23 +45,23 @@ public function render()
             $this->_appendNamespaces();
         }
     }
-    
+
     /**
      * Append entry namespaces
-     * 
+     *
      * @return void
      */
     protected function _appendNamespaces()
     {
         $this->getRootElement()->setAttribute('xmlns:slash',
-            'http://purl.org/rss/1.0/modules/slash/');  
+            'http://purl.org/rss/1.0/modules/slash/');
     }
 
     /**
      * Set entry comment count
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setCommentCount(DOMDocument $dom, DOMElement $root)
diff --git a/src/Writer/Extension/Threading/Renderer/Entry.php b/src/Writer/Extension/Threading/Renderer/Entry.php
index 61bfa117..d1239010 100644
--- a/src/Writer/Extension/Threading/Renderer/Entry.php
+++ b/src/Writer/Extension/Threading/Renderer/Entry.php
@@ -29,10 +29,10 @@ class Entry extends Extension\AbstractRenderer
      * @var bool
      */
     protected $_called = false;
-    
+
     /**
      * Render entry
-     * 
+     *
      * @return void
      */
     public function render()
@@ -47,23 +47,23 @@ public function render()
             $this->_appendNamespaces();
         }
     }
-    
+
     /**
      * Append entry namespaces
-     * 
+     *
      * @return void
      */
     protected function _appendNamespaces()
     {
         $this->getRootElement()->setAttribute('xmlns:thr',
-            'http://purl.org/syndication/thread/1.0');  
+            'http://purl.org/syndication/thread/1.0');
     }
-    
+
     /**
      * Set comment link
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setCommentLink(DOMDocument $dom, DOMElement $root)
@@ -83,12 +83,12 @@ protected function _setCommentLink(DOMDocument $dom, DOMElement $root)
         $root->appendChild($clink);
         $this->_called = true;
     }
-    
+
     /**
      * Set comment feed links
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root)
@@ -113,9 +113,9 @@ protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set entry comment count
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setCommentCount(DOMDocument $dom, DOMElement $root)
diff --git a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php
index 814d815e..9a2a7ca4 100644
--- a/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php
+++ b/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php
@@ -29,10 +29,10 @@ class Entry extends Extension\AbstractRenderer
      * @var bool
      */
     protected $_called = false;
-    
+
     /**
      * Render entry
-     * 
+     *
      * @return void
      */
     public function render()
@@ -45,23 +45,23 @@ public function render()
             $this->_appendNamespaces();
         }
     }
-    
+
     /**
      * Append entry namespaces
-     * 
+     *
      * @return void
      */
     protected function _appendNamespaces()
     {
         $this->getRootElement()->setAttribute('xmlns:wfw',
-            'http://wellformedweb.org/CommentAPI/');  
+            'http://wellformedweb.org/CommentAPI/');
     }
-    
+
     /**
      * Set entry comment feed links
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root)
diff --git a/src/Writer/Feed.php b/src/Writer/Feed.php
index cfd2b3bf..0008911f 100644
--- a/src/Writer/Feed.php
+++ b/src/Writer/Feed.php
@@ -63,7 +63,7 @@ public function addTombstone(Deleted $deleted)
     {
         $this->_entries[] = $deleted;
     }
-    
+
     /**
      * Creates a new Zend_Feed_Writer_Deleted data container for use. This is NOT
      * added to the current feed automatically, but is necessary to create a
diff --git a/src/Writer/FeedFactory.php b/src/Writer/FeedFactory.php
index ceb74448..2abc8bc3 100644
--- a/src/Writer/FeedFactory.php
+++ b/src/Writer/FeedFactory.php
@@ -21,7 +21,7 @@ abstract class FeedFactory
 {
     /**
      * Create and return a Feed based on data provided.
-     * 
+     *
      * @param  array|\Traversable $data
      * @return Feed
      */
@@ -73,8 +73,8 @@ public static function factory($data)
 
     /**
      * Normalize a key
-     * 
-     * @param  string $key 
+     *
+     * @param  string $key
      * @return string
      */
     protected static function convertKey($key)
@@ -85,9 +85,9 @@ protected static function convertKey($key)
 
     /**
      * Create and attach entries to a feed
-     * 
-     * @param  array|Traversable $entries 
-     * @param  Feed $feed 
+     *
+     * @param  array|Traversable $entries
+     * @param  Feed $feed
      * @return void
      */
     protected static function createEntries($entries, Feed $feed)
diff --git a/src/Writer/Renderer/AbstractRenderer.php b/src/Writer/Renderer/AbstractRenderer.php
index 1777ffcd..1760faf4 100644
--- a/src/Writer/Renderer/AbstractRenderer.php
+++ b/src/Writer/Renderer/AbstractRenderer.php
@@ -25,7 +25,7 @@ class AbstractRenderer
      * @var array
      */
     protected $_extensions = array();
-    
+
     /**
      * @var mixed
      */
@@ -45,14 +45,14 @@ class AbstractRenderer
      * @var array
      */
     protected $_exceptions = array();
-    
+
     /**
      * Encoding of all text values
      *
      * @var string
      */
     protected $_encoding = 'UTF-8';
-    
+
     /**
      * Holds the value "atom" or "rss" depending on the feed type set when
      * when last exported.
@@ -60,7 +60,7 @@ class AbstractRenderer
      * @var string
      */
     protected $_type = null;
-    
+
     /**
      * @var DOMElement
      */
@@ -68,8 +68,8 @@ class AbstractRenderer
 
     /**
      * Constructor
-     * 
-     * @param  mixed $container 
+     *
+     * @param  mixed $container
      * @return void
      */
     public function __construct($container)
@@ -78,10 +78,10 @@ public function __construct($container)
         $this->setType($container->getType());
         $this->_loadExtensions();
     }
-    
+
     /**
      * Save XML to string
-     * 
+     *
      * @return string
      */
     public function saveXml()
@@ -91,7 +91,7 @@ public function saveXml()
 
     /**
      * Get DOM document
-     * 
+     *
      * @return DOMDocument
      */
     public function getDomDocument()
@@ -101,7 +101,7 @@ public function getDomDocument()
 
     /**
      * Get document element from DOM
-     * 
+     *
      * @return DOMElement
      */
     public function getElement()
@@ -111,18 +111,18 @@ public function getElement()
 
     /**
      * Get data container of items being rendered
-     * 
+     *
      * @return mixed
      */
     public function getDataContainer()
     {
         return $this->_container;
     }
-    
+
     /**
      * Set feed encoding
-     * 
-     * @param  string $enc 
+     *
+     * @param  string $enc
      * @return AbstractRenderer
      */
     public function setEncoding($enc)
@@ -130,10 +130,10 @@ public function setEncoding($enc)
         $this->_encoding = $enc;
         return $this;
     }
-    
+
     /**
      * Get feed encoding
-     * 
+     *
      * @return string
      */
     public function getEncoding()
@@ -143,8 +143,8 @@ public function getEncoding()
 
     /**
      * Indicate whether or not to ignore exceptions
-     * 
-     * @param  bool $bool 
+     *
+     * @param  bool $bool
      * @return AbstractRenderer
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -159,14 +159,14 @@ public function ignoreExceptions($bool = true)
 
     /**
      * Get exception list
-     * 
+     *
      * @return array
      */
     public function getExceptions()
     {
         return $this->_exceptions;
     }
-    
+
     /**
      * Set the current feed type being exported to "rss" or "atom". This allows
      * other objects to gracefully choose whether to execute or not, depending
@@ -178,7 +178,7 @@ public function setType($type)
     {
         $this->_type = $type;
     }
-    
+
     /**
      * Retrieve the current or last feed type exported.
      *
@@ -188,7 +188,7 @@ public function getType()
     {
         return $this->_type;
     }
-    
+
     /**
      * Sets the absolute root element for the XML feed being generated. This
      * helps simplify the appending of namespace declarations, but also ensures
@@ -201,7 +201,7 @@ public function setRootElement(DOMElement $root)
     {
         $this->_rootElement = $root;
     }
-    
+
     /**
      * Retrieve the absolute root element for the XML feed being generated.
      *
@@ -211,7 +211,7 @@ public function getRootElement()
     {
         return $this->_rootElement;
     }
-    
+
     /**
      * Load extensions from Zend_Feed_Writer
      *
diff --git a/src/Writer/Renderer/Entry/Atom/Deleted.php b/src/Writer/Renderer/Entry/Atom/Deleted.php
index 5e79189b..dd07abee 100644
--- a/src/Writer/Renderer/Entry/Atom/Deleted.php
+++ b/src/Writer/Renderer/Entry/Atom/Deleted.php
@@ -24,8 +24,8 @@ class Deleted
 {
     /**
      * Constructor
-     * 
-     * @param  \Zend\Feed\Writer\Deleted $container 
+     *
+     * @param  \Zend\Feed\Writer\Deleted $container
      * @return void
      */
     public function __construct (\Zend\Feed\Writer\Deleted $container)
@@ -35,7 +35,7 @@ public function __construct (\Zend\Feed\Writer\Deleted $container)
 
     /**
      * Render atom entry
-     * 
+     *
      * @return \Zend\Feed\Writer\Renderer\Entry\Atom
      */
     public function render()
@@ -44,21 +44,21 @@ public function render()
         $this->_dom->formatOutput = true;
         $entry = $this->_dom->createElement('at:deleted-entry');
         $this->_dom->appendChild($entry);
-        
+
         $entry->setAttribute('ref', $this->_container->getReference());
         $entry->setAttribute('when', $this->_container->getWhen()->format(DateTime::ISO8601));
-        
+
         $this->_setBy($this->_dom, $entry);
         $this->_setComment($this->_dom, $entry);
-        
+
         return $this;
     }
-    
+
     /**
      * Set tombstone comment
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setComment(DOMDocument $dom, DOMElement $root)
@@ -72,12 +72,12 @@ protected function _setComment(DOMDocument $dom, DOMElement $root)
         $cdata = $dom->createCDATASection($this->getDataContainer()->getComment());
         $c->appendChild($cdata);
     }
-    
+
     /**
-     * Set entry authors 
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     * Set entry authors
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setBy(DOMDocument $dom, DOMElement $root)
@@ -105,5 +105,5 @@ protected function _setBy(DOMDocument $dom, DOMElement $root)
             $uri->appendChild($text);
         }
     }
-    
+
 }
diff --git a/src/Writer/Renderer/Entry/AtomDeleted.php b/src/Writer/Renderer/Entry/AtomDeleted.php
index 1ac0e1fb..573540d5 100644
--- a/src/Writer/Renderer/Entry/AtomDeleted.php
+++ b/src/Writer/Renderer/Entry/AtomDeleted.php
@@ -24,7 +24,7 @@ class AtomDeleted extends Renderer\AbstractRenderer implements Renderer\Renderer
 {
     /**
      * Constructor
-     * 
+     *
      * @param  Writer\Deleted $container
      * @return void
      */
@@ -44,21 +44,21 @@ public function render()
         $this->_dom->formatOutput = true;
         $entry = $this->_dom->createElement('at:deleted-entry');
         $this->_dom->appendChild($entry);
-        
+
         $entry->setAttribute('ref', $this->_container->getReference());
         $entry->setAttribute('when', $this->_container->getWhen()->format(DateTime::ISO8601));
-        
+
         $this->_setBy($this->_dom, $entry);
         $this->_setComment($this->_dom, $entry);
-        
+
         return $this;
     }
-    
+
     /**
      * Set tombstone comment
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setComment(DOMDocument $dom, DOMElement $root)
@@ -72,12 +72,12 @@ protected function _setComment(DOMDocument $dom, DOMElement $root)
         $cdata = $dom->createCDATASection($this->getDataContainer()->getComment());
         $c->appendChild($cdata);
     }
-    
+
     /**
-     * Set entry authors 
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     * Set entry authors
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setBy(DOMDocument $dom, DOMElement $root)
@@ -105,5 +105,5 @@ protected function _setBy(DOMDocument $dom, DOMElement $root)
             $uri->appendChild($text);
         }
     }
-    
+
 }
diff --git a/src/Writer/Renderer/Entry/Rss.php b/src/Writer/Renderer/Entry/Rss.php
index b993af64..83d1dc49 100644
--- a/src/Writer/Renderer/Entry/Rss.php
+++ b/src/Writer/Renderer/Entry/Rss.php
@@ -25,7 +25,7 @@ class Rss extends Renderer\AbstractRenderer implements Renderer\RendererInterfac
 {
     /**
      * Constructor
-     * 
+     *
      * @param  Writer\Entry $container
      * @return void
      */
@@ -33,10 +33,10 @@ public function __construct (Writer\Entry $container)
     {
         parent::__construct($container);
     }
-    
+
     /**
      * Render RSS entry
-     * 
+     *
      * @return Rss
      */
     public function render()
@@ -46,7 +46,7 @@ public function render()
         $this->_dom->substituteEntities = false;
         $entry = $this->_dom->createElement('item');
         $this->_dom->appendChild($entry);
-        
+
         $this->_setTitle($this->_dom, $entry);
         $this->_setDescription($this->_dom, $entry);
         $this->_setDateCreated($this->_dom, $entry);
@@ -66,12 +66,12 @@ public function render()
 
         return $this;
     }
-    
+
     /**
      * Set entry title
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -95,10 +95,10 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root)
         $text = $dom->createTextNode($this->getDataContainer()->getTitle());
         $title->appendChild($text);
     }
-    
+
     /**
      * Set entry description
-     * 
+     *
      * @param  DOMDocument $dom
      * @param  DOMElement $root
      * @return void
@@ -128,12 +128,12 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root)
         $text = $dom->createCDATASection($this->getDataContainer()->getDescription());
         $subtitle->appendChild($text);
     }
-    
+
     /**
      * Set date entry was last modified
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setDateModified(DOMDocument $dom, DOMElement $root)
@@ -149,12 +149,12 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root)
         );
         $updated->appendChild($text);
     }
-    
+
     /**
      * Set date entry was created
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setDateCreated(DOMDocument $dom, DOMElement $root)
@@ -168,12 +168,12 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root)
             );
         }
     }
-    
+
     /**
      * Set entry authors
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setAuthors(DOMDocument $dom, DOMElement $root)
@@ -193,12 +193,12 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root)
             $root->appendChild($author);
         }
     }
-    
+
     /**
      * Set entry enclosure
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -242,12 +242,12 @@ protected function _setEnclosure(DOMDocument $dom, DOMElement $root)
         $enclosure->setAttribute('url', $data['uri']);
         $root->appendChild($enclosure);
     }
-    
+
     /**
      * Set link to entry
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setLink(DOMDocument $dom, DOMElement $root)
@@ -260,12 +260,12 @@ protected function _setLink(DOMDocument $dom, DOMElement $root)
         $text = $dom->createTextNode($this->getDataContainer()->getLink());
         $link->appendChild($text);
     }
-    
+
     /**
      * Set entry identifier
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setId(DOMDocument $dom, DOMElement $root)
@@ -287,12 +287,12 @@ protected function _setId(DOMDocument $dom, DOMElement $root)
             $id->setAttribute('isPermaLink', 'false');
         }
     }
-    
+
     /**
      * Set link to entry comments
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setCommentLink(DOMDocument $dom, DOMElement $root)
@@ -306,12 +306,12 @@ protected function _setCommentLink(DOMDocument $dom, DOMElement $root)
         $clink->appendChild($text);
         $root->appendChild($clink);
     }
-    
+
     /**
      * Set entry categories
-     * 
-     * @param DOMDocument $dom 
-     * @param DOMElement $root 
+     *
+     * @param DOMDocument $dom
+     * @param DOMElement $root
      * @return void
      */
     protected function _setCategories(DOMDocument $dom, DOMElement $root)
diff --git a/src/Writer/Renderer/Feed/AbstractAtom.php b/src/Writer/Renderer/Feed/AbstractAtom.php
index 7d31b9a6..ad069891 100644
--- a/src/Writer/Renderer/Feed/AbstractAtom.php
+++ b/src/Writer/Renderer/Feed/AbstractAtom.php
@@ -24,8 +24,8 @@ class AbstractAtom extends Renderer\AbstractRenderer
 {
     /**
      * Constructor
-     * 
-     * @param  Zend_Feed_Writer_Feed $container 
+     *
+     * @param  Zend_Feed_Writer_Feed $container
      * @return void
      */
     public function __construct ($container)
@@ -35,9 +35,9 @@ public function __construct ($container)
 
     /**
      * Set feed language
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setLanguage(DOMDocument $dom, DOMElement $root)
@@ -50,9 +50,9 @@ protected function _setLanguage(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set feed title
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -79,9 +79,9 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set feed description
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setDescription(DOMDocument $dom, DOMElement $root)
@@ -98,9 +98,9 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set date feed was last modified
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -128,9 +128,9 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set feed generator string
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setGenerator(DOMDocument $dom, DOMElement $root)
@@ -155,9 +155,9 @@ protected function _setGenerator(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set link to feed
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setLink(DOMDocument $dom, DOMElement $root)
@@ -174,9 +174,9 @@ protected function _setLink(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set feed links
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -206,12 +206,12 @@ protected function _setFeedLinks(DOMDocument $dom, DOMElement $root)
             $flink->setAttribute('href', $href);
         }
     }
-    
+
     /**
-     * Set feed authors 
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     * Set feed authors
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setAuthors(DOMDocument $dom, DOMElement $root)
@@ -249,9 +249,9 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set feed identifier
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -281,12 +281,12 @@ protected function _setId(DOMDocument $dom, DOMElement $root)
         $text = $dom->createTextNode($this->getDataContainer()->getId());
         $id->appendChild($text);
     }
-    
+
     /**
      * Set feed copyright
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setCopyright(DOMDocument $dom, DOMElement $root)
@@ -303,9 +303,9 @@ protected function _setCopyright(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set feed level logo (image)
-     * 
-     * @param DOMDocument $dom 
-     * @param DOMElement $root 
+     *
+     * @param DOMDocument $dom
+     * @param DOMElement $root
      * @return void
      */
     protected function _setImage(DOMDocument $dom, DOMElement $root)
@@ -319,12 +319,12 @@ protected function _setImage(DOMDocument $dom, DOMElement $root)
         $text = $dom->createTextNode($image['uri']);
         $img->appendChild($text);
     }
-    
+
     /**
-     * Set date feed was created 
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     * Set date feed was created
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setDateCreated(DOMDocument $dom, DOMElement $root)
@@ -338,12 +338,12 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root)
             );
         }
     }
-    
+
     /**
      * Set base URL to feed links
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setBaseUrl(DOMDocument $dom, DOMElement $root)
@@ -354,12 +354,12 @@ protected function _setBaseUrl(DOMDocument $dom, DOMElement $root)
         }
         $root->setAttribute('xml:base', $baseUrl);
     }
-    
+
     /**
-     * Set hubs to which this feed pushes 
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     * Set hubs to which this feed pushes
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setHubs(DOMDocument $dom, DOMElement $root)
@@ -375,12 +375,12 @@ protected function _setHubs(DOMDocument $dom, DOMElement $root)
             $root->appendChild($hub);
         }
     }
-    
+
     /**
-     * Set feed cateories 
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     * Set feed cateories
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setCategories(DOMDocument $dom, DOMElement $root)
diff --git a/src/Writer/Renderer/Feed/Atom.php b/src/Writer/Renderer/Feed/Atom.php
index aa687fd6..54c85360 100644
--- a/src/Writer/Renderer/Feed/Atom.php
+++ b/src/Writer/Renderer/Feed/Atom.php
@@ -22,7 +22,7 @@ class Atom extends AbstractAtom implements Renderer\RendererInterface
 {
     /**
      * Constructor
-     * 
+     *
      * @param  Writer\Feed $container
      * @return void
      */
@@ -33,7 +33,7 @@ public function __construct (Writer\Feed $container)
 
     /**
      * Render Atom feed
-     * 
+     *
      * @return Atom
      */
     public function render()
@@ -63,14 +63,14 @@ public function render()
         $this->_setCopyright($this->_dom, $root);
         $this->_setCategories($this->_dom, $root);
         $this->_setHubs($this->_dom, $root);
-        
+
         foreach ($this->_extensions as $ext) {
             $ext->setType($this->getType());
             $ext->setRootElement($this->getRootElement());
             $ext->setDOMDocument($this->getDOMDocument(), $root);
             $ext->render();
         }
-        
+
         foreach ($this->_container as $entry) {
             if ($this->getDataContainer()->getEncoding()) {
                 $entry->setEncoding($this->getDataContainer()->getEncoding());
diff --git a/src/Writer/Renderer/Feed/Atom/AbstractAtom.php b/src/Writer/Renderer/Feed/Atom/AbstractAtom.php
index 70f5a571..57b65cfa 100644
--- a/src/Writer/Renderer/Feed/Atom/AbstractAtom.php
+++ b/src/Writer/Renderer/Feed/Atom/AbstractAtom.php
@@ -23,8 +23,8 @@ class AbstractAtom extends Feed\Writer\Renderer\AbstractRenderer
 {
     /**
      * Constructor
-     * 
-     * @param  \Zend\Feed\Writer\Feed $container 
+     *
+     * @param  \Zend\Feed\Writer\Feed $container
      * @return void
      */
     public function __construct ($container)
@@ -34,9 +34,9 @@ public function __construct ($container)
 
     /**
      * Set feed language
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setLanguage(DOMDocument $dom, DOMElement $root)
@@ -49,9 +49,9 @@ protected function _setLanguage(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set feed title
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      * @throws Feed\Exception\InvalidArgumentException
      */
@@ -78,9 +78,9 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set feed description
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setDescription(DOMDocument $dom, DOMElement $root)
@@ -97,9 +97,9 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set date feed was last modified
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      * @throws Feed\Exception\InvalidArgumentException
      */
@@ -127,9 +127,9 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set feed generator string
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setGenerator(DOMDocument $dom, DOMElement $root)
@@ -154,9 +154,9 @@ protected function _setGenerator(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set link to feed
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setLink(DOMDocument $dom, DOMElement $root)
@@ -173,9 +173,9 @@ protected function _setLink(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set feed links
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      * @throws Feed\Exception\InvalidArgumentException
      */
@@ -205,12 +205,12 @@ protected function _setFeedLinks(DOMDocument $dom, DOMElement $root)
             $flink->setAttribute('href', $href);
         }
     }
-    
+
     /**
-     * Set feed authors 
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     * Set feed authors
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setAuthors(DOMDocument $dom, DOMElement $root)
@@ -248,9 +248,9 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set feed identifier
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      * @throws Feed\Exception\InvalidArgumentException
      */
@@ -280,12 +280,12 @@ protected function _setId(DOMDocument $dom, DOMElement $root)
         $text = $dom->createTextNode($this->getDataContainer()->getId());
         $id->appendChild($text);
     }
-    
+
     /**
      * Set feed copyright
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setCopyright(DOMDocument $dom, DOMElement $root)
@@ -301,9 +301,9 @@ protected function _setCopyright(DOMDocument $dom, DOMElement $root)
     }
     /**
      * Set feed level logo (image)
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setImage(DOMDocument $dom, DOMElement $root)
@@ -317,13 +317,13 @@ protected function _setImage(DOMDocument $dom, DOMElement $root)
         $text = $dom->createTextNode($image['uri']);
         $img->appendChild($text);
     }
-    
-    
+
+
     /**
-     * Set date feed was created 
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     * Set date feed was created
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setDateCreated(DOMDocument $dom, DOMElement $root)
@@ -337,12 +337,12 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root)
             );
         }
     }
-    
+
     /**
      * Set base URL to feed links
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setBaseUrl(DOMDocument $dom, DOMElement $root)
@@ -353,12 +353,12 @@ protected function _setBaseUrl(DOMDocument $dom, DOMElement $root)
         }
         $root->setAttribute('xml:base', $baseUrl);
     }
-    
+
     /**
-     * Set hubs to which this feed pushes 
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     * Set hubs to which this feed pushes
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setHubs(DOMDocument $dom, DOMElement $root)
@@ -374,12 +374,12 @@ protected function _setHubs(DOMDocument $dom, DOMElement $root)
             $root->appendChild($hub);
         }
     }
-    
+
     /**
-     * Set feed cateories 
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     * Set feed cateories
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setCategories(DOMDocument $dom, DOMElement $root)
diff --git a/src/Writer/Renderer/Feed/Atom/Source.php b/src/Writer/Renderer/Feed/Atom/Source.php
index 1f934013..5950f328 100644
--- a/src/Writer/Renderer/Feed/Atom/Source.php
+++ b/src/Writer/Renderer/Feed/Atom/Source.php
@@ -22,7 +22,7 @@ class Source extends AbstractAtom implements \Zend\Feed\Writer\Renderer\Renderer
 
     /**
      * Constructor
-     * 
+     *
      * @param  \Zend\Feed\Writer\Source $container
      * @return void
      */
@@ -30,10 +30,10 @@ public function __construct (\Zend\Feed\Writer\Source $container)
     {
         parent::__construct($container);
     }
-    
+
     /**
      * Render Atom Feed Metadata (Source element)
-     * 
+     *
      * @return \Zend\Feed\Writer\Renderer\Feed\Atom
      */
     public function render()
@@ -59,7 +59,7 @@ public function render()
         $this->_setAuthors($this->_dom, $root);
         $this->_setCopyright($this->_dom, $root);
         $this->_setCategories($this->_dom, $root);
-        
+
         foreach ($this->_extensions as $ext) {
             $ext->setType($this->getType());
             $ext->setRootElement($this->getRootElement());
@@ -68,12 +68,12 @@ public function render()
         }
         return $this;
     }
-    
+
     /**
      * Set feed generator string
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setGenerator(DOMDocument $dom, DOMElement $root)
diff --git a/src/Writer/Renderer/Feed/AtomSource.php b/src/Writer/Renderer/Feed/AtomSource.php
index f0659403..d54fac86 100644
--- a/src/Writer/Renderer/Feed/AtomSource.php
+++ b/src/Writer/Renderer/Feed/AtomSource.php
@@ -24,18 +24,18 @@ class AtomSource extends AbstractAtom implements Renderer\RendererInterface
 
     /**
      * Constructor
-     * 
-     * @param  Zend_Feed_Writer_Feed_Source $container 
+     *
+     * @param  Zend_Feed_Writer_Feed_Source $container
      * @return void
      */
     public function __construct (Writer\Source $container)
     {
         parent::__construct($container);
     }
-    
+
     /**
      * Render Atom Feed Metadata (Source element)
-     * 
+     *
      * @return \Zend\Feed\Writer\Renderer\Feed\Atom
      */
     public function render()
@@ -61,7 +61,7 @@ public function render()
         $this->_setAuthors($this->_dom, $root);
         $this->_setCopyright($this->_dom, $root);
         $this->_setCategories($this->_dom, $root);
-        
+
         foreach ($this->_extensions as $ext) {
             $ext->setType($this->getType());
             $ext->setRootElement($this->getRootElement());
@@ -70,10 +70,10 @@ public function render()
         }
         return $this;
     }
-    
+
     /**
      * Set feed generator string
-     * 
+     *
      * @param  DOMDocument $dom
      * @param  DOMElement $root
      * @return void
diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php
index a154f180..ce571f53 100644
--- a/src/Writer/Renderer/Feed/Rss.php
+++ b/src/Writer/Renderer/Feed/Rss.php
@@ -25,8 +25,8 @@ class Rss extends Renderer\AbstractRenderer implements Renderer\RendererInterfac
 {
     /**
      * Constructor
-     * 
-     * @param  Zend_Feed_Writer_Feed $container 
+     *
+     * @param  Zend_Feed_Writer_Feed $container
      * @return void
      */
     public function __construct (Writer\Feed $container)
@@ -36,7 +36,7 @@ public function __construct (Writer\Feed $container)
 
     /**
      * Render RSS feed
-     * 
+     *
      * @return Zend_Feed_Writer_Renderer_Feed_Rss
      */
     public function render()
@@ -50,7 +50,7 @@ public function render()
         $rss = $this->_dom->createElement('rss');
         $this->setRootElement($rss);
         $rss->setAttribute('version', '2.0');
-        
+
         $channel = $this->_dom->createElement('channel');
         $rss->appendChild($channel);
         $this->_dom->appendChild($rss);
@@ -67,14 +67,14 @@ public function render()
         $this->_setAuthors($this->_dom, $channel);
         $this->_setCopyright($this->_dom, $channel);
         $this->_setCategories($this->_dom, $channel);
-        
+
         foreach ($this->_extensions as $ext) {
             $ext->setType($this->getType());
             $ext->setRootElement($this->getRootElement());
             $ext->setDOMDocument($this->getDOMDocument(), $channel);
             $ext->render();
         }
-        
+
         foreach ($this->_container as $entry) {
             if ($this->getDataContainer()->getEncoding()) {
                 $entry->setEncoding($this->getDataContainer()->getEncoding());
@@ -99,9 +99,9 @@ public function render()
 
     /**
      * Set feed language
-     * 
-     * @param DOMDocument $dom 
-     * @param DOMElement $root 
+     *
+     * @param DOMDocument $dom
+     * @param DOMElement $root
      * @return void
      */
     protected function _setLanguage(DOMDocument $dom, DOMElement $root)
@@ -117,9 +117,9 @@ protected function _setLanguage(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set feed title
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -145,9 +145,9 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set feed description
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -172,9 +172,9 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set date feed was last modified
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setDateModified(DOMDocument $dom, DOMElement $root)
@@ -193,9 +193,9 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set feed generator string
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setGenerator(DOMDocument $dom, DOMElement $root)
@@ -221,9 +221,9 @@ protected function _setGenerator(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set link to feed
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -249,12 +249,12 @@ protected function _setLink(DOMDocument $dom, DOMElement $root)
             $link->setAttribute('isPermaLink', 'false');
         }
     }
-    
+
     /**
      * Set feed authors
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setAuthors(DOMDocument $dom, DOMElement $root)
@@ -274,12 +274,12 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root)
             $root->appendChild($author);
         }
     }
-    
+
     /**
      * Set feed copyright
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setCopyright(DOMDocument $dom, DOMElement $root)
@@ -296,9 +296,9 @@ protected function _setCopyright(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set feed channel image
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      * @throws Writer\Exception\InvalidArgumentException
      */
@@ -407,12 +407,12 @@ protected function _setImage(DOMDocument $dom, DOMElement $root)
             $img->appendChild($desc);
         }
     }
-    
+
     /**
      * Set date feed was created
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setDateCreated(DOMDocument $dom, DOMElement $root)
@@ -429,9 +429,9 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root)
 
     /**
      * Set date feed last build date
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setLastBuildDate(DOMDocument $dom, DOMElement $root)
@@ -447,12 +447,12 @@ protected function _setLastBuildDate(DOMDocument $dom, DOMElement $root)
         );
         $lastBuildDate->appendChild($text);
     }
-    
+
     /**
      * Set base URL to feed links
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setBaseUrl(DOMDocument $dom, DOMElement $root)
@@ -463,12 +463,12 @@ protected function _setBaseUrl(DOMDocument $dom, DOMElement $root)
         }
         $root->setAttribute('xml:base', $baseUrl);
     }
-    
+
     /**
      * Set feed categories
-     * 
-     * @param  DOMDocument $dom 
-     * @param  DOMElement $root 
+     *
+     * @param  DOMDocument $dom
+     * @param  DOMElement $root
      * @return void
      */
     protected function _setCategories(DOMDocument $dom, DOMElement $root)
diff --git a/src/Writer/Renderer/RendererInterface.php b/src/Writer/Renderer/RendererInterface.php
index 842492cc..3ef55a6c 100644
--- a/src/Writer/Renderer/RendererInterface.php
+++ b/src/Writer/Renderer/RendererInterface.php
@@ -21,53 +21,53 @@ interface RendererInterface
 {
     /**
      * Render feed/entry
-     * 
+     *
      * @return void
      */
     public function render();
 
     /**
      * Save feed and/or entry to XML and return string
-     * 
+     *
      * @return string
      */
     public function saveXml();
 
     /**
      * Get DOM document
-     * 
+     *
      * @return DOMDocument
      */
     public function getDomDocument();
 
     /**
      * Get document element from DOM
-     * 
+     *
      * @return DOMElement
      */
     public function getElement();
 
     /**
      * Get data container containing feed items
-     * 
+     *
      * @return mixed
      */
     public function getDataContainer();
 
     /**
      * Should exceptions be ignored?
-     * 
+     *
      * @return mixed
      */
     public function ignoreExceptions();
-    
+
     /**
      * Get list of thrown exceptions
-     * 
+     *
      * @return array
      */
     public function getExceptions();
-    
+
     /**
      * Set the current feed type being exported to "rss" or "atom". This allows
      * other objects to gracefully choose whether to execute or not, depending
@@ -76,14 +76,14 @@ public function getExceptions();
      * @param string $type
      */
     public function setType($type);
-    
+
     /**
      * Retrieve the current or last feed type exported.
      *
      * @return string Value will be "rss" or "atom"
      */
     public function getType();
-    
+
     /**
      * Sets the absolute root element for the XML feed being generated. This
      * helps simplify the appending of namespace declarations, but also ensures
@@ -93,7 +93,7 @@ public function getType();
      * @param DOMElement $root
      */
     public function setRootElement(DOMElement $root);
-    
+
     /**
      * Retrieve the absolute root element for the XML feed being generated.
      *
diff --git a/src/Writer/Writer.php b/src/Writer/Writer.php
index 3d47bd70..803ba274 100644
--- a/src/Writer/Writer.php
+++ b/src/Writer/Writer.php
@@ -47,7 +47,7 @@ class Writer
     const TYPE_RSS_10           = 'rss-10';
     const TYPE_RSS_20           = 'rss-20';
     const TYPE_RSS_ANY          = 'rss';
-    
+
     /**
      * PluginLoader instance used by component
      *
@@ -75,7 +75,7 @@ class Writer
         'entryRenderer' => array(),
         'feedRenderer'  => array(),
     );
-    
+
     /**
      * Set plugin loader for use with Extensions
      *
@@ -254,7 +254,7 @@ public static function registerCoreExtensions()
         self::registerExtension('Threading');
         self::registerExtension('ITunes');
     }
-    
+
     public static function lcfirst($str)
     {
         $str[0] = strtolower($str[0]);
diff --git a/test/PubSubHubbub/Model/SubscriptionTest.php b/test/PubSubHubbub/Model/SubscriptionTest.php
index 0d22ad0d..e1cd2129 100644
--- a/test/PubSubHubbub/Model/SubscriptionTest.php
+++ b/test/PubSubHubbub/Model/SubscriptionTest.php
@@ -32,9 +32,9 @@ public function testAllOperations()
     {
         $adapter = $this->initDb();
         $table = new TableGateway('subscription', $adapter);
-        
+
         $subscription = new Subscription($table);
-        
+
         $id = uniqid();
         $this->assertFalse($subscription->hasSubscription($id));
         $this->assertFalse($subscription->getSubscription($id));
@@ -78,7 +78,7 @@ protected function initDb()
         }
         $db = new DbAdapter(array('driver' => 'pdo_sqlite', 'dsn' => 'sqlite::memory:'));
         $this->createTable($db);
-        
+
         return $db;
     }
 
diff --git a/test/PubSubHubbub/PublisherTest.php b/test/PubSubHubbub/PublisherTest.php
index 16d3ef13..2d9d0545 100644
--- a/test/PubSubHubbub/PublisherTest.php
+++ b/test/PubSubHubbub/PublisherTest.php
@@ -299,7 +299,8 @@ public function testNotifiesHubAndReportsFail()
 
 class ClientNotReset extends HttpClient
 {
-    public function resetParameters($clearCookies = false) {
+    public function resetParameters($clearCookies = false)
+    {
         // Do nothing
     }
 }
diff --git a/test/PubSubHubbub/SubscriberHttpTest.php b/test/PubSubHubbub/SubscriberHttpTest.php
index 585183c7..7562181b 100644
--- a/test/PubSubHubbub/SubscriberHttpTest.php
+++ b/test/PubSubHubbub/SubscriberHttpTest.php
@@ -59,7 +59,7 @@ public function setUp()
             $this->_client->setAdapter('\Zend\Http\Client\Adapter\Socket');
             PubSubHubbub::setHttpClient($this->_client);
             $this->_subscriber = new Subscriber;
-            
+
             $this->_storage = $this->_getCleanMock('\Zend\Feed\PubSubHubbub\Model\Subscription');
             $this->_subscriber->setStorage($this->_storage);
 
@@ -98,8 +98,9 @@ public function testUnsubscriptionRequestSendsExpectedPostData()
             .'&hub.verify_token=abc',
             $this->_client->getResponse()->getBody());
     }
-    
-    protected function _getCleanMock($className) {
+
+    protected function _getCleanMock($className)
+    {
         $class = new \ReflectionClass($className);
         $methods = $class->getMethods();
         $stubMethods = array();
diff --git a/test/PubSubHubbub/SubscriberTest.php b/test/PubSubHubbub/SubscriberTest.php
index 20548f65..26d11928 100644
--- a/test/PubSubHubbub/SubscriberTest.php
+++ b/test/PubSubHubbub/SubscriberTest.php
@@ -26,9 +26,9 @@ class SubscriberTest extends \PHPUnit_Framework_TestCase
 {
     /** @var Subscriber */
     protected $_subscriber = null;
-    
+
     protected $_adapter = null;
-    
+
     protected $_tableGateway = null;
 
     public function setUp()
@@ -289,8 +289,9 @@ public function testGetStorageThrowsExceptionIfNoneSet()
         $this->setExpectedException('Zend\Feed\PubSubHubbub\Exception\ExceptionInterface');
         $this->_subscriber->getStorage();
     }
-    
-    protected function _getCleanMock($className) {
+
+    protected function _getCleanMock($className)
+    {
         $class = new \ReflectionClass($className);
         $methods = $class->getMethods();
         $stubMethods = array();
diff --git a/test/Reader/Entry/AtomStandaloneEntryTest.php b/test/Reader/Entry/AtomStandaloneEntryTest.php
index 12de7ece..a5beb8e9 100644
--- a/test/Reader/Entry/AtomStandaloneEntryTest.php
+++ b/test/Reader/Entry/AtomStandaloneEntryTest.php
@@ -24,9 +24,9 @@ class AtomStandaloneEntryTest extends \PHPUnit_Framework_TestCase
 {
 
     protected $_feedSamplePath = null;
-    
+
     protected $_expectedCats = array();
-    
+
     protected $_expectedCatsDc = array();
 
     public function setup()
@@ -186,7 +186,7 @@ public function testGetsEnclosureFromAtom10()
 
         $this->assertEquals($expected, $entry->getEnclosure());
     }
-    
+
     /**
      * TEXT
      * @group ZFRATOMCONTENT
@@ -198,7 +198,7 @@ public function testGetsContentFromAtom10()
         );
         $this->assertEquals('Entry Content &', $entry->getContent());
     }
-    
+
     /**
      * HTML Escaped
      * @group ZFRATOMCONTENT
@@ -210,7 +210,7 @@ public function testGetsContentFromAtom10Html()
         );
         $this->assertEquals('

Entry Content &

', $entry->getContent()); } - + /** * HTML CDATA Escaped * @group ZFRATOMCONTENT @@ -222,7 +222,7 @@ public function testGetsContentFromAtom10HtmlCdata() ); $this->assertEquals('

Entry Content &

', $entry->getContent()); } - + /** * XHTML * @group ZFRATOMCONTENT @@ -258,7 +258,7 @@ public function testGetsCommentLinkFromAtom10() ); $this->assertEquals('http://www.example.com/entry/comments', $entry->getCommentLink()); } - + /** * Get category data * @group ZFR002 @@ -271,5 +271,5 @@ public function testGetsCategoriesFromAtom10() $this->assertEquals($this->_expectedCats, (array) $entry->getCategories()); $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); } - + } diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index 581215ec..a59f4ef2 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -24,9 +24,9 @@ class AtomTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; - + protected $_expectedCats = array(); - + protected $_expectedCatsDc = array(); public function setup() @@ -293,7 +293,7 @@ public function testGetsContentFromAtom10() $entry = $feed->current(); $this->assertEquals('Entry Content &', $entry->getContent()); } - + /** * HTML Escaped * @group ZFRATOMCONTENT @@ -306,7 +306,7 @@ public function testGetsContentFromAtom10Html() $entry = $feed->current(); $this->assertEquals('

Entry Content &

', $entry->getContent()); } - + /** * HTML CDATA Escaped * @group ZFRATOMCONTENT @@ -319,7 +319,7 @@ public function testGetsContentFromAtom10HtmlCdata() $entry = $feed->current(); $this->assertEquals('

Entry Content &

', $entry->getContent()); } - + /** * XHTML * @group ZFRATOMCONTENT @@ -422,13 +422,13 @@ public function testGetsCommentLinkFromAtom10_RelativeLinks() $entry = $feed->current(); $this->assertEquals('http://www.example.com/entry/comments', $entry->getCommentLink()); } - + /** * Get category data */ - + // Atom 1.0 (Atom 0.3 never supported categories except via Atom 1.0/Dublin Core extensions) - + public function testGetsCategoriesFromAtom10() { $feed = Reader\Reader::importString( @@ -438,7 +438,7 @@ public function testGetsCategoriesFromAtom10() $this->assertEquals($this->_expectedCats, (array) $entry->getCategories()); $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromAtom03_Atom10Extension() { $feed = Reader\Reader::importString( @@ -448,9 +448,9 @@ public function testGetsCategoriesFromAtom03_Atom10Extension() $this->assertEquals($this->_expectedCats, (array) $entry->getCategories()); $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); } - + // DC 1.0/1.1 for Atom 0.3 - + public function testGetsCategoriesFromAtom03_Dc10() { $feed = Reader\Reader::importString( @@ -460,7 +460,7 @@ public function testGetsCategoriesFromAtom03_Dc10() $this->assertEquals($this->_expectedCatsDc, (array) $entry->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromAtom03_Dc11() { $feed = Reader\Reader::importString( @@ -470,9 +470,9 @@ public function testGetsCategoriesFromAtom03_Dc11() $this->assertEquals($this->_expectedCatsDc, (array) $entry->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } - + // No Categories In Entry - + public function testGetsCategoriesFromAtom10_None() { $feed = Reader\Reader::importString( @@ -482,7 +482,7 @@ public function testGetsCategoriesFromAtom10_None() $this->assertEquals(array(), (array) $entry->getCategories()); $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromAtom03_None() { $feed = Reader\Reader::importString( @@ -492,5 +492,5 @@ public function testGetsCategoriesFromAtom03_None() $this->assertEquals(array(), (array) $entry->getCategories()); $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); } - + } diff --git a/test/Reader/Entry/CommonTest.php b/test/Reader/Entry/CommonTest.php index 73eee640..01ff20a0 100644 --- a/test/Reader/Entry/CommonTest.php +++ b/test/Reader/Entry/CommonTest.php @@ -96,7 +96,7 @@ public function testReturnsNullIfExtensionDoesNotExist() $entry = $feed->current(); $this->assertEquals(null, $entry->getExtension('Foo')); } - + /** * @group ZF-8213 */ @@ -108,7 +108,7 @@ public function testReturnsEncodingOfFeed() $entry = $feed->current(); $this->assertEquals('UTF-8', $entry->getEncoding()); } - + /** * @group ZF-8213 */ @@ -131,12 +131,12 @@ public function testFeedEntryCanDetectFeedType() ); $entry = $feed->current(); $stub = $this->getMockForAbstractClass( - 'Zend\Feed\Reader\Entry\AbstractEntry', + 'Zend\Feed\Reader\Entry\AbstractEntry', array($entry->getElement(), $entry->getId()) ); $this->assertEquals($entry->getType(), $stub->getType()); } - + /** * When passing a newly created DOMElement without any DOMDocument assigned */ @@ -148,7 +148,7 @@ public function testFeedEntryCanSetAnyType() $entry = $feed->current(); $domElement = new \DOMElement($entry->getElement()->tagName); $stub = $this->getMockForAbstractClass( - 'Zend\Feed\Reader\Entry\AbstractEntry', + 'Zend\Feed\Reader\Entry\AbstractEntry', array($domElement, $entry->getId()) ); $this->assertEquals($stub->getType(), Reader\Reader::TYPE_ANY); diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index bc78bd25..8df5a580 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -24,11 +24,11 @@ class RssTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; - + protected $_expectedCats = array(); - + protected $_expectedCatsRdf = array(); - + protected $_expectedCatsAtom = array(); public function setup() @@ -1869,7 +1869,8 @@ public function testGetsDateModified($path, $edate) $this->assertTrue($edate == $entry->getDateModified()); } - public function dateModifiedProvider() { + public function dateModifiedProvider() + { $iso = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z'); $us = DateTime::createFromFormat(DateTime::ISO8601, '2010-01-04T02:14:00-0600'); $rss = DateTime::createFromFormat(DateTime::RSS, 'Sun, 11 Jan 2009 09:55:59 GMT'); @@ -2544,13 +2545,13 @@ public function testGetsCommentFeedLinkFromRss090_None() $entry = $feed->current(); $this->assertEquals(null, $entry->getCommentFeedLink()); } - + /** * Get category data */ - + // RSS 2.0 - + public function testGetsCategoriesFromRss20() { $feed = Reader\Reader::importString( @@ -2560,9 +2561,9 @@ public function testGetsCategoriesFromRss20() $this->assertEquals($this->_expectedCats, (array) $entry->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } - + // DC 1.0 - + public function testGetsCategoriesFromRss090_Dc10() { $feed = Reader\Reader::importString( @@ -2572,7 +2573,7 @@ public function testGetsCategoriesFromRss090_Dc10() $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss091_Dc10() { $feed = Reader\Reader::importString( @@ -2582,7 +2583,7 @@ public function testGetsCategoriesFromRss091_Dc10() $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss092_Dc10() { $feed = Reader\Reader::importString( @@ -2592,7 +2593,7 @@ public function testGetsCategoriesFromRss092_Dc10() $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss093_Dc10() { $feed = Reader\Reader::importString( @@ -2602,7 +2603,7 @@ public function testGetsCategoriesFromRss093_Dc10() $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss094_Dc10() { $feed = Reader\Reader::importString( @@ -2612,7 +2613,7 @@ public function testGetsCategoriesFromRss094_Dc10() $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss10_Dc10() { $feed = Reader\Reader::importString( @@ -2622,9 +2623,9 @@ public function testGetsCategoriesFromRss10_Dc10() $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } - + // DC 1.1 - + public function testGetsCategoriesFromRss090_Dc11() { $feed = Reader\Reader::importString( @@ -2634,7 +2635,7 @@ public function testGetsCategoriesFromRss090_Dc11() $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss091_Dc11() { $feed = Reader\Reader::importString( @@ -2644,7 +2645,7 @@ public function testGetsCategoriesFromRss091_Dc11() $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss092_Dc11() { $feed = Reader\Reader::importString( @@ -2654,7 +2655,7 @@ public function testGetsCategoriesFromRss092_Dc11() $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss093_Dc11() { $feed = Reader\Reader::importString( @@ -2664,7 +2665,7 @@ public function testGetsCategoriesFromRss093_Dc11() $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss094_Dc11() { $feed = Reader\Reader::importString( @@ -2674,7 +2675,7 @@ public function testGetsCategoriesFromRss094_Dc11() $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss10_Dc11() { $feed = Reader\Reader::importString( @@ -2684,9 +2685,9 @@ public function testGetsCategoriesFromRss10_Dc11() $this->assertEquals($this->_expectedCatsRdf, (array) $entry->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($entry->getCategories()->getValues())); } - + // Atom 1.0 - + public function testGetsCategoriesFromRss090_Atom10() { $feed = Reader\Reader::importString( @@ -2696,7 +2697,7 @@ public function testGetsCategoriesFromRss090_Atom10() $this->assertEquals($this->_expectedCatsAtom, (array) $entry->getCategories()); $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss091_Atom10() { $feed = Reader\Reader::importString( @@ -2706,7 +2707,7 @@ public function testGetsCategoriesFromRss091_Atom10() $this->assertEquals($this->_expectedCatsAtom, (array) $entry->getCategories()); $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss092_Atom10() { $feed = Reader\Reader::importString( @@ -2716,7 +2717,7 @@ public function testGetsCategoriesFromRss092_Atom10() $this->assertEquals($this->_expectedCatsAtom, (array) $entry->getCategories()); $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss093_Atom10() { $feed = Reader\Reader::importString( @@ -2726,7 +2727,7 @@ public function testGetsCategoriesFromRss093_Atom10() $this->assertEquals($this->_expectedCatsAtom, (array) $entry->getCategories()); $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss094_Atom10() { $feed = Reader\Reader::importString( @@ -2736,7 +2737,7 @@ public function testGetsCategoriesFromRss094_Atom10() $this->assertEquals($this->_expectedCatsAtom, (array) $entry->getCategories()); $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss10_Atom10() { $feed = Reader\Reader::importString( @@ -2746,9 +2747,9 @@ public function testGetsCategoriesFromRss10_Atom10() $this->assertEquals($this->_expectedCatsAtom, (array) $entry->getCategories()); $this->assertEquals(array('topic1','Cat & Dog'), array_values($entry->getCategories()->getValues())); } - + // No Categories In Entry - + public function testGetsCategoriesFromRss20_None() { $feed = Reader\Reader::importString( @@ -2758,7 +2759,7 @@ public function testGetsCategoriesFromRss20_None() $this->assertEquals(array(), (array) $entry->getCategories()); $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss090_None() { $feed = Reader\Reader::importString( @@ -2768,7 +2769,7 @@ public function testGetsCategoriesFromRss090_None() $this->assertEquals(array(), (array) $entry->getCategories()); $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss091_None() { $feed = Reader\Reader::importString( @@ -2778,7 +2779,7 @@ public function testGetsCategoriesFromRss091_None() $this->assertEquals(array(), (array) $entry->getCategories()); $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss092_None() { $feed = Reader\Reader::importString( @@ -2788,7 +2789,7 @@ public function testGetsCategoriesFromRss092_None() $this->assertEquals(array(), (array) $entry->getCategories()); $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss093_None() { $feed = Reader\Reader::importString( @@ -2798,7 +2799,7 @@ public function testGetsCategoriesFromRss093_None() $this->assertEquals(array(), (array) $entry->getCategories()); $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss094_None() { $feed = Reader\Reader::importString( @@ -2808,7 +2809,7 @@ public function testGetsCategoriesFromRss094_None() $this->assertEquals(array(), (array) $entry->getCategories()); $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss10_None() { $feed = Reader\Reader::importString( @@ -2818,6 +2819,6 @@ public function testGetsCategoriesFromRss10_None() $this->assertEquals(array(), (array) $entry->getCategories()); $this->assertEquals(array(), array_values($entry->getCategories()->getValues())); } - - + + } diff --git a/test/Reader/Feed/AtomSourceTest.php b/test/Reader/Feed/AtomSourceTest.php index aea52b04..0d4eecab 100644 --- a/test/Reader/Feed/AtomSourceTest.php +++ b/test/Reader/Feed/AtomSourceTest.php @@ -24,11 +24,11 @@ class AtomSourceTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; - + protected $_options = array(); - + protected $_expectedCats = array(); - + protected $_expectedCatsDc = array(); public function setup() @@ -72,7 +72,7 @@ public function testGetsSourceFromEntry() file_get_contents($this->_feedSamplePath.'/title/atom10.xml') ); $source = $feed->current()->getSource(); - $this->assertTrue($source instanceof Reader\Feed\Atom\Source); + $this->assertTrue($source instanceof Reader\Feed\Atom\Source); } /** @@ -245,7 +245,7 @@ public function testGetsFeedLinkFromAtom10() $source = $feed->current()->getSource(); $this->assertEquals('http://www.example.com/feed/atom', $source->getFeedLink()); } - + /** * Get Pubsubhubbub Hubs */ @@ -260,7 +260,7 @@ public function testGetsHubsFromAtom10() 'http://www.example.com/hub2' ), $source->getHubs()); } - + /** * Get category data */ diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index bd472580..168ea9c4 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -24,11 +24,11 @@ class AtomTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; - + protected $_options = array(); - + protected $_expectedCats = array(); - + protected $_expectedCatsDc = array(); public function setup() @@ -413,13 +413,13 @@ public function testCountableInterface() ); $this->assertEquals(0, count($feed)); } - + /** * Get category data */ - + // Atom 1.0 (Atom 0.3 never supported categories except via Atom 1.0/Dublin Core extensions) - + public function testGetsCategoriesFromAtom10() { $feed = Reader\Reader::importString( @@ -428,7 +428,7 @@ public function testGetsCategoriesFromAtom10() $this->assertEquals($this->_expectedCats, (array) $feed->getCategories()); $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromAtom03_Atom10Extension() { $feed = Reader\Reader::importString( @@ -437,9 +437,9 @@ public function testGetsCategoriesFromAtom03_Atom10Extension() $this->assertEquals($this->_expectedCats, (array) $feed->getCategories()); $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); } - + // DC 1.0/1.1 for Atom 0.3 - + public function testGetsCategoriesFromAtom03_Dc10() { $feed = Reader\Reader::importString( @@ -448,7 +448,7 @@ public function testGetsCategoriesFromAtom03_Dc10() $this->assertEquals($this->_expectedCatsDc, (array) $feed->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromAtom03_Dc11() { $feed = Reader\Reader::importString( @@ -457,9 +457,9 @@ public function testGetsCategoriesFromAtom03_Dc11() $this->assertEquals($this->_expectedCatsDc, (array) $feed->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); } - + // No Categories In Entry - + public function testGetsCategoriesFromAtom10_None() { $feed = Reader\Reader::importString( @@ -468,7 +468,7 @@ public function testGetsCategoriesFromAtom10_None() $this->assertEquals(array(), (array) $feed->getCategories()); $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromAtom03_None() { $feed = Reader\Reader::importString( diff --git a/test/Reader/Feed/CommonTest.php b/test/Reader/Feed/CommonTest.php index 1eed3408..d00f5e0d 100644 --- a/test/Reader/Feed/CommonTest.php +++ b/test/Reader/Feed/CommonTest.php @@ -88,7 +88,7 @@ public function testReturnsNullIfExtensionDoesNotExist() ); $this->assertEquals(null, $feed->getExtension('Foo')); } - + /** * @group ZF-8213 */ @@ -99,7 +99,7 @@ public function testReturnsEncodingOfFeed() ); $this->assertEquals('UTF-8', $feed->getEncoding()); } - + /** * @group ZF-8213 */ diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index 664d99d6..caf73e98 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -24,11 +24,11 @@ class RssTest extends \PHPUnit_Framework_TestCase { protected $_feedSamplePath = null; - + protected $_expectedCats = array(); - + protected $_expectedCatsRdf = array(); - + protected $_expectedCatsAtom = array(); public function setup() @@ -2104,7 +2104,8 @@ public function testGetsDateModified($path, $edate) $this->assertTrue($edate == $feed->getDateModified()); } - public function dateModifiedProvider() { + public function dateModifiedProvider() + { $iso = DateTime::createFromFormat(DateTime::ISO8601, '2009-03-07T08:03:50Z'); $us = DateTime::createFromFormat(DateTime::ISO8601, '2010-01-04T02:14:00-0600'); return array( @@ -2280,13 +2281,13 @@ public function testGetsHubsFromRss090_None() ); $this->assertEquals(null, $feed->getHubs()); } - + /** * Get category data */ - + // RSS 2.0 - + public function testGetsCategoriesFromRss20() { $feed = Reader\Reader::importString( @@ -2295,9 +2296,9 @@ public function testGetsCategoriesFromRss20() $this->assertEquals($this->_expectedCats, (array) $feed->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); } - + // DC 1.0 - + public function testGetsCategoriesFromRss090_Dc10() { $feed = Reader\Reader::importString( @@ -2306,7 +2307,7 @@ public function testGetsCategoriesFromRss090_Dc10() $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss091_Dc10() { $feed = Reader\Reader::importString( @@ -2315,7 +2316,7 @@ public function testGetsCategoriesFromRss091_Dc10() $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss092_Dc10() { $feed = Reader\Reader::importString( @@ -2324,7 +2325,7 @@ public function testGetsCategoriesFromRss092_Dc10() $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss093_Dc10() { $feed = Reader\Reader::importString( @@ -2333,7 +2334,7 @@ public function testGetsCategoriesFromRss093_Dc10() $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss094_Dc10() { $feed = Reader\Reader::importString( @@ -2342,7 +2343,7 @@ public function testGetsCategoriesFromRss094_Dc10() $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss10_Dc10() { $feed = Reader\Reader::importString( @@ -2351,9 +2352,9 @@ public function testGetsCategoriesFromRss10_Dc10() $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); } - + // DC 1.1 - + public function testGetsCategoriesFromRss090_Dc11() { $feed = Reader\Reader::importString( @@ -2362,7 +2363,7 @@ public function testGetsCategoriesFromRss090_Dc11() $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss091_Dc11() { $feed = Reader\Reader::importString( @@ -2371,7 +2372,7 @@ public function testGetsCategoriesFromRss091_Dc11() $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss092_Dc11() { $feed = Reader\Reader::importString( @@ -2380,7 +2381,7 @@ public function testGetsCategoriesFromRss092_Dc11() $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss093_Dc11() { $feed = Reader\Reader::importString( @@ -2389,7 +2390,7 @@ public function testGetsCategoriesFromRss093_Dc11() $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss094_Dc11() { $feed = Reader\Reader::importString( @@ -2398,7 +2399,7 @@ public function testGetsCategoriesFromRss094_Dc11() $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss10_Dc11() { $feed = Reader\Reader::importString( @@ -2407,9 +2408,9 @@ public function testGetsCategoriesFromRss10_Dc11() $this->assertEquals($this->_expectedCatsRdf, (array) $feed->getCategories()); $this->assertEquals(array('topic1','topic2'), array_values($feed->getCategories()->getValues())); } - + // Atom 1.0 - + public function testGetsCategoriesFromRss090_Atom10() { $feed = Reader\Reader::importString( @@ -2418,7 +2419,7 @@ public function testGetsCategoriesFromRss090_Atom10() $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss091_Atom10() { $feed = Reader\Reader::importString( @@ -2427,7 +2428,7 @@ public function testGetsCategoriesFromRss091_Atom10() $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss092_Atom10() { $feed = Reader\Reader::importString( @@ -2436,7 +2437,7 @@ public function testGetsCategoriesFromRss092_Atom10() $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss093_Atom10() { $feed = Reader\Reader::importString( @@ -2445,7 +2446,7 @@ public function testGetsCategoriesFromRss093_Atom10() $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss094_Atom10() { $feed = Reader\Reader::importString( @@ -2454,7 +2455,7 @@ public function testGetsCategoriesFromRss094_Atom10() $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss10_Atom10() { $feed = Reader\Reader::importString( @@ -2463,9 +2464,9 @@ public function testGetsCategoriesFromRss10_Atom10() $this->assertEquals($this->_expectedCatsAtom, (array) $feed->getCategories()); $this->assertEquals(array('topic1','Cat & Dog'), array_values($feed->getCategories()->getValues())); } - + // No Categories In Entry - + public function testGetsCategoriesFromRss20_None() { $feed = Reader\Reader::importString( @@ -2474,7 +2475,7 @@ public function testGetsCategoriesFromRss20_None() $this->assertEquals(array(), (array) $feed->getCategories()); $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss090_None() { $feed = Reader\Reader::importString( @@ -2483,7 +2484,7 @@ public function testGetsCategoriesFromRss090_None() $this->assertEquals(array(), (array) $feed->getCategories()); $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss091_None() { $feed = Reader\Reader::importString( @@ -2492,7 +2493,7 @@ public function testGetsCategoriesFromRss091_None() $this->assertEquals(array(), (array) $feed->getCategories()); $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss092_None() { $feed = Reader\Reader::importString( @@ -2501,7 +2502,7 @@ public function testGetsCategoriesFromRss092_None() $this->assertEquals(array(), (array) $feed->getCategories()); $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss093_None() { $feed = Reader\Reader::importString( @@ -2510,7 +2511,7 @@ public function testGetsCategoriesFromRss093_None() $this->assertEquals(array(), (array) $feed->getCategories()); $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss094_None() { $feed = Reader\Reader::importString( @@ -2519,7 +2520,7 @@ public function testGetsCategoriesFromRss094_None() $this->assertEquals(array(), (array) $feed->getCategories()); $this->assertEquals(array(), array_values($feed->getCategories()->getValues())); } - + public function testGetsCategoriesFromRss10_None() { $feed = Reader\Reader::importString( diff --git a/test/Reader/Feed/_files/Atom/category/plain/atom03.xml b/test/Reader/Feed/_files/Atom/category/plain/atom03.xml index 510b42f8..cdac16c9 100644 --- a/test/Reader/Feed/_files/Atom/category/plain/atom03.xml +++ b/test/Reader/Feed/_files/Atom/category/plain/atom03.xml @@ -5,6 +5,6 @@ - + diff --git a/test/Reader/ReaderTest.php b/test/Reader/ReaderTest.php index b364e806..6f9f8664 100644 --- a/test/Reader/ReaderTest.php +++ b/test/Reader/ReaderTest.php @@ -145,7 +145,7 @@ public function testImportsUri() Reader\Reader::import('http://www.planet-php.net/rdf/'); } - + /** * @group ZF-8328 * @expectedException Zend\Feed\Reader\Exception\RuntimeException @@ -200,7 +200,7 @@ public function testZeroCountFeedSetReturnedFromEmptyList() $links = Reader\Reader::findFeedLinks('http://www.example.com'); $this->assertEquals(0, count($links)); } - + /** * @group ZF-8327 */ @@ -213,7 +213,7 @@ public function testGetsFeedLinksAndTrimsNewlines() $links = Reader\Reader::findFeedLinks('http://www.infopod.com.br'); $this->assertEquals('http://feeds.feedburner.com/jonnyken/infoblog', $links->rss); } - + /** * @group ZF-8330 */ @@ -226,7 +226,7 @@ public function testGetsFeedLinksAndNormalisesRelativeUrls() $links = Reader\Reader::findFeedLinks('http://meiobit.com'); $this->assertEquals('http://meiobit.com/rss.xml', $links->rss); } - + /** * @group ZF-8330 */ diff --git a/test/Writer/DeletedTest.php b/test/Writer/DeletedTest.php index e9f70062..5c4dc49b 100644 --- a/test/Writer/DeletedTest.php +++ b/test/Writer/DeletedTest.php @@ -45,7 +45,7 @@ public function testGetReferenceReturnsNullIfNotSet() $entry = new Writer\Deleted; $this->assertTrue(is_null($entry->getReference())); } - + public function testSetWhenDefaultsToCurrentTime() { $entry = new Writer\Deleted; @@ -61,7 +61,7 @@ public function testSetWhenUsesGivenUnixTimestamp() $myDate = new DateTime('@' . 1234567890); $this->assertEquals($myDate, $entry->getWhen()); } - + /** * @group ZF-12070 */ @@ -83,7 +83,7 @@ public function testSetWhenUsesGivenUnixTimestampWhenItIsAVerySmallInteger() $myDate = new DateTime('@' . 123); $this->assertEquals($myDate, $entry->getWhen()); } - + public function testSetWhenUsesDateTimeObject() { $myDate = new DateTime('@' . 1234567890); @@ -91,7 +91,7 @@ public function testSetWhenUsesDateTimeObject() $entry->setWhen($myDate); $this->assertEquals($myDate, $entry->getWhen()); } - + public function testSetWhenThrowsExceptionOnInvalidParameter() { $entry = new Writer\Deleted; @@ -101,13 +101,13 @@ public function testSetWhenThrowsExceptionOnInvalidParameter() } catch (Writer\Exception\ExceptionInterface $e) { } } - + public function testGetWhenReturnsNullIfDateNotSet() { $entry = new Writer\Deleted; $this->assertTrue(is_null($entry->getWhen())); } - + public function testAddsByNameFromArray() { $entry = new Writer\Deleted; diff --git a/test/Writer/Extension/ITunes/EntryTest.php b/test/Writer/Extension/ITunes/EntryTest.php index 5bcce521..9e8ebbc0 100644 --- a/test/Writer/Extension/ITunes/EntryTest.php +++ b/test/Writer/Extension/ITunes/EntryTest.php @@ -28,7 +28,7 @@ public function testSetBlock() $entry->setItunesBlock('yes'); $this->assertEquals('yes', $entry->getItunesBlock()); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -37,7 +37,7 @@ public function testSetBlockThrowsExceptionOnNonAlphaValue() $entry = new Writer\Entry; $entry->setItunesBlock('123'); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -46,21 +46,21 @@ public function testSetBlockThrowsExceptionIfValueGreaterThan255CharsLength() $entry = new Writer\Entry; $entry->setItunesBlock(str_repeat('a', 256)); } - + public function testAddAuthors() { $entry = new Writer\Entry; $entry->addItunesAuthors(array('joe', 'jane')); $this->assertEquals(array('joe', 'jane'), $entry->getItunesAuthors()); } - + public function testAddAuthor() { $entry = new Writer\Entry; $entry->addItunesAuthor('joe'); $this->assertEquals(array('joe'), $entry->getItunesAuthors()); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -69,28 +69,28 @@ public function testAddAuthorThrowsExceptionIfValueGreaterThan255CharsLength() $entry = new Writer\Entry; $entry->addItunesAuthor(str_repeat('a', 256)); } - + public function testSetDurationAsSeconds() { $entry = new Writer\Entry; $entry->setItunesDuration(23); $this->assertEquals(23, $entry->getItunesDuration()); } - + public function testSetDurationAsMinutesAndSeconds() { $entry = new Writer\Entry; $entry->setItunesDuration('23:23'); $this->assertEquals('23:23', $entry->getItunesDuration()); } - + public function testSetDurationAsHoursMinutesAndSeconds() { $entry = new Writer\Entry; $entry->setItunesDuration('23:23:23'); $this->assertEquals('23:23:23', $entry->getItunesDuration()); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -99,7 +99,7 @@ public function testSetDurationThrowsExceptionOnUnknownFormat() $entry = new Writer\Entry; $entry->setItunesDuration('abc'); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -108,7 +108,7 @@ public function testSetDurationThrowsExceptionOnInvalidSeconds() $entry = new Writer\Entry; $entry->setItunesDuration('23:456'); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -117,28 +117,28 @@ public function testSetDurationThrowsExceptionOnInvalidMinutes() $entry = new Writer\Entry; $entry->setItunesDuration('23:234:45'); } - + public function testSetExplicitToYes() { $entry = new Writer\Entry; $entry->setItunesExplicit('yes'); $this->assertEquals('yes', $entry->getItunesExplicit()); } - + public function testSetExplicitToNo() { $entry = new Writer\Entry; $entry->setItunesExplicit('no'); $this->assertEquals('no', $entry->getItunesExplicit()); } - + public function testSetExplicitToClean() { $entry = new Writer\Entry; $entry->setItunesExplicit('clean'); $this->assertEquals('clean', $entry->getItunesExplicit()); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -147,7 +147,7 @@ public function testSetExplicitThrowsExceptionOnUnknownTerm() $entry = new Writer\Entry; $entry->setItunesExplicit('abc'); } - + public function testSetKeywords() { $entry = new Writer\Entry; @@ -157,7 +157,7 @@ public function testSetKeywords() $entry->setItunesKeywords($words); $this->assertEquals($words, $entry->getItunesKeywords()); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -169,7 +169,7 @@ public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded() ); $entry->setItunesKeywords($words); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -181,14 +181,14 @@ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharL ); $entry->setItunesKeywords($words); } - + public function testSetSubtitle() { $entry = new Writer\Entry; $entry->setItunesSubtitle('abc'); $this->assertEquals('abc', $entry->getItunesSubtitle()); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -197,14 +197,14 @@ public function testSetSubtitleThrowsExceptionWhenValueExceeds255Chars() $entry = new Writer\Entry; $entry->setItunesSubtitle(str_repeat('a', 256)); } - + public function testSetSummary() { $entry = new Writer\Entry; $entry->setItunesSummary('abc'); $this->assertEquals('abc', $entry->getItunesSummary()); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ diff --git a/test/Writer/Extension/ITunes/FeedTest.php b/test/Writer/Extension/ITunes/FeedTest.php index 6e7ecf46..d9b5af0b 100644 --- a/test/Writer/Extension/ITunes/FeedTest.php +++ b/test/Writer/Extension/ITunes/FeedTest.php @@ -28,7 +28,7 @@ public function testSetBlock() $feed->setItunesBlock('yes'); $this->assertEquals('yes', $feed->getItunesBlock()); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -37,7 +37,7 @@ public function testSetBlockThrowsExceptionOnNonAlphaValue() $feed = new Writer\Feed; $feed->setItunesBlock('123'); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -46,21 +46,21 @@ public function testSetBlockThrowsExceptionIfValueGreaterThan255CharsLength() $feed = new Writer\Feed; $feed->setItunesBlock(str_repeat('a', 256)); } - + public function testAddAuthors() { $feed = new Writer\Feed; $feed->addItunesAuthors(array('joe', 'jane')); $this->assertEquals(array('joe', 'jane'), $feed->getItunesAuthors()); } - + public function testAddAuthor() { $feed = new Writer\Feed; $feed->addItunesAuthor('joe'); $this->assertEquals(array('joe'), $feed->getItunesAuthors()); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -69,7 +69,7 @@ public function testAddAuthorThrowsExceptionIfValueGreaterThan255CharsLength() $feed = new Writer\Feed; $feed->addItunesAuthor(str_repeat('a', 256)); } - + public function testSetCategories() { $feed = new Writer\Feed; @@ -80,7 +80,7 @@ public function testSetCategories() $feed->setItunesCategories($cats); $this->assertEquals($cats, $feed->getItunesCategories()); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -94,21 +94,21 @@ public function testSetCategoriesThrowsExceptionIfAnyCatNameGreaterThan255CharsL $feed->setItunesCategories($cats); $this->assertEquals($cats, $feed->getItunesAuthors()); } - + public function testSetImageAsPngFile() { $feed = new Writer\Feed; $feed->setItunesImage('http://www.example.com/image.png'); $this->assertEquals('http://www.example.com/image.png', $feed->getItunesImage()); } - + public function testSetImageAsJpgFile() { $feed = new Writer\Feed; $feed->setItunesImage('http://www.example.com/image.jpg'); $this->assertEquals('http://www.example.com/image.jpg', $feed->getItunesImage()); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -117,7 +117,7 @@ public function testSetImageThrowsExceptionOnInvalidUri() $feed = new Writer\Feed; $feed->setItunesImage('http://'); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -126,28 +126,28 @@ public function testSetImageThrowsExceptionOnInvalidImageExtension() $feed = new Writer\Feed; $feed->setItunesImage('http://www.example.com/image.gif'); } - + public function testSetDurationAsSeconds() { $feed = new Writer\Feed; $feed->setItunesDuration(23); $this->assertEquals(23, $feed->getItunesDuration()); } - + public function testSetDurationAsMinutesAndSeconds() { $feed = new Writer\Feed; $feed->setItunesDuration('23:23'); $this->assertEquals('23:23', $feed->getItunesDuration()); } - + public function testSetDurationAsHoursMinutesAndSeconds() { $feed = new Writer\Feed; $feed->setItunesDuration('23:23:23'); $this->assertEquals('23:23:23', $feed->getItunesDuration()); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -156,7 +156,7 @@ public function testSetDurationThrowsExceptionOnUnknownFormat() $feed = new Writer\Feed; $feed->setItunesDuration('abc'); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -165,7 +165,7 @@ public function testSetDurationThrowsExceptionOnInvalidSeconds() $feed = new Writer\Feed; $feed->setItunesDuration('23:456'); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -174,28 +174,28 @@ public function testSetDurationThrowsExceptionOnInvalidMinutes() $feed = new Writer\Feed; $feed->setItunesDuration('23:234:45'); } - + public function testSetExplicitToYes() { $feed = new Writer\Feed; $feed->setItunesExplicit('yes'); $this->assertEquals('yes', $feed->getItunesExplicit()); } - + public function testSetExplicitToNo() { $feed = new Writer\Feed; $feed->setItunesExplicit('no'); $this->assertEquals('no', $feed->getItunesExplicit()); } - + public function testSetExplicitToClean() { $feed = new Writer\Feed; $feed->setItunesExplicit('clean'); $this->assertEquals('clean', $feed->getItunesExplicit()); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -204,7 +204,7 @@ public function testSetExplicitThrowsExceptionOnUnknownTerm() $feed = new Writer\Feed; $feed->setItunesExplicit('abc'); } - + public function testSetKeywords() { $feed = new Writer\Feed; @@ -214,7 +214,7 @@ public function testSetKeywords() $feed->setItunesKeywords($words); $this->assertEquals($words, $feed->getItunesKeywords()); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -226,7 +226,7 @@ public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded() ); $feed->setItunesKeywords($words); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -238,14 +238,14 @@ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharL ); $feed->setItunesKeywords($words); } - + public function testSetNewFeedUrl() { $feed = new Writer\Feed; $feed->setItunesNewFeedUrl('http://example.com/feed'); $this->assertEquals('http://example.com/feed', $feed->getItunesNewFeedUrl()); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -254,28 +254,28 @@ public function testSetNewFeedUrlThrowsExceptionOnInvalidUri() $feed = new Writer\Feed; $feed->setItunesNewFeedUrl('http://'); } - + public function testAddOwner() { $feed = new Writer\Feed; $feed->addItunesOwner(array('name'=>'joe','email'=>'joe@example.com')); $this->assertEquals(array(array('name'=>'joe','email'=>'joe@example.com')), $feed->getItunesOwners()); } - + public function testAddOwners() { $feed = new Writer\Feed; $feed->addItunesOwners(array(array('name'=>'joe','email'=>'joe@example.com'))); $this->assertEquals(array(array('name'=>'joe','email'=>'joe@example.com')), $feed->getItunesOwners()); } - + public function testSetSubtitle() { $feed = new Writer\Feed; $feed->setItunesSubtitle('abc'); $this->assertEquals('abc', $feed->getItunesSubtitle()); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ @@ -284,14 +284,14 @@ public function testSetSubtitleThrowsExceptionWhenValueExceeds255Chars() $feed = new Writer\Feed; $feed->setItunesSubtitle(str_repeat('a', 256)); } - + public function testSetSummary() { $feed = new Writer\Feed; $feed->setItunesSummary('abc'); $this->assertEquals('abc', $feed->getItunesSummary()); } - + /** * @expectedException Zend\Feed\Writer\Exception\ExceptionInterface */ From 7b5fe370e129db543be2cdb7c283a2138f0c24f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michae=CC=88l=20Gallego?= Date: Mon, 23 Jul 2012 19:28:04 +0200 Subject: [PATCH 228/238] Fix CS --- src/Writer/Feed.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Writer/Feed.php b/src/Writer/Feed.php index 79e45056..743ae3b7 100644 --- a/src/Writer/Feed.php +++ b/src/Writer/Feed.php @@ -17,7 +17,7 @@ /** * @category Zend -* @package Zend\Feed\Writer +* @package Zend_Feed_Writer */ class Feed extends AbstractFeed implements Iterator, Countable { From a888d45e85e13e4ebcd4b45aaf3957a58b267901 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Mon, 23 Jul 2012 22:26:18 -0500 Subject: [PATCH 229/238] [zen-77] Refactored Zend\Feed\Reader to use AbstractPluginManager - Created ExtensionManager - Refactored extensions to use setter injection instead of constructor injection - Removed all usage of plugin loaders --- src/Reader/AbstractFeed.php | 82 +++---- src/Reader/Entry/AbstractEntry.php | 64 +++--- src/Reader/Entry/Atom.php | 142 ++++++------ src/Reader/Entry/Rss.php | 179 ++++++++------- src/Reader/Extension/AbstractEntry.php | 130 +++++++---- src/Reader/Extension/AbstractFeed.php | 84 ++++--- src/Reader/Extension/Atom/Entry.php | 154 ++++++------- src/Reader/Extension/Atom/Feed.php | 192 ++++++++-------- src/Reader/Extension/Content/Entry.php | 8 +- src/Reader/Extension/DublinCore/Entry.php | 82 +++---- src/Reader/Extension/DublinCore/Feed.php | 106 ++++----- src/Reader/Extension/Podcast/Entry.php | 74 +++--- src/Reader/Extension/Podcast/Feed.php | 106 ++++----- src/Reader/Extension/Slash/Entry.php | 36 +-- src/Reader/Extension/Thread/Entry.php | 16 +- src/Reader/Extension/WellFormedWeb/Entry.php | 12 +- src/Reader/ExtensionManager.php | 81 +++++++ src/Reader/Feed/AbstractFeed.php | 86 +++---- src/Reader/Feed/Atom.php | 156 +++++++------ src/Reader/Feed/Atom/Source.php | 31 ++- src/Reader/Feed/Rss.php | 213 +++++++++--------- src/Reader/Reader.php | 137 ++++------- test/Reader/ReaderTest.php | 14 +- .../_files/My/Extension/JungleBooks/Entry.php | 14 +- .../_files/My/Extension/JungleBooks/Feed.php | 14 +- 25 files changed, 1167 insertions(+), 1046 deletions(-) create mode 100644 src/Reader/ExtensionManager.php diff --git a/src/Reader/AbstractFeed.php b/src/Reader/AbstractFeed.php index ee6b6a4f..aee38599 100644 --- a/src/Reader/AbstractFeed.php +++ b/src/Reader/AbstractFeed.php @@ -25,49 +25,49 @@ abstract class AbstractFeed implements Feed\FeedInterface * * @var array */ - protected $_data = array(); + protected $data = array(); /** * Parsed feed data in the shape of a DOMDocument * * @var DOMDocument */ - protected $_domDocument = null; + protected $domDocument = null; /** * An array of parsed feed entries * * @var array */ - protected $_entries = array(); + protected $entries = array(); /** * A pointer for the iterator to keep track of the entries array * * @var int */ - protected $_entriesKey = 0; + protected $entriesKey = 0; /** * The base XPath query used to retrieve feed data * * @var DOMXPath */ - protected $_xpath = null; + protected $xpath = null; /** * Array of loaded extensions * * @var array */ - protected $_extensions = array(); + protected $extensions = array(); /** * Original Source URI (set if imported from a URI) * * @var string */ - protected $_originalSourceUri = null; + protected $originalSourceUri = null; /** * Constructor @@ -77,17 +77,17 @@ abstract class AbstractFeed implements Feed\FeedInterface */ public function __construct(DOMDocument $domDocument, $type = null) { - $this->_domDocument = $domDocument; - $this->_xpath = new DOMXPath($this->_domDocument); + $this->domDocument = $domDocument; + $this->xpath = new DOMXPath($this->domDocument); if ($type !== null) { - $this->_data['type'] = $type; + $this->data['type'] = $type; } else { - $this->_data['type'] = Reader::detectType($this->_domDocument); + $this->data['type'] = Reader::detectType($this->domDocument); } - $this->_registerNamespaces(); - $this->_indexEntries(); - $this->_loadExtensions(); + $this->registerNamespaces(); + $this->indexEntries(); + $this->loadExtensions(); } /** @@ -99,7 +99,7 @@ public function __construct(DOMDocument $domDocument, $type = null) */ public function setOriginalSourceUri($uri) { - $this->_originalSourceUri = $uri; + $this->originalSourceUri = $uri; } /** @@ -110,7 +110,7 @@ public function setOriginalSourceUri($uri) */ public function getOriginalSourceUri() { - return $this->_originalSourceUri; + return $this->originalSourceUri; } /** @@ -121,7 +121,7 @@ public function getOriginalSourceUri() */ public function count() { - return count($this->_entries); + return count($this->entries); } /** @@ -132,12 +132,12 @@ public function count() public function current() { if (substr($this->getType(), 0, 3) == 'rss') { - $reader = new Entry\RSS($this->_entries[$this->key()], $this->key(), $this->getType()); + $reader = new Entry\RSS($this->entries[$this->key()], $this->key(), $this->getType()); } else { - $reader = new Entry\Atom($this->_entries[$this->key()], $this->key(), $this->getType()); + $reader = new Entry\Atom($this->entries[$this->key()], $this->key(), $this->getType()); } - $reader->setXpath($this->_xpath); + $reader->setXpath($this->xpath); return $reader; } @@ -149,7 +149,7 @@ public function current() */ public function getDomDocument() { - return $this->_domDocument; + return $this->domDocument; } /** @@ -193,7 +193,7 @@ public function getElement() */ public function getXpath() { - return $this->_xpath; + return $this->xpath; } /** @@ -203,7 +203,7 @@ public function getXpath() */ public function getType() { - return $this->_data['type']; + return $this->data['type']; } /** @@ -213,7 +213,7 @@ public function getType() */ public function key() { - return $this->_entriesKey; + return $this->entriesKey; } /** @@ -222,7 +222,7 @@ public function key() */ public function next() { - ++$this->_entriesKey; + ++$this->entriesKey; } /** @@ -231,7 +231,7 @@ public function next() */ public function rewind() { - $this->_entriesKey = 0; + $this->entriesKey = 0; } /** @@ -241,17 +241,17 @@ public function rewind() */ public function valid() { - return 0 <= $this->_entriesKey && $this->_entriesKey < $this->count(); + return 0 <= $this->entriesKey && $this->entriesKey < $this->count(); } public function getExtensions() { - return $this->_extensions; + return $this->extensions; } public function __call($method, $args) { - foreach ($this->_extensions as $extension) { + foreach ($this->extensions as $extension) { if (method_exists($extension, $method)) { return call_user_func_array(array($extension, $method), $args); } @@ -268,24 +268,26 @@ public function __call($method, $args) */ public function getExtension($name) { - if (array_key_exists($name . '\Feed', $this->_extensions)) { - return $this->_extensions[$name . '\Feed']; + if (array_key_exists($name . '\Feed', $this->extensions)) { + return $this->extensions[$name . '\Feed']; } return null; } - protected function _loadExtensions() + protected function loadExtensions() { - $all = Reader::getExtensions(); - $feed = $all['feed']; + $all = Reader::getExtensions(); + $manager = Reader::getExtensionManager(); + $feed = $all['feed']; foreach ($feed as $extension) { if (in_array($extension, $all['core'])) { continue; } - $className = Reader::getPluginLoader()->getClassName($extension); - $this->_extensions[$extension] = new $className( - $this->getDomDocument(), $this->_data['type'], $this->_xpath - ); + $plugin = $manager->get($extension); + $plugin->setDomDocument($this->getDomDocument()); + $plugin->setType($this->data['type']); + $plugin->setXpath($this->xpath); + $this->extensions[$extension] = $plugin; } } @@ -293,11 +295,11 @@ protected function _loadExtensions() * Read all entries to the internal entries array * */ - abstract protected function _indexEntries(); + abstract protected function indexEntries(); /** * Register the default namespaces for the current feed format * */ - abstract protected function _registerNamespaces(); + abstract protected function registerNamespaces(); } diff --git a/src/Reader/Entry/AbstractEntry.php b/src/Reader/Entry/AbstractEntry.php index 7448c226..bfa38acf 100644 --- a/src/Reader/Entry/AbstractEntry.php +++ b/src/Reader/Entry/AbstractEntry.php @@ -27,42 +27,42 @@ abstract class AbstractEntry * * @var array */ - protected $_data = array(); + protected $data = array(); /** * DOM document object * * @var DOMDocument */ - protected $_domDocument = null; + protected $domDocument = null; /** * Entry instance * * @var Zend_Feed_Entry_Interface */ - protected $_entry = null; + protected $entry = null; /** * Pointer to the current entry * * @var int */ - protected $_entryKey = 0; + protected $entryKey = 0; /** * XPath object * * @var DOMXPath */ - protected $_xpath = null; + protected $xpath = null; /** * Registered extensions * * @var array */ - protected $_extensions = array(); + protected $extensions = array(); /** * Constructor @@ -74,17 +74,17 @@ abstract class AbstractEntry */ public function __construct(DOMElement $entry, $entryKey, $type = null) { - $this->_entry = $entry; - $this->_entryKey = $entryKey; - $this->_domDocument = $entry->ownerDocument; + $this->entry = $entry; + $this->entryKey = $entryKey; + $this->domDocument = $entry->ownerDocument; if ($type !== null) { - $this->_data['type'] = $type; - } elseif ($this->_domDocument !== null) { - $this->_data['type'] = Reader\Reader::detectType($this->_domDocument); + $this->data['type'] = $type; + } elseif ($this->domDocument !== null) { + $this->data['type'] = Reader\Reader::detectType($this->domDocument); } else { - $this->_data['type'] = Reader\Reader::TYPE_ANY; + $this->data['type'] = Reader\Reader::TYPE_ANY; } - $this->_loadExtensions(); + $this->loadExtensions(); } /** @@ -94,7 +94,7 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) */ public function getDomDocument() { - return $this->_domDocument; + return $this->domDocument; } /** @@ -104,7 +104,7 @@ public function getDomDocument() */ public function getElement() { - return $this->_entry; + return $this->entry; } /** @@ -141,7 +141,7 @@ public function saveXml() */ public function getType() { - return $this->_data['type']; + return $this->data['type']; } /** @@ -151,10 +151,10 @@ public function getType() */ public function getXpath() { - if (!$this->_xpath) { + if (!$this->xpath) { $this->setXpath(new DOMXPath($this->getDomDocument())); } - return $this->_xpath; + return $this->xpath; } /** @@ -165,7 +165,7 @@ public function getXpath() */ public function setXpath(DOMXPath $xpath) { - $this->_xpath = $xpath; + $this->xpath = $xpath; return $this; } @@ -176,7 +176,7 @@ public function setXpath(DOMXPath $xpath) */ public function getExtensions() { - return $this->_extensions; + return $this->extensions; } /** @@ -187,8 +187,8 @@ public function getExtensions() */ public function getExtension($name) { - if (array_key_exists($name . '\\Entry', $this->_extensions)) { - return $this->_extensions[$name . '\\Entry']; + if (array_key_exists($name . '\\Entry', $this->extensions)) { + return $this->extensions[$name . '\\Entry']; } return null; } @@ -203,7 +203,7 @@ public function getExtension($name) */ public function __call($method, $args) { - foreach ($this->_extensions as $extension) { + foreach ($this->extensions as $extension) { if (method_exists($extension, $method)) { return call_user_func_array(array($extension, $method), $args); } @@ -217,18 +217,20 @@ public function __call($method, $args) * * @return void */ - protected function _loadExtensions() + protected function loadExtensions() { - $all = Reader\Reader::getExtensions(); - $feed = $all['entry']; + $all = Reader\Reader::getExtensions(); + $manager = Reader\Reader::getExtensionManager(); + $feed = $all['entry']; foreach ($feed as $extension) { if (in_array($extension, $all['core'])) { continue; } - $className = Reader\Reader::getPluginLoader()->getClassName($extension); - $this->_extensions[$extension] = new $className( - $this->getElement(), $this->_entryKey, $this->_data['type'] - ); + $plugin = $manager->get($extension); + $plugin->setEntryElement($this->getElement()); + $plugin->setEntryKey($this->entryKey); + $plugin->setType($this->data['type']); + $this->extensions[$extension] = $plugin; } } } diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index 7e499181..a774c1b9 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -25,7 +25,7 @@ class Atom extends AbstractEntry implements EntryInterface * * @var string */ - protected $_xpathQuery = ''; + protected $xpathQuery = ''; /** * Constructor @@ -40,16 +40,18 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) parent::__construct($entry, $entryKey, $type); // Everyone by now should know XPath indices start from 1 not 0 - $this->_xpathQuery = '//atom:entry[' . ($this->_entryKey + 1) . ']'; + $this->xpathQuery = '//atom:entry[' . ($this->entryKey + 1) . ']'; - $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\\Entry'); - $this->_extensions['Atom\\Entry'] = new $atomClass($entry, $entryKey, $type); + $manager = Reader\Reader::getExtensionManager(); + $extensions = array('Atom\Entry', 'Thread\Entry', 'DublinCore\Entry'); - $threadClass = Reader\Reader::getPluginLoader()->getClassName('Thread\\Entry'); - $this->_extensions['Thread\\Entry'] = new $threadClass($entry, $entryKey, $type); - - $threadClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\\Entry'); - $this->_extensions['DublinCore\\Entry'] = new $threadClass($entry, $entryKey, $type); + foreach ($extensions as $name) { + $extension = $manager->get($name); + $extension->setEntryElement($entry); + $extension->setEntryKey($entryKey); + $extension->setType($type); + $this->extensions[$name] = $extension; + } } /** @@ -76,15 +78,15 @@ public function getAuthor($index = 0) */ public function getAuthors() { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; + if (array_key_exists('authors', $this->data)) { + return $this->data['authors']; } $people = $this->getExtension('Atom')->getAuthors(); - $this->_data['authors'] = $people; + $this->data['authors'] = $people; - return $this->_data['authors']; + return $this->data['authors']; } /** @@ -94,15 +96,15 @@ public function getAuthors() */ public function getContent() { - if (array_key_exists('content', $this->_data)) { - return $this->_data['content']; + if (array_key_exists('content', $this->data)) { + return $this->data['content']; } $content = $this->getExtension('Atom')->getContent(); - $this->_data['content'] = $content; + $this->data['content'] = $content; - return $this->_data['content']; + return $this->data['content']; } /** @@ -112,15 +114,15 @@ public function getContent() */ public function getDateCreated() { - if (array_key_exists('datecreated', $this->_data)) { - return $this->_data['datecreated']; + if (array_key_exists('datecreated', $this->data)) { + return $this->data['datecreated']; } $dateCreated = $this->getExtension('Atom')->getDateCreated(); - $this->_data['datecreated'] = $dateCreated; + $this->data['datecreated'] = $dateCreated; - return $this->_data['datecreated']; + return $this->data['datecreated']; } /** @@ -130,15 +132,15 @@ public function getDateCreated() */ public function getDateModified() { - if (array_key_exists('datemodified', $this->_data)) { - return $this->_data['datemodified']; + if (array_key_exists('datemodified', $this->data)) { + return $this->data['datemodified']; } $dateModified = $this->getExtension('Atom')->getDateModified(); - $this->_data['datemodified'] = $dateModified; + $this->data['datemodified'] = $dateModified; - return $this->_data['datemodified']; + return $this->data['datemodified']; } /** @@ -148,15 +150,15 @@ public function getDateModified() */ public function getDescription() { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; + if (array_key_exists('description', $this->data)) { + return $this->data['description']; } $description = $this->getExtension('Atom')->getDescription(); - $this->_data['description'] = $description; + $this->data['description'] = $description; - return $this->_data['description']; + return $this->data['description']; } /** @@ -166,15 +168,15 @@ public function getDescription() */ public function getEnclosure() { - if (array_key_exists('enclosure', $this->_data)) { - return $this->_data['enclosure']; + if (array_key_exists('enclosure', $this->data)) { + return $this->data['enclosure']; } $enclosure = $this->getExtension('Atom')->getEnclosure(); - $this->_data['enclosure'] = $enclosure; + $this->data['enclosure'] = $enclosure; - return $this->_data['enclosure']; + return $this->data['enclosure']; } /** @@ -184,15 +186,15 @@ public function getEnclosure() */ public function getId() { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; + if (array_key_exists('id', $this->data)) { + return $this->data['id']; } $id = $this->getExtension('Atom')->getId(); - $this->_data['id'] = $id; + $this->data['id'] = $id; - return $this->_data['id']; + return $this->data['id']; } /** @@ -203,12 +205,12 @@ public function getId() */ public function getLink($index = 0) { - if (!array_key_exists('links', $this->_data)) { + if (!array_key_exists('links', $this->data)) { $this->getLinks(); } - if (isset($this->_data['links'][$index])) { - return $this->_data['links'][$index]; + if (isset($this->data['links'][$index])) { + return $this->data['links'][$index]; } return null; @@ -221,15 +223,15 @@ public function getLink($index = 0) */ public function getLinks() { - if (array_key_exists('links', $this->_data)) { - return $this->_data['links']; + if (array_key_exists('links', $this->data)) { + return $this->data['links']; } $links = $this->getExtension('Atom')->getLinks(); - $this->_data['links'] = $links; + $this->data['links'] = $links; - return $this->_data['links']; + return $this->data['links']; } /** @@ -249,15 +251,15 @@ public function getPermalink() */ public function getTitle() { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; + if (array_key_exists('title', $this->data)) { + return $this->data['title']; } $title = $this->getExtension('Atom')->getTitle(); - $this->_data['title'] = $title; + $this->data['title'] = $title; - return $this->_data['title']; + return $this->data['title']; } /** @@ -267,8 +269,8 @@ public function getTitle() */ public function getCommentCount() { - if (array_key_exists('commentcount', $this->_data)) { - return $this->_data['commentcount']; + if (array_key_exists('commentcount', $this->data)) { + return $this->data['commentcount']; } $commentcount = $this->getExtension('Thread')->getCommentCount(); @@ -277,9 +279,9 @@ public function getCommentCount() $commentcount = $this->getExtension('Atom')->getCommentCount(); } - $this->_data['commentcount'] = $commentcount; + $this->data['commentcount'] = $commentcount; - return $this->_data['commentcount']; + return $this->data['commentcount']; } /** @@ -289,15 +291,15 @@ public function getCommentCount() */ public function getCommentLink() { - if (array_key_exists('commentlink', $this->_data)) { - return $this->_data['commentlink']; + if (array_key_exists('commentlink', $this->data)) { + return $this->data['commentlink']; } $commentlink = $this->getExtension('Atom')->getCommentLink(); - $this->_data['commentlink'] = $commentlink; + $this->data['commentlink'] = $commentlink; - return $this->_data['commentlink']; + return $this->data['commentlink']; } /** @@ -307,15 +309,15 @@ public function getCommentLink() */ public function getCommentFeedLink() { - if (array_key_exists('commentfeedlink', $this->_data)) { - return $this->_data['commentfeedlink']; + if (array_key_exists('commentfeedlink', $this->data)) { + return $this->data['commentfeedlink']; } $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink(); - $this->_data['commentfeedlink'] = $commentfeedlink; + $this->data['commentfeedlink'] = $commentfeedlink; - return $this->_data['commentfeedlink']; + return $this->data['commentfeedlink']; } /** @@ -325,8 +327,8 @@ public function getCommentFeedLink() */ public function getCategories() { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; + if (array_key_exists('categories', $this->data)) { + return $this->data['categories']; } $categoryCollection = $this->getExtension('Atom')->getCategories(); @@ -335,9 +337,9 @@ public function getCategories() $categoryCollection = $this->getExtension('DublinCore')->getCategories(); } - $this->_data['categories'] = $categoryCollection; + $this->data['categories'] = $categoryCollection; - return $this->_data['categories']; + return $this->data['categories']; } /** @@ -347,15 +349,15 @@ public function getCategories() */ public function getSource() { - if (array_key_exists('source', $this->_data)) { - return $this->_data['source']; + if (array_key_exists('source', $this->data)) { + return $this->data['source']; } $source = $this->getExtension('Atom')->getSource(); - $this->_data['source'] = $source; + $this->data['source'] = $source; - return $this->_data['source']; + return $this->data['source']; } /** @@ -367,8 +369,8 @@ public function getSource() public function setXpath(DOMXPath $xpath) { parent::setXpath($xpath); - foreach ($this->_extensions as $extension) { - $extension->setXpath($this->_xpath); + foreach ($this->extensions as $extension) { + $extension->setXpath($this->xpath); } } } diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index 3adc8955..7d54cea4 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -28,14 +28,14 @@ class Rss extends AbstractEntry implements EntryInterface * * @var string */ - protected $_xpathQueryRdf = ''; + protected $xpathQueryRdf = ''; /** * XPath query for RSS * * @var string */ - protected $_xpathQueryRss = ''; + protected $xpathQueryRss = ''; /** * Constructor @@ -48,28 +48,25 @@ class Rss extends AbstractEntry implements EntryInterface public function __construct(DOMElement $entry, $entryKey, $type = null) { parent::__construct($entry, $entryKey, $type); - $this->_xpathQueryRss = '//item[' . ($this->_entryKey+1) . ']'; - $this->_xpathQueryRdf = '//rss:item[' . ($this->_entryKey+1) . ']'; - - $pluginLoader = Reader\Reader::getPluginLoader(); - - $dublinCoreClass = $pluginLoader->getClassName('DublinCore\\Entry'); - $this->_extensions['DublinCore\\Entry'] = new $dublinCoreClass($entry, $entryKey, $type); - - $contentClass = $pluginLoader->getClassName('Content\\Entry'); - $this->_extensions['Content\\Entry'] = new $contentClass($entry, $entryKey, $type); - - $atomClass = $pluginLoader->getClassName('Atom\\Entry'); - $this->_extensions['Atom\\Entry'] = new $atomClass($entry, $entryKey, $type); - - $wfwClass = $pluginLoader->getClassName('WellFormedWeb\\Entry'); - $this->_extensions['WellFormedWeb\\Entry'] = new $wfwClass($entry, $entryKey, $type); - - $slashClass = $pluginLoader->getClassName('Slash\\Entry'); - $this->_extensions['Slash\\Entry'] = new $slashClass($entry, $entryKey, $type); - - $threadClass = $pluginLoader->getClassName('Thread\\Entry'); - $this->_extensions['Thread\\Entry'] = new $threadClass($entry, $entryKey, $type); + $this->xpathQueryRss = '//item[' . ($this->entryKey+1) . ']'; + $this->xpathQueryRdf = '//rss:item[' . ($this->entryKey+1) . ']'; + + $manager = Reader\Reader::getExtensionManager(); + $extensions = array( + 'DublinCore\Entry', + 'Content\Entry', + 'Atom\Entry', + 'WellFormedWeb\Entry', + 'Slash\Entry', + 'Thread\Entry', + ); + foreach ($extensions as $name) { + $extension = $manager->get($name); + $extension->setEntryElement($entry); + $extension->setEntryKey($entryKey); + $extension->setType($type); + $this->extensions[$name] = $extension; + } } /** @@ -96,8 +93,8 @@ public function getAuthor($index = 0) */ public function getAuthors() { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; + if (array_key_exists('authors', $this->data)) { + return $this->data['authors']; } $authors = array(); @@ -112,9 +109,9 @@ public function getAuthors() if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $list = $this->_xpath->query($this->_xpathQueryRss . '//author'); + $list = $this->xpath->query($this->xpathQueryRss . '//author'); } else { - $list = $this->_xpath->query($this->_xpathQueryRdf . '//rss:author'); + $list = $this->xpath->query($this->xpathQueryRdf . '//rss:author'); } if ($list->length) { foreach ($list as $author) { @@ -145,9 +142,9 @@ public function getAuthors() $authors = null; } - $this->_data['authors'] = $authors; + $this->data['authors'] = $authors; - return $this->_data['authors']; + return $this->data['authors']; } /** @@ -157,8 +154,8 @@ public function getAuthors() */ public function getContent() { - if (array_key_exists('content', $this->_data)) { - return $this->_data['content']; + if (array_key_exists('content', $this->data)) { + return $this->data['content']; } $content = $this->getExtension('Content')->getContent(); @@ -171,9 +168,9 @@ public function getContent() $content = $this->getExtension('Atom')->getContent(); } - $this->_data['content'] = $content; + $this->data['content'] = $content; - return $this->_data['content']; + return $this->data['content']; } /** @@ -193,8 +190,8 @@ public function getDateCreated() */ public function getDateModified() { - if (array_key_exists('datemodified', $this->_data)) { - return $this->_data['datemodified']; + if (array_key_exists('datemodified', $this->data)) { + return $this->data['datemodified']; } $dateModified = null; @@ -203,7 +200,7 @@ public function getDateModified() if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { - $dateModified = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/pubDate)'); + $dateModified = $this->xpath->evaluate('string('.$this->xpathQueryRss.'/pubDate)'); if ($dateModified) { $dateModifiedParsed = strtotime($dateModified); if ($dateModifiedParsed) { @@ -242,9 +239,9 @@ public function getDateModified() $date = null; } - $this->_data['datemodified'] = $date; + $this->data['datemodified'] = $date; - return $this->_data['datemodified']; + return $this->data['datemodified']; } /** @@ -254,8 +251,8 @@ public function getDateModified() */ public function getDescription() { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; + if (array_key_exists('description', $this->data)) { + return $this->data['description']; } $description = null; @@ -263,9 +260,9 @@ public function getDescription() if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { - $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/description)'); + $description = $this->xpath->evaluate('string('.$this->xpathQueryRss.'/description)'); } else { - $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRdf.'/rss:description)'); + $description = $this->xpath->evaluate('string('.$this->xpathQueryRdf.'/rss:description)'); } if (!$description) { @@ -280,9 +277,9 @@ public function getDescription() $description = null; } - $this->_data['description'] = $description; + $this->data['description'] = $description; - return $this->_data['description']; + return $this->data['description']; } /** @@ -291,14 +288,14 @@ public function getDescription() */ public function getEnclosure() { - if (array_key_exists('enclosure', $this->_data)) { - return $this->_data['enclosure']; + if (array_key_exists('enclosure', $this->data)) { + return $this->data['enclosure']; } $enclosure = null; if ($this->getType() == Reader\Reader::TYPE_RSS_20) { - $nodeList = $this->_xpath->query($this->_xpathQueryRss . '/enclosure'); + $nodeList = $this->xpath->query($this->xpathQueryRss . '/enclosure'); if ($nodeList->length > 0) { $enclosure = new \stdClass(); @@ -312,9 +309,9 @@ public function getEnclosure() $enclosure = $this->getExtension('Atom')->getEnclosure(); } - $this->_data['enclosure'] = $enclosure; + $this->data['enclosure'] = $enclosure; - return $this->_data['enclosure']; + return $this->data['enclosure']; } /** @@ -324,8 +321,8 @@ public function getEnclosure() */ public function getId() { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; + if (array_key_exists('id', $this->data)) { + return $this->data['id']; } $id = null; @@ -333,7 +330,7 @@ public function getId() if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { - $id = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/guid)'); + $id = $this->xpath->evaluate('string('.$this->xpathQueryRss.'/guid)'); } if (!$id) { @@ -354,9 +351,9 @@ public function getId() } } - $this->_data['id'] = $id; + $this->data['id'] = $id; - return $this->_data['id']; + return $this->data['id']; } /** @@ -367,12 +364,12 @@ public function getId() */ public function getLink($index = 0) { - if (!array_key_exists('links', $this->_data)) { + if (!array_key_exists('links', $this->data)) { $this->getLinks(); } - if (isset($this->_data['links'][$index])) { - return $this->_data['links'][$index]; + if (isset($this->data['links'][$index])) { + return $this->data['links'][$index]; } return null; @@ -385,17 +382,17 @@ public function getLink($index = 0) */ public function getLinks() { - if (array_key_exists('links', $this->_data)) { - return $this->_data['links']; + if (array_key_exists('links', $this->data)) { + return $this->data['links']; } $links = array(); if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $list = $this->_xpath->query($this->_xpathQueryRss.'//link'); + $list = $this->xpath->query($this->xpathQueryRss.'//link'); } else { - $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:link'); + $list = $this->xpath->query($this->xpathQueryRdf.'//rss:link'); } if (!$list->length) { @@ -406,9 +403,9 @@ public function getLinks() } } - $this->_data['links'] = $links; + $this->data['links'] = $links; - return $this->_data['links']; + return $this->data['links']; } /** @@ -418,15 +415,15 @@ public function getLinks() */ public function getCategories() { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; + if (array_key_exists('categories', $this->data)) { + return $this->data['categories']; } if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $list = $this->_xpath->query($this->_xpathQueryRss.'//category'); + $list = $this->xpath->query($this->xpathQueryRss.'//category'); } else { - $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:category'); + $list = $this->xpath->query($this->xpathQueryRdf.'//rss:category'); } if ($list->length) { @@ -446,9 +443,9 @@ public function getCategories() $categoryCollection = $this->getExtension('Atom')->getCategories(); } - $this->_data['categories'] = $categoryCollection; + $this->data['categories'] = $categoryCollection; - return $this->_data['categories']; + return $this->data['categories']; } /** @@ -468,8 +465,8 @@ public function getPermalink() */ public function getTitle() { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; + if (array_key_exists('title', $this->data)) { + return $this->data['title']; } $title = null; @@ -477,9 +474,9 @@ public function getTitle() if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { - $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/title)'); + $title = $this->xpath->evaluate('string('.$this->xpathQueryRss.'/title)'); } else { - $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRdf.'/rss:title)'); + $title = $this->xpath->evaluate('string('.$this->xpathQueryRdf.'/rss:title)'); } if (!$title) { @@ -494,9 +491,9 @@ public function getTitle() $title = null; } - $this->_data['title'] = $title; + $this->data['title'] = $title; - return $this->_data['title']; + return $this->data['title']; } /** @@ -506,8 +503,8 @@ public function getTitle() */ public function getCommentCount() { - if (array_key_exists('commentcount', $this->_data)) { - return $this->_data['commentcount']; + if (array_key_exists('commentcount', $this->data)) { + return $this->data['commentcount']; } $commentcount = $this->getExtension('Slash')->getCommentCount(); @@ -524,9 +521,9 @@ public function getCommentCount() $commentcount = null; } - $this->_data['commentcount'] = $commentcount; + $this->data['commentcount'] = $commentcount; - return $this->_data['commentcount']; + return $this->data['commentcount']; } /** @@ -536,8 +533,8 @@ public function getCommentCount() */ public function getCommentLink() { - if (array_key_exists('commentlink', $this->_data)) { - return $this->_data['commentlink']; + if (array_key_exists('commentlink', $this->data)) { + return $this->data['commentlink']; } $commentlink = null; @@ -545,7 +542,7 @@ public function getCommentLink() if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { - $commentlink = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/comments)'); + $commentlink = $this->xpath->evaluate('string('.$this->xpathQueryRss.'/comments)'); } if (!$commentlink) { @@ -556,9 +553,9 @@ public function getCommentLink() $commentlink = null; } - $this->_data['commentlink'] = $commentlink; + $this->data['commentlink'] = $commentlink; - return $this->_data['commentlink']; + return $this->data['commentlink']; } /** @@ -568,8 +565,8 @@ public function getCommentLink() */ public function getCommentFeedLink() { - if (array_key_exists('commentfeedlink', $this->_data)) { - return $this->_data['commentfeedlink']; + if (array_key_exists('commentfeedlink', $this->data)) { + return $this->data['commentfeedlink']; } $commentfeedlink = $this->getExtension('WellFormedWeb')->getCommentFeedLink(); @@ -586,9 +583,9 @@ public function getCommentFeedLink() $commentfeedlink = null; } - $this->_data['commentfeedlink'] = $commentfeedlink; + $this->data['commentfeedlink'] = $commentfeedlink; - return $this->_data['commentfeedlink']; + return $this->data['commentfeedlink']; } /** @@ -600,8 +597,8 @@ public function getCommentFeedLink() public function setXpath(DOMXPath $xpath) { parent::setXpath($xpath); - foreach ($this->_extensions as $extension) { - $extension->setXpath($this->_xpath); + foreach ($this->extensions as $extension) { + $extension->setXpath($this->xpath); } } } diff --git a/src/Reader/Extension/AbstractEntry.php b/src/Reader/Extension/AbstractEntry.php index fdddb416..00571dc4 100644 --- a/src/Reader/Extension/AbstractEntry.php +++ b/src/Reader/Extension/AbstractEntry.php @@ -26,74 +26,78 @@ abstract class AbstractEntry * * @var array */ - protected $_data = array(); + protected $data = array(); /** * DOM document object * * @var DOMDocument */ - protected $_domDocument = null; + protected $domDocument = null; /** * Entry instance * * @var Zend_Feed_Entry_Abstract */ - protected $_entry = null; + protected $entry = null; /** * Pointer to the current entry * * @var int */ - protected $_entryKey = 0; + protected $entryKey = 0; /** * XPath object * * @var DOMXPath */ - protected $_xpath = null; + protected $xpath = null; /** * XPath query * * @var string */ - protected $_xpathPrefix = ''; + protected $xpathPrefix = ''; /** - * Constructor + * Set the entry DOMElement * - * @param Zend_Feed_Entry_Abstract $entry - * @param int $entryKey - * @param string $type - * @return void + * Has side effect of setting the DOMDocument for the entry. + * + * @param DOMElement $entry + * @return AbstractEntry */ - public function __construct(DOMElement $entry, $entryKey, $type = null) + public function setEntryElement(DOMElement $entry) { - $this->_entry = $entry; - $this->_entryKey = $entryKey; - $this->_domDocument = $entry->ownerDocument; - - if ($type !== null) { - $this->_data['type'] = $type; - } else { - $this->_data['type'] = Reader\Reader::detectType($entry->ownerDocument, true); - } - // set the XPath query prefix for the entry being queried - if ($this->getType() == Reader\Reader::TYPE_RSS_10 - || $this->getType() == Reader\Reader::TYPE_RSS_090 - ) { - $this->setXpathPrefix('//rss:item[' . ($this->_entryKey+1) . ']'); - } elseif ($this->getType() == Reader\Reader::TYPE_ATOM_10 - || $this->getType() == Reader\Reader::TYPE_ATOM_03 - ) { - $this->setXpathPrefix('//atom:entry[' . ($this->_entryKey+1) . ']'); - } else { - $this->setXpathPrefix('//item[' . ($this->_entryKey+1) . ']'); - } + $this->entry = $entry; + $this->domDocument = $entry->ownerDocument; + return $this; + } + + /** + * Get the entry DOMElement + * + * @return DOMElement + */ + public function getEntryElement() + { + return $this->entry; + } + + /** + * Set the entry key + * + * @param string $entryKey + * @return AbstractEntry + */ + public function setEntryKey($entryKey) + { + $this->entryKey = $entryKey; + return $this; } /** @@ -103,7 +107,7 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) */ public function getDomDocument() { - return $this->_domDocument; + return $this->domDocument; } /** @@ -117,6 +121,40 @@ public function getEncoding() return $assumed; } + /** + * Set the entry type + * + * Has side effect of setting xpath prefix + * + * @param string $type + * @return AbstractEntry + */ + public function setType($type) + { + if (null === $type) { + $this->data['type'] = null; + return $this; + } + + $this->data['type'] = $type; + if ($type === Reader\Reader::TYPE_RSS_10 + || $type === Reader\Reader::TYPE_RSS_090 + ) { + $this->setXpathPrefix('//rss:item[' . ($this->entryKey + 1) . ']'); + return $this; + } + + if ($type === Reader\Reader::TYPE_ATOM_10 + || $type === Reader\Reader::TYPE_ATOM_03 + ) { + $this->setXpathPrefix('//atom:entry[' . ($this->entryKey + 1) . ']'); + return $this; + } + + $this->setXpathPrefix('//item[' . ($this->entryKey + 1) . ']'); + return $this; + } + /** * Get the entry type * @@ -124,7 +162,13 @@ public function getEncoding() */ public function getType() { - return $this->_data['type']; + $type = $this->data['type']; + if ($type === null) { + $type = Reader\Reader::detectType($this->getEntryElement(), true); + $this->setType($type); + } + + return $type; } /** @@ -135,8 +179,8 @@ public function getType() */ public function setXpath(DOMXPath $xpath) { - $this->_xpath = $xpath; - $this->_registerNamespaces(); + $this->xpath = $xpath; + $this->registerNamespaces(); return $this; } @@ -147,10 +191,10 @@ public function setXpath(DOMXPath $xpath) */ public function getXpath() { - if (!$this->_xpath) { + if (!$this->xpath) { $this->setXpath(new DOMXPath($this->getDomDocument())); } - return $this->_xpath; + return $this->xpath; } /** @@ -160,7 +204,7 @@ public function getXpath() */ public function toArray() { - return $this->_data; + return $this->data; } /** @@ -170,7 +214,7 @@ public function toArray() */ public function getXpathPrefix() { - return $this->_xpathPrefix; + return $this->xpathPrefix; } /** @@ -181,7 +225,7 @@ public function getXpathPrefix() */ public function setXpathPrefix($prefix) { - $this->_xpathPrefix = $prefix; + $this->xpathPrefix = $prefix; return $this; } @@ -190,5 +234,5 @@ public function setXpathPrefix($prefix) * * @return void */ - abstract protected function _registerNamespaces(); + abstract protected function registerNamespaces(); } diff --git a/src/Reader/Extension/AbstractFeed.php b/src/Reader/Extension/AbstractFeed.php index c219836f..c6cb7311 100644 --- a/src/Reader/Extension/AbstractFeed.php +++ b/src/Reader/Extension/AbstractFeed.php @@ -25,53 +25,39 @@ abstract class AbstractFeed * * @var array */ - protected $_data = array(); + protected $data = array(); /** * Parsed feed data in the shape of a DOMDocument * * @var DOMDocument */ - protected $_domDocument = null; + protected $domDocument = null; /** * The base XPath query used to retrieve feed data * * @var DOMXPath */ - protected $_xpath = null; + protected $xpath = null; /** * The XPath prefix * * @var string */ - protected $_xpathPrefix = ''; + protected $xpathPrefix = ''; /** - * Constructor - * - * @param Zend_Feed_Abstract $feed The source Zend_Feed object - * @param string $type Feed type - * @return void + * Set the DOM document + * + * @param DOMDocument $dom + * @return AbstractFeed */ - public function __construct(DOMDocument $dom, $type = null, DOMXPath $xpath = null) + public function setDomDocument(DOMDocument $dom) { - $this->_domDocument = $dom; - - if ($type !== null) { - $this->_data['type'] = $type; - } else { - $this->_data['type'] = Reader\Reader::detectType($dom); - } - - if ($xpath !== null) { - $this->_xpath = $xpath; - } else { - $this->_xpath = new DOMXPath($this->_domDocument); - } - - $this->_registerNamespaces(); + $this->domDocument = $dom; + return $this; } /** @@ -81,7 +67,7 @@ public function __construct(DOMDocument $dom, $type = null, DOMXPath $xpath = nu */ public function getDomDocument() { - return $this->_domDocument; + return $this->domDocument; } /** @@ -95,14 +81,33 @@ public function getEncoding() return $assumed; } + /** + * Set the feed type + * + * @param string $type + * @return AbstractFeed + */ + public function setType($type) + { + $this->data['type'] = $type; + return $this; + } + /** * Get the feed type * + * If null, it will attempt to autodetect the type. + * * @return string */ public function getType() { - return $this->_data['type']; + $type = $this->data['type']; + if (null === $type) { + $type = Reader\Reader::detectType($this->getDomDocument()); + $this->setType($type); + } + return $type; } @@ -113,7 +118,7 @@ public function getType() */ public function toArray() // untested { - return $this->_data; + return $this->data; } /** @@ -122,10 +127,15 @@ public function toArray() // untested * @param DOMXPath $xpath * @return Reader\Reader_Extension_EntryAbstract */ - public function setXpath(DOMXPath $xpath) + public function setXpath(DOMXPath $xpath = null) { - $this->_xpath = $xpath; - $this->_registerNamespaces(); + if (null === $xpath) { + $this->xpath = null; + return $this; + } + + $this->xpath = $xpath; + $this->registerNamespaces(); return $this; } @@ -136,7 +146,11 @@ public function setXpath(DOMXPath $xpath) */ public function getXpath() { - return $this->_xpath; + if (null === $this->xpath) { + $this->setXpath(new DOMXPath($this->getDomDocument())); + } + + return $this->xpath; } /** @@ -146,7 +160,7 @@ public function getXpath() */ public function getXpathPrefix() { - return $this->_xpathPrefix; + return $this->xpathPrefix; } /** @@ -156,11 +170,11 @@ public function getXpathPrefix() */ public function setXpathPrefix($prefix) { - $this->_xpathPrefix = $prefix; + $this->xpathPrefix = $prefix; } /** * Register the default namespaces for the current feed format */ - abstract protected function _registerNamespaces(); + abstract protected function registerNamespaces(); } diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index d0be4b1f..8742f8de 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -49,8 +49,8 @@ public function getAuthor($index = 0) */ public function getAuthors() { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; + if (array_key_exists('authors', $this->data)) { + return $this->data['authors']; } $authors = array(); @@ -65,7 +65,7 @@ public function getAuthors() if ($list->length) { foreach ($list as $author) { - $author = $this->_getAuthor($author); + $author = $this->getAuthorFromElement($author); if (!empty($author)) { $authors[] = $author; } @@ -80,8 +80,8 @@ public function getAuthors() ); } - $this->_data['authors'] = $authors; - return $this->_data['authors']; + $this->data['authors'] = $authors; + return $this->data['authors']; } /** @@ -91,8 +91,8 @@ public function getAuthors() */ public function getContent() { - if (array_key_exists('content', $this->_data)) { - return $this->_data['content']; + if (array_key_exists('content', $this->data)) { + return $this->data['content']; } $content = null; @@ -117,7 +117,7 @@ public function getContent() $d = new DOMDocument('1.0', $this->getEncoding()); $xhtmls = $d->importNode($xhtml, true); $d->appendChild($xhtmls); - $content = $this->_collectXhtml( + $content = $this->collectXhtml( $d->saveXML(), $d->lookupPrefix('http://www.w3.org/1999/xhtml') ); @@ -129,9 +129,9 @@ public function getContent() $content = $this->getDescription(); } - $this->_data['content'] = trim($content); + $this->data['content'] = trim($content); - return $this->_data['content']; + return $this->data['content']; } /** @@ -141,7 +141,7 @@ public function getContent() * @param $prefix * @return mixed */ - protected function _collectXhtml($xhtml, $prefix) + protected function collectXhtml($xhtml, $prefix) { if (!empty($prefix)) $prefix = $prefix . ':'; $matches = array( @@ -162,13 +162,13 @@ protected function _collectXhtml($xhtml, $prefix) */ public function getDateCreated() { - if (array_key_exists('datecreated', $this->_data)) { - return $this->_data['datecreated']; + if (array_key_exists('datecreated', $this->data)) { + return $this->data['datecreated']; } $date = null; - if ($this->_getAtomType() === Reader\Reader::TYPE_ATOM_03) { + if ($this->getAtomType() === Reader\Reader::TYPE_ATOM_03) { $dateCreated = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:created)'); } else { $dateCreated = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:published)'); @@ -178,9 +178,9 @@ public function getDateCreated() $date = DateTime::createFromFormat(DateTime::ISO8601, $dateCreated); } - $this->_data['datecreated'] = $date; + $this->data['datecreated'] = $date; - return $this->_data['datecreated']; + return $this->data['datecreated']; } /** @@ -190,13 +190,13 @@ public function getDateCreated() */ public function getDateModified() { - if (array_key_exists('datemodified', $this->_data)) { - return $this->_data['datemodified']; + if (array_key_exists('datemodified', $this->data)) { + return $this->data['datemodified']; } $date = null; - if ($this->_getAtomType() === Reader\Reader::TYPE_ATOM_03) { + if ($this->getAtomType() === Reader\Reader::TYPE_ATOM_03) { $dateModified = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)'); } else { $dateModified = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)'); @@ -206,9 +206,9 @@ public function getDateModified() $date = DateTime::createFromFormat(DateTime::ISO8601, $dateModified); } - $this->_data['datemodified'] = $date; + $this->data['datemodified'] = $date; - return $this->_data['datemodified']; + return $this->data['datemodified']; } /** @@ -218,8 +218,8 @@ public function getDateModified() */ public function getDescription() { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; + if (array_key_exists('description', $this->data)) { + return $this->data['description']; } $description = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:summary)'); @@ -228,9 +228,9 @@ public function getDescription() $description = null; } - $this->_data['description'] = $description; + $this->data['description'] = $description; - return $this->_data['description']; + return $this->data['description']; } /** @@ -240,8 +240,8 @@ public function getDescription() */ public function getEnclosure() { - if (array_key_exists('enclosure', $this->_data)) { - return $this->_data['enclosure']; + if (array_key_exists('enclosure', $this->data)) { + return $this->data['enclosure']; } $enclosure = null; @@ -255,9 +255,9 @@ public function getEnclosure() $enclosure->type = $nodeList->item(0)->getAttribute('type'); } - $this->_data['enclosure'] = $enclosure; + $this->data['enclosure'] = $enclosure; - return $this->_data['enclosure']; + return $this->data['enclosure']; } /** @@ -267,8 +267,8 @@ public function getEnclosure() */ public function getId() { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; + if (array_key_exists('id', $this->data)) { + return $this->data['id']; } $id = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:id)'); @@ -283,9 +283,9 @@ public function getId() } } - $this->_data['id'] = $id; + $this->data['id'] = $id; - return $this->_data['id']; + return $this->data['id']; } /** @@ -295,8 +295,8 @@ public function getId() */ public function getBaseUrl() { - if (array_key_exists('baseUrl', $this->_data)) { - return $this->_data['baseUrl']; + if (array_key_exists('baseUrl', $this->data)) { + return $this->data['baseUrl']; } $baseUrl = $this->getXpath()->evaluate('string(' @@ -311,9 +311,9 @@ public function getBaseUrl() $baseUrl = null; } - $this->_data['baseUrl'] = $baseUrl; + $this->data['baseUrl'] = $baseUrl; - return $this->_data['baseUrl']; + return $this->data['baseUrl']; } /** @@ -324,12 +324,12 @@ public function getBaseUrl() */ public function getLink($index = 0) { - if (!array_key_exists('links', $this->_data)) { + if (!array_key_exists('links', $this->data)) { $this->getLinks(); } - if (isset($this->_data['links'][$index])) { - return $this->_data['links'][$index]; + if (isset($this->data['links'][$index])) { + return $this->data['links'][$index]; } return null; @@ -342,8 +342,8 @@ public function getLink($index = 0) */ public function getLinks() { - if (array_key_exists('links', $this->_data)) { - return $this->_data['links']; + if (array_key_exists('links', $this->data)) { + return $this->data['links']; } $links = array(); @@ -355,13 +355,13 @@ public function getLinks() if ($list->length) { foreach ($list as $link) { - $links[] = $this->_absolutiseUri($link->value); + $links[] = $this->absolutiseUri($link->value); } } - $this->_data['links'] = $links; + $this->data['links'] = $links; - return $this->_data['links']; + return $this->data['links']; } /** @@ -381,8 +381,8 @@ public function getPermalink() */ public function getTitle() { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; + if (array_key_exists('title', $this->data)) { + return $this->data['title']; } $title = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:title)'); @@ -391,9 +391,9 @@ public function getTitle() $title = null; } - $this->_data['title'] = $title; + $this->data['title'] = $title; - return $this->_data['title']; + return $this->data['title']; } /** @@ -403,8 +403,8 @@ public function getTitle() */ public function getCommentCount() { - if (array_key_exists('commentcount', $this->_data)) { - return $this->_data['commentcount']; + if (array_key_exists('commentcount', $this->data)) { + return $this->data['commentcount']; } $count = null; @@ -418,9 +418,9 @@ public function getCommentCount() $count = $list->item(0)->value; } - $this->_data['commentcount'] = $count; + $this->data['commentcount'] = $count; - return $this->_data['commentcount']; + return $this->data['commentcount']; } /** @@ -430,8 +430,8 @@ public function getCommentCount() */ public function getCommentLink() { - if (array_key_exists('commentlink', $this->_data)) { - return $this->_data['commentlink']; + if (array_key_exists('commentlink', $this->data)) { + return $this->data['commentlink']; } $link = null; @@ -442,12 +442,12 @@ public function getCommentLink() if ($list->length) { $link = $list->item(0)->value; - $link = $this->_absolutiseUri($link); + $link = $this->absolutiseUri($link); } - $this->_data['commentlink'] = $link; + $this->data['commentlink'] = $link; - return $this->_data['commentlink']; + return $this->data['commentlink']; } /** @@ -457,8 +457,8 @@ public function getCommentLink() */ public function getCommentFeedLink($type = 'atom') { - if (array_key_exists('commentfeedlink', $this->_data)) { - return $this->_data['commentfeedlink']; + if (array_key_exists('commentfeedlink', $this->data)) { + return $this->data['commentfeedlink']; } $link = null; @@ -469,12 +469,12 @@ public function getCommentFeedLink($type = 'atom') if ($list->length) { $link = $list->item(0)->value; - $link = $this->_absolutiseUri($link); + $link = $this->absolutiseUri($link); } - $this->_data['commentfeedlink'] = $link; + $this->data['commentfeedlink'] = $link; - return $this->_data['commentfeedlink']; + return $this->data['commentfeedlink']; } /** @@ -484,11 +484,11 @@ public function getCommentFeedLink($type = 'atom') */ public function getCategories() { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; + if (array_key_exists('categories', $this->data)) { + return $this->data['categories']; } - if ($this->_getAtomType() == Reader\Reader::TYPE_ATOM_10) { + if ($this->getAtomType() == Reader\Reader::TYPE_ATOM_10) { $list = $this->getXpath()->query($this->getXpathPrefix() . '//atom:category'); } else { /** @@ -513,9 +513,9 @@ public function getCategories() return new Collection\Category; } - $this->_data['categories'] = $categoryCollection; + $this->data['categories'] = $categoryCollection; - return $this->_data['categories']; + return $this->data['categories']; } /** @@ -525,8 +525,8 @@ public function getCategories() */ public function getSource() { - if (array_key_exists('source', $this->_data)) { - return $this->_data['source']; + if (array_key_exists('source', $this->data)) { + return $this->data['source']; } $source = null; @@ -539,8 +539,8 @@ public function getSource() } } - $this->_data['source'] = $source; - return $this->_data['source']; + $this->data['source'] = $source; + return $this->data['source']; } /** @@ -550,7 +550,7 @@ public function getSource() * @param $link * @return string */ - protected function _absolutiseUri($link) + protected function absolutiseUri($link) { if (!Uri\UriFactory::factory($link)->isAbsolute()) { if ($this->getBaseUrl() !== null) { @@ -569,7 +569,7 @@ protected function _absolutiseUri($link) * @param DOMElement $element * @return string */ - protected function _getAuthor(DOMElement $element) + protected function getAuthorFromElement(DOMElement $element) { $author = array(); @@ -598,9 +598,9 @@ protected function _getAuthor(DOMElement $element) /** * Register the default namespaces for the current feed format */ - protected function _registerNamespaces() + protected function registerNamespaces() { - switch ($this->_getAtomType()) { + switch ($this->getAtomType()) { case Reader\Reader::TYPE_ATOM_03: $this->getXpath()->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_03); break; @@ -613,7 +613,7 @@ protected function _registerNamespaces() /** * Detect the presence of any Atom namespaces in use */ - protected function _getAtomType() + protected function getAtomType() { $dom = $this->getDomDocument(); $prefixAtom03 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_03); diff --git a/src/Reader/Extension/Atom/Feed.php b/src/Reader/Extension/Atom/Feed.php index 0f82880f..204f8fcc 100644 --- a/src/Reader/Extension/Atom/Feed.php +++ b/src/Reader/Extension/Atom/Feed.php @@ -47,17 +47,17 @@ public function getAuthor($index = 0) */ public function getAuthors() { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; + if (array_key_exists('authors', $this->data)) { + return $this->data['authors']; } - $list = $this->_xpath->query('//atom:author'); + $list = $this->xpath->query('//atom:author'); $authors = array(); if ($list->length) { foreach ($list as $author) { - $author = $this->_getAuthor($author); + $author = $this->getAuthorFromElement($author); if (!empty($author)) { $authors[] = $author; } @@ -72,9 +72,9 @@ public function getAuthors() ); } - $this->_data['authors'] = $authors; + $this->data['authors'] = $authors; - return $this->_data['authors']; + return $this->data['authors']; } /** @@ -84,25 +84,25 @@ public function getAuthors() */ public function getCopyright() { - if (array_key_exists('copyright', $this->_data)) { - return $this->_data['copyright']; + if (array_key_exists('copyright', $this->data)) { + return $this->data['copyright']; } $copyright = null; if ($this->getType() === Reader\Reader::TYPE_ATOM_03) { - $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:copyright)'); + $copyright = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:copyright)'); } else { - $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:rights)'); + $copyright = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:rights)'); } if (!$copyright) { $copyright = null; } - $this->_data['copyright'] = $copyright; + $this->data['copyright'] = $copyright; - return $this->_data['copyright']; + return $this->data['copyright']; } /** @@ -112,25 +112,25 @@ public function getCopyright() */ public function getDateCreated() { - if (array_key_exists('datecreated', $this->_data)) { - return $this->_data['datecreated']; + if (array_key_exists('datecreated', $this->data)) { + return $this->data['datecreated']; } $date = null; if ($this->getType() === Reader\Reader::TYPE_ATOM_03) { - $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:created)'); + $dateCreated = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:created)'); } else { - $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:published)'); + $dateCreated = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:published)'); } if ($dateCreated) { $date = DateTime::createFromFormat(DateTime::ISO8601, $dateCreated); } - $this->_data['datecreated'] = $date; + $this->data['datecreated'] = $date; - return $this->_data['datecreated']; + return $this->data['datecreated']; } /** @@ -140,25 +140,25 @@ public function getDateCreated() */ public function getDateModified() { - if (array_key_exists('datemodified', $this->_data)) { - return $this->_data['datemodified']; + if (array_key_exists('datemodified', $this->data)) { + return $this->data['datemodified']; } $date = null; if ($this->getType() === Reader\Reader::TYPE_ATOM_03) { - $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)'); + $dateModified = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)'); } else { - $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)'); + $dateModified = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)'); } if ($dateModified) { $date = DateTime::createFromFormat(DateTime::ISO8601, $dateModified); } - $this->_data['datemodified'] = $date; + $this->data['datemodified'] = $date; - return $this->_data['datemodified']; + return $this->data['datemodified']; } /** @@ -168,25 +168,25 @@ public function getDateModified() */ public function getDescription() { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; + if (array_key_exists('description', $this->data)) { + return $this->data['description']; } $description = null; if ($this->getType() === Reader\Reader::TYPE_ATOM_03) { - $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:tagline)'); + $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:tagline)'); } else { - $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:subtitle)'); + $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:subtitle)'); } if (!$description) { $description = null; } - $this->_data['description'] = $description; + $this->data['description'] = $description; - return $this->_data['description']; + return $this->data['description']; } /** @@ -196,19 +196,19 @@ public function getDescription() */ public function getGenerator() { - if (array_key_exists('generator', $this->_data)) { - return $this->_data['generator']; + if (array_key_exists('generator', $this->data)) { + return $this->data['generator']; } // TODO: Add uri support - $generator = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:generator)'); + $generator = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:generator)'); if (!$generator) { $generator = null; } - $this->_data['generator'] = $generator; + $this->data['generator'] = $generator; - return $this->_data['generator']; + return $this->data['generator']; } /** @@ -218,11 +218,11 @@ public function getGenerator() */ public function getId() { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; + if (array_key_exists('id', $this->data)) { + return $this->data['id']; } - $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:id)'); + $id = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:id)'); if (!$id) { if ($this->getLink()) { @@ -234,9 +234,9 @@ public function getId() } } - $this->_data['id'] = $id; + $this->data['id'] = $id; - return $this->_data['id']; + return $this->data['id']; } /** @@ -246,23 +246,23 @@ public function getId() */ public function getLanguage() { - if (array_key_exists('language', $this->_data)) { - return $this->_data['language']; + if (array_key_exists('language', $this->data)) { + return $this->data['language']; } - $language = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:lang)'); + $language = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:lang)'); if (!$language) { - $language = $this->_xpath->evaluate('string(//@xml:lang[1])'); + $language = $this->xpath->evaluate('string(//@xml:lang[1])'); } if (!$language) { $language = null; } - $this->_data['language'] = $language; + $this->data['language'] = $language; - return $this->_data['language']; + return $this->data['language']; } /** @@ -272,11 +272,11 @@ public function getLanguage() */ public function getImage() { - if (array_key_exists('image', $this->_data)) { - return $this->_data['image']; + if (array_key_exists('image', $this->data)) { + return $this->data['image']; } - $imageUrl = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:logo)'); + $imageUrl = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:logo)'); if (!$imageUrl) { $image = null; @@ -284,9 +284,9 @@ public function getImage() $image = array('uri'=>$imageUrl); } - $this->_data['image'] = $image; + $this->data['image'] = $image; - return $this->_data['image']; + return $this->data['image']; } /** @@ -296,18 +296,18 @@ public function getImage() */ public function getBaseUrl() { - if (array_key_exists('baseUrl', $this->_data)) { - return $this->_data['baseUrl']; + if (array_key_exists('baseUrl', $this->data)) { + return $this->data['baseUrl']; } - $baseUrl = $this->_xpath->evaluate('string(//@xml:base[1])'); + $baseUrl = $this->xpath->evaluate('string(//@xml:base[1])'); if (!$baseUrl) { $baseUrl = null; } - $this->_data['baseUrl'] = $baseUrl; + $this->data['baseUrl'] = $baseUrl; - return $this->_data['baseUrl']; + return $this->data['baseUrl']; } /** @@ -317,25 +317,25 @@ public function getBaseUrl() */ public function getLink() { - if (array_key_exists('link', $this->_data)) { - return $this->_data['link']; + if (array_key_exists('link', $this->data)) { + return $this->data['link']; } $link = null; - $list = $this->_xpath->query( + $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); + $link = $this->absolutiseUri($link); } - $this->_data['link'] = $link; + $this->data['link'] = $link; - return $this->_data['link']; + return $this->data['link']; } /** @@ -345,17 +345,17 @@ public function getLink() */ public function getFeedLink() { - if (array_key_exists('feedlink', $this->_data)) { - return $this->_data['feedlink']; + if (array_key_exists('feedlink', $this->data)) { + return $this->data['feedlink']; } - $link = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:link[@rel="self"]/@href)'); + $link = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:link[@rel="self"]/@href)'); - $link = $this->_absolutiseUri($link); + $link = $this->absolutiseUri($link); - $this->_data['feedlink'] = $link; + $this->data['feedlink'] = $link; - return $this->_data['feedlink']; + return $this->data['feedlink']; } /** @@ -365,25 +365,25 @@ public function getFeedLink() */ public function getHubs() { - if (array_key_exists('hubs', $this->_data)) { - return $this->_data['hubs']; + if (array_key_exists('hubs', $this->data)) { + return $this->data['hubs']; } $hubs = array(); - $list = $this->_xpath->query($this->getXpathPrefix() + $list = $this->xpath->query($this->getXpathPrefix() . '//atom:link[@rel="hub"]/@href'); if ($list->length) { foreach ($list as $uri) { - $hubs[] = $this->_absolutiseUri($uri->nodeValue); + $hubs[] = $this->absolutiseUri($uri->nodeValue); } } else { $hubs = null; } - $this->_data['hubs'] = $hubs; + $this->data['hubs'] = $hubs; - return $this->_data['hubs']; + return $this->data['hubs']; } /** @@ -393,19 +393,19 @@ public function getHubs() */ public function getTitle() { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; + if (array_key_exists('title', $this->data)) { + return $this->data['title']; } - $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:title)'); + $title = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:title)'); if (!$title) { $title = null; } - $this->_data['title'] = $title; + $this->data['title'] = $title; - return $this->_data['title']; + return $this->data['title']; } /** @@ -415,20 +415,20 @@ public function getTitle() */ public function getCategories() { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; + if (array_key_exists('categories', $this->data)) { + return $this->data['categories']; } if ($this->getType() == Reader\Reader::TYPE_ATOM_10) { - $list = $this->_xpath->query($this->getXpathPrefix() . '/atom:category'); + $list = $this->xpath->query($this->getXpathPrefix() . '/atom:category'); } else { /** * Since Atom 0.3 did not support categories, it would have used the * Dublin Core extension. However there is a small possibility Atom 0.3 * may have been retrofittied to use Atom 1.0 instead. */ - $this->_xpath->registerNamespace('atom10', Reader\Reader::NAMESPACE_ATOM_10); - $list = $this->_xpath->query($this->getXpathPrefix() . '/atom10:category'); + $this->xpath->registerNamespace('atom10', Reader\Reader::NAMESPACE_ATOM_10); + $list = $this->xpath->query($this->getXpathPrefix() . '/atom10:category'); } if ($list->length) { @@ -444,9 +444,9 @@ public function getCategories() return new Collection\Category; } - $this->_data['categories'] = $categoryCollection; + $this->data['categories'] = $categoryCollection; - return $this->_data['categories']; + return $this->data['categories']; } /** @@ -455,7 +455,7 @@ public function getCategories() * @param DOMElement $element * @return string */ - protected function _getAuthor(DOMElement $element) + protected function getAuthorFromElement(DOMElement $element) { $author = array(); @@ -485,7 +485,7 @@ protected function _getAuthor(DOMElement $element) * 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) + protected function absolutiseUri($link) { if (!Uri\UriFactory::factory($link)->isAbsolute()) { if ($this->getBaseUrl() !== null) { @@ -501,20 +501,20 @@ protected function _absolutiseUri($link) /** * Register the default namespaces for the current feed format */ - protected function _registerNamespaces() + protected function registerNamespaces() { if ($this->getType() == Reader\Reader::TYPE_ATOM_10 || $this->getType() == Reader\Reader::TYPE_ATOM_03 ) { return; // pre-registered at Feed level } - $atomDetected = $this->_getAtomType(); + $atomDetected = $this->getAtomType(); switch ($atomDetected) { case Reader\Reader::TYPE_ATOM_03: - $this->_xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_03); + $this->xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_03); break; default: - $this->_xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_10); + $this->xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_10); break; } } @@ -522,17 +522,19 @@ protected function _registerNamespaces() /** * Detect the presence of any Atom namespaces in use */ - protected function _getAtomType() + protected function getAtomType() { $dom = $this->getDomDocument(); $prefixAtom03 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_03); $prefixAtom10 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_10); if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_10) - || !empty($prefixAtom10)) { + || !empty($prefixAtom10) + ) { return Reader\Reader::TYPE_ATOM_10; } if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_03) - || !empty($prefixAtom03)) { + || !empty($prefixAtom03) + ) { return Reader\Reader::TYPE_ATOM_03; } } diff --git a/src/Reader/Extension/Content/Entry.php b/src/Reader/Extension/Content/Entry.php index b1bf605b..bdcb8d65 100644 --- a/src/Reader/Extension/Content/Entry.php +++ b/src/Reader/Extension/Content/Entry.php @@ -25,9 +25,9 @@ public function getContent() if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090 ) { - $content = $this->_xpath->evaluate('string('.$this->getXpathPrefix().'/content:encoded)'); + $content = $this->xpath->evaluate('string('.$this->getXpathPrefix().'/content:encoded)'); } else { - $content = $this->_xpath->evaluate('string('.$this->getXpathPrefix().'/content:encoded)'); + $content = $this->xpath->evaluate('string('.$this->getXpathPrefix().'/content:encoded)'); } return $content; } @@ -35,8 +35,8 @@ public function getContent() /** * Register RSS Content Module namespace */ - protected function _registerNamespaces() + protected function registerNamespaces() { - $this->_xpath->registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/'); + $this->xpath->registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/'); } } diff --git a/src/Reader/Extension/DublinCore/Entry.php b/src/Reader/Extension/DublinCore/Entry.php index 9e9248c2..beb04c42 100644 --- a/src/Reader/Extension/DublinCore/Entry.php +++ b/src/Reader/Extension/DublinCore/Entry.php @@ -46,21 +46,21 @@ public function getAuthor($index = 0) */ public function getAuthors() { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; + if (array_key_exists('authors', $this->data)) { + return $this->data['authors']; } $authors = array(); - $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc11:creator'); + $list = $this->xpath->evaluate($this->getXpathPrefix() . '//dc11:creator'); if (!$list->length) { - $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc10:creator'); + $list = $this->xpath->evaluate($this->getXpathPrefix() . '//dc10:creator'); } if (!$list->length) { - $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc11:publisher'); + $list = $this->xpath->evaluate($this->getXpathPrefix() . '//dc11:publisher'); if (!$list->length) { - $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc10:publisher'); + $list = $this->xpath->evaluate($this->getXpathPrefix() . '//dc10:publisher'); } } @@ -77,9 +77,9 @@ public function getAuthors() $authors = null; } - $this->_data['authors'] = $authors; + $this->data['authors'] = $authors; - return $this->_data['authors']; + return $this->data['authors']; } /** @@ -89,14 +89,14 @@ public function getAuthors() */ public function getCategories() { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; + if (array_key_exists('categories', $this->data)) { + return $this->data['categories']; } - $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc11:subject'); + $list = $this->xpath->evaluate($this->getXpathPrefix() . '//dc11:subject'); if (!$list->length) { - $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc10:subject'); + $list = $this->xpath->evaluate($this->getXpathPrefix() . '//dc10:subject'); } if ($list->length) { @@ -112,8 +112,8 @@ public function getCategories() $categoryCollection = new Collection\Category; } - $this->_data['categories'] = $categoryCollection; - return $this->_data['categories']; + $this->data['categories'] = $categoryCollection; + return $this->data['categories']; } @@ -134,24 +134,24 @@ public function getContent() */ public function getDescription() { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; + if (array_key_exists('description', $this->data)) { + return $this->data['description']; } $description = null; - $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:description)'); + $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:description)'); if (!$description) { - $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:description)'); + $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:description)'); } if (!$description) { $description = null; } - $this->_data['description'] = $description; + $this->data['description'] = $description; - return $this->_data['description']; + return $this->data['description']; } /** @@ -161,20 +161,20 @@ public function getDescription() */ public function getId() { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; + if (array_key_exists('id', $this->data)) { + return $this->data['id']; } $id = null; - $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:identifier)'); + $id = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:identifier)'); if (!$id) { - $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:identifier)'); + $id = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:identifier)'); } - $this->_data['id'] = $id; + $this->data['id'] = $id; - return $this->_data['id']; + return $this->data['id']; } /** @@ -184,24 +184,24 @@ public function getId() */ public function getTitle() { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; + if (array_key_exists('title', $this->data)) { + return $this->data['title']; } $title = null; - $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:title)'); + $title = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:title)'); if (!$title) { - $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:title)'); + $title = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:title)'); } if (!$title) { $title = null; } - $this->_data['title'] = $title; + $this->data['title'] = $title; - return $this->_data['title']; + return $this->data['title']; } /** @@ -211,24 +211,24 @@ public function getTitle() */ public function getDate() { - if (array_key_exists('date', $this->_data)) { - return $this->_data['date']; + if (array_key_exists('date', $this->data)) { + return $this->data['date']; } $d = null; - $date = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:date)'); + $date = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:date)'); if (!$date) { - $date = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:date)'); + $date = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:date)'); } if ($date) { $d = DateTime::createFromFormat(DateTime::ISO8601, $date); } - $this->_data['date'] = $d; + $this->data['date'] = $d; - return $this->_data['date']; + return $this->data['date']; } /** @@ -236,9 +236,9 @@ public function getDate() * * @return void */ - protected function _registerNamespaces() + protected function registerNamespaces() { - $this->_xpath->registerNamespace('dc10', 'http://purl.org/dc/elements/1.0/'); - $this->_xpath->registerNamespace('dc11', 'http://purl.org/dc/elements/1.1/'); + $this->xpath->registerNamespace('dc10', 'http://purl.org/dc/elements/1.0/'); + $this->xpath->registerNamespace('dc11', 'http://purl.org/dc/elements/1.1/'); } } diff --git a/src/Reader/Extension/DublinCore/Feed.php b/src/Reader/Extension/DublinCore/Feed.php index ec2133ab..6456c902 100644 --- a/src/Reader/Extension/DublinCore/Feed.php +++ b/src/Reader/Extension/DublinCore/Feed.php @@ -45,21 +45,21 @@ public function getAuthor($index = 0) */ public function getAuthors() { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; + if (array_key_exists('authors', $this->data)) { + return $this->data['authors']; } $authors = array(); - $list = $this->_xpath->query('//dc11:creator'); + $list = $this->xpath->query('//dc11:creator'); if (!$list->length) { - $list = $this->_xpath->query('//dc10:creator'); + $list = $this->xpath->query('//dc10:creator'); } if (!$list->length) { - $list = $this->_xpath->query('//dc11:publisher'); + $list = $this->xpath->query('//dc11:publisher'); if (!$list->length) { - $list = $this->_xpath->query('//dc10:publisher'); + $list = $this->xpath->query('//dc10:publisher'); } } @@ -76,9 +76,9 @@ public function getAuthors() $authors = null; } - $this->_data['authors'] = $authors; + $this->data['authors'] = $authors; - return $this->_data['authors']; + return $this->data['authors']; } /** @@ -88,24 +88,24 @@ public function getAuthors() */ public function getCopyright() { - if (array_key_exists('copyright', $this->_data)) { - return $this->_data['copyright']; + if (array_key_exists('copyright', $this->data)) { + return $this->data['copyright']; } $copyright = null; - $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:rights)'); + $copyright = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:rights)'); if (!$copyright) { - $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:rights)'); + $copyright = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:rights)'); } if (!$copyright) { $copyright = null; } - $this->_data['copyright'] = $copyright; + $this->data['copyright'] = $copyright; - return $this->_data['copyright']; + return $this->data['copyright']; } /** @@ -115,24 +115,24 @@ public function getCopyright() */ public function getDescription() { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; + if (array_key_exists('description', $this->data)) { + return $this->data['description']; } $description = null; - $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:description)'); + $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:description)'); if (!$description) { - $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:description)'); + $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:description)'); } if (!$description) { $description = null; } - $this->_data['description'] = $description; + $this->data['description'] = $description; - return $this->_data['description']; + return $this->data['description']; } /** @@ -142,20 +142,20 @@ public function getDescription() */ public function getId() { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; + if (array_key_exists('id', $this->data)) { + return $this->data['id']; } $id = null; - $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:identifier)'); + $id = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:identifier)'); if (!$id) { - $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:identifier)'); + $id = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:identifier)'); } - $this->_data['id'] = $id; + $this->data['id'] = $id; - return $this->_data['id']; + return $this->data['id']; } /** @@ -165,24 +165,24 @@ public function getId() */ public function getLanguage() { - if (array_key_exists('language', $this->_data)) { - return $this->_data['language']; + if (array_key_exists('language', $this->data)) { + return $this->data['language']; } $language = null; - $language = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:language)'); + $language = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:language)'); if (!$language) { - $language = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:language)'); + $language = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:language)'); } if (!$language) { $language = null; } - $this->_data['language'] = $language; + $this->data['language'] = $language; - return $this->_data['language']; + return $this->data['language']; } /** @@ -192,24 +192,24 @@ public function getLanguage() */ public function getTitle() { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; + if (array_key_exists('title', $this->data)) { + return $this->data['title']; } $title = null; - $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:title)'); + $title = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:title)'); if (!$title) { - $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:title)'); + $title = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:title)'); } if (!$title) { $title = null; } - $this->_data['title'] = $title; + $this->data['title'] = $title; - return $this->_data['title']; + return $this->data['title']; } /** @@ -219,24 +219,24 @@ public function getTitle() */ public function getDate() { - if (array_key_exists('date', $this->_data)) { - return $this->_data['date']; + if (array_key_exists('date', $this->data)) { + return $this->data['date']; } $d = null; - $date = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:date)'); + $date = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:date)'); if (!$date) { - $date = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:date)'); + $date = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:date)'); } if ($date) { $d = DateTime::createFromFormat(DateTime::ISO8601, $date); } - $this->_data['date'] = $d; + $this->data['date'] = $d; - return $this->_data['date']; + return $this->data['date']; } /** @@ -246,14 +246,14 @@ public function getDate() */ public function getCategories() { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; + if (array_key_exists('categories', $this->data)) { + return $this->data['categories']; } - $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc11:subject'); + $list = $this->xpath->evaluate($this->getXpathPrefix() . '//dc11:subject'); if (!$list->length) { - $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc10:subject'); + $list = $this->xpath->evaluate($this->getXpathPrefix() . '//dc10:subject'); } if ($list->length) { @@ -269,8 +269,8 @@ public function getCategories() $categoryCollection = new Collection\Category; } - $this->_data['categories'] = $categoryCollection; - return $this->_data['categories']; + $this->data['categories'] = $categoryCollection; + return $this->data['categories']; } /** @@ -278,9 +278,9 @@ public function getCategories() * * @return void */ - protected function _registerNamespaces() + protected function registerNamespaces() { - $this->_xpath->registerNamespace('dc10', 'http://purl.org/dc/elements/1.0/'); - $this->_xpath->registerNamespace('dc11', 'http://purl.org/dc/elements/1.1/'); + $this->xpath->registerNamespace('dc10', 'http://purl.org/dc/elements/1.0/'); + $this->xpath->registerNamespace('dc11', 'http://purl.org/dc/elements/1.1/'); } } diff --git a/src/Reader/Extension/Podcast/Entry.php b/src/Reader/Extension/Podcast/Entry.php index d1bec400..9db197ac 100644 --- a/src/Reader/Extension/Podcast/Entry.php +++ b/src/Reader/Extension/Podcast/Entry.php @@ -25,19 +25,19 @@ class Entry extends Extension\AbstractEntry */ public function getCastAuthor() { - if (isset($this->_data['author'])) { - return $this->_data['author']; + if (isset($this->data['author'])) { + return $this->data['author']; } - $author = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:author)'); + $author = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:author)'); if (!$author) { $author = null; } - $this->_data['author'] = $author; + $this->data['author'] = $author; - return $this->_data['author']; + return $this->data['author']; } /** @@ -47,19 +47,19 @@ public function getCastAuthor() */ public function getBlock() { - if (isset($this->_data['block'])) { - return $this->_data['block']; + if (isset($this->data['block'])) { + return $this->data['block']; } - $block = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:block)'); + $block = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:block)'); if (!$block) { $block = null; } - $this->_data['block'] = $block; + $this->data['block'] = $block; - return $this->_data['block']; + return $this->data['block']; } /** @@ -69,19 +69,19 @@ public function getBlock() */ public function getDuration() { - if (isset($this->_data['duration'])) { - return $this->_data['duration']; + if (isset($this->data['duration'])) { + return $this->data['duration']; } - $duration = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:duration)'); + $duration = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:duration)'); if (!$duration) { $duration = null; } - $this->_data['duration'] = $duration; + $this->data['duration'] = $duration; - return $this->_data['duration']; + return $this->data['duration']; } /** @@ -91,19 +91,19 @@ public function getDuration() */ public function getExplicit() { - if (isset($this->_data['explicit'])) { - return $this->_data['explicit']; + if (isset($this->data['explicit'])) { + return $this->data['explicit']; } - $explicit = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:explicit)'); + $explicit = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:explicit)'); if (!$explicit) { $explicit = null; } - $this->_data['explicit'] = $explicit; + $this->data['explicit'] = $explicit; - return $this->_data['explicit']; + return $this->data['explicit']; } /** @@ -113,19 +113,19 @@ public function getExplicit() */ public function getKeywords() { - if (isset($this->_data['keywords'])) { - return $this->_data['keywords']; + if (isset($this->data['keywords'])) { + return $this->data['keywords']; } - $keywords = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)'); + $keywords = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)'); if (!$keywords) { $keywords = null; } - $this->_data['keywords'] = $keywords; + $this->data['keywords'] = $keywords; - return $this->_data['keywords']; + return $this->data['keywords']; } /** @@ -135,19 +135,19 @@ public function getKeywords() */ public function getSubtitle() { - if (isset($this->_data['subtitle'])) { - return $this->_data['subtitle']; + if (isset($this->data['subtitle'])) { + return $this->data['subtitle']; } - $subtitle = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:subtitle)'); + $subtitle = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:subtitle)'); if (!$subtitle) { $subtitle = null; } - $this->_data['subtitle'] = $subtitle; + $this->data['subtitle'] = $subtitle; - return $this->_data['subtitle']; + return $this->data['subtitle']; } /** @@ -157,27 +157,27 @@ public function getSubtitle() */ public function getSummary() { - if (isset($this->_data['summary'])) { - return $this->_data['summary']; + if (isset($this->data['summary'])) { + return $this->data['summary']; } - $summary = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:summary)'); + $summary = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:summary)'); if (!$summary) { $summary = null; } - $this->_data['summary'] = $summary; + $this->data['summary'] = $summary; - return $this->_data['summary']; + return $this->data['summary']; } /** * Register iTunes namespace * */ - protected function _registerNamespaces() + protected function registerNamespaces() { - $this->_xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); + $this->xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); } } diff --git a/src/Reader/Extension/Podcast/Feed.php b/src/Reader/Extension/Podcast/Feed.php index 8dda6750..09ab189e 100644 --- a/src/Reader/Extension/Podcast/Feed.php +++ b/src/Reader/Extension/Podcast/Feed.php @@ -26,19 +26,19 @@ class Feed extends Extension\AbstractFeed */ public function getCastAuthor() { - if (isset($this->_data['author'])) { - return $this->_data['author']; + if (isset($this->data['author'])) { + return $this->data['author']; } - $author = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:author)'); + $author = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:author)'); if (!$author) { $author = null; } - $this->_data['author'] = $author; + $this->data['author'] = $author; - return $this->_data['author']; + return $this->data['author']; } /** @@ -48,19 +48,19 @@ public function getCastAuthor() */ public function getBlock() { - if (isset($this->_data['block'])) { - return $this->_data['block']; + if (isset($this->data['block'])) { + return $this->data['block']; } - $block = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:block)'); + $block = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:block)'); if (!$block) { $block = null; } - $this->_data['block'] = $block; + $this->data['block'] = $block; - return $this->_data['block']; + return $this->data['block']; } /** @@ -70,11 +70,11 @@ public function getBlock() */ public function getItunesCategories() { - if (isset($this->_data['categories'])) { - return $this->_data['categories']; + if (isset($this->data['categories'])) { + return $this->data['categories']; } - $categoryList = $this->_xpath->query($this->getXpathPrefix() . '/itunes:category'); + $categoryList = $this->xpath->query($this->getXpathPrefix() . '/itunes:category'); $categories = array(); @@ -101,9 +101,9 @@ public function getItunesCategories() $categories = null; } - $this->_data['categories'] = $categories; + $this->data['categories'] = $categories; - return $this->_data['categories']; + return $this->data['categories']; } /** @@ -113,19 +113,19 @@ public function getItunesCategories() */ public function getExplicit() { - if (isset($this->_data['explicit'])) { - return $this->_data['explicit']; + if (isset($this->data['explicit'])) { + return $this->data['explicit']; } - $explicit = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:explicit)'); + $explicit = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:explicit)'); if (!$explicit) { $explicit = null; } - $this->_data['explicit'] = $explicit; + $this->data['explicit'] = $explicit; - return $this->_data['explicit']; + return $this->data['explicit']; } /** @@ -135,19 +135,19 @@ public function getExplicit() */ public function getItunesImage() { - if (isset($this->_data['image'])) { - return $this->_data['image']; + if (isset($this->data['image'])) { + return $this->data['image']; } - $image = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:image/@href)'); + $image = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:image/@href)'); if (!$image) { $image = null; } - $this->_data['image'] = $image; + $this->data['image'] = $image; - return $this->_data['image']; + return $this->data['image']; } /** @@ -157,19 +157,19 @@ public function getItunesImage() */ public function getKeywords() { - if (isset($this->_data['keywords'])) { - return $this->_data['keywords']; + if (isset($this->data['keywords'])) { + return $this->data['keywords']; } - $keywords = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)'); + $keywords = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)'); if (!$keywords) { $keywords = null; } - $this->_data['keywords'] = $keywords; + $this->data['keywords'] = $keywords; - return $this->_data['keywords']; + return $this->data['keywords']; } /** @@ -179,19 +179,19 @@ public function getKeywords() */ public function getNewFeedUrl() { - if (isset($this->_data['new-feed-url'])) { - return $this->_data['new-feed-url']; + if (isset($this->data['new-feed-url'])) { + return $this->data['new-feed-url']; } - $newFeedUrl = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:new-feed-url)'); + $newFeedUrl = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:new-feed-url)'); if (!$newFeedUrl) { $newFeedUrl = null; } - $this->_data['new-feed-url'] = $newFeedUrl; + $this->data['new-feed-url'] = $newFeedUrl; - return $this->_data['new-feed-url']; + return $this->data['new-feed-url']; } /** @@ -201,14 +201,14 @@ public function getNewFeedUrl() */ public function getOwner() { - if (isset($this->_data['owner'])) { - return $this->_data['owner']; + if (isset($this->data['owner'])) { + return $this->data['owner']; } $owner = null; - $email = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:owner/itunes:email)'); - $name = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:owner/itunes:name)'); + $email = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:owner/itunes:email)'); + $name = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:owner/itunes:name)'); if (!empty($email)) { $owner = $email . (empty($name) ? '' : ' (' . $name . ')'); @@ -220,9 +220,9 @@ public function getOwner() $owner = null; } - $this->_data['owner'] = $owner; + $this->data['owner'] = $owner; - return $this->_data['owner']; + return $this->data['owner']; } /** @@ -232,19 +232,19 @@ public function getOwner() */ public function getSubtitle() { - if (isset($this->_data['subtitle'])) { - return $this->_data['subtitle']; + if (isset($this->data['subtitle'])) { + return $this->data['subtitle']; } - $subtitle = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:subtitle)'); + $subtitle = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:subtitle)'); if (!$subtitle) { $subtitle = null; } - $this->_data['subtitle'] = $subtitle; + $this->data['subtitle'] = $subtitle; - return $this->_data['subtitle']; + return $this->data['subtitle']; } /** @@ -254,27 +254,27 @@ public function getSubtitle() */ public function getSummary() { - if (isset($this->_data['summary'])) { - return $this->_data['summary']; + if (isset($this->data['summary'])) { + return $this->data['summary']; } - $summary = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:summary)'); + $summary = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:summary)'); if (!$summary) { $summary = null; } - $this->_data['summary'] = $summary; + $this->data['summary'] = $summary; - return $this->_data['summary']; + return $this->data['summary']; } /** * Register iTunes namespace * */ - protected function _registerNamespaces() + protected function registerNamespaces() { - $this->_xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); + $this->xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); } } diff --git a/src/Reader/Extension/Slash/Entry.php b/src/Reader/Extension/Slash/Entry.php index 61fbe7d8..2a7d907f 100644 --- a/src/Reader/Extension/Slash/Entry.php +++ b/src/Reader/Extension/Slash/Entry.php @@ -25,7 +25,7 @@ class Entry extends Extension\AbstractEntry */ public function getSection() { - return $this->_getData('section'); + return $this->getData('section'); } /** @@ -35,7 +35,7 @@ public function getSection() */ public function getDepartment() { - return $this->_getData('department'); + return $this->getData('department'); } /** @@ -47,11 +47,11 @@ public function getHitParade() { $name = 'hit_parade'; - if (isset($this->_data[$name])) { - return $this->_data[$name]; + if (isset($this->data[$name])) { + return $this->data[$name]; } - $stringParade = $this->_getData($name); + $stringParade = $this->getData($name); $hitParade = array(); if (!empty($stringParade)) { @@ -61,7 +61,7 @@ public function getHitParade() $hitParade[] = $hit + 0; //cast to integer } - $this->_data[$name] = $hitParade; + $this->data[$name] = $hitParade; return $hitParade; } @@ -74,15 +74,15 @@ public function getCommentCount() { $name = 'comments'; - if (isset($this->_data[$name])) { - return $this->_data[$name]; + if (isset($this->data[$name])) { + return $this->data[$name]; } - $comments = $this->_getData($name, 'string'); + $comments = $this->getData($name, 'string'); if (!$comments) { - $this->_data[$name] = null; - return $this->_data[$name]; + $this->data[$name] = null; + return $this->data[$name]; } return $comments; @@ -95,19 +95,19 @@ public function getCommentCount() * * @return mixed|null */ - protected function _getData($name, $type = 'string') + protected function getData($name, $type = 'string') { - if (array_key_exists($name, $this->_data)) { - return $this->_data[$name]; + if (array_key_exists($name, $this->data)) { + return $this->data[$name]; } - $data = $this->_xpath->evaluate($type . '(' . $this->getXpathPrefix() . '/slash10:' . $name . ')'); + $data = $this->xpath->evaluate($type . '(' . $this->getXpathPrefix() . '/slash10:' . $name . ')'); if (!$data) { $data = null; } - $this->_data[$name] = $data; + $this->data[$name] = $data; return $data; } @@ -117,8 +117,8 @@ protected function _getData($name, $type = 'string') * * @return void */ - protected function _registerNamespaces() + protected function registerNamespaces() { - $this->_xpath->registerNamespace('slash10', 'http://purl.org/rss/1.0/modules/slash/'); + $this->xpath->registerNamespace('slash10', 'http://purl.org/rss/1.0/modules/slash/'); } } diff --git a/src/Reader/Extension/Thread/Entry.php b/src/Reader/Extension/Thread/Entry.php index 758b61da..604154fd 100644 --- a/src/Reader/Extension/Thread/Entry.php +++ b/src/Reader/Extension/Thread/Entry.php @@ -37,7 +37,7 @@ public function getInReplyTo() */ public function getCommentCount() { - return $this->_getData('total'); + return $this->getData('total'); } /** @@ -47,19 +47,19 @@ public function getCommentCount() * @param string $type * @return mixed|null */ - protected function _getData($name) + protected function getData($name) { - if (array_key_exists($name, $this->_data)) { - return $this->_data[$name]; + if (array_key_exists($name, $this->data)) { + return $this->data[$name]; } - $data = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/thread10:' . $name . ')'); + $data = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/thread10:' . $name . ')'); if (!$data) { $data = null; } - $this->_data[$name] = $data; + $this->data[$name] = $data; return $data; } @@ -69,8 +69,8 @@ protected function _getData($name) * * @return void */ - protected function _registerNamespaces() + protected function registerNamespaces() { - $this->_xpath->registerNamespace('thread10', 'http://purl.org/syndication/thread/1.0'); + $this->xpath->registerNamespace('thread10', 'http://purl.org/syndication/thread/1.0'); } } diff --git a/src/Reader/Extension/WellFormedWeb/Entry.php b/src/Reader/Extension/WellFormedWeb/Entry.php index a9e22bc8..794aa6a9 100644 --- a/src/Reader/Extension/WellFormedWeb/Entry.php +++ b/src/Reader/Extension/WellFormedWeb/Entry.php @@ -26,17 +26,17 @@ class Entry extends Extension\AbstractEntry public function getCommentFeedLink() { $name = 'commentRss'; - if (array_key_exists($name, $this->_data)) { - return $this->_data[$name]; + if (array_key_exists($name, $this->data)) { + return $this->data[$name]; } - $data = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/wfw:' . $name . ')'); + $data = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/wfw:' . $name . ')'); if (!$data) { $data = null; } - $this->_data[$name] = $data; + $this->data[$name] = $data; return $data; } @@ -46,8 +46,8 @@ public function getCommentFeedLink() * * @return void */ - protected function _registerNamespaces() + protected function registerNamespaces() { - $this->_xpath->registerNamespace('wfw', 'http://wellformedweb.org/CommentAPI/'); + $this->xpath->registerNamespace('wfw', 'http://wellformedweb.org/CommentAPI/'); } } diff --git a/src/Reader/ExtensionManager.php b/src/Reader/ExtensionManager.php new file mode 100644 index 00000000..03a943f6 --- /dev/null +++ b/src/Reader/ExtensionManager.php @@ -0,0 +1,81 @@ + 'Zend\Feed\Reader\Extension\Atom\Entry', + 'atomfeed' => 'Zend\Feed\Reader\Extension\Atom\Feed', + 'contententry' => 'Zend\Feed\Reader\Extension\Content\Entry', + 'creativecommonsentry' => 'Zend\Feed\Reader\Extension\CreativeCommons\Entry', + 'creativecommonsfeed' => 'Zend\Feed\Reader\Extension\CreativeCommons\Feed', + 'dublincoreentry' => 'Zend\Feed\Reader\Extension\DublinCore\Entry', + 'dublincorefeed' => 'Zend\Feed\Reader\Extension\DublinCore\Feed', + 'podcastentry' => 'Zend\Feed\Reader\Extension\Podcast\Entry', + 'podcastfeed' => 'Zend\Feed\Reader\Extension\Podcast\Feed', + 'slashentry' => 'Zend\Feed\Reader\Extension\Slash\Entry', + 'syndicationfeed' => 'Zend\Feed\Reader\Extension\Syndication\Feed', + 'threadentry' => 'Zend\Feed\Reader\Extension\Thread\Entry', + 'wellformedwebentry' => 'Zend\Feed\Reader\Extension\WellFormedWeb\Entry', + ); + + /** + * Do not share instances + * + * @var bool + */ + protected $shareByDefault = false; + + /** + * Validate the plugin + * + * Checks that the extension loaded is of a valid type. + * + * @param mixed $plugin + * @return void + * @throws Exception\InvalidArgumentException if invalid + */ + public function validatePlugin($plugin) + { + if ($plugin instanceof Extension\AbstractEntry + || $plugin instanceof Extension\AbstractFeed + ) { + // we're okay + return; + } + + throw new Exception\InvalidArgumentException(sprintf( + 'Plugin of type %s is invalid; must implement %s\Extension\AbstractFeed ' + . 'or %s\Extension\AbstractEntry', + (is_object($plugin) ? get_class($plugin) : gettype($plugin)), + __NAMESPACE__, + __NAMESPACE__ + )); + } +} diff --git a/src/Reader/Feed/AbstractFeed.php b/src/Reader/Feed/AbstractFeed.php index 36a2bd02..73b42f00 100644 --- a/src/Reader/Feed/AbstractFeed.php +++ b/src/Reader/Feed/AbstractFeed.php @@ -26,49 +26,49 @@ abstract class AbstractFeed implements FeedInterface * * @var array */ - protected $_data = array(); + protected $data = array(); /** * Parsed feed data in the shape of a DOMDocument * * @var DOMDocument */ - protected $_domDocument = null; + protected $domDocument = null; /** * An array of parsed feed entries * * @var array */ - protected $_entries = array(); + protected $entries = array(); /** * A pointer for the iterator to keep track of the entries array * * @var int */ - protected $_entriesKey = 0; + protected $entriesKey = 0; /** * The base XPath query used to retrieve feed data * * @var DOMXPath */ - protected $_xpath = null; + protected $xpath = null; /** * Array of loaded extensions * * @var array */ - protected $_extensions = array(); + protected $extensions = array(); /** * Original Source URI (set if imported from a URI) * * @var string */ - protected $_originalSourceUri = null; + protected $originalSourceUri = null; /** * Constructor @@ -78,17 +78,17 @@ abstract class AbstractFeed implements FeedInterface */ public function __construct(DOMDocument $domDocument, $type = null) { - $this->_domDocument = $domDocument; - $this->_xpath = new DOMXPath($this->_domDocument); + $this->domDocument = $domDocument; + $this->xpath = new DOMXPath($this->domDocument); if ($type !== null) { - $this->_data['type'] = $type; + $this->data['type'] = $type; } else { - $this->_data['type'] = Reader\Reader::detectType($this->_domDocument); + $this->data['type'] = Reader\Reader::detectType($this->domDocument); } - $this->_registerNamespaces(); - $this->_indexEntries(); - $this->_loadExtensions(); + $this->registerNamespaces(); + $this->indexEntries(); + $this->loadExtensions(); } /** @@ -100,7 +100,7 @@ public function __construct(DOMDocument $domDocument, $type = null) */ public function setOriginalSourceUri($uri) { - $this->_originalSourceUri = $uri; + $this->originalSourceUri = $uri; } /** @@ -111,7 +111,7 @@ public function setOriginalSourceUri($uri) */ public function getOriginalSourceUri() { - return $this->_originalSourceUri; + return $this->originalSourceUri; } /** @@ -122,7 +122,7 @@ public function getOriginalSourceUri() */ public function count() { - return count($this->_entries); + return count($this->entries); } /** @@ -133,12 +133,12 @@ public function count() public function current() { if (substr($this->getType(), 0, 3) == 'rss') { - $reader = new Reader\Entry\Rss($this->_entries[$this->key()], $this->key(), $this->getType()); + $reader = new Reader\Entry\Rss($this->entries[$this->key()], $this->key(), $this->getType()); } else { - $reader = new Reader\Entry\Atom($this->_entries[$this->key()], $this->key(), $this->getType()); + $reader = new Reader\Entry\Atom($this->entries[$this->key()], $this->key(), $this->getType()); } - $reader->setXpath($this->_xpath); + $reader->setXpath($this->xpath); return $reader; } @@ -150,7 +150,7 @@ public function current() */ public function getDomDocument() { - return $this->_domDocument; + return $this->domDocument; } /** @@ -194,7 +194,7 @@ public function getElement() */ public function getXpath() { - return $this->_xpath; + return $this->xpath; } /** @@ -204,7 +204,7 @@ public function getXpath() */ public function getType() { - return $this->_data['type']; + return $this->data['type']; } /** @@ -214,7 +214,7 @@ public function getType() */ public function key() { - return $this->_entriesKey; + return $this->entriesKey; } /** @@ -223,7 +223,7 @@ public function key() */ public function next() { - ++$this->_entriesKey; + ++$this->entriesKey; } /** @@ -232,7 +232,7 @@ public function next() */ public function rewind() { - $this->_entriesKey = 0; + $this->entriesKey = 0; } /** @@ -242,17 +242,17 @@ public function rewind() */ public function valid() { - return 0 <= $this->_entriesKey && $this->_entriesKey < $this->count(); + return 0 <= $this->entriesKey && $this->entriesKey < $this->count(); } public function getExtensions() { - return $this->_extensions; + return $this->extensions; } public function __call($method, $args) { - foreach ($this->_extensions as $extension) { + foreach ($this->extensions as $extension) { if (method_exists($extension, $method)) { return call_user_func_array(array($extension, $method), $args); } @@ -269,29 +269,29 @@ public function __call($method, $args) */ public function getExtension($name) { - if (array_key_exists($name . '\\Feed', $this->_extensions)) { - return $this->_extensions[$name . '\\Feed']; + if (array_key_exists($name . '\\Feed', $this->extensions)) { + return $this->extensions[$name . '\\Feed']; } return null; } - protected function _loadExtensions() + protected function loadExtensions() { - $all = Reader\Reader::getExtensions(); - $feed = $all['feed']; + $all = Reader\Reader::getExtensions(); + $manager = Reader\Reader::getExtensionManager(); + $feed = $all['feed']; foreach ($feed as $extension) { if (in_array($extension, $all['core'])) { continue; } - if (!$className = Reader\Reader::getPluginLoader()->getClassName($extension)) { - continue; - } - if (!class_exists($className)) { + if (!$manager->has($extension)) { throw new Exception\RuntimeException(sprintf('Unable to load extension "%s"; cannot find class', $extension)); } - $this->_extensions[$extension] = new $className( - $this->getDomDocument(), $this->_data['type'], $this->_xpath - ); + $plugin = $manager->get($extension); + $plugin->setDomDocument($this->getDomDocument()); + $plugin->setType($this->data['type']); + $plugin->setXpath($this->xpath); + $this->extensions[$extension] = $plugin; } } @@ -299,11 +299,11 @@ protected function _loadExtensions() * Read all entries to the internal entries array * */ - abstract protected function _indexEntries(); + abstract protected function indexEntries(); /** * Register the default namespaces for the current feed format * */ - abstract protected function _registerNamespaces(); + abstract protected function registerNamespaces(); } diff --git a/src/Reader/Feed/Atom.php b/src/Reader/Feed/Atom.php index 8490c1d6..48abe949 100644 --- a/src/Reader/Feed/Atom.php +++ b/src/Reader/Feed/Atom.php @@ -29,11 +29,21 @@ class Atom extends AbstractFeed public function __construct(DOMDocument $dom, $type = null) { parent::__construct($dom, $type); - $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\\Feed'); - $this->_extensions['Atom\\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); - $atomClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\\Feed'); - $this->_extensions['DublinCore\\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); - foreach ($this->_extensions as $extension) { + $manager = Reader\Reader::getExtensionManager(); + + $atomFeed = $manager->get('Atom\Feed'); + $atomFeed->setDomDocument($dom); + $atomFeed->setType($this->data['type']); + $atomFeed->setXpath($this->xpath); + $this->extensions['Atom\\Feed'] = $atomFeed; + + $atomFeed = $manager->get('DublinCore\Feed'); + $atomFeed->setDomDocument($dom); + $atomFeed->setType($this->data['type']); + $atomFeed->setXpath($this->xpath); + $this->extensions['DublinCore\\Feed'] = $atomFeed; + + foreach ($this->extensions as $extension) { $extension->setXpathPrefix('/atom:feed'); } } @@ -62,15 +72,15 @@ public function getAuthor($index = 0) */ public function getAuthors() { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; + if (array_key_exists('authors', $this->data)) { + return $this->data['authors']; } $authors = $this->getExtension('Atom')->getAuthors(); - $this->_data['authors'] = $authors; + $this->data['authors'] = $authors; - return $this->_data['authors']; + return $this->data['authors']; } /** @@ -80,8 +90,8 @@ public function getAuthors() */ public function getCopyright() { - if (array_key_exists('copyright', $this->_data)) { - return $this->_data['copyright']; + if (array_key_exists('copyright', $this->data)) { + return $this->data['copyright']; } $copyright = $this->getExtension('Atom')->getCopyright(); @@ -90,9 +100,9 @@ public function getCopyright() $copyright = null; } - $this->_data['copyright'] = $copyright; + $this->data['copyright'] = $copyright; - return $this->_data['copyright']; + return $this->data['copyright']; } /** @@ -102,8 +112,8 @@ public function getCopyright() */ public function getDateCreated() { - if (array_key_exists('datecreated', $this->_data)) { - return $this->_data['datecreated']; + if (array_key_exists('datecreated', $this->data)) { + return $this->data['datecreated']; } $dateCreated = $this->getExtension('Atom')->getDateCreated(); @@ -112,9 +122,9 @@ public function getDateCreated() $dateCreated = null; } - $this->_data['datecreated'] = $dateCreated; + $this->data['datecreated'] = $dateCreated; - return $this->_data['datecreated']; + return $this->data['datecreated']; } /** @@ -124,8 +134,8 @@ public function getDateCreated() */ public function getDateModified() { - if (array_key_exists('datemodified', $this->_data)) { - return $this->_data['datemodified']; + if (array_key_exists('datemodified', $this->data)) { + return $this->data['datemodified']; } $dateModified = $this->getExtension('Atom')->getDateModified(); @@ -134,9 +144,9 @@ public function getDateModified() $dateModified = null; } - $this->_data['datemodified'] = $dateModified; + $this->data['datemodified'] = $dateModified; - return $this->_data['datemodified']; + return $this->data['datemodified']; } /** @@ -156,8 +166,8 @@ public function getLastBuildDate() */ public function getDescription() { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; + if (array_key_exists('description', $this->data)) { + return $this->data['description']; } $description = $this->getExtension('Atom')->getDescription(); @@ -166,9 +176,9 @@ public function getDescription() $description = null; } - $this->_data['description'] = $description; + $this->data['description'] = $description; - return $this->_data['description']; + return $this->data['description']; } /** @@ -178,15 +188,15 @@ public function getDescription() */ public function getGenerator() { - if (array_key_exists('generator', $this->_data)) { - return $this->_data['generator']; + if (array_key_exists('generator', $this->data)) { + return $this->data['generator']; } $generator = $this->getExtension('Atom')->getGenerator(); - $this->_data['generator'] = $generator; + $this->data['generator'] = $generator; - return $this->_data['generator']; + return $this->data['generator']; } /** @@ -196,15 +206,15 @@ public function getGenerator() */ public function getId() { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; + if (array_key_exists('id', $this->data)) { + return $this->data['id']; } $id = $this->getExtension('Atom')->getId(); - $this->_data['id'] = $id; + $this->data['id'] = $id; - return $this->_data['id']; + return $this->data['id']; } /** @@ -214,23 +224,23 @@ public function getId() */ public function getLanguage() { - if (array_key_exists('language', $this->_data)) { - return $this->_data['language']; + if (array_key_exists('language', $this->data)) { + return $this->data['language']; } $language = $this->getExtension('Atom')->getLanguage(); if (!$language) { - $language = $this->_xpath->evaluate('string(//@xml:lang[1])'); + $language = $this->xpath->evaluate('string(//@xml:lang[1])'); } if (!$language) { $language = null; } - $this->_data['language'] = $language; + $this->data['language'] = $language; - return $this->_data['language']; + return $this->data['language']; } /** @@ -240,15 +250,15 @@ public function getLanguage() */ public function getBaseUrl() { - if (array_key_exists('baseUrl', $this->_data)) { - return $this->_data['baseUrl']; + if (array_key_exists('baseUrl', $this->data)) { + return $this->data['baseUrl']; } $baseUrl = $this->getExtension('Atom')->getBaseUrl(); - $this->_data['baseUrl'] = $baseUrl; + $this->data['baseUrl'] = $baseUrl; - return $this->_data['baseUrl']; + return $this->data['baseUrl']; } /** @@ -258,15 +268,15 @@ public function getBaseUrl() */ public function getLink() { - if (array_key_exists('link', $this->_data)) { - return $this->_data['link']; + if (array_key_exists('link', $this->data)) { + return $this->data['link']; } $link = $this->getExtension('Atom')->getLink(); - $this->_data['link'] = $link; + $this->data['link'] = $link; - return $this->_data['link']; + return $this->data['link']; } /** @@ -276,15 +286,15 @@ public function getLink() */ public function getImage() { - if (array_key_exists('image', $this->_data)) { - return $this->_data['image']; + if (array_key_exists('image', $this->data)) { + return $this->data['image']; } $link = $this->getExtension('Atom')->getImage(); - $this->_data['image'] = $link; + $this->data['image'] = $link; - return $this->_data['image']; + return $this->data['image']; } /** @@ -294,8 +304,8 @@ public function getImage() */ public function getFeedLink() { - if (array_key_exists('feedlink', $this->_data)) { - return $this->_data['feedlink']; + if (array_key_exists('feedlink', $this->data)) { + return $this->data['feedlink']; } $link = $this->getExtension('Atom')->getFeedLink(); @@ -304,9 +314,9 @@ public function getFeedLink() $link = $this->getOriginalSourceUri(); } - $this->_data['feedlink'] = $link; + $this->data['feedlink'] = $link; - return $this->_data['feedlink']; + return $this->data['feedlink']; } /** @@ -316,15 +326,15 @@ public function getFeedLink() */ public function getTitle() { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; + if (array_key_exists('title', $this->data)) { + return $this->data['title']; } $title = $this->getExtension('Atom')->getTitle(); - $this->_data['title'] = $title; + $this->data['title'] = $title; - return $this->_data['title']; + return $this->data['title']; } /** @@ -334,15 +344,15 @@ public function getTitle() */ public function getHubs() { - if (array_key_exists('hubs', $this->_data)) { - return $this->_data['hubs']; + if (array_key_exists('hubs', $this->data)) { + return $this->data['hubs']; } $hubs = $this->getExtension('Atom')->getHubs(); - $this->_data['hubs'] = $hubs; + $this->data['hubs'] = $hubs; - return $this->_data['hubs']; + return $this->data['hubs']; } /** @@ -352,8 +362,8 @@ public function getHubs() */ public function getCategories() { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; + if (array_key_exists('categories', $this->data)) { + return $this->data['categories']; } $categoryCollection = $this->getExtension('Atom')->getCategories(); @@ -362,9 +372,9 @@ public function getCategories() $categoryCollection = $this->getExtension('DublinCore')->getCategories(); } - $this->_data['categories'] = $categoryCollection; + $this->data['categories'] = $categoryCollection; - return $this->_data['categories']; + return $this->data['categories']; } /** @@ -372,15 +382,15 @@ public function getCategories() * * @return void */ - protected function _indexEntries() + 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'); + $entries = $this->xpath->evaluate('//atom:entry'); foreach($entries as $index=>$entry) { - $this->_entries[$index] = $entry; + $this->entries[$index] = $entry; } } } @@ -389,15 +399,15 @@ protected function _indexEntries() * Register the default namespaces for the current feed format * */ - protected function _registerNamespaces() + protected function registerNamespaces() { - switch ($this->_data['type']) { + switch ($this->data['type']) { case Reader\Reader::TYPE_ATOM_03: - $this->_xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_03); + $this->xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_03); break; case Reader\Reader::TYPE_ATOM_10: default: - $this->_xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_10); + $this->xpath->registerNamespace('atom', Reader\Reader::NAMESPACE_ATOM_10); } } } diff --git a/src/Reader/Feed/Atom/Source.php b/src/Reader/Feed/Atom/Source.php index 7aa3f528..e23c0dff 100644 --- a/src/Reader/Feed/Atom/Source.php +++ b/src/Reader/Feed/Atom/Source.php @@ -33,17 +33,24 @@ class Source extends Feed\Atom */ public function __construct(DOMElement $source, $xpathPrefix, $type = Reader\Reader::TYPE_ATOM_10) { - $this->_domDocument = $source->ownerDocument; - $this->_xpath = new DOMXPath($this->_domDocument); - $this->_data['type'] = $type; - $this->_registerNamespaces(); - $this->_loadExtensions(); - - $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\\Feed'); - $this->_extensions['Atom\\Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); - $atomClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\\Feed'); - $this->_extensions['DublinCore\\Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); - foreach ($this->_extensions as $extension) { + $this->domDocument = $source->ownerDocument; + $this->xpath = new DOMXPath($this->domDocument); + $this->data['type'] = $type; + $this->registerNamespaces(); + $this->loadExtensions(); + + $manager = Reader\Reader::getExtensionManager(); + $extensions = array('Atom\Feed', 'DublinCore\Feed'); + + foreach ($extensions as $name) { + $extension = $manager->get($name); + $extension->setDomDocument($this->domDocument); + $extension->setType($this->data['type']); + $extension->setXpath($this->xpath); + $this->extensions[$name] = $extension; + } + + foreach ($this->extensions as $extension) { $extension->setXpathPrefix(rtrim($xpathPrefix, '/') . '/atom:source'); } } @@ -86,6 +93,6 @@ public function valid() {} /** * @return void */ - protected function _indexEntries() {} + protected function indexEntries() {} } diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index 96b16462..56493e38 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -33,17 +33,28 @@ public function __construct(DOMDocument $dom, $type = null) { parent::__construct($dom, $type); - $dublinCoreClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\Feed'); - $this->_extensions['DublinCore\Feed'] = new $dublinCoreClass($dom, $this->_data['type'], $this->_xpath); - $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\\Feed'); - $this->_extensions['Atom\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); - - if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { + $manager = Reader\Reader::getExtensionManager(); + + $feed = $manager->get('DublinCore\Feed'); + $feed->setDomDocument($dom); + $feed->setType($this->data['type']); + $feed->setXpath($this->xpath); + $this->extensions['DublinCore\Feed'] = $feed; + + $feed = $manager->get('Atom\Feed'); + $feed->setDomDocument($dom); + $feed->setType($this->data['type']); + $feed->setXpath($this->xpath); + $this->extensions['Atom\Feed'] = $feed; + + if ($this->getType() !== Reader\Reader::TYPE_RSS_10 + && $this->getType() !== Reader\Reader::TYPE_RSS_090 + ) { $xpathPrefix = '/rss/channel'; } else { $xpathPrefix = '/rdf:RDF/rss:channel'; } - foreach ($this->_extensions as $extension) { + foreach ($this->extensions as $extension) { $extension->setXpathPrefix($xpathPrefix); } } @@ -72,8 +83,8 @@ public function getAuthor($index = 0) */ public function getAuthors() { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; + if (array_key_exists('authors', $this->data)) { + return $this->data['authors']; } $authors = array(); @@ -92,9 +103,9 @@ public function getAuthors() */ if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $list = $this->_xpath->query('//author'); + $list = $this->xpath->query('//author'); } else { - $list = $this->_xpath->query('//rss:author'); + $list = $this->xpath->query('//rss:author'); } if ($list->length) { foreach ($list as $author) { @@ -125,9 +136,9 @@ public function getAuthors() $authors = null; } - $this->_data['authors'] = $authors; + $this->data['authors'] = $authors; - return $this->_data['authors']; + return $this->data['authors']; } /** @@ -137,15 +148,15 @@ public function getAuthors() */ public function getCopyright() { - if (array_key_exists('copyright', $this->_data)) { - return $this->_data['copyright']; + if (array_key_exists('copyright', $this->data)) { + return $this->data['copyright']; } $copyright = null; if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $copyright = $this->_xpath->evaluate('string(/rss/channel/copyright)'); + $copyright = $this->xpath->evaluate('string(/rss/channel/copyright)'); } if (!$copyright && $this->getExtension('DublinCore') !== null) { @@ -160,9 +171,9 @@ public function getCopyright() $copyright = null; } - $this->_data['copyright'] = $copyright; + $this->data['copyright'] = $copyright; - return $this->_data['copyright']; + return $this->data['copyright']; } /** @@ -183,8 +194,8 @@ public function getDateCreated() */ public function getDateModified() { - if (array_key_exists('datemodified', $this->_data)) { - return $this->_data['datemodified']; + if (array_key_exists('datemodified', $this->data)) { + return $this->data['datemodified']; } $dateModified = null; @@ -192,9 +203,9 @@ public function getDateModified() if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $dateModified = $this->_xpath->evaluate('string(/rss/channel/pubDate)'); + $dateModified = $this->xpath->evaluate('string(/rss/channel/pubDate)'); if (!$dateModified) { - $dateModified = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)'); + $dateModified = $this->xpath->evaluate('string(/rss/channel/lastBuildDate)'); } if ($dateModified) { $dateModifiedParsed = strtotime($dateModified); @@ -234,9 +245,9 @@ public function getDateModified() $date = null; } - $this->_data['datemodified'] = $date; + $this->data['datemodified'] = $date; - return $this->_data['datemodified']; + return $this->data['datemodified']; } /** @@ -246,8 +257,8 @@ public function getDateModified() */ public function getLastBuildDate() { - if (array_key_exists('lastBuildDate', $this->_data)) { - return $this->_data['lastBuildDate']; + if (array_key_exists('lastBuildDate', $this->data)) { + return $this->data['lastBuildDate']; } $lastBuildDate = null; @@ -255,7 +266,7 @@ public function getLastBuildDate() if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $lastBuildDate = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)'); + $lastBuildDate = $this->xpath->evaluate('string(/rss/channel/lastBuildDate)'); if ($lastBuildDate) { $lastBuildDateParsed = strtotime($lastBuildDate); if ($lastBuildDateParsed) { @@ -286,9 +297,9 @@ public function getLastBuildDate() $date = null; } - $this->_data['lastBuildDate'] = $date; + $this->data['lastBuildDate'] = $date; - return $this->_data['lastBuildDate']; + return $this->data['lastBuildDate']; } /** @@ -298,17 +309,17 @@ public function getLastBuildDate() */ public function getDescription() { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; + if (array_key_exists('description', $this->data)) { + return $this->data['description']; } $description = null; if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $description = $this->_xpath->evaluate('string(/rss/channel/description)'); + $description = $this->xpath->evaluate('string(/rss/channel/description)'); } else { - $description = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:description)'); + $description = $this->xpath->evaluate('string(/rdf:RDF/rss:channel/rss:description)'); } if (!$description && $this->getExtension('DublinCore') !== null) { @@ -323,9 +334,9 @@ public function getDescription() $description = null; } - $this->_data['description'] = $description; + $this->data['description'] = $description; - return $this->_data['description']; + return $this->data['description']; } /** @@ -335,15 +346,15 @@ public function getDescription() */ public function getId() { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; + if (array_key_exists('id', $this->data)) { + return $this->data['id']; } $id = null; if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $id = $this->_xpath->evaluate('string(/rss/channel/guid)'); + $id = $this->xpath->evaluate('string(/rss/channel/guid)'); } if (!$id && $this->getExtension('DublinCore') !== null) { @@ -364,9 +375,9 @@ public function getId() } } - $this->_data['id'] = $id; + $this->data['id'] = $id; - return $this->_data['id']; + return $this->data['id']; } /** @@ -376,41 +387,41 @@ public function getId() */ public function getImage() { - if (array_key_exists('image', $this->_data)) { - return $this->_data['image']; + if (array_key_exists('image', $this->data)) { + return $this->data['image']; } if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $list = $this->_xpath->query('/rss/channel/image'); + $list = $this->xpath->query('/rss/channel/image'); $prefix = '/rss/channel/image[1]'; } else { - $list = $this->_xpath->query('/rdf:RDF/rss:channel/rss:image'); + $list = $this->xpath->query('/rdf:RDF/rss:channel/rss:image'); $prefix = '/rdf:RDF/rss:channel/rss:image[1]'; } if ($list->length > 0) { $image = array(); - $value = $this->_xpath->evaluate('string(' . $prefix . '/url)'); + $value = $this->xpath->evaluate('string(' . $prefix . '/url)'); if ($value) { $image['uri'] = $value; } - $value = $this->_xpath->evaluate('string(' . $prefix . '/link)'); + $value = $this->xpath->evaluate('string(' . $prefix . '/link)'); if ($value) { $image['link'] = $value; } - $value = $this->_xpath->evaluate('string(' . $prefix . '/title)'); + $value = $this->xpath->evaluate('string(' . $prefix . '/title)'); if ($value) { $image['title'] = $value; } - $value = $this->_xpath->evaluate('string(' . $prefix . '/height)'); + $value = $this->xpath->evaluate('string(' . $prefix . '/height)'); if ($value) { $image['height'] = $value; } - $value = $this->_xpath->evaluate('string(' . $prefix . '/width)'); + $value = $this->xpath->evaluate('string(' . $prefix . '/width)'); if ($value) { $image['width'] = $value; } - $value = $this->_xpath->evaluate('string(' . $prefix . '/description)'); + $value = $this->xpath->evaluate('string(' . $prefix . '/description)'); if ($value) { $image['description'] = $value; } @@ -418,9 +429,9 @@ public function getImage() $image = null; } - $this->_data['image'] = $image; + $this->data['image'] = $image; - return $this->_data['image']; + return $this->data['image']; } /** @@ -430,15 +441,15 @@ public function getImage() */ public function getLanguage() { - if (array_key_exists('language', $this->_data)) { - return $this->_data['language']; + if (array_key_exists('language', $this->data)) { + return $this->data['language']; } $language = null; if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $language = $this->_xpath->evaluate('string(/rss/channel/language)'); + $language = $this->xpath->evaluate('string(/rss/channel/language)'); } if (!$language && $this->getExtension('DublinCore') !== null) { @@ -450,16 +461,16 @@ public function getLanguage() } if (!$language) { - $language = $this->_xpath->evaluate('string(//@xml:lang[1])'); + $language = $this->xpath->evaluate('string(//@xml:lang[1])'); } if (!$language) { $language = null; } - $this->_data['language'] = $language; + $this->data['language'] = $language; - return $this->_data['language']; + return $this->data['language']; } /** @@ -469,17 +480,17 @@ public function getLanguage() */ public function getLink() { - if (array_key_exists('link', $this->_data)) { - return $this->_data['link']; + if (array_key_exists('link', $this->data)) { + return $this->data['link']; } $link = null; if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $link = $this->_xpath->evaluate('string(/rss/channel/link)'); + $link = $this->xpath->evaluate('string(/rss/channel/link)'); } else { - $link = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:link)'); + $link = $this->xpath->evaluate('string(/rdf:RDF/rss:channel/rss:link)'); } if (empty($link)) { @@ -490,9 +501,9 @@ public function getLink() $link = null; } - $this->_data['link'] = $link; + $this->data['link'] = $link; - return $this->_data['link']; + return $this->data['link']; } /** @@ -502,8 +513,8 @@ public function getLink() */ public function getFeedLink() { - if (array_key_exists('feedlink', $this->_data)) { - return $this->_data['feedlink']; + if (array_key_exists('feedlink', $this->data)) { + return $this->data['feedlink']; } $link = null; @@ -514,9 +525,9 @@ public function getFeedLink() $link = $this->getOriginalSourceUri(); } - $this->_data['feedlink'] = $link; + $this->data['feedlink'] = $link; - return $this->_data['feedlink']; + return $this->data['feedlink']; } /** @@ -526,23 +537,23 @@ public function getFeedLink() */ public function getGenerator() { - if (array_key_exists('generator', $this->_data)) { - return $this->_data['generator']; + if (array_key_exists('generator', $this->data)) { + return $this->data['generator']; } $generator = null; if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $generator = $this->_xpath->evaluate('string(/rss/channel/generator)'); + $generator = $this->xpath->evaluate('string(/rss/channel/generator)'); } if (!$generator) { if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $generator = $this->_xpath->evaluate('string(/rss/channel/atom:generator)'); + $generator = $this->xpath->evaluate('string(/rss/channel/atom:generator)'); } else { - $generator = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/atom:generator)'); + $generator = $this->xpath->evaluate('string(/rdf:RDF/rss:channel/atom:generator)'); } } @@ -554,9 +565,9 @@ public function getGenerator() $generator = null; } - $this->_data['generator'] = $generator; + $this->data['generator'] = $generator; - return $this->_data['generator']; + return $this->data['generator']; } /** @@ -566,17 +577,17 @@ public function getGenerator() */ public function getTitle() { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; + if (array_key_exists('title', $this->data)) { + return $this->data['title']; } $title = null; if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $title = $this->_xpath->evaluate('string(/rss/channel/title)'); + $title = $this->xpath->evaluate('string(/rss/channel/title)'); } else { - $title = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:title)'); + $title = $this->xpath->evaluate('string(/rdf:RDF/rss:channel/rss:title)'); } if (!$title && $this->getExtension('DublinCore') !== null) { @@ -591,9 +602,9 @@ public function getTitle() $title = null; } - $this->_data['title'] = $title; + $this->data['title'] = $title; - return $this->_data['title']; + return $this->data['title']; } /** @@ -603,8 +614,8 @@ public function getTitle() */ public function getHubs() { - if (array_key_exists('hubs', $this->_data)) { - return $this->_data['hubs']; + if (array_key_exists('hubs', $this->data)) { + return $this->data['hubs']; } $hubs = $this->getExtension('Atom')->getHubs(); @@ -615,9 +626,9 @@ public function getHubs() $hubs = array_unique($hubs); } - $this->_data['hubs'] = $hubs; + $this->data['hubs'] = $hubs; - return $this->_data['hubs']; + return $this->data['hubs']; } /** @@ -627,15 +638,15 @@ public function getHubs() */ public function getCategories() { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; + if (array_key_exists('categories', $this->data)) { + return $this->data['categories']; } if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { - $list = $this->_xpath->query('/rss/channel//category'); + $list = $this->xpath->query('/rss/channel//category'); } else { - $list = $this->_xpath->query('/rdf:RDF/rss:channel//rss:category'); + $list = $this->xpath->query('/rdf:RDF/rss:channel//rss:category'); } if ($list->length) { @@ -655,27 +666,27 @@ public function getCategories() $categoryCollection = $this->getExtension('Atom')->getCategories(); } - $this->_data['categories'] = $categoryCollection; + $this->data['categories'] = $categoryCollection; - return $this->_data['categories']; + return $this->data['categories']; } /** * Read all entries to the internal entries array * */ - protected function _indexEntries() + 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'); + $entries = $this->xpath->evaluate('//item'); } else { - $entries = $this->_xpath->evaluate('//rss:item'); + $entries = $this->xpath->evaluate('//rss:item'); } foreach($entries as $index=>$entry) { - $this->_entries[$index] = $entry; + $this->entries[$index] = $entry; } } @@ -683,17 +694,17 @@ protected function _indexEntries() * Register the default namespaces for the current feed format * */ - protected function _registerNamespaces() + protected function registerNamespaces() { - switch ($this->_data['type']) { + switch ($this->data['type']) { case Reader\Reader::TYPE_RSS_10: - $this->_xpath->registerNamespace('rdf', Reader\Reader::NAMESPACE_RDF); - $this->_xpath->registerNamespace('rss', Reader\Reader::NAMESPACE_RSS_10); + $this->xpath->registerNamespace('rdf', Reader\Reader::NAMESPACE_RDF); + $this->xpath->registerNamespace('rss', Reader\Reader::NAMESPACE_RSS_10); break; case Reader\Reader::TYPE_RSS_090: - $this->_xpath->registerNamespace('rdf', Reader\Reader::NAMESPACE_RDF); - $this->_xpath->registerNamespace('rss', Reader\Reader::NAMESPACE_RSS_090); + $this->xpath->registerNamespace('rdf', Reader\Reader::NAMESPACE_RDF); + $this->xpath->registerNamespace('rss', Reader\Reader::NAMESPACE_RSS_090); break; } } diff --git a/src/Reader/Reader.php b/src/Reader/Reader.php index fad9c8bf..a4350c5c 100644 --- a/src/Reader/Reader.php +++ b/src/Reader/Reader.php @@ -14,7 +14,6 @@ use DOMXPath; use Zend\Cache\Storage\StorageInterface as CacheStorage; use Zend\Http; -use Zend\Loader; use Zend\Stdlib\ErrorHandler; /** @@ -56,29 +55,27 @@ class Reader * * @var CacheStorage */ - protected static $_cache = null; + protected static $cache = null; /** * HTTP client object to use for retrieving feeds * * @var \Zend\Http\Client */ - protected static $_httpClient = null; + protected static $httpClient = null; /** * Override HTTP PUT and DELETE request methods? * * @var boolean */ - protected static $_httpMethodOverride = false; + protected static $httpMethodOverride = false; - protected static $_httpConditionalGet = false; + protected static $httpConditionalGet = false; - protected static $_pluginLoader = null; + protected static $extensionManager = null; - protected static $_prefixPaths = array(); - - protected static $_extensions = array( + protected static $extensions = array( 'feed' => array( 'DublinCore\Feed', 'Atom\Feed' @@ -104,7 +101,7 @@ class Reader */ public static function getCache() { - return self::$_cache; + return self::$cache; } /** @@ -115,7 +112,7 @@ public static function getCache() */ public static function setCache(CacheStorage $cache) { - self::$_cache = $cache; + self::$cache = $cache; } /** @@ -128,7 +125,7 @@ public static function setCache(CacheStorage $cache) */ public static function setHttpClient(Http\Client $httpClient) { - self::$_httpClient = $httpClient; + self::$httpClient = $httpClient; } @@ -139,11 +136,11 @@ public static function setHttpClient(Http\Client $httpClient) */ public static function getHttpClient() { - if (!self::$_httpClient instanceof Http\Client) { - self::$_httpClient = new Http\Client(); + if (!self::$httpClient instanceof Http\Client) { + self::$httpClient = new Http\Client(); } - return self::$_httpClient; + return self::$httpClient; } /** @@ -161,7 +158,7 @@ public static function getHttpClient() */ public static function setHttpMethodOverride($override = true) { - self::$_httpMethodOverride = $override; + self::$httpMethodOverride = $override; } /** @@ -171,7 +168,7 @@ public static function setHttpMethodOverride($override = true) */ public static function getHttpMethodOverride() { - return self::$_httpMethodOverride; + return self::$httpMethodOverride; } /** @@ -182,7 +179,7 @@ public static function getHttpMethodOverride() */ public static function useHttpConditionalGet($bool = true) { - self::$_httpConditionalGet = $bool; + self::$httpConditionalGet = $bool; } /** @@ -206,7 +203,7 @@ public static function import($uri, $etag = null, $lastModified = null) $client->setUri($uri); $cacheId = 'Zend_Feed_Reader_' . md5($uri); - if (self::$_httpConditionalGet && $cache) { + if (self::$httpConditionalGet && $cache) { $data = $cache->getItem($cacheId); if ($data) { if ($etag === null) { @@ -289,7 +286,7 @@ public static function importString($string) $type = self::detectType($dom); - self::_registerCoreExtensions(); + self::registerCoreExtensions(); if (substr($type, 0, 3) == 'rss') { $reader = new Feed\Rss($dom, $type); @@ -474,67 +471,26 @@ public static function detectType($feed, $specOnly = false) } /** - * Set plugin loader for use with Extensions - * - * @param \Zend\Loader\ShortNameLocator $loader - */ - public static function setPluginLoader(Loader\ShortNameLocator $loader) - { - self::$_pluginLoader = $loader; - } - - /** - * Get plugin loader for use with Extensions - * - * @return \Zend\Loader\PrefixPathLoader $loader - */ - public static function getPluginLoader() - { - if (!isset(self::$_pluginLoader)) { - self::setPluginLoader(new Loader\PrefixPathLoader(array( - 'Zend\Feed\Reader\Extension\\' => 'Zend/Feed/Reader/Extension/', - ))); - } - return self::$_pluginLoader; - } - - /** - * Add prefix path for loading Extensions + * Set plugin manager for use with Extensions * - * @param string $prefix - * @param string $path - * @return void + * @param ExtensionManager $extensionManager */ - public static function addPrefixPath($prefix, $path) + public static function setExtensionManager(ExtensionManager $extensionManager) { - $pluginLoader = self::getPluginLoader(); - if ($pluginLoader instanceof Loader\PrefixPathMapper) { - $prefix = rtrim($prefix, '\\'); - $path = rtrim($path, DIRECTORY_SEPARATOR); - $pluginLoader->addPrefixPath($prefix, $path); - } + self::$extensionManager = $extensionManager; } /** - * Add multiple Extension prefix paths at once + * Get plugin manager for use with Extensions * - * @param array $spec - * @return void + * @return ExtensionManager */ - public static function addPrefixPaths(array $spec) + public static function getExtensionManager() { - $pluginLoader = self::getPluginLoader(); - if (!$pluginLoader instanceof Loader\PrefixPathMapper) { - return; - } - if (isset($spec['prefix']) && isset($spec['path'])) { - self::addPrefixPath($spec['prefix'], $spec['path']); - } - foreach ($spec as $prefixPath) { - if (isset($prefixPath['prefix']) && isset($prefixPath['path'])) { - self::addPrefixPath($prefixPath['prefix'], $prefixPath['path']); - } + if (!isset(self::$extensionManager)) { + self::setExtensionManager(new ExtensionManager()); } + return self::$extensionManager; } /** @@ -548,23 +504,22 @@ public static function registerExtension($name) { $feedName = $name . '\Feed'; $entryName = $name . '\Entry'; - $loader = self::getPluginLoader(); + $manager = self::getExtensionManager(); if (self::isRegistered($name)) { - if ($loader->isLoaded($feedName) || $loader->isLoaded($entryName)) { + if ($manager->has($feedName) || $manager->has($entryName)) { return; } } - $loader->load($feedName); - $loader->load($entryName); - if (!$loader->isLoaded($feedName) && !$loader->isLoaded($entryName)) { + + if (!$manager->has($feedName) && !$manager->has($entryName)) { throw new Exception\RuntimeException('Could not load extension: ' . $name . ' using Plugin Loader. Check prefix paths are configured and extension exists.'); } - if ($loader->isLoaded($feedName)) { - self::$_extensions['feed'][] = $feedName; + if ($manager->has($feedName)) { + self::$extensions['feed'][] = $feedName; } - if ($loader->isLoaded($entryName)) { - self::$_extensions['entry'][] = $entryName; + if ($manager->has($entryName)) { + self::$extensions['entry'][] = $entryName; } } @@ -578,8 +533,8 @@ public static function isRegistered($extensionName) { $feedName = $extensionName . '\Feed'; $entryName = $extensionName . '\Entry'; - if (in_array($feedName, self::$_extensions['feed']) - || in_array($entryName, self::$_extensions['entry']) + if (in_array($feedName, self::$extensions['feed']) + || in_array($entryName, self::$extensions['entry']) ) { return true; } @@ -593,7 +548,7 @@ public static function isRegistered($extensionName) */ public static function getExtensions() { - return self::$_extensions; + return self::$extensions; } /** @@ -603,13 +558,12 @@ public static function getExtensions() */ public static function reset() { - self::$_cache = null; - self::$_httpClient = null; - self::$_httpMethodOverride = false; - self::$_httpConditionalGet = false; - self::$_pluginLoader = null; - self::$_prefixPaths = array(); - self::$_extensions = array( + self::$cache = null; + self::$httpClient = null; + self::$httpMethodOverride = false; + self::$httpConditionalGet = false; + self::$extensionManager = null; + self::$extensions = array( 'feed' => array( 'DublinCore\Feed', 'Atom\Feed' @@ -634,7 +588,7 @@ public static function reset() * * @return void */ - protected static function _registerCoreExtensions() + protected static function registerCoreExtensions() { self::registerExtension('DublinCore'); self::registerExtension('Content'); @@ -663,5 +617,4 @@ public static function arrayUnique(array $array) } return $array; } - } diff --git a/test/Reader/ReaderTest.php b/test/Reader/ReaderTest.php index 6f9f8664..07c8e809 100644 --- a/test/Reader/ReaderTest.php +++ b/test/Reader/ReaderTest.php @@ -249,17 +249,13 @@ public function testGetsFeedLinksAndNormalisesRelativeUrlsOnUriWithPath() $this->assertEquals('http://foo/test.atom', $links->atom); } - public function testAddsPrefixPath() - { - $path = str_replace('#', DIRECTORY_SEPARATOR, '#A#B#C'); - Reader\Reader::addPrefixPath('A\\B\\C', $path); - $prefixPaths = Reader\Reader::getPluginLoader()->getPaths(); - $this->assertEquals($path . DIRECTORY_SEPARATOR, $prefixPaths['A\\B\\C\\'][0]); - } - public function testRegistersUserExtension() { - Reader\Reader::addPrefixPath('My\\Extension', dirname(__FILE__) . '/_files/My/Extension'); + require_once __DIR__ . '/_files/My/Extension/JungleBooks/Entry.php'; + require_once __DIR__ . '/_files/My/Extension/JungleBooks/Feed.php'; + $manager = Reader\Reader::getExtensionManager(); + $manager->setInvokableClass('JungleBooks\Entry', 'My\Extension\JungleBooks\Entry'); + $manager->setInvokableClass('JungleBooks\Feed', 'My\Extension\JungleBooks\Feed'); Reader\Reader::registerExtension('JungleBooks'); $this->assertTrue(Reader\Reader::isRegistered('JungleBooks')); diff --git a/test/Reader/_files/My/Extension/JungleBooks/Entry.php b/test/Reader/_files/My/Extension/JungleBooks/Entry.php index 15813603..77115a89 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Entry.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Entry.php @@ -22,19 +22,19 @@ class Entry extends Extension\AbstractEntry public function getIsbn() { - if (isset($this->_data['isbn'])) { - return $this->_data['isbn']; + if (isset($this->data['isbn'])) { + return $this->data['isbn']; } - $isbn = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/jungle:isbn)'); + $isbn = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/jungle:isbn)'); if (!$isbn) { $isbn = null; } - $this->_data['isbn'] = $title; - return $this->_data['isbn']; + $this->data['isbn'] = $title; + return $this->data['isbn']; } - protected function _registerNamespaces() + protected function registerNamespaces() { - $this->_xpath->registerNamespace('jungle', 'http://example.com/junglebooks/rss/module/1.0/'); + $this->xpath->registerNamespace('jungle', 'http://example.com/junglebooks/rss/module/1.0/'); } } diff --git a/test/Reader/_files/My/Extension/JungleBooks/Feed.php b/test/Reader/_files/My/Extension/JungleBooks/Feed.php index 4ff689ce..ab1235dc 100644 --- a/test/Reader/_files/My/Extension/JungleBooks/Feed.php +++ b/test/Reader/_files/My/Extension/JungleBooks/Feed.php @@ -22,19 +22,19 @@ class Feed extends Extension\AbstractFeed public function getDaysPopularBookLink() { - if (isset($this->_data['dayPopular'])) { - return $this->_data['dayPopular']; + if (isset($this->data['dayPopular'])) { + return $this->data['dayPopular']; } - $dayPopular = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/jungle:dayPopular)'); + $dayPopular = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/jungle:dayPopular)'); if (!$dayPopular) { $dayPopular = null; } - $this->_data['dayPopular'] = $dayPopular; - return $this->_data['dayPopular']; + $this->data['dayPopular'] = $dayPopular; + return $this->data['dayPopular']; } - protected function _registerNamespaces() + protected function registerNamespaces() { - $this->_xpath->registerNamespace('jungle', 'http://example.com/junglebooks/rss/module/1.0/'); + $this->xpath->registerNamespace('jungle', 'http://example.com/junglebooks/rss/module/1.0/'); } } From e01c5040d0865412cbe378a716ab0cff80de1616 Mon Sep 17 00:00:00 2001 From: tr Date: Fri, 27 Jul 2012 19:52:35 +0100 Subject: [PATCH 230/238] really fixed mail errors and added some missing vars --- src/Writer/AbstractFeed.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Writer/AbstractFeed.php b/src/Writer/AbstractFeed.php index b54254b4..2935e4c8 100644 --- a/src/Writer/AbstractFeed.php +++ b/src/Writer/AbstractFeed.php @@ -35,6 +35,11 @@ class AbstractFeed */ protected $type = null; + /** + * @var $_extensions + */ + protected $extensions; + /** * Constructor: Primarily triggers the registration of core extensions and * loads those appropriate to this data container. @@ -751,7 +756,7 @@ public function remove($name) */ public function __call($method, $args) { - foreach ($this->_extensions as $extension) { + foreach ($this->extensions as $extension) { try { return call_user_func_array(array($extension, $method), $args); } catch (Exception\BadMethodCallException $e) { @@ -776,8 +781,8 @@ protected function _loadExtensions() if (!$manager->has($ext)) { throw new Exception\RuntimeException(sprintf('Unable to load extension "%s"; could not resolve to class', $ext)); } - $this->_extensions[$ext] = $manager->get($ext); - $this->_extensions[$ext]->setEncoding($this->getEncoding()); + $this->extensions[$ext] = $manager->get($ext); + $this->extensions[$ext]->setEncoding($this->getEncoding()); } } } From 6b4f8827a9990f805bcdbd6bac7b47d57487c542 Mon Sep 17 00:00:00 2001 From: Ralph Schindler Date: Wed, 1 Aug 2012 13:04:42 -0500 Subject: [PATCH 231/238] Fixed usage of Zend\Version in components that don't first "use" Zend\Version --- src/Writer/Renderer/Feed/AbstractAtom.php | 3 ++- src/Writer/Renderer/Feed/Atom/AbstractAtom.php | 3 ++- src/Writer/Renderer/Feed/Rss.php | 3 ++- test/Writer/Renderer/Feed/RssTest.php | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Writer/Renderer/Feed/AbstractAtom.php b/src/Writer/Renderer/Feed/AbstractAtom.php index 18c9abe4..29c36c06 100644 --- a/src/Writer/Renderer/Feed/AbstractAtom.php +++ b/src/Writer/Renderer/Feed/AbstractAtom.php @@ -15,6 +15,7 @@ use DOMElement; use Zend\Feed\Writer; use Zend\Feed\Writer\Renderer; +use Zend\Version\Version; /** * @category Zend @@ -137,7 +138,7 @@ protected function _setGenerator(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getGenerator()) { $this->getDataContainer()->setGenerator('Zend_Feed_Writer', - \Zend\Version::VERSION, 'http://framework.zend.com'); + Version::VERSION, 'http://framework.zend.com'); } $gdata = $this->getDataContainer()->getGenerator(); diff --git a/src/Writer/Renderer/Feed/Atom/AbstractAtom.php b/src/Writer/Renderer/Feed/Atom/AbstractAtom.php index e71b8f31..531eb6aa 100644 --- a/src/Writer/Renderer/Feed/Atom/AbstractAtom.php +++ b/src/Writer/Renderer/Feed/Atom/AbstractAtom.php @@ -14,6 +14,7 @@ use DOMDocument; use DOMElement; use Zend\Feed; +use Zend\Version\Version; /** * @category Zend @@ -136,7 +137,7 @@ protected function _setGenerator(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getGenerator()) { $this->getDataContainer()->setGenerator('Zend_Feed_Writer', - \Zend\Version::VERSION, 'http://framework.zend.com'); + Version::VERSION, 'http://framework.zend.com'); } $gdata = $this->getDataContainer()->getGenerator(); diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index 7bfd95dd..26e7b017 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -16,6 +16,7 @@ use Zend\Feed\Writer; use Zend\Feed\Writer\Renderer; use Zend\Uri; +use Zend\Version\Version; /** * @category Zend @@ -202,7 +203,7 @@ protected function _setGenerator(DOMDocument $dom, DOMElement $root) { if(!$this->getDataContainer()->getGenerator()) { $this->getDataContainer()->setGenerator('Zend_Feed_Writer', - \Zend\Version::VERSION, 'http://framework.zend.com'); + Version::VERSION, 'http://framework.zend.com'); } $gdata = $this->getDataContainer()->getGenerator(); diff --git a/test/Writer/Renderer/Feed/RssTest.php b/test/Writer/Renderer/Feed/RssTest.php index 12c69d15..fa49dfa4 100644 --- a/test/Writer/Renderer/Feed/RssTest.php +++ b/test/Writer/Renderer/Feed/RssTest.php @@ -178,7 +178,7 @@ public function testFeedGeneratorDefaultIsUsedIfGeneratorNotSetByHand() $rssFeed->render(); $feed = Reader\Reader::importString($rssFeed->saveXml()); $this->assertEquals( - 'Zend_Feed_Writer ' . \Zend\Version::VERSION . ' (http://framework.zend.com)', $feed->getGenerator()); + 'Zend_Feed_Writer ' . \Zend\Version\Version::VERSION . ' (http://framework.zend.com)', $feed->getGenerator()); } public function testFeedLanguageHasBeenSet() From aff0c02a5cd9ad6515b9e14b5321e236b12ae8d0 Mon Sep 17 00:00:00 2001 From: Padraic Brady Date: Wed, 1 Aug 2012 20:00:22 +0100 Subject: [PATCH 232/238] Disable external entity loading for DOMDocument when parsing XML feeds --- src/Reader/Reader.php | 4 ++++ test/Reader/ReaderTest.php | 8 ++++++++ test/Reader/_files/Reader/xxe-atom10.xml | 5 +++++ test/Reader/_files/Reader/xxe-info.txt | 1 + 4 files changed, 18 insertions(+) create mode 100644 test/Reader/_files/Reader/xxe-atom10.xml create mode 100644 test/Reader/_files/Reader/xxe-info.txt diff --git a/src/Reader/Reader.php b/src/Reader/Reader.php index 19ebf395..448c1555 100644 --- a/src/Reader/Reader.php +++ b/src/Reader/Reader.php @@ -269,8 +269,10 @@ public static function import($uri, $etag = null, $lastModified = null) public static function importString($string) { $libxml_errflag = libxml_use_internal_errors(true); + libxml_disable_entity_loader(true); $dom = new DOMDocument; $status = $dom->loadXML($string); + libxml_disable_entity_loader(false); libxml_use_internal_errors($libxml_errflag); if (!$status) { @@ -336,8 +338,10 @@ public static function findFeedLinks($uri) } $responseHtml = $response->getBody(); $libxml_errflag = libxml_use_internal_errors(true); + //libxml_disable_entity_loader(true); $dom = new DOMDocument; $status = $dom->loadHTML($responseHtml); + //libxml_disable_entity_loader(false); libxml_use_internal_errors($libxml_errflag); if (!$status) { // Build error message diff --git a/test/Reader/ReaderTest.php b/test/Reader/ReaderTest.php index 07c8e809..b2d3104f 100644 --- a/test/Reader/ReaderTest.php +++ b/test/Reader/ReaderTest.php @@ -261,6 +261,14 @@ public function testRegistersUserExtension() $this->assertTrue(Reader\Reader::isRegistered('JungleBooks')); } + public function testXxePreventionOnFeedParsing() + { + $string = file_get_contents($this->_feedSamplePath.'/Reader/xxe-atom10.xml'); + $string = str_replace('XXE_URI', $this->_feedSamplePath.'/Reader/xxe-info.txt', $string); + $feed = Reader\Reader::importString($string); + $this->assertEquals('info:', $feed->getTitle()); + } + protected function _getTempDirectory() { $tmpdir = array(); diff --git a/test/Reader/_files/Reader/xxe-atom10.xml b/test/Reader/_files/Reader/xxe-atom10.xml new file mode 100644 index 00000000..add649f7 --- /dev/null +++ b/test/Reader/_files/Reader/xxe-atom10.xml @@ -0,0 +1,5 @@ + + ]> + + info:&discloseInfo; + \ No newline at end of file diff --git a/test/Reader/_files/Reader/xxe-info.txt b/test/Reader/_files/Reader/xxe-info.txt new file mode 100644 index 00000000..64b0eaee --- /dev/null +++ b/test/Reader/_files/Reader/xxe-info.txt @@ -0,0 +1 @@ +xxe-information-disclosed \ No newline at end of file From 3daad464ff4c6e7aabcc65bdea3857bd3674a94c Mon Sep 17 00:00:00 2001 From: Padraic Brady Date: Wed, 1 Aug 2012 20:18:31 +0100 Subject: [PATCH 233/238] Added additional disables on external entities - no disclosure involved, but still capable of DOS and local filesystem/http ops. --- src/Reader/Reader.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Reader/Reader.php b/src/Reader/Reader.php index 448c1555..ed87be89 100644 --- a/src/Reader/Reader.php +++ b/src/Reader/Reader.php @@ -338,10 +338,10 @@ public static function findFeedLinks($uri) } $responseHtml = $response->getBody(); $libxml_errflag = libxml_use_internal_errors(true); - //libxml_disable_entity_loader(true); + libxml_disable_entity_loader(true); $dom = new DOMDocument; $status = $dom->loadHTML($responseHtml); - //libxml_disable_entity_loader(false); + libxml_disable_entity_loader(false); libxml_use_internal_errors($libxml_errflag); if (!$status) { // Build error message @@ -375,8 +375,10 @@ public static function detectType($feed, $specOnly = false) } elseif(is_string($feed) && !empty($feed)) { ErrorHandler::start(E_NOTICE|E_WARNING); ini_set('track_errors', 1); + libxml_disable_entity_loader(true); $dom = new DOMDocument; $status = $dom->loadXML($feed); + libxml_disable_entity_loader(false); ini_restore('track_errors'); ErrorHandler::stop(); if (!$status) { From 339c074926f2ecfb3d71686e4acc6dd1957dfaa4 Mon Sep 17 00:00:00 2001 From: Michael Kliewe Date: Sat, 11 Aug 2012 11:27:30 +0200 Subject: [PATCH 234/238] removed all "@return void" in constructors --- src/Reader/AbstractEntry.php | 1 - src/Reader/Entry/AbstractEntry.php | 1 - src/Reader/Entry/Atom.php | 1 - src/Reader/Entry/Rss.php | 1 - src/Writer/AbstractFeed.php | 1 - src/Writer/Entry.php | 1 - src/Writer/Renderer/AbstractRenderer.php | 1 - src/Writer/Renderer/Entry/Atom/Deleted.php | 1 - src/Writer/Renderer/Entry/AtomDeleted.php | 1 - src/Writer/Renderer/Entry/Rss.php | 1 - src/Writer/Renderer/Feed/AbstractAtom.php | 1 - src/Writer/Renderer/Feed/Atom.php | 1 - src/Writer/Renderer/Feed/Atom/AbstractAtom.php | 1 - src/Writer/Renderer/Feed/Atom/Source.php | 1 - src/Writer/Renderer/Feed/AtomSource.php | 1 - src/Writer/Renderer/Feed/Rss.php | 1 - test/Reader/Entry/_files/Common/atom.xml | 1 - test/Reader/Entry/_files/Common/atom_noencodingdefined.xml | 1 - test/Reader/Entry/_files/Common/rss.xml | 1 - test/Reader/Feed/_files/Common/atom.xml | 1 - test/Reader/Feed/_files/Common/atom_noencodingdefined.xml | 1 - test/Reader/Feed/_files/Common/atom_rewrittenbydom.xml | 1 - test/Reader/Feed/_files/Common/rss.xml | 1 - test/Reader/Integration/_files/wordpress-atom10.xml | 1 - test/Reader/Integration/_files/wordpress-rss2-dc-atom.xml | 1 - 25 files changed, 25 deletions(-) diff --git a/src/Reader/AbstractEntry.php b/src/Reader/AbstractEntry.php index a52f147c..fdb673f2 100644 --- a/src/Reader/AbstractEntry.php +++ b/src/Reader/AbstractEntry.php @@ -68,7 +68,6 @@ abstract class AbstractEntry * @param DOMElement $entry * @param int $entryKey * @param null|string $type - * @return void */ public function __construct(DOMElement $entry, $entryKey, $type = null) { diff --git a/src/Reader/Entry/AbstractEntry.php b/src/Reader/Entry/AbstractEntry.php index bfa38acf..5a21d5e8 100644 --- a/src/Reader/Entry/AbstractEntry.php +++ b/src/Reader/Entry/AbstractEntry.php @@ -70,7 +70,6 @@ abstract class AbstractEntry * @param DOMElement $entry * @param int $entryKey * @param string $type - * @return void */ public function __construct(DOMElement $entry, $entryKey, $type = null) { diff --git a/src/Reader/Entry/Atom.php b/src/Reader/Entry/Atom.php index a774c1b9..ec966292 100644 --- a/src/Reader/Entry/Atom.php +++ b/src/Reader/Entry/Atom.php @@ -33,7 +33,6 @@ class Atom extends AbstractEntry implements EntryInterface * @param DOMElement $entry * @param int $entryKey * @param string $type - * @return void */ public function __construct(DOMElement $entry, $entryKey, $type = null) { diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index 7d54cea4..586a5f6a 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -43,7 +43,6 @@ class Rss extends AbstractEntry implements EntryInterface * @param DOMElement $entry * @param string $entryKey * @param string $type - * @return void */ public function __construct(DOMElement $entry, $entryKey, $type = null) { diff --git a/src/Writer/AbstractFeed.php b/src/Writer/AbstractFeed.php index 2935e4c8..555686c2 100644 --- a/src/Writer/AbstractFeed.php +++ b/src/Writer/AbstractFeed.php @@ -44,7 +44,6 @@ class AbstractFeed * Constructor: Primarily triggers the registration of core extensions and * loads those appropriate to this data container. * - * @return void */ public function __construct() { diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index 17211719..2e5bfee2 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -47,7 +47,6 @@ class Entry * Constructor: Primarily triggers the registration of core extensions and * loads those appropriate to this data container. * - * @return void */ public function __construct() { diff --git a/src/Writer/Renderer/AbstractRenderer.php b/src/Writer/Renderer/AbstractRenderer.php index 60fb63bb..7704ecde 100644 --- a/src/Writer/Renderer/AbstractRenderer.php +++ b/src/Writer/Renderer/AbstractRenderer.php @@ -70,7 +70,6 @@ class AbstractRenderer * Constructor * * @param mixed $container - * @return void */ public function __construct($container) { diff --git a/src/Writer/Renderer/Entry/Atom/Deleted.php b/src/Writer/Renderer/Entry/Atom/Deleted.php index db800926..294f1b4f 100644 --- a/src/Writer/Renderer/Entry/Atom/Deleted.php +++ b/src/Writer/Renderer/Entry/Atom/Deleted.php @@ -26,7 +26,6 @@ class Deleted * Constructor * * @param \Zend\Feed\Writer\Deleted $container - * @return void */ public function __construct (\Zend\Feed\Writer\Deleted $container) { diff --git a/src/Writer/Renderer/Entry/AtomDeleted.php b/src/Writer/Renderer/Entry/AtomDeleted.php index e59e2aba..be7d0f0b 100644 --- a/src/Writer/Renderer/Entry/AtomDeleted.php +++ b/src/Writer/Renderer/Entry/AtomDeleted.php @@ -26,7 +26,6 @@ class AtomDeleted extends Renderer\AbstractRenderer implements Renderer\Renderer * Constructor * * @param Writer\Deleted $container - * @return void */ public function __construct (Writer\Deleted $container) { diff --git a/src/Writer/Renderer/Entry/Rss.php b/src/Writer/Renderer/Entry/Rss.php index 5dd6ae61..cc5b1f73 100644 --- a/src/Writer/Renderer/Entry/Rss.php +++ b/src/Writer/Renderer/Entry/Rss.php @@ -27,7 +27,6 @@ class Rss extends Renderer\AbstractRenderer implements Renderer\RendererInterfac * Constructor * * @param Writer\Entry $container - * @return void */ public function __construct (Writer\Entry $container) { diff --git a/src/Writer/Renderer/Feed/AbstractAtom.php b/src/Writer/Renderer/Feed/AbstractAtom.php index db8ba0ba..6531ca87 100644 --- a/src/Writer/Renderer/Feed/AbstractAtom.php +++ b/src/Writer/Renderer/Feed/AbstractAtom.php @@ -27,7 +27,6 @@ class AbstractAtom extends Renderer\AbstractRenderer * Constructor * * @param Zend_Feed_Writer_Feed $container - * @return void */ public function __construct ($container) { diff --git a/src/Writer/Renderer/Feed/Atom.php b/src/Writer/Renderer/Feed/Atom.php index 0e95f01b..87bacf3f 100644 --- a/src/Writer/Renderer/Feed/Atom.php +++ b/src/Writer/Renderer/Feed/Atom.php @@ -24,7 +24,6 @@ class Atom extends AbstractAtom implements Renderer\RendererInterface * Constructor * * @param Writer\Feed $container - * @return void */ public function __construct (Writer\Feed $container) { diff --git a/src/Writer/Renderer/Feed/Atom/AbstractAtom.php b/src/Writer/Renderer/Feed/Atom/AbstractAtom.php index f57c9213..5569f456 100644 --- a/src/Writer/Renderer/Feed/Atom/AbstractAtom.php +++ b/src/Writer/Renderer/Feed/Atom/AbstractAtom.php @@ -26,7 +26,6 @@ class AbstractAtom extends Feed\Writer\Renderer\AbstractRenderer * Constructor * * @param \Zend\Feed\Writer\Feed $container - * @return void */ public function __construct ($container) { diff --git a/src/Writer/Renderer/Feed/Atom/Source.php b/src/Writer/Renderer/Feed/Atom/Source.php index 51e3e4bd..c545fd54 100644 --- a/src/Writer/Renderer/Feed/Atom/Source.php +++ b/src/Writer/Renderer/Feed/Atom/Source.php @@ -24,7 +24,6 @@ class Source extends AbstractAtom implements \Zend\Feed\Writer\Renderer\Renderer * Constructor * * @param \Zend\Feed\Writer\Source $container - * @return void */ public function __construct (\Zend\Feed\Writer\Source $container) { diff --git a/src/Writer/Renderer/Feed/AtomSource.php b/src/Writer/Renderer/Feed/AtomSource.php index 5010495a..a8dca0e3 100644 --- a/src/Writer/Renderer/Feed/AtomSource.php +++ b/src/Writer/Renderer/Feed/AtomSource.php @@ -26,7 +26,6 @@ class AtomSource extends AbstractAtom implements Renderer\RendererInterface * Constructor * * @param Zend_Feed_Writer_Feed_Source $container - * @return void */ public function __construct (Writer\Source $container) { diff --git a/src/Writer/Renderer/Feed/Rss.php b/src/Writer/Renderer/Feed/Rss.php index 26e7b017..0f48ff79 100644 --- a/src/Writer/Renderer/Feed/Rss.php +++ b/src/Writer/Renderer/Feed/Rss.php @@ -28,7 +28,6 @@ class Rss extends Renderer\AbstractRenderer implements Renderer\RendererInterfac * Constructor * * @param Zend_Feed_Writer_Feed $container - * @return void */ public function __construct (Writer\Feed $container) { diff --git a/test/Reader/Entry/_files/Common/atom.xml b/test/Reader/Entry/_files/Common/atom.xml index 29c4fe30..b4236842 100644 --- a/test/Reader/Entry/_files/Common/atom.xml +++ b/test/Reader/Entry/_files/Common/atom.xml @@ -525,7 +525,6 @@ class Wp_Amf_Gateway * * @param array $dbConfig * @param string $prefix - * @return void */ public function __construct(array $dbConfig, $prefix) { diff --git a/test/Reader/Entry/_files/Common/atom_noencodingdefined.xml b/test/Reader/Entry/_files/Common/atom_noencodingdefined.xml index 69dcd46b..02084ab6 100644 --- a/test/Reader/Entry/_files/Common/atom_noencodingdefined.xml +++ b/test/Reader/Entry/_files/Common/atom_noencodingdefined.xml @@ -525,7 +525,6 @@ class Wp_Amf_Gateway * * @param array $dbConfig * @param string $prefix - * @return void */ public function __construct(array $dbConfig, $prefix) { diff --git a/test/Reader/Entry/_files/Common/rss.xml b/test/Reader/Entry/_files/Common/rss.xml index 75f0e70c..f8bb28ea 100644 --- a/test/Reader/Entry/_files/Common/rss.xml +++ b/test/Reader/Entry/_files/Common/rss.xml @@ -504,7 +504,6 @@ class Wp_Amf_Gateway * * @param array $dbConfig * @param string $prefix - * @return void */ public function __construct(array $dbConfig, $prefix) { diff --git a/test/Reader/Feed/_files/Common/atom.xml b/test/Reader/Feed/_files/Common/atom.xml index 29c4fe30..b4236842 100644 --- a/test/Reader/Feed/_files/Common/atom.xml +++ b/test/Reader/Feed/_files/Common/atom.xml @@ -525,7 +525,6 @@ class Wp_Amf_Gateway * * @param array $dbConfig * @param string $prefix - * @return void */ public function __construct(array $dbConfig, $prefix) { diff --git a/test/Reader/Feed/_files/Common/atom_noencodingdefined.xml b/test/Reader/Feed/_files/Common/atom_noencodingdefined.xml index 69dcd46b..02084ab6 100644 --- a/test/Reader/Feed/_files/Common/atom_noencodingdefined.xml +++ b/test/Reader/Feed/_files/Common/atom_noencodingdefined.xml @@ -525,7 +525,6 @@ class Wp_Amf_Gateway * * @param array $dbConfig * @param string $prefix - * @return void */ public function __construct(array $dbConfig, $prefix) { diff --git a/test/Reader/Feed/_files/Common/atom_rewrittenbydom.xml b/test/Reader/Feed/_files/Common/atom_rewrittenbydom.xml index 378e71b4..b560b108 100644 --- a/test/Reader/Feed/_files/Common/atom_rewrittenbydom.xml +++ b/test/Reader/Feed/_files/Common/atom_rewrittenbydom.xml @@ -521,7 +521,6 @@ class Wp_Amf_Gateway * * @param array $dbConfig * @param string $prefix - * @return void */ public function __construct(array $dbConfig, $prefix) { diff --git a/test/Reader/Feed/_files/Common/rss.xml b/test/Reader/Feed/_files/Common/rss.xml index 75f0e70c..f8bb28ea 100644 --- a/test/Reader/Feed/_files/Common/rss.xml +++ b/test/Reader/Feed/_files/Common/rss.xml @@ -504,7 +504,6 @@ class Wp_Amf_Gateway * * @param array $dbConfig * @param string $prefix - * @return void */ public function __construct(array $dbConfig, $prefix) { diff --git a/test/Reader/Integration/_files/wordpress-atom10.xml b/test/Reader/Integration/_files/wordpress-atom10.xml index 29c4fe30..b4236842 100644 --- a/test/Reader/Integration/_files/wordpress-atom10.xml +++ b/test/Reader/Integration/_files/wordpress-atom10.xml @@ -525,7 +525,6 @@ class Wp_Amf_Gateway * * @param array $dbConfig * @param string $prefix - * @return void */ public function __construct(array $dbConfig, $prefix) { diff --git a/test/Reader/Integration/_files/wordpress-rss2-dc-atom.xml b/test/Reader/Integration/_files/wordpress-rss2-dc-atom.xml index 75f0e70c..f8bb28ea 100644 --- a/test/Reader/Integration/_files/wordpress-rss2-dc-atom.xml +++ b/test/Reader/Integration/_files/wordpress-rss2-dc-atom.xml @@ -504,7 +504,6 @@ class Wp_Amf_Gateway * * @param array $dbConfig * @param string $prefix - * @return void */ public function __construct(array $dbConfig, $prefix) { From 08d0eebe358d403dcda6ac3ecf50df51e9552b8a Mon Sep 17 00:00:00 2001 From: Michel Hunziker Date: Fri, 31 Aug 2012 10:57:14 +0200 Subject: [PATCH 235/238] More phpDoc updates to match php code --- src/Reader/Extension/AbstractFeed.php | 1 + src/Reader/Extension/Atom/Entry.php | 3 +++ src/Reader/Reader.php | 11 +++++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Reader/Extension/AbstractFeed.php b/src/Reader/Extension/AbstractFeed.php index 3770fc83..557e114e 100644 --- a/src/Reader/Extension/AbstractFeed.php +++ b/src/Reader/Extension/AbstractFeed.php @@ -166,6 +166,7 @@ public function getXpathPrefix() /** * Set the XPath prefix * + * @param string $prefix * @return void */ public function setXpathPrefix($prefix) diff --git a/src/Reader/Extension/Atom/Entry.php b/src/Reader/Extension/Atom/Entry.php index 5e0dbd2c..31226203 100644 --- a/src/Reader/Extension/Atom/Entry.php +++ b/src/Reader/Extension/Atom/Entry.php @@ -453,6 +453,7 @@ public function getCommentLink() /** * Returns a URI pointing to a feed of all comments for this entry * + * @param string $type * @return string */ public function getCommentFeedLink($type = 'atom') @@ -612,6 +613,8 @@ protected function registerNamespaces() /** * Detect the presence of any Atom namespaces in use + * + * @return string */ protected function getAtomType() { diff --git a/src/Reader/Reader.php b/src/Reader/Reader.php index 2edc6851..70a6f61a 100644 --- a/src/Reader/Reader.php +++ b/src/Reader/Reader.php @@ -183,13 +183,13 @@ public static function useHttpConditionalGet($bool = true) } /** - * Import a feed by providing a URL + * Import a feed by providing a URI * - * @param string $url The URL to the feed + * @param string $uri The URI to the feed * @param string $etag OPTIONAL Last received ETag for this resource * @param string $lastModified OPTIONAL Last-Modified value for this resource * @return Reader - * @throws Exception\ExceptionInterface + * @throws Exception\RuntimeException */ public static function import($uri, $etag = null, $lastModified = null) { @@ -264,6 +264,7 @@ public static function import($uri, $etag = null, $lastModified = null) * * @param string $string * @return Feed\FeedInterface + * @throws Exception\InvalidArgumentException * @throws Exception\RuntimeException */ public static function importString($string) @@ -372,8 +373,10 @@ public static function findFeedLinks($uri) * Detect the feed type of the provided feed * * @param Feed\AbstractFeed|DOMDocument|string $feed + * @param bool $specOnly * @return string - * @throws Exception\ExceptionInterface + * @throws Exception\InvalidArgumentException + * @throws Exception\RuntimeException */ public static function detectType($feed, $specOnly = false) { From 4d9ee2185436805f62cc71e66e67901147a1635d Mon Sep 17 00:00:00 2001 From: Michel Hunziker Date: Fri, 31 Aug 2012 17:30:38 +0200 Subject: [PATCH 236/238] Add missing @throws annotations --- src/Writer/AbstractFeed.php | 1 + src/Writer/Extension/ITunes/Entry.php | 1 + src/Writer/FeedFactory.php | 2 ++ 3 files changed, 4 insertions(+) diff --git a/src/Writer/AbstractFeed.php b/src/Writer/AbstractFeed.php index a6ea27f4..b93e7275 100644 --- a/src/Writer/AbstractFeed.php +++ b/src/Writer/AbstractFeed.php @@ -770,6 +770,7 @@ public function __call($method, $args) /** * Load extensions from Zend_Feed_Writer * + * @throws Exception\RuntimeException * @return void */ protected function _loadExtensions() diff --git a/src/Writer/Extension/ITunes/Entry.php b/src/Writer/Extension/ITunes/Entry.php index ce6c400a..24ed2209 100644 --- a/src/Writer/Extension/ITunes/Entry.php +++ b/src/Writer/Extension/ITunes/Entry.php @@ -209,6 +209,7 @@ public function setItunesSummary($value) * * @param string $method * @param array $params + * @throws Writer\Exception\BadMethodCallException * @return mixed */ public function __call($method, array $params) diff --git a/src/Writer/FeedFactory.php b/src/Writer/FeedFactory.php index 2abc8bc3..899895e2 100644 --- a/src/Writer/FeedFactory.php +++ b/src/Writer/FeedFactory.php @@ -23,6 +23,7 @@ abstract class FeedFactory * Create and return a Feed based on data provided. * * @param array|\Traversable $data + * @throws Exception\InvalidArgumentException * @return Feed */ public static function factory($data) @@ -88,6 +89,7 @@ protected static function convertKey($key) * * @param array|Traversable $entries * @param Feed $feed + * @throws Exception\InvalidArgumentException * @return void */ protected static function createEntries($entries, Feed $feed) From 5eca80ac1e27b97eb0d89367410a20981eb3f5df Mon Sep 17 00:00:00 2001 From: Michel Hunziker Date: Sat, 1 Sep 2012 20:40:03 +0200 Subject: [PATCH 237/238] Resolve more mismatched phpDoc --- src/Reader/Entry/AbstractEntry.php | 6 +++--- src/Reader/Entry/EntryInterface.php | 2 +- src/Reader/Extension/AbstractEntry.php | 2 +- src/Reader/Feed/AbstractFeed.php | 3 ++- src/Writer/AbstractFeed.php | 5 ++++- src/Writer/Entry.php | 4 ++-- src/Writer/Extension/ITunes/Entry.php | 2 +- src/Writer/Renderer/AbstractRenderer.php | 6 +++--- src/Writer/Renderer/Feed/AbstractAtom.php | 4 ++-- 9 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/Reader/Entry/AbstractEntry.php b/src/Reader/Entry/AbstractEntry.php index 5a21d5e8..db36d31b 100644 --- a/src/Reader/Entry/AbstractEntry.php +++ b/src/Reader/Entry/AbstractEntry.php @@ -39,7 +39,7 @@ abstract class AbstractEntry /** * Entry instance * - * @var Zend_Feed_Entry_Interface + * @var DOMElement */ protected $entry = null; @@ -160,7 +160,7 @@ public function getXpath() * Set the XPath query * * @param DOMXPath $xpath - * @return Zend_Feed_Reader_Entry_EntryAbstract + * @return AbstractEntry */ public function setXpath(DOMXPath $xpath) { @@ -182,7 +182,7 @@ public function getExtensions() * Return an Extension object with the matching name (postfixed with _Entry) * * @param string $name - * @return Zend_Feed_Reader_Extension_EntryAbstract + * @return Reader\Extension\AbstractEntry */ public function getExtension($name) { diff --git a/src/Reader/Entry/EntryInterface.php b/src/Reader/Entry/EntryInterface.php index 4d0fc31d..57a0b2eb 100644 --- a/src/Reader/Entry/EntryInterface.php +++ b/src/Reader/Entry/EntryInterface.php @@ -64,7 +64,7 @@ public function getDescription(); /** * Get the entry enclosure * - * @return stdClass + * @return \stdClass */ public function getEnclosure(); diff --git a/src/Reader/Extension/AbstractEntry.php b/src/Reader/Extension/AbstractEntry.php index e60d2de6..c040f0bd 100644 --- a/src/Reader/Extension/AbstractEntry.php +++ b/src/Reader/Extension/AbstractEntry.php @@ -38,7 +38,7 @@ abstract class AbstractEntry /** * Entry instance * - * @var Zend_Feed_Entry_Abstract + * @var DOMElement */ protected $entry = null; diff --git a/src/Reader/Feed/AbstractFeed.php b/src/Reader/Feed/AbstractFeed.php index a7701b92..fe6435da 100644 --- a/src/Reader/Feed/AbstractFeed.php +++ b/src/Reader/Feed/AbstractFeed.php @@ -11,6 +11,7 @@ namespace Zend\Feed\Reader\Feed; use DOMDocument; +use DOMElement; use DOMXPath; use Zend\Feed\Reader; use Zend\Feed\Reader\Exception; @@ -210,7 +211,7 @@ public function getType() /** * Return the current feed key * - * @return unknown + * @return int */ public function key() { diff --git a/src/Writer/AbstractFeed.php b/src/Writer/AbstractFeed.php index b93e7275..9afc0b25 100644 --- a/src/Writer/AbstractFeed.php +++ b/src/Writer/AbstractFeed.php @@ -194,8 +194,11 @@ public function setDescription($description) /** * Set the feed generator entry * - * @return string|null + * @param array|string $name + * @param null|string $version + * @param null|string $uri * @throws Exception\InvalidArgumentException + * @return string|null */ public function setGenerator($name, $version = null, $uri = null) { diff --git a/src/Writer/Entry.php b/src/Writer/Entry.php index 985cda19..9e757f93 100644 --- a/src/Writer/Entry.php +++ b/src/Writer/Entry.php @@ -167,7 +167,7 @@ public function setContent($content) /** * Set the feed creation date * - * @return string|null|DateTime + * @param string|null|DateTime $date * @throws Exception\InvalidArgumentException */ public function setDateCreated($date = null) @@ -185,7 +185,7 @@ public function setDateCreated($date = null) /** * Set the feed modification date * - * @return string|null|DateTime + * @param string|null|DateTime $date * @throws Exception\InvalidArgumentException */ public function setDateModified($date = null) diff --git a/src/Writer/Extension/ITunes/Entry.php b/src/Writer/Extension/ITunes/Entry.php index 24ed2209..d6b9ce9c 100644 --- a/src/Writer/Extension/ITunes/Entry.php +++ b/src/Writer/Extension/ITunes/Entry.php @@ -37,7 +37,7 @@ class Entry * Set feed encoding * * @param string $enc - * @return Zend_Feed_Writer_Extension_ITunes_Entry + * @return Entry */ public function setEncoding($enc) { diff --git a/src/Writer/Renderer/AbstractRenderer.php b/src/Writer/Renderer/AbstractRenderer.php index 7704ecde..d914fdbd 100644 --- a/src/Writer/Renderer/AbstractRenderer.php +++ b/src/Writer/Renderer/AbstractRenderer.php @@ -27,7 +27,7 @@ class AbstractRenderer protected $extensions = array(); /** - * @var mixed + * @var Writer\AbstractFeed */ protected $container = null; @@ -69,7 +69,7 @@ class AbstractRenderer /** * Constructor * - * @param mixed $container + * @param Writer\AbstractFeed $container */ public function __construct($container) { @@ -111,7 +111,7 @@ public function getElement() /** * Get data container of items being rendered * - * @return mixed + * @return Writer\AbstractFeed */ public function getDataContainer() { diff --git a/src/Writer/Renderer/Feed/AbstractAtom.php b/src/Writer/Renderer/Feed/AbstractAtom.php index 10d8b551..c8012a06 100644 --- a/src/Writer/Renderer/Feed/AbstractAtom.php +++ b/src/Writer/Renderer/Feed/AbstractAtom.php @@ -26,9 +26,9 @@ class AbstractAtom extends Renderer\AbstractRenderer /** * Constructor * - * @param Zend_Feed_Writer_Feed $container + * @param Writer\AbstractFeed $container */ - public function __construct ($container) + public function __construct($container) { parent::__construct($container); } From a84a3e035d4d27dee5282c6fcc5353ceb492dbcb Mon Sep 17 00:00:00 2001 From: Michel Hunziker Date: Sat, 1 Sep 2012 22:09:27 +0200 Subject: [PATCH 238/238] Add more missing @throws annotations --- src/Reader/Entry/Rss.php | 1 + src/Reader/Feed/Rss.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Reader/Entry/Rss.php b/src/Reader/Entry/Rss.php index 93080cad..ca73049d 100644 --- a/src/Reader/Entry/Rss.php +++ b/src/Reader/Entry/Rss.php @@ -185,6 +185,7 @@ public function getDateCreated() /** * Get the entry's date of modification * + * @throws Exception\RuntimeException * @return string */ public function getDateModified() diff --git a/src/Reader/Feed/Rss.php b/src/Reader/Feed/Rss.php index b0b1e0b9..656d7c37 100644 --- a/src/Reader/Feed/Rss.php +++ b/src/Reader/Feed/Rss.php @@ -253,6 +253,7 @@ public function getDateModified() /** * Get the feed lastBuild date * + * @throws Exception\RuntimeException * @return DateTime */ public function getLastBuildDate()