本文整理汇总了PHP中Xml::encodeJSVar方法的典型用法代码示例。如果您正苦于以下问题:PHP Xml::encodeJSVar方法的具体用法?PHP Xml::encodeJSVar怎么用?PHP Xml::encodeJSVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xml
的用法示例。
在下文中一共展示了Xml::encodeJSVar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildEditBox
static function buildEditBox($rules, $textName = 'wpFilterRules', $addResultDiv = true, $canEdit = true)
{
global $wgOut;
$readOnlyAttrib = array();
if (!$canEdit) {
$readOnlyAttrib['readonly'] = 'readonly';
}
global $wgUser;
$noTestAttrib = array();
if (!$wgUser->isAllowed('abusefilter-modify')) {
$noTestAttrib['disabled'] = 'disabled';
$addResultDiv = false;
}
$rules = rtrim($rules) . "\n";
$rules = Xml::textarea($textName, $rules, 40, 5, $readOnlyAttrib);
$dropDown = self::getBuilderValues();
// Generate builder drop-down
$builder = '';
$builder .= Xml::option(wfMsg('abusefilter-edit-builder-select'));
foreach ($dropDown as $group => $values) {
$builder .= Xml::openElement('optgroup', array('label' => wfMsg("abusefilter-edit-builder-group-{$group}"))) . "\n";
foreach ($values as $content => $name) {
$builder .= Xml::option(wfMsg("abusefilter-edit-builder-{$group}-{$name}"), $content) . "\n";
}
$builder .= Xml::closeElement('optgroup') . "\n";
}
$rules .= Xml::tags('select', array('id' => 'wpFilterBuilder', 'onchange' => 'addText();'), $builder) . ' ';
// Add syntax checking
$rules .= Xml::element('input', array('type' => 'button', 'onclick' => 'doSyntaxCheck()', 'value' => wfMsg('abusefilter-edit-check'), 'id' => 'mw-abusefilter-syntaxcheck') + $noTestAttrib);
if ($addResultDiv) {
$rules .= Xml::element('div', array('id' => 'mw-abusefilter-syntaxresult', 'style' => 'display: none;'), ' ');
}
// Add script
$editScript = file_get_contents(dirname(__FILE__) . '/edit.js');
$editScript = "var wgFilterBoxName = " . Xml::encodeJSVar($textName) . ";\n{$editScript}";
// Import localisation.
$importMessages = array('abusefilter-edit-syntaxok', 'abusefilter-edit-syntaxerr');
$msgData = array();
foreach ($importMessages as $msg) {
$msgData[$msg] = wfMsg($msg);
}
$editScript .= "\nvar wgAbuseFilterMessages = " . json_encode($msgData) . ";\n";
$wgOut->addInlineScript($editScript);
return $rules;
}
示例2: json_encode
<link rel="stylesheet" href="<?php
echo AssetsManager::getInstance()->getSassCommonURL('/skins/oasis/css/core/WikiaSlider.scss');
?>
">
<link rel="stylesheet" href="<?php
echo AssetsManager::getInstance()->getSassCommonURL('/resources/wikia/libraries/bootstrap/tooltip.scss');
?>
">
<?php
echo $globalVariablesScript;
?>
<script>
var returnTo = <?php
echo Xml::encodeJSVar($returnTo);
?>
;
var themeHistory = <?php
echo json_encode($themeHistory);
?>
;
var themeSettings = <?php
echo json_encode($themeSettings);
?>
;
var themes = <?php
echo json_encode($wg->OasisThemes);
?>
;
var applicationThemeSettings = <?php