function getAPIInstance()
 {
     $config = ColabsInstagram::getConfiguration();
     $instagram = new Instagram_XAuth($config);
     $instagram->setAccessToken(ColabsInstagram::getAccessToken());
     return $instagram;
 }
<?php

$user = get_option('colabs_type_instagram');
$limit = get_option('colabs_piccount_instagram');
$tag = get_option('colabs_tag_instagram');
$address = get_option('colabs_address_instagram');
$getlatlang = getLatLng($address);
if (empty($limit)) {
    $limit = 10;
}
$nextMaxId = '';
$max_id = $nextMaxId;
$piccounter = 1;
$token = ColabsInstagram::getAccessToken();
if ($token) {
    if (!empty($getlatlang)) {
        $data = ColabsInstagram::getLocationBasedFeed($getlatlang);
    } else {
        if (empty($tag)) {
            $data = ColabsInstagram::getFeedByUserId($user, $max_id, $nextMaxId);
        } else {
            $data = ColabsInstagram::getFeedByTag($tag, $max_id, $nextMaxId);
        }
    }
    if (count($data) > 0) {
        if (get_option('colabs_random_instagram') == 'true') {
            shuffle($data);
        }
        foreach ($data as $obj) {
            if (intval($limit) > 0 && $piccounter > $limit) {
                break;