You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

97 lines
2.5 KiB

<?php
namespace app\libraries;
use Vimeo\Vimeo;
class Vimeo_library {
private $client_secret = '';
private $access_token = '';
private $client_id = '';
private $client = null;
private $authorize_url='';
private $callback_url='';
private $public_url = '';
private $endpoint_video = '';
private $endpoint_user = '';
private $endpoint_channel = '';
private $endpoint_album = '';
private $endpoint_folder = '';
protected $ci;
function __construct () {
$vimeoCredentials = json_decode(file_get_contents(APPPATH . 'config/vimeo/vimeo-api-keys.json'), true);
$this->client_id = $vimeoCredentials['client_id'];
$this->client_secret = $vimeoCredentials['client_secret'];
$this->access_token = $vimeoCredentials['access_token'];
$this->authorize_url = $vimeoCredentials['authorize_url'];
$this->callback_url = $vimeoCredentials['callback_url'];
$this->public_url = $vimeoCredentials['public_url'];
$this->ci =& get_instance();
$this->client = new Vimeo($this->client_id, $this->client_secret, $this->access_token);
}
/**
* Get vimeo folder
*/
public function getFolder($folder_id) {
return $this->client->request('/me/folders/'.$folder_id, array(), 'GET');
}
/**
* Get vimeo album
*/
public function getAlbum($showcase_id) {
return $this->client->request('/me/albums/'.$showcase_id, array(), 'GET');
}
/**
* Get vimeo channel
*/
public function getChannel($channel_id) {
return $this->client->request('/channels/'.$channel_id, array(), 'GET');
}
/**
* Get vimeo video
*/
public function getVideo($video_id) {
if(empty($video_id) || is_null($video_id)) {
return null;
}
return $this->client->request('/videos/'.$video_id, array(), 'GET');
}
/**
* Get vimeo user
*/
public function getUser($user_id) {
return $this->client->request('/users/'.$user_id, array(), 'GET');
}
public function getAuthorizeURL() {
return $this->authorize_url;
}
public function getCallbackURL() {
return $this->callback_url;
}
public function getPublicURL() {
return $this->public_url;
}
public function getAccessToken() {
return $this->access_token;
}
public function getClientSecret() {
return $this->client_secret;
}
public function getClientId() {
return $this->client_id;
}
public function getTutorial() {
return $this->client->request('/tutorial', array(), 'GET');
}
}