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):
- print_r ($data->data);
- foreach($data->data as $item):
- $lat = (!empty($item->location->latitude))?$item->location->latitude:null; // Caches latitude as $lat
- $lon = (!empty($item->location->longitude))?$item->location->longitude:null; // Caches longitude as $lon
- $location = (!empty($item->location->name))?$item->location->name:null;
- $id = (!empty($item->location->id))?$item->location->id:null;
- 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,
- "id" => htmlentities($id),
- "location" => htmlentities($location),
- "lat" => htmlentities($lat),
- "lon" => htmlentities($lon),
- "url" => $item->link,
- "date" => htmlentities(date("F j, Y, g:i a", $item->caption->created_time)),
- "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