本文整理汇总了PHP中Xml::namespaceSelector方法的典型用法代码示例。如果您正苦于以下问题:PHP Xml::namespaceSelector方法的具体用法?PHP Xml::namespaceSelector怎么用?PHP Xml::namespaceSelector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xml
的用法示例。
在下文中一共展示了Xml::namespaceSelector方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute($par)
{
global $wgUrlProtocols, $wgMiserMode;
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
$out->allowClickjacking();
$request = $this->getRequest();
$target = $request->getVal('target', $par);
$namespace = $request->getIntorNull('namespace', null);
$protocols_list = array();
foreach ($wgUrlProtocols as $prot) {
if ($prot !== '//') {
$protocols_list[] = $prot;
}
}
$target2 = $target;
$protocol = '';
$pr_sl = strpos($target2, '//');
$pr_cl = strpos($target2, ':');
if ($pr_sl) {
// For protocols with '//'
$protocol = substr($target2, 0, $pr_sl + 2);
$target2 = substr($target2, $pr_sl + 2);
} elseif (!$pr_sl && $pr_cl) {
// For protocols without '//' like 'mailto:'
$protocol = substr($target2, 0, $pr_cl + 1);
$target2 = substr($target2, $pr_cl + 1);
} elseif ($protocol == '' && $target2 != '') {
// default
$protocol = 'http://';
}
if ($protocol != '' && !in_array($protocol, $protocols_list)) {
// unsupported protocol, show original search request
$target2 = $target;
$protocol = '';
}
$out->addWikiMsg('linksearch-text', '<nowiki>' . $this->getLang()->commaList($wgUrlProtocols) . '</nowiki>');
$s = Xml::openElement('form', array('id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $GLOBALS['wgScript'])) . Html::hidden('title', $this->getTitle()->getPrefixedDbKey()) . '<fieldset>' . Xml::element('legend', array(), wfMsg('linksearch')) . Xml::inputLabel(wfMsg('linksearch-pat'), 'target', 'target', 50, $target) . ' ';
if (!$wgMiserMode) {
$s .= Xml::label(wfMsg('linksearch-ns'), 'namespace') . ' ' . Xml::namespaceSelector($namespace, '');
}
$s .= Xml::submitButton(wfMsg('linksearch-ok')) . '</fieldset>' . Xml::closeElement('form');
$out->addHTML($s);
if ($target != '') {
$this->setParams(array('query' => $target2, 'namespace' => $namespace, 'protocol' => $protocol));
parent::execute($par);
if ($this->mMungedQuery === false) {
$out->addWikiMsg('linksearch-error');
}
}
}
示例2: namespaceForm
/**
* HTML for the top form
* @param integer $namespace A namespace constant (default NS_MAIN).
* @param string $from Article name we are starting listing at.
*/
function namespaceForm($namespace = NS_MAIN, $from = '')
{
global $wgScript, $wgContLang;
$t = SpecialPage::getTitleFor($this->name);
$align = $wgContLang->isRtl() ? 'left' : 'right';
$out = Xml::openElement('div', array('class' => 'namespaceoptions'));
$out .= Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
$out .= Xml::hidden('title', $t->getPrefixedText());
$out .= Xml::openElement('table', array('id' => 'nsselect', 'class' => 'allpages'));
$out .= "<tr>\n\t\t\t<td align='{$align}'>" . Xml::label(wfMsg($this->nsfromMsg), 'nsfrom') . "</td>\n\t\t\t<td>" . Xml::input('from', 20, $from, array('id' => 'nsfrom')) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='{$align}'>" . Xml::label(wfMsg('namespace'), 'namespace') . "</td>\n\t\t\t<td>" . Xml::namespaceSelector($namespace, null) . Xml::submitButton(wfMsg('allpagessubmit')) . "</td>\n\t\t\t</tr>";
$out .= Xml::closeElement('table');
$out .= Xml::closeElement('form');
$out .= Xml::closeElement('div');
return $out;
}
示例3: wfSpecialLinkSearch
/**
* Special:LinkSearch to search the external-links table.
*/
function wfSpecialLinkSearch($par)
{
list($limit, $offset) = wfCheckLimits();
global $wgOut, $wgUrlProtocols, $wgMiserMode, $wgLang;
$target = $GLOBALS['wgRequest']->getVal('target', $par);
$namespace = $GLOBALS['wgRequest']->getIntorNull('namespace', null);
$protocols_list[] = '';
foreach ($wgUrlProtocols as $prot) {
$protocols_list[] = $prot;
}
$target2 = $target;
$protocol = '';
$pr_sl = strpos($target2, '//');
$pr_cl = strpos($target2, ':');
if ($pr_sl) {
// For protocols with '//'
$protocol = substr($target2, 0, $pr_sl + 2);
$target2 = substr($target2, $pr_sl + 2);
} elseif (!$pr_sl && $pr_cl) {
// For protocols without '//' like 'mailto:'
$protocol = substr($target2, 0, $pr_cl + 1);
$target2 = substr($target2, $pr_cl + 1);
} elseif ($protocol == '' && $target2 != '') {
// default
$protocol = 'http://';
}
if (!in_array($protocol, $protocols_list)) {
// unsupported protocol, show original search request
$target2 = $target;
$protocol = '';
}
$self = Title::makeTitle(NS_SPECIAL, 'Linksearch');
$wgOut->allowClickjacking();
$wgOut->addWikiMsg('linksearch-text', '<nowiki>' . $wgLang->commaList($wgUrlProtocols) . '</nowiki>');
$s = Xml::openElement('form', array('id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $GLOBALS['wgScript'])) . Html::hidden('title', $self->getPrefixedDbKey()) . '<fieldset>' . Xml::element('legend', array(), wfMsg('linksearch')) . Xml::inputLabel(wfMsg('linksearch-pat'), 'target', 'target', 50, $target) . ' ';
if (!$wgMiserMode) {
$s .= Xml::label(wfMsg('linksearch-ns'), 'namespace') . ' ' . Xml::namespaceSelector($namespace, '');
}
$s .= Xml::submitButton(wfMsg('linksearch-ok')) . '</fieldset>' . Xml::closeElement('form');
$wgOut->addHTML($s);
if ($target != '') {
$searcher = new LinkSearchPage();
$searcher->setParams(array('query' => $target2, 'namespace' => $namespace, 'protocol' => $protocol));
$searcher->doQuery($offset, $limit);
}
}
示例4: namespaceForm
/**
* HTML for the top form
* @param integer $namespace A namespace constant (default NS_MAIN).
* @param string $from dbKey we are starting listing at.
* @param string $to dbKey we are ending listing at.
*/
function namespaceForm($namespace = NS_MAIN, $from = '', $to = '')
{
global $wgScript;
$t = $this->getTitle();
$out = Xml::openElement('div', array('class' => 'namespaceoptions'));
$out .= Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
$out .= Xml::hidden('title', $t->getPrefixedText());
$out .= Xml::openElement('fieldset');
$out .= Xml::element('legend', null, wfMsg('allpages'));
$out .= Xml::openElement('table', array('id' => 'nsselect', 'class' => 'allpages'));
$out .= "<tr>\n\t<td class='mw-label'>" . Xml::label(wfMsg('allpagesfrom'), 'nsfrom') . "\t</td>\n\t<td class='mw-input'>" . Xml::input('from', 30, str_replace('_', ' ', $from), array('id' => 'nsfrom')) . "\t</td>\n</tr>\n<tr>\n\t<td class='mw-label'>" . Xml::label(wfMsg('allpagesto'), 'nsto') . "\t</td>\n\t\t\t<td class='mw-input'>" . Xml::input('to', 30, str_replace('_', ' ', $to), array('id' => 'nsto')) . "\t\t</td>\n</tr>\n<tr>\n\t<td class='mw-label'>" . Xml::label(wfMsg('namespace'), 'namespace') . "\t</td>\n\t\t\t<td class='mw-input'>" . Xml::namespaceSelector($namespace, null) . ' ' . Xml::submitButton(wfMsg('allpagessubmit')) . "\t</td>\n</tr>";
$out .= Xml::closeElement('table');
$out .= Xml::closeElement('fieldset');
$out .= Xml::closeElement('form');
$out .= Xml::closeElement('div');
return $out;
}
示例5: getHTML
public function getHTML()
{
global $wgRequest, $wgScript, $wgTitle;
$s = '';
$s .= Xml::fieldset(wfMsg('listuserrestrictions-legend'));
$s .= "<form action=\"{$wgScript}\">";
$s .= Xml::hidden('title', $wgTitle->getPrefixedDbKey());
$s .= Xml::label(wfMsgHtml('listuserrestrictions-type'), 'type') . ' ' . self::typeSelector('type', $wgRequest->getVal('type'), 'type');
$s .= ' ';
$s .= Xml::inputLabel(wfMsgHtml('listuserrestrictions-user'), 'user', 'user', false, $wgRequest->getVal('user'));
$s .= '<p>';
$s .= Xml::label(wfMsgHtml('listuserrestrictions-namespace'), 'namespace') . ' ' . Xml::namespaceSelector($wgRequest->getVal('namespace'), '', 'namespace');
$s .= ' ';
$s .= Xml::inputLabel(wfMsgHtml('listuserrestrictions-page'), 'page', 'page', false, $wgRequest->getVal('page'));
$s .= Xml::submitButton(wfMsg('listuserrestrictions-submit'));
$s .= "</p></form></fieldset>";
return $s;
}
示例6: getForm
/**
* Generates the namespace selector form with hidden attributes.
* @param $this->opts Array: the options to be included.
*/
protected function getForm()
{
global $wgScript;
$this->opts['title'] = $this->getTitle()->getPrefixedText();
if (!isset($this->opts['target'])) {
$this->opts['target'] = '';
} else {
$this->opts['target'] = str_replace('_', ' ', $this->opts['target']);
}
if (!isset($this->opts['namespace'])) {
$this->opts['namespace'] = '';
}
if (!isset($this->opts['contribs'])) {
$this->opts['contribs'] = 'user';
}
if (!isset($this->opts['year'])) {
$this->opts['year'] = '';
}
if (!isset($this->opts['month'])) {
$this->opts['month'] = '';
}
if ($this->opts['contribs'] == 'newbie') {
$this->opts['target'] = '';
}
if (!isset($this->opts['tagfilter'])) {
$this->opts['tagfilter'] = '';
}
$f = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
# Add hidden params for tracking
foreach ($this->opts as $name => $value) {
if (in_array($name, array('namespace', 'target', 'contribs', 'year', 'month'))) {
continue;
}
$f .= "\t" . Xml::hidden($name, $value) . "\n";
}
$tagFilter = ChangeTags::buildTagFilterSelector($this->opts['tagfilter']);
$f .= '<fieldset>' . Xml::element('legend', array(), wfMsg('sp-contributions-search')) . Xml::radioLabel(wfMsgExt('sp-contributions-newbies', array('parsemag')), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie' ? true : false) . '<br />' . Xml::radioLabel(wfMsgExt('sp-contributions-username', array('parsemag')), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user' ? true : false) . ' ' . Html::input('target', $this->opts['target'], 'text', array('size' => '20', 'required' => '') + ($this->opts['target'] ? array() : array('autofocus'))) . ' ' . '<span style="white-space: nowrap">' . Xml::label(wfMsg('namespace'), 'namespace') . ' ' . Xml::namespaceSelector($this->opts['namespace'], '') . '</span>' . ($tagFilter ? Xml::tags('p', null, implode(' ', $tagFilter)) : '') . Xml::openElement('p') . '<span style="white-space: nowrap">' . Xml::dateMenu($this->opts['year'], $this->opts['month']) . '</span>' . ' ' . Xml::submitButton(wfMsg('sp-contributions-submit')) . Xml::closeElement('p');
$explain = wfMsgExt('sp-contributions-explain', 'parseinline');
if (!wfEmptyMsg('sp-contributions-explain', $explain)) {
$f .= "<p id='mw-sp-contributions-explain'>{$explain}</p>";
}
$f .= '</fieldset>' . Xml::closeElement('form');
return $f;
}
示例7: getForm
/**
* Generates the namespace selector form with hidden attributes.
* @return String: HTML fragment
*/
protected function getForm()
{
global $wgScript;
$this->opts['title'] = $this->getTitle()->getPrefixedText();
if (!isset($this->opts['target'])) {
$this->opts['target'] = '';
} else {
$this->opts['target'] = str_replace('_', ' ', $this->opts['target']);
}
if (!isset($this->opts['namespace'])) {
$this->opts['namespace'] = '';
}
if (!isset($this->opts['nsInvert'])) {
$this->opts['nsInvert'] = '';
}
if (!isset($this->opts['associated'])) {
$this->opts['associated'] = false;
}
if (!isset($this->opts['contribs'])) {
$this->opts['contribs'] = 'user';
}
if (!isset($this->opts['year'])) {
$this->opts['year'] = '';
}
if (!isset($this->opts['month'])) {
$this->opts['month'] = '';
}
if ($this->opts['contribs'] == 'newbie') {
$this->opts['target'] = '';
}
if (!isset($this->opts['tagfilter'])) {
$this->opts['tagfilter'] = '';
}
if (!isset($this->opts['topOnly'])) {
$this->opts['topOnly'] = false;
}
$form = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form'));
# Add hidden params for tracking except for parameters in $skipParameters
$skipParameters = array('namespace', 'nsInvert', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'associated');
foreach ($this->opts as $name => $value) {
if (in_array($name, $skipParameters)) {
continue;
}
$form .= "\t" . Html::hidden($name, $value) . "\n";
}
$tagFilter = ChangeTags::buildTagFilterSelector($this->opts['tagfilter']);
if ($tagFilter) {
$filterSelection = Xml::tags('td', array('class' => 'mw-label'), array_shift($tagFilter)) . Xml::tags('td', array('class' => 'mw-input'), implode(' ', $tagFilter));
} else {
$filterSelection = Xml::tags('td', array('colspan' => 2), '');
}
$targetSelection = Xml::tags('td', array('colspan' => 2), Xml::radioLabel($this->msg('sp-contributions-newbies')->text(), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie', array('class' => 'mw-input')) . '<br />' . Xml::radioLabel($this->msg('sp-contributions-username')->text(), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user', array('class' => 'mw-input')) . ' ' . Html::input('target', $this->opts['target'], 'text', array('size' => '20', 'required' => '', 'class' => 'mw-input') + ($this->opts['target'] ? array() : array('autofocus'))) . ' ');
$namespaceSelection = Xml::tags('td', array('class' => 'mw-label'), Xml::label($this->msg('namespace')->text(), 'namespace', '')) . Xml::tags('td', null, Xml::namespaceSelector($this->opts['namespace'], '') . ' ' . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('invert')->text(), 'nsInvert', 'nsInvert', $this->opts['nsInvert'], array('title' => $this->msg('tooltip-invert')->text(), 'class' => 'mw-input')) . ' ') . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('namespace_association')->text(), 'associated', 'associated', $this->opts['associated'], array('title' => $this->msg('tooltip-namespace_association')->text(), 'class' => 'mw-input')) . ' '));
$extraOptions = Xml::tags('td', array('colspan' => 2), Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('history-show-deleted')->text(), 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'], array('class' => 'mw-input'))) . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('sp-contributions-toponly')->text(), 'topOnly', 'mw-show-top-only', $this->opts['topOnly'], array('class' => 'mw-input'))));
$dateSelectionAndSubmit = Xml::tags('td', array('colspan' => 2), Xml::dateMenu($this->opts['year'], $this->opts['month']) . ' ' . Xml::submitButton($this->msg('sp-contributions-submit')->text(), array('class' => 'mw-submit')));
$form .= Xml::fieldset($this->msg('sp-contributions-search')->text()) . Xml::openElement('table', array('class' => 'mw-contributions-table')) . Xml::openElement('tr') . $targetSelection . Xml::closeElement('tr') . Xml::openElement('tr') . $namespaceSelection . Xml::closeElement('tr') . Xml::openElement('tr') . $filterSelection . Xml::closeElement('tr') . Xml::openElement('tr') . $extraOptions . Xml::closeElement('tr') . Xml::openElement('tr') . $dateSelectionAndSubmit . Xml::closeElement('tr') . Xml::closeElement('table');
$explain = $this->msg('sp-contributions-explain');
if ($explain->exists()) {
$form .= "<p id='mw-sp-contributions-explain'>{$explain}</p>";
}
$form .= Xml::closeElement('fieldset') . Xml::closeElement('form');
return $form;
}
示例8: whatlinkshereForm
function whatlinkshereForm()
{
global $wgScript;
// We get nicer value from the title object
$this->opts->consumeValue('target');
// Reset these for new requests
$this->opts->consumeValues(array('back', 'from'));
$target = $this->target ? $this->target->getPrefixedText() : '';
$namespace = $this->opts->consumeValue('namespace');
# Build up the form
$f = Xml::openElement('form', array('action' => $wgScript));
# Values that should not be forgotten
$f .= Html::hidden('title', $this->getTitle()->getPrefixedText());
foreach ($this->opts->getUnconsumedValues() as $name => $value) {
$f .= Html::hidden($name, $value);
}
$f .= Xml::fieldset(wfMsg('whatlinkshere'));
# Target input
$f .= Xml::inputLabel(wfMsg('whatlinkshere-page'), 'target', 'mw-whatlinkshere-target', 40, $target);
$f .= ' ';
# Namespace selector
$f .= Xml::label(wfMsg('namespace'), 'namespace') . ' ' . Xml::namespaceSelector($namespace, '');
$f .= ' ';
# Submit
$f .= Xml::submitButton(wfMsg('allpagessubmit'));
# Close
$f .= Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n";
return $f;
}
示例9: getForm
/**
* Generates the namespace selector form with hidden attributes.
* @param $this->opts Array: the options to be included.
*/
protected function getForm()
{
global $wgScript, $wgTitle;
$this->opts['title'] = $wgTitle->getPrefixedText();
if (!isset($this->opts['target'])) {
$this->opts['target'] = '';
} else {
$this->opts['target'] = str_replace('_', ' ', $this->opts['target']);
}
if (!isset($this->opts['namespace'])) {
$this->opts['namespace'] = '';
}
if (!isset($this->opts['contribs'])) {
$this->opts['contribs'] = 'user';
}
if (!isset($this->opts['year'])) {
$this->opts['year'] = '';
}
if (!isset($this->opts['month'])) {
$this->opts['month'] = '';
}
if ($this->opts['contribs'] == 'newbie') {
$this->opts['target'] = '';
}
$f = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
foreach ($this->opts as $name => $value) {
if (in_array($name, array('namespace', 'target', 'contribs', 'year', 'month'))) {
continue;
}
$f .= "\t" . Xml::hidden($name, $value) . "\n";
}
$f .= '<fieldset>' . Xml::element('legend', array(), wfMsg('sp-contributions-search')) . Xml::radioLabel(wfMsgExt('sp-contributions-newbies', array('parseinline')), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie' ? true : false) . '<br />' . Xml::radioLabel(wfMsgExt('sp-contributions-username', array('parseinline')), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user' ? true : false) . ' ' . Xml::input('target', 20, $this->opts['target']) . ' ' . '<span style="white-space: nowrap">' . Xml::label(wfMsg('namespace'), 'namespace') . ' ' . Xml::namespaceSelector($this->opts['namespace'], '') . '</span>' . Xml::openElement('p') . '<span style="white-space: nowrap">' . Xml::label(wfMsg('year'), 'year') . ' ' . Xml::input('year', 4, $this->opts['year'], array('id' => 'year', 'maxlength' => 4)) . '</span>' . ' ' . '<span style="white-space: nowrap">' . Xml::label(wfMsg('month'), 'month') . ' ' . Xml::monthSelector($this->opts['month'], -1) . ' ' . '</span>' . Xml::submitButton(wfMsg('sp-contributions-submit')) . Xml::closeElement('p');
$explain = wfMsgExt('sp-contributions-explain', 'parseinline');
if (!wfEmptyMsg('sp-contributions-explain', $explain)) {
$f .= "<p>{$explain}</p>";
}
$f .= '</fieldset>' . Xml::closeElement('form');
return $f;
}
示例10: 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'));
}
示例11: testNamespaceSelector
function testNamespaceSelector()
{
$this->assertEquals('<select class="namespaceselector" id="namespace" name="namespace">' . "\n" . '<option value="0">(Main)</option>' . "\n" . '<option value="1">Talk</option>' . "\n" . '<option value="2">User</option>' . "\n" . '<option value="3">User talk</option>' . "\n" . '<option value="4">MyWiki</option>' . "\n" . '<option value="5">MyWiki Talk</option>' . "\n" . '<option value="6">File</option>' . "\n" . '<option value="7">File talk</option>' . "\n" . '<option value="8">MediaWiki</option>' . "\n" . '<option value="9">MediaWiki talk</option>' . "\n" . '<option value="10">Template</option>' . "\n" . '<option value="11">Template talk</option>' . "\n" . '<option value="100">Custom</option>' . "\n" . '<option value="101">Custom talk</option>' . "\n" . '</select>', Xml::namespaceSelector(), 'Basic namespace selector without custom options');
$this->assertEquals('<label for="namespace">Select a namespace:</label>' . ' <select class="namespaceselector" id="namespace" name="myname">' . "\n" . '<option value="all">all</option>' . "\n" . '<option value="0">(Main)</option>' . "\n" . '<option value="1">Talk</option>' . "\n" . '<option value="2" selected="">User</option>' . "\n" . '<option value="3">User talk</option>' . "\n" . '<option value="4">MyWiki</option>' . "\n" . '<option value="5">MyWiki Talk</option>' . "\n" . '<option value="6">File</option>' . "\n" . '<option value="7">File talk</option>' . "\n" . '<option value="8">MediaWiki</option>' . "\n" . '<option value="9">MediaWiki talk</option>' . "\n" . '<option value="10">Template</option>' . "\n" . '<option value="11">Template talk</option>' . "\n" . '<option value="100">Custom</option>' . "\n" . '<option value="101">Custom talk</option>' . "\n" . '</select>', Xml::namespaceSelector($selected = '2', $all = 'all', $element_name = 'myname', $label = 'Select a namespace:'), 'Basic namespace selector with custom values');
}
示例12: HTMLnamespaceselector
function HTMLnamespaceselector($selected = '', $allnamespaces = null, $includehidden = false)
{
return Xml::namespaceSelector($selected, $allnamespaces, $includehidden);
}
示例13: execute
//.........这里部分代码省略.........
} elseif ($request->getCheck('exportall') && $wgExportAllowAll) {
$this->doExport = true;
$exportall = true;
} elseif ($request->wasPosted() && $par == '') {
$page = $request->getText('pages');
$this->curonly = $request->getCheck('curonly');
$rawOffset = $request->getVal('offset');
if ($rawOffset) {
$offset = wfTimestamp(TS_MW, $rawOffset);
} else {
$offset = null;
}
$limit = $request->getInt('limit');
$dir = $request->getVal('dir');
$history = array('dir' => 'asc', 'offset' => false, 'limit' => $wgExportMaxHistory);
$historyCheck = $request->getCheck('history');
if ($this->curonly) {
$history = WikiExporter::CURRENT;
} elseif (!$historyCheck) {
if ($limit > 0 && ($wgExportMaxHistory == 0 || $limit < $wgExportMaxHistory)) {
$history['limit'] = $limit;
}
if (!is_null($offset)) {
$history['offset'] = $offset;
}
if (strtolower($dir) == 'desc') {
$history['dir'] = 'desc';
}
}
if ($page != '') {
$this->doExport = true;
}
} else {
// Default to current-only for GET requests.
$page = $request->getText('pages', $par);
$historyCheck = $request->getCheck('history');
if ($historyCheck) {
$history = WikiExporter::FULL;
} else {
$history = WikiExporter::CURRENT;
}
if ($page != '') {
$this->doExport = true;
}
}
if (!$wgExportAllowHistory) {
// Override
$history = WikiExporter::CURRENT;
}
$list_authors = $request->getCheck('listauthors');
if (!$this->curonly || !$wgExportAllowListContributors) {
$list_authors = false;
}
if ($this->doExport) {
$this->getOutput()->disable();
// Cancel output buffering and gzipping if set
// This should provide safer streaming for pages with history
wfResetOutputBuffers();
$request->response()->header("Content-type: application/xml; charset=utf-8");
if ($request->getCheck('wpDownload')) {
// Provide a sane filename suggestion
$filename = urlencode($wgSitename . '-' . wfTimestampNow() . '.xml');
$request->response()->header("Content-disposition: attachment;filename={$filename}");
}
$this->doExport($page, $history, $list_authors, $exportall);
return;
}
$out = $this->getOutput();
$out->addWikiMsg('exporttext');
$form = Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalUrl('action=submit')));
$form .= Xml::inputLabel(wfMsg('export-addcattext'), 'catname', 'catname', 40) . ' ';
$form .= Xml::submitButton(wfMsg('export-addcat'), array('name' => 'addcat')) . '<br />';
if ($wgExportFromNamespaces) {
$form .= Xml::namespaceSelector($nsindex, null, 'nsindex', wfMsg('export-addnstext')) . ' ';
$form .= Xml::submitButton(wfMsg('export-addns'), array('name' => 'addns')) . '<br />';
}
if ($wgExportAllowAll) {
$form .= Xml::checkLabel(wfMsg('exportall'), 'exportall', 'exportall', $request->wasPosted() ? $request->getCheck('exportall') : false) . '<br />';
}
$form .= Xml::element('textarea', array('name' => 'pages', 'cols' => 40, 'rows' => 10), $page, false);
$form .= '<br />';
if ($wgExportAllowHistory) {
$form .= Xml::checkLabel(wfMsg('exportcuronly'), 'curonly', 'curonly', $request->wasPosted() ? $request->getCheck('curonly') : true) . '<br />';
} else {
$out->addHTML(wfMsgExt('exportnohistory', 'parse'));
}
$form .= Xml::checkLabel(wfMsg('export-templates'), 'templates', 'wpExportTemplates', $request->wasPosted() ? $request->getCheck('templates') : false) . '<br />';
if ($wgExportMaxLinkDepth || $this->userCanOverrideExportDepth()) {
$form .= Xml::inputLabel(wfMsg('export-pagelinks'), 'pagelink-depth', 'pagelink-depth', 20, 0) . '<br />';
}
// Enable this when we can do something useful exporting/importing image information. :)
//$form .= Xml::checkLabel( wfMsg( 'export-images' ), 'images', 'wpExportImages', false ) . '<br />';
$form .= Xml::checkLabel(wfMsg('export-download'), 'wpDownload', 'wpDownload', $request->wasPosted() ? $request->getCheck('wpDownload') : true) . '<br />';
if ($wgExportAllowListContributors) {
$form .= Xml::checkLabel(wfMsg('exportlistauthors'), 'listauthors', 'listauthors', $request->wasPosted() ? $request->getCheck('listauthors') : false) . '<br />';
}
$form .= Xml::submitButton(wfMsg('export-submit'), Linker::tooltipAndAccesskeyAttribs('export'));
$form .= Xml::closeElement('form');
$out->addHTML($form);
}
示例14: deletedContributionsForm
/**
* Generates the namespace selector form with hidden attributes.
* @param $options Array: the options to be included.
*/
function deletedContributionsForm($options)
{
global $wgScript, $wgTitle, $wgRequest;
$options['title'] = $wgTitle->getPrefixedText();
if (!isset($options['target'])) {
$options['target'] = '';
} else {
$options['target'] = str_replace('_', ' ', $options['target']);
}
if (!isset($options['namespace'])) {
$options['namespace'] = '';
}
if (!isset($options['contribs'])) {
$options['contribs'] = 'user';
}
if ($options['contribs'] == 'newbie') {
$options['target'] = '';
}
$f = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
foreach ($options as $name => $value) {
if (in_array($name, array('namespace', 'target', 'contribs'))) {
continue;
}
$f .= "\t" . Xml::hidden($name, $value) . "\n";
}
$f .= '<fieldset>' . Xml::element('legend', array(), wfMsg('sp-contributions-search')) . wfMsgExt('sp-contributions-username', array('parseinline')) . ' ' . Xml::input('target', 20, $options['target']) . ' ' . Xml::label(wfMsg('namespace'), 'namespace') . ' ' . Xml::namespaceSelector($options['namespace'], '') . Xml::submitButton(wfMsg('sp-contributions-submit')) . '</fieldset>' . Xml::closeElement('form');
return $f;
}
示例15: getForm
/**
* Generates the namespace selector form with hidden attributes.
* @param $options Array: the options to be included.
*/
function getForm($options)
{
global $wgScript;
$options['title'] = SpecialPage::getTitleFor('DeletedContributions')->getPrefixedText();
if (!isset($options['target'])) {
$options['target'] = '';
} else {
$options['target'] = str_replace('_', ' ', $options['target']);
}
if (!isset($options['namespace'])) {
$options['namespace'] = '';
}
if (!isset($options['contribs'])) {
$options['contribs'] = 'user';
}
if ($options['contribs'] == 'newbie') {
$options['target'] = '';
}
$f = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
foreach ($options as $name => $value) {
if (in_array($name, array('namespace', 'target', 'contribs'))) {
continue;
}
$f .= "\t" . Html::hidden($name, $value) . "\n";
}
$f .= Xml::openElement('fieldset') . Xml::element('legend', array(), wfMsg('sp-contributions-search')) . Xml::tags('label', array('for' => 'target'), wfMsgExt('sp-contributions-username', 'parseinline')) . ' ' . Html::input('target', $options['target'], 'text', array('size' => '20', 'required' => '') + ($options['target'] ? array() : array('autofocus'))) . ' ' . Xml::label(wfMsg('namespace'), 'namespace') . ' ' . Xml::namespaceSelector($options['namespace'], '') . ' ' . Xml::submitButton(wfMsg('sp-contributions-submit')) . Xml::closeElement('fieldset') . Xml::closeElement('form');
return $f;
}