1 | <?php |
||
18 | class Notifications extends AbstractModel |
||
19 | { |
||
20 | /** |
||
21 | * Instance manager |
||
22 | * |
||
23 | * @var Notifications |
||
24 | */ |
||
25 | protected static $_instance; |
||
26 | |||
27 | /** |
||
28 | * List of notifications to send |
||
29 | * |
||
30 | * @var \Notifications_Task[] |
||
31 | */ |
||
32 | protected $_to_send; |
||
33 | |||
34 | /** |
||
35 | * Available notification frequencies |
||
36 | * |
||
37 | * @var string[] |
||
38 | */ |
||
39 | protected $_notification_frequencies; |
||
40 | |||
41 | /** |
||
42 | * Available notification frequencies |
||
43 | * |
||
44 | * @var string[] |
||
45 | */ |
||
46 | protected $_notifiers; |
||
47 | |||
48 | /** |
||
49 | * Disallows to register notification types with id < 5 |
||
50 | * |
||
51 | * @var bool |
||
52 | */ |
||
53 | protected $_protect_id = true; |
||
54 | |||
55 | public function __construct($db) |
||
71 | |||
72 | /** |
||
73 | * We hax a new notification to send out! |
||
74 | * |
||
75 | * @param \Notifications_Task $task |
||
76 | */ |
||
77 | public function add(\Notifications_Task $task) |
||
81 | |||
82 | /** |
||
83 | * Time to notify our beloved members! YAY! |
||
84 | */ |
||
85 | public function send() |
||
105 | |||
106 | /** |
||
107 | * Function to register any new notification method. |
||
108 | * |
||
109 | * @param int $id This shall be a unique integer representing the |
||
110 | * notification method. |
||
111 | * <b>WARNING for addons developers</b>: please note that this has |
||
112 | * to be unique across addons, so if you develop an addon that |
||
113 | * extends notifications, please verify this id has not been |
||
114 | * "taken" by someone else! |
||
115 | * @param int $key The string name identifying the notification method |
||
116 | * @param mixed|mixed[] $callback A callable function/array/whatever that |
||
117 | * will take care of sending the notification |
||
118 | * @param null|string[] $lang_data For the moment an array containing at least: |
||
119 | * - 'subject' => 'something' |
||
120 | * - 'body' => 'something_else' |
||
121 | * the two will be used to identify the strings to be |
||
122 | * used for the subject and the body respectively of |
||
123 | * the notification. |
||
124 | * @throws Elk_Exception |
||
125 | */ |
||
126 | public function register($id, $key, $callback, $lang_data = null) |
||
140 | |||
141 | public function getNotifiers() |
||
145 | |||
146 | /** |
||
147 | * Process a certain task in order to send out the notifications. |
||
148 | * |
||
149 | * @param \Notifications_Task $task |
||
150 | */ |
||
151 | protected function _send_task(\Notifications_Task $task) |
||
179 | |||
180 | /** |
||
181 | * Inserts a new mention in the database (those that appear in the mentions area). |
||
182 | * |
||
183 | * @param \ElkArte\sources\subs\MentionType\Mention_Type_Interface $obj |
||
184 | * @param \Notifications_Task $task |
||
185 | * @param mixed[] $bodies |
||
186 | * @global $modSettings - Not sure if actually necessary |
||
187 | */ |
||
188 | protected function _send_notification(\ElkArte\sources\subs\MentionType\Mention_Type_Interface $obj, \Notifications_Task $task, $bodies) |
||
205 | |||
206 | /** |
||
207 | * Sends an immediate email notification. |
||
208 | * |
||
209 | * @param \ElkArte\sources\subs\MentionType\Mention_Type_Interface $obj |
||
210 | * @param \Notifications_Task $task |
||
211 | * @param mixed[] $bodies |
||
212 | */ |
||
213 | protected function _send_email(\ElkArte\sources\subs\MentionType\Mention_Type_Interface $obj, \Notifications_Task $task, $bodies) |
||
221 | |||
222 | /** |
||
223 | * Stores data in the database to send a daily digest. |
||
224 | * |
||
225 | * @param \ElkArte\sources\subs\MentionType\Mention_Type_Interface $obj |
||
226 | * @param \Notifications_Task $task |
||
227 | * @param mixed[] $bodies |
||
228 | */ |
||
229 | protected function _send_daily_email(\ElkArte\sources\subs\MentionType\Mention_Type_Interface $obj, \Notifications_Task $task, $bodies) |
||
242 | |||
243 | /** |
||
244 | * Stores data in the database to send a weekly digest. |
||
245 | * |
||
246 | * @param \ElkArte\sources\subs\MentionType\Mention_Type_Interface $obj |
||
247 | * @param \Notifications_Task $task |
||
248 | * @param mixed[] $bodies |
||
249 | */ |
||
250 | protected function _send_weekly_email(\ElkArte\sources\subs\MentionType\Mention_Type_Interface $obj, \Notifications_Task $task, $bodies) |
||
263 | |||
264 | /** |
||
265 | * Do the insert into the database for daily and weekly digests. |
||
266 | * |
||
267 | * @param mixed[] $insert_array |
||
268 | */ |
||
269 | protected function _insert_delayed($insert_array) |
||
284 | |||
285 | /** |
||
286 | * Loads from the database the notification preferences for a certain type |
||
287 | * of mention for a bunch of members. |
||
288 | * |
||
289 | * @param string[] $notification_frequencies |
||
290 | * @param string $notification_type |
||
291 | * @param int[] $members |
||
292 | */ |
||
293 | protected function _getNotificationPreferences($notification_frequencies, $notification_type, $members) |
||
334 | |||
335 | /** |
||
336 | * Singleton... until we have something better. |
||
337 | * |
||
338 | * @return Notifications |
||
339 | */ |
||
340 | public static function getInstance() |
||
347 | } |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.