本文整理汇总了PHP中gapi::authenticateUser方法的典型用法代码示例。如果您正苦于以下问题:PHP gapi::authenticateUser方法的具体用法?PHP gapi::authenticateUser怎么用?PHP gapi::authenticateUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gapi
的用法示例。
在下文中一共展示了gapi::authenticateUser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
}
if (!isset($google['password']) || !$google['password']) {
$ga_errors[2] = "Please enter your analytics password";
}
if (!isset($google['profile']) || !$google['profile']) {
$ga_errors[3] = "Please enter your analytics Profile ID";
} elseif (!is_numeric($google['profile'])) {
$ga_errors[3] = "Profile ID must be numeric";
}
if (!isset($google['tracking']) || !$google['tracking']) {
$ga_errors[4] = "Please enter your analytics Tracking ID";
}
if (!count($ga_errors)) {
require_once "../includes/gapi.class.php";
$ga = new gapi($google['username'], $google['password']);
$check = $ga->authenticateUser($google['username'], $google['password']);
if ($check) {
try {
$res = $ga->requestReportData($google['profile'], array('country'), array('pageviews', 'visits'), array("-visits"), null, date("Y-m-d"), date("Y-m-d"));
$settings->addSetting("analytics", json_encode($google));
$ga_success = true;
} catch (Exception $e) {
$ga_errors[3] = "Invalid Profile ID";
}
} else {
$ga_errors[1] = "Can't authenticate";
}
}
}
} else {
$google = $settings->getSetting("analytics", true);
示例2: authenticateUser
/**
* Authenticate Google Account with Google
*
* @param String $email
* @param String $password
*/
protected function authenticateUser($email, $password)
{
try {
return parent::authenticateUser($email, $password);
} catch (Exception $e) {
throw new dmGapiException('GAPI: Failed to authenticate with email ' . $email . '. Please configure email and password in the admin configuration panel');
}
}
示例3: date
$from = date("Y-m-d", strtotime("29 days ago"));
} else {
$from = $_GET['from'];
}
if (!isset($_GET['to']) || !$_GET['to']) {
$to = date("Y-m-d");
} else {
$to = $_GET['to'];
}
if (!isset($_GET['report_type'])) {
$report_type = "country";
} else {
$report_type = $_GET['report_type'];
}
$ga = new gapi($account->username, $account->password);
$check = $ga->authenticateUser($account->username, $account->password);
if ($check) {
if ($report_type == "country") {
$res = $ga->requestReportData($account->profile, array('country'), array('pageviews', 'visits'), array("-visits"), null, $from, $to);
$data = array();
if (count($res)) {
foreach ($res as $key => $val) {
$data[] = array("label" => $val->dimensions['country'], "data" => $val->metrics['visits']);
if (count($data) >= 12) {
break;
}
}
}
} elseif ($report_type == "daily") {
$res = $ga->requestReportData($account->profile, array('date'), array('pageviews', 'visits'), array("date"), null, $from, $to);
$data_pv = array();