-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWRMessages.php
126 lines (109 loc) · 5.2 KB
/
WRMessages.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
<?php
if ( !defined( 'MEDIAWIKI' ) ) {
die();
}
/**
* An extension to add Kol-Zchut-specific messsages and override some default ones.
* Originally based on [[Extension:WikimediaMessages]]
*
* @file
* @ingroup Extensions
*
* @copyright Copyright © 2012, Dror S. & Kol-Zchut Ltd (CIC)
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
*/
$wgExtensionCredits['other'][] = [
'path' => __FILE__,
'name' => 'WRMessages',
'author' => 'Dror S. [FFS] ([https://www.kolzchut.org.il Kol-Zchut])',
'version' => '0.3.0',
'url' => 'https://github.com/kolzchut/mediawiki-extensions-WRMessages',
'descriptionmsg' => 'wrmessages-desc',
];
// i18n
$wgMessagesDirs['WRMessages'] = [
__DIR__ . '/i18n/new',
__DIR__ . '/i18n/overrides'
];
$wgExtensionMessagesFiles['WRMessagesNamespaces'] = __DIR__ . '/WRMessages.namespaces.php';
$wgExtensionMessagesFiles['WRMessagesAliases'] = __DIR__ . '/WRMessages.alias.php';
// Autoloading
$wgAutoloadClasses['WRMessagesHooks'] = __DIR__ . '/WRMessages.hooks.php';
// Hooks
$wgHooks['LinkerMakeExternalLink'][] = 'WRMessagesHooks::onLinkerMakeExternalLink';
$wgHooks['CanonicalNamespaces'][] = 'WRMessagesHooks::onCanonicalNamespaces';
$wgHooks['MessageCache::get'][] = 'WRMessagesHooks::onMessageCacheGet';
/** Custom Namespaces */
// 2015 No longer in use (using NS_PROJECT instead, only redirects left)
define( 'NS_WR_COMPANY', 110 );
define( 'NS_WR_COMPANY_TALK', NS_WR_COMPANY + 1 );
// 2010-05-30 knowledge communities, no longer in use
define( 'NS_WR_COMMUNITY', 112 );
define( 'NS_WR_COMMUNITY_TALK', NS_WR_COMMUNITY + 1 );
// 2011-01-31 portals data (but not the portals themselves). Never used
define( 'NS_WR_PORTAL', 114 );
define( 'NS_WR_PORTAL_TALK', NS_WR_PORTAL + 1 );
// 2011-05-12 draft articles before publishing to NS_MAIN
define( 'NS_WR_DRAFTS', 116 );
define( 'NS_WR_DRAFTS_TALK', NS_WR_DRAFTS + 1 );
// 2011-09-26 on-hold articles,with warning about being inactive
define( 'NS_WR_LIMBO', 118 );
define( 'NS_WR_LIMBO_TALK', NS_WR_LIMBO + 1 );
// 2011-12-01 a huge sandbox
define( 'NS_WR_PRACTICE', 120 );
define( 'NS_WR_PRACTICE_TALK', NS_WR_PRACTICE + 1 );
// 2012-03-07 holding small data like "tax reduction point"
define( 'NS_WR_DATA', 122 );
define( 'NS_WR_DATA_TALK', NS_WR_DATA + 1 );
// 2019-08-05 Landing Pages
define( 'NS_WR_LANDING', 124 );
define( 'NS_WR_LANDING_TALK', NS_WR_LANDING + 1 );
// 2024-03-25 Linguistic simplification. Skip 126 because it's in use as a custom namespace in production.
define( 'NS_WR_SIMPLIFICATION', 128 );
define( 'NS_WR_SIMPLIFICATION_TALK', NS_WR_LANDING + 1 );
/** Enable subpages on most namespaces [DS 2009-12-28] */
$wgNamespacesWithSubpages[NS_WR_COMPANY] = true;
$wgNamespacesWithSubpages[NS_WR_COMMUNITY] = true;
$wgNamespacesWithSubpages[NS_WR_PORTAL] = true;
$wgNamespacesWithSubpages[NS_WR_DRAFTS] = true;
$wgNamespacesWithSubpages[NS_WR_LIMBO] = true;
$wgNamespacesWithSubpages[NS_WR_PRACTICE] = true;
$wgNamespacesWithSubpages[NS_WR_DATA] = true;
$wgNamespacesWithSubpages[NS_MAIN] = true;
$wgNamespacesWithSubpages[NS_HELP] = true;
$wgNamespacesWithSubpages[NS_TEMPLATE] = true;
$wgNamespacesWithSubpages[NS_PROJECT] = true;
$wgNamespacesWithSubpages[NS_WR_SIMPLIFICATION] = true;
/** Edit protection for some sensitive namespaces */
$wgNamespaceProtection[NS_MAIN] = [ 'edit-main' ];
$wgNamespaceProtection[NS_WR_DATA] = [ 'edit-main' ];
$wgNamespaceProtection[NS_WR_DRAFTS] = [ 'edit-main' ];
$wgNamespaceProtection[NS_WR_LIMBO] = [ 'edit-main' ];
$wgNamespaceProtection[NS_HELP] = [ 'edit-main' ];
$wgNamespaceProtection[NS_WR_DATA] = [ 'edit-main' ];
/** Add namespaces to be searched by default */
$wgNamespacesToBeSearchedDefault[NS_WR_DRAFTS] = true;
$wgNamespacesToBeSearchedDefault[NS_WR_LANDING] = true;
// Only allow staff to edit NS_PROJECT
$wgNamespaceProtection[NS_PROJECT] = [ 'editproject' ];
// If allowed to edit the NS_PROJECT, allowed to edit the following as well:
$wgNamespaceProtection[NS_WR_COMPANY] = [ 'editproject' ];
$wgNamespaceProtection[NS_TEMPLATE] = [ 'editproject' ];
/** Extra security for non-public-oriented namespaces, [dependent on Extension:Lockdown!] */
// $wgNamespacePermissionLockdown[NS_WR_DRAFTS]['*'] = array('editor', 'staff');
// $wgNonincludableNamespaces[] = NS_WR_DRAFTS;
// $wgNamespacePermissionLockdown[NS_WR_LIMBO]['*'] = array('editor', 'staff');
$wgNonincludableNamespaces[] = NS_WR_LIMBO;
$wgNamespacePermissionLockdown[NS_WR_PRACTICE]['*'] = [ 'editor', 'staff' ];
$wgNonincludableNamespaces[] = NS_WR_PRACTICE;
/** Extra security for potentially private information [dependent on Extension:Lockdown!] */
$wgSpecialPageLockdown['Listusers'] = [ 'staff' ];
$wgSpecialPageLockdown['Activeusers'] = [ 'editor', 'staff' ];
$wgSpecialPageLockdown['BlockList'] = [ 'editor', 'staff' ];
$wgSpecialPageLockdown['Log'] = [ 'editor', 'staff' ];
$wgSpecialPageLockdown['LinkSearch'] = [ 'editor', 'staff' ];
$wgSpecialPageLockdown['Export'] = [ 'editor', 'staff' ];
/** The default, as set in CommonSettings.php, is noindex, nofollow. These are exceptions: */
$wgNamespaceRobotPolicies[NS_MAIN] = 'index,follow';
$wgNamespaceRobotPolicies[NS_PROJECT] = 'index,follow';
$wgWRMessagesReferrerWhitelistRegexp = [ '/gov.il$/', '/kolsherut.org.il$/' ];