diff options
author | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2019-05-15 12:14:32 +0000 |
---|---|---|
committer | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2019-05-15 12:14:32 +0000 |
commit | 38153c0f3e739f3d89a1a7734fd7d199bf457fab (patch) | |
tree | 28e19f4e091d5182a2c63bc98377e5381b0043ac /Postman/Postman-Email-Log | |
parent | 942aa536210fe204a2d097eb8878c1d690e0547b (diff) | |
download | Post-SMTP-38153c0f3e739f3d89a1a7734fd7d199bf457fab.zip |
= 2.0 - 2019-05-15
* New: Mailer Type - Added an option to send without overwrite the 'wp_mail' function, better compability to WordPress delivery. hopefully will be the default in the future.
* Updated: Sendgrid API was upgraded and rewritten to the new version.
* Fixed: Message-Id header was missing on SMTP
* Fixed: Email logger optimization - better query for large amount of records.
* Fixed: The localization was fixed to match translate.wordpress.org translation system ( Thanks to Niels de Blaauw from Level-Level ).
* Fixed: Code and optimization ( Thanks to Niels de Blaauw from Level-Level ).
Diffstat (limited to 'Postman/Postman-Email-Log')
4 files changed, 76 insertions, 72 deletions
diff --git a/Postman/Postman-Email-Log/PostmanEmailLogController.php b/Postman/Postman-Email-Log/PostmanEmailLogController.php index be08232..79751f3 100644 --- a/Postman/Postman-Email-Log/PostmanEmailLogController.php +++ b/Postman/Postman-Email-Log/PostmanEmailLogController.php @@ -1,4 +1,5 @@ <?php +require_once dirname(__DIR__) . '/PostmanEmailLogs.php'; require_once 'PostmanEmailLogService.php'; require_once 'PostmanEmailLogView.php'; @@ -77,8 +78,7 @@ class PostmanEmailLogController { // get the email address of the recipient from the HTTP Request $postid = $this->getRequestParameter( 'email' ); if ( ! empty( $postid ) ) { - $post = get_post( $postid ); - $meta_values = get_post_meta( $postid ); + $meta_values = PostmanEmailLogs::get_data( $postid ); if ( isset( $_POST['mail_to'] ) && ! empty( $_POST['mail_to'] ) ) { $emails = explode( ',', $_POST['mail_to'] ); @@ -87,7 +87,7 @@ class PostmanEmailLogController { $to = $meta_values ['original_to'] [0]; } - $success = wp_mail( $to, $meta_values ['original_subject'] [0], $meta_values ['original_message'] [0], $meta_values ['original_headers'] [0] ); + $success = wp_mail( $to, $meta_values ['original_subject'] [0], maybe_unserialize( $meta_values ['original_message'] [0] ), $meta_values ['original_headers'] [0] ); // Postman API: retrieve the result of sending this message from Postman $result = apply_filters( 'postman_wp_mail_result', null ); @@ -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( @@ -134,8 +134,8 @@ class PostmanEmailLogController { /** * TODO move this somewhere reusable * - * @param unknown $parameterName - * @return unknown + * @param mixed $parameterName + * @return mixed */ private function getRequestParameter( $parameterName ) { if ( isset( $_POST [ $parameterName ] ) ) { @@ -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'] ) ); } @@ -202,7 +202,7 @@ class PostmanEmailLogController { $this->logger->trace( 'handling view item' ); $postid = $_REQUEST ['email']; $post = get_post( $postid ); - $meta_values = get_post_meta( $postid ); + $meta_values = PostmanEmailLogs::get_data( $postid ); // https://css-tricks.com/examples/hrs/ print '<html><head><style>body {font-family: monospace;} hr { border: 0; @@ -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/>'; @@ -260,21 +260,21 @@ class PostmanEmailLogController { $this->logger->trace( 'handling view transcript item' ); $postid = $_REQUEST ['email']; $post = get_post( $postid ); - $meta_values = get_post_meta( $postid ); + $meta_values = PostmanEmailLogs::get_data( $postid ); // https://css-tricks.com/examples/hrs/ print '<html><head><style>body {font-family: monospace;} hr { border: 0; 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,15 @@ 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> + + <?php include_once POST_PATH . '/Postman/extra/donation.php'; ?> <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 +371,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 +394,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..b1b1dff 100644 --- a/Postman/Postman-Email-Log/PostmanEmailLogService.php +++ b/Postman/Postman-Email-Log/PostmanEmailLogService.php @@ -67,7 +67,7 @@ if ( ! class_exists( 'PostmanEmailLogService' ) ) { * Logs successful email attempts * * @param PostmanMessage $message - * @param unknown $transcript + * @param mixed $transcript * @param PostmanModuleTransport $transport */ public function writeSuccessLog( PostmanEmailLog $log, PostmanMessage $message, $transcript, PostmanModuleTransport $transport ) { @@ -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 ); @@ -88,13 +88,13 @@ if ( ! class_exists( 'PostmanEmailLogService' ) ) { * Logs failed email attempts, requires more metadata so the email can be resent in the future * * @param PostmanMessage $message - * @param unknown $transcript + * @param mixed $transcript * @param PostmanModuleTransport $transport - * @param unknown $statusMessage - * @param unknown $originalTo - * @param unknown $originalSubject - * @param unknown $originalMessage - * @param unknown $originalHeaders + * @param mixed $statusMessage + * @param mixed $originalTo + * @param mixed $originalSubject + * @param mixed $originalMessage + * @param mixed $originalHeaders */ public function writeFailureLog( PostmanEmailLog $log, PostmanMessage $message = null, $transcript, PostmanModuleTransport $transport, $statusMessage ) { if ( PostmanOptions::getInstance()->isMailLoggingEnabled() ) { @@ -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'; @@ -227,9 +227,9 @@ if ( ! class_exists( 'PostmanEmailLogService' ) ) { * Creates a Log object for use by writeToEmailLog() * * @param PostmanMessage $message - * @param unknown $transcript - * @param unknown $statusMessage - * @param unknown $success + * @param mixed $transcript + * @param mixed $statusMessage + * @param mixed $success * @param PostmanModuleTransport $transport * @return PostmanEmailLog */ @@ -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 ) { @@ -284,7 +284,7 @@ if ( ! class_exists( 'PostmanEmailLogPurger' ) ) { /** * - * @return unknown + * @return mixed */ function __construct( $args = array() ) { $this->logger = new PostmanLogger( get_class( $this ) ); @@ -313,7 +313,7 @@ if ( ! class_exists( 'PostmanEmailLogPurger' ) ) { /** * * @param array $posts - * @param unknown $postid + * @param mixed $postid */ function verifyLogItemExistsAndRemove( $postid ) { $force_delete = true; @@ -336,7 +336,7 @@ if ( ! class_exists( 'PostmanEmailLogPurger' ) ) { /** * - * @param unknown $size + * @param mixed $size */ function truncateLogItems( $size ) { $index = count( $this->posts ); diff --git a/Postman/Postman-Email-Log/PostmanEmailLogView.php b/Postman/Postman-Email-Log/PostmanEmailLogView.php index 2db03d7..a9722bd 100644 --- a/Postman/Postman-Email-Log/PostmanEmailLogView.php +++ b/Postman/Postman-Email-Log/PostmanEmailLogView.php @@ -1,5 +1,7 @@ <?php +require_once dirname(__DIR__) . '/PostmanEmailLogs.php'; + /** * See http://wpengineer.com/2426/wp_list_table-a-step-by-step-guide/ */ @@ -92,25 +94,25 @@ class PostmanEmailLogView extends WP_List_Table { $transcriptUrl = admin_url( sprintf( $iframeUri, 'transcript', $item ['ID'] ) ); $resendUrl = admin_url( sprintf( $iframeUri, 'resend', $item ['ID'] ) ); - $meta_values = get_post_meta( $item ['ID'] ); + $meta_values = PostmanEmailLogs::get_data( $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 +161,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 +224,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,16 +365,16 @@ 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 ); + $meta_values = PostmanEmailLogs::get_data( $post->ID ); $sent_to = array_map( 'sanitize_email', explode( ',' , $meta_values ['to_header'] [0] ) ); $flattenedPost = array( // the post title must be escaped as they are displayed in the HTML output '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, ); |