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; }
<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