-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUsersWatchButton.php
More file actions
127 lines (108 loc) · 5.42 KB
/
UsersWatchButton.php
File metadata and controls
127 lines (108 loc) · 5.42 KB
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
<?php
# Alert the user that this is not a valid access point to MediaWiki if they try to access the special pages file directly.
if ( !defined( 'MEDIAWIKI' ) ) {
exit( 1 );
}
$dir = dirname( __FILE__ );
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => 'Users Watch Button',
'descriptionmsg' => 'userswatchbutton-desc',
'version' => '1.0',
'author' => array( 'Pierre Boutet' ),
'url' => 'https://www.wikifab.org'
);
$wgResourceModules['ext.userswatchbutton.js'] = array(
'scripts' => 'userswatchbutton.js',
'styles' => array(),
'messages' => array(
),
'dependencies' => array(
),
'position' => 'bottom',
'localBasePath' => __DIR__ . '',
'remoteExtPath' => 'UsersWatchButton',
);
$wgResourceModules['ext.userswatchbutton.icons'] = array(
'styles' => array(),
'messages' => array(
),
'dependencies' => array(
),
'position' => 'top',
'localBasePath' => __DIR__ . '/icons',
'remoteExtPath' => 'UsersWatchButton/icons',
);
$wgHooks['ParserFirstCallInit'][] = 'userswatchbuttonFunctions';
$wgHooks['BeforePageDisplay'][] = 'UsersWatchButton::BeforePageDisplay';
// hooks for notifications with Echo :
$wgHooks['ParserFirstCallInit'][] = 'CombinedWatchlist\\NotificationHook::onParserFirstCallInit';
$wgHooks['RecentChange_save'][] = 'CombinedWatchlist\\NotificationHook::onRecentChange_save';
$wgHooks['EchoGetDefaultNotifiedUsers'][] = 'CombinedWatchlist\\NotificationHook::onEchoGetDefaultNotifiedUsers';
$wgHooks['EchoGetBundleRules'][] = 'CombinedWatchlist\\NotificationHook::onEchoGetBundleRules';
$wgHooks['EchoGetDefaultNotifiedUsers'][] = 'NewFollowerNotif\\NotificationHook::onEchoGetDefaultNotifiedUsers';
$wgHooks['EchoGetBundleRules'][] = 'NewFollowerNotif\\NotificationHook::onEchoGetBundleRules';
$wgHooks['UsersWatchList-newFollower'][] = 'NewFollowerNotif\\NotificationHook::onNewFollower';
$wgHooks['BeforeCreateEchoEvent'][] = 'NewFollowerNotif\\NotificationHook::onBeforeCreateEchoEvent';
# Parser function to insert a link changing a tab.
function userswatchbuttonFunctions( $parser ) {
$parser->setFunctionHook( 'userswatchbutton', array('UsersWatchButton', 'addParser' ));
//$parser->setFunctionTagHook('displayTutorialsList', array('WfAuthorDiv', 'addSampleParser' ), array());
return true;
}
//require_once(__DIR__ . "/includes/UsersWatchButton.php");
$wgAutoloadClasses['UsersWatchButton'] = __DIR__ . "/includes/UsersWatchButton.php";
$wgAutoloadClasses['CombinedWatchlist\\EventFormatter'] = __DIR__ . "/includes/CombinedWatchlist/EventFormatter.php";
$wgAutoloadClasses['CombinedWatchlist\\NotificationPresentationModel'] = __DIR__ . "/includes/CombinedWatchlist/NotificationPresentationModel.php";
$wgAutoloadClasses['CombinedWatchlist\\NotificationHook'] = __DIR__ . "/includes/CombinedWatchlist/NotificationHook.php";
$wgAutoloadClasses['CombinedWatchlist\\WatchlistModelConnector'] = __DIR__ . "/includes/CombinedWatchlist/WatchlistModelConnector.php";
$wgAutoloadClasses['NewFollowerNotif\\NotificationPresentationModel'] = __DIR__ . "/includes/NewFollowerNotif/NotificationPresentationModel.php";
$wgAutoloadClasses['NewFollowerNotif\\NotificationHook'] = __DIR__ . "/includes/NewFollowerNotif/NotificationHook.php";
$wgMessagesDirs['UsersWatchButton'][] = __DIR__ . "/i18n";
// Allow translation of the parser function name
$wgExtensionMessagesFiles['UsersWatchButtonMagic'] = __DIR__ . '/UsersWatchButton.i18n.php';
// connection with the 'Notification' extension ('Echo')
// Notification on watchlist
$wgEchoNotificationCategories['combinedwatchlist'] = array(
'priority' => 3,
'tooltip' => 'echo-pref-tooltip-combinedwatchlist',
);
$wgEchoNotifications['combinedwatchlist'] = array(
'category' => 'combinedwatchlist',
//'bundle' => array( 'web' => true, 'email' => true ),
'formatter-class' => 'CombinedWatchlist\\EventFormatter',
'presentation-model' => 'CombinedWatchlist\\NotificationPresentationModel',
'title-message' => 'combinewatchlist-notif-title-message',
'email-subject-message' => 'combinewatchlist-notif-email-subject-message',
'email-body-batch-message' => 'combinewatchlist-notif-email-body-batch-message',
'title-message' => 'combinewatchlist-notif-title-message',
'section' => 'message', // 'message' or 'alert'
'bundle' => array( 'web' => true, 'email' => true )
);
// Notification new follower
$wgEchoNotificationCategories['newfollower'] = array(
'priority' => 3,
'tooltip' => 'echo-pref-tooltip-newfollower',
);
$wgEchoNotifications['newfollower'] = array(
'category' => 'newfollower',
//'bundle' => array( 'web' => true, 'email' => true ),
'formatter-class' => 'EchoBasicFormatter',
'presentation-model' => 'NewFollowerNotif\\NotificationPresentationModel',
'title-message' => 'newfollower-notif-title-message',
'email-subject-message' => 'newfollower-notif-email-subject-message',
'email-body-batch-message' => 'newfollower-notif-email-body-batch-message',
'title-message' => 'newfollower-notif-title-message',
'section' => 'message', // 'message' or 'alert'
);
//default email notification period
// -1 : no email
// 0 : instant email
// 1 : every day
// 7 : every weeks
//$wgDefaultUserOptions['echo-email-frequency'] = 1;
// Echo notification subscription preference
$wgDefaultUserOptions['echo-subscriptions-web-combinedwatchlist'] = true;
$wgDefaultUserOptions['echo-subscriptions-email-combinedwatchlist'] = true;
$wgDefaultUserOptions['echo-subscriptions-web-newfollower'] = true;
$wgDefaultUserOptions['echo-subscriptions-email-newfollower'] = true;