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


PHP Xml::encodeJSVar方法代码示例

本文整理汇总了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;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:45,代码来源:AbuseFilter.class.php

示例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 
开发者ID:Tjorriemorrie,项目名称:app,代码行数:31,代码来源:ThemeDesigner_Index.php


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