Index: trunk/phase3/includes/ImageGallery.php |
— | — | @@ -247,7 +247,7 @@ |
248 | 248 | } |
249 | 249 | |
250 | 250 | $params = array( 'width' => $this->mWidths, 'height' => $this->mHeights ); |
251 | | - $i = 0; |
| 251 | + # Output each image... |
252 | 252 | foreach ( $this->mImages as $pair ) { |
253 | 253 | $nt = $pair[0]; |
254 | 254 | $text = $pair[1]; # "text" means "caption" here |
— | — | @@ -257,8 +257,20 @@ |
258 | 258 | $time = $sha1 = $descQuery = false; |
259 | 259 | wfRunHooks( 'BeforeGalleryFindFile', |
260 | 260 | array( &$this, &$nt, &$time, &$descQuery, &$sha1 ) ); |
261 | | - # Fetch and register the file (file title may be different via hooks) |
262 | | - list( $img, $nt ) = $this->mParser->fetchFileAndTitle( $nt, $time, $sha1 ); |
| 261 | + # Get the file... |
| 262 | + if ( $this->mParser instanceof Parser ) { |
| 263 | + # Fetch and register the file (file title may be different via hooks) |
| 264 | + list( $img, $nt ) = $this->mParser->fetchFileAndTitle( $nt, $time, $sha1 ); |
| 265 | + } else { |
| 266 | + if ( $time === '0' ) { |
| 267 | + $img = false; // broken thumbnail forced by hook |
| 268 | + } elseif ( $sha1 ) { // get by (sha1,timestamp) |
| 269 | + $img = RepoGroup::singleton()->findFileFromKey( |
| 270 | + $sha1, array( 'time' => $time ) ); |
| 271 | + } else { // get by (name,timestamp) |
| 272 | + $img = wfFindFile( $nt, array( 'time' => $time ) ); |
| 273 | + } |
| 274 | + } |
263 | 275 | } else { |
264 | 276 | $img = false; |
265 | 277 | } |
— | — | @@ -353,7 +365,6 @@ |
354 | 366 | . $textlink . $text . $nb |
355 | 367 | . "\n\t\t\t</div>" |
356 | 368 | . "\n\t\t</div></li>"; |
357 | | - ++$i; |
358 | 369 | } |
359 | 370 | $s .= "\n</ul>"; |
360 | 371 | |