diff options
author | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2019-09-13 11:29:33 +0000 |
---|---|---|
committer | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2019-09-13 11:29:33 +0000 |
commit | caa73945f9fe69875171ea2aade2c53e60b21bbe (patch) | |
tree | dbcc35d42a519d3796c82c3942891226a425c2e7 /Postman/Postman-Configuration | |
parent | 5f134fb5839bf3e161385727c2a2009b54444878 (diff) | |
download | Post-SMTP-caa73945f9fe69875171ea2aade2c53e60b21bbe.zip |
hooks + sanitize bug
Diffstat (limited to 'Postman/Postman-Configuration')
4 files changed, 28 insertions, 12 deletions
diff --git a/Postman/Postman-Configuration/PostmanConfigurationController.php b/Postman/Postman-Configuration/PostmanConfigurationController.php index ee14ad8..59fbdb8 100644 --- a/Postman/Postman-Configuration/PostmanConfigurationController.php +++ b/Postman/Postman-Configuration/PostmanConfigurationController.php @@ -390,17 +390,19 @@ class PostmanConfigurationController { print '<section id="notifications">'; do_settings_sections( PostmanAdminController::NOTIFICATIONS_OPTIONS ); - $currentKey = $this->options->getNotificationService(); - $pushover = $currentKey == 'pushover' ? 'block' : 'none'; - $slack = $currentKey == 'slack' ? 'block' : 'none'; + $currentKey = $this->options->getNotificationService(); + $pushover = $currentKey == 'pushover' ? 'block' : 'none'; + $slack = $currentKey == 'slack' ? 'block' : 'none'; - echo '<div id="pushover_cred" style="display: ' . $pushover . ';">'; - do_settings_sections( PostmanAdminController::NOTIFICATIONS_PUSHOVER_CRED ); - echo '</div>'; + echo '<div id="pushover_cred" style="display: ' . $pushover . ';">'; + do_settings_sections( PostmanAdminController::NOTIFICATIONS_PUSHOVER_CRED ); + echo '</div>'; - echo '<div id="slack_cred" style="display: ' . $slack . ';">'; - do_settings_sections( PostmanAdminController::NOTIFICATIONS_SLACK_CRED ); - echo '</div>'; + echo '<div id="slack_cred" style="display: ' . $slack . ';">'; + do_settings_sections( PostmanAdminController::NOTIFICATIONS_SLACK_CRED ); + echo '</div>'; + + do_action( 'post_smtp_notification_settings' ); print '</section>'; diff --git a/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php b/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php index 6ddebd7..705ef23 100644 --- a/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php +++ b/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php @@ -234,6 +234,7 @@ class PostmanSettingsRegistry { 'notification_chrome_uid_callback', ), PostmanAdminController::NOTIFICATIONS_OPTIONS, PostmanAdminController::NOTIFICATIONS_SECTION ); + do_action( 'post_smtp_settings' ); } } @@ -443,12 +444,20 @@ class PostmanSettingsRegistry { public function notification_service_callback() { $inputDescription = __( 'Select the notification service you want to recieve alerts about failed emails.' ); + + $options = apply_filters('post_smtp_notification_service', array( + 'default' => __( 'WP Admin Email', 'post-smtp' ), + 'pushover' => __( 'Pushover', 'post-smtp' ), + 'slack' => __( 'Slack', 'post-smtp' ), + )); + printf( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::NOTIFICATION_SERVICE ); $currentKey = $this->options->getNotificationService(); - $this->printSelectOption( __( 'Email', 'post-smtp' ), 'default', $currentKey ); - $this->printSelectOption( __( 'Pushover', 'post-smtp' ), 'pushover', $currentKey ); - $this->printSelectOption( __( 'Slack', 'post-smtp' ), 'slack', $currentKey ); + foreach ( $options as $key => $label ) { + $this->printSelectOption( $label, $key, $currentKey ); + } + printf( '</select><br/><span class="postman_input_description">%s</span>', $inputDescription ); } diff --git a/Postman/Postman-Configuration/postman_manual_config.js b/Postman/Postman-Configuration/postman_manual_config.js index a47df1a..49438fc 100644 --- a/Postman/Postman-Configuration/postman_manual_config.js +++ b/Postman/Postman-Configuration/postman_manual_config.js @@ -40,6 +40,9 @@ jQuery(document).ready( $('#pushover_cred').fadeOut('fast'); $('#slack_cred').fadeIn(); } + + Hook.call( 'post_smtp_notification_change', selected ); + }); diff --git a/Postman/Postman-Configuration/postman_wizard.js b/Postman/Postman-Configuration/postman_wizard.js index d844322..cbd2031 100644 --- a/Postman/Postman-Configuration/postman_wizard.js +++ b/Postman/Postman-Configuration/postman_wizard.js @@ -517,6 +517,8 @@ function handleConfigurationResponse(response) { jQuery('#pushover_cred').fadeOut('fast'); jQuery('#slack_cred').fadeIn(); } + + Hook.call( 'post_smtp_notification_change', selected ); }); // add an event on the user port override field |