-
Notifications
You must be signed in to change notification settings - Fork 10
/
Ziggeo.php
220 lines (161 loc) · 5.45 KB
/
Ziggeo.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?php
spl_autoload_register(function ($class) {
$fname = dirname(__FILE__) . "/classes/" . $class . '.php';
if (file_exists($fname))
include $fname;
});
Class Ziggeo {
private $token;
private $private_key;
private $encryption_key;
function __construct($token, $private_key, $encryption_key = NULL, $config = NULL) {
$this->token = $token;
$this->private_key = $private_key;
$this->encryption_key = $encryption_key;
if (is_array($config)) {
foreach($config as $ident => $value)
$this->config()->set($ident, $value);
}
}
function token() {
return $this->token;
}
function private_key() {
return $this->private_key;
}
function encryption_key() {
return $this->encryption_key;
}
private $config = NULL;
function config() {
if (!@$this->config)
$this->config = new ZiggeoConfig($this);
return $this->config;
}
private $connect = NULL;
function connect() {
if (!@$this->connect) {
$server_api_url = $this->config()->get("server_api_url");
$regions = $this->config()->get("regions");
foreach ($regions as $key => $value)
if (strpos($this->token(), $key) === 0)
$server_api_url = $value;
$this->connect = new ZiggeoConnect($this, $server_api_url, $this->config());
}
return $this->connect;
}
private $apiConnect = NULL;
function apiConnect() {
if (!@$this->apiConnect) {
$api_url = $this->config()->get("api_url");
$api_regions = $this->config()->get("api_regions");
foreach ($api_regions as $key => $value)
if (strpos($this->token(), $key) === 0)
$api_url = $value;
$this->apiConnect = new ZiggeoConnect($this, $api_url, $this->config());
}
return $this->apiConnect;
}
private $cdnConnect = NULL;
function cdnConnect() {
if (!@$this->cdnConnect) {
$cdn_url = $this->config()->get("cdn_url");
$cdn_regions = $this->config()->get("cdn_regions");
foreach ($cdn_regions as $key => $value)
if (strpos($this->token(), $key) === 0)
$cdn_url = $value;
$this->cdnConnect = new ZiggeoConnect($this, $cdn_url, $this->config());
}
return $this->cdnConnect;
}
private $jsCdnConnect = NULL;
function jsCdnConnect() {
if (!@$this->jsCdnConnect) {
$jsCdn_url = $this->config()->get("js_cdn_url");
$jsCdn_regions = $this->config()->get("js_cdn_regions");
foreach ($jsCdn_regions as $key => $value)
if (strpos($this->token(), $key) === 0)
$jsCdn_url = $value;
$this->jsCdnConnect = new ZiggeoConnect($this, $jsCdn_url, $this->config());
}
return $this->jsCdnConnect;
}
private $auth = NULL;
function auth() {
if (!@$this->auth)
$this->auth = new ZiggeoAuth($this);
return $this->auth;
}
private $videos = NULL;
function videos() {
if (!@$this->videos)
$this->videos = new ZiggeoVideos($this);
return $this->videos;
}
private $streams = NULL;
function streams() {
if (!@$this->streams)
$this->streams = new ZiggeoStreams($this);
return $this->streams;
}
private $audios = NULL;
function audios() {
if (!@$this->audios)
$this->audios = new ZiggeoAudios($this);
return $this->audios;
}
private $audioStreams = NULL;
function audioStreams() {
if (!@$this->audioStreams)
$this->audioStreams = new ZiggeoAudioStreams($this);
return $this->audioStreams;
}
private $authtokens = NULL;
function authtokens() {
if (!@$this->authtokens)
$this->authtokens = new ZiggeoAuthtokens($this);
return $this->authtokens;
}
private $application = NULL;
function application() {
if (!@$this->application)
$this->application = new ZiggeoApplication($this);
return $this->application;
}
private $effectProfiles = NULL;
function effectProfiles() {
if (!@$this->effectProfiles)
$this->effectProfiles = new ZiggeoEffectProfiles($this);
return $this->effectProfiles;
}
private $effectProfileProcess = NULL;
function effectProfileProcess() {
if (!@$this->effectProfileProcess)
$this->effectProfileProcess = new ZiggeoEffectProfileProcess($this);
return $this->effectProfileProcess;
}
private $metaProfiles = NULL;
function metaProfiles() {
if (!@$this->metaProfiles)
$this->metaProfiles = new ZiggeoMetaProfiles($this);
return $this->metaProfiles;
}
private $metaProfileProcess = NULL;
function metaProfileProcess() {
if (!@$this->metaProfileProcess)
$this->metaProfileProcess = new ZiggeoMetaProfileProcess($this);
return $this->metaProfileProcess;
}
private $webhooks = NULL;
function webhooks() {
if (!@$this->webhooks)
$this->webhooks = new ZiggeoWebhooks($this);
return $this->webhooks;
}
private $analytics = NULL;
function analytics() {
if (!@$this->analytics)
$this->analytics = new ZiggeoAnalytics($this);
return $this->analytics;
}
}