PageRenderTime 26ms CodeModel.GetById 0ms RepoModel.GetById 1ms app.codeStats 0ms

/src/application/libraries/Zend/Oauth/Http/UserAuthorization.php

https://bitbucket.org/masnug/grc276-blog-laravel
PHP | 78 lines | 31 code | 9 blank | 38 comment | 3 complexity | 1b2ae17ba406a13cb0d9f23d7ee86a6d MD5 | raw file
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Oauth
  17. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. * @version $Id: UserAuthorization.php 23775 2011-03-01 17:25:24Z ralph $
  20. */
  21. /** Zend_Oauth_Http */
  22. require_once 'Zend/Oauth/Http.php';
  23. /** Zend_Uri_Http */
  24. require_once 'Zend/Uri/Http.php';
  25. /**
  26. * @category Zend
  27. * @package Zend_Oauth
  28. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  29. * @license http://framework.zend.com/license/new-bsd New BSD License
  30. */
  31. class Zend_Oauth_Http_UserAuthorization extends Zend_Oauth_Http
  32. {
  33. /**
  34. * Generate a redirect URL from the allowable parameters and configured
  35. * values.
  36. *
  37. * @return string
  38. */
  39. public function getUrl()
  40. {
  41. $params = $this->assembleParams();
  42. $uri = Zend_Uri_Http::fromString($this->_consumer->getUserAuthorizationUrl());
  43. $uri->setQuery(
  44. $this->_httpUtility->toEncodedQueryString($params)
  45. );
  46. return $uri->getUri();
  47. }
  48. /**
  49. * Assemble all parameters for inclusion in a redirect URL.
  50. *
  51. * @return array
  52. */
  53. public function assembleParams()
  54. {
  55. $params = array(
  56. 'oauth_token' => $this->_consumer->getLastRequestToken()->getToken(),
  57. );
  58. if (!Zend_Oauth_Client::$supportsRevisionA) {
  59. $callback = $this->_consumer->getCallbackUrl();
  60. if (!empty($callback)) {
  61. $params['oauth_callback'] = $callback;
  62. }
  63. }
  64. if (!empty($this->_parameters)) {
  65. $params = array_merge($params, $this->_parameters);
  66. }
  67. return $params;
  68. }
  69. }