예제 #1
0
 /**
  * Constructor; create a new object with an optional array|Zend_Config
  * instance containing initialising options.
  *
  * @param  array|Traversable $options
  */
 public function __construct($options = null)
 {
     $this->_config = new Config\StandardConfig();
     if ($options !== null) {
         if ($options instanceof Traversable) {
             $options = ArrayUtils::iteratorToArray($options);
         }
         $this->_config->setOptions($options);
     }
 }
예제 #2
0
 /**
  * Assemble all parameters for a generic OAuth request - i.e. no special
  * params other than the defaults expected for any OAuth query.
  *
  * @param  string $url
  * @param  ConfigInterface $config
  * @param  null|array $serviceProviderParams
  * @return array
  */
 public function assembleParams($url, ConfigInterface $config, array $serviceProviderParams = null)
 {
     $params = array();
     if ($config->getToken()->getToken() != null) {
         $params['access_token'] = $config->getToken()->getToken();
     }
     if ($serviceProviderParams !== null) {
         $params = array_merge($params, $serviceProviderParams);
     }
     return $params;
 }
예제 #3
0
 /**
  * Assemble all parameters for a generic OAuth request - i.e. no special
  * params other than the defaults expected for any OAuth query.
  *
  * @param  string $url
  * @param  ConfigInterface $config
  * @param  null|array $serviceProviderParams
  * @return array
  */
 public function assembleParams($url, ConfigInterface $config, array $serviceProviderParams = null)
 {
     $params = array('oauth_consumer_key' => $config->getConsumerKey(), 'oauth_nonce' => $this->generateNonce(), 'oauth_signature_method' => $config->getSignatureMethod(), 'oauth_timestamp' => $this->generateTimestamp(), 'oauth_version' => $config->getVersion());
     if ($config->getToken()->getToken() != null) {
         $params['oauth_token'] = $config->getToken()->getToken();
     }
     if ($serviceProviderParams !== null) {
         $params = array_merge($params, $serviceProviderParams);
     }
     $params['oauth_signature'] = $this->sign($params, $config->getSignatureMethod(), $config->getConsumerSecret(), $config->getToken()->getTokenSecret(), $config->getRequestMethod(), $url);
     return $params;
 }
예제 #4
0
 /**
  *
  * @param ZendOAuth\Token\Access $accessToken
  * @return \Itscaro\Service\Flickr\Client
  */
 public function setAccessToken(ZendOAuth\Token\Access $accessToken)
 {
     $this->_optionsOAuth->setToken($accessToken);
     return $this;
 }