summaryrefslogtreecommitdiff
path: root/Postman/Postman-Email-Log
diff options
context:
space:
mode:
authoryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2017-11-20 22:02:17 +0000
committeryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2017-11-20 22:02:17 +0000
commita5f8d8dce0f9f7cc373d62a820d07902e02548d7 (patch)
treed4588eeb10d37ff8cc77162d6efd7abd9ea9a246 /Postman/Postman-Email-Log
parentc4a84af9a1de9645d1742b71c56f1c06f0d0cba0 (diff)
downloadPost-SMTP-a5f8d8dce0f9f7cc373d62a820d07902e02548d7.zip
* Fixed: misspled false
* Fixed: feedback form * Fixed: Some localization strings * Removed: deprecated function * New: Option to input emails when resend email * Added: explain message on email log filter
Diffstat (limited to 'Postman/Postman-Email-Log')
-rw-r--r--Postman/Postman-Email-Log/PostmanEmailLogController.php18
-rw-r--r--Postman/Postman-Email-Log/PostmanEmailLogView.php10
2 files changed, 22 insertions, 6 deletions
diff --git a/Postman/Postman-Email-Log/PostmanEmailLogController.php b/Postman/Postman-Email-Log/PostmanEmailLogController.php
index a7bd78a..efb19ae 100644
--- a/Postman/Postman-Email-Log/PostmanEmailLogController.php
+++ b/Postman/Postman-Email-Log/PostmanEmailLogController.php
@@ -70,13 +70,22 @@ class PostmanEmailLogController {
/**
*/
public function resendMail() {
+ check_ajax_referer( 'resend', 'security' );
+
// 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 );
- $success = wp_mail( $meta_values ['original_to'] [0], $meta_values ['original_subject'] [0], $meta_values ['original_message'] [0], $meta_values ['original_headers'] [0] );
+ if ( isset( $_POST['mail_to'] ) && ! empty( $_POST['mail_to'] ) ) {
+ $emails = explode( ',', $_POST['mail_to'] );
+ $to = array_map( 'sanitize_email', $emails );
+ } else {
+ $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] );
// Postman API: retrieve the result of sending this message from Postman
$result = apply_filters( 'postman_wp_mail_result', null );
@@ -288,7 +297,7 @@ 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 ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ) );
+ $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 );
$page = add_submenu_page( PostmanViewController::POSTMAN_MENU_SLUG, $pageTitle, $pluginName, 'read_private_posts', 'postman_email_log', array( $this, 'postman_render_email_page' ) );
@@ -338,7 +347,7 @@ class PostmanEmailLogController {
</div>
<h2><?php
/* Translators where (%s) is the name of the plugin */
- echo sprintf( __( '%s Email Log', Postman::TEXT_DOMAIN ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ) )?></h2>
+ echo sprintf( __( '%s Email Log', Postman::TEXT_DOMAIN ), __( 'Post SMTP', Postman::TEXT_DOMAIN ) )?></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;">
@@ -374,7 +383,8 @@ class PostmanEmailLogController {
<div class="form-control">
<!-- <button type="submit" name="export_email_logs" class="button button-primary">Export To CSV</button> -->
</div>
- </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>
</form>
<!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
diff --git a/Postman/Postman-Email-Log/PostmanEmailLogView.php b/Postman/Postman-Email-Log/PostmanEmailLogView.php
index f8f4fac..fe0fdfe 100644
--- a/Postman/Postman-Email-Log/PostmanEmailLogView.php
+++ b/Postman/Postman-Email-Log/PostmanEmailLogView.php
@@ -105,7 +105,9 @@ class PostmanEmailLogView extends WP_List_Table {
}
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( '<span id="%3$s"><a href="javascript:postman_resend_email(%1$s);">%2$s</a></span>', $item ['ID'], __( 'Resend', Postman::TEXT_DOMAIN ), 'resend-' . $item ['ID'] );
+ $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' ) );
} else {
$actions ['resend'] = sprintf( '%2$s', $resendUrl, __( 'Resend', Postman::TEXT_DOMAIN ) );
}
@@ -317,6 +319,7 @@ class PostmanEmailLogView extends WP_List_Table {
$from_date = sanitize_text_field( $_POST['from_date'] );
$args['date_query']['after'] = $from_date;
+ $args['date_query']['column'] = 'post_date';
$args['date_query']['inclusive'] = false;
}
@@ -324,6 +327,7 @@ class PostmanEmailLogView extends WP_List_Table {
$to_date = sanitize_text_field( $_POST['to_date'] );
$args['date_query']['before'] = $to_date;
+ $args['date_query']['column'] = 'post_date';
$args['date_query']['inclusive'] = true;
}
@@ -336,6 +340,8 @@ class PostmanEmailLogView extends WP_List_Table {
}
$posts = new WP_query( $args );
+ $date_format = get_option( 'date_format' );
+ $time_format = get_option( 'time_format' );
foreach ( $posts->posts as $post ) {
$date = $post->post_date;
@@ -351,7 +357,7 @@ class PostmanEmailLogView extends WP_List_Table {
'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 )),
- 'date' => $date,
+ 'date' => date( "$date_format $time_format", strtotime( $post->post_date ) ),
'ID' => $post->ID,
);
array_push( $data, $flattenedPost );