From fd70868a4b7c569ff5eeddfa36b71709c24b3555 Mon Sep 17 00:00:00 2001 From: Niels de Blaauw Date: Wed, 13 Mar 2019 09:42:41 +0100 Subject: Fixes #1, deprecates and replaces variable text domain usage This should be removed as it breaks compatibility with translate.wordpress.org --- .../PostmanConfigurationController.php | 140 ++++++++++----------- .../PostmanRegisterConfigurationSettings.php | 138 ++++++++++---------- .../PostmanConnectivityTestController.php | 50 ++++---- .../PostmanDashboardWidgetController.php | 22 ++-- .../PostmanWelcomeController.php | 70 +++++------ .../PostmanDiagnosticTestController.php | 14 +-- .../PostmanEmailLogController.php | 58 ++++----- .../Postman-Email-Log/PostmanEmailLogPostType.php | 4 +- .../Postman-Email-Log/PostmanEmailLogService.php | 10 +- Postman/Postman-Email-Log/PostmanEmailLogView.php | 28 ++--- .../Postman-Mail/PostmanDefaultModuleTransport.php | 2 +- .../PostmanGmailApiModuleTransport.php | 8 +- Postman/Postman-Mail/PostmanMailgunTransport.php | 32 ++--- Postman/Postman-Mail/PostmanMandrillTransport.php | 20 +-- Postman/Postman-Mail/PostmanMessage.php | 4 +- Postman/Postman-Mail/PostmanModuleTransport.php | 16 +-- Postman/Postman-Mail/PostmanMyMailConnector.php | 6 +- Postman/Postman-Mail/PostmanSendGridMailEngine.php | 12 +- Postman/Postman-Mail/PostmanSendGridTransport.php | 20 +-- .../Postman-Mail/PostmanSmtpModuleTransport.php | 82 ++++++------ Postman/Postman-Mail/PostmanTransportRegistry.php | 6 +- Postman/Postman-Mail/PostmanWooCommerce.php | 42 +++---- Postman/Postman-Mail/PostmanZendMailEngine.php | 2 +- .../PostmanSendTestEmailController.php | 50 ++++---- Postman/Postman.php | 26 ++-- Postman/PostmanAdminController.php | 28 ++--- Postman/PostmanConfigTextHelper.php | 66 +++++----- Postman/PostmanInputSanitizer.php | 2 +- Postman/PostmanViewController.php | 92 +++++++------- Postman/notifications/PostmanMailNotify.php | 2 +- 30 files changed, 530 insertions(+), 522 deletions(-) diff --git a/Postman/Postman-Configuration/PostmanConfigurationController.php b/Postman/Postman-Configuration/PostmanConfigurationController.php index bc9c274..a58f18d 100644 --- a/Postman/Postman-Configuration/PostmanConfigurationController.php +++ b/Postman/Postman-Configuration/PostmanConfigurationController.php @@ -94,11 +94,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 +131,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 +155,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 +194,14 @@ class PostmanConfigurationController { public function outputManualConfigurationContent() { print '
'; - PostmanViewController::outputChildPageHeader( __( 'Settings', Postman::TEXT_DOMAIN ), 'advanced_config' ); + PostmanViewController::outputChildPageHeader( __( 'Settings', 'post-smtp' ), 'advanced_config' ); print '
    '; - print sprintf( '
  • %s
  • ', __( 'Account', Postman::TEXT_DOMAIN ) ); - print sprintf( '
  • %s
  • ', __( 'Fallback', Postman::TEXT_DOMAIN ) ); - print sprintf( '
  • %s
  • ', __( 'Message', Postman::TEXT_DOMAIN ) ); - print sprintf( '
  • %s
  • ', __( 'Logging', Postman::TEXT_DOMAIN ) ); - print sprintf( '
  • %s
  • ', __( 'Advanced', Postman::TEXT_DOMAIN ) ); - print sprintf( '
  • %s
  • ', __( 'Notifications', Postman::TEXT_DOMAIN ) ); + print sprintf( '
  • %s
  • ', __( 'Account', 'post-smtp' ) ); + print sprintf( '
  • %s
  • ', __( 'Fallback', 'post-smtp' ) ); + print sprintf( '
  • %s
  • ', __( 'Message', 'post-smtp' ) ); + print sprintf( '
  • %s
  • ', __( 'Logging', 'post-smtp' ) ); + print sprintf( '
  • %s
  • ', __( 'Advanced', 'post-smtp' ) ); + print sprintf( '
  • %s
  • ', __( 'Notifications', 'post-smtp' ) ); print '
'; print '
'; @@ -239,29 +239,29 @@ class PostmanConfigurationController {
-

-

+

+

- + - + options->getFallbackHostname(); ?> - + options->getFallbackPort(); ?> - + __( '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' ), ); ?> - + - + - + - +
 
@@ -302,36 +302,36 @@ class PostmanConfigurationController {

- +
 
'; - PostmanViewController::outputChildPageHeader( __( 'Setup Wizard', Postman::TEXT_DOMAIN ) ); + PostmanViewController::outputChildPageHeader( __( 'Setup Wizard', 'post-smtp' ) ); print ''; @@ -440,12 +440,12 @@ class PostmanConfigurationController { settings_fields( PostmanAdminController::SETTINGS_GROUP_NAME ); // Wizard Step 0 - printf( '
%s
', _x( 'Import Configuration', 'Wizard Step Title', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', _x( 'Import Configuration', 'Wizard Step Title', 'post-smtp' ) ); print '
'; - printf( '%s', _x( 'Import configuration from another plugin?', 'Wizard Step Title', Postman::TEXT_DOMAIN ) ); - printf( '

%s

', __( 'If you had a working configuration with another Plugin, the Setup Wizard can begin with those settings.', Postman::TEXT_DOMAIN ) ); + printf( '%s', _x( 'Import configuration from another plugin?', 'Wizard Step Title', 'post-smtp' ) ); + printf( '

%s

', __( 'If you had a working configuration with another Plugin, the Setup Wizard can begin with those settings.', 'post-smtp' ) ); print ''; - printf( '', 'none', __( 'None', Postman::TEXT_DOMAIN ) ); + printf( '', 'none', __( 'None', 'post-smtp' ) ); if ( $this->importableConfiguration->isImportAvailable() ) { foreach ( $this->importableConfiguration->getAvailableOptions() as $options ) { @@ -456,20 +456,20 @@ class PostmanConfigurationController { print ''; // Wizard Step 1 - printf( '
%s
', _x( 'Sender Details', 'Wizard Step Title', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', _x( 'Sender Details', 'Wizard Step Title', 'post-smtp' ) ); print '
'; - printf( '%s', _x( 'Who is the mail coming from?', 'Wizard Step Title', Postman::TEXT_DOMAIN ) ); - printf( '

%s

', __( 'Enter the email address and name you\'d like to send mail as.', Postman::TEXT_DOMAIN ) ); - printf( '

%s

', __( 'Please note that to prevent abuse, many email services will not let you send from an email address other than the one you authenticate with.', Postman::TEXT_DOMAIN ) ); - printf( '', __( 'Email Address', Postman::TEXT_DOMAIN ) ); + printf( '%s', _x( 'Who is the mail coming from?', 'Wizard Step Title', 'post-smtp' ) ); + printf( '

%s

', __( 'Enter the email address and name you\'d like to send mail as.', 'post-smtp' ) ); + printf( '

%s

', __( 'Please note that to prevent abuse, many email services will not let you send from an email address other than the one you authenticate with.', 'post-smtp' ) ); + printf( '', __( 'Email Address', 'post-smtp' ) ); print $this->settingsRegistry->from_email_callback(); print '
'; - printf( '', __( 'Name', Postman::TEXT_DOMAIN ) ); + printf( '', __( 'Name', 'post-smtp' ) ); print $this->settingsRegistry->sender_name_callback(); print '
'; // Wizard Step 2 - printf( '
%s
', __( 'Outgoing Mail Server Hostname', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', __( 'Outgoing Mail Server Hostname', 'post-smtp' ) ); print '
'; foreach ( PostmanTransportRegistry::getInstance()->getTransports() as $transport ) { $transport->printWizardMailServerHostnameStep(); @@ -477,11 +477,11 @@ class PostmanConfigurationController { print '
'; // Wizard Step 3 - printf( '
%s
', __( 'Connectivity Test', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', __( 'Connectivity Test', 'post-smtp' ) ); print '
'; - printf( '%s', __( 'How will the connection to the mail server be established?', Postman::TEXT_DOMAIN ) ); - printf( '

%s

', __( 'Your connection settings depend on what your email service provider offers, and what your WordPress host allows.', Postman::TEXT_DOMAIN ) ); - printf( '

%s: %s

', __( 'Connectivity Test', Postman::TEXT_DOMAIN ), _x( 'Ready', 'TCP Port Test Status', Postman::TEXT_DOMAIN ) ); + printf( '%s', __( 'How will the connection to the mail server be established?', 'post-smtp' ) ); + printf( '

%s

', __( 'Your connection settings depend on what your email service provider offers, and what your WordPress host allows.', 'post-smtp' ) ); + printf( '

%s: %s

', __( 'Connectivity Test', 'post-smtp' ), _x( 'Ready', 'TCP Port Test Status', 'post-smtp' ) ); printf( '', plugins_url( 'post-smtp/style/ajax-loader.gif' ) ); printf( '', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::TRANSPORT_TYPE ); printf( '', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::PORT ); @@ -489,27 +489,27 @@ class PostmanConfigurationController { printf( '', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::AUTHENTICATION_TYPE ); print '

'; /* Translators: Where %1$s is the socket identifier and %2$s is the authentication type */ - printf( '

', _x( 'Socket', 'A socket is the network term for host and port together', Postman::TEXT_DOMAIN ) ); - printf( '', __( 'Authentication', Postman::TEXT_DOMAIN ) ); + printf( '', _x( 'Socket', 'A socket is the network term for host and port together', 'post-smtp' ) ); + printf( '', __( 'Authentication', 'post-smtp' ) ); print ('

') ; - $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( '', $warning, $clearCredentialsWarning ); print '
'; // Wizard Step 4 - printf( '
%s
', __( 'Authentication', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', __( 'Authentication', 'post-smtp' ) ); print '
'; - printf( '%s', __( 'How will you prove your identity to the mail server?', Postman::TEXT_DOMAIN ) ); + printf( '%s', __( 'How will you prove your identity to the mail server?', 'post-smtp' ) ); foreach ( PostmanTransportRegistry::getInstance()->getTransports() as $transport ) { $transport->printWizardAuthenticationStep(); } print '
'; // Wizard Step 5 - Notificiations - printf( '
%s
', __( 'Notifications', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', __( 'Notifications', 'post-smtp' ) ); print '
'; - printf( '%s', __( 'Select a notify service to notify you when an email is failed to delivered.', Postman::TEXT_DOMAIN ) ); + printf( '%s', __( 'Select a notify service to notify you when an email is failed to delivered.', 'post-smtp' ) ); ?> '; } diff --git a/Postman/Postman-Controller/PostmanDashboardWidgetController.php b/Postman/Postman-Controller/PostmanDashboardWidgetController.php index 7393ee3..70df440 100644 --- a/Postman/Postman-Controller/PostmanDashboardWidgetController.php +++ b/Postman/Postman-Controller/PostmanDashboardWidgetController.php @@ -54,7 +54,7 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) { public function addDashboardWidget() { // only display to the widget to administrator if (PostmanUtils::isAdmin ()) { - wp_add_dashboard_widget ( 'example_dashboard_widget', __ ( 'Postman SMTP', Postman::TEXT_DOMAIN ), array ( + wp_add_dashboard_widget ( 'example_dashboard_widget', __ ( 'Postman SMTP', 'post-smtp' ), array ( $this, 'printDashboardWidget' ) ); // Display function. @@ -67,7 +67,7 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) { public function addNetworkDashboardWidget() { // only display to the widget to administrator if (PostmanUtils::isAdmin ()) { - wp_add_dashboard_widget ( 'example_dashboard_widget', __ ( 'Postman SMTP', Postman::TEXT_DOMAIN ), array ( + wp_add_dashboard_widget ( 'example_dashboard_widget', __ ( 'Postman SMTP', 'post-smtp' ), array ( $this, 'printNetworkDashboardWidget' ) ); // Display function. @@ -78,8 +78,8 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) { * Create the function to output the contents of our Dashboard Widget. */ public function printDashboardWidget() { - $goToSettings = sprintf ( '%s', PostmanUtils::getSettingsPageUrl (), __ ( 'Settings', Postman::TEXT_DOMAIN ) ); - $goToEmailLog = sprintf ( '%s', _x ( 'Email Log', 'The log of Emails that have been delivered', Postman::TEXT_DOMAIN ) ); + $goToSettings = sprintf ( '%s', PostmanUtils::getSettingsPageUrl (), __ ( 'Settings', 'post-smtp' ) ); + $goToEmailLog = sprintf ( '%s', _x ( 'Email Log', 'The log of Emails that have been delivered', 'post-smtp' ) ); if ($this->options->isMailLoggingEnabled ()) { $goToEmailLog = sprintf ( '%s', PostmanUtils::getEmailLogPageUrl (), $goToEmailLog ); } @@ -92,16 +92,16 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) { */ public function print_postman_status() { if (! PostmanPreRequisitesCheck::isReady ()) { - printf ( '

%s

', __ ( 'Error: Postman is missing a required PHP library.', Postman::TEXT_DOMAIN ) ); + printf ( '

%s

', __ ( 'Error: Postman is missing a required PHP library.', 'post-smtp' ) ); } else if ($this->wpMailBinder->isUnboundDueToException ()) { - printf ( '

%s

', __ ( 'Postman: wp_mail has been declared by another plugin or theme, so you won\'t be able to use Postman until the conflict is resolved.', Postman::TEXT_DOMAIN ) ); + printf ( '

%s

', __ ( 'Postman: wp_mail has been declared by another plugin or theme, so you won\'t be able to use Postman until the conflict is resolved.', 'post-smtp' ) ); } else { if ($this->options->getRunMode () != PostmanOptions::RUN_MODE_PRODUCTION) { - printf ( '

%s

', __ ( 'Postman is in non-Production mode and is dumping all emails.', Postman::TEXT_DOMAIN ) ); + printf ( '

%s

', __ ( 'Postman is in non-Production mode and is dumping all emails.', 'post-smtp' ) ); } else if (PostmanTransportRegistry::getInstance ()->getSelectedTransport ()->isConfiguredAndReady ()) { - printf ( '', sprintf ( _n ( 'Postman is configured and has delivered %d email.', 'Postman is configured and has delivered %d emails.', PostmanState::getInstance ()->getSuccessfulDeliveries (), Postman::TEXT_DOMAIN ), PostmanState::getInstance ()->getSuccessfulDeliveries () ) ); + printf ( '', sprintf ( _n ( 'Postman is configured and has delivered %d email.', 'Postman is configured and has delivered %d emails.', PostmanState::getInstance ()->getSuccessfulDeliveries (), 'post-smtp' ), PostmanState::getInstance ()->getSuccessfulDeliveries () ) ); } else { - printf ( '

%s

', __ ( 'Postman is not configured and is mimicking out-of-the-box WordPress email delivery.', Postman::TEXT_DOMAIN ) ); + printf ( '

%s

', __ ( 'Postman is not configured and is mimicking out-of-the-box WordPress email delivery.', 'post-smtp' ) ); } $currentTransport = PostmanTransportRegistry::getInstance ()->getActiveTransport (); $deliveryDetails = $currentTransport->getDeliveryDetails ( $this->options ); @@ -113,7 +113,7 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) { * Create the function to output the contents of our Dashboard Widget. */ public function printNetworkDashboardWidget() { - printf ( '', __ ( 'Postman is operating in per-site mode.', Postman::TEXT_DOMAIN ) ); + printf ( '', __ ( 'Postman is operating in per-site mode.', 'post-smtp' ) ); } /** @@ -143,7 +143,7 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) { $privated = intval ( $num_posts->private ); $post_type = get_post_type_object ( $type ); - $text = _n ( '%s ' . $post_type->labels->singular_name, '%s ' . $post_type->labels->name, $privated, Postman::TEXT_DOMAIN ); + $text = _n ( '%s ' . $post_type->labels->singular_name, '%s ' . $post_type->labels->name, $privated, 'post-smtp' ); $text = sprintf ( $text, number_format_i18n ( $privated ) ); $items [] = sprintf ( '%2$s', $type, $text, PostmanUtils::getEmailLogPageUrl () ) . "\n"; diff --git a/Postman/Postman-Controller/PostmanWelcomeController.php b/Postman/Postman-Controller/PostmanWelcomeController.php index b43e969..869848a 100644 --- a/Postman/Postman-Controller/PostmanWelcomeController.php +++ b/Postman/Postman-Controller/PostmanWelcomeController.php @@ -19,8 +19,8 @@ class PostmanWelcomeController { // About add_dashboard_page( - __( 'Welcome', Postman::TEXT_DOMAIN ), - __( 'Welcome', Postman::TEXT_DOMAIN ), + __( 'Welcome', 'post-smtp' ), + __( 'Welcome', 'post-smtp' ), 'manage_options', 'post-about', array( $this, 'about_screen' ) @@ -28,8 +28,8 @@ class PostmanWelcomeController { // Credits add_dashboard_page( - __( 'Credits', Postman::TEXT_DOMAIN ), - __( 'Credits', Postman::TEXT_DOMAIN ), + __( 'Credits', 'post-smtp' ), + __( 'Credits', 'post-smtp' ), 'manage_options', 'post-credits', array( $this, 'credits_screen' ) @@ -72,36 +72,36 @@ class PostmanWelcomeController { }
-

version ); ?>

-
version ); ?>
+

version ); ?>

+
version ); ?>
%s','Post SMTP support every SMTP service: Gmail/G-suite, SendGrid, Mandrill, Office365, and more...' ); ?>
-
version ); ?>
+
version ); ?>
-

+

-

+

- +

-

+

- +

@@ -109,7 +109,7 @@ class PostmanWelcomeController {
-

+

@@ -120,30 +120,30 @@ class PostmanWelcomeController { Supports forced recipients (cc, bcc, to) and custom email headers, SASL Support: Plain/Login/CRAM-MD5/XOAUTH2 authentication, Security Support: SMTPS and STARTTLS (SSL/TLS), - Copy configuration to other instances of Post.', Postman::TEXT_DOMAIN ); ?>

+ Copy configuration to other instances of Post.', 'post-smtp' ); ?>

-

-

+

+

-

-

+

+

-

-

+

+

- +
@@ -170,36 +170,36 @@ class PostmanWelcomeController { }
-

version ); ?>

-
version ); ?>
-
version ); ?>
+

version ); ?>

+
version ); ?>
+
version ); ?>
-

+

-

+

-

-
+

+

diegocanal, Johan Yourstone, @@ -209,7 +209,7 @@ class PostmanWelcomeController {

- +
diff --git a/Postman/Postman-Diagnostic-Test/PostmanDiagnosticTestController.php b/Postman/Postman-Diagnostic-Test/PostmanDiagnosticTestController.php index c526113..03527de 100644 --- a/Postman/Postman-Diagnostic-Test/PostmanDiagnosticTestController.php +++ b/Postman/Postman-Diagnostic-Test/PostmanDiagnosticTestController.php @@ -77,7 +77,7 @@ class PostmanDiagnosticTestController { * Register the Diagnostics screen */ public function addDiagnosticsSubmenu() { - $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, PostmanDiagnosticTestController::DIAGNOSTICS_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, PostmanDiagnosticTestController::DIAGNOSTICS_SLUG, array( $this, 'outputDiagnosticsContent', ) ); @@ -98,14 +98,14 @@ class PostmanDiagnosticTestController { // test features print '
'; - PostmanViewController::outputChildPageHeader( __( 'Diagnostic Test', Postman::TEXT_DOMAIN ) ); + PostmanViewController::outputChildPageHeader( __( 'Diagnostic Test', 'post-smtp' ) ); - printf( '

%s

', __( 'Are you having issues with Postman?', Postman::TEXT_DOMAIN ) ); + printf( '

%s

', __( 'Are you having issues with Postman?', 'post-smtp' ) ); /* translators: where %1$s and %2$s are the URLs to the Troubleshooting and Support Forums on WordPress.org */ - printf( '

%s

', sprintf( __( 'Please check the troubleshooting and error messages page and the support forum.', Postman::TEXT_DOMAIN ), 'https://wordpress.org/plugins/post-smtp/other_notes/', 'https://wordpress.org/support/plugin/post-smtp' ) ); - printf( '

%s

', __( 'Diagnostic Test', Postman::TEXT_DOMAIN ) ); - printf( '

%s


', sprintf( __( 'If you write for help, please include the following:', Postman::TEXT_DOMAIN ), 'https://wordpress.org/plugins/post-smtp/other_notes/', 'https://wordpress.org/support/plugin/post-smtp' ) ); - printf( '', _x( 'Checking..', 'The "please wait" message', Postman::TEXT_DOMAIN ) ); + printf( '

%s

', sprintf( __( 'Please check the troubleshooting and error messages page and the support forum.', 'post-smtp' ), 'https://wordpress.org/plugins/post-smtp/other_notes/', 'https://wordpress.org/support/plugin/post-smtp' ) ); + printf( '

%s

', __( 'Diagnostic Test', 'post-smtp' ) ); + printf( '

%s


', sprintf( __( 'If you write for help, please include the following:', 'post-smtp' ), 'https://wordpress.org/plugins/post-smtp/other_notes/', 'https://wordpress.org/support/plugin/post-smtp' ) ); + printf( '', _x( 'Checking..', 'The "please wait" message', 'post-smtp' ) ); print '
'; } } diff --git a/Postman/Postman-Email-Log/PostmanEmailLogController.php b/Postman/Postman-Email-Log/PostmanEmailLogController.php index be08232..ef1f7c5 100644 --- a/Postman/Postman-Email-Log/PostmanEmailLogController.php +++ b/Postman/Postman-Email-Log/PostmanEmailLogController.php @@ -97,7 +97,7 @@ class PostmanEmailLogController { if ( $success ) { $this->logger->debug( 'Email was successfully re-sent' ); // the message was sent successfully, generate an appropriate message for the user - $statusMessage = sprintf( __( 'Your message was delivered (%d ms) to the SMTP server! Congratulations :)', Postman::TEXT_DOMAIN ), $result ['time'] ); + $statusMessage = sprintf( __( 'Your message was delivered (%d ms) to the SMTP server! Congratulations :)', 'post-smtp' ), $result ['time'] ); // compose the JSON response for the caller $response = array( @@ -163,7 +163,7 @@ class PostmanEmailLogController { $purger->verifyLogItemExistsAndRemove( $postid ); } $mh = new PostmanMessageHandler(); - $mh->addMessage( __( 'Mail Log Entries were deleted.', Postman::TEXT_DOMAIN ) ); + $mh->addMessage( __( 'Mail Log Entries were deleted.', 'post-smtp' ) ); } else { $this->logger->warn( sprintf( 'action "%s" not recognized', $_REQUEST ['action'] ) ); } @@ -186,7 +186,7 @@ class PostmanEmailLogController { $purger = new PostmanEmailLogPurger(); $purger->verifyLogItemExistsAndRemove( $postid ); $mh = new PostmanMessageHandler(); - $mh->addMessage( __( 'Mail Log Entry was deleted.', Postman::TEXT_DOMAIN ) ); + $mh->addMessage( __( 'Mail Log Entry was deleted.', 'post-smtp' ) ); } else { $this->logger->warn( sprintf( 'nonce "%s" failed validation', $_REQUEST ['_wpnonce'] ) ); } @@ -211,29 +211,29 @@ class PostmanEmailLogController { }'; print ''; if ( ! empty( $meta_values ['from_header'] [0] ) ) { - printf( '', _x( 'From', 'Who is this message From?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['from_header'] [0] ) ); + printf( '', _x( 'From', 'Who is this message From?', 'post-smtp' ), esc_html( $meta_values ['from_header'] [0] ) ); } // show the To header (it's optional) if ( ! empty( $meta_values ['to_header'] [0] ) ) { - printf( '', _x( 'To', 'Who is this message To?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['to_header'] [0] ) ); + printf( '', _x( 'To', 'Who is this message To?', 'post-smtp' ), esc_html( $meta_values ['to_header'] [0] ) ); } // show the Cc header (it's optional) if ( ! empty( $meta_values ['cc_header'] [0] ) ) { - printf( '', _x( 'Cc', 'Who is this message Cc\'d to?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['cc_header'] [0] ) ); + printf( '', _x( 'Cc', 'Who is this message Cc\'d to?', 'post-smtp' ), esc_html( $meta_values ['cc_header'] [0] ) ); } // show the Bcc header (it's optional) if ( ! empty( $meta_values ['bcc_header'] [0] ) ) { - printf( '', _x( 'Bcc', 'Who is this message Bcc\'d to?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['bcc_header'] [0] ) ); + printf( '', _x( 'Bcc', 'Who is this message Bcc\'d to?', 'post-smtp' ), esc_html( $meta_values ['bcc_header'] [0] ) ); } // show the Reply-To header (it's optional) if ( ! empty( $meta_values ['reply_to_header'] [0] ) ) { - printf( '', __( 'Reply-To', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['reply_to_header'] [0] ) ); + printf( '', __( 'Reply-To', 'post-smtp' ), esc_html( $meta_values ['reply_to_header'] [0] ) ); } - printf( '', _x( 'Date', 'What is the date today?', Postman::TEXT_DOMAIN ), $post->post_date ); - printf( '', _x( 'Subject', 'What is the subject of this message?', Postman::TEXT_DOMAIN ), esc_html( $post->post_title ) ); + printf( '', _x( 'Date', 'What is the date today?', 'post-smtp' ), $post->post_date ); + printf( '', _x( 'Subject', 'What is the subject of this message?', 'post-smtp' ), esc_html( $post->post_title ) ); // The Transport UI is always there, in more recent versions that is if ( ! empty( $meta_values ['transport_uri'] [0] ) ) { - printf( '', _x( 'Delivery-URI', 'What is the unique URI of the configuration?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['transport_uri'] [0] ) ); + printf( '', _x( 'Delivery-URI', 'What is the unique URI of the configuration?', 'post-smtp' ), esc_html( $meta_values ['transport_uri'] [0] ) ); } print '
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
'; print '
'; @@ -267,14 +267,14 @@ class PostmanEmailLogController { border-bottom: 1px dashed #ccc; background: #bbb; }'; - printf( '

%s

', __( 'This is the conversation between Postman and the mail server. It can be useful for diagnosing problems. DO NOT post it on-line, it may contain your account password.', Postman::TEXT_DOMAIN ) ); + printf( '

%s

', __( 'This is the conversation between Postman and the mail server. It can be useful for diagnosing problems. DO NOT post it on-line, it may contain your account password.', 'post-smtp' ) ); print '
'; print '
';
 			if ( ! empty( $meta_values ['session_transcript'] [0] ) ) {
 				print esc_html( $meta_values ['session_transcript'] [0] );
 			} else {
 				/* Translators: Meaning "Not Applicable" */
-				print __( 'n/a', Postman::TEXT_DOMAIN );
+				print __( 'n/a', 'post-smtp' );
 			}
 			print '
'; print ''; @@ -299,8 +299,8 @@ class PostmanEmailLogController { $this->logger->trace( 'created PostmanEmailLog admin menu item' ); /* Translators where (%s) is the name of the plugin */ - $pageTitle = sprintf( __( '%s Email Log', Postman::TEXT_DOMAIN ), __( 'Post SMTP', Postman::TEXT_DOMAIN ) ); - $pluginName = _x( 'Email Log', 'The log of Emails that have been delivered', Postman::TEXT_DOMAIN ); + $pageTitle = sprintf( __( '%s Email Log', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) ); + $pluginName = _x( 'Email Log', 'The log of Emails that have been delivered', 'post-smtp' ); $page = add_submenu_page( PostmanViewController::POSTMAN_MENU_SLUG, $pageTitle, $pluginName, Postman::MANAGE_POSTMAN_CAPABILITY_LOGS, 'postman_email_log', array( $this, 'postman_render_email_page' ) ); @@ -317,10 +317,10 @@ class PostmanEmailLogController { wp_enqueue_style( 'postman_email_log' ); wp_enqueue_script( 'postman_resend_email_script' ); wp_enqueue_script( 'sprintf' ); - wp_localize_script( 'postman_resend_email_script', 'postman_js_email_was_resent', __( 'Email was successfully resent (but without attachments)', Postman::TEXT_DOMAIN ) ); + wp_localize_script( 'postman_resend_email_script', 'postman_js_email_was_resent', __( 'Email was successfully resent (but without attachments)', 'post-smtp' ) ); /* Translators: Where %s is an error message */ - wp_localize_script( 'postman_resend_email_script', 'postman_js_email_not_resent', __( 'Email could not be resent. Error: %s', Postman::TEXT_DOMAIN ) ); - wp_localize_script( 'postman_resend_email_script', 'postman_js_resend_label', __( 'Resend', Postman::TEXT_DOMAIN ) ); + wp_localize_script( 'postman_resend_email_script', 'postman_js_email_not_resent', __( 'Email could not be resent. Error: %s', 'post-smtp' ) ); + wp_localize_script( 'postman_resend_email_script', 'postman_js_resend_label', __( 'Resend', 'post-smtp' ) ); } /** @@ -349,13 +349,13 @@ class PostmanEmailLogController {

+ echo sprintf( __( '%s Email Log', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) )?>

+ echo __( 'This is a record of deliveries made to the mail server. It does not neccessarily indicate sucessful delivery to the recipient.', 'post-smtp' )?>

- - + +
- - + +
- - + +
- + %5$s
', $item ['ID'], __( 'Resend', Postman::TEXT_DOMAIN ), 'resend-' . $item ['ID'], esc_attr( $to ), __( 'comma-separated for multiple emails', Postman::TEXT_DOMAIN ), wp_create_nonce( 'resend' ) ); + $actions ['resend'] = sprintf( '%2$s
%5$s
', $item ['ID'], __( 'Resend', 'post-smtp' ), 'resend-' . $item ['ID'], esc_attr( $to ), __( 'comma-separated for multiple emails', 'post-smtp' ), wp_create_nonce( 'resend' ) ); } else { - $actions ['resend'] = sprintf( '%2$s', $resendUrl, __( 'Resend', Postman::TEXT_DOMAIN ) ); + $actions ['resend'] = sprintf( '%2$s', $resendUrl, __( 'Resend', 'post-smtp' ) ); } // Return the title contents @@ -159,10 +159,10 @@ class PostmanEmailLogView extends WP_List_Table { function get_columns() { $columns = array( 'cb' => '', // Render a checkbox instead of text - 'title' => _x( 'Subject', 'What is the subject of this message?', Postman::TEXT_DOMAIN ), - 'sent_to' => __( 'Sent To', Postman::TEXT_DOMAIN ), - 'status' => __( 'Status', Postman::TEXT_DOMAIN ), - 'date' => _x( 'Delivery Time', 'When was this email sent?', Postman::TEXT_DOMAIN ), + 'title' => _x( 'Subject', 'What is the subject of this message?', 'post-smtp' ), + 'sent_to' => __( 'Sent To', 'post-smtp' ), + 'status' => __( 'Status', 'post-smtp' ), + 'date' => _x( 'Delivery Time', 'When was this email sent?', 'post-smtp' ), ); return $columns; } @@ -222,7 +222,7 @@ class PostmanEmailLogView extends WP_List_Table { */ function get_bulk_actions() { $actions = array( - 'bulk_delete' => _x( 'Delete', 'Delete an item from the email log', Postman::TEXT_DOMAIN ), + 'bulk_delete' => _x( 'Delete', 'Delete an item from the email log', 'post-smtp' ), ); return $actions; } @@ -363,7 +363,7 @@ class PostmanEmailLogView extends WP_List_Table { // if this PHP system support humanTime, than use it if ( ! empty( $humanTime ) ) { /* Translators: where %s indicates the relative time from now */ - $date = sprintf( _x( '%s ago', 'A relative time as in "five days ago"', Postman::TEXT_DOMAIN ), $humanTime ); + $date = sprintf( _x( '%s ago', 'A relative time as in "five days ago"', 'post-smtp' ), $humanTime ); } $meta_values = get_post_meta( $post->ID ); $sent_to = array_map( 'sanitize_email', explode( ',' , $meta_values ['to_header'] [0] ) ); @@ -372,7 +372,7 @@ class PostmanEmailLogView extends WP_List_Table { 'sent_to' => implode( ', ', $sent_to ), 'title' => esc_html( $post->post_title ), // the post status must be escaped as they are displayed in the HTML output - 'status' => ($post->post_excerpt != null ? esc_html( $post->post_excerpt ) : __( 'Sent', Postman::TEXT_DOMAIN )), + 'status' => ($post->post_excerpt != null ? esc_html( $post->post_excerpt ) : __( 'Sent', 'post-smtp' )), 'date' => date( "$date_format $time_format", strtotime( $post->post_date ) ), 'ID' => $post->ID, ); diff --git a/Postman/Postman-Mail/PostmanDefaultModuleTransport.php b/Postman/Postman-Mail/PostmanDefaultModuleTransport.php index 8f30962..dbce30a 100644 --- a/Postman/Postman-Mail/PostmanDefaultModuleTransport.php +++ b/Postman/Postman-Mail/PostmanDefaultModuleTransport.php @@ -102,7 +102,7 @@ if (! class_exists ( 'PostmanSmtpModuleTransport' )) { return self::SLUG; } public function getName() { - return __ ( 'Default', Postman::TEXT_DOMAIN ); + return __ ( 'Default', 'post-smtp' ); } public function getHostname() { return 'localhost'; diff --git a/Postman/Postman-Mail/PostmanGmailApiModuleTransport.php b/Postman/Postman-Mail/PostmanGmailApiModuleTransport.php index ab568ea..eae4320 100644 --- a/Postman/Postman-Mail/PostmanGmailApiModuleTransport.php +++ b/Postman/Postman-Mail/PostmanGmailApiModuleTransport.php @@ -98,7 +98,7 @@ class PostmanGmailApiModuleTransport extends PostmanAbstractZendModuleTransport return self::SLUG; } public function getName() { - return __ ( 'Gmail API', Postman::TEXT_DOMAIN ); + return __ ( 'Gmail API', 'post-smtp' ); } public function isEnvelopeFromValidationSupported() { return false; @@ -148,7 +148,7 @@ class PostmanGmailApiModuleTransport extends PostmanAbstractZendModuleTransport */ public function getDeliveryDetails() { /* translators: where (1) is the secure icon and (2) is the transport name */ - return sprintf ( __ ( 'Postman will send mail via the %1$s %2$s.', Postman::TEXT_DOMAIN ), '🔐', $this->getName () ); + return sprintf ( __ ( 'Postman will send mail via the %1$s %2$s.', 'post-smtp' ), '🔐', $this->getName () ); } /** @@ -162,7 +162,7 @@ class PostmanGmailApiModuleTransport extends PostmanAbstractZendModuleTransport $this->setReadyForOAuthGrant (); if ($this->isPermissionNeeded ()) { /* translators: %1$s is the Client ID label, and %2$s is the Client Secret label */ - $message = sprintf ( __ ( 'You have configured OAuth 2.0 authentication, but have not received permission to use it.', Postman::TEXT_DOMAIN ), $this->getScribe ()->getClientIdLabel (), $this->getScribe ()->getClientSecretLabel () ); + $message = sprintf ( __ ( 'You have configured OAuth 2.0 authentication, but have not received permission to use it.', 'post-smtp' ), $this->getScribe ()->getClientIdLabel (), $this->getScribe ()->getClientSecretLabel () ); $message .= sprintf ( ' %s.', PostmanUtils::getGrantOAuthPermissionUrl (), $this->getScribe ()->getRequestPermissionLinkText () ); array_push ( $messages, $message ); $this->setNotConfiguredAndReady (); @@ -217,7 +217,7 @@ class PostmanGmailApiModuleTransport extends PostmanAbstractZendModuleTransport $overrideItem ['auth_items'] = array ( array ( 'selected' => true, - 'name' => __ ( 'OAuth 2.0 (requires Client ID and Client Secret)', Postman::TEXT_DOMAIN ), + 'name' => __ ( 'OAuth 2.0 (requires Client ID and Client Secret)', 'post-smtp' ), 'value' => 'oauth2' ) ); diff --git a/Postman/Postman-Mail/PostmanMailgunTransport.php b/Postman/Postman-Mail/PostmanMailgunTransport.php index dcbc1ae..4f79424 100644 --- a/Postman/Postman-Mail/PostmanMailgunTransport.php +++ b/Postman/Postman-Mail/PostmanMailgunTransport.php @@ -36,7 +36,7 @@ class PostmanMailgunTransport extends PostmanAbstractModuleTransport implements return self::SLUG; } public function getName() { - return __( 'Mailgun API', Postman::TEXT_DOMAIN ); + return __( 'Mailgun API', 'post-smtp' ); } /** * v0.2.1 @@ -78,7 +78,7 @@ class PostmanMailgunTransport extends PostmanAbstractModuleTransport implements } public function getDeliveryDetails() { /* translators: where (1) is the secure icon and (2) is the transport name */ - return sprintf( __( 'Post SMTP will send mail via the %1$s %2$s.', Postman::TEXT_DOMAIN ), '🔐', $this->getName() ); + return sprintf( __( 'Post SMTP will send mail via the %1$s %2$s.', 'post-smtp' ), '🔐', $this->getName() ); } /** @@ -102,17 +102,17 @@ class PostmanMailgunTransport extends PostmanAbstractModuleTransport implements $domainName = $this->options->getMailgunDomainName(); if ( empty( $apiKey ) ) { - array_push( $messages, __( 'API Key can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push( $messages, __( 'API Key can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady(); } if ( empty( $domainName ) ) { - array_push( $messages, __( 'Domain Name can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push( $messages, __( 'Domain Name can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady(); } if ( ! $this->isSenderConfigured() ) { - array_push( $messages, __( 'Message From Address can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push( $messages, __( 'Message From Address can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady(); } return $messages; @@ -155,7 +155,7 @@ class PostmanMailgunTransport extends PostmanAbstractModuleTransport implements $overrideItem ['auth_items'] = array( array( 'selected' => true, - 'name' => __( 'API Key', Postman::TEXT_DOMAIN ), + 'name' => __( 'API Key', 'post-smtp' ), 'value' => 'api_key', ), ); @@ -184,40 +184,40 @@ class PostmanMailgunTransport extends PostmanAbstractModuleTransport implements */ public function addSettings() { // the Mailgun Auth section - add_settings_section( PostmanMailgunTransport::MAILGUN_AUTH_SECTION, __( 'Authentication', Postman::TEXT_DOMAIN ), array( + add_settings_section( PostmanMailgunTransport::MAILGUN_AUTH_SECTION, __( 'Authentication', 'post-smtp' ), array( $this, 'printMailgunAuthSectionInfo', ), PostmanMailgunTransport::MAILGUN_AUTH_OPTIONS ); - add_settings_field( PostmanOptions::MAILGUN_API_KEY, __( 'API Key', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::MAILGUN_API_KEY, __( 'API Key', 'post-smtp' ), array( $this, 'mailgun_api_key_callback', ), PostmanMailgunTransport::MAILGUN_AUTH_OPTIONS, PostmanMailgunTransport::MAILGUN_AUTH_SECTION ); - add_settings_field( PostmanOptions::MAILGUN_DOMAIN_NAME, __( 'Domain Name', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::MAILGUN_DOMAIN_NAME, __( 'Domain Name', 'post-smtp' ), array( $this, 'mailgun_domain_name_callback', ), PostmanMailgunTransport::MAILGUN_AUTH_OPTIONS, PostmanMailgunTransport::MAILGUN_AUTH_SECTION ); - add_settings_field( PostmanOptions::MAILGUN_REGION, __( 'Mailgun Europe Region?', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::MAILGUN_REGION, __( 'Mailgun Europe Region?', 'post-smtp' ), array( $this, 'mailgun_region_callback', ), PostmanMailgunTransport::MAILGUN_AUTH_OPTIONS, PostmanMailgunTransport::MAILGUN_AUTH_SECTION ); } public function printMailgunAuthSectionInfo() { /* Translators: Where (1) is the service URL and (2) is the service name and (3) is a api key URL */ - printf( '

%s

', sprintf( __( 'Create an account at %2$s and enter an API key below.', Postman::TEXT_DOMAIN ), 'https://mailgun.com', 'mailgun.com', 'https://app.mailgun.com/app/domains/' ) ); + printf( '

%s

', sprintf( __( 'Create an account at %2$s and enter an API key below.', 'post-smtp' ), 'https://mailgun.com', 'mailgun.com', 'https://app.mailgun.com/app/domains/' ) ); } /** */ public function mailgun_api_key_callback() { - printf( '', null !== $this->options->getMailgunApiKey() ? esc_attr( PostmanUtils::obfuscatePassword( $this->options->getMailgunApiKey() ) ) : '', __( 'Required', Postman::TEXT_DOMAIN ) ); + printf( '', null !== $this->options->getMailgunApiKey() ? esc_attr( PostmanUtils::obfuscatePassword( $this->options->getMailgunApiKey() ) ) : '', __( 'Required', 'post-smtp' ) ); print ''; } function mailgun_domain_name_callback() { - printf( '', null !== $this->options->getMailgunDomainName() ? esc_attr( $this->options->getMailgunDomainName() ) : '', __( 'Required', Postman::TEXT_DOMAIN ) ); + printf( '', null !== $this->options->getMailgunDomainName() ? esc_attr( $this->options->getMailgunDomainName() ) : '', __( 'Required', 'post-smtp' ) ); } function mailgun_region_callback() { @@ -248,14 +248,14 @@ class PostmanMailgunTransport extends PostmanAbstractModuleTransport implements public function printWizardAuthenticationStep() { print '
'; $this->printMailgunAuthSectionInfo(); - printf( '', __( 'API Key', Postman::TEXT_DOMAIN ) ); + printf( '', __( 'API Key', 'post-smtp' ) ); print '
'; print $this->mailgun_api_key_callback(); - printf( '', __( 'Domain Name', Postman::TEXT_DOMAIN ) ); + printf( '', __( 'Domain Name', 'post-smtp' ) ); print '
'; print $this->mailgun_domain_name_callback(); print '
'; - printf( '', __( 'Mailgun Europe Region?', Postman::TEXT_DOMAIN ) ); + printf( '', __( 'Mailgun Europe Region?', 'post-smtp' ) ); print '
'; print $this->mailgun_region_callback(); print '
'; diff --git a/Postman/Postman-Mail/PostmanMandrillTransport.php b/Postman/Postman-Mail/PostmanMandrillTransport.php index 795abfd..4526887 100644 --- a/Postman/Postman-Mail/PostmanMandrillTransport.php +++ b/Postman/Postman-Mail/PostmanMandrillTransport.php @@ -41,7 +41,7 @@ class PostmanMandrillTransport extends PostmanAbstractModuleTransport implements return self::SLUG; } public function getName() { - return __ ( 'Mandrill API', Postman::TEXT_DOMAIN ); + return __ ( 'Mandrill API', 'post-smtp' ); } /** * v0.2.1 @@ -132,7 +132,7 @@ class PostmanMandrillTransport extends PostmanAbstractModuleTransport implements */ public function getDeliveryDetails() { /* translators: where (1) is the secure icon and (2) is the transport name */ - return sprintf ( __ ( 'Postman will send mail via the %1$s %2$s.', Postman::TEXT_DOMAIN ), '🔐', $this->getName () ); + return sprintf ( __ ( 'Postman will send mail via the %1$s %2$s.', 'post-smtp' ), '🔐', $this->getName () ); } /** @@ -144,11 +144,11 @@ class PostmanMandrillTransport extends PostmanAbstractModuleTransport implements $messages = parent::validateTransportConfiguration (); $apiKey = $this->options->getMandrillApiKey (); if (empty ( $apiKey )) { - array_push ( $messages, __ ( 'API Key can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push ( $messages, __ ( 'API Key can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady (); } if (! $this->isSenderConfigured ()) { - array_push ( $messages, __ ( 'Message From Address can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push ( $messages, __ ( 'Message From Address can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady (); } return $messages; @@ -191,7 +191,7 @@ class PostmanMandrillTransport extends PostmanAbstractModuleTransport implements $overrideItem ['auth_items'] = array ( array ( 'selected' => true, - 'name' => __ ( 'API Key', Postman::TEXT_DOMAIN ), + 'name' => __ ( 'API Key', 'post-smtp' ), 'value' => 'api_key' ) ); @@ -220,12 +220,12 @@ class PostmanMandrillTransport extends PostmanAbstractModuleTransport implements */ public function addSettings() { // the Mandrill Auth section - add_settings_section ( PostmanMandrillTransport::MANDRILL_AUTH_SECTION, __ ( 'Authentication', Postman::TEXT_DOMAIN ), array ( + add_settings_section ( PostmanMandrillTransport::MANDRILL_AUTH_SECTION, __ ( 'Authentication', 'post-smtp' ), array ( $this, 'printMandrillAuthSectionInfo' ), PostmanMandrillTransport::MANDRILL_AUTH_OPTIONS ); - add_settings_field ( PostmanOptions::MANDRILL_API_KEY, __ ( 'API Key', Postman::TEXT_DOMAIN ), array ( + add_settings_field ( PostmanOptions::MANDRILL_API_KEY, __ ( 'API Key', 'post-smtp' ), array ( $this, 'mandrill_api_key_callback' ), PostmanMandrillTransport::MANDRILL_AUTH_OPTIONS, PostmanMandrillTransport::MANDRILL_AUTH_SECTION ); @@ -235,13 +235,13 @@ class PostmanMandrillTransport extends PostmanAbstractModuleTransport implements */ public function printMandrillAuthSectionInfo() { /* Translators: Where (1) is the service URL and (2) is the service name and (3) is a api key URL */ - printf ( '

%s

', sprintf ( __ ( 'Create an account at %2$s and enter an API key below.', Postman::TEXT_DOMAIN ), 'https://mandrillapp.com', 'Mandrillapp.com', 'https://mandrillapp.com/settings' ) ); + printf ( '

%s

', sprintf ( __ ( 'Create an account at %2$s and enter an API key below.', 'post-smtp' ), 'https://mandrillapp.com', 'Mandrillapp.com', 'https://mandrillapp.com/settings' ) ); } /** */ public function mandrill_api_key_callback() { - printf ( '', null !== $this->options->getMandrillApiKey () ? esc_attr ( PostmanUtils::obfuscatePassword ( $this->options->getMandrillApiKey () ) ) : '', __ ( 'Required', Postman::TEXT_DOMAIN ) ); + printf ( '', null !== $this->options->getMandrillApiKey () ? esc_attr ( PostmanUtils::obfuscatePassword ( $this->options->getMandrillApiKey () ) ) : '', __ ( 'Required', 'post-smtp' ) ); print ' '; } @@ -268,7 +268,7 @@ class PostmanMandrillTransport extends PostmanAbstractModuleTransport implements public function printWizardAuthenticationStep() { print '
'; $this->printMandrillAuthSectionInfo (); - printf ( '', __ ( 'API Key', Postman::TEXT_DOMAIN ) ); + printf ( '', __ ( 'API Key', 'post-smtp' ) ); print '
'; print $this->mandrill_api_key_callback (); print '
'; diff --git a/Postman/Postman-Mail/PostmanMessage.php b/Postman/Postman-Mail/PostmanMessage.php index 2af67ef..3398cb9 100644 --- a/Postman/Postman-Mail/PostmanMessage.php +++ b/Postman/Postman-Mail/PostmanMessage.php @@ -52,7 +52,7 @@ if ( ! class_exists( 'PostmanMessage' ) ) { } function __get( $name ) { - $message = __( '%1$s property of a PostmanMessage object is not supported. For now all of this class properties are private.', Postman::TEXT_DOMAIN ); + $message = __( '%1$s property of a PostmanMessage object is not supported. For now all of this class properties are private.', 'post-smtp' ); if ( WP_DEBUG ) { trigger_error( sprintf( $message, $name ) ); @@ -63,7 +63,7 @@ if ( ! class_exists( 'PostmanMessage' ) ) { $class = new ReflectionClass(__CLASS__); $methods = $class->getMethods(ReflectionMethod::IS_PUBLIC ); - $message = __( '%1$s method of a PostmanMessage object is not supported. Use one of the following methods
%2$s
', Postman::TEXT_DOMAIN ); + $message = __( '%1$s method of a PostmanMessage object is not supported. Use one of the following methods
%2$s
', 'post-smtp' ); if ( WP_DEBUG ) { trigger_error( sprintf( $message, $name, print_r( $methods, true ) ) ); diff --git a/Postman/Postman-Mail/PostmanModuleTransport.php b/Postman/Postman-Mail/PostmanModuleTransport.php index 21c1624..8c4647b 100644 --- a/Postman/Postman-Mail/PostmanModuleTransport.php +++ b/Postman/Postman-Mail/PostmanModuleTransport.php @@ -503,7 +503,7 @@ abstract class PostmanAbstractZendModuleTransport extends PostmanAbstractModuleT $deliveryDetails ['host'] = $this->getHostname () . ':' . $this->getPort (); $deliveryDetails ['auth_desc'] = $this->getAuthenticationDescription ( $this->getAuthenticationType () ); /* translators: where (1) is the transport type, (2) is the host, and (3) is the Authentication Type (e.g. Postman will send mail via smtp.gmail.com:465 using OAuth 2.0 authentication.) */ - return sprintf ( __ ( 'Postman will send mail via %1$s to %2$s using %3$s authentication.', Postman::TEXT_DOMAIN ), '' . $deliveryDetails ['transport_name'] . '', '' . $deliveryDetails ['host'] . '', '' . $deliveryDetails ['auth_desc'] . '' ); + return sprintf ( __ ( 'Postman will send mail via %1$s to %2$s using %3$s authentication.', 'post-smtp' ), '' . $deliveryDetails ['transport_name'] . '', '' . $deliveryDetails ['host'] . '', '' . $deliveryDetails ['auth_desc'] . '' ); } /** @@ -531,7 +531,7 @@ abstract class PostmanAbstractZendModuleTransport extends PostmanAbstractModuleT if (PostmanOptions::AUTHENTICATION_TYPE_OAUTH2 == $authType) { return 'OAuth 2.0'; } else if (PostmanOptions::AUTHENTICATION_TYPE_NONE == $authType) { - return _x ( 'no', 'as in "There is no Spoon"', Postman::TEXT_DOMAIN ); + return _x ( 'no', 'as in "There is no Spoon"', 'post-smtp' ); } else { switch ($authType) { case PostmanOptions::AUTHENTICATION_TYPE_CRAMMD5 : @@ -550,7 +550,7 @@ abstract class PostmanAbstractZendModuleTransport extends PostmanAbstractModuleT $authDescription = $authType; break; } - return sprintf ( '%s (%s)', __ ( 'Password', Postman::TEXT_DOMAIN ), $authDescription ); + return sprintf ( '%s (%s)', __ ( 'Password', 'post-smtp' ), $authDescription ); } } @@ -575,13 +575,13 @@ abstract class PostmanAbstractZendModuleTransport extends PostmanAbstractModuleT parent::validateTransportConfiguration (); $messages = parent::validateTransportConfiguration (); if (! $this->isSenderConfigured ()) { - array_push ( $messages, __ ( 'Message From Address can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push ( $messages, __ ( 'Message From Address can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady (); } if ($this->getAuthenticationType () == PostmanOptions::AUTHENTICATION_TYPE_OAUTH2) { if (! $this->isOAuth2ClientIdAndClientSecretConfigured ()) { /* translators: %1$s is the Client ID label, and %2$s is the Client Secret label (e.g. Warning: OAuth 2.0 authentication requires an OAuth 2.0-capable Outgoing Mail Server, Sender Email Address, Client ID, and Client Secret.) */ - array_push ( $messages, sprintf ( __ ( 'OAuth 2.0 authentication requires a %1$s and %2$s.', Postman::TEXT_DOMAIN ), $this->getScribe ()->getClientIdLabel (), $this->getScribe ()->getClientSecretLabel () ) ); + array_push ( $messages, sprintf ( __ ( 'OAuth 2.0 authentication requires a %1$s and %2$s.', 'post-smtp' ), $this->getScribe ()->getClientIdLabel (), $this->getScribe ()->getClientSecretLabel () ) ); $this->setNotConfiguredAndReady (); } } @@ -703,21 +703,21 @@ abstract class PostmanAbstractZendModuleTransport extends PostmanAbstractModuleT if ($socket->auth_crammd5 || $socket->auth_login || $socket->authPlain) { array_push ( $overrideAuthItems, array ( 'selected' => $passwordMode, - 'name' => __ ( 'Password (requires username and password)', Postman::TEXT_DOMAIN ), + 'name' => __ ( 'Password (requires username and password)', 'post-smtp' ), 'value' => 'password' ) ); } if ($socket->auth_xoauth || $winningRecommendation ['auth'] == 'oauth2') { array_push ( $overrideAuthItems, array ( 'selected' => $oauth2Mode, - 'name' => __ ( 'OAuth 2.0 (requires Client ID and Client Secret)', Postman::TEXT_DOMAIN ), + 'name' => __ ( 'OAuth 2.0 (requires Client ID and Client Secret)', 'post-smtp' ), 'value' => 'oauth2' ) ); } if ($socket->auth_none) { array_push ( $overrideAuthItems, array ( 'selected' => $noAuthMode, - 'name' => __ ( 'None', Postman::TEXT_DOMAIN ), + 'name' => __ ( 'None', 'post-smtp' ), 'value' => 'none' ) ); } diff --git a/Postman/Postman-Mail/PostmanMyMailConnector.php b/Postman/Postman-Mail/PostmanMyMailConnector.php index e08aa02..d37f97e 100644 --- a/Postman/Postman-Mail/PostmanMyMailConnector.php +++ b/Postman/Postman-Mail/PostmanMyMailConnector.php @@ -172,7 +172,7 @@ if ( ! class_exists( 'PostmanMyMailConnector' ) ) { * @return void */ public function delivery_method( $delivery_methods ) { - $delivery_methods [ MAILSTER_POSTMAN_ID ] = __( 'Postman SMTP', Postman::TEXT_DOMAIN ); + $delivery_methods [ MAILSTER_POSTMAN_ID ] = __( 'Postman SMTP', 'post-smtp' ); return $delivery_methods; } @@ -196,7 +196,7 @@ if ( ! class_exists( 'PostmanMyMailConnector' ) ) { */ public function activate() { if ( defined( 'MAILSTER_VERSION' ) && version_compare( MAILSTER_POSTMAN_REQUIRED_VERSION, MAILSTER_VERSION, '<=' ) ) { - mailster_notice( sprintf( __( 'MyMail: Change the delivery method in the %s!', Postman::TEXT_DOMAIN ), sprintf( '%s', __( 'Settings', 'postman-smtp' ) ) ), '', false, 'delivery_method' ); + mailster_notice( sprintf( __( 'MyMail: Change the delivery method in the %s!', 'post-smtp' ), sprintf( '%s', __( 'Settings', 'postman-smtp' ) ) ), '', false, 'delivery_method' ); $this->reset(); } } @@ -212,7 +212,7 @@ if ( ! class_exists( 'PostmanMyMailConnector' ) ) { if ( mailster_option( 'deliverymethod' ) == MAILSTER_POSTMAN_ID ) { mailster_update_option( 'deliverymethod', 'simple' ); /* Translators where %s is the name of the page */ - mailster_notice( sprintf( __( 'MyMail: Change the delivery method in the %s!', Postman::TEXT_DOMAIN ), sprintf( '%s', __( 'Settings', 'postman-smtp' ) ) ), '', false, 'delivery_method' ); + mailster_notice( sprintf( __( 'MyMail: Change the delivery method in the %s!', 'post-smtp' ), sprintf( '%s', __( 'Settings', 'postman-smtp' ) ) ), '', false, 'delivery_method' ); } } } diff --git a/Postman/Postman-Mail/PostmanSendGridMailEngine.php b/Postman/Postman-Mail/PostmanSendGridMailEngine.php index 32cfb9e..61527c3 100644 --- a/Postman/Postman-Mail/PostmanSendGridMailEngine.php +++ b/Postman/Postman-Mail/PostmanSendGridMailEngine.php @@ -219,22 +219,22 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) { private function errorCodesMap($error_code) { switch ($error_code) { case 413: - $message = sprintf( __( 'ERROR: The JSON payload you have included in your request is too large. Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code ); + $message = sprintf( __( 'ERROR: The JSON payload you have included in your request is too large. Status code is %1$s', 'post-smtp' ), $error_code ); break; case 429: - $message = sprintf( __( 'ERROR: The number of requests you have made exceeds SendGrid rate limitations. Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code ); + $message = sprintf( __( 'ERROR: The number of requests you have made exceeds SendGrid rate limitations. Status code is %1$s', 'post-smtp' ), $error_code ); break; case 500: - $message = sprintf( __( 'ERROR: An error occurred on a SendGrid server. Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code ); + $message = sprintf( __( 'ERROR: An error occurred on a SendGrid server. Status code is %1$s', 'post-smtp' ), $error_code ); break; case 513: - $message = sprintf( __( 'ERROR: The SendGrid v3 Web API is not available. Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code ); + $message = sprintf( __( 'ERROR: The SendGrid v3 Web API is not available. Status code is %1$s', 'post-smtp' ), $error_code ); break; case 502: - $message = sprintf( __( 'ERROR: No recipient supplied. Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code ); + $message = sprintf( __( 'ERROR: No recipient supplied. Status code is %1$s', 'post-smtp' ), $error_code ); break; default: - $message = sprintf( __( 'ERROR: Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code ); + $message = sprintf( __( 'ERROR: Status code is %1$s', 'post-smtp' ), $error_code ); } return $message; diff --git a/Postman/Postman-Mail/PostmanSendGridTransport.php b/Postman/Postman-Mail/PostmanSendGridTransport.php index 358fcc5..8a40f47 100644 --- a/Postman/Postman-Mail/PostmanSendGridTransport.php +++ b/Postman/Postman-Mail/PostmanSendGridTransport.php @@ -36,7 +36,7 @@ class PostmanSendGridTransport extends PostmanAbstractModuleTransport implements return self::SLUG; } public function getName() { - return __ ( 'SendGrid API', Postman::TEXT_DOMAIN ); + return __ ( 'SendGrid API', 'post-smtp' ); } /** * v0.2.1 @@ -76,7 +76,7 @@ class PostmanSendGridTransport extends PostmanAbstractModuleTransport implements } public function getDeliveryDetails() { /* translators: where (1) is the secure icon and (2) is the transport name */ - return sprintf ( __ ( 'Postman will send mail via the %1$s %2$s.', Postman::TEXT_DOMAIN ), '🔐', $this->getName () ); + return sprintf ( __ ( 'Postman will send mail via the %1$s %2$s.', 'post-smtp' ), '🔐', $this->getName () ); } /** @@ -98,11 +98,11 @@ class PostmanSendGridTransport extends PostmanAbstractModuleTransport implements $messages = parent::validateTransportConfiguration (); $apiKey = $this->options->getSendGridApiKey (); if (empty ( $apiKey )) { - array_push ( $messages, __ ( 'API Key can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push ( $messages, __ ( 'API Key can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady (); } if (! $this->isSenderConfigured ()) { - array_push ( $messages, __ ( 'Message From Address can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push ( $messages, __ ( 'Message From Address can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady (); } return $messages; @@ -145,7 +145,7 @@ class PostmanSendGridTransport extends PostmanAbstractModuleTransport implements $overrideItem ['auth_items'] = array ( array ( 'selected' => true, - 'name' => __ ( 'API Key', Postman::TEXT_DOMAIN ), + 'name' => __ ( 'API Key', 'post-smtp' ), 'value' => 'api_key' ) ); @@ -174,25 +174,25 @@ class PostmanSendGridTransport extends PostmanAbstractModuleTransport implements */ public function addSettings() { // the SendGrid Auth section - add_settings_section ( PostmanSendGridTransport::SENDGRID_AUTH_SECTION, __ ( 'Authentication', Postman::TEXT_DOMAIN ), array ( + add_settings_section ( PostmanSendGridTransport::SENDGRID_AUTH_SECTION, __ ( 'Authentication', 'post-smtp' ), array ( $this, 'printSendGridAuthSectionInfo' ), PostmanSendGridTransport::SENDGRID_AUTH_OPTIONS ); - add_settings_field ( PostmanOptions::SENDGRID_API_KEY, __ ( 'API Key', Postman::TEXT_DOMAIN ), array ( + add_settings_field ( PostmanOptions::SENDGRID_API_KEY, __ ( 'API Key', 'post-smtp' ), array ( $this, 'sendgrid_api_key_callback' ), PostmanSendGridTransport::SENDGRID_AUTH_OPTIONS, PostmanSendGridTransport::SENDGRID_AUTH_SECTION ); } public function printSendGridAuthSectionInfo() { /* Translators: Where (1) is the service URL and (2) is the service name and (3) is a api key URL */ - printf ( '

%s

', sprintf ( __ ( 'Create an account at %2$s and enter an API key below.', Postman::TEXT_DOMAIN ), 'https://sendgrid.com', 'SendGrid.com', 'https://app.sendgrid.com/settings/api_keys' ) ); + printf ( '

%s

', sprintf ( __ ( 'Create an account at %2$s and enter an API key below.', 'post-smtp' ), 'https://sendgrid.com', 'SendGrid.com', 'https://app.sendgrid.com/settings/api_keys' ) ); } /** */ public function sendgrid_api_key_callback() { - printf ( '', null !== $this->options->getSendGridApiKey () ? esc_attr ( PostmanUtils::obfuscatePassword ( $this->options->getSendGridApiKey () ) ) : '', __ ( 'Required', Postman::TEXT_DOMAIN ) ); + printf ( '', null !== $this->options->getSendGridApiKey () ? esc_attr ( PostmanUtils::obfuscatePassword ( $this->options->getSendGridApiKey () ) ) : '', __ ( 'Required', 'post-smtp' ) ); print ' '; } @@ -219,7 +219,7 @@ class PostmanSendGridTransport extends PostmanAbstractModuleTransport implements public function printWizardAuthenticationStep() { print '
'; $this->printSendGridAuthSectionInfo (); - printf ( '', __ ( 'API Key', Postman::TEXT_DOMAIN ) ); + printf ( '', __ ( 'API Key', 'post-smtp' ) ); print '
'; print $this->sendgrid_api_key_callback (); print '
'; diff --git a/Postman/Postman-Mail/PostmanSmtpModuleTransport.php b/Postman/Postman-Mail/PostmanSmtpModuleTransport.php index 3bd1ad2..b1f358d 100644 --- a/Postman/Postman-Mail/PostmanSmtpModuleTransport.php +++ b/Postman/Postman-Mail/PostmanSmtpModuleTransport.php @@ -91,21 +91,21 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl protected function validateTransportConfiguration() { $messages = parent::validateTransportConfiguration(); if ( ! $this->isHostConfigured( $this->options ) ) { - array_push( $messages, __( 'Outgoing Mail Server Hostname and Port can not be empty.', Postman::TEXT_DOMAIN ) ); + array_push( $messages, __( 'Outgoing Mail Server Hostname and Port can not be empty.', 'post-smtp' ) ); $this->setNotConfiguredAndReady(); } if ( ! $this->isEnvelopeFromConfigured() ) { - array_push( $messages, __( 'Envelope-From Email Address can not be empty', Postman::TEXT_DOMAIN ) . '.' ); + array_push( $messages, __( 'Envelope-From Email Address can not be empty', 'post-smtp' ) . '.' ); $this->setNotConfiguredAndReady(); } if ( $this->options->isAuthTypePassword() && ! $this->isPasswordAuthenticationConfigured( $this->options ) ) { - array_push( $messages, __( 'Username and password can not be empty.', Postman::TEXT_DOMAIN ) ); + array_push( $messages, __( 'Username and password can not be empty.', 'post-smtp' ) ); $this->setNotConfiguredAndReady(); } if ( $this->getAuthenticationType() == PostmanOptions::AUTHENTICATION_TYPE_OAUTH2 ) { if ( ! $this->isOAuth2SupportedHostConfigured() ) { /* translators: %1$s is the Client ID label, and %2$s is the Client Secret label (e.g. Warning: OAuth 2.0 authentication requires an OAuth 2.0-capable Outgoing Mail Server, Sender Email Address, Client ID, and Client Secret.) */ - array_push( $messages, sprintf( __( 'OAuth 2.0 authentication requires a supported OAuth 2.0-capable Outgoing Mail Server.', Postman::TEXT_DOMAIN ) ) ); + array_push( $messages, sprintf( __( 'OAuth 2.0 authentication requires a supported OAuth 2.0-capable Outgoing Mail Server.', 'post-smtp' ) ) ); $this->setNotConfiguredAndReady(); } } @@ -113,7 +113,7 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl $this->setReadyForOAuthGrant(); if ( $this->isPermissionNeeded( $this->options, $this->getOAuthToken() ) ) { /* translators: %1$s is the Client ID label, and %2$s is the Client Secret label */ - $message = sprintf( __( 'You have configured OAuth 2.0 authentication, but have not received permission to use it.', Postman::TEXT_DOMAIN ), $this->getScribe()->getClientIdLabel(), $this->getScribe()->getClientSecretLabel() ); + $message = sprintf( __( 'You have configured OAuth 2.0 authentication, but have not received permission to use it.', 'post-smtp' ), $this->getScribe()->getClientIdLabel(), $this->getScribe()->getClientSecretLabel() ); $message .= sprintf( ' %s.', PostmanUtils::getGrantOAuthPermissionUrl(), $this->getScribe()->getRequestPermissionLinkText() ); array_push( $messages, $message ); $this->setNotConfiguredAndReady(); @@ -265,7 +265,7 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl $authDesc = $this->getAuthenticationDescription( $recommendation ['auth'] ); $recommendation ['label'] = sprintf( 'SMTP - %2$s:%3$d', $transportDescription, $hostData->hostnameDomainOnly, $port ); /* translators: where %1$s is a description of the transport (eg. SMTPS-SSL), %2$s is a description of the authentication (eg. Password-CRAMMD5), %3$d is the TCP port (eg. 465), %4$d is the hostname */ - $recommendation ['message'] = sprintf( __( 'Postman recommends %1$s with %2$s authentication to host %4$s on port %3$d.', Postman::TEXT_DOMAIN ), $transportDescription, $authDesc, $port, $hostname ); + $recommendation ['message'] = sprintf( __( 'Postman recommends %1$s with %2$s authentication to host %4$s on port %3$d.', 'post-smtp' ), $transportDescription, $authDesc, $port, $hostname ); } // fill-in the rest of the recommendation @@ -322,53 +322,53 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl $oauthScribe = $transport->getScribe(); // Sanitize - add_settings_section( PostmanAdminController::SMTP_SECTION, __( 'Transport Settings', Postman::TEXT_DOMAIN ), array( + add_settings_section( PostmanAdminController::SMTP_SECTION, __( 'Transport Settings', 'post-smtp' ), array( $this, 'printSmtpSectionInfo', ), PostmanAdminController::SMTP_OPTIONS ); - add_settings_field( PostmanOptions::HOSTNAME, __( 'Outgoing Mail Server Hostname', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::HOSTNAME, __( 'Outgoing Mail Server Hostname', 'post-smtp' ), array( $this, 'hostname_callback', ), PostmanAdminController::SMTP_OPTIONS, PostmanAdminController::SMTP_SECTION ); - add_settings_field( PostmanOptions::PORT, __( 'Outgoing Mail Server Port', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::PORT, __( 'Outgoing Mail Server Port', 'post-smtp' ), array( $this, 'port_callback', ), PostmanAdminController::SMTP_OPTIONS, PostmanAdminController::SMTP_SECTION ); - add_settings_field( PostmanOptions::ENVELOPE_SENDER, __( 'Envelope-From Email Address', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::ENVELOPE_SENDER, __( 'Envelope-From Email Address', 'post-smtp' ), array( $this, 'sender_email_callback', ), PostmanAdminController::SMTP_OPTIONS, PostmanAdminController::SMTP_SECTION ); - add_settings_field( PostmanOptions::SECURITY_TYPE, _x( 'Security', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::SECURITY_TYPE, _x( 'Security', 'Configuration Input Field', 'post-smtp' ), array( $this, 'encryption_type_callback', ), PostmanAdminController::SMTP_OPTIONS, PostmanAdminController::SMTP_SECTION ); - add_settings_field( PostmanOptions::AUTHENTICATION_TYPE, __( 'Authentication', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::AUTHENTICATION_TYPE, __( 'Authentication', 'post-smtp' ), array( $this, 'authentication_type_callback', ), PostmanAdminController::SMTP_OPTIONS, PostmanAdminController::SMTP_SECTION ); - add_settings_section( PostmanAdminController::BASIC_AUTH_SECTION, __( 'Authentication', Postman::TEXT_DOMAIN ), array( + add_settings_section( PostmanAdminController::BASIC_AUTH_SECTION, __( 'Authentication', 'post-smtp' ), array( $this, 'printBasicAuthSectionInfo', ), PostmanAdminController::BASIC_AUTH_OPTIONS ); - add_settings_field( PostmanOptions::BASIC_AUTH_USERNAME, __( 'Username', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::BASIC_AUTH_USERNAME, __( 'Username', 'post-smtp' ), array( $this, 'basic_auth_username_callback', ), PostmanAdminController::BASIC_AUTH_OPTIONS, PostmanAdminController::BASIC_AUTH_SECTION ); - add_settings_field( PostmanOptions::BASIC_AUTH_PASSWORD, __( 'Password', Postman::TEXT_DOMAIN ), array( + add_settings_field( PostmanOptions::BASIC_AUTH_PASSWORD, __( 'Password', 'post-smtp' ), array( $this, 'basic_auth_password_callback', ), PostmanAdminController::BASIC_AUTH_OPTIONS, PostmanAdminController::BASIC_AUTH_SECTION ); // the OAuth section - add_settings_section( PostmanAdminController::OAUTH_SECTION, __( 'Authentication', Postman::TEXT_DOMAIN ), array( + add_settings_section( PostmanAdminController::OAUTH_SECTION, __( 'Authentication', 'post-smtp' ), array( $this, 'printOAuthSectionInfo', ), PostmanAdminController::OAUTH_AUTH_OPTIONS ); @@ -398,21 +398,21 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl * Print the Section text */ public function printSmtpSectionInfo() { - print __( 'Configure the communication with the mail server.', Postman::TEXT_DOMAIN ); + print __( 'Configure the communication with the mail server.', 'post-smtp' ); } /** * Get the settings option array and print one of its values */ public function hostname_callback() { - printf( '', null !== $this->options->getHostname() ? esc_attr( $this->options->getHostname() ) : '', __( 'Required', Postman::TEXT_DOMAIN ) ); + printf( '', null !== $this->options->getHostname() ? esc_attr( $this->options->getHostname() ) : '', __( 'Required', 'post-smtp' ) ); } /** * Get the settings option array and print one of its values */ public function port_callback( $args ) { - printf( '', null !== $this->options->getPort() ? esc_attr( $this->options->getPort() ) : '', isset( $args ['style'] ) ? $args ['style'] : '', __( 'Required', Postman::TEXT_DOMAIN ) ); + printf( '', null !== $this->options->getPort() ? esc_attr( $this->options->getPort() ) : '', isset( $args ['style'] ) ? $args ['style'] : '', __( 'Required', 'post-smtp' ) ); } /** @@ -421,7 +421,7 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl public function encryption_type_callback() { $encType = $this->options->getEncryptionType(); print ''; @@ -445,7 +445,7 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl * Print the Section text */ public function printBasicAuthSectionInfo() { - print __( 'Enter the account credentials.', Postman::TEXT_DOMAIN ); + print __( 'Enter the account credentials.', 'post-smtp' ); } /** @@ -453,9 +453,9 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl */ public function basic_auth_username_callback() { $inputValue = (null !== $this->options->getUsername() ? esc_attr( $this->options->getUsername() ) : ''); - $inputDescription = __( 'The Username is usually the same as the Envelope-From Email Address.', Postman::TEXT_DOMAIN ); + $inputDescription = __( 'The Username is usually the same as the Envelope-From Email Address.', 'post-smtp' ); print ('') ; - printf( '
%s', $inputValue, __( 'Required', Postman::TEXT_DOMAIN ), $inputDescription ); + printf( '
%s', $inputValue, __( 'Required', 'post-smtp' ), $inputDescription ); } /** @@ -463,7 +463,7 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl */ public function basic_auth_password_callback() { print ('') ; - printf( '', null !== $this->options->getPassword() ? esc_attr( PostmanUtils::obfuscatePassword( $this->options->getPassword() ) ) : '', __( 'Required', Postman::TEXT_DOMAIN ) ); + printf( '', null !== $this->options->getPassword() ? esc_attr( PostmanUtils::obfuscatePassword( $this->options->getPassword() ) ) : '', __( 'Required', 'post-smtp' ) ); print ' '; } @@ -471,14 +471,14 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl * Get the settings option array and print one of its values */ public function oauth_client_id_callback() { - printf( '', null !== $this->options->getClientId() ? esc_attr( $this->options->getClientId() ) : '', __( 'Required', Postman::TEXT_DOMAIN ) ); + printf( '', null !== $this->options->getClientId() ? esc_attr( $this->options->getClientId() ) : '', __( 'Required', 'post-smtp' ) ); } /** * Get the settings option array and print one of its values */ public function oauth_client_secret_callback() { - printf( '', null !== $this->options->getClientSecret() ? esc_attr( $this->options->getClientSecret() ) : '', __( 'Required', Postman::TEXT_DOMAIN ) ); + printf( '', null !== $this->options->getClientSecret() ? esc_attr( $this->options->getClientSecret() ) : '', __( 'Required', 'post-smtp' ) ); } /** @@ -507,7 +507,7 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl $oauthScribe = $transport->getScribe(); return $oauthScribe->getCallbackDomain(); } catch ( Exception $e ) { - return __( 'Error computing your domain root - please enter it manually', Postman::TEXT_DOMAIN ); + return __( 'Error computing your domain root - please enter it manually', 'post-smtp' ); } } @@ -526,28 +526,28 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl */ public function sender_email_callback() { $inputValue = (null !== $this->options->getEnvelopeSender() ? esc_attr( $this->options->getEnvelopeSender() ) : ''); - $requiredLabel = __( 'Required', Postman::TEXT_DOMAIN ); - $envelopeFromMessage = __( 'This address, like the return address printed on an envelope, identifies the account owner to the SMTP server.', Postman::TEXT_DOMAIN ); - $spfMessage = sprintf( __( 'For reliable delivery, this domain must specify an SPF record permitting the use of the SMTP server named above.', Postman::TEXT_DOMAIN ), 'https://www.mail-tester.com/spf/' ); + $requiredLabel = __( 'Required', 'post-smtp' ); + $envelopeFromMessage = __( 'This address, like the return address printed on an envelope, identifies the account owner to the SMTP server.', 'post-smtp' ); + $spfMessage = sprintf( __( 'For reliable delivery, this domain must specify an SPF record permitting the use of the SMTP server named above.', 'post-smtp' ), 'https://www.mail-tester.com/spf/' ); printf( '
%s %s', $inputValue, $requiredLabel, $envelopeFromMessage, $spfMessage ); } /** */ public function printWizardMailServerHostnameStep() { - printf( '%s', _x( 'Which host will relay the mail?', 'Wizard Step Title', Postman::TEXT_DOMAIN ) ); - printf( '

%s

', __( 'This is the Outgoing (SMTP) Mail Server, or Mail Submission Agent (MSA), which Postman delegates mail delivery to. This server is specific to your email account, and if you don\'t know what to use, ask your email service provider.', Postman::TEXT_DOMAIN ) ); - printf( '

%s

', __( 'Note that many WordPress hosts, such as GoDaddy, Bluehost and Dreamhost, require that you use their mail accounts with their mail servers, and prevent you from using others.', Postman::TEXT_DOMAIN ) ); - printf( '', __( 'Outgoing Mail Server Hostname', Postman::TEXT_DOMAIN ) ); + printf( '%s', _x( 'Which host will relay the mail?', 'Wizard Step Title', 'post-smtp' ) ); + printf( '

%s

', __( 'This is the Outgoing (SMTP) Mail Server, or Mail Submission Agent (MSA), which Postman delegates mail delivery to. This server is specific to your email account, and if you don\'t know what to use, ask your email service provider.', 'post-smtp' ) ); + printf( '

%s

', __( 'Note that many WordPress hosts, such as GoDaddy, Bluehost and Dreamhost, require that you use their mail accounts with their mail servers, and prevent you from using others.', 'post-smtp' ) ); + printf( '', __( 'Outgoing Mail Server Hostname', 'post-smtp' ) ); print $this->hostname_callback(); printf( '', plugins_url( 'post-smtp/style/ajax-loader.gif' ) ); - $warning = __( 'Warning', Postman::TEXT_DOMAIN ); + $warning = __( 'Warning', 'post-smtp' ); /* Translators: Where (%s) is the name of the web host */ - $nonGodaddyDomainMessage = sprintf( __( 'Your email address requires access to a remote SMTP server blocked by %s.', Postman::TEXT_DOMAIN ), 'GoDaddy' ); - $nonGodaddyDomainMessage .= sprintf( ' %s', __( 'If you have access to cPanel, enable the Remote Mail Exchanger.', Postman::TEXT_DOMAIN ) ); + $nonGodaddyDomainMessage = sprintf( __( 'Your email address requires access to a remote SMTP server blocked by %s.', 'post-smtp' ), 'GoDaddy' ); + $nonGodaddyDomainMessage .= sprintf( ' %s', __( 'If you have access to cPanel, enable the Remote Mail Exchanger.', 'post-smtp' ) ); printf( '

%s: %s

', $warning, $nonGodaddyDomainMessage ); /* Translators: Where (%1$s) is the SPF-info URL and (%2$s) is the name of the web host */ - $godaddyCustomDomainMessage = sprintf( __( 'If you own this domain, make sure it has an SPF record authorizing %2$s as a relay, or you will have delivery problems.', Postman::TEXT_DOMAIN ), 'http://www.mail-tester.com/spf/godaddy', 'GoDaddy' ); + $godaddyCustomDomainMessage = sprintf( __( 'If you own this domain, make sure it has an SPF record authorizing %2$s as a relay, or you will have delivery problems.', 'post-smtp' ), 'http://www.mail-tester.com/spf/godaddy', 'GoDaddy' ); printf( '

%s: %s

', $warning, $godaddyCustomDomainMessage ); } @@ -575,12 +575,12 @@ class PostmanSmtpModuleTransport extends PostmanAbstractZendModuleTransport impl print ''; print '
'; - printf( '

%s

', __( 'Enter the account credentials.', Postman::TEXT_DOMAIN ) ); - printf( '', __( 'Username', Postman::TEXT_DOMAIN ) ); + printf( '

%s

', __( 'Enter the account credentials.', 'post-smtp' ) ); + printf( '', __( 'Username', 'post-smtp' ) ); print '
'; print $this->basic_auth_username_callback(); print '
'; - printf( '', __( 'Password', Postman::TEXT_DOMAIN ) ); + printf( '', __( 'Password', 'post-smtp' ) ); print '
'; print $this->basic_auth_password_callback(); print '
'; diff --git a/Postman/Postman-Mail/PostmanTransportRegistry.php b/Postman/Postman-Mail/PostmanTransportRegistry.php index e86f1f4..ed212ab 100644 --- a/Postman/Postman-Mail/PostmanTransportRegistry.php +++ b/Postman/Postman-Mail/PostmanTransportRegistry.php @@ -231,18 +231,18 @@ class PostmanTransportRegistry { if ( PostmanOptions::getInstance()->getRunMode() != PostmanOptions::RUN_MODE_PRODUCTION ) { return array( 'error' => true, - 'message' => __( 'Postman is in non-Production mode and is dumping all emails.', Postman::TEXT_DOMAIN ), + 'message' => __( 'Postman is in non-Production mode and is dumping all emails.', 'post-smtp' ), ); } else { return array( 'error' => false, - 'message' => __( 'Postman is configured.', Postman::TEXT_DOMAIN ), + 'message' => __( 'Postman is configured.', 'post-smtp' ), ); } } else { return array( 'error' => true, - 'message' => __( 'Postman is not configured and is mimicking out-of-the-box WordPress email delivery.', Postman::TEXT_DOMAIN ), + 'message' => __( 'Postman is not configured and is mimicking out-of-the-box WordPress email delivery.', 'post-smtp' ), ); } } diff --git a/Postman/Postman-Mail/PostmanWooCommerce.php b/Postman/Postman-Mail/PostmanWooCommerce.php index a6a2e82..feee32e 100644 --- a/Postman/Postman-Mail/PostmanWooCommerce.php +++ b/Postman/Postman-Mail/PostmanWooCommerce.php @@ -28,7 +28,7 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { return array( - array( 'title' => __( 'Email notifications', Postman::TEXT_DOMAIN ), 'desc' => __( 'Email notifications sent from WooCommerce are listed below. Click on an email to configure it.', Postman::TEXT_DOMAIN ), 'type' => 'title', 'id' => 'email_notification_settings' ), + array( 'title' => __( 'Email notifications', 'post-smtp' ), 'desc' => __( 'Email notifications sent from WooCommerce are listed below. Click on an email to configure it.', 'post-smtp' ), 'type' => 'title', 'id' => 'email_notification_settings' ), array( 'type' => 'email_notification' ), @@ -36,11 +36,11 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { array( 'type' => 'sectionend', 'id' => 'email_recipient_options' ), - array( 'title' => __( 'Email sender options', Postman::TEXT_DOMAIN ), 'type' => 'title', 'desc' => '', 'id' => 'email_options' ), + array( 'title' => __( 'Email sender options', 'post-smtp' ), 'type' => 'title', 'desc' => '', 'id' => 'email_options' ), array( - 'title' => __( '"From" name', Postman::TEXT_DOMAIN ), - 'desc' => __( 'How the sender name appears in outgoing WooCommerce emails.', Postman::TEXT_DOMAIN ), + 'title' => __( '"From" name', 'post-smtp' ), + 'desc' => __( 'How the sender name appears in outgoing WooCommerce emails.', 'post-smtp' ), 'id' => 'woocommerce_email_from_name', 'type' => 'text', 'css' => 'min-width:300px;', @@ -50,8 +50,8 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { ), array( - 'title' => __( '"From" address', Postman::TEXT_DOMAIN ), - 'desc' => __( 'This is overided by the account configured on Post SMTP plugin configuration.', Postman::TEXT_DOMAIN ), + 'title' => __( '"From" address', 'post-smtp' ), + 'desc' => __( 'This is overided by the account configured on Post SMTP plugin configuration.', 'post-smtp' ), 'id' => 'woocommerce_email_from_address', 'type' => 'email', 'custom_attributes' => array( @@ -66,26 +66,26 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { array( 'type' => 'sectionend', 'id' => 'email_options' ), - array( 'title' => __( 'Email template', Postman::TEXT_DOMAIN ), 'type' => 'title', 'desc' => sprintf( __( 'This section lets you customize the WooCommerce emails. Click here to preview your email template.', Postman::TEXT_DOMAIN ), wp_nonce_url( admin_url( '?preview_woocommerce_mail=true' ), 'preview-mail' ) ), 'id' => 'email_template_options' ), + array( 'title' => __( 'Email template', 'post-smtp' ), 'type' => 'title', 'desc' => sprintf( __( 'This section lets you customize the WooCommerce emails. Click here to preview your email template.', 'post-smtp' ), wp_nonce_url( admin_url( '?preview_woocommerce_mail=true' ), 'preview-mail' ) ), 'id' => 'email_template_options' ), array( - 'title' => __( 'Header image', Postman::TEXT_DOMAIN ), - 'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', Postman::TEXT_DOMAIN ), + 'title' => __( 'Header image', 'post-smtp' ), + 'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'post-smtp' ), 'id' => 'woocommerce_email_header_image', 'type' => 'text', 'css' => 'min-width:300px;', - 'placeholder' => __( 'N/A', Postman::TEXT_DOMAIN ), + 'placeholder' => __( 'N/A', 'post-smtp' ), 'default' => '', 'autoload' => false, 'desc_tip' => true, ), array( - 'title' => __( 'Footer text', Postman::TEXT_DOMAIN ), - 'desc' => __( 'The text to appear in the footer of WooCommerce emails.', Postman::TEXT_DOMAIN ), + 'title' => __( 'Footer text', 'post-smtp' ), + 'desc' => __( 'The text to appear in the footer of WooCommerce emails.', 'post-smtp' ), 'id' => 'woocommerce_email_footer_text', 'css' => 'width:300px; height: 75px;', - 'placeholder' => __( 'N/A', Postman::TEXT_DOMAIN ), + 'placeholder' => __( 'N/A', 'post-smtp' ), 'type' => 'textarea', /* translators: %s: site name */ 'default' => get_bloginfo( 'name', 'display' ), @@ -94,9 +94,9 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { ), array( - 'title' => __( 'Base color', Postman::TEXT_DOMAIN ), + 'title' => __( 'Base color', 'post-smtp' ), /* translators: %s: default color */ - 'desc' => sprintf( __( 'The base color for WooCommerce email templates. Default %s.', Postman::TEXT_DOMAIN ), '#96588a' ), + 'desc' => sprintf( __( 'The base color for WooCommerce email templates. Default %s.', 'post-smtp' ), '#96588a' ), 'id' => 'woocommerce_email_base_color', 'type' => 'color', 'css' => 'width:6em;', @@ -106,9 +106,9 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { ), array( - 'title' => __( 'Background color', Postman::TEXT_DOMAIN ), + 'title' => __( 'Background color', 'post-smtp' ), /* translators: %s: default color */ - 'desc' => sprintf( __( 'The background color for WooCommerce email templates. Default %s.', Postman::TEXT_DOMAIN ), '#f7f7f7' ), + 'desc' => sprintf( __( 'The background color for WooCommerce email templates. Default %s.', 'post-smtp' ), '#f7f7f7' ), 'id' => 'woocommerce_email_background_color', 'type' => 'color', 'css' => 'width:6em;', @@ -118,9 +118,9 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { ), array( - 'title' => __( 'Body background color', Postman::TEXT_DOMAIN ), + 'title' => __( 'Body background color', 'post-smtp' ), /* translators: %s: default color */ - 'desc' => sprintf( __( 'The main body background color. Default %s.', Postman::TEXT_DOMAIN ), '#ffffff' ), + 'desc' => sprintf( __( 'The main body background color. Default %s.', 'post-smtp' ), '#ffffff' ), 'id' => 'woocommerce_email_body_background_color', 'type' => 'color', 'css' => 'width:6em;', @@ -130,9 +130,9 @@ if ( ! class_exists( 'PostmanWoocommerce' ) ) { ), array( - 'title' => __( 'Body text color', Postman::TEXT_DOMAIN ), + 'title' => __( 'Body text color', 'post-smtp' ), /* translators: %s: default color */ - 'desc' => sprintf( __( 'The main body text color. Default %s.', Postman::TEXT_DOMAIN ), '#3c3c3c' ), + 'desc' => sprintf( __( 'The main body text color. Default %s.', 'post-smtp' ), '#3c3c3c' ), 'id' => 'woocommerce_email_text_color', 'type' => 'color', 'css' => 'width:6em;', diff --git a/Postman/Postman-Mail/PostmanZendMailEngine.php b/Postman/Postman-Mail/PostmanZendMailEngine.php index 8d69811..a2079f2 100644 --- a/Postman/Postman-Mail/PostmanZendMailEngine.php +++ b/Postman/Postman-Mail/PostmanZendMailEngine.php @@ -204,7 +204,7 @@ if ( ! class_exists( 'PostmanZendMailEngine' ) ) { $message = $e->getMessage(); if ( $e->getCode() == 334 ) { // replace the unusable Google message with a better one in the case of code 334 - $message = sprintf( __( 'Communication Error [334] - make sure the Envelope From email is the same account used to create the Client ID.', Postman::TEXT_DOMAIN ) ); + $message = sprintf( __( 'Communication Error [334] - make sure the Envelope From email is the same account used to create the Client ID.', 'post-smtp' ) ); } // create a new exception $newException = new Exception( $message, $e->getCode() ); diff --git a/Postman/Postman-Send-Test-Email/PostmanSendTestEmailController.php b/Postman/Postman-Send-Test-Email/PostmanSendTestEmailController.php index 55b7d49..42c7b08 100644 --- a/Postman/Postman-Send-Test-Email/PostmanSendTestEmailController.php +++ b/Postman/Postman-Send-Test-Email/PostmanSendTestEmailController.php @@ -90,7 +90,7 @@ class PostmanSendTestEmailController { * Register the Email Test screen */ public function addEmailTestSubmenu() { - $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, PostmanSendTestEmailController::EMAIL_TEST_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, PostmanSendTestEmailController::EMAIL_TEST_SLUG, array( $this, 'outputTestEmailContent', ) ); @@ -110,11 +110,11 @@ class PostmanSendTestEmailController { wp_enqueue_script( 'postman_test_email_wizard_script' ); wp_localize_script( PostmanViewController::POSTMAN_SCRIPT, 'postman_email_test', array( 'recipient' => '#' . self::RECIPIENT_EMAIL_FIELD_NAME, - 'not_started' => _x( 'In Outbox', 'Email Test Status', Postman::TEXT_DOMAIN ), - 'sending' => _x( 'Sending...', 'Email Test Status', Postman::TEXT_DOMAIN ), - 'success' => _x( 'Success', 'Email Test Status', Postman::TEXT_DOMAIN ), - 'failed' => _x( 'Failed', 'Email Test Status', Postman::TEXT_DOMAIN ), - 'ajax_error' => __( 'Ajax Error', Postman::TEXT_DOMAIN ), + 'not_started' => _x( 'In Outbox', 'Email Test Status', 'post-smtp' ), + 'sending' => _x( 'Sending...', 'Email Test Status', 'post-smtp' ), + 'success' => _x( 'Success', 'Email Test Status', 'post-smtp' ), + 'failed' => _x( 'Failed', 'Email Test Status', 'post-smtp' ), + 'ajax_error' => __( 'Ajax Error', 'post-smtp' ), ) ); } @@ -123,42 +123,42 @@ class PostmanSendTestEmailController { public function outputTestEmailContent() { print '
'; - PostmanViewController::outputChildPageHeader( __( 'Send a Test Email', Postman::TEXT_DOMAIN ) ); + PostmanViewController::outputChildPageHeader( __( 'Send a Test Email', 'post-smtp' ) ); printf( '
', PostmanUtils::getSettingsPageUrl() ); // Step 1 - printf( '
%s
', __( 'Specify the Recipient', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', __( 'Specify the Recipient', 'post-smtp' ) ); print '
'; - printf( '%s', __( 'Who is this message going to?', Postman::TEXT_DOMAIN ) ); - printf( '

%s', __( 'This utility allows you to send an email message for testing.', Postman::TEXT_DOMAIN ) ); + printf( '%s', __( 'Who is this message going to?', 'post-smtp' ) ); + printf( '

%s', __( 'This utility allows you to send an email message for testing.', 'post-smtp' ) ); print ' '; /* translators: where %d is an amount of time, in seconds */ - printf( '%s

', sprintf( _n( 'If there is a problem, Postman will give up after %d second.', 'If there is a problem, Postman will give up after %d seconds.', $this->options->getReadTimeout(), Postman::TEXT_DOMAIN ), $this->options->getReadTimeout() ) ); - printf( '', _x( 'Recipient Email Address', 'Configuration Input Field', Postman::TEXT_DOMAIN ) ); + printf( '%s

', sprintf( _n( 'If there is a problem, Postman will give up after %d second.', 'If there is a problem, Postman will give up after %d seconds.', $this->options->getReadTimeout(), 'post-smtp' ), $this->options->getReadTimeout() ) ); + printf( '', _x( 'Recipient Email Address', 'Configuration Input Field', 'post-smtp' ) ); print $this->test_email_callback(); print '
'; // Step 2 - printf( '
%s
', __( 'Send The Message', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', __( 'Send The Message', 'post-smtp' ) ); print '
'; print ''; - print __( 'Sending the message:', Postman::TEXT_DOMAIN ); - printf( ' %s', _x( 'In Outbox', 'Email Test Status', Postman::TEXT_DOMAIN ) ); + print __( 'Sending the message:', 'post-smtp' ); + printf( ' %s', _x( 'In Outbox', 'Email Test Status', 'post-smtp' ) ); print ''; print '
'; - printf( '

', __( 'Status', Postman::TEXT_DOMAIN ) ); + printf( '

', __( 'Status', 'post-smtp' ) ); print ''; print '
'; print '
'; // Step 3 - printf( '
%s
', __( 'Session Transcript', Postman::TEXT_DOMAIN ) ); + printf( '
%s
', __( 'Session Transcript', 'post-smtp' ) ); print '
'; - printf( '%s', __( 'Examine the Session Transcript if you need to.', Postman::TEXT_DOMAIN ) ); - printf( '

%s

', __( 'This is the conversation between Postman and the mail server. It can be useful for diagnosing problems. DO NOT post it on-line, it may contain your account password.', Postman::TEXT_DOMAIN ) ); + printf( '%s', __( 'Examine the Session Transcript if you need to.', 'post-smtp' ) ); + printf( '

%s

', __( 'This is the conversation between Postman and the mail server. It can be useful for diagnosing problems. DO NOT post it on-line, it may contain your account password.', 'post-smtp' ) ); print '
'; - printf( '

', __( 'Session Transcript', Postman::TEXT_DOMAIN ) ); + printf( '

', __( 'Session Transcript', 'post-smtp' ) ); print ''; print '
'; print '
'; @@ -206,7 +206,7 @@ class PostmanSendTestEmailAjaxController extends PostmanAbstractAjaxHandler { $serverName = PostmanUtils::postmanGetServerName(); /* translators: where %s is the domain name of the site */ - $subject = sprintf( _x( 'Postman SMTP Test (%s)', 'Test Email Subject', Postman::TEXT_DOMAIN ), $serverName ); + $subject = sprintf( _x( 'Postman SMTP Test (%s)', 'Test Email Subject', 'post-smtp' ), $serverName ); // Postman API: indicate to Postman this is just for testing add_filter( 'postman_test_email', array( @@ -236,7 +236,7 @@ class PostmanSendTestEmailAjaxController extends PostmanAbstractAjaxHandler { if ( $success ) { $this->logger->debug( 'Test Email delivered to server' ); // the message was sent successfully, generate an appropriate message for the user - $statusMessage = sprintf( __( 'Your message was delivered (%d ms) to the SMTP server! Congratulations :)', Postman::TEXT_DOMAIN ), $result ['time'] ); + $statusMessage = sprintf( __( 'Your message was delivered (%d ms) to the SMTP server! Congratulations :)', 'post-smtp' ), $result ['time'] ); $this->logger->debug( 'statusmessage: ' . $statusMessage ); @@ -292,9 +292,9 @@ class PostmanSendTestEmailAjaxController extends PostmanAbstractAjaxHandler { // English - Mandarin - French - Hindi - Spanish - Portuguese - Russian - Japanese // http://www.pinyin.info/tools/converter/chars2uninumbers.html $greeting = 'Hello! - 你好 - Bonjour! - नमस्ते - ¡Hola! - Olá - Привет! - 今日は'; - $sentBy = sprintf( _x( 'Sent by Postman %s', 'Test Email Tagline', Postman::TEXT_DOMAIN ), $pluginData ['version'] ); - $imageSource = __( 'Image source', Postman::TEXT_DOMAIN ); - $withPermission = __( 'Used with permission', Postman::TEXT_DOMAIN ); + $sentBy = sprintf( _x( 'Sent by Postman %s', 'Test Email Tagline', 'post-smtp' ), $pluginData ['version'] ); + $imageSource = __( 'Image source', 'post-smtp' ); + $withPermission = __( 'Used with permission', 'post-smtp' ); $messageArray = array( 'Content-Type: text/plain; charset = "UTF-8"', 'Content-Transfer-Encoding: 8bit', diff --git a/Postman/Postman.php b/Postman/Postman.php index b0f70e0..ca13826 100644 --- a/Postman/Postman.php +++ b/Postman/Postman.php @@ -19,6 +19,14 @@ class Postman { const ADMINISTRATOR_ROLE_NAME = 'administrator'; const MANAGE_POSTMAN_CAPABILITY_NAME = 'manage_postman_smtp'; const MANAGE_POSTMAN_CAPABILITY_LOGS = 'manage_postman_logs'; + + /** + * Use the text domain directly instead of this constant, as it + * causes issues with https://translate.wordpress.org. + * + * @deprecated + * @see https://github.com/yehudah/Post-SMTP/issues/1#issuecomment-421940923 + */ const TEXT_DOMAIN = 'post-smtp'; private $logger; @@ -60,7 +68,7 @@ class Postman { // get plugin metadata - alternative to get_plugin_data $this->pluginData = array( - 'name' => __( 'Postman SMTP', Postman::TEXT_DOMAIN ), + 'name' => __( 'Postman SMTP', 'post-smtp' ), 'version' => $version, ); @@ -163,9 +171,9 @@ class Postman { public function post_smtp_wpml_admin_notice() { $class = 'notice notice-error'; - $title = __( 'Post SMTP notice!', Postman::TEXT_DOMAIN ); - $intro = __( 'WPML is installed and has a known bug with Post SMTP and few other plugins - you better upgrade, but we can try to fix it.', Postman::TEXT_DOMAIN ); - $text = __( 'Click here to fix', Postman::TEXT_DOMAIN ); + $title = __( 'Post SMTP notice!', 'post-smtp' ); + $intro = __( 'WPML is installed and has a known bug with Post SMTP and few other plugins - you better upgrade, but we can try to fix it.', 'post-smtp' ); + $text = __( 'Click here to fix', 'post-smtp' ); $message = '
' . $text . ''; printf( '

%2$s

%3$s

%4$s

', esc_attr( $class ), $title, $intro, $message ); @@ -305,7 +313,7 @@ class Postman { // I've adopted their error message as well, for shits and giggles .... :D $reflFunc = new ReflectionFunction( 'wp_mail' ); - $message = __( 'Postman: wp_mail has been declared by another plugin or theme, so you won\'t be able to use Postman until the conflict is resolved.', Postman::TEXT_DOMAIN ); + $message = __( 'Postman: wp_mail has been declared by another plugin or theme, so you won\'t be able to use Postman until the conflict is resolved.', 'post-smtp' ); $plugin_full_path = $reflFunc->getFileName(); if ( strpos( $plugin_full_path, 'plugins' ) !== false ) { @@ -382,8 +390,8 @@ class Postman { } $msg = PostmanTransportRegistry::getInstance()->getReadyMessage(); $message = sprintf( $msg['message'] ); - $goToSettings = sprintf( '%s', PostmanUtils::getSettingsPageUrl(), __( 'Settings', Postman::TEXT_DOMAIN ) ); - $goToEmailLog = sprintf( '%s', _x( 'Email Log', 'The log of Emails that have been delivered', Postman::TEXT_DOMAIN ) ); + $goToSettings = sprintf( '%s', PostmanUtils::getSettingsPageUrl(), __( 'Settings', 'post-smtp' ) ); + $goToEmailLog = sprintf( '%s', _x( 'Email Log', 'The log of Emails that have been delivered', 'post-smtp' ) ); if ( PostmanOptions::getInstance()->isMailLoggingEnabled() ) { $goToEmailLog = sprintf( '%s', PostmanUtils::getEmailLogPageUrl(), $goToEmailLog ); } @@ -433,12 +441,12 @@ class Postman { $shortLocale = substr( get_locale(), 0, 2 ); if ( $shortLocale != 'en' ) { $langDir = 'post-smtp/Postman/languages'; - $success = load_plugin_textdomain( Postman::TEXT_DOMAIN, false, $langDir ); + $success = load_plugin_textdomain( 'post-smtp', false, $langDir ); if ( $this->logger->isDebug() ) { if ( $success ) { $this->logger->debug( sprintf( 'local translation file loaded for locale=%s', get_locale() ) ); } else { - $this->logger->debug( sprintf( 'failed to load local translation file: locale=%s file=%s/%s-%s.mo', get_locale(), $langDir, Postman::TEXT_DOMAIN, get_locale() ) ); + $this->logger->debug( sprintf( 'failed to load local translation file: locale=%s file=%s/%s-%s.mo', get_locale(), $langDir, 'post-smtp', get_locale() ) ); } } } diff --git a/Postman/PostmanAdminController.php b/Postman/PostmanAdminController.php index f85e30c..7125cd9 100644 --- a/Postman/PostmanAdminController.php +++ b/Postman/PostmanAdminController.php @@ -111,7 +111,7 @@ if ( ! class_exists( 'PostmanAdminController' ) ) { // do a redirect on the init hook $this->registerInitFunction( 'handleSuccessfulSave' ); // add a saved message to be shown after the redirect - $this->messageHandler->addMessage( _x( 'Settings saved.', 'The plugin successfully saved new settings.', Postman::TEXT_DOMAIN ) ); + $this->messageHandler->addMessage( _x( 'Settings saved.', 'The plugin successfully saved new settings.', 'post-smtp' ) ); return; } else { // unset the action in the failed case as well @@ -162,11 +162,11 @@ if ( ! class_exists( 'PostmanAdminController' ) ) { ?> -

+