Esempio n. 1
0
 public function get_user_id_from_username($username)
 {
     try {
         $users = $this->request('get', 'https://api.instagram.com/v1/users/search', array('q' => $username, 'access_token' => $this->access_token));
     } catch (\Exception $e) {
         \SocialFeed\Controller::log($e->getMessage());
         return array();
     }
     $user_id = false;
     foreach ($users as $user) {
         if (strtolower($user->username) === strtolower($username)) {
             $user_id = $user->id;
             break;
         }
     }
     return $user_id;
 }
Esempio n. 2
0
<?php

/*
Plugin Name: Social Feed
Plugin URI:
Description: Retrieves posts from Facebook, Instagram, and Twitter and displays the latest N number of them.
Version: 1.0
Author: TMBR
Author URI: http://wearetmbr.com/
*/
function socialfeed_autoloader($class)
{
    $class = strtolower($class);
    $class = str_replace(array('socialfeed\\', '\\'), array('', '/'), $class);
    $try_file = dirname(__FILE__) . '/' . $class . '.php';
    if (file_exists($try_file)) {
        require_once $try_file;
    }
}
spl_autoload_register('socialfeed_autoloader');
\SocialFeed\Controller::i()->add_actions();