forked from shinvdu/sevice_cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFile.php
More file actions
39 lines (35 loc) · 1.17 KB
/
File.php
File metadata and controls
39 lines (35 loc) · 1.17 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
<?php
class File extends Connector {
public function __construct($options){
parent::__construct($options);
$this->connect();
}
/*
$file_contents: To return file contents or not.
*/
public function file_load($fid, $file_contents = 1, $image_styles = false) {
return (object)$this->requestSend($this->_methods->FILE_GET, array($fid, $file_contents, $image_styles));
}
public function file_create($file) {
return (object)$this->requestSend($this->_methods->FILE_CREATE, array($file));
}
public function file_delete($fid) {
if (!is_array($fid)) {
$fid = (array)$fid;
}
$return = array();
foreach ($fid as $id) {
$return[] = $this->requestSend($this->_methods->FILE_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 file_list($page = 0, $fields = '*', $parameters = array(), $pagesize = 20){
return $this->requestSend($this->_methods->FILE_LIST, array($page, $fields, $parameters, $pagesize));
}
}