Merge "Hide TOC with CSS instead of JavaScript"
[lhc/web/wiklou.git] / includes / Linker.php
index 6634127..e625a02 100644 (file)
@@ -38,29 +38,6 @@ class Linker {
        const TOOL_LINKS_NOBLOCK = 1;
        const TOOL_LINKS_EMAIL = 2;
 
-       /**
-        * Return the CSS colour of a known link
-        *
-        * @deprecated since 1.28, use LinkRenderer::getLinkClasses() instead
-        *
-        * @since 1.16.3
-        * @param LinkTarget $t
-        * @param int $threshold User defined threshold
-        * @return string CSS class
-        */
-       public static function getLinkColour( LinkTarget $t, $threshold ) {
-               wfDeprecated( __METHOD__, '1.28' );
-               $services = MediaWikiServices::getInstance();
-               $linkRenderer = $services->getLinkRenderer();
-               if ( $threshold !== $linkRenderer->getStubThreshold() ) {
-                       // Need to create a new instance with the right stub threshold...
-                       $linkRenderer = $services->getLinkRendererFactory()->create();
-                       $linkRenderer->setStubThreshold( $threshold );
-               }
-
-               return $linkRenderer->getLinkClasses( $t );
-       }
-
        /**
         * This function returns an HTML link to the given target.  It serves a few
         * purposes:
@@ -328,7 +305,9 @@ class Linker {
                $res = null;
                $dummy = new DummyLinker;
                if ( !Hooks::run( 'ImageBeforeProduceHTML', [ &$dummy, &$title,
-                       &$file, &$frameParams, &$handlerParams, &$time, &$res ] ) ) {
+                       &$file, &$frameParams, &$handlerParams, &$time, &$res,
+                       $parser, &$query, &$widthOption
+               ] ) ) {
                        return $res;
                }
 
@@ -826,7 +805,7 @@ class Linker {
                        $key = strtolower( $name );
                }
 
-               return self::linkKnown( SpecialPage::getTitleFor( $name ), wfMessage( $key )->text() );
+               return self::linkKnown( SpecialPage::getTitleFor( $name ), wfMessage( $key )->escaped() );
        }
 
        /**
@@ -925,7 +904,7 @@ class Linker {
         *   red if the user has no edits?
         * @param int $flags Customisation flags (e.g. Linker::TOOL_LINKS_NOBLOCK
         *   and Linker::TOOL_LINKS_EMAIL).
-        * @param int $edits User edit count (optional, for performance)
+        * @param int|null $edits User edit count (optional, for performance)
         * @return string HTML fragment
         */
        public static function userToolLinks(
@@ -987,7 +966,7 @@ class Linker {
         * @since 1.16.3
         * @param int $userId User identifier
         * @param string $userText User name or IP address
-        * @param int $edits User edit count (optional, for performance)
+        * @param int|null $edits User edit count (optional, for performance)
         * @return string
         */
        public static function userToolLinksRedContribs( $userId, $userText, $edits = null ) {
@@ -1583,12 +1562,24 @@ class Linker {
                $title = wfMessage( 'toc' )->inLanguage( $lang )->escaped();
 
                return '<div id="toc" class="toc">'
+                       . Html::element( 'input', [
+                               'type' => 'checkbox',
+                               'id' => 'toctogglecheckbox',
+                               'class' => 'toctogglecheckbox',
+                               'style' => 'display:none',
+                       ] )
                        . Html::openElement( 'div', [
                                'class' => 'toctitle',
                                'lang' => $lang->getHtmlCode(),
                                'dir' => $lang->getDir(),
                        ] )
-                       . '<h2>' . $title . "</h2></div>\n"
+                       . "<h2>$title</h2>"
+                       . '<span class="toctogglespan">'
+                       . Html::label( '', 'toctogglecheckbox', [
+                               'class' => 'toctogglelabel',
+                       ] )
+                       . '</span>'
+                       . "</div>\n"
                        . $toc
                        . "</ul>\n</div>\n";
        }
@@ -1699,7 +1690,7 @@ class Linker {
         * @since 1.16.3. $context added in 1.20. $options added in 1.21
         *
         * @param Revision $rev
-        * @param IContextSource $context Context to use or null for the main context.
+        * @param IContextSource|null $context Context to use or null for the main context.
         * @param array $options
         * @return string
         */