本文整理汇总了PHP中Html::namespaceSelector方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::namespaceSelector方法的具体用法?PHP Html::namespaceSelector怎么用?PHP Html::namespaceSelector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::namespaceSelector方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: promptForm
/**
* Prompt for a username or IP address.
*
* @param $userName string
*/
protected function promptForm($userName = '')
{
$out = $this->getOutput();
$out->addModules('mediawiki.userSuggest');
$out->addWikiMsg('nuke-tools');
$out->addHTML(Xml::openElement('form', array('action' => $this->getPageTitle()->getLocalURL('action=submit'), 'method' => 'post')) . '<table><tr>' . '<td>' . Xml::label($this->msg('nuke-userorip')->text(), 'nuke-target') . '</td>' . '<td>' . Xml::input('target', 40, $userName, array('id' => 'nuke-target', 'class' => 'mw-autocomplete-user', 'autofocus' => true)) . '</td>' . '</tr><tr>' . '<td>' . Xml::label($this->msg('nuke-pattern')->text(), 'nuke-pattern') . '</td>' . '<td>' . Xml::input('pattern', 40, '', array('id' => 'nuke-pattern')) . '</td>' . '</tr><tr>' . '<td>' . Xml::label($this->msg('nuke-namespace')->text(), 'nuke-namespace') . '</td>' . '<td>' . Html::namespaceSelector(array('all' => 'all'), array('name' => 'namespace')) . '</td>' . '</tr><tr>' . '<td>' . Xml::label($this->msg('nuke-maxpages')->text(), 'nuke-limit') . '</td>' . '<td>' . Xml::input('limit', 7, '500', array('id' => 'nuke-limit')) . '</td>' . '</tr><tr>' . '<td></td>' . '<td>' . Xml::submitButton($this->msg('nuke-submit-user')->text()) . '</td>' . '</tr></table>' . Html::hidden('wpEditToken', $this->getUser()->getEditToken()) . Xml::closeElement('form'));
}
示例2: 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->getLanguage()->commaList($protocols_list) . '</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(), $this->msg('linksearch')->text()) . Xml::inputLabel($this->msg('linksearch-pat')->text(), 'target', 'target', 50, $target) . ' ';
if (!$wgMiserMode) {
$s .= Html::namespaceSelector(array('selected' => $namespace, 'all' => '', 'label' => $this->msg('linksearch-ns')->text()), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector'));
}
$s .= Xml::submitButton($this->msg('linksearch-ok')->text()) . '</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');
}
}
}
示例3: execute
function execute($par)
{
global $wgUrlProtocols, $wgMiserMode, $wgScript;
$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;
// Get protocol, default is http://
$protocol = 'http://';
$bits = wfParseUrl($target);
if (isset($bits['scheme']) && isset($bits['delimiter'])) {
$protocol = $bits['scheme'] . $bits['delimiter'];
// Make sure wfParseUrl() didn't make some well-intended correction in the
// protocol
if (strcasecmp($protocol, substr($target, 0, strlen($protocol))) === 0) {
$target2 = substr($target, strlen($protocol));
} else {
// If it did, let LinkFilter::makeLikeArray() handle this
$protocol = '';
}
}
$out->addWikiMsg('linksearch-text', '<nowiki>' . $this->getLanguage()->commaList($protocols_list) . '</nowiki>', count($protocols_list));
$s = Html::openElement('form', array('id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $wgScript)) . "\n" . Html::hidden('title', $this->getPageTitle()->getPrefixedDBkey()) . "\n" . Html::openElement('fieldset') . "\n" . Html::element('legend', array(), $this->msg('linksearch')->text()) . "\n" . Xml::inputLabel($this->msg('linksearch-pat')->text(), 'target', 'target', 50, $target) . "\n";
if (!$wgMiserMode) {
$s .= Html::namespaceSelector(array('selected' => $namespace, 'all' => '', 'label' => $this->msg('linksearch-ns')->text()), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector'));
}
$s .= Xml::submitButton($this->msg('linksearch-ok')->text()) . "\n" . Html::closeElement('fieldset') . "\n" . Html::closeElement('form') . "\n";
$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');
}
}
}
示例4: namespaceFilterForm
/**
* Creates the choose namespace selection
*
* @todo Uses radio buttons (HASHAR)
* @param $opts FormOptions
* @return String
*/
protected function namespaceFilterForm(FormOptions $opts)
{
# start wikia change
$nsSelect = '';
/* Wikia Change */
wfRunHooks('onGetNamespaceCheckbox', array(&$nsSelect, $opts['namespace'], '', 'namespace', null));
$nsLabel = Xml::label(wfMsg('namespace'), 'namespace');
if (empty($nsSelect)) {
$nsSelect = Html::namespaceSelector(array('selected' => $opts['namespace'], 'all' => ''), array('name' => 'namespace', 'id' => 'namespace'));
# end wikia change
$invert = Xml::checkLabel(wfMsg('invert'), 'invert', 'nsinvert', $opts['invert'], array('title' => wfMsg('tooltip-invert')));
$associated = Xml::checkLabel(wfMsg('namespace_association'), 'associated', 'nsassociated', $opts['associated'], array('title' => wfMsg('tooltip-namespace_association')));
} else {
$invert = "";
$associated = "";
}
/* Wikia Change end*/
return array($nsLabel, "{$nsSelect} {$invert} {$associated}");
}
示例5: getNamespaceMenu
/**
* Prepare the namespace filter drop-down; standard namespace
* selector, sans the MediaWiki namespace
*
* @param $namespace Mixed: pre-select namespace
* @return string
*/
function getNamespaceMenu( $namespace = null ) {
return Html::namespaceSelector(
array(
'selected' => $namespace,
'all' => '',
'label' => $this->msg( 'namespace' )->text()
), array(
'name' => 'namespace',
'id' => 'namespace',
'class' => 'namespaceselector',
)
);
}
示例6: namespaceSelector
/**
* Build a drop-down box for selecting a namespace
*
* @param $selected Mixed: Namespace which should be pre-selected
* @param $all Mixed: Value of an item denoting all namespaces, or null to omit
* @param $element_name String: value of the "name" attribute of the select tag
* @param string $label optional label to add to the field
* @return string
* @deprecated since 1.19
*/
public static function namespaceSelector($selected = '', $all = null, $element_name = 'namespace', $label = null)
{
wfDeprecated(__METHOD__, '1.19');
return Html::namespaceSelector(array('selected' => $selected, 'all' => $all, 'label' => $label), array('name' => $element_name, 'id' => 'namespace', 'class' => 'namespaceselector'));
}
示例7: showForm
private function showForm()
{
global $wgImportSources, $wgExportMaxLinkDepth;
$action = $this->getTitle()->getLocalUrl(array('action' => 'submit'));
$user = $this->getUser();
$out = $this->getOutput();
if ($user->isAllowed('importupload')) {
$out->addHTML(Xml::fieldset($this->msg('import-upload')->text()) . Xml::openElement('form', array('enctype' => 'multipart/form-data', 'method' => 'post', 'action' => $action, 'id' => 'mw-import-upload-form')) . $this->msg('importtext')->parseAsBlock() . Html::hidden('action', 'submit') . Html::hidden('source', 'upload') . Xml::openElement('table', array('id' => 'mw-import-table')) . "<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-upload-filename')->text(), 'xmlimport') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('xmlimport', 50, '', array('type' => 'file')) . ' ' . "</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($this->msg('import-comment')->text(), 'mw-import-comment') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('log-comment', 50, '', array('id' => 'mw-import-comment', 'type' => 'text')) . ' ' . "</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($this->msg('import-interwiki-rootpage')->text(), 'mw-interwiki-rootpage') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('rootpage', 50, $this->rootpage, array('id' => 'mw-interwiki-rootpage', 'type' => 'text')) . ' ' . "</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($this->msg('uploadbtn')->text()) . "</td>\n\t\t\t\t</tr>" . Xml::closeElement('table') . Html::hidden('editToken', $user->getEditToken()) . Xml::closeElement('form') . Xml::closeElement('fieldset'));
} else {
if (empty($wgImportSources)) {
$out->addWikiMsg('importnosources');
}
}
if ($user->isAllowed('import') && !empty($wgImportSources)) {
# Show input field for import depth only if $wgExportMaxLinkDepth > 0
$importDepth = '';
if ($wgExportMaxLinkDepth > 0) {
$importDepth = "<tr>\n\t\t\t\t\t\t\t<td class='mw-label'>" . $this->msg('export-pagelinks')->parse() . "</td>\n\t\t\t\t\t\t\t<td class='mw-input'>" . Xml::input('pagelink-depth', 3, 0) . "</td>\n\t\t\t\t\t\t</tr>";
}
$out->addHTML(Xml::fieldset($this->msg('importinterwiki')->text()) . Xml::openElement('form', array('method' => 'post', 'action' => $action, 'id' => 'mw-import-interwiki-form')) . $this->msg('import-interwiki-text')->parseAsBlock() . Html::hidden('action', 'submit') . Html::hidden('source', 'interwiki') . Html::hidden('editToken', $user->getEditToken()) . Xml::openElement('table', array('id' => 'mw-import-table')) . "<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-interwiki-source')->text(), 'interwiki') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::openElement('select', array('name' => 'interwiki')));
foreach ($wgImportSources as $prefix) {
$selected = $this->interwiki === $prefix ? ' selected="selected"' : '';
$out->addHTML(Xml::option($prefix, $prefix, $selected));
}
$out->addHTML(Xml::closeElement('select') . Xml::input('frompage', 50, $this->frompage) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel($this->msg('import-interwiki-history')->text(), 'interwikiHistory', 'interwikiHistory', $this->history) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel($this->msg('import-interwiki-templates')->text(), 'interwikiTemplates', 'interwikiTemplates', $this->includeTemplates) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t{$importDepth}\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label($this->msg('import-interwiki-namespace')->text(), 'namespace') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Html::namespaceSelector(array('selected' => $this->namespace, 'all' => ''), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector')) . "</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($this->msg('import-comment')->text(), 'mw-interwiki-comment') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('log-comment', 50, '', array('id' => 'mw-interwiki-comment', 'type' => 'text')) . ' ' . "</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($this->msg('import-interwiki-rootpage')->text(), 'mw-interwiki-rootpage') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::input('rootpage', 50, $this->rootpage, array('id' => 'mw-interwiki-rootpage', 'type' => 'text')) . ' ' . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-submit'>" . Xml::submitButton($this->msg('import-interwiki-submit')->text(), Linker::tooltipAndAccesskeyAttribs('import')) . "</td>\n\t\t\t\t</tr>" . Xml::closeElement('table') . Xml::closeElement('form') . Xml::closeElement('fieldset'));
}
}
示例8: namespaceForm
/**
* HTML for the top form
*
* @param int $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.
* @param bool $hideredirects Dont show redirects (default false)
* @return string
*/
function namespaceForm($namespace = NS_MAIN, $from = '', $to = '', $hideredirects = false)
{
$t = $this->getPageTitle();
$out = Xml::openElement('div', array('class' => 'namespaceoptions'));
$out .= Xml::openElement('form', array('method' => 'get', 'action' => $this->getConfig()->get('Script')));
$out .= Html::hidden('title', $t->getPrefixedText());
$out .= Xml::openElement('fieldset');
$out .= Xml::element('legend', null, $this->msg('allpages')->text());
$out .= Xml::openElement('table', array('id' => 'nsselect', 'class' => 'allpages'));
$out .= "<tr>\n\t<td class='mw-label'>" . Xml::label($this->msg('allpagesfrom')->text(), '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($this->msg('allpagesto')->text(), '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($this->msg('namespace')->text(), 'namespace') . "\t</td>\n\t\t\t<td class='mw-input'>" . Html::namespaceSelector(array('selected' => $namespace), array('name' => 'namespace', 'id' => 'namespace')) . ' ' . Xml::checkLabel($this->msg('allpages-hide-redirects')->text(), 'hideredirects', 'hideredirects', $hideredirects) . ' ' . Xml::submitButton($this->msg('allpagessubmit')->text()) . "\t</td>\n</tr>";
$out .= Xml::closeElement('table');
$out .= Xml::closeElement('fieldset');
$out .= Xml::closeElement('form');
$out .= Xml::closeElement('div');
return $out;
}
示例9: doHeader
/**
* Set the text to be displayed above the changes
*
* @param FormOptions $opts
* @param int $numRows Number of rows in the result to show after this header
*/
public function doHeader($opts, $numRows)
{
$user = $this->getUser();
$this->getOutput()->addSubtitle($this->msg('watchlistfor2', $user->getName())->rawParams(SpecialEditWatchlist::buildTools(null)));
$this->setTopText($opts);
$lang = $this->getLanguage();
$wlInfo = '';
if ($opts['days'] > 0) {
$timestamp = wfTimestampNow();
$wlInfo = $this->msg('wlnote')->numParams($numRows, round($opts['days'] * 24))->params($lang->userDate($timestamp, $user), $lang->userTime($timestamp, $user))->parse() . "<br />\n";
}
$nondefaults = $opts->getChangedValues();
$cutofflinks = $this->cutoffLinks($opts['days'], $nondefaults) . "<br />\n";
# Spit out some control panel links
$filters = array('hideminor' => 'rcshowhideminor', 'hidebots' => 'rcshowhidebots', 'hideanons' => 'rcshowhideanons', 'hideliu' => 'rcshowhideliu', 'hidemyself' => 'rcshowhidemine', 'hidepatrolled' => 'rcshowhidepatr');
foreach ($this->getCustomFilters() as $key => $params) {
$filters[$key] = $params['msg'];
}
// Disable some if needed
if (!$user->useNPPatrol()) {
unset($filters['hidepatrolled']);
}
$links = array();
foreach ($filters as $name => $msg) {
$links[] = $this->showHideLink($nondefaults, $msg, $name, $opts[$name]);
}
$hiddenFields = $nondefaults;
unset($hiddenFields['namespace']);
unset($hiddenFields['invert']);
unset($hiddenFields['associated']);
# Create output
$form = '';
# Namespace filter and put the whole form together.
$form .= $wlInfo;
$form .= $cutofflinks;
$form .= $lang->pipeList($links) . "\n";
$form .= "<hr />\n<p>";
$form .= Html::namespaceSelector(array('selected' => $opts['namespace'], 'all' => '', 'label' => $this->msg('namespace')->text()), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector')) . ' ';
$form .= Xml::checkLabel($this->msg('invert')->text(), 'invert', 'nsinvert', $opts['invert'], array('title' => $this->msg('tooltip-invert')->text())) . ' ';
$form .= Xml::checkLabel($this->msg('namespace_association')->text(), 'associated', 'nsassociated', $opts['associated'], array('title' => $this->msg('tooltip-namespace_association')->text())) . ' ';
$form .= Xml::submitButton($this->msg('allpagessubmit')->text()) . "</p>\n";
foreach ($hiddenFields as $key => $value) {
$form .= Html::hidden($key, $value) . "\n";
}
$form .= Xml::closeElement('fieldset') . "\n";
$form .= Xml::closeElement('form') . "\n";
$this->getOutput()->addHTML($form);
$this->setBottomText($opts);
}
示例10: getMappingFormPart
private function getMappingFormPart($sourceName)
{
$isSameSourceAsBefore = $this->sourceName === $sourceName;
$defaultNamespace = $this->getConfig()->get('ImportTargetNamespace');
return "<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::radioLabel($this->msg('import-mapping-default')->text(), 'mapping', 'default', "mw-import-mapping-{$sourceName}-default", $isSameSourceAsBefore ? $this->mapping === 'default' : is_null($defaultNamespace)) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::radioLabel($this->msg('import-mapping-namespace')->text(), 'mapping', 'namespace', "mw-import-mapping-{$sourceName}-namespace", $isSameSourceAsBefore ? $this->mapping === 'namespace' : !is_null($defaultNamespace)) . ' ' . Html::namespaceSelector(['selected' => $isSameSourceAsBefore ? $this->namespace : $defaultNamespace || ''], ['name' => "namespace", 'id' => "mw-import-namespace-{$sourceName}", 'class' => 'namespaceselector']) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::radioLabel($this->msg('import-mapping-subpage')->text(), 'mapping', 'subpage', "mw-import-mapping-{$sourceName}-subpage", $isSameSourceAsBefore ? $this->mapping === 'subpage' : '') . ' ' . Xml::input('rootpage', 50, $isSameSourceAsBefore ? $this->rootpage : '', ['id' => "mw-interwiki-rootpage-{$sourceName}", 'type' => 'text']) . ' ' . "</td>\n\t\t\t\t</tr>";
}
示例11: testCanDisableANamespaces
public function testCanDisableANamespaces()
{
$this->assertEquals('<select id=namespace name=namespace>' . "\n" . '<option disabled value=0>(Main)</option>' . "\n" . '<option disabled value=1>Talk</option>' . "\n" . '<option disabled value=2>User</option>' . "\n" . '<option disabled value=3>User talk</option>' . "\n" . '<option disabled 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=14>Category</option>' . "\n" . '<option value=15>Category talk</option>' . "\n" . '<option value=100>Custom</option>' . "\n" . '<option value=101>Custom talk</option>' . "\n" . '</select>', Html::namespaceSelector(array('disable' => array(0, 1, 2, 3, 4))), 'Namespace selector namespace disabling');
}
示例12: showForm
//.........这里部分代码省略.........
$out->addWikiMsg('delete_and_move_text', $newTitle->getPrefixedText());
$movepagebtn = wfMsg('delete_and_move');
$submitVar = 'wpDeleteAndMove';
$confirm = "\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('delete_and_move_confirm'), 'wpConfirm', 'wpConfirm') . "</td>\n\t\t\t\t</tr>";
$err = array();
} else {
if ($this->oldTitle->getNamespace() == NS_USER && !$this->oldTitle->isSubpage()) {
$out->wrapWikiMsg("<div class=\"error mw-moveuserpage-warning\">\n\$1\n</div>", 'moveuserpage-warning');
}
$out->addWikiMsg($wgFixDoubleRedirects ? 'movepagetext' : 'movepagetext-noredirectfixer');
$movepagebtn = wfMsg('movepagebtn');
$submitVar = 'wpMove';
$confirm = false;
}
if (count($err) == 1 && isset($err[0][0]) && $err[0][0] == 'file-exists-sharedrepo' && $user->isAllowed('reupload-shared')) {
$out->addWikiMsg('move-over-sharedrepo', $newTitle->getPrefixedText());
$submitVar = 'wpMoveOverSharedFile';
$err = array();
}
$oldTalk = $this->oldTitle->getTalkPage();
$oldTitleSubpages = $this->oldTitle->hasSubpages();
$oldTitleTalkSubpages = $this->oldTitle->getTalkPage()->hasSubpages();
$canMoveSubpage = ($oldTitleSubpages || $oldTitleTalkSubpages) && !count($this->oldTitle->getUserPermissionsErrors('move-subpages', $user));
# We also want to be able to move assoc. subpage talk-pages even if base page
# has no associated talk page, so || with $oldTitleTalkSubpages.
$considerTalk = !$this->oldTitle->isTalkPage() && ($oldTalk->exists() || $oldTitleTalkSubpages && $canMoveSubpage);
$dbr = wfGetDB(DB_SLAVE);
if ($wgFixDoubleRedirects) {
$hasRedirects = $dbr->selectField('redirect', '1', array('rd_namespace' => $this->oldTitle->getNamespace(), 'rd_title' => $this->oldTitle->getDBkey()), __METHOD__);
} else {
$hasRedirects = false;
}
if ($considerTalk) {
$out->addWikiMsg('movepagetalktext');
}
if (count($err)) {
$out->addHTML("<div class='error'>\n");
$action_desc = $this->msg('action-move')->plain();
$out->addWikiMsg('permissionserrorstext-withaction', count($err), $action_desc);
if (count($err) == 1) {
$errMsg = $err[0];
$errMsgName = array_shift($errMsg);
if ($errMsgName == 'hookaborted') {
$out->addHTML("<p>{$errMsg[0]}</p>\n");
} else {
$out->addWikiMsgArray($errMsgName, $errMsg);
}
} else {
$errStr = array();
foreach ($err as $errMsg) {
if ($errMsg[0] == 'hookaborted') {
$errStr[] = $errMsg[1];
} else {
$errMsgName = array_shift($errMsg);
$errStr[] = $this->msg($errMsgName, $errMsg)->parse();
}
}
$out->addHTML('<ul><li>' . implode("</li>\n<li>", $errStr) . "</li></ul>\n");
}
$out->addHTML("</div>\n");
}
if ($this->oldTitle->isProtected('move')) {
# Is the title semi-protected?
if ($this->oldTitle->isSemiProtected('move')) {
$noticeMsg = 'semiprotectedpagemovewarning';
$classes[] = 'mw-textarea-sprotected';
} else {
# Then it must be protected based on static groups (regular)
$noticeMsg = 'protectedpagemovewarning';
$classes[] = 'mw-textarea-protected';
}
$out->addHTML("<div class='mw-warning-with-logexcerpt'>\n");
$out->addWikiMsg($noticeMsg);
LogEventsList::showLogExtract($out, 'protect', $this->oldTitle, '', array('lim' => 1));
$out->addHTML("</div>\n");
}
// Byte limit (not string length limit) for wpReason and wpNewTitleMain
// is enforced in the mediawiki.special.movePage module
$out->addHTML(Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalURL('action=submit'), 'id' => 'movepage')) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('move-page-legend')) . Xml::openElement('table', array('border' => '0', 'id' => 'mw-movepage-table')) . "<tr>\n\t\t\t\t<td class='mw-label'>" . wfMsgHtml('movearticle') . "</td>\n\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t<strong>{$oldTitleLink}</strong>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('newtitle'), 'wpNewTitleMain') . "</td>\n\t\t\t\t<td class='mw-input'>" . Html::namespaceSelector(array('selected' => $newTitle->getNamespace()), array('name' => 'wpNewTitleNs', 'id' => 'wpNewTitleNs')) . Xml::input('wpNewTitleMain', 60, $wgContLang->recodeForEdit($newTitle->getText()), array('type' => 'text', 'id' => 'wpNewTitleMain', 'maxlength' => 255)) . Html::hidden('wpOldTitle', $this->oldTitle->getPrefixedText()) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('movereason'), 'wpReason') . "</td>\n\t\t\t\t<td class='mw-input'>" . Html::element('textarea', array('name' => 'wpReason', 'id' => 'wpReason', 'cols' => 60, 'rows' => 2, 'maxlength' => 200), $this->reason) . "</td>\n\t\t\t</tr>");
if ($considerTalk) {
$out->addHTML("\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('movetalk'), 'wpMovetalk', 'wpMovetalk', $this->moveTalk) . "</td>\n\t\t\t\t</tr>");
}
if ($user->isAllowed('suppressredirect')) {
$out->addHTML("\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-input' >" . Xml::checkLabel(wfMsg('move-leave-redirect'), 'wpLeaveRedirect', 'wpLeaveRedirect', $this->leaveRedirect) . "</td>\n\t\t\t\t</tr>");
}
if ($hasRedirects) {
$out->addHTML("\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-input' >" . Xml::checkLabel(wfMsg('fix-double-redirects'), 'wpFixRedirects', 'wpFixRedirects', $this->fixRedirects) . "</td>\n\t\t\t\t</tr>");
}
if ($canMoveSubpage) {
$out->addHTML("\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class=\"mw-input\">" . Xml::check('wpMovesubpages', $this->moveSubpages && ($this->oldTitle->hasSubpages() || $this->moveTalk), array('id' => 'wpMovesubpages')) . ' ' . Xml::tags('label', array('for' => 'wpMovesubpages'), wfMsgExt($this->oldTitle->hasSubpages() ? 'move-subpages' : 'move-talk-subpages', array('parseinline'), $this->getLanguage()->formatNum($wgMaximumMovedPages), $wgMaximumMovedPages)) . "</td>\n\t\t\t\t</tr>");
}
$watchChecked = $user->isLoggedIn() && ($this->watch || $user->getBoolOption('watchmoves') || $this->oldTitle->userIsWatching());
# Don't allow watching if user is not logged in
if ($user->isLoggedIn()) {
$out->addHTML("\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('move-watch'), 'wpWatch', 'watch', $watchChecked) . "</td>\n\t\t\t</tr>");
}
$out->addHTML("\n\t\t\t\t{$confirm}\n\t\t\t<tr>\n\t\t\t\t<td> </td>\n\t\t\t\t<td class='mw-submit'>" . Xml::submitButton($movepagebtn, array('name' => $submitVar)) . "</td>\n\t\t\t</tr>" . Xml::closeElement('table') . Html::hidden('wpEditToken', $user->getEditToken()) . Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n");
$this->showLogFragment($this->oldTitle);
$this->showSubpages($this->oldTitle);
}
示例13: 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($this->msg('whatlinkshere')->text());
# Target input
$f .= Xml::inputLabel($this->msg('whatlinkshere-page')->text(), 'target', 'mw-whatlinkshere-target', 40, $target);
$f .= ' ';
# Namespace selector
$f .= Html::namespaceSelector(array('selected' => $namespace, 'all' => '', 'label' => $this->msg('namespace')->text()), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector'));
$f .= ' ';
# Submit
$f .= Xml::submitButton($this->msg('allpagessubmit')->text());
# Close
$f .= Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n";
return $f;
}
示例14: getForm
/**
* Generates the namespace selector form with hidden attributes.
* @param array $options The options to be included.
* @return string
*/
function getForm($options)
{
$options['title'] = $this->getPageTitle()->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', ['method' => 'get', 'action' => wfScript()]);
foreach ($options as $name => $value) {
if (in_array($name, ['namespace', 'target', 'contribs'])) {
continue;
}
$f .= "\t" . Html::hidden($name, $value) . "\n";
}
$this->getOutput()->addModules('mediawiki.userSuggest');
$f .= Xml::openElement('fieldset');
$f .= Xml::element('legend', [], $this->msg('sp-contributions-search')->text());
$f .= Xml::tags('label', ['for' => 'target'], $this->msg('sp-contributions-username')->parse()) . ' ';
$f .= Html::input('target', $options['target'], 'text', ['size' => '20', 'required' => '', 'class' => ['mw-autocomplete-user']] + ($options['target'] ? [] : ['autofocus'])) . ' ';
$f .= Html::namespaceSelector(['selected' => $options['namespace'], 'all' => '', 'label' => $this->msg('namespace')->text()], ['name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector']) . ' ';
$f .= Xml::submitButton($this->msg('sp-contributions-submit')->text());
$f .= Xml::closeElement('fieldset');
$f .= Xml::closeElement('form');
return $f;
}
示例15: execute
//.........这里部分代码省略.........
# Spit out some control panel links
$filters = array(
'hideMinor' => 'rcshowhideminor',
'hideBots' => 'rcshowhidebots',
'hideAnons' => 'rcshowhideanons',
'hideLiu' => 'rcshowhideliu',
'hideOwn' => 'rcshowhidemine',
'hidePatrolled' => 'rcshowhidepatr'
);
foreach ( $this->customFilters as $key => $params ) {
$filters[$key] = $params['msg'];
}
// Disable some if needed
if ( !$user->useNPPatrol() ) {
unset( $filters['hidePatrolled'] );
}
$links = array();
foreach ( $filters as $name => $msg ) {
$links[] = $this->showHideLink( $nondefaults, $msg, $name, $values[$name] );
}
$hiddenFields = $nondefaults;
unset( $hiddenFields['namespace'] );
unset( $hiddenFields['invert'] );
unset( $hiddenFields['associated'] );
# Namespace filter and put the whole form together.
$form .= $wlInfo;
$form .= $cutofflinks;
$form .= $lang->pipeList( $links ) . "\n";
$form .= "<hr />\n<p>";
$form .= Html::namespaceSelector(
array(
'selected' => $nameSpace,
'all' => '',
'label' => $this->msg( 'namespace' )->text()
), array(
'name' => 'namespace',
'id' => 'namespace',
'class' => 'namespaceselector',
)
) . ' ';
$form .= Xml::checkLabel(
$this->msg( 'invert' )->text(),
'invert',
'nsinvert',
$invert,
array( 'title' => $this->msg( 'tooltip-invert' )->text() )
) . ' ';
$form .= Xml::checkLabel(
$this->msg( 'namespace_association' )->text(),
'associated',
'associated',
$associated,
array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
) . ' ';
$form .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . "</p>\n";
foreach ( $hiddenFields as $key => $value ) {
$form .= Html::hidden( $key, $value ) . "\n";
}
$form .= Xml::closeElement( 'fieldset' ) . "\n";
$form .= Xml::closeElement( 'form' ) . "\n";
$output->addHTML( $form );