mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/PageImages
synced 2024-11-15 12:00:40 +00:00
bccf0c0862
With Ie0ab9090, the OpenSearchXml extension is merged into core. The new hook works identically to OpenSearchXml's hook. The $wgPageImagesExpandOpenSearchXml variable should probably be renamed, but I'm leaving that for a different patch. Change-Id: I16024aa22578585873cddba1daa4ca0dc05645e1
99 lines
2.5 KiB
PHP
99 lines
2.5 KiB
PHP
<?php
|
|
|
|
if ( !defined( 'MEDIAWIKI' ) ) {
|
|
die;
|
|
}
|
|
|
|
define( 'PAGE_IMAGES_INSTALLED', true );
|
|
|
|
$wgExtensionCredits['api'][] = array(
|
|
'path' => __FILE__,
|
|
'name' => 'PageImages',
|
|
'descriptionmsg' => 'pageimages-desc',
|
|
'author' => 'Max Semenik',
|
|
'url' => 'https://www.mediawiki.org/wiki/Extension:PageImages'
|
|
);
|
|
|
|
$wgAutoloadClasses['ApiQueryPageImages'] = __DIR__ . "/ApiQueryPageImages.php";
|
|
$wgAutoloadClasses['PageImages'] = __DIR__ . "/PageImages.body.php";
|
|
|
|
$wgMessagesDirs['PageImages'] = __DIR__ . '/i18n';
|
|
$wgExtensionMessagesFiles['PageImages'] = __DIR__ . "/PageImages.i18n.php";
|
|
|
|
$wgHooks['ParserMakeImageParams'][] = 'PageImages::onParserMakeImageParams';
|
|
$wgHooks['LinksUpdate'][] = 'PageImages::onLinksUpdate';
|
|
$wgHooks['OpenSearchXml'][] = 'PageImages::onApiOpenSearchSuggest';
|
|
$wgHooks['ApiOpenSearchSuggest'][] = 'PageImages::onApiOpenSearchSuggest';
|
|
$wgHooks['InfoAction'][] = 'PageImages::onInfoAction';
|
|
$wgHooks['AfterParserFetchFileAndTitle'][] = 'PageImages::onAfterParserFetchFileAndTitle';
|
|
$wgHooks['SpecialMobileEditWatchlist::images'][] = 'PageImages::onSpecialMobileEditWatchlist_images';
|
|
|
|
$wgAPIPropModules['pageimages'] = 'ApiQueryPageImages';
|
|
|
|
/**
|
|
* Configures how various aspects of image affect its score
|
|
*/
|
|
$wgPageImagesScores = array(
|
|
/** position of image in article */
|
|
'position' => array( 8, 6, 4, 3 ),
|
|
/** image width as shown on page */
|
|
'width' => array(
|
|
119 => -100, // Very small images are usually from maintenace or stub templates
|
|
400 => 10,
|
|
600 => 5, // Larger images are panoramas, less suitable
|
|
601 => 0,
|
|
),
|
|
/** real width of a gallery image */
|
|
'galleryImageWidth' => array(
|
|
99 => -100,
|
|
100 => 0,
|
|
),
|
|
/** width/height ratio, in tenths */
|
|
'ratio' => array(
|
|
3 => -100,
|
|
5 => 0,
|
|
20 => 5,
|
|
30 => 0,
|
|
31 => -100,
|
|
),
|
|
);
|
|
|
|
$wgPageImagesBlacklist = array(
|
|
array(
|
|
'type' => 'db',
|
|
'page' => 'MediaWiki:Pageimages-blacklist',
|
|
'db' => false, // current wiki
|
|
),
|
|
/*
|
|
array(
|
|
'type' => 'db',
|
|
'page' => 'MediaWiki:Pageimages-blacklist',
|
|
'db' => 'commonswiki',
|
|
),
|
|
array(
|
|
'type' => 'url',
|
|
'url' => 'http://example.com/w/index.php?title=somepage&action=raw',
|
|
),
|
|
*/
|
|
);
|
|
|
|
/**
|
|
* How long blacklist cache lives
|
|
*/
|
|
$wgPageImagesBlacklistExpiry = 60 * 15;
|
|
|
|
/**
|
|
* Whether this extension's image information should be used by OpenSearch
|
|
*/
|
|
$wgPageImagesExpandOpenSearchXml = false;
|
|
|
|
/**
|
|
* Collect data only for these namespaces
|
|
*/
|
|
$wgPageImagesNamespaces = array( NS_MAIN );
|
|
|
|
/**
|
|
* If set to true, allows selecting images from galleries as page images
|
|
*/
|
|
$wgPageImagesUseGalleries = false;
|