function onNextendYoutube(&$google, &$youtube)
 {
     $config = new NextendData();
     $config->loadJson(NextendSmartSliderStorage::get(self::$_group));
     if (!class_exists('Google_Client')) {
         require_once dirname(__FILE__) . '/googleclient/Google_Client.php';
     }
     if (!class_exists('Google_YouTubeService')) {
         require_once dirname(__FILE__) . '/googleclient/contrib/Google_YouTubeService.php';
     }
     $google = new Google_Client();
     $google->setClientId($config->get('apikey', ''));
     $google->setClientSecret($config->get('apisecret', ''));
     $token = $config->get('token', null);
     if ($token) {
         $google->setAccessToken($token);
     }
     $youtube = new Google_YouTubeService($google);
     if ($google->isAccessTokenExpired()) {
         $token = json_decode($google->getAccessToken(), true);
         if (isset($token['refresh_token'])) {
             $google->refreshToken($token['refresh_token']);
             $config->set('token', $google->getAccessToken());
             NextendSmartSliderStorage::set(self::$_group, $config->toJSON());
         }
     }
 }
 function onNextendTwitter(&$twitter)
 {
     $config = new NextendData();
     $config->loadJson(NextendSmartSliderStorage::get(self::$_group));
     require_once dirname(__FILE__) . "/api/tmhOAuth.php";
     $twitter = new tmhOAuth(array('consumer_key' => $config->get('apikey', ''), 'consumer_secret' => $config->get('apisecret', ''), 'user_token' => $config->get('token', ''), 'user_secret' => $config->get('tokensecret', '')));
 }
 function onNextendFlickr(&$flickr)
 {
     $config = new NextendData();
     $config->loadJson(NextendSmartSliderStorage::get(self::$_group));
     require_once dirname(__FILE__) . "/api/phpFlickr.php";
     $flickr = new phpFlickr($config->get('apikey', ''), $config->get('apisecret', ''));
     $flickr->setToken($config->get('token', ''));
 }
 function onNextendFacebook(&$facebook)
 {
     $config = new NextendData();
     $config->loadJson(NextendSmartSliderStorage::get(self::$_group));
     require_once dirname(__FILE__) . "/api/facebook.php";
     $facebook = new Facebook(array('appId' => $config->get('apikey', ''), 'secret' => $config->get('apisecret', '')));
     $facebook->setAccessToken($config->get('token', ''));
 }
 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', ''));
 }
Beispiel #6
0
 function makeItem($args)
 {
     if (isset($this->items[$args[1]])) {
         $data = new NextendData();
         $data->loadJson(base64_decode($args[2]));
         if ($data->_data != null) {
             ++self::$i[$this->id];
             if ($this->admin) {
                 return $this->items[$args[1]]->renderAdmin($data, $this->id . 'item' . self::$i[$this->id], $this->id, $this);
             }
             return $this->items[$args[1]]->render($data, $this->id . 'item' . self::$i[$this->id], $this->id, $this);
         }
     }
     return '';
 }