-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatomfeed.class
More file actions
69 lines (48 loc) · 1.55 KB
/
Copy pathatomfeed.class
File metadata and controls
69 lines (48 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
// limited to one alternate per type and hreflang. A feed should contain a link back to the feed itself
class AtomFeed extends AtomElement {
public $Icon;
public $Logo;
public $Subtitle;
public $Entries;
public function __construct() {
parent::__construct('feed');
$this->Icon = NULL;
$this->Logo = NULL;
$this->Subtitle = NULL;
$this->Entries = array();
}
public function AddEntry($entry) {
if (!$entry instanceof AtomEntry)
throw new Exception('Entries must be instances of AtomEntry class');
$this->Entries[] = $entry;
}
public function SetIcon($uri) {
$this->Icon = $uri;
}
public function SetLogo($uri) {
$this->Logo = $uri;
}
public function SetSubtitle($data) {
$this->Subtitle = $data;
}
public static function Consume($data) {
}
public function Build() {
if ($this->Icon !== NULL)
$this->AddElement('icon', $this->Icon);
if ($this->Logo !== NULL)
$this->AddElement('logo', $this->Logo);
if ($this->Subtitle !== NULL)
$this->AddElement('subtitle', $this->Subtitle);
$node = $this->ForkChild('generator', 'Exhibition');
$node->SetAttribute('uri', 'http://evilprojects.com/exhibition/');
$node->SetAttribute('version', '1.0');
$this->AddChild($node);
parent::Build();
foreach ($this->Entries as $entry)
$this->AddChild($entry->Build());
return $this;
}
}
?>