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


PHP Transaction::getAttributes方法代码示例

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


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

示例1: wfJSVariablesTopScripts

/**
 * @param array $vars JS variables to be added at the top of the page
 * @param array $scripts JS scripts to add to the top of the page
 * @return bool return true - it's a hook
 */
function wfJSVariablesTopScripts(array &$vars, &$scripts)
{
    $wg = F::app()->wg;
    $title = $wg->Title;
    $out = $wg->Out;
    // ads need it
    $vars['wgAfterContentAndJS'] = array();
    if (is_array($wg->WikiFactoryTags)) {
        $vars['wgWikiFactoryTagIds'] = array_keys($wg->WikiFactoryTags);
        $vars['wgWikiFactoryTagNames'] = array_values($wg->WikiFactoryTags);
    }
    $vars['wgCdnRootUrl'] = $wg->CdnRootUrl;
    $vars['wgCdnApiUrl'] = $wg->CdnApiUrl;
    // analytics needs it (from here till the end of the function)
    $vars['wgDBname'] = $wg->DBname;
    $vars['wgCityId'] = $wg->CityId;
    // c&p from OutputPage::getJSVars with an old 1.16 name
    $vars['wgContentLanguage'] = $title->getPageLanguage()->getCode();
    // c&p from OutputPage::getJSVars, it's needed earlier
    $user = $wg->User;
    /** @var $user User */
    if ($user->isAnon()) {
        $vars['wgUserName'] = null;
    } else {
        $vars['wgUserName'] = $user->getName();
        /*
         * Remove when SOC-217 ABTest is finished
         */
        $vars['wgNotConfirmedEmail'] = $user->getGlobalAttribute(UserLoginSpecialController::NOT_CONFIRMED_LOGIN_OPTION_NAME);
        /*
         * End remove
         */
    }
    if ($out->isArticle()) {
        $vars['wgArticleId'] = $out->getWikiPage()->getId();
    }
    $vars['wgCategories'] = $out->getCategories();
    $vars['wgPageName'] = $title->getPrefixedDBKey();
    $vars['wikiaPageType'] = WikiaPageType::getPageType();
    $vars['wikiaPageIsCorporate'] = WikiaPageType::isCorporatePage();
    $vars['wgArticleType'] = WikiaPageType::getArticleType();
    // missing in 1.19
    $skin = RequestContext::getMain()->getSkin();
    $vars['skin'] = $skin->getSkinName();
    // for Google Analytics
    $vars['_gaq'] = array();
    $vars['wgIsGASpecialWiki'] = $wg->IsGASpecialWiki;
    // PER-58: moved wgStyleVersion to <head>
    $vars['wgStyleVersion'] = (string) $wg->StyleVersion;
    $wg->NoExternals = $wg->Request->getBool('noexternals', $wg->NoExternals);
    if (!empty($wg->NoExternals)) {
        $vars["wgNoExternals"] = $wg->NoExternals;
    }
    $vars['wgTransactionContext'] = Transaction::getAttributes();
    $scripts .= Html::inlineScript("var wgNow = new Date();") . "\n";
    return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:62,代码来源:JSVariables.php

示例2: onShutdown

 /**
  * Sends all events via Scribe
  */
 public static function onShutdown()
 {
     // Check dependencies (perform autoload if required)
     if (!is_callable('Transaction::getAttributes') || !is_callable('WScribeClient::singleton')) {
         return;
     }
     // send events with full context data
     self::send(Transaction::getEvents(), Transaction::getAttributes());
     // send raw events with the minimal context
     self::send(Transaction::getRawEvents(), [Transaction::PSEUDO_PARAM_TYPE => Transaction::getType(), Transaction::PARAM_ENVIRONMENT => Transaction::getAttribute(Transaction::PARAM_ENVIRONMENT)]);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:14,代码来源:TransactionTraceScribe.php

示例3: send

 /**
  * Send data via Scribe
  *
  * @param ProfilerData $data
  */
 public function send(ProfilerData $data)
 {
     if (!$this->checkDependencies()) {
         return;
     }
     $scribeKey = $this->getScribeKey($data->getEngine());
     $data = array('time' => microtime(true), 'engine' => $data->getEngine(), 'profile' => $data->getProfile(), 'context' => Transaction::getAttributes(), 'request' => $data->getRequest(), 'entries' => $data->getEntries());
     $data = json_encode($data);
     try {
         WScribeClient::singleton($scribeKey)->send($data);
     } catch (TException $e) {
         Wikia::log(__METHOD__, 'scribeClient exception', $e->getMessage());
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:19,代码来源:ProfilerDataScribeSink.php


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