You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.4 KiB
37 lines
1.4 KiB
6 years ago
|
<?php
|
||
|
/** @license MIT
|
||
|
* Copyright 2018 J. King et al.
|
||
|
* See LICENSE and AUTHORS files for details */
|
||
|
|
||
|
declare(strict_types=1);
|
||
4 years ago
|
namespace JKingWeb\Lax\Parser\XML\Primitives;
|
||
6 years ago
|
|
||
6 years ago
|
use JKingWeb\Lax\Person\Collection as PersonCollection;
|
||
4 years ago
|
use JKingWeb\Lax\Parser\XML\XPath;
|
||
6 years ago
|
|
||
|
trait Entry {
|
||
6 years ago
|
/** Primitive to fetch a collection of authors associated with an Atom entry
|
||
|
*
|
||
|
* This differs from feeds in that an entry's <source> element (which possibly contains metadata for the source feed) is checked for authors if the entry itself has none
|
||
|
*/
|
||
|
protected function getAuthorsAtom() {
|
||
|
return $this->fetchPeopleAtom("atom:author", "author") ?? $this->fetchPeopleAtom("atom:source[1]/atom:author", "author");
|
||
6 years ago
|
}
|
||
6 years ago
|
|
||
|
/** Primitive to fetch an RDF entry's canonical URL */
|
||
|
protected function getUrlRss1() {
|
||
|
// XPath doesn't seem to like the query we'd need for this, so it must be done the hard way.
|
||
|
$node = $this->subject;
|
||
|
if ($node->localName=="item" && ($node->namespaceURI==XPath::NS['rss1'] || $node->namespaceURI==XPath::NS['rss0']) && $node->hasAttributeNS(XPath::NS['rdf'], "about")) {
|
||
|
return $this->resolveNodeUrl($node, "about", XPath::NS['rdf']);
|
||
|
} else {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
6 years ago
|
|
||
|
/** Primitive to fetch the modification date of an RSS feed */
|
||
|
protected function getDateModifiedRss2() {
|
||
6 years ago
|
return $this->fetchDate("pubDate");
|
||
6 years ago
|
}
|
||
6 years ago
|
}
|