本文整理汇总了PHP中apiClient::setDeveloperKey方法的典型用法代码示例。如果您正苦于以下问题:PHP apiClient::setDeveloperKey方法的具体用法?PHP apiClient::setDeveloperKey怎么用?PHP apiClient::setDeveloperKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类apiClient
的用法示例。
在下文中一共展示了apiClient::setDeveloperKey方法的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();
}
示例2: testClient
public function testClient()
{
$client = new apiClient();
$client->setAccessType('foo');
$this->assertEquals('foo', $client->getAuth()->accessType);
$client->setDeveloperKey('foo');
$this->assertEquals('foo', $client->getAuth()->developerKey);
$client->setAccessToken(json_encode(array('access_token' => '1')));
$this->assertEquals("{\"access_token\":\"1\"}", $client->getAccessToken());
}
示例3: 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;
}
示例4: 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();
}
示例5: init
private function init()
{
$client = new \apiClient();
$client->setApplicationName("Share1Book Test Page");
$client->setDeveloperKey($this->apiKey);
$service = new \apiBooksService($client);
$volumes = $service->volumes;
$optParams['maxResults'] = 1;
$optParams['country'] = 'FR';
$optParams['fields'] = 'kind,totalItems,items(volumeInfo(title,authors,imageLinks,description,publisher,publishedDate,industryIdentifiers))';
$q = $this->isbn10 ? $this->isbn10 : ($this->isbn13 ? $this->isbn13 : ($this->asin ? $this->asin : ""));
\Sb\Trace\Trace::addItem("requetage de google avec {$q}");
$this->results = $volumes->listVolumes($q, $optParams);
if ($this->results && count($this->results) > 0) {
if (array_key_exists('items', $this->results)) {
if (count($this->results['items']) > 0) {
$bookInfo = $this->results['items'][0];
$this->volumeInfo = $bookInfo['volumeInfo'];
}
}
}
}
示例6: 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 '';
}
示例7: sleep
$sql = "SELECT blogID FROM blogs WHERE url is null LIMIT 20";
$result = mysql_query($sql);
if (mysql_num_rows($result) < 5) {
sleep(60);
continue;
}
while ($row = mysql_fetch_assoc($result)) {
$sql = "SELECT apiKey FROM GoogleApiKey WHERE timediff(now(),date) > 9 ORDER BY Date ASC LIMIT 1";
$apiRS = mysql_query($sql);
if (mysql_num_rows($apiRS) == 0) {
sleep(9);
continue;
}
$apiKey = mysql_fetch_assoc($apiRS);
$client = new apiClient();
$client->setDeveloperKey($apiKey['apiKey']);
$service = new apiBloggerService($client);
$sql = "UPDATE GoogleApiKey SET Date = NOW() WHERE apiKey = '{$apiKey['apiKey']}' LIMIT 1; ";
mysql_query($sql);
try {
$blog = $service->blogs->get($row['blogID']);
} catch (Exception $e) {
echo $e->getCode();
if ($e->getCode() == 403 || $e->getCode() == 400) {
$sql = "UPDATE GoogleApiKey SET Date = '2020-01-01' WHERE apiKey = '{$apiKey['apiKey']}' LIMIT 1; ";
mysql_query($sql);
} else {
$sql = "UPDATE blogs SET url = '' WHERE blogID = '{$row['blogID']}' LIMIT 1; ";
mysql_query($sql);
}
continue;
示例8: apiClient
<?php
require_once 'google-api-php-client/src/apiClient.php';
require_once 'google-api-php-client/src/contrib/apiPlusService.php';
session_start();
$client = new apiClient();
$client->setApplicationName("Google+ PHP Starter Application");
//*********** Replace with Your API Credentials **************
$client->setClientId('272754976297-dakklcmbcemi2lojd383jt78nca9p0ad.apps.googleusercontent.com');
$client->setClientSecret('bIWo2hqsj1z3HT7u9p5rlsns');
$client->setRedirectUri('http://demo.webtutplus.com/google_login');
$client->setDeveloperKey('AIzaSyCa9jeGbICutfVxBgrO2aKUs9xqZTrUCF8');
//************************************************************
$client->setScopes(array('https://www.googleapis.com/auth/plus.me'));
$plus = new apiPlusService($client);
if (isset($_REQUEST['logout'])) {
unset($_SESSION['access_token']);
}
if (isset($_GET['code'])) {
$client->authenticate();
$_SESSION['access_token'] = $client->getAccessToken();
header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
}
if (isset($_SESSION['access_token'])) {
$client->setAccessToken($_SESSION['access_token']);
}
if ($client->getAccessToken()) {
$me = $plus->people->get('me');
$optParams = array('maxResults' => 100);
$activities = $plus->activities->listActivities('me', 'public', $optParams);
$_SESSION['access_token'] = $client->getAccessToken();
示例9: die
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
if (ini_get('register_globals') === "1") {
die("register_globals must be turned off before using the starter application");
}
require_once 'google-api-php-client/src/apiClient.php';
require_once 'google-api-php-client/src/contrib/apiPlusService.php';
session_start();
$client = new apiClient();
$client->setApplicationName("Get Friends Id");
$client->setClientId('1057327068472.apps.googleusercontent.com');
$client->setClientSecret('EOO__L0l3dn2i97W1OHN8KT8');
$client->setRedirectUri('http://localhost/googleplus/initialize.php');
$client->setDeveloperKey('AIzaSyCoR7Exd0QXZsvE8q5CaLGtVnAM3RPGeQY');
$client->setScopes(array('https://www.googleapis.com/auth/plus.me', 'https://www.google.com/m8/feeds/'));
$plus = new apiPlusService($client);
if (isset($_REQUEST['logout'])) {
unset($_SESSION['access_token']);
}
if (isset($_GET['code'])) {
$client->authenticate();
$_SESSION['access_token'] = $client->getAccessToken();
$redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
}
if (isset($_SESSION['access_token'])) {
$client->setAccessToken($_SESSION['access_token']);
}
if ($client->getAccessToken()) {
示例10: apiClient
<?php
session_start();
/******Improting Facebook API Files**************/
require_once 'includes/google-api-php-client/apiClient.php';
require_once 'includes/google-api-php-client/contrib/apiOauth2Service.php';
require_once 'credentials.php';
require_once 'sqlFunctions.php';
/******Google API Connection With My APP**************/
$client = new apiClient();
//$client->setApplicationName("TheASP");
$client->setClientId($client_id);
$client->setClientSecret($client_secret);
$client->setDeveloperKey($api_key);
$client->setRedirectUri($redirect_url);
$client->setAccessType('online');
$client->setApprovalPrompt('auto');
$oauth2 = new apiOauth2Service($client);
/******Waiting For OAuth Token And Then Authenticating**************/
if (isset($_GET['code'])) {
$client->authenticate();
/******After Authentication Requesting For User Data******/
$info = $oauth2->userinfo->get();
//echo '<pre>' . print_r( $info, 1 ) . '</pre>';
}
$email = $info['email'];
$fullname = $info['name'];
$fname = $info['given_name'];
$lname = $info['family_name'];
$Fuid = $info['id'];
$fblink = $info['link'];
示例11: index
public function index()
{
$this->load->language('easycheck/auth');
$data['text_heading'] = $this->language->get('text_heading');
$data['text_describe'] = $this->language->get('text_describe');
$data['text_savetime'] = $this->language->get('text_savetime');
$data['text_reg_log'] = $this->language->get('text_reg_log');
$data['text_proceedguest'] = $this->language->get('text_proceedguest');
$data['text_guest'] = $this->language->get('text_guest');
$data['text_or'] = $this->language->get('text_or');
$data['btn_continue'] = $this->language->get('btn_continue');
$data['btn_facebook'] = $this->language->get('btn_facebook');
$data['btn_gplus'] = $this->language->get('btn_gplus');
$data['input_email'] = $this->language->get('input_email');
$data['input_passd'] = $this->language->get('input_passd');
$data['check_availability'] = $this->url->link('easycheck/auth/check_availability');
$data['login'] = $this->url->link('easycheck/auth/login');
$data['guest_login'] = $this->url->link('easycheck/auth/guest_login');
$data['address_url'] = $this->url->link('easycheck/address');
$data['cant_access'] = $this->language->get('cant_access');
$data['forgot_password'] = $this->url->link('account/forgotten', '', 'SSL');
///////////////////////facebook & google login start////////////////////////////////
$appId = $this->settings['step']['facebook_login']['app_id'];
$secret = $this->settings['step']['facebook_login']['app_secret'];
$data['appId'] = $appId;
$data['secret'] = $secret;
//google login settings
$this->load->library('googleSetup');
$client = new apiClient();
$redirect_url = HTTP_SERVER . 'index.php?route=easycheck/checkout';
$client->setClientId('702107489335-fsutq69eq4turib43ksldj8t59dsckul.apps.googleusercontent.com');
$client->setClientSecret('vvNUGsKFe3_pA8aK4w-LysBS');
$client->setDeveloperKey('702107489335-fsutq69eq4turib43ksldj8t59dsckul.apps.googleusercontent.com');
$client->setRedirectUri($redirect_url);
$client->setApprovalPrompt(false);
$oauth2 = new apiOauth2Service($client);
$data['client'] = $client;
$url = $client->createAuthUrl();
$data['url'] = $url;
if (isset($this->request->get['code'])) {
$client->authenticate();
$info = $oauth2->userinfo->get();
if (isset($info['given_name']) && $info['given_name'] != "") {
$name = $info['given_name'];
} else {
$name = $info['name'];
}
$user_table = array('firstname' => $name, 'lastname' => $info['family_name'], 'email' => $info['email'], 'telephone' => '', 'fax' => '', 'password' => substr(md5(uniqid(rand(), true)), 0, 9), 'company' => '', 'company_id' => '', 'tax_id' => '', 'address_1' => '', 'address_2' => '', 'city' => '', 'postcode' => '', 'country_id' => '', 'zone_id' => '', 'customer_group_id' => 1, 'status' => 1, 'approved' => 1);
$this->load->model('account/customer');
//getting customer info if already exists
$users_check = $this->model_account_customer->getCustomerByEmail($info['email']);
//adding customer if new
if (empty($users_check)) {
$this->model_account_customer->addFacebookGoogleCustomer($user_table);
}
$users_check = $this->model_account_customer->getCustomerByEmail($info['email']);
//loging in the customer
$users_pass = $this->customer->login($info['email'], '', true);
$this->session->data['customer_id'] = $users_check['customer_id'];
if ($users_pass == true) {
echo '<script>window.opener.location.href ="' . $redirect_url . '"; window.close();</script>';
} else {
echo '<script>window.opener.location.href ="' . $redirect_url . '"; window.close();</script>';
}
}
///////////////////////facebook & google login start////////////////////////////////
unset($this->session->data['guest']);
unset($this->session->data['payment_address']);
unset($this->session->data['shipping_address']);
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/easycheck/auth.tpl')) {
return $this->load->view($this->config->get('config_template') . '/template/easycheck/auth.tpl', $data);
}
}
示例12: 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) {
}
}
示例13: apiClient
<?php
require_once 'google-api-php-client/src/apiClient.php';
require_once 'google-api-php-client/src/contrib/apiPlusService.php';
session_start();
$client = new apiClient();
$client->setApplicationName("Google+ PHP Starter Application");
//*********** Replace with Your API Credentials **************
$client->setClientId('312021842419-ad2m0g33mbe862eapkl19qpbnd5mfhag.apps.googleusercontent.com');
$client->setClientSecret('9efxIU0KSGb6m2QTqcUew0eG');
$client->setRedirectUri('http://localhost/samples/php/social/google/googleplus-source/');
$client->setDeveloperKey('AIzaSyC8Y8HuCv44VAbUO8uvlDhK_NobMS7bwdo');
//************************************************************
$client->setScopes(array('https://www.googleapis.com/auth/plus.me'));
$plus = new apiPlusService($client);
echo '<pre>';
print_r($_SESSION);
echo '</pre>';
if (isset($_REQUEST['logout'])) {
unset($_SESSION['access_token']);
setcookie('token', "", time() - 3600);
}
if (isset($_GET['code'])) {
$client->authenticate();
$_SESSION['access_token'] = $client->getAccessToken();
header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
}
if (isset($_SESSION['access_token'])) {
$client->setAccessToken($_SESSION['access_token']);
//json decode the session token and save it in a variable as object
$sessionToken = json_decode($_SESSION['access_token']);
示例14: die
<?php
require_once 'google-api-php-client/src/apiClient.php';
require_once 'google-api-php-client/src/contrib/apiPlusService.php';
$configFile = file_get_contents('Class/my_config.properties');
preg_match_all("/\n([^=]*)=(.*)/", $configFile, $config);
$link = mysql_connect($config[2][1], $config[2][2], $config[2][3]);
mysql_select_db('bloganalysis');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_query("set wait_timeout = 7200");
$client = new apiClient();
//$client->setUseObjects(true);
$client->setDeveloperKey('');
$service = new apiPlusService($client);
while (1) {
$sql = "SELECT plusID FROM author WHERE plusID is not null and blogs = '' LIMIT 10";
$result = mysql_query($sql);
if (mysql_num_rows($result) < 10) {
sleep(60);
continue;
}
while ($row = mysql_fetch_assoc($result)) {
//echo "\n({$row['plusID']}) : ";
try {
$plus = $service->people->get($row['plusID']);
} catch (Exception $e) {
echo $e->getCode();
if ($e->getCode() == 403) {
die('die');
示例15: 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);