-
Notifications
You must be signed in to change notification settings - Fork 6
/
arena.php
59 lines (49 loc) · 1.25 KB
/
arena.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
<?php
function autoloader($class) {
include 'lib/' . $class . '.php';
}
spl_autoload_register('autoloader');
/*
* Arena PHP API interface
*
*
* Integration examples are in examples/ directory
*
*/
class Arena
{
function __construct() {
// empty for now
}
function get_channel($slug = null, $options = null){
$request = new Request("channels/$slug", $options);
return new Channel($request->data);
}
function get_block($id = null){
$request = new Request("blocks/$id");
return new Block($request->data);
}
function get_user($slug = null){
$request = new Request("users/$slug");
return new User($request->data);
}
function get_user_channels($slug = null){
$request = new Request("users/$slug/channels");
return new ChannelCollection($request->data);
}
function create_block($channel_slug, $block_attrs = null){
$request = new Request("channels/$channel_slug/blocks", array('POST' => true), $block_attrs);
return new Block($request->data);
}
function select_block($connection_id){
$request = new Request("connections/$connection_id/selection", array('PUT' => true));
}
function set_page() {
if(isset($_GET['page'])){
return $_GET['page'];
}else{
return 1;
}
}
}
?>