Merge "Convert Special:DeletedContributions to use OOUI."
[lhc/web/wiklou.git] / includes / OutputPage.php
index 43d71ab..bae871e 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MediaWikiServices;
 use MediaWiki\Session\SessionManager;
 use WrappedString\WrappedString;
 use WrappedString\WrappedStringList;
@@ -1010,8 +1011,9 @@ class OutputPage extends ContextSource {
                if ( $title->isRedirect() ) {
                        $query['redirect'] = 'no';
                }
+               $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
                return wfMessage( 'backlinksubtitle' )
-                       ->rawParams( Linker::link( $title, null, [], $query ) );
+                       ->rawParams( $linkRenderer->makeLink( $title, null, [], $query ) );
        }
 
        /**
@@ -1269,6 +1271,7 @@ class OutputPage extends ContextSource {
                        'OutputPageMakeCategoryLinks',
                        [ &$this, $categories, &$this->mCategoryLinks ] )
                ) {
+                       $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
                        foreach ( $categories as $category => $type ) {
                                // array keys will cast numeric category names to ints, so cast back to string
                                $category = (string)$category;
@@ -1283,7 +1286,7 @@ class OutputPage extends ContextSource {
                                }
                                $text = $wgContLang->convertHtml( $title->getText() );
                                $this->mCategories[$type][] = $title->getText();
-                               $this->mCategoryLinks[$type][] = Linker::link( $title, $text );
+                               $this->mCategoryLinks[$type][] = $linkRenderer->makeLink( $title, new HtmlArmor( $text ) );
                        }
                }
        }
@@ -2653,8 +2656,10 @@ class OutputPage extends ContextSource {
         * @param array $options Options array to pass to Linker
         */
        public function addReturnTo( $title, array $query = [], $text = null, $options = [] ) {
+               $linkRenderer = MediaWikiServices::getInstance()
+                       ->getLinkRendererFactory()->createFromLegacyOptions( $options );
                $link = $this->msg( 'returnto' )->rawParams(
-                       Linker::link( $title, $text, [], $query, $options ) )->escaped();
+                       $linkRenderer->makeLink( $title, $text, [], $query ) )->escaped();
                $this->addHTML( "<p id=\"mw-returnto\">{$link}</p>\n" );
        }
 
@@ -2735,7 +2740,6 @@ class OutputPage extends ContextSource {
                                'site.styles',
                                'noscript',
                                'user.styles',
-                               'user.cssprefs',
                        ] );
                        $this->getSkin()->setupSkinUserCss( $this );
 
@@ -2848,6 +2852,14 @@ class OutputPage extends ContextSource {
                $bodyClasses[] = $userdir;
                $bodyClasses[] = "sitedir-$sitedir";
 
+               $underline = $this->getUser()->getOption( 'underline' );
+               if ( $underline < 2 ) {
+                       // The following classes can be used here:
+                       // * mw-underline-always
+                       // * mw-underline-never
+                       $bodyClasses[] = 'mw-underline-' . ( $underline ? 'always' : 'never' );
+               }
+
                if ( $this->getLanguage()->capitalizeAllNouns() ) {
                        # A <body> class is probably not the best way to do this . . .
                        $bodyClasses[] = 'capitalize-all-nouns';