{
var $mImages, $mShowBytes, $mShowFilename;
var $mCaption = false;
- var $mSkin = false;
/**
* Hide blacklisted images?
/**
* Registered parser object for output callbacks
+ * @var Parser
*/
var $mParser;
* Instruct the class to use a specific skin for rendering
*
* @param $skin Skin object
+ * @deprecated Not used anymore
*/
function useSkin( $skin ) {
- $this->mSkin = $skin;
- }
-
- /**
- * Return the skin that should be used
- *
- * @return Skin object
- */
- function getSkin() {
- if( !$this->mSkin ) {
- global $wgUser;
- $skin = $wgUser->getSkin();
- } else {
- $skin = $this->mSkin;
- }
- return $skin;
+ /* no op */
}
/**
function toHTML() {
global $wgLang;
- $sk = $this->getSkin();
-
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'] : "";
}
$attribs = Sanitizer::mergeAttributes(
- array(
- 'class' => 'gallery'),
- $this->mAttribs );
+ array( 'class' => 'gallery' ), $this->mAttribs );
+
$s = Xml::openElement( 'ul', $attribs );
if ( $this->mCaption ) {
$s .= "\n\t<li class='gallerycaption'>{$this->mCaption}</li>";
}
$params = array( 'width' => $this->mWidths, 'height' => $this->mHeights );
- $i = 0;
+ # Output each image...
foreach ( $this->mImages as $pair ) {
$nt = $pair[0];
$text = $pair[1]; # "text" means "caption" here
+ $descQuery = false;
if ( $nt->getNamespace() == NS_FILE ) {
- # Give extensions a chance to select the file revision for us
- $time = $sha1 = $descQuery = false;
- wfRunHooks( 'BeforeGalleryFindFile',
- array( &$this, &$nt, &$time, &$descQuery, &$sha1 ) );
- # Fetch and register the file (file title may be different via hooks)
- list( $img, $nt ) = $this->mParser->fetchFileAndTitle( $nt, $time, $sha1 );
+ # Get the file...
+ if ( $this->mParser instanceof Parser ) {
+ # Give extensions a chance to select the file revision for us
+ $time = $sha1 = false;
+ wfRunHooks( 'BeforeParserFetchFileAndTitle',
+ array( $this->mParser, $nt, &$time, &$sha1, &$descQuery ) );
+ # Fetch and register the file (file title may be different via hooks)
+ list( $img, $nt ) = $this->mParser->fetchFileAndTitle( $nt, $time, $sha1 );
+ } else {
+ $img = wfFindFile( $nt );
+ }
} else {
$img = false;
}
} elseif( $this->mHideBadImages && wfIsBadImage( $nt->getDBkey(), $this->getContextTitle() ) ) {
# The image is blacklisted, just show it as a text link.
$thumbhtml = "\n\t\t\t".'<div style="height: '.(self::THUMB_PADDING + $this->mHeights).'px;">' .
- $sk->link(
+ Linker::link(
$nt,
htmlspecialchars( $nt->getText() ),
array(),
//TODO
// $linkTarget = Title::newFromText( $wgContLang->getNsText( MWNamespace::getUser() ) . ":{$ut}" );
- // $ul = $sk->link( $linkTarget, $ut );
+ // $ul = Linker::link( $linkTarget, $ut );
if( $this->mShowBytes ) {
if( $img ) {
}
$textlink = $this->mShowFilename ?
- $sk->link(
+ Linker::link(
$nt,
htmlspecialchars( $wgLang->truncate( $nt->getText(), $this->mCaptionLength ) ),
array(),
. $textlink . $text . $nb
. "\n\t\t\t</div>"
. "\n\t\t</div></li>";
- ++$i;
}
$s .= "\n</ul>";