2013-02-22 18:50:54 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2013-09-12 09:41:07 +00:00
|
|
|
* TemplateData extension.
|
2013-02-22 18:50:54 +00:00
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @ingroup Extensions
|
|
|
|
*/
|
|
|
|
|
2013-09-19 22:54:05 +00:00
|
|
|
if ( version_compare( $wgVersion, '1.22wmf18', '<' ) ) {
|
|
|
|
echo "Extension:TemplateData requires MediaWiki 1.22 or higher.\n";
|
|
|
|
exit( 1 );
|
|
|
|
}
|
|
|
|
|
2013-02-22 18:50:54 +00:00
|
|
|
$wgExtensionCredits['parserhook'][] = array(
|
|
|
|
'path' => __FILE__,
|
|
|
|
'name' => 'TemplateData',
|
|
|
|
'author' => array( 'Timo Tijhof' ),
|
|
|
|
'version' => '0.1.0',
|
|
|
|
'url' => 'https://www.mediawiki.org/wiki/Extension:TemplateData',
|
|
|
|
'descriptionmsg' => 'templatedata-desc',
|
|
|
|
);
|
|
|
|
|
|
|
|
/* Setup */
|
|
|
|
|
|
|
|
$dir = __DIR__;
|
|
|
|
|
|
|
|
// Register files
|
|
|
|
$wgExtensionMessagesFiles['TemplateData'] = $dir . '/TemplateData.i18n.php';
|
|
|
|
$wgAutoloadClasses['TemplateDataHooks'] = $dir . '/TemplateData.hooks.php';
|
|
|
|
$wgAutoloadClasses['TemplateDataBlob'] = $dir . '/TemplateDataBlob.php';
|
2013-03-27 20:08:57 +00:00
|
|
|
$wgAutoloadClasses['ApiTemplateData'] = $dir . '/api/ApiTemplateData.php';
|
2013-02-22 18:50:54 +00:00
|
|
|
|
|
|
|
// Register hooks
|
|
|
|
$wgHooks['ParserFirstCallInit'][] = 'TemplateDataHooks::onParserFirstCallInit';
|
|
|
|
$wgHooks['PageContentSave'][] = 'TemplateDataHooks::onPageContentSave';
|
2013-04-16 14:18:10 +00:00
|
|
|
$wgHooks['UnitTestsList'][] = 'TemplateDataHooks::onUnitTestsList';
|
2013-02-22 18:50:54 +00:00
|
|
|
|
2013-03-27 20:08:57 +00:00
|
|
|
// Register APIs
|
|
|
|
$wgAPIModules['templatedata'] = 'ApiTemplateData';
|
2013-02-22 18:50:54 +00:00
|
|
|
|
2013-03-27 20:08:57 +00:00
|
|
|
// Register page properties
|
2013-02-22 18:50:54 +00:00
|
|
|
$wgPageProps['templatedata'] = 'Content of <templatedata> tag';
|
|
|
|
|
|
|
|
// Register modules
|
|
|
|
$wgResourceModules['ext.templateData'] = array(
|
|
|
|
'styles' => 'resources/ext.templateData.css',
|
2013-05-08 23:56:57 +00:00
|
|
|
'position' => 'top',
|
2013-02-22 18:50:54 +00:00
|
|
|
'localBasePath' => $dir,
|
|
|
|
'remoteExtPath' => 'TemplateData',
|
|
|
|
);
|