mediawiki-extensions-PageIm.../PageImages.php

113 lines
3.1 KiB
PHP
Raw Normal View History

2012-02-29 09:30:06 +00:00
<?php
2012-02-29 10:50:36 +00:00
if ( !defined( 'MEDIAWIKI' ) ) {
die;
}
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',
'license-name' => 'WTFPL',
2012-03-01 20:00:29 +00:00
);
2012-02-29 10:50:36 +00:00
$wgAutoloadClasses['ApiQueryPageImages'] = __DIR__ . '/includes/ApiQueryPageImages.php';
$wgAutoloadClasses['PageImages'] = __DIR__ . '/includes/PageImages.php';
$wgAutoloadClasses['PageImages\Hooks\LinksUpdateHookHandler']
= __DIR__ . '/includes/LinksUpdateHookHandler.php';
$wgAutoloadClasses['PageImages\Hooks\ParserFileProcessingHookHandlers']
= __DIR__ . '/includes/ParserFileProcessingHookHandlers.php';
2012-02-29 10:50:36 +00:00
$wgMessagesDirs['PageImages'] = __DIR__ . '/i18n';
$wgExtensionMessagesFiles['PageImages'] = __DIR__ . "/PageImages.i18n.php";
2012-03-05 21:36:43 +00:00
$wgHooks['ParserMakeImageParams'][]
= 'PageImages\Hooks\ParserFileProcessingHookHandlers::onParserMakeImageParams';
$wgHooks['LinksUpdate'][] = 'PageImages\Hooks\LinksUpdateHookHandler::onLinksUpdate';
$wgHooks['OpenSearchXml'][] = 'PageImages::onApiOpenSearchSuggest';
$wgHooks['ApiOpenSearchSuggest'][] = 'PageImages::onApiOpenSearchSuggest';
$wgHooks['InfoAction'][] = 'PageImages::onInfoAction';
$wgHooks['AfterParserFetchFileAndTitle'][]
= 'PageImages\Hooks\ParserFileProcessingHookHandlers::onAfterParserFetchFileAndTitle';
$wgHooks['SpecialMobileEditWatchlist::images'][] = 'PageImages::onSpecialMobileEditWatchlist_images';
2012-03-01 12:25:57 +00:00
$wgHooks['UnitTestsList'][] = function( array &$paths ) {
$paths[] = __DIR__ . '/tests/phpunit';
};
$wgAPIPropModules['pageimages'] = 'ApiQueryPageImages';
2012-03-01 17:37:16 +00:00
/**
* Configures how various aspects of image affect its score
*/
2012-03-01 12:25:57 +00:00
$wgPageImagesScores = array(
/** position of image in article */
2012-03-01 12:25:57 +00:00
'position' => array( 8, 6, 4, 3 ),
/** image width as shown on page */
2012-03-01 12:25:57 +00:00
'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,
2012-03-01 12:25:57 +00:00
),
'rights' => array(
'nonfree' => -100, // don't show nonfree images
),
2012-03-02 16:42:17 +00:00
);
$wgPageImagesBlacklist = array(
array(
'type' => 'db',
'page' => 'MediaWiki:Pageimages-blacklist',
2012-03-02 16:42:17 +00:00
'db' => false, // current wiki
),
/*
array(
'type' => 'db',
'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',
),
*/
);
/**
* How long blacklist cache lives
*/
2012-03-02 16:42:17 +00:00
$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;