Mercurial > hg > cmmr2012-drupal-site
comparison vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Feed.php @ 2:5311817fb629
Theme updates
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 13:19:18 +0000 |
parents | c75dbcec494b |
children | a9cd425dd02b |
comparison
equal
deleted
inserted
replaced
1:0b0e5f3b1e83 | 2:5311817fb629 |
---|---|
51 $authors = []; | 51 $authors = []; |
52 | 52 |
53 if ($list->length) { | 53 if ($list->length) { |
54 foreach ($list as $author) { | 54 foreach ($list as $author) { |
55 $author = $this->getAuthorFromElement($author); | 55 $author = $this->getAuthorFromElement($author); |
56 if (!empty($author)) { | 56 if (! empty($author)) { |
57 $authors[] = $author; | 57 $authors[] = $author; |
58 } | 58 } |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
89 $copyright = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:copyright)'); | 89 $copyright = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:copyright)'); |
90 } else { | 90 } else { |
91 $copyright = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:rights)'); | 91 $copyright = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:rights)'); |
92 } | 92 } |
93 | 93 |
94 if (!$copyright) { | 94 if (! $copyright) { |
95 $copyright = null; | 95 $copyright = null; |
96 } | 96 } |
97 | 97 |
98 $this->data['copyright'] = $copyright; | 98 $this->data['copyright'] = $copyright; |
99 | 99 |
173 $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:tagline)'); | 173 $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:tagline)'); |
174 } else { | 174 } else { |
175 $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:subtitle)'); | 175 $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:subtitle)'); |
176 } | 176 } |
177 | 177 |
178 if (!$description) { | 178 if (! $description) { |
179 $description = null; | 179 $description = null; |
180 } | 180 } |
181 | 181 |
182 $this->data['description'] = $description; | 182 $this->data['description'] = $description; |
183 | 183 |
195 return $this->data['generator']; | 195 return $this->data['generator']; |
196 } | 196 } |
197 // TODO: Add uri support | 197 // TODO: Add uri support |
198 $generator = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:generator)'); | 198 $generator = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:generator)'); |
199 | 199 |
200 if (!$generator) { | 200 if (! $generator) { |
201 $generator = null; | 201 $generator = null; |
202 } | 202 } |
203 | 203 |
204 $this->data['generator'] = $generator; | 204 $this->data['generator'] = $generator; |
205 | 205 |
217 return $this->data['id']; | 217 return $this->data['id']; |
218 } | 218 } |
219 | 219 |
220 $id = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:id)'); | 220 $id = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:id)'); |
221 | 221 |
222 if (!$id) { | 222 if (! $id) { |
223 if ($this->getLink()) { | 223 if ($this->getLink()) { |
224 $id = $this->getLink(); | 224 $id = $this->getLink(); |
225 } elseif ($this->getTitle()) { | 225 } elseif ($this->getTitle()) { |
226 $id = $this->getTitle(); | 226 $id = $this->getTitle(); |
227 } else { | 227 } else { |
245 return $this->data['language']; | 245 return $this->data['language']; |
246 } | 246 } |
247 | 247 |
248 $language = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:lang)'); | 248 $language = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:lang)'); |
249 | 249 |
250 if (!$language) { | 250 if (! $language) { |
251 $language = $this->xpath->evaluate('string(//@xml:lang[1])'); | 251 $language = $this->xpath->evaluate('string(//@xml:lang[1])'); |
252 } | 252 } |
253 | 253 |
254 if (!$language) { | 254 if (! $language) { |
255 $language = null; | 255 $language = null; |
256 } | 256 } |
257 | 257 |
258 $this->data['language'] = $language; | 258 $this->data['language'] = $language; |
259 | 259 |
271 return $this->data['image']; | 271 return $this->data['image']; |
272 } | 272 } |
273 | 273 |
274 $imageUrl = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:logo)'); | 274 $imageUrl = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:logo)'); |
275 | 275 |
276 if (!$imageUrl) { | 276 if (! $imageUrl) { |
277 $image = null; | 277 $image = null; |
278 } else { | 278 } else { |
279 $image = ['uri' => $imageUrl]; | 279 $image = ['uri' => $imageUrl]; |
280 } | 280 } |
281 | 281 |
295 return $this->data['baseUrl']; | 295 return $this->data['baseUrl']; |
296 } | 296 } |
297 | 297 |
298 $baseUrl = $this->xpath->evaluate('string(//@xml:base[1])'); | 298 $baseUrl = $this->xpath->evaluate('string(//@xml:base[1])'); |
299 | 299 |
300 if (!$baseUrl) { | 300 if (! $baseUrl) { |
301 $baseUrl = null; | 301 $baseUrl = null; |
302 } | 302 } |
303 $this->data['baseUrl'] = $baseUrl; | 303 $this->data['baseUrl'] = $baseUrl; |
304 | 304 |
305 return $this->data['baseUrl']; | 305 return $this->data['baseUrl']; |
392 return $this->data['title']; | 392 return $this->data['title']; |
393 } | 393 } |
394 | 394 |
395 $title = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:title)'); | 395 $title = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:title)'); |
396 | 396 |
397 if (!$title) { | 397 if (! $title) { |
398 $title = null; | 398 $title = null; |
399 } | 399 } |
400 | 400 |
401 $this->data['title'] = $title; | 401 $this->data['title'] = $title; |
402 | 402 |
480 * Attempt to absolutise the URI, i.e. if a relative URI apply the | 480 * Attempt to absolutise the URI, i.e. if a relative URI apply the |
481 * xml:base value as a prefix to turn into an absolute URI. | 481 * xml:base value as a prefix to turn into an absolute URI. |
482 */ | 482 */ |
483 protected function absolutiseUri($link) | 483 protected function absolutiseUri($link) |
484 { | 484 { |
485 if (!Uri::factory($link)->isAbsolute()) { | 485 if (! Uri::factory($link)->isAbsolute()) { |
486 if ($this->getBaseUrl() !== null) { | 486 if ($this->getBaseUrl() !== null) { |
487 $link = $this->getBaseUrl() . $link; | 487 $link = $this->getBaseUrl() . $link; |
488 if (!Uri::factory($link)->isValid()) { | 488 if (! Uri::factory($link)->isValid()) { |
489 $link = null; | 489 $link = null; |
490 } | 490 } |
491 } | 491 } |
492 } | 492 } |
493 return $link; | 493 return $link; |
521 { | 521 { |
522 $dom = $this->getDomDocument(); | 522 $dom = $this->getDomDocument(); |
523 $prefixAtom03 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_03); | 523 $prefixAtom03 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_03); |
524 $prefixAtom10 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_10); | 524 $prefixAtom10 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_10); |
525 if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_10) | 525 if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_10) |
526 || !empty($prefixAtom10) | 526 || ! empty($prefixAtom10) |
527 ) { | 527 ) { |
528 return Reader\Reader::TYPE_ATOM_10; | 528 return Reader\Reader::TYPE_ATOM_10; |
529 } | 529 } |
530 if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_03) | 530 if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_03) |
531 || !empty($prefixAtom03) | 531 || ! empty($prefixAtom03) |
532 ) { | 532 ) { |
533 return Reader\Reader::TYPE_ATOM_03; | 533 return Reader\Reader::TYPE_ATOM_03; |
534 } | 534 } |
535 } | 535 } |
536 } | 536 } |