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


PHP Preferences::getStravaWriteScope方法代码示例

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


在下文中一共展示了Preferences::getStravaWriteScope方法的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) {
//.........这里部分代码省略.........
开发者ID:JoanMcGalliard,项目名称:EddingtonAndMore,代码行数:101,代码来源:MainPage.php


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