/** * set OAuth Access Token * * @param AppModel $model * @param mixed $token * @param string $secret * @return true|false */ public function twitterSetToken($model, $token = null, $secret = null) { if (empty($token)) { // -- get from Model->data if (empty($model->data[$model->alias])) { return false; } $data = $model->data[$model->alias]; if (empty($data[$this->settings[$model->alias]['fields']['oauth_token']]) || empty($data[$this->settings[$model->alias]['fields']['oauth_token_secret']])) { return false; } $secret = $data[$this->settings[$model->alias]['fields']['oauth_token_secret']]; $token = $data[$this->settings[$model->alias]['fields']['oauth_token']]; } else { if (is_array($token)) { if (!empty($token[$model->alias])) { $token = $token[$model->alias]; } if (!empty($token[$this->settings[$model->alias]['fields']['oauth_token']]) && !empty($token[$this->settings[$model->alias]['fields']['oauth_token_secret']])) { // -- get from array $secret = $token[$this->settings[$model->alias]['fields']['oauth_token_secret']]; $token = $token[$this->settings[$model->alias]['fields']['oauth_token']]; } } } return $this->DataSource->setToken($token, $secret); }
/** * set OAuth Access Token * * @param mixed $token * @param string $secret * @return true|false */ public function setToken($token, $secret = null) { if (is_array($token) && !empty($token[$this->settings['fields']['oauth_token']]) && !empty($token[$this->settings['fields']['oauth_token_secret']])) { $secret = $token[$this->settings['fields']['oauth_token_secret']]; $token = $token[$this->settings['fields']['oauth_token']]; } return $this->DataSource->setToken($token, $secret); }
function testGetAnywhereIdentity() { $this->assertEqual($this->TestSource->getAnywhereIdentity(15982041), '15982041:7f25bf8e58f67fb01857dee740169456ee65a885'); }