forked from shinvdu/sevice_cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaxonomy.php
More file actions
84 lines (75 loc) · 2.53 KB
/
Taxonomy.php
File metadata and controls
84 lines (75 loc) · 2.53 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
class Taxonomy extends Connector {
public function __construct($options){
parent::__construct($options);
$this->connect();
}
public function vocabulary_load($vid) {
return (object)$this->requestSend($this->_methods->VOCABULARY_GET, array($vid));
}
public function vocabulary_create($vocabulary) {
if(is_array($vocabulary)){
$vocabulary = (object)$vocabulary;
}
return $this->requestSend($this->_methods->VOCABULARY_CREATE, array($vocabulary));
}
public function vocabulary_save($vid, $vocabulary) {
if(is_object($vocabulary)){
$vocabulary = (array)$vocabulary;
}
return $this->requestSend($this->_methods->VOCABULARY_SAVE, array($vid, $vocabulary));
}
public function vocabulary_delete($vid) {
if (!is_array($vid)) {
$vid = (array)$vid;
}
$return = array();
foreach ($vid as $id) {
$return[] = $this->requestSend($this->_methods->VOCABULARY_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 vocabulary_list($page = 0, $fields = '*', $parameters = array(), $pagesize = 20){
return $this->requestSend($this->_methods->VOCABULARY_LIST, array($page, $fields, $parameters, $pagesize));
}
public function term_load($tid) {
return (object)$this->requestSend($this->_methods->TERM_GET, array($tid));
}
public function term_create($term) {
if(is_array($term)){
$term = (object)$term;
}
return $this->requestSend($this->_methods->TERM_CREATE, array($term));
}
public function term_save($tid, $term) {
if(is_object($term)){
$term = (array)$term;
}
return $this->requestSend($this->_methods->TERM_SAVE, array($tid, $term));
}
public function term_delete($tid) {
if (!is_array($tid)) {
$tid = (array)$tid;
}
$return = array();
foreach ($tid as $id) {
$return[] = $this->requestSend($this->_methods->TERM_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 term_list($page = 0, $fields = '*', $parameters = array(), $pagesize = 20){
return $this->requestSend($this->_methods->TERM_LIST, array($page, $fields, $parameters, $pagesize));
}
}