From 7aa4390a6702059342aad220e53e3aa4efc9caad Mon Sep 17 00:00:00 2001 From: yehudah Date: Mon, 19 Aug 2019 20:55:55 +0000 Subject: adding hooks --- .../Postman-Configuration/PostmanConfigurationController.php | 3 +++ Postman/Postman-Mail/PostmanMailgunTransport.php | 6 +++--- Postman/Postman-Mail/PostmanModuleTransport.php | 2 +- Postman/Postman.php | 3 +++ Postman/PostmanOptions.php | 12 +++++++++++- postman-smtp.php | 1 + 6 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Postman/Postman-Configuration/PostmanConfigurationController.php b/Postman/Postman-Configuration/PostmanConfigurationController.php index 6d5b6b5..a81605a 100644 --- a/Postman/Postman-Configuration/PostmanConfigurationController.php +++ b/Postman/Postman-Configuration/PostmanConfigurationController.php @@ -235,6 +235,9 @@ class PostmanConfigurationController { print '
'; do_settings_sections( PostmanMailgunTransport::MAILGUN_AUTH_OPTIONS ); print '
'; + + do_action( 'post_smtp_settings_sections' ); + print ''; // end account config ?> diff --git a/Postman/Postman-Mail/PostmanMailgunTransport.php b/Postman/Postman-Mail/PostmanMailgunTransport.php index a673e01..63173db 100644 --- a/Postman/Postman-Mail/PostmanMailgunTransport.php +++ b/Postman/Postman-Mail/PostmanMailgunTransport.php @@ -154,9 +154,9 @@ class PostmanMailgunTransport extends PostmanAbstractModuleTransport implements // push the authentication options into the $overrideItem structure $overrideItem ['auth_items'] = array( array( - 'selected' => true, - 'name' => __( 'API Key', 'post-smtp' ), - 'value' => 'api_key', + 'selected' => true, + 'name' => __( 'API Key', 'post-smtp' ), + 'value' => 'api_key', ), ); return $overrideItem; diff --git a/Postman/Postman-Mail/PostmanModuleTransport.php b/Postman/Postman-Mail/PostmanModuleTransport.php index 37d692d..12d3d17 100644 --- a/Postman/Postman-Mail/PostmanModuleTransport.php +++ b/Postman/Postman-Mail/PostmanModuleTransport.php @@ -78,7 +78,7 @@ abstract class PostmanAbstractModuleTransport implements PostmanModuleTransport /** */ - public function __construct($rootPluginFilenameAndPath) { + public function __construct($rootPluginFilenameAndPath = null) { $this->logger = new PostmanLogger ( get_class ( $this ) ); $this->options = PostmanOptions::getInstance (); $this->rootPluginFilenameAndPath = $rootPluginFilenameAndPath; diff --git a/Postman/Postman.php b/Postman/Postman.php index 1610da5..71c7cfd 100644 --- a/Postman/Postman.php +++ b/Postman/Postman.php @@ -35,6 +35,8 @@ class Postman { private $pluginData; private $rootPluginFilenameAndPath; + public static $rootPlugin; + /** * The constructor * @@ -45,6 +47,7 @@ class Postman { assert( ! empty( $rootPluginFilenameAndPath ) ); assert( ! empty( $version ) ); $this->rootPluginFilenameAndPath = $rootPluginFilenameAndPath; + self::$rootPlugin = $rootPluginFilenameAndPath; // load the dependencies require_once 'PostmanOptions.php'; diff --git a/Postman/PostmanOptions.php b/Postman/PostmanOptions.php index 7d8c2a0..57fe658 100644 --- a/Postman/PostmanOptions.php +++ b/Postman/PostmanOptions.php @@ -164,6 +164,14 @@ if ( ! class_exists( 'PostmanOptions' ) ) { $this->load(); } + public function __call($method, $args) + { + if (isset($this->$method)) { + $func = $this->$method; + return call_user_func_array($func, $args); + } + } + public function save() { update_option( PostmanOptions::POSTMAN_OPTIONS, $this->options ); } @@ -172,7 +180,7 @@ if ( ! class_exists( 'PostmanOptions' ) ) { $this->load(); } - private function load() { + public function load() { $options = get_option( self::POSTMAN_OPTIONS ); @@ -189,6 +197,8 @@ if ( ! class_exists( 'PostmanOptions' ) ) { restore_current_blog(); } + do_action( 'post_smtp_options_load', $this ); + $this->options = $options; } diff --git a/postman-smtp.php b/postman-smtp.php index 3919867..4f4f706 100644 --- a/postman-smtp.php +++ b/postman-smtp.php @@ -129,4 +129,5 @@ function post_start( $startingMemory ) { function post_setupPostman() { require_once 'Postman/Postman.php'; $kevinCostner = new Postman( __FILE__, POST_SMTP_VER ); + do_action( 'post_smtp_init'); } -- cgit v1.2.3