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


PHP Google_Client::setLogger方法代码示例

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


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

示例1: getClient

 /**
  * Return Google Content Client Instance
  *
  * @param int  $storeId
  * @param bool $noAuthRedirect
  *
  * @return bool|Google_Client
  */
 public function getClient($storeId, $noAuthRedirect = false)
 {
     if (isset($this->_client)) {
         if ($this->_client->isAccessTokenExpired()) {
             return $this->redirectToAuth($storeId, $noAuthRedirect);
         }
         return $this->_client;
     }
     $clientId = $this->getConfig()->getConfigData('client_id', $storeId);
     $clientSecret = $this->getConfig()->getClientSecret($storeId);
     $accessToken = $this->_getAccessToken($storeId);
     if (!$clientId || !$clientSecret) {
         Mage::getSingleton('adminhtml/session')->addError("Please specify Google Content API access data for this store!");
         return false;
     }
     if (!isset($accessToken) || empty($accessToken)) {
         return $this->redirectToAuth($storeId, $noAuthRedirect);
     }
     $this->_client = new Google_Client();
     $this->_client->setApplicationName(self::APPNAME);
     $this->_client->setClientId($clientId);
     $this->_client->setClientSecret($clientSecret);
     $this->_client->setScopes('https://www.googleapis.com/auth/content');
     $this->_client->setAccessToken($accessToken);
     if ($this->_client->isAccessTokenExpired()) {
         return $this->redirectToAuth($storeId, $noAuthRedirect);
     }
     if ($this->getConfig()->getIsDebug($storeId)) {
         $this->_client->setLogger(Mage::getModel('gshoppingv2/logger', $this->_client)->setStoreID($storeId));
     }
     return $this->_client;
 }
开发者ID:rsquarem,项目名称:MageGoogleShoppingApiV2,代码行数:40,代码来源:GoogleShopping.php

示例2: initClient

 /**
  * @param KalturaYoutubeApiDistributionJobProviderData $providerData
  * @return Google_Client
  */
 protected function initClient(KalturaYoutubeApiDistributionProfile $distributionProfile)
 {
     $options = array(CURLOPT_VERBOSE => true, CURLOPT_STDERR => STDOUT, CURLOPT_TIMEOUT => $this->timeout);
     $client = new Google_Client();
     $client->getIo()->setOptions($options);
     $client->setLogger(new YoutubeApiDistributionEngineLogger($client));
     $client->setClientId($distributionProfile->googleClientId);
     $client->setClientSecret($distributionProfile->googleClientSecret);
     $client->setAccessToken(str_replace('\\', '', $distributionProfile->googleTokenData));
     return $client;
 }
开发者ID:DBezemer,项目名称:server,代码行数:15,代码来源:YoutubeApiDistributionEngine.php

示例3: __construct

 /**
  * @param array $config
  */
 public function __construct(array $config, LoggerInterface $symfonyLogger = null)
 {
     // True if objects should be returned by the service classes.
     // False if associative arrays should be returned (default behavior).
     $config['use_objects'] = true;
     $client = new \Google_Client($config);
     if ($symfonyLogger) {
         //BC for Google API 1.0
         if (class_exists('\\Google_Logger_Psr')) {
             $googleLogger = new \Google_Logger_Psr($client, $symfonyLogger);
             $client->setLogger($googleLogger);
         } else {
             $client->setLogger($symfonyLogger);
         }
     }
     $client->setApplicationName($config['application_name']);
     $client->setClientId($config['oauth2_client_id']);
     $client->setClientSecret($config['oauth2_client_secret']);
     $client->setRedirectUri($config['oauth2_redirect_uri']);
     $client->setDeveloperKey($config['developer_key']);
     $this->client = $client;
 }
开发者ID:aschempp,项目名称:GoogleApiBundle,代码行数:25,代码来源:GoogleClient.php

示例4: initApiClients

 /**
  * Initialize API to Google and YouTube
  *
  * @param string $oAuthRedirectUrl
  * @throws LiveBroadcastOutputException
  */
 public function initApiClients($oAuthRedirectUrl)
 {
     if (empty($this->clientId) || empty($this->clientSecret)) {
         throw new LiveBroadcastOutputException('The YouTube oAuth settings are not correct.');
     }
     $googleApiClient = new \Google_Client();
     $googleApiClient->setLogger($this->logger);
     $googleApiClient->setClientId($this->clientId);
     $googleApiClient->setClientSecret($this->clientSecret);
     $googleApiClient->setScopes('https://www.googleapis.com/auth/youtube');
     $googleApiClient->setAccessType('offline');
     $googleApiClient->setRedirectUri($oAuthRedirectUrl);
     $googleApiClient->setApprovalPrompt('force');
     $this->googleApiClient = $googleApiClient;
     $this->youTubeApiClient = new \Google_Service_YouTube($googleApiClient);
 }
开发者ID:martin1982,项目名称:live-broadcast-bundle,代码行数:22,代码来源:YouTubeApiService.php

示例5: AppEngineFlexHandler

};
// [END session]
// add AppEngineFlexHandler on prod
// [START logging]
$app->register(new Silex\Provider\MonologServiceProvider());
if (isset($_SERVER['GAE_VM']) && $_SERVER['GAE_VM'] === 'true') {
    $app['monolog.handler'] = new AppEngineFlexHandler();
} else {
    $app['monolog.handler'] = new Monolog\Handler\ErrorLogHandler();
}
// [END logging]
// create the google authorization client
// [START google_client]
$app['google_client'] = function ($app) {
    $client = new Google_Client(['client_id' => $app['config']['google_client_id'], 'client_secret' => $app['config']['google_client_secret']]);
    $client->setLogger($app['monolog']);
    if ($app['routes']->get('login_callback')) {
        /** @var Symfony\Component\Routing\Generator\UrlGenerator $urlGen */
        $urlGen = $app['url_generator'];
        $redirectUri = $urlGen->generate('login_callback', [], $urlGen::ABSOLUTE_URL);
        $client->setRedirectUri($redirectUri);
    }
    return $client;
};
// [END google_client]
// [START pubsub_client]
$app['pubsub.client'] = function ($app) {
    // create the pubsub client
    $projectId = $app['config']['google_project_id'];
    $pubsub = new PubSubClient(['projectId' => $projectId]);
    return $pubsub;
开发者ID:GoogleCloudPlatform,项目名称:getting-started-php,代码行数:31,代码来源:app.php


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