From 9b0ce7c2dc11aadbe8c2c560e70903da66f30107 Mon Sep 17 00:00:00 2001 From: Oleksandr Mykhailenko Date: Wed, 14 Dec 2022 16:26:16 +0200 Subject: [PATCH] Fix bug with wp_mail filter. release new version --- CHANGELOG.md | 3 +++ includes/wp-mail-api.php | 18 +++++++----------- mailgun.php | 2 +- readme.md | 5 ++++- readme.txt | 5 ++++- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bcd528a..35c15ce 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ Changelog ========= +1.8.9 (2022-12-14) +- Fixed bug with removed wp_mail filter + 1.8.8 (2022-12-11) - Fixed bug when `$to` override in the `wp_mail` function diff --git a/includes/wp-mail-api.php b/includes/wp-mail-api.php index 3781235..7ac6298 100644 --- a/includes/wp-mail-api.php +++ b/includes/wp-mail-api.php @@ -130,27 +130,27 @@ function wp_mail($to, $subject, $message, $headers = '', $attachments = array()) // Respect WordPress core filters $atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ); - if ( isset( $atts['to'] ) ) { + if (isset($atts['to'])) { $to = $atts['to']; } - if ( ! is_array( $to ) ) { - $to = explode( ',', $to ); + if (!is_array($to)) { + $to = explode(',', $to); } - if ( isset( $atts['subject'] ) ) { + if (isset($atts['subject'])) { $subject = $atts['subject']; } - if ( isset( $atts['message'] ) ) { + if (isset($atts['message'])) { $message = $atts['message']; } - if ( isset( $atts['headers'] ) ) { + if (isset($atts['headers'])) { $headers = $atts['headers']; } - if ( isset( $atts['attachments'] ) ) { + if (isset($atts['attachments'])) { $attachments = $atts['attachments']; } @@ -158,10 +158,6 @@ function wp_mail($to, $subject, $message, $headers = '', $attachments = array()) $attachments = explode("\n", str_replace("\r\n", "\n", $attachments)); } - if (!is_array($attachments)) { - $attachments = explode("\n", str_replace("\r\n", "\n", $attachments)); - } - // Headers if (empty($headers)) { $headers = []; diff --git a/mailgun.php b/mailgun.php index 2e2342e..8f8a3ea 100755 --- a/mailgun.php +++ b/mailgun.php @@ -3,7 +3,7 @@ * Plugin Name: Mailgun * Plugin URI: http://wordpress.org/extend/plugins/mailgun/ * Description: Mailgun integration for WordPress - * Version: 1.8.8 + * Version: 1.8.9 * Tested up to: 6.1 * Author: Mailgun * Author URI: http://www.mailgun.com/ diff --git a/readme.md b/readme.md index e1172bb..eaf44cb 100755 --- a/readme.md +++ b/readme.md @@ -5,7 +5,7 @@ Contributors: mailgun, sivel, lookahead.io, m35dev Tags: mailgun, smtp, http, api, mail, email Requires at least: 3.3 Tested up to: 6.1 -Stable tag: 1.8.8 +Stable tag: 1.8.9 Requires PHP: 5.6 License: GPLv2 or later @@ -130,6 +130,9 @@ MAILGUN_FROM_ADDRESS Type: string == Changelog == += 1.8.9 (2022-12-14): = +- Fixed bug with removed wp_mail filter + = 1.8.8 (2022-12-11): = - Fixed bug when `$to` override in the `wp_mail` function diff --git a/readme.txt b/readme.txt index 991703f..0d99ada 100755 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Contributors: mailgun, sivel, lookahead.io, m35dev Tags: mailgun, smtp, http, api, mail, email Requires at least: 4.4 Tested up to: 6.1 -Stable tag: 1.8.8 +Stable tag: 1.8.9 Requires PHP: 5.6 License: GPLv2 or later @@ -128,6 +128,9 @@ MAILGUN_FROM_ADDRESS Type: string == Changelog == += 1.8.8 (2022-12-14): = +- Fixed bug with removed wp_mail filter + = 1.8.7 (2022-11-12): = - Fixed bug when field `Override "From" Details` was not updated