/**
- * isEmpty() returns false iff the gallery doesn't contain any images
+ * isEmpty() returns true if the gallery contains no images
*/
function isEmpty() {
return empty( $this->mImages );
*
*/
function toHTML() {
- global $wgLang, $wgContLang, $wgUser;
+ global $wgLang, $wgUser;
$sk = $wgUser->getSkin();
if( $this->mShowBytes ) {
if( $img->exists() ) {
- $nb = wfMsg( 'nbytes', $wgLang->formatNum( $img->getSize() ) );
+ $nb = wfMsgHtml( 'nbytes', $wgLang->formatNum( $img->getSize() ) );
} else {
- $nb = wfMsg( 'filemissing' );
+ $nb = wfMsgHtml( 'filemissing' );
}
- $nb = htmlspecialchars( $nb ) . '<br />';
+ $nb = "$nb<br />\n";
} else {
$nb = '';
}
- '' ;
$textlink = $this->mShowFilename ?
- $sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20, '...' ) ) ) . '<br />' :
+ $sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20, '...' ) ) ) . "<br />\n" :
'' ;
$s .= ($i%4==0) ? '<tr>' : '';
$thumb = $img->getThumbnail( 120, 120 );
$vpad = floor( ( 150 - $thumb->height ) /2 ) - 2;
- $s .= '<td><div class="gallerybox">' .
- '<div class="thumb" style="padding: ' . $vpad . 'px 0;">'.
- $sk->makeKnownLinkObj( $nt, $thumb->toHtml() ) . '</div>';
- if($text <> '') {
- $s .= '<div class="gallerytext">' .
- $textlink . $text . $nb .
- '</div>';
- }
+ $s .= '<td><div class="gallerybox">' . '<div class="thumb" style="padding: ' . $vpad . 'px 0;">';
+
+ # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which
+ # in version 4.8.6 generated crackpot html in its absence, see:
+ # http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar
+ $s .= $sk->makeKnownLinkObj( $nt, $thumb->toHtml() ) . '</div><div class="gallerytext">' . "\n" .
+ $textlink . $text . $nb .
+ '</div>';
$s .= "</div></td>\n";
$s .= ($i%4==3) ? '</tr>' : '';
$i++;