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


PHP common_debug函数代码示例

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


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

示例1: discover

 /**
  * For RFC6415 and HTTP URIs, fetch the host-meta file
  * and look for LRDD templates
  */
 public function discover($uri)
 {
     // This is allowed for RFC6415 but not the 'WebFinger' RFC7033.
     $try_schemes = array('https', 'http');
     $scheme = mb_strtolower(parse_url($uri, PHP_URL_SCHEME));
     switch ($scheme) {
         case 'acct':
             if (!Discovery::isAcct($uri)) {
                 throw new Exception('Bad resource URI: ' . $uri);
             }
             // We can't use parse_url data for this, since the 'host'
             // entry is only set if the scheme has '://' after it.
             list($user, $domain) = explode('@', parse_url($uri, PHP_URL_PATH));
             break;
         case 'http':
         case 'https':
             $domain = mb_strtolower(parse_url($uri, PHP_URL_HOST));
             $try_schemes = array($scheme);
             break;
         default:
             throw new Exception('Unable to discover resource descriptor endpoint.');
     }
     foreach ($try_schemes as $scheme) {
         $url = $scheme . '://' . $domain . '/.well-known/host-meta';
         try {
             $response = self::fetchUrl($url);
             $this->xrd->loadString($response->getBody());
         } catch (Exception $e) {
             common_debug('LRDD could not load resource descriptor: ' . $url . ' (' . $e->getMessage() . ')');
             continue;
         }
         return $this->xrd->links;
     }
     throw new Exception('Unable to retrieve resource descriptor links.');
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:39,代码来源:hostmeta.php

示例2: handle

 /**
  * Class handler.
  *
  * @param array $args array of arguments
  *
  * @return void
  */
 function handle($args)
 {
     parent::handle($args);
     $datastore = new ApiStatusNetOAuthDataStore();
     $server = new OAuthServer($datastore);
     $hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
     $server->add_signature_method($hmac_method);
     $atok = $app = null;
     // XXX: Insist that oauth_token and oauth_verifier be populated?
     // Spec doesn't say they MUST be.
     try {
         $req = OAuthRequest::from_request();
         $this->reqToken = $req->get_parameter('oauth_token');
         $this->verifier = $req->get_parameter('oauth_verifier');
         $app = $datastore->getAppByRequestToken($this->reqToken);
         $atok = $server->fetch_access_token($req);
     } catch (Exception $e) {
         common_log(LOG_WARNING, 'API OAuthException - ' . $e->getMessage());
         common_debug(var_export($req, true));
         $code = $e->getCode();
         $this->clientError($e->getMessage(), empty($code) ? 401 : $code, 'text');
         return;
     }
     if (empty($atok)) {
         // Token exchange failed -- log it
         $msg = sprintf('API OAuth - Failure exchanging OAuth request token for access token, ' . 'request token = %s, verifier = %s', $this->reqToken, $this->verifier);
         common_log(LOG_WARNING, $msg);
         // TRANS: Client error given from the OAuth API when the request token or verifier is invalid.
         $this->clientError(_('Invalid request token or verifier.'), 400, 'text');
     } else {
         common_log(LOG_INFO, sprintf("Issued access token '%s' for application %d (%s).", $atok->key, $app->id, $app->name));
         $this->showAccessToken($atok);
     }
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:41,代码来源:apioauthaccesstoken.php

示例3: doPost

 protected function doPost()
 {
     try {
         $request = Subscription_queue::pkeyGet(array('subscriber' => $this->scoped->id, 'subscribed' => $this->target->id));
         if ($request instanceof Subscription_queue) {
             $request->abort();
         }
     } catch (AlreadyFulfilledException $e) {
         common_debug('Tried to cancel a non-existing pending subscription');
     }
     if (GNUsocial::isAjax()) {
         $this->startHTML('text/xml;charset=utf-8');
         $this->elementStart('head');
         // TRANS: Title after unsubscribing from a group.
         $this->element('title', null, _m('TITLE', 'Unsubscribed'));
         $this->elementEnd('head');
         $this->elementStart('body');
         $subscribe = new SubscribeForm($this, $this->target);
         $subscribe->show();
         $this->elementEnd('body');
         $this->endHTML();
         exit;
     }
     common_redirect(common_local_url('subscriptions', array('nickname' => $this->scoped->getNickname())), 303);
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:25,代码来源:cancelsubscription.php

示例4: handle

 function handle($args)
 {
     parent::handle($args);
     if (common_is_real_login()) {
         $this->clientError(_('Already logged in.'));
     } else {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $token = $this->trimmed('token');
             if (!$token || $token != common_session_token()) {
                 $this->showForm(_('There was a problem with your session token. Try again, please.'));
                 return;
             }
             if ($this->arg('create')) {
                 if (!$this->boolean('license')) {
                     $this->showForm(_('You can\'t register if you don\'t agree to the license.'), $this->trimmed('newname'));
                     return;
                 }
                 $this->createNewUser();
             } else {
                 if ($this->arg('connect')) {
                     $this->connectUser();
                 } else {
                     common_debug(print_r($this->args, true), __FILE__);
                     $this->showForm(_('Something weird happened.'), $this->trimmed('newname'));
                 }
             }
         } else {
             $this->tryLogin();
         }
     }
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:31,代码来源:finishopenidlogin.php

示例5: handle

 function handle($args)
 {
     parent::handle($args);
     $secret = common_config('facebook', 'secret');
     $sig = '';
     ksort($_POST);
     foreach ($_POST as $key => $val) {
         if (substr($key, 0, 7) == 'fb_sig_') {
             $sig .= substr($key, 7) . '=' . $val;
         }
     }
     $sig .= $secret;
     $verify = md5($sig);
     if ($verify == $this->arg('fb_sig')) {
         $flink = Foreign_link::getByForeignID($this->arg('fb_sig_user'), 2);
         common_debug("Removing foreign link to Facebook - local user ID: {$flink->user_id}, Facebook ID: {$flink->foreign_id}");
         $result = $flink->delete();
         if (!$result) {
             common_log_db_error($flink, 'DELETE', __FILE__);
             $this->serverError(_('Couldn\'t remove Facebook user.'));
             return;
         }
     } else {
         # Someone bad tried to remove facebook link?
         common_log(LOG_ERR, "Someone from {$_SERVER['REMOTE_ADDR']} " . 'unsuccessfully tried to remove a foreign link to Facebook!');
     }
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:27,代码来源:facebookremove.php

示例6: onEndAccountSettingsNav

 /**
  * Menu item for personal subscriptions/groups area
  *
  * @param Action $action action being executed
  *
  * @return boolean hook return
  */
 function onEndAccountSettingsNav($action)
 {
     $action_name = $action->trimmed('action');
     common_debug("ACTION NAME = " . $action_name);
     $action->menuItem(common_local_url('mirrorsettings'), _m('MENU', 'Mirroring'), _m('Configure mirroring of posts from other feeds'), $action_name === 'mirrorsettings');
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:14,代码来源:SubMirrorPlugin.php

示例7: onStartNoticeSave

 function onStartNoticeSave($notice)
 {
     $args = $this->testArgs($notice);
     common_debug("Blogspamnet args = " . print_r($args, TRUE));
     $request = xmlrpc_encode_request('testComment', array($args));
     $context = stream_context_create(array('http' => array('method' => "POST", 'header' => "Content-Type: text/xml\r\n" . "User-Agent: " . $this->userAgent(), 'content' => $request)));
     $file = file_get_contents($this->baseUrl, false, $context);
     $response = xmlrpc_decode($file);
     if (xmlrpc_is_fault($response)) {
         throw new ServerException("{$response['faultString']} ({$response['faultCode']})", 500);
     } else {
         common_debug("Blogspamnet results = " . $response);
         if (preg_match('/^ERROR(:(.*))?$/', $response, $match)) {
             throw new ServerException(sprintf(_("Error from %s: %s"), $this->baseUrl, $match[2]), 500);
         } else {
             if (preg_match('/^SPAM(:(.*))?$/', $response, $match)) {
                 throw new ClientException(sprintf(_("Spam checker results: %s"), $match[2]), 400);
             } else {
                 if (preg_match('/^OK$/', $response)) {
                     // don't do anything
                 } else {
                     throw new ServerException(sprintf(_("Unexpected response from %s: %s"), $this->baseUrl, $response), 500);
                 }
             }
         }
     }
     return true;
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:28,代码来源:BlogspamNetPlugin.php

示例8: __construct

 function __construct($connection, Profile $owner, Action $out = null)
 {
     parent::__construct($out);
     common_debug("ConnectedAppsList constructor");
     $this->connection = $connection;
     $this->owner = $owner;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:connectedappslist.php

示例9: onStartNoticeSave

 function onStartNoticeSave($notice)
 {
     $args = $this->testArgs($notice);
     common_debug("Blogspamnet args = " . print_r($args, TRUE));
     $requestBody = xmlrpc_encode_request('testComment', array($args));
     $request = new HTTPClient($this->baseUrl, HTTPClient::METHOD_POST);
     $request->setHeader('Content-Type', 'text/xml');
     $request->setBody($requestBody);
     $httpResponse = $request->send();
     $response = xmlrpc_decode($httpResponse->getBody());
     if (xmlrpc_is_fault($response)) {
         throw new ServerException("{$response['faultString']} ({$response['faultCode']})", 500);
     } else {
         common_debug("Blogspamnet results = " . $response);
         if (preg_match('/^ERROR(:(.*))?$/', $response, $match)) {
             throw new ServerException(sprintf(_("Error from %s: %s"), $this->baseUrl, $match[2]), 500);
         } else {
             if (preg_match('/^SPAM(:(.*))?$/', $response, $match)) {
                 throw new ClientException(sprintf(_("Spam checker results: %s"), $match[2]), 400);
             } else {
                 if (preg_match('/^OK$/', $response)) {
                     // don't do anything
                 } else {
                     throw new ServerException(sprintf(_("Unexpected response from %s: %s"), $this->baseUrl, $response), 500);
                 }
             }
         }
     }
     return true;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:30,代码来源:BlogspamNetPlugin.php

示例10: prepare

 function prepare($args)
 {
     parent::prepare($args);
     common_debug('IndexAction -> redirect -> ' . $this->lang);
     common_redirect(common_get_route('home', array('lang' => $this->lang)), 303);
     return true;
 }
开发者ID:Edo78,项目名称:fluidframe,代码行数:7,代码来源:index.php

示例11: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     common_debug("apitimelinetag prepare()");
     $this->tag = $this->arg('tag');
     $this->notices = $this->getNotices();
     return true;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:15,代码来源:apitimelinetag.php

示例12: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  *
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->callback = $this->arg('oauth_callback');
     if (!empty($this->callback)) {
         common_debug("callback: {$this->callback}");
     }
     return true;
 }
开发者ID:sukhjindersingh,项目名称:PHInest-Solutions,代码行数:17,代码来源:apioauthrequesttoken.php

示例13: prepare

 /**
  * Initialization.
  *
  * @param array $args Web and URL arguments
  *
  * @return boolean false if user doesn't exist
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->url = $this->arg('url');
     $this->challenge = $this->arg('challenge');
     common_debug("args = " . var_export($this->args, true));
     common_debug('url = ' . $this->url . ' challenge = ' . $this->challenge);
     return true;
 }
开发者ID:himmelex,项目名称:NTW,代码行数:16,代码来源:LoggingAggregator.php

示例14: fromUrl

 public static function fromUrl($url, $depth = 0)
 {
     common_debug('MentionURL: trying to find a profile for ' . $url);
     $url = preg_replace('#https?://#', 'https://', $url);
     try {
         $profile = Profile::fromUri($url);
     } catch (UnknownUriException $ex) {
     }
     if (!$profile instanceof Profile) {
         $profile = self::findProfileByProfileURL($url);
     }
     $url = str_replace('https://', 'http://', $url);
     if (!$profile instanceof Profile) {
         try {
             $profile = Profile::fromUri($url);
         } catch (UnknownUriException $ex) {
         }
     }
     if (!$profile instanceof Profile) {
         $profile = self::findProfileByProfileURL($url);
     }
     if (!$profile instanceof Profile) {
         $hcard = mention_url_representative_hcard($url);
         if (!$hcard) {
             return null;
         }
         $mention_profile = new Mention_url_profile();
         $mention_profile->query('BEGIN');
         $profile = new Profile();
         $profile->profileurl = $hcard['url'][0];
         $profile->fullname = $hcard['name'][0];
         preg_match('/\\/([^\\/]+)\\/*$/', $profile->profileurl, $matches);
         if (!$hcard['nickname']) {
             $hcard['nickname'] = array($matches[1]);
         }
         $profile->nickname = $hcard['nickname'][0];
         $profile->created = common_sql_now();
         $mention_profile->profile_id = $profile->insert();
         if (!$mention_profile->profile_id) {
             $mention_profile->query('ROLLBACK');
             return null;
         }
         $mention_profile->profileurl = $profile->profileurl;
         if (!$mention_profile->insert()) {
             $mention_profile->query('ROLLBACK');
             if ($depth > 0) {
                 return null;
             } else {
                 return self::fromUrl($url, $depth + 1);
             }
         } else {
             $mention_profile->query('COMMIT');
         }
     }
     return $profile;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:56,代码来源:Mention_url_profile.php

示例15: getHreflangs

 function getHreflangs()
 {
     $hreflangs = array();
     $langs = common_config('site', 'langs');
     common_debug('Langs:' . print_r($langs, true));
     foreach ($langs as $key => $lang) {
         $hreflangs[] = array('lang' => $key, 'href' => common_get_route('home', array('lang' => $key)));
     }
     return $hreflangs;
 }
开发者ID:Edo78,项目名称:fluidframe,代码行数:10,代码来源:home.php


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