本文整理汇总了PHP中Preferences::clear方法的典型用法代码示例。如果您正苦于以下问题:PHP Preferences::clear方法的具体用法?PHP Preferences::clear怎么用?PHP Preferences::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preferences
的用法示例。
在下文中一共展示了Preferences::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
private function setup()
{
global $scratchDirectory, $workingEmailAddress;
$this->here = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['SCRIPT_NAME']}";
$state = null;
$this->start_date = null;
$this->end_date = null;
if (isset($_POST["start_date"]) && $_POST["start_date"] != '') {
$this->start_date = strtotime($_POST["start_date"]);
}
if (isset($_POST["end_date"]) && $_POST["end_date"] != "") {
$this->end_date = strtotime($_POST["end_date"] . " 23:59:59");
}
if (array_key_exists("tz", $_POST)) {
$this->preferences->setTimezone($_POST["tz"]);
}
if (array_key_exists("main_form", $_POST)) {
$this->preferences->setSplitRides(array_key_exists("split_rides", $_POST));
if (array_key_exists("elevation_units", $_POST)) {
$this->preferences->setMclUseFeet(true);
$this->myCyclingLog->setUseFeetForElevation(true);
} else {
$this->preferences->setMclUseFeet(false);
$this->myCyclingLog->setUseFeetForElevation(false);
}
}
if (array_key_exists("clear_cookies", $_POST)) {
$this->preferences->clear();
unset($_GET["code"]);
unset($_GET["state"]);
}
$this->myCyclingLog->setUseFeetForElevation($this->preferences->getMclUseFeet());
$this->endomondo->setSplitOvernightRides($this->preferences->getSplitRides());
$this->rideWithGps->setSplitOvernightRides($this->preferences->getSplitRides());
$this->strava->setSplitOvernightRides($this->preferences->getSplitRides());
$this->strava->setWriteScope($this->preferences->getStravaWriteScope());
if (array_key_exists("login_mcl", $_POST)) {
$mcl_username = $_POST['username'];
$mcl_password = $_POST['password'];
$auth = base64_encode("{$mcl_username}:{$mcl_password}");
$this->myCyclingLog->setAuth("{$auth}");
if ($this->myCyclingLog->isConnected()) {
$this->preferences->setMclAuth($auth);
$this->preferences->setMclUsername($_POST['username']);
} else {
$this->error_message = "There was a problem connecting to MyCyclingLog, please try again";
}
} else {
if ($this->preferences->getMclAuth()) {
$this->myCyclingLog->setAuth($this->preferences->getMclAuth());
}
}
if (array_key_exists("login_endo", $_POST)) {
$endo_username = $_POST['username'];
$endo_password = $_POST['password'];
$auth = $this->endomondo->connect($endo_username, $endo_password);
if ($this->endomondo->isConnected()) {
$this->preferences->setEndoAuth($auth);
} else {
$this->error_message = "There was a problem connecting to Endomondo, please try again.<br>(" . $this->endomondo->getError() . ")";
}
} else {
if ($this->preferences->getEndoAuth() != null) {
$this->endomondo->setAuth($this->preferences->getEndoAuth());
}
}
if (array_key_exists("login_rwgps", $_POST)) {
$rwgps_username = $_POST['username'];
$rwgps_password = $_POST['password'];
$auth = $this->rideWithGps->connect($rwgps_username, $rwgps_password);
if ($this->rideWithGps->isConnected()) {
$this->preferences->setRwgpsAuth($auth);
} else {
$this->error_message = "There was a problem connecting to RideWithGps, please try again.<br>(" . $this->rideWithGps->getError() . ")";
}
} else {
if ($this->preferences->getRwgpsAuth() != null) {
$this->rideWithGps->setAuth($this->preferences->getRwgpsAuth());
}
}
if (array_key_exists("state", $_GET)) {
if (!array_key_exists("error", $_GET) && array_key_exists("code", $_GET)) {
$code = $_GET["code"];
$token = $this->strava->setAccessTokenFromCode($code);
if ($this->strava->isConnected()) {
$this->strava->setWriteScope($_GET["state"] == "write");
$this->preferences->setStravaWriteScope($this->strava->writeScope());
$this->preferences->setStravaAccessToken($token);
}
} else {
$this->error_message .= 'There was a problem connecting to strava, please try again: ' . $_GET["error"] . " ";
}
if ($this->strava->getError()) {
$this->error_message .= 'There was a problem connecting to strava, please try again: ' . $this->strava->getError() . " ";
}
unset($_GET["state"]);
unset($_GET["code"]);
unset($_GET["error"]);
} else {
if ($this->preferences->getStravaAccessToken() != null) {
//.........这里部分代码省略.........