From 3686a6e1793a2c5af8b7ee4459e20887f08dc720 Mon Sep 17 00:00:00 2001 From: yehudah Date: Mon, 13 Jan 2020 06:59:45 +0000 Subject: * Fixed: Notify on error bug - crash site * Fixed: From header --- Postman/Extensions/Core/Notifications/PostmanNotify.php | 4 +++- .../Extensions/Core/Notifications/PostmanNotifyOptions.php | 13 ++++++++++++- Postman/Phpmailer/PostsmtpMailer.php | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'Postman') diff --git a/Postman/Extensions/Core/Notifications/PostmanNotify.php b/Postman/Extensions/Core/Notifications/PostmanNotify.php index d9f6a58..ae505cf 100644 --- a/Postman/Extensions/Core/Notifications/PostmanNotify.php +++ b/Postman/Extensions/Core/Notifications/PostmanNotify.php @@ -15,9 +15,11 @@ class PostmanNotify { const NOTIFICATIONS_PUSHOVER_CRED = 'postman_pushover_cred'; const NOTIFICATIONS_SLACK_CRED = 'postman_slack_cred'; + private $options; + public function __construct() { - $this->options = new PostmanNotifyOptions(); + $this->options = PostmanNotifyOptions::getInstance(); add_filter( 'post_smtp_admin_tabs', array( $this, 'tabs' ) ); add_action( 'post_smtp_settings_menu', array( $this, 'menu' ) ); diff --git a/Postman/Extensions/Core/Notifications/PostmanNotifyOptions.php b/Postman/Extensions/Core/Notifications/PostmanNotifyOptions.php index 08c27db..2973eb9 100644 --- a/Postman/Extensions/Core/Notifications/PostmanNotifyOptions.php +++ b/Postman/Extensions/Core/Notifications/PostmanNotifyOptions.php @@ -12,7 +12,18 @@ class PostmanNotifyOptions { private $options; - public function __construct() + private static $instance; + + public static function getInstance() + { + if ( ! self::$instance ) { + self::$instance = new static; + } + + return self::$instance; + } + + private function __construct() { $this->options = get_option( 'postman_options' ); } diff --git a/Postman/Phpmailer/PostsmtpMailer.php b/Postman/Phpmailer/PostsmtpMailer.php index e52091d..838cdc5 100644 --- a/Postman/Phpmailer/PostsmtpMailer.php +++ b/Postman/Phpmailer/PostsmtpMailer.php @@ -39,7 +39,7 @@ class PostsmtpMailer extends PHPMailer { public function hooks() { if ( $this->options->getTransportType() == 'smtp' ) { - add_action( 'phpmailer_init', array( $this, 'phpmailer_smtp_init' ) ); + add_action( 'phpmailer_init', array( $this, 'phpmailer_smtp_init' ), 999 ); } } -- cgit v1.2.3