public function getTimeline($userID = false, $limit = 20)
 {
     $result = array('result' => array());
     $accumulator = $this->debugAccumulatorGroup . '_instagram_timeline';
     eZDebug::accumulatorStart($accumulator, $this->debugAccumulatorGroup, 'timeline');
     $cacheFileHandler = $this->getCacheFileHandler('timeline', array($userID, $limit));
     try {
         if ($this->isCacheExpired($cacheFileHandler)) {
             $API = new Instagram($this->API['key']);
             if ($this->API['token'] !== null) {
                 $API->setAccessToken($this->API['token']);
             }
             $items = array();
             $response = $API->getUserMedia($userID, $limit);
             $items = is_object($response) && isset($response->data) ? $response->data : array();
             foreach ($items as $i => $item) {
                 $items[$i] = self::objectToArray($item);
             }
             $cacheFileHandler->fileStoreContents($cacheFileHandler->filePath, serialize($items));
         } else {
             $items = unserialize($cacheFileHandler->fetchContents());
         }
         eZDebug::accumulatorStop($accumulator);
         $result['result'] = $items;
         return $result;
     } catch (Exception $e) {
         eZDebug::accumulatorStop($accumulator);
         eZDebug::writeError($e->getMessage(), self::$debugMessagesGroup);
         return $result;
     }
 }
 public function InstaTagMedia($tag = false, $num = false, $shuffle = true)
 {
     $instagram = new Instagram(array('apiKey' => $this->InstagramApiKey, 'apiSecret' => $this->InstagramApiSecret, 'apiCallback' => $this->InstagramApiCallback));
     $media = false;
     $output = false;
     $out = array();
     if (!$tag) {
         $tag = $this->InstagramSearchTerm;
     }
     if (!$num) {
         $num = $this->InstagramItemsCount;
     }
     try {
         $media = $instagram->getTagMedia($tag, 50);
     } catch (Exception $e) {
         SS_Log::log(new Exception(print_r($e, true)), SS_Log::ERR);
     }
     if (is_object($media) && isset($media->data)) {
         foreach ($media->data as $data) {
             if (is_object($data)) {
                 $item = array('caption' => $data->caption ? $data->caption->text : "", 'thumb' => $data->images->thumbnail->url, 'image' => $data->images->standard_resolution->url, 'username' => $data->user->username);
                 array_push($out, $item);
             }
         }
         if ($shuffle) {
             shuffle($out);
         }
         $output = ArrayList::create($out);
         $output = $output->limit($num);
     }
     return $output;
 }
function nextend_api_auth_flow()
{
    $api_key = NextendRequest::getVar('api_key');
    $api_secret = NextendRequest::getVar('api_secret');
    $redirect_uri = NextendRequest::getVar('redirect_uri');
    if (session_id() == "") {
        @session_start();
    }
    if (!$api_key || !$api_secret || !$redirect_uri) {
        $api_key = isset($_SESSION['api_key']) ? $_SESSION['api_key'] : null;
        $api_secret = isset($_SESSION['api_secret']) ? $_SESSION['api_secret'] : null;
        $redirect_uri = isset($_SESSION['redirect_uri']) ? $_SESSION['redirect_uri'] : null;
    } else {
        $_SESSION['api_key'] = $api_key;
        $_SESSION['api_secret'] = $api_secret;
        $_SESSION['redirect_uri'] = $redirect_uri;
    }
    if ($api_key && $api_secret) {
        require_once dirname(__FILE__) . "/api/Instagram.php";
        $config = array('client_id' => $api_key, 'client_secret' => $api_secret, 'redirect_uri' => $redirect_uri, 'grant_type' => 'authorization_code');
        $instagram = new Instagram($config);
        $accessCode = $instagram->getAccessCode();
        if ($accessCode === null) {
            $instagram->openAuthorizationUrl();
        } else {
            $accessToken = $instagram->getAccessToken();
            unset($_SESSION['api_key']);
            unset($_SESSION['api_secret']);
            unset($_SESSION['redirect_uri']);
            echo '<script type="text/javascript">';
            echo 'window.opener.setToken("' . $accessToken . '");';
            echo '</script>';
        }
    }
}
function instagran_feeds_fn($user)
{
    //SECRET: f7a23d3958c6421cb59fe1326f7527d8
    //CLIENTE-ID: f09df43a57a547deaa1d1873dfa3c7d8
    $CLIENT_ID = 'f09df43a57a547deaa1d1873dfa3c7d8';
    $CLIENT_SECRET = 'f7a23d3958c6421cb59fe1326f7527d8';
    require_once 'instagram.class.php';
    // initialize client
    try {
        $instagram = new Instagram($CLIENT_ID);
        // get and display popular images
        $user = $instagram->searchUser($user);
        // search for user's photos
        $media = $instagram->getUserMedia($user->data[0]->id);
        if (count($media->data) > 0) {
            foreach ($media->data as $item) {
                echo '<li>
                                <a target="_target" href="' . $item->link . '"><img src="' . $item->images->thumbnail->url . '" /></a>';
                //echo 'By: <em>' . $item->user->username . '</em> <br/>';
                //echo 'Date: ' . date ('d M Y h:i:s', $item->created_time) . '<br/>';
                //echo $item->comments->count . ' comment(s). ' .
                //$item->likes->count . ' likes. </li>';
            }
        }
    } catch (Exception $e) {
        echo 'ERROR: ' . $e->getMessage() . print_r($client);
        exit;
    }
}
function smamo_instagram()
{
    // Klargør svar
    $response = array();
    $num = isset($_POST['num']) ? 4 * wp_strip_all_tags($_POST['num']) : 4;
    // vi skal bruge et hashtag, ellers die();
    if (!isset($_POST['hash'])) {
        $response['code'] = '400';
        $response['error'] = 'No hashtag received';
        wp_die(json_encode($response));
    }
    // Indstil $tag
    $tag = wp_strip_all_tags($_POST['hash']);
    // Inkluder instagram class
    require get_template_directory() . '/functions/instagram/instagram.class.php';
    // Opret ny instance
    $instagram = new Instagram(array('apiKey' => 'dd36cc7a7be445c8a00d9f383e49f8c8', 'apiSecret' => 'e750735ffba74f8a8ed753a33c7351da', 'apiCallback' => 'http://faaborg-gym.dk'));
    $response['images'] = array();
    $inst_obj = $instagram->getTagMedia($tag, $num);
    $next_page = $instagram->pagination($inst_obj);
    $response['next'] = $next_page;
    foreach ($inst_obj->data as $key => $val) {
        $response['images'][] = $val;
    }
    wp_die(json_encode($response));
}
 function onNextendInstagram(&$instagram)
 {
     $config = new NextendData();
     $config->loadJson(NextendSmartSliderStorage::get(self::$_group));
     require_once dirname(__FILE__) . "/api/Instagram.php";
     $c = array('client_id' => $config->get('apikey', ''), 'client_secret' => $config->get('apisecret', ''), 'redirect_uri' => '', 'grant_type' => 'authorization_code');
     $instagram = new Instagram($c);
     $instagram->setAccessToken($config->get('token', ''));
 }
Exemple #7
0
function getInstagramData()
{
    // Initialize class for public requests
    // Setup class
    $instagram = new Instagram(array('apiKey' => '73b2123729934af5acbe7d275e382eef', 'apiSecret' => '7d065e9b5bcd47c399139ecb79d2bc92', 'apiCallback' => 'http://misterbrowns.com/'));
    $instagram->setAccessToken('509731687.73b2123.3f895a50426f4fed96adbfb6c1c123cc');
    $data = $instagram->getUserMedia('52746983', 7);
    return $data;
}
Exemple #8
0
 public static function getAllFeeds()
 {
     $fb = new FacebookUtils();
     $fbFeed = $fb->getFeed();
     $ig = new Instagram();
     $igFeed = $ig->user(2256663036)->count(10)->getPosts();
     $feed = array_merge($fbFeed, $igFeed);
     shuffle($feed);
     return $feed;
 }
 /**
  * index display media location data
  *
  * @param  int $media_id
  * @param  Application $app
  * @return array $response
  */
 public function indexAction($media_id, Application $app)
 {
     $v = $this->instagram->validateMedia($media_id);
     if ($v['status'] === 200) {
         $response = self::locationGenerator($media_id, $v['location']);
     } else {
         $response = $v['error'];
     }
     return $app->json($response, $v['status']);
 }
 /**
  *
  * Execute the Request
  *
  * @return object Response Data
  * @throws InstagramException
  */
 public function execute()
 {
     $response = parent::execute();
     $this->response = $response;
     if ($this->throwExceptionIfResponseNotOk() && !$response->isOK()) {
         throw new InstagramException(sprintf("Instagram Request Failed! [%s] [%s]", $this->getEndpoint(), $response->getCode()));
     }
     $this->instagram->setCookies(array_merge($this->instagram->getCookies(), $response->getCookies()));
     return $this->parseResponse($response);
 }
 public function feed()
 {
     Phalanx::loadClasses('SocialNetwork');
     $token = SocialNetwork::get_access_token(1, INSTAGRAM);
     $token = json_decode($token);
     $instagram = new Instagram($this->config);
     $instagram->setAccessToken($token->access_token);
     $popular = $instagram->getUserFeed();
     $response = json_decode($popular, true);
     foreach ($response['data'] as $each) {
         echo "<img src='{$each['images']['thumbnail']['url']}'>";
     }
 }
 public static function instance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 function __construct($token = null, $count = null, $size = null)
 {
     if (!empty($token)) {
         self::$access_token = $token;
     }
     if (!empty($count)) {
         self::$count = $count;
     }
     if (!empty($size)) {
         self::$display_size = $size;
     }
     self::$result = self::fetch("https://api.instagram.com/v1/users/self/media/recent?count=" . self::$count . "&access_token=" . self::$access_token);
     self::$result = json_decode(self::$result);
     // https://api.instagram.com/v1/users/self/feed
 }
<?php

##########################################################
##														##
##		Desenvolvido por Rodrigo Passos					##
##		http://www.rodrigop.com.br						##
##		contato@rodrigop.com.br							##
##														##
##		Sinta-se livre para alterar o que quiser :)		##
##														##
##########################################################
require_once "class.php";
if ($_REQUEST["url"]) {
    $Instagram = new Instagram();
    if ($_REQUEST["action"] == "1") {
        echo $Instagram->loadMore($_REQUEST["url"]);
    } else {
        if ($_REQUEST["action"] == "2") {
            echo $Instagram->getUrlMore($_REQUEST["url"]);
        }
    }
}
Exemple #15
0
 * URI callback that you must set up with Instagram as the return address
 * for your application on their developers section:
 * http://instagr.am/developer/
 * 
 * 
 * If you have any question, check http://mauriciocuenca.com/ for the
 * latest updates
**/
require_once 'Instagram.php';
/**
 * Configuration params, make sure to write exactly the ones
 * instagram provide you at http://instagr.am/developer/
 */
$config = array('client_id' => 'e1d602f8517645749de38593dbf9ad25', 'client_secret' => '63dbfae2a6444956802e269384fc05cc', 'grant_type' => 'authorization_code', 'redirect_uri' => 'http://www.HoopsMap.com/instagram/');
/**
 * This is how a wrong response looks like
 * array(1) { ["InstagramOAuthToken"]=> string(89) "{"code": 400, "error_type": "OAuthException", "error_message": "No matching code found."}" }
 */
session_start();
/**
if (isset($_SESSION['InstagramAccessToken']) && !empty($_SESSION['InstagramAccessToken'])) {
    header('Location: index.php');
    die();
}
**/
// Instantiate the API handler object
$instagram = new Instagram($config);
$instagram->openAuthorizationUrl();
?>

<?php

require '../src/Instagram.php';
include 'data.php';
$i = new Instagram($username, $password, $proxy, $debug);
try {
    $i->login();
} catch (InstagramException $e) {
    $e->getMessage();
    exit;
}
try {
    $i->uploadPhoto($photo, $caption);
} catch (Exception $e) {
    echo $e->getMessage();
}
Exemple #17
0
<?php

session_start();
if (!isset($_SESSION['AccessToken'])) {
    header('Location: redirect.php?op=getauth');
    die;
}
require_once 'Class.Instagram.php';
$instgram = new Instagram();
$followingdata = json_decode($instgram->getFollowing(20));
/* echo "<pre>";
 print_r($followingdata);
 echo "</pre>"; */
include_once 'header.php';
include_once 'leftmenu.php';
?>
<div id="content">
<div id="content_top"></div>
<div id="content_main">
<?php 
foreach ($followingdata->data as $feeddata) {
    ?>
		<h2>&nbsp; </h2>
        <p>&nbsp;</p>
       	<h3><img src="<?php 
    echo $feeddata->profile_picture;
    ?>
" width="60" height="60" caption="Profile Image">&nbsp;&nbsp;<?php 
    echo $feeddata->username;
    ?>
 </h3>
Exemple #18
0
<?php

/**
 * Instagram PHP API
 * 
 * @link https://github.com/cosenary/Instagram-PHP-API
 * @author Christian Metz
 * @since 01.10.2013
 */
require_once '../instagram.class.php';
// initialize class
$instagram = new Instagram(array('apiKey' => 'db64ea18e8394b63b6c4309250b4ea6a', 'apiSecret' => '1e672be29aab4d2e88a79f3dc8919eee', 'apiCallback' => 'http://test.me/php/api/instagram/Instagram-PHP-API-master/example/success.php'));
// receive OAuth code parameter
$code = $_GET['code'];
// check whether the user has granted access
if (isset($code)) {
    // receive OAuth token object
    $data = $instagram->getOAuthToken($code);
    $username = $username = $data->user->username;
    $user_id = $data->user->id;
    // store user access token
    $instagram->setAccessToken($data);
    // now you have access to all authenticated user methods
    $result = $instagram->getUserMedia();
} else {
    // check whether an error occurred
    if (isset($_GET['error'])) {
        echo 'An error occurred: ' . $_GET['error_description'];
    }
}
?>
 function get_photo_count()
 {
     add_post_meta(get_the_ID(), '_instagram_count', 0, true);
     $instagram_count = get_post_meta($post->ID, '_instagram_count');
     $instagram_count = @unserialize($instagram_count[0]);
     $instagram = new Instagram(array('client_id' => '4dbe36aac4c943b9b260f078f33b4edc', 'access_token' => '1685551.4dbe36a.1970e3a32fff4545a4e3ceded4e059ee'));
     $result = $instagram->tags_media_recent('tbex');
     $data = json_decode($result, true);
     if (count($instagram_count) != 0) {
         for ($i = 0; $i < sizeof($data['data']); $i++) {
             $instagram_count[] = $data['data'][$i]["id"];
         }
         $instagram_count = array_unique($instagram_count);
         sort($instagram_count);
         $instagram_count = serialize($instagram_count);
         update_post_meta($post->ID, '_instagram_count', $instagram_count);
     }
 }
<?php

require_once 'instagram.class.php';
$instagram = new Instagram(array('apiKey' => '', 'apiSecret' => '', 'apiCallback' => ''));
if ($_COOKIE['ulttoken']) {
    $instagram->setAccessToken($_COOKIE['ulttoken']);
    $user = $instagram->getUser()->data;
    ?>
<div id="content">

<?php 
}
echo "<div class=\"feed-photos\">\n<div class=\"photo-grid \">";
require_once 'con.php';
Exemple #21
0
        $html .= '
	<p>';
        foreach ($entry->comments as $comment) {
            $html .= '<small><a href="index.php?user='******'">' . $comment->user->username . '</a></small> ' . htmlspecialchars($comment->text) . '<br />';
        }
        $html .= '
	</p>';
    }
    $html .= '</div>';
    return $html;
}
/**
 * Do the API-calls now
 */
try {
    $inst = new Instagram();
    $inst->auth->login($username, $password, $deviceId);
    if (isset($_GET['user']) && is_numeric($_GET['user']) && !isset($_GET['hidebacklink'])) {
        echo '<p><a href="index.php">&lt;&lt; Back to my feed</a></p>';
        $feed = $inst->feed->user((int) $_GET['user']);
    } else {
        $feed = $inst->feed->timeline();
    }
    $inst->run();
    $response = $feed->getResponse()->getData();
    foreach ($response as $rentry) {
        echo printEntry($rentry);
    }
} catch (Instagram_Exception $ex) {
    echo "<pre>\n\n   ERROR: {$ex->getMessage()}\n\n" . var_export($ex->getResponse(), 1) . "\n\n{$ex}\n\n</pre>";
}
require_once 'Instagram.php';
/**
 * Configuration params, make sure to write exactly the ones
 * instagram provide you at http://instagr.am/developer/
 */
$config = array('client_id' => 'e8d6b06f7550461e897b45b02d84c23e', 'client_secret' => '2357fc69da344800acef2592ef647491', 'grant_type' => 'authorization_code', 'redirect_uri' => 'http://mauriciocuenca.com/qnktwit/');
/**
 * This is how a wrong response looks like
 * array(1) { ["InstagramOAuthToken"]=> string(89) "{"code": 400, "error_type": "OAuthException", "error_message": "No matching code found."}" }
 */
session_start();
if (isset($_SESSION['InstagramAccessToken']) && !empty($_SESSION['InstagramAccessToken'])) {
    header('Location: callback.php');
    die;
}
// Instantiate the API handler object
$instagram = new Instagram($config);
//Setup subscription
if (isset($rs[0]["access_token"])) {
    $instagram->setAccessToken($_SESSION['InstagramAccessToken']);
    if (isset($_GET['list'])) {
        $subscriptions = $instagram->listSubscriptions();
    } else {
        if (isset($_GET['delete'])) {
            $subscriptions = $instagram->deleteSubscription(array("object" => "all"));
        } else {
            $subscriptions = $instagram->createSubscription(array("object" => "tag", "object_id" => "mydowntown", "aspect" => "media", "callback_url" => $config['instagram']['redirect_uri'] . "subscriptions.php"));
        }
    }
    print_r($subscriptions);
}
<?php

//session_start();
//session_start();
require_once 'instagram.class.php';
// Setup class
$instagram = new Instagram(array('apiKey' => '', 'apiSecret' => '', 'apiCallback' => ''));
$token = '';
$check = '';
$code = '';
// Receive OAuth code parameter
if (!isset($_SESSION["check"]) && strlen($_GET["code"]) < 50) {
    $code = $_GET["code"];
    //echo "$code<br>";
    $_SESSION["check"] = $code;
}
$code = $_SESSION["check"];
//echo "$code<br>";
//echo strlen($code);
//echo "$code<br>";
// Check whether the user has granted access
if (true === isset($code) && strlen($code) < 50) {
    //echo "true hit<br>";
    //echo "passed<br>";
    //$data = $instagram->getInstagramPhotos($code);
    //echo $data;
    // Receive OAuth token object
    if (!isset($_SESSION[$token])) {
        //echo "session not set<br>";
        $data = $instagram->getOAuthToken($code);
        $_SESSION[$token] = $data;
Exemple #24
0
 /**
  * getPhotoInfo 
  * 
  * @return string
  */
 private function getPhotoInfo()
 {
     $config = getInstagramConfigData();
     $instagram = new Instagram($config['instagram_client_id'], $config['instagram_client_secret'], $this->accessToken);
     try {
         if (isset($_GET['show']) && $_GET['show'] == 'more') {
             $feed = $instagram->get('users/self/media/recent/');
         } else {
             $feed = $instagram->get('users/self/media/recent/', array('count' => 8));
         }
     } catch (InstagramApiError $e) {
         $this->fcmsError->add(array('type' => 'operation', 'message' => T_('Could not get Instagram User data.'), 'error' => $e->getMessage(), 'file' => __FILE__, 'line' => __LINE__));
         return false;
     }
     $photos = '';
     $automaticSelect = '';
     if (!$this->autoUpload) {
         $photos .= '<h2>' . T_('Manual') . '</h2>';
         $photos .= '<p>' . T_('Choose photo to add.') . '</p>';
         $photos .= '<ul>';
         $i = 1;
         foreach ($feed->data as $photo) {
             $sourceId = $photo->id;
             $thumbnail = $photo->images->thumbnail->url;
             $medium = $photo->images->low_resolution->url;
             $full = $photo->images->standard_resolution->url;
             $caption = isset($photo->caption) ? $photo->caption->text : '';
             $caption .= ' [' . sprintf(T_('Instagram filter: %s.'), $photo->filter) . ']';
             $value = "{$sourceId}|{$thumbnail}|{$medium}|{$full}|{$caption}";
             $photos .= '<li>';
             $photos .= '<label for="instagram' . $i . '">';
             $photos .= '<img src="' . $thumbnail . '" alt="' . $caption . '"/><br/>';
             $photos .= '<input type="checkbox" id="instagram' . $i . '" name="photos[]" value="' . $value . '"/>';
             $photos .= '</label>';
             $photos .= '</li>';
             $i++;
         }
         // They probably have more
         if ($i == 8) {
             $photos .= '<li><a href="index.php?action=upload&amp;type=instagram&amp;show=more">' . T_('See more') . '</a></li>';
         }
         $photos .= '</ul>';
     }
     return $photos . '
                     <h2>' . T_('Automatic') . '</h2>
                     <label>
                         <input type="checkbox" id="automatic" name="automatic" value="1" ' . ($this->autoUpload ? 'checked="checked"' : '') . '/>
                         ' . T_('Have all photos automatically imported.') . '
                     </label>';
 }
Exemple #25
0
<?php

include_once 'head.php';
$ig = new Instagram();
$ig->get_popular_media();
include_once 'footer.php';
<?php

$items = Instagram::getTagMedia($region['greeklish'], 20);
if (count($items->data) == 0) {
    $items = Instagram::getTagMedia('greece', 20);
}
$i = 0;
?>

<div id="carouselFull" class="carousel slide" data-ride="carousel">
    <div class="carousel-inner">

    	@foreach ($items->data as $image)
    		<div class="item {{( $i >= 1) ? '': 'active'}}" style="height: 340px;">
	            <img src="{{ $image->images->standard_resolution->url }}" width="614.5" height="368" alt="First slide">
	            <div class="container">
	                <div class="carousel-caption">
	                    
	                </div>
	            </div>
	        </div>
	        <?php 
$i++;
?>
		@endforeach
    </div>
    <a class="left carousel-control" href="#carouselFull" role="button" data-slide="prev"><span class="fa fa-chevron-left"></span></a>
    <a class="right carousel-control" href="#carouselFull" role="button" data-slide="next"><span class="fa fa-chevron-right"></span></a>
</div>
 function instagram_authorize()
 {
     global $xoousersultra_captcha_loader, $xoouserultra, $blog_id;
     //require_once(ABSPATH . 'wp-includes/pluggable.php');
     require_once ABSPATH . 'wp-admin/includes/user.php';
     require_once xoousers_path . "libs/instagram/instagram.class.php";
     $YOUR_APP_KEY = $xoouserultra->get_option('instagram_client_id');
     $YOUR_APP_SECRET = $xoouserultra->get_option('instagram_client_secret');
     $YOUR_APP_CALLBACK = $xoouserultra->get_option('instagram_redirect_uri');
     if ($xoouserultra->get_option('instagram_connect') == 1 && $YOUR_APP_KEY && $YOUR_APP_SECRET && $YOUR_APP_CALLBACK) {
         if (isset($_GET['code']) && isset($_REQUEST['instagram']) && $_REQUEST['instagram'] == '1') {
             $instagram = new Instagram(array('apiKey' => $YOUR_APP_KEY, 'apiSecret' => $YOUR_APP_SECRET, 'apiCallback' => $YOUR_APP_CALLBACK));
             $code = $_GET['code'];
             // Receive OAuth token object
             $data = $instagram->getOAuthToken($code);
             // Take a look at the API response
             $user = $data->user->username;
             $fullname = $data->user->full_name;
             $bio = $data->user->bio;
             $website = $data->user->website;
             $id = $data->user->id;
             $access_token = $data->access_token;
             //check access token is set or not
             if (!empty($user)) {
                 //if user data get successfully
                 if (isset($id)) {
                     //check if
                     $users = get_users(array('meta_key' => 'xoouser_ultra_instagram_id', 'meta_value' => $id, 'meta_compare' => '='));
                     if (isset($users[0]->ID) && is_numeric($users[0]->ID)) {
                         $returning = $users[0]->ID;
                         $returning_user_login = $users[0]->user_login;
                     } else {
                         $returning = '';
                     }
                     // Authorize user
                     if (is_user_logged_in()) {
                         update_user_meta($user_id, 'xoouser_ultra_instagram_id', $id);
                         $this->login_registration_afterlogin();
                     } else {
                         //the user is NOT logged in
                         if ($returning != '') {
                             $noactive = false;
                             /*If alreayd exists*/
                             $user = get_user_by('login', $returning_user_login);
                             $user_id = $user->ID;
                             if (!$this->is_active($user_id) && !is_super_admin($user_id)) {
                                 $noactive = true;
                             }
                             if (!$noactive) {
                                 $secure = "";
                                 //already exists then we log in
                                 wp_set_auth_cookie($user_id, true, $secure);
                                 do_action('wp_login', $user->user_login, $user);
                             }
                             //redirect user
                             $this->login_registration_afterlogin();
                         } else {
                             if ($user != '' && username_exists($user)) {
                                 //user email exists then we have to sync
                                 $user_id = username_exists($user);
                                 $user = get_userdata($user_id);
                                 update_user_meta($user_id, 'xoouser_ultra_instagram_id', $id);
                                 $u_user = $user->user_login;
                                 $noactive = false;
                                 /*If alreayd exists*/
                                 $user = get_user_by('login', $u_user);
                                 $user_id = $user->ID;
                                 if (!$this->is_active($user_id) && !is_super_admin($user_id)) {
                                     $noactive = true;
                                 }
                                 if (!$noactive) {
                                     $secure = "";
                                     //already exists then we log in
                                     wp_set_auth_cookie($user_id, true, $secure);
                                     do_action('wp_login', $user->user_login, $user);
                                 }
                                 //redirect user
                                 $this->login_registration_afterlogin();
                             } else {
                                 //user is new we have to create it
                                 //this is a new client we have to create the account
                                 $u_name = $this->get_social_services_name('instagram', $data->user);
                                 $u_email = $id;
                                 //generat random password
                                 $user_pass = wp_generate_password(12, false);
                                 $user_login = $this->unique_user('instagram', $data->user);
                                 $user_login = sanitize_user($user_login, true);
                                 //Build user data
                                 $user_data = array('user_login' => $user_login, 'display_name' => $u_name, 'user_email' => $u_email, 'user_pass' => $user_pass);
                                 // Create a new user
                                 $user_id = wp_insert_user($user_data);
                                 update_user_meta($user_id, 'xoouser_ultra_social_signup', 7);
                                 update_user_meta($user_id, 'xoouser_ultra_instagram_id', $id);
                                 update_user_meta($user_id, 'first_name', $u_name);
                                 update_user_meta($user_id, 'display_name', $u_name);
                                 $verify_key = $this->get_unique_verify_account_id();
                                 update_user_meta($user_id, 'xoouser_ultra_very_key', $verify_key);
                                 $this->user_account_status($user_id);
                                 //notify client
                                 $xoouserultra->messaging->welcome_email($u_email, $user_login, $user_pass);
                                 $creds['user_login'] = sanitize_user($user_login);
                                 $creds['user_password'] = $user_pass;
                                 $creds['remember'] = 1;
                                 $noactive = false;
                                 if (!$this->is_active($user_id) && !is_super_admin($user_id)) {
                                     $noactive = true;
                                 }
                                 if (!$noactive) {
                                     $user = wp_signon($creds, false);
                                     do_action('wp_login', $user->user_login, $user);
                                 }
                                 //redirect user
                                 $this->login_registration_afterlogin();
                             }
                         }
                     }
                 }
             }
         }
     }
 }
<?php

// Get class for Instagram
// More examples here: https://github.com/cosenary/Instagram-PHP-API
require_once 'lib/instagram.class.php';
// Initialize class with client_id
// Register at http://instagram.com/developer/ and replace client_id with your own
$instagram = new Instagram(array('apiKey' => '6ffb1036a193401ca901270833b0b905', 'apiSecret' => 'c6c9139856ab474ba1c8d74fe97b7b10', 'apiCallback' => 'http://localhost'));
// Set keyword for #hashtag
$tag = 'kisschoice';
// Get latest photos according to #hashtag keyword
$media = $instagram->getTagMedia($tag);
// Set number of photos to show
$limit = 5;
// Set height and width for photos
$size = '100';
echo json_encode($media->data);
/*
    // Show results
    // Using for loop will cause error if there are less photos than the limit
    foreach(array_slice($media->data, 0, $limit) as $data)
    {
        // Show photo
        echo '<p><img src="'.$data->images->thumbnail->url.'" height="'.$size.'" width="'.$size.'" alt="SOME TEXT HERE"></p>';
    }*/
Exemple #29
0
<?php

/*
Example use of aimee.instagram.class.php
*/
require_once 'aimee.instagram.class.php';
// tags to query
$tags = array('englishbulldog', 'igbulldogs_worldwide');
// initiate class
$ig = new Instagram();
// set your access token
$ig->setAccessToken('access_token');
// loop through tags
foreach ($tags as $tag) {
    // searches tag
    $tag = $ig->searchTag($tag);
    // shuffles json data
    shuffle($tag['data']);
    // likes the randomly shuffled tag!
    $ig->likeMedia($tag['data'][0]['id']);
}
// free up some memory
unset($ig);
Exemple #30
0
<?php

require '../instagram.class.php';
// initialize class
$instagram = new Instagram(array('apiKey' => 'db64ea18e8394b63b6c4309250b4ea6a', 'apiSecret' => '1e672be29aab4d2e88a79f3dc8919eee', 'apiCallback' => 'http://localhost/instagram/Instagram-PHP-API-master/example/success.php'));
// create login URL
$loginUrl = $instagram->getLoginUrl();
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Instagram - OAuth Login</title>
    <link rel="stylesheet" type="text/css" href="assets/style.css">
    <style>
      .login {
        display: block;
        font-size: 20px;
        font-weight: bold;
        margin-top: 50px;
      }
    </style>
  </head>
  <body>
    <div class="container">
      <header class="clearfix">
        <h1>Instagram <span>display your photo stream</span></h1>
      </header>
      <div class="main">