File indexing completed on 2025-01-26 05:29:42
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Oauth 0017 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0018 * @license http://framework.zend.com/license/new-bsd New BSD License 0019 * @version $Id$ 0020 */ 0021 0022 /** Zend_Oauth_Http */ 0023 // require_once 'Zend/Oauth/Http.php'; 0024 0025 /** Zend_Uri_Http */ 0026 // require_once 'Zend/Uri/Http.php'; 0027 0028 /** 0029 * @category Zend 0030 * @package Zend_Oauth 0031 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0032 * @license http://framework.zend.com/license/new-bsd New BSD License 0033 */ 0034 class Zend_Oauth_Http_UserAuthorization extends Zend_Oauth_Http 0035 { 0036 /** 0037 * Generate a redirect URL from the allowable parameters and configured 0038 * values. 0039 * 0040 * @return string 0041 */ 0042 public function getUrl() 0043 { 0044 $params = $this->assembleParams(); 0045 $uri = Zend_Uri_Http::fromString($this->_consumer->getUserAuthorizationUrl()); 0046 0047 $uri->setQuery( 0048 $this->_httpUtility->toEncodedQueryString($params) 0049 ); 0050 0051 return $uri->getUri(); 0052 } 0053 0054 /** 0055 * Assemble all parameters for inclusion in a redirect URL. 0056 * 0057 * @return array 0058 */ 0059 public function assembleParams() 0060 { 0061 $params = array( 0062 'oauth_token' => $this->_consumer->getLastRequestToken()->getToken(), 0063 ); 0064 0065 if (!Zend_Oauth_Client::$supportsRevisionA) { 0066 $callback = $this->_consumer->getCallbackUrl(); 0067 if (!empty($callback)) { 0068 $params['oauth_callback'] = $callback; 0069 } 0070 } 0071 0072 if (!empty($this->_parameters)) { 0073 $params = array_merge($params, $this->_parameters); 0074 } 0075 0076 return $params; 0077 } 0078 }