本文整理汇总了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;
}
}