Revert r86764, r89134, r86827 -- added a second opaque boolean parameter to Linker...
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 14 Jun 2011 23:50:40 +0000 (23:50 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 14 Jun 2011 23:50:40 +0000 (23:50 +0000)
commentBlock() exists for the sole purpose of embedding a comment into parentheses if it exists so you can append it to a line of text -- if you're not putting stuff in parentheses, don't use commentBlock() because you're not generating a parenthesized comment block.
Opaque boolean parameters are also very poor form, especially when tacking on multiple ones. There was already a nasty optional '$local' boolean param, forcing all uses of this other parameter to add *two* parameters, making illegible stuff like 'false, false'.

includes/ImagePage.php
includes/Linker.php
includes/specials/SpecialListfiles.php

index effd829..f962a99 100644 (file)
@@ -1111,7 +1111,7 @@ class ImageHistoryList {
                if ( $file->isDeleted( File::DELETED_COMMENT ) ) {
                        $row .= '<span class="history-deleted">' . wfMsgHtml( 'rev-deleted-comment' ) . '</span>';
                } else {
-                       $row .= $this->skin->commentBlock( $description, $this->title, false, false );
+                       $row .= $this->skin->commentBlock( $description, $this->title );
                }
                $row .= '</td>';
 
index 4d913e7..bd8ad3c 100644 (file)
@@ -1343,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
@@ -1354,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>";
                }
        }
 
@@ -1377,7 +1374,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 ) ) {
-                       $block = ' ' . self::commentBlock( $rev->getComment( Revision::FOR_THIS_USER ),
+                       $block = self::commentBlock( $rev->getComment( Revision::FOR_THIS_USER ),
                                $rev->getTitle(), $local );
                } else {
                        $block = " <span class=\"comment\">" . wfMsgHtml( 'rev-deleted-comment' ) . "</span>";
index 8cc6e36..205dd57 100644 (file)
@@ -221,7 +221,7 @@ class ImageListPager extends TablePager {
                        case 'img_size':
                                return $this->getSkin()->formatSize( $value );
                        case 'img_description':
-                               return $this->getSkin()->commentBlock( $value, null, false, false );
+                               return $this->getSkin()->commentBlock( $value );
                        case 'count':
                                return intval( $value ) + 1;
                }