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


PHP apiClient::setUseObjects方法代码示例

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


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

示例1: 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

示例2: loadEvents

/**
 * Load the list of upcoming events in the UPL and return an array containing
 * an array of each event's information.
 */
function loadEvents()
{
    if (!class_exists('apiClient')) {
        return array();
    }
    // Load up the Google API client
    $client = new apiClient();
    $client->setApplicationName('UPL Website');
    $client->setUseObjects(true);
    apiKey($client);
    $cal = new apiCalendarService($client);
    // List all events in the UPL calendar
    $calendarId = '42jcv5rucaf2h6ehk89gbbog5g@group.calendar.google.com';
    $args = array('singleEvents' => true, 'orderBy' => 'startTime', 'maxResults' => 5, 'timeMin' => date(DateTime::RFC3339));
    $events = $cal->events->listEvents($calendarId, $args);
    // Make sure that we at least have some events
    if (!$events) {
        return array();
    }
    $events = $events->getItems();
    if (!is_array($events)) {
        return array();
    }
    // Just a little helper to convert dates
    function makeDate($evtDate)
    {
        return DateTime::createFromFormat(DateTime::RFC3339, $evtDate->getDateTime());
    }
    function mapEvent($event)
    {
        return array('summary' => $event->getSummary(), 'start' => makeDate($event->getStart()), 'end' => makeDate($event->getEnd()), 'description' => $event->getDescription(), 'link' => $event->getHtmlLink());
    }
    // Retrieve all our events
    return array_map(mapEvent, $events);
}
开发者ID:LOZORD,项目名称:UPL-Website-Revamp,代码行数:39,代码来源:events.php

示例3: 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

示例4: 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

示例5: 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

示例6: GetUserInfo

 /**
  * Retrieve user profile information from Google's UserInfo service.
  *
  * @param OauthCredentials $credentials Object representation of OAuth creds
  * @return Userinfo User profile information
  */
 function GetUserInfo($credentials)
 {
     $client = new apiClient();
     $client->setUseObjects(true);
     /*
      * Set clientId and clientSecret in case token is expired.
      * and refresh is needed
      */
     $client->setClientId($credentials->clientId);
     $client->setClientSecret($credentials->clientSecret);
     $client->setAccessToken($credentials->toJson());
     $userInfoService = new apiOauth2Service($client);
     $userInfo = $userInfoService->userinfo->get();
     return $userInfo;
 }
开发者ID:Legallyplayed,项目名称:hrovira-mavenized-google-drive-sdk-samples,代码行数:21,代码来源:auth_handler.php

示例7: apiClient

  * on the home page: I didn't want to mess with
  * Michael's code when I wasn't with him) was done
  * by Bobby.
  *
  *****************************************************/
 
 session_start();
 
 
 //include needed files
 require_once "google-api-php-client/src/apiClient.php";
 require_once "google-api-php-client/src/contrib/apiCalendarService.php";
 require_once("doodle-api/includes/helpers.php");
 //create new API request
 $apiClient = new apiClient();
 $apiClient->setUseObjects(true);
 $service = new apiCalendarService($apiClient);
 
 //set global for use later
 $_SESSION["service"]= $service;
 
 //check for current Authentication token
 if (isset($_SESSION['oauth_access_token'])) 
 {
 $apiClient->setAccessToken($_SESSION['oauth_access_token']);
 } 
 else
 {
 $token = $apiClient->authenticate();
 $_SESSION['oauth_access_token'] = $token;
 }   
开发者ID:robertflitsch,项目名称:cs50-psets,代码行数:31,代码来源:index.php


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