Add Special:ApiSandbox
[lhc/web/wiklou.git] / includes / specials / SpecialContributions.php
index b1908c2..1a1b490 100644 (file)
@@ -49,11 +49,7 @@ class SpecialContributions extends IncludableSpecialPage {
                        $target = $request->getVal( 'target' );
                }
 
-               // check for radiobox
-               if ( $request->getVal( 'contribs' ) == 'newbie' ) {
-                       $target = 'newbies';
-                       $this->opts['contribs'] = 'newbie';
-               } elseif ( $par === 'newbies' ) { // b/c for WMF
+               if ( $request->getVal( 'contribs' ) == 'newbie' || $par === 'newbies' ) {
                        $target = 'newbies';
                        $this->opts['contribs'] = 'newbie';
                } else {
@@ -482,7 +478,7 @@ class SpecialContributions extends IncludableSpecialPage {
                        $filterSelection = Html::rawElement(
                                'td',
                                array(),
-                               implode( '&#160', $tagFilter )
+                               implode( ' ', $tagFilter )
                        );
                } else {
                        $filterSelection = Html::rawElement( 'td', array( 'colspan' => 2 ), '' );
@@ -575,8 +571,10 @@ class SpecialContributions extends IncludableSpecialPage {
                                )
                );
 
+               $filters = array();
+
                if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) {
-                       $deletedOnlyCheck = Html::rawElement(
+                       $filters[] = Html::rawElement(
                                'span',
                                array( 'class' => 'mw-input-with-label' ),
                                Xml::checkLabel(
@@ -587,11 +585,9 @@ class SpecialContributions extends IncludableSpecialPage {
                                        array( 'class' => 'mw-input' )
                                )
                        );
-               } else {
-                       $deletedOnlyCheck = '';
                }
 
-               $checkLabelTopOnly = Html::rawElement(
+               $filters[] = Html::rawElement(
                        'span',
                        array( 'class' => 'mw-input-with-label' ),
                        Xml::checkLabel(
@@ -602,7 +598,7 @@ class SpecialContributions extends IncludableSpecialPage {
                                array( 'class' => 'mw-input' )
                        )
                );
-               $checkLabelNewOnly = Html::rawElement(
+               $filters[] = Html::rawElement(
                        'span',
                        array( 'class' => 'mw-input-with-label' ),
                        Xml::checkLabel(
@@ -613,10 +609,16 @@ class SpecialContributions extends IncludableSpecialPage {
                                array( 'class' => 'mw-input' )
                        )
                );
+
+               Hooks::run(
+                       'SpecialContributions::getForm::filters',
+                       array( $this, &$filters )
+               );
+
                $extraOptions = Html::rawElement(
                        'td',
                        array( 'colspan' => 2 ),
-                       $deletedOnlyCheck . $checkLabelTopOnly . $checkLabelNewOnly
+                       implode( '', $filters )
                );
 
                $dateSelectionAndSubmit = Xml::tags( 'td', array( 'colspan' => 2 ),
@@ -649,6 +651,24 @@ class SpecialContributions extends IncludableSpecialPage {
                return $form;
        }
 
+       /**
+        * Return an array of subpages beginning with $search that this special page will accept.
+        *
+        * @param string $search Prefix to search for
+        * @param int $limit Maximum number of results to return (usually 10)
+        * @param int $offset Number of results to skip (usually 0)
+        * @return string[] Matching subpages
+        */
+       public function prefixSearchSubpages( $search, $limit, $offset ) {
+               $user = User::newFromName( $search );
+               if ( !$user ) {
+                       // No prefix suggestion for invalid user
+                       return array();
+               }
+               // Autocomplete subpage as user list - public to allow caching
+               return UserNamePrefixSearch::search( 'public', $search, $limit, $offset );
+       }
+
        protected function getGroupName() {
                return 'users';
        }