remove the unqualified "OAuth" namespace from the project. We need to reference either OAuth1 or OAuth2.
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
* The first PHP Library to support OAuth for Twitter's REST API.
|
||||
*/
|
||||
|
||||
/* Load OAuth lib. You can find it at http://oauth.net */
|
||||
if(!class_exists('OAuthException'))
|
||||
/* Load OAuth1 lib. You can find it at http://oauth.net */
|
||||
if(!class_exists('OAuth1Exception'))
|
||||
require_once('library/OAuth1.php');
|
||||
|
||||
/**
|
||||
@@ -58,10 +58,10 @@ class TwitterOAuth {
|
||||
* construct TwitterOAuth object
|
||||
*/
|
||||
function __construct($consumer_key, $consumer_secret, $oauth_token = NULL, $oauth_token_secret = NULL) {
|
||||
$this->sha1_method = new OAuthSignatureMethod_HMAC_SHA1();
|
||||
$this->consumer = new OAuthConsumer($consumer_key, $consumer_secret);
|
||||
$this->sha1_method = new OAuth1SignatureMethod_HMAC_SHA1();
|
||||
$this->consumer = new OAuth1Consumer($consumer_key, $consumer_secret);
|
||||
if (!empty($oauth_token) && !empty($oauth_token_secret)) {
|
||||
$this->token = new OAuthConsumer($oauth_token, $oauth_token_secret);
|
||||
$this->token = new OAuth1Consumer($oauth_token, $oauth_token_secret);
|
||||
} else {
|
||||
$this->token = NULL;
|
||||
}
|
||||
@@ -79,8 +79,8 @@ class TwitterOAuth {
|
||||
$parameters['oauth_callback'] = $oauth_callback;
|
||||
}
|
||||
$request = $this->oAuthRequest($this->requestTokenURL(), 'GET', $parameters);
|
||||
$token = OAuthUtil::parse_parameters($request);
|
||||
$this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
|
||||
$token = OAuth1Util::parse_parameters($request);
|
||||
$this->token = new OAuth1Consumer($token['oauth_token'], $token['oauth_token_secret']);
|
||||
return $token;
|
||||
}
|
||||
|
||||
@@ -115,8 +115,8 @@ class TwitterOAuth {
|
||||
$parameters['oauth_verifier'] = $oauth_verifier;
|
||||
}
|
||||
$request = $this->oAuthRequest($this->accessTokenURL(), 'GET', $parameters);
|
||||
$token = OAuthUtil::parse_parameters($request);
|
||||
$this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
|
||||
$token = OAuth1Util::parse_parameters($request);
|
||||
$this->token = new OAuth1Consumer($token['oauth_token'], $token['oauth_token_secret']);
|
||||
return $token;
|
||||
}
|
||||
|
||||
@@ -135,8 +135,8 @@ class TwitterOAuth {
|
||||
$parameters['x_auth_password'] = $password;
|
||||
$parameters['x_auth_mode'] = 'client_auth';
|
||||
$request = $this->oAuthRequest($this->accessTokenURL(), 'POST', $parameters);
|
||||
$token = OAuthUtil::parse_parameters($request);
|
||||
$this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
|
||||
$token = OAuth1Util::parse_parameters($request);
|
||||
$this->token = new OAuth1Consumer($token['oauth_token'], $token['oauth_token_secret']);
|
||||
return $token;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ class TwitterOAuth {
|
||||
if (strrpos($url, 'https://') !== 0 && strrpos($url, 'http://') !== 0) {
|
||||
$url = "{$this->host}{$url}.{$this->format}";
|
||||
}
|
||||
$request = OAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, $url, $parameters);
|
||||
$request = OAuth1Request::from_consumer_and_token($this->consumer, $this->token, $method, $url, $parameters);
|
||||
$request->sign_request($this->sha1_method, $this->consumer, $this->token);
|
||||
switch ($method) {
|
||||
case 'GET':
|
||||
|
Reference in New Issue
Block a user