diff options
Diffstat (limited to 'Postman/Postman-Configuration')
3 files changed, 191 insertions, 161 deletions
diff --git a/Postman/Postman-Configuration/PostmanConfigurationController.php b/Postman/Postman-Configuration/PostmanConfigurationController.php index bc9c274..6d5b6b5 100644 --- a/Postman/Postman-Configuration/PostmanConfigurationController.php +++ b/Postman/Postman-Configuration/PostmanConfigurationController.php @@ -12,10 +12,12 @@ class PostmanConfigurationController { // Holds the values to be used in the fields callbacks private $rootPluginFilenameAndPath; + private $importableConfiguration; + /** * Constructor * - * @param unknown $rootPluginFilenameAndPath + * @param mixed $rootPluginFilenameAndPath */ public function __construct( $rootPluginFilenameAndPath ) { assert( ! empty( $rootPluginFilenameAndPath ) ); @@ -94,11 +96,11 @@ class PostmanConfigurationController { /** */ private function addLocalizeScriptsToPage() { - $warning = __( 'Warning', Postman::TEXT_DOMAIN ); + $warning = __( 'Warning', 'post-smtp' ); /* translators: where %s is the name of the SMTP server */ - wp_localize_script( 'postman_wizard_script', 'postman_smtp_mitm', sprintf( '%s: %s', $warning, __( 'connected to %1$s instead of %2$s.', Postman::TEXT_DOMAIN ) ) ); + wp_localize_script( 'postman_wizard_script', 'postman_smtp_mitm', sprintf( '%s: %s', $warning, __( 'connected to %1$s instead of %2$s.', 'post-smtp' ) ) ); /* translators: where %d is a port number */ - wp_localize_script( 'postman_wizard_script', 'postman_wizard_bad_redirect_url', __( 'You are about to configure OAuth 2.0 with an IP address instead of a domain name. This is not permitted. Either assign a real domain name to your site or add a fake one in your local host file.', Postman::TEXT_DOMAIN ) ); + wp_localize_script( 'postman_wizard_script', 'postman_wizard_bad_redirect_url', __( 'You are about to configure OAuth 2.0 with an IP address instead of a domain name. This is not permitted. Either assign a real domain name to your site or add a fake one in your local host file.', 'post-smtp' ) ); // user input wp_localize_script( PostmanViewController::POSTMAN_SCRIPT, 'postman_input_sender_email', '#input_' . PostmanOptions::MESSAGE_SENDER_EMAIL ); @@ -131,7 +133,7 @@ class PostmanConfigurationController { * Register the Configuration screen */ public function addConfigurationSubmenu() { - $page = add_submenu_page( null, sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ) ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanConfigurationController::CONFIGURATION_SLUG, array( + $page = add_submenu_page( null, sprintf( __( '%s Setup', 'post-smtp' ), __( 'Postman SMTP', 'post-smtp' ) ), __( 'Postman SMTP', 'post-smtp' ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanConfigurationController::CONFIGURATION_SLUG, array( $this, 'outputManualConfigurationContent', ) ); @@ -155,7 +157,7 @@ class PostmanConfigurationController { * Register the Setup Wizard screen */ public function addSetupWizardSubmenu() { - $page = add_submenu_page( null, sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ) ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanConfigurationController::CONFIGURATION_WIZARD_SLUG, array( + $page = add_submenu_page( null, sprintf( __( '%s Setup', 'post-smtp' ), __( 'Postman SMTP', 'post-smtp' ) ), __( 'Postman SMTP', 'post-smtp' ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanConfigurationController::CONFIGURATION_WIZARD_SLUG, array( $this, 'outputWizardContent', ) ); @@ -194,14 +196,14 @@ class PostmanConfigurationController { public function outputManualConfigurationContent() { print '<div class="wrap">'; - PostmanViewController::outputChildPageHeader( __( 'Settings', Postman::TEXT_DOMAIN ), 'advanced_config' ); + PostmanViewController::outputChildPageHeader( __( 'Settings', 'post-smtp' ), 'advanced_config' ); print '<div id="config_tabs"><ul>'; - print sprintf( '<li><a href="#account_config">%s</a></li>', __( 'Account', Postman::TEXT_DOMAIN ) ); - print sprintf( '<li><a href="#fallback">%s</a></li>', __( 'Fallback', Postman::TEXT_DOMAIN ) ); - print sprintf( '<li><a href="#message_config">%s</a></li>', __( 'Message', Postman::TEXT_DOMAIN ) ); - print sprintf( '<li><a href="#logging_config">%s</a></li>', __( 'Logging', Postman::TEXT_DOMAIN ) ); - print sprintf( '<li><a href="#advanced_options_config">%s</a></li>', __( 'Advanced', Postman::TEXT_DOMAIN ) ); - print sprintf( '<li><a href="#notifications">%s</a></li>', __( 'Notifications', Postman::TEXT_DOMAIN ) ); + print sprintf( '<li><a href="#account_config">%s</a></li>', __( 'Account', 'post-smtp' ) ); + print sprintf( '<li><a href="#fallback">%s</a></li>', __( 'Fallback', 'post-smtp' ) ); + print sprintf( '<li><a href="#message_config">%s</a></li>', __( 'Message', 'post-smtp' ) ); + print sprintf( '<li><a href="#logging_config">%s</a></li>', __( 'Logging', 'post-smtp' ) ); + print sprintf( '<li><a href="#advanced_options_config">%s</a></li>', __( 'Advanced', 'post-smtp' ) ); + print sprintf( '<li><a href="#notifications">%s</a></li>', __( 'Notifications', 'post-smtp' ) ); print '</ul>'; print '<form method="post" action="options.php">'; @@ -239,29 +241,29 @@ class PostmanConfigurationController { <!-- Fallback Start --> <section id="fallback"> - <h2><?php esc_html_e( 'Failed emails fallback', Postman::TEXT_DOMAIN ); ?></h2> - <p><?php esc_html_e( 'By enable this option, if your email is fail to send Post SMTP will try to use the SMTP service you define here.', Postman::TEXT_DOMAIN ); ?></p> + <h2><?php esc_html_e( 'Failed emails fallback', 'post-smtp' ); ?></h2> + <p><?php esc_html_e( 'By enable this option, if your email is fail to send Post SMTP will try to use the SMTP service you define here.', 'post-smtp' ); ?></p> <table class="form-table"> <tr valign=""> - <th scope="row"><?php _e( 'Use Fallback?', Postman::TEXT_DOMAIN ); ?></th> + <th scope="row"><?php _e( 'Use Fallback?', 'post-smtp' ); ?></th> <td> <label> <input name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_ENABLED; ?>]" type="radio" value="no"<?php echo checked( $this->options->getFallbackIsEnabled(), 'no' ); ?>> - <?php _e( 'No', Postman::TEXT_DOMAIN ); ?> + <?php _e( 'No', 'post-smtp' ); ?> </label> <label> <?php $checked = checked( $this->options->getFallbackIsEnabled(), 'yes', false ); ?> <input name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_ENABLED; ?>]" type="radio" value="yes"<?php echo checked( $this->options->getFallbackIsEnabled(), 'yes' ); ?>> - <?php _e( 'Yes', Postman::TEXT_DOMAIN ); ?> + <?php _e( 'Yes', 'post-smtp' ); ?> </label> </td> </tr> <tr> - <th scope="row"><?php _e('Outgoing Mail Server', Postman::TEXT_DOMAIN ); ?></th> + <th scope="row"><?php _e('Outgoing Mail Server', 'post-smtp' ); ?></th> <?php $host = $this->options->getFallbackHostname(); ?> <td> <input type="text" id="fallback-smtp-host" name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_HOSTNAME; ?>]" @@ -270,7 +272,7 @@ class PostmanConfigurationController { </tr> <tr> - <th scope="row"><?php _e('Mail Server Port', Postman::TEXT_DOMAIN ); ?></th> + <th scope="row"><?php _e('Mail Server Port', 'post-smtp' ); ?></th> <?php $port = $this->options->getFallbackPort(); ?> <td> <input type="number" id="fallback-smtp-port" name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_PORT; ?>]" @@ -279,12 +281,12 @@ class PostmanConfigurationController { </tr> <tr> - <th scope="row"><?php _e('Security', Postman::TEXT_DOMAIN ); ?></th> + <th scope="row"><?php _e('Security', 'post-smtp' ); ?></th> <?php $security_options = array( - 'none' => __( 'None', Postman::TEXT_DOMAIN ), - 'ssl' => __( 'SSL', Postman::TEXT_DOMAIN ), - 'tls' => __( 'TLS', Postman::TEXT_DOMAIN ), + 'none' => __( 'None', 'post-smtp' ), + 'ssl' => __( 'SSL', 'post-smtp' ), + 'tls' => __( 'TLS', 'post-smtp' ), ); ?> <td> @@ -302,36 +304,36 @@ class PostmanConfigurationController { </tr> <tr> - <th scope="row"><?php _e('From Email', Postman::TEXT_DOMAIN ); ?></th> + <th scope="row"><?php _e('From Email', 'post-smtp' ); ?></th> <td> <input type="email" id="fallback-smtp-from-email" value="<?php echo $this->options->getFallbackFromEmail(); ?>" name="postman_options[<?php echo PostmanOptions::FALLBACK_FROM_EMAIL; ?>]" > <br> - <small><?php _e( "Use allowed email, for example: If you are using Gmail, type your Gmail adress.", Postman::TEXT_DOMAIN ); ?></small> + <small><?php _e( "Use allowed email, for example: If you are using Gmail, type your Gmail adress.", 'post-smtp' ); ?></small> </td> </tr> <tr valign=""> - <th scope="row"><?php _e( 'Use SMTP Authentication?', Postman::TEXT_DOMAIN ); ?></th> + <th scope="row"><?php _e( 'Use SMTP Authentication?', 'post-smtp' ); ?></th> <td> <label> <input name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_USE_AUTH; ?>]" type="radio" value="none"<?php checked( $this->options->getFallbackAuth(), 'none' ); ?>> - <?php _e( 'No', Postman::TEXT_DOMAIN ); ?> + <?php _e( 'No', 'post-smtp' ); ?> </label> <label> <input name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_USE_AUTH; ?>]" type="radio" value="login"<?php checked( $this->options->getFallbackAuth(), 'login' ); ?>> - <?php _e( 'Yes', Postman::TEXT_DOMAIN ); ?> + <?php _e( 'Yes', 'post-smtp' ); ?> </label> </td> </tr> <tr> - <th scope="row"><?php _e('User name', Postman::TEXT_DOMAIN ); ?></th> + <th scope="row"><?php _e('User name', 'post-smtp' ); ?></th> <td> <input type="text" id="fallback-smtp-username" value="<?php echo $this->options->getFallbackUsername(); ?>" @@ -341,7 +343,7 @@ class PostmanConfigurationController { </tr> <tr> - <th scope="row"><?php _e('Password', Postman::TEXT_DOMAIN ); ?></th> + <th scope="row"><?php _e('Password', 'post-smtp' ); ?></th> <td> <input type="password" id="fallback-smtp-password" value="<?php echo PostmanUtils::obfuscatePassword( $this->options->getFallbackPassword() ); ?>" @@ -408,7 +410,7 @@ class PostmanConfigurationController { // construct Wizard print '<div class="wrap">'; - PostmanViewController::outputChildPageHeader( __( 'Setup Wizard', Postman::TEXT_DOMAIN ) ); + PostmanViewController::outputChildPageHeader( __( 'Setup Wizard', 'post-smtp' ) ); print '<form id="postman_wizard" method="post" action="options.php">'; @@ -440,12 +442,12 @@ class PostmanConfigurationController { settings_fields( PostmanAdminController::SETTINGS_GROUP_NAME ); // Wizard Step 0 - printf( '<h5>%s</h5>', _x( 'Import Configuration', 'Wizard Step Title', Postman::TEXT_DOMAIN ) ); + printf( '<h5>%s</h5>', _x( 'Import Configuration', 'Wizard Step Title', 'post-smtp' ) ); print '<fieldset>'; - printf( '<legend>%s</legend>', _x( 'Import configuration from another plugin?', 'Wizard Step Title', Postman::TEXT_DOMAIN ) ); - printf( '<p>%s</p>', __( 'If you had a working configuration with another Plugin, the Setup Wizard can begin with those settings.', Postman::TEXT_DOMAIN ) ); + printf( '<legend>%s</legend>', _x( 'Import configuration from another plugin?', 'Wizard Step Title', 'post-smtp' ) ); + printf( '<p>%s</p>', __( 'If you had a working configuration with another Plugin, the Setup Wizard can begin with those settings.', 'post-smtp' ) ); print '<table class="input_auth_type">'; - printf( '<tr><td><input type="radio" id="import_none" name="input_plugin" value="%s" checked="checked"></input></td><td><label> %s</label></td></tr>', 'none', __( 'None', Postman::TEXT_DOMAIN ) ); + printf( '<tr><td><input type="radio" id="import_none" name="input_plugin" value="%s" checked="checked"></input></td><td><label> %s</label></td></tr>', 'none', __( 'None', 'post-smtp' ) ); if ( $this->importableConfiguration->isImportAvailable() ) { foreach ( $this->importableConfiguration->getAvailableOptions() as $options ) { @@ -456,20 +458,20 @@ class PostmanConfigurationController { print '</fieldset>'; // Wizard Step 1 - printf( '<h5>%s</h5>', _x( 'Sender Details', 'Wizard Step Title', Postman::TEXT_DOMAIN ) ); + printf( '<h5>%s</h5>', _x( 'Sender Details', 'Wizard Step Title', 'post-smtp' ) ); print '<fieldset>'; - printf( '<legend>%s</legend>', _x( 'Who is the mail coming from?', 'Wizard Step Title', Postman::TEXT_DOMAIN ) ); - printf( '<p>%s</p>', __( 'Enter the email address and name you\'d like to send mail as.', Postman::TEXT_DOMAIN ) ); - printf( '<p>%s</p>', __( 'Please note that to prevent abuse, many email services will <em>not</em> let you send from an email address other than the one you authenticate with.', Postman::TEXT_DOMAIN ) ); - printf( '<label for="postman_options[sender_email]">%s</label>', __( 'Email Address', Postman::TEXT_DOMAIN ) ); + printf( '<legend>%s</legend>', _x( 'Who is the mail coming from?', 'Wizard Step Title', 'post-smtp' ) ); + printf( '<p>%s</p>', __( 'Enter the email address and name you\'d like to send mail as.', 'post-smtp' ) ); + printf( '<p>%s</p>', __( 'Please note that to prevent abuse, many email services will <em>not</em> let you send from an email address other than the one you authenticate with.', 'post-smtp' ) ); + printf( '<label for="postman_options[sender_email]">%s</label>', __( 'Email Address', 'post-smtp' ) ); print $this->settingsRegistry->from_email_callback(); print '<br/>'; - printf( '<label for="postman_options[sender_name]">%s</label>', __( 'Name', Postman::TEXT_DOMAIN ) ); + printf( '<label for="postman_options[sender_name]">%s</label>', __( 'Name', 'post-smtp' ) ); print $this->settingsRegistry->sender_name_callback(); print '</fieldset>'; // Wizard Step 2 - printf( '<h5>%s</h5>', __( 'Outgoing Mail Server Hostname', Postman::TEXT_DOMAIN ) ); + printf( '<h5>%s</h5>', __( 'Outgoing Mail Server Hostname', 'post-smtp' ) ); print '<fieldset>'; foreach ( PostmanTransportRegistry::getInstance()->getTransports() as $transport ) { $transport->printWizardMailServerHostnameStep(); @@ -477,11 +479,11 @@ class PostmanConfigurationController { print '</fieldset>'; // Wizard Step 3 - printf( '<h5>%s</h5>', __( 'Connectivity Test', Postman::TEXT_DOMAIN ) ); + printf( '<h5>%s</h5>', __( 'Connectivity Test', 'post-smtp' ) ); print '<fieldset>'; - printf( '<legend>%s</legend>', __( 'How will the connection to the mail server be established?', Postman::TEXT_DOMAIN ) ); - printf( '<p>%s</p>', __( 'Your connection settings depend on what your email service provider offers, and what your WordPress host allows.', Postman::TEXT_DOMAIN ) ); - printf( '<p id="connectivity_test_status">%s: <span id="port_test_status">%s</span></p>', __( 'Connectivity Test', Postman::TEXT_DOMAIN ), _x( 'Ready', 'TCP Port Test Status', Postman::TEXT_DOMAIN ) ); + printf( '<legend>%s</legend>', __( 'How will the connection to the mail server be established?', 'post-smtp' ) ); + printf( '<p>%s</p>', __( 'Your connection settings depend on what your email service provider offers, and what your WordPress host allows.', 'post-smtp' ) ); + printf( '<p id="connectivity_test_status">%s: <span id="port_test_status">%s</span></p>', __( 'Connectivity Test', 'post-smtp' ), _x( 'Ready', 'TCP Port Test Status', 'post-smtp' ) ); printf( '<p class="ajax-loader" style="display:none"><img src="%s"/></p>', plugins_url( 'post-smtp/style/ajax-loader.gif' ) ); printf( '<input type="hidden" id="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::TRANSPORT_TYPE ); printf( '<input type="hidden" id="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::PORT ); @@ -489,27 +491,27 @@ class PostmanConfigurationController { printf( '<input type="hidden" id="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::AUTHENTICATION_TYPE ); print '<p id="wizard_recommendation"></p>'; /* Translators: Where %1$s is the socket identifier and %2$s is the authentication type */ - printf( '<p class="user_override" style="display:none"><label><span>%s:</span></label> <table id="user_socket_override" class="user_override"></table></p>', _x( 'Socket', 'A socket is the network term for host and port together', Postman::TEXT_DOMAIN ) ); - printf( '<p class="user_override" style="display:none"><label><span>%s:</span></label> <table id="user_auth_override" class="user_override"></table></p>', __( 'Authentication', Postman::TEXT_DOMAIN ) ); + printf( '<p class="user_override" style="display:none"><label><span>%s:</span></label> <table id="user_socket_override" class="user_override"></table></p>', _x( 'Socket', 'A socket is the network term for host and port together', 'post-smtp' ) ); + printf( '<p class="user_override" style="display:none"><label><span>%s:</span></label> <table id="user_auth_override" class="user_override"></table></p>', __( 'Authentication', 'post-smtp' ) ); print ('<p><span id="smtp_mitm" style="display:none; background-color:yellow"></span></p>') ; - $warning = __( 'Warning', Postman::TEXT_DOMAIN ); - $clearCredentialsWarning = __( 'This configuration option will send your authorization credentials in the clear.', Postman::TEXT_DOMAIN ); + $warning = __( 'Warning', 'post-smtp' ); + $clearCredentialsWarning = __( 'This configuration option will send your authorization credentials in the clear.', 'post-smtp' ); printf( '<p id="smtp_not_secure" style="display:none"><span style="background-color:yellow">%s: %s</span></p>', $warning, $clearCredentialsWarning ); print '</fieldset>'; // Wizard Step 4 - printf( '<h5>%s</h5>', __( 'Authentication', Postman::TEXT_DOMAIN ) ); + printf( '<h5>%s</h5>', __( 'Authentication', 'post-smtp' ) ); print '<fieldset>'; - printf( '<legend>%s</legend>', __( 'How will you prove your identity to the mail server?', Postman::TEXT_DOMAIN ) ); + printf( '<legend>%s</legend>', __( 'How will you prove your identity to the mail server?', 'post-smtp' ) ); foreach ( PostmanTransportRegistry::getInstance()->getTransports() as $transport ) { $transport->printWizardAuthenticationStep(); } print '</fieldset>'; // Wizard Step 5 - Notificiations - printf( '<h5>%s</h5>', __( 'Notifications', Postman::TEXT_DOMAIN ) ); + printf( '<h5>%s</h5>', __( 'Notifications', 'post-smtp' ) ); print '<fieldset>'; - printf( '<legend>%s</legend>', __( 'Select a notify service to notify you when an email is failed to delivered.', Postman::TEXT_DOMAIN ) ); + printf( '<legend>%s</legend>', __( 'Select a notify service to notify you when an email is failed to delivered.', 'post-smtp' ) ); ?> <select id="input_notification_service" class="input_notification_service" name="postman_options[notification_service]"> @@ -518,17 +520,17 @@ class PostmanConfigurationController { <option value="slack">Slack</option> </select> <div id="pushover_cred" style="display: none;"> - <h2><?php _e( 'Pushover Credentials', Postman::TEXT_DOMAIN ); ?></h2> + <h2><?php _e( 'Pushover Credentials', 'post-smtp' ); ?></h2> <table class="form-table"> <tbody> <tr> - <th scope="row"><?php _e( 'Pushover User Key', Postman::TEXT_DOMAIN ); ?></th> + <th scope="row"><?php _e( 'Pushover User Key', 'post-smtp' ); ?></th> <td> <input type="password" id="pushover_user" name="postman_options[pushover_user]" value=""> </td> </tr> <tr> - <th scope="row"><?php _e( 'Pushover App Token', Postman::TEXT_DOMAIN ); ?></th> + <th scope="row"><?php _e( 'Pushover App Token', 'post-smtp' ); ?></th> <td> <input type="password" id="pushover_token" name="postman_options[pushover_token]" value=""> </td> @@ -537,15 +539,15 @@ class PostmanConfigurationController { </table> </div> <div id="slack_cred" style="display: none;"> - <h2><?php _e( 'Slack Credentials', Postman::TEXT_DOMAIN ); ?></h2> + <h2><?php _e( 'Slack Credentials', 'post-smtp' ); ?></h2> <table class="form-table"> <tbody> <tr> - <th scope="row"><?php _e( 'Slack webhook', Postman::TEXT_DOMAIN ); ?></th> + <th scope="row"><?php _e( 'Slack webhook', 'post-smtp' ); ?></th> <td> <input type="password" id="slack_token" name="postman_options[slack_token]" value=""> <a target="_blank" class="" href="https://slack.postmansmtp.com/"> - <?php _e( 'Get your webhook URL here.', Postman::TEXT_DOMAIN ); ?> + <?php _e( 'Get your webhook URL here.', 'post-smtp' ); ?> </a> </td> </tr> @@ -554,20 +556,20 @@ class PostmanConfigurationController { </div> <div id="use-chrome-extension"> - <h2><?php _e( 'Push To Chrome Extension', Postman::TEXT_DOMAIN ); ?></h2> + <h2><?php _e( 'Push To Chrome Extension', 'post-smtp' ); ?></h2> <table class="form-table"> <tbody> <tr> - <th scope="row"><?php _e( 'This is an extra notification to the selection above', Postman::TEXT_DOMAIN ); ?></th> + <th scope="row"><?php _e( 'This is an extra notification to the selection above', 'post-smtp' ); ?></th> <td> <input type="checkbox" id="notification_use_chrome" name="postman_options[notification_use_chrome]"> <a target="_blank" class="" href="https://chrome.google.com/webstore/detail/npklmbkpbknkmbohdbpikeidiaekjoch"> - <?php _e( 'You can download the chrome extensiom here.', Postman::TEXT_DOMAIN ); ?> + <?php _e( 'You can download the chrome extension here.', 'post-smtp' ); ?> </a> </td> </tr> <tr> - <th scope="row"><?php _e( 'Your UID as you see in the extension.', Postman::TEXT_DOMAIN ); ?></th> + <th scope="row"><?php _e( 'Your UID as you see in the extension.', 'post-smtp' ); ?></th> <td> <input type="password" id="notification_chrome_uid" name="postman_options[notification_chrome_uid]" value=""> </td> @@ -580,15 +582,22 @@ class PostmanConfigurationController { print '</fieldset>'; // Wizard Step 6 - printf( '<h5>%s</h5>', _x( 'Finish', 'The final step of the Wizard', Postman::TEXT_DOMAIN ) ); + printf( '<h5>%s</h5>', _x( 'Finish', 'The final step of the Wizard', 'post-smtp' ) ); print '<fieldset>'; - printf( '<legend>%s</legend>', _x( 'You\'re Done!', 'Wizard Step Title', Postman::TEXT_DOMAIN ) ); + printf( '<legend>%s</legend>', _x( 'You\'re Done!', 'Wizard Step Title', 'post-smtp' ) ); print '<section>'; - printf( '<p>%s</p>', __( 'Click Finish to save these settings, then:', Postman::TEXT_DOMAIN ) ); + printf( '<p>%s</p>', __( 'Click Finish to save these settings, then:', 'post-smtp' ) ); print '<ul style="margin-left: 20px">'; - printf( '<li class="wizard-auth-oauth2">%s</li>', __( 'Grant permission with the Email Provider for Postman to send email and', Postman::TEXT_DOMAIN ) ); - printf( '<li>%s</li>', __( 'Send yourself a Test Email to make sure everything is working!', Postman::TEXT_DOMAIN ) ); + printf( '<li class="wizard-auth-oauth2">%s</li>', __( 'Grant permission with the Email Provider for Postman to send email and', 'post-smtp' ) ); + printf( '<li>%s</li>', __( 'Send yourself a Test Email to make sure everything is working!', 'post-smtp' ) ); print '</ul>'; + + // Get PHPmailer recommendation + Postman::getMailerTypeRecommend(); + + $in_wizard = true; + include_once POST_PATH . '/Postman/extra/donation.php'; + print '</section>'; print '</fieldset>'; print '</form>'; @@ -730,7 +739,7 @@ class PostmanManageConfigurationAjaxHandler extends PostmanAbstractAjaxHandler { wp_send_json_success( $response ); } else { /* translators: where %s is the URL to the Connectivity Test page */ - $configuration ['message'] = sprintf( __( 'Postman can\'t find any way to send mail on your system. Run a <a href="%s">connectivity test</a>.', Postman::TEXT_DOMAIN ), PostmanViewController::getPageUrl( PostmanViewController::PORT_TEST_SLUG ) ); + $configuration ['message'] = sprintf( __( 'Postman can\'t find any way to send mail on your system. Run a <a href="%s">connectivity test</a>.', 'post-smtp' ), PostmanViewController::getPageUrl( PostmanViewController::PORT_TEST_SLUG ) ); $response ['configuration'] = $configuration; if ( $this->logger->isTrace() ) { $this->logger->trace( 'configuration:' ); @@ -745,8 +754,8 @@ class PostmanManageConfigurationAjaxHandler extends PostmanAbstractAjaxHandler { * // ask a transport if they support it, and if they do at what priority is it * // configure for the highest priority you find * - * @param unknown $queryHostData - * @return unknown + * @param mixed $queryHostData + * @return mixed */ private function getWinningRecommendation( $sockets, $userSocketOverride, $userAuthOverride, $originalSmtpServer ) { foreach ( $sockets as $socket ) { @@ -758,11 +767,11 @@ class PostmanManageConfigurationAjaxHandler extends PostmanAbstractAjaxHandler { /** * - * @param PostmanSocket $socket - * @param unknown $userSocketOverride - * @param unknown $userAuthOverride - * @param unknown $originalSmtpServer - * @return Ambigous <NULL, unknown, string> + * @param PostmanWizardSocket $socket + * @param mixed $userSocketOverride + * @param mixed $userAuthOverride + * @param mixed $originalSmtpServer + * @return mixed */ private function getWin( PostmanWizardSocket $socket, $userSocketOverride, $userAuthOverride, $originalSmtpServer ) { static $recommendationPriority = - 1; @@ -790,7 +799,7 @@ class PostmanManageConfigurationAjaxHandler extends PostmanAbstractAjaxHandler { /** * - * @param unknown $queryHostData + * @param mixed $queryHostData * @return multitype: */ private function createOverrideMenus( $sockets, $winningRecommendation, $userSocketOverride, $userAuthOverride ) { @@ -815,9 +824,9 @@ class PostmanManageConfigurationAjaxHandler extends PostmanAbstractAjaxHandler { /** * * @param PostmanWizardSocket $socket - * @param unknown $winningRecommendation - * @param unknown $userSocketOverride - * @param unknown $userAuthOverride + * @param mixed $winningRecommendation + * @param mixed $userSocketOverride + * @param mixed $userAuthOverride */ private function createOverrideMenu( PostmanWizardSocket $socket, $winningRecommendation, $userSocketOverride, $userAuthOverride ) { if ( $socket->success ) { diff --git a/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php b/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php index 7882d43..84305a3 100644 --- a/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php +++ b/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php @@ -28,23 +28,28 @@ class PostmanSettingsRegistry { ) ); // Sanitize - add_settings_section( 'transport_section', __( 'Transport', Postman::TEXT_DOMAIN ), array( + add_settings_section( 'transport_section', __( 'Transport', 'post-smtp' ), array( $this, 'printTransportSectionInfo', ), 'transport_options' ); - add_settings_field( PostmanOptions::TRANSPORT_TYPE, _x( 'Type', '(i.e.) What kind is it?', Postman::TEXT_DOMAIN ), array( - $this, - 'transport_type_callback', - ), 'transport_options', 'transport_section' ); + add_settings_field( PostmanOptions::TRANSPORT_TYPE, _x( 'Type', '(i.e.) What kind is it?', 'post-smtp' ), array( + $this, + 'transport_type_callback', + ), 'transport_options', 'transport_section' ); + + add_settings_field( 'smtp_mailers', __( 'Mailer Type', 'post-smtp' ), array( + $this, + 'smtp_mailer_callback', + ), 'transport_options', 'transport_section' ); // the Message From section - add_settings_section( PostmanAdminController::MESSAGE_FROM_SECTION, _x( 'From Address', 'The Message Sender Email Address', Postman::TEXT_DOMAIN ), array( + add_settings_section( PostmanAdminController::MESSAGE_FROM_SECTION, _x( 'From Address', 'The Message Sender Email Address', 'post-smtp' ), array( $this, 'printMessageFromSectionInfo', ), PostmanAdminController::MESSAGE_FROM_OPTIONS ); - add_settings_field( PostmanOptions::MESSAGE_SENDER_EMAIL, __( 'Email Address', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::MESSAGE_SENDER_EMAIL, __( 'Email Address', 'post-smtp' ), array( $this, 'from_email_callback', ), PostmanAdminController::MESSAGE_FROM_OPTIONS, PostmanAdminController::MESSAGE_FROM_SECTION ); @@ -54,7 +59,7 @@ class PostmanSettingsRegistry { 'prevent_from_email_override_callback', ), PostmanAdminController::MESSAGE_FROM_OPTIONS, PostmanAdminController::MESSAGE_FROM_SECTION ); - add_settings_field( PostmanOptions::MESSAGE_SENDER_NAME, __( 'Name', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::MESSAGE_SENDER_NAME, __( 'Name', 'post-smtp' ), array( $this, 'sender_name_callback', ), PostmanAdminController::MESSAGE_FROM_OPTIONS, PostmanAdminController::MESSAGE_FROM_SECTION ); @@ -65,38 +70,38 @@ class PostmanSettingsRegistry { ), PostmanAdminController::MESSAGE_FROM_OPTIONS, PostmanAdminController::MESSAGE_FROM_SECTION ); // the Additional Addresses section - add_settings_section( PostmanAdminController::MESSAGE_SECTION, __( 'Additional Email Addresses', Postman::TEXT_DOMAIN ), array( + add_settings_section( PostmanAdminController::MESSAGE_SECTION, __( 'Additional Email Addresses', 'post-smtp' ), array( $this, 'printMessageSectionInfo', ), PostmanAdminController::MESSAGE_OPTIONS ); - add_settings_field( PostmanOptions::REPLY_TO, __( 'Reply-To', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::REPLY_TO, __( 'Reply-To', 'post-smtp' ), array( $this, 'reply_to_callback', ), PostmanAdminController::MESSAGE_OPTIONS, PostmanAdminController::MESSAGE_SECTION ); - add_settings_field( PostmanOptions::FORCED_TO_RECIPIENTS, __( 'To Recipient(s)', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::FORCED_TO_RECIPIENTS, __( 'To Recipient(s)', 'post-smtp' ), array( $this, 'to_callback', ), PostmanAdminController::MESSAGE_OPTIONS, PostmanAdminController::MESSAGE_SECTION ); - add_settings_field( PostmanOptions::FORCED_CC_RECIPIENTS, __( 'Carbon Copy Recipient(s)', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::FORCED_CC_RECIPIENTS, __( 'Carbon Copy Recipient(s)', 'post-smtp' ), array( $this, 'cc_callback', ), PostmanAdminController::MESSAGE_OPTIONS, PostmanAdminController::MESSAGE_SECTION ); - add_settings_field( PostmanOptions::FORCED_BCC_RECIPIENTS, __( 'Blind Carbon Copy Recipient(s)', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::FORCED_BCC_RECIPIENTS, __( 'Blind Carbon Copy Recipient(s)', 'post-smtp' ), array( $this, 'bcc_callback', ), PostmanAdminController::MESSAGE_OPTIONS, PostmanAdminController::MESSAGE_SECTION ); // the Additional Headers section - add_settings_section( PostmanAdminController::MESSAGE_HEADERS_SECTION, __( 'Additional Headers', Postman::TEXT_DOMAIN ), array( + add_settings_section( PostmanAdminController::MESSAGE_HEADERS_SECTION, __( 'Additional Headers', 'post-smtp' ), array( $this, 'printAdditionalHeadersSectionInfo', ), PostmanAdminController::MESSAGE_HEADERS_OPTIONS ); - add_settings_field( PostmanOptions::ADDITIONAL_HEADERS, __( 'Custom Headers', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::ADDITIONAL_HEADERS, __( 'Custom Headers', 'post-smtp' ), array( $this, 'headers_callback', ), PostmanAdminController::MESSAGE_HEADERS_OPTIONS, PostmanAdminController::MESSAGE_HEADERS_SECTION ); @@ -104,123 +109,123 @@ class PostmanSettingsRegistry { // Fallback // the Email Validation section - add_settings_section( PostmanAdminController::EMAIL_VALIDATION_SECTION, __( 'Validation', Postman::TEXT_DOMAIN ), array( + add_settings_section( PostmanAdminController::EMAIL_VALIDATION_SECTION, __( 'Validation', 'post-smtp' ), array( $this, 'printEmailValidationSectionInfo', ), PostmanAdminController::EMAIL_VALIDATION_OPTIONS ); - add_settings_field( PostmanOptions::ENVELOPE_SENDER, __( 'Email Address', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::ENVELOPE_SENDER, __( 'Email Address', 'post-smtp' ), array( $this, 'disable_email_validation_callback', ), PostmanAdminController::EMAIL_VALIDATION_OPTIONS, PostmanAdminController::EMAIL_VALIDATION_SECTION ); // the Logging section - add_settings_section( PostmanAdminController::LOGGING_SECTION, __( 'Email Log Settings', Postman::TEXT_DOMAIN ), array( + add_settings_section( PostmanAdminController::LOGGING_SECTION, __( 'Email Log Settings', 'post-smtp' ), array( $this, 'printLoggingSectionInfo', ), PostmanAdminController::LOGGING_OPTIONS ); - add_settings_field( 'logging_status', __( 'Enable Logging', Postman::TEXT_DOMAIN ), array( + add_settings_field( 'logging_status', __( 'Enable Logging', 'post-smtp' ), array( $this, 'loggingStatusInputField', ), PostmanAdminController::LOGGING_OPTIONS, PostmanAdminController::LOGGING_SECTION ); - add_settings_field( 'logging_max_entries', __( 'Maximum Log Entries', Postman::TEXT_DOMAIN ), array( + add_settings_field( 'logging_max_entries', __( 'Maximum Log Entries', 'post-smtp' ), array( $this, 'loggingMaxEntriesInputField', ), PostmanAdminController::LOGGING_OPTIONS, PostmanAdminController::LOGGING_SECTION ); - add_settings_field( PostmanOptions::TRANSCRIPT_SIZE, __( 'Maximum Transcript Size', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::TRANSCRIPT_SIZE, __( 'Maximum Transcript Size', 'post-smtp' ), array( $this, 'transcriptSizeInputField', ), PostmanAdminController::LOGGING_OPTIONS, PostmanAdminController::LOGGING_SECTION ); // the Network section - add_settings_section( PostmanAdminController::NETWORK_SECTION, __( 'Network Settings', Postman::TEXT_DOMAIN ), array( + add_settings_section( PostmanAdminController::NETWORK_SECTION, __( 'Network Settings', 'post-smtp' ), array( $this, 'printNetworkSectionInfo', ), PostmanAdminController::NETWORK_OPTIONS ); - add_settings_field( 'connection_timeout', _x( 'TCP Connection Timeout (sec)', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array( + add_settings_field( 'connection_timeout', _x( 'TCP Connection Timeout (sec)', 'Configuration Input Field', 'post-smtp' ), array( $this, 'connection_timeout_callback', ), PostmanAdminController::NETWORK_OPTIONS, PostmanAdminController::NETWORK_SECTION ); - add_settings_field( 'read_timeout', _x( 'TCP Read Timeout (sec)', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array( + add_settings_field( 'read_timeout', _x( 'TCP Read Timeout (sec)', 'Configuration Input Field', 'post-smtp' ), array( $this, 'read_timeout_callback', ), PostmanAdminController::NETWORK_OPTIONS, PostmanAdminController::NETWORK_SECTION ); // the Advanced section - add_settings_section( PostmanAdminController::ADVANCED_SECTION, _x( 'Miscellaneous Settings', 'Configuration Section Title', Postman::TEXT_DOMAIN ), array( + add_settings_section( PostmanAdminController::ADVANCED_SECTION, _x( 'Miscellaneous Settings', 'Configuration Section Title', 'post-smtp' ), array( $this, 'printAdvancedSectionInfo', ), PostmanAdminController::ADVANCED_OPTIONS ); - add_settings_field( PostmanOptions::LOG_LEVEL, _x( 'PHP Log Level', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::LOG_LEVEL, _x( 'PHP Log Level', 'Configuration Input Field', 'post-smtp' ), array( $this, 'log_level_callback', ), PostmanAdminController::ADVANCED_OPTIONS, PostmanAdminController::ADVANCED_SECTION ); - add_settings_field( PostmanOptions::RUN_MODE, _x( 'Delivery Mode', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::RUN_MODE, _x( 'Delivery Mode', 'Configuration Input Field', 'post-smtp' ), array( $this, 'runModeCallback', ), PostmanAdminController::ADVANCED_OPTIONS, PostmanAdminController::ADVANCED_SECTION ); - add_settings_field( PostmanOptions::STEALTH_MODE, _x( 'Stealth Mode', 'This mode removes the Postman X-Mailer signature from emails', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::STEALTH_MODE, _x( 'Stealth Mode', 'This mode removes the Postman X-Mailer signature from emails', 'post-smtp' ), array( $this, 'stealthModeCallback', ), PostmanAdminController::ADVANCED_OPTIONS, PostmanAdminController::ADVANCED_SECTION ); - add_settings_field( PostmanOptions::TEMPORARY_DIRECTORY, __( 'Temporary Directory', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::TEMPORARY_DIRECTORY, __( 'Temporary Directory', 'post-smtp' ), array( $this, 'temporaryDirectoryCallback', ), PostmanAdminController::ADVANCED_OPTIONS, PostmanAdminController::ADVANCED_SECTION ); // Notifications - add_settings_section( PostmanAdminController::NOTIFICATIONS_SECTION, _x( 'Notifications Settings', 'Configuration Section Title', Postman::TEXT_DOMAIN ), array( + add_settings_section( PostmanAdminController::NOTIFICATIONS_SECTION, _x( 'Notifications Settings', 'Configuration Section Title', 'post-smtp' ), array( $this, 'printNotificationsSectionInfo', ), PostmanAdminController::NOTIFICATIONS_OPTIONS ); - add_settings_field( PostmanOptions::NOTIFICATION_SERVICE, _x( 'Notification Service', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::NOTIFICATION_SERVICE, _x( 'Notification Service', 'Configuration Input Field', 'post-smtp' ), array( $this, 'notification_service_callback', ), PostmanAdminController::NOTIFICATIONS_OPTIONS, PostmanAdminController::NOTIFICATIONS_SECTION ); // Pushover - add_settings_section( 'pushover_credentials', _x( 'Pushover Credentials', 'Configuration Section Title', Postman::TEXT_DOMAIN ), array( + add_settings_section( 'pushover_credentials', _x( 'Pushover Credentials', 'Configuration Section Title', 'post-smtp' ), array( $this, 'printNotificationsSectionInfo', ), PostmanAdminController::NOTIFICATIONS_PUSHOVER_CRED ); - add_settings_field( PostmanOptions::PUSHOVER_USER, _x( 'Pushover User Key', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::PUSHOVER_USER, _x( 'Pushover User Key', 'Configuration Input Field', 'post-smtp' ), array( $this, 'pushover_user_callback', ), PostmanAdminController::NOTIFICATIONS_PUSHOVER_CRED, 'pushover_credentials' ); - add_settings_field( PostmanOptions::PUSHOVER_TOKEN, _x( 'Pushover App Token', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::PUSHOVER_TOKEN, _x( 'Pushover App Token', 'Configuration Input Field', 'post-smtp' ), array( $this, 'pushover_token_callback', ), PostmanAdminController::NOTIFICATIONS_PUSHOVER_CRED, 'pushover_credentials' ); // Slack - add_settings_section( 'slack_credentials', _x( 'Slack Credentials', 'Configuration Section Title', Postman::TEXT_DOMAIN ), array( + add_settings_section( 'slack_credentials', _x( 'Slack Credentials', 'Configuration Section Title', 'post-smtp' ), array( $this, 'printNotificationsSectionInfo', ), PostmanAdminController::NOTIFICATIONS_SLACK_CRED ); - add_settings_field( PostmanOptions::SLACK_TOKEN, _x( 'Slack Webhook', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::SLACK_TOKEN, _x( 'Slack Webhook', 'Configuration Input Field', 'post-smtp' ), array( $this, 'slack_token_callback', ), PostmanAdminController::NOTIFICATIONS_SLACK_CRED, 'slack_credentials' ); - add_settings_field( PostmanOptions::NOTIFICATION_USE_CHROME, _x( 'Push to chrome extension', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::NOTIFICATION_USE_CHROME, _x( 'Push to chrome extension', 'Configuration Input Field', 'post-smtp' ), array( $this, 'notification_use_chrome_callback', ), PostmanAdminController::NOTIFICATIONS_OPTIONS, PostmanAdminController::NOTIFICATIONS_SECTION ); - add_settings_field( PostmanOptions::NOTIFICATION_CHROME_UID, _x( 'Chrome Extension UID', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::NOTIFICATION_CHROME_UID, _x( 'Chrome Extension UID', 'Configuration Input Field', 'post-smtp' ), array( $this, 'notification_chrome_uid_callback', ), PostmanAdminController::NOTIFICATIONS_OPTIONS, PostmanAdminController::NOTIFICATIONS_SECTION ); @@ -232,31 +237,31 @@ class PostmanSettingsRegistry { * Print the Transport section info */ public function printTransportSectionInfo() { - print __( 'Choose SMTP or a vendor-specific API:', Postman::TEXT_DOMAIN ); + print __( 'Choose SMTP or a vendor-specific API:', 'post-smtp' ); } public function printLoggingSectionInfo() { - print __( 'Configure the delivery audit log:', Postman::TEXT_DOMAIN ); + print __( 'Configure the delivery audit log:', 'post-smtp' ); } /** * Print the Section text */ public function printMessageFromSectionInfo() { - print sprintf( __( 'This address, like the <b>letterhead</b> printed on a letter, identifies the sender to the recipient. Change this when you are sending on behalf of someone else, for example to use Google\'s <a href="%s">Send Mail As</a> feature. Other plugins, especially Contact Forms, may override this field to be your visitor\'s address.', Postman::TEXT_DOMAIN ), 'https://support.google.com/mail/answer/22370?hl=en' ); + print sprintf( __( 'This address, like the <b>letterhead</b> printed on a letter, identifies the sender to the recipient. Change this when you are sending on behalf of someone else, for example to use Google\'s <a href="%s">Send Mail As</a> feature. Other plugins, especially Contact Forms, may override this field to be your visitor\'s address.', 'post-smtp' ), 'https://support.google.com/mail/answer/22370?hl=en' ); } /** * Print the Section text */ public function printMessageSectionInfo() { - print __( 'Separate multiple <b>to</b>/<b>cc</b>/<b>bcc</b> recipients with commas.', Postman::TEXT_DOMAIN ); + print __( 'Separate multiple <b>to</b>/<b>cc</b>/<b>bcc</b> recipients with commas.', 'post-smtp' ); } /** * Print the Section text */ public function printNetworkSectionInfo() { - print __( 'Increase the timeouts if your host is intermittenly failing to send mail. Be careful, this also correlates to how long your user must wait if the mail server is unreachable.', Postman::TEXT_DOMAIN ); + print __( 'Increase the timeouts if your host is intermittenly failing to send mail. Be careful, this also correlates to how long your user must wait if the mail server is unreachable.', 'post-smtp' ); } /** @@ -275,14 +280,14 @@ class PostmanSettingsRegistry { * Print the Section text */ public function printAdditionalHeadersSectionInfo() { - print __( 'Specify custom headers (e.g. <code>X-MC-Tags: wordpress-site-A</code>), one per line. Use custom headers with caution as they can negatively affect your Spam score.', Postman::TEXT_DOMAIN ); + print __( 'Specify custom headers (e.g. <code>X-MC-Tags: wordpress-site-A</code>), one per line. Use custom headers with caution as they can negatively affect your Spam score.', 'post-smtp' ); } /** * Print the Email Validation Description */ public function printEmailValidationSectionInfo() { - print __( 'E-mail addresses can be validated before sending e-mail, however this may fail with some newer domains.', Postman::TEXT_DOMAIN ); + print __( 'E-mail addresses can be validated before sending e-mail, however this may fail with some newer domains.', 'post-smtp' ); } /** @@ -297,6 +302,22 @@ class PostmanSettingsRegistry { print '</select>'; } + /** + * Get the settings option array and print one of its values + */ + public function smtp_mailer_callback() { + $smtp_mailers = PostmanOptions::SMTP_MAILERS; + $current_smtp_mailer = $this->options->getSmtpMailer(); + printf( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, 'smtp_mailers' ); + foreach ( $smtp_mailers as $key => $smtp_mailer ) { + printf( '<option class="input_tx_type_%1$s" value="%1$s" %3$s>%2$s</option>', $key, $smtp_mailer, $current_smtp_mailer == $key ? 'selected="selected"' : '' ); + } + print '</select>'; + ?> + <p class="description" id="mailer-type-description"><?php _e( 'Beta Feature: Change this to <strong>PHPMailer</strong> only if you see <code>wp_mail</code> conflict message, conflicts when another plugin is activated, and <strong><u>sometimes</u></strong> spam issues.', 'post-smtp' ); ?></p> + <?php + } + /** * Get the settings option array and print one of its values */ @@ -308,21 +329,21 @@ class PostmanSettingsRegistry { */ public function prevent_from_name_override_callback() { $enforced = $this->options->isPluginSenderNameEnforced(); - printf( '<input type="checkbox" id="input_prevent_sender_name_override" name="postman_options[prevent_sender_name_override]" %s /> %s', $enforced ? 'checked="checked"' : '', __( 'Prevent <b>plugins</b> and <b>themes</b> from changing this', Postman::TEXT_DOMAIN ) ); + printf( '<input type="checkbox" id="input_prevent_sender_name_override" name="postman_options[prevent_sender_name_override]" %s /> %s', $enforced ? 'checked="checked"' : '', __( 'Prevent <b>plugins</b> and <b>themes</b> from changing this', 'post-smtp' ) ); } /** * Get the settings option array and print one of its values */ public function from_email_callback() { - printf( '<input type="email" id="input_sender_email" name="postman_options[sender_email]" value="%s" size="40" class="required" placeholder="%s"/>', null !== $this->options->getMessageSenderEmail() ? esc_attr( $this->options->getMessageSenderEmail() ) : '', __( 'Required', Postman::TEXT_DOMAIN ) ); + printf( '<input type="email" id="input_sender_email" name="postman_options[sender_email]" value="%s" size="40" class="required" placeholder="%s"/>', null !== $this->options->getMessageSenderEmail() ? esc_attr( $this->options->getMessageSenderEmail() ) : '', __( 'Required', 'post-smtp' ) ); } /** * Print the Section text */ public function printMessageSenderSectionInfo() { - print sprintf( __( 'This address, like the <b>return address</b> printed on an envelope, identifies the account owner to the SMTP server.', Postman::TEXT_DOMAIN ), 'https://support.google.com/mail/answer/22370?hl=en' ); + print sprintf( __( 'This address, like the <b>return address</b> printed on an envelope, identifies the account owner to the SMTP server.', 'post-smtp' ), 'https://support.google.com/mail/answer/22370?hl=en' ); } /** @@ -330,7 +351,7 @@ class PostmanSettingsRegistry { */ public function prevent_from_email_override_callback() { $enforced = $this->options->isPluginSenderEmailEnforced(); - printf( '<input type="checkbox" id="input_prevent_sender_email_override" name="postman_options[prevent_sender_email_override]" %s /> %s', $enforced ? 'checked="checked"' : '', __( 'Prevent <b>plugins</b> and <b>themes</b> from changing this', Postman::TEXT_DOMAIN ) ); + printf( '<input type="checkbox" id="input_prevent_sender_email_override" name="postman_options[prevent_sender_email_override]" %s /> %s', $enforced ? 'checked="checked"' : '', __( 'Prevent <b>plugins</b> and <b>themes</b> from changing this', 'post-smtp' ) ); } /** @@ -343,8 +364,8 @@ class PostmanSettingsRegistry { $disabled = 'disabled="disabled" '; } printf( '<select ' . $disabled . 'id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::MAIL_LOG_ENABLED_OPTION ); - printf( '<option value="%s" %s>%s</option>', PostmanOptions::MAIL_LOG_ENABLED_OPTION_YES, $this->options->isMailLoggingEnabled() ? 'selected="selected"' : '', __( 'Yes', Postman::TEXT_DOMAIN ) ); - printf( '<option value="%s" %s>%s</option>', PostmanOptions::MAIL_LOG_ENABLED_OPTION_NO, ! $this->options->isMailLoggingEnabled() ? 'selected="selected"' : '', __( 'No', Postman::TEXT_DOMAIN ) ); + printf( '<option value="%s" %s>%s</option>', PostmanOptions::MAIL_LOG_ENABLED_OPTION_YES, $this->options->isMailLoggingEnabled() ? 'selected="selected"' : '', __( 'Yes', 'post-smtp' ) ); + printf( '<option value="%s" %s>%s</option>', PostmanOptions::MAIL_LOG_ENABLED_OPTION_NO, ! $this->options->isMailLoggingEnabled() ? 'selected="selected"' : '', __( 'No', 'post-smtp' ) ); printf( '</select>' ); } public function loggingMaxEntriesInputField() { @@ -354,7 +375,7 @@ class PostmanSettingsRegistry { $inputOptionsSlug = PostmanOptions::POSTMAN_OPTIONS; $inputTranscriptSlug = PostmanOptions::TRANSCRIPT_SIZE; $inputValue = $this->options->getTranscriptSize(); - $inputDescription = __( 'Change this value if you can\'t see the beginning of the transcript because your messages are too big.', Postman::TEXT_DOMAIN ); + $inputDescription = __( 'Change this value if you can\'t see the beginning of the transcript because your messages are too big.', 'post-smtp' ); printf( '<input type="text" id="input%2$s" name="%1$s[%2$s]" value="%3$s"/><br/><span class="postman_input_description">%4$s</span>', $inputOptionsSlug, $inputTranscriptSlug, $inputValue, $inputDescription ); } @@ -397,22 +418,22 @@ class PostmanSettingsRegistry { */ public function disable_email_validation_callback() { $disabled = $this->options->isEmailValidationDisabled(); - printf( '<input type="checkbox" id="%2$s" name="%1$s[%2$s]" %3$s /> %4$s', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::DISABLE_EMAIL_VALIDAITON, $disabled ? 'checked="checked"' : '', __( 'Disable e-mail validation', Postman::TEXT_DOMAIN ) ); + printf( '<input type="checkbox" id="%2$s" name="%1$s[%2$s]" %3$s /> %4$s', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::DISABLE_EMAIL_VALIDAITON, $disabled ? 'checked="checked"' : '', __( 'Disable e-mail validation', 'post-smtp' ) ); } /** * Get the settings option array and print one of its values */ public function log_level_callback() { - $inputDescription = sprintf( __( 'Log Level specifies the level of detail written to the <a target="_blank" href="%s">WordPress Debug log</a> - view the log with <a target-"_new" href="%s">Debug</a>.', Postman::TEXT_DOMAIN ), 'https://codex.wordpress.org/Debugging_in_WordPress', 'https://wordpress.org/plugins/debug/' ); + $inputDescription = sprintf( __( 'Log Level specifies the level of detail written to the <a target="_blank" href="%s">WordPress Debug log</a> - view the log with <a target-"_new" href="%s">Debug</a>.', 'post-smtp' ), 'https://codex.wordpress.org/Debugging_in_WordPress', 'https://wordpress.org/plugins/debug/' ); printf( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::LOG_LEVEL ); $currentKey = $this->options->getLogLevel(); - $this->printSelectOption( __( 'Off', Postman::TEXT_DOMAIN ), PostmanLogger::OFF_INT, $currentKey ); - $this->printSelectOption( __( 'Trace', Postman::TEXT_DOMAIN ), PostmanLogger::TRACE_INT, $currentKey ); - $this->printSelectOption( __( 'Debug', Postman::TEXT_DOMAIN ), PostmanLogger::DEBUG_INT, $currentKey ); - $this->printSelectOption( __( 'Info', Postman::TEXT_DOMAIN ), PostmanLogger::INFO_INT, $currentKey ); - $this->printSelectOption( __( 'Warning', Postman::TEXT_DOMAIN ), PostmanLogger::WARN_INT, $currentKey ); - $this->printSelectOption( __( 'Error', Postman::TEXT_DOMAIN ), PostmanLogger::ERROR_INT, $currentKey ); + $this->printSelectOption( __( 'Off', 'post-smtp' ), PostmanLogger::OFF_INT, $currentKey ); + $this->printSelectOption( __( 'Trace', 'post-smtp' ), PostmanLogger::TRACE_INT, $currentKey ); + $this->printSelectOption( __( 'Debug', 'post-smtp' ), PostmanLogger::DEBUG_INT, $currentKey ); + $this->printSelectOption( __( 'Info', 'post-smtp' ), PostmanLogger::INFO_INT, $currentKey ); + $this->printSelectOption( __( 'Warning', 'post-smtp' ), PostmanLogger::WARN_INT, $currentKey ); + $this->printSelectOption( __( 'Error', 'post-smtp' ), PostmanLogger::ERROR_INT, $currentKey ); printf( '</select><br/><span class="postman_input_description">%s</span>', $inputDescription ); } @@ -421,9 +442,9 @@ class PostmanSettingsRegistry { 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', Postman::TEXT_DOMAIN ), 'default', $currentKey ); - $this->printSelectOption( __( 'Pushover', Postman::TEXT_DOMAIN ), 'pushover', $currentKey ); - $this->printSelectOption( __( 'Slack', Postman::TEXT_DOMAIN ), 'slack', $currentKey ); + $this->printSelectOption( __( 'Email', 'post-smtp' ), 'default', $currentKey ); + $this->printSelectOption( __( 'Pushover', 'post-smtp' ), 'pushover', $currentKey ); + $this->printSelectOption( __( 'Slack', 'post-smtp' ), 'slack', $currentKey ); printf( '</select><br/><span class="postman_input_description">%s</span>', $inputDescription ); } @@ -446,7 +467,7 @@ class PostmanSettingsRegistry { public function slack_token_callback() { printf( '<input type="password" id="slack_token" name="%s[%s]" value="%s" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::SLACK_TOKEN, $this->options->getSlackToken() ); - echo '<a target="_blank" href="https://slack.postmansmtp.com/">' . __( 'Get your webhook URL here', Postman::TEXT_DOMAIN ) . '</a>'; + echo '<a target="_blank" href="https://slack.postmansmtp.com/">' . __( 'Get your webhook URL here', 'post-smtp' ) . '</a>'; } @@ -455,26 +476,26 @@ class PostmanSettingsRegistry { printf( $optionPattern, $optionKey, $optionKey == $currentKey ? 'selected="selected"' : '', $label ); } public function runModeCallback() { - $inputDescription = __( 'Delivery mode offers options useful for developing or testing.', Postman::TEXT_DOMAIN ); + $inputDescription = __( 'Delivery mode offers options useful for developing or testing.', 'post-smtp' ); printf( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::RUN_MODE ); $currentKey = $this->options->getRunMode(); - $this->printSelectOption( _x( 'Log Email and Send', 'When the server is online to the public, this is "Production" mode', Postman::TEXT_DOMAIN ), PostmanOptions::RUN_MODE_PRODUCTION, $currentKey ); - $this->printSelectOption( __( 'Log Email and Delete', Postman::TEXT_DOMAIN ), PostmanOptions::RUN_MODE_LOG_ONLY, $currentKey ); - $this->printSelectOption( __( 'Delete All Emails', Postman::TEXT_DOMAIN ), PostmanOptions::RUN_MODE_IGNORE, $currentKey ); + $this->printSelectOption( _x( 'Log Email and Send', 'When the server is online to the public, this is "Production" mode', 'post-smtp' ), PostmanOptions::RUN_MODE_PRODUCTION, $currentKey ); + $this->printSelectOption( __( 'Log Email and Delete', 'post-smtp' ), PostmanOptions::RUN_MODE_LOG_ONLY, $currentKey ); + $this->printSelectOption( __( 'Delete All Emails', 'post-smtp' ), PostmanOptions::RUN_MODE_IGNORE, $currentKey ); printf( '</select><br/><span class="postman_input_description">%s</span>', $inputDescription ); } public function stealthModeCallback() { - printf( '<input type="checkbox" id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]" %3$s /> %4$s', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::STEALTH_MODE, $this->options->isStealthModeEnabled() ? 'checked="checked"' : '', __( 'Remove the Postman X-Header signature from messages', Postman::TEXT_DOMAIN ) ); + printf( '<input type="checkbox" id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]" %3$s /> %4$s', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::STEALTH_MODE, $this->options->isStealthModeEnabled() ? 'checked="checked"' : '', __( 'Remove the Postman X-Header signature from messages', 'post-smtp' ) ); } public function temporaryDirectoryCallback() { $inputDescription = __( 'Lockfiles are written here to prevent users from triggering an OAuth 2.0 token refresh at the same time.' ); printf( '<input type="text" id="input_%2$s" name="%1$s[%2$s]" value="%3$s" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::TEMPORARY_DIRECTORY, $this->options->getTempDirectory() ); if ( PostmanState::getInstance()->isFileLockingEnabled() ) { - printf( ' <span style="color:green">%s</span></br><span class="postman_input_description">%s</span>', __( 'Valid', Postman::TEXT_DOMAIN ), $inputDescription ); + printf( ' <span style="color:green">%s</span></br><span class="postman_input_description">%s</span>', __( 'Valid', 'post-smtp' ), $inputDescription ); } else { - printf( ' <span style="color:red">%s</span></br><span class="postman_input_description">%s</span>', __( 'Invalid', Postman::TEXT_DOMAIN ), $inputDescription ); + printf( ' <span style="color:red">%s</span></br><span class="postman_input_description">%s</span>', __( 'Invalid', 'post-smtp' ), $inputDescription ); } } @@ -496,6 +517,6 @@ class PostmanSettingsRegistry { * Get the settings option array and print one of its values */ public function port_callback( $args ) { - printf( '<input type="text" id="input_port" name="postman_options[port]" value="%s" %s placeholder="%s"/>', null !== $this->options->getPort() ? esc_attr( $this->options->getPort() ) : '', isset( $args ['style'] ) ? $args ['style'] : '', __( 'Required', Postman::TEXT_DOMAIN ) ); + printf( '<input type="text" id="input_port" name="postman_options[port]" value="%s" %s placeholder="%s"/>', null !== $this->options->getPort() ? esc_attr( $this->options->getPort() ) : '', isset( $args ['style'] ) ? $args ['style'] : '', __( 'Required', 'post-smtp' ) ); } } diff --git a/Postman/Postman-Configuration/PostmanSmtpDiscovery.php b/Postman/Postman-Configuration/PostmanSmtpDiscovery.php index 2d568cd..44da3bb 100644 --- a/Postman/Postman-Configuration/PostmanSmtpDiscovery.php +++ b/Postman/Postman-Configuration/PostmanSmtpDiscovery.php @@ -117,7 +117,7 @@ if (! class_exists ( 'PostmanSmtpDiscovery' )) { /** * Constructor * - * @param unknown $email + * @param mixed $email */ public function __construct($email) { $this->email = $email; @@ -137,8 +137,8 @@ if (! class_exists ( 'PostmanSmtpDiscovery' )) { } /** * - * @param unknown $email - * @return Ambigous <number, boolean> + * @param mixed $email + * @return string|bool */ private function validateEmail($email) { return PostmanUtils::validateEmail ( $email ); @@ -171,7 +171,7 @@ if (! class_exists ( 'PostmanSmtpDiscovery' )) { /** * Uses getmxrr to retrieve the MX records of a hostname * - * @param unknown $hostname + * @param mixed $hostname * @return mixed|boolean */ private function findMxHostViaDns($hostname) { @@ -201,9 +201,9 @@ if (! class_exists ( 'PostmanSmtpDiscovery' )) { * This is a custom implementation of mxrr for Windows PHP installations * which don't have this method natively. * - * @param unknown $hostname - * @param unknown $mxhosts - * @param unknown $mxweight + * @param mixed $hostname + * @param mixed $mxhosts + * @param mixed $mxweight * @return boolean */ function getmxrr($hostname, &$mxhosts, &$mxweight) { |