SpecialListgrouprights: Fix "Namespace restrictions" header ID
authorRoan Kattouw <roan.kattouw@gmail.com>
Wed, 22 Nov 2017 22:31:34 +0000 (17:31 -0500)
committerRoan Kattouw <roan.kattouw@gmail.com>
Thu, 7 Dec 2017 18:25:04 +0000 (10:25 -0800)
* Strip the '#' from the start of the <h2>'s id attribute
* Don't parse the header message. It doesn't contain HTML, and it's used
  as plain text anyway.
* Use guessSectionNameFromStrippedText() because we are now feeding it
  plain text. Previously we were calling guessSectionNameFromWikitext()
  but passing in HTML.

Change-Id: I380c20293437dbcd3419f83ea8b7a7ee0bb504f1

includes/specials/SpecialListgrouprights.php

index 2315887..a299933 100644 (file)
@@ -141,7 +141,7 @@ class SpecialListGroupRights extends SpecialPage {
        }
 
        private function outputNamespaceProtectionInfo() {
-               global $wgParser, $wgContLang;
+               global $wgContLang;
                $out = $this->getOutput();
                $namespaceProtection = $this->getConfig()->get( 'NamespaceProtection' );
 
@@ -149,11 +149,11 @@ class SpecialListGroupRights extends SpecialPage {
                        return;
                }
 
-               $header = $this->msg( 'listgrouprights-namespaceprotection-header' )->parse();
+               $header = $this->msg( 'listgrouprights-namespaceprotection-header' )->text();
                $out->addHTML(
                        Html::rawElement( 'h2', [], Html::element( 'span', [
                                'class' => 'mw-headline',
-                               'id' => $wgParser->guessSectionNameFromWikiText( $header )
+                               'id' => substr( Parser::guessSectionNameFromStrippedText( $header ), 1 )
                        ], $header ) ) .
                        Xml::openElement( 'table', [ 'class' => 'wikitable' ] ) .
                        Html::element(