Permalink
Browse files

added empty documentation file and decode json returns.

  • Loading branch information...
1 parent 9384fd7 commit 41c11d1b393185ba880242aadfc61504e3bae524 @abraham abraham committed Dec 1, 2009
Showing with 20 additions and 8 deletions.
  1. +1 −0 DOCUMENTATION
  2. +3 −1 html.inc
  3. +1 −1 index.php
  4. +15 −6 twitteroauth/twitteroauth.php
View
@@ -0,0 +1 @@
+Coming soon...
View
@@ -30,7 +30,9 @@
<?php echo '<h3>'.$status_text.'</h3>'; ?>
<?php } ?>
<p>
- <?php echo $content; ?>
+ <pre>
+ <?php print_r($content); ?>
+ </pre>
</p>
</body>
View
@@ -20,7 +20,7 @@
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
/* If method is set change API call made. Test is called by default. */
-$content = '<pre>'.$connection->get('account/verify_credentials').'</pre>';
+$content = $connection->get('account/verify_credentials');
/* Some example calls */
//$connection->get('users/show', array('screen_name' => 'abraham')));
@@ -119,21 +119,33 @@ function getAccessToken($oauth_verifier = FALSE) {
* GET wrappwer for oAuthRequest.
*/
function get($url, $parameters = NULL) {
- return $this->oAuthRequest($url, 'GET', $parameters);
+ $response = $this->oAuthRequest($url, 'GET', $parameters);
+ if ($this->format === 'json' && $this->decode_json) {
+ return json_decode($response);
+ }
+ return $response;
}
/**
* POST wreapper for oAuthRequest.
*/
function post($url, $parameters) {
- return $this->oAuthRequest($url, 'POST', $parameters);
+ $response = $this->oAuthRequest($url, 'POST', $parameters);
+ if ($this->format === 'json' && $this->decode_json) {
+ return json_decode($response);
+ }
+ return $response;
}
/**
* DELTE wrapper for oAuthReqeust.
*/
function delete($url, $parameters) {
- return $this->oAuthRequest($url, 'DELETE', $parameters);
+ $response = $this->oAuthRequest($url, 'DELETE', $parameters);
+ if ($this->format === 'json' && $this->decode_json) {
+ return json_decode($response);
+ }
+ return $response;
}
/**
@@ -185,9 +197,6 @@ function http($url, $method, $postfields = NULL) {
$this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
$this->last_api_call = $url;
curl_close ($ci);
- //if ($this->format === 'json' && $this->decode_json) {
- // return json_decode($response);
- //}
return $response;
}
}

0 comments on commit 41c11d1

Please sign in to comment.