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(
|
2014-03-13 21:32:10 +00:00
|
|
|
'path' => __FILE__,
|
|
|
|
'name' => 'TemplateData',
|
|
|
|
'author' => array(
|
|
|
|
'Timo Tijhof',
|
|
|
|
),
|
2014-03-28 21:40:09 +00:00
|
|
|
'version' => '0.1.1',
|
2014-03-13 21:32:10 +00:00
|
|
|
'url' => 'https://www.mediawiki.org/wiki/Extension:TemplateData',
|
2013-02-22 18:50:54 +00:00
|
|
|
'descriptionmsg' => 'templatedata-desc',
|
2014-03-13 21:32:10 +00:00
|
|
|
'license-name' => 'GPLv2',
|
2013-02-22 18:50:54 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
/* Setup */
|
|
|
|
|
|
|
|
$dir = __DIR__;
|
|
|
|
|
|
|
|
// Register files
|
2014-03-28 21:40:09 +00:00
|
|
|
$wgMessagesDirs['TemplateData'] = __DIR__ . '/i18n';
|
2013-02-22 18:50:54 +00:00
|
|
|
$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-09-21 03:46:02 +00:00
|
|
|
$wgHooks['ResourceLoaderTestModules'][] = 'TemplateDataHooks::onResourceLoaderTestModules';
|
2014-10-11 05:22:21 +00:00
|
|
|
$wgHooks['ResourceLoaderRegisterModules'][] = 'TemplateDataHooks::onResourceLoaderRegisterModules';
|
2013-09-21 03:46:02 +00:00
|
|
|
$wgHooks['EditPage::showEditForm:initial'][] = 'TemplateDataHooks::onEditPage';
|
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',
|
|
|
|
);
|
2013-09-21 03:46:02 +00:00
|
|
|
|
|
|
|
$wgResourceModules['ext.templateDataGenerator.editPage'] = array(
|
|
|
|
'localBasePath' => $dir,
|
|
|
|
'remoteExtPath' => 'TemplateData',
|
|
|
|
'scripts' => array(
|
|
|
|
'modules/ext.templateDataGenerator.editPage.js',
|
|
|
|
),
|
|
|
|
'dependencies' => array(
|
2014-10-11 05:22:21 +00:00
|
|
|
'ext.templateDataGenerator.ui',
|
2013-09-21 03:46:02 +00:00
|
|
|
),
|
|
|
|
'messages' => array(
|
|
|
|
'templatedata-editbutton',
|
2014-05-20 22:51:46 +00:00
|
|
|
'templatedata-helplink',
|
2014-09-25 18:05:39 +00:00
|
|
|
'templatedata-helplink-target',
|
2013-09-21 03:46:02 +00:00
|
|
|
'templatedata-errormsg-jsonbadformat',
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2014-10-11 05:22:21 +00:00
|
|
|
$wgResourceModules['ext.templateDataGenerator.data'] = array(
|
2013-09-21 03:46:02 +00:00
|
|
|
'localBasePath' => $dir,
|
|
|
|
'remoteExtPath' => 'TemplateData',
|
|
|
|
'scripts' => array(
|
2015-02-17 23:56:44 +00:00
|
|
|
'modules/ext.templateDataGenerator.js',
|
2014-10-11 05:22:21 +00:00
|
|
|
'modules/ext.templateDataGenerator.data.js'
|
2013-09-21 03:46:02 +00:00
|
|
|
),
|
|
|
|
'dependencies' => array(
|
2014-10-11 05:22:21 +00:00
|
|
|
'oojs'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
$wgResourceModules['ext.templateDataGenerator.ui'] = array(
|
|
|
|
'localBasePath' => $dir,
|
|
|
|
'remoteExtPath' => 'TemplateData',
|
|
|
|
'styles' => 'modules/ext.templateDataGenerator.ui.css',
|
|
|
|
'scripts' => array(
|
|
|
|
'modules/ext.templateDataGenerator.ui.js',
|
|
|
|
'modules/widgets/ext.templateDataGenerator.optionWidget.js',
|
|
|
|
'modules/widgets/ext.templateDataGenerator.optionImportWidget.js',
|
|
|
|
'modules/widgets/ext.templateDataGenerator.languageResultWidget.js',
|
|
|
|
'modules/widgets/ext.templateDataGenerator.languageSearchWidget.js',
|
2015-01-06 00:04:51 +00:00
|
|
|
'modules/widgets/ext.templateDataGenerator.dragDropItemWidget.js',
|
|
|
|
'modules/widgets/ext.templateDataGenerator.dragDropWidget.js',
|
2014-10-11 05:22:21 +00:00
|
|
|
'modules/ext.templateDataGenerator.ui.tdDialog.js',
|
|
|
|
),
|
|
|
|
'dependencies' => array(
|
|
|
|
'oojs-ui',
|
|
|
|
'ext.templateDataGenerator.data',
|
|
|
|
'jquery.uls.data'
|
2013-09-21 03:46:02 +00:00
|
|
|
),
|
|
|
|
'messages' => array(
|
2014-10-11 05:22:21 +00:00
|
|
|
'comma-separator',
|
2015-02-19 01:11:39 +00:00
|
|
|
'templatedata-doc-no-params-set',
|
2015-02-18 22:55:17 +00:00
|
|
|
'templatedata-exists-on-related-page',
|
2014-10-11 05:22:21 +00:00
|
|
|
'templatedata-modal-button-add-language',
|
2013-09-21 03:46:02 +00:00
|
|
|
'templatedata-modal-button-addparam',
|
|
|
|
'templatedata-modal-button-apply',
|
2014-10-11 05:22:21 +00:00
|
|
|
'templatedata-modal-button-back',
|
2013-09-21 03:46:02 +00:00
|
|
|
'templatedata-modal-button-cancel',
|
2014-10-11 05:22:21 +00:00
|
|
|
'templatedata-modal-button-changelang',
|
2013-09-21 03:46:02 +00:00
|
|
|
'templatedata-modal-button-delparam',
|
|
|
|
'templatedata-modal-button-importParams',
|
2015-01-06 01:14:51 +00:00
|
|
|
'templatedata-modal-button-restoreparam',
|
2014-10-11 05:22:21 +00:00
|
|
|
'templatedata-modal-button-saveparam',
|
|
|
|
'templatedata-modal-current-language',
|
2013-09-21 03:46:02 +00:00
|
|
|
'templatedata-modal-errormsg',
|
|
|
|
'templatedata-modal-errormsg-import-noparams',
|
2014-05-20 22:51:46 +00:00
|
|
|
'templatedata-modal-errormsg-import-paramsalreadyexist',
|
2013-09-21 03:46:02 +00:00
|
|
|
'templatedata-modal-notice-import-numparams',
|
2014-10-11 05:22:21 +00:00
|
|
|
'templatedata-modal-placeholder-paramkey',
|
|
|
|
'templatedata-modal-search-input-placeholder',
|
2013-09-21 03:46:02 +00:00
|
|
|
'templatedata-modal-table-param-actions',
|
|
|
|
'templatedata-modal-table-param-aliases',
|
2014-09-02 15:29:33 +00:00
|
|
|
'templatedata-modal-table-param-autovalue',
|
2013-09-21 03:46:02 +00:00
|
|
|
'templatedata-modal-table-param-default',
|
2015-01-16 18:56:06 +00:00
|
|
|
'templatedata-modal-table-param-deprecated',
|
2014-10-11 05:22:21 +00:00
|
|
|
'templatedata-modal-table-param-description',
|
|
|
|
'templatedata-modal-table-param-importoption',
|
|
|
|
'templatedata-modal-table-param-importoption-subtitle',
|
2013-09-21 03:46:02 +00:00
|
|
|
'templatedata-modal-table-param-label',
|
|
|
|
'templatedata-modal-table-param-name',
|
|
|
|
'templatedata-modal-table-param-required',
|
2014-04-24 22:21:36 +00:00
|
|
|
'templatedata-modal-table-param-suggested',
|
2013-09-21 03:46:02 +00:00
|
|
|
'templatedata-modal-table-param-type',
|
2014-05-20 22:51:46 +00:00
|
|
|
'templatedata-modal-table-param-type-boolean',
|
2014-10-11 05:22:21 +00:00
|
|
|
'templatedata-modal-table-param-type-boolean',
|
2014-05-20 22:51:46 +00:00
|
|
|
'templatedata-modal-table-param-type-content',
|
2014-10-11 05:22:21 +00:00
|
|
|
'templatedata-modal-table-param-type-date',
|
2014-05-20 22:51:46 +00:00
|
|
|
'templatedata-modal-table-param-type-line',
|
2013-09-21 03:46:02 +00:00
|
|
|
'templatedata-modal-table-param-type-number',
|
|
|
|
'templatedata-modal-table-param-type-string',
|
2014-05-20 22:51:46 +00:00
|
|
|
'templatedata-modal-table-param-type-unbalanced-wikitext',
|
2013-09-21 03:46:02 +00:00
|
|
|
'templatedata-modal-table-param-type-undefined',
|
2014-10-11 05:22:21 +00:00
|
|
|
'templatedata-modal-table-param-type-wiki-file-name',
|
|
|
|
'templatedata-modal-table-param-type-wiki-page-name',
|
2014-05-20 22:51:46 +00:00
|
|
|
'templatedata-modal-table-param-type-wiki-user-name',
|
2014-05-17 22:36:54 +00:00
|
|
|
'templatedata-modal-table-param-uneditablefield',
|
2013-09-21 03:46:02 +00:00
|
|
|
'templatedata-modal-title',
|
2014-10-11 05:22:21 +00:00
|
|
|
'templatedata-modal-title-addparam',
|
|
|
|
'templatedata-modal-title-choose-language',
|
|
|
|
'templatedata-modal-title-language',
|
2015-01-06 00:04:51 +00:00
|
|
|
'templatedata-modal-title-paramorder',
|
2013-09-21 03:46:02 +00:00
|
|
|
'templatedata-modal-title-templatedesc',
|
2014-10-11 05:22:21 +00:00
|
|
|
'templatedata-modal-title-templateparam-details',
|
2015-02-18 22:55:17 +00:00
|
|
|
'templatedata-modal-title-templateparams'
|
2013-09-21 03:46:02 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
/* Configuration */
|
|
|
|
|
|
|
|
// Set this to true to use the template documentation
|
|
|
|
// editor feature
|
|
|
|
$wgTemplateDataUseGUI = false;
|