]>
Commit | Line | Data |
---|---|---|
b4d16900 AD |
1 | <?php |
2 | abstract class FeedItem_Common extends FeedItem { | |
3 | protected $elem; | |
4 | protected $xpath; | |
5 | protected $doc; | |
6 | ||
7 | function __construct($elem, $doc, $xpath) { | |
8 | $this->elem = $elem; | |
9 | $this->xpath = $xpath; | |
10 | $this->doc = $doc; | |
11 | } | |
12 | ||
13 | function get_author() { | |
14 | $author = $this->elem->getElementsByTagName("author")->item(0); | |
15 | ||
16 | if ($author) { | |
17 | $name = $author->getElementsByTagName("name")->item(0); | |
18 | ||
19 | if ($name) return $name->nodeValue; | |
20 | ||
21 | $email = $author->getElementsByTagName("email")->item(0); | |
22 | ||
23 | if ($email) return $email->nodeValue; | |
602fe534 AD |
24 | |
25 | if ($author->nodeValue) | |
26 | return $author->nodeValue; | |
b4d16900 AD |
27 | } |
28 | ||
29 | $author = $this->xpath->query("dc:creator", $this->elem)->item(0); | |
30 | ||
31 | if ($author) { | |
32 | return $author->nodeValue; | |
33 | } | |
34 | } | |
35 | ||
36 | // todo | |
37 | function get_comments_url() { | |
38 | ||
39 | } | |
40 | ||
41 | function get_comments_count() { | |
42 | $comments = $this->xpath->query("slash:comments", $this->elem)->item(0); | |
43 | ||
44 | if ($comments) { | |
45 | return $comments->nodeValue; | |
46 | } | |
47 | } | |
48 | ||
49 | ||
50 | } | |
51 | ?> |