Better Notifications for WordPress - Version 1.0

Version Description

  • First major release - we're no longer in beta!
  • Total overhaul. The plugin has been completely re-written.
  • Auto-importer: Your old notifications will be imported when updating the plugin.
  • New 'Generator' for easily creating and editing your notifications.
  • More options and notification types as per feedback via the forums - thanks everyone!
  • Granular control over choosing either user roles or individual users you'd like to send a notification to.
  • Fully translatable.
  • Loads of bugfixes and improvements.
Download this release

Release Info

Developer voltronik
Plugin Icon 128x128 Better Notifications for WordPress
Version 1.0
Comparing to
See all releases

Code changes from version 0.1b to 1.0

README.txt CHANGED
@@ -1,39 +1,46 @@
1
- === Better Notifications for WordPress (beta) ===
2
- Contributors: voltronik, peterrocker
3
- Tags: notifications, email, roles, custom
4
  Requires at least: 3.5
5
- Tested up to: 3.5
6
- Stable tag: 0.1b
7
  License: GPLv3
8
 
9
- Send customisable HTML emails to user roles for different WordPress notifications.
10
 
11
  == Description ==
12
 
13
- Better Notifications for WordPress (beta) allows you to choose which WordPress email notifications are sent to which user roles (including custom roles) and allows you to customise the notifications using simple HTML and shortcodes. Emails are sent using wp_mail() but can be sent using SMTP using an appropriate 3rd party plugin (we recommend WP-Mail-SMTP).
14
 
15
- For example:
16
- You want Editors to be alerted via email when a new post is published and you'd like to customise it to include your branding along with the author's display name and post time - with this plugin, that's easy.
17
 
18
- Notifications that you can use are:
 
 
 
19
 
20
  * New category
21
- * New post published / post updated
 
22
  * New comment (and it's corresponding status)
23
- * New user registration
24
  * New trackback
25
  * New pingback
26
- * Lost password reset
 
 
 
 
27
 
28
- If you'd like to see a notification in the list above, please drop us a line in the forums and we'll see what we can do to add it.
29
 
30
- A long and handy list of shortcodes you can use is available [here](http://www.voltronik.co.uk/wordpress-plugins/better-notifications-for-wordpress/ "Shortcodes for use in Better Notifications for WordPress")
31
 
 
32
 
33
- Having problems? Please let us know via this plugin's forum so we can address them and let it act as a source of information for future reference and other users.
 
34
 
35
- Like this plugin? Please leave us a great review!
36
- Don't think the plugin is worthy of 5 stars? Let us know on the forum or drop us a line at plugins [at] voltronik.co.uk and we'll try and help.
37
 
38
 
39
 
@@ -41,60 +48,103 @@ Don't think the plugin is worthy of 5 stars? Let us know on the forum or drop us
41
 
42
  1. Upload the 'bnfw' plugin folder to the '/wp-content/plugins/' directory or download it via your WordPress installation.
43
  2. Activate the plugin through the 'Plugins' menu in WordPress
44
- 3. Use the new 'Notifications' Menu item in the sidebar to configure the plugin.
45
  4. (Optional) Install a plugin to use SMTP instead of wp_mail(). We recommend WP-Mail-SMTP.
46
- 5. Test by creating an update for the defined notification (e.g. create a new post if the new posts notification has been set-up).
47
- 6. Depending on you requirements, you may need to switch on or off some of the default WordPress settings. Please see the FAQ section for more information.
48
 
49
 
50
 
51
  == Frequently Asked Questions ==
52
 
 
 
 
 
 
 
 
 
53
  = What are some scenarios this plugin could be used for? =
54
 
55
- * Outreach: A blog/news site with 300,000 subscribers and want to use it to alert them of new blog posts.
56
- * Communication: A small, internal WordPress site and use to to alert staff of new comments.
57
- * Monitor: A website for a groundbreaking new product and use it for new trackbacks or pingbacks notifications.
58
  * Security: To receive alerts of password reset requests and their corresponding email address.
59
 
60
  The possibilities are endless!
61
 
 
 
 
 
62
  = What isn't this plugin? =
63
 
64
- It's not designed to send out newsletters. There is no send-this-out-on-this-date style functionality. There are many other great plugins available that you could use for that instead.
65
 
66
  = How do I set-up WordPress to work with this plugin correctly? =
67
 
68
- This will very much depend on what notifications you're using the plugin for. Out-of-the-box, this plugin works very well but there are a few tweaks that you will need to ensure 100% compatibility. All the below points refer to our plugin:
69
 
70
  * If you want to use the new comment notifications in BNFW, you need to switch off 'Email me whenever anyone posts a comment' and 'A comment is held for moderation' under Settings > Discussion. It's ok if you don't do this but you might receive WordPress's own email notifications along with the ones you configure using BNFW too. It also goes without saying that you need to enable comments for your posts if you want the email notifications to come through.
71
 
72
- * If you want to use the trackback / pingback BNFW notification, then you need to switch on 'Attempt to notify any blogs linked to from the article' and 'Allow link notifications from other blogs (pingbacks and trackbacks)' under Settings > Discussion.
 
 
73
 
74
- = Configured Emails aren't coming through! =
75
 
76
- Check your settings to make sure all is as it should be, then check your spam folder. Gmail and certain hosts can mark messages from new websites (or IP addresses) as spam so it's worth checking and possibly creating a filter to ensure this doesn't happen in the future.
77
 
78
- = The email previews aren't showing the contents of the shortcodes! =
79
 
80
- This is by design. In order to show the contents, the plugin would have to retrieve information for a specific notification and it's hard to tell which one you'd like to use or if there's any information in the database. The previews will show your HTML rendering, however.
81
 
82
- = Some of my shortcodes aren't working! =
 
 
 
 
83
 
84
- It's possible you're inserting a shortcode into an email for a notification that cannot use it. WordPress imposes certain limitations on information outputted for particular notifications. For example: the 'New Category' email notification cannot use any of the author or time shortcodes as WordPress only stores (and subsequently returns) the category name, category slug and category description. It's also worth checking the spelling and hyphens in any shortcodes as well as if they are wrapped in square brackets '[]'.
85
-
86
 
87
 
88
  == Screenshots ==
89
 
90
- 1. The notifications and roles settings. Set which roles you'd like to receive emails for notifications from here.
91
- 2. The email templates screen. Customise your emails using HTML and shortcodes here.
 
 
 
92
 
93
 
94
 
95
  == Changelog ==
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  = 0.1 beta =
98
  * Initial version of the plugin.
99
  * Settings page for configuring notification types for roles.
100
- * Email Templates page for customising emails using HTML and shortcodes.
 
 
 
 
 
 
 
 
 
1
+ === Better Notifications for WordPress ===
2
+ Contributors: voltronik
3
+ Tags: notifications, email, alerts, roles, users, HTML
4
  Requires at least: 3.5
5
+ Tested up to: 4.1
6
+ Stable tag: 1.0
7
  License: GPLv3
8
 
9
+ Send customisable HTML emails to your users for different WordPress notifications.
10
 
11
  == Description ==
12
 
13
+ > Recently updated to be even easier to use!
14
 
15
+ Better Notifications for WordPress allows you to generate custom HTML email notifications and send them to user roles (including custom roles) or individual users for all kinds of things happening on your WordPress website. Emails are sent out via your WordPress website (using `wp_mail`) but can be sent via SMTP using an appropriate 3rd party plugin should you wish.
 
16
 
17
+ = For example: =
18
+ You want a user with the editor role (or all users using the Editor role) to be alerted via email when a new post is published and you'd like to customise it to include your branding along with the author's display name and post time - with this plugin, that's easy.
19
+
20
+ Notifications that are currently available to use are:
21
 
22
  * New category
23
+ * New Post
24
+ * Post updated
25
  * New comment (and it's corresponding status)
 
26
  * New trackback
27
  * New pingback
28
+ * New user registration (admin)
29
+ * Lost password reset (admin)
30
+ * New custom taxonomy
31
+
32
+ If you'd like to see a notification in the list above, please drop me a line in the forums and we'll see what we can do to add it.
33
 
34
+ A long and handy list of shortcodes you can use is available [here](http://www.voltronik.co.uk/wordpress-plugins/better-notifications-for-wordpress/ "Shortcodes for use in Better Notifications for WordPress").
35
 
 
36
 
37
+ Having problems? Please let me know via this plugin's forum so we can address them and let it act as a source of information for future reference and other users.
38
 
39
+ Like this plugin? Please leave it a great review!
40
+ Don't think the plugin is worthy of 5 stars? Let me know on the forum and we'll do our best to help.
41
 
42
+ > Want to add categories and sub-categories via the WordPress front-end?
43
+ > Try my [Front-end Categories](https://wordpress.org/plugins/front-end-categories/ "Front-end Categories WordPress Plugin") plugin.
44
 
45
 
46
 
48
 
49
  1. Upload the 'bnfw' plugin folder to the '/wp-content/plugins/' directory or download it via your WordPress installation.
50
  2. Activate the plugin through the 'Plugins' menu in WordPress
51
+ 3. Use the settings in the new 'Notifications' Menu item in the sidebar to configure the plugin.
52
  4. (Optional) Install a plugin to use SMTP instead of wp_mail(). We recommend WP-Mail-SMTP.
53
+ 5. Test by creating a notification.
 
54
 
55
 
56
 
57
  == Frequently Asked Questions ==
58
 
59
+ = What are shortcodes? Where can I use them in this plugin? =
60
+
61
+ Shortcodes are little blocks of content inserted by WordPress, contained in square brackets. For example, if you want to add the content of a post to a notification for 'New Post Published', you can use the `[post_content]` shortcode to display this in the email that is sent out.
62
+
63
+ Shortcodes can be used in the 'Subject' and 'Message Body' of your notifications.
64
+
65
+ A long and handy list of shortcodes you can use is available [here](http://www.voltronik.co.uk/wordpress-plugins/better-notifications-for-wordpress/ "Shortcodes for use in Better Notifications for WordPress").
66
+
67
  = What are some scenarios this plugin could be used for? =
68
 
69
+ * Outreach: A blog/news site with hundreds of subscribers and want to use it to alert them of new blog posts.
70
+ * Communication: A small, internal WordPress site and use it to alert staff of new comments.
71
+ * Monitor: A website for an awesome new product or service and use it for notifications of pingbacks and trackbacks.
72
  * Security: To receive alerts of password reset requests and their corresponding email address.
73
 
74
  The possibilities are endless!
75
 
76
+ = Does this plugin work with Akismet? =
77
+
78
+ Yes! There is an option for suppressing comments marked as SPAM by Akismet in the plugin settings.
79
+
80
  = What isn't this plugin? =
81
 
82
+ It's not designed to send out newsletters. There is no send-this-out-on-this-date style functionality included. There are many other great plugins available that you could use for that instead.
83
 
84
  = How do I set-up WordPress to work with this plugin correctly? =
85
 
86
+ This will very much depend on what notifications you're using the plugin for. Out-of-the-box, this plugin works very well but there are a few tweaks that you will need to ensure 100% compatibility. All the below points refer to this plugin:
87
 
88
  * If you want to use the new comment notifications in BNFW, you need to switch off 'Email me whenever anyone posts a comment' and 'A comment is held for moderation' under Settings > Discussion. It's ok if you don't do this but you might receive WordPress's own email notifications along with the ones you configure using BNFW too. It also goes without saying that you need to enable comments for your posts if you want the email notifications to come through.
89
 
90
+ = Configured emails aren't coming through! =
91
+
92
+ Check your settings to make sure all is as it should be, then check your spam folder and/or filter at your host. Gmail and certain hosts can mark messages from new websites (or IP addresses) as spam so it's worth checking and possibly creating a filter to ensure this doesn't happen in the future.
93
 
94
+ Many hosts place a limit on the number of emails that can be sent out within an hour so this may also cause some delay in emails arriving.
95
 
96
+ = Some of my shortcodes aren't working! =
97
 
98
+ It's possible you're inserting a shortcode into a notification that cannot use it. For example: the 'New Category' email notification cannot use any of the author or time shortcodes as WordPress only stores the category name, category slug and category description in the database. It's also worth checking the spelling and hyphens in any shortcodes as well as if they are wrapped in square brackets '[]'.
99
 
100
+ = Can I translate this plugin? =
101
 
102
+ Yes, of course! The plugin is completely translation-friendly and if you send me your .po file, i'll make sure to include it in the plugin and credit you on this page.
103
+
104
+ = Will this plugin work with versions WordPress less than 3.5? =
105
+
106
+ It might do but this is untested.
107
 
 
 
108
 
109
 
110
  == Screenshots ==
111
 
112
+ 1. All Notifications
113
+
114
+ 2. Add New Notification
115
+
116
+ 3. Plugin Settings
117
 
118
 
119
 
120
  == Changelog ==
121
 
122
+ = 1.0 =
123
+ * First major release - we're no longer in beta!
124
+ * Total overhaul. The plugin has been completely re-written.
125
+ * Auto-importer: Your old notifications will be imported when updating the plugin.
126
+ * New 'Generator' for easily creating and editing your notifications.
127
+ * More options and notification types as per feedback via the forums - thanks everyone!
128
+ * Granular control over choosing either user roles or individual users you'd like to send a notification to.
129
+ * Fully translatable.
130
+ * Loads of bugfixes and improvements.
131
+
132
+ = 0.2.1 beta =
133
+ * Minor Bugfixes
134
+
135
+ = 0.2 beta =
136
+ * Added an option to suppress spam comment notifications.
137
+
138
  = 0.1 beta =
139
  * Initial version of the plugin.
140
  * Settings page for configuring notification types for roles.
141
+ * Email Templates page for customising emails using HTML and shortcodes.
142
+
143
+
144
+
145
+ == Upgrade Notice ==
146
+
147
+ = Migrating from 0.2.1 to 1.0 =
148
+
149
+ Version 1 features an auto-importer which should migrate all of your notifications from any previous versions of the plugin to 1.0.
150
+ Please ensure that you check, double check and test your notifications before and after upgrading.
assets/images/select2-spinner.gif ADDED
Binary file
assets/images/select2.png ADDED
Binary file
assets/images/select2@2x.png ADDED
Binary file
assets/js/bnfw.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+ $(".select2").select2();
3
+
4
+ $("#bnfw_user_role_toggle, #bnfw_user_toggle").click(function() {
5
+ $("#bnfw_user_role_container").toggle();
6
+ $("#bnfw_user_container").toggle();
7
+ });
8
+ });
better-wordpress-notifications.php DELETED
@@ -1,218 +0,0 @@
1
- <?php
2
- /*
3
- Plugin Name: Better Notifications for WordPress
4
- Plugin URI: http://www.voltronik.co.uk/wordpress-plugins/better-notifications-for-wordpress/
5
- Description: Send customisable HTML emails to user roles for different WordPress notifications.
6
- Version: 0.1 Beta
7
- Author: Voltronik
8
- Author URI: http://www.voltronik.co.uk/
9
- Author Email: hello@voltronik.co.uk
10
- License: GPLv2 or later
11
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
-
13
- Copyright 2013 Voltronik Web Design (hello@voltronik.co.uk)
14
-
15
- This program is free software; you can redistribute it and/or modify
16
- it under the terms of the GNU General Public License, version 2, as
17
- published by the Free Software Foundation.
18
-
19
- This program is distributed in the hope that it will be useful,
20
- but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- GNU General Public License for more details.
23
-
24
- You should have received a copy of the GNU General Public License
25
- along with this program; if not, write to the Free Software
26
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
-
28
- */
29
-
30
- /*
31
- hooks which we support
32
- */
33
- $GLOBALS['BNFW_ACTION_TYPES'] = array("create_term", "publish_post", "comment_post", "user_register", "trackback_post", "pingback_post", "lostpassword_post");
34
-
35
- /*
36
- pretty names for the hooks
37
- */
38
- $GLOBALS['BNFW_ACTION_TYPES_PRETTY'] = array("create_term" => "New Category",
39
- "publish_post" => "Publish / Update Post",
40
- "comment_post" => "New Comment / Awaiting Moderation",
41
- "user_register" => "New User Registration",
42
- "trackback_post" => "New Trackback",
43
- "pingback_post" => "New Pingback",
44
- "lostpassword_post" => "Lost password reset");
45
-
46
-
47
- // Load Engine
48
- require_once ('includes/bnfw_engine.php');
49
-
50
- // Load Settings page
51
- if(is_admin()){
52
- require_once ('includes/admin-page.php');
53
- }
54
-
55
- //add_filter('the_content', 'bnfw_debug');
56
-
57
- add_action('create_term', 'bnfw_term_created');
58
- add_action('publish_post', 'bnfw_publish_post');
59
- add_action('comment_post', 'bnfw_comment_post');
60
- add_action('user_register', 'bnfw_user_register');
61
- add_action('trackback_post', 'bnfw_trackback_post');
62
- add_action('pingback_post', 'bnfw_pingback_post');
63
- add_action('lostpassword_post', 'bnfw_lostpassword_post');
64
-
65
- add_filter('wp_mail', 'bnfw_disable_emails');
66
-
67
- register_activation_hook( __FILE__, 'bnfw_activate' );
68
-
69
-
70
- function bnfw_disable_emails($result = '') {
71
- extract($result);
72
- $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
73
- if (strstr(sprintf(__('[%s] New User Registration'), $blogname), $subject)) {
74
- $to = '';
75
- $subject = '';
76
- $message = '';
77
- $headers = '';
78
- $attachments = array ();
79
- return compact('to', 'subject', 'message', 'headers', 'attachments');
80
- }
81
- else if (strstr(sprintf(__('[%s] Password Lost/Changed'), $blogname), $subject)) {
82
- $to = '';
83
- $subject = '';
84
- $message = '';
85
- $headers = '';
86
- $attachments = array ();
87
- return compact('to', 'subject', 'message', 'headers', 'attachments');
88
- }
89
- else if (strstr(sprintf(__('[%s] Comment:'), $blogname), $subject)) {
90
- $to = '';
91
- $subject = '';
92
- $message = '';
93
- $headers = '';
94
- $attachments = array ();
95
- return compact('to', 'subject', 'message', 'headers', 'attachments');
96
- }
97
- else if (strstr(sprintf(__('[%s] Please moderate:'), $blogname), $subject)) {
98
- $to = '';
99
- $subject = '';
100
- $message = '';
101
- $headers = '';
102
- $attachments = array ();
103
- return compact('to', 'subject', 'message', 'headers', 'attachments');
104
- }
105
-
106
-
107
- return $result;
108
- }
109
-
110
- function bnfw_activate(){
111
-
112
- //set default values
113
- $bnfw_options = get_option('bnfw_settings');
114
- if($bnfw_options === false){
115
-
116
- $bnfw_options = array('create_term-administrator' => '1',
117
- 'publish_post-administrator' => '1',
118
- 'comment_post-administrator' => '1',
119
- 'user_register-administrator' => '1',
120
- 'trackback_post-administrator' => '1',
121
- 'pingback_post-administrator' => '1',
122
- 'lostpassword_post-administrator' => '1'
123
- );
124
-
125
- update_option('bnfw_settings', $bnfw_options);
126
- }
127
-
128
- $bnfw_options = get_option('bnfw_custom_email_settings');
129
- if($bnfw_options === false){
130
-
131
- $bnfw_options = array('payload-subject-publish_post' => 'A new post has been published!',
132
- 'payload-subject-create_term' => 'New category created',
133
- 'payload-subject-comment_post' => 'This is a comment notification email',
134
- 'payload-subject-user_register' => 'A new user has registered!',
135
- 'payload-subject-trackback_post' => 'You have a new trackback!',
136
- 'payload-subject-pingback_post' => 'You have a new pingback!',
137
- 'payload-subject-lostpassword_post' => '[user_login] has lost their password!',
138
- 'payload-body-publish_post' => 'A post was published by <strong>[display_name]</strong> on <strong>[post_date]</strong>
139
-
140
- <p>Here\'s an excerpt: <br /></p>
141
- <em>[post_excerpt]</em>',
142
- 'payload-body-create_term' => 'A new category has been created called: <strong>[name]</strong>',
143
- 'payload-body-comment_post' => 'A new comment was posted by <strong>[comment_author_email]</strong>.
144
- <p>It\'s status has been set to: <strong>[comment_approved]</strong>.</p>',
145
- 'payload-body-user_register' => 'Say hello to <strong>[user_login]</strong>!',
146
- 'payload-body-trackback_post' => 'From: <strong>[comment_author_url]</strong>',
147
- 'payload-body-pingback_post' => 'From: <strong>[comment_author_url]</strong>',
148
- 'payload-body-lostpassword_post' => '<strong>[user_login]</strong> has lost their password.
149
-
150
- <p>An email has been sent to them so they can reset their password.</p>'
151
- );
152
-
153
- update_option('bnfw_custom_email_settings', $bnfw_options);
154
-
155
- }
156
-
157
- }
158
-
159
-
160
- function bnfw_term_created($termID){
161
-
162
- $the_term = get_term_by('id', $termID, 'category');
163
- bnfw_launch_payload(bnfw_get_recipients_for_type('create_term'), bnfw_get_subject_for_term_created($the_term), bnfw_get_payload_for_term_created($the_term));
164
-
165
- }
166
-
167
- function bnfw_publish_post($postID){
168
-
169
- $the_post = get_post($postID);
170
- bnfw_launch_payload(bnfw_get_recipients_for_type('publish_post'), bnfw_get_subject_for_publish_post($the_post), bnfw_get_payload_for_publish_post($the_post));
171
-
172
- }
173
-
174
- function bnfw_comment_post($comment_id){
175
-
176
- $the_comment = get_comment($comment_id);
177
- bnfw_launch_payload(bnfw_get_recipients_for_type('comment_post'), bnfw_get_subject_for_comment_post($the_comment), bnfw_get_payload_for_comment_post($the_comment));
178
-
179
- }
180
-
181
- function bnfw_user_register($user_id){
182
-
183
- $the_user = get_user_by('id', $user_id);
184
- bnfw_launch_payload(bnfw_get_recipients_for_type('user_register'), bnfw_get_subject_for_user_register($the_user), bnfw_get_payload_for_user_register($the_user));
185
-
186
- }
187
-
188
- function bnfw_trackback_post($comment_id){
189
-
190
- $the_comment = get_comment($comment_id);
191
- bnfw_launch_payload(bnfw_get_recipients_for_type('trackback_post'), bnfw_get_subject_for_trackback_post($the_comment), bnfw_get_payload_for_trackback_post($the_comment));
192
-
193
- }
194
-
195
- function bnfw_pingback_post($comment_id){
196
-
197
- $the_comment = get_comment($comment_id);
198
- bnfw_launch_payload(bnfw_get_recipients_for_type('pingback_post'), bnfw_get_subject_for_pingback_post($the_comment), bnfw_get_payload_for_pingback_post($the_comment));
199
-
200
- }
201
-
202
- function bnfw_lostpassword_post(){
203
- $user_data = get_user_by( 'email', trim( $_POST['user_login'] ) );
204
- bnfw_launch_payload(bnfw_get_recipients_for_type('lostpassword_post'), bnfw_get_subject_for_lostpassword_post($user_data), bnfw_get_payload_for_lostpassword_post($user_data));
205
- }
206
-
207
-
208
- function bnfw_debug($content){
209
-
210
- $bnfw_options = get_option('bnfw_settings');
211
-
212
- if ( !isset( $wp_roles ) )
213
- $wp_roles = new WP_Roles();
214
- var_dump($wp_roles->get_names());
215
-
216
- var_dump($bnfw_options);
217
- return $content;
218
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bnfw.php ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ Plugin Name: Better Notifications for WordPress
4
+ Plugin URI: http://wordpress.org/plugins/bnfw/
5
+ Description: Customise the default WordPress email notifications and create new ones with HTML and shortcodes.
6
+ Version: 1.0
7
+ Author: Voltronik
8
+ Author URI: http://www.voltronik.co.uk/
9
+ Author Email: plugins@voltronik.co.uk
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 © 2014 Voltronik (plugins@voltronik.co.uk)
18
+
19
+ This program is free software; you can redistribute it and/or modify
20
+ it under the terms of the GNU General Public License, version 2, as
21
+ published by the Free Software Foundation.
22
+
23
+ This program is distributed in the hope that it will be useful,
24
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
25
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
+ GNU General Public License for more details.
27
+
28
+ You should have received a copy of the GNU General Public License
29
+ along with this program; if not, write to the Free Software
30
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31
+ */
32
+
33
+ class BNFW {
34
+
35
+ /**
36
+ * Constructor.
37
+ *
38
+ * @since 1.0
39
+ */
40
+ function __construct() {
41
+ $this->load_textdomain();
42
+ $this->includes();
43
+ $this->hooks();
44
+
45
+ $this->notifier = new BNFW_Notification;
46
+ $this->engine = new BNFW_Engine;
47
+ }
48
+
49
+ /**
50
+ * Loads the plugin language files
51
+ *
52
+ * @since 1.0
53
+ */
54
+ public function load_textdomain() {
55
+ // Load localization domain
56
+ $this->translations = dirname( plugin_basename( __FILE__ ) ) . '/languages/';
57
+ load_plugin_textdomain( 'bnfw', false, $this->translations );
58
+ }
59
+
60
+ /**
61
+ * Include required files.
62
+ *
63
+ * @since 1.0
64
+ */
65
+ public function includes() {
66
+ // Load Engine and post type
67
+ require_once( 'includes/engine/class-bnfw-engine.php' );
68
+ require_once( 'includes/admin/class-bnfw-notification.php' );
69
+
70
+ // Load Admin Pages
71
+ if ( is_admin() ) {
72
+ require_once( 'includes/admin/bnfw-settings.php' );
73
+ }
74
+
75
+ // uncomment for debugging
76
+ //require_once ('includes/debug.php');
77
+ }
78
+
79
+ /**
80
+ * Register Hooks.
81
+ *
82
+ * @since 1.0
83
+ */
84
+ public function hooks() {
85
+ register_activation_hook( __FILE__, array( $this, 'activate' ) );
86
+
87
+ add_action( 'draft_to_publish' , array( $this, 'publish_post' ) );
88
+ add_action( 'publish_to_publish' , array( $this, 'update_post' ) );
89
+
90
+ add_action( 'comment_post' , array( $this, 'comment_post' ) );
91
+ add_action( 'trackback_post' , array( $this, 'trackback_post' ) );
92
+ add_action( 'pingback_post' , array( $this, 'pingback_post' ) );
93
+
94
+ add_action( 'user_register' , array( $this, 'user_register' ) );
95
+ add_action( 'lostpassword_post' , array( $this, 'lost_password' ) );
96
+
97
+ add_action( 'create_term' , array( $this, 'create_term' ), 10, 3 );
98
+
99
+ add_filter( 'plugin_action_links' , array( $this, 'plugin_action_links' ), 10, 4 );
100
+ }
101
+
102
+ /**
103
+ * Run this on first-time plugin activation
104
+ *
105
+ * @since 1.0
106
+ */
107
+ // importer
108
+ public function activate() {
109
+ require_once( dirname( __FILE__ ) . '/includes/import.php' );
110
+ $importer = new BNFW_Import;
111
+ $importer->import();
112
+ }
113
+
114
+ /**
115
+ * Add 'Settings' link below BNFW in Plugins list.
116
+ *
117
+ * @since 1.0
118
+ */
119
+ public function plugin_action_links( $links, $file ) {
120
+ $plugin_file = 'bnfw/bnfw.php';
121
+ if ( $file == $plugin_file ) {
122
+ $settings_link = '<a href="' . admin_url( 'admin.php?page=bnfw-settings' ) . '">' . 'Settings' . '</a>';
123
+ array_unshift( $links, $settings_link );
124
+ }
125
+ return $links;
126
+ }
127
+
128
+ /**
129
+ * When a new term is created.
130
+ *
131
+ * @since 1.0
132
+ */
133
+ public function create_term( $term_id, $tt_id, $taxonomy ) {
134
+ if ( 'category' == $taxonomy ) {
135
+ $this->send_notification( 'new-category', $term_id );
136
+ } else {
137
+ $this->send_notification( 'new-term', $term_id );
138
+ }
139
+ }
140
+
141
+ /**
142
+ * Fires when a post is created for the first time.
143
+ *
144
+ * @since 1.0
145
+ */
146
+ function publish_post( $post ) {
147
+ $post_id = $post->ID;
148
+ $post_type = $post->post_type;
149
+
150
+ if ( BNFW_Notification::POST_TYPE != $post_type ) {
151
+ $this->send_notification( 'new-' . $post_type, $post_id );
152
+ }
153
+ }
154
+
155
+ /**
156
+ * Fires when a post is updated.
157
+ *
158
+ * @since 1.0
159
+ */
160
+ function update_post( $post ) {
161
+ $post_id = $post->ID;
162
+ $post_type = $post->post_type;
163
+
164
+ if ( BNFW_Notification::POST_TYPE != $post_type ) {
165
+ $this->send_notification( 'update-' . $post_type, $post_id );
166
+ }
167
+ }
168
+
169
+ /**
170
+ * Send notification for new comments
171
+ *
172
+ * @since 1.0
173
+ */
174
+ function comment_post( $comment_id ) {
175
+ $the_comment = get_comment( $comment_id );
176
+ if ( $this->can_send_comment_notification( $the_comment ) ) {
177
+ $this->send_notification( 'new-comment', $comment_id );
178
+ }
179
+ }
180
+
181
+ /**
182
+ * Send notification for new trackback
183
+ *
184
+ * @since 1.0
185
+ */
186
+ function trackback_post( $comment_id ){
187
+ $the_comment = get_comment( $comment_id );
188
+ if ( $this->can_send_comment_notification( $the_comment ) ) {
189
+ $this->send_notification( 'new-trackback', $comment_id );
190
+ }
191
+ }
192
+
193
+ /**
194
+ * Send notification for new pingbacks
195
+ *
196
+ * @since 1.0
197
+ */
198
+ function pingback_post( $comment_id ) {
199
+ $the_comment = get_comment( $comment_id );
200
+ if ( $this->can_send_comment_notification( $the_comment ) ) {
201
+ $this->send_notification( 'new-pingback', $comment_id );
202
+ }
203
+ }
204
+
205
+ /**
206
+ * Send notification for lost password.
207
+ *
208
+ * @since 1.0
209
+ */
210
+ function lost_password() {
211
+ $user = get_user_by( 'login', trim( $_POST['user_login'] ) );
212
+ if ( $user ) {
213
+ $this->send_notification( 'user-password', $user->ID );
214
+ }
215
+ }
216
+
217
+ /**
218
+ * Send notification for new uses.
219
+ *
220
+ * @since 1.0
221
+ */
222
+ function user_register( $user_id ) {
223
+ $this->send_notification( 'new-user', $user_id );
224
+ }
225
+
226
+ /**
227
+ * Send notification based on type and ref id
228
+ *
229
+ * @access private
230
+ * @since 1.0
231
+ */
232
+ private function send_notification( $type, $ref_id ) {
233
+ $notifications = $this->notifier->get_notifications( $type );
234
+ foreach ( $notifications as $notification ) {
235
+ $this->engine->send_notification( $this->notifier->read_settings( $notification->ID ), $ref_id );
236
+ }
237
+ }
238
+
239
+ /**
240
+ * Can send comment notification or not
241
+ *
242
+ * @since 1.0
243
+ */
244
+ private function can_send_comment_notification( $comment ) {
245
+ // Returns false if the comment is marked as spam AND admin has enabled suppression of spam
246
+ $suppress_spam = get_option( 'bnfw_suppress_spam' );
247
+ if ( '1' === $suppress_spam && ( 0 === strcmp( $comment->comment_approved, 'spam' ) ) ) {
248
+ return false;
249
+ }
250
+ return true;
251
+ }
252
+ }
253
+
254
+ /* ------------------------------------------------------------------------ *
255
+ * Fire up the plugin
256
+ * ------------------------------------------------------------------------ */
257
+ new BNFW;
includes/admin-page.php DELETED
@@ -1,201 +0,0 @@
1
- <?php
2
-
3
- /* Register the plugin pages */
4
- function bnfw_admin_menu() {
5
- add_menu_page( 'Better Notifications for WordPress Notifications', // The Menu Title
6
- 'Notifications', // The Page title
7
- 'manage_options', // The capability required for access to this item
8
- 'bnfw-admin', // the slug to use for the page in the URL
9
- 'bnfw_callback', // The function to call to render the page
10
- '', // Icon URL
11
- '100.111111' // Position in Admin Menu
12
- );
13
-
14
- add_submenu_page( 'bnfw-admin', 'Notifications', 'Notifications', 'manage_options', 'bnfw-admin', 'bnfw_callback');
15
- add_submenu_page( 'bnfw-admin', 'Email Templates', 'Email Templates', 'manage_options', 'bnfw-email-customise', 'bnfw_email_customise_page');
16
-
17
- /* Enqueue scripts action */
18
- add_action( 'admin_enqueue_scripts', 'bnfw_admin_scripts' );
19
-
20
- }
21
-
22
- // Create the Admin menu pages action
23
- add_action( 'admin_menu', 'bnfw_admin_menu' );
24
-
25
- // Call the settings page and create it
26
- function bnfw_callback() {
27
- bnfw_settings_page();
28
- }
29
-
30
- function bnfw_admin_scripts($hook) {
31
-
32
- if( strpos($hook, 'bnfw') === false){
33
- return;
34
- }
35
-
36
- wp_enqueue_style('bnfw-admin-css', plugin_dir_url(__FILE__) . 'css/plugin_styles.css');
37
- }
38
-
39
- // creates our settings in the options table
40
- function bnfw_register_settings() {
41
- register_setting('bnfw_settings_group', 'bnfw_settings');
42
- register_setting('bnfw_email_settings_group', 'bnfw_custom_email_settings');
43
-
44
- }
45
- add_action('admin_init', 'bnfw_register_settings');
46
-
47
-
48
-
49
- /***** Settings Page *****/
50
- function bnfw_settings_page() {
51
-
52
- $bnfw_options = get_option('bnfw_settings');
53
-
54
- ob_start(); ?>
55
-
56
-
57
- <div class="wrap">
58
-
59
- <?php settings_errors(); ?>
60
-
61
- <div class="row clearfix">
62
- <div class="eightcol first">
63
- <h2>Better Notifications for WordPress - Notifications</h2>
64
- <h3>Email Settings for User Roles</h3>
65
- <p>Here, you can set which user roles you'd like to receive emails notifications for.</p>
66
- </div>
67
-
68
- <div id="paypal-donate" class="fourcol last">
69
- <strong class="sevencol first">We worked really hard on this plugin. If you found it useful, please consider donating via the button to the right. Thanks!</strong>
70
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
71
- <input type="hidden" name="cmd" value="_s-xclick">
72
- <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYCqUcAJo5NzEwLtimsVU5PWiC7E9cmCpFQ095Mu/Oqr9WqoP09CVwl+7QgDfs6qRIljmKBYEdRq5ZnMuuwgznjc0hMdehrbQUvTuL5U3OiJy1+Ifv0yeswMh+Fh+v/mEK0gr+39uX6/+wf9wfk3VMtXFHwhLP2+TMT31441CwgTaDELMAkGBSsOAwIaBQAwgcQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQI/qWC6jcghWeAgaCf3zUsAktRid68gNKqqoTVuU7FjijIYbZDaFL77frQG1lSR6C2+w1x3XsDsFIODuE3/k9sRcuCAKVIQtr+qaYSSREzeRytLqNgO7oYyZJtjH4MrTiLdgkP2IIXglHzFjHyGW1reUZ5LPcZmQzfCBmSbEThwzCOcq6Zcr8inZ9UqsnsvZZvIbOntEanSoEOScFaIcwxxGJFrIfPFRacdYKfoIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMB4XDTA0MDIxMzEwMTMxNVoXDTM1MDIxMzEwMTMxNVowgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBR07d/ETMS1ycjtkpkvjXZe9k+6CieLuLsPumsJ7QC1odNz3sJiCbs2wC0nLE0uLGaEtXynIgRqIddYCHx88pb5HTXv4SZeuv0Rqq4+axW9PLAAATU8w04qqjaSXgbGLP3NmohqM6bV9kZZwZLR/klDaQGo1u9uDb9lr4Yn+rBQIDAQABo4HuMIHrMB0GA1UdDgQWBBSWn3y7xm8XvVk/UtcKG+wQ1mSUazCBuwYDVR0jBIGzMIGwgBSWn3y7xm8XvVk/UtcKG+wQ1mSUa6GBlKSBkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTMwMjEwMTE0MjIyWjAjBgkqhkiG9w0BCQQxFgQUfx/ReNIyYSPc378H9V1sC2s12UUwDQYJKoZIhvcNAQEBBQAEgYAycTRRP/j6HJ7uSWG24u+2qAM8kh2PR/ZMu30ZCgzxSr0NwQw8guDqt59FjteksFnOYH/9Oe4em8hWWN6fuGpRHGno9hK64wbsy9ZKCy2NDyljDhghNWeSOXrHmv7bKqQny6Y/DqlUJZyxSea4W8B9FT4i8IC/IWjlQs8/IG65Xw==-----END PKCS7-----
73
- ">
74
- <input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal — The safer, easier way to pay online.">
75
- <img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
76
- </form>
77
- </div>
78
- </div>
79
-
80
- <form method="post" action="options.php">
81
-
82
- <?php settings_fields('bnfw_settings_group'); ?>
83
-
84
- <div id="role-settings" class="twelvecol">
85
-
86
- <div id="roles" class="row clearfix">
87
- <div class="threecol first clearfix">&nbsp;</div>
88
- <?php foreach ($GLOBALS['BNFW_ACTION_TYPES'] as $bnfw_events) { ?>
89
- <div class="role twocol clearfix">
90
- <strong><?php echo $GLOBALS['BNFW_ACTION_TYPES_PRETTY'][$bnfw_events] ?></strong>
91
- </div>
92
- <?php } ?>
93
- </div>
94
-
95
- <?php $getted_roles = get_editable_roles(); foreach (get_editable_roles() as $field => $roles) { ?>
96
-
97
- <div class="event row clearfix">
98
- <div class="first threecol clearfix"><strong><?php echo $getted_roles[$field]['name']; ?></strong></div>
99
-
100
- <?php foreach ($GLOBALS['BNFW_ACTION_TYPES'] as $bnfw_events) { ?>
101
- <div class="role twocol clearfix">
102
- <input id="bnfw_settings[<?php echo $bnfw_events ?>-<?php echo $field ?>]" name="bnfw_settings[<?php echo $bnfw_events ?>-<?php echo $field ?>]" type="checkbox" value="1" <?php checked(1, $bnfw_options[$bnfw_events.'-'.$field]); ?> />
103
- </div>
104
- <?php } ?>
105
-
106
- </div>
107
-
108
- <?php } ?>
109
-
110
- </div>
111
-
112
- <p class="submit clearfix">
113
- <input type="submit" class="button-primary" value="Save Settings" />
114
- </p>
115
-
116
- </form>
117
-
118
- </div>
119
-
120
- <?php echo ob_get_clean();
121
-
122
- }
123
-
124
-
125
-
126
- /***** Email Customisation Page *****/
127
- function bnfw_email_customise_page() {
128
-
129
- $bnfw_options = get_option('bnfw_custom_email_settings');
130
-
131
- ob_start(); ?>
132
-
133
- <div class="wrap">
134
-
135
- <?php settings_errors(); ?>
136
-
137
- <div class="row clearfix">
138
- <div class="eightcol first">
139
- <h2>Better Notifications for WordPress - Email Templates</h2>
140
- <p>Here you can customise the emails that are sent out for each of the notifications.</p>
141
- <p>Email are sent out in HTML (you can add HTML tags) and can include shortcodes to insert more detail where required. For a full list of all shortcodes available, please go <a href="http://www.voltronik.co.uk/wordpress-plugins/better-notifications-for-wordpress/" title="Better Notifications for WordPress - Shortcodes" target="_blank">here</a>. <br />PLEASE NOTE: Not all shortcodes can be used with all notification types due to restrictions imposed by WordPress.</p>
142
- </div>
143
-
144
- <div id="paypal-donate" class="fourcol last">
145
- <strong class="sevencol first">We worked really hard on this plugin. If you found it useful, please consider donating via the button to the right. Thanks!</strong>
146
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
147
- <input type="hidden" name="cmd" value="_s-xclick">
148
- <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYCqUcAJo5NzEwLtimsVU5PWiC7E9cmCpFQ095Mu/Oqr9WqoP09CVwl+7QgDfs6qRIljmKBYEdRq5ZnMuuwgznjc0hMdehrbQUvTuL5U3OiJy1+Ifv0yeswMh+Fh+v/mEK0gr+39uX6/+wf9wfk3VMtXFHwhLP2+TMT31441CwgTaDELMAkGBSsOAwIaBQAwgcQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQI/qWC6jcghWeAgaCf3zUsAktRid68gNKqqoTVuU7FjijIYbZDaFL77frQG1lSR6C2+w1x3XsDsFIODuE3/k9sRcuCAKVIQtr+qaYSSREzeRytLqNgO7oYyZJtjH4MrTiLdgkP2IIXglHzFjHyGW1reUZ5LPcZmQzfCBmSbEThwzCOcq6Zcr8inZ9UqsnsvZZvIbOntEanSoEOScFaIcwxxGJFrIfPFRacdYKfoIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMB4XDTA0MDIxMzEwMTMxNVoXDTM1MDIxMzEwMTMxNVowgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBR07d/ETMS1ycjtkpkvjXZe9k+6CieLuLsPumsJ7QC1odNz3sJiCbs2wC0nLE0uLGaEtXynIgRqIddYCHx88pb5HTXv4SZeuv0Rqq4+axW9PLAAATU8w04qqjaSXgbGLP3NmohqM6bV9kZZwZLR/klDaQGo1u9uDb9lr4Yn+rBQIDAQABo4HuMIHrMB0GA1UdDgQWBBSWn3y7xm8XvVk/UtcKG+wQ1mSUazCBuwYDVR0jBIGzMIGwgBSWn3y7xm8XvVk/UtcKG+wQ1mSUa6GBlKSBkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTMwMjEwMTE0MjIyWjAjBgkqhkiG9w0BCQQxFgQUfx/ReNIyYSPc378H9V1sC2s12UUwDQYJKoZIhvcNAQEBBQAEgYAycTRRP/j6HJ7uSWG24u+2qAM8kh2PR/ZMu30ZCgzxSr0NwQw8guDqt59FjteksFnOYH/9Oe4em8hWWN6fuGpRHGno9hK64wbsy9ZKCy2NDyljDhghNWeSOXrHmv7bKqQny6Y/DqlUJZyxSea4W8B9FT4i8IC/IWjlQs8/IG65Xw==-----END PKCS7-----
149
- ">
150
- <input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal — The safer, easier way to pay online.">
151
- <img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
152
- </form>
153
- </div>
154
- </div>
155
-
156
- <form method="post" action="options.php">
157
-
158
- <?php settings_fields('bnfw_email_settings_group'); ?>
159
-
160
- <p class="submit clearfix">
161
- <input type="submit" class="button-primary" value="Save Settings" />
162
- </p>
163
-
164
- <div class="wrap clearfix">
165
- <?php foreach ($GLOBALS['BNFW_ACTION_TYPES'] as $bnfw_events) { ?>
166
- <div class="bnfw-email-custom-form sixcol clearfix">
167
-
168
- <!-- Event Type -->
169
- <h3 class="elevencol first clearfix"><?php echo $GLOBALS['BNFW_ACTION_TYPES_PRETTY'][$bnfw_events] ?></h3>
170
-
171
- <div class="sixcol first clearfix">
172
- <!-- Subject -->
173
- <label class="subject twelvecol first" for="bnfw_custom_email_settings[payload-subject-<?php echo $bnfw_events; ?>]">Email Subject</label>
174
- <input type="text" id="bnfw_custom_email_settings[payload-subject-<?php echo $bnfw_events; ?>]" name="bnfw_custom_email_settings[payload-subject-<?php echo $bnfw_events; ?>]" value="<?php echo $bnfw_options['payload-subject-'.$bnfw_events] ?>" />
175
-
176
- <!-- Message Body -->
177
- <label class="message-body twelvecol first" for="bnfw_custom_email_settings[payload-body-<?php echo $bnfw_events; ?>]">Email Message Body</label>
178
- <textarea id="bnfw_custom_email_settings[payload-body-<?php echo $bnfw_events; ?>]" name="bnfw_custom_email_settings[payload-body-<?php echo $bnfw_events; ?>]"><?php echo $bnfw_options['payload-body-'.$bnfw_events] ?></textarea>
179
- </div>
180
-
181
- <div class="bnfw-preview left">
182
- <h4>Email Message Body Preview</h4>
183
-
184
- <div class="bnfw-preview-content">
185
- <?php echo $bnfw_options['payload-body-'.$bnfw_events] ?>
186
- </div>
187
- </div>
188
- </div>
189
- <?php } ?>
190
- </div>
191
-
192
- <p class="submit clearfix">
193
- <input type="submit" class="button-primary" value="Save Settings" />
194
- </p>
195
-
196
- </form>
197
-
198
- </div>
199
-
200
- <?php echo ob_get_clean();
201
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/bnfw-settings.php ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* ------------------------------------------------------------------------ *
3
+ * Register the Admin pages and load the scripts action
4
+ * ------------------------------------------------------------------------ */
5
+
6
+ // Sub-menu pages
7
+ function bnfw_admin_menu() {
8
+
9
+ // New Notifications Sub-menu
10
+ add_submenu_page(
11
+ 'edit.php?post_type=bnfw_notification',
12
+ __( 'Notification Settings', 'bnfw' ),
13
+ __( 'Settings', 'bnfw' ),
14
+ 'manage_options',
15
+ 'bnfw-settings',
16
+ 'bnfw_settings_page'
17
+ );
18
+ }
19
+ // Add the Admin pages to the WordPress menu
20
+ add_action( 'admin_menu', 'bnfw_admin_menu' );
21
+
22
+ /* ------------------------------------------------------------------------ *
23
+ * Menu Pages
24
+ * ------------------------------------------------------------------------ */
25
+
26
+ // Settings Page
27
+ function bnfw_settings_page() {
28
+ ob_start(); ?>
29
+
30
+ <div class="wrap">
31
+ <?php screen_icon(); ?>
32
+ <h2><?php _e( 'BNFW Settings', 'bnfw'); ?></h2>
33
+
34
+ <form method="post" action="options.php" class="bnfw-form">
35
+ <?php
36
+ settings_errors();
37
+ settings_fields('bnfw-settings');
38
+ do_settings_sections( 'bnfw-settings' );
39
+
40
+ submit_button( 'Save Settings' );
41
+ ?>
42
+ </form>
43
+ </div>
44
+
45
+ <?php echo ob_get_clean();
46
+ }
47
+
48
+ /* ------------------------------------------------------------------------ *
49
+ * Settings Page - Setting Registration
50
+ * ------------------------------------------------------------------------ */
51
+ function bnfw_general_options() {
52
+
53
+ // Set-up - General Options Section
54
+ add_settings_section (
55
+ 'bnfw_general_options_section', // Section ID
56
+ '', // Title above settings section
57
+ 'bnfw_general_options_callback', // Name of function that renders a description of the settings section
58
+ 'bnfw-settings' // Page to show on
59
+ );
60
+
61
+ // Add - Specify Name, Email, CC and BCC Checkbox
62
+ //add_settings_field (
63
+ //'bnfw_specify_email_headers', // Field ID
64
+ //__( 'Email Headers', 'bnfw' ), // Label to the left
65
+ //'bnfw_general_options_section_checkbox', // Name of function that renders options on the page
66
+ //'bnfw-settings', // Page to show on
67
+ //'bnfw_general_options_section', // Associate with which settings section?
68
+ //array(
69
+ //__( 'Do you want to specify a Name, Email, CC and BCC for each notification?', 'bnfw' )
70
+ //)
71
+ //);
72
+
73
+ // Suppress notifications for SPAM comments
74
+ add_settings_field (
75
+ 'bnfw_suppress_spam', // Field ID
76
+ __( 'Suppress SPAM comment notification', 'bnfw' ), // Label to the left
77
+ 'bnfw_suppress_spam_checkbox', // Name of function that renders options on the page
78
+ 'bnfw-settings', // Page to show on
79
+ 'bnfw_general_options_section', // Associate with which settings section?
80
+ array(
81
+ __( "Don't send notifications for comments marked as SPAM by Akismet", 'bnfw' )
82
+ )
83
+ );
84
+
85
+ //// Add - Minimum access role dropdown
86
+ //add_settings_field (
87
+ //'bnfw_choose_admin', // Field ID
88
+ //__( 'Set minimum role to have access to this plugin', 'bnfw' ), // Label to the left
89
+ //'bnfw_choose_admin_dropdown', // Name of function that renders options on the page
90
+ //'bnfw-settings', // Page to show on
91
+ //'bnfw_general_options_section' // Associate with which settings section?
92
+ //);
93
+
94
+ // Register - Specify Name, Email, CC and BCC Checkbox
95
+ //register_setting (
96
+ //'bnfw-settings',
97
+ //'bnfw_specify_email_headers'
98
+ //);
99
+
100
+ // Register - Suppress SPAM Checkbox
101
+ register_setting (
102
+ 'bnfw-settings',
103
+ 'bnfw_suppress_spam'
104
+ );
105
+
106
+ //// Register - Minimum access role dropdown
107
+ //register_setting (
108
+ //'bnfw-settings',
109
+ //'bnfw_choose_admin'
110
+ //);
111
+ }
112
+ add_action('admin_init', 'bnfw_general_options');
113
+
114
+ /* ------------------------------------------------------------------------ *
115
+ * Settings Page - Settings Section Callbacks
116
+ * ------------------------------------------------------------------------ */
117
+
118
+ function bnfw_general_options_callback() {}
119
+
120
+ /* ------------------------------------------------------------------------ *
121
+ * Settings Page - Settings Field Callbacks
122
+ * ------------------------------------------------------------------------ */
123
+
124
+ // Specify Name, Email, CC and BCC Checkbox
125
+ function bnfw_general_options_section_checkbox($args) {
126
+ echo '<input type="checkbox" id="bnfw_specify_email_headers" name="bnfw_specify_email_headers" value="1" ' . checked(1, get_option('bnfw_specify_email_headers'), false) . '/>';
127
+ echo '<label for="bnfw_specify_email_headers"> ' . $args[0] . '</label>';
128
+ }
129
+
130
+ /**
131
+ * Suppress SPAM checkbox.
132
+ *
133
+ * @since 1.0
134
+ */
135
+ function bnfw_suppress_spam_checkbox( $args ) {
136
+ ?>
137
+ <input type="checkbox" id="bnfw_suppress_spam" name="bnfw_suppress_spam" value="1" <?php checked( 1, get_option( 'bnfw_suppress_spam' ), true );?>>
138
+ <label for="bnfw_suppress_spam"><?php echo $args[0]; ?></label>
139
+ <?php
140
+ }
141
+
142
+ // Minimum access role dropdown
143
+ function bnfw_choose_admin_dropdown($args) {
144
+
145
+ echo '<select id="bnfw_choose_admin" name="bnfw_choose_admin">';
146
+ global $wp_roles;
147
+ $roles = $wp_roles->get_names();
148
+
149
+ foreach($roles as $role) {
150
+ echo '<option value="'.$role.'"' . selected(get_option('bnfw_choose_admin'), $role , false) . '>' . $role . '</option>';
151
+ }
152
+ echo '</select>';
153
+ }
154
+
155
+ /* ------------------------------------------------------------------------ *
156
+ * Notification Generator - Setting Registration
157
+ * ------------------------------------------------------------------------ */
158
+ function bnfw_generator_options() {
159
+
160
+ // Set-up - Generator Section
161
+ add_settings_section (
162
+ 'bnfw_generator_section', // Section ID
163
+ '', // Title above settings section
164
+ 'bnfw_generator_callback', // Name of function that renders a description of the settings section
165
+ 'bnfw-generator' // Page to show on
166
+ );
167
+
168
+ // Add - Notification Name Text
169
+ add_settings_field (
170
+ 'bnfw_notification_name', // Field ID
171
+ __( 'Notification Name', 'bnfw' ), // Label to the left
172
+ 'bnfw_generator_notification_name', // Name of function that renders options on the page
173
+ 'bnfw-generator', // Page to show on
174
+ 'bnfw_generator_section' // Associate with which settings section?
175
+ );
176
+
177
+ // Add - Notification User Roles
178
+ add_settings_field (
179
+ 'bnfw_user_roles', // Field ID
180
+ __( 'User Roles', 'bnfw' ), // Label to the left
181
+ 'bnfw_generator_user_roles', // Name of function that renders options on the page
182
+ 'bnfw-generator', // Page to show on
183
+ 'bnfw_generator_section' // Associate with which settings section?
184
+ );
185
+
186
+ // Add - Notification Users
187
+ add_settings_field (
188
+ 'bnfw_users', // Field ID
189
+ __( 'User', 'bnfw' ), // Label to the left
190
+ 'bnfw_generator_users', // Name of function that renders options on the page
191
+ 'bnfw-generator', // Page to show on
192
+ 'bnfw_generator_section' // Associate with which settings section?
193
+ );
194
+
195
+
196
+ // Register - All Generator Fields
197
+ register_setting ( 'bnfw-generator', 'bnfw_notification_name' );
198
+ register_setting ( 'bnfw-generator', 'bnfw_user_roles' );
199
+ register_setting ( 'bnfw-generator', 'bnfw_users' );
200
+ }
201
+ add_action('admin_init', 'bnfw_generator_options');
202
+
203
+ /* ------------------------------------------------------------------------ *
204
+ * Notification Generator - Form Section Callbacks
205
+ * ------------------------------------------------------------------------ */
206
+
207
+ function bnfw_generator_callback() {}
208
+
209
+ /* ------------------------------------------------------------------------ *
210
+ * Notification Generator - Field Callbacks
211
+ * ------------------------------------------------------------------------ */
212
+
213
+ function bnfw_generator_notification_name($args) {
214
+
215
+ $settings = get_option( 'bnfw_notification_name' );
216
+ // Show this field if page isn't bnfw-notifications.php
217
+ if (strcmp(basename($_SERVER['PHP_SELF']), "bnfw-notifications.php") != 0) {
218
+ echo '<input type="text" name="bnfw_notification_name" value="'. $settings .'">';
219
+ }
220
+ }
221
+
222
+ function bnfw_generator_user_roles($args) {
223
+
224
+ $settings = get_option( 'bnfw_user_roles' );
225
+
226
+ echo '<select multiple name="bnfw_user_roles" id="' . $settings . '" class="select2 populate">';
227
+ global $wp_roles;
228
+ $roles = $wp_roles->get_names();
229
+
230
+ echo '<option value="'.$settings.'" selected>' . $settings . '</option>';
231
+
232
+ foreach($roles as $role) {
233
+ echo '<option value="'.$role.'">' . $role . '</option>';
234
+ }
235
+ echo '</select>';
236
+ }
237
+
238
+
239
+ function bnfw_generator_users($args) {
240
+
241
+ $user_roles = get_option( 'bnfw_user_roles' );
242
+ $single_users = get_option( 'bnfw_users' );
243
+
244
+ // Enable Users Checkbox
245
+ echo '<div id="bnfw-users-enable" class="checkbox bnfw-field">
246
+ <label for="bnfw-users-enable-checkbox">',
247
+ __( 'Do you want to specify individual users from the user roles selected above?', 'bnfw' ),
248
+ '</label>
249
+ <input type="checkbox" id="bnfw-users-enable-checkbox">
250
+ </div>';
251
+
252
+ echo '<select multiple name="bnfw_users" id="' . $single_users . '" class="select2 populate">';
253
+ global $wp_roles;
254
+ $roles = $wp_roles->get_names();
255
+
256
+ echo '<option value="'.$single_users.'" selected>' . $single_users . '</option>';
257
+
258
+ foreach($roles as $role) {
259
+ echo '<option value="'.$role.'">' . $role . '</option>';
260
+ }
261
+ echo '</select>';
262
+ }
includes/admin/class-bnfw-notification.php ADDED
@@ -0,0 +1,581 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BNFW Notification.
4
+ *
5
+ * @since 1.0
6
+ */
7
+ class BNFW_Notification {
8
+
9
+ const POST_TYPE = 'bnfw_notification';
10
+ const META_KEY_PREFIX = 'bnfw_';
11
+
12
+ public function __construct() {
13
+
14
+ add_action( 'init', array( $this, 'register_post_type' ) );
15
+ add_action( 'do_meta_boxes', array( $this, 'remove_meta_boxes' ) );
16
+ add_action( 'add_meta_boxes_' . self::POST_TYPE, array( $this, 'add_meta_boxes' ) );
17
+ add_action( 'save_post', array( $this, 'save_meta_data' ) );
18
+ add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
19
+
20
+ // Custom row actions.
21
+ add_filter( 'post_row_actions', array( $this, 'custom_row_actions' ), 10, 2 );
22
+
23
+ // Custom columns
24
+ add_filter( sprintf( 'manage_%s_posts_columns', self::POST_TYPE ), array( $this, 'columns_header' ) );
25
+ add_action( sprintf( 'manage_%s_posts_custom_column', self::POST_TYPE ), array( $this, 'custom_column_row' ), 10, 2 );
26
+
27
+ // Enqueue scripts/styles and disables autosave for this post type.
28
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
29
+ }
30
+
31
+ /**
32
+ * Register bnfw_notification custom post type.
33
+ *
34
+ * @since 1.0
35
+ */
36
+ public function register_post_type() {
37
+ register_post_type( self::POST_TYPE, array(
38
+ 'labels' => array(
39
+ 'name' => __( 'Notifications', 'bnfw' ),
40
+ 'singular_name' => __( 'Notification', 'bnfw' ),
41
+ 'add_new' => __( 'Add New', 'bnfw' ),
42
+ 'menu_name' => __( 'Notifications', 'bnfw' ),
43
+ 'name_admin_bar' => __( 'Notifications', 'bnfw' ),
44
+ 'add_new_item' => __( 'Add New Notification', 'bnfw' ),
45
+ 'edit_item' => __( 'Edit Notification', 'bnfw' ),
46
+ 'new_item' => __( 'New Notification', 'bnfw' ),
47
+ 'view_item' => __( 'View Notification', 'bnfw' ),
48
+ 'search_items' => __( 'Search Notifications', 'bnfw' ),
49
+ 'not_found' => __( 'No Notifications found', 'bnfw' ),
50
+ 'not_found_in_trash' => __( 'No Notifications found in trash', 'bnfw' ),
51
+ 'all_items' => __( 'All Notifications', 'bnfw' )
52
+ ),
53
+ 'public' => false,
54
+ 'show_in_nav_menus' => true,
55
+ 'show_in_admin_bar' => true,
56
+ 'has_archive' => false,
57
+ 'show_ui' => true,
58
+ 'show_in_menu' => true,
59
+ 'menu_icon' => 'dashicons-email-alt',
60
+ 'menu_position' => 100,
61
+ 'rewrite' => false,
62
+ 'map_meta_cap' => false,
63
+ 'capabilities' => array(
64
+
65
+ // meta caps (don't assign these to roles)
66
+ 'edit_post' => 'manage_options',
67
+ 'read_post' => 'manage_options',
68
+ 'delete_post' => 'manage_options',
69
+
70
+ // primitive/meta caps
71
+ 'create_posts' => 'manage_options',
72
+
73
+ // primitive caps used outside of map_meta_cap()
74
+ 'edit_posts' => 'manage_options',
75
+ 'edit_others_posts' => 'manage_options',
76
+ 'publish_posts' => 'manage_options',
77
+ 'read_private_posts' => 'manage_options',
78
+
79
+ // primitive caps used inside of map_meta_cap()
80
+ 'read' => 'manage_options',
81
+ 'delete_posts' => 'manage_options',
82
+ 'delete_private_posts' => 'manage_options',
83
+ 'delete_published_posts' => 'manage_options',
84
+ 'delete_others_posts' => 'manage_options',
85
+ 'edit_private_posts' => 'manage_options',
86
+ 'edit_published_posts' => 'manage_options',
87
+ ),
88
+
89
+ // What features the post type supports.
90
+ 'supports' => array(
91
+ 'title',
92
+ ),
93
+ ));
94
+ }
95
+
96
+ /**
97
+ * Remove unwanted meta boxes.
98
+ *
99
+ * @since 1.0
100
+ */
101
+ public function remove_meta_boxes() {
102
+ remove_meta_box( 'submitdiv', self::POST_TYPE, 'side' );
103
+ }
104
+
105
+ /**
106
+ * Add meta box to the post editor screen.
107
+ *
108
+ * @since 1.0
109
+ */
110
+ public function add_meta_boxes() {
111
+ add_meta_box(
112
+ 'bnfw-post-notification', // Unique ID
113
+ esc_html__( 'Notification Settings', 'bnfw'), // Title
114
+ array( $this, 'render_settings_meta_box' ), // Callback function
115
+ self::POST_TYPE, // Admin page (or post type)
116
+ 'normal' // Context
117
+ );
118
+
119
+ add_meta_box(
120
+ 'bnfw_submitdiv',
121
+ __( 'Save Notification', 'bnfw' ),
122
+ array( $this, 'render_submitdiv' ),
123
+ self::POST_TYPE,
124
+ 'side',
125
+ 'core'
126
+ );
127
+ }
128
+
129
+ /**
130
+ * Render the settings meta box.
131
+ *
132
+ * @since 1.0
133
+ */
134
+ public function render_settings_meta_box( $post ) {
135
+ global $wp_roles;
136
+ wp_nonce_field(
137
+ // Action
138
+ self::POST_TYPE,
139
+
140
+ // Name.
141
+ self::POST_TYPE . '_nonce'
142
+ );
143
+
144
+ $setting = $this->read_settings( $post->ID );
145
+ ?>
146
+ <table class="form-table">
147
+ <tbody>
148
+ <tr valign="top">
149
+ <th scope="row">
150
+ <label for="notification"><?php _e( 'Notification For', 'bnfw' ); ?></label>
151
+ </th>
152
+ <td>
153
+ <select name="notification" id="notification" class="select2" data-placeholder="Select the notification type" style="width:75%">
154
+ <optgroup label="WordPress Defaults">
155
+ <option value="new-comment" <?php selected( 'new-comment', $setting['notification'] );?>><?php _e( 'New Comment / Awaiting Moderation', 'bnfw' ); ?></option>
156
+ <option value="new-trackback" <?php selected( 'new-trackback', $setting['notification'] );?>><?php _e( 'New Trackback', 'bnfw' );?></option>
157
+ <option value="new-pingback" <?php selected( 'new-pingback', $setting['notification'] );?>><?php _e( 'New Pingback', 'bnfw' );?></option>
158
+ <option value="user-password" <?php selected( 'user-password', $setting['notification'] );?>><?php _e( 'Password Reset', 'bnfw' );?></option>
159
+ <option value="new-user" <?php selected( 'new-user', $setting['notification'] );?>><?php _e( 'New User Registration', 'bnfw' );?></option>
160
+ </optgroup>
161
+ <optgroup label="Posts">
162
+ <option value="new-post" <?php selected( 'new-post', $setting['notification'] );?>><?php _e( 'New Post Published', 'bnfw' );?></option>
163
+ <option value="update-post" <?php selected( 'update-post', $setting['notification'] );?>><?php _e( 'Post Updated', 'bnfw' );?></option>
164
+ <!-- <option value="pending-post" <?php selected( 'pending-post', $setting['notification'] );?>>Post Pending Review</option> -->
165
+ <option value="new-category" <?php selected( 'new-category', $setting['notification'] );?>><?php _e( 'New Category', 'bnfw' ); ?></option>
166
+ </optgroup>
167
+ <?php
168
+ $types = get_post_types( array(
169
+ '_builtin' => false
170
+ ), 'names'
171
+ );
172
+
173
+ foreach ( $types as $type ) {
174
+ if ( self::POST_TYPE != $type ) {
175
+ ?>
176
+ <optgroup label="<?php _e( 'Custom Post Type - ', 'bnfw' ); echo $type; ?>">
177
+ <option value="new-<?php echo $type; ?>" <?php selected( 'new-' . $type, $setting['notification'] );?>><?php echo __( 'New ', 'bnfw' ), $type; ?></option>
178
+ <option value="update-<?php echo $type; ?>" <?php selected( 'update-' . $type, $setting['notification'] );?>><?php echo __( 'Update ', 'bnfw' ), $type; ?></option>
179
+ <-- <option value="pending-<?php echo $type; ?>" <?php selected( 'pending-' . $type, $setting['notification'] );?>><?php echo $type, __( ' Pending Review', 'bnfw' ); ?></option> -->
180
+ </optgroup>
181
+ <?php
182
+ }
183
+ }
184
+ ?>
185
+ <optgroup label="<?php _e( 'Custom Taxonomy', 'bnfw' );?>">
186
+ <option value="new-term" <?php selected( 'new-term', $setting['notification'] );?>><?php _e( 'New Term', 'bnfw' ); ?></option>
187
+ </optgroup>
188
+ </select>
189
+ </td>
190
+ </tr>
191
+ <?php
192
+ if ( get_option( 'bnfw_specify_email_headers', 0 ) == 1 ) {
193
+ ?>
194
+ <tr valign="top">
195
+ <th scope="row">
196
+ <?php _e( 'From Name and Email', 'bnfw' ); ?>
197
+ </th>
198
+ <td>
199
+ <input type="text" name="from-name" value="<?php echo $setting['from-name']; ?>" placeholder="Site Name" style="width:37%">
200
+ <input type="email" name="from-email" value="<?php echo $setting['from-email']; ?>" placeholder="Admin Email" style="width:37%">
201
+ </td>
202
+ </tr>
203
+
204
+ <tr valign="top">
205
+ <th scope="row">
206
+ <?php _e( 'CC', 'bnfw' ); ?>
207
+ </th>
208
+
209
+ <td>
210
+ <?php $this->render_roles_dropdown( 'cc-roles', $setting['cc-roles'] ); ?>
211
+ <input type="email" name="cc-email" value="<?php echo $setting['cc-email']; ?>" placeholder="Additional email addresses" style="width:50%;">
212
+ </td>
213
+ </tr>
214
+
215
+ <tr valign="top">
216
+ <th scope="row">
217
+ <?php _e( 'BCC', 'bnfw' ); ?>
218
+ </th>
219
+
220
+ <td>
221
+ <?php $this->render_roles_dropdown( 'bcc-roles', $setting['bcc-roles'] ); ?>
222
+ <input type="email" name="bcc-email" value="<?php echo $setting['bcc-email']; ?>" placeholder="Additional email addresses" style="width:50%;">
223
+ </td>
224
+ </tr>
225
+ <?php
226
+ }
227
+ ?>
228
+ <tr valign="top">
229
+ <th scope="row">
230
+ <?php _e( 'User Roles', 'bnfw' ); ?>
231
+ </th>
232
+ <?php
233
+ $roles_style = '';
234
+ $user_style = 'display:none';
235
+
236
+ if ( count( $setting['users'] ) > 0 ) {
237
+ $roles_style = 'display:none';
238
+ $user_style = '';
239
+ }
240
+ ?>
241
+ <td>
242
+ <div id="bnfw_user_role_container" style="<?php echo $roles_style; ?>">
243
+ <select multiple name="user-roles[]" class="select2" data-placeholder="Select User Role" style="width:75%">
244
+ <?php
245
+ $roles = $wp_roles->get_names();
246
+
247
+ foreach ( $roles as $role ) {
248
+ $selected = selected( true, in_array( $role, $setting['user-roles'] ), false );
249
+ echo '<option value="', $role, '" ', $selected, '>', $role, '</option>';
250
+ }
251
+ ?>
252
+ </select><br>
253
+ <a id="bnfw_user_role_toggle" href="#"><?php _e( 'Define individual users instead', 'bnfw' );?></a>
254
+ </div>
255
+
256
+ <div id="bnfw_user_container" style="<?php echo $user_style; ?>">
257
+ <select multiple name="users[]" class="select2" data-placeholder="Select Users" style="width:75%">
258
+ <?php
259
+ $users = get_users( array (
260
+ 'order_by' => 'email',
261
+ ) );
262
+
263
+ foreach ( $users as $user ) {
264
+ $selected = selected( true, in_array( $user->ID, $setting['users'] ), false );
265
+ echo '<option value="', $user->ID, '" ', $selected, '>', $user->user_login, '</option>';
266
+ }
267
+ ?>
268
+ </select><br>
269
+ <a id="bnfw_user_toggle" href="#"><?php _e( 'Define user roles instead', 'bnfw' );?></a>
270
+ </div>
271
+ </td>
272
+ </tr>
273
+
274
+ <tr valign="top">
275
+ <th scope="row">
276
+ <?php _e( 'Subject', 'bnfw' ); ?>
277
+ </th>
278
+ <td>
279
+ <input type="text" name="subject" value="<?php echo $setting['subject']; ?>" style="width:75%;">
280
+ </td>
281
+ </tr>
282
+
283
+ <tr valign="top">
284
+ <th scope="row">
285
+ <?php _e( 'Message Body', 'bnfw' ); ?>
286
+ </th>
287
+ <td>
288
+ <textarea name="message" rows="10" style="width:75%;"><?php echo esc_textarea( $setting['message'] ); ?></textarea>
289
+ </td>
290
+ </tr>
291
+ </tbody>
292
+ </table>
293
+ <?php
294
+ }
295
+
296
+ /**
297
+ * Render user roles dropdown.
298
+ *
299
+ * @since 1.0
300
+ */
301
+ private function render_roles_dropdown( $field, $value, $multiple = '', $width = 25 ) {
302
+ global $wp_roles;
303
+ ?>
304
+ <select <?php echo $multiple; ?> name="<?php echo $field; if( !empty( $multiple ) ) echo '[]';?>" id="<?php echo $field;?>" class="select2" data-placeholder="Select User Role" style="width:<?php echo $width; ?>%">
305
+ <?php
306
+ $roles = $wp_roles->get_names();
307
+
308
+ foreach( $roles as $role ) {
309
+ if( empty( $multiple ) ) {
310
+ $selected = selected( $value, $role, false );
311
+ } else {
312
+ $selected = selected( true, in_array( $role, $value ), false );
313
+ }
314
+ echo '<option value="', $role, '" ', $selected, '>', $role, '</option>';
315
+ }
316
+ ?>
317
+ </select>
318
+ <?php
319
+ }
320
+
321
+ /**
322
+ * Enqueue scripts.
323
+ *
324
+ * @since 1.0
325
+ */
326
+ public function enqueue_scripts() {
327
+ if ( self::POST_TYPE === get_post_type() ) {
328
+ wp_dequeue_script( 'autosave' );
329
+
330
+ wp_enqueue_style( 'select2', '//cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.css', array(), '3.5.2' );
331
+ wp_enqueue_script( 'select2', '//cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.js', array( 'jquery' ), '3.5.2', true );
332
+ wp_enqueue_script( 'bnfw', plugins_url( '../assets/js/bnfw.js', dirname( __FILE__ ) ), array( 'jquery' ), '0.1', true );
333
+ }
334
+ }
335
+
336
+ /**
337
+ * Save the meta box's post metadata.
338
+ *
339
+ * @since 1.0
340
+ * @param int $post_id The ID of the post being saved.
341
+ */
342
+ public function save_meta_data( $post_id ) {
343
+
344
+ if ( self::POST_TYPE !== get_post_type( $post_id ) ) {
345
+ return;
346
+ }
347
+
348
+ // Check nonce.
349
+ if ( empty( $_POST[ self::POST_TYPE . '_nonce' ] ) ) {
350
+ return;
351
+ }
352
+
353
+ // Verify nonce.
354
+ if ( ! wp_verify_nonce( $_POST[ self::POST_TYPE . '_nonce' ], self::POST_TYPE ) ) {
355
+ return;
356
+ }
357
+
358
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
359
+ return;
360
+ }
361
+
362
+ if ( ! current_user_can( 'manage_options' ) ) {
363
+ return;
364
+ }
365
+
366
+ $setting = array(
367
+ 'notification' => $_POST['notification'],
368
+ 'subject' => sanitize_text_field( $_POST['subject'] ),
369
+ 'message' => $_POST['message'],
370
+ );
371
+
372
+ if ( isset( $_POST['user-roles'] ) ) {
373
+ $setting['user-roles'] = $_POST['user-roles'];
374
+ $setting['users'] = array();
375
+ } else {
376
+ $setting['user-roles'] = array();
377
+ $setting['users'] = $_POST['users'];
378
+ }
379
+
380
+ if ( get_option( 'bnfw_specify_email_headers', 0 ) == 1 ) {
381
+ $setting['from-name'] = sanitize_text_field( $_POST['from-name'] );
382
+ $setting['from-email'] = sanitize_email( $_POST['from-email'] );
383
+ $setting['cc-email'] = sanitize_email( $_POST['cc-email'] );
384
+ $setting['cc-roles'] = $_POST['cc-roles'];
385
+ $setting['bcc-email'] = sanitize_email( $_POST['bcc-email'] );
386
+ $setting['bcc-roles'] = $_POST['bcc-roles'];
387
+ }
388
+
389
+ $this->save_settings( $post_id, $setting );
390
+ }
391
+
392
+ /**
393
+ * Save settings in post meta.
394
+ *
395
+ * @since 1.0
396
+ * @access private
397
+ */
398
+ private function save_settings( $post_id, $setting ) {
399
+ foreach( $setting as $key => $value ) {
400
+ update_post_meta( $post_id, self::META_KEY_PREFIX . $key, $value );
401
+ }
402
+ }
403
+
404
+ /**
405
+ * Read settings from post meta.
406
+ *
407
+ * @since 1.0
408
+ */
409
+ public function read_settings( $post_id ) {
410
+ $setting = array();
411
+ $default = array(
412
+ 'notification' => '',
413
+ 'from-name' => '',
414
+ 'from-email' => '',
415
+ 'cc-email' => '',
416
+ 'cc-roles' => '',
417
+ 'bcc-email' => '',
418
+ 'bcc-roles' => '',
419
+ 'user-roles' => array(),
420
+ 'users' => array(),
421
+ 'subject' => '',
422
+ 'message' => '',
423
+ );
424
+
425
+ foreach( $default as $key => $default_value ) {
426
+ $value = get_post_meta( $post_id, self::META_KEY_PREFIX . $key, true );
427
+ if ( ! empty( $value ) ) {
428
+ $setting[ $key ] = $value;
429
+ } else {
430
+ $setting[ $key ] = $default_value;
431
+ }
432
+ }
433
+
434
+ return $setting;
435
+ }
436
+
437
+ /**
438
+ * Change the post updated message for notification post type.
439
+ *
440
+ * @since 1.0
441
+ */
442
+ public function post_updated_messages( $messages ) {
443
+ $messages[ self::POST_TYPE ] = array_fill( 0, 11, __( 'Notification saved.', 'bnfw' ) );
444
+
445
+ return $messages;
446
+ }
447
+
448
+ /**
449
+ * Render submit div meta box.
450
+ *
451
+ * @since 1.0
452
+ */
453
+ public function render_submitdiv() {
454
+ global $post;
455
+ ?>
456
+ <div class="submitbox" id="submitpost">
457
+
458
+ <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
459
+ <div style="display:none;">
460
+ <?php submit_button( __( 'Save' ), 'button', 'save' ); ?>
461
+ </div>
462
+
463
+ <?php // Always publish. ?>
464
+ <input type="hidden" name="post_status" id="hidden_post_status" value="publish">
465
+
466
+ <div id="major-publishing-actions">
467
+
468
+ <div id="delete-action">
469
+ <?php
470
+ if ( ! EMPTY_TRASH_DAYS ) {
471
+ $delete_text = __( 'Delete Permanently', 'bnfw' );
472
+ } else {
473
+ $delete_text = __( 'Move to Trash', 'bnfw' );
474
+ }
475
+ ?>
476
+ <a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>"><?php echo $delete_text; ?></a>
477
+ </div>
478
+
479
+ <div id="publishing-action">
480
+ <span class="spinner"></span>
481
+ <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Save' ) ?>">
482
+ <input name="save" type="submit" class="button button-primary button-large" id="publish" accesskey="p" value="<?php esc_attr_e('Save' ) ?>">
483
+ </div>
484
+ <div class="clear"></div>
485
+
486
+ </div>
487
+ <!-- #major-publishing-actions -->
488
+
489
+ <div class="clear"></div>
490
+ </div>
491
+ <!-- #submitpost -->
492
+ <?php
493
+ }
494
+
495
+ /**
496
+ * Get notifications based on type.
497
+ *
498
+ * @since 1.0
499
+ */
500
+ public function get_notifications( $type ) {
501
+ $args = array(
502
+ 'post_type' => self::POST_TYPE,
503
+ 'meta_query' => array(
504
+ array(
505
+ 'key' => self::META_KEY_PREFIX . 'notification',
506
+ 'value' => $type,
507
+ ),
508
+ ),
509
+ );
510
+
511
+ $wp_query = new WP_Query();
512
+ $posts = $wp_query->query( $args );
513
+ return $posts;
514
+ }
515
+
516
+ /**
517
+ * Custom columns for this post type.
518
+ *
519
+ * @param array $columns
520
+ * @return array
521
+ *
522
+ * @since 1.0
523
+ * @filter manage_{post_type}_posts_columns
524
+ */
525
+ public function columns_header( $columns ) {
526
+ $columns['subject'] = __( 'Subject', 'bnfw' );
527
+ $columns['user-roles'] = __( 'User Roles', 'bnfw' );
528
+
529
+ return $columns;
530
+ }
531
+
532
+ /**
533
+ * Custom column appears in each row.
534
+ *
535
+ * @param string $column Column name
536
+ * @param int $post_id Post ID
537
+ *
538
+ * @since 1.0
539
+ * @action manage_{post_type}_posts_custom_column
540
+ */
541
+ public function custom_column_row( $column, $post_id ) {
542
+ $setting = $this->read_settings( $post_id );
543
+ switch ( $column ) {
544
+ case 'subject':
545
+ echo ! empty( $setting['subject'] ) ? $setting['subject'] : '';
546
+ break;
547
+ case 'user-roles':
548
+ if ( ! empty( $setting['users'] ) ) {
549
+ $users = array();
550
+ $user_query = new WP_User_Query( array( 'include' => $setting['users'] ) );
551
+ foreach ( $user_query->results as $user ) {
552
+ $users[] = $user->user_login;
553
+ }
554
+ echo implode( ', ', $users );
555
+ } else {
556
+ echo ! empty( $setting['user-roles'] ) ? implode( ', ', $setting['user-roles'] ) : '';
557
+ }
558
+ break;
559
+ }
560
+ }
561
+
562
+ /**
563
+ * Custom row actions for this post type.
564
+ *
565
+ * @param array $actions
566
+ * @return array
567
+ *
568
+ * @since 1.0
569
+ * @filter post_row_actions
570
+ */
571
+ public function custom_row_actions( $actions ) {
572
+ $post = get_post();
573
+
574
+ if ( self::POST_TYPE === get_post_type( $post ) ) {
575
+ unset( $actions['inline hide-if-no-js'] );
576
+ unset( $actions['view'] );
577
+ }
578
+
579
+ return $actions;
580
+ }
581
+ }
includes/bnfw_engine.php DELETED
@@ -1,617 +0,0 @@
1
- <?php
2
-
3
- /*
4
- Logic to retrieve to whom the notif should be sent
5
- */
6
- function bnfw_get_recipients_for_type($notification_type){
7
-
8
- $bnfw_options = get_option('bnfw_settings');
9
-
10
- $recipients = '';
11
-
12
- if ( !isset( $wp_roles ) )
13
- $wp_roles = new WP_Roles();
14
-
15
- foreach ($wp_roles->roles as $field => $role) {
16
-
17
- if($bnfw_options[$notification_type.'-'.$field] === "1"){
18
-
19
- $users = get_users('role='.$field);
20
-
21
- foreach ($users as $the_email) {
22
- $recipients .= $the_email->user_email . ',';
23
- }
24
-
25
- }
26
- }
27
-
28
- return $recipients;
29
- }
30
-
31
- function bnfw_launch_payload($recipients, $subject, $payload){
32
-
33
- $headers[] = 'content-type: text/html';
34
- $headers[] = 'Bcc: '.$recipients;
35
- $headers[] = 'From: '.get_option('blogname').' <'.get_option('admin_email').'>';
36
- wp_mail("", $subject, $payload, $headers);
37
-
38
- }
39
-
40
- /*
41
- * Subject getters -----------------------------------------------
42
- */
43
-
44
- function bnfw_get_subject_for_publish_post($the_post){
45
-
46
- $bnfw_options = get_option('bnfw_custom_email_settings');
47
- $user_info = get_userdata($the_post->post_author);
48
-
49
- $message_body = $bnfw_options['payload-subject-publish_post'];
50
-
51
- $message_body = str_replace("[ID]", $the_post->ID, $message_body);
52
- $message_body = str_replace("[post_author]", $the_post->post_author, $message_body);
53
- $message_body = str_replace("[post_date]", $the_post->post_date, $message_body);
54
- $message_body = str_replace("[post_date_gmt]", $the_post->post_date_gmt, $message_body);
55
- $message_body = str_replace("[post_content]", $the_post->post_content, $message_body);
56
- $message_body = str_replace("[post_title]", $the_post->post_title, $message_body);
57
-
58
- $category_list = "";
59
-
60
- foreach ($the_post->post_category as $category_int){
61
-
62
- $temp_term = get_term_by('id', $category_int, 'category'); $category_list .= $temp_term->name . ", ";
63
-
64
- }
65
-
66
- $message_body = str_replace("[post_category]", $category_list, $message_body);
67
- $message_body = str_replace("[post_excerpt]", implode(", ", $the_post->post_excerpt), $message_body);
68
- $message_body = str_replace("[post_status]", $the_post->post_status, $message_body);
69
- $message_body = str_replace("[comment_status]", $the_post->comment_status, $message_body);
70
- $message_body = str_replace("[ping_status]", $the_post->ping_status, $message_body);
71
- $message_body = str_replace("[post_password]", $the_post->post_password, $message_body);
72
- $message_body = str_replace("[post_name]", $the_post->post_name, $message_body);
73
- $message_body = str_replace("[to_ping]", $the_post->to_ping, $message_body);
74
- $message_body = str_replace("[pinged]", implode(", ", $the_post->pinged), $message_body);
75
- $message_body = str_replace("[post_modified]", $the_post->post_modified, $message_body);
76
- $message_body = str_replace("[post_modified_gmt]", $the_post->post_modified_gmt, $message_body);
77
- $message_body = str_replace("[post_content_filtered]", $the_post->post_content_filtered, $message_body);
78
- $message_body = str_replace("[post_parent]", $the_post->post_parent, $message_body);
79
- $message_body = str_replace("[guid]", $the_post->guid, $message_body);
80
- $message_body = str_replace("[menu_order]", $the_post->menu_order, $message_body);
81
- $message_body = str_replace("[post_type]", $the_post->post_type, $message_body);
82
- $message_body = str_replace("[post_mime_type]", $the_post->post_mime_type, $message_body);
83
- $message_body = str_replace("[comment_count]", $the_post->comment_count, $message_body);
84
-
85
- $message_body = str_replace("[user_login]", $user_info->user_login, $message_body);
86
- $message_body = str_replace("[user_nicename]", $user_info->user_nicename, $message_body);
87
- $message_body = str_replace("[user_email]", $user_info->user_email, $message_body);
88
- $message_body = str_replace("[user_url]", $user_info->user_url, $message_body);
89
- $message_body = str_replace("[user_registered]", $user_info->user_registered, $message_body);
90
- $message_body = str_replace("[display_name]", $user_info->display_name, $message_body);
91
- $message_body = str_replace("[user_firstname]", $user_info->user_firstname, $message_body);
92
- $message_body = str_replace("[user_lastname]", $user_info->user_lastname, $message_body);
93
- $message_body = str_replace("[nickname]", $user_info->nickname, $message_body);
94
- $message_body = str_replace("[user_description]", $user_info->user_description, $message_body);
95
- $message_body = str_replace("[wp_capabilities]", implode(", ", $user_info->wp_capabilities), $message_body);
96
- $message_body = str_replace("[admin_color]", $user_info->admin_color, $message_body);
97
- $message_body = str_replace("[closedpostboxes_page]", $user_info->closedpostboxes_page, $message_body);
98
- $message_body = str_replace("[primary_blog]", implode(", ", $user_info->primary_blog), $message_body);
99
- $message_body = str_replace("[rich_editing]", $user_info->rich_editing, $message_body);
100
- $message_body = str_replace("[source_domain]", $user_info->source_domain, $message_body);
101
-
102
- return $message_body;
103
-
104
- }
105
-
106
- function bnfw_get_subject_for_term_created($the_term){
107
-
108
- $bnfw_options = get_option('bnfw_custom_email_settings');
109
- $message_body = $bnfw_options['payload-subject-create_term'];
110
-
111
- $message_body = str_replace("[slug]", $the_term->slug, $message_body);
112
- $message_body = str_replace("[name]", $the_term->name, $message_body);
113
- $message_body = str_replace("[description]", $the_term->description, $message_body);
114
-
115
- return $message_body;
116
- }
117
-
118
-
119
- function bnfw_get_subject_for_comment_post($the_comment){
120
-
121
- $bnfw_options = get_option('bnfw_custom_email_settings');
122
- $message_body = $bnfw_options['payload-subject-comment_post'];
123
- $user_info = get_userdata($the_comment->comment_author);
124
- $the_post = get_post($the_comment->comment_post_ID);
125
-
126
- $message_body = str_replace("[comment_ID]", $the_comment->comment_ID, $message_body);
127
- $message_body = str_replace("[comment_post_ID]", $the_comment->comment_post_ID, $message_body);
128
- $message_body = str_replace("[comment_author]", $the_comment->comment_author, $message_body);
129
- $message_body = str_replace("[comment_author_email]", $the_comment->comment_author_email, $message_body);
130
- $message_body = str_replace("[comment_author_url]", $the_comment->comment_author_url, $message_body);
131
- $message_body = str_replace("[comment_author_IP]", $the_comment->comment_author_IP, $message_body);
132
- $message_body = str_replace("[comment_date]", $the_comment->comment_date, $message_body);
133
- $message_body = str_replace("[comment_date_gmt]", $the_comment->comment_date_gmt, $message_body);
134
- $message_body = str_replace("[comment_content]", $the_comment->comment_content, $message_body);
135
- $message_body = str_replace("[comment_karma]", $the_comment->comment_karma, $message_body);
136
- $message_body = str_replace("[comment_approved]", str_replace(array("0", "1", "spam"), array("awaiting moderation", "approved", "spam"), $the_comment->comment_approved), $message_body);
137
- $message_body = str_replace("[comment_agent]", $the_comment->comment_agent, $message_body);
138
- $message_body = str_replace("[comment_type]", $the_comment->comment_type, $message_body);
139
- $message_body = str_replace("[comment_parent]", $the_comment->comment_parent, $message_body);
140
- $message_body = str_replace("[user_id]", $the_comment->user_id, $message_body);
141
-
142
- $message_body = str_replace("[user_login]", $user_info->user_login, $message_body);
143
- $message_body = str_replace("[user_nicename]", $user_info->user_nicename, $message_body);
144
- $message_body = str_replace("[user_email]", $user_info->user_email, $message_body);
145
- $message_body = str_replace("[user_url]", $user_info->user_url, $message_body);
146
- $message_body = str_replace("[user_registered]", $user_info->user_registered, $message_body);
147
- $message_body = str_replace("[display_name]", $user_info->display_name, $message_body);
148
- $message_body = str_replace("[user_firstname]", $user_info->user_firstname, $message_body);
149
- $message_body = str_replace("[user_lastname]", $user_info->user_lastname, $message_body);
150
- $message_body = str_replace("[nickname]", $user_info->nickname, $message_body);
151
- $message_body = str_replace("[user_description]", $user_info->user_description, $message_body);
152
- $message_body = str_replace("[wp_capabilities]", implode(", ", $user_info->wp_capabilities), $message_body);
153
- $message_body = str_replace("[admin_color]", $user_info->admin_color, $message_body);
154
- $message_body = str_replace("[closedpostboxes_page]", $user_info->closedpostboxes_page, $message_body);
155
- $message_body = str_replace("[primary_blog]", implode(", ", $user_info->primary_blog), $message_body);
156
- $message_body = str_replace("[rich_editing]", $user_info->rich_editing, $message_body);
157
- $message_body = str_replace("[source_domain]", $user_info->source_domain, $message_body);
158
-
159
- $message_body = str_replace("[post_author]", $the_post->post_author, $message_body);
160
- $message_body = str_replace("[post_date]", $the_post->post_date, $message_body);
161
- $message_body = str_replace("[post_date_gmt]", $the_post->post_date_gmt, $message_body);
162
- $message_body = str_replace("[post_content]", $the_post->post_content, $message_body);
163
- $message_body = str_replace("[post_title]", $the_post->post_title, $message_body);
164
- $category_list = "";
165
-
166
- foreach ($the_post->post_category as $category_int){
167
-
168
- $temp_term = get_term_by('id', $category_int, 'category'); $category_list .= $temp_term->name . ", ";
169
-
170
- }
171
-
172
- $message_body = str_replace("[post_category]", $category_list, $message_body);
173
- $message_body = str_replace("[post_excerpt]", implode(", ", $the_post->post_excerpt), $message_body);
174
- $message_body = str_replace("[post_status]", $the_post->post_status, $message_body);
175
- $message_body = str_replace("[comment_status]", $the_post->comment_status, $message_body);
176
- $message_body = str_replace("[ping_status]", $the_post->ping_status, $message_body);
177
- $message_body = str_replace("[post_password]", $the_post->post_password, $message_body);
178
- $message_body = str_replace("[post_name]", $the_post->post_name, $message_body);
179
- $message_body = str_replace("[to_ping]", $the_post->to_ping, $message_body);
180
- $message_body = str_replace("[pinged]", implode(", ", $the_post->pinged), $message_body);
181
- $message_body = str_replace("[post_modified]", $the_post->post_modified, $message_body);
182
- $message_body = str_replace("[post_modified_gmt]", $the_post->post_modified_gmt, $message_body);
183
- $message_body = str_replace("[post_content_filtered]", $the_post->post_content_filtered, $message_body);
184
- $message_body = str_replace("[post_parent]", $the_post->post_parent, $message_body);
185
- $message_body = str_replace("[guid]", $the_post->guid, $message_body);
186
- $message_body = str_replace("[menu_order]", $the_post->menu_order, $message_body);
187
- $message_body = str_replace("[post_type]", $the_post->post_type, $message_body);
188
- $message_body = str_replace("[post_mime_type]", $the_post->post_mime_type, $message_body);
189
- $message_body = str_replace("[comment_count]", $the_post->comment_count, $message_body);
190
-
191
- return $message_body;
192
- }
193
-
194
- function bnfw_get_subject_for_user_register($user_info){
195
- $bnfw_options = get_option('bnfw_custom_email_settings');
196
- $message_body = $bnfw_options['payload-subject-user_register'];
197
-
198
- $message_body = str_replace("[ID]", $user_info->ID, $message_body);
199
- $message_body = str_replace("[user_login]", $user_info->user_login, $message_body);
200
- $message_body = str_replace("[user_nicename]", $user_info->user_nicename, $message_body);
201
- $message_body = str_replace("[user_email]", $user_info->user_email, $message_body);
202
- $message_body = str_replace("[user_url]", $user_info->user_url, $message_body);
203
- $message_body = str_replace("[user_registered]", $user_info->user_registered, $message_body);
204
- $message_body = str_replace("[display_name]", $user_info->display_name, $message_body);
205
- $message_body = str_replace("[user_firstname]", $user_info->user_firstname, $message_body);
206
- $message_body = str_replace("[user_lastname]", $user_info->user_lastname, $message_body);
207
- $message_body = str_replace("[nickname]", $user_info->nickname, $message_body);
208
- $message_body = str_replace("[user_description]", $user_info->user_description, $message_body);
209
- $message_body = str_replace("[wp_capabilities]", implode(", ", $user_info->wp_capabilities), $message_body);
210
- $message_body = str_replace("[admin_color]", $user_info->admin_color, $message_body);
211
- $message_body = str_replace("[closedpostboxes_page]", $user_info->closedpostboxes_page, $message_body);
212
- $message_body = str_replace("[primary_blog]", implode(", ", $user_info->primary_blog), $message_body);
213
- $message_body = str_replace("[rich_editing]", $user_info->rich_editing, $message_body);
214
- $message_body = str_replace("[source_domain]", $user_info->source_domain, $message_body);
215
-
216
- return $message_body;
217
- }
218
-
219
- function bnfw_get_subject_for_trackback_post($the_comment){
220
-
221
- $bnfw_options = get_option('bnfw_custom_email_settings');
222
- $message_body = $bnfw_options['payload-subject-trackback_post'];
223
- $user_info = get_userdata($the_comment->comment_author);
224
-
225
- $message_body = str_replace("[comment_ID]", $the_comment->comment_ID, $message_body);
226
- $message_body = str_replace("[comment_post_ID]", $the_comment->comment_post_ID, $message_body);
227
- $message_body = str_replace("[comment_author]", $the_comment->comment_author, $message_body);
228
- $message_body = str_replace("[comment_author_email]", $the_comment->comment_author_email, $message_body);
229
- $message_body = str_replace("[comment_author_url]", $the_comment->comment_author_url, $message_body);
230
- $message_body = str_replace("[comment_author_IP]", $the_comment->comment_author_IP, $message_body);
231
- $message_body = str_replace("[comment_date]", $the_comment->comment_date, $message_body);
232
- $message_body = str_replace("[comment_date_gmt]", $the_comment->comment_date_gmt, $message_body);
233
- $message_body = str_replace("[comment_content]", $the_comment->comment_content, $message_body);
234
- $message_body = str_replace("[comment_karma]", $the_comment->comment_karma, $message_body);
235
- $message_body = str_replace("[comment_approved]", str_replace(array("0", "1", "spam"), array("awaiting moderation", "approved", "spam"), $the_comment->comment_approved), $message_body);
236
- $message_body = str_replace("[comment_agent]", $the_comment->comment_agent, $message_body);
237
- $message_body = str_replace("[comment_type]", $the_comment->comment_type, $message_body);
238
- $message_body = str_replace("[comment_parent]", $the_comment->comment_parent, $message_body);
239
- $message_body = str_replace("[user_id]", $the_comment->user_id, $message_body);
240
-
241
- $message_body = str_replace("[user_login]", $user_info->user_login, $message_body);
242
- $message_body = str_replace("[user_nicename]", $user_info->user_nicename, $message_body);
243
- $message_body = str_replace("[user_email]", $user_info->user_email, $message_body);
244
- $message_body = str_replace("[user_url]", $user_info->user_url, $message_body);
245
- $message_body = str_replace("[user_registered]", $user_info->user_registered, $message_body);
246
- $message_body = str_replace("[display_name]", $user_info->display_name, $message_body);
247
- $message_body = str_replace("[user_firstname]", $user_info->user_firstname, $message_body);
248
- $message_body = str_replace("[user_lastname]", $user_info->user_lastname, $message_body);
249
- $message_body = str_replace("[nickname]", $user_info->nickname, $message_body);
250
- $message_body = str_replace("[user_description]", $user_info->user_description, $message_body);
251
- $message_body = str_replace("[wp_capabilities]", implode(", ", $user_info->wp_capabilities), $message_body);
252
- $message_body = str_replace("[admin_color]", $user_info->admin_color, $message_body);
253
- $message_body = str_replace("[closedpostboxes_page]", $user_info->closedpostboxes_page, $message_body);
254
- $message_body = str_replace("[primary_blog]", implode(", ", $user_info->primary_blog), $message_body);
255
- $message_body = str_replace("[rich_editing]", $user_info->rich_editing, $message_body);
256
- $message_body = str_replace("[source_domain]", $user_info->source_domain, $message_body);
257
-
258
- return $message_body;
259
- }
260
-
261
- function bnfw_get_subject_for_pingback_post($the_comment){
262
- $bnfw_options = get_option('bnfw_custom_email_settings');
263
- $message_body = $bnfw_options['payload-subject-pingback_post'];
264
- $user_info = get_userdata($the_comment->comment_author);
265
-
266
- $message_body = str_replace("[comment_ID]", $the_comment->comment_ID, $message_body);
267
- $message_body = str_replace("[comment_post_ID]", $the_comment->comment_post_ID, $message_body);
268
- $message_body = str_replace("[comment_author]", $the_comment->comment_author, $message_body);
269
- $message_body = str_replace("[comment_author_email]", $the_comment->comment_author_email, $message_body);
270
- $message_body = str_replace("[comment_author_url]", $the_comment->comment_author_url, $message_body);
271
- $message_body = str_replace("[comment_author_IP]", $the_comment->comment_author_IP, $message_body);
272
- $message_body = str_replace("[comment_date]", $the_comment->comment_date, $message_body);
273
- $message_body = str_replace("[comment_date_gmt]", $the_comment->comment_date_gmt, $message_body);
274
- $message_body = str_replace("[comment_content]", $the_comment->comment_content, $message_body);
275
- $message_body = str_replace("[comment_karma]", $the_comment->comment_karma, $message_body);
276
- $message_body = str_replace("[comment_approved]", str_replace(array("0", "1", "spam"), array("awaiting moderation", "approved", "spam"), $the_comment->comment_approved), $message_body);
277
- $message_body = str_replace("[comment_agent]", $the_comment->comment_agent, $message_body);
278
- $message_body = str_replace("[comment_type]", $the_comment->comment_type, $message_body);
279
- $message_body = str_replace("[comment_parent]", $the_comment->comment_parent, $message_body);
280
- $message_body = str_replace("[user_id]", $the_comment->user_id, $message_body);
281
-
282
- $message_body = str_replace("[user_login]", $user_info->user_login, $message_body);
283
- $message_body = str_replace("[user_nicename]", $user_info->user_nicename, $message_body);
284
- $message_body = str_replace("[user_email]", $user_info->user_email, $message_body);
285
- $message_body = str_replace("[user_url]", $user_info->user_url, $message_body);
286
- $message_body = str_replace("[user_registered]", $user_info->user_registered, $message_body);
287
- $message_body = str_replace("[display_name]", $user_info->display_name, $message_body);
288
- $message_body = str_replace("[user_firstname]", $user_info->user_firstname, $message_body);
289
- $message_body = str_replace("[user_lastname]", $user_info->user_lastname, $message_body);
290
- $message_body = str_replace("[nickname]", $user_info->nickname, $message_body);
291
- $message_body = str_replace("[user_description]", $user_info->user_description, $message_body);
292
- $message_body = str_replace("[wp_capabilities]", implode(", ", $user_info->wp_capabilities), $message_body);
293
- $message_body = str_replace("[admin_color]", $user_info->admin_color, $message_body);
294
- $message_body = str_replace("[closedpostboxes_page]", $user_info->closedpostboxes_page, $message_body);
295
- $message_body = str_replace("[primary_blog]", implode(", ", $user_info->primary_blog), $message_body);
296
- $message_body = str_replace("[rich_editing]", $user_info->rich_editing, $message_body);
297
- $message_body = str_replace("[source_domain]", $user_info->source_domain, $message_body);
298
-
299
- return $message_body;
300
- }
301
-
302
- function bnfw_get_subject_for_lostpassword_post($user_info){
303
- $bnfw_options = get_option('bnfw_custom_email_settings');
304
- $message_body = $bnfw_options['payload-subject-lostpassword_post'];
305
-
306
- $message_body = str_replace("[ID]", $user_info->ID, $message_body);
307
- $message_body = str_replace("[user_login]", $user_info->user_login, $message_body);
308
- $message_body = str_replace("[user_nicename]", $user_info->user_nicename, $message_body);
309
- $message_body = str_replace("[user_email]", $user_info->user_email, $message_body);
310
- $message_body = str_replace("[user_url]", $user_info->user_url, $message_body);
311
- $message_body = str_replace("[user_registered]", $user_info->user_registered, $message_body);
312
- $message_body = str_replace("[display_name]", $user_info->display_name, $message_body);
313
- $message_body = str_replace("[user_firstname]", $user_info->user_firstname, $message_body);
314
- $message_body = str_replace("[user_lastname]", $user_info->user_lastname, $message_body);
315
- $message_body = str_replace("[nickname]", $user_info->nickname, $message_body);
316
- $message_body = str_replace("[user_description]", $user_info->user_description, $message_body);
317
- $message_body = str_replace("[wp_capabilities]", implode(", ", $user_info->wp_capabilities), $message_body);
318
- $message_body = str_replace("[admin_color]", $user_info->admin_color, $message_body);
319
- $message_body = str_replace("[closedpostboxes_page]", $user_info->closedpostboxes_page, $message_body);
320
- $message_body = str_replace("[primary_blog]", implode(", ", $user_info->primary_blog), $message_body);
321
- $message_body = str_replace("[rich_editing]", $user_info->rich_editing, $message_body);
322
- $message_body = str_replace("[source_domain]", $user_info->source_domain, $message_body);
323
-
324
- return $message_body;
325
- }
326
-
327
-
328
- /*
329
- * Payload getters -----------------------------------------------
330
- */
331
-
332
- function bnfw_get_payload_for_publish_post($the_post){
333
-
334
- $bnfw_options = get_option('bnfw_custom_email_settings');
335
- $user_info = get_userdata($the_post->post_author);
336
-
337
- $message_body = $bnfw_options['payload-body-publish_post'];
338
-
339
- $message_body = str_replace("[ID]", $the_post->ID, $message_body);
340
- $message_body = str_replace("[post_author]", $the_post->post_author, $message_body);
341
- $message_body = str_replace("[post_date]", $the_post->post_date, $message_body);
342
- $message_body = str_replace("[post_date_gmt]", $the_post->post_date_gmt, $message_body);
343
- $message_body = str_replace("[post_content]", $the_post->post_content, $message_body);
344
- $message_body = str_replace("[post_title]", $the_post->post_title, $message_body);
345
- $category_list = "";
346
-
347
- foreach ($the_post->post_category as $category_int){
348
-
349
- $temp_term = get_term_by('id', $category_int, 'category'); $category_list .= $temp_term->name . ", ";
350
-
351
- }
352
-
353
- $message_body = str_replace("[post_category]", $category_list, $message_body);
354
- $message_body = str_replace("[post_excerpt]", implode(", ", $the_post->post_excerpt), $message_body);
355
- $message_body = str_replace("[post_status]", $the_post->post_status, $message_body);
356
- $message_body = str_replace("[comment_status]", $the_post->comment_status, $message_body);
357
- $message_body = str_replace("[ping_status]", $the_post->ping_status, $message_body);
358
- $message_body = str_replace("[post_password]", $the_post->post_password, $message_body);
359
- $message_body = str_replace("[post_name]", $the_post->post_name, $message_body);
360
- $message_body = str_replace("[to_ping]", $the_post->to_ping, $message_body);
361
- $message_body = str_replace("[pinged]", implode(", ", $the_post->pinged), $message_body);
362
- $message_body = str_replace("[post_modified]", $the_post->post_modified, $message_body);
363
- $message_body = str_replace("[post_modified_gmt]", $the_post->post_modified_gmt, $message_body);
364
- $message_body = str_replace("[post_content_filtered]", $the_post->post_content_filtered, $message_body);
365
- $message_body = str_replace("[post_parent]", $the_post->post_parent, $message_body);
366
- $message_body = str_replace("[guid]", $the_post->guid, $message_body);
367
- $message_body = str_replace("[menu_order]", $the_post->menu_order, $message_body);
368
- $message_body = str_replace("[post_type]", $the_post->post_type, $message_body);
369
- $message_body = str_replace("[post_mime_type]", $the_post->post_mime_type, $message_body);
370
- $message_body = str_replace("[comment_count]", $the_post->comment_count, $message_body);
371
-
372
- $message_body = str_replace("[user_login]", $user_info->user_login, $message_body);
373
- $message_body = str_replace("[user_nicename]", $user_info->user_nicename, $message_body);
374
- $message_body = str_replace("[user_email]", $user_info->user_email, $message_body);
375
- $message_body = str_replace("[user_url]", $user_info->user_url, $message_body);
376
- $message_body = str_replace("[user_registered]", $user_info->user_registered, $message_body);
377
- $message_body = str_replace("[display_name]", $user_info->display_name, $message_body);
378
- $message_body = str_replace("[user_firstname]", $user_info->user_firstname, $message_body);
379
- $message_body = str_replace("[user_lastname]", $user_info->user_lastname, $message_body);
380
- $message_body = str_replace("[nickname]", $user_info->nickname, $message_body);
381
- $message_body = str_replace("[user_description]", $user_info->user_description, $message_body);
382
- $message_body = str_replace("[wp_capabilities]", implode(", ", $user_info->wp_capabilities), $message_body);
383
- $message_body = str_replace("[admin_color]", $user_info->admin_color, $message_body);
384
- $message_body = str_replace("[closedpostboxes_page]", $user_info->closedpostboxes_page, $message_body);
385
- $message_body = str_replace("[primary_blog]", implode(", ", $user_info->primary_blog), $message_body);
386
- $message_body = str_replace("[rich_editing]", $user_info->rich_editing, $message_body);
387
- $message_body = str_replace("[source_domain]", $user_info->source_domain, $message_body);
388
-
389
- return $message_body;
390
- }
391
-
392
- function bnfw_get_payload_for_term_created($the_term){
393
-
394
- $bnfw_options = get_option('bnfw_custom_email_settings');
395
- $message_body = $bnfw_options['payload-body-create_term'];
396
-
397
- $message_body = str_replace("[slug]", $the_term->slug, $message_body);
398
- $message_body = str_replace("[name]", $the_term->name, $message_body);
399
- $message_body = str_replace("[description]", $the_term->description, $message_body);
400
-
401
- return $message_body;
402
- }
403
-
404
- function bnfw_get_payload_for_comment_post($the_comment){
405
-
406
- $bnfw_options = get_option('bnfw_custom_email_settings');
407
- $message_body = $bnfw_options['payload-body-comment_post'];
408
- $user_info = get_userdata($the_comment->comment_author);
409
- $the_post = get_post($the_comment->comment_post_ID);
410
-
411
- $message_body = str_replace("[comment_ID]", $the_comment->comment_ID, $message_body);
412
- $message_body = str_replace("[comment_post_ID]", $the_comment->comment_post_ID, $message_body);
413
- $message_body = str_replace("[comment_author]", $the_comment->comment_author, $message_body);
414
- $message_body = str_replace("[comment_author_email]", $the_comment->comment_author_email, $message_body);
415
- $message_body = str_replace("[comment_author_url]", $the_comment->comment_author_url, $message_body);
416
- $message_body = str_replace("[comment_author_IP]", $the_comment->comment_author_IP, $message_body);
417
- $message_body = str_replace("[comment_date]", $the_comment->comment_date, $message_body);
418
- $message_body = str_replace("[comment_date_gmt]", $the_comment->comment_date_gmt, $message_body);
419
- $message_body = str_replace("[comment_content]", $the_comment->comment_content, $message_body);
420
- $message_body = str_replace("[comment_karma]", $the_comment->comment_karma, $message_body);
421
- $message_body = str_replace("[comment_approved]", str_replace(array("0", "1", "spam"), array("awaiting moderation", "approved", "spam"), $the_comment->comment_approved), $message_body);
422
- $message_body = str_replace("[comment_agent]", $the_comment->comment_agent, $message_body);
423
- $message_body = str_replace("[comment_type]", $the_comment->comment_type, $message_body);
424
- $message_body = str_replace("[comment_parent]", $the_comment->comment_parent, $message_body);
425
- $message_body = str_replace("[user_id]", $the_comment->user_id, $message_body);
426
-
427
- $message_body = str_replace("[user_login]", $user_info->user_login, $message_body);
428
- $message_body = str_replace("[user_nicename]", $user_info->user_nicename, $message_body);
429
- $message_body = str_replace("[user_email]", $user_info->user_email, $message_body);
430
- $message_body = str_replace("[user_url]", $user_info->user_url, $message_body);
431
- $message_body = str_replace("[user_registered]", $user_info->user_registered, $message_body);
432
- $message_body = str_replace("[display_name]", $user_info->display_name, $message_body);
433
- $message_body = str_replace("[user_firstname]", $user_info->user_firstname, $message_body);
434
- $message_body = str_replace("[user_lastname]", $user_info->user_lastname, $message_body);
435
- $message_body = str_replace("[nickname]", $user_info->nickname, $message_body);
436
- $message_body = str_replace("[user_description]", $user_info->user_description, $message_body);
437
- $message_body = str_replace("[wp_capabilities]", implode(", ", $user_info->wp_capabilities), $message_body);
438
- $message_body = str_replace("[admin_color]", $user_info->admin_color, $message_body);
439
- $message_body = str_replace("[closedpostboxes_page]", $user_info->closedpostboxes_page, $message_body);
440
- $message_body = str_replace("[primary_blog]", implode(", ", $user_info->primary_blog), $message_body);
441
- $message_body = str_replace("[rich_editing]", $user_info->rich_editing, $message_body);
442
- $message_body = str_replace("[source_domain]", $user_info->source_domain, $message_body);
443
-
444
- $message_body = str_replace("[post_author]", $the_post->post_author, $message_body);
445
- $message_body = str_replace("[post_date]", $the_post->post_date, $message_body);
446
- $message_body = str_replace("[post_date_gmt]", $the_post->post_date_gmt, $message_body);
447
- $message_body = str_replace("[post_content]", $the_post->post_content, $message_body);
448
- $message_body = str_replace("[post_title]", $the_post->post_title, $message_body);
449
- $category_list = "";
450
-
451
- foreach ($the_post->post_category as $category_int){
452
-
453
- $temp_term = get_term_by('id', $category_int, 'category'); $category_list .= $temp_term->name . ", ";
454
-
455
- }
456
-
457
- $message_body = str_replace("[post_category]", $category_list, $message_body);
458
- $message_body = str_replace("[post_excerpt]", implode(", ", $the_post->post_excerpt), $message_body);
459
- $message_body = str_replace("[post_status]", $the_post->post_status, $message_body);
460
- $message_body = str_replace("[comment_status]", $the_post->comment_status, $message_body);
461
- $message_body = str_replace("[ping_status]", $the_post->ping_status, $message_body);
462
- $message_body = str_replace("[post_password]", $the_post->post_password, $message_body);
463
- $message_body = str_replace("[post_name]", $the_post->post_name, $message_body);
464
- $message_body = str_replace("[to_ping]", $the_post->to_ping, $message_body);
465
- $message_body = str_replace("[pinged]", implode(", ", $the_post->pinged), $message_body);
466
- $message_body = str_replace("[post_modified]", $the_post->post_modified, $message_body);
467
- $message_body = str_replace("[post_modified_gmt]", $the_post->post_modified_gmt, $message_body);
468
- $message_body = str_replace("[post_content_filtered]", $the_post->post_content_filtered, $message_body);
469
- $message_body = str_replace("[post_parent]", $the_post->post_parent, $message_body);
470
- $message_body = str_replace("[guid]", $the_post->guid, $message_body);
471
- $message_body = str_replace("[menu_order]", $the_post->menu_order, $message_body);
472
- $message_body = str_replace("[post_type]", $the_post->post_type, $message_body);
473
- $message_body = str_replace("[post_mime_type]", $the_post->post_mime_type, $message_body);
474
- $message_body = str_replace("[comment_count]", $the_post->comment_count, $message_body);
475
-
476
- return $message_body;
477
- }
478
-
479
- function bnfw_get_payload_for_user_register($user_info){
480
-
481
- $bnfw_options = get_option('bnfw_custom_email_settings');
482
- $message_body = $bnfw_options['payload-body-user_register'];
483
-
484
- $message_body = str_replace("[ID]", $user_info->ID, $message_body);
485
- $message_body = str_replace("[user_login]", $user_info->user_login, $message_body);
486
- $message_body = str_replace("[user_nicename]", $user_info->user_nicename, $message_body);
487
- $message_body = str_replace("[user_email]", $user_info->user_email, $message_body);
488
- $message_body = str_replace("[user_url]", $user_info->user_url, $message_body);
489
- $message_body = str_replace("[user_registered]", $user_info->user_registered, $message_body);
490
- $message_body = str_replace("[display_name]", $user_info->display_name, $message_body);
491
- $message_body = str_replace("[user_firstname]", $user_info->user_firstname, $message_body);
492
- $message_body = str_replace("[user_lastname]", $user_info->user_lastname, $message_body);
493
- $message_body = str_replace("[nickname]", $user_info->nickname, $message_body);
494
- $message_body = str_replace("[user_description]", $user_info->user_description, $message_body);
495
- $message_body = str_replace("[wp_capabilities]", implode(", ", $user_info->wp_capabilities), $message_body);
496
- $message_body = str_replace("[admin_color]", $user_info->admin_color, $message_body);
497
- $message_body = str_replace("[closedpostboxes_page]", $user_info->closedpostboxes_page, $message_body);
498
- $message_body = str_replace("[primary_blog]", implode(", ", $user_info->primary_blog), $message_body);
499
- $message_body = str_replace("[rich_editing]", $user_info->rich_editing, $message_body);
500
- $message_body = str_replace("[source_domain]", $user_info->source_domain, $message_body);
501
-
502
- return $message_body;
503
-
504
- }
505
-
506
- function bnfw_get_payload_for_trackback_post($the_comment){$message_body = $bnfw_options['payload-body-comment_post'];
507
-
508
- $bnfw_options = get_option('bnfw_custom_email_settings');
509
- $message_body = $bnfw_options['payload-body-trackback_post'];
510
- $user_info = get_userdata($the_comment->comment_author);
511
-
512
- $message_body = str_replace("[comment_ID]", $the_comment->comment_ID, $message_body);
513
- $message_body = str_replace("[comment_post_ID]", $the_comment->comment_post_ID, $message_body);
514
- $message_body = str_replace("[comment_author]", $the_comment->comment_author, $message_body);
515
- $message_body = str_replace("[comment_author_email]", $the_comment->comment_author_email, $message_body);
516
- $message_body = str_replace("[comment_author_url]", $the_comment->comment_author_url, $message_body);
517
- $message_body = str_replace("[comment_author_IP]", $the_comment->comment_author_IP, $message_body);
518
- $message_body = str_replace("[comment_date]", $the_comment->comment_date, $message_body);
519
- $message_body = str_replace("[comment_date_gmt]", $the_comment->comment_date_gmt, $message_body);
520
- $message_body = str_replace("[comment_content]", $the_comment->comment_content, $message_body);
521
- $message_body = str_replace("[comment_karma]", $the_comment->comment_karma, $message_body);
522
- $message_body = str_replace("[comment_approved]", str_replace(array("0", "1", "spam"), array("awaiting moderation", "approved", "spam"), $the_comment->comment_approved), $message_body);
523
- $message_body = str_replace("[comment_agent]", $the_comment->comment_agent, $message_body);
524
- $message_body = str_replace("[comment_type]", $the_comment->comment_type, $message_body);
525
- $message_body = str_replace("[comment_parent]", $the_comment->comment_parent, $message_body);
526
- $message_body = str_replace("[user_id]", $the_comment->user_id, $message_body);
527
-
528
- $message_body = str_replace("[user_login]", $user_info->user_login, $message_body);
529
- $message_body = str_replace("[user_nicename]", $user_info->user_nicename, $message_body);
530
- $message_body = str_replace("[user_email]", $user_info->user_email, $message_body);
531
- $message_body = str_replace("[user_url]", $user_info->user_url, $message_body);
532
- $message_body = str_replace("[user_registered]", $user_info->user_registered, $message_body);
533
- $message_body = str_replace("[display_name]", $user_info->display_name, $message_body);
534
- $message_body = str_replace("[user_firstname]", $user_info->user_firstname, $message_body);
535
- $message_body = str_replace("[user_lastname]", $user_info->user_lastname, $message_body);
536
- $message_body = str_replace("[nickname]", $user_info->nickname, $message_body);
537
- $message_body = str_replace("[user_description]", $user_info->user_description, $message_body);
538
- $message_body = str_replace("[wp_capabilities]", implode(", ", $user_info->wp_capabilities), $message_body);
539
- $message_body = str_replace("[admin_color]", $user_info->admin_color, $message_body);
540
- $message_body = str_replace("[closedpostboxes_page]", $user_info->closedpostboxes_page, $message_body);
541
- $message_body = str_replace("[primary_blog]", implode(", ", $user_info->primary_blog), $message_body);
542
- $message_body = str_replace("[rich_editing]", $user_info->rich_editing, $message_body);
543
- $message_body = str_replace("[source_domain]", $user_info->source_domain, $message_body);
544
-
545
- return $message_body;
546
- }
547
-
548
- function bnfw_get_payload_for_pingback_post($the_comment){
549
-
550
- $bnfw_options = get_option('bnfw_custom_email_settings');
551
- $message_body = $bnfw_options['payload-body-pingback_post'];
552
- $user_info = get_userdata($the_comment->comment_author);
553
-
554
- $message_body = str_replace("[comment_ID]", $the_comment->comment_ID, $message_body);
555
- $message_body = str_replace("[comment_post_ID]", $the_comment->comment_post_ID, $message_body);
556
- $message_body = str_replace("[comment_author]", $the_comment->comment_author, $message_body);
557
- $message_body = str_replace("[comment_author_email]", $the_comment->comment_author_email, $message_body);
558
- $message_body = str_replace("[comment_author_url]", $the_comment->comment_author_url, $message_body);
559
- $message_body = str_replace("[comment_author_IP]", $the_comment->comment_author_IP, $message_body);
560
- $message_body = str_replace("[comment_date]", $the_comment->comment_date, $message_body);
561
- $message_body = str_replace("[comment_date_gmt]", $the_comment->comment_date_gmt, $message_body);
562
- $message_body = str_replace("[comment_content]", $the_comment->comment_content, $message_body);
563
- $message_body = str_replace("[comment_karma]", $the_comment->comment_karma, $message_body);
564
- $message_body = str_replace("[comment_approved]", str_replace(array("0", "1", "spam"), array("awaiting moderation", "approved", "spam"), $the_comment->comment_approved), $message_body);
565
- $message_body = str_replace("[comment_agent]", $the_comment->comment_agent, $message_body);
566
- $message_body = str_replace("[comment_type]", $the_comment->comment_type, $message_body);
567
- $message_body = str_replace("[comment_parent]", $the_comment->comment_parent, $message_body);
568
- $message_body = str_replace("[user_id]", $the_comment->user_id, $message_body);
569
-
570
- $message_body = str_replace("[user_login]", $user_info->user_login, $message_body);
571
- $message_body = str_replace("[user_nicename]", $user_info->user_nicename, $message_body);
572
- $message_body = str_replace("[user_email]", $user_info->user_email, $message_body);
573
- $message_body = str_replace("[user_url]", $user_info->user_url, $message_body);
574
- $message_body = str_replace("[user_registered]", $user_info->user_registered, $message_body);
575
- $message_body = str_replace("[display_name]", $user_info->display_name, $message_body);
576
- $message_body = str_replace("[user_firstname]", $user_info->user_firstname, $message_body);
577
- $message_body = str_replace("[user_lastname]", $user_info->user_lastname, $message_body);
578
- $message_body = str_replace("[nickname]", $user_info->nickname, $message_body);
579
- $message_body = str_replace("[user_description]", $user_info->user_description, $message_body);
580
- $message_body = str_replace("[wp_capabilities]", implode(", ", $user_info->wp_capabilities), $message_body);
581
- $message_body = str_replace("[admin_color]", $user_info->admin_color, $message_body);
582
- $message_body = str_replace("[closedpostboxes_page]", $user_info->closedpostboxes_page, $message_body);
583
- $message_body = str_replace("[primary_blog]", implode(", ", $user_info->primary_blog), $message_body);
584
- $message_body = str_replace("[rich_editing]", $user_info->rich_editing, $message_body);
585
- $message_body = str_replace("[source_domain]", $user_info->source_domain, $message_body);
586
-
587
- return $message_body;
588
- }
589
-
590
- function bnfw_get_payload_for_lostpassword_post($user_info){
591
-
592
- $bnfw_options = get_option('bnfw_custom_email_settings');
593
- $message_body = $bnfw_options['payload-body-lostpassword_post'];
594
-
595
- $message_body = str_replace("[ID]", $user_info->ID, $message_body);
596
- $message_body = str_replace("[user_login]", $user_info->user_login, $message_body);
597
- $message_body = str_replace("[user_nicename]", $user_info->user_nicename, $message_body);
598
- $message_body = str_replace("[user_email]", $user_info->user_email, $message_body);
599
- $message_body = str_replace("[user_url]", $user_info->user_url, $message_body);
600
- $message_body = str_replace("[user_registered]", $user_info->user_registered, $message_body);
601
- $message_body = str_replace("[display_name]", $user_info->display_name, $message_body);
602
- $message_body = str_replace("[user_firstname]", $user_info->user_firstname, $message_body);
603
- $message_body = str_replace("[user_lastname]", $user_info->user_lastname, $message_body);
604
- $message_body = str_replace("[nickname]", $user_info->nickname, $message_body);
605
- $message_body = str_replace("[user_description]", $user_info->user_description, $message_body);
606
- $message_body = str_replace("[wp_capabilities]", implode(", ", $user_info->wp_capabilities), $message_body);
607
- $message_body = str_replace("[admin_color]", $user_info->admin_color, $message_body);
608
- $message_body = str_replace("[closedpostboxes_page]", $user_info->closedpostboxes_page, $message_body);
609
- $message_body = str_replace("[primary_blog]", implode(", ", $user_info->primary_blog), $message_body);
610
- $message_body = str_replace("[rich_editing]", $user_info->rich_editing, $message_body);
611
- $message_body = str_replace("[source_domain]", $user_info->source_domain, $message_body);
612
-
613
- return $message_body;
614
-
615
- }
616
-
617
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/css/plugin_styles.css DELETED
@@ -1,134 +0,0 @@
1
- /******************************************************************
2
- Stylesheet: Better Notifications for WordPress
3
- ******************************************************************/
4
-
5
- /*.wrap {
6
- width: 100px;
7
- }*/
8
-
9
- .onecol { width: 5.801104972%; } /* 4.85%; } /* grid_1 */
10
- .twocol { width: 14.364640883%; } /* 13.45%; } /* grid_2 */
11
- .threecol { width: 22.928176794%; } /* 22.05%; } /* grid_3 */
12
- .fourcol { width: 31.491712705%; } /* 30.75%; } /* grid_4 */
13
- .fivecol { width: 40.055248616%; } /* 39.45%; } /* grid_5 */
14
- .sixcol { width: 48.618784527%; } /* 48%; } /* grid_6 */
15
- .sevencol { width: 57.182320438000005%; } /* 56.75%; } /* grid_7 */
16
- .eightcol { width: 65.74585634900001%; } /* 65.4%; } /* grid_8 */
17
- .ninecol { width: 74.30939226%; } /* 74.05%; } /* grid_9 */
18
- .tencol { width: 82.87292817100001%; } /* 82.7%; } /* grid_10 */
19
- .elevencol { width: 91.436464082%; } /* 91.35%; } /* grid_11 */
20
- .twelvecol { width: 99.999999993%; } /* 100%; } /* grid_12 */
21
-
22
- /* layout & column defaults */
23
- .onecol, .twocol, .threecol, .fourcol, .fivecol, .sixcol, .sevencol, .eightcol, .ninecol, .tencol, .elevencol, .twelvecol {
24
- position: relative;
25
- float: left;
26
- margin-left: 2.762430939%;
27
- }
28
-
29
- .first {
30
- margin-left: 0;
31
- }
32
-
33
- .last {
34
- float: right;
35
- }
36
-
37
- .row {
38
- /* line-height: 25px;*/
39
- }
40
-
41
-
42
- /***** Clearfix *****/
43
- .clearfix:before,
44
- .clearfix:after {
45
- content: " "; /* 1 */
46
- display: table; /* 2 */
47
- }
48
-
49
- .clearfix:after {
50
- clear: both;
51
- }
52
-
53
- .left {
54
- float: left;
55
- }
56
-
57
- .right {
58
- float: right;
59
- }
60
-
61
-
62
- /*******************
63
- Admin Page Styling
64
- *******************/
65
-
66
- #paypal-donate {
67
- margin: 10px 0 0 0;
68
- }
69
-
70
- #paypal-donate strong {
71
- text-align: center;
72
- margin-right: 20px;
73
- }
74
-
75
-
76
-
77
- /***** Notifications Page *****/
78
-
79
- /* Grid of checkboxes on Settings page */
80
- #role-settings {
81
- margin: 20px 0 50px 0;
82
- }
83
-
84
- #role-settings .twocol {
85
- width: 8%;
86
- }
87
-
88
- #role-settings .row {
89
- line-height: 25px;
90
- }
91
-
92
- #role-settings .event.row:nth-child(2n+1) {
93
- background-color: #efefef;
94
- }
95
-
96
- /* Role labels on top row of settings page checkbox grid */
97
- .role {
98
- text-align: center;
99
- }
100
-
101
-
102
-
103
- /***** Email Templates Page *****/
104
-
105
- /* Wrapper around email template form */
106
- .bnfw-email-custom-form {
107
- margin: 0 0 40px 0;
108
- }
109
-
110
- .bnfw-email-custom-form h3 {
111
- background: #efefef;
112
- margin: 0 0 0 0;
113
- padding: 10px 5px;
114
- }
115
-
116
- .bnfw-email-custom-form label {
117
- padding: 10px 0 5px 0;
118
- font-weight: bold;
119
- }
120
-
121
- .bnfw-email-custom-form textarea {
122
- width: 100% !important;
123
- height: 250px;
124
- }
125
-
126
- /* Preview div */
127
- .bnfw-preview {
128
- background: #efefef;
129
- margin: 10px;
130
- width: 41.7%;
131
- height: 318px;
132
- overflow: scroll;
133
- padding: 5px;
134
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/debug.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**------------------------------------------------------------------------ *
3
+ * Debugger functions
4
+ *
5
+ * Include this file for debugging
6
+ * ------------------------------------------------------------------------ */
7
+
8
+ // Debugger
9
+ //add_filter('the_content', 'bnfw_debug');
10
+
11
+ // function bnfw_debug($content){
12
+ // $bnfw_options = get_option('bnfw_settings');
13
+
14
+ // if ( !isset( $wp_roles ) )
15
+ // $wp_roles = new WP_Roles();
16
+ // var_dump($wp_roles->get_names());
17
+
18
+ // var_dump($bnfw_options);
19
+ // return $content;
20
+ // }
21
+ ?>
includes/engine/class-bnfw-engine.php ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BNFW Engine
4
+ *
5
+ * @since 1.0
6
+ */
7
+ class BNFW_Engine {
8
+ /**
9
+ * Send the notification email.
10
+ *
11
+ * @since 1.0
12
+ */
13
+ public function send_notification( $setting, $id ) {
14
+ $subject = $this->handle_shortcodes( $setting['subject'], $setting['notification'], $id );
15
+ $message = $this->handle_shortcodes( $setting['message'], $setting['notification'], $id );
16
+ $emails = $this->get_emails( $setting );
17
+ $headers = $this->get_headers( $emails );
18
+ $headers[] = 'Content-type: text/html';
19
+
20
+ foreach ( $emails['to'] as $email ) {
21
+ wp_mail( $email, $subject, $message, $headers );
22
+ }
23
+ }
24
+
25
+ /**
26
+ * Generate message for notification.
27
+ *
28
+ * @since 1.0
29
+ */
30
+ private function handle_shortcodes( $message, $notification, $id ) {
31
+ // handle new comments, trackbacks and pingbacks
32
+ if ( 'new-comment' == $notification || 'new-trackback' == $notification || 'new-pingback' == $notification ) {
33
+ $message = $this->comment_shortcodes( $message, $id );
34
+ $comment = get_comment( $id );
35
+ $message = $this->post_shortcodes( $message, $comment->comment_post_ID );
36
+ }
37
+
38
+ // handle users (lost password and new user registration)
39
+ if ( 'user-password' == $notification || 'new-user' == $notification ) {
40
+ $message = $this->user_shortcodes( $message, $id );
41
+ }
42
+
43
+ // handle new category
44
+ if ( 'new-category' == $notification || 'new-term' == $notification ) {
45
+ $message = $this->category_shortcodes( $message, $id );
46
+ }
47
+
48
+ // handle new and update posts
49
+ $post_types = get_post_types( array( '_builtin' => false ), 'names' );
50
+ $post_types = array_diff( $post_types, array( BNFW_Notification::POST_TYPE ) );
51
+ array_push( $post_types, 'post' );
52
+
53
+ $type = explode( '-', $notification, 2 );
54
+ if ( $type[0] == 'new' || $type[0] == 'update' ) {
55
+ if ( in_array( $type[1], $post_types ) ) {
56
+ $message = $this->post_shortcodes( $message, $id );
57
+ $post = get_post( $id );
58
+ $message = $this->user_shortcodes( $message, $post->post_author );
59
+ }
60
+ }
61
+
62
+ return $message;
63
+ }
64
+
65
+ /**
66
+ * Handle post shortcodes.
67
+ *
68
+ * @since 1.0
69
+ */
70
+ private function post_shortcodes( $message, $post_id ) {
71
+ $post = get_post( $post_id );
72
+
73
+ $message = str_replace( '[ID]', $post->ID, $message );
74
+ $message = str_replace( '[post_author]', $post->post_author, $message );
75
+ $message = str_replace( '[post_date]', $post->post_date, $message );
76
+ $message = str_replace( '[post_date_gmt]', $post->post_date_gmt, $message );
77
+ $message = str_replace( '[post_content]', $post->post_content, $message );
78
+ $message = str_replace( '[post_title]', $post->post_title, $message );
79
+ $message = str_replace( '[post_excerpt]', $post->post_excerpt, $message );
80
+ $message = str_replace( '[post_status]', $post->post_status, $message );
81
+ $message = str_replace( '[comment_status]', $post->comment_status, $message );
82
+ $message = str_replace( '[ping_status]', $post->ping_status, $message );
83
+ $message = str_replace( '[post_password]', $post->post_password, $message );
84
+ $message = str_replace( '[post_name]', $post->post_name, $message );
85
+ $message = str_replace( '[to_ping]', $post->to_ping, $message );
86
+ $message = str_replace( '[pinged]', $post->pinged, $message );
87
+ $message = str_replace( '[post_modified]', $post->post_modified, $message );
88
+ $message = str_replace( '[post_modified_gmt]', $post->post_modified_gmt, $message );
89
+ $message = str_replace( '[post_content_filtered]', $post->post_content_filtered, $message );
90
+ $message = str_replace( '[post_parent]', $post->post_parent, $message );
91
+ $message = str_replace( '[guid]', $post->guid, $message );
92
+ $message = str_replace( '[menu_order]', $post->menu_order, $message );
93
+ $message = str_replace( '[post_type]', $post->post_type, $message );
94
+ $message = str_replace( '[post_mime_type]', $post->post_mime_type, $message );
95
+ $message = str_replace( '[comment_count]', $post->comment_count, $message );
96
+
97
+ $category_list = implode( ',', wp_get_post_categories( $post_id, array( 'fields' => 'name') ) );
98
+ $message = str_replace( '[post_category]', $category_list, $message );
99
+
100
+ return $message;
101
+ }
102
+
103
+ /**
104
+ * Handle comment shortcodes.
105
+ *
106
+ * @since 1.0
107
+ */
108
+ private function comment_shortcodes( $message, $comment_id ) {
109
+ $comment = get_comment( $comment_id );
110
+
111
+ $message = str_replace( '[comment_ID]', $comment->comment_ID, $message );
112
+ $message = str_replace( '[comment_post_ID]', $comment->comment_post_ID, $message );
113
+ $message = str_replace( '[comment_author]', $comment->comment_author, $message );
114
+ $message = str_replace( '[comment_author_email]', $comment->comment_author_email, $message );
115
+ $message = str_replace( '[comment_author_url]', $comment->comment_author_url, $message );
116
+ $message = str_replace( '[comment_author_IP]', $comment->comment_author_IP, $message );
117
+ $message = str_replace( '[comment_date]', $comment->comment_date, $message );
118
+ $message = str_replace( '[comment_date_gmt]', $comment->comment_date_gmt, $message );
119
+ $message = str_replace( '[comment_content]', $comment->comment_content, $message );
120
+ $message = str_replace( '[comment_karma]', $comment->comment_karma, $message );
121
+ $message = str_replace( '[comment_approved]', str_replace( array( '0', '1', 'spam' ), array( 'awaiting moderation', 'approved', 'spam' ), $comment->comment_approved ), $message );
122
+ $message = str_replace( '[comment_agent]', $comment->comment_agent, $message );
123
+ $message = str_replace( '[comment_type]', $comment->comment_type, $message );
124
+ $message = str_replace( '[comment_parent]', $comment->comment_parent, $message );
125
+ $message = str_replace( '[user_id]', $comment->user_id, $message );
126
+
127
+ return $message;
128
+ }
129
+
130
+ /**
131
+ * Handle user shortcodes.
132
+ *
133
+ * @access private
134
+ * @since 1.0
135
+ */
136
+ private function user_shortcodes( $message, $user_id ) {
137
+ $user_info = get_userdata( $user_id );
138
+
139
+ $message = str_replace( '[user_login]', $user_info->user_login, $message );
140
+ $message = str_replace( '[user_nicename]', $user_info->user_nicename, $message );
141
+ $message = str_replace( '[user_email]', $user_info->user_email, $message );
142
+ $message = str_replace( '[user_url]', $user_info->user_url, $message );
143
+ $message = str_replace( '[user_registered]', $user_info->user_registered, $message );
144
+ $message = str_replace( '[display_name]', $user_info->display_name, $message );
145
+ $message = str_replace( '[user_firstname]', $user_info->user_firstname, $message );
146
+ $message = str_replace( '[user_lastname]', $user_info->user_lastname, $message );
147
+ $message = str_replace( '[nickname]', $user_info->nickname, $message );
148
+ $message = str_replace( '[user_description]', $user_info->user_description, $message );
149
+ $message = str_replace( '[wp_capabilities]', implode( ',', $user_info->wp_capabilities ), $message );
150
+ $message = str_replace( '[admin_color]', $user_info->admin_color, $message );
151
+ $message = str_replace( '[closedpostboxes_page]', $user_info->closedpostboxes_page, $message );
152
+ $message = str_replace( '[primary_blog]', $user_info->primary_blog, $message );
153
+ $message = str_replace( '[rich_editing]', $user_info->rich_editing, $message );
154
+ $message = str_replace( '[source_domain]', $user_info->source_domain, $message );
155
+
156
+ return $message;
157
+ }
158
+
159
+ /**
160
+ * Handle category shortcodes.
161
+ *
162
+ * @access private
163
+ * @since 1.0
164
+ */
165
+ private function category_shortcodes( $message, $cat_id ) {
166
+ $cat_info = get_category( $cat_id );
167
+
168
+ $message = str_replace( '[slug]', $cat_info->slug, $message );
169
+ $message = str_replace( '[name]', $cat_info->name, $message );
170
+ $message = str_replace( '[description]', $cat_info->description, $message );
171
+ return $message;
172
+ }
173
+
174
+ /**
175
+ * Get the list of emails from the notification settings.
176
+ *
177
+ * @since 1.0
178
+ */
179
+ private function get_emails( $setting ) {
180
+ $emails = array();
181
+ if ( ! empty( $setting['from-name'] ) && ! empty( $setting['from-email'] ) ) {
182
+ $emails['from'] = $setting['from-name'] . ' <' . $setting['from-email'] . '>' ;
183
+ } else {
184
+ $emails['from'] = get_option('blogname') . ' <' . get_option('admin_email') . '>' ;
185
+ }
186
+
187
+ if ( ! empty( $setting['users'] ) ) {
188
+ $emails['to'] = $this->get_emails_from_id( $setting['users'] );
189
+ } else {
190
+ $emails['to'] = $this->get_emails_from_role( $setting['user-roles'] );
191
+ }
192
+
193
+ $emails['cc'] = $this->get_emails_from_role( $setting['cc-roles'] );
194
+ if ( ! empty( $setting['cc-email'] ) ) {
195
+ $emails['cc'][] = $setting['cc-email'];
196
+ }
197
+
198
+ $emails['bcc'] = $this->get_emails_from_role( $setting['bcc-roles'] );
199
+ if ( ! empty( $setting['bcc-email'] ) ) {
200
+ $emails['bcc'][] = $setting['bcc-email'];
201
+ }
202
+
203
+ return $emails;
204
+ }
205
+
206
+ /**
207
+ * Get user emails by user ids.
208
+ *
209
+ * @param mixed $user_ids
210
+ * @since 1.0
211
+ */
212
+ private function get_emails_from_id( $user_ids ) {
213
+ $email_list = array();
214
+ $user_query = new WP_User_Query( array( 'include' => $user_ids ) );
215
+ foreach ( $user_query->results as $user ) {
216
+ $email_list[] = $user->user_email;
217
+ }
218
+ return $email_list;
219
+ }
220
+
221
+ /**
222
+ * Get emails of users based on role.
223
+ *
224
+ * @since 1.0
225
+ */
226
+ private function get_emails_from_role( $roles ) {
227
+ if ( ! is_array( $roles ) ) {
228
+ $roles = array( $roles );
229
+ }
230
+
231
+ $email_list = array();
232
+ foreach ( $roles as $role ) {
233
+ $users = get_users( array(
234
+ 'role' => $role,
235
+ 'fields' => array( 'user_email' ),
236
+ ));
237
+
238
+ foreach( $users as $user ) {
239
+ $email_list[] = $user->user_email;
240
+ }
241
+ }
242
+
243
+ return $email_list;
244
+ }
245
+
246
+ /**
247
+ * Generate email headers based on the emails.
248
+ *
249
+ * @since 1.0
250
+ */
251
+ private function get_headers( $emails ) {
252
+ $headers = array();
253
+ return $headers;
254
+
255
+ $headers[] = 'From:' . $emails['from'];
256
+ if ( ! empty( $emails['cc'] ) ) {
257
+ $headers[] = 'Cc:' . implode( ',', $emails['cc'] );
258
+ }
259
+ if ( ! empty( $emails['bcc'] ) ) {
260
+ $headers[] = 'Bcc:' . implode( ',', $emails['bcc'] );
261
+ }
262
+ }
263
+ }
264
+ ?>
includes/import.php ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Import notification from old plugin.
4
+ *
5
+ * @since 1.0
6
+ */
7
+ class BNFW_Import {
8
+ const EMAIL_OPTION = 'bnfw_custom_email_settings';
9
+ const SETTING_OPTION = 'bnfw_settings';
10
+ private $events = array( 'create_term', 'publish_post', 'comment_post', 'user_register', 'trackback_post', 'pingback_post', 'lostpassword_post' );
11
+
12
+ /**
13
+ * Import notification from old plugin.
14
+ *
15
+ * @since 1.0
16
+ */
17
+ public function import() {
18
+ global $wp_roles;
19
+ $roles = $wp_roles->get_names();
20
+
21
+ if ( $this->import_needed() ) {
22
+ $old_events = get_option( self::SETTING_OPTION );
23
+ foreach ( $old_events as $event => $value ) {
24
+ if ( '1' == $value ) {
25
+ $event_array = explode( '-', $event );
26
+ if ( 2 == count( $event_array ) ) {
27
+ if ( in_array( $event_array[0], $this->events ) && in_array( $event_array[1], array_keys( $roles ) ) ) {
28
+ $event_array[1] = $roles[$event_array[1]];
29
+ $this->insert_notification( $event_array );
30
+ }
31
+ }
32
+ }
33
+ }
34
+ // delete the old options
35
+ $this->delete_option();
36
+ }
37
+ }
38
+
39
+ /**
40
+ * Check if import is needed.
41
+ *
42
+ * @since 1.0
43
+ */
44
+ private function import_needed() {
45
+ if ( get_option( self::EMAIL_OPTION ) && get_option( self::SETTING_OPTION ) ) {
46
+ return true;
47
+ }
48
+ return false;
49
+ }
50
+
51
+ /**
52
+ * Insert notification.
53
+ *
54
+ * @param mixed $event
55
+ */
56
+ private function insert_notification( $event ) {
57
+ $post = array(
58
+ 'post_title' => $event[0] . __( ' for ', 'bnfw' ) . $event[1] . __( ' (Auto Imported)', 'bnfw' ),
59
+ 'post_type' => BNFW_Notification::POST_TYPE,
60
+ 'post_content' => '',
61
+ 'post_status' => 'publish',
62
+ );
63
+
64
+ $post_id = wp_insert_post( $post );
65
+ if ( $post_id > 0 ) {
66
+ $content = $this->map_notification_content( $event[0] );
67
+ $setting = array(
68
+ 'notification' => $this->map_notification( $event[0] ),
69
+ 'user-roles' => array( $event[1] ),
70
+ 'users' => array(),
71
+ 'subject' => $content['subject'],
72
+ 'message' => $content['body'],
73
+ );
74
+
75
+ foreach ( $setting as $key => $value ) {
76
+ update_post_meta( $post_id, BNFW_Notification::META_KEY_PREFIX . $key, $value );
77
+ }
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Map old notification type to new notification type.
83
+ *
84
+ * @param mixed $event_name
85
+ */
86
+ private function map_notification( $event_name ) {
87
+ switch ( $event_name ) {
88
+ case 'create_term':
89
+ return 'new-category';
90
+ break;
91
+ case 'publish_post':
92
+ return 'new-post';
93
+ break;
94
+ case 'comment_post':
95
+ return 'new-comment';
96
+ break;
97
+ case 'user_register':
98
+ return 'new-user';
99
+ break;
100
+ case 'trackback_post':
101
+ return 'new-trackback';
102
+ break;
103
+ case 'pingback_post':
104
+ return 'new-pingback';
105
+ break;
106
+ case 'lostpassword_post':
107
+ return 'user-password';
108
+ break;
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Map content from old plugin.
114
+ *
115
+ * @param mixed $event
116
+ */
117
+ private function map_notification_content( $event_name ) {
118
+ $content = array();
119
+ if ( ! isset( $this->content_map ) ) {
120
+ $this->parse_content();
121
+ }
122
+ return $this->content_map[$event_name];
123
+ }
124
+
125
+ /**
126
+ * Parse content from old plugins setting.
127
+ *
128
+ * @since 1.0
129
+ */
130
+ private function parse_content() {
131
+ $old_content = get_option( self::EMAIL_OPTION );
132
+ $content_map = array();
133
+ foreach ( $old_content as $key => $value ) {
134
+ $key_array = explode( '-', $key );
135
+ if ( 3 == count( $key_array ) ) {
136
+ $content_map[$key_array[2]][$key_array[1]] = $value;
137
+ }
138
+ }
139
+ $this->content_map = $content_map;
140
+ }
141
+
142
+ /**
143
+ * Delete old plugin database options.
144
+ *
145
+ * @since 1.0
146
+ */
147
+ private function delete_option() {
148
+ delete_option( self::EMAIL_OPTION );
149
+ delete_option( self::SETTING_OPTION );
150
+ }
151
+ }
152
+ ?>
includes/overrides.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* ------------------------------------------------------------------------ *
3
+ * Disable all default WordPress emails
4
+ * ------------------------------------------------------------------------ */
5
+
6
+ function bnfw_disable_emails($result = '') {
7
+ extract($result);
8
+ $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
9
+ if (strstr(sprintf(__('[%s] New User Registration'), $blogname), $subject)) {
10
+ $to = '';
11
+ $subject = '';
12
+ $message = '';
13
+ $headers = '';
14
+ $attachments = array ();
15
+ return compact('to', 'subject', 'message', 'headers', 'attachments');
16
+ }
17
+ else if (strstr(sprintf(__('[%s] Password Lost/Changed'), $blogname), $subject)) {
18
+ $to = '';
19
+ $subject = '';
20
+ $message = '';
21
+ $headers = '';
22
+ $attachments = array ();
23
+ return compact('to', 'subject', 'message', 'headers', 'attachments');
24
+ }
25
+ else if (strstr(sprintf(__('[%s] Comment:'), $blogname), $subject)) {
26
+ $to = '';
27
+ $subject = '';
28
+ $message = '';
29
+ $headers = '';
30
+ $attachments = array ();
31
+ return compact('to', 'subject', 'message', 'headers', 'attachments');
32
+ }
33
+ else if (strstr(sprintf(__('[%s] Please moderate:'), $blogname), $subject)) {
34
+ $to = '';
35
+ $subject = '';
36
+ $message = '';
37
+ $headers = '';
38
+ $attachments = array ();
39
+ return compact('to', 'subject', 'message', 'headers', 'attachments');
40
+ }
41
+
42
+ return $result;
43
+ }
44
+
45
+ add_filter('wp_mail', 'bnfw_disable_emails');
46
+ ?>
languages/bnfw.pot ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2014 Better Notifications for WordPress
2
+ # This file is distributed under the same license as the Better Notifications for WordPress package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Better Notifications for WordPress 1.0\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/bnfw\n"
7
+ "POT-Creation-Date: 2014-12-17 13:59:40+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+
15
+ #: includes/admin/bnfw-settings.php:12
16
+ #: includes/admin/class-bnfw-notification.php:113
17
+ msgid "Notification Settings"
18
+ msgstr ""
19
+
20
+ #: includes/admin/bnfw-settings.php:13
21
+ msgid "Settings"
22
+ msgstr ""
23
+
24
+ #: includes/admin/bnfw-settings.php:32
25
+ msgid "BNFW Settings"
26
+ msgstr ""
27
+
28
+ #: includes/admin/bnfw-settings.php:76
29
+ msgid "Suppress SPAM comment notification"
30
+ msgstr ""
31
+
32
+ #: includes/admin/bnfw-settings.php:81
33
+ msgid "Don't send notifications for comments marked as SPAM by Akismet"
34
+ msgstr ""
35
+
36
+ #: includes/admin/bnfw-settings.php:171
37
+ msgid "Notification Name"
38
+ msgstr ""
39
+
40
+ #: includes/admin/bnfw-settings.php:180
41
+ #: includes/admin/class-bnfw-notification.php:230
42
+ #: includes/admin/class-bnfw-notification.php:527
43
+ msgid "User Roles"
44
+ msgstr ""
45
+
46
+ #: includes/admin/bnfw-settings.php:189
47
+ msgid "User"
48
+ msgstr ""
49
+
50
+ #: includes/admin/bnfw-settings.php:247
51
+ msgid ""
52
+ "Do you want to specify individual users from the user roles selected above?"
53
+ msgstr ""
54
+
55
+ #: includes/admin/class-bnfw-notification.php:39
56
+ #: includes/admin/class-bnfw-notification.php:42
57
+ #: includes/admin/class-bnfw-notification.php:43
58
+ msgid "Notifications"
59
+ msgstr ""
60
+
61
+ #: includes/admin/class-bnfw-notification.php:40
62
+ msgid "Notification"
63
+ msgstr ""
64
+
65
+ #: includes/admin/class-bnfw-notification.php:41
66
+ msgid "Add New"
67
+ msgstr ""
68
+
69
+ #: includes/admin/class-bnfw-notification.php:44
70
+ msgid "Add New Notification"
71
+ msgstr ""
72
+
73
+ #: includes/admin/class-bnfw-notification.php:45
74
+ msgid "Edit Notification"
75
+ msgstr ""
76
+
77
+ #: includes/admin/class-bnfw-notification.php:46
78
+ msgid "New Notification"
79
+ msgstr ""
80
+
81
+ #: includes/admin/class-bnfw-notification.php:47
82
+ msgid "View Notification"
83
+ msgstr ""
84
+
85
+ #: includes/admin/class-bnfw-notification.php:48
86
+ msgid "Search Notifications"
87
+ msgstr ""
88
+
89
+ #: includes/admin/class-bnfw-notification.php:49
90
+ msgid "No Notifications found"
91
+ msgstr ""
92
+
93
+ #: includes/admin/class-bnfw-notification.php:50
94
+ msgid "No Notifications found in trash"
95
+ msgstr ""
96
+
97
+ #: includes/admin/class-bnfw-notification.php:51
98
+ msgid "All Notifications"
99
+ msgstr ""
100
+
101
+ #: includes/admin/class-bnfw-notification.php:121
102
+ msgid "Save Notification"
103
+ msgstr ""
104
+
105
+ #: includes/admin/class-bnfw-notification.php:150
106
+ msgid "Notification For"
107
+ msgstr ""
108
+
109
+ #: includes/admin/class-bnfw-notification.php:155
110
+ msgid "New Comment / Awaiting Moderation"
111
+ msgstr ""
112
+
113
+ #: includes/admin/class-bnfw-notification.php:156
114
+ msgid "New Trackback"
115
+ msgstr ""
116
+
117
+ #: includes/admin/class-bnfw-notification.php:157
118
+ msgid "New Pingback"
119
+ msgstr ""
120
+
121
+ #: includes/admin/class-bnfw-notification.php:158
122
+ msgid "Password Reset"
123
+ msgstr ""
124
+
125
+ #: includes/admin/class-bnfw-notification.php:159
126
+ msgid "New User Registration"
127
+ msgstr ""
128
+
129
+ #: includes/admin/class-bnfw-notification.php:162
130
+ msgid "New Post Published"
131
+ msgstr ""
132
+
133
+ #: includes/admin/class-bnfw-notification.php:163
134
+ msgid "Post Updated"
135
+ msgstr ""
136
+
137
+ #: includes/admin/class-bnfw-notification.php:165
138
+ msgid "New Category"
139
+ msgstr ""
140
+
141
+ #: includes/admin/class-bnfw-notification.php:176
142
+ msgid "Custom Post Type - "
143
+ msgstr ""
144
+
145
+ #: includes/admin/class-bnfw-notification.php:177
146
+ msgid "New "
147
+ msgstr ""
148
+
149
+ #: includes/admin/class-bnfw-notification.php:178
150
+ msgid "Update "
151
+ msgstr ""
152
+
153
+ #: includes/admin/class-bnfw-notification.php:179
154
+ msgid " Pending Review"
155
+ msgstr ""
156
+
157
+ #: includes/admin/class-bnfw-notification.php:185
158
+ msgid "Custom Taxonomy"
159
+ msgstr ""
160
+
161
+ #: includes/admin/class-bnfw-notification.php:186
162
+ msgid "New Term"
163
+ msgstr ""
164
+
165
+ #: includes/admin/class-bnfw-notification.php:196
166
+ msgid "From Name and Email"
167
+ msgstr ""
168
+
169
+ #: includes/admin/class-bnfw-notification.php:206
170
+ msgid "CC"
171
+ msgstr ""
172
+
173
+ #: includes/admin/class-bnfw-notification.php:217
174
+ msgid "BCC"
175
+ msgstr ""
176
+
177
+ #: includes/admin/class-bnfw-notification.php:253
178
+ msgid "Define individual users instead"
179
+ msgstr ""
180
+
181
+ #: includes/admin/class-bnfw-notification.php:269
182
+ msgid "Define user roles instead"
183
+ msgstr ""
184
+
185
+ #: includes/admin/class-bnfw-notification.php:276
186
+ #: includes/admin/class-bnfw-notification.php:526
187
+ msgid "Subject"
188
+ msgstr ""
189
+
190
+ #: includes/admin/class-bnfw-notification.php:285
191
+ msgid "Message Body"
192
+ msgstr ""
193
+
194
+ #: includes/admin/class-bnfw-notification.php:443
195
+ msgid "Notification saved."
196
+ msgstr ""
197
+
198
+ #: includes/admin/class-bnfw-notification.php:460
199
+ #: includes/admin/class-bnfw-notification.php:481
200
+ #: includes/admin/class-bnfw-notification.php:482
201
+ msgid "Save"
202
+ msgstr ""
203
+
204
+ #: includes/admin/class-bnfw-notification.php:471
205
+ msgid "Delete Permanently"
206
+ msgstr ""
207
+
208
+ #: includes/admin/class-bnfw-notification.php:473
209
+ msgid "Move to Trash"
210
+ msgstr ""
211
+
212
+ #: includes/import.php:58
213
+ msgid " for "
214
+ msgstr ""
215
+
216
+ #: includes/import.php:58
217
+ msgid " (Auto Imported)"
218
+ msgstr ""
219
+
220
+ #: includes/overrides.php:9
221
+ msgid "[%s] New User Registration"
222
+ msgstr ""
223
+
224
+ #: includes/overrides.php:17
225
+ msgid "[%s] Password Lost/Changed"
226
+ msgstr ""
227
+
228
+ #: includes/overrides.php:25
229
+ msgid "[%s] Comment:"
230
+ msgstr ""
231
+
232
+ #: includes/overrides.php:33
233
+ msgid "[%s] Please moderate:"
234
+ msgstr ""
235
+
236
+ #. Plugin Name of the plugin/theme
237
+ msgid "Better Notifications for WordPress"
238
+ msgstr ""
239
+
240
+ #. Plugin URI of the plugin/theme
241
+ msgid "http://wordpress.org/plugins/bnfw/"
242
+ msgstr ""
243
+
244
+ #. Description of the plugin/theme
245
+ msgid ""
246
+ "Customise the default WordPress email notifications and create new ones with "
247
+ "HTML and shortcodes."
248
+ msgstr ""
249
+
250
+ #. Author of the plugin/theme
251
+ msgid "Voltronik"
252
+ msgstr ""
253
+
254
+ #. Author URI of the plugin/theme
255
+ msgid "http://www.voltronik.co.uk/"
256
+ msgstr ""