本文整理汇总了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;
}
示例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)]);
}
示例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());
}
}