Permalink
Browse files

Merge remote branch 'ngnpope/master'

  • Loading branch information...
2 parents b000b29 + 9b72019 commit e9f6cd4b4cb6e9a620a7ead26245370afcee7cce @jmathai jmathai committed Nov 10, 2010
Showing with 36 additions and 11 deletions.
  1. +1 −0 .gitattributes
  2. +14 −0 .gitignore
  3. +16 −6 EpiOAuth.php
  4. +5 −5 EpiTwitter.php
View
@@ -0,0 +1 @@
++* crlf=input
View
@@ -0,0 +1,14 @@
+# Backup and Swap Files
+.*.sw?
+*.bak
+*~
+
+# Windows Metadata Files
+Desktop.ini
+Thumbs.db
+
+# Mac OS X Metadata Files
+.DS_Store
+__MACOSX
+
+# Project Specific
View
@@ -11,6 +11,7 @@ class EpiOAuth
protected $consumerSecret;
protected $token;
protected $tokenSecret;
+ protected $callback;
protected $signatureMethod;
protected $debug = false;
protected $useSSL = false;
@@ -30,6 +31,10 @@ public function addHeader($header)
public function getAccessToken($params = null)
{
+ if (isset($_GET['oauth_verifier']) && !isset($params['oauth_verifier']))
+ {
+ $params['oauth_verifier'] = $_GET['oauth_verifier'];
+ }
$resp = $this->httpRequest('POST', $this->getUrl($this->accessTokenUrl), $params);
return new EpiOAuthResponse($resp);
}
@@ -57,6 +62,10 @@ public function getAuthorizationUrl($token = null)
public function getRequestToken($params = null)
{
+ if (isset($this->callback) && !isset($params['oauth_callback']))
+ {
+ $params['oauth_callback'] = $this->callback;
+ }
$resp = $this->httpRequest('POST', $this->getUrl($this->requestTokenUrl), $params);
return new EpiOAuthResponse($resp);
}
@@ -116,6 +125,11 @@ public function setToken($token = null, $secret = null)
$this->tokenSecret = $secret;
}
+ public function setCallback($callback = null)
+ {
+ $this->callback = $callback;
+ }
+
public function useSSL($use = false)
{
$this->useSSL = (bool)$use;
@@ -156,12 +170,8 @@ protected function curlInit($url)
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
if(isset($_SERVER ['SERVER_ADDR']) && !empty($_SERVER['SERVER_ADDR']) && $_SERVER['SERVER_ADDR'] != '127.0.0.1')
curl_setopt($ch, CURLOPT_INTERFACE, $_SERVER ['SERVER_ADDR']);
-
- if($this->useSSL === true)
- {
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- }
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
return $ch;
}
View
@@ -14,11 +14,11 @@ class EpiTwitter extends EpiOAuth
const EPITWITTER_SIGNATURE_METHOD = 'HMAC-SHA1';
const EPITWITTER_AUTH_OAUTH = 'oauth';
const EPITWITTER_AUTH_BASIC = 'basic';
- protected $requestTokenUrl= 'http://twitter.com/oauth/request_token';
- protected $accessTokenUrl = 'http://twitter.com/oauth/access_token';
- protected $authorizeUrl = 'http://twitter.com/oauth/authorize';
- protected $authenticateUrl= 'http://twitter.com/oauth/authenticate';
- protected $apiUrl = 'http://twitter.com';
+ protected $requestTokenUrl= 'https://api.twitter.com/oauth/request_token';
+ protected $accessTokenUrl = 'https://api.twitter.com/oauth/access_token';
+ protected $authorizeUrl = 'https://api.twitter.com/oauth/authorize';
+ protected $authenticateUrl= 'https://api.twitter.com/oauth/authenticate';
+ protected $apiUrl = 'http://api.twitter.com';
protected $apiVersionedUrl= 'http://api.twitter.com';
protected $searchUrl = 'http://search.twitter.com';
protected $userAgent = 'EpiTwitter (http://github.com/jmathai/twitter-async/tree/)';

0 comments on commit e9f6cd4

Please sign in to comment.