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


PHP Hybrid_Logger类代码示例

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


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

示例1: loginFinish

 /**
  * finish login step 
  */
 function loginFinish()
 {
     // in case we get error_reason=user_denied&error=access_denied
     if (isset($_REQUEST['error']) && $_REQUEST['error'] == "access_denied") {
         throw new Exception("Authentification failed! The user denied your request.", 5);
     }
     if (!isset($_REQUEST['code']) || !isset($_REQUEST['state'])) {
         throw new Exception("Authentification failed! The user denied your request.", 5);
     }
     $code = $_REQUEST['code'];
     $state = $_REQUEST['state'];
     $user_id = 0;
     // try to get the UID of the connected user from fb, should be > 0
     try {
         $user_id = $this->api->getUser($code, $state, $this->endpoint);
     } catch (Exception $e) {
         Hybrid_Logger::error("Authentification failed! Renren returned an invalide user id.");
         Hybrid_Logger::error("Exception:" . $e->getMessage(), $e);
     }
     if (!$user_id) {
         throw new Exception("Authentification failed! {$this->providerId} returned an invalide user id.", 5);
     }
     // set user as logged in
     $this->setUserConnected();
     // store access token
     //$this->token( "access_token", $this->api->getAccessToken() );
 }
开发者ID:pingwangcs,项目名称:51zhaohu,代码行数:30,代码来源:Renren.php

示例2: authenticate

 private function authenticate($code)
 {
     $params = array("client_id" => $this->api->client_id, "client_secret" => $this->api->client_secret, "grant_type" => "authorization_code", "redirect_uri" => $this->api->redirect_uri, "code" => $code);
     $url = $this->api->token_url;
     $url = $url . (strpos($url, '?') ? '&' : '?') . http_build_query($params);
     $response = $this->api->api($url, 'POST');
     Hybrid_Logger::debug("authenticate with url: {$url}");
     if (!$response || !isset($response->access_token)) {
         throw new Exception("The Authorization Service has return: " . $response->error);
     }
     if (isset($response->access_token)) {
         $this->api->access_token = $response->access_token;
     }
     if (isset($response->refresh_token)) {
         $this->api->refresh_token = $response->refresh_token;
     }
     if (isset($response->expires_in)) {
         $this->api->access_token_expires_in = $response->expires_in;
     }
     // calculate when the access token expire
     if (isset($response->expires_in)) {
         $this->api->access_token_expires_at = time() + $response->expires_in;
     }
     return $response;
 }
开发者ID:hybridauth,项目名称:hybridauth,代码行数:25,代码来源:Weibo.php

示例3: loginBegin

 /**
  * begin login step
  * 
  * simply call Facebook::require_login(). 
  */
 function loginBegin()
 {
     $parameters = array("scope" => $this->scope, "redirect_uri" => $this->endpoint, "display" => "page");
     $optionals = array("scope", "redirect_uri", "display", "auth_type");
     foreach ($optionals as $parameter) {
         if (isset($this->config[$parameter]) && !empty($this->config[$parameter])) {
             $parameters[$parameter] = $this->config[$parameter];
             //If the auth_type parameter is used, we need to generate a nonce and include it as a parameter
             if ($parameter == "auth_type") {
                 $nonce = md5(uniqid(mt_rand(), true));
                 $parameters['auth_nonce'] = $nonce;
                 Hybrid_Auth::storage()->set('fb_auth_nonce', $nonce);
             }
         }
     }
     if (isset($this->config['force']) && $this->config['force'] === true) {
         $parameters['auth_type'] = 'reauthenticate';
         $parameters['auth_nonce'] = md5(uniqid(mt_rand(), true));
         Hybrid_Auth::storage()->set('fb_auth_nonce', $parameters['auth_nonce']);
     }
     // get the login url
     $url = $this->api->getLoginUrl($parameters);
     if (!$url) {
         Hybrid_Logger::error("Hybrid_Providers_Facebook: url is empty!");
     }
     // redirect to facebook
     Hybrid_Auth::redirect($url);
 }
开发者ID:Denisof,项目名称:opencart,代码行数:33,代码来源:Facebook.php

示例4: loginFinish

 /**
  * finish login step 
  */
 function loginFinish()
 {
     // in case we get error_reason=user_denied&error=access_denied
     if (isset($_REQUEST['error']) && $_REQUEST['error'] == "access_denied") {
         Hybrid_Logger::debug("QQ access_denied");
         throw new Exception("Authentification failed! The user denied your request.", 5);
     }
     if (!isset($_REQUEST['code']) || !isset($_REQUEST['state'])) {
         Hybrid_Logger::debug("QQ no code or state");
         throw new Exception("Authentification failed! The user denied your request.", 5);
     }
     $code = $_REQUEST['code'];
     $state = $_REQUEST['state'];
     // try to get the UID of the connected user from fb, should be > 0
     try {
         $access_token = $this->api->qq_callback();
         $openid = $this->api->get_openid();
         Hybrid_Logger::debug("Get QQ openid: {$openid}");
     } catch (Exception $e) {
         Hybrid_Logger::error("Authentification failed for {$this->providerId} ");
         Hybrid_Logger::error("Exception:" . $e->getMessage(), $e);
     }
     if (!$access_token || !$openid) {
         throw new Exception("Authentification failed! {$this->providerId} returned invalide access token or openid", 5);
     }
     // set user as logged in
     $this->setUserConnected();
     // store access token
     //$this->token( "access_token", $this->api->getAccessToken() );
 }
开发者ID:pingwangcs,项目名称:51zhaohu,代码行数:33,代码来源:QQ.php

示例5: request

 private function request($url, $params = false, $type = "GET")
 {
     Hybrid_Logger::info("Enter OAuth2Client::request( {$url} )");
     Hybrid_Logger::debug("OAuth2Client::request(). dump request params: ", serialize($params));
     if ($type == "GET") {
         $url = $url . (strpos($url, '?') ? '&' : '?') . http_build_query($params, '', '&');
     }
     $this->http_info = array();
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_TIMEOUT, $this->api->curl_time_out);
     curl_setopt($ch, CURLOPT_USERAGENT, $this->api->curl_useragent);
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->api->curl_connect_time_out);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->api->curl_ssl_verifypeer);
     curl_setopt($ch, CURLOPT_HTTPHEADER, $this->api->curl_header);
     if ($this->api->curl_proxy) {
         curl_setopt($ch, CURLOPT_PROXY, $this->api->curl_proxy);
     }
     if ($type == "POST") {
         curl_setopt($ch, CURLOPT_POST, 1);
         if ($params) {
             curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
         }
     }
     $response = curl_exec($ch);
     Hybrid_Logger::debug("OAuth2Client::request(). dump request info: ", serialize(curl_getinfo($ch)));
     Hybrid_Logger::debug("OAuth2Client::request(). dump request result: ", serialize($response));
     $this->http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     $this->http_info = array_merge($this->http_info, curl_getinfo($ch));
     curl_close($ch);
     return $response;
 }
开发者ID:leloulight,项目名称:epetitions,代码行数:33,代码来源:Odnoklassniki.php

示例6: clearError

 /**
  * clear the last error
  */
 public static function clearError()
 {
     Hybrid_Logger::info("Enter Hybrid_Error::clearError()");
     Hybrid_Auth::storage()->delete("hauth_session.error.status");
     Hybrid_Auth::storage()->delete("hauth_session.error.message");
     Hybrid_Auth::storage()->delete("hauth_session.error.code");
     Hybrid_Auth::storage()->delete("hauth_session.error.trace");
     Hybrid_Auth::storage()->delete("hauth_session.error.previous");
 }
开发者ID:mafiu,项目名称:listapp,代码行数:12,代码来源:Error.php

示例7: getUserProfile

 function getUserProfile()
 {
     $profile = $this->api->api('me/', 'GET', array('fields' => 'id,username,first_name,last_name,counts,image'));
     if (!isset($profile->data->id)) {
         throw new Exception("User profile request failed! {$this->providerId} returned an invalid response:" . Hybrid_Logger::dumpData($profile), 6);
     }
     $data = $profile->data;
     $this->user->profile->identifier = $data->id;
     $this->user->profile->firstName = $data->first_name;
     $this->user->profile->lastName = $data->last_name;
     $this->user->profile->displayName = $data->username;
     if (isset($data->image->{'60x60'})) {
         $this->user->profile->photoURL = $data->image->{'60x60'}->url;
     }
     return $this->user->profile;
 }
开发者ID:hybridauth,项目名称:hybridauth,代码行数:16,代码来源:Pinterest.php

示例8: __construct

 public function __construct($inc)
 {
     Hybrid_Logger::debug("Construct QQ Recorder");
     $this->error = new ErrorCase();
     //-------读取配置文件
     //$incFileContents = file(ROOT."comm/inc.php");
     //$incFileContents = $incFileContents[1];
     //$this->inc = json_decode($incFileContents);
     $this->inc = $inc;
     if (empty($this->inc)) {
         $this->error->showError("20001");
     }
     if (empty($_SESSION['QC_userData'])) {
         self::$data = array();
     } else {
         self::$data = $_SESSION['QC_userData'];
     }
 }
开发者ID:pingwangcs,项目名称:51zhaohu,代码行数:18,代码来源:Recorder.class.php

示例9: getUserProfile

 /**
  * {@inheritdoc}
  */
 function getUserProfile()
 {
     $data = $this->api->api("users/self", "GET", Hybrid_Providers_Foursquare::$apiVersion);
     if (!isset($data->response->user->id)) {
         throw new Exception("User profile request failed! {$this->providerId} returned an invalid response:" . Hybrid_Logger::dumpData($data), 6);
     }
     $data = $data->response->user;
     $this->user->profile->identifier = $data->id;
     $this->user->profile->firstName = $data->firstName;
     $this->user->profile->lastName = $data->lastName;
     $this->user->profile->displayName = $this->buildDisplayName($this->user->profile->firstName, $this->user->profile->lastName);
     $this->user->profile->photoURL = $this->buildPhotoURL($data->photo->prefix, $data->photo->suffix);
     $this->user->profile->profileURL = "https://www.foursquare.com/user/" . $data->id;
     $this->user->profile->gender = $data->gender;
     $this->user->profile->city = $data->homeCity;
     $this->user->profile->email = $data->contact->email;
     $this->user->profile->emailVerified = $data->contact->email;
     return $this->user->profile;
 }
开发者ID:mif32,项目名称:2_d_social_login_lite,代码行数:22,代码来源:foursquare.php

示例10: __construct

 function __construct()
 {
     if (array_key_exists('debug_mode', Hybrid_Auth::$config)) {
         Hybrid_Logger::$enabled = Hybrid_Auth::$config['debug_mode'];
     }
     if (array_key_exists('debug_file', Hybrid_Auth::$config)) {
         Hybrid_Logger::$log_file = Hybrid_Auth::$config['debug_file'];
     }
     if (array_key_exists('debug_level', Hybrid_Auth::$config)) {
         Hybrid_Logger::$log_level = Hybrid_Auth::$config['debug_level'];
     }
     // if debug mode is set to true, then check for the writable log file
     if (Hybrid_Logger::$enabled) {
         if (!file_exists(Hybrid_Logger::$log_file)) {
             throw new Exception("'debug_mode' is set to 'true', but no log file path 'debug_file' given.", 1);
         }
         if (!is_writable(Hybrid_Logger::$log_file)) {
             throw new Exception("'debug_mode' is set to 'true', but the given log file path 'debug_file' is not a writable file.", 1);
         }
     }
 }
开发者ID:pingwangcs,项目名称:51zhaohu,代码行数:21,代码来源:Logger.php

示例11: getUserProfile

 /**
  * {@inheritdoc}
  */
 public function getUserProfile()
 {
     $data = $this->api->get("me");
     if (!isset($data->id)) {
         throw new Exception("User profile request failed! {$this->providerId} returned an invalid response: " . Hybrid_Logger::dumpData($data), 6);
     }
     $this->user->profile->identifier = property_exists($data, 'id') ? $data->id : "";
     $this->user->profile->firstName = property_exists($data, 'first_name') ? $data->first_name : "";
     $this->user->profile->lastName = property_exists($data, 'last_name') ? $data->last_name : "";
     $this->user->profile->displayName = property_exists($data, 'name') ? trim($data->name) : "";
     $this->user->profile->gender = property_exists($data, 'gender') ? $data->gender : "";
     //wl.basic
     $this->user->profile->profileURL = property_exists($data, 'link') ? $data->link : "";
     //wl.emails
     $this->user->profile->email = property_exists($data, 'emails') ? $data->emails->account : "";
     $this->user->profile->emailVerified = property_exists($data, 'emails') ? $data->emails->account : "";
     //wl.birthday
     $this->user->profile->birthDay = property_exists($data, 'birth_day') ? $data->birth_day : "";
     $this->user->profile->birthMonth = property_exists($data, 'birth_month') ? $data->birth_month : "";
     $this->user->profile->birthYear = property_exists($data, 'birth_year') ? $data->birth_year : "";
     return $this->user->profile;
 }
开发者ID:kalypso63,项目名称:social_auth,代码行数:25,代码来源:Live.php

示例12: getUserProfile

 /**
  * {@inheritdoc}
  */
 function getUserProfile()
 {
     $response = json_decode(json_encode($this->api->api($this->api->userinfo_url)), true);
     //$this->user->profile->identifier = ($response["user"]) ? $response["user"]["userid"] : (($response, "userid")) ? $response["userid"] : "";
     if ($response["user"]) {
         $this->user->profile->identifier = $response["user"] ? $response["user"]["userid"] : "";
         $this->user->profile->firstName = $response["user"]["name"] ? $this->get_name_part($response["user"]["name"], 0) : "";
         $this->user->profile->lastName = $response["user"]["name"] ? $this->get_name_part($response["user"]["name"], 1) : "";
         $this->user->profile->displayName = $response["user"]["name"] ? $response["user"]["name"] : "";
         $this->user->profile->photoURL = $response["user"]["profilephoto"] ? "https://api.dataporten.no/userinfo/v1/user/media/" . $response["user"]["profilephoto"] : "";
         $this->user->profile->email = $response["user"]["email"] ? $response["user"]["email"] : "";
         $this->user->profile->emailVerified = $response["user"]["email"] ? $response["user"]["email"] : "";
     } else {
         if ($response["name"]) {
             $this->user->profile->identifier = $response["userid"] ? $response["userid"] : "";
             $this->user->profile->firstName = $response["name"] ? $this->get_name_part($response["name"], 0) : "";
             $this->user->profile->lastName = $response["name"] ? $this->get_name_part($response["name"], 1) : "";
             $this->user->profile->displayName = $response["name"] ? $response["name"] : "";
         } else {
             throw new Exception("User profile request failed! {$this->providerId} returned an invalid response:" . Hybrid_Logger::dumpData($response), 6);
         }
     }
     return $this->user->profile;
 }
开发者ID:hybridauth,项目名称:hybridauth,代码行数:27,代码来源:Dataporten.php

示例13: setUserUnconnected

 /**
  * set user to unconnected 
  */
 public function setUserUnconnected()
 {
     Hybrid_Logger::info("Enter [{$this->providerId}]::setUserUnconnected()");
     Hybrid_Auth::storage()->set("hauth_session.{$this->providerId}.is_logged_in", 0);
 }
开发者ID:Lavoaster,项目名称:PVLive,代码行数:8,代码来源:Provider_Model.php

示例14: redirect

 /**
  * Utility function, redirect to a given URL with php header or using javascript location.href
  *
  * @param string $url  URL to redirect to
  * @param string $mode PHP|JS
  */
 public static function redirect($url, $mode = "PHP")
 {
     Hybrid_Logger::info("Enter Hybrid_Auth::redirect( {$url}, {$mode} )");
     // Ensure session is saved before sending response, see https://github.com/symfony/symfony/pull/12341
     if (PHP_VERSION_ID >= 50400 && PHP_SESSION_ACTIVE === session_status() || PHP_VERSION_ID < 50400 && isset($_SESSION) && session_id()) {
         session_write_close();
     }
     if ($mode == "PHP") {
         header("Location: {$url}");
     } elseif ($mode == "JS") {
         echo '<html>';
         echo '<head>';
         echo '<script type="text/javascript">';
         echo 'function redirect(){ window.top.location.href="' . $url . '"; }';
         echo '</script>';
         echo '</head>';
         echo '<body onload="redirect()">';
         echo 'Redirecting, please wait...';
         echo '</body>';
         echo '</html>';
     }
     die;
 }
开发者ID:kalypso63,项目名称:social_auth,代码行数:29,代码来源:Auth.php

示例15: authInit

 public static function authInit()
 {
     if (!Hybrid_Endpoint::$initDone) {
         Hybrid_Endpoint::$initDone = TRUE;
         # Init Hybrid_Auth
         try {
             require_once realpath(dirname(__FILE__)) . "/Storage.php";
             $storage = new Hybrid_Storage();
             // Check if Hybrid_Auth session already exist
             if (!$storage->config("CONFIG")) {
                 header("HTTP/1.0 404 Not Found");
                 die("You cannot access this page directly.");
             }
             Hybrid_Auth::initialize($storage->config("CONFIG"));
         } catch (Exception $e) {
             Hybrid_Logger::error("Endpoint: Error while trying to init Hybrid_Auth");
             header("HTTP/1.0 404 Not Found");
             die("Oophs. Error!");
         }
     }
 }
开发者ID:nickolanack,项目名称:joomla-hs-users,代码行数:21,代码来源:Endpoint.php


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