forked from shinvdu/sevice_cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComment.php
More file actions
48 lines (44 loc) · 1.38 KB
/
Comment.php
File metadata and controls
48 lines (44 loc) · 1.38 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
<?php
class Comment extends Service
{
// data stored in this object
protected $comment;
public function __construct($options){
parent::__construct($options);
$this->connect();
}
public function comment_load($cid) {
return (object)$this->requestSend($this->_methods->COMMENT_GET, array($cid));
}
public function comment_create($comment) {
if(is_array($comment)){
$comment = (object)$comment;
}
return $this->requestSend($this->_methods->COMMENT_CREATE, array($comment));
}
public function comment_save($cid, $comment) {
if(is_object($comment)){
$comment = (array)$comment;
}
return $this->requestSend($this->_methods->COMMENT_SAVE, array($cid, $comment));
}
public function comment_delete($cid) {
if (!is_array($cid)) {
$cid = (array)$cid;
}
$return = array();
foreach ($cid as $id) {
$return[] = $this->requestSend($this->_methods->COMMENT_DELETE, array($id));
}
return $return;
}
/*
$page: The zero-based index of the page to get, defaults to 0.
$fields: string, The fields to get.
$parameters: array, Parameters array
$pagesize: Number of records to get per page.
*/
public function comment_list($page = 0, $fields = '*', $parameters = array(), $pagesize = 20){
return $this->requestSend($this->_methods->COMMENT_LIST, array($page, $fields, $parameters, $pagesize));
}
}