mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/PageImages
synced 2024-11-28 02:00:42 +00:00
++
This commit is contained in:
parent
fb828b5361
commit
6d258671b5
24
PageImages.body.php
Normal file
24
PageImages.body.php
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class PageImages {
|
||||||
|
public static function registerImage( Title $title, File $file, &$params, Parser $parser ) {
|
||||||
|
$out = $parser->getOutput();
|
||||||
|
if ( !isset( $out->pageImages ) ) {
|
||||||
|
$out->pageImages = array();
|
||||||
|
}
|
||||||
|
$myParams = $params;
|
||||||
|
if ( !isset( $myParams['handler']['width'] ) ) {
|
||||||
|
$myParams['handler']['width'] = $file->getWidth();
|
||||||
|
}
|
||||||
|
$out->pageImages[$title->getDBkey()] = $myParams;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getProperties( LinksUpdate $lu ) {
|
||||||
|
if ( !isset( $lu->getParserOutput()->pageImages ) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
$images = $lu->getParserOutput()->pageImages;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
if ( !defined( 'MEDIAWIKI' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
define( 'PAGE_IMAGES_INSTALLED', true );
|
||||||
|
|
||||||
|
$dir = dirname( __FILE__ );
|
||||||
|
$wgAutoloadClasses['PageImages'] = "$dir/PageImages.body.php";
|
||||||
|
|
||||||
|
$wgHooks['ParserMakeImageParams'][] = 'PageImages::registerImage';
|
||||||
|
$wgHooks['LinksUpdate'][] = 'PageImages::getProperties';
|
||||||
|
|
Loading…
Reference in a new issue