PluginProbe
Customize WordPress Emails and Alerts – Better Notifications for WP / 1.6.7
Customize WordPress Emails and Alerts – Better Notifications for WP v1.6.7
1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.8 1.8.1 1.8.10 1.8.11 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5 All 81 releases
bnfw / bnfw.php

bnfw.php in Customize WordPress Emails and Alerts – Better Notifications for WP 1.6.7, at bnfw.php

758 lines 22.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Better Notifications for WordPress
4 * Plugin URI: https://wordpress.org/plugins/bnfw/
5 * Description: Supercharge your WordPress notifications using a WYSIWYG editor and shortcodes. Default and new notifications available. Add more power with Add-ons.
6 * Version: 1.6.7
7 * Author: Made with Fuel
8 * Author URI: https://betternotificationsforwp.com/
9 * Author Email: hello@betternotificationsforwp.com
10 * License: GPLv2 or later
11 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12 * Text Domain: bnfw
13 * Domain Path: /languages
14 */
15
16 /**
17 * Copyright © 2017 Made with Fuel Ltd. (hello@betternotificationsforwp.com)
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License, version 2, as
20 * published by the Free Software Foundation.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30 require_once 'includes/freemius.php';
31
32 class BNFW {
33
34 /**
35 * Constructor.
36 *
37 * @since 1.0
38 */
39 function __construct() {
40 $this->load_textdomain();
41 $this->includes();
42 $this->hooks();
43
44 /**
45 * BNFW Notification.
46 *
47 * @var \BNFW_Notification
48 */
49 $this->notifier = new BNFW_Notification;
50
51 /**
52 * BNFW Engine.
53 *
54 * @var \BNFW_Engine
55 */
56 $this->engine = new BNFW_Engine;
57 }
58
59 /**
60 * Factory method to return the instance of the class.
61 *
62 * Makes sure that only one instance is created.
63 *
64 * @return \BNFW Instance of the class.
65 */
66 public static function factory() {
67 static $instance = false;
68 if ( ! $instance ) {
69 $instance = new self();
70 }
71 return $instance;
72 }
73
74 /**
75 * Loads the plugin language files
76 *
77 * @since 1.0
78 */
79 public function load_textdomain() {
80 // Load localization domain
81 $this->translations = dirname( plugin_basename( __FILE__ ) ) . '/languages/';
82 load_plugin_textdomain( 'bnfw', false, $this->translations );
83 }
84
85 /**
86 * Include required files.
87 *
88 * @since 1.0
89 */
90 public function includes() {
91
92 // Load license related classes
93 if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) {
94 require_once 'includes/libraries/EDD_SL_Plugin_Updater.php';
95 }
96 require_once 'includes/license/class-bnfw-license.php';
97 require_once 'includes/license/class-bnfw-license-setting.php';
98
99 // Load Engine
100 require_once 'includes/engine/class-bnfw-engine.php';
101 require_once 'includes/overrides.php';
102
103 // Load notification post type and notification helpers
104 require_once 'includes/admin/class-bnfw-notification.php';
105 require_once 'includes/notification/post-notification.php';
106
107 // Helpers
108 require_once 'includes/helpers/helpers.php';
109 require_once 'includes/helpers/ajax-helpers.php';
110
111 // Load Admin Pages
112 if ( is_admin() ) {
113 require_once 'includes/admin/bnfw-settings.php';
114 }
115 }
116
117 /**
118 * Register Hooks.
119 *
120 * @since 1.0
121 */
122 public function hooks() {
123 global $wp_version;
124
125 register_activation_hook( __FILE__, array( $this, 'activate' ) );
126
127 add_action( 'draft_to_private' , array( $this, 'private_post' ) );
128 add_action( 'future_to_private' , array( $this, 'private_post' ) );
129 add_action( 'pending_to_private' , array( $this, 'private_post' ) );
130 add_action( 'publish_to_private' , array( $this, 'private_post' ) );
131
132 add_action( 'wp_insert_post' , array( $this, 'insert_post' ), 10, 2 );
133
134 add_action( 'draft_to_publish' , array( $this, 'publish_post' ) );
135 add_action( 'future_to_publish' , array( $this, 'publish_post' ) );
136 add_action( 'pending_to_publish' , array( $this, 'publish_post' ) );
137 add_action( 'private_to_publish' , array( $this, 'publish_post' ) );
138 add_action( 'acf/submit_form' , array( $this, 'acf_submit_form' ), 10, 2 );
139
140 add_action( 'publish_to_publish' , array( $this, 'update_post' ) );
141 add_action( 'private_to_private' , array( $this, 'update_post' ) );
142
143 add_action( 'init' , array( $this, 'custom_post_type_hooks' ), 100 );
144 add_action( 'create_term' , array( $this, 'create_term' ), 10, 3 );
145
146 add_action( 'comment_post' , array( $this, 'comment_post' ) );
147 add_action( 'trackback_post' , array( $this, 'trackback_post' ) );
148 add_action( 'pingback_post' , array( $this, 'pingback_post' ) );
149
150 add_action( 'user_register' , array( $this, 'user_register' ) );
151 add_action( 'user_register' , array( $this, 'welcome_email' ) );
152 add_action( 'set_user_role' , array( $this, 'user_role_changed' ), 10, 3 );
153
154 if ( version_compare( $wp_version, '4.4', '>=' ) ) {
155 add_filter( 'retrieve_password_title', array( $this, 'change_password_email_title' ), 10, 3 );
156 } else {
157 add_filter( 'retrieve_password_title', array( $this, 'change_password_email_title' ) );
158 }
159 add_action( 'lostpassword_post' , array( $this, 'on_lost_password' ) );
160 add_filter( 'retrieve_password_message' , array( $this, 'change_password_email_message' ), 10, 4 );
161
162 add_action( 'after_password_reset' , array( $this, 'on_password_reset' ) );
163 add_filter( 'password_change_email' , array( $this, 'on_password_changed' ), 10, 2 );
164 add_filter( 'email_change_email' , array( $this, 'on_email_changed' ), 10, 2 );
165
166 add_filter( 'auto_core_update_email' , array( $this, 'on_core_updated' ), 10, 4 );
167
168 add_filter( 'plugin_action_links' , array( $this, 'plugin_action_links' ), 10, 4 );
169 add_action( 'shutdown' , array( $this, 'on_shutdown' ) );
170 }
171
172 /**
173 * Setup hooks for custom post types.
174 *
175 * @since 1.2
176 */
177 function custom_post_type_hooks() {
178 $post_types = get_post_types( array( 'public' => true ), 'names' );
179 $post_types = array_diff( $post_types, array( BNFW_Notification::POST_TYPE ) );
180
181 foreach ( $post_types as $post_type ) {
182 add_action( 'pending_' . $post_type, array( $this, 'on_post_pending' ), 10, 2 );
183 add_action( 'future_' . $post_type, array( $this, 'on_post_scheduled' ), 10, 2 );
184 }
185 }
186
187 /**
188 * importer
189 */
190 public function activate() {
191 require_once dirname( __FILE__ ) . '/includes/import.php';
192 $importer = new BNFW_Import;
193 $importer->import();
194 }
195
196 /**
197 * Add 'Settings' link below BNFW in Plugins list.
198 *
199 * @since 1.0
200 * @param unknown $links
201 * @param unknown $file
202 * @return unknown
203 */
204 public function plugin_action_links( $links, $file ) {
205 $plugin_file = 'bnfw/bnfw.php';
206 if ( $file == $plugin_file ) {
207 $settings_link = '<a href="' . esc_url( admin_url( 'edit.php?post_type=bnfw_notification&page=bnfw-settings' ) ) . '">' . esc_html__( 'Settings', 'bnfw' ) . '</a>';
208 array_unshift( $links, $settings_link );
209 }
210 return $links;
211 }
212
213 /**
214 * When a new term is created.
215 *
216 * @since 1.0
217 * @param int $term_id
218 * @param int $tt_id
219 * @param string $taxonomy
220 */
221 public function create_term( $term_id, $tt_id, $taxonomy ) {
222 $this->send_notification( 'newterm-' . $taxonomy, $term_id );
223 }
224
225 /**
226 * Fires when a post is created for the first time.
227 *
228 * @since 1.3.1
229 * @param int $post_id Post ID
230 * @param object $post Post object
231 */
232 public function insert_post( $post_id, $post ) {
233 // Some themes like P2, directly insert posts into DB.
234 $insert_post_themes = apply_filters( 'bnfw_insert_post_themes', array( 'P2', 'Syncope' ) );
235 $current_theme = wp_get_theme();
236
237 /**
238 * Whether to trigger insert post hook.
239 *
240 * @since 1.4
241 */
242 $trigger_insert_post = apply_filters( 'bnfw_trigger_insert_post', false );
243
244 if ( in_array( $current_theme->get( 'Name' ), $insert_post_themes ) || $trigger_insert_post ) {
245 $this->handle_inserted_post( $post_id );
246 }
247 }
248
249 /**
250 * Trigger New Post published notification for ACF forms.
251 *
252 * @param string $form ACF Form.
253 * @param int $post_id Post ID.
254 */
255 public function acf_submit_form( $form, $post_id ) {
256 $this->handle_inserted_post( $post_id );
257 }
258
259 /**
260 * Trigger correct notifications for inserted posts.
261 *
262 * @since 1.6.7
263 *
264 * @param int $post_id Post id.
265 */
266 private function handle_inserted_post( $post_id ) {
267 $post = get_post( $post_id );
268
269 if ( ! is_a( $post, 'WP_Post' ) ) {
270 return;
271 }
272
273 switch ( $post->post_status ) {
274 case 'publish':
275 $this->publish_post( $post );
276 break;
277
278 case 'private':
279 $this->private_post( $post );
280 break;
281
282 case 'pending':
283 $this->on_post_pending( $post_id, $post );
284 break;
285
286 case 'future':
287 $this->on_post_scheduled( $post_id, $post );
288 break;
289 }
290 }
291
292 /**
293 * Fires when a post is created for the first time.
294 *
295 * @since 1.0
296 * @param object $post Post Object
297 */
298 function publish_post( $post ) {
299 $post_id = $post->ID;
300 $post_type = $post->post_type;
301
302 if ( BNFW_Notification::POST_TYPE != $post_type ) {
303 $this->send_notification_async( 'new-' . $post_type, $post_id );
304 }
305 }
306
307 /**
308 * Fires when a private post is created.
309 *
310 * @since 1.6
311 * @param object $post Post Object
312 */
313 public function private_post( $post ) {
314 $post_id = $post->ID;
315 $post_type = $post->post_type;
316
317 if ( BNFW_Notification::POST_TYPE != $post_type ) {
318 $this->send_notification_async( 'private-' . $post_type, $post_id );
319 }
320 }
321
322 /**
323 * Fires when a post is updated.
324 *
325 * @since 1.0
326 * @param unknown $post
327 */
328 function update_post( $post ) {
329 $post_id = $post->ID;
330 $post_type = $post->post_type;
331
332 if ( BNFW_Notification::POST_TYPE != $post_type ) {
333 $this->send_notification_async( 'update-' . $post_type, $post_id );
334 }
335 }
336
337 /**
338 * Fires when a post is pending for review.
339 *
340 * @since 1.1
341 * @param int $post_id Post ID
342 * @param object $post Post object
343 */
344 function on_post_pending( $post_id, $post ) {
345 $post_type = $post->post_type;
346
347 if ( BNFW_Notification::POST_TYPE != $post_type ) {
348 $this->send_notification_async( 'pending-' . $post_type, $post_id );
349 }
350 }
351
352 /**
353 * Fires when a post is scheduled.
354 *
355 * @since 1.1.5
356 * @param int $post_id Post ID
357 * @param object $post Post object
358 */
359 function on_post_scheduled( $post_id, $post ) {
360 $post_type = $post->post_type;
361
362 if ( BNFW_Notification::POST_TYPE != $post_type ) {
363 $this->send_notification_async( 'future-' . $post_type, $post_id );
364 }
365 }
366
367 /**
368 * Send notification for new comments
369 *
370 * @since 1.0
371 * @param int $comment_id
372 */
373 function comment_post( $comment_id ) {
374 $the_comment = get_comment( $comment_id );
375 if ( $this->can_send_comment_notification( $the_comment ) ) {
376 $post = get_post( $the_comment->comment_post_ID );
377 $notification_type = 'new-comment'; // old notification name
378 if ( 'post' != $post->post_type ) {
379 $notification_type = 'comment-' . $post->post_type;
380 }
381 $this->send_notification( $notification_type, $comment_id );
382
383 // comment reply notification.
384 if ( $the_comment->comment_parent > 0 ) {
385 $notification_type = 'reply-comment'; // old notification name
386 if ( 'post' != $post->post_type ) {
387 $notification_type = 'commentreply-' . $post->post_type;
388 }
389 $notifications = $this->notifier->get_notifications( $notification_type );
390 if ( count( $notifications ) > 0 ) {
391 $parent = get_comment( $the_comment->comment_parent );
392 if ( $parent->comment_author_email != $the_comment->comment_author_email ) {
393 foreach ( $notifications as $notification ) {
394 $this->engine->send_comment_reply_email( $this->notifier->read_settings( $notification->ID ), $the_comment, $parent );
395 }
396 }
397 }
398 }
399 }
400 }
401
402 /**
403 * Send notification for new trackback
404 *
405 * @since 1.0
406 * @param unknown $comment_id
407 */
408 function trackback_post( $comment_id ) {
409 $the_comment = get_comment( $comment_id );
410 if ( $this->can_send_comment_notification( $the_comment ) ) {
411 $this->send_notification( 'new-trackback', $comment_id );
412 }
413 }
414
415 /**
416 * Send notification for new pingbacks
417 *
418 * @since 1.0
419 * @param unknown $comment_id
420 */
421 function pingback_post( $comment_id ) {
422 $the_comment = get_comment( $comment_id );
423 if ( $this->can_send_comment_notification( $the_comment ) ) {
424 $this->send_notification( 'new-pingback', $comment_id );
425 }
426 }
427
428 /**
429 * Send notification for lost password.
430 *
431 * @since 1.0
432 */
433 function on_lost_password() {
434 $user_login = sanitize_text_field( $_POST['user_login'] );
435 $user = get_user_by( 'login', $user_login );
436 if ( $user ) {
437 $this->send_notification( 'admin-password', $user->ID );
438 }
439 }
440
441 /**
442 * Change the title of the password reset email that is sent to the user.
443 *
444 * @since 1.1
445 *
446 * @param string $title
447 * @param string $user_login
448 * @param string $user_data
449 *
450 * @return string
451 */
452 public function change_password_email_title( $title, $user_login = '', $user_data = '' ) {
453 $notifications = $this->notifier->get_notifications( 'user-password' );
454 if ( count( $notifications ) > 0 ) {
455 // Ideally there should be only one notification for this type.
456 // If there are multiple notification then we will read data about only the last one
457 $setting = $this->notifier->read_settings( end( $notifications )->ID );
458
459 if ( '' === $user_data ) {
460 return $this->engine->handle_shortcodes( $setting['subject'], 'user-password', $user_data->ID );
461 } else {
462 return $setting['subject'];
463 }
464 }
465
466 return $title;
467 }
468
469 /**
470 * Change the message of the password reset email.
471 *
472 * @since 1.1
473 *
474 * @param string $message
475 * @param string $key
476 * @param string $user_login
477 * @param string $user_data
478 *
479 * @return string
480 */
481 public function change_password_email_message( $message, $key, $user_login = '', $user_data = '' ) {
482 $notifications = $this->notifier->get_notifications( 'user-password' );
483 if ( count( $notifications ) > 0 ) {
484 // Ideally there should be only one notification for this type.
485 // If there are multiple notification then we will read data about only the last one
486 $setting = $this->notifier->read_settings( end( $notifications )->ID );
487
488 $message = $this->engine->handle_password_reset_shortcodes( $setting, $key, $user_login, $user_data );
489
490 if ( 'html' == $setting['email-formatting'] ) {
491 add_filter( 'wp_mail_content_type', array( $this, 'set_html_content_type' ) );
492 $message = wpautop( $message );
493 } else {
494 add_filter( 'wp_mail_content_type', array( $this, 'set_text_content_type' ) );
495 }
496 } else {
497 if ( $this->notifier->notification_exists( 'user-password', false ) ) {
498 // disabled notification exists, so disable the email by returning empty string.
499 return '';
500 }
501 }
502
503 return $message;
504 }
505
506 /**
507 * On Password reset.
508 *
509 * @param WP_User $user User who's password was changed.
510 */
511 public function on_password_reset( $user ) {
512 $notifications = $this->notifier->get_notifications( 'password-changed' );
513 foreach ( $notifications as $notification ) {
514 $this->engine->send_password_changed_email( $this->notifier->read_settings( $notification->ID ), $user );
515 }
516 }
517
518 /**
519 * On Password Changed.
520 *
521 * @since 1.6
522 *
523 * @param array $email_data Email Data.
524 * @param array $user User data.
525 *
526 * @return array Modified Email Data
527 */
528 public function on_password_changed( $email_data, $user ) {
529 return $this->handle_filtered_data_notification( 'password-changed', $email_data, $user['ID'] );
530 }
531
532 /**
533 * On Email Changed.
534 *
535 * @since 1.6
536 *
537 * @param array $email_data Email Data.
538 * @param array $user User data.
539 *
540 * @return array Modified Email Data
541 */
542 public function on_email_changed( $email_data, $user ) {
543 return $this->handle_filtered_data_notification( 'email-changed', $email_data, $user['ID'] );
544 }
545
546 /**
547 * Send notification on core updated event.
548 *
549 * @since 1.6
550 *
551 * @param array $email_data Email Data.
552 * @param string $type The type of email being sent. Can be one of
553 * 'success', 'fail', 'manual', 'critical'.
554 * @param object $core_update The update offer that was attempted.
555 * @param mixed $result The result for the core update. Can be WP_Error.
556 *
557 * @return array Modified Email Data.
558 */
559 public function on_core_updated( $email_data, $type, $core_update, $result ) {
560 $notifications = $this->notifier->get_notifications( 'core-updated' );
561 if ( count( $notifications ) > 0 ) {
562 // Ideally there should be only one notification for this type.
563 // If there are multiple notification then we will read data about only the last one
564 $setting = $this->notifier->read_settings( end( $notifications )->ID );
565
566 $email_data = $this->engine->handle_core_updated_notification( $email_data, $setting, $type );
567 }
568
569 return $email_data;
570 }
571
572 /**
573 * Process User update notifications.
574 *
575 * @since 1.6
576 *
577 * @param string $notification_name Notification Name.
578 * @param array $email_data Email Data.
579 * @param string|int $extra_data User Id.
580 *
581 * @return array Modified Email Data.
582 */
583 private function handle_filtered_data_notification( $notification_name, $email_data, $extra_data ) {
584 $notifications = $this->notifier->get_notifications( $notification_name );
585 if ( count( $notifications ) > 0 ) {
586 // Ideally there should be only one notification for this type.
587 // If there are multiple notification then we will read data about only the last one
588 $setting = $this->notifier->read_settings( end( $notifications )->ID );
589
590 $email_data = $this->engine->handle_filtered_data_notification( $email_data, $setting, $extra_data );
591 }
592
593 return $email_data;
594 }
595
596 /**
597 * Set the email formatting to HTML.
598 *
599 * @since 1.4
600 */
601 public function set_html_content_type() {
602 return 'text/html';
603 }
604
605 /**
606 * Set the email formatting to text.
607 *
608 * @since 1.4
609 */
610 public function set_text_content_type() {
611 return 'text/plain';
612 }
613
614 /**
615 * Send notification for new users.
616 *
617 * @since 1.0
618 * @param int $user_id
619 */
620 function user_register( $user_id ) {
621 $this->send_notification( 'admin-user', $user_id );
622 }
623
624 /**
625 * New User - Post-registration Email
626 *
627 * @since 1.1
628 * @param int $user_id New user id
629 */
630 public function welcome_email( $user_id ) {
631 $notifications = $this->notifier->get_notifications( 'welcome-email' );
632 foreach ( $notifications as $notification ) {
633 $this->engine->send_registration_email( $this->notifier->read_settings( $notification->ID ), get_userdata( $user_id ) );
634 }
635 }
636
637 /**
638 * Send notification when a user role changes.
639 *
640 * @since 1.3.9
641 *
642 * @param int $user_id User ID
643 * @param string $new_role New User role
644 * @param array $old_roles Old User role
645 */
646 public function user_role_changed( $user_id, $new_role, $old_roles ) {
647 if ( ! empty( $old_roles ) ) {
648 $notifications = $this->notifier->get_notifications( 'user-role' );
649 foreach ( $notifications as $notification ) {
650
651 /**
652 * Trigger User Role Changed - For User notification.
653 *
654 * @since 1.6.5
655 */
656 if ( apply_filters( 'bnfw_trigger_user-role_notification', true, $notification, $new_role, $old_roles ) ) {
657 $this->engine->send_user_role_changed_email(
658 $this->notifier->read_settings( $notification->ID ),
659 $user_id,
660 $old_roles[0],
661 $new_role
662 );
663 }
664 }
665
666 $notifications = $this->notifier->get_notifications( 'admin-role' );
667 foreach ( $notifications as $notification ) {
668
669 /**
670 * Trigger User Role Changed - For User notification.
671 *
672 * @since 1.6.5
673 */
674 if ( apply_filters( 'bnfw_trigger_admin-role_notification', true, $notification, $new_role, $old_roles ) ) {
675 $setting = $this->notifier->read_settings( $notification->ID );
676 $setting['message'] = $this->engine->handle_user_role_shortcodes( $setting['message'], $old_roles[0], $new_role );
677 $setting['subject'] = $this->engine->handle_user_role_shortcodes( $setting['subject'], $old_roles[0], $new_role );
678
679 $this->engine->send_notification( $setting, $user_id );
680 }
681 }
682 }
683 }
684
685 /**
686 * Send notification based on type and ref id
687 *
688 * @access private
689 * @since 1.0
690 * @param string $type Notification type.
691 * @param int $ref_id Reference id.
692 */
693 private function send_notification( $type, $ref_id ) {
694 $notifications = $this->notifier->get_notifications( $type );
695 foreach ( $notifications as $notification ) {
696 $this->engine->send_notification( $this->notifier->read_settings( $notification->ID ), $ref_id );
697 }
698 }
699
700 /**
701 * Send notification async based on type and ref id.
702 *
703 * @access private
704 * @param string $type Notification type.
705 * @param int $ref_id Reference id.
706 */
707 private function send_notification_async( $type, $ref_id ) {
708 $notifications = $this->notifier->get_notifications( $type, false );
709 foreach ( $notifications as $notification ) {
710 $transient = get_transient( 'bnfw-async-notifications' );
711 if ( ! is_array( $transient ) ) {
712 $transient = array();
713 }
714
715 $transient[] = array( 'ref_id' => $ref_id, 'notification_id' => $notification->ID, 'notification_type' => $type );
716 set_transient( 'bnfw-async-notifications', $transient, 600 );
717 }
718 }
719
720 /**
721 * Can send comment notification or not
722 *
723 * @since 1.0
724 * @param unknown $comment
725 * @return unknown
726 */
727 private function can_send_comment_notification( $comment ) {
728 // Returns false if the comment is marked as spam AND admin has enabled suppression of spam
729 $suppress_spam = get_option( 'bnfw_suppress_spam' );
730 if ( '1' === $suppress_spam && ( 0 === strcmp( $comment->comment_approved, 'spam' ) ) ) {
731 return false;
732 }
733 return true;
734 }
735
736 /**
737 * Send notification emails on shutdown.
738 */
739 public function on_shutdown() {
740 if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
741 return;
742 }
743
744 $transient = get_transient( 'bnfw-async-notifications' );
745 if ( is_array( $transient ) ) {
746 delete_transient( 'bnfw-async-notifications' );
747 foreach ( $transient as $id_pairs ) {
748 $this->engine->send_notification( $this->notifier->read_settings( $id_pairs['notification_id'] ), $id_pairs['ref_id'] );
749 }
750 }
751 }
752 }
753
754 /* ------------------------------------------------------------------------ *
755 * Fire up the plugin
756 * ------------------------------------------------------------------------ */
757 BNFW::factory();
758