/** * Shows the search form */ private function showForm() { global $wgScript, $wgOut, $wgRequest; /* Build form */ $html = Xml::openElement('form', array('action' => $wgScript)) . "\n"; // Name of SpecialPage $html .= Html::hidden('title', $this->getTitle()->getPrefixedText()) . "\n"; // Limit $html .= Html::hidden('limit', $wgRequest->getInt('limit', 50)); // Input box with target prefilled if available $formContent = "\t" . Xml::input('target', 40, is_null($this->target) ? '' : $this->target->getText()) . "\n\t" . Xml::element('input', array('type' => 'submit', 'value' => wfMsg('globalusage-ok'))) . "\n\t<p>" . Xml::checkLabel(wfMsg('globalusage-filterlocal'), 'filterlocal', 'mw-filterlocal', $this->filterLocal) . '</p>'; if (!is_null($this->target) && wfFindFile($this->target)) { // Show the image if it exists $html .= Linker::makeThumbLinkObj($this->target, wfFindFile($this->target), $this->target->getPrefixedText(), '', wfUILang()->alignEnd(), array(), false, false); } // Wrap the entire form in a nice fieldset $html .= Xml::fieldSet(wfMsg('globalusage-text'), $formContent) . "\n</form>"; $wgOut->addHtml($html); }
/** * Get all Interwiki Links - the heart of the function * @param $prefix string Prefix to search for in list * @return string HTML */ private function getInterwikis($prefix = null) { global $wgScript; $dbr = wfGetDB(DB_SLAVE); $conds = array(); if (!is_null($prefix)) { $conds[] = "iw_prefix " . $dbr->buildLike($prefix, $dbr->anyString()); } $results = $dbr->select('interwiki', array('iw_prefix', 'iw_url'), $conds); $form = Xml::openElement('form', array('action' => $wgScript, 'method' => 'get', 'id' => 'interwikilist-search')) . Html::Hidden('title', $this->mTitle->getPrefixedText()) . Xml::inputLabel(wfMsg('interwikilist-prefix'), 'iwsearch', 'interwikilist-prefix', false, $prefix) . Xml::submitButton(wfMsg('search')) . Xml::closeElement('form'); $text = Xml::fieldSet(wfMsg('interwikilist-filter'), $form); $interwikiList = array(); foreach ($results as $row) { $interwikiList["mw-iwlist-" . $row->iw_prefix] = array($row->iw_prefix, $row->iw_url); } $dbr->freeResult($results); $text .= Xml::buildTable($interwikiList, array('id' => 'sv-software'), array(wfMsg('interwikilist-linkname'), wfMsg('interwikilist-target'))); return $text; }