Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion instagram-api/instagram-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Instagram Wordpress API
Plugin URI: http://github.com/msigley/
Description: Provides functions for accessing the Instagram API. Leverages the Wordpress HTTP API.
Version: 2.0.1
Version: 2.0.2
Author: Matthew Sigley
License: GPL2
*/
Expand Down
10 changes: 7 additions & 3 deletions instagram-api/rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,13 @@ public function request( $endpoint, $method, $body = array(), $cache = true, &$r
if( 200 != $response_code && 400 != $response_code )
return false;

$response_body = wp_remote_retrieve_body( $response );
$this->cache_request( $response_body, $endpoint, $method, $body );
return json_decode( $response_body );
$response_body = wp_remote_retrieve_body($response);
$response_body_json = json_decode($response_body);
if (isset($response_body_json->error) || !isset($response_body_json->data)) {
return false;
}
$this->cache_request($response_body, $endpoint, $method, $body);
return $response_body_json;
}

private function get_cached_request( $endpoint, $method, $body=array() ) {
Expand Down