本文整理汇总了PHP中Xml::textarea方法的典型用法代码示例。如果您正苦于以下问题:PHP Xml::textarea方法的具体用法?PHP Xml::textarea怎么用?PHP Xml::textarea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xml
的用法示例。
在下文中一共展示了Xml::textarea方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addRequestWikiForm
function addRequestWikiForm()
{
$localpage = $this->getPageTitle()->getLocalUrl();
$form = Xml::openElement('form', array('action' => $localpage, 'method' => 'post'));
$form .= '<fieldset><legend>' . $this->msg('requestwiki')->escaped() . '</legend>';
$form .= Xml::openElement('table');
$form .= '<tr><td>' . $this->msg('requestwiki-label-siteurl')->escaped() . '</td>';
$form .= '<td>' . Xml::input('subdomain', 20, '') . '.miraheze.org' . '</td></tr>';
$form .= '<tr><td>' . $this->msg('requestwiki-label-sitename')->escaped() . '</td>';
$form .= '<td>' . Xml::input('sitename', 20, '', array('required' => '')) . '</td></tr>';
$form .= '<tr><td>' . $this->msg('requestwiki-label-customdomain')->escaped() . '</td>';
$form .= '<td>' . Xml::input('customdomain', 20, '') . '</td></tr>';
$form .= '<tr><td>' . $this->msg('requestwiki-label-language')->escaped() . '</td>';
$form .= '<td>' . Xml::languageSelector('en', true, null, array('name' => 'language'))[1] . '</td></tr>';
$form .= '<tr><td>' . $this->msg('requestwiki-label-private')->escaped() . '</td>';
$form .= '<td>' . Xml::check('private', false, array('value' => 0)) . '</td></tr>';
$form .= '<tr><td>' . $this->msg('requestwiki-label-comments')->escaped() . '</td>';
$form .= '<td>' . Xml::textarea('comments', '', 40, 5, array('required' => '')) . '</td></tr>';
$form .= '<tr><td>' . Xml::submitButton($this->msg('requestwiki-submit')->plain()) . '</td></tr>';
$form .= Xml::closeElement('table');
$form .= '</fieldset>';
$form .= Html::hidden('token', $this->getUser()->getEditToken());
$form .= Xml::closeElement('form');
$this->getOutput()->addHTML($form);
}
示例2: execute
function execute($subpage)
{
global $wgRequest, $wgOut;
$wgOut->setPageTitle('Wikitext Preview');
if ($wikitext = $wgRequest->getText('wikitext')) {
$wgOut->addHTML(Xml::fieldset('Wikitext preview', $wgOut->parse($wikitext)));
}
$f = Xml::textarea('wikitext', $wikitext);
$f .= Xml::submitButton('Preview wikitext');
$f .= Html::Hidden('title', $this->getTitle()->getPrefixedText());
$f = Xml::tags('form', array('method' => 'POST', 'action' => $this->getTitle()->getLocalURL()), $f);
$wgOut->addHTML(Xml::fieldset('Preview wikitext', $f));
}
示例3: show
function show()
{
global $wgOut, $wgUser;
if (!$wgUser->isAllowed('abusefilter-modify')) {
$wgOut->addWikiMsg('abusefilter-edit-notallowed');
return;
}
$wgOut->addWikiMsg('abusefilter-import-intro');
$html = Xml::textarea('wpImportText', '', 40, 20);
$html .= Xml::submitButton(wfMsg('abusefilter-import-submit'), array('accesskey' => 's'));
$url = SpecialPage::getTitleFor('AbuseFilter', 'new')->getFullURL();
$html = Xml::tags('form', array('method' => 'post', 'action' => $url), $html);
$wgOut->addHTML($html);
}
示例4: showView
//.........这里部分代码省略.........
$htmlOut .= Xml::tags('tr', null, Xml::tags('td', null, $lsLabel) . Xml::tags('td', null, $lsSelect) . Xml::tags('td', array('colspan' => 2), Xml::submitButton(wfMsg('centralnotice-modify'))));
$htmlOut .= Xml::tags('tr', null, Xml::tags('td', null, '') . Xml::tags('td', null, $sk->makeLinkObj($newPage, wfMsgHtml('centralnotice-preview-all-template-translations'), "template={$currentTemplate}&wpUserLanguage=all")));
$htmlOut .= Html::closeElement('table');
$htmlOut .= Html::closeElement('fieldset');
$htmlOut .= Html::closeElement('form');
}
// Show edit form
if ($this->editable) {
$htmlOut .= Html::openElement('form', array('method' => 'post', 'onsubmit' => 'return validateBannerForm(this)'));
$htmlOut .= Html::hidden('wpMethod', 'editTemplate');
}
// If there was an error, we'll need to restore the state of the form
if ($wgRequest->wasPosted() && $wgRequest->getVal('mainform')) {
$displayAnon = $wgRequest->getCheck('displayAnon');
$displayAccount = $wgRequest->getCheck('displayAccount');
$fundraising = $wgRequest->getCheck('fundraising');
$autolink = $wgRequest->getCheck('autolink');
$landingPages = $wgRequest->getVal('landingPages');
$body = $wgRequest->getVal('templateBody', $body);
} else {
// Use previously stored values
$displayAnon = $bannerSettings['anon'] == 1;
$displayAccount = $bannerSettings['account'] == 1;
$fundraising = $bannerSettings['fundraising'] == 1;
$autolink = $bannerSettings['autolink'] == 1;
$landingPages = $bannerSettings['landingpages'];
// $body default is defined prior to message interface code
}
// Show banner settings
$htmlOut .= Xml::fieldset(wfMsg('centralnotice-settings'));
$htmlOut .= Html::openElement('p', null);
$htmlOut .= wfMsg('centralnotice-banner-display');
$htmlOut .= Xml::check('displayAnon', $displayAnon, wfArrayMerge($disabled, array('id' => 'displayAnon')));
$htmlOut .= Xml::label(wfMsg('centralnotice-banner-anonymous'), 'displayAnon');
$htmlOut .= Xml::check('displayAccount', $displayAccount, wfArrayMerge($disabled, array('id' => 'displayAccount')));
$htmlOut .= Xml::label(wfMsg('centralnotice-banner-logged-in'), 'displayAccount');
$htmlOut .= Html::closeElement('p');
// Fundraising settings
if ($wgNoticeEnableFundraising) {
// Checkbox for indicating if it is a fundraising banner
$htmlOut .= Html::openElement('p', null);
$htmlOut .= Xml::check('fundraising', $fundraising, wfArrayMerge($disabled, array('id' => 'fundraising')));
$htmlOut .= Xml::label(wfMsg('centralnotice-banner-fundraising'), 'fundraising');
$htmlOut .= Html::closeElement('p');
// Checkbox for whether or not to automatically create landing page link
$htmlOut .= Html::openElement('p', null);
$htmlOut .= Xml::check('autolink', $autolink, wfArrayMerge($disabled, array('id' => 'autolink')));
$htmlOut .= Xml::label(wfMsg('centralnotice-banner-autolink'), 'autolink');
$htmlOut .= Html::closeElement('p');
// Interface for setting the landing pages
if ($autolink) {
$htmlOut .= Html::openElement('div', array('id' => 'autolinkInterface'));
} else {
$htmlOut .= Html::openElement('div', array('id' => 'autolinkInterface', 'style' => 'display:none;'));
}
$htmlOut .= Xml::tags('p', array(), wfMsg('centralnotice-banner-autolink-help', 'id="cn-landingpage-link"', 'JimmyAppeal01'));
$htmlOut .= Xml::tags('p', array(), Xml::inputLabel(wfMsg('centralnotice-banner-landing-pages'), 'landingPages', 'landingPages', 40, $landingPages, array('maxlength' => 255)));
$htmlOut .= Html::closeElement('div');
}
// Begin banner body section
$htmlOut .= Html::closeElement('fieldset');
if ($this->editable) {
$htmlOut .= Xml::fieldset(wfMsg('centralnotice-edit-template'));
$htmlOut .= wfMsg('centralnotice-edit-template-summary');
$buttons = array();
$buttons[] = '<a href="#" onclick="insertButton(\'close\');return false;">' . wfMsg('centralnotice-close-button') . '</a>';
$htmlOut .= Xml::tags('div', array('style' => 'margin-bottom: 0.2em;'), '<img src="' . $scriptPath . '/down-arrow.png" ' . 'style="vertical-align:baseline;"/>' . wfMsg('centralnotice-insert', $wgLang->commaList($buttons)));
} else {
$htmlOut .= Xml::fieldset(wfMsg('centralnotice-banner'));
}
$htmlOut .= Xml::textarea('templateBody', $body, 60, 20, $readonly);
$htmlOut .= Html::closeElement('fieldset');
if ($this->editable) {
// Indicate which form was submitted
$htmlOut .= Html::hidden('mainform', 'true');
$htmlOut .= Html::hidden('authtoken', $wgUser->editToken());
$htmlOut .= Xml::tags('div', array('class' => 'cn-buttons'), Xml::submitButton(wfMsg('centralnotice-save-banner')));
$htmlOut .= Html::closeElement('form');
}
// Show clone form
if ($this->editable) {
$htmlOut .= Html::openElement('form', array('method' => 'post', 'action' => $this->getTitle('clone')->getLocalUrl()));
$htmlOut .= Xml::fieldset(wfMsg('centralnotice-clone-notice'));
$htmlOut .= Html::openElement('table', array('cellpadding' => 9));
$htmlOut .= Html::openElement('tr');
$htmlOut .= Xml::inputLabel(wfMsg('centralnotice-clone-name'), 'newTemplate', 'newTemplate', '25');
$htmlOut .= Xml::submitButton(wfMsg('centralnotice-clone'), array('id' => 'clone'));
$htmlOut .= Html::hidden('oldTemplate', $currentTemplate);
$htmlOut .= Html::closeElement('tr');
$htmlOut .= Html::closeElement('table');
$htmlOut .= Html::hidden('authtoken', $wgUser->editToken());
$htmlOut .= Html::closeElement('fieldset');
$htmlOut .= Html::closeElement('form');
}
// End View Banner fieldset
$htmlOut .= Html::closeElement('fieldset');
// Output HTML
$wgOut->addHTML($htmlOut);
}
}
示例5: showEditUserGroupsForm
/**
* Show the form to add group memberships to one or more users at once.
*/
protected function showEditUserGroupsForm()
{
global $wgOut, $wgUser, $wgLang;
$wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalURL(), 'name' => 'editGroup', 'id' => 'mw-userrights-form2')) . Html::hidden('wpEditToken', $wgUser->getEditToken()) . Xml::openElement('fieldset') . Xml::element('legend', array(), wfMsg('userrights-editusergroup')) . wfMsgExt('batchuserrights-intro', array('parse')) . Xml::tags('p', null, $this->groupCheckboxes()) . Xml::openElement('table', array('border' => '0', 'id' => 'mw-userrights-table-outer')) . "<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('batchuserrights-names'), 'wpUsernames') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::textarea('wpUsernames', '') . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('userrights-reason'), 'wpReason') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('user-reason', 60, false, array('id' => 'wpReason', 'maxlength' => 255)) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-submit'>" . Xml::submitButton(wfMsg('saveusergroups'), array('name' => 'saveusergroups', 'accesskey' => 's')) . "</td>\n\t\t\t\t</tr>" . Xml::closeElement('table') . "\n" . Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n");
}
示例6: buildEditBox
/**
* @param $rules String
* @param $textName String
* @param $addResultDiv Boolean
* @param $canEdit Boolean
* @return string
*/
static function buildEditBox($rules, $textName = 'wpFilterRules', $addResultDiv = true, $canEdit = true)
{
global $wgOut;
$textareaAttrib = array('dir' => 'ltr');
# Rules are in English
if (!$canEdit) {
$textareaAttrib['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, 15, $textareaAttrib);
if ($canEdit) {
$dropDown = self::getBuilderValues();
// Generate builder drop-down
$builder = '';
$builder .= Xml::option(wfMessage('abusefilter-edit-builder-select')->text());
foreach ($dropDown as $group => $values) {
// Give grep a chance to find the usages:
// abusefilter-edit-builder-group-op-arithmetic, abusefilter-edit-builder-group-op-comparison,
// abusefilter-edit-builder-group-op-bool, abusefilter-edit-builder-group-misc,
// abusefilter-edit-builder-group-funcs, abusefilter-edit-builder-group-vars
$builder .= Xml::openElement('optgroup', array('label' => wfMessage("abusefilter-edit-builder-group-{$group}")->text())) . "\n";
foreach ($values as $content => $name) {
$builder .= Xml::option(wfMessage("abusefilter-edit-builder-{$group}-{$name}")->text(), $content) . "\n";
}
$builder .= Xml::closeElement('optgroup') . "\n";
}
$rules .= Xml::tags('select', array('id' => 'wpFilterBuilder'), $builder) . ' ';
// Add syntax checking
$rules .= Xml::element('input', array('type' => 'button', 'value' => wfMessage('abusefilter-edit-check')->text(), 'id' => 'mw-abusefilter-syntaxcheck') + $noTestAttrib);
}
if ($addResultDiv) {
$rules .= Xml::element('div', array('id' => 'mw-abusefilter-syntaxresult', 'style' => 'display: none;'), ' ');
}
// Add script
$wgOut->addModules('ext.abuseFilter.edit');
self::$editboxName = $textName;
return $rules;
}
示例7: _executeCreate
/**
* Displays form to create wiki
*/
protected function _executeCreate($wgFarmer, $wiki)
{
global $wgOut, $wgUser, $wgRequest;
if (!$wgFarmer->getActiveWiki()->isDefaultWiki()) {
$wgOut->wrapWikiMsg('== $1 ==', 'farmer-notavailable');
$wgOut->addWikiMsg('farmer-notavailable-text');
return;
}
if (!MediaWikiFarmer::userCanCreateWiki($wgUser, $wiki)) {
$wgOut->addWikiMsg('farmercantcreatewikis');
return;
}
$name = MediaWikiFarmer_Wiki::sanitizeName($wgRequest->getVal('wpName', $wiki));
$title = MediaWikiFarmer_Wiki::sanitizeTitle($wgRequest->getVal('wpTitle'));
$description = $wgRequest->getVal('wpDescription', '');
$reason = $wgRequest->getVal('wpReason');
$action = $this->getTitle('create')->escapeLocalURL();
// if something was POST'd
if ($wgRequest->wasPosted()) {
// we create the wiki if the user pressed 'Confirm'
if ($wgRequest->getCheck('wpConfirm')) {
$wikiObj = MediaWikiFarmer_Wiki::newFromParams($name, $title, $description, $wgUser->getName());
$wikiObj->create();
$log = new LogPage('farmer');
$log->addEntry('create', $this->getTitle(), $reason, array($name));
$wgOut->wrapWikiMsg('== $1 ==', 'farmer-wikicreated');
$wgOut->addWikiMsg('farmer-wikicreated-text', $wikiObj->getUrl(wfUrlencode(wfMessage('mainpage')->inContentLanguage()->useDatabase(false)->plain())));
$wgOut->addWikiMsg('farmer-default', '[[' . $title . ':Special:Farmer|Special:Farmer]]');
return;
}
if ($name && $title && $description) {
$wiki = new MediaWikiFarmer_Wiki($name);
if ($wiki->exists() || $wiki->databaseExists()) {
$wgOut->wrapWikiMsg("== \$1 ==\n\n\$2", 'farmer-wikiexists', array('farmer-wikiexists-text', $name));
return;
}
$url = $wiki->getUrl('');
$wgOut->wrapWikiMsg('== $1 ==', 'farmer-confirmsetting');
$wgOut->addHtml(Xml::openElement('table', array('class' => 'wikitable')) . "\n" . Xml::tags('tr', array(), Xml::tags('th', array(), wfMsgExt('farmer-confirmsetting-name', 'parseinline')) . Xml::element('td', array(), $name)) . "\n" . Xml::tags('tr', array(), Xml::tags('th', array(), wfMsgExt('farmer-confirmsetting-title', 'parseinline')) . Xml::element('td', array(), $title)) . "\n" . Xml::tags('tr', array(), Xml::tags('th', array(), wfMsgExt('farmer-confirmsetting-description', 'parseinline')) . Xml::element('td', array(), $description)) . "\n" . Xml::tags('tr', array(), Xml::tags('th', array(), wfMsgExt('farmer-confirmsetting-reason', 'parseinline')) . Xml::element('td', array(), $reason)) . "\n" . Xml::closeElement('table'));
$wgOut->addWikiMsg('farmer-confirmsetting-text', $name, $title, $url);
$nameaccount = htmlspecialchars($name);
$nametitle = htmlspecialchars($title);
$namedescript = htmlspecialchars($description);
$confirmaccount = wfMsgHtml('farmer-button-confirm');
$wgOut->addHTML("\n\n<form id=\"farmercreate2\" method=\"post\" action=\"{$action}\">\n<input type=\"hidden\" name=\"wpName\" value=\"{$nameaccount}\" />\n<input type=\"hidden\" name=\"wpTitle\" value=\"{$nametitle}\" />\n<input type=\"hidden\" name=\"wpDescription\" value=\"{$namedescript}\" />\n<input type=\"hidden\" name=\"wpReason\" value=\"{$reason}\" />\n<input type=\"submit\" name=\"wpConfirm\" value=\"{$confirmaccount}\" />\n</form>");
return;
}
}
if ($wiki && !$name) {
$name = $wiki;
}
$wgOut->wrapWikiMsg("== \$1 ==\n\$2\n== \$3 ==\n\$4\n\$5\n\$6", 'farmer-createwiki-form-title', 'farmer-createwiki-form-text1', 'farmer-createwiki-form-help', 'farmer-createwiki-form-text2', 'farmer-createwiki-form-text3', 'farmer-createwiki-form-text4');
$formURL = wfMsgHTML('farmercreateurl');
$formSitename = wfMsgHTML('farmercreatesitename');
$formNextStep = wfMsgHTML('farmercreatenextstep');
$token = htmlspecialchars($wgUser->editToken());
$wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'action' => $action)) . "\n" . Xml::buildForm(array('farmer-createwiki-user' => Xml::element('b', array(), $wgUser->getName()), 'farmer-createwiki-name' => Xml::input('wpName', 20, $name), 'farmer-createwiki-title' => Xml::input('wpTitle', 20, $title), 'farmer-createwiki-description' => Xml::textarea('wpDescription', $description), 'farmer-createwiki-reason' => Xml::input('wpReason', 20, $reason)), 'farmer-button-submit') . "\n" . Html::Hidden('token', $token) . "\n" . Xml::closeElement('form'));
}
示例8: showForm
function showForm($err = '')
{
global $wgOut;
if ($err) {
$wgOut->addHTML('<div class="wikierror">' . htmlspecialchars($err) . '</div>');
}
$wgOut->addWikiMsg('masseditregextext');
$titleObj = SpecialPage::getTitleFor('MassEditRegex');
$wgOut->addHTML(Xml::openElement('form', array('id' => 'masseditregex', 'method' => 'post', 'action' => $titleObj->getLocalURL('action=submit'))) . Xml::element('p', null, wfMsg('masseditregex-pagelisttxt')) . Xml::textarea('wpPageList', join("\n", $this->aPageList)) . Xml::namespaceSelector($this->iNamespace, null, 'namespace', wfMsg('masseditregex-namespace-intro')) . Xml::element('br') . Xml::element('span', null, wfMsg('masseditregex-listtype-intro')) . Xml::openElement('ul', array('style' => 'list-style: none')));
// Generate HTML for the radio buttons (one for each list type)
foreach (array('pagenames', 'pagename-prefixes', 'categories', 'backlinks') as $strValue) {
// Have to use openElement because putting an Xml::xxx return value
// inside an Xml::element causes the HTML code to be escaped and appear
// on the page.
$wgOut->addHTML(Xml::openElement('li') . Xml::radioLabel(wfMsg('masseditregex-listtype-' . $strValue), 'wpPageListType', $strValue, 'masseditregex-radio-' . $strValue, $strValue == $this->strPageListType) . Xml::closeElement('li'));
}
$wgOut->addHTML(Xml::closeElement('ul') . Xml::openElement('table', array('style' => 'width: 100%')) . Xml::openElement('tr') . Xml::openElement('td') . Xml::element('p', null, wfMsg('masseditregex-matchtxt')) . Xml::textarea('wpMatch', join("\n", $this->aMatch)) . Xml::closeElement('td') . Xml::openElement('td') . Xml::element('p', null, wfMsg('masseditregex-replacetxt')) . Xml::textarea('wpReplace', $this->strReplace) . Xml::closeElement('td') . Xml::closeElement('tr') . Xml::closeElement('table') . Xml::openElement('div', array('class' => 'editOptions')) . Xml::tags('span', array('class' => 'mw-summary', 'id' => 'wpSummaryLabel'), Xml::tags('label', array('for' => 'wpSummary'), wfMsg('summary'))) . ' ' . Xml::input('wpSummary', 60, $this->strSummary, array('id' => 'wpSummary', 'maxlength' => '200', 'tabindex' => '1')) . Xml::tags('div', array('class' => 'mw-summary-preview'), wfMsgExt('summary-preview', 'parseinline') . $this->sk->commentBlock($this->strSummary)) . Xml::closeElement('div') . Xml::element('input', array('id' => 'wpSave', 'name' => 'wpSave', 'type' => 'submit', 'value' => wfMsg('masseditregex-executebtn'), 'accesskey' => wfMsg('accesskey-save'), 'title' => wfMsg('masseditregex-tooltip-execute') . ' [' . wfMsg('accesskey-save') . ']')) . Xml::element('input', array('id' => 'wpPreview', 'name' => 'wpPreview', 'type' => 'submit', 'value' => wfMsg('showpreview'), 'accesskey' => wfMsg('accesskey-preview'), 'title' => wfMsg('tooltip-preview') . ' [' . wfMsg('accesskey-preview') . ']')));
$wgOut->addHTML(Xml::closeElement('form'));
}
示例9: showForm
function showForm( $warning_msg = null ) {
global $wgOut;
$wgOut->addHTML(
Xml::openElement( 'form', array( 'id' => 'powersearch', 'action' => $this->getTitle()->getFullUrl(), 'method' => 'post' ) ) . "\n" .
self::hiddenField( 'title', $this->getTitle()->getPrefixedText() ) .
self::hiddenField( 'continue', 1 )
);
if ( is_null( $warning_msg ) ) {
$wgOut->addWikiMsg( 'replacetext_docu' );
} else {
$wgOut->wrapWikiMsg( "<div class=\"errorbox\">\n$1\n</div><br clear=\"both\" />", $warning_msg );
}
$wgOut->addHTML( '<table><tr><td style="vertical-align: top;">' );
$wgOut->addWikiMsg( 'replacetext_originaltext' );
$wgOut->addHTML( '</td><td>' );
// 'width: auto' style is needed to override MediaWiki's
// normal 'width: 100%', which causes the textarea to get
// zero width in IE
$wgOut->addHTML( Xml::textarea( 'target', $this->target, 50, 2, array( 'style' => 'width: auto;' ) ) );
$wgOut->addHTML( '</td></tr><tr><td style="vertical-align: top;">' );
$wgOut->addWikiMsg( 'replacetext_replacementtext' );
$wgOut->addHTML( '</td><td>' );
$wgOut->addHTML( Xml::textarea( 'replacement', $this->replacement, 50, 2, array( 'style' => 'width: auto;' ) ) );
$wgOut->addHTML( '</td></tr></table>' );
$wgOut->addHTML( Xml::tags( 'p', null,
Xml::checkLabel( wfMsg( 'replacetext_useregex' ), 'use_regex', 'use_regex' ) ) . "\n" .
Xml::element( 'p', array( 'style' => 'font-style: italic' ),
wfMsg( 'replacetext_regexdocu' ) )
);
// The interface is heavily based on the one in Special:Search.
$search_label = wfMsg( 'powersearch-ns' );
$namespaces = SearchEngine::searchableNamespaces();
$tables = $this->namespaceTables( $namespaces );
$wgOut->addHTML(
"<div class=\"mw-search-formheader\"></div>\n" .
"<fieldset id=\"mw-searchoptions\">\n" .
Xml::tags( 'h4', null, wfMsgExt( 'powersearch-ns', array( 'parseinline' ) ) )
);
// The ability to select/unselect groups of namespaces in the
// search interface exists only in some skins, like Vector -
// check for the presence of the 'powersearch-togglelabel'
// message to see if we can use this functionality here.
if ( !wfEmptyMsg( 'powersearch-togglelabel', wfMsg( 'powersearch-togglelabel' ) ) ) {
$wgOut->addHTML(
Xml::tags(
'div',
array( 'id' => 'mw-search-togglebox' ),
Xml::label( wfMsg( 'powersearch-togglelabel' ), 'mw-search-togglelabel' ) .
Xml::element(
'input',
array(
'type'=>'button',
'id' => 'mw-search-toggleall',
// 'onclick' value needed for MW 1.16
'onclick' => 'mwToggleSearchCheckboxes("all");',
'value' => wfMsg( 'powersearch-toggleall' )
)
) .
Xml::element(
'input',
array(
'type'=>'button',
'id' => 'mw-search-togglenone',
// 'onclick' value needed for MW 1.16
'onclick' => 'mwToggleSearchCheckboxes("none");',
'value' => wfMsg( 'powersearch-togglenone' )
)
)
)
);
} // end if
$wgOut->addHTML(
Xml::element( 'div', array( 'class' => 'divider' ), '', false ) .
"$tables\n</fieldset>"
);
//FIXME: raw html messages
$optional_filters_label = wfMsg( 'replacetext_optionalfilters' );
$category_search_label = wfMsg( 'replacetext_categorysearch' );
$prefix_search_label = wfMsg( 'replacetext_prefixsearch' );
$wgOut->addHTML(
"<fieldset id=\"mw-searchoptions\">\n" .
Xml::tags( 'h4', null, wfMsgExt( 'replacetext_optionalfilters', array( 'parseinline' ) ) ) .
Xml::element( 'div', array( 'class' => 'divider' ), '', false ) .
"<p>$category_search_label\n" .
Xml::input( 'category', 20, $this->category, array( 'type' => 'text' ) ) . '</p>' .
"<p>$prefix_search_label\n" .
Xml::input( 'prefix', 20, $this->prefix, array( 'type' => 'text' ) ) . '</p>' .
"</fieldset>\n" .
"<p>\n" .
Xml::checkLabel( wfMsg( 'replacetext_editpages' ), 'edit_pages', 'edit_pages', true ) . '<br />' .
Xml::checkLabel( wfMsg( 'replacetext_movepages' ), 'move_pages', 'move_pages' ) .
"</p>\n" .
Xml::submitButton( wfMsg( 'replacetext_continue' ) ) .
Xml::closeElement( 'form' )
);
// Add Javascript specific to Special:Search
if ( method_exists( $wgOut, 'addModules' ) ) {
$wgOut->addModules( 'mediawiki.special.search' );
} else {
//.........这里部分代码省略.........
示例10: buildConsequenceSelector
/**
* @param $action string The action to build an editor for
* @param $set bool Whether or not the action is activated
* @param $parameters array Action parameters
* @param $row stdClass abuse_filter row object
* @return string
*/
function buildConsequenceSelector($action, $set, $parameters, $row)
{
global $wgAbuseFilterAvailableActions, $wgMainCacheType;
if (!in_array($action, $wgAbuseFilterAvailableActions)) {
return '';
}
$readOnlyAttrib = array();
$cbReadOnlyAttrib = array();
// For checkboxes
if (!$this->canEditFilter($row)) {
$readOnlyAttrib['readonly'] = 'readonly';
$cbReadOnlyAttrib['disabled'] = 'disabled';
}
switch ($action) {
case 'throttle':
// Throttling is only available via object caching
if ($wgMainCacheType === CACHE_NONE) {
return '';
}
$throttleSettings = Xml::checkLabel($this->msg('abusefilter-edit-action-throttle')->text(), 'wpFilterActionThrottle', "mw-abusefilter-action-checkbox-{$action}", $set, array('class' => 'mw-abusefilter-action-checkbox') + $cbReadOnlyAttrib);
$throttleFields = array();
if ($set) {
array_shift($parameters);
$throttleRate = explode(',', $parameters[0]);
$throttleCount = $throttleRate[0];
$throttlePeriod = $throttleRate[1];
$throttleGroups = implode("\n", array_slice($parameters, 1));
} else {
$throttleCount = 3;
$throttlePeriod = 60;
$throttleGroups = "user\n";
}
$throttleFields['abusefilter-edit-throttle-count'] = Xml::input('wpFilterThrottleCount', 20, $throttleCount, $readOnlyAttrib);
$throttleFields['abusefilter-edit-throttle-period'] = $this->msg('abusefilter-edit-throttle-seconds')->rawParams(Xml::input('wpFilterThrottlePeriod', 20, $throttlePeriod, $readOnlyAttrib))->parse();
$throttleFields['abusefilter-edit-throttle-groups'] = Xml::textarea('wpFilterThrottleGroups', $throttleGroups . "\n", 40, 5, $readOnlyAttrib);
$throttleSettings .= Xml::tags('div', array('id' => 'mw-abusefilter-throttle-parameters'), Xml::buildForm($throttleFields));
return $throttleSettings;
case 'flag':
$checkbox = Xml::checkLabel($this->msg('abusefilter-edit-action-flag')->text(), 'wpFilterActionFlag', "mw-abusefilter-action-checkbox-{$action}", true, array('disabled' => '1', 'class' => 'mw-abusefilter-action-checkbox'));
return Xml::tags('p', null, $checkbox);
case 'warn':
global $wgAbuseFilterDefaultWarningMessage;
$output = '';
$checkbox = Xml::checkLabel($this->msg('abusefilter-edit-action-warn')->text(), 'wpFilterActionWarn', "mw-abusefilter-action-checkbox-{$action}", $set, array('class' => 'mw-abusefilter-action-checkbox') + $cbReadOnlyAttrib);
$output .= Xml::tags('p', null, $checkbox);
if ($set) {
$warnMsg = $parameters[0];
} elseif ($row && isset($row->af_group) && $row->af_group && isset($wgAbuseFilterDefaultWarningMessage[$row->af_group])) {
$warnMsg = $wgAbuseFilterDefaultWarningMessage[$row->af_group];
} else {
$warnMsg = 'abusefilter-warning';
}
$warnFields['abusefilter-edit-warn-message'] = $this->getExistingSelector($warnMsg);
$warnFields['abusefilter-edit-warn-other-label'] = Xml::input('wpFilterWarnMessageOther', 45, $warnMsg ? $warnMsg : 'abusefilter-warning-', array('id' => 'mw-abusefilter-warn-message-other') + $cbReadOnlyAttrib);
$previewButton = Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-warn-preview-button', 'value' => $this->msg('abusefilter-edit-warn-preview')->text()));
$editButton = Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-warn-edit-button', 'value' => $this->msg('abusefilter-edit-warn-edit')->text()));
$previewHolder = Xml::element('div', array('id' => 'mw-abusefilter-warn-preview'), '');
$warnFields['abusefilter-edit-warn-actions'] = Xml::tags('p', null, "{$previewButton} {$editButton}") . "\n{$previewHolder}";
$output .= Xml::tags('div', array('id' => 'mw-abusefilter-warn-parameters'), Xml::buildForm($warnFields));
return $output;
case 'tag':
if ($set) {
$tags = $parameters;
} else {
$tags = array();
}
$output = '';
$checkbox = Xml::checkLabel($this->msg('abusefilter-edit-action-tag')->text(), 'wpFilterActionTag', "mw-abusefilter-action-checkbox-{$action}", $set, array('class' => 'mw-abusefilter-action-checkbox') + $cbReadOnlyAttrib);
$output .= Xml::tags('p', null, $checkbox);
$tagFields['abusefilter-edit-tag-tag'] = Xml::textarea('wpFilterTags', implode("\n", $tags), 40, 5, $readOnlyAttrib);
$output .= Xml::tags('div', array('id' => 'mw-abusefilter-tag-parameters'), Xml::buildForm($tagFields));
return $output;
default:
// Give grep a chance to find the usages:
// abusefilter-edit-action-warn, abusefilter-edit-action-disallow
// abusefilter-edit-action-flag, abusefilter-edit-action-blockautopromote
// abusefilter-edit-action-degroup, abusefilter-edit-action-block
// abusefilter-edit-action-throttle, abusefilter-edit-action-rangeblock
// abusefilter-edit-action-tag
$message = 'abusefilter-edit-action-' . $action;
$form_field = 'wpFilterAction' . ucfirst($action);
$status = $set;
$thisAction = Xml::checkLabel($this->msg($message)->text(), $form_field, "mw-abusefilter-action-checkbox-{$action}", $status, array('class' => 'mw-abusefilter-action-checkbox') + $cbReadOnlyAttrib);
$thisAction = Xml::tags('p', null, $thisAction);
return $thisAction;
}
}
示例11: getTextArea
/**
* Get a labelled textarea to configure a variable
*
* @param $params Array
* Parameters are:
* var: The variable to be configured (required)
* label: The message name for the label (required)
* attribs: Additional attributes for the input element (optional)
* controlName: The name for the input element (optional)
* value: The current value of the variable (optional)
* help: The html for the help text (optional)
*
* @return string
*/
public function getTextArea($params)
{
if (!isset($params['controlName'])) {
$params['controlName'] = 'config_' . $params['var'];
}
if (!isset($params['value'])) {
$params['value'] = $this->getVar($params['var']);
}
if (!isset($params['attribs'])) {
$params['attribs'] = array();
}
if (!isset($params['help'])) {
$params['help'] = "";
}
return $this->label($params['label'], $params['controlName'], Xml::textarea($params['controlName'], $params['value'], 30, 5, $params['attribs'] + array('id' => $params['controlName'], 'class' => 'config-input-text', 'tabindex' => $this->nextTabIndex())), $params['help']);
}
示例12: showForm
function showForm($warning_msg = null)
{
global $wgVersion;
$out = $this->getOutput();
$out->addHTML(Xml::openElement('form', array('id' => 'powersearch', 'action' => $this->getTitle()->getFullUrl(), 'method' => 'post')) . "\n" . $this->hiddenField('title', $this->getTitle()->getPrefixedText()) . $this->hiddenField('continue', 1));
if (is_null($warning_msg)) {
$out->addWikiMsg('replacetext_docu');
} else {
$out->wrapWikiMsg("<div class=\"errorbox\">\n\$1\n</div><br clear=\"both\" />", $warning_msg);
}
$out->addHTML('<table><tr><td style="vertical-align: top;">');
$out->addWikiMsg('replacetext_originaltext');
$out->addHTML('</td><td>');
// 'width: auto' style is needed to override MediaWiki's
// normal 'width: 100%', which causes the textarea to get
// zero width in IE
$out->addHTML(Xml::textarea('target', $this->target, 50, 2, array('style' => 'width: auto;')));
$out->addHTML('</td></tr><tr><td style="vertical-align: top;">');
$out->addWikiMsg('replacetext_replacementtext');
$out->addHTML('</td><td>');
$out->addHTML(Xml::textarea('replacement', $this->replacement, 50, 2, array('style' => 'width: auto;')));
$out->addHTML('</td></tr></table>');
$out->addHTML(Xml::tags('p', null, Xml::checkLabel($this->msg('replacetext_useregex')->text(), 'use_regex', 'use_regex')) . "\n" . Xml::element('p', array('style' => 'font-style: italic'), $this->msg('replacetext_regexdocu')->text()));
// The interface is heavily based on the one in Special:Search.
$namespaces = SearchEngine::searchableNamespaces();
$tables = $this->namespaceTables($namespaces);
$out->addHTML("<div class=\"mw-search-formheader\"></div>\n" . "<fieldset id=\"mw-searchoptions\">\n" . Xml::tags('h4', null, $this->msg('powersearch-ns')->parse()));
// The ability to select/unselect groups of namespaces in the
// search interface exists only in some skins, like Vector -
// check for the presence of the 'powersearch-togglelabel'
// message to see if we can use this functionality here.
if ($this->msg('powersearch-togglelabel')->isDisabled()) {
// do nothing
} elseif (version_compare($wgVersion, '1.20', '>=')) {
// In MediaWiki 1.20, this became a lot simpler after
// the main work was passed off to Javascript
$out->addHTML(Html::element('div', array('id' => 'mw-search-togglebox')));
} else {
// MW <= 1.19
$out->addHTML(Xml::tags('div', array('id' => 'mw-search-togglebox'), Xml::label($this->msg('powersearch-togglelabel')->text(), 'mw-search-togglelabel') . Xml::element('input', array('type' => 'button', 'id' => 'mw-search-toggleall', 'onclick' => 'mwToggleSearchCheckboxes("all");', 'value' => $this->msg('powersearch-toggleall')->text())) . Xml::element('input', array('type' => 'button', 'id' => 'mw-search-togglenone', 'onclick' => 'mwToggleSearchCheckboxes("none");', 'value' => $this->msg('powersearch-togglenone')->text()))));
}
// end if
$out->addHTML(Xml::element('div', array('class' => 'divider'), '', false) . "{$tables}\n</fieldset>");
// @todo FIXME: raw html messages
$category_search_label = $this->msg('replacetext_categorysearch')->text();
$prefix_search_label = $this->msg('replacetext_prefixsearch')->text();
$out->addHTML("<fieldset id=\"mw-searchoptions\">\n" . Xml::tags('h4', null, $this->msg('replacetext_optionalfilters')->parse()) . Xml::element('div', array('class' => 'divider'), '', false) . "<p>{$category_search_label}\n" . Xml::input('category', 20, $this->category, array('type' => 'text')) . '</p>' . "<p>{$prefix_search_label}\n" . Xml::input('prefix', 20, $this->prefix, array('type' => 'text')) . '</p>' . "</fieldset>\n" . "<p>\n" . Xml::checkLabel($this->msg('replacetext_editpages')->text(), 'edit_pages', 'edit_pages', true) . '<br />' . Xml::checkLabel($this->msg('replacetext_movepages')->text(), 'move_pages', 'move_pages') . "</p>\n" . Xml::submitButton($this->msg('replacetext_continue')->text()) . Xml::closeElement('form'));
// Add Javascript specific to Special:Search
$out->addModules('mediawiki.special.search');
}
示例13: constructCreateForm
function constructCreateForm()
{
global $wgOut, $wgScript;
global $wgUserProperties, $wgActivityModes;
$wgOut->addHTML(Xml::openElement('form', array('action' => $this->getTitle()->getLocalURL(), 'method' => 'post')));
$wgOut->addHTML(Xml::element('h2', null, wfMsg('nss-create-account-header')) . "\n");
$wgOut->addHTML("<table border=\"1\" id=\"newuser\">\n");
$props = array_merge(array('username', 'email'), $wgUserProperties);
foreach ($props as $i) {
$msg = 'am-' . $i;
$wgOut->addHTML("\t<tr><th>" . (wfEmptyMsg($msg, wfMsg($msg)) ? $i : wfMsgHtml($msg)) . "</th><td>" . Xml::input("am-" . str_replace(' ', '_', $i), 40) . "</td></tr>\n");
}
global $wgActivityModes;
$select = new XmlSelect("am-active");
$select->setDefault('active');
$select->setAttribute('width', '100%');
foreach ($wgActivityModes as $key) {
$select->addOption($key);
}
$wgOut->addHTML("\t<tr><th>" . wfMsgHtml('am-active') . "</th><td>" . $select->getHTML() . "</td></tr>\n");
$wgOut->addHTML("</table>\n");
$wgOut->addHTML("<div id=\"newaccount-submit\">\n" . Html::Hidden('action', 'create') . Xml::checkLabel(wfMsg('nss-no-mail'), 'nss-no-mail', 'nss-no-mail') . "<br />\n" . Xml::element('input', array('type' => 'submit', 'value' => wfMsg('nss-create-account'))) . "</div>\n</form>\n");
$wgOut->addHTML(Xml::openElement('form', array('action' => $this->getTitle()->getLocalURL(), 'method' => 'post')));
$wgOut->addHTML("<div id=\"newaccount-raw\">\n" . Xml::textarea('nss-create-account-raw', '') . "\n" . Html::Hidden('action', 'create-raw') . Xml::checkLabel(wfMsg('nss-no-mail'), 'nss-no-mail', 'nss-no-mail') . "<br />\n" . Xml::element('input', array('type' => 'submit', 'value' => wfMsg('nss-create-account'))) . "</div>\n</form>\n");
}
示例14: showForm
function showForm()
{
global $wgOut, $wgUser, $wgContactRequireAll, $wgContactIncludeIP, $wgRequest;
#TODO: show captcha
$wgOut->setPageTitle(wfMsg('contactpage-title'));
$wgOut->addHTML($this->formularText);
if ($this->subject === '') {
$this->subject = wfMsgForContent('contactpage-defsubject');
}
$msgSuffix = $wgContactRequireAll ? '-required' : '';
$titleObj = SpecialPage::getTitleFor('Contact');
$action = $titleObj->getLocalURL('action=submit');
$token = $wgUser->isAnon() ? EDIT_TOKEN_SUFFIX : $wgUser->editToken();
//this kind of sucks, really...
$form = Xml::openElement('form', array('method' => 'post', 'action' => $action, 'id' => 'emailuser')) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('contactpage-legend')) . Xml::openElement('table', array('id' => 'mailheader')) . '<tr>
<td class="mw-label">' . Xml::label(wfMsg('emailsubject'), 'wpSubject') . '</td>
<td class="mw-input" id="mw-contactpage-subject">' . Xml::input('wpSubject', 60, $this->subject, array('type' => 'text', 'maxlength' => 200)) . '</td>
</tr>
<tr>
<td class="mw-label">' . Xml::label(wfMsg("contactpage-fromname{$msgSuffix}"), 'wpFromName') . '</td>
<td class="mw-input" id="mw-contactpage-from">' . Xml::input('wpFromName', 60, $this->fromname, array('type' => 'text', 'maxlength' => 200)) . '</td>
</tr>
<tr>
<td class="mw-label">' . Xml::label(wfMsg("contactpage-fromaddress{$msgSuffix}"), 'wpFromAddress') . '</td>
<td class="mw-input" id="mw-contactpage-address">' . Xml::input('wpFromAddress', 60, $this->fromaddress, array('type' => 'text', 'maxlength' => 200)) . '</td>
</tr>';
// Allow other extensions to add more fields into Special:Contact
wfRunHooks('ContactFormBeforeMessage', array($this, &$form));
$form .= '<tr>
<td></td>
<td class="mw-input" id="mw-contactpage-formfootnote">
<small>' . wfMsg("contactpage-formfootnotes{$msgSuffix}") . '</small>
</td>
</tr>
<tr>
<td class="mw-label">' . Xml::label(wfMsg('emailmessage'), 'wpText') . '</td>
<td class="mw-input">' . Xml::textarea('wpText', $this->text, 80, 20, array('id' => 'wpText')) . '</td>
</tr>';
if ($wgContactIncludeIP && $wgUser->isLoggedIn()) {
$form .= '<tr>
<td></td>
<td class="mw-input">' . Xml::checkLabel(wfMsg('contactpage-includeip'), 'wpIncludeIP', 'wpIncludeIP', false) . '</td>
</tr>';
}
$ccme = $this->wasPosted ? $this->cc_me : $wgUser->getBoolOption('ccmeonemails');
$form .= '<tr>
<td></td>
<td class="mw-input">' . Xml::checkLabel(wfMsg('emailccme'), 'wpCCMe', 'wpCCMe', $ccme) . '<br />' . $this->getCaptcha() . '</td>
</tr>
<tr>
<td></td>
<td class="mw-submit">' . Xml::submitButton(wfMsg('emailsend'), array('name' => 'wpSend', 'accesskey' => 's')) . '</td>
</tr>' . Html::hidden('wpEditToken', $token) . Html::hidden('formtype', $this->formType) . Xml::closeElement('table') . Xml::closeElement('fieldset') . Xml::closeElement('form');
$wgOut->addHTML($form);
}
示例15: 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;
}