本文整理匯總了PHP中singleton::request方法的典型用法代碼示例。如果您正苦於以下問題:PHP singleton::request方法的具體用法?PHP singleton::request怎麽用?PHP singleton::request使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類singleton
的用法示例。
在下文中一共展示了singleton::request方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _vimeography_subscribe_to_trigger
/**
* When the user enters the source location when creating a new gallery.
*
* Won't work publically yet, because the user needs to be authenticated to subscribe to push notifications.
* Also, does not currently work with albums.
*
* @return [type] [description]
*/
private function _vimeography_subscribe_to_trigger($resource, $gallery_id)
{
$callback = network_site_url() . '/vimeography/' . $gallery_id . '/refresh/';
$response = $this->_vimeo->request('/triggers', array('actions' => 'added, removed', 'callback' => $callback, 'resource_uri' => $resource . '/videos'), 'POST');
echo '<pre>';
var_dump($response);
echo '</pre>';
die;
switch ($response['status']) {
case 201:
//successful
return TRUE;
break;
case 403:
if ($this->_token === FALSE) {
// Trigger unsuccessful, rely on 304 headers.
break;
// This line will only work when the Vimeo API supports triggers without being authenticated
// Though, the user could technically be subscribing to a collection that isn't actually supported in PRO, either.
// So be specific in which sources are currently supported.
//throw new Vimeography_Exception('Vimeography PRO allows you to show videos from all of your users, channels, albums, & groups.');
} else {
throw new Vimeography_Exception(__("Looks like you don't have the permission to subscribe to this collection.", 'vimeography'));
}
break;
case 405:
case 500:
// Unsupported container uri
throw new Vimeography_Exception(__('The resource that was entered is currently unsupported.', 'vimeography'));
break;
default:
throw new Vimeography_Exception(serialize($response));
break;
}
}