Merge "Use MediaWiki\SuppressWarnings around trigger_error('') instead @"
[lhc/web/wiklou.git] / includes / MWGrants.php
index 58efdc7..3079c65 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 /**
- * Functions and constants to deal with grants
- *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
  */
+use MediaWiki\MediaWikiServices;
 
 /**
  * A collection of public static functions to deal with grants.
@@ -57,11 +58,11 @@ class MWGrants {
                // Give grep a chance to find the usages:
                // grant-blockusers, grant-createeditmovepage, grant-delete,
                // grant-editinterface, grant-editmycssjs, grant-editmywatchlist,
-               // grant-editpage, grant-editprotected, grant-highvolume,
-               // grant-oversight, grant-patrol, grant-protect, grant-rollback,
-               // grant-sendemail, grant-uploadeditmovefile, grant-uploadfile,
-               // grant-basic, grant-viewdeleted, grant-viewmywatchlist,
-               // grant-createaccount
+               // grant-editsiteconfig, grant-editpage, grant-editprotected,
+               // grant-highvolume, grant-oversight, grant-patrol, grant-protect,
+               // grant-rollback, grant-sendemail, grant-uploadeditmovefile,
+               // grant-uploadfile, grant-basic, grant-viewdeleted,
+               // grant-viewmywatchlist, grant-createaccount
                $msg = wfMessage( "grant-$grant" );
                if ( $lang !== null ) {
                        if ( is_string( $lang ) ) {
@@ -178,9 +179,10 @@ class MWGrants {
         * @return string (proto-relative) HTML link
         */
        public static function getGrantsLink( $grant, $lang = null ) {
-               return \Linker::linkKnown(
+               $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
+               return $linkRenderer->makeKnownLink(
                        \SpecialPage::getTitleFor( 'Listgrants', false, $grant ),
-                       htmlspecialchars( self::grantName( $grant, $lang ) )
+                       self::grantName( $grant, $lang )
                );
        }
 
@@ -191,12 +193,10 @@ class MWGrants {
         * @return string Wikitext
         */
        public static function getGrantsWikiText( $grantsFilter, $lang = null ) {
-               global $wgContLang;
-
                if ( is_string( $lang ) ) {
                        $lang = Language::factory( $lang );
                } elseif ( $lang === null ) {
-                       $lang = $wgContLang;
+                       $lang = MediaWikiServices::getInstance()->getContentLanguage();
                }
 
                $s = '';