本文整理汇总了PHP中Zend_Uri_Http::getUri方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Uri_Http::getUri方法的具体用法?PHP Zend_Uri_Http::getUri怎么用?PHP Zend_Uri_Http::getUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Uri_Http
的用法示例。
在下文中一共展示了Zend_Uri_Http::getUri方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkOAuthRequest
/**
* Validate OAuth request
* @param Zend_Uri_Http $url Request URL, will use current if null
* @param array $params Additional parameters
* @return bool
* @throws Zend_Oauth_Exception
*/
public function checkOAuthRequest(Zend_Uri_Http $url = null, $params = array())
{
if (empty($url)) {
$this->url = $this->getRequestUrl();
} else {
$this->url = clone $url;
}
// We'll ignore query for the pruposes of URL matching
$this->url->setQuery('');
if (isset($_SERVER['REQUEST_METHOD'])) {
$method = $_SERVER['REQUEST_METHOD'];
} elseif (isset($_SERVER['HTTP_METHOD'])) {
$method = $_SERVER['HTTP_METHOD'];
} else {
$method = 'GET';
}
$params = $this->assembleParams($method, $params);
$this->checkSignatureMethod($params['oauth_signature_method']);
$this->checkRequiredParams($params);
$this->timestamp = $params['oauth_timestamp'];
$this->nonce = $params['oauth_nonce'];
$this->consumer_key = $params['oauth_consumer_key'];
if (!is_callable($this->nonceHandler)) {
throw new Zend_Oauth_Exception("Nonce handler not callable", self::BAD_NONCE);
}
$res = call_user_func($this->nonceHandler, $this);
if ($res != self::OK) {
throw new Zend_Oauth_Exception("Invalid request", $res);
}
if (!is_callable($this->consumerHandler)) {
throw new Zend_Oauth_Exception("Consumer handler not callable", self::CONSUMER_KEY_UNKNOWN);
}
$res = call_user_func($this->consumerHandler, $this);
// this will set $this->consumer_secret if OK
if ($res != self::OK) {
throw new Zend_Oauth_Exception("Consumer key invalid", $res);
}
if ($this->needsToken()) {
$this->token = $params['oauth_token'];
$this->verifier = $params['oauth_verifier'];
if (!is_callable($this->tokenHandler)) {
throw new Zend_Oauth_Exception("Token handler not callable", self::TOKEN_REJECTED);
}
$res = call_user_func($this->tokenHandler, $this);
// this will set $this->token_secret if OK
if ($res != self::OK) {
throw new Zend_Oauth_Exception("Token invalid", $res);
}
}
$util = new Zend_Oauth_Http_Utility();
$req_sign = $params['oauth_signature'];
unset($params['oauth_signature']);
$our_sign = $util->sign($params, $params['oauth_signature_method'], $this->consumer_secret, $this->token_secret, $method, $this->url->getUri());
if ($req_sign != $our_sign) {
// TODO: think how to extract signature base string
$this->problem = $our_sign;
throw new Zend_Oauth_Exception("Invalid signature", self::INVALID_SIGNATURE);
}
return true;
}
示例2: _prepareRest
/**
* Call a remote REST web service URI and return the Zend_Http_Response object
*
* @param string $path The path to append to the URI
* @throws Zend_Rest_Client_Exception
* @return void
*/
private function _prepareRest($path)
{
// Get the URI object and configure it
if (!$this->_uri instanceof Zend_Uri_Http) {
require_once 'Zend/Rest/Client/Exception.php';
throw new Zend_Rest_Client_Exception('URI object must be set before performing call');
}
$uri = $this->_uri->getUri();
if ($path[0] != '/' && $uri[strlen($uri) - 1] != '/') {
$path = '/' . $path;
}
$this->_uri->setPath($path);
/**
* Get the HTTP client and configure it for the endpoint URI. Do this each time
* because the Zend_Http_Client instance is shared among all Zend_Service_Abstract subclasses.
*/
if ($this->_noReset) {
// if $_noReset we do not want to reset on this request,
// but we do on any subsequent request
$this->_noReset = false;
} else {
self::getHttpClient()->resetParameters();
}
self::getHttpClient()->setUri($this->_uri);
}
示例3: setEndpoint
/**
* Sets an alternative endpoint to the default
*
* @param Zend_Uri_Http $endpoint
* @return Zend_Service_Amazon_Ses
* @throws InvalidArgumentException If the provided endpoint url is not valid
*/
public function setEndpoint(Zend_Uri_Http $endpoint)
{
$this->_endpoint = $endpoint;
if (!$endpoint->valid()) {
throw new InvalidArgumentException(sprintf('The provided url "%s" is not valid.', $endpoint->getUri()));
}
return $this;
}
示例4: _prepareRest
/**
* Call a remote REST web service URI and return the Zend_Http_Response object
*
* @param string $path The path to append to the URI
* @throws Zend_Service_Exception
* @return void
*/
private final function _prepareRest($path, $query = null)
{
// Get the URI object and configure it
if (!$this->_uri instanceof Zend_Uri_Http) {
throw new Zend_Service_Exception('URI object must be set before performing call');
}
$uri = $this->_uri->getUri();
if ($path[0] != '/' && $uri[strlen($uri) - 1] != '/') {
$path = '/' . $path;
}
$this->_uri->setPath($path);
if (!is_null($query)) {
$this->_uri->setQuery($query);
}
/**
* Get the HTTP client and configure it for the endpoint URI. Do this each time
* because the Zend_Http_Client instance is shared among all Zend_Service_Abstract subclasses.
*/
self::getHttpClient()->setUri($this->_uri);
}
示例5: _prepareRest
/**
* Call a remote REST web service URI and return the Zend_Http_Response object
*
* @param string $path The path to append to the URI
* @throws Zend_Rest_Client_Exception
* @return void
*/
private final function _prepareRest($path)
{
// Get the URI object and configure it
if (!$this->_uri instanceof Zend_Uri_Http) {
require_once 'Zend/Rest/Client/Exception.php';
throw new Zend_Rest_Client_Exception('URI object must be set before performing call');
}
list($path, $query) = explode("?", $path);
$uri = $this->_uri->getUri();
if ($path[0] != '/') {
$path = $this->_basepath . $path;
}
$this->_uri->setPath($path);
$this->_uri->setQuery($query);
/**
* Get the HTTP client and configure it for the endpoint URI. Do this each time
* because the Zend_Http_Client instance is shared among all Zend_Service_Abstract subclasses.
*/
self::getHttpClient()->resetParameters()->setUri($this->_uri);
}
示例6: _prepareRequest
/**
* Call a remote REST web service URI and return the Zend_Http_Response object
*
* @param string $path The path to append to the URI
* @throws Tid_Zend_REST_Json_Exception
* @return void
*/
protected function _prepareRequest($path)
{
// Get the URI object and configure it
if (!$this->_uri instanceof Zend_Uri_Http) {
require_once 'Tid/Zend/REST/Json/Exception.php';
throw new Tid_Zend_REST_Json_Exception('URI object must be set before performing call');
}
$uri = rtrim($this->_uri->getUri(), '/') . '/' . ltrim($path, '/');
/**
* Get the HTTP client and configure it for the endpoint URI. Do this
* each time because the Zend_Http_Client instance is shared among all
* Zend_Service_Abstract subclasses.
*/
self::getHttpClient()->resetParameters()->setUri($uri);
}
示例7: matches
/**
* Checks if the given pattern matches the last requested uri.
*
* @param string $pattern
* @return boolean
*/
protected function matches($pattern)
{
if (empty($pattern)) {
return false;
}
$uri = $this->requestedUri->getUri();
return preg_match($this->toRegExp($pattern), $uri) > 0;
}