From 82f78770cb8c6058bf506db617ed95c21e3c7b0a Mon Sep 17 00:00:00 2001 From: yehudah Date: Tue, 5 Dec 2017 21:53:16 +0000 Subject: * Welcome on activation * email log records per page * email logs trash all * remove gmail hosts for non gmail host --- .../Postman-Email-Log/PostmanEmailLogController.php | 20 +++++++++++++++----- Postman/Postman-Email-Log/PostmanEmailLogService.php | 10 ++++++---- Postman/Postman-Email-Log/PostmanEmailLogView.php | 16 +++++++++++++++- 3 files changed, 36 insertions(+), 10 deletions(-) (limited to 'Postman/Postman-Email-Log') diff --git a/Postman/Postman-Email-Log/PostmanEmailLogController.php b/Postman/Postman-Email-Log/PostmanEmailLogController.php index efb19ae..447b6dc 100644 --- a/Postman/Postman-Email-Log/PostmanEmailLogController.php +++ b/Postman/Postman-Email-Log/PostmanEmailLogController.php @@ -363,7 +363,7 @@ class PostmanEmailLogController { ?>
-
+
@@ -378,11 +378,21 @@ class PostmanEmailLogController {
+
+
+
+
+ + + +
- -
- -
Please notice: when you select a date for example 11/20/2017, behind the scene the query select 11/20/2017 00:00:00.
So if you searching for an email arrived that day at any hour you need to select 11/20/2017 as the From Date and 11/21/2017 as the To Date.
diff --git a/Postman/Postman-Email-Log/PostmanEmailLogService.php b/Postman/Postman-Email-Log/PostmanEmailLogService.php index 5f57ed8..6c0784b 100644 --- a/Postman/Postman-Email-Log/PostmanEmailLogService.php +++ b/Postman/Postman-Email-Log/PostmanEmailLogService.php @@ -234,10 +234,10 @@ if ( ! class_exists( 'PostmanEmailLogPurger' ) ) { * * @return unknown */ - function __construct() { + function __construct( $args = array() ) { $this->logger = new PostmanLogger( get_class( $this ) ); - $args = array( - 'posts_per_page' => 1000, + $defaults = array( + 'posts_per_page' => -1, 'offset' => 0, 'category' => '', 'category_name' => '', @@ -253,7 +253,9 @@ if ( ! class_exists( 'PostmanEmailLogPurger' ) ) { 'post_status' => 'private', 'suppress_filters' => true, ); - $this->posts = get_posts( $args ); + $args = wp_parse_args( $args, $defaults ); + $query = new WP_Query( $args ); + $this->posts = $query->posts; } /** diff --git a/Postman/Postman-Email-Log/PostmanEmailLogView.php b/Postman/Postman-Email-Log/PostmanEmailLogView.php index fe0fdfe..1d8c4b1 100644 --- a/Postman/Postman-Email-Log/PostmanEmailLogView.php +++ b/Postman/Postman-Email-Log/PostmanEmailLogView.php @@ -305,8 +305,10 @@ class PostmanEmailLogView extends WP_List_Table { * be able to use your precisely-queried data immediately. */ $data = array(); + $posts_per_page = absint( $_POST['postman_page_records'] ); + $args = array( - 'posts_per_page' => 1000, + 'posts_per_page' => $posts_per_page, 'offset' => 0, 'orderby' => 'date', 'order' => 'DESC', @@ -339,7 +341,19 @@ class PostmanEmailLogView extends WP_List_Table { $args['s'] = sanitize_text_field( $_POST['search'] ); } + if ( isset( $_POST['postman_trash_all'] ) ) { + $args['posts_per_page'] = -1; + } $posts = new WP_query( $args ); + + if ( isset( $_POST['postman_trash_all'] ) ) { + foreach ( $posts->posts as $post ) { + wp_delete_post( $post->ID, true ); + } + + $posts->posts = array(); + } + $date_format = get_option( 'date_format' ); $time_format = get_option( 'time_format' ); -- cgit v1.2.3