コード例 #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'));
 }