diff options
author | Niels de Blaauw <niels@level-level.com> | 2019-03-13 09:42:41 +0100 |
---|---|---|
committer | Niels de Blaauw <niels@level-level.com> | 2019-03-13 09:42:41 +0100 |
commit | fd70868a4b7c569ff5eeddfa36b71709c24b3555 (patch) | |
tree | 92a5412dcea553a72a2ab90971ec42bba8331481 /Postman/Postman-Email-Log | |
parent | c88e7ad0b42cefd8fb7b509c8c2e355f567d9434 (diff) | |
download | Post-SMTP-fd70868a4b7c569ff5eeddfa36b71709c24b3555.zip |
Fixes #1, deprecates and replaces variable text domain usage
This should be removed as it breaks compatibility with translate.wordpress.org
Diffstat (limited to 'Postman/Postman-Email-Log')
4 files changed, 50 insertions, 50 deletions
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 { }</style></head><body>'; print '<table>'; if ( ! empty( $meta_values ['from_header'] [0] ) ) { - printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _x( 'From', 'Who is this message From?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['from_header'] [0] ) ); + printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _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( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _x( 'To', 'Who is this message To?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['to_header'] [0] ) ); + printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _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( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _x( 'Cc', 'Who is this message Cc\'d to?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['cc_header'] [0] ) ); + printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _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( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _x( 'Bcc', 'Who is this message Bcc\'d to?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['bcc_header'] [0] ) ); + printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _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( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', __( 'Reply-To', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['reply_to_header'] [0] ) ); + printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', __( 'Reply-To', 'post-smtp' ), esc_html( $meta_values ['reply_to_header'] [0] ) ); } - printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _x( 'Date', 'What is the date today?', Postman::TEXT_DOMAIN ), $post->post_date ); - printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _x( 'Subject', 'What is the subject of this message?', Postman::TEXT_DOMAIN ), esc_html( $post->post_title ) ); + printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _x( 'Date', 'What is the date today?', 'post-smtp' ), $post->post_date ); + printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _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( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _x( 'Delivery-URI', 'What is the unique URI of the configuration?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['transport_uri'] [0] ) ); + printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _x( 'Delivery-URI', 'What is the unique URI of the configuration?', 'post-smtp' ), esc_html( $meta_values ['transport_uri'] [0] ) ); } print '</table>'; print '<hr/>'; @@ -267,14 +267,14 @@ class PostmanEmailLogController { border-bottom: 1px dashed #ccc; background: #bbb; }</style></head><body>'; - printf( '<p>%s</p>', __( 'This is the conversation between Postman and the mail server. It can be useful for diagnosing problems. <b>DO NOT</b> post it on-line, it may contain your account password.', Postman::TEXT_DOMAIN ) ); + printf( '<p>%s</p>', __( 'This is the conversation between Postman and the mail server. It can be useful for diagnosing problems. <b>DO NOT</b> post it on-line, it may contain your account password.', 'post-smtp' ) ); print '<hr/>'; print '<pre>'; 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 '</pre>'; print '</body></html>'; @@ -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 { </div> <h2><?php /* Translators where (%s) is the name of the plugin */ - echo sprintf( __( '%s Email Log', Postman::TEXT_DOMAIN ), __( 'Post SMTP', Postman::TEXT_DOMAIN ) )?></h2> + echo sprintf( __( '%s Email Log', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) )?></h2> <div style="background: #ECECEC; border: 1px solid #CCC; padding: 0 10px; margin-top: 5px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;"> <p><?php - echo __( 'This is a record of deliveries made to the mail server. It does not neccessarily indicate sucessful delivery to the recipient.', Postman::TEXT_DOMAIN )?></p> + echo __( 'This is a record of deliveries made to the mail server. It does not neccessarily indicate sucessful delivery to the recipient.', 'post-smtp' )?></p> </div> <?php @@ -369,19 +369,19 @@ class PostmanEmailLogController { <form id="postman-email-log-filter" method="post"> <div id="email-log-filter" class="postman-log-row"> <div class="form-control"> - <label for="from_date"><?php _e( 'From Date', Postman::TEXT_DOMAIN ); ?></label> - <input id="from_date" class="email-log-date" value="<?php echo $from_date; ?>" type="text" name="from_date" placeholder="<?php _e( 'From Date', Postman::TEXT_DOMAIN ); ?>"> + <label for="from_date"><?php _e( 'From Date', 'post-smtp' ); ?></label> + <input id="from_date" class="email-log-date" value="<?php echo $from_date; ?>" type="text" name="from_date" placeholder="<?php _e( 'From Date', 'post-smtp' ); ?>"> </div> <div class="form-control"> - <label for="to_date"><?php _e( 'To Date', Postman::TEXT_DOMAIN ); ?></label> - <input id="to_date" class="email-log-date" value="<?php echo $to_date; ?>" type="text" name="to_date" placeholder="<?php _e( 'To Date', Postman::TEXT_DOMAIN ); ?>"> + <label for="to_date"><?php _e( 'To Date', 'post-smtp' ); ?></label> + <input id="to_date" class="email-log-date" value="<?php echo $to_date; ?>" type="text" name="to_date" placeholder="<?php _e( 'To Date', 'post-smtp' ); ?>"> </div> <div class="form-control"> - <label for="search"><?php _e( 'Search', Postman::TEXT_DOMAIN ); ?></label> - <input id="search" type="text" name="search" value="<?php echo $search; ?>" placeholder="<?php _e( 'Search', Postman::TEXT_DOMAIN ); ?>"> + <label for="search"><?php _e( 'Search', 'post-smtp' ); ?></label> + <input id="search" type="text" name="search" value="<?php echo $search; ?>" placeholder="<?php _e( 'Search', 'post-smtp' ); ?>"> </div> <div class="form-control"> - <label id="postman_page_records"><?php _e( 'Records per page', Postman::TEXT_DOMAIN ); ?></label> + <label id="postman_page_records"><?php _e( 'Records per page', 'post-smtp' ); ?></label> <select id="postman_page_records" name="postman_page_records"> <?php foreach ( $page_records as $value ) { @@ -392,10 +392,10 @@ class PostmanEmailLogController { </select> </div> <div class="form-control" style="padding: 0 5px 0 5px;"> - <button type="submit" name="filter" class="button button-primary"><?php _e( 'Filter/Search', Postman::TEXT_DOMAIN ); ?></button> + <button type="submit" name="filter" class="button button-primary"><?php _e( 'Filter/Search', 'post-smtp' ); ?></button> </div> <div class="form-control"> - <button type="submit" id="postman_trash_all" name="postman_trash_all" class="button button-primary"><?php _e( 'Trash All', Postman::TEXT_DOMAIN ); ?></button> + <button type="submit" id="postman_trash_all" name="postman_trash_all" class="button button-primary"><?php _e( 'Trash All', 'post-smtp' ); ?></button> </div> </div> <div class="error">Please notice: when you select a date for example 11/20/2017, behind the scene the query select <b>11/20/2017 00:00:00</b>.<br>So if you searching for an email arrived that day at any hour you need to select 11/20/2017 as the <b>From Date</b> and 11/21/2017 as the <b>To Date</b>.</div> diff --git a/Postman/Postman-Email-Log/PostmanEmailLogPostType.php b/Postman/Postman-Email-Log/PostmanEmailLogPostType.php index d45f92d..38ab1d0 100644 --- a/Postman/Postman-Email-Log/PostmanEmailLogPostType.php +++ b/Postman/Postman-Email-Log/PostmanEmailLogPostType.php @@ -34,8 +34,8 @@ if (! class_exists ( 'PostmanEmailLogPostType' )) { public static function create_post_type() { register_post_type ( self::POSTMAN_CUSTOM_POST_TYPE_SLUG, array ( 'labels' => array ( - 'name' => _x ( 'Sent Emails', 'The group of Emails that have been delivered', Postman::TEXT_DOMAIN ), - 'singular_name' => _x ( 'Sent Email', 'An Email that has been delivered', Postman::TEXT_DOMAIN ) + 'name' => _x ( 'Sent Emails', 'The group of Emails that have been delivered', 'post-smtp' ), + 'singular_name' => _x ( 'Sent Email', 'An Email that has been delivered', 'post-smtp' ) ), 'capability_type' => '', 'capabilities' => array () diff --git a/Postman/Postman-Email-Log/PostmanEmailLogService.php b/Postman/Postman-Email-Log/PostmanEmailLogService.php index dd51974..0064a64 100644 --- a/Postman/Postman-Email-Log/PostmanEmailLogService.php +++ b/Postman/Postman-Email-Log/PostmanEmailLogService.php @@ -76,7 +76,7 @@ if ( ! class_exists( 'PostmanEmailLogService' ) ) { $status = true; $subject = $message->getSubject(); if ( empty( $subject ) ) { - $statusMessage = sprintf( '%s: %s', __( 'Warning', Postman::TEXT_DOMAIN ), __( 'An empty subject line can result in delivery failure.', Postman::TEXT_DOMAIN ) ); + $statusMessage = sprintf( '%s: %s', __( 'Warning', 'post-smtp' ), __( 'An empty subject line can result in delivery failure.', 'post-smtp' ) ); $status = 'WARN'; } $this->createLog( $log, $message, $transcript, $statusMessage, $status, $transport ); @@ -182,9 +182,9 @@ if ( ! class_exists( 'PostmanEmailLogService' ) ) { } private function checkForLogErrors( PostmanEmailLog $log, $postMessage ) { - $message = __( 'You getting this message because an error detected while delivered your email.', Postman::TEXT_DOMAIN ); - $message .= "\r\n" . sprintf( __( 'For the domain: %1$s',Postman::TEXT_DOMAIN ), get_bloginfo('url') ); - $message .= "\r\n" . __( 'The log to paste when you open a support issue:', Postman::TEXT_DOMAIN ) . "\r\n"; + $message = __( 'You getting this message because an error detected while delivered your email.', 'post-smtp' ); + $message .= "\r\n" . sprintf( __( 'For the domain: %1$s','post-smtp' ), get_bloginfo('url') ); + $message .= "\r\n" . __( 'The log to paste when you open a support issue:', 'post-smtp' ) . "\r\n"; if ( $log->statusMessage && ! empty( $log->statusMessage ) ) { require_once POST_PATH . '/Postman/notifications/PostmanNotify.php'; @@ -263,7 +263,7 @@ if ( ! class_exists( 'PostmanEmailLogService' ) ) { $count = 0; foreach ( $addresses as $address ) { if ( $count >= 3 ) { - $flat .= sprintf( __( '.. +%d more', Postman::TEXT_DOMAIN ), sizeof( $addresses ) - $count ); + $flat .= sprintf( __( '.. +%d more', 'post-smtp' ), sizeof( $addresses ) - $count ); break; } if ( $count > 0 ) { diff --git a/Postman/Postman-Email-Log/PostmanEmailLogView.php b/Postman/Postman-Email-Log/PostmanEmailLogView.php index 2db03d7..2f41bcf 100644 --- a/Postman/Postman-Email-Log/PostmanEmailLogView.php +++ b/Postman/Postman-Email-Log/PostmanEmailLogView.php @@ -95,22 +95,22 @@ class PostmanEmailLogView extends WP_List_Table { $meta_values = get_post_meta( $item ['ID'] ); $actions = array( - 'delete' => sprintf( '<a href="%s">%s</a>', $deleteUrl, _x( 'Delete', 'Delete an item from the email log', Postman::TEXT_DOMAIN ) ), - 'view' => sprintf( '<a href="%s" class="thickbox">%s</a>', $viewUrl, _x( 'View', 'View an item from the email log', Postman::TEXT_DOMAIN ) ), + 'delete' => sprintf( '<a href="%s">%s</a>', $deleteUrl, _x( 'Delete', 'Delete an item from the email log', 'post-smtp' ) ), + 'view' => sprintf( '<a href="%s" class="thickbox">%s</a>', $viewUrl, _x( 'View', 'View an item from the email log', 'post-smtp' ) ), ); if ( ! empty( $meta_values ['session_transcript'] [0] ) ) { - $actions ['transcript'] = sprintf( '<a href="%1$s" class="thickbox">%2$s</a>', $transcriptUrl, __( 'Session Transcript', Postman::TEXT_DOMAIN ) ); + $actions ['transcript'] = sprintf( '<a href="%1$s" class="thickbox">%2$s</a>', $transcriptUrl, __( 'Session Transcript', 'post-smtp' ) ); } else { - $actions ['transcript'] = sprintf( '%2$s', $transcriptUrl, __( 'Session Transcript', Postman::TEXT_DOMAIN ) ); + $actions ['transcript'] = sprintf( '%2$s', $transcriptUrl, __( 'Session Transcript', 'post-smtp' ) ); } if ( ! (empty( $meta_values ['original_to'] [0] ) && empty( $meta_values ['originalHeaders'] [0] )) ) { - // $actions ['resend'] = sprintf ( '<a href="%s">%s</a>', $resendUrl, __ ( 'Resend', Postman::TEXT_DOMAIN ) ); + // $actions ['resend'] = sprintf ( '<a href="%s">%s</a>', $resendUrl, __ ( 'Resend', 'post-smtp' ) ); $emails = maybe_unserialize( $meta_values ['original_to'] [0] ); $to = is_array( $emails ) ? implode( ',', $emails ) : $emails; - $actions ['resend'] = sprintf( '<span id="%3$s"><a class="postman-open-resend" href="#">%2$s</a></span><div style="display:none;"><input type="hidden" name="security" value="%6$s"><input type="text" name="mail_to" class="regular-text ltr" data-id="%1$s" value="%4$s"><button class="postman-resend button button-primary">%2$s</button><i style="color: black;">%5$s</i></div>', $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( '<span id="%3$s"><a class="postman-open-resend" href="#">%2$s</a></span><div style="display:none;"><input type="hidden" name="security" value="%6$s"><input type="text" name="mail_to" class="regular-text ltr" data-id="%1$s" value="%4$s"><button class="postman-resend button button-primary">%2$s</button><i style="color: black;">%5$s</i></div>', $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' => '<input type="checkbox" />', // 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, ); |