Chris@0
|
1 <?php
|
Chris@0
|
2 /**
|
Chris@0
|
3 * Zend Framework (http://framework.zend.com/)
|
Chris@0
|
4 *
|
Chris@0
|
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
|
Chris@0
|
6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
Chris@0
|
7 * @license http://framework.zend.com/license/new-bsd New BSD License
|
Chris@0
|
8 */
|
Chris@0
|
9
|
Chris@0
|
10 namespace Zend\Feed\Reader\Feed\Atom;
|
Chris@0
|
11
|
Chris@0
|
12 use DOMElement;
|
Chris@0
|
13 use DOMXPath;
|
Chris@0
|
14 use Zend\Feed\Reader;
|
Chris@0
|
15 use Zend\Feed\Reader\Feed;
|
Chris@0
|
16
|
Chris@0
|
17 /**
|
Chris@0
|
18 */
|
Chris@0
|
19 class Source extends Feed\Atom
|
Chris@0
|
20 {
|
Chris@0
|
21 /**
|
Chris@0
|
22 * Constructor: Create a Source object which is largely just a normal
|
Chris@0
|
23 * Zend\Feed\Reader\AbstractFeed object only designed to retrieve feed level
|
Chris@0
|
24 * metadata from an Atom entry's source element.
|
Chris@0
|
25 *
|
Chris@0
|
26 * @param DOMElement $source
|
Chris@0
|
27 * @param string $xpathPrefix Passed from parent Entry object
|
Chris@0
|
28 * @param string $type Nearly always Atom 1.0
|
Chris@0
|
29 */
|
Chris@0
|
30 public function __construct(DOMElement $source, $xpathPrefix, $type = Reader\Reader::TYPE_ATOM_10)
|
Chris@0
|
31 {
|
Chris@0
|
32 $this->domDocument = $source->ownerDocument;
|
Chris@0
|
33 $this->xpath = new DOMXPath($this->domDocument);
|
Chris@0
|
34 $this->data['type'] = $type;
|
Chris@0
|
35 $this->registerNamespaces();
|
Chris@0
|
36 $this->loadExtensions();
|
Chris@0
|
37
|
Chris@0
|
38 $manager = Reader\Reader::getExtensionManager();
|
Chris@0
|
39 $extensions = ['Atom\Feed', 'DublinCore\Feed'];
|
Chris@0
|
40
|
Chris@0
|
41 foreach ($extensions as $name) {
|
Chris@0
|
42 $extension = $manager->get($name);
|
Chris@0
|
43 $extension->setDomDocument($this->domDocument);
|
Chris@0
|
44 $extension->setType($this->data['type']);
|
Chris@0
|
45 $extension->setXpath($this->xpath);
|
Chris@0
|
46 $this->extensions[$name] = $extension;
|
Chris@0
|
47 }
|
Chris@0
|
48
|
Chris@0
|
49 foreach ($this->extensions as $extension) {
|
Chris@0
|
50 $extension->setXpathPrefix(rtrim($xpathPrefix, '/') . '/atom:source');
|
Chris@0
|
51 }
|
Chris@0
|
52 }
|
Chris@0
|
53
|
Chris@0
|
54 /**
|
Chris@0
|
55 * Since this is not an Entry carrier but a vehicle for Feed metadata, any
|
Chris@0
|
56 * applicable Entry methods are stubbed out and do nothing.
|
Chris@0
|
57 */
|
Chris@0
|
58
|
Chris@0
|
59 /**
|
Chris@0
|
60 * @return void
|
Chris@0
|
61 */
|
Chris@0
|
62 public function count()
|
Chris@0
|
63 {
|
Chris@0
|
64 }
|
Chris@0
|
65
|
Chris@0
|
66 /**
|
Chris@0
|
67 * @return void
|
Chris@0
|
68 */
|
Chris@0
|
69 public function current()
|
Chris@0
|
70 {
|
Chris@0
|
71 }
|
Chris@0
|
72
|
Chris@0
|
73 /**
|
Chris@0
|
74 * @return void
|
Chris@0
|
75 */
|
Chris@0
|
76 public function key()
|
Chris@0
|
77 {
|
Chris@0
|
78 }
|
Chris@0
|
79
|
Chris@0
|
80 /**
|
Chris@0
|
81 * @return void
|
Chris@0
|
82 */
|
Chris@0
|
83 public function next()
|
Chris@0
|
84 {
|
Chris@0
|
85 }
|
Chris@0
|
86
|
Chris@0
|
87 /**
|
Chris@0
|
88 * @return void
|
Chris@0
|
89 */
|
Chris@0
|
90 public function rewind()
|
Chris@0
|
91 {
|
Chris@0
|
92 }
|
Chris@0
|
93
|
Chris@0
|
94 /**
|
Chris@0
|
95 * @return void
|
Chris@0
|
96 */
|
Chris@0
|
97 public function valid()
|
Chris@0
|
98 {
|
Chris@0
|
99 }
|
Chris@0
|
100
|
Chris@0
|
101 /**
|
Chris@0
|
102 * @return void
|
Chris@0
|
103 */
|
Chris@0
|
104 protected function indexEntries()
|
Chris@0
|
105 {
|
Chris@0
|
106 }
|
Chris@0
|
107 }
|