Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5ec3927

Browse files
author
Michael Christopher
committed
Completed classes for Job and Output, added structures for Account and Input
1 parentee22220 commit5ec3927

File tree

7 files changed

+123
-6
lines changed

7 files changed

+123
-6
lines changed

‎Services/Zencoder/Account.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/*
3+
4+
Zencoder API PHP Library
5+
Version: 2.0
6+
See the README file for info on how to use this library.
7+
8+
*/
9+
10+
class Services_Zencoder_Account {
11+
public$id;
12+
13+
publicfunction__construct($params) {
14+
$this->update_attributes($params);
15+
}
16+
17+
privatefunctionupdate_attributes($attributes =array()) {
18+
foreach($attributesas$attr_name =>$attr_value) {
19+
if(!function_exists($this->$attr_name)) {
20+
$this->$attr_name =$attr_value;
21+
}
22+
}
23+
}
24+
}

‎Services/Zencoder/Http.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public function __call($name, $args) {
3333
CURLOPT_POSTFIELDS =>NULL,
3434
CURLOPT_CONNECTTIMEOUT =>30,
3535
CURLOPT_TIMEOUT =>30,
36-
CURLOPT_SSL_VERIFYPEER =>1,
37-
CURLOPT_SSL_VERIFYHOST =>2
36+
CURLOPT_SSL_VERIFYPEER =>0,
37+
CURLOPT_SSL_VERIFYHOST =>0
3838
);
3939

4040
foreach ($req_headersas$k =>$v)$opts[CURLOPT_HTTPHEADER][] ="$k:$v";

‎Services/Zencoder/Input.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/*
3+
4+
Zencoder API PHP Library
5+
Version: 2.0
6+
See the README file for info on how to use this library.
7+
8+
*/
9+
10+
class Services_Zencoder_Input {
11+
public$id;
12+
13+
publicfunction__construct($params) {
14+
$this->update_attributes($params);
15+
}
16+
17+
privatefunctionupdate_attributes($attributes =array()) {
18+
foreach($attributesas$attr_name =>$attr_value) {
19+
if(!function_exists($this->$attr_name)) {
20+
$this->$attr_name =$attr_value;
21+
}
22+
}
23+
}
24+
}

‎Services/Zencoder/Job.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
/*
3+
4+
Zencoder API PHP Library
5+
Version: 2.0
6+
See the README file for info on how to use this library.
7+
8+
*/
9+
10+
class Services_Zencoder_Job {
11+
public$id,$test,$state,$outputs =array();
12+
protected$raw_response;
13+
14+
publicfunction__construct($params) {
15+
$this->raw_response =$params;
16+
$this->update_attributes($params);
17+
}
18+
19+
privatefunctionupdate_attributes($attributes =array()) {
20+
foreach($attributesas$attr_name =>$attr_value) {
21+
if($attr_name =="outputs" &&is_array($attr_value)) {
22+
$this->create_outputs($attr_value);
23+
}elseif (!function_exists($this->$attr_name)) {
24+
$this->$attr_name =$attr_value;
25+
}
26+
}
27+
}
28+
29+
privatefunctioncreate_outputs($outputs =array()) {
30+
foreach($outputsas$output_attrs) {
31+
if(!empty($output_attrs->label)) {
32+
$this->outputs[$output_attrs->label] =newServices_Zencoder_Output($output_attrs);
33+
}else {
34+
$this->outputs[] =newServices_Zencoder_Output($output_attrs);
35+
}
36+
}
37+
}
38+
}

‎Services/Zencoder/Jobs.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99

1010
class Services_Zencoder_Jobsextends Services_Zencoder_Base {
11-
public$id,$test,$state,$outputs =array();
1211

1312
publicfunctioncreate($params =NULL) {
1413
if(is_string($params)) {
@@ -19,7 +18,11 @@ public function create($params = NULL) {
1918
thrownewServices_Zencoder_Exception(
2019
'Job parameters required to create job.');
2120
}
22-
return$request =$this->proxy->createData("jobs",$json);
21+
$request =$this->proxy->createData("jobs",$json);
22+
if ($request) {
23+
returnnewServices_Zencoder_Job($request);
24+
}
25+
thrownewServices_Zencoder_Exception('Unable to create job');
2326
}
2427

2528
publicfunctionindex() {

‎Services/Zencoder/Notifications.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99

1010
class Services_Zencoder_Notificationsextends Services_Zencoder_Base {
1111
publicfunctionparseIncoming() {
12-
$notification_data =json_decode(trim(file_get_contents('php://input')),true);
13-
returnnewServices_Zencoder_Notification($notification_data);
12+
$incoming_data =json_decode(trim(file_get_contents('php://input')),true);
13+
if (!$incoming_data) {
14+
thrownewServices_Zencoder_Exception(
15+
'Unable to parse notification data:' .file_get_contents('php://input'));
16+
}
17+
returnnewServices_Zencoder_Notification();
1418
}
1519
}

‎Services/Zencoder/Output.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/*
3+
4+
Zencoder API PHP Library
5+
Version: 2.0
6+
See the README file for info on how to use this library.
7+
8+
*/
9+
10+
class Services_Zencoder_Output {
11+
public$id,$label,$url,$state,$error_message,$error_link;
12+
13+
publicfunction__construct($params) {
14+
$this->update_attributes($params);
15+
}
16+
17+
privatefunctionupdate_attributes($attributes =array()) {
18+
foreach($attributesas$attr_name =>$attr_value) {
19+
if(!function_exists($this->$attr_name)) {
20+
$this->$attr_name =$attr_value;
21+
}
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp