(Bug 17970) {{PROTECTIONLEVEL}} should be able to return the status for pages besides...
[lhc/web/wiklou.git] / includes / SpecialPage.php
index 67aa2b3..da150c9 100644 (file)
@@ -254,13 +254,14 @@ class SpecialPage {
         *
         * @param $name String
         * @param $subpage String|Bool subpage string, or false to not use a subpage
+        * @param $fragment String the link fragment (after the "#")
         * @throws MWException
         * @return Title object
         */
-       public static function getTitleFor( $name, $subpage = false ) {
+       public static function getTitleFor( $name, $subpage = false, $fragment = '' ) {
                $name = SpecialPageFactory::getLocalNameFor( $name, $subpage );
                if ( $name ) {
-                       return Title::makeTitle( NS_SPECIAL, $name );
+                       return Title::makeTitle( NS_SPECIAL, $name, $fragment );
                } else {
                        throw new MWException( "Invalid special page name \"$name\"" );
                }
@@ -877,6 +878,16 @@ abstract class FormSpecialPage extends SpecialPage {
         */
        protected function alterForm( HTMLForm $form ) {}
 
+       /**
+        * Get message prefix for HTMLForm
+        *
+        * @since 1.21
+        * @return string
+        */
+       protected function getMessagePrefix() {
+               return strtolower( $this->getName() );
+       }
+
        /**
         * Get the HTMLForm to control behaviour
         * @return HTMLForm|null
@@ -884,11 +895,11 @@ abstract class FormSpecialPage extends SpecialPage {
        protected function getForm() {
                $this->fields = $this->getFormFields();
 
-               $form = new HTMLForm( $this->fields, $this->getContext() );
+               $form = new HTMLForm( $this->fields, $this->getContext(), $this->getMessagePrefix() );
                $form->setSubmitCallback( array( $this, 'onSubmit' ) );
-               $form->setWrapperLegend( $this->msg( strtolower( $this->getName() ) . '-legend' ) );
+               $form->setWrapperLegend( $this->msg( $this->getMessagePrefix() . '-legend' ) );
                $form->addHeaderText(
-                       $this->msg( strtolower( $this->getName() ) . '-text' )->parseAsBlock() );
+                       $this->msg( $this->getMessagePrefix() . '-text' )->parseAsBlock() );
 
                // Retain query parameters (uselang etc)
                $params = array_diff_key(