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
|
|
|
|
*/
|
|
|
|
|
|
|
|
$wgExtensionCredits['parserhook'][] = array(
|
2014-03-13 21:32:10 +00:00
|
|
|
'path' => __FILE__,
|
|
|
|
'name' => 'TemplateData',
|
|
|
|
'author' => array(
|
|
|
|
'Timo Tijhof',
|
2015-02-20 23:42:36 +00:00
|
|
|
'Moriel Schottlender',
|
|
|
|
'James D. Forrester',
|
|
|
|
'Trevor Parscal',
|
|
|
|
'Bartosz Dziewoński',
|
|
|
|
'Marielle Volz',
|
|
|
|
'...'
|
2014-03-13 21:32:10 +00:00
|
|
|
),
|
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';
|
2015-02-20 23:41:39 +00:00
|
|
|
$wgExtensionFunctions[] = 'TemplateDataHooks::onSetup';
|
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
|
|
|
|
|
|
|
// 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',
|
2015-03-07 00:17:21 +00:00
|
|
|
'modules/ext.templateDataGenerator.data.js',
|
|
|
|
'modules/ext.templateDataGenerator.sourceHandler.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',
|
2015-03-07 00:17:21 +00:00
|
|
|
'templatedata-modal-json-error-replace',
|
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',
|
2015-03-05 23:33:12 +00:00
|
|
|
'templatedata-modal-table-param-deprecatedValue',
|
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 */
|
|
|
|
|
2015-02-20 23:57:09 +00:00
|
|
|
// Set this to false to disable the template documentation editor feature
|
|
|
|
$wgTemplateDataUseGUI = true;
|