Пример #1
0
 public function __construct()
 {
     parent::__construct();
     $OAuth2 = nxcSocialNetworksOAuth2::getInstanceByType('instagram');
     $OAuth2Token = $OAuth2->getToken()->Token;
     $this->API = array('key' => $OAuth2->appSettings['key'], 'secret' => $OAuth2->appSettings['secret'], 'token' => $OAuth2Token);
 }
Пример #2
0
 public function __construct()
 {
     parent::__construct();
     $OAuth2 = nxcSocialNetworksOAuth2::getInstanceByType('twitter');
     $OAuth2Token = $OAuth2->getToken();
     $this->API = new TwitterOAuth($OAuth2->appSettings['key'], $OAuth2->appSettings['secret'], $OAuth2Token->attribute('token'), $OAuth2Token->attribute('secret'));
 }
Пример #3
0
 protected function __construct()
 {
     parent::__construct();
     $redirectURL = '/nxc_social_network_token/get_access_token/linkedin';
     eZURI::transformURI($redirectURL, false, 'full');
     $this->connection = new LinkedIn(array('appKey' => $this->appSettings['key'], 'appSecret' => $this->appSettings['secret'], 'callbackUrl' => $redirectURL));
 }
Пример #4
0
 public function __construct()
 {
     parent::__construct();
     $OAuth2 = nxcSocialNetworksOAuth2::getInstanceByType('facebook');
     $this->API = new Facebook($OAuth2->appSettings['key'], $OAuth2->appSettings['secret']);
     $OAuth2Token = $OAuth2->getToken();
     $this->acessToken = $OAuth2Token->attribute('token');
 }
Пример #5
0
 protected function getAPI()
 {
     $OAuth2 = nxcSocialNetworksOAuth2::getInstanceByType('linkedin');
     $OAuth2Token = $OAuth2->getToken();
     $API = new LinkedIn(array('appKey' => $OAuth2->appSettings['key'], 'appSecret' => $OAuth2->appSettings['secret'], 'callbackUrl' => null));
     $API->setTokenAccess(array('oauth_token' => $OAuth2Token->attribute('token'), 'oauth_token_secret' => $OAuth2Token->attribute('secret')));
     return $API;
 }
Пример #6
0
 protected function getAPI()
 {
     $OAuth2 = nxcSocialNetworksOAuth2::getInstanceByType('facebook');
     $API = new Facebook($OAuth2->appSettings['key'], $OAuth2->appSettings['secret']);
     $OAuth2Token = $OAuth2->getToken();
     $this->acessToken = $OAuth2Token->attribute('token');
     return $API;
 }
Пример #7
0
 public function __construct()
 {
     parent::__construct();
     $OAuth2 = nxcSocialNetworksOAuth2::getInstanceByType('google');
     $token = $OAuth2->getToken();
     $tmp = json_decode($token->attribute('token'), true);
     try {
         $OAuth2->connection->refreshToken($tmp['refresh_token']);
         $this->API = new apiPlusService($OAuth2->connection);
     } catch (Exception $e) {
         eZDebug::writeError($e->getMessage(), self::$debugMessagesGroup);
     }
 }
Пример #8
0
 protected function __construct()
 {
     parent::__construct();
     $redirectURL = '/nxc_social_network_token/get_access_token/google';
     eZURI::transformURI($redirectURL, false, 'full');
     $this->connection = new apiClient(array('cacheClass' => 'apiFileCache', 'authClass' => 'apiOAuth2', 'ioClass' => 'apiCurlIO'));
     $this->connection->setClientId($this->appSettings['key']);
     $this->connection->setClientSecret($this->appSettings['secret']);
     $this->connection->setRedirectUri($redirectURL);
     $this->connection->setApplicationName('eZ Publish');
     $this->connection->setAccessType('offline');
     $this->setState();
 }
Пример #9
0
 protected function __construct()
 {
     parent::__construct();
     $this->OAunth2Connection = nxcSocialNetworksOAuth2::getInstanceByType('google');
 }
Пример #10
0
<?php

/**
 * @package nxcSocialNetworks
 * @author  Serhey Dolgushev <*****@*****.**>
 * @date    16 Sep 2012
 **/
$error = false;
try {
    $OAth2 = nxcSocialNetworksOAuth2::getInstanceByType($Params['type']);
} catch (Exception $e) {
    $error = $e->getMessage();
}
if ($error === false) {
    try {
        $scopes = $OAth2->getPersistenceTokenScopes();
        header('Location: ' . $OAth2->getAuthorizeURL($scopes));
        eZExecution::cleanExit();
    } catch (Exception $e) {
        $error = $e->getMessage();
    }
}
$tpl = eZTemplate::factory();
$tpl->setVariable('error', $error);
$Result = array();
$Result['content'] = $tpl->fetch('design:social_networks/settings.tpl');
$Result['path'] = array(array('text' => ezpI18n::tr('extension/nxc_social_networks', 'Social Network Tokens Management'), 'url' => false));
Пример #11
0
 protected function getAPI()
 {
     $OAuth2 = nxcSocialNetworksOAuth2::getInstanceByType('twitter');
     $OAuth2Token = $OAuth2->getToken();
     return new TwitterOAuth($OAuth2->appSettings['key'], $OAuth2->appSettings['secret'], $OAuth2Token->attribute('token'), $OAuth2Token->attribute('secret'));
 }