コード例 #1
0
 function whatlinkshereForm()
 {
     // We get nicer value from the title object
     $this->opts->consumeValue('target');
     // Reset these for new requests
     $this->opts->consumeValues(['back', 'from']);
     $target = $this->target ? $this->target->getPrefixedText() : '';
     $namespace = $this->opts->consumeValue('namespace');
     $nsinvert = $this->opts->consumeValue('invert');
     # Build up the form
     $f = Xml::openElement('form', ['action' => wfScript()]);
     # Values that should not be forgotten
     $f .= Html::hidden('title', $this->getPageTitle()->getPrefixedText());
     foreach ($this->opts->getUnconsumedValues() as $name => $value) {
         $f .= Html::hidden($name, $value);
     }
     $f .= Xml::fieldset($this->msg('whatlinkshere')->text());
     # Target input (.mw-searchInput enables suggestions)
     $f .= Xml::inputLabel($this->msg('whatlinkshere-page')->text(), 'target', 'mw-whatlinkshere-target', 40, $target, ['class' => 'mw-searchInput']);
     $f .= ' ';
     # Namespace selector
     $f .= Html::namespaceSelector(['selected' => $namespace, 'all' => '', 'label' => $this->msg('namespace')->text()], ['name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector']);
     $f .= ' ' . Xml::checkLabel($this->msg('invert')->text(), 'invert', 'nsinvert', $nsinvert, ['title' => $this->msg('tooltip-whatlinkshere-invert')->text()]);
     $f .= ' ';
     # Submit
     $f .= Xml::submitButton($this->msg('whatlinkshere-submit')->text());
     # Close
     $f .= Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n";
     return $f;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
ファイル: SpecialAPC.php プロジェクト: Tjorriemorrie/app
 public function setup()
 {
     global $wgRequest;
     $opts = new FormOptions();
     // Bind to the member variable
     $this->opts = $opts;
     $opts->add('mode', self::MODE_STATS);
     $opts->add('image', APCImages::IMG_NONE);
     $opts->add('clearcache', false);
     $opts->add('limit', 20);
     $opts->add('offset', 0);
     $opts->add('display', '');
     $opts->add('delete', '');
     $opts->add('sort', 'hits');
     $opts->add('sortdir', 0);
     $opts->add('scope', 'active');
     $opts->add('searchi', '');
     // MediaWiki captures search, ARGH!
     $opts->fetchValuesFromRequest($wgRequest);
     $opts->validateIntBounds('limit', 0, 5000);
     $opts->validateIntBounds('sortdir', 0, 1);
     $this->opts->consumeValues(array('display', 'clearcache', 'image'));
 }
コード例 #4
0
 /**
  * Get options to be displayed in a form
  *
  * @param FormOptions $opts
  * @return array
  */
 function getExtraOptions($opts)
 {
     $opts->consumeValues(array('namespace', 'invert', 'associated', 'tagfilter', 'categories', 'categories_any'));
     $extraOpts = array();
     $extraOpts['namespace'] = $this->namespaceFilterForm($opts);
     if ($this->getConfig()->get('AllowCategorizedRecentChanges')) {
         $extraOpts['category'] = $this->categoryFilterForm($opts);
     }
     $tagFilter = ChangeTags::buildTagFilterSelector($opts['tagfilter']);
     if (count($tagFilter)) {
         $extraOpts['tagfilter'] = $tagFilter;
     }
     // Don't fire the hook for subclasses. (Or should we?)
     if ($this->getName() === 'Recentchanges') {
         Hooks::run('SpecialRecentChangesPanel', array(&$extraOpts, $opts));
     }
     return $extraOpts;
 }