-
Notifications
You must be signed in to change notification settings - Fork 2
/
AtomEntryAdapter.php
71 lines (57 loc) · 1.96 KB
/
AtomEntryAdapter.php
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
70
71
<?php
require_once 'AtomSourceAdapter.php';
require_once 'AtomContentAdapter.php';
class AtomEntryAdapter extends AtomSourceAdapter {
protected $_published;
protected $_content;
protected $_summary;
public function getContent() {
return $this->_content;
}
public function getPublished() {
return $this->_published;
}
public function getSummary() {
return $this->_summary;
}
public function setContent($value) {
if (!isset($this->_content)) {
$content = $this->_addElement(AtomNS::NS, AtomNS::CONTENT_ELEMENT, $value);
$this->_content = new AtomContentAdapter($content);
return;
}
$this->_content->value = $value;
}
public function setPublished($value) {
if (!isset($this->_published)) {
$published = $this->_addElement(AtomNS::NS, AtomNS::PUBLISHED_ELEMENT, $value);
$this->_published = new AtomDateConstructAdapter(AtomNS::PUBLISHED_ELEMENT, $published);
return;
}
$this->_published->value = $value;
}
public function setSummary($value) {
if (!isset($this->_summary)) {
$summary = $this->_addElement(AtomNS::NS, AtomNS::SUMMARY_ELEMENT, $value);
$this->_summary = new AtomTextConstructAdapter(AtomNS::SUMMARY_ELEMENT, $summary);
return;
}
$this->_summary->value = $value;
}
public function __construct($data=null, $data_is_url=false) {
parent::__construct(AtomNS::ENTRY_ELEMENT, $data, $data_is_url);
//$this->_init();
}
protected function _init() {
parent::_init();
if (isset($this->_element[AtomNS::PUBLISHED_ELEMENT][0])) {
$this->_published = new AtomDateConstructAdapter(AtomNS::PUBLISHED_ELEMENT, $this->_element[AtomNS::PUBLISHED_ELEMENT][0]);
}
if (isset($this->_element[AtomNS::CONTENT_ELEMENT][0])) {
$this->_content = new AtomContentAdapter($this->_element[AtomNS::CONTENT_ELEMENT][0]);
}
if (isset($this->_element[AtomNS::SUMMARY_ELEMENT][0])) {
$this->_summary = new AtomTextConstructAdapter(AtomNS::SUMMARY_ELEMENT, $this->_element[AtomNS::SUMMARY_ELEMENT][0]);
}
}
}