Change $bad and return false to override. If an image is "bad", it is not
rendered inline in wiki pages or galleries in category pages.
-'BeforeGalleryFindFile': before an image is fetched for a gallery
-&$gallery,: the gallery object
-&$nt: the image title
-&$time: image timestamp (used to specify the file)
-&$descQuery: query string to add to thumbnail URL
-&$sha1: image base 36 sha1 (used to specify the file, $nt will be ignored if this is set)
-
'BeforeInitialize': before anything is initialized in performRequestForTitle()
&$title: Title being used for request
&$article: The associated Article object
&$out: OutputPage object
&$skin: Skin object
+'BeforeParserFetchFileAndTitle': before an image is rendered by Parser
+&$parser: Parser object
+&$nt: the image title
+&$time: the image timestamp (use '0' to force a broken thumbnail)
+&$sha1: image base 36 sha1 (used to specify the file, $nt will be ignored if this is set)
+&$descQuery: query string to add to thumbnail URL
+
'BeforeParserFetchTemplateAndtitle': before a template is fetched by Parser
&$parser: Parser object
&$title: title of the template
&$skip: skip this template and link it?
&$id: the id of the revision being parsed
-'BeforeParserMakeImageLinkObj': before an image is rendered by Parser
-&$parser: Parser object
-&$nt: the image title
-&$skip: skip this image and link it?
-&$time: the image timestamp
-&$descQuery: query string to add to thumbnail URL
-&$sha1: image base 36 sha1 (used to specify the file, $nt will be ignored if this is set)
-
'BeforeParserrenderImageGallery': before an image gallery is rendered by Parser
&$parser: Parser object
&$ig: ImageGallery object
}
$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>";
$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 ) );
# 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 {
- if ( $time === '0' ) {
- $img = false; // broken thumbnail forced by hook
- } elseif ( $sha1 ) { // get by (sha1,timestamp)
- $img = RepoGroup::singleton()->findFileFromKey(
- $sha1, array( 'time' => $time ) );
- } else { // get by (name,timestamp)
- $img = wfFindFile( $nt, array( 'time' => $time ) );
- }
+ $img = wfFindFile( $nt );
}
} else {
$img = false;
if ( $ns == NS_MEDIA ) {
wfProfileIn( __METHOD__."-media" );
# Give extensions a chance to select the file revision for us
- $skip = $time = $sha1 = $descQuery = false;
- wfRunHooks( 'BeforeParserMakeImageLinkObj',
- array( &$this, &$nt, &$skip, &$time, &$descQuery, &$sha1 ) );
- if ( $skip ) {
- $this->mOutput->addImage( $nt->getDBkey(), null, null ); // register
- $link = $sk->link( $nt );
- } else {
- # Fetch and register the file (file title may be different via hooks)
- list( $file, $nt ) = $this->fetchFileAndTitle( $nt, $time, $sha1 );
- $link = $sk->makeMediaLinkFile( $nt, $file, $text );
- }
+ $time = $sha1 = $descQuery = false;
+ wfRunHooks( 'BeforeParserFetchFileAndTitle',
+ array( &$this, &$nt, &$time, &$sha1, &$descQuery ) );
+ # Fetch and register the file (file title may be different via hooks)
+ list( $file, $nt ) = $this->fetchFileAndTitle( $nt, $time, $sha1 );
# Cloak with NOPARSE to avoid replacement in replaceExternalLinks
- $s .= $prefix . $this->armorLinks( $link ) . $trail;
+ $s .= $prefix . $this->armorLinks(
+ $sk->makeMediaLinkFile( $nt, $file, $text ) ) . $trail;
wfProfileOut( __METHOD__."-media" );
continue;
}
$sk = $this->mOptions->getSkin( $this->mTitle );
# Give extensions a chance to select the file revision for us
- $skip = $time = $sha1 = $descQuery = false;
- wfRunHooks( 'BeforeParserMakeImageLinkObj',
- array( &$this, &$title, &$skip, &$time, &$descQuery, &$sha1 ) );
- if ( $skip ) {
- $this->mOutput->addImage( $title->getDBkey(), null, null ); // register
- return $sk->link( $title );
- }
+ $time = $sha1 = $descQuery = false;
+ wfRunHooks( 'BeforeParserFetchFileAndTitle',
+ array( &$this, &$title, &$time, &$sha1, &$descQuery ) );
# Fetch and register the file (file title may be different via hooks)
list( $file, $title ) = $this->fetchFileAndTitle( $title, $time, $sha1 );
+
# Get parameter map
$handler = $file ? $file->getHandler() : false;