Ejemplo n.º 1
0
 /**
  * Configure the request parameters as specified in the configuration file.
  * When processing additions, if a parameter value exists, it will not be
  * overwritten.
  *
  * @param	array	an associative array of request parameters
  * @return	array
  */
 protected function _configure_parameters($parms)
 {
     $parms = parent::_configure_parameters($parms);
     $name = 'alt';
     $temp = Arr::get($parms, $name);
     if (empty($temp)) {
         $parms[$name] = $this->_format;
     }
     return $parms;
 }
Ejemplo n.º 2
0
 /**
  * Configure the request parameters as specified in the configuration file.
  * When processing additions, if a parameter value exists, it will not be
  * overwritten.
  *
  * @param	array	an associative array of request parameters
  * @return	array
  */
 protected function _configure_parameters($parms)
 {
     $parms = parent::_configure_parameters($parms);
     if (!$this->_send_accept_header) {
         $name = 'type';
         $temp = Arr::get($parms, $name);
         if (empty($temp)) {
             $parms[$name] = $this->_format;
         }
     }
     return $parms;
 }
Ejemplo n.º 3
0
 /**
  * Configure the request parameters as specified in the configuration file.
  * When processing additions, if a parameter value exists, it will not be
  * overwritten.
  *
  * @param	array	an associative array of request parameters
  * @return	array
  */
 protected function _configure_parameters($parms)
 {
     $parms = parent::_configure_parameters($parms);
     // Set the access key
     if ($this->is_valid_token(NULL, TRUE)) {
         $access_token = $this->_token->key;
         $name = 'access_token';
         $temp = Arr::get($parms, $name);
         if (empty($temp)) {
             $parms[$name] = $access_token;
         }
     }
     return $parms;
 }
Ejemplo n.º 4
0
 /**
  * Ensure the request token has been verified and an access token received.
  *
  * @return	void
  */
 protected function _check_token()
 {
     parent::_check_token();
     $token = $this->_token;
     if (isset($token->attributes) and is_array($token->attributes)) {
         $attributes = $token->attributes;
         $oauth_session_handle = Arr::get($attributes, 'oauth_session_handle');
         $oauth_expires_in = Arr::get($attributes, 'oauth_expires_in');
         // Get the date the token was last updated
         $date_updated = 0;
         $model = $this->_model;
         if ($model instanceof Jelly_Model) {
             $date_updated = $model->date_updated;
         }
         if (!empty($oauth_session_handle) and $date_updated + $oauth_expires_in < time()) {
             // Refresh the access token
             $token = $this->_refresh_access_token($oauth_session_handle, array('token_key' => $token->key, 'token_secret' => $token->secret));
             if (isset($token) and $this->is_valid_token($token)) {
                 $success = $this->_update_token($token);
             }
         }
     }
 }