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',
|
2016-01-12 21:55:31 +00:00
|
|
|
'url' => 'https://www.mediawiki.org/wiki/Extension:PageImages',
|
|
|
|
'license-name' => 'WTFPL',
|
2012-03-01 20:00:29 +00:00
|
|
|
);
|
2012-02-29 10:50:36 +00:00
|
|
|
|
2015-11-11 17:33:46 +00:00
|
|
|
$wgAutoloadClasses['ApiQueryPageImages'] = __DIR__ . '/includes/ApiQueryPageImages.php';
|
|
|
|
$wgAutoloadClasses['PageImages'] = __DIR__ . '/includes/PageImages.php';
|
2015-11-16 15:40:07 +00:00
|
|
|
$wgAutoloadClasses['PageImages\Hooks\LinksUpdateHookHandler']
|
|
|
|
= __DIR__ . '/includes/LinksUpdateHookHandler.php';
|
2016-02-14 11:21:00 +00:00
|
|
|
$wgAutoloadClasses['PageImages\Hooks\ParserFileProcessingHookHandlers']
|
|
|
|
= __DIR__ . '/includes/ParserFileProcessingHookHandlers.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
|
|
|
|
2015-12-30 12:41:37 +00:00
|
|
|
$wgHooks['ParserMakeImageParams'][]
|
2016-02-14 11:21:00 +00:00
|
|
|
= 'PageImages\Hooks\ParserFileProcessingHookHandlers::onParserMakeImageParams';
|
2015-11-16 15:40:07 +00:00
|
|
|
$wgHooks['LinksUpdate'][] = 'PageImages\Hooks\LinksUpdateHookHandler::onLinksUpdate';
|
2014-11-05 22:18:30 +00:00
|
|
|
$wgHooks['OpenSearchXml'][] = 'PageImages::onApiOpenSearchSuggest';
|
|
|
|
$wgHooks['ApiOpenSearchSuggest'][] = 'PageImages::onApiOpenSearchSuggest';
|
2014-05-02 06:29:28 +00:00
|
|
|
$wgHooks['InfoAction'][] = 'PageImages::onInfoAction';
|
2015-12-30 12:41:37 +00:00
|
|
|
$wgHooks['AfterParserFetchFileAndTitle'][]
|
2016-02-14 11:21:00 +00:00
|
|
|
= 'PageImages\Hooks\ParserFileProcessingHookHandlers::onAfterParserFetchFileAndTitle';
|
2014-09-19 18:41:48 +00:00
|
|
|
$wgHooks['SpecialMobileEditWatchlist::images'][] = 'PageImages::onSpecialMobileEditWatchlist_images';
|
2012-03-01 12:25:57 +00:00
|
|
|
|
2015-10-02 08:58:54 +00:00
|
|
|
$wgHooks['UnitTestsList'][] = function( array &$paths ) {
|
|
|
|
$paths[] = __DIR__ . '/tests/phpunit';
|
|
|
|
};
|
|
|
|
|
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
|
|
|
),
|
2016-01-25 05:29:29 +00:00
|
|
|
'rights' => array(
|
|
|
|
'nonfree' => -100, // don't show nonfree images
|
|
|
|
),
|
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
|
|
|
|
|
|
|
/**
|
2014-11-05 22:18:30 +00:00
|
|
|
* Whether this extension's image information should be used by OpenSearch
|
2012-03-08 14:01:00 +00:00
|
|
|
*/
|
|
|
|
$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;
|