forked from wikimedia/mediawiki-extensions-TemplateData
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TemplateData.php
129 lines (116 loc) · 4.11 KB
/
TemplateData.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
/**
* TemplateData extension.
*
* @file
* @ingroup Extensions
*/
if ( version_compare( $wgVersion, '1.22wmf18', '<' ) ) {
echo "Extension:TemplateData requires MediaWiki 1.22 or higher.\n";
exit( 1 );
}
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => 'TemplateData',
'author' => array(
'Timo Tijhof',
),
'version' => '0.1.1',
'url' => 'https://www.mediawiki.org/wiki/Extension:TemplateData',
'descriptionmsg' => 'templatedata-desc',
'license-name' => 'GPLv2',
);
/* Setup */
$dir = __DIR__;
// Register files
$wgMessagesDirs['TemplateData'] = __DIR__ . '/i18n';
$wgExtensionMessagesFiles['TemplateData'] = $dir . '/TemplateData.i18n.php';
$wgAutoloadClasses['TemplateDataHooks'] = $dir . '/TemplateData.hooks.php';
$wgAutoloadClasses['TemplateDataBlob'] = $dir . '/TemplateDataBlob.php';
$wgAutoloadClasses['ApiTemplateData'] = $dir . '/api/ApiTemplateData.php';
// Register hooks
$wgHooks['ParserFirstCallInit'][] = 'TemplateDataHooks::onParserFirstCallInit';
$wgHooks['PageContentSave'][] = 'TemplateDataHooks::onPageContentSave';
$wgHooks['UnitTestsList'][] = 'TemplateDataHooks::onUnitTestsList';
$wgHooks['ResourceLoaderTestModules'][] = 'TemplateDataHooks::onResourceLoaderTestModules';
$wgHooks['EditPage::showEditForm:initial'][] = 'TemplateDataHooks::onEditPage';
// Register APIs
$wgAPIModules['templatedata'] = 'ApiTemplateData';
// Register page properties
$wgPageProps['templatedata'] = 'Content of <templatedata> tag';
// Register modules
$wgResourceModules['ext.templateData'] = array(
'styles' => 'resources/ext.templateData.css',
'position' => 'top',
'localBasePath' => $dir,
'remoteExtPath' => 'TemplateData',
);
$wgResourceModules['ext.templateDataGenerator.editPage'] = array(
'localBasePath' => $dir,
'remoteExtPath' => 'TemplateData',
'scripts' => array(
'modules/ext.templateDataGenerator.editPage.js',
),
'dependencies' => array(
'ext.templateDataGenerator.core',
),
'messages' => array(
'templatedata-editbutton',
'templatedata-helplink',
'templatedata-errormsg-jsonbadformat',
)
);
$wgResourceModules['ext.templateDataGenerator.core'] = array(
'localBasePath' => $dir,
'remoteExtPath' => 'TemplateData',
'styles' => 'modules/ext.templateDataGenerator.css',
'scripts' => array(
'modules/ext.templateDataGenerator.core.js',
),
'dependencies' => array(
'jquery.ui.dialog',
'jquery.ui.button',
'jquery.ui.sortable',
),
'messages' => array(
'templatedata-modal-button-addparam',
'templatedata-modal-button-apply',
'templatedata-modal-button-cancel',
'templatedata-modal-button-delparam',
'templatedata-modal-button-importParams',
'templatedata-modal-errormsg',
'templatedata-modal-errormsg-import-noparams',
'templatedata-modal-errormsg-import-paramsalreadyexist',
'templatedata-modal-notice-import-numparams',
'templatedata-modal-table-param-actions',
'templatedata-modal-table-param-aliases',
'templatedata-modal-table-param-autovalue',
'templatedata-modal-table-param-default',
'templatedata-modal-table-param-desc',
'templatedata-modal-table-param-label',
'templatedata-modal-table-param-name',
'templatedata-modal-table-param-required',
'templatedata-modal-table-param-suggested',
'templatedata-modal-table-param-type',
'templatedata-modal-table-param-type-boolean',
'templatedata-modal-table-param-type-content',
'templatedata-modal-table-param-type-wiki-file-name',
'templatedata-modal-table-param-type-line',
'templatedata-modal-table-param-type-number',
'templatedata-modal-table-param-type-boolean',
'templatedata-modal-table-param-type-date',
'templatedata-modal-table-param-type-wiki-page-name',
'templatedata-modal-table-param-type-string',
'templatedata-modal-table-param-type-unbalanced-wikitext',
'templatedata-modal-table-param-type-undefined',
'templatedata-modal-table-param-type-wiki-user-name',
'templatedata-modal-table-param-uneditablefield',
'templatedata-modal-title',
'templatedata-modal-title-templatedesc',
'templatedata-modal-title-templateparams',
)
);
/* Configuration */
// Set this to true to use the template documentation
// editor feature
$wgTemplateDataUseGUI = false;