* null|string
*/
protected $profile;
- function getProfile() { return $this->profile; }
/// Search engine
protected $searchEngine;
* @var array
*/
protected $namespaces;
- function getNamespaces() { return $this->namespaces; }
/**
* @var bool
$this->outputHeader();
$out = $this->getOutput();
$out->allowClickjacking();
- $out->addModuleStyles( 'mediawiki.special' );
+ $out->addModuleStyles( array(
+ 'mediawiki.special', 'mediawiki.special.search', 'mediawiki.ui'
+ ) );
// Strip underscores from title parameter; most of the time we'll want
// text form here. But don't strip underscores from actual text params!
if ( $request->getVal( 'fulltext' )
|| !is_null( $request->getVal( 'offset' ) )
- || !is_null( $request->getVal( 'searchx' ) ) )
- {
+ || !is_null( $request->getVal( 'searchx' ) )
+ ) {
$this->showResults( $search );
} else {
$this->goResult( $search );
// prev/next links
if ( $num || $this->offset ) {
// Show the create link ahead
- $this->showCreateLink( $t );
+ $this->showCreateLink( $t, $num );
$prevnext = $this->getLanguage()->viewPrevNext( $this->getTitle(), $this->offset, $this->limit,
$this->powerSearchOptions() + array( 'search' => $term ),
max( $titleMatchesNum, $textMatchesNum ) < $this->limit
} else {
$out->wrapWikiMsg( "<p class=\"mw-search-nonefound\">\n$1</p>",
array( 'search-nonefound', wfEscapeWikiText( $term ) ) );
- $this->showCreateLink( $t );
+ $this->showCreateLink( $t, $num );
}
}
$out->addHtml( "</div>" );
/**
* @param $t Title
+ * @param int $num The number of search results found
*/
- protected function showCreateLink( $t ) {
+ protected function showCreateLink( $t, $num ) {
// show direct page/create link if applicable
// Check DBkey !== '' in case of fragment link only.
} else {
$messageName = 'searchmenu-new-nocreate';
}
- $params = array( $messageName, wfEscapeWikiText( $t->getPrefixedText() ) );
+ $params = array( $messageName, wfEscapeWikiText( $t->getPrefixedText() ), Message::numParam( $num ) );
wfRunHooks( 'SpecialSearchCreateLink', array( $t, &$params ) );
// Extensions using the hook might still return an empty $messageName
$out = $this->getOutput();
if ( strval( $term ) !== '' ) {
$out->setPageTitle( $this->msg( 'searchresults' ) );
- $out->setHTMLTitle( $this->msg( 'pagetitle' )->rawParams(
- $this->msg( 'searchresults-title' )->rawParams( $term )->text()
- ) );
+ $out->setHTMLTitle( $this->msg( 'pagetitle' )
+ ->rawParams( $this->msg( 'searchresults-title' )->rawParams( $term ) )
+ ->inContentLanguage()->text()
+ );
}
// add javascript specific to special:search
$out->addModules( 'mediawiki.special.search' );
$out .= Html::input( 'search', $term, 'search', array(
'id' => $this->profile === 'advanced' ? 'powerSearchText' : 'searchText',
'size' => '50',
- 'autofocus'
+ 'autofocus',
+ 'class' => 'mw-ui-input',
) ) . "\n";
$out .= Html::hidden( 'fulltext', 'Search' ) . "\n";
- $out .= Xml::submitButton( $this->msg( 'searchbutton' )->text() ) . "\n";
+ $out .= Xml::submitButton(
+ $this->msg( 'searchbutton' )->text(),
+ array( 'class' => array( 'mw-ui-button', 'mw-ui-primary' ) )
+ ) . "\n";
return $out . $this->didYouMeanHtml;
}
return $this->searchEngine;
}
+ /**
+ * Current search profile.
+ * @return null|string
+ */
+ function getProfile() {
+ return $this->profile;
+ }
+
+ /**
+ * Current namespaces.
+ * @return array
+ */
+ function getNamespaces() {
+ return $this->namespaces;
+ }
+
/**
* Users of hook SpecialSearchSetupEngine can use this to
* add more params to links to not lose selection when