Version Description
- 19th August 2019 =
- New: You can now filter the mail headers in BNFW using
bnfw_mail_headers
. More details here. - Added: Better support for the new Block Editor (Gutenberg) and all post/page/custom post type notifications. More and better support coming soon.
- Added: Support for the upcoming Digest add-on.
- Fixed: The 'New User Registration - For Admin' notification was sending out the default WordPress notification as well as the BNFW notification in some cases.
- Fixed: The 'New Comment - Awaiting Moderation' notification was missing from the Global Override add-on.
- Fixed: A fatal error which occasionally occurred when a user changes their password on the front-end.
Download this release
Release Info
Developer | voltronik |
Plugin | Better Notifications for WordPress |
Version | 1.7.4 |
Comparing to | |
See all releases |
Code changes from version 1.7.3 to 1.7.4
- README.txt +25 -15
- assets/js/bnfw.js +1 -1
- bnfw.php +19 -12
- includes/admin/bnfw-settings.php +1 -1
- includes/engine/class-bnfw-engine.php +30 -25
- includes/libraries/EDD_SL_Plugin_Updater.php +151 -21
- includes/notification/post-notification.php +1 -0
- includes/overrides.php +1 -1
- languages/bnfw-de_DE.po +3 -3
- languages/bnfw-fr_FR.po +1 -1
- languages/bnfw-nl_NL.po +4 -4
- languages/bnfw-pt_BR.po +4 -4
- languages/bnfw.pot +4 -4
README.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
=== Better Notifications for
|
2 |
Contributors: voltronik
|
3 |
Donate link: https://betternotificationsforwp.com/donate/
|
4 |
Tags: notification, email, push, sms, alert, HTML, customize, bulk, trigger, CC, BCC
|
5 |
Requires at least: 4.0
|
6 |
-
Tested up to: 5.
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 1.7.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -13,7 +13,7 @@ Supercharge your WordPress notifications using a WYSIWYG editor and shortcodes.
|
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
-
Better Notifications for
|
17 |
|
18 |
Here's a quick walkthrough of the plugin in action:
|
19 |
[youtube https://www.youtube.com/watch?v=MxPUyRZPJ1Q]
|
@@ -21,7 +21,7 @@ Here's a quick walkthrough of the plugin in action:
|
|
21 |
= An Example: =
|
22 |
You want all the users in the Editor role to be notified via email when a new post is published and you'd like to customise it to include your logo along with the author's name and date / time it was published - with this plugin, that's easy.
|
23 |
|
24 |
-
> A handy list of shortcodes you can use is available [here](https://betternotificationsforwp.com/shortcodes/ "Shortcodes for use in Better Notifications for
|
25 |
|
26 |
= Premium Add-ons =
|
27 |
Power-up your notifications using add-ons:
|
@@ -32,15 +32,17 @@ Power-up your notifications using add-ons:
|
|
32 |
|
33 |
[Custom Fields](https://betternotificationsforwp.com/downloads/custom-fields/) - Provides a number of new shortcodes allowing you to include data from custom fields and custom user fields created using [ACF](https://wordpress.org/plugins/advanced-custom-fields/).
|
34 |
|
35 |
-
[Multisite](https://betternotificationsforwp.com/downloads/multisite/) - Adds new notifications and shortcodes for WordPress Multisite to Better Notifications for WordPress.
|
36 |
-
|
37 |
[Send to Any Email](https://betternotificationsforwp.com/downloads/send-to-any-email/) - Send notifications to non-WordPress Users.
|
38 |
|
|
|
|
|
39 |
[Global Override](https://betternotificationsforwp.com/downloads/per-post-override/) - Override some of the settings of notifications directly when editing a post, page, or custom post type.
|
40 |
|
41 |
[Reminders](https://betternotificationsforwp.com/downloads/update-reminder/) - Send a reminder to your users and/or user roles when a post, page, or custom post type hasn't been updated after a set amount of time. Also send a notification when a user hasn't logged in for a set amount of time.
|
42 |
|
43 |
-
[
|
|
|
|
|
44 |
|
45 |
...and more coming soon!
|
46 |
|
@@ -143,13 +145,13 @@ If you'd like to see a notification in the list above, please drop me a line in
|
|
143 |
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
144 |
3. Use the settings in the new 'Notifications' Menu item in the sidebar to configure the plugin.
|
145 |
4. (Optional) Install a plugin to use SMTP instead of `wp_mail()`. I recommend [Post SMTP Mailer/Email Log](https://wordpress.org/plugins/post-smtp/).
|
146 |
-
5. Test by creating a notification with some [shortcodes](https://betternotificationsforwp.com/shortcodes/ "Shortcodes for use in Better Notifications for
|
147 |
|
148 |
|
149 |
|
150 |
== Frequently Asked Questions ==
|
151 |
|
152 |
-
> Full Documentation for BNFW can be found [here](https://betternotificationsforwp.com/documentation/ "Documentation for Better Notifications for
|
153 |
|
154 |
= Is this plugin compatible with the new Block Editor (Gutenberg) in WordPress 5? =
|
155 |
|
@@ -161,7 +163,7 @@ Shortcodes are text in square brackets that output content of some kind. For exa
|
|
161 |
|
162 |
Shortcodes can be used in the 'Subject' and 'Message Body' of your notifications, except for a select few (due to a restriction in WordPress).
|
163 |
|
164 |
-
> A handy list of shortcodes you can use is available [here](https://betternotificationsforwp.com/shortcodes/ "Shortcodes for use in Better Notifications for
|
165 |
|
166 |
= What are some scenarios this plugin could be used for? =
|
167 |
|
@@ -182,7 +184,7 @@ Yes! Full support for WordPress Multisite was added in 1.6.13, alongside the rel
|
|
182 |
|
183 |
= Notifications aren't coming through! =
|
184 |
|
185 |
-
First of all, follow [this article](https://betternotificationsforwp.com/how-can-i-receive-the-best-support/) about how to find out what might be causing the problem. Additionally, please take a look at [this help document](https://betternotificationsforwp.com/documentation/getting-started/how-to-improve-email-delivery/) to see how you might improve email delivery when using Better Notifications for
|
186 |
|
187 |
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. [This article](https://support.mailpoet.com/knowledgebase/lists-of-hosts-and-their-sending-limits/) has a fairly extensive list of hosts and their corresponding email rate limits that's worth checking out. Alternatively, please check with your host directly to find out what your limit is.
|
188 |
|
@@ -194,7 +196,7 @@ It's possible you're inserting a shortcode into a notification that cannot use i
|
|
194 |
|
195 |
= Other emails from WordPress / other plugins are being messed up! =
|
196 |
|
197 |
-
WordPress, by default, sends all emails in Plain Text. If you'd like to include code or use the WYSIWYG editor as part of Better Notifications for
|
198 |
|
199 |
= Custom Post Type 'X' isn't showing in the list of available custom post types =
|
200 |
|
@@ -216,9 +218,17 @@ Yes, of course! The plugin is completely translation-friendly and if you send me
|
|
216 |
|
217 |
== Changelog ==
|
218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
= 1.7.3 - 10th April 2019 =
|
220 |
-
*
|
221 |
-
*
|
222 |
* Added: You can now Enable or Disable a notification by hovering over it on the 'All Notifications' screen as well as enabling or disabling notifications in bulk from the Bulk Actions dropdown menu.
|
223 |
* Fixed: The 'User Email Changed - For User' and 'User Password Changed' notifications were no longer being disabled when attempting to override it since WordPress 5.0.
|
224 |
* Fixed: An issue where the new Block Editor (Gutenberg) caused double notifications upon publishing a post. Better support for Gutenberg will be coming this year. For now, it is recommended to use the [Classic Editor](https://wordpress.org/plugins/classic-editor/) plugin.
|
1 |
+
=== Better Notifications for WP ===
|
2 |
Contributors: voltronik
|
3 |
Donate link: https://betternotificationsforwp.com/donate/
|
4 |
Tags: notification, email, push, sms, alert, HTML, customize, bulk, trigger, CC, BCC
|
5 |
Requires at least: 4.0
|
6 |
+
Tested up to: 5.2.2
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 1.7.4
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
+
Better Notifications for WP is a simple but powerful plugin for beginners to advanced users that allows you to customise the email notifications that WordPress sends using the WYSIWYG editor and shortcodes. All of the default WordPress email notifications are available to customise as well as lots of new ones. You can choose to send notifications to individual users, multiple users, all users in a user role, multiple roles - you name it! You can also power-up your notifications with [Premium Add-ons](https://betternotificationsforwp.com/downloads/). 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.
|
17 |
|
18 |
Here's a quick walkthrough of the plugin in action:
|
19 |
[youtube https://www.youtube.com/watch?v=MxPUyRZPJ1Q]
|
21 |
= An Example: =
|
22 |
You want all the users in the Editor role to be notified via email when a new post is published and you'd like to customise it to include your logo along with the author's name and date / time it was published - with this plugin, that's easy.
|
23 |
|
24 |
+
> A handy list of shortcodes you can use is available [here](https://betternotificationsforwp.com/shortcodes/ "Shortcodes for use in Better Notifications for WP").
|
25 |
|
26 |
= Premium Add-ons =
|
27 |
Power-up your notifications using add-ons:
|
32 |
|
33 |
[Custom Fields](https://betternotificationsforwp.com/downloads/custom-fields/) - Provides a number of new shortcodes allowing you to include data from custom fields and custom user fields created using [ACF](https://wordpress.org/plugins/advanced-custom-fields/).
|
34 |
|
|
|
|
|
35 |
[Send to Any Email](https://betternotificationsforwp.com/downloads/send-to-any-email/) - Send notifications to non-WordPress Users.
|
36 |
|
37 |
+
[Digest](https://betternotificationsforwp.com/downloads/digest/) - Group multiple notifications into a single digest notification.
|
38 |
+
|
39 |
[Global Override](https://betternotificationsforwp.com/downloads/per-post-override/) - Override some of the settings of notifications directly when editing a post, page, or custom post type.
|
40 |
|
41 |
[Reminders](https://betternotificationsforwp.com/downloads/update-reminder/) - Send a reminder to your users and/or user roles when a post, page, or custom post type hasn't been updated after a set amount of time. Also send a notification when a user hasn't logged in for a set amount of time.
|
42 |
|
43 |
+
[Multisite](https://betternotificationsforwp.com/downloads/multisite/) - Adds new notifications and shortcodes for WordPress Multisite to Better Notifications for WP.
|
44 |
+
|
45 |
+
[Profile Builder](https://betternotificationsforwp.com/downloads/profile-builder/) - Adds compatibility and new notifications and shortcodes for Profile Builder Free, Hobbyist, and Pro plugins to Better Notifications for WP.
|
46 |
|
47 |
...and more coming soon!
|
48 |
|
145 |
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
146 |
3. Use the settings in the new 'Notifications' Menu item in the sidebar to configure the plugin.
|
147 |
4. (Optional) Install a plugin to use SMTP instead of `wp_mail()`. I recommend [Post SMTP Mailer/Email Log](https://wordpress.org/plugins/post-smtp/).
|
148 |
+
5. Test by creating a notification with some [shortcodes](https://betternotificationsforwp.com/shortcodes/ "Shortcodes for use in Better Notifications for WP").
|
149 |
|
150 |
|
151 |
|
152 |
== Frequently Asked Questions ==
|
153 |
|
154 |
+
> Full Documentation for BNFW can be found [here](https://betternotificationsforwp.com/documentation/ "Documentation for Better Notifications for WP").
|
155 |
|
156 |
= Is this plugin compatible with the new Block Editor (Gutenberg) in WordPress 5? =
|
157 |
|
163 |
|
164 |
Shortcodes can be used in the 'Subject' and 'Message Body' of your notifications, except for a select few (due to a restriction in WordPress).
|
165 |
|
166 |
+
> A handy list of shortcodes you can use is available [here](https://betternotificationsforwp.com/shortcodes/ "Shortcodes for use in Better Notifications for WP").
|
167 |
|
168 |
= What are some scenarios this plugin could be used for? =
|
169 |
|
184 |
|
185 |
= Notifications aren't coming through! =
|
186 |
|
187 |
+
First of all, follow [this article](https://betternotificationsforwp.com/how-can-i-receive-the-best-support/) about how to find out what might be causing the problem. Additionally, please take a look at [this help document](https://betternotificationsforwp.com/documentation/getting-started/how-to-improve-email-delivery/) to see how you might improve email delivery when using Better Notifications for WP.
|
188 |
|
189 |
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. [This article](https://support.mailpoet.com/knowledgebase/lists-of-hosts-and-their-sending-limits/) has a fairly extensive list of hosts and their corresponding email rate limits that's worth checking out. Alternatively, please check with your host directly to find out what your limit is.
|
190 |
|
196 |
|
197 |
= Other emails from WordPress / other plugins are being messed up! =
|
198 |
|
199 |
+
WordPress, by default, sends all emails in Plain Text. If you'd like to include code or use the WYSIWYG editor as part of Better Notifications for WP in your emails, you can change this to HTML using the global setting in Better Notification for WordPress. This can be found under the 'Notifications > Settings' screen. Changing this global email format setting will affect how all emails are sent out from WordPress however, so you may experience formatting issues with emails sent out from other plugins if you change the email format setting in this way. If you do, change this setting to Plain Text. You can also set the email format on a per-notification basis when setting-up a new Notification. The caveat is that WordPress will only either allow setting the email format globally (for all emails) or individually for anything that's non-transactional.
|
200 |
|
201 |
= Custom Post Type 'X' isn't showing in the list of available custom post types =
|
202 |
|
218 |
|
219 |
== Changelog ==
|
220 |
|
221 |
+
= 1.7.4 - 19th August 2019 =
|
222 |
+
* New: You can now filter the mail headers in BNFW using `bnfw_mail_headers`. More details [here](https://betternotificationsforwp.com/documentation/actions-and-filters/).
|
223 |
+
* Added: Better support for the new Block Editor (Gutenberg) and all post/page/custom post type notifications. More and better support coming soon.
|
224 |
+
* Added: Support for the upcoming [Digest add-on](https://betternotificationsforwp.com/downloads/digest/).
|
225 |
+
* Fixed: The 'New User Registration - For Admin' notification was sending out the default WordPress notification as well as the BNFW notification in some cases.
|
226 |
+
* Fixed: The 'New Comment - Awaiting Moderation' notification was missing from the [Global Override add-on](https://betternotificationsforwp.com/downloads/per-post-override/).
|
227 |
+
* Fixed: A fatal error which occasionally occurred when a user changes their password on the front-end.
|
228 |
+
|
229 |
= 1.7.3 - 10th April 2019 =
|
230 |
+
* New: Notification - 'User Email Changed - For Admin'. This is sent to an admin after a user has successfully changed and confirmed a new email address.
|
231 |
+
* New: Notification - 'User Email Changed Confirmation - For User'. This is sent to a user in order for them to confirm a change to their email address.
|
232 |
* Added: You can now Enable or Disable a notification by hovering over it on the 'All Notifications' screen as well as enabling or disabling notifications in bulk from the Bulk Actions dropdown menu.
|
233 |
* Fixed: The 'User Email Changed - For User' and 'User Password Changed' notifications were no longer being disabled when attempting to override it since WordPress 5.0.
|
234 |
* Fixed: An issue where the new Block Editor (Gutenberg) caused double notifications upon publishing a post. Better support for Gutenberg will be coming this year. For now, it is recommended to use the [Classic Editor](https://wordpress.org/plugins/classic-editor/) plugin.
|
assets/js/bnfw.js
CHANGED
@@ -566,7 +566,7 @@ jQuery(document).ready(function($) {
|
|
566 |
'[global_site_url]';
|
567 |
break;
|
568 |
default:
|
569 |
-
alert( "This is a new notification that is not available in WordPress by default and has been added by Better Notifications for
|
570 |
break;
|
571 |
}
|
572 |
|
566 |
'[global_site_url]';
|
567 |
break;
|
568 |
default:
|
569 |
+
alert( "This is a new notification that is not available in WordPress by default and has been added by Better Notifications for WP. As such, it doesn't have any default content." );
|
570 |
break;
|
571 |
}
|
572 |
|
bnfw.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Plugin Name: Better Notifications for
|
4 |
* Plugin URI: https://wordpress.org/plugins/bnfw/
|
5 |
* Description: Supercharge your WordPress notifications using a WYSIWYG editor and shortcodes. Default and new notifications available. Add more power with Add-ons.
|
6 |
-
* Version: 1.7.
|
7 |
* Author: Made with Fuel
|
8 |
* Author URI: https://betternotificationsforwp.com/
|
9 |
* Author Email: hello@betternotificationsforwp.com
|
@@ -135,6 +135,7 @@ class BNFW {
|
|
135 |
|
136 |
add_action( 'wp_insert_post' , array( $this, 'insert_post' ), 10, 2 );
|
137 |
|
|
|
138 |
add_action( 'draft_to_publish' , array( $this, 'publish_post' ) );
|
139 |
add_action( 'future_to_publish' , array( $this, 'publish_post' ) );
|
140 |
add_action( 'pending_to_publish' , array( $this, 'publish_post' ) );
|
@@ -270,9 +271,9 @@ class BNFW {
|
|
270 |
*
|
271 |
* @since 1.4
|
272 |
*/
|
273 |
-
$trigger_insert_post = apply_filters( 'bnfw_trigger_insert_post', false );
|
274 |
|
275 |
-
if ( in_array( $current_theme->get( 'Name' ), $insert_post_themes ) || $trigger_insert_post
|
276 |
$this->handle_inserted_post( $post_id );
|
277 |
}
|
278 |
}
|
@@ -812,12 +813,11 @@ class BNFW {
|
|
812 |
/**
|
813 |
* Send notification based on type and ref id
|
814 |
*
|
815 |
-
* @access private
|
816 |
* @since 1.0
|
817 |
* @param string $type Notification type.
|
818 |
-
* @param
|
819 |
*/
|
820 |
-
|
821 |
$notifications = $this->notifier->get_notifications( $type );
|
822 |
foreach ( $notifications as $notification ) {
|
823 |
$this->engine->send_notification( $this->notifier->read_settings( $notification->ID ), $ref_id );
|
@@ -827,11 +827,10 @@ class BNFW {
|
|
827 |
/**
|
828 |
* Send notification async based on type and ref id.
|
829 |
*
|
830 |
-
* @access private
|
831 |
* @param string $type Notification type.
|
832 |
-
* @param
|
833 |
*/
|
834 |
-
|
835 |
$notifications = $this->notifier->get_notifications( $type, false );
|
836 |
foreach ( $notifications as $notification ) {
|
837 |
$transient = get_transient( 'bnfw-async-notifications' );
|
@@ -839,8 +838,16 @@ class BNFW {
|
|
839 |
$transient = array();
|
840 |
}
|
841 |
|
842 |
-
$
|
843 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
844 |
}
|
845 |
}
|
846 |
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Plugin Name: Better Notifications for WP
|
4 |
* Plugin URI: https://wordpress.org/plugins/bnfw/
|
5 |
* Description: Supercharge your WordPress notifications using a WYSIWYG editor and shortcodes. Default and new notifications available. Add more power with Add-ons.
|
6 |
+
* Version: 1.7.4
|
7 |
* Author: Made with Fuel
|
8 |
* Author URI: https://betternotificationsforwp.com/
|
9 |
* Author Email: hello@betternotificationsforwp.com
|
135 |
|
136 |
add_action( 'wp_insert_post' , array( $this, 'insert_post' ), 10, 2 );
|
137 |
|
138 |
+
add_action( 'auto-draft_to_publish' , array( $this, 'publish_post' ) );
|
139 |
add_action( 'draft_to_publish' , array( $this, 'publish_post' ) );
|
140 |
add_action( 'future_to_publish' , array( $this, 'publish_post' ) );
|
141 |
add_action( 'pending_to_publish' , array( $this, 'publish_post' ) );
|
271 |
*
|
272 |
* @since 1.4
|
273 |
*/
|
274 |
+
$trigger_insert_post = apply_filters( 'bnfw_trigger_insert_post', false, $post_id );
|
275 |
|
276 |
+
if ( in_array( $current_theme->get( 'Name' ), $insert_post_themes ) || $trigger_insert_post ) {
|
277 |
$this->handle_inserted_post( $post_id );
|
278 |
}
|
279 |
}
|
813 |
/**
|
814 |
* Send notification based on type and ref id
|
815 |
*
|
|
|
816 |
* @since 1.0
|
817 |
* @param string $type Notification type.
|
818 |
+
* @param mixed $ref_id Reference data.
|
819 |
*/
|
820 |
+
public function send_notification( $type, $ref_id ) {
|
821 |
$notifications = $this->notifier->get_notifications( $type );
|
822 |
foreach ( $notifications as $notification ) {
|
823 |
$this->engine->send_notification( $this->notifier->read_settings( $notification->ID ), $ref_id );
|
827 |
/**
|
828 |
* Send notification async based on type and ref id.
|
829 |
*
|
|
|
830 |
* @param string $type Notification type.
|
831 |
+
* @param mixed $ref_id Reference data.
|
832 |
*/
|
833 |
+
public function send_notification_async( $type, $ref_id ) {
|
834 |
$notifications = $this->notifier->get_notifications( $type, false );
|
835 |
foreach ( $notifications as $notification ) {
|
836 |
$transient = get_transient( 'bnfw-async-notifications' );
|
838 |
$transient = array();
|
839 |
}
|
840 |
|
841 |
+
$notification_data = array(
|
842 |
+
'ref_id' => $ref_id,
|
843 |
+
'notification_id' => $notification->ID,
|
844 |
+
'notification_type' => $type,
|
845 |
+
);
|
846 |
+
|
847 |
+
if ( ! in_array( $notification_data, $transient ) ) {
|
848 |
+
$transient[] = $notification_data;
|
849 |
+
set_transient( 'bnfw-async-notifications', $transient, 600 );
|
850 |
+
}
|
851 |
}
|
852 |
}
|
853 |
|
includes/admin/bnfw-settings.php
CHANGED
@@ -200,7 +200,7 @@ function bnfw_general_options() {
|
|
200 |
'bnfw-settings', // Page to show on
|
201 |
'bnfw_general_options_section', // Associate with which settings section?
|
202 |
array(
|
203 |
-
esc_html__( 'Allow Better Notifications for
|
204 |
)
|
205 |
);
|
206 |
}
|
200 |
'bnfw-settings', // Page to show on
|
201 |
'bnfw_general_options_section', // Associate with which settings section?
|
202 |
array(
|
203 |
+
esc_html__( 'Allow Better Notifications for WP to anonymously track how this plugin is used and help make the plugin better.', 'bnfw' )
|
204 |
)
|
205 |
);
|
206 |
}
|
includes/engine/class-bnfw-engine.php
CHANGED
@@ -68,6 +68,12 @@ class BNFW_Engine {
|
|
68 |
|
69 |
$emails = apply_filters( 'bnfw_emails', $emails, $setting );
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
if ( isset( $emails['to'] ) && is_array( $emails['to'] ) ) {
|
72 |
foreach ( $emails['to'] as $email ) {
|
73 |
wp_mail( $email, stripslashes( $this->handle_global_user_shortcodes( $subject, $email ) ), $this->handle_global_user_shortcodes( $message, $email ), $headers );
|
@@ -882,33 +888,26 @@ class BNFW_Engine {
|
|
882 |
}
|
883 |
|
884 |
if ( 'true' == $setting['show-fields'] ) {
|
885 |
-
|
886 |
-
$from_email = $setting['from-email'];
|
887 |
-
if ( ! is_email( $from_email ) ) {
|
888 |
-
$from_email = $this->process_shortcodes_in_email( $from_email, $id, $setting, $emails['to'] );
|
889 |
-
}
|
890 |
|
891 |
-
|
892 |
-
|
893 |
-
if ( is_email( $from_email ) ) {
|
894 |
-
$emails['from'] = $from_name . ' <' . $from_email . '>';
|
895 |
-
}
|
896 |
-
} else {
|
897 |
-
$emails['from'] = get_option( 'blogname' ) . ' <' . get_option( 'admin_email' ) . '>';
|
898 |
}
|
899 |
|
900 |
-
|
901 |
-
|
902 |
-
|
|
|
903 |
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
}
|
909 |
|
910 |
-
|
911 |
-
|
|
|
|
|
912 |
|
913 |
if ( ! empty( $setting['cc'] ) ) {
|
914 |
$emails['cc'] = $this->get_emails_from_users( $setting['cc'], $exclude, $id, $setting );
|
@@ -1130,7 +1129,7 @@ class BNFW_Engine {
|
|
1130 |
$headers[] = 'From:' . $emails['from'];
|
1131 |
}
|
1132 |
|
1133 |
-
if ( ! empty( $emails['reply-email'] ) ) {
|
1134 |
$headers[] = 'Reply-To:' . $emails['reply-name'] . '<' . $emails['reply-email'] . '>';
|
1135 |
}
|
1136 |
|
@@ -1141,7 +1140,13 @@ class BNFW_Engine {
|
|
1141 |
$headers[] = 'Bcc:' . implode( ',', $emails['bcc'] );
|
1142 |
}
|
1143 |
|
1144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1145 |
}
|
1146 |
|
1147 |
public function handle_user_request_email_shortcodes( $message, $setting, $email_data ) {
|
@@ -1217,7 +1222,7 @@ class BNFW_Engine {
|
|
1217 |
*
|
1218 |
* @return string
|
1219 |
*/
|
1220 |
-
|
1221 |
if ( ! empty( $setting ) ) {
|
1222 |
if ( $this->starts_with( $setting['notification'], 'comment-' ) || $this->starts_with( $setting['notification'], 'moderate-' ) ) {
|
1223 |
// for new comment notifications, we need to use post id instead of comment id.
|
68 |
|
69 |
$emails = apply_filters( 'bnfw_emails', $emails, $setting );
|
70 |
|
71 |
+
$send = apply_filters( 'bnfw_can_send_email', true, $setting, $emails, $subject, $message, $headers );
|
72 |
+
|
73 |
+
if ( ! $send ) {
|
74 |
+
return;
|
75 |
+
}
|
76 |
+
|
77 |
if ( isset( $emails['to'] ) && is_array( $emails['to'] ) ) {
|
78 |
foreach ( $emails['to'] as $email ) {
|
79 |
wp_mail( $email, stripslashes( $this->handle_global_user_shortcodes( $subject, $email ) ), $this->handle_global_user_shortcodes( $message, $email ), $headers );
|
888 |
}
|
889 |
|
890 |
if ( 'true' == $setting['show-fields'] ) {
|
891 |
+
$default_from_field = get_option( 'blogname' ) . ' <' . get_option( 'admin_email' ) . '>';
|
|
|
|
|
|
|
|
|
892 |
|
893 |
+
if ( ! empty( $setting['from-name'] ) && ! empty( $setting['from-email'] ) && is_email( $setting['from-email'] ) ) {
|
894 |
+
$default_from_field = $setting['from-name'] . ' <' . $setting['from-email'] . '>';
|
|
|
|
|
|
|
|
|
|
|
895 |
}
|
896 |
|
897 |
+
/**
|
898 |
+
* Filter Email From Field.
|
899 |
+
*/
|
900 |
+
$emails['from'] = apply_filters( 'bnfw_from_field', $default_from_field, $setting, $id, $emails['to'] );
|
901 |
|
902 |
+
/**
|
903 |
+
* Filter Reply Name Field.
|
904 |
+
*/
|
905 |
+
$emails['reply-name'] = apply_filters( 'bnfw_reply_name_field', $setting['reply-name'], $setting, $id, $emails['to'] );
|
|
|
906 |
|
907 |
+
/**
|
908 |
+
* Filter Reply Email Field.
|
909 |
+
*/
|
910 |
+
$emails['reply-email'] = apply_filters( 'bnfw_reply_email_field', $setting['reply-email'], $setting, $id, $emails['to'] );
|
911 |
|
912 |
if ( ! empty( $setting['cc'] ) ) {
|
913 |
$emails['cc'] = $this->get_emails_from_users( $setting['cc'], $exclude, $id, $setting );
|
1129 |
$headers[] = 'From:' . $emails['from'];
|
1130 |
}
|
1131 |
|
1132 |
+
if ( ! empty( $emails['reply-email'] ) && is_email( $emails['reply-email'] ) ) {
|
1133 |
$headers[] = 'Reply-To:' . $emails['reply-name'] . '<' . $emails['reply-email'] . '>';
|
1134 |
}
|
1135 |
|
1140 |
$headers[] = 'Bcc:' . implode( ',', $emails['bcc'] );
|
1141 |
}
|
1142 |
|
1143 |
+
/**
|
1144 |
+
* Filter out mail headers.
|
1145 |
+
*
|
1146 |
+
* @param array $headers Headers.
|
1147 |
+
* @param array $emails Emails.
|
1148 |
+
*/
|
1149 |
+
return apply_filters( 'bnfw_mail_headers', $headers, $emails );
|
1150 |
}
|
1151 |
|
1152 |
public function handle_user_request_email_shortcodes( $message, $setting, $email_data ) {
|
1222 |
*
|
1223 |
* @return string
|
1224 |
*/
|
1225 |
+
public function process_shortcodes_in_email( $email, $post_id, $setting, $to_emails ) {
|
1226 |
if ( ! empty( $setting ) ) {
|
1227 |
if ( $this->starts_with( $setting['notification'], 'comment-' ) || $this->starts_with( $setting['notification'], 'moderate-' ) ) {
|
1228 |
// for new comment notifications, we need to use post id instead of comment id.
|
includes/libraries/EDD_SL_Plugin_Updater.php
CHANGED
@@ -7,7 +7,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
7 |
* Allows plugins to use their own update API.
|
8 |
*
|
9 |
* @author Easy Digital Downloads
|
10 |
-
* @version 1.6.
|
11 |
*/
|
12 |
class EDD_SL_Plugin_Updater {
|
13 |
|
@@ -19,6 +19,8 @@ class EDD_SL_Plugin_Updater {
|
|
19 |
private $wp_override = false;
|
20 |
private $cache_key = '';
|
21 |
|
|
|
|
|
22 |
/**
|
23 |
* Class constructor.
|
24 |
*
|
@@ -39,11 +41,20 @@ class EDD_SL_Plugin_Updater {
|
|
39 |
$this->slug = basename( $_plugin_file, '.php' );
|
40 |
$this->version = $_api_data['version'];
|
41 |
$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
|
42 |
-
|
43 |
-
$this->cache_key = md5( serialize( $this->slug . $this->api_data['license'] ) );
|
44 |
|
45 |
$edd_plugin_data[ $this->slug ] = $this->api_data;
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
// Set up hooks.
|
48 |
$this->init();
|
49 |
|
@@ -98,7 +109,7 @@ class EDD_SL_Plugin_Updater {
|
|
98 |
$version_info = $this->get_cached_version_info();
|
99 |
|
100 |
if ( false === $version_info ) {
|
101 |
-
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' =>
|
102 |
|
103 |
$this->set_version_info_cache( $version_info );
|
104 |
|
@@ -110,9 +121,12 @@ class EDD_SL_Plugin_Updater {
|
|
110 |
|
111 |
$_transient_data->response[ $this->name ] = $version_info;
|
112 |
|
|
|
|
|
|
|
113 |
}
|
114 |
|
115 |
-
$_transient_data->last_checked =
|
116 |
$_transient_data->checked[ $this->name ] = $this->version;
|
117 |
|
118 |
}
|
@@ -156,7 +170,20 @@ class EDD_SL_Plugin_Updater {
|
|
156 |
$version_info = $this->get_cached_version_info();
|
157 |
|
158 |
if ( false === $version_info ) {
|
159 |
-
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' =>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
$this->set_version_info_cache( $version_info );
|
162 |
}
|
@@ -171,7 +198,7 @@ class EDD_SL_Plugin_Updater {
|
|
171 |
|
172 |
}
|
173 |
|
174 |
-
$update_cache->last_checked =
|
175 |
$update_cache->checked[ $this->name ] = $this->version;
|
176 |
|
177 |
set_site_transient( 'update_plugins', $update_cache );
|
@@ -251,17 +278,18 @@ class EDD_SL_Plugin_Updater {
|
|
251 |
'is_ssl' => is_ssl(),
|
252 |
'fields' => array(
|
253 |
'banners' => array(),
|
254 |
-
'reviews' => false
|
|
|
255 |
)
|
256 |
);
|
257 |
|
258 |
-
$cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] ) );
|
259 |
|
260 |
// Get the transient where we store the api request for this plugin for 24 hours
|
261 |
$edd_api_request_transient = $this->get_cached_version_info( $cache_key );
|
262 |
|
263 |
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
|
264 |
-
if ( empty( $edd_api_request_transient ) ){
|
265 |
|
266 |
$api_response = $this->api_request( 'plugin_information', $to_send );
|
267 |
|
@@ -276,9 +304,49 @@ class EDD_SL_Plugin_Updater {
|
|
276 |
$_data = $edd_api_request_transient;
|
277 |
}
|
278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
return $_data;
|
280 |
}
|
281 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
/**
|
283 |
* Disable SSL verification in order to prevent download update failures
|
284 |
*
|
@@ -287,11 +355,13 @@ class EDD_SL_Plugin_Updater {
|
|
287 |
* @return object $array
|
288 |
*/
|
289 |
public function http_request_args( $args, $url ) {
|
290 |
-
|
|
|
291 |
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
|
292 |
-
$args['sslverify'] =
|
293 |
}
|
294 |
return $args;
|
|
|
295 |
}
|
296 |
|
297 |
/**
|
@@ -307,7 +377,31 @@ class EDD_SL_Plugin_Updater {
|
|
307 |
*/
|
308 |
private function api_request( $_action, $_data ) {
|
309 |
|
310 |
-
global $wp_version;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
|
312 |
$data = array_merge( $this->api_data, $_data );
|
313 |
|
@@ -315,7 +409,7 @@ class EDD_SL_Plugin_Updater {
|
|
315 |
return;
|
316 |
}
|
317 |
|
318 |
-
if( $this->api_url == trailingslashit (home_url() ) ) {
|
319 |
return false; // Don't allow a plugin to ping itself
|
320 |
}
|
321 |
|
@@ -324,13 +418,14 @@ class EDD_SL_Plugin_Updater {
|
|
324 |
'license' => ! empty( $data['license'] ) ? $data['license'] : '',
|
325 |
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
|
326 |
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
|
|
|
327 |
'slug' => $data['slug'],
|
328 |
'author' => $data['author'],
|
329 |
'url' => home_url(),
|
330 |
'beta' => ! empty( $data['beta'] ),
|
331 |
);
|
332 |
|
333 |
-
$request
|
334 |
|
335 |
if ( ! is_wp_error( $request ) ) {
|
336 |
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
@@ -346,6 +441,16 @@ class EDD_SL_Plugin_Updater {
|
|
346 |
$request->banners = maybe_unserialize( $request->banners );
|
347 |
}
|
348 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
return $request;
|
350 |
}
|
351 |
|
@@ -370,7 +475,8 @@ class EDD_SL_Plugin_Updater {
|
|
370 |
}
|
371 |
|
372 |
$data = $edd_plugin_data[ $_REQUEST['slug'] ];
|
373 |
-
$
|
|
|
374 |
$version_info = $this->get_cached_version_info( $cache_key );
|
375 |
|
376 |
if( false === $version_info ) {
|
@@ -385,18 +491,26 @@ class EDD_SL_Plugin_Updater {
|
|
385 |
'beta' => ! empty( $data['beta'] )
|
386 |
);
|
387 |
|
388 |
-
$
|
|
|
389 |
|
390 |
if ( ! is_wp_error( $request ) ) {
|
391 |
$version_info = json_decode( wp_remote_retrieve_body( $request ) );
|
392 |
}
|
393 |
|
|
|
394 |
if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
|
395 |
$version_info->sections = maybe_unserialize( $version_info->sections );
|
396 |
} else {
|
397 |
$version_info = false;
|
398 |
}
|
399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
$this->set_version_info_cache( $version_info, $cache_key );
|
401 |
|
402 |
}
|
@@ -416,11 +530,17 @@ class EDD_SL_Plugin_Updater {
|
|
416 |
|
417 |
$cache = get_option( $cache_key );
|
418 |
|
419 |
-
if( empty( $cache['timeout'] ) ||
|
420 |
return false; // Cache is expired
|
421 |
}
|
422 |
|
423 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
424 |
|
425 |
}
|
426 |
|
@@ -431,12 +551,22 @@ class EDD_SL_Plugin_Updater {
|
|
431 |
}
|
432 |
|
433 |
$data = array(
|
434 |
-
'timeout' => strtotime( '+3 hours',
|
435 |
'value' => json_encode( $value )
|
436 |
);
|
437 |
|
438 |
-
update_option( $cache_key, $data );
|
|
|
|
|
439 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
}
|
441 |
|
442 |
}
|
7 |
* Allows plugins to use their own update API.
|
8 |
*
|
9 |
* @author Easy Digital Downloads
|
10 |
+
* @version 1.6.18
|
11 |
*/
|
12 |
class EDD_SL_Plugin_Updater {
|
13 |
|
19 |
private $wp_override = false;
|
20 |
private $cache_key = '';
|
21 |
|
22 |
+
private $health_check_timeout = 5;
|
23 |
+
|
24 |
/**
|
25 |
* Class constructor.
|
26 |
*
|
41 |
$this->slug = basename( $_plugin_file, '.php' );
|
42 |
$this->version = $_api_data['version'];
|
43 |
$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
|
44 |
+
$this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
|
45 |
+
$this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
|
46 |
|
47 |
$edd_plugin_data[ $this->slug ] = $this->api_data;
|
48 |
|
49 |
+
/**
|
50 |
+
* Fires after the $edd_plugin_data is setup.
|
51 |
+
*
|
52 |
+
* @since x.x.x
|
53 |
+
*
|
54 |
+
* @param array $edd_plugin_data Array of EDD SL plugin data.
|
55 |
+
*/
|
56 |
+
do_action( 'post_edd_sl_plugin_updater_setup', $edd_plugin_data );
|
57 |
+
|
58 |
// Set up hooks.
|
59 |
$this->init();
|
60 |
|
109 |
$version_info = $this->get_cached_version_info();
|
110 |
|
111 |
if ( false === $version_info ) {
|
112 |
+
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
|
113 |
|
114 |
$this->set_version_info_cache( $version_info );
|
115 |
|
121 |
|
122 |
$_transient_data->response[ $this->name ] = $version_info;
|
123 |
|
124 |
+
// Make sure the plugin property is set to the plugin's name/location. See issue 1463 on Software Licensing's GitHub repo.
|
125 |
+
$_transient_data->response[ $this->name ]->plugin = $this->name;
|
126 |
+
|
127 |
}
|
128 |
|
129 |
+
$_transient_data->last_checked = time();
|
130 |
$_transient_data->checked[ $this->name ] = $this->version;
|
131 |
|
132 |
}
|
170 |
$version_info = $this->get_cached_version_info();
|
171 |
|
172 |
if ( false === $version_info ) {
|
173 |
+
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
|
174 |
+
|
175 |
+
// Since we disabled our filter for the transient, we aren't running our object conversion on banners, sections, or icons. Do this now:
|
176 |
+
if ( isset( $version_info->banners ) && ! is_array( $version_info->banners ) ) {
|
177 |
+
$version_info->banners = $this->convert_object_to_array( $version_info->banners );
|
178 |
+
}
|
179 |
+
|
180 |
+
if ( isset( $version_info->sections ) && ! is_array( $version_info->sections ) ) {
|
181 |
+
$version_info->sections = $this->convert_object_to_array( $version_info->sections );
|
182 |
+
}
|
183 |
+
|
184 |
+
if ( isset( $version_info->icons ) && ! is_array( $version_info->icons ) ) {
|
185 |
+
$version_info->icons = $this->convert_object_to_array( $version_info->icons );
|
186 |
+
}
|
187 |
|
188 |
$this->set_version_info_cache( $version_info );
|
189 |
}
|
198 |
|
199 |
}
|
200 |
|
201 |
+
$update_cache->last_checked = time();
|
202 |
$update_cache->checked[ $this->name ] = $this->version;
|
203 |
|
204 |
set_site_transient( 'update_plugins', $update_cache );
|
278 |
'is_ssl' => is_ssl(),
|
279 |
'fields' => array(
|
280 |
'banners' => array(),
|
281 |
+
'reviews' => false,
|
282 |
+
'icons' => array(),
|
283 |
)
|
284 |
);
|
285 |
|
286 |
+
$cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
|
287 |
|
288 |
// Get the transient where we store the api request for this plugin for 24 hours
|
289 |
$edd_api_request_transient = $this->get_cached_version_info( $cache_key );
|
290 |
|
291 |
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
|
292 |
+
if ( empty( $edd_api_request_transient ) ) {
|
293 |
|
294 |
$api_response = $this->api_request( 'plugin_information', $to_send );
|
295 |
|
304 |
$_data = $edd_api_request_transient;
|
305 |
}
|
306 |
|
307 |
+
// Convert sections into an associative array, since we're getting an object, but Core expects an array.
|
308 |
+
if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
|
309 |
+
$_data->sections = $this->convert_object_to_array( $_data->sections );
|
310 |
+
}
|
311 |
+
|
312 |
+
// Convert banners into an associative array, since we're getting an object, but Core expects an array.
|
313 |
+
if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
|
314 |
+
$_data->banners = $this->convert_object_to_array( $_data->banners );
|
315 |
+
}
|
316 |
+
|
317 |
+
// Convert icons into an associative array, since we're getting an object, but Core expects an array.
|
318 |
+
if ( isset( $_data->icons ) && ! is_array( $_data->icons ) ) {
|
319 |
+
$_data->icons = $this->convert_object_to_array( $_data->icons );
|
320 |
+
}
|
321 |
+
|
322 |
+
if( ! isset( $_data->plugin ) ) {
|
323 |
+
$_data->plugin = $this->name;
|
324 |
+
}
|
325 |
+
|
326 |
return $_data;
|
327 |
}
|
328 |
|
329 |
+
/**
|
330 |
+
* Convert some objects to arrays when injecting data into the update API
|
331 |
+
*
|
332 |
+
* Some data like sections, banners, and icons are expected to be an associative array, however due to the JSON
|
333 |
+
* decoding, they are objects. This method allows us to pass in the object and return an associative array.
|
334 |
+
*
|
335 |
+
* @since 3.6.5
|
336 |
+
*
|
337 |
+
* @param stdClass $data
|
338 |
+
*
|
339 |
+
* @return array
|
340 |
+
*/
|
341 |
+
private function convert_object_to_array( $data ) {
|
342 |
+
$new_data = array();
|
343 |
+
foreach ( $data as $key => $value ) {
|
344 |
+
$new_data[ $key ] = $value;
|
345 |
+
}
|
346 |
+
|
347 |
+
return $new_data;
|
348 |
+
}
|
349 |
+
|
350 |
/**
|
351 |
* Disable SSL verification in order to prevent download update failures
|
352 |
*
|
355 |
* @return object $array
|
356 |
*/
|
357 |
public function http_request_args( $args, $url ) {
|
358 |
+
|
359 |
+
$verify_ssl = $this->verify_ssl();
|
360 |
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
|
361 |
+
$args['sslverify'] = $verify_ssl;
|
362 |
}
|
363 |
return $args;
|
364 |
+
|
365 |
}
|
366 |
|
367 |
/**
|
377 |
*/
|
378 |
private function api_request( $_action, $_data ) {
|
379 |
|
380 |
+
global $wp_version, $edd_plugin_url_available;
|
381 |
+
|
382 |
+
$verify_ssl = $this->verify_ssl();
|
383 |
+
|
384 |
+
// Do a quick status check on this domain if we haven't already checked it.
|
385 |
+
$store_hash = md5( $this->api_url );
|
386 |
+
if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) {
|
387 |
+
$test_url_parts = parse_url( $this->api_url );
|
388 |
+
|
389 |
+
$scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme'] : 'http';
|
390 |
+
$host = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : '';
|
391 |
+
$port = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : '';
|
392 |
+
|
393 |
+
if ( empty( $host ) ) {
|
394 |
+
$edd_plugin_url_available[ $store_hash ] = false;
|
395 |
+
} else {
|
396 |
+
$test_url = $scheme . '://' . $host . $port;
|
397 |
+
$response = wp_remote_get( $test_url, array( 'timeout' => $this->health_check_timeout, 'sslverify' => $verify_ssl ) );
|
398 |
+
$edd_plugin_url_available[ $store_hash ] = is_wp_error( $response ) ? false : true;
|
399 |
+
}
|
400 |
+
}
|
401 |
+
|
402 |
+
if ( false === $edd_plugin_url_available[ $store_hash ] ) {
|
403 |
+
return;
|
404 |
+
}
|
405 |
|
406 |
$data = array_merge( $this->api_data, $_data );
|
407 |
|
409 |
return;
|
410 |
}
|
411 |
|
412 |
+
if( $this->api_url == trailingslashit ( home_url() ) ) {
|
413 |
return false; // Don't allow a plugin to ping itself
|
414 |
}
|
415 |
|
418 |
'license' => ! empty( $data['license'] ) ? $data['license'] : '',
|
419 |
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
|
420 |
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
|
421 |
+
'version' => isset( $data['version'] ) ? $data['version'] : false,
|
422 |
'slug' => $data['slug'],
|
423 |
'author' => $data['author'],
|
424 |
'url' => home_url(),
|
425 |
'beta' => ! empty( $data['beta'] ),
|
426 |
);
|
427 |
|
428 |
+
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
|
429 |
|
430 |
if ( ! is_wp_error( $request ) ) {
|
431 |
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
441 |
$request->banners = maybe_unserialize( $request->banners );
|
442 |
}
|
443 |
|
444 |
+
if ( $request && isset( $request->icons ) ) {
|
445 |
+
$request->icons = maybe_unserialize( $request->icons );
|
446 |
+
}
|
447 |
+
|
448 |
+
if( ! empty( $request->sections ) ) {
|
449 |
+
foreach( $request->sections as $key => $section ) {
|
450 |
+
$request->$key = (array) $section;
|
451 |
+
}
|
452 |
+
}
|
453 |
+
|
454 |
return $request;
|
455 |
}
|
456 |
|
475 |
}
|
476 |
|
477 |
$data = $edd_plugin_data[ $_REQUEST['slug'] ];
|
478 |
+
$beta = ! empty( $data['beta'] ) ? true : false;
|
479 |
+
$cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' );
|
480 |
$version_info = $this->get_cached_version_info( $cache_key );
|
481 |
|
482 |
if( false === $version_info ) {
|
491 |
'beta' => ! empty( $data['beta'] )
|
492 |
);
|
493 |
|
494 |
+
$verify_ssl = $this->verify_ssl();
|
495 |
+
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
|
496 |
|
497 |
if ( ! is_wp_error( $request ) ) {
|
498 |
$version_info = json_decode( wp_remote_retrieve_body( $request ) );
|
499 |
}
|
500 |
|
501 |
+
|
502 |
if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
|
503 |
$version_info->sections = maybe_unserialize( $version_info->sections );
|
504 |
} else {
|
505 |
$version_info = false;
|
506 |
}
|
507 |
|
508 |
+
if( ! empty( $version_info ) ) {
|
509 |
+
foreach( $version_info->sections as $key => $section ) {
|
510 |
+
$version_info->$key = (array) $section;
|
511 |
+
}
|
512 |
+
}
|
513 |
+
|
514 |
$this->set_version_info_cache( $version_info, $cache_key );
|
515 |
|
516 |
}
|
530 |
|
531 |
$cache = get_option( $cache_key );
|
532 |
|
533 |
+
if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
|
534 |
return false; // Cache is expired
|
535 |
}
|
536 |
|
537 |
+
// We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point.
|
538 |
+
$cache['value'] = json_decode( $cache['value'] );
|
539 |
+
if ( ! empty( $cache['value']->icons ) ) {
|
540 |
+
$cache['value']->icons = (array) $cache['value']->icons;
|
541 |
+
}
|
542 |
+
|
543 |
+
return $cache['value'];
|
544 |
|
545 |
}
|
546 |
|
551 |
}
|
552 |
|
553 |
$data = array(
|
554 |
+
'timeout' => strtotime( '+3 hours', time() ),
|
555 |
'value' => json_encode( $value )
|
556 |
);
|
557 |
|
558 |
+
update_option( $cache_key, $data, 'no' );
|
559 |
+
|
560 |
+
}
|
561 |
|
562 |
+
/**
|
563 |
+
* Returns if the SSL of the store should be verified.
|
564 |
+
*
|
565 |
+
* @since 1.6.13
|
566 |
+
* @return bool
|
567 |
+
*/
|
568 |
+
private function verify_ssl() {
|
569 |
+
return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
|
570 |
}
|
571 |
|
572 |
}
|
includes/notification/post-notification.php
CHANGED
@@ -20,6 +20,7 @@ function bnfw_post_notifications( $notifications, $post_type ) {
|
|
20 |
$notifications[] = 'pending-' . $post_type;
|
21 |
$notifications[] = 'future-' . $post_type;
|
22 |
$notifications[] = 'comment-' . $post_type;
|
|
|
23 |
$notifications[] = 'new-comment';
|
24 |
$notifications[] = 'new-trackback';
|
25 |
$notifications[] = 'new-pingback';
|
20 |
$notifications[] = 'pending-' . $post_type;
|
21 |
$notifications[] = 'future-' . $post_type;
|
22 |
$notifications[] = 'comment-' . $post_type;
|
23 |
+
$notifications[] = 'moderate-' . $post_type . '-comment';
|
24 |
$notifications[] = 'new-comment';
|
25 |
$notifications[] = 'new-trackback';
|
26 |
$notifications[] = 'new-pingback';
|
includes/overrides.php
CHANGED
@@ -38,7 +38,7 @@ if ( ! function_exists( 'wp_new_user_notification' ) ) {
|
|
38 |
// we want to reverse this for the plain text arena of emails.
|
39 |
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
|
40 |
|
41 |
-
if ( $bnfw->notifier->notification_exists( 'admin-user',
|
42 |
$message = sprintf( esc_html__( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n";
|
43 |
$message .= sprintf( esc_html__( 'Username: %s' ), $user->user_login ) . "\r\n\r\n";
|
44 |
$message .= sprintf( esc_html__( 'E-mail: %s' ), $user->user_email ) . "\r\n";
|
38 |
// we want to reverse this for the plain text arena of emails.
|
39 |
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
|
40 |
|
41 |
+
if ( ! $bnfw->notifier->notification_exists( 'admin-user', false ) ) {
|
42 |
$message = sprintf( esc_html__( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n";
|
43 |
$message .= sprintf( esc_html__( 'Username: %s' ), $user->user_login ) . "\r\n\r\n";
|
44 |
$message .= sprintf( esc_html__( 'E-mail: %s' ), $user->user_email ) . "\r\n";
|
languages/bnfw-de_DE.po
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
-
"Project-Id-Version: Better Notifications for
|
4 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/bnfw\n"
|
5 |
"POT-Creation-Date: 2015-08-11 05:30:23+00:00\n"
|
6 |
"PO-Revision-Date: Tue May 17 2016 15:27:35 GMT+0200 (CEST)\n"
|
@@ -422,8 +422,8 @@ msgid "[%s] Your username and password"
|
|
422 |
msgstr "[%s] Ihr Benutzername und Passwort"
|
423 |
|
424 |
#. Plugin Name of the plugin/theme
|
425 |
-
msgid "Better Notifications for
|
426 |
-
msgstr "Better Notifications
|
427 |
|
428 |
#. Plugin URI of the plugin/theme
|
429 |
msgid "http://wordpress.org/plugins/bnfw/"
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
+
"Project-Id-Version: Better Notifications for WP 1.3.3\n"
|
4 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/bnfw\n"
|
5 |
"POT-Creation-Date: 2015-08-11 05:30:23+00:00\n"
|
6 |
"PO-Revision-Date: Tue May 17 2016 15:27:35 GMT+0200 (CEST)\n"
|
422 |
msgstr "[%s] Ihr Benutzername und Passwort"
|
423 |
|
424 |
#. Plugin Name of the plugin/theme
|
425 |
+
msgid "Better Notifications for WP"
|
426 |
+
msgstr "Better Notifications for WP"
|
427 |
|
428 |
#. Plugin URI of the plugin/theme
|
429 |
msgid "http://wordpress.org/plugins/bnfw/"
|
languages/bnfw-fr_FR.po
CHANGED
@@ -28,7 +28,7 @@ msgid "Show additional email fields"
|
|
28 |
msgstr "Afficher des champs d’emails supplémentaires"
|
29 |
|
30 |
#. Plugin Name of the plugin/theme
|
31 |
-
msgid "Better Notifications for
|
32 |
msgstr "Better Notifications pour WordPress"
|
33 |
|
34 |
#. Plugin URI of the plugin/theme
|
28 |
msgstr "Afficher des champs d’emails supplémentaires"
|
29 |
|
30 |
#. Plugin Name of the plugin/theme
|
31 |
+
msgid "Better Notifications for WP"
|
32 |
msgstr "Better Notifications pour WordPress"
|
33 |
|
34 |
#. Plugin URI of the plugin/theme
|
languages/bnfw-nl_NL.po
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
# Copyright (C) 2015 Better Notifications for
|
2 |
-
# This file is distributed under the same license as the Better Notifications for
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Better Notifications for
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/bnfw\n"
|
7 |
"POT-Creation-Date: 2015-08-11 05:30:23+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
@@ -407,7 +407,7 @@ msgid "[%s] Your username and password"
|
|
407 |
msgstr "[%s] Je gebruikersnaam en wachtwoord"
|
408 |
|
409 |
#. Plugin Name of the plugin/theme
|
410 |
-
msgid "Better Notifications for
|
411 |
msgstr ""
|
412 |
|
413 |
#. Plugin URI of the plugin/theme
|
1 |
+
# Copyright (C) 2015 Better Notifications for WP
|
2 |
+
# This file is distributed under the same license as the Better Notifications for WP package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Better Notifications for WP 1.3.3\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/bnfw\n"
|
7 |
"POT-Creation-Date: 2015-08-11 05:30:23+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
407 |
msgstr "[%s] Je gebruikersnaam en wachtwoord"
|
408 |
|
409 |
#. Plugin Name of the plugin/theme
|
410 |
+
msgid "Better Notifications for WP"
|
411 |
msgstr ""
|
412 |
|
413 |
#. Plugin URI of the plugin/theme
|
languages/bnfw-pt_BR.po
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
# Copyright (C) 2015 Better Notifications for
|
2 |
-
# This file is distributed under the same license as the Better Notifications for
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Better Notifications for
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/bnfw\n"
|
7 |
"POT-Creation-Date: 2015-08-24 17:09-0300\n"
|
8 |
"MIME-Version: 1.0\n"
|
@@ -385,7 +385,7 @@ msgid "[%s] Your username and password"
|
|
385 |
msgstr "[%s] O seu nome de usuário e senha"
|
386 |
|
387 |
#. Plugin Name of the plugin/theme
|
388 |
-
msgid "Better Notifications for
|
389 |
msgstr "Melhores notificações para WordPress"
|
390 |
|
391 |
#. Plugin URI of the plugin/theme
|
1 |
+
# Copyright (C) 2015 Better Notifications for WP
|
2 |
+
# This file is distributed under the same license as the Better Notifications for WP package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Better Notifications for WP 1.3.3\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/bnfw\n"
|
7 |
"POT-Creation-Date: 2015-08-24 17:09-0300\n"
|
8 |
"MIME-Version: 1.0\n"
|
385 |
msgstr "[%s] O seu nome de usuário e senha"
|
386 |
|
387 |
#. Plugin Name of the plugin/theme
|
388 |
+
msgid "Better Notifications for WP"
|
389 |
msgstr "Melhores notificações para WordPress"
|
390 |
|
391 |
#. Plugin URI of the plugin/theme
|
languages/bnfw.pot
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
# Copyright (C) 2015 Better Notifications for
|
2 |
-
# This file is distributed under the same license as the Better Notifications for
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Better Notifications for
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/bnfw\n"
|
7 |
"POT-Creation-Date: 2015-08-11 05:30:23+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
@@ -397,7 +397,7 @@ msgid "[%s] Your username and password"
|
|
397 |
msgstr ""
|
398 |
|
399 |
#. Plugin Name of the plugin/theme
|
400 |
-
msgid "Better Notifications for
|
401 |
msgstr ""
|
402 |
|
403 |
#. Plugin URI of the plugin/theme
|
1 |
+
# Copyright (C) 2015 Better Notifications for WP
|
2 |
+
# This file is distributed under the same license as the Better Notifications for WP package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Better Notifications for WP 1.3.3\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/bnfw\n"
|
7 |
"POT-Creation-Date: 2015-08-11 05:30:23+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
397 |
msgstr ""
|
398 |
|
399 |
#. Plugin Name of the plugin/theme
|
400 |
+
msgid "Better Notifications for WP"
|
401 |
msgstr ""
|
402 |
|
403 |
#. Plugin URI of the plugin/theme
|