diff options
Diffstat (limited to 'Postman')
-rw-r--r-- | Postman/Extensions/Core/Notifications/PostmanNotify.php | 4 | ||||
-rw-r--r-- | Postman/Extensions/Core/Notifications/PostmanNotifyOptions.php | 13 | ||||
-rw-r--r-- | Postman/Phpmailer/PostsmtpMailer.php | 2 |
3 files changed, 16 insertions, 3 deletions
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 ); } } |