Revert r113650 and reapply r113619 and r113649 with one modification: User::createNew...
[lhc/web/wiklou.git] / includes / ImageGallery.php
index 5c2ed89..5a8fb8e 100644 (file)
@@ -28,9 +28,9 @@ class ImageGallery {
         * Contextual title, used when images are being screened
         * against the bad image list
         */
-       private $contextTitle = false;
+       protected $contextTitle = false;
 
-       private $mAttribs = array();
+       protected $mAttribs = array();
 
        /**
         * Fixed margins
@@ -75,7 +75,7 @@ class ImageGallery {
        /**
         * Set the caption (as plain text)
         *
-        * @param $caption Caption
+        * @param $caption string Caption
         */
        function setCaption( $caption ) {
                $this->mCaption = htmlspecialchars( $caption );
@@ -131,7 +131,7 @@ class ImageGallery {
         * @deprecated since 1.18 Not used anymore
         */
        function useSkin( $skin ) {
-               wfDeprecated( __METHOD__ );
+               wfDeprecated( __METHOD__, '1.18' );
                /* no op */
        }
 
@@ -168,6 +168,7 @@ class ImageGallery {
 
        /**
         * isEmpty() returns true if the gallery contains no images
+        * @return bool
         */
        function isEmpty() {
                return empty( $this->mImages );
@@ -215,13 +216,14 @@ class ImageGallery {
         * - the additional text provided when adding the image
         * - the size of the image
         *
+        * @return string
         */
        function toHTML() {
                global $wgLang;
 
                if ( $this->mPerRow > 0 ) {
                        $maxwidth = $this->mPerRow * ( $this->mWidths + self::THUMB_PADDING + self::GB_PADDING + self::GB_BORDERS );
-                       $oldStyle = isset( $this->mAttribs['style'] ) ? $this->mAttribs['style'] : ''; 
+                       $oldStyle = isset( $this->mAttribs['style'] ) ? $this->mAttribs['style'] : '';
                        # _width is ignored by any sane browser. IE6 doesn't know max-width so it uses _width instead
                        $this->mAttribs['style'] = "max-width: {$maxwidth}px;_width: {$maxwidth}px;" . $oldStyle;
                }
@@ -249,11 +251,11 @@ class ImageGallery {
                                # Get the file...
                                if ( $this->mParser instanceof Parser ) {
                                        # Give extensions a chance to select the file revision for us
-                                       $time = $sha1 = false;
+                                       $options = array();
                                        wfRunHooks( 'BeforeParserFetchFileAndTitle',
-                                               array( $this->mParser, $nt, &$time, &$sha1, &$descQuery ) );
+                                               array( $this->mParser, $nt, &$options, &$descQuery ) );
                                        # Fetch and register the file (file title may be different via hooks)
-                                       list( $img, $nt ) = $this->mParser->fetchFileAndTitle( $nt, $time, $sha1 );
+                                       list( $img, $nt ) = $this->mParser->fetchFileAndTitle( $nt, $options );
                                } else {
                                        $img = wfFindFile( $nt );
                                }
@@ -314,8 +316,7 @@ class ImageGallery {
 
                        if( $this->mShowBytes ) {
                                if( $img ) {
-                                       $fileSize = wfMsgExt( 'nbytes', array( 'parsemag', 'escape'),
-                                               $wgLang->formatNum( $img->getSize() ) );
+                                       $fileSize = htmlspecialchars( $wgLang->formatSize( $img->getSize() ) );
                                } else {
                                        $fileSize = wfMsgHtml( 'filemissing' );
                                }