@@ -4,5 +4,5 @@ |
||
4 | 4 | require_once 'Vendor/autoload.php'; |
5 | 5 | |
6 | 6 | // Load test target classes |
7 | -spl_autoload_register(function($c) { @include_once strtr($c, '\\_', '//').'.php'; }); |
|
8 | -set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__DIR__).'/Source'); |
|
9 | 7 | \ No newline at end of file |
8 | +spl_autoload_register(function($c) { @include_once strtr($c, '\\_', '//') . '.php'; }); |
|
9 | +set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__DIR__) . '/Source'); |
|
10 | 10 | \ No newline at end of file |
@@ -9,49 +9,49 @@ |
||
9 | 9 | class Feed implements FeedInterface |
10 | 10 | { |
11 | 11 | |
12 | - /** @var ChannelInterface[] */ |
|
13 | - protected $channels = []; |
|
14 | - |
|
15 | - /** |
|
16 | - * Add channel |
|
17 | - * @param ChannelInterface $channel |
|
18 | - * @return $this |
|
19 | - */ |
|
20 | - public function addChannel(ChannelInterface $channel) |
|
21 | - { |
|
22 | - $this->channels[] = $channel; |
|
23 | - |
|
24 | - return $this; |
|
25 | - } |
|
26 | - |
|
27 | - /** |
|
28 | - * Render XML |
|
29 | - * @return string |
|
30 | - */ |
|
31 | - public function render() |
|
32 | - { |
|
33 | - $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">', |
|
34 | - LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL); |
|
35 | - |
|
36 | - foreach ($this->channels as $channel) { |
|
37 | - $toDom = dom_import_simplexml($xml); |
|
38 | - $fromDom = dom_import_simplexml($channel->asXML()); |
|
39 | - $toDom->appendChild($toDom->ownerDocument->importNode($fromDom, true)); |
|
40 | - } |
|
41 | - |
|
42 | - $dom = new DOMDocument('1.0', 'UTF-8'); |
|
43 | - $dom->appendChild($dom->importNode(dom_import_simplexml($xml), true)); |
|
44 | - $dom->formatOutput = true; |
|
45 | - |
|
46 | - return $dom->saveXML(); |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * Render XML |
|
51 | - * @return string |
|
52 | - */ |
|
53 | - public function __toString() |
|
54 | - { |
|
55 | - return $this->render(); |
|
56 | - } |
|
12 | + /** @var ChannelInterface[] */ |
|
13 | + protected $channels = []; |
|
14 | + |
|
15 | + /** |
|
16 | + * Add channel |
|
17 | + * @param ChannelInterface $channel |
|
18 | + * @return $this |
|
19 | + */ |
|
20 | + public function addChannel(ChannelInterface $channel) |
|
21 | + { |
|
22 | + $this->channels[] = $channel; |
|
23 | + |
|
24 | + return $this; |
|
25 | + } |
|
26 | + |
|
27 | + /** |
|
28 | + * Render XML |
|
29 | + * @return string |
|
30 | + */ |
|
31 | + public function render() |
|
32 | + { |
|
33 | + $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">', |
|
34 | + LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL); |
|
35 | + |
|
36 | + foreach ($this->channels as $channel) { |
|
37 | + $toDom = dom_import_simplexml($xml); |
|
38 | + $fromDom = dom_import_simplexml($channel->asXML()); |
|
39 | + $toDom->appendChild($toDom->ownerDocument->importNode($fromDom, true)); |
|
40 | + } |
|
41 | + |
|
42 | + $dom = new DOMDocument('1.0', 'UTF-8'); |
|
43 | + $dom->appendChild($dom->importNode(dom_import_simplexml($xml), true)); |
|
44 | + $dom->formatOutput = true; |
|
45 | + |
|
46 | + return $dom->saveXML(); |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * Render XML |
|
51 | + * @return string |
|
52 | + */ |
|
53 | + public function __toString() |
|
54 | + { |
|
55 | + return $this->render(); |
|
56 | + } |
|
57 | 57 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | public function render() |
32 | 32 | { |
33 | 33 | $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">', |
34 | - LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL); |
|
34 | + LIBXML_NOERROR|LIBXML_ERR_NONE|LIBXML_ERR_FATAL); |
|
35 | 35 | |
36 | 36 | foreach ($this->channels as $channel) { |
37 | 37 | $toDom = dom_import_simplexml($xml); |
@@ -7,22 +7,22 @@ |
||
7 | 7 | interface FeedInterface |
8 | 8 | { |
9 | 9 | |
10 | - /** |
|
11 | - * Add channel |
|
12 | - * @param ChannelInterface $channel |
|
13 | - * @return $this |
|
14 | - */ |
|
15 | - public function addChannel(ChannelInterface $channel); |
|
10 | + /** |
|
11 | + * Add channel |
|
12 | + * @param ChannelInterface $channel |
|
13 | + * @return $this |
|
14 | + */ |
|
15 | + public function addChannel(ChannelInterface $channel); |
|
16 | 16 | |
17 | - /** |
|
18 | - * Render XML |
|
19 | - * @return string |
|
20 | - */ |
|
21 | - public function render(); |
|
17 | + /** |
|
18 | + * Render XML |
|
19 | + * @return string |
|
20 | + */ |
|
21 | + public function render(); |
|
22 | 22 | |
23 | - /** |
|
24 | - * Render XML |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - public function __toString(); |
|
23 | + /** |
|
24 | + * Render XML |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + public function __toString(); |
|
28 | 28 | } |
@@ -10,233 +10,233 @@ |
||
10 | 10 | class Channel implements ChannelInterface |
11 | 11 | { |
12 | 12 | |
13 | - /** @var string */ |
|
14 | - protected $title; |
|
15 | - |
|
16 | - /** @var string */ |
|
17 | - protected $url; |
|
18 | - |
|
19 | - /** @var string */ |
|
20 | - protected $description; |
|
21 | - |
|
22 | - /** @var string */ |
|
23 | - protected $language; |
|
24 | - |
|
25 | - /** @var string */ |
|
26 | - protected $copyright; |
|
27 | - |
|
28 | - /** @var int */ |
|
29 | - protected $pubDate; |
|
30 | - |
|
31 | - /** @var int */ |
|
32 | - protected $lastBuildDate; |
|
33 | - |
|
34 | - /** @var string */ |
|
35 | - protected $updatePeriod; |
|
36 | - |
|
37 | - /** @var integer */ |
|
38 | - protected $updateFrequency; |
|
39 | - |
|
40 | - /** @var int */ |
|
41 | - protected $ttl; |
|
42 | - |
|
43 | - /** @var ItemInterface[] */ |
|
44 | - protected $items = []; |
|
45 | - |
|
46 | - /** |
|
47 | - * Set channel title |
|
48 | - * @param string $title |
|
49 | - * @return $this |
|
50 | - */ |
|
51 | - public function title($title) |
|
52 | - { |
|
53 | - $this->title = $title; |
|
54 | - |
|
55 | - return $this; |
|
56 | - } |
|
57 | - |
|
58 | - /** |
|
59 | - * Set channel URL |
|
60 | - * @param string $url |
|
61 | - * @return $this |
|
62 | - */ |
|
63 | - public function url($url) |
|
64 | - { |
|
65 | - $this->url = $url; |
|
66 | - |
|
67 | - return $this; |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * Set channel description |
|
72 | - * @param string $description |
|
73 | - * @return $this |
|
74 | - */ |
|
75 | - public function description($description) |
|
76 | - { |
|
77 | - $this->description = $description; |
|
78 | - |
|
79 | - return $this; |
|
80 | - } |
|
81 | - |
|
82 | - /** |
|
83 | - * Set ISO639 language code |
|
84 | - * |
|
85 | - * The language the channel is written in. This allows aggregators to group all |
|
86 | - * Italian language sites, for example, on a single page. A list of allowable |
|
87 | - * values for this element, as provided by Netscape, is here. You may also use |
|
88 | - * values defined by the W3C. |
|
89 | - * |
|
90 | - * @param string $language |
|
91 | - * @return $this |
|
92 | - */ |
|
93 | - public function language($language) |
|
94 | - { |
|
95 | - $this->language = $language; |
|
96 | - |
|
97 | - return $this; |
|
98 | - } |
|
99 | - |
|
100 | - /** |
|
101 | - * Set channel copyright |
|
102 | - * @param string $copyright |
|
103 | - * @return $this |
|
104 | - */ |
|
105 | - public function copyright($copyright) |
|
106 | - { |
|
107 | - $this->copyright = $copyright; |
|
108 | - |
|
109 | - return $this; |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * Set channel published date |
|
114 | - * @param int $pubDate Unix timestamp |
|
115 | - * @return $this |
|
116 | - */ |
|
117 | - public function pubDate($pubDate) |
|
118 | - { |
|
119 | - $this->pubDate = $pubDate; |
|
120 | - |
|
121 | - return $this; |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * Set channel last build date |
|
126 | - * @param int $lastBuildDate Unix timestamp |
|
127 | - * @return $this |
|
128 | - */ |
|
129 | - public function lastBuildDate($lastBuildDate) |
|
130 | - { |
|
131 | - $this->lastBuildDate = $lastBuildDate; |
|
132 | - |
|
133 | - return $this; |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * @param $updatePeriod |
|
138 | - * @return $this |
|
139 | - */ |
|
140 | - public function updatePeriod($updatePeriod) |
|
141 | - { |
|
142 | - $this->updatePeriod = $updatePeriod; |
|
143 | - |
|
144 | - return $this; |
|
145 | - } |
|
146 | - |
|
147 | - /** |
|
148 | - * @param $updateFrequency |
|
149 | - * @return $this |
|
150 | - */ |
|
151 | - public function updateFrequency($updateFrequency) |
|
152 | - { |
|
153 | - $this->updateFrequency = $updateFrequency; |
|
154 | - |
|
155 | - return $this; |
|
156 | - } |
|
157 | - |
|
158 | - /** |
|
159 | - * Set channel ttl (minutes) |
|
160 | - * @param int $ttl |
|
161 | - * @return $this |
|
162 | - */ |
|
163 | - public function ttl($ttl) |
|
164 | - { |
|
165 | - $this->ttl = $ttl; |
|
166 | - |
|
167 | - return $this; |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * Add item object |
|
172 | - * @param ItemInterface $item |
|
173 | - * @return $this |
|
174 | - */ |
|
175 | - public function addItem(ItemInterface $item) |
|
176 | - { |
|
177 | - $this->items[] = $item; |
|
178 | - |
|
179 | - return $this; |
|
180 | - } |
|
181 | - |
|
182 | - /** |
|
183 | - * Append to feed |
|
184 | - * @param FeedInterface $feed |
|
185 | - * @return $this |
|
186 | - */ |
|
187 | - public function appendTo(FeedInterface $feed) |
|
188 | - { |
|
189 | - $feed->addChannel($this); |
|
190 | - |
|
191 | - return $this; |
|
192 | - } |
|
193 | - |
|
194 | - /** |
|
195 | - * Return XML object |
|
196 | - * @return SimpleXMLElement |
|
197 | - */ |
|
198 | - public function asXML() |
|
199 | - { |
|
200 | - $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel></channel>', |
|
201 | - LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL); |
|
202 | - $xml->addChild('title', $this->title); |
|
203 | - $xml->addChild('link', $this->url); |
|
204 | - $xml->addChild('description', $this->description); |
|
205 | - |
|
206 | - if ($this->language !== null) { |
|
207 | - $xml->addChild('language', $this->language); |
|
208 | - } |
|
209 | - |
|
210 | - if ($this->updatePeriod) { |
|
211 | - $xml->addChild("xmlns:sy:updatePeriod", $this->updatePeriod); |
|
212 | - } |
|
213 | - |
|
214 | - if ($this->updateFrequency) { |
|
215 | - $xml->addChild("xmlns:sy:updateFrequency", $this->updateFrequency); |
|
216 | - } |
|
217 | - |
|
218 | - if ($this->copyright !== null) { |
|
219 | - $xml->addChild('copyright', $this->copyright); |
|
220 | - } |
|
221 | - |
|
222 | - if ($this->pubDate !== null) { |
|
223 | - $xml->addChild('pubDate', date(DATE_RSS, $this->pubDate)); |
|
224 | - } |
|
225 | - |
|
226 | - if ($this->lastBuildDate !== null) { |
|
227 | - $xml->addChild('lastBuildDate', date(DATE_RSS, $this->lastBuildDate)); |
|
228 | - } |
|
229 | - |
|
230 | - if ($this->ttl !== null) { |
|
231 | - $xml->addChild('ttl', $this->ttl); |
|
232 | - } |
|
233 | - |
|
234 | - foreach ($this->items as $item) { |
|
235 | - $toDom = dom_import_simplexml($xml); |
|
236 | - $fromDom = dom_import_simplexml($item->asXML()); |
|
237 | - $toDom->appendChild($toDom->ownerDocument->importNode($fromDom, true)); |
|
238 | - } |
|
239 | - |
|
240 | - return $xml; |
|
241 | - } |
|
13 | + /** @var string */ |
|
14 | + protected $title; |
|
15 | + |
|
16 | + /** @var string */ |
|
17 | + protected $url; |
|
18 | + |
|
19 | + /** @var string */ |
|
20 | + protected $description; |
|
21 | + |
|
22 | + /** @var string */ |
|
23 | + protected $language; |
|
24 | + |
|
25 | + /** @var string */ |
|
26 | + protected $copyright; |
|
27 | + |
|
28 | + /** @var int */ |
|
29 | + protected $pubDate; |
|
30 | + |
|
31 | + /** @var int */ |
|
32 | + protected $lastBuildDate; |
|
33 | + |
|
34 | + /** @var string */ |
|
35 | + protected $updatePeriod; |
|
36 | + |
|
37 | + /** @var integer */ |
|
38 | + protected $updateFrequency; |
|
39 | + |
|
40 | + /** @var int */ |
|
41 | + protected $ttl; |
|
42 | + |
|
43 | + /** @var ItemInterface[] */ |
|
44 | + protected $items = []; |
|
45 | + |
|
46 | + /** |
|
47 | + * Set channel title |
|
48 | + * @param string $title |
|
49 | + * @return $this |
|
50 | + */ |
|
51 | + public function title($title) |
|
52 | + { |
|
53 | + $this->title = $title; |
|
54 | + |
|
55 | + return $this; |
|
56 | + } |
|
57 | + |
|
58 | + /** |
|
59 | + * Set channel URL |
|
60 | + * @param string $url |
|
61 | + * @return $this |
|
62 | + */ |
|
63 | + public function url($url) |
|
64 | + { |
|
65 | + $this->url = $url; |
|
66 | + |
|
67 | + return $this; |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * Set channel description |
|
72 | + * @param string $description |
|
73 | + * @return $this |
|
74 | + */ |
|
75 | + public function description($description) |
|
76 | + { |
|
77 | + $this->description = $description; |
|
78 | + |
|
79 | + return $this; |
|
80 | + } |
|
81 | + |
|
82 | + /** |
|
83 | + * Set ISO639 language code |
|
84 | + * |
|
85 | + * The language the channel is written in. This allows aggregators to group all |
|
86 | + * Italian language sites, for example, on a single page. A list of allowable |
|
87 | + * values for this element, as provided by Netscape, is here. You may also use |
|
88 | + * values defined by the W3C. |
|
89 | + * |
|
90 | + * @param string $language |
|
91 | + * @return $this |
|
92 | + */ |
|
93 | + public function language($language) |
|
94 | + { |
|
95 | + $this->language = $language; |
|
96 | + |
|
97 | + return $this; |
|
98 | + } |
|
99 | + |
|
100 | + /** |
|
101 | + * Set channel copyright |
|
102 | + * @param string $copyright |
|
103 | + * @return $this |
|
104 | + */ |
|
105 | + public function copyright($copyright) |
|
106 | + { |
|
107 | + $this->copyright = $copyright; |
|
108 | + |
|
109 | + return $this; |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * Set channel published date |
|
114 | + * @param int $pubDate Unix timestamp |
|
115 | + * @return $this |
|
116 | + */ |
|
117 | + public function pubDate($pubDate) |
|
118 | + { |
|
119 | + $this->pubDate = $pubDate; |
|
120 | + |
|
121 | + return $this; |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * Set channel last build date |
|
126 | + * @param int $lastBuildDate Unix timestamp |
|
127 | + * @return $this |
|
128 | + */ |
|
129 | + public function lastBuildDate($lastBuildDate) |
|
130 | + { |
|
131 | + $this->lastBuildDate = $lastBuildDate; |
|
132 | + |
|
133 | + return $this; |
|
134 | + } |
|
135 | + |
|
136 | + /** |
|
137 | + * @param $updatePeriod |
|
138 | + * @return $this |
|
139 | + */ |
|
140 | + public function updatePeriod($updatePeriod) |
|
141 | + { |
|
142 | + $this->updatePeriod = $updatePeriod; |
|
143 | + |
|
144 | + return $this; |
|
145 | + } |
|
146 | + |
|
147 | + /** |
|
148 | + * @param $updateFrequency |
|
149 | + * @return $this |
|
150 | + */ |
|
151 | + public function updateFrequency($updateFrequency) |
|
152 | + { |
|
153 | + $this->updateFrequency = $updateFrequency; |
|
154 | + |
|
155 | + return $this; |
|
156 | + } |
|
157 | + |
|
158 | + /** |
|
159 | + * Set channel ttl (minutes) |
|
160 | + * @param int $ttl |
|
161 | + * @return $this |
|
162 | + */ |
|
163 | + public function ttl($ttl) |
|
164 | + { |
|
165 | + $this->ttl = $ttl; |
|
166 | + |
|
167 | + return $this; |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * Add item object |
|
172 | + * @param ItemInterface $item |
|
173 | + * @return $this |
|
174 | + */ |
|
175 | + public function addItem(ItemInterface $item) |
|
176 | + { |
|
177 | + $this->items[] = $item; |
|
178 | + |
|
179 | + return $this; |
|
180 | + } |
|
181 | + |
|
182 | + /** |
|
183 | + * Append to feed |
|
184 | + * @param FeedInterface $feed |
|
185 | + * @return $this |
|
186 | + */ |
|
187 | + public function appendTo(FeedInterface $feed) |
|
188 | + { |
|
189 | + $feed->addChannel($this); |
|
190 | + |
|
191 | + return $this; |
|
192 | + } |
|
193 | + |
|
194 | + /** |
|
195 | + * Return XML object |
|
196 | + * @return SimpleXMLElement |
|
197 | + */ |
|
198 | + public function asXML() |
|
199 | + { |
|
200 | + $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel></channel>', |
|
201 | + LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL); |
|
202 | + $xml->addChild('title', $this->title); |
|
203 | + $xml->addChild('link', $this->url); |
|
204 | + $xml->addChild('description', $this->description); |
|
205 | + |
|
206 | + if ($this->language !== null) { |
|
207 | + $xml->addChild('language', $this->language); |
|
208 | + } |
|
209 | + |
|
210 | + if ($this->updatePeriod) { |
|
211 | + $xml->addChild("xmlns:sy:updatePeriod", $this->updatePeriod); |
|
212 | + } |
|
213 | + |
|
214 | + if ($this->updateFrequency) { |
|
215 | + $xml->addChild("xmlns:sy:updateFrequency", $this->updateFrequency); |
|
216 | + } |
|
217 | + |
|
218 | + if ($this->copyright !== null) { |
|
219 | + $xml->addChild('copyright', $this->copyright); |
|
220 | + } |
|
221 | + |
|
222 | + if ($this->pubDate !== null) { |
|
223 | + $xml->addChild('pubDate', date(DATE_RSS, $this->pubDate)); |
|
224 | + } |
|
225 | + |
|
226 | + if ($this->lastBuildDate !== null) { |
|
227 | + $xml->addChild('lastBuildDate', date(DATE_RSS, $this->lastBuildDate)); |
|
228 | + } |
|
229 | + |
|
230 | + if ($this->ttl !== null) { |
|
231 | + $xml->addChild('ttl', $this->ttl); |
|
232 | + } |
|
233 | + |
|
234 | + foreach ($this->items as $item) { |
|
235 | + $toDom = dom_import_simplexml($xml); |
|
236 | + $fromDom = dom_import_simplexml($item->asXML()); |
|
237 | + $toDom->appendChild($toDom->ownerDocument->importNode($fromDom, true)); |
|
238 | + } |
|
239 | + |
|
240 | + return $xml; |
|
241 | + } |
|
242 | 242 | } |
@@ -198,7 +198,7 @@ |
||
198 | 198 | public function asXML() |
199 | 199 | { |
200 | 200 | $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel></channel>', |
201 | - LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL); |
|
201 | + LIBXML_NOERROR|LIBXML_ERR_NONE|LIBXML_ERR_FATAL); |
|
202 | 202 | $xml->addChild('title', $this->title); |
203 | 203 | $xml->addChild('link', $this->url); |
204 | 204 | $xml->addChild('description', $this->description); |
@@ -8,97 +8,97 @@ |
||
8 | 8 | interface ChannelInterface |
9 | 9 | { |
10 | 10 | |
11 | - /** |
|
12 | - * Set channel title |
|
13 | - * @param string $title |
|
14 | - * @return $this |
|
15 | - */ |
|
16 | - public function title($title); |
|
17 | - |
|
18 | - /** |
|
19 | - * Set channel URL |
|
20 | - * @param string $url |
|
21 | - * @return $this |
|
22 | - */ |
|
23 | - public function url($url); |
|
24 | - |
|
25 | - /** |
|
26 | - * Set channel description |
|
27 | - * @param string $description |
|
28 | - * @return $this |
|
29 | - */ |
|
30 | - public function description($description); |
|
31 | - |
|
32 | - /** |
|
33 | - * Set ISO639 language code |
|
34 | - * |
|
35 | - * The language the channel is written in. This allows aggregators to group all |
|
36 | - * Italian language sites, for example, on a single page. A list of allowable |
|
37 | - * values for this element, as provided by Netscape, is here. You may also use |
|
38 | - * values defined by the W3C. |
|
39 | - * |
|
40 | - * @param string $language |
|
41 | - * @return $this |
|
42 | - */ |
|
43 | - public function language($language); |
|
44 | - |
|
45 | - /** |
|
46 | - * Set channel copyright |
|
47 | - * @param string $copyright |
|
48 | - * @return $this |
|
49 | - */ |
|
50 | - public function copyright($copyright); |
|
51 | - |
|
52 | - /** |
|
53 | - * Set channel published date |
|
54 | - * @param int $pubDate Unix timestamp |
|
55 | - * @return $this |
|
56 | - */ |
|
57 | - public function pubDate($pubDate); |
|
58 | - |
|
59 | - /** |
|
60 | - * Set channel last build date |
|
61 | - * @param int $lastBuildDate Unix timestamp |
|
62 | - * @return $this |
|
63 | - */ |
|
64 | - public function lastBuildDate($lastBuildDate); |
|
65 | - |
|
66 | - /** |
|
67 | - * Set channel ttl (minutes) |
|
68 | - * @param int $ttl |
|
69 | - * @return $this |
|
70 | - */ |
|
71 | - public function ttl($ttl); |
|
72 | - |
|
73 | - /** |
|
74 | - * Add item object |
|
75 | - * @param ItemInterface $item |
|
76 | - * @return $this |
|
77 | - */ |
|
78 | - public function addItem(ItemInterface $item); |
|
79 | - |
|
80 | - /** |
|
81 | - * @param $updatePeriod |
|
82 | - * @return $this |
|
83 | - */ |
|
84 | - public function updatePeriod($updatePeriod); |
|
85 | - |
|
86 | - /** |
|
87 | - * @param $updateFrequency |
|
88 | - * @return $this |
|
89 | - */ |
|
90 | - public function updateFrequency($updateFrequency); |
|
91 | - |
|
92 | - /** |
|
93 | - * Append to feed |
|
94 | - * @param FeedInterface $feed |
|
95 | - * @return $this |
|
96 | - */ |
|
97 | - public function appendTo(FeedInterface $feed); |
|
98 | - |
|
99 | - /** |
|
100 | - * Return XML object |
|
101 | - * @return SimpleXMLElement |
|
102 | - */ |
|
103 | - public function asXML(); |
|
11 | + /** |
|
12 | + * Set channel title |
|
13 | + * @param string $title |
|
14 | + * @return $this |
|
15 | + */ |
|
16 | + public function title($title); |
|
17 | + |
|
18 | + /** |
|
19 | + * Set channel URL |
|
20 | + * @param string $url |
|
21 | + * @return $this |
|
22 | + */ |
|
23 | + public function url($url); |
|
24 | + |
|
25 | + /** |
|
26 | + * Set channel description |
|
27 | + * @param string $description |
|
28 | + * @return $this |
|
29 | + */ |
|
30 | + public function description($description); |
|
31 | + |
|
32 | + /** |
|
33 | + * Set ISO639 language code |
|
34 | + * |
|
35 | + * The language the channel is written in. This allows aggregators to group all |
|
36 | + * Italian language sites, for example, on a single page. A list of allowable |
|
37 | + * values for this element, as provided by Netscape, is here. You may also use |
|
38 | + * values defined by the W3C. |
|
39 | + * |
|
40 | + * @param string $language |
|
41 | + * @return $this |
|
42 | + */ |
|
43 | + public function language($language); |
|
44 | + |
|
45 | + /** |
|
46 | + * Set channel copyright |
|
47 | + * @param string $copyright |
|
48 | + * @return $this |
|
49 | + */ |
|
50 | + public function copyright($copyright); |
|
51 | + |
|
52 | + /** |
|
53 | + * Set channel published date |
|
54 | + * @param int $pubDate Unix timestamp |
|
55 | + * @return $this |
|
56 | + */ |
|
57 | + public function pubDate($pubDate); |
|
58 | + |
|
59 | + /** |
|
60 | + * Set channel last build date |
|
61 | + * @param int $lastBuildDate Unix timestamp |
|
62 | + * @return $this |
|
63 | + */ |
|
64 | + public function lastBuildDate($lastBuildDate); |
|
65 | + |
|
66 | + /** |
|
67 | + * Set channel ttl (minutes) |
|
68 | + * @param int $ttl |
|
69 | + * @return $this |
|
70 | + */ |
|
71 | + public function ttl($ttl); |
|
72 | + |
|
73 | + /** |
|
74 | + * Add item object |
|
75 | + * @param ItemInterface $item |
|
76 | + * @return $this |
|
77 | + */ |
|
78 | + public function addItem(ItemInterface $item); |
|
79 | + |
|
80 | + /** |
|
81 | + * @param $updatePeriod |
|
82 | + * @return $this |
|
83 | + */ |
|
84 | + public function updatePeriod($updatePeriod); |
|
85 | + |
|
86 | + /** |
|
87 | + * @param $updateFrequency |
|
88 | + * @return $this |
|
89 | + */ |
|
90 | + public function updateFrequency($updateFrequency); |
|
91 | + |
|
92 | + /** |
|
93 | + * Append to feed |
|
94 | + * @param FeedInterface $feed |
|
95 | + * @return $this |
|
96 | + */ |
|
97 | + public function appendTo(FeedInterface $feed); |
|
98 | + |
|
99 | + /** |
|
100 | + * Return XML object |
|
101 | + * @return SimpleXMLElement |
|
102 | + */ |
|
103 | + public function asXML(); |
|
104 | 104 | } |
@@ -9,207 +9,207 @@ |
||
9 | 9 | class Item implements ItemInterface |
10 | 10 | { |
11 | 11 | |
12 | - /** @var string */ |
|
13 | - protected $title; |
|
14 | - |
|
15 | - /** @var string */ |
|
16 | - protected $url; |
|
17 | - |
|
18 | - /** @var string */ |
|
19 | - protected $description; |
|
20 | - |
|
21 | - /** @var string */ |
|
22 | - protected $content; |
|
23 | - |
|
24 | - /** @var string */ |
|
25 | - protected $creator; |
|
26 | - |
|
27 | - /** @var array */ |
|
28 | - protected $categories = []; |
|
29 | - |
|
30 | - /** @var string */ |
|
31 | - protected $guid; |
|
32 | - |
|
33 | - /** @var bool */ |
|
34 | - protected $isPermalink; |
|
35 | - |
|
36 | - /** @var int */ |
|
37 | - protected $pubDate; |
|
38 | - |
|
39 | - /** @var array */ |
|
40 | - protected $enclosure; |
|
41 | - |
|
42 | - /** |
|
43 | - * Set item title |
|
44 | - * @param string $title |
|
45 | - * @return $this |
|
46 | - */ |
|
47 | - public function title($title) |
|
48 | - { |
|
49 | - $this->title = $title; |
|
50 | - |
|
51 | - return $this; |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * Set item URL |
|
56 | - * @param string $url |
|
57 | - * @return $this |
|
58 | - */ |
|
59 | - public function url($url) |
|
60 | - { |
|
61 | - $this->url = $url; |
|
62 | - |
|
63 | - return $this; |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * Set item description |
|
68 | - * @param string $description |
|
69 | - * @return $this |
|
70 | - */ |
|
71 | - public function description($description) |
|
72 | - { |
|
73 | - $this->description = $description; |
|
74 | - |
|
75 | - return $this; |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * Set item category |
|
80 | - * @param string $name Category name |
|
81 | - * @param string $domain Category URL |
|
82 | - * @return $this |
|
83 | - */ |
|
84 | - public function category($name, $domain = null) |
|
85 | - { |
|
86 | - $this->categories[] = [$name, $domain]; |
|
87 | - |
|
88 | - return $this; |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * Set GUID |
|
93 | - * @param string $guid |
|
94 | - * @param bool $isPermalink |
|
95 | - * @return $this |
|
96 | - */ |
|
97 | - public function guid($guid, $isPermalink = false) |
|
98 | - { |
|
99 | - $this->guid = $guid; |
|
100 | - $this->isPermalink = $isPermalink; |
|
101 | - |
|
102 | - return $this; |
|
103 | - } |
|
104 | - |
|
105 | - /** |
|
106 | - * Set published date |
|
107 | - * @param int $pubDate Unix timestamp |
|
108 | - * @return $this |
|
109 | - */ |
|
110 | - public function pubDate($pubDate) |
|
111 | - { |
|
112 | - $this->pubDate = $pubDate; |
|
113 | - |
|
114 | - return $this; |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * Set enclosure |
|
119 | - * @param string $url Url to media file |
|
120 | - * @param int $length Length in bytes of the media file |
|
121 | - * @param string $type Media type, default is audio/mpeg |
|
122 | - * @return $this |
|
123 | - */ |
|
124 | - public function enclosure($url, $length = 0, $type = 'audio/mpeg') |
|
125 | - { |
|
126 | - $this->enclosure = ['url' => $url, 'length' => $length, 'type' => $type]; |
|
127 | - |
|
128 | - return $this; |
|
129 | - } |
|
130 | - |
|
131 | - /** |
|
132 | - * Append item to the channel |
|
133 | - * @param ChannelInterface $channel |
|
134 | - * @return $this |
|
135 | - */ |
|
136 | - public function appendTo(ChannelInterface $channel) |
|
137 | - { |
|
138 | - $channel->addItem($this); |
|
139 | - |
|
140 | - return $this; |
|
141 | - } |
|
142 | - |
|
143 | - /** |
|
144 | - * Set author name for article |
|
145 | - * |
|
146 | - * @param $creator |
|
147 | - * @return $this |
|
148 | - */ |
|
149 | - public function creator($creator) |
|
150 | - { |
|
151 | - $this->creator = $creator; |
|
152 | - |
|
153 | - return $this; |
|
154 | - } |
|
155 | - |
|
156 | - /** |
|
157 | - * @param $content |
|
158 | - * @return $this |
|
159 | - */ |
|
160 | - public function content($content) |
|
161 | - { |
|
162 | - $this->content = $content; |
|
163 | - |
|
164 | - return $this; |
|
165 | - } |
|
166 | - |
|
167 | - /** |
|
168 | - * Return XML object |
|
169 | - * @return SimpleXMLElement |
|
170 | - */ |
|
171 | - public function asXML() |
|
172 | - { |
|
173 | - $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item></item>', |
|
174 | - LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL); |
|
175 | - $xml->addChild('title', $this->title); |
|
176 | - $xml->addChild('link', $this->url); |
|
177 | - if ($this->pubDate !== null) { |
|
178 | - $xml->addChild('pubDate', date(DATE_RSS, $this->pubDate)); |
|
179 | - } |
|
180 | - |
|
181 | - if ($this->creator) { |
|
182 | - $xml->addChildCData("xmlns:dc:creator", $this->creator); |
|
183 | - } |
|
184 | - if ($this->guid) { |
|
185 | - $guid = $xml->addChild('guid', $this->guid); |
|
186 | - |
|
187 | - if ($this->isPermalink) { |
|
188 | - $guid->addAttribute('isPermaLink', 'true'); |
|
189 | - } |
|
190 | - } |
|
191 | - |
|
192 | - foreach ($this->categories as $category) { |
|
193 | - $element = $xml->addChild('category', $category[0]); |
|
194 | - |
|
195 | - if (isset($category[1])) { |
|
196 | - $element->addAttribute('domain', $category[1]); |
|
197 | - } |
|
198 | - } |
|
199 | - |
|
200 | - $xml->addChild('description', $this->description); |
|
201 | - $xml->addChildCData('xmlns:content:encoded', $this->content); |
|
202 | - |
|
203 | - if (is_array($this->enclosure) && (count($this->enclosure) == 3)) { |
|
204 | - $element = $xml->addChild('enclosure'); |
|
205 | - $element->addAttribute('url', $this->enclosure['url']); |
|
206 | - $element->addAttribute('type', $this->enclosure['type']); |
|
207 | - |
|
208 | - if ($this->enclosure['length']) { |
|
209 | - $element->addAttribute('length', $this->enclosure['length']); |
|
210 | - } |
|
211 | - } |
|
212 | - |
|
213 | - return $xml; |
|
214 | - } |
|
12 | + /** @var string */ |
|
13 | + protected $title; |
|
14 | + |
|
15 | + /** @var string */ |
|
16 | + protected $url; |
|
17 | + |
|
18 | + /** @var string */ |
|
19 | + protected $description; |
|
20 | + |
|
21 | + /** @var string */ |
|
22 | + protected $content; |
|
23 | + |
|
24 | + /** @var string */ |
|
25 | + protected $creator; |
|
26 | + |
|
27 | + /** @var array */ |
|
28 | + protected $categories = []; |
|
29 | + |
|
30 | + /** @var string */ |
|
31 | + protected $guid; |
|
32 | + |
|
33 | + /** @var bool */ |
|
34 | + protected $isPermalink; |
|
35 | + |
|
36 | + /** @var int */ |
|
37 | + protected $pubDate; |
|
38 | + |
|
39 | + /** @var array */ |
|
40 | + protected $enclosure; |
|
41 | + |
|
42 | + /** |
|
43 | + * Set item title |
|
44 | + * @param string $title |
|
45 | + * @return $this |
|
46 | + */ |
|
47 | + public function title($title) |
|
48 | + { |
|
49 | + $this->title = $title; |
|
50 | + |
|
51 | + return $this; |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * Set item URL |
|
56 | + * @param string $url |
|
57 | + * @return $this |
|
58 | + */ |
|
59 | + public function url($url) |
|
60 | + { |
|
61 | + $this->url = $url; |
|
62 | + |
|
63 | + return $this; |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * Set item description |
|
68 | + * @param string $description |
|
69 | + * @return $this |
|
70 | + */ |
|
71 | + public function description($description) |
|
72 | + { |
|
73 | + $this->description = $description; |
|
74 | + |
|
75 | + return $this; |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * Set item category |
|
80 | + * @param string $name Category name |
|
81 | + * @param string $domain Category URL |
|
82 | + * @return $this |
|
83 | + */ |
|
84 | + public function category($name, $domain = null) |
|
85 | + { |
|
86 | + $this->categories[] = [$name, $domain]; |
|
87 | + |
|
88 | + return $this; |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * Set GUID |
|
93 | + * @param string $guid |
|
94 | + * @param bool $isPermalink |
|
95 | + * @return $this |
|
96 | + */ |
|
97 | + public function guid($guid, $isPermalink = false) |
|
98 | + { |
|
99 | + $this->guid = $guid; |
|
100 | + $this->isPermalink = $isPermalink; |
|
101 | + |
|
102 | + return $this; |
|
103 | + } |
|
104 | + |
|
105 | + /** |
|
106 | + * Set published date |
|
107 | + * @param int $pubDate Unix timestamp |
|
108 | + * @return $this |
|
109 | + */ |
|
110 | + public function pubDate($pubDate) |
|
111 | + { |
|
112 | + $this->pubDate = $pubDate; |
|
113 | + |
|
114 | + return $this; |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * Set enclosure |
|
119 | + * @param string $url Url to media file |
|
120 | + * @param int $length Length in bytes of the media file |
|
121 | + * @param string $type Media type, default is audio/mpeg |
|
122 | + * @return $this |
|
123 | + */ |
|
124 | + public function enclosure($url, $length = 0, $type = 'audio/mpeg') |
|
125 | + { |
|
126 | + $this->enclosure = ['url' => $url, 'length' => $length, 'type' => $type]; |
|
127 | + |
|
128 | + return $this; |
|
129 | + } |
|
130 | + |
|
131 | + /** |
|
132 | + * Append item to the channel |
|
133 | + * @param ChannelInterface $channel |
|
134 | + * @return $this |
|
135 | + */ |
|
136 | + public function appendTo(ChannelInterface $channel) |
|
137 | + { |
|
138 | + $channel->addItem($this); |
|
139 | + |
|
140 | + return $this; |
|
141 | + } |
|
142 | + |
|
143 | + /** |
|
144 | + * Set author name for article |
|
145 | + * |
|
146 | + * @param $creator |
|
147 | + * @return $this |
|
148 | + */ |
|
149 | + public function creator($creator) |
|
150 | + { |
|
151 | + $this->creator = $creator; |
|
152 | + |
|
153 | + return $this; |
|
154 | + } |
|
155 | + |
|
156 | + /** |
|
157 | + * @param $content |
|
158 | + * @return $this |
|
159 | + */ |
|
160 | + public function content($content) |
|
161 | + { |
|
162 | + $this->content = $content; |
|
163 | + |
|
164 | + return $this; |
|
165 | + } |
|
166 | + |
|
167 | + /** |
|
168 | + * Return XML object |
|
169 | + * @return SimpleXMLElement |
|
170 | + */ |
|
171 | + public function asXML() |
|
172 | + { |
|
173 | + $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item></item>', |
|
174 | + LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL); |
|
175 | + $xml->addChild('title', $this->title); |
|
176 | + $xml->addChild('link', $this->url); |
|
177 | + if ($this->pubDate !== null) { |
|
178 | + $xml->addChild('pubDate', date(DATE_RSS, $this->pubDate)); |
|
179 | + } |
|
180 | + |
|
181 | + if ($this->creator) { |
|
182 | + $xml->addChildCData("xmlns:dc:creator", $this->creator); |
|
183 | + } |
|
184 | + if ($this->guid) { |
|
185 | + $guid = $xml->addChild('guid', $this->guid); |
|
186 | + |
|
187 | + if ($this->isPermalink) { |
|
188 | + $guid->addAttribute('isPermaLink', 'true'); |
|
189 | + } |
|
190 | + } |
|
191 | + |
|
192 | + foreach ($this->categories as $category) { |
|
193 | + $element = $xml->addChild('category', $category[0]); |
|
194 | + |
|
195 | + if (isset($category[1])) { |
|
196 | + $element->addAttribute('domain', $category[1]); |
|
197 | + } |
|
198 | + } |
|
199 | + |
|
200 | + $xml->addChild('description', $this->description); |
|
201 | + $xml->addChildCData('xmlns:content:encoded', $this->content); |
|
202 | + |
|
203 | + if (is_array($this->enclosure) && (count($this->enclosure) == 3)) { |
|
204 | + $element = $xml->addChild('enclosure'); |
|
205 | + $element->addAttribute('url', $this->enclosure['url']); |
|
206 | + $element->addAttribute('type', $this->enclosure['type']); |
|
207 | + |
|
208 | + if ($this->enclosure['length']) { |
|
209 | + $element->addAttribute('length', $this->enclosure['length']); |
|
210 | + } |
|
211 | + } |
|
212 | + |
|
213 | + return $xml; |
|
214 | + } |
|
215 | 215 | } |
@@ -171,7 +171,7 @@ |
||
171 | 171 | public function asXML() |
172 | 172 | { |
173 | 173 | $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item></item>', |
174 | - LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL); |
|
174 | + LIBXML_NOERROR|LIBXML_ERR_NONE|LIBXML_ERR_FATAL); |
|
175 | 175 | $xml->addChild('title', $this->title); |
176 | 176 | $xml->addChild('link', $this->url); |
177 | 177 | if ($this->pubDate !== null) { |
@@ -7,40 +7,40 @@ |
||
7 | 7 | class SimpleXMLElement extends XMLElement |
8 | 8 | { |
9 | 9 | |
10 | - /** |
|
11 | - * @param string $name |
|
12 | - * @param string $value |
|
13 | - * @param string $namespace |
|
14 | - * @return XMLElement |
|
15 | - */ |
|
16 | - public function addChild($name, $value = null, $namespace = null) |
|
17 | - { |
|
18 | - if ($value !== null and is_string($value) === true) { |
|
19 | - $value = str_replace('&', '&', $value); |
|
20 | - } |
|
10 | + /** |
|
11 | + * @param string $name |
|
12 | + * @param string $value |
|
13 | + * @param string $namespace |
|
14 | + * @return XMLElement |
|
15 | + */ |
|
16 | + public function addChild($name, $value = null, $namespace = null) |
|
17 | + { |
|
18 | + if ($value !== null and is_string($value) === true) { |
|
19 | + $value = str_replace('&', '&', $value); |
|
20 | + } |
|
21 | 21 | |
22 | - return parent::addChild($name, $value, $namespace); |
|
23 | - } |
|
22 | + return parent::addChild($name, $value, $namespace); |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * Create a child with CDATA value |
|
27 | - * @param string $name The name of the child element to add. |
|
28 | - * @param string $cdata_text The CDATA value of the child element. |
|
29 | - */ |
|
30 | - public function addChildCData($name, $cdata_text) |
|
31 | - { |
|
32 | - $child = $this->addChild($name); |
|
33 | - $child->addCData($cdata_text); |
|
34 | - } |
|
25 | + /** |
|
26 | + * Create a child with CDATA value |
|
27 | + * @param string $name The name of the child element to add. |
|
28 | + * @param string $cdata_text The CDATA value of the child element. |
|
29 | + */ |
|
30 | + public function addChildCData($name, $cdata_text) |
|
31 | + { |
|
32 | + $child = $this->addChild($name); |
|
33 | + $child->addCData($cdata_text); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * Add CDATA text in a node |
|
38 | - * @param string $cdata_text The CDATA value to add |
|
39 | - */ |
|
40 | - private function addCData($cdata_text) |
|
41 | - { |
|
42 | - $node = dom_import_simplexml($this); |
|
43 | - $no = $node->ownerDocument; |
|
44 | - $node->appendChild($no->createCDATASection($cdata_text)); |
|
45 | - } |
|
36 | + /** |
|
37 | + * Add CDATA text in a node |
|
38 | + * @param string $cdata_text The CDATA value to add |
|
39 | + */ |
|
40 | + private function addCData($cdata_text) |
|
41 | + { |
|
42 | + $node = dom_import_simplexml($this); |
|
43 | + $no = $node->ownerDocument; |
|
44 | + $node->appendChild($no->createCDATASection($cdata_text)); |
|
45 | + } |
|
46 | 46 | } |
@@ -9,34 +9,34 @@ |
||
9 | 9 | $feed = new Feed(); |
10 | 10 | $channel = new Channel(); |
11 | 11 | $channel |
12 | - ->title("Channel Title") |
|
13 | - ->description("Channel Description") |
|
14 | - ->url('http://bhaktaraz.com.np') |
|
15 | - ->language('en-US') |
|
16 | - ->copyright('Copyright 2015, Bhaktaraz') |
|
17 | - ->pubDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900')) |
|
18 | - ->lastBuildDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900')) |
|
19 | - ->updateFrequency(1) |
|
20 | - ->updatePeriod('hourly') |
|
21 | - ->ttl(60) |
|
22 | - ->appendTo($feed); |
|
12 | + ->title("Channel Title") |
|
13 | + ->description("Channel Description") |
|
14 | + ->url('http://bhaktaraz.com.np') |
|
15 | + ->language('en-US') |
|
16 | + ->copyright('Copyright 2015, Bhaktaraz') |
|
17 | + ->pubDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900')) |
|
18 | + ->lastBuildDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900')) |
|
19 | + ->updateFrequency(1) |
|
20 | + ->updatePeriod('hourly') |
|
21 | + ->ttl(60) |
|
22 | + ->appendTo($feed); |
|
23 | 23 | |
24 | 24 | $item = new Item(); |
25 | 25 | $item |
26 | - ->title("Item Title") |
|
27 | - ->creator("Deepak Pandey") |
|
28 | - ->description("Item body") |
|
29 | - ->content("<p class=\"popPara\" style=\"text-align: justify;\"><a href=\"http://www.onlinekhabar.com/wp-content/uploads/2015/11/kathmandu_view_tower_Old_buspark.jpg\"><img class=\"aligncenter wp-image-349218\" src=\"http://www.onlinekhabar.com/wp-content/uploads/2015/11/kathmandu_view_tower_Old_buspark.jpg\" alt=\"kathmandu_view_tower_Old_buspark\" width=\"810\" height=\"523\" srcset=\"http://www.onlinekhabar.com/wp-content/uploads/2015/11/kathmandu_view_tower_Old_buspark.jpg 650w, http://www.onlinekhabar.com/wp-content/uploads/2015/11/kathmandu_view_tower_Old_buspark-300x194.jpg 300w\" sizes=\"(max-width: 810px) 100vw, 810px\" /></a>२४ जेठ, काठमाडौँ । निर्माण सामग्रीको अभावका कारण पुरानो बसपार्कमा बनाउन लागिएको काठमाडौँ टावरको निर्माण कार्य अन्योलमा परेको छ ।</p> |
|
26 | + ->title("Item Title") |
|
27 | + ->creator("Deepak Pandey") |
|
28 | + ->description("Item body") |
|
29 | + ->content("<p class=\"popPara\" style=\"text-align: justify;\"><a href=\"http://www.onlinekhabar.com/wp-content/uploads/2015/11/kathmandu_view_tower_Old_buspark.jpg\"><img class=\"aligncenter wp-image-349218\" src=\"http://www.onlinekhabar.com/wp-content/uploads/2015/11/kathmandu_view_tower_Old_buspark.jpg\" alt=\"kathmandu_view_tower_Old_buspark\" width=\"810\" height=\"523\" srcset=\"http://www.onlinekhabar.com/wp-content/uploads/2015/11/kathmandu_view_tower_Old_buspark.jpg 650w, http://www.onlinekhabar.com/wp-content/uploads/2015/11/kathmandu_view_tower_Old_buspark-300x194.jpg 300w\" sizes=\"(max-width: 810px) 100vw, 810px\" /></a>२४ जेठ, काठमाडौँ । निर्माण सामग्रीको अभावका कारण पुरानो बसपार्कमा बनाउन लागिएको काठमाडौँ टावरको निर्माण कार्य अन्योलमा परेको छ ।</p> |
|
30 | 30 | <p class=\"popPara\" style=\"text-align: justify;\">टावर निर्माणको सम्पूर्ण सामग्री भारतबाट ल्याउनुपर्ने भएकाले निर्माण कार्य सुरु गर्न ढिला भएको निर्माणको जिम्मा पाएको जलेश्वर, स्वछन्द र विकोईका प्रमुख मनोज भेटवालले जानकारी दिए । उनका अनुसार सिमेन्ट, ढुङ्गा, गिट्टी बालुवालगायतको सामग्रीबाहेक अन्य सबै निर्माणका सामान भारतबाट ल्याउनुपर्ने छ ।</p> |
31 | 31 | <p class=\"popPara\" style=\"text-align: justify;\">हाल पुरानो बसपार्कमा जस्ताले बार्ने भइरहेको छ । भारतबाट आवश्यक सामग्री केही दिनमा आइपुग्ने र सामग्री आयसँगै निर्माण कार्यले गति लिने बताइएको छ ।</p> |
32 | 32 | <p>निर्माणलाई तीव्ररुपमा अघि बढाउनकै लागि भनी गत वैशाखको पहलो साता पुरानो बसपार्कमा आवतजावत गर्ने सबै यातायातका साधनलाई खुल्लामञ्चमा स्थानान्तरण गरिसकेको छ ।</p> |
33 | 33 | <p>भूकम्पपश्चात् भवन निर्माणको मापदण्ड फेरबदल भएकाले भवन पूर्णरूपमा भूकम्प प्रतिरोधात्मक र १२ तल्लाको बनाउने तयारी छ । नेपालमा हालसम्म बनेका भवनभन्दा पृथक र अत्याधुनिकसँगै नेपाली कला, संस्कृति झल्किने खालको हुने बताइएको छ ।</p> |
34 | 34 | <p>कामपासँग गरेको सम्झौताअनुसार ती कम्पनीले आफ्नो लगानीमा भवन बनाएर ३० वर्षसम्म चलाउने छन् । काम सुरु भएको पाँच वर्षभित्र सो टावर बनाइसक्नुपर्ने छ ।</p> |
35 | 35 | <p>टावरको लागत रु तीन अर्ब ५० करोड पुग्ने अनुमान गरिएको महानगरपालिका प्रवक्ता ज्ञानेन्द्र कार्कीले जातनकारी दिनुभयो । भवनको सबैभन्दा तल्लो तलामा बसको पार्किङ रहने छ । त्यस्तै, त्यसको माथि दुई तलामा हलुका गाडीको पार्किङ, व्यवस्थित सिनेमा हल, पौडी पोखरी, रेस्टुराँ, बैंक तथा महानगरपालिकाको वडा कार्यालयसमेत रहनेछ । भवनका लागि २३ रोपनी पाँच आना जग्गा छुट्याइएको छ ।</p>") |
36 | - ->url('http://bhaktaraz.com.np/?p=2') |
|
37 | - ->pubDate(strtotime('Mon, 03 Aug 2015 10:22:02 +0550')) |
|
38 | - ->guid('http://bhaktaraz.com.np/?p=2', true) |
|
39 | - ->appendTo($channel); |
|
36 | + ->url('http://bhaktaraz.com.np/?p=2') |
|
37 | + ->pubDate(strtotime('Mon, 03 Aug 2015 10:22:02 +0550')) |
|
38 | + ->guid('http://bhaktaraz.com.np/?p=2', true) |
|
39 | + ->appendTo($channel); |
|
40 | 40 | |
41 | 41 | |
42 | 42 | echo $feed; // or echo $feed->render(); |
@@ -8,83 +8,83 @@ |
||
8 | 8 | interface ItemInterface |
9 | 9 | { |
10 | 10 | |
11 | - /** |
|
12 | - * Set item title |
|
13 | - * @param string $title |
|
14 | - * @return $this |
|
15 | - */ |
|
16 | - public function title($title); |
|
11 | + /** |
|
12 | + * Set item title |
|
13 | + * @param string $title |
|
14 | + * @return $this |
|
15 | + */ |
|
16 | + public function title($title); |
|
17 | 17 | |
18 | - /** |
|
19 | - * Set item URL |
|
20 | - * @param string $url |
|
21 | - * @return $this |
|
22 | - */ |
|
23 | - public function url($url); |
|
18 | + /** |
|
19 | + * Set item URL |
|
20 | + * @param string $url |
|
21 | + * @return $this |
|
22 | + */ |
|
23 | + public function url($url); |
|
24 | 24 | |
25 | - /** |
|
26 | - * Set author name for article |
|
27 | - * |
|
28 | - * @param $creator |
|
29 | - * @return $this |
|
30 | - */ |
|
31 | - public function creator($creator); |
|
25 | + /** |
|
26 | + * Set author name for article |
|
27 | + * |
|
28 | + * @param $creator |
|
29 | + * @return $this |
|
30 | + */ |
|
31 | + public function creator($creator); |
|
32 | 32 | |
33 | - /** |
|
34 | - * Set item description |
|
35 | - * @param string $description |
|
36 | - * @return $this |
|
37 | - */ |
|
38 | - public function description($description); |
|
33 | + /** |
|
34 | + * Set item description |
|
35 | + * @param string $description |
|
36 | + * @return $this |
|
37 | + */ |
|
38 | + public function description($description); |
|
39 | 39 | |
40 | - /** |
|
41 | - * @param $content |
|
42 | - * @return $this |
|
43 | - */ |
|
44 | - public function content($content); |
|
40 | + /** |
|
41 | + * @param $content |
|
42 | + * @return $this |
|
43 | + */ |
|
44 | + public function content($content); |
|
45 | 45 | |
46 | - /** |
|
47 | - * Set item category |
|
48 | - * @param string $name Category name |
|
49 | - * @param string $domain Category URL |
|
50 | - * @return $this |
|
51 | - */ |
|
52 | - public function category($name, $domain = null); |
|
46 | + /** |
|
47 | + * Set item category |
|
48 | + * @param string $name Category name |
|
49 | + * @param string $domain Category URL |
|
50 | + * @return $this |
|
51 | + */ |
|
52 | + public function category($name, $domain = null); |
|
53 | 53 | |
54 | - /** |
|
55 | - * Set GUID |
|
56 | - * @param string $guid |
|
57 | - * @param bool $isPermalink |
|
58 | - * @return $this |
|
59 | - */ |
|
60 | - public function guid($guid, $isPermalink = false); |
|
54 | + /** |
|
55 | + * Set GUID |
|
56 | + * @param string $guid |
|
57 | + * @param bool $isPermalink |
|
58 | + * @return $this |
|
59 | + */ |
|
60 | + public function guid($guid, $isPermalink = false); |
|
61 | 61 | |
62 | - /** |
|
63 | - * Set published date |
|
64 | - * @param int $pubDate Unix timestamp |
|
65 | - * @return $this |
|
66 | - */ |
|
67 | - public function pubDate($pubDate); |
|
62 | + /** |
|
63 | + * Set published date |
|
64 | + * @param int $pubDate Unix timestamp |
|
65 | + * @return $this |
|
66 | + */ |
|
67 | + public function pubDate($pubDate); |
|
68 | 68 | |
69 | - /** |
|
70 | - * Set enclosure |
|
71 | - * @param string $url Url to media file |
|
72 | - * @param int $length Length in bytes of the media file |
|
73 | - * @param string $type Media type, default is audio/mpeg |
|
74 | - * @return $this |
|
75 | - */ |
|
76 | - public function enclosure($url, $length = 0, $type = 'audio/mpeg'); |
|
69 | + /** |
|
70 | + * Set enclosure |
|
71 | + * @param string $url Url to media file |
|
72 | + * @param int $length Length in bytes of the media file |
|
73 | + * @param string $type Media type, default is audio/mpeg |
|
74 | + * @return $this |
|
75 | + */ |
|
76 | + public function enclosure($url, $length = 0, $type = 'audio/mpeg'); |
|
77 | 77 | |
78 | - /** |
|
79 | - * Append item to the channel |
|
80 | - * @param ChannelInterface $channel |
|
81 | - * @return $this |
|
82 | - */ |
|
83 | - public function appendTo(ChannelInterface $channel); |
|
78 | + /** |
|
79 | + * Append item to the channel |
|
80 | + * @param ChannelInterface $channel |
|
81 | + * @return $this |
|
82 | + */ |
|
83 | + public function appendTo(ChannelInterface $channel); |
|
84 | 84 | |
85 | - /** |
|
86 | - * Return XML object |
|
87 | - * @return SimpleXMLElement |
|
88 | - */ |
|
89 | - public function asXML(); |
|
85 | + /** |
|
86 | + * Return XML object |
|
87 | + * @return SimpleXMLElement |
|
88 | + */ |
|
89 | + public function asXML(); |
|
90 | 90 | } |