2012-02-29 09:30:06 +00:00
|
|
|
<?php
|
2012-02-29 10:50:36 +00:00
|
|
|
|
|
|
|
if ( !defined( 'MEDIAWIKI' ) ) {
|
|
|
|
die;
|
|
|
|
}
|
|
|
|
|
2012-03-12 12:54:17 +00:00
|
|
|
define( 'PAGE_IMAGES_INSTALLED', true );
|
|
|
|
|
2012-03-02 16:42:17 +00:00
|
|
|
$wgExtensionCredits['api'][] = array(
|
2012-03-01 20:00:29 +00:00
|
|
|
'path' => __FILE__,
|
|
|
|
'name' => 'PageImages',
|
|
|
|
'descriptionmsg' => 'pageimages-desc',
|
|
|
|
'author' => 'Max Semenik',
|
|
|
|
'url' => 'https://www.mediawiki.org/wiki/Extension:PageImages'
|
|
|
|
);
|
2012-02-29 10:50:36 +00:00
|
|
|
|
2014-03-28 11:12:22 +00:00
|
|
|
$wgAutoloadClasses['ApiQueryPageImages'] = __DIR__ . "/ApiQueryPageImages.php";
|
|
|
|
$wgAutoloadClasses['PageImages'] = __DIR__ . "/PageImages.body.php";
|
2012-02-29 10:50:36 +00:00
|
|
|
|
2014-03-28 11:12:22 +00:00
|
|
|
$wgMessagesDirs['PageImages'] = __DIR__ . '/i18n';
|
|
|
|
$wgExtensionMessagesFiles['PageImages'] = __DIR__ . "/PageImages.i18n.php";
|
2012-03-05 21:36:43 +00:00
|
|
|
|
2012-03-01 14:33:28 +00:00
|
|
|
$wgHooks['ParserMakeImageParams'][] = 'PageImages::onParserMakeImageParams';
|
|
|
|
$wgHooks['LinksUpdate'][] = 'PageImages::onLinksUpdate';
|
2012-12-17 19:22:13 +00:00
|
|
|
$wgHooks['OpenSearchXml'][] = 'PageImages::onOpenSearchXml';
|
2014-05-02 06:29:28 +00:00
|
|
|
$wgHooks['InfoAction'][] = 'PageImages::onInfoAction';
|
2014-06-18 00:23:21 +00:00
|
|
|
$wgHooks['AfterParserFetchFileAndTitle'][] = 'PageImages::onAfterParserFetchFileAndTitle';
|
2014-09-19 18:41:48 +00:00
|
|
|
$wgHooks['SpecialMobileEditWatchlist::images'][] = 'PageImages::onSpecialMobileEditWatchlist_images';
|
2012-03-01 12:25:57 +00:00
|
|
|
|
2012-12-17 19:22:13 +00:00
|
|
|
$wgAPIPropModules['pageimages'] = 'ApiQueryPageImages';
|
2012-03-01 17:37:16 +00:00
|
|
|
|
2014-02-11 19:59:04 +00:00
|
|
|
/**
|
|
|
|
* Configures how various aspects of image affect its score
|
|
|
|
*/
|
2012-03-01 12:25:57 +00:00
|
|
|
$wgPageImagesScores = array(
|
2014-02-11 19:59:04 +00:00
|
|
|
/** position of image in article */
|
2012-03-01 12:25:57 +00:00
|
|
|
'position' => array( 8, 6, 4, 3 ),
|
2014-06-18 00:23:21 +00:00
|
|
|
/** image width as shown on page */
|
2012-03-01 12:25:57 +00:00
|
|
|
'width' => array(
|
2014-10-20 22:01:32 +00:00
|
|
|
119 => -100, // Very small images are usually from maintenace or stub templates
|
|
|
|
400 => 10,
|
|
|
|
600 => 5, // Larger images are panoramas, less suitable
|
|
|
|
601 => 0,
|
2014-02-11 19:59:04 +00:00
|
|
|
),
|
2014-06-18 00:23:21 +00:00
|
|
|
/** real width of a gallery image */
|
|
|
|
'galleryImageWidth' => array(
|
|
|
|
99 => -100,
|
|
|
|
100 => 0,
|
|
|
|
),
|
2014-02-11 19:59:04 +00:00
|
|
|
/** width/height ratio, in tenths */
|
|
|
|
'ratio' => array(
|
|
|
|
3 => -100,
|
|
|
|
5 => 0,
|
|
|
|
20 => 5,
|
|
|
|
30 => 0,
|
|
|
|
31 => -100,
|
2012-03-01 12:25:57 +00:00
|
|
|
),
|
2012-03-02 16:42:17 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
$wgPageImagesBlacklist = array(
|
|
|
|
array(
|
|
|
|
'type' => 'db',
|
2012-12-26 21:26:51 +00:00
|
|
|
'page' => 'MediaWiki:Pageimages-blacklist',
|
2012-03-02 16:42:17 +00:00
|
|
|
'db' => false, // current wiki
|
|
|
|
),
|
|
|
|
/*
|
|
|
|
array(
|
|
|
|
'type' => 'db',
|
2012-12-26 21:26:51 +00:00
|
|
|
'page' => 'MediaWiki:Pageimages-blacklist',
|
2012-03-02 16:42:17 +00:00
|
|
|
'db' => 'commonswiki',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'type' => 'url',
|
|
|
|
'url' => 'http://example.com/w/index.php?title=somepage&action=raw',
|
|
|
|
),
|
|
|
|
*/
|
|
|
|
);
|
|
|
|
|
2012-03-08 14:01:00 +00:00
|
|
|
/**
|
|
|
|
* How long blacklist cache lives
|
|
|
|
*/
|
2012-03-02 16:42:17 +00:00
|
|
|
$wgPageImagesBlacklistExpiry = 60 * 15;
|
2012-03-08 14:01:00 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether this extension's image information should be used by OpenSearchXml
|
|
|
|
*/
|
|
|
|
$wgPageImagesExpandOpenSearchXml = false;
|
2012-05-08 21:42:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Collect data only for these namespaces
|
|
|
|
*/
|
|
|
|
$wgPageImagesNamespaces = array( NS_MAIN );
|
2014-06-18 00:23:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If set to true, allows selecting images from galleries as page images
|
|
|
|
*/
|
|
|
|
$wgPageImagesUseGalleries = false;
|