1 | <?php |
||
9 | class SubscriberManager |
||
10 | { |
||
11 | |||
12 | /** |
||
13 | * Check if subscription system is enabled |
||
14 | * |
||
15 | * @return bool |
||
16 | */ |
||
17 | public function isenabled() |
||
21 | |||
22 | /** |
||
23 | * Adds a new subscription for the given page or namespace |
||
24 | * |
||
25 | * This will automatically overwrite any existent subscription for the given user on this |
||
26 | * *exact* page or namespace. It will *not* modify any subscription that may exist in higher namespaces. |
||
27 | * |
||
28 | * @throws Exception when user or style is empty |
||
29 | * |
||
30 | * @param string $id The target page or namespace, specified by id; Namespaces |
||
31 | * are identified by appending a colon. |
||
32 | * @param string $user |
||
33 | * @param string $style |
||
34 | * @param string $data |
||
35 | * |
||
36 | * @return bool |
||
37 | */ |
||
38 | public function add($id, $user, $style, $data = '') |
||
65 | |||
66 | |||
67 | /** |
||
68 | * Removes a subscription for the given page or namespace |
||
69 | * |
||
70 | * This removes all subscriptions matching the given criteria on the given page or |
||
71 | * namespace. It will *not* modify any subscriptions that may exist in higher |
||
72 | * namespaces. |
||
73 | * |
||
74 | * @param string $id The target object’s (namespace or page) id |
||
75 | * @param string|array $user |
||
76 | * @param string|array $style |
||
77 | * @param string|array $data |
||
78 | * |
||
79 | * @return bool |
||
80 | */ |
||
81 | public function remove($id, $user = null, $style = null, $data = null) |
||
96 | |||
97 | /** |
||
98 | * Get data for $INFO['subscribed'] |
||
99 | * |
||
100 | * $INFO['subscribed'] is either false if no subscription for the current page |
||
101 | * and user is in effect. Else it contains an array of arrays with the fields |
||
102 | * “target”, “style”, and optionally “data”. |
||
103 | * |
||
104 | * @author Adrian Lang <[email protected]> |
||
105 | * |
||
106 | * @param string $id Page ID, defaults to global $ID |
||
107 | * @param string $user User, defaults to $_SERVER['REMOTE_USER'] |
||
108 | * |
||
109 | * @return array|false |
||
110 | */ |
||
111 | public function userSubscription($id = '', $user = '') |
||
143 | |||
144 | /** |
||
145 | * Recursively search for matching subscriptions |
||
146 | * |
||
147 | * This function searches all relevant subscription files for a page or |
||
148 | * namespace. |
||
149 | * |
||
150 | * @author Adrian Lang <[email protected]> |
||
151 | * |
||
152 | * @param string $page The target object’s (namespace or page) id |
||
153 | * @param string|array $user |
||
154 | * @param string|array $style |
||
155 | * @param string|array $data |
||
156 | * |
||
157 | * @return array |
||
158 | */ |
||
159 | public function subscribers($page, $user = null, $style = null, $data = null) |
||
203 | |||
204 | /** |
||
205 | * Default callback for COMMON_NOTIFY_ADDRESSLIST |
||
206 | * |
||
207 | * Aggregates all email addresses of user who have subscribed the given page with 'every' style |
||
208 | * |
||
209 | * @author Adrian Lang <[email protected]> |
||
210 | * @author Steven Danz <[email protected]> |
||
211 | * |
||
212 | * @todo move the whole functionality into this class, trigger SUBSCRIPTION_NOTIFY_ADDRESSLIST instead, |
||
213 | * use an array for the addresses within it |
||
214 | * |
||
215 | * @param array &$data Containing the entries: |
||
216 | * - $id (the page id), |
||
217 | * - $self (whether the author should be notified, |
||
218 | * - $addresslist (current email address list) |
||
219 | * - $replacements (array of additional string substitutions, @KEY@ to be replaced by value) |
||
220 | */ |
||
221 | public function notifyAddresses(&$data) |
||
263 | |||
264 | /** |
||
265 | * Return the subscription meta file for the given ID |
||
266 | * |
||
267 | * @author Adrian Lang <[email protected]> |
||
268 | * |
||
269 | * @param string $id The target page or namespace, specified by id; Namespaces |
||
270 | * are identified by appending a colon. |
||
271 | * |
||
272 | * @return string |
||
273 | */ |
||
274 | protected function file($id) |
||
285 | } |
||
286 |