当前位置: 首页>>代码示例>>PHP>>正文


PHP apiClient::setClientId方法代码示例

本文整理汇总了PHP中apiClient::setClientId方法的典型用法代码示例。如果您正苦于以下问题:PHP apiClient::setClientId方法的具体用法?PHP apiClient::setClientId怎么用?PHP apiClient::setClientId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在apiClient的用法示例。


在下文中一共展示了apiClient::setClientId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index()
 {
     $this->id = "content";
     $this->template = "login/login.tpl";
     $this->layout = "common/layout-empty";
     if (Registry::get('username')) {
         header("Location: search.php");
         exit;
     }
     $request = Registry::get('request');
     $session = Registry::get('session');
     $db = Registry::get('db');
     $this->load->model('user/auth');
     $this->load->model('user/user');
     $this->load->model('user/prefs');
     $this->load->model('domain/domain');
     $this->load->model('folder/folder');
     if (ENABLE_SAAS == 1) {
         $this->load->model('saas/ldap');
         $this->load->model('saas/customer');
     }
     $this->data['title'] = $this->data['text_login'];
     $this->data['title_prefix'] = TITLE_PREFIX;
     $this->data['failed_login_count'] = $this->model_user_auth->get_failed_login_count();
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate() == true) {
         if ($this->model_user_auth->checkLogin($this->request->post['username'], $_POST['password']) == 1) {
             if ($session->get("ga_block") == 1) {
                 header("Location: " . SITE_URL . "index.php?route=login/ga");
                 exit;
             } else {
                 $this->model_user_prefs->get_user_preferences($session->get('username'));
                 if (ENABLE_SAAS == 1) {
                     $this->model_saas_customer->online($session->get('email'));
                 }
                 LOGGER('logged in');
                 if (isAdminUser() == 1) {
                     header("Location: " . SITE_URL . "index.php?route=health/health");
                     exit;
                 }
                 header("Location: " . SITE_URL . "search.php");
                 exit;
             }
         } else {
             $this->model_user_auth->increment_failed_login_count($this->data['failed_login_count']);
             $this->data['failed_login_count']++;
         }
         $this->data['x'] = $this->data['text_invalid_email_or_password'];
     }
     if (ENABLE_GOOGLE_LOGIN == 1) {
         $client = new apiClient();
         $client->setApplicationName(GOOGLE_APPLICATION_NAME);
         $client->setScopes(array('https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile', 'https://mail.google.com/'));
         $client->setClientId(GOOGLE_CLIENT_ID);
         $client->setClientSecret(GOOGLE_CLIENT_SECRET);
         $client->setRedirectUri(GOOGLE_REDIRECT_URL);
         $client->setDeveloperKey(GOOGLE_DEVELOPER_KEY);
         $this->data['auth_url'] = $client->createAuthUrl();
     }
     $this->render();
 }
开发者ID:buxiaoyang,项目名称:EmailArchive,代码行数:60,代码来源:login.php

示例2: getServiceClient

 public static function getServiceClient()
 {
     if (!self::isServiceConfigured()) {
         return false;
     }
     $config = self::getConfig();
     $client = new apiClient(array("ioFileCache_directory" => PIMCORE_CACHE_DIRECTORY));
     $client->setApplicationName("pimcore CMF");
     $key = file_get_contents(self::getPrivateKeyPath());
     $client->setAssertionCredentials(new apiAssertionCredentials($config->email, array('https://www.googleapis.com/auth/analytics.readonly', "https://www.google.com/webmasters/tools/feeds/"), $key));
     $client->setClientId($config->client_id);
     // token cache
     $tokenFile = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/google-api.token";
     if (file_exists($tokenFile)) {
         $tokenData = file_get_contents($tokenFile);
         $tokenInfo = Zend_Json::decode($tokenData);
         if ($tokenInfo["created"] + $tokenInfo["expires_in"] > time() - 900) {
             $token = $tokenData;
         }
     }
     if (!$token) {
         $client->getAuth()->refreshTokenWithAssertion();
         $token = $client->getAuth()->getAccessToken();
         file_put_contents($tokenFile, $token);
     }
     $client->setAccessToken($token);
     return $client;
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:28,代码来源:Api.php

示例3: testSettersGetters

 public function testSettersGetters()
 {
     $client = new apiClient();
     $client->setClientId("client1");
     $client->setClientSecret('client1secret');
     $client->setState('1');
     $client->setApprovalPrompt('force');
     $client->setAccessType('offline');
     global $apiConfig;
     $this->assertEquals('client1', $apiConfig['oauth2_client_id']);
     $this->assertEquals('client1secret', $apiConfig['oauth2_client_secret']);
     $client->setRedirectUri('localhost');
     $client->setApplicationName('me');
     $client->setUseObjects(false);
     $this->assertEquals('object', gettype($client->getAuth()));
     $this->assertEquals('object', gettype($client->getCache()));
     $this->assertEquals('object', gettype($client->getIo()));
     $client->setAuthClass('apiAuthNone');
     $client->setAuthClass('apiOAuth2');
     try {
         $client->setAccessToken(null);
         die('Should have thrown an apiAuthException.');
     } catch (apiAuthException $e) {
         $this->assertEquals('Could not json decode the access token', $e->getMessage());
     }
     $token = json_encode(array('access_token' => 'token'));
     $client->setAccessToken($token);
     $this->assertEquals($token, $client->getAccessToken());
 }
开发者ID:rahij,项目名称:ivlesync,代码行数:29,代码来源:ApiClientTest.php

示例4: __construct

 /**
  * Constructor and Login
  * @param $buy
  * @return Oara_Network_Publisher_Buy_Api
  */
 public function __construct($credentials)
 {
     $client = new apiClient();
     $client->setApplicationName("AffJet");
     $client->setClientId($credentials['clientId']);
     $client->setClientSecret($credentials['clientSecret']);
     $client->setAccessToken($credentials['oauth2']);
     $client->setAccessType('offline');
     $this->_client = $client;
     $this->_gan = new apiGanService($client);
 }
开发者ID:netzkind,项目名称:php-oara,代码行数:16,代码来源:GoogleAffiliateNetwork.php

示例5: BuildService

 /**
  * Build a Drive service object for interacting with the Google Drive API.
  *
  * @return apiDriveService service object
  */
 function BuildService($credentials)
 {
     $client = new apiClient();
     // return data from API calls as PHP objects instead of arrays
     $client->setUseObjects(true);
     $client->setAccessToken($credentials->toJson());
     // set clientId and clientSecret in case token is expired
     // and refresh is needed
     $client->setClientId($credentials->clientId);
     $client->setClientSecret($credentials->clientSecret);
     return new apiDriveService($client);
 }
开发者ID:Legallyplayed,项目名称:hrovira-mavenized-google-drive-sdk-samples,代码行数:17,代码来源:drive_handler.php

示例6: getGoogleClient

 private function getGoogleClient($config)
 {
     require_once LIBS_DIR . '/google-api-php-client/src/apiClient.php';
     require_once LIBS_DIR . '/google-api-php-client/src/contrib/apiOauth2Service.php';
     $client = new apiClient();
     $client->setApplicationName($config['application_name']);
     $client->setClientId($config['client_id']);
     $client->setClientSecret($config['client_secret']);
     $client->setRedirectUri($config['redirect_url']);
     $client->setScopes(array('https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email'));
     return $client;
 }
开发者ID:oaki,项目名称:demoshop,代码行数:12,代码来源:Front_AuthentificationPresenter.php

示例7: connect

 /**
  * connect
  */
 protected function connect()
 {
     $client = new apiClient();
     $client->setApplicationName("Google Application");
     //*********** Replace with Your API Credentials **************
     $client->setClientId($this->clientId);
     $client->setClientSecret($this->clientSecret);
     $client->setRedirectUri($this->redirectUri);
     //        $client->setDeveloperKey('AIzaSyBiUF9NmJKGwbJCDOQIoF2NxMgtYjwI1c8');
     //************************************************************
     $client->setScopes(array('https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/userinfo.email'));
     return $client;
 }
开发者ID:visualweber,项目名称:appzf1,代码行数:16,代码来源:GoogleApiClient.php

示例8: createClient

 /**
  * @return apiClient
  */
 private function createClient()
 {
     require_once 'apiClient.php';
     $client = new apiClient();
     /*$client->setClientId($this->getClientID());
       $client->setClientSecret($this->getClientSecret());
       $client->setRedirectUri($this->getRedirectUri());
       $client->setDeveloperKey($this->getDeveloperKey());
       $client->setApplicationName(yii::app()->name);*/
     $client->setClientId(Yii::app()->functions->getOptionAdmin("google_client_id"));
     $client->setClientSecret(Yii::app()->functions->getOptionAdmin("google_client_secret"));
     $client->setRedirectUri(Yii::app()->functions->getOptionAdmin("google_client_redirect_ulr"));
     $client->setDeveloperKey($this->getDeveloperKey());
     $client->setApplicationName(yii::app()->name);
     return $client;
 }
开发者ID:ashishvazirani,项目名称:food,代码行数:19,代码来源:GoogleApis.php

示例9: index

 public function index()
 {
     $this->id = "content";
     $this->template = "login/login.tpl";
     $this->layout = "common/layout";
     $request = Registry::get('request');
     $db = Registry::get('db');
     $session = Registry::get('session');
     $this->load->model('user/auth');
     $this->load->model('user/user');
     $this->load->model('user/prefs');
     $this->load->model('user/google');
     $this->load->model('domain/domain');
     $this->load->model('folder/folder');
     $this->document->title = $this->data['text_login'];
     $client = new apiClient();
     $client->setApplicationName(GOOGLE_APPLICATION_NAME);
     $client->setScopes(array('https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile', 'https://mail.google.com/'));
     $client->setClientId(GOOGLE_CLIENT_ID);
     $client->setClientSecret(GOOGLE_CLIENT_SECRET);
     $client->setRedirectUri(GOOGLE_REDIRECT_URL);
     $client->setDeveloperKey(GOOGLE_DEVELOPER_KEY);
     $oauth2 = new apiOauth2Service($client);
     if (isset($_GET['code'])) {
         $client->authenticate();
         $session->set("access_token", $client->getAccessToken());
         header('Location: ' . GOOGLE_REDIRECT_URL);
     }
     if ($session->get("access_token")) {
         $client->setAccessToken($session->get("access_token"));
     }
     if ($client->getAccessToken()) {
         $session->set("access_token", $client->getAccessToken());
         $token = json_decode($session->get("access_token"));
         if (isset($token->{'access_token'}) && isset($token->{'refresh_token'})) {
             $account = $oauth2->userinfo->get();
             $this->model_user_google->check_for_account($account);
             $this->model_user_google->update_tokens($account['email'], $account['id'], $token);
             header("Location: " . SITE_URL . "search.php");
             exit;
         }
     }
     $this->render();
 }
开发者ID:buxiaoyang,项目名称:EmailArchive,代码行数:44,代码来源:google.php

示例10: refresh_access_token

 public function refresh_access_token($email = '')
 {
     if ($email == '') {
         return '';
     }
     $query = $this->db->query("SELECT refresh_token FROM " . TABLE_GOOGLE . " WHERE email=?", array($email));
     if (!isset($query->row['refresh_token'])) {
         return '';
     }
     $client = new apiClient();
     $client->setApplicationName(GOOGLE_APPLICATION_NAME);
     $client->setClientId(GOOGLE_CLIENT_ID);
     $client->setClientSecret(GOOGLE_CLIENT_SECRET);
     $client->setRedirectUri(GOOGLE_REDIRECT_URL);
     $client->setDeveloperKey(GOOGLE_DEVELOPER_KEY);
     $client->refreshToken($query->row['refresh_token']);
     $s = $client->getAccessToken();
     $a = json_decode($s);
     if (isset($a->{'access_token'})) {
         return $a->{'access_token'};
     }
     return '';
 }
开发者ID:buxiaoyang,项目名称:EmailArchive,代码行数:23,代码来源:google.php

示例11: dirname

<?php

if (!defined('NEW_GOOGLE_LOGIN')) {
    return;
}
require_once dirname(__FILE__) . '/apiClient.php';
require_once dirname(__FILE__) . '/contrib/apiOauth2Service.php';
$settings = maybe_unserialize(get_option('nextend_google_connect'));
$client = new apiClient();
$client->setClientId($settings['google_client_id']);
$client->setClientSecret($settings['google_client_secret']);
$client->setDeveloperKey($settings['google_api_key']);
$client->setRedirectUri(new_google_login_url());
$client->setApprovalPrompt('auto');
$oauth2 = new apiOauth2Service($client);
开发者ID:domalexxx,项目名称:nashvancouver,代码行数:15,代码来源:init.php

示例12: apiClient

<?php

include 'constants.php';
ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'apiClient.php';
require_once 'apiCalendarService.php';
session_start();
$client = new apiClient();
$client->setApplicationName("NUS Timetable Sync");
$client->setClientId($clientId);
$client->setClientSecret($clientSecret);
$client->setRedirectUri('http://localhost/ivle/test.php');
$client->setDeveloperKey($developerKey);
$apiClient = new apiClient();
$cal = new apiCalendarService($client);
if (isset($_SESSION['logout'])) {
    unset($_SESSION['token']);
}
if (isset($_GET['code'])) {
    $client->authenticate();
    $_SESSION['token'] = $client->getAccessToken();
    header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
}
if (isset($_SESSION['token'])) {
    $client->setAccessToken($_SESSION['token']);
}
if ($client->getAccessToken()) {
    $start_date_reference = array("Monday" => 13, "Tuesday" => 14, "Wednesday" => 15, "Thursday" => 16, "Friday" => 17, "Saturday" => 18, "Sunday" => 19);
    foreach ($_SESSION['modules'] as $module) {
        $event = new Event();
开发者ID:rahij,项目名称:ivlesync,代码行数:31,代码来源:addToCalendar.php

示例13: mysqli

<?php

require_once 'config.php';
require_once 'src/apiClient.php';
require_once 'src/contrib/apiPlusService.php';
require_once 'src/gMaps.php';
$mysqli = new mysqli(SERVER, USER, PASSWORD, DATABASE);
$gmap = new gMaps(MAP_KEY);
$client = new apiClient();
$plus = new apiPlusService($client);
session_start();
$client->setApplicationName('Globe +');
$client->setClientId(PLUS_CLIENT_ID);
$client->setClientSecret(PLUS_CLIENT_SECRET);
$client->setRedirectUri(PLUS_REDIRECT_URI);
$client->setDeveloperKey(PLUS_DEVELOPPER_KEY);
if (isset($_GET['code'])) {
    $client->authenticate();
    $_SESSION['access_token'] = $client->getAccessToken();
    header('Location: ' . URL . $_SERVER['PHP_SELF']);
}
if (isset($_GET['error'])) {
    header('Location: ' . URL . '?status=error');
    die;
}
if (isset($_SESSION['access_token'])) {
    $client->setAccessToken($_SESSION['access_token']);
}
if ($client->getAccessToken()) {
    $me = $plus->people->get('me');
    // These fields are currently filtered through the PHP sanitize filters.
开发者ID:narpaldhillon,项目名称:Globe-Plus,代码行数:31,代码来源:oauthcallback.php

示例14: getClient

 public static function getClient()
 {
     $client = new apiClient();
     $client->setApplicationName('GAnalytics joomla extension');
     $client->setClientId(GAnalyticsHelper::getComponentParameter('client-id'));
     $client->setClientSecret(GAnalyticsHelper::getComponentParameter('client-secret'));
     $uri = JFactory::getURI();
     if (filter_var($uri->getHost(), FILTER_VALIDATE_IP)) {
         $uri->setHost('localhost');
     }
     $client->setRedirectUri($uri->toString(array('scheme', 'host', 'port', 'path')) . '?option=com_ganalytics&view=import');
     $client->setUseObjects(true);
     $service = new apiAnalyticsService($client);
     return $client;
 }
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:15,代码来源:data.php

示例15: deleteGoogleCalendarEvent

 public function deleteGoogleCalendarEvent($action)
 {
     try {
         // catch google exceptions so the whole app doesn't crash if google has a problem syncing
         $admin = Yii::app()->params->admin;
         if ($admin->googleIntegration) {
             if (isset($this->syncGoogleCalendarId) && $this->syncGoogleCalendarId) {
                 // Google Calendar Libraries
                 $timezone = date_default_timezone_get();
                 require_once "protected/extensions/google-api-php-client/src/apiClient.php";
                 require_once "protected/extensions/google-api-php-client/src/contrib/apiCalendarService.php";
                 date_default_timezone_set($timezone);
                 $client = new apiClient();
                 $client->setClientId($admin->googleClientId);
                 $client->setClientSecret($admin->googleClientSecret);
                 $client->setDeveloperKey($admin->googleAPIKey);
                 $client->setAccessToken($this->syncGoogleCalendarAccessToken);
                 $client->setUseObjects(true);
                 // return objects instead of arrays
                 $googleCalendar = new apiCalendarService($client);
                 $googleCalendar->events->delete($this->syncGoogleCalendarId, $action->syncGoogleCalendarEventId);
             }
         }
     } catch (Exception $e) {
     }
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:26,代码来源:Profile.php


注:本文中的apiClient::setClientId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。