Merge "Add 'mediawiki.ui.button' CSS module"
[lhc/web/wiklou.git] / includes / specials / SpecialSearch.php
index bdcecf9..b6b219f 100644 (file)
@@ -37,7 +37,6 @@ class SpecialSearch extends SpecialPage {
         * null|string
         */
        protected $profile;
-       function getProfile() { return $this->profile; }
 
        /// Search engine
        protected $searchEngine;
@@ -60,7 +59,6 @@ class SpecialSearch extends SpecialPage {
         * @var array
         */
        protected $namespaces;
-       function getNamespaces() { return $this->namespaces; }
 
        /**
         * @var bool
@@ -376,7 +374,7 @@ class SpecialSearch extends SpecialPage {
                // 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
@@ -422,7 +420,7 @@ class SpecialSearch extends SpecialPage {
                        } 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>" );
@@ -436,8 +434,9 @@ class SpecialSearch extends SpecialPage {
 
        /**
         * @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.
@@ -455,7 +454,7 @@ class SpecialSearch extends SpecialPage {
                } 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
@@ -1188,6 +1187,22 @@ class SpecialSearch extends SpecialPage {
                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