forked from alchemy-fr/Phlickr
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Comment.php
93 lines (79 loc) · 2.34 KB
/
Comment.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/**
* @version $Id: Comment.php 510 2006-12-28 03:44:39Z drewish $
* @author Martin Legris <[email protected]>
* @license http://opensource.org/licenses/lgpl-license.php
* GNU Lesser General Public License, Version 2.1
* @package Phlickr
*/
/**
* Phlickr_Api includes the core classes.
*/
require_once dirname(__FILE__) . '/Api.php';
/**
* This class extends Phlickr_ObjectBase.
*/
require_once dirname(__FILE__) . '/Framework/ObjectBase.php';
/**
* Phlickr_Group access to the photos in a group.
*
* @package Phlickr
* @author Martin Legris <[email protected]>
* @since 0.5.1
*/
class Phlickr_Comment extends Phlickr_Framework_ObjectBase {
/**
* The name of the XML element in the response that defines the object.
*
* @var string
*/
const XML_RESPONSE_ELEMENT = 'comment';
/**
* Constructor.
*
* You can construct a group from an Id or XML.
*
* @param object Phlickr_API $api
* @param mixed $source string Id, object SimpleXMLElement
* @throws Phlickr_Exception, Phlickr_ConnectionException, Phlickr_XmlParseException
*/
function __construct(Phlickr_Api $api, $source) {
$this->_cachedXml = $source;
$this->_api = $api;
}
public function __toString() {
return $this->getName() . ' (' . $this->getId() . ')';
}
static function getRequestMethodName() {
return self::XML_METHOD_NAME;
}
static function getRequestMethodParams($id) {
return array('comment_id' => (string) $id);
}
/**
* Build a URL to access the comment
*
* @return string
*/
public function getUrl() {
return (string) $this->_cachedXML['permalink'];
}
public function buildUrl() {
return $this->getUrl();
}
public function getId() {
return (string) $this->_cachedXml["id"];
}
public function getAuthorId() {
return (string) $this->_cachedXml['author'];
}
public function getAuthorName() {
return (string) $this->_cachedXml['authorname'];
}
public function getCreationDate() {
return (integer) $this->_cachedXml['datecreate'];
}
public function getComment() {
return (string) $this->_cachedXml;
}
}