*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Feed / Reader / Extension / CreativeCommons / Feed.php
blobc3d0cd2d42a3a0224fc4336dba8a04eba4815fc3
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
15 * @category Zend
16 * @package Zend_Feed_Reader
17 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license http://framework.zend.com/license/new-bsd New BSD License
19 * @version $Id: Feed.php 16971 2009-07-22 18:05:45Z mikaelkael $
22 /**
23 * @see Zend_Feed_Reader_Extension_FeedAbstract
25 require_once 'Zend/Feed/Reader/Extension/FeedAbstract.php';
27 /**
28 * @category Zend
29 * @package Zend_Feed_Reader
30 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
31 * @license http://framework.zend.com/license/new-bsd New BSD License
33 class Zend_Feed_Reader_Extension_CreativeCommons_Feed
34 extends Zend_Feed_Reader_Extension_FeedAbstract
36 /**
37 * Get the entry license
39 * @return string|null
41 public function getLicense($index = 0)
43 $licenses = $this->getLicenses();
45 if (isset($licenses[$index])) {
46 return $licenses[$index];
49 return null;
52 /**
53 * Get the entry licenses
55 * @return array
57 public function getLicenses()
59 $name = 'licenses';
60 if (array_key_exists($name, $this->_data)) {
61 return $this->_data[$name];
64 $licenses = array();
65 $list = $this->_xpath->evaluate('channel/cc:license');
67 if ($list->length) {
68 foreach ($list as $license) {
69 $licenses[] = $license->nodeValue;
72 $licenses = array_unique($licenses);
75 $this->_data[$name] = $licenses;
77 return $this->_data[$name];
80 /**
81 * Register Creative Commons namespaces
83 * @return void
85 protected function _registerNamespaces()
87 $this->_xpath->registerNamespace('cc', 'http://backend.userland.com/creativeCommonsRssModule');