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
+
+
+Posted by Abhijit Kalamkar, Software Engineer
+
+ 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.
+Posted by Rajen Sheth, Product Manager
+
+ 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)
+
+
+Posted by Chikai Ohazama, Google Earth Team
+
+ 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 & 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 & 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
+
+
+Posted by April Yu, University Programs Team, and Emily Nishi, Diversity Program Manager
+
+ 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
+
+
+Posted by Karen Wickre, Google Blog team
+
+ 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:
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."
"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."
"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."
+
+ 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.
+
+ 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
+
+
+
+ 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? :-)
]]>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.
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:
$_POST['username'] = chr(0xbf) .                      chr(0x27) .                      ' OR username = username /*'; $_POST['password'] = 'guess';
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:
+
+
+
+
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!
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? :-)
]]>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.
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:
$_POST['username'] = chr(0xbf) .                      chr(0x27) .                      ' OR username = username /*'; $_POST['password'] = 'guess';
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:
+
+
+
+
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…)
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", $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.
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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.
+
+
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!
+
+
+
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!
+
+
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!
+
+
+
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.
+
+
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!
+
+
+
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
+
+
+
+ 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
+
+
+
+ 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.
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.
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
+
+
+
+ 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
+
+
+
+ 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!
+
+
+
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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
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
+
+
+
+ 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
+
+
+
+ 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
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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.
+
+]]>
+ 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.
+
+
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!
+
+
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!
+
+
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!
+
+
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.
+
+
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!
+
+
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.
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.
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!
+
+
+]]>
+ 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
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
+]]>
+ 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
+
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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.
+
+
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!
+
+
+
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!
+
+
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!
+
+
+
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.
+
+
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!
+
+
+
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
+
+
+
+ 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
+
+
+
+ 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.
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.
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
+
+
+
+ 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
+
+
+
+ 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!
+
+
+
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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
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
+
+
+
+ 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
+
+
+
+ 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
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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.
+
+]]>
+ 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.
+
+
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!
+
+
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!
+
+
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!
+
+
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.
+
+
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!
+
+
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.
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.
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!
+
+
+]]>
+ 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
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
+]]>
+ 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
+
+
+
+ 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.
+
+
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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.
+
+
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!
+
+
+
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!
+
+
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!
+
+
+
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.
+
+
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!
+
+
+
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
+
+
+
+ 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
+
+
+
+ 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.
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.
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
+
+
+
+ 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
+
+
+
+ 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!
+
+
+
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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
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
+
+
+
+ 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
+
+
+
+ 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
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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
+
+
+
+ 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.
+
+
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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.
+
+
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!
+
+
+
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!
+
+
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!
+
+
+
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.
+
+
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!
+
+
+
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
+
+
+
+ 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
+
+
+
+ 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.
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.
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
+
+
+
+ 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
+
+
+
+ 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!
+
+
+
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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
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
+
+
+
+ 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
+
+
+
+ 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
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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.
+
+]]>
+ 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.
+
+
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!
+
+
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!
+
+
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!
+
+
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.
+
+
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!
+
+
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.
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.
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!
+
+
+]]>
+ 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
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
+]]>
+ 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
+
+
+
+ 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.
+
+
+]]>
+
+
+ 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
+
+
+
+ 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.
+
+
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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.
+
+
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!
+
+
+
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!
+
+
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!
+
+
+
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.
+
+
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!
+
+
+
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
+
+
+
+ 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
+
+
+
+ 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.
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.
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
+
+
+
+ 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
+
+
+
+ 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!
+
+
+
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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
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
+
+
+
+ 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
+
+
+
+ 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
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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
+
+
+
+ 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.
+
+
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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.
+
+
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!
+
+
+
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!
+
+
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!
+
+
+
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.
+
+
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!
+
+
+
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
+
+
+
+ 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
+
+
+
+ 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.
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.
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
+
+
+
+ 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
+
+
+
+ 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!
+
+
+
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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
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
+
+
+
+ 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
+
+
+
+ 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
+]]>
+
+
+ 0
+
+
+
+ norm2782
+ http://www.norm2782.com
+
+
+
+ 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
+
+
', $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 &
-
\ 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 &</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 &
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 &</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.
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.
');
$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('
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.
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", $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('
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.
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.
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
-
-
-Posted by Abhijit Kalamkar, Software Engineer
-
- 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.
-Posted by Rajen Sheth, Product Manager
-
- 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)
-
-
-Posted by Chikai Ohazama, Google Earth Team
-
- 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 & 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 & 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
-
-
-Posted by April Yu, University Programs Team, and Emily Nishi, Diversity Program Manager
-
- 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
-
-
-Posted by Karen Wickre, Google Blog team
-
- 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:
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."
"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."
"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."
-
- 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.
-
- 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
-
-
-
- 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? :-)
]]>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.
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:
$_POST['username'] = chr(0xbf) .                      chr(0x27) .                      ' OR username = username /*'; $_POST['password'] = 'guess';
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:
-
-
-
-
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!
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? :-)
]]>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.
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:
$_POST['username'] = chr(0xbf) .                      chr(0x27) .                      ' OR username = username /*'; $_POST['password'] = 'guess';
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:
-
-
-
-
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('
- 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
-
-
-Posted by Abhijit Kalamkar, Software Engineer
-
- 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.
-Posted by Rajen Sheth, Product Manager
-
- 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)
-
-
-Posted by Chikai Ohazama, Google Earth Team
-
- 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 & 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 & 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
-
-
-Posted by April Yu, University Programs Team, and Emily Nishi, Diversity Program Manager
-
- 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
-
-
-Posted by Karen Wickre, Google Blog team
-
- 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:
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."
"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."
"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."
-
- 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.
-
- 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
-
-
-
- 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? :-)
]]>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.
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:
$_POST['username'] = chr(0xbf) .                      chr(0x27) .                      ' OR username = username /*'; $_POST['password'] = 'guess';
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:
-
-
-
-
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!
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? :-)
]]>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.
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:
$_POST['username'] = chr(0xbf) .                      chr(0x27) .                      ' OR username = username /*'; $_POST['password'] = 'guess';
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:
-
-
-
-
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…)
<?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