updated plugin SMTP Mailer version 1.1.9

This commit is contained in:
KawaiiPunk 2023-10-22 22:21:15 +00:00 committed by Gitium
parent b59322423c
commit 880d6051ac
2 changed files with 27 additions and 16 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
/* /*
Plugin Name: SMTP Mailer Plugin Name: SMTP Mailer
Version: 1.1.6 Version: 1.1.9
Plugin URI: https://wphowto.net/smtp-mailer-plugin-for-wordpress-1482 Plugin URI: https://wphowto.net/smtp-mailer-plugin-for-wordpress-1482
Author: naa986 Author: naa986
Author URI: https://wphowto.net/ Author URI: https://wphowto.net/
@ -16,8 +16,8 @@ if (!defined('ABSPATH')){
class SMTP_MAILER { class SMTP_MAILER {
var $plugin_version = '1.1.6'; var $plugin_version = '1.1.9';
var $phpmailer_version = '6.7'; var $phpmailer_version = '6.8.0';
var $plugin_url; var $plugin_url;
var $plugin_path; var $plugin_path;
@ -36,17 +36,17 @@ class SMTP_MAILER {
} }
function loader_operations() { function loader_operations() {
if (is_admin()) {
add_filter('plugin_action_links', array($this, 'add_plugin_action_links'), 10, 2);
}
add_action('plugins_loaded', array($this, 'plugins_loaded_handler')); add_action('plugins_loaded', array($this, 'plugins_loaded_handler'));
add_action('admin_menu', array($this, 'options_menu')); add_action('admin_menu', array($this, 'options_menu'));
add_action('admin_notices', 'smtp_mailer_admin_notice'); //add_action('admin_notices', 'smtp_mailer_admin_notice');
add_filter('pre_wp_mail', 'smtp_mailer_pre_wp_mail', 10, 2); add_filter('pre_wp_mail', 'smtp_mailer_pre_wp_mail', 10, 2);
} }
function plugins_loaded_handler() function plugins_loaded_handler()
{ {
if(is_admin() && current_user_can('manage_options')){
add_filter('plugin_action_links', array($this, 'add_plugin_action_links'), 10, 2);
}
load_plugin_textdomain('smtp-mailer', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/'); load_plugin_textdomain('smtp-mailer', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');
} }
@ -522,8 +522,10 @@ function smtp_mailer_pre_wp_mail($null, $atts)
$headers = array(); $headers = array();
} else { } else {
if ( ! is_array( $headers ) ) { if ( ! is_array( $headers ) ) {
// Explode the headers out, so this function can take /*
// both string headers and an array of headers. * Explode the headers out, so this function can take
* both string headers and an array of headers.
*/
$tempheaders = explode( "\n", str_replace( "\r\n", "\n", $headers ) ); $tempheaders = explode( "\n", str_replace( "\r\n", "\n", $headers ) );
} else { } else {
$tempheaders = $headers; $tempheaders = $headers;
@ -534,7 +536,7 @@ function smtp_mailer_pre_wp_mail($null, $atts)
if ( ! empty( $tempheaders ) ) { if ( ! empty( $tempheaders ) ) {
// Iterate through the raw headers. // Iterate through the raw headers.
foreach ( (array) $tempheaders as $header ) { foreach ( (array) $tempheaders as $header ) {
if ( strpos( $header, ':' ) === false ) { if ( ! str_contains( $header, ':' ) ) {
if ( false !== stripos( $header, 'boundary=' ) ) { if ( false !== stripos( $header, 'boundary=' ) ) {
$parts = preg_split( '/boundary=/i', trim( $header ) ); $parts = preg_split( '/boundary=/i', trim( $header ) );
$boundary = trim( str_replace( array( "'", '"' ), '', $parts[1] ) ); $boundary = trim( str_replace( array( "'", '"' ), '', $parts[1] ) );
@ -570,7 +572,7 @@ function smtp_mailer_pre_wp_mail($null, $atts)
} }
break; break;
case 'content-type': case 'content-type':
if ( strpos( $content, ';' ) !== false ) { if ( str_contains( $content, ';' ) ) {
list( $type, $charset_content ) = explode( ';', $content ); list( $type, $charset_content ) = explode( ';', $content );
$content_type = trim( $type ); $content_type = trim( $type );
if ( false !== stripos( $charset_content, 'charset=' ) ) { if ( false !== stripos( $charset_content, 'charset=' ) ) {
@ -631,7 +633,7 @@ function smtp_mailer_pre_wp_mail($null, $atts)
$from_email = 'wordpress@'; $from_email = 'wordpress@';
if ( null !== $sitename ) { if ( null !== $sitename ) {
if ( 'www.' === substr( $sitename, 0, 4 ) ) { if ( str_starts_with( $sitename, 'www.' ) ) {
$sitename = substr( $sitename, 4 ); $sitename = substr( $sitename, 4 );
} }
@ -688,7 +690,7 @@ function smtp_mailer_pre_wp_mail($null, $atts)
$recipient_name = ''; $recipient_name = '';
if ( preg_match( '/(.*)<(.+)>/', $address, $matches ) ) { if ( preg_match( '/(.*)<(.+)>/', $address, $matches ) ) {
if ( count( $matches ) == 3 ) { if ( count( $matches ) === 3 ) {
$recipient_name = $matches[1]; $recipient_name = $matches[1];
$address = $matches[2]; $address = $matches[2];
} }

View File

@ -2,9 +2,9 @@
Contributors: naa986 Contributors: naa986
Donate link: https://wphowto.net/ Donate link: https://wphowto.net/
Tags: email, mail, smtp, phpmailer Tags: email, mail, smtp, phpmailer
Requires at least: 6.2 Requires at least: 6.3
Tested up to: 6.2 Tested up to: 6.3
Stable tag: 1.1.6 Stable tag: 1.1.9
License: GPLv2 or later License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html
@ -103,6 +103,15 @@ none
== Changelog == == Changelog ==
= 1.1.9 =
* Additional check for the settings link.
= 1.1.8 =
* Removed admin notices to avoid confusion since configurations can vary on different servers.
= 1.1.7 =
* WordPress 6.3 compatibility update.
= 1.1.6 = = 1.1.6 =
* WordPress 6.2 compatibility update. * WordPress 6.2 compatibility update.