예제 #1
0
 /**
  * Generate a redirect URL from the allowable parameters and configured
  * values.
  *
  * @return string
  */
 public function getUrl()
 {
     $params = $this->assembleParams();
     $uri = new \Zend\Uri\Url($this->_consumer->getUserAuthorizationUrl());
     $uri->setQuery($this->_httpUtility->toEncodedQueryString($params));
     return $uri->generate();
 }
예제 #2
0
 /**
  * Sets server url (scheme and host-related stuff without request URI)
  *
  * E.g. http://www.example.com
  *
  * @param  string $serverUrl                    server URL to set (only
  *                                              scheme and host)
  * @throws \Zend\Uri\Exception                   if invalid server URL
  * @return \Zend\View\Helper\Navigation\Sitemap  fluent interface, returns
  *                                              self
  */
 public function setServerUrl($serverUrl)
 {
     $uri = new \Zend\Uri\Url($serverUrl);
     $uri->setFragment('');
     $uri->setPath('');
     $uri->setQuery('');
     if ($uri->isValid()) {
         $this->_serverUrl = $uri->generate();
     } else {
         $e = new \Zend\Uri\Exception(sprintf('Invalid server URL: "%s"', $serverUrl));
         $e->setView($this->view);
         throw $e;
     }
     return $this;
 }
예제 #3
0
 /**
  * Normalize the base signature URL
  * 
  * @param  string $url 
  * @return string
  */
 public function normaliseBaseSignatureUrl($url)
 {
     $uri = new \Zend\Uri\Url($url);
     if ($uri->getScheme() == 'http' && $uri->getPort() == '80') {
         $uri->setPort('');
     } elseif ($uri->getScheme() == 'https' && $uri->getPort() == '443') {
         $uri->setPort('');
     } elseif (!in_array($uri->getScheme(), array('http', 'https'))) {
         throw new OAuthException('Invalid URL provided; must be an HTTP or HTTPS scheme');
     }
     $uri->setQuery('');
     $uri->setFragment('');
     $uri->setHost(strtolower($uri->getHost()));
     return $uri->generate();
 }