(Bug 19725) Do not include suppressed edits in the "View X deleted edits" message...
[lhc/web/wiklou.git] / includes / Linker.php
index 092fff6..f9a8cc0 100644 (file)
@@ -82,6 +82,11 @@ class Linker {
 
        /**
         * Common code for getLinkAttributesX functions
+        *
+        * @param $title string
+        * @param $class string
+        *
+        * @return string
         */
        private static function getLinkAttributesInternal( $title, $class ) {
                $title = htmlspecialchars( $title );
@@ -143,7 +148,7 @@ class Linker {
         * @param $query         array  The query string to append to the URL
         *   you're linking to, in key => value array form.  Query keys and values
         *   will be URL-encoded.
-        * @param $options       mixed  String or array of strings:
+        * @param $options string|array  String or array of strings:
         *     'known': Page is known to exist, so don't check if it does.
         *     'broken': Page is known not to exist, so don't check if it does.
         *     'noclasses': Don't add any classes automatically (includes "new",
@@ -257,6 +262,10 @@ class Linker {
         * Returns the array of attributes used when linking to the Title $target
         *
         * @param $target Title
+        * @param $attribs
+        * @param $options
+        *
+        * @return array
         */
        private static function linkAttribs( $target, $attribs, $options ) {
                wfProfileIn( __METHOD__ );
@@ -512,7 +521,7 @@ class Linker {
                                // we don't want it to be limited by its "normal" width.
                                global $wgSVGMaxSize;
                                $hp['width'] = $wgSVGMaxSize;
-                       } else { 
+                       } else {
                                $hp['width'] = $file->getWidth( $page );
                        }
 
@@ -829,7 +838,7 @@ class Linker {
         * This will make a broken link if $file is false.
         *
         * @param $title Title object.
-        * @param $file mixed File object or false
+        * @param $file File|false mixed File object or false
         * @param $text String: pre-sanitized HTML
         * @return String: HTML
         *
@@ -852,12 +861,16 @@ class Linker {
        }
 
        /**
-        *  Make a link to a special page given its name and, optionally,
+        * Make a link to a special page given its name and, optionally,
         * a message key from the link text.
         * Usage example: $skin->specialLink( 'recentchanges' )
+        *
+        * @return bool
         */
        static function specialLink( $name, $key = '' ) {
-               if ( $key == '' ) { $key = strtolower( $name ); }
+               if ( $key == '' ) {
+                       $key = strtolower( $name );
+               }
 
                return self::linkKnown( SpecialPage::getTitleFor( $name ) , wfMsg( $key ) );
        }
@@ -1000,7 +1013,7 @@ class Linker {
        static function revUserLink( $rev, $isPublic = false ) {
                if ( $rev->isDeleted( Revision::DELETED_USER ) && $isPublic ) {
                        $link = wfMsgHtml( 'rev-deleted-user' );
-               } else if ( $rev->userCan( Revision::DELETED_USER ) ) {
+               } elseif ( $rev->userCan( Revision::DELETED_USER ) ) {
                        $link = self::userLink( $rev->getUser( Revision::FOR_THIS_USER ),
                                $rev->getUserText( Revision::FOR_THIS_USER ) );
                } else {
@@ -1021,7 +1034,7 @@ class Linker {
        static function revUserTools( $rev, $isPublic = false ) {
                if ( $rev->isDeleted( Revision::DELETED_USER ) && $isPublic ) {
                        $link = wfMsgHtml( 'rev-deleted-user' );
-               } else if ( $rev->userCan( Revision::DELETED_USER ) ) {
+               } elseif ( $rev->userCan( Revision::DELETED_USER ) ) {
                        $userId = $rev->getUser( Revision::FOR_THIS_USER );
                        $userText = $rev->getUserText( Revision::FOR_THIS_USER );
                        $link = self::userLink( $userId, $userText ) .
@@ -1098,6 +1111,10 @@ class Linker {
                return $comment;
        }
 
+       /**
+        * @param $match
+        * @return string
+        */
        private static function formatAutocommentsCallback( $match ) {
                $title = self::$autocommentTitle;
                $local = self::$autocommentLocal;
@@ -1144,6 +1161,9 @@ class Linker {
                return $comment;
        }
 
+       /**
+        * @var Title
+        */
        static $commentContextTitle;
        static $commentLocal;
 
@@ -1169,6 +1189,10 @@ class Linker {
                return $html;
        }
 
+       /**
+        * @param $match
+        * @return mixed
+        */
        protected static function formatLinksInCommentCallback( $match ) {
                global $wgContLang;
 
@@ -1319,10 +1343,10 @@ class Linker {
         * @param $comment String
         * @param $title Mixed: Title object (to generate link to section in autocomment) or null
         * @param $local Boolean: whether section links should refer to local page
-        * @param $embraced Boolean: whether the formatted comment should be embraced with ()
+        *
         * @return string
         */
-       static function commentBlock( $comment, $title = null, $local = false, $embraced = true ) {
+       static function commentBlock( $comment, $title = null, $local = false ) {
                // '*' used to be the comment inserted by the software way back
                // in antiquity in case none was provided, here for backwards
                // compatability, acc. to brion -ævar
@@ -1330,10 +1354,7 @@ class Linker {
                        return '';
                } else {
                        $formatted = self::formatComment( $comment, $title, $local );
-                       if ( $embraced ) {
-                               $formatted = wfMessage( 'parentheses' )->rawParams( $formatted )->escaped();
-                       }
-                       return Html::rawElement( 'span', array( 'class' => 'comment' ), $formatted );
+                       return " <span class=\"comment\">($formatted)</span>";
                }
        }
 
@@ -1352,7 +1373,7 @@ class Linker {
                }
                if ( $rev->isDeleted( Revision::DELETED_COMMENT ) && $isPublic ) {
                        $block = " <span class=\"comment\">" . wfMsgHtml( 'rev-deleted-comment' ) . "</span>";
-               } else if ( $rev->userCan( Revision::DELETED_COMMENT ) ) {
+               } elseif ( $rev->userCan( Revision::DELETED_COMMENT ) ) {
                        $block = self::commentBlock( $rev->getComment( Revision::FOR_THIS_USER ),
                                $rev->getTitle(), $local );
                } else {
@@ -1364,6 +1385,10 @@ class Linker {
                return $block;
        }
 
+       /**
+        * @param $size
+        * @return string
+        */
        public static function formatRevisionSize( $size ) {
                if ( $size == 0 ) {
                        $stxt = wfMsgExt( 'historyempty', 'parsemag' );
@@ -1378,6 +1403,8 @@ class Linker {
 
        /**
         * Add another level to the Table of Contents
+        *
+        * @return string
         */
        static function tocIndent() {
                return "\n<ul>";
@@ -1385,6 +1412,8 @@ class Linker {
 
        /**
         * Finish one or more sublevels on the Table of Contents
+        *
+        * @return string
         */
        static function tocUnindent( $level ) {
                return "</li>\n" . str_repeat( "</ul>\n</li>\n", $level > 0 ? $level : 0 );
@@ -1392,11 +1421,14 @@ class Linker {
 
        /**
         * parameter level defines if we are on an indentation level
+        *
+        * @return string
         */
        static function tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex = false ) {
                $classes = "toclevel-$level";
-               if ( $sectionIndex !== false )
+               if ( $sectionIndex !== false ) {
                        $classes .= " tocsection-$sectionIndex";
+               }
                return "\n<li class=\"$classes\"><a href=\"#" .
                        $anchor . '"><span class="tocnumber">' .
                        $tocnumber . '</span> <span class="toctext">' .
@@ -1441,7 +1473,7 @@ class Linker {
                foreach ( $tree as $section ) {
                        if ( $section['toclevel'] > $lastLevel )
                                $toc .= self::tocIndent();
-                       else if ( $section['toclevel'] < $lastLevel )
+                       elseif ( $section['toclevel'] < $lastLevel )
                                $toc .= self::tocUnindent(
                                        $lastLevel - $section['toclevel'] );
                        else
@@ -1663,6 +1695,10 @@ class Linker {
         *   escape), or false for no title attribute
         */
        public static function titleAttrib( $name, $options = null ) {
+               global $wgEnableTooltipsAndAccesskeys;
+               if ( !$wgEnableTooltipsAndAccesskeys )
+                       return false;
+               
                wfProfileIn( __METHOD__ );
 
                $message = wfMessage( "tooltip-$name" );
@@ -1949,6 +1985,9 @@ class Linker {
        }
 }
 
+/**
+ * @since 1.19
+ */
 class DummyLinker {
 
        /**
@@ -1958,9 +1997,8 @@ class DummyLinker {
         * @param $fname String Name of called method
         * @param $args Array Arguments to the method
         */
-       function __call( $fname, $args ) {
+       public function __call( $fname, $args ) {
                return call_user_func_array( array( 'Linker', $fname ), $args );
        }
-
 }