Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(!is_wp_error($response) && $response['response']['code'] < 400 && $response['response']['code'] >= 200):
- $data = json_decode($response['body']);
- if($data->meta->code == 200):
- foreach($data->data as $item):
- // Get Lat and Long
- $lat = (isset($item->data->location->latitude))?$item->data->location->latitude:null; // Caches latitude as $lat
- $lon = (isset($item->data->location->longtitude))?$item->data->location->longtitude:null; // Caches longitude as $lon
- if(isset($instance['hashtag'], $item->caption->text)):
- $image_title = $item->user->username.': "'.filter_var($item->caption->text, FILTER_SANITIZE_STRING).'"';
- elseif(isset($instance['hashtag']) && !isset($item->caption->text)):
- $image_title = "instagram by ".$item->user->username;
- else:
- $image_title = filter_var($item->caption->text, FILTER_SANITIZE_STRING);
- endif;
- $images[] = array(
- "title" => $image_title,
- "lat" => htmlspecialchars($lat),
- "lon" => htmlspecialchars($lon),
- "image_small" => $item->images->thumbnail->url,
- "image_middle" => $item->images->low_resolution->url,
- "image_large" => $item->images->standard_resolution->url
- );
- endforeach;
- endif;
- endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement