本文整理汇总了PHP中Hybrid_Logger::info方法的典型用法代码示例。如果您正苦于以下问题:PHP Hybrid_Logger::info方法的具体用法?PHP Hybrid_Logger::info怎么用?PHP Hybrid_Logger::info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hybrid_Logger
的用法示例。
在下文中一共展示了Hybrid_Logger::info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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");
}
示例3: request
private function request($url, $params = false, $type = "GET")
{
$params = http_build_query($params, '', '&');
Hybrid_Logger::info("Enter OAuth2Client::request( {$url} )");
Hybrid_Logger::debug("OAuth2Client::request(). dump request params: ", $params);
if ($type == "GET") {
$url = $url . (strpos($url, '?') ? '&' : '?') . $params;
}
$this->http_info = array();
$ch = curl_init();
$headers = $this->curl_header;
if ($type == "POST") {
//$headers[] = 'Content-Type: application/x-www-form-urlencoded';
}
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, $this->curl_time_out);
curl_setopt($ch, CURLOPT_USERAGENT, $this->curl_useragent);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->curl_connect_time_out);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->curl_ssl_verifypeer);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $this->curl_ssl_verifyhost);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_USERPWD, $this->client_id . ':' . $this->client_secret);
// logging
if ($this->curl_log !== null) {
$fp = fopen($this->curl_log, 'a');
curl_setopt($ch, CURLOPT_STDERR, $fp);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
}
if ($this->curl_proxy) {
curl_setopt($ch, CURLOPT_PROXY, $this->curl_proxy);
}
if ($type == "POST") {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
}
$response = curl_exec($ch);
if ($this->curl_log !== null) {
fclose($fp);
}
if ($response === FALSE) {
Hybrid_Logger::error("OAuth2Client::request(). curl_exec error: ", curl_error($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;
}
示例4: processAuthDone
/**
* define:endpoint step 3.1 and 3.2
*/
public static function processAuthDone()
{
Hybrid_Endpoint::authInit();
$provider_id = trim(strip_tags(Hybrid_Endpoint::$request["hauth_done"]));
$hauth = Hybrid_Auth::setup($provider_id);
if (!$hauth) {
Hybrid_Logger::error("Endpoint: Invalide parameter on hauth_done!");
$hauth->adapter->setUserUnconnected();
header("HTTP/1.0 404 Not Found");
die("Invalide parameter! Please return to the login page and try again.");
}
try {
Hybrid_Logger::info("Endpoint: call adapter [{$provider_id}] loginFinish() ");
$hauth->adapter->loginFinish();
} catch (Exception $e) {
Hybrid_Logger::error("Exception:" . $e->getMessage(), $e);
Hybrid_Error::setError($e->getMessage(), $e->getCode(), $e->getTraceAsString(), $e);
$hauth->adapter->setUserUnconnected();
}
Hybrid_Logger::info("Endpoint: job done. retrun to callback url.");
$hauth->returnToCallbackUrl();
die;
}
示例5: str_replace
// with /index.php?hauth.done={provider}?{args}...
if (strrpos($_SERVER["QUERY_STRING"], '?')) {
$_SERVER["QUERY_STRING"] = str_replace("?", "&", $_SERVER["QUERY_STRING"]);
parse_str($_SERVER["QUERY_STRING"], $_REQUEST);
}
$provider_id = trim(strip_tags($_REQUEST["hauth_done"]));
$hauth = Hybrid_Auth::setup($provider_id);
if (!$hauth) {
Hybrid_Logger::error("Endpoint: Invalide parameter on hauth_done!");
$hauth->adapter->setUserUnconnected();
header("HTTP/1.0 404 Not Found");
die("Invalide parameter! Please return to the login page and try again.");
}
try {
Hybrid_Logger::info("Endpoint: call adapter [{$provider_id}] loginFinish() ");
$hauth->adapter->loginFinish();
} catch (Exception $e) {
Hybrid_Logger::error("Exception:" . $e->getMessage(), $e);
Hybrid_Error::setError($e->getMessage(), $e->getCode(), $e->getTraceAsString(), $e);
$hauth->adapter->setUserUnconnected();
}
Hybrid_Logger::info("Endpoint: job done. retrun to callback url.");
$hauth->returnToCallbackUrl();
die;
}
} else {
# Else,
# We advertise our XRDS document, something supposed to be done from the Realm URL page
echo str_replace("{X_XRDS_LOCATION}", Hybrid_Auth::getCurrentUrl(false) . "?get=openid_xrds&v=" . Hybrid_Auth::$version, file_get_contents(dirname(__FILE__) . "/Hybrid/resources/openid_realm.html"));
die;
}
示例6: 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);
}
示例7: 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;
}
示例8: request
/**
* Make http request
*/
function request($url, $method, $postfields = NULL, $auth_header = NULL, $content_type = NULL)
{
Hybrid_Logger::info("Enter OAuth1Client::request( {$method}, {$url} )");
Hybrid_Logger::debug("OAuth1Client::request(). dump post fields: ", serialize($postfields));
$this->http_info = array();
$ci = curl_init();
/* Curl settings */
curl_setopt($ci, CURLOPT_USERAGENT, $this->curl_useragent);
curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->curl_connect_time_out);
curl_setopt($ci, CURLOPT_TIMEOUT, $this->curl_time_out);
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ci, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->curl_ssl_verifypeer);
curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
curl_setopt($ci, CURLOPT_HEADER, FALSE);
if ($content_type) {
curl_setopt($ci, CURLOPT_HTTPHEADER, array('Expect:', "Content-Type: {$content_type}"));
}
if ($this->curl_proxy) {
curl_setopt($ci, CURLOPT_PROXY, $this->curl_proxy);
}
switch ($method) {
case 'POST':
curl_setopt($ci, CURLOPT_POST, TRUE);
if (!empty($postfields)) {
curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
}
if (!empty($auth_header) && $this->curl_auth_header) {
curl_setopt($ci, CURLOPT_HTTPHEADER, array('Content-Type: application/atom+xml', $auth_header));
}
break;
case 'DELETE':
curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE');
if (!empty($postfields)) {
$url = "{$url}?{$postfields}";
}
}
curl_setopt($ci, CURLOPT_URL, $url);
$response = curl_exec($ci);
if ($response === FALSE) {
Hybrid_Logger::error("OAuth1Client::request(). curl_exec error: ", curl_error($ci));
}
Hybrid_Logger::debug("OAuth1Client::request(). dump request info: ", serialize(curl_getinfo($ci)));
Hybrid_Logger::debug("OAuth1Client::request(). dump request result: ", serialize($response));
$this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
$this->http_info = array_merge($this->http_info, curl_getinfo($ci));
curl_close($ci);
return $response;
}
示例9: 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->curl_time_out);
curl_setopt($ch, CURLOPT_USERAGENT, $this->curl_useragent);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->curl_connect_time_out);
$config = Yii::app()->getModule('hybridauth')->getConfig();
if ($config['proxy']) {
curl_setopt($ch, CURLOPT_PROXYTYPE, 'HTTPS');
curl_setopt($ch, CURLOPT_PROXY, $config['proxy']['url']);
curl_setopt($ch, CURLOPT_PROXYPORT, $config['proxy']['port']);
if ($config['proxy']['user']) {
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $config['proxy']['user'] . ':' . $config['proxy']['password']);
}
//curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_NTLM);
}
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->curl_ssl_verifypeer);
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->curl_header);
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;
}
示例10: processAuthDone
/**
* define:endpoint step 3.1 and 3.2
*/
public static function processAuthDone()
{
Hybrid_Endpoint::authInit();
// Fix a strange behavior when some provider call back ha endpoint
// with /index.php?hauth.done={provider}?{args}...
if (strrpos($_SERVER["QUERY_STRING"], '?')) {
$_SERVER["QUERY_STRING"] = str_replace("?", "&", $_SERVER["QUERY_STRING"]);
parse_str($_SERVER["QUERY_STRING"], Hybrid_Endpoint::$request);
}
$provider_id = trim(strip_tags(Hybrid_Endpoint::$request["hauth_done"]));
$hauth = Hybrid_Auth::setup($provider_id);
if (!$hauth) {
Hybrid_Logger::error("Endpoint: Invalide parameter on hauth_done!");
$hauth->adapter->setUserUnconnected();
header("HTTP/1.0 404 Not Found");
die("Invalide parameter! Please return to the login page and try again.");
}
try {
Hybrid_Logger::info("Endpoint: call adapter [{$provider_id}] loginFinish() ");
$hauth->adapter->loginFinish();
} catch (Exception $e) {
Hybrid_Logger::error("Exception:" . $e->getMessage(), $e);
Hybrid_Error::setError($e->getMessage(), $e->getCode(), $e->getTraceAsString(), $e);
$hauth->adapter->setUserUnconnected();
}
Hybrid_Logger::info("Endpoint: job done. retrun to callback url.");
$hauth->returnToCallbackUrl();
die;
}
示例11: processAuthDone
/**
* Define: endpoint step 3.1 and 3.2
* @return void
* @throws Hybrid_Exception
*/
protected function processAuthDone()
{
$this->authInit();
$provider_id = trim(strip_tags($this->request["hauth_done"]));
$hauth = Hybrid_Auth::setup($provider_id);
if (!$hauth) {
Hybrid_Logger::error("Endpoint: Invalid parameter on hauth_done!");
$hauth->adapter->setUserUnconnected();
throw new Hybrid_Exception("Invalid parameter! Please return to the login page and try again.");
}
try {
Hybrid_Logger::info("Endpoint: call adapter [{$provider_id}] loginFinish() ");
$hauth->adapter->loginFinish();
} catch (Exception $e) {
Hybrid_Logger::error("Exception:" . $e->getMessage(), $e);
Hybrid_Error::setError($e->getMessage(), $e->getCode(), $e->getTraceAsString(), $e->getPrevious());
$hauth->adapter->setUserUnconnected();
}
Hybrid_Logger::info("Endpoint: job done. return to callback url.");
$hauth->returnToCallbackUrl();
die;
}
示例12: processAuthDone
/**
* define:endpoint step 3.1 and 3.2
*/
protected function processAuthDone()
{
$provider_id = trim($this->getProperty('hauth_done'));
$hauth = Hybrid_Auth::setup($provider_id);
if (!$hauth) {
Hybrid_Logger::error("Endpoint: Invalid parameter on hauth_done!");
$hauth->adapter->setUserUnconnected();
header("HTTP/1.0 404 Not Found");
return "Invalid parameter! Please return to the login page and try again.";
}
try {
Hybrid_Logger::info("Endpoint: call adapter [{$provider_id}] loginFinish() ");
$hauth->adapter->loginFinish();
} catch (Exception $e) {
Hybrid_Logger::error("Exception:" . $e->getMessage(), $e);
Hybrid_Error::setError($e->getMessage(), $e->getCode(), $e->getTraceAsString(), $e);
$hauth->adapter->setUserUnconnected();
}
Hybrid_Logger::info("Endpoint: job done. retrun to callback url.");
// Save profile data in session
$profile = $hauth->adapter->getUserProfile();
// Try to get user by social profile
/*$q = $this->modx->newQuery('modUser');
$q->innerJoin('modUserProfile', 'Profile');
$q->innerJoin('modHybridAuthUserProfile', 'SocialProfile');
$q->innerJoin('modHybridAuthProvider', 'Provider', "Provider.id=SocialProfile.provider");
$q->where(array(
"SocialProfile.identifier" => $profile->identifier,
"Provider.name" => $provider,
"modUser.active" => 1,
"Profile.blocked" => 0,
));
$q->limit(1);
if($user = $this->modx->getObject('modUser', $q)){
$user->addSessionContext($this->modx->context->key);
$redirectTo = $this->modx->getOption('site_url');
$this->modx->sendRedirect($redirectTo);
return;
}*/
// else
$_SESSION['social_profile'] = array('provider' => $provider_id, 'profile' => $this->modx->error->toArray($profile));
//$q->prepare();
//$this->modx->log(1, $q->toSQL());
// else
$hauth->returnToCallbackUrl();
return '';
}
示例13: processAuthDone
/**
* define:endpoint step 3.1 and 3.2
*/
protected function processAuthDone()
{
$provider_id = trim($this->getProperty('hauth_done'));
$hauth = Hybrid_Auth::setup($provider_id);
if (!$hauth) {
Hybrid_Logger::error("Endpoint: Invalid parameter on hauth_done!");
$hauth->adapter->setUserUnconnected();
header("HTTP/1.0 404 Not Found");
return "Invalid parameter! Please return to the login page and try again.";
}
try {
Hybrid_Logger::info("Endpoint: call adapter [{$provider_id}] loginFinish() ");
$hauth->adapter->loginFinish();
} catch (Exception $e) {
Hybrid_Logger::error("Exception:" . $e->getMessage(), $e);
Hybrid_Error::setError($e->getMessage(), $e->getCode(), $e->getTraceAsString(), $e);
$hauth->adapter->setUserUnconnected();
}
Hybrid_Logger::info("Endpoint: job done. retrun to callback url.");
// Save profile data in session
$profile = $hauth->adapter->getUserProfile();
// else
$_SESSION['social_profile'] = array('provider' => $provider_id, 'profile' => $this->modx->error->toArray($profile));
//$q->prepare();
//$this->modx->log(1, $q->toSQL());
// else
$hauth->returnToCallbackUrl();
return '';
}
示例14: 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 . "?" . http_build_query($params);
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, $this->curl_time_out);
curl_setopt($ch, CURLOPT_USERAGENT, $this->curl_useragent);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->curl_connect_time_out);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->curl_ssl_verifypeer);
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->curl_header);
if ($type == "POST") {
curl_setopt($ch, CURLOPT_POST, 1);
if ($params) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
}
}
$result = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
Hybrid_Logger::debug("OAuth2Client::request(). dump request info: ", serialize($info));
Hybrid_Logger::debug("OAuth2Client::request(). dump request result: ", serialize($result));
return $result;
}
示例15: __call
/**
* handle :
* getUserProfile()
* getUserContacts()
* getUserActivity()
* setUserStatus()
*/
public function __call($name, $arguments)
{
Hybrid_Logger::info("Enter Hybrid_Provider_Adapter::{$name}(), Provider: {$this->id}");
if (!$this->isUserConnected()) {
throw new Exception("User not connected to the provider {$this->id}.", 7);
}
if (!method_exists($this->adapter, $name)) {
throw new Exception("Call to undefined function Hybrid_Providers_{$this->id}::{$name}().");
}
if (count($arguments)) {
return $this->adapter->{$name}($arguments[0]);
} else {
return $this->adapter->{$name}();
}
}