Version Description
Download this release
Release Info
Developer | giucu91 |
Plugin | Check Email |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.0.4
- changelog.txt +5 -0
- check-email.php +3 -3
- include/Core/Check_Email_Logger.php +47 -42
- include/Core/Check_Email_Review.php +5 -5
- include/Core/Request/Check_Email_Log_List_Action.php +28 -18
- include/Core/Request/Check_Email_Nonce_Checker.php +11 -4
- include/Core/UI/Component/Check_Email_Dashboard_Widget.php +5 -5
- include/Core/UI/Page/Check_Email_Log_List_Page.php +8 -8
- include/Core/UI/Page/Check_Email_Settings_Page.php +4 -4
- include/Core/UI/Page/Check_Email_Status_Page.php +106 -175
- include/Core/UI/Page/partials/check-email-admin-status-display.php +109 -0
- include/Core/UI/Setting/Check_Email_Core_Setting.php +85 -67
- include/Core/UI/Setting/Check_Email_Log_Setting_Field.php +1 -1
- include/Core/UI/list_table/Check_Email_Log_List_Table.php +42 -20
- include/Util/helper.php +13 -12
- languages/check-email.po +444 -0
- readme.txt +2 -2
changelog.txt
CHANGED
@@ -1,9 +1,14 @@
|
|
1 |
== Changelog ==
|
2 |
|
|
|
|
|
|
|
|
|
3 |
= v1.0.3 - 24/09/2021 =
|
4 |
- Fixed: Secutiry issue
|
5 |
|
6 |
= v1.0.2 - 16/06/2021 =
|
|
|
7 |
- Added: Translation for roles and notices. ( https://github.com/WPChill/check-email/issues/10 )
|
8 |
- Added: Headers of the emails in the view log tab. ( https://github.com/WPChill/check-email/issues/12 )
|
9 |
- Fixed: Admin subpages link bug. ( https://github.com/WPChill/check-email/issues/9 )
|
1 |
== Changelog ==
|
2 |
|
3 |
+
= v1.0.4 - 28/10/2021 =
|
4 |
+
- Fixed: URL got too long when bulk deleting email logs. (https://github.com/WPChill/check-email/issues/30)
|
5 |
+
- Fixed: Sanitization and Escaping
|
6 |
+
|
7 |
= v1.0.3 - 24/09/2021 =
|
8 |
- Fixed: Secutiry issue
|
9 |
|
10 |
= v1.0.2 - 16/06/2021 =
|
11 |
+
- Added: From column in Email Logs. ( https://github.com/WPChill/check-email/issues/24 )
|
12 |
- Added: Translation for roles and notices. ( https://github.com/WPChill/check-email/issues/10 )
|
13 |
- Added: Headers of the emails in the view log tab. ( https://github.com/WPChill/check-email/issues/12 )
|
14 |
- Fixed: Admin subpages link bug. ( https://github.com/WPChill/check-email/issues/9 )
|
check-email.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Check & Log Email
|
4 |
* Description: Check & Log email allows you to test if your WordPress installation is sending emails correctly and logs every email.
|
5 |
* Author: WPChill
|
6 |
-
* Version: 1.0.
|
7 |
* Author URI: https://wpchill.com/
|
8 |
* License: GPLv3 or later
|
9 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -41,7 +41,7 @@ if ( version_compare( PHP_VERSION, '5.6.0', '<' ) ) {
|
|
41 |
<p>
|
42 |
<?php
|
43 |
printf(
|
44 |
-
|
45 |
);
|
46 |
?>
|
47 |
</p>
|
@@ -94,7 +94,7 @@ function check_email_log( $plugin_file ) {
|
|
94 |
|
95 |
$check_email->add_loadie( new \CheckEmail\Core\Request\Check_Email_Nonce_Checker() );
|
96 |
$check_email->add_loadie( new \CheckEmail\Core\Request\Check_Email_Log_List_Action() );
|
97 |
-
|
98 |
$capability_giver = new \CheckEmail\Core\Check_Email_Admin_Capability_Giver();
|
99 |
$check_email->add_loadie( $capability_giver );
|
100 |
$capability_giver->add_cap_to_admin();
|
3 |
* Plugin Name: Check & Log Email
|
4 |
* Description: Check & Log email allows you to test if your WordPress installation is sending emails correctly and logs every email.
|
5 |
* Author: WPChill
|
6 |
+
* Version: 1.0.4
|
7 |
* Author URI: https://wpchill.com/
|
8 |
* License: GPLv3 or later
|
9 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
41 |
<p>
|
42 |
<?php
|
43 |
printf(
|
44 |
+
esc_html__( 'Check & Log Email requires at least PHP 5.6 to function properly. Please upgrade PHP.', 'check-email' )
|
45 |
);
|
46 |
?>
|
47 |
</p>
|
94 |
|
95 |
$check_email->add_loadie( new \CheckEmail\Core\Request\Check_Email_Nonce_Checker() );
|
96 |
$check_email->add_loadie( new \CheckEmail\Core\Request\Check_Email_Log_List_Action() );
|
97 |
+
|
98 |
$capability_giver = new \CheckEmail\Core\Check_Email_Admin_Capability_Giver();
|
99 |
$check_email->add_loadie( $capability_giver );
|
100 |
$capability_giver->add_cap_to_admin();
|
include/Core/Check_Email_Logger.php
CHANGED
@@ -21,48 +21,53 @@ class Check_Email_Logger implements Loadie {
|
|
21 |
* Logs email to database.
|
22 |
*/
|
23 |
public function log_email( $original_mail_info ) {
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
$log =
|
58 |
-
|
59 |
-
$
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
|
68 |
public function on_email_failed( $wp_error ) {
|
21 |
* Logs email to database.
|
22 |
*/
|
23 |
public function log_email( $original_mail_info ) {
|
24 |
+
$option = get_option( 'check-email-log-core' );
|
25 |
+
|
26 |
+
if ( is_array( $option ) && array_key_exists( 'enable_logs', $option ) && 'true' === strtolower( $option['enable_logs'] ) ) {
|
27 |
+
$original_mail_info = apply_filters( 'check_email_wp_mail_log', $original_mail_info );
|
28 |
+
|
29 |
+
$mail_info = wp_parse_args(
|
30 |
+
$original_mail_info,
|
31 |
+
array(
|
32 |
+
'to' => '',
|
33 |
+
'subject' => '',
|
34 |
+
'message' => '',
|
35 |
+
'headers' => '',
|
36 |
+
'attachments' => array(),
|
37 |
+
)
|
38 |
+
);
|
39 |
+
|
40 |
+
$ip = '';
|
41 |
+
if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
|
42 |
+
$ip = sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) );
|
43 |
+
}
|
44 |
+
|
45 |
+
$log = array(
|
46 |
+
'to_email' => \CheckEmail\Util\wp_chill_check_email_stringify( $mail_info['to'] ),
|
47 |
+
'subject' => esc_html($mail_info['subject']),
|
48 |
+
'message' => wp_kses_post($mail_info['message']),
|
49 |
+
'headers' => \CheckEmail\Util\wp_chill_check_email_stringify( $mail_info['headers'], "\n" ),
|
50 |
+
'attachment_name' => \CheckEmail\Util\wp_chill_check_email_stringify( $mail_info['attachments'] ),
|
51 |
+
'sent_date' => current_time( 'mysql' ),
|
52 |
+
'ip_address' => $ip,
|
53 |
+
'result' => 1,
|
54 |
+
);
|
55 |
+
|
56 |
+
if ( empty( $log['attachment_name'] ) ) {
|
57 |
+
$log['attachments'] = 'false';
|
58 |
+
} else {
|
59 |
+
$log['attachments'] = 'true';
|
60 |
+
}
|
61 |
+
|
62 |
+
$log = apply_filters( 'check_email_email_log_before_insert', $log, $original_mail_info );
|
63 |
+
|
64 |
+
$check_email = wpchill_check_email();
|
65 |
+
$check_email->table_manager->insert_log( $log );
|
66 |
+
|
67 |
+
do_action( 'check_email_log_inserted' );
|
68 |
+
}
|
69 |
+
|
70 |
+
return $original_mail_info;
|
71 |
}
|
72 |
|
73 |
public function on_email_failed( $wp_error ) {
|
include/Core/Check_Email_Review.php
CHANGED
@@ -11,7 +11,7 @@ class Check_Email_Review {
|
|
11 |
private $messages;
|
12 |
private $link = 'https://wordpress.org/support/plugin/%s/reviews/#new-post';
|
13 |
private $slug = 'check-email';
|
14 |
-
|
15 |
function __construct() {
|
16 |
|
17 |
$this->messages = array(
|
@@ -75,7 +75,7 @@ class Check_Email_Review {
|
|
75 |
|
76 |
?>
|
77 |
<div id="<?php echo esc_attr($this->slug) ?>-epsilon-review-notice" class="notice notice-success is-dismissible" style="margin-top:30px;">
|
78 |
-
<p><?php echo sprintf( esc_html( $this->messages['notice'] ), $this->value ) ; ?></p>
|
79 |
<p class="actions">
|
80 |
<a id="epsilon-rate" href="<?php echo esc_url( $url ) ?>" target="_blank" class="button button-primary epsilon-review-button">
|
81 |
<?php echo esc_html( $this->messages['rate'] ); ?>
|
@@ -137,7 +137,7 @@ class Check_Email_Review {
|
|
137 |
|
138 |
var data = {
|
139 |
action: 'epsilon_check-email_review',
|
140 |
-
security: '<?php echo $ajax_nonce; ?>',
|
141 |
check: id
|
142 |
};
|
143 |
|
@@ -145,8 +145,8 @@ class Check_Email_Review {
|
|
145 |
data['epsilon-review'] = 1;
|
146 |
}
|
147 |
|
148 |
-
$.post( '<?php echo admin_url( 'admin-ajax.php' ) ?>', data, function( response ) {
|
149 |
-
$( '#<?php echo $this->slug ?>-epsilon-review-notice' ).slideUp( 'fast', function() {
|
150 |
$( this ).remove();
|
151 |
} );
|
152 |
});
|
11 |
private $messages;
|
12 |
private $link = 'https://wordpress.org/support/plugin/%s/reviews/#new-post';
|
13 |
private $slug = 'check-email';
|
14 |
+
|
15 |
function __construct() {
|
16 |
|
17 |
$this->messages = array(
|
75 |
|
76 |
?>
|
77 |
<div id="<?php echo esc_attr($this->slug) ?>-epsilon-review-notice" class="notice notice-success is-dismissible" style="margin-top:30px;">
|
78 |
+
<p><?php echo sprintf( esc_html( $this->messages['notice'] ), esc_html( $this->value ) ) ; ?></p>
|
79 |
<p class="actions">
|
80 |
<a id="epsilon-rate" href="<?php echo esc_url( $url ) ?>" target="_blank" class="button button-primary epsilon-review-button">
|
81 |
<?php echo esc_html( $this->messages['rate'] ); ?>
|
137 |
|
138 |
var data = {
|
139 |
action: 'epsilon_check-email_review',
|
140 |
+
security: '<?php echo esc_js($ajax_nonce); ?>',
|
141 |
check: id
|
142 |
};
|
143 |
|
145 |
data['epsilon-review'] = 1;
|
146 |
}
|
147 |
|
148 |
+
$.post( '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ) ?>', data, function( response ) {
|
149 |
+
$( '#<?php echo esc_html( $this->slug ) ?>-epsilon-review-notice' ).slideUp( 'fast', function() {
|
150 |
$( this ).remove();
|
151 |
} );
|
152 |
});
|
include/Core/Request/Check_Email_Log_List_Action.php
CHANGED
@@ -14,14 +14,16 @@ class Check_Email_Log_List_Action implements Loadie {
|
|
14 |
add_action( 'check-email-log-list-delete', array( $this, 'delete_logs' ) );
|
15 |
add_action( 'check-email-log-list-delete-all', array( $this, 'delete_all_logs' ) );
|
16 |
add_action( 'check-email-log-list-manage-user-roles-changed', array( $this, 'update_capabilities_for_user_roles' ), 10, 2 );
|
|
|
17 |
}
|
18 |
|
19 |
public function view_log_message() {
|
|
|
20 |
if ( ! current_user_can( 'manage_check_email' ) ) {
|
21 |
wp_die();
|
22 |
}
|
23 |
|
24 |
-
$id = absint( $_GET['log_id'] );
|
25 |
|
26 |
if ( $id <= 0 ) {
|
27 |
wp_die();
|
@@ -42,36 +44,33 @@ class Check_Email_Log_List_Action implements Loadie {
|
|
42 |
$active_tab = '1';
|
43 |
}
|
44 |
|
45 |
-
ob_start();
|
46 |
?>
|
47 |
<table style="width: 100%;">
|
48 |
<tr style="background: #eee;">
|
49 |
-
<td style="padding: 5px;"><?php
|
50 |
<td style="padding: 5px;"><?php echo esc_html( $log_item['sent_date'] ); ?></td>
|
51 |
</tr>
|
52 |
<tr style="background: #eee;">
|
53 |
-
<td style="padding: 5px;"><?php
|
54 |
<td style="padding: 5px;"><?php echo esc_html( $log_item['to_email'] ); ?></td>
|
55 |
</tr>
|
56 |
<tr style="background: #eee;">
|
57 |
-
<td style="padding: 5px;"><?php
|
58 |
<td style="padding: 5px;"><?php echo esc_html( $log_item['subject'] ); ?></td>
|
59 |
</tr>
|
60 |
-
|
61 |
-
<td style="padding: 5px;"><?php
|
62 |
<td style="padding: 5px;"><?php echo esc_html( $log_item['headers'] ); ?></td>
|
63 |
</tr>
|
64 |
|
65 |
-
<?php
|
66 |
-
do_action( 'check_email_view_log_after_headers', $log_item );
|
67 |
-
?>
|
68 |
|
69 |
</table>
|
70 |
|
71 |
<div id="tabs">
|
72 |
<ul data-active-tab="<?php echo absint( $active_tab ); ?>">
|
73 |
-
<li><a href="#tabs-text"><?php
|
74 |
-
<li><a href="#tabs-preview"><?php
|
75 |
</ul>
|
76 |
|
77 |
<div id="tabs-text">
|
@@ -84,11 +83,10 @@ class Check_Email_Log_List_Action implements Loadie {
|
|
84 |
</div>
|
85 |
|
86 |
<div id="view-message-footer">
|
87 |
-
<a href="#" class="button action" id="thickbox-footer-close"><?php
|
88 |
</div>
|
89 |
|
90 |
<?php
|
91 |
-
echo ob_get_clean();
|
92 |
}
|
93 |
|
94 |
wp_die(); // this is required to return a proper result.
|
@@ -108,14 +106,26 @@ class Check_Email_Log_List_Action implements Loadie {
|
|
108 |
$id_list = implode( ',', $ids );
|
109 |
|
110 |
$logs_deleted = $this->get_table_manager()->delete_logs( $id_list );
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
112 |
}
|
113 |
|
114 |
public function delete_all_logs() {
|
115 |
$logs_deleted = $this->get_table_manager()->delete_all_logs();
|
116 |
-
|
|
|
|
|
117 |
}
|
118 |
|
|
|
|
|
|
|
|
|
|
|
119 |
public function update_capabilities_for_user_roles( $old_roles, $new_roles ) {
|
120 |
foreach ( $old_roles as $old_role ) {
|
121 |
$role = get_role( $old_role );
|
@@ -135,11 +145,11 @@ class Check_Email_Log_List_Action implements Loadie {
|
|
135 |
}
|
136 |
|
137 |
protected function render_log_deleted_notice( $logs_deleted ) {
|
138 |
-
$message =
|
139 |
$type = 'error';
|
140 |
|
141 |
if ( absint( $logs_deleted ) > 0 ) {
|
142 |
-
$message = sprintf( _n( '1 email log deleted.', '%s email logs deleted', $logs_deleted, 'check-email' ), $logs_deleted );
|
143 |
$type = 'updated';
|
144 |
}
|
145 |
|
14 |
add_action( 'check-email-log-list-delete', array( $this, 'delete_logs' ) );
|
15 |
add_action( 'check-email-log-list-delete-all', array( $this, 'delete_all_logs' ) );
|
16 |
add_action( 'check-email-log-list-manage-user-roles-changed', array( $this, 'update_capabilities_for_user_roles' ), 10, 2 );
|
17 |
+
add_action( 'admin_init', array( $this, 'deleted_logs_message' ) );
|
18 |
}
|
19 |
|
20 |
public function view_log_message() {
|
21 |
+
|
22 |
if ( ! current_user_can( 'manage_check_email' ) ) {
|
23 |
wp_die();
|
24 |
}
|
25 |
|
26 |
+
$id = isset( $_GET['log_id'] ) ? absint( $_GET['log_id'] ) : 0 ;
|
27 |
|
28 |
if ( $id <= 0 ) {
|
29 |
wp_die();
|
44 |
$active_tab = '1';
|
45 |
}
|
46 |
|
|
|
47 |
?>
|
48 |
<table style="width: 100%;">
|
49 |
<tr style="background: #eee;">
|
50 |
+
<td style="padding: 5px;"><?php esc_html_e( 'Sent at', 'check-email' ); ?>:</td>
|
51 |
<td style="padding: 5px;"><?php echo esc_html( $log_item['sent_date'] ); ?></td>
|
52 |
</tr>
|
53 |
<tr style="background: #eee;">
|
54 |
+
<td style="padding: 5px;"><?php esc_html_e( 'To', 'check-email' ); ?>:</td>
|
55 |
<td style="padding: 5px;"><?php echo esc_html( $log_item['to_email'] ); ?></td>
|
56 |
</tr>
|
57 |
<tr style="background: #eee;">
|
58 |
+
<td style="padding: 5px;"><?php esc_html_e( 'Subject', 'check-email' ); ?>:</td>
|
59 |
<td style="padding: 5px;"><?php echo esc_html( $log_item['subject'] ); ?></td>
|
60 |
</tr>
|
61 |
+
<tr style="background: #eee;">
|
62 |
+
<td style="padding: 5px;"><?php esc_html_e( 'Headers', 'check-email' ); ?>:</td>
|
63 |
<td style="padding: 5px;"><?php echo esc_html( $log_item['headers'] ); ?></td>
|
64 |
</tr>
|
65 |
|
66 |
+
<?php do_action( 'check_email_view_log_after_headers', $log_item ); ?>
|
|
|
|
|
67 |
|
68 |
</table>
|
69 |
|
70 |
<div id="tabs">
|
71 |
<ul data-active-tab="<?php echo absint( $active_tab ); ?>">
|
72 |
+
<li><a href="#tabs-text"><?php esc_html_e( 'Raw Email Content', 'check-email' ); ?></a></li>
|
73 |
+
<li><a href="#tabs-preview"><?php esc_html_e( 'Preview Content as HTML', 'check-email' ); ?></a></li>
|
74 |
</ul>
|
75 |
|
76 |
<div id="tabs-text">
|
83 |
</div>
|
84 |
|
85 |
<div id="view-message-footer">
|
86 |
+
<a href="#" class="button action" id="thickbox-footer-close"><?php esc_html_e( 'Close', 'check-email' ); ?></a>
|
87 |
</div>
|
88 |
|
89 |
<?php
|
|
|
90 |
}
|
91 |
|
92 |
wp_die(); // this is required to return a proper result.
|
106 |
$id_list = implode( ',', $ids );
|
107 |
|
108 |
$logs_deleted = $this->get_table_manager()->delete_logs( $id_list );
|
109 |
+
if( isset( $_REQUEST['_wp_http_referer'] ) ){
|
110 |
+
wp_redirect( wp_unslash( $_REQUEST['_wp_http_referer'] ) . '&deleted_logs=' . $logs_deleted ); exit;
|
111 |
+
}else{
|
112 |
+
// phpcs:ignore
|
113 |
+
wp_redirect( wp_unslash( $_SERVER['HTTP_REFERER'] ) . '&deleted_logs=' . $logs_deleted ); exit;
|
114 |
+
}
|
115 |
}
|
116 |
|
117 |
public function delete_all_logs() {
|
118 |
$logs_deleted = $this->get_table_manager()->delete_all_logs();
|
119 |
+
if( isset($_REQUEST['_wp_http_referer'] ) ){
|
120 |
+
wp_redirect( wp_unslash( $_REQUEST['_wp_http_referer'] ) . '&deleted_logs=' . $logs_deleted ); exit;
|
121 |
+
}
|
122 |
}
|
123 |
|
124 |
+
public function deleted_logs_message(){
|
125 |
+
if( isset( $_GET['deleted_logs'] ) ){
|
126 |
+
$this->render_log_deleted_notice( intval( $_GET['deleted_logs'] ) );
|
127 |
+
}
|
128 |
+
}
|
129 |
public function update_capabilities_for_user_roles( $old_roles, $new_roles ) {
|
130 |
foreach ( $old_roles as $old_role ) {
|
131 |
$role = get_role( $old_role );
|
145 |
}
|
146 |
|
147 |
protected function render_log_deleted_notice( $logs_deleted ) {
|
148 |
+
$message = esc_html__( 'There was some problem in deleting the email logs', 'check-email' );
|
149 |
$type = 'error';
|
150 |
|
151 |
if ( absint( $logs_deleted ) > 0 ) {
|
152 |
+
$message = sprintf( esc_html( _n( '1 email log deleted.', '%s email logs deleted', $logs_deleted, 'check-email' )), $logs_deleted );
|
153 |
$type = 'updated';
|
154 |
}
|
155 |
|
include/Core/Request/Check_Email_Nonce_Checker.php
CHANGED
@@ -20,28 +20,34 @@ class Check_Email_Nonce_Checker implements Loadie {
|
|
20 |
}
|
21 |
|
22 |
if ( isset( $_POST['check-email-action'] ) ) {
|
23 |
-
$action = sanitize_text_field( $_POST['check-email-action'] );
|
24 |
|
|
|
|
|
25 |
if ( ! isset( $_POST[ $action . '_nonce' ] ) ) {
|
26 |
return;
|
27 |
}
|
28 |
|
|
|
|
|
29 |
if ( ! wp_verify_nonce( $_POST[ $action . '_nonce' ], $action ) ) {
|
30 |
return;
|
31 |
}
|
32 |
}
|
33 |
|
34 |
if ( isset( $_REQUEST['action'] ) || isset( $_REQUEST['action2'] ) ) {
|
35 |
-
$action = sanitize_text_field( $_REQUEST['action'] );
|
36 |
|
37 |
if ( '-1' === $action ) {
|
38 |
if ( ! isset( $_REQUEST['action2'] ) ) {
|
39 |
return;
|
40 |
}
|
41 |
|
42 |
-
$action = sanitize_text_field( $_REQUEST['action2'] );
|
43 |
}
|
44 |
|
|
|
|
|
45 |
if ( strpos( $action, 'check-email-log-list-' ) !== 0 ) {
|
46 |
return;
|
47 |
}
|
@@ -49,7 +55,8 @@ class Check_Email_Nonce_Checker implements Loadie {
|
|
49 |
if ( ! isset( $_REQUEST[ Check_Email_Log_List_Page::LOG_LIST_ACTION_NONCE_FIELD ] ) ) {
|
50 |
return;
|
51 |
}
|
52 |
-
|
|
|
53 |
if ( ! wp_verify_nonce( $_REQUEST[ Check_Email_Log_List_Page::LOG_LIST_ACTION_NONCE_FIELD ], Check_Email_Log_List_Page::LOG_LIST_ACTION_NONCE ) ) {
|
54 |
return;
|
55 |
}
|
20 |
}
|
21 |
|
22 |
if ( isset( $_POST['check-email-action'] ) ) {
|
23 |
+
$action = sanitize_text_field( wp_unslash( $_POST['check-email-action'] ) );
|
24 |
|
25 |
+
// $action is sanitize on line 23
|
26 |
+
// phpcs:ignore
|
27 |
if ( ! isset( $_POST[ $action . '_nonce' ] ) ) {
|
28 |
return;
|
29 |
}
|
30 |
|
31 |
+
// $action is sanitize on line 23
|
32 |
+
// phpcs:ignore
|
33 |
if ( ! wp_verify_nonce( $_POST[ $action . '_nonce' ], $action ) ) {
|
34 |
return;
|
35 |
}
|
36 |
}
|
37 |
|
38 |
if ( isset( $_REQUEST['action'] ) || isset( $_REQUEST['action2'] ) ) {
|
39 |
+
$action = sanitize_text_field( wp_unslash($_REQUEST['action']) );
|
40 |
|
41 |
if ( '-1' === $action ) {
|
42 |
if ( ! isset( $_REQUEST['action2'] ) ) {
|
43 |
return;
|
44 |
}
|
45 |
|
46 |
+
$action = sanitize_text_field( wp_unslash($_REQUEST['action2']) );
|
47 |
}
|
48 |
|
49 |
+
// $action is sanitize on line 39 or 46
|
50 |
+
// phpcs:ignore
|
51 |
if ( strpos( $action, 'check-email-log-list-' ) !== 0 ) {
|
52 |
return;
|
53 |
}
|
55 |
if ( ! isset( $_REQUEST[ Check_Email_Log_List_Page::LOG_LIST_ACTION_NONCE_FIELD ] ) ) {
|
56 |
return;
|
57 |
}
|
58 |
+
|
59 |
+
// phpcs:ignore
|
60 |
if ( ! wp_verify_nonce( $_REQUEST[ Check_Email_Log_List_Page::LOG_LIST_ACTION_NONCE_FIELD ], Check_Email_Log_List_Page::LOG_LIST_ACTION_NONCE ) ) {
|
61 |
return;
|
62 |
}
|
include/Core/UI/Component/Check_Email_Dashboard_Widget.php
CHANGED
@@ -12,7 +12,7 @@ class Check_Email_Dashboard_Widget implements Loadie {
|
|
12 |
public function register() {
|
13 |
wp_add_dashboard_widget(
|
14 |
'check_email_dashboard_widget',
|
15 |
-
|
16 |
array( $this, 'render' )
|
17 |
);
|
18 |
}
|
@@ -26,7 +26,7 @@ class Check_Email_Dashboard_Widget implements Loadie {
|
|
26 |
?>
|
27 |
|
28 |
<p>
|
29 |
-
<?php
|
30 |
</p>
|
31 |
|
32 |
<?php
|
@@ -34,9 +34,9 @@ class Check_Email_Dashboard_Widget implements Loadie {
|
|
34 |
?>
|
35 |
|
36 |
<ul class="subsubsub" style="float: none">
|
37 |
-
|
38 |
-
<li><?php printf(
|
39 |
-
<li><?php printf(
|
40 |
</ul>
|
41 |
|
42 |
<?php
|
12 |
public function register() {
|
13 |
wp_add_dashboard_widget(
|
14 |
'check_email_dashboard_widget',
|
15 |
+
esc_html__( 'Check Email Summary', 'check-email' ),
|
16 |
array( $this, 'render' )
|
17 |
);
|
18 |
}
|
26 |
?>
|
27 |
|
28 |
<p>
|
29 |
+
<?php esc_html_e( 'Total number of emails logged' , 'check-email' ); ?>: <strong><?php echo number_format( absint( $logs_count ), 0, ',', ',' ); ?></strong>
|
30 |
</p>
|
31 |
|
32 |
<?php
|
34 |
?>
|
35 |
|
36 |
<ul class="subsubsub" style="float: none">
|
37 |
+
<li><?php printf( esc_html__( '<a href="%s">Status</a>', 'check-email' ), 'admin.php?page=check-email-status' ); ?> <span style="color: #ddd"> | </span></li>
|
38 |
+
<li><?php printf( esc_html__( '<a href="%s">Email Logs</a>', 'check-email' ), 'admin.php?page=check-email-logs' ); ?> <span style="color: #ddd"> | </span></li>
|
39 |
+
<li><?php printf( esc_html__( '<a href="%s">Settings</a>', 'check-email' ), 'admin.php?page=check-email-settings' ); ?> <span style="color: #ddd"> | </span></li>
|
40 |
</ul>
|
41 |
|
42 |
<?php
|
include/Core/UI/Page/Check_Email_Log_List_Page.php
CHANGED
@@ -11,7 +11,7 @@ class Check_Email_Log_List_Page extends Check_Email_BasePage {
|
|
11 |
const PAGE_SLUG = 'check-email-logs';
|
12 |
const LOG_LIST_ACTION_NONCE_FIELD = 'check-email-log-list-nonce-field';
|
13 |
const LOG_LIST_ACTION_NONCE = 'check-email-log-list-nonce';
|
14 |
-
|
15 |
|
16 |
/**
|
17 |
* Setup hooks.
|
@@ -30,8 +30,8 @@ class Check_Email_Log_List_Page extends Check_Email_BasePage {
|
|
30 |
if ( is_array( $option ) && array_key_exists( 'enable_logs', $option ) && 'true' === strtolower( $option['enable_logs'] ) ) {
|
31 |
$this->page = add_submenu_page(
|
32 |
Check_Email_Status_Page::PAGE_SLUG,
|
33 |
-
|
34 |
-
|
35 |
'manage_check_email',
|
36 |
self::PAGE_SLUG,
|
37 |
array( $this, 'render_page' )
|
@@ -44,7 +44,7 @@ class Check_Email_Log_List_Page extends Check_Email_BasePage {
|
|
44 |
}
|
45 |
|
46 |
public function render_page() {
|
47 |
-
|
48 |
$plugin_dir_url = plugin_dir_url( $check_email->get_plugin_file() );
|
49 |
wp_enqueue_style( 'check-email-view-logs-css', $plugin_dir_url . 'assets/css/admin/view-logs.css', array( 'jquery-ui-css' ), $check_email->get_version() );
|
50 |
$option = get_option( 'check-email-log-core' );
|
@@ -54,12 +54,12 @@ class Check_Email_Log_List_Page extends Check_Email_BasePage {
|
|
54 |
$this->log_list_table->prepare_items();
|
55 |
?>
|
56 |
<div class="wrap">
|
57 |
-
<h2><?php
|
58 |
<?php settings_errors(); ?>
|
59 |
|
60 |
<form id="email-logs-list" method="get">
|
61 |
<input type="hidden" name="page" value="<?php echo esc_attr( self::PAGE_SLUG ); ?>">
|
62 |
-
<?php $this->log_list_table->search_box(
|
63 |
|
64 |
<?php
|
65 |
// Disable the output of referrer hidden field, since it will be generated by the log list table.
|
@@ -78,7 +78,7 @@ class Check_Email_Log_List_Page extends Check_Email_BasePage {
|
|
78 |
$this->get_screen()->add_option(
|
79 |
'per_page',
|
80 |
array(
|
81 |
-
'label' =>
|
82 |
'default' => 20,
|
83 |
'option' => 'per_page',
|
84 |
)
|
@@ -129,6 +129,6 @@ class Check_Email_Log_List_Page extends Check_Email_BasePage {
|
|
129 |
|
130 |
wp_register_script( 'insertionQ', $plugin_dir_url . 'assets/vendor/insertion-query/insQ.min.js', array( 'jquery' ), '1.0.4', true );
|
131 |
|
132 |
-
wp_enqueue_script( 'check-email-view-logs', $plugin_dir_url . 'assets/js/admin/view-logs.js', array( 'insertionQ', 'jquery-ui-core', 'jquery-ui-datepicker', 'jquery-ui-tooltip' ), $check_email->get_version(), true );
|
133 |
}
|
134 |
}
|
11 |
const PAGE_SLUG = 'check-email-logs';
|
12 |
const LOG_LIST_ACTION_NONCE_FIELD = 'check-email-log-list-nonce-field';
|
13 |
const LOG_LIST_ACTION_NONCE = 'check-email-log-list-nonce';
|
14 |
+
const CAPABILITY = 'manage_check_email';
|
15 |
|
16 |
/**
|
17 |
* Setup hooks.
|
30 |
if ( is_array( $option ) && array_key_exists( 'enable_logs', $option ) && 'true' === strtolower( $option['enable_logs'] ) ) {
|
31 |
$this->page = add_submenu_page(
|
32 |
Check_Email_Status_Page::PAGE_SLUG,
|
33 |
+
esc_html__( 'View Logs', 'check-email'),
|
34 |
+
esc_html__( 'View Logs', 'check-email'),
|
35 |
'manage_check_email',
|
36 |
self::PAGE_SLUG,
|
37 |
array( $this, 'render_page' )
|
44 |
}
|
45 |
|
46 |
public function render_page() {
|
47 |
+
$check_email = wpchill_check_email();
|
48 |
$plugin_dir_url = plugin_dir_url( $check_email->get_plugin_file() );
|
49 |
wp_enqueue_style( 'check-email-view-logs-css', $plugin_dir_url . 'assets/css/admin/view-logs.css', array( 'jquery-ui-css' ), $check_email->get_version() );
|
50 |
$option = get_option( 'check-email-log-core' );
|
54 |
$this->log_list_table->prepare_items();
|
55 |
?>
|
56 |
<div class="wrap">
|
57 |
+
<h2><?php esc_html_e( 'Email Logs', 'check-email' ); ?></h2>
|
58 |
<?php settings_errors(); ?>
|
59 |
|
60 |
<form id="email-logs-list" method="get">
|
61 |
<input type="hidden" name="page" value="<?php echo esc_attr( self::PAGE_SLUG ); ?>">
|
62 |
+
<?php $this->log_list_table->search_box( esc_html__( 'Search Logs', 'check-email' ), 'search_id' ); ?>
|
63 |
|
64 |
<?php
|
65 |
// Disable the output of referrer hidden field, since it will be generated by the log list table.
|
78 |
$this->get_screen()->add_option(
|
79 |
'per_page',
|
80 |
array(
|
81 |
+
'label' => esc_html__( 'Entries per page', 'check-email' ),
|
82 |
'default' => 20,
|
83 |
'option' => 'per_page',
|
84 |
)
|
129 |
|
130 |
wp_register_script( 'insertionQ', $plugin_dir_url . 'assets/vendor/insertion-query/insQ.min.js', array( 'jquery' ), '1.0.4', true );
|
131 |
|
132 |
+
wp_enqueue_script( 'check-email-view-logs', $plugin_dir_url . 'assets/js/admin/view-logs.js', array( 'insertionQ', 'jquery-ui-core', 'jquery-ui-datepicker', 'jquery-ui-tooltip', 'jquery-ui-tabs' ), $check_email->get_version(), true );
|
133 |
}
|
134 |
}
|
include/Core/UI/Page/Check_Email_Settings_Page.php
CHANGED
@@ -56,8 +56,8 @@ class Check_Email_Settings_Page extends Check_Email_BasePage {
|
|
56 |
|
57 |
$this->page = add_submenu_page(
|
58 |
Check_Email_Status_Page::PAGE_SLUG,
|
59 |
-
|
60 |
-
|
61 |
'manage_options',
|
62 |
self::PAGE_SLUG,
|
63 |
array( $this, 'render_page' )
|
@@ -68,7 +68,7 @@ class Check_Email_Settings_Page extends Check_Email_BasePage {
|
|
68 |
public function render_page() {
|
69 |
?>
|
70 |
<div class="wrap">
|
71 |
-
<h1><?php
|
72 |
|
73 |
<form method="post" action="options.php">
|
74 |
<?php
|
@@ -76,7 +76,7 @@ class Check_Email_Settings_Page extends Check_Email_BasePage {
|
|
76 |
settings_fields( self::PAGE_SLUG );
|
77 |
do_settings_sections( self::PAGE_SLUG );
|
78 |
|
79 |
-
submit_button(
|
80 |
?>
|
81 |
</form>
|
82 |
|
56 |
|
57 |
$this->page = add_submenu_page(
|
58 |
Check_Email_Status_Page::PAGE_SLUG,
|
59 |
+
esc_html__( 'Settings', 'check-email' ),
|
60 |
+
esc_html__( 'Settings', 'check-email' ),
|
61 |
'manage_options',
|
62 |
self::PAGE_SLUG,
|
63 |
array( $this, 'render_page' )
|
68 |
public function render_page() {
|
69 |
?>
|
70 |
<div class="wrap">
|
71 |
+
<h1><?php esc_html_e( 'Email Log Settings', 'check-email' ); ?></h1>
|
72 |
|
73 |
<form method="post" action="options.php">
|
74 |
<?php
|
76 |
settings_fields( self::PAGE_SLUG );
|
77 |
do_settings_sections( self::PAGE_SLUG );
|
78 |
|
79 |
+
submit_button( esc_html__( 'Save', 'check-email' ) );
|
80 |
?>
|
81 |
</form>
|
82 |
|
include/Core/UI/Page/Check_Email_Status_Page.php
CHANGED
@@ -19,7 +19,6 @@ class Check_Email_Status_Page extends Check_Email_BasePage {
|
|
19 |
*/
|
20 |
public function load() {
|
21 |
parent::load();
|
22 |
-
|
23 |
add_action( 'admin_enqueue_scripts', array( $this, 'checkemail_assets' ) );;
|
24 |
}
|
25 |
|
@@ -27,195 +26,127 @@ class Check_Email_Status_Page extends Check_Email_BasePage {
|
|
27 |
* Register page.
|
28 |
*/
|
29 |
public function register_page() {
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
$this->page = add_submenu_page(
|
42 |
Check_Email_Status_Page::PAGE_SLUG,
|
43 |
-
|
44 |
-
|
45 |
'manage_check_email',
|
46 |
self::PAGE_SLUG,
|
47 |
array( $this, 'render_page' ),
|
48 |
-
|
49 |
);
|
50 |
}
|
51 |
|
52 |
public function render_page() {
|
53 |
?>
|
54 |
<div class="wrap">
|
55 |
-
<h1><?php
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
}
|
83 |
-
|
84 |
-
echo '
|
85 |
-
<h2>' . __( "Check & Log Email" ) . '</h2>
|
86 |
-
<hr />
|
87 |
-
|
88 |
-
<h3>' . __( "Current mail settings:", "check-email" ) . '</h3>
|
89 |
-
<ul>
|
90 |
-
<li>' . __( "SendMail path (UNIX):", "check-email" ) . '<strong> ' . ini_get("sendmail_path") . '</strong></li>
|
91 |
-
<li>' . __( "SMTP server (Windows):", "check-email" ) . '<strong> ' . ini_get("SMTP") . '</strong></li>
|
92 |
-
<li>' . __( "SMTP port (Windows):", "check-email" ) . '<strong> ' . ini_get("smtp_port") . '</strong></li>
|
93 |
-
<li>' . __( "Add X header:", "check-email" ) . '<strong> ' . ini_get("mail.add_x_header") . '</strong></li>
|
94 |
-
</ul>
|
95 |
-
<br />
|
96 |
-
<h3>' . __( "Send a test email", "check-email" ) . '</h3>
|
97 |
-
<hr />
|
98 |
-
<form action="' . get_admin_url() . 'admin.php?page=check-email-status" method="post">
|
99 |
-
<p><label for="checkemail_to">' . __( "Send test email to:", "check-email" ) . '</label>
|
100 |
-
<input type="text" name="checkemail_to" id="checkemail_to" class="text"';
|
101 |
-
if ( isset( $_POST["checkemail_to"] ) ) {
|
102 |
-
echo ' value="' . esc_attr( $_POST["checkemail_to"] ) . '"';
|
103 |
-
}
|
104 |
-
echo ' /></p>
|
105 |
-
<br />
|
106 |
-
<p><label for="checkemail_autoheaders">' . __( "Use standard headers", "check-email" ) . '</label>
|
107 |
-
<input type="radio" id="checkemail_autoheaders" name="checkemail_headers" value="auto"';
|
108 |
-
if ( !isset($_POST["checkemail_headers"]) || $_POST["checkemail_headers"] == "auto" ){
|
109 |
-
echo ' checked="checked"';
|
110 |
-
}
|
111 |
-
echo ' /></p>
|
112 |
-
<pre id="autoheaders"';
|
113 |
-
if ( isset($_POST["checkemail_headers"]) && $_POST["checkemail_headers"] == "custom" ){
|
114 |
-
echo ' class="checkemail-hide"';
|
115 |
-
}
|
116 |
-
echo '>MIME-Version: 1.0
|
117 |
-
From: ' . $from_email . '
|
118 |
-
Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . '"</pre>
|
119 |
-
<p><label for="checkemail_customheaders">' . __( "Use custom headers", "check-email" ) . '</label>
|
120 |
-
<input type="radio" id="checkemail_customheaders" name="checkemail_headers" value="custom"';
|
121 |
-
if ( isset($_POST["checkemail_headers"]) && $_POST["checkemail_headers"] == "custom" ){
|
122 |
-
echo ' checked="checked"';
|
123 |
-
}
|
124 |
-
echo ' /></p>
|
125 |
-
<div id="customheaders"';
|
126 |
-
if ( !isset($_POST["checkemail_headers"]) || $_POST["checkemail_headers"] == "auto" ){
|
127 |
-
echo ' class="checkemail-hide"';
|
128 |
-
}
|
129 |
-
echo '>
|
130 |
-
<br />
|
131 |
-
<h3>' . __( "Set your custom headers below: ", "check-email" ) . '</h3>
|
132 |
-
<hr />
|
133 |
-
<p><label for="checkemail_mime">' . __( "MIME Version", "check-email" ) . '</label>
|
134 |
-
<input type="text" name="checkemail_mime" id="checkemail_mime" value="';
|
135 |
-
if ( isset( $_POST["checkemail_mime"] ) ) {
|
136 |
-
echo esc_attr( $_POST["checkemail_mime"] );
|
137 |
-
} else {
|
138 |
-
echo '1.0';
|
139 |
-
}
|
140 |
-
echo '" /></p>
|
141 |
-
<p><label for="checkemail_type">' . __( "Content type", "check-email" ) . '</label>
|
142 |
-
<input type="text" name="checkemail_type" id="checkemail_type" value="';
|
143 |
-
if ( isset( $_POST["checkemail_type"] ) ) {
|
144 |
-
echo esc_attr( $_POST["checkemail_type"] );
|
145 |
-
} else {
|
146 |
-
echo 'text/html; charset=iso-8859-1';
|
147 |
-
}
|
148 |
-
echo '" class="text" /></p>
|
149 |
-
<p><label for="checkemail_from">' . __( "From", "check-email" ) . '</label>
|
150 |
-
<input type="text" name="checkemail_from" id="checkemail_from" value="';
|
151 |
-
if ( isset( $_POST["checkemail_from"] ) ) {
|
152 |
-
echo esc_attr( $_POST["checkemail_from"] );
|
153 |
-
} else {
|
154 |
-
echo $from_email;
|
155 |
-
}
|
156 |
-
echo '" class="text" /></p>
|
157 |
-
<p><label for="checkemail_cc">' . __( "CC", "check-email" ) . '</label>
|
158 |
-
<textarea name="checkemail_cc" id="checkemail_cc" cols="30" rows="4" class="text">';
|
159 |
-
if ( isset( $_POST["checkemail_cc"] ) ) {
|
160 |
-
echo esc_textarea( $_POST["checkemail_cc"] );
|
161 |
-
}
|
162 |
-
echo '</textarea></p>
|
163 |
-
<p><label for="checkemail_break_n">' . __( "Header line break type", "check-email" ) . '</label>
|
164 |
-
<input type="radio" name="checkemail_break" id="checkemail_break_n" value="\n"';
|
165 |
-
if ( !isset( $_POST["checkemail_break"] ) || $_POST["checkemail_break"] == '\n' ) {
|
166 |
-
echo ' checked="checked"';
|
167 |
-
}
|
168 |
-
echo ' /> \n
|
169 |
-
<input type="radio" name="checkemail_break" id="checkemail_break_rn" value="\r\n"';
|
170 |
-
if ( isset( $_POST["checkemail_break"] ) && $_POST["checkemail_break"] == '\r\n' ) {
|
171 |
-
echo ' checked="checked"';
|
172 |
-
}
|
173 |
-
echo ' /> \r\n</p>
|
174 |
-
</div>
|
175 |
-
<p>
|
176 |
-
<label for="checkemail_go" class="checkemail-hide">' . __( "Send", "check-email" ) . '</label>
|
177 |
-
<input type="submit" name="checkemail_go" id="checkemail_go" class="button-primary" value="' . __( "Send test email", "check-email" ) . '" /></p>
|
178 |
-
';
|
179 |
-
wp_nonce_field( 'checkemail' );
|
180 |
-
echo '</form>
|
181 |
-
|
182 |
-
</div>
|
183 |
-
';
|
184 |
-
?>
|
185 |
</div>
|
186 |
<?php
|
187 |
}
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
$
|
207 |
-
|
208 |
-
|
209 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
}
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
$plugin_dir_url = plugin_dir_url( $check_email->get_plugin_file() );
|
220 |
wp_enqueue_style( 'checkemail-css', $plugin_dir_url . 'assets/css/admin/checkemail.css', array(), $check_email->get_version() );
|
221 |
wp_enqueue_script( 'checkemail', $plugin_dir_url . 'assets/js/admin/checkemail.js', array(), $check_email->get_version(), true );
|
19 |
*/
|
20 |
public function load() {
|
21 |
parent::load();
|
|
|
22 |
add_action( 'admin_enqueue_scripts', array( $this, 'checkemail_assets' ) );;
|
23 |
}
|
24 |
|
26 |
* Register page.
|
27 |
*/
|
28 |
public function register_page() {
|
29 |
+
|
30 |
+
add_menu_page(
|
31 |
+
esc_html__( 'Check & Log Email', 'check-email' ),
|
32 |
+
esc_html__( 'Check & Log Email', 'check-email' ),
|
33 |
+
'manage_check_email',
|
34 |
+
self::PAGE_SLUG,
|
35 |
+
array( $this, 'render_page' ),
|
36 |
+
'dashicons-email-alt',
|
37 |
+
26
|
38 |
+
);
|
39 |
+
|
40 |
$this->page = add_submenu_page(
|
41 |
Check_Email_Status_Page::PAGE_SLUG,
|
42 |
+
esc_html__( 'Status', 'check-email' ),
|
43 |
+
esc_html__( 'Status', 'check-email' ),
|
44 |
'manage_check_email',
|
45 |
self::PAGE_SLUG,
|
46 |
array( $this, 'render_page' ),
|
47 |
+
-10
|
48 |
);
|
49 |
}
|
50 |
|
51 |
public function render_page() {
|
52 |
?>
|
53 |
<div class="wrap">
|
54 |
+
<h1><?php esc_html_e( 'Status', 'check-email' ); ?></h1>
|
55 |
+
<?php
|
56 |
+
global $current_user;
|
57 |
+
global $phpmailer;
|
58 |
+
|
59 |
+
$from_name = '';
|
60 |
+
$from_email = apply_filters( 'wp_mail_from', $current_user->user_email );
|
61 |
+
$from_name = apply_filters( 'wp_mail_from_name', $from_name );
|
62 |
+
|
63 |
+
$headers = '';
|
64 |
+
// phpcs:ignore
|
65 |
+
if ( isset($_REQUEST['_wpnonce']) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'checkemail' ) && isset( $_POST['checkemail_to'] ) && isset( $_POST['checkemail_headers'] ) ) {
|
66 |
+
$headers = $this->checkemail_send( sanitize_email( wp_unslash($_POST['checkemail_to']) ), sanitize_textarea_field(wp_unslash($_POST['checkemail_headers'])) );
|
67 |
+
}
|
68 |
+
?>
|
69 |
+
|
70 |
+
<div id="CKE_banner">
|
71 |
+
<h2>
|
72 |
+
<img draggable="false" role="img" class="emoji" alt="👉" src="https://s.w.org/images/core/emoji/13.0.1/svg/1f449.svg">
|
73 |
+
<?php esc_html_e('Suggest a new feature!', 'check-email') ?>
|
74 |
+
<img draggable="false" role="img" class="emoji" alt="👈" src="https://s.w.org/images/core/emoji/13.0.1/svg/1f448.svg">
|
75 |
+
</h2>
|
76 |
+
<p><?php esc_html_e('Help us build the next set of features for Check & Log Email. Tell us what you think and we will make it happen!', 'check-email') ?></p>
|
77 |
+
<a target="_blank" rel="noreferrer noopener" href="https://bit.ly/33QzqBU" class="button button-primary button-hero"><?php esc_html_e('Click here', 'check-email') ?></a>
|
78 |
+
</div>
|
79 |
+
|
80 |
+
<?php require_once 'partials/check-email-admin-status-display.php'; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
</div>
|
82 |
<?php
|
83 |
}
|
84 |
+
|
85 |
+
// send a test email
|
86 |
+
private function checkemail_send( $to, $headers = "auto" ) {
|
87 |
+
global $current_user;
|
88 |
+
|
89 |
+
$from_name = '';
|
90 |
+
$from_email = apply_filters( 'wp_mail_from', $current_user->user_email );
|
91 |
+
$from_name = apply_filters( 'wp_mail_from_name', $from_name );
|
92 |
+
|
93 |
+
if ( $headers == "auto" ) {
|
94 |
+
$headers = "MIME-Version: 1.0\r\n" .
|
95 |
+
"From: " . esc_html( $from_email ). "\r\n" .
|
96 |
+
"Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\r\n";
|
97 |
+
} else {
|
98 |
+
$break = chr( 10 );
|
99 |
+
// nonce is validated in line 65.
|
100 |
+
// phpcs:ignore
|
101 |
+
if ( isset( $_POST['checkemail_break'] ) && '\r\n' == stripslashes( $_POST["checkemail_break"] ) ) {
|
102 |
+
$break = chr( 13 ) . chr( 10 );
|
103 |
+
}
|
104 |
+
|
105 |
+
$defaults = array(
|
106 |
+
'MIME-Version' => '1.0',
|
107 |
+
'From' => esc_html( $from_email ),
|
108 |
+
'Cc' => '',
|
109 |
+
'Content-Type' => 'text/html; charset='.get_option('blog_charset')
|
110 |
+
);
|
111 |
+
|
112 |
+
$args = array();
|
113 |
+
|
114 |
+
// nonce is validated in line 65.
|
115 |
+
// phpcs:disable
|
116 |
+
if ( isset( $_POST['checkemail_mime'] ) ) {
|
117 |
+
$args['MIME-Version'] = sanitize_text_field( wp_unslash($_POST['checkemail_mime']) );
|
118 |
+
}
|
119 |
+
|
120 |
+
if ( isset( $_POST['checkemail_from'] ) ) {
|
121 |
+
$args['From'] = sanitize_email( wp_unslash($_POST['checkemail_from']) );
|
122 |
}
|
123 |
+
|
124 |
+
if ( isset( $_POST['checkemail_cc'] ) ) {
|
125 |
+
$args['Cc'] = sanitize_email( wp_unslash($_POST['checkemail_cc']) );
|
126 |
+
}
|
127 |
+
|
128 |
+
if ( isset( $_POST['checkemail_type'] ) ) {
|
129 |
+
$args['Content-Type'] = sanitize_text_field( wp_unslash($_POST['checkemail_type']) );
|
130 |
+
}
|
131 |
+
// phpcs:enable
|
132 |
+
|
133 |
+
$args = wp_parse_args( $args, $defaults );
|
134 |
+
$headers = '';
|
135 |
+
foreach ( $args as $key => $value ) {
|
136 |
+
$headers .= $key . ': ' . $value . $break;
|
137 |
+
}
|
138 |
+
|
139 |
+
}
|
140 |
+
|
141 |
+
$title = sprintf( esc_html__( "Test email from %s ", "check-email"), esc_url( get_bloginfo( "url" ) ) );
|
142 |
+
$body = sprintf( esc_html__( 'This test email proves that your WordPress installation at %1$s can send emails.\n\nSent: %2$s', "check-email" ), esc_url( get_bloginfo( "url" ) ), date( "r" ) );
|
143 |
+
wp_mail( $to, $title, $body, $headers );
|
144 |
+
|
145 |
+
return $headers;
|
146 |
+
}
|
147 |
+
|
148 |
+
public function checkemail_assets() {
|
149 |
+
$check_email = wpchill_check_email();
|
150 |
$plugin_dir_url = plugin_dir_url( $check_email->get_plugin_file() );
|
151 |
wp_enqueue_style( 'checkemail-css', $plugin_dir_url . 'assets/css/admin/checkemail.css', array(), $check_email->get_version() );
|
152 |
wp_enqueue_script( 'checkemail', $plugin_dir_url . 'assets/js/admin/checkemail.js', array(), $check_email->get_version(), true );
|
include/Core/UI/Page/partials/check-email-admin-status-display.php
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// we have a nonce but we don't process the form here
|
3 |
+
// phpcs:ignoreFile
|
4 |
+
|
5 |
+
$email_headers = isset( $_POST["checkemail_headers"] ) ? sanitize_text_field( wp_unslash($_POST["checkemail_headers"]) ) : 'auto';
|
6 |
+
$checkemail_to = isset( $_POST["checkemail_to"] ) ? sanitize_email( wp_unslash( $_POST["checkemail_to"] ) ) : '';
|
7 |
+
$checkemail_mime = isset( $_POST['checkemail_mime'] ) ? sanitize_text_field( wp_unslash($_POST['checkemail_mime']) ) : '1.0';
|
8 |
+
$checkemail_type = isset( $_POST['checkemail_type'] ) ? sanitize_text_field( wp_unslash($_POST['checkemail_type']) ) : 'text/html; charset=iso-8859-1';
|
9 |
+
$checkemail_from = isset( $_POST['checkemail_from'] ) ? sanitize_email( wp_unslash( $_POST['checkemail_from'] ) ) : $from_email;
|
10 |
+
$checkemail_cc = isset( $_POST['checkemail_cc'] ) ? sanitize_textarea_field( wp_unslash( $_POST['checkemail_cc'] ) ) : '';
|
11 |
+
$checkemail_break = isset( $_POST['checkemail_break'] ) ? sanitize_text_field( wp_unslash( $_POST['checkemail_break'] ) ) : '';
|
12 |
+
|
13 |
+
?>
|
14 |
+
|
15 |
+
<div id="checkemail" class="wrap">
|
16 |
+
<?php if ( isset( $_POST["checkemail_to"]) && ! empty( $_POST["checkemail_to"] ) ): ?>
|
17 |
+
<div class="updated">
|
18 |
+
<?php if ( ! empty( $headers ) ): ?>
|
19 |
+
<p><?php esc_html_e( 'The test email has been sent by WordPress. Please note this does NOT mean it has been delivered. See', 'check_email' );?>
|
20 |
+
<a href=<? echo esc_url( "http://codex.wordpress.org/Function_Reference/wp_mail")?>> <?php esc_html_e( "wp_mail in the Codex", "check-email") ?></a> <?php esc_html_e( "for more information. The headers sent were :", 'check-email' ) ?>
|
21 |
+
</p>
|
22 |
+
|
23 |
+
<pre><?php echo esc_textarea( str_replace( chr( 10 ), '\n' . "\n", str_replace( chr( 13 ), '\r', $headers ) ) ); ?></pre>
|
24 |
+
<?php else: ?>
|
25 |
+
<p><?php esc_html_e( 'Security check failed', 'check-email' ) ?></p>
|
26 |
+
<?php endif; ?>
|
27 |
+
</div>
|
28 |
+
<?php endif; ?>
|
29 |
+
<h2><?php esc_html_e( 'Check & Log Email', 'check-email' ) ?></h2><hr />
|
30 |
+
|
31 |
+
<?php if ( $phpmailer ) { ?>
|
32 |
+
|
33 |
+
<h3><?php esc_html_e( 'Current mail settings', 'check-email' ) ?></h3>
|
34 |
+
<ul>
|
35 |
+
<?php if (isset($phpmailer->Mailer) && !empty($phpmailer->Mailer)): ?>
|
36 |
+
<li><?php esc_html_e( 'Mailer:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->Mailer ) ?></strong></li>
|
37 |
+
<?php endif; ?>
|
38 |
+
<?php if (isset($phpmailer->Sendmail) && !empty($phpmailer->Sendmail)): ?>
|
39 |
+
<li><?php esc_html_e( 'SendMail path:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->Sendmail ) ?></strong></li>
|
40 |
+
<?php endif; ?>
|
41 |
+
<?php if (isset($phpmailer->Host) && !empty($phpmailer->Host)): ?>
|
42 |
+
<li><?php esc_html_e( 'Host:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->Host ) ?></strong></li>
|
43 |
+
<?php endif; ?>
|
44 |
+
<?php if (isset($phpmailer->Port) && !empty($phpmailer->Port)): ?>
|
45 |
+
<li><?php esc_html_e( 'Port:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->Port ) ?></strong></li>
|
46 |
+
<?php endif; ?>
|
47 |
+
<?php if (isset($phpmailer->CharSet) && !empty($phpmailer->CharSet)): ?>
|
48 |
+
<li><?php esc_html_e( 'CharSet:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->CharSet ) ?></strong></li>
|
49 |
+
<?php endif; ?>
|
50 |
+
<?php if (isset($phpmailer->ContentType) && !empty($phpmailer->ContentType)): ?>
|
51 |
+
<li><?php esc_html_e( 'Content-Type:', 'check-email' ) ?> <strong><?php echo esc_html( $phpmailer->ContentType ) ?></strong></li>
|
52 |
+
<?php endif; ?>
|
53 |
+
</ul>
|
54 |
+
|
55 |
+
<?php } ?>
|
56 |
+
|
57 |
+
<h3><?php esc_html_e( 'Send a test email', 'check-email' ) ?></h3><hr />
|
58 |
+
<form action="<?php echo esc_url( get_admin_url() ) . 'admin.php?page=check-email-status' ?>" method="post">
|
59 |
+
<p>
|
60 |
+
<label for="checkemail_to"><?php esc_html_e( 'Send test email to', 'check-email' ); ?></label>
|
61 |
+
<input type="text" name="checkemail_to" id="checkemail_to" class="text" value="<?php echo esc_attr( $checkemail_to ) ?>"/>
|
62 |
+
</p>
|
63 |
+
<p>
|
64 |
+
<label for="checkemail_autoheaders"><?php esc_html_e( 'Use standard headers', 'check-email' ) ?></label>
|
65 |
+
<?php ?>
|
66 |
+
<input type="radio" id="checkemail_autoheaders" name="checkemail_headers" value="auto" <?php checked( $email_headers, 'auto' ) ?>/>
|
67 |
+
</p>
|
68 |
+
<div id="autoheaders" class="<?php echo ( $email_headers == 'custom' ? 'checkemail-hide' : '' ) ?>">
|
69 |
+
<?php printf( esc_html__( 'MIME-Version: %s', 'check-email'), '1.0' ) ?><br />
|
70 |
+
<?php printf( esc_html__( 'From: %s', 'check-email'), esc_html( $from_email ) ) ?><br />
|
71 |
+
<?php printf( esc_html__( 'Content-Type: %s', 'check-email'), 'text/plain; charset="' . esc_html( get_option( 'blog_charset' ) ) . '"' ) ?>
|
72 |
+
</div>
|
73 |
+
<p>
|
74 |
+
<label for='checkemail_customheaders'><?php esc_html_e( 'Use custom headers', 'check-email' ) ?></label>
|
75 |
+
<input type="radio" id="checkemail_customheaders" name="checkemail_headers" value="custom" <?php echo (isset($_POST['checkemail_headers']) && $_POST['checkemail_headers'] == 'custom' ? 'checked="checked"' : '') ?>/>
|
76 |
+
</p>
|
77 |
+
<div id="customheaders" class="<?php echo ( !isset($_POST['checkemail_headers']) || $_POST['checkemail_headers'] == 'auto' ? 'checkemail-hide' : '' ) ?>"><br />
|
78 |
+
<h3><?php esc_html_e( 'Set your custom headers below', 'check-email' ) ?></h3><hr />
|
79 |
+
<p>
|
80 |
+
<label for="checkemail_mime"><?php esc_html_e( 'MIME Version', 'check-email' ) ?></label>
|
81 |
+
<input type="text" name="checkemail_mime" id="checkemail_mime" value="<?php echo esc_attr( $checkemail_mime ) ?>"/>
|
82 |
+
</p>
|
83 |
+
<p>
|
84 |
+
<label for="checkemail_type"><?php esc_html_e( 'Content type', 'check-email' ) ?></label>
|
85 |
+
<input type="text" name="checkemail_type" id="checkemail_type" value="<?php echo esc_attr( $checkemail_type ) ?>"/>
|
86 |
+
</p>
|
87 |
+
<p>
|
88 |
+
<label for="checkemail_from"><?php esc_html_e( 'From', 'check-email' ) ?></label>
|
89 |
+
<input type="text" name="checkemail_from" id="checkemail_from" value="<?php echo esc_attr( $checkemail_from ) ?>" class="text" />
|
90 |
+
</p>
|
91 |
+
<p>
|
92 |
+
<label for="checkemail_cc"><?php esc_html_e( 'CC', 'check-email' ) ?></label>
|
93 |
+
<textarea name="checkemail_cc" id="checkemail_cc" cols="30" rows="4" class="text"><?php echo esc_textarea( $checkemail_cc ) ?></textarea>
|
94 |
+
</p>
|
95 |
+
<p>
|
96 |
+
<label for="checkemail_break_n"><?php esc_html_e( 'Header line break type', 'check-email' ) ?></label>
|
97 |
+
<input type="radio" name="checkemail_break" id="checkemail_break_n" value="\n" <?php checked( $checkemail_break, '\n' ) ?>/><?php esc_html_e('\n', 'check-email') ?>
|
98 |
+
<input type="radio" name="checkemail_break" id="checkemail_break_rn" value="\r\n" <?php checked( $checkemail_break, '\r\n' ) ?>/><?php esc_html_e('\r\n', 'check-email') ?>
|
99 |
+
</p>
|
100 |
+
</div>
|
101 |
+
|
102 |
+
<?php wp_nonce_field( 'checkemail' ); ?>
|
103 |
+
|
104 |
+
<p>
|
105 |
+
<label for="checkemail_go" class="checkemail-hide"><?php esc_html_e( 'Send', 'check-email' ) ?></label>
|
106 |
+
<input type="submit" name="checkemail_go" id="checkemail_go" class="button-primary" value="<?php esc_attr_e( 'Send test email', 'check-email' ) ?>" />
|
107 |
+
</p>
|
108 |
+
</form>
|
109 |
+
</div>
|
include/Core/UI/Setting/Check_Email_Core_Setting.php
CHANGED
@@ -9,29 +9,29 @@ class Check_Email_Core_Setting extends Check_Email_Setting {
|
|
9 |
|
10 |
protected function initialize() {
|
11 |
$this->section->id = 'check-email-log-core';
|
12 |
-
$this->section->title =
|
13 |
$this->section->option_name = 'check-email-log-core';
|
14 |
|
15 |
$this->section->field_labels = array(
|
16 |
-
'allowed_user_roles'
|
17 |
-
|
18 |
-
'enable_dashboard_widget' =>
|
19 |
-
'db_size_notification'
|
20 |
-
'remove_on_uninstall'
|
21 |
);
|
22 |
|
23 |
$this->section->default_value = array(
|
24 |
-
'allowed_user_roles'
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
),
|
34 |
-
'remove_on_uninstall'
|
35 |
);
|
36 |
|
37 |
$this->load();
|
@@ -48,7 +48,7 @@ class Check_Email_Core_Setting extends Check_Email_Setting {
|
|
48 |
}
|
49 |
|
50 |
public function render_allowed_user_roles_settings( $args ) {
|
51 |
-
|
52 |
$option = $this->get_value();
|
53 |
$selected_roles = $option[ $args['id'] ];
|
54 |
|
@@ -59,7 +59,7 @@ class Check_Email_Core_Setting extends Check_Email_Setting {
|
|
59 |
?>
|
60 |
|
61 |
<p>
|
62 |
-
<input type="checkbox" checked disabled><?php
|
63 |
</p>
|
64 |
|
65 |
<?php foreach ( $available_roles as $role_id => $role ) : ?>
|
@@ -67,14 +67,14 @@ class Check_Email_Core_Setting extends Check_Email_Setting {
|
|
67 |
<input type="checkbox" name="<?php echo esc_attr( $field_name ); ?>" value="<?php echo esc_attr( $role_id ); ?>"
|
68 |
<?php \CheckEmail\Util\wp_chill_check_email_array_checked( $selected_roles, $role_id ); ?>>
|
69 |
|
70 |
-
<?php echo translate_user_role($role['name']); ?>
|
71 |
</p>
|
72 |
<?php endforeach; ?>
|
73 |
|
74 |
<p>
|
75 |
<em>
|
76 |
-
<?php
|
77 |
-
<?php
|
78 |
</em>
|
79 |
</p>
|
80 |
|
@@ -89,22 +89,21 @@ class Check_Email_Core_Setting extends Check_Email_Setting {
|
|
89 |
return array_map( 'sanitize_text_field', $roles );
|
90 |
}
|
91 |
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
<input id="check-email-enable-logs" type="checkbox" name="<?php echo esc_attr( $field_name ); ?>" value="true" <?php checked( 'true', $enable_logs ); ?>>
|
100 |
-
<?php
|
101 |
<?php
|
102 |
}
|
103 |
-
|
104 |
public function sanitize_enable_logs( $value ) {
|
105 |
return sanitize_text_field( $value );
|
106 |
}
|
107 |
-
|
108 |
public function render_remove_on_uninstall_settings( $args ) {
|
109 |
$option = $this->get_value();
|
110 |
$remove_data = $option[ $args['id'] ];
|
@@ -113,7 +112,7 @@ class Check_Email_Core_Setting extends Check_Email_Setting {
|
|
113 |
?>
|
114 |
|
115 |
<input type="checkbox" name="<?php echo esc_attr( $field_name ); ?>" value="true" <?php checked( 'true', $remove_data ); ?>>
|
116 |
-
<?php
|
117 |
|
118 |
<?php
|
119 |
}
|
@@ -147,67 +146,85 @@ class Check_Email_Core_Setting extends Check_Email_Setting {
|
|
147 |
}
|
148 |
|
149 |
public function render_enable_dashboard_widget_settings( $args ) {
|
150 |
-
$option
|
151 |
$enable_dashboard_widget = $option[ $args['id'] ];
|
152 |
|
153 |
$field_name = $this->section->option_name . '[' . $args['id'] . ']';
|
154 |
?>
|
155 |
|
156 |
<input id="check-email-enable-widget" type="checkbox" name="<?php echo esc_attr( $field_name ); ?>" value="true" <?php checked( 'true', $enable_dashboard_widget ); ?>>
|
157 |
-
<?php
|
158 |
|
159 |
<?php
|
160 |
}
|
161 |
|
162 |
public function render_db_size_notification_settings( $args ) {
|
163 |
$option = $this->get_value();
|
164 |
-
$db_size_notification_data = $option[ $args['id'] ];
|
165 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
$field_name = $this->section->option_name . '[' . $args['id'] . ']';
|
167 |
// Since we store three different fields, give each field a unique name.
|
168 |
$db_size_notification_field_name = $field_name . '[notify]';
|
169 |
$admin_email_field_name = $field_name . '[admin_email]';
|
170 |
$logs_threshold_field_name = $field_name . '[logs_threshold]';
|
171 |
|
|
|
172 |
$check_email = wpchill_check_email();
|
173 |
$logs_count = $check_email->table_manager->get_logs_count();
|
174 |
|
175 |
$admin_email_input_field = sprintf(
|
176 |
-
'<input type="email" name="%1$s" value="%2$s" size="35" />',
|
|
|
|
|
|
|
177 |
|
178 |
-
$logs_threshold_input_field = sprintf(
|
|
|
179 |
esc_attr( $logs_threshold_field_name ),
|
180 |
empty( $db_size_notification_data['logs_threshold'] ) ? '' : esc_attr( $db_size_notification_data['logs_threshold'] )
|
181 |
);
|
182 |
?>
|
183 |
|
184 |
-
<input id="check-email-enable-db-notifications" type="checkbox" name="<?php echo esc_attr( $db_size_notification_field_name ); ?>" value="true" <?php
|
185 |
-
checked( true, $db_size_notification_data['notify'] ); ?> />
|
186 |
<?php
|
187 |
// The values within each field are already escaped.
|
188 |
-
|
|
|
|
|
189 |
$admin_email_input_field,
|
190 |
$logs_threshold_input_field
|
191 |
);
|
|
|
192 |
?>
|
193 |
-
|
194 |
-
|
195 |
-
<?php
|
196 |
-
|
197 |
-
'
|
198 |
-
'<strong>' .
|
199 |
-
|
200 |
-
|
201 |
-
|
|
|
|
|
202 |
<?php if ( ! empty( $db_size_notification_data['threshold_email_last_sent'] ) ) : ?>
|
203 |
-
|
204 |
-
<?php
|
205 |
-
|
206 |
-
'
|
|
|
207 |
'<b>Save</b>'
|
208 |
-
);
|
209 |
-
|
210 |
-
|
|
|
211 |
endif;
|
212 |
}
|
213 |
|
@@ -256,7 +273,7 @@ class Check_Email_Core_Setting extends Check_Email_Setting {
|
|
256 |
|
257 |
return $db_size_notification_data;
|
258 |
}
|
259 |
-
|
260 |
public function verify_email_log_threshold() {
|
261 |
$cron_hook = 'check_email_trigger_notify_email_when_log_threshold_met';
|
262 |
if ( ! wp_next_scheduled( $cron_hook ) ) {
|
@@ -279,8 +296,8 @@ class Check_Email_Core_Setting extends Check_Email_Setting {
|
|
279 |
}
|
280 |
|
281 |
public function trigger_threshold_met_notification_email() {
|
282 |
-
$check_email
|
283 |
-
$logs_count
|
284 |
|
285 |
$setting_data = $this->get_value();
|
286 |
|
@@ -315,7 +332,7 @@ class Check_Email_Core_Setting extends Check_Email_Setting {
|
|
315 |
$this->register_threshold_met_admin_notice();
|
316 |
|
317 |
if ( $is_notification_enabled && is_email( $admin_email ) ) {
|
318 |
-
$subject = sprintf(
|
319 |
$message = <<<EOT
|
320 |
<p>This email is generated by the Check & Log Email plugin.</p>
|
321 |
<p>Your log threshold of $logs_threshold has been met. You may manually delete the logs to keep your database table in size.</p>
|
@@ -337,17 +354,18 @@ EOT;
|
|
337 |
public function register_threshold_met_admin_notice() {
|
338 |
add_action( 'admin_notices', array( $this, 'render_log_threshold_met_notice' ) );
|
339 |
}
|
340 |
-
|
341 |
public function render_log_threshold_met_notice() {
|
342 |
-
$check_email
|
343 |
$logs_count = absint( $check_email->table_manager->get_logs_count() );
|
344 |
-
$notice_message = sprintf(
|
345 |
-
$
|
346 |
-
|
|
|
347 |
?>
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
<?php
|
352 |
}
|
353 |
|
9 |
|
10 |
protected function initialize() {
|
11 |
$this->section->id = 'check-email-log-core';
|
12 |
+
$this->section->title = esc_html__( 'Core Check Email Log Settings', 'check-email' );
|
13 |
$this->section->option_name = 'check-email-log-core';
|
14 |
|
15 |
$this->section->field_labels = array(
|
16 |
+
'allowed_user_roles' => esc_html__( 'Allowed User Roles', 'check-email' ),
|
17 |
+
'enable_logs' => esc_html__( 'Enable Logs', 'check-email' ),
|
18 |
+
'enable_dashboard_widget' => esc_html__( 'Enable Dashboard Widget', 'check-email' ),
|
19 |
+
'db_size_notification' => esc_html__( 'Database Size Notification', 'check-email' ),
|
20 |
+
'remove_on_uninstall' => esc_html__( 'Remove Data on Uninstall?', 'check-email' ),
|
21 |
);
|
22 |
|
23 |
$this->section->default_value = array(
|
24 |
+
'allowed_user_roles' => array(),
|
25 |
+
'enable_logs' => false,
|
26 |
+
'enable_dashboard_widget' => false,
|
27 |
+
'db_size_notification' => array(
|
28 |
+
'notify' => false,
|
29 |
+
'admin_email' => '',
|
30 |
+
'logs_threshold' => '',
|
31 |
+
'log_threshold_met' => false,
|
32 |
+
'threshold_email_last_sent' => false,
|
33 |
),
|
34 |
+
'remove_on_uninstall' => '',
|
35 |
);
|
36 |
|
37 |
$this->load();
|
48 |
}
|
49 |
|
50 |
public function render_allowed_user_roles_settings( $args ) {
|
51 |
+
|
52 |
$option = $this->get_value();
|
53 |
$selected_roles = $option[ $args['id'] ];
|
54 |
|
59 |
?>
|
60 |
|
61 |
<p>
|
62 |
+
<input type="checkbox" checked disabled><?php esc_html_e( 'Administrator', 'check-email' ); ?>
|
63 |
</p>
|
64 |
|
65 |
<?php foreach ( $available_roles as $role_id => $role ) : ?>
|
67 |
<input type="checkbox" name="<?php echo esc_attr( $field_name ); ?>" value="<?php echo esc_attr( $role_id ); ?>"
|
68 |
<?php \CheckEmail\Util\wp_chill_check_email_array_checked( $selected_roles, $role_id ); ?>>
|
69 |
|
70 |
+
<?php echo esc_html( translate_user_role( $role['name'] ) ); ?>
|
71 |
</p>
|
72 |
<?php endforeach; ?>
|
73 |
|
74 |
<p>
|
75 |
<em>
|
76 |
+
<?php echo wp_kses_post( __( '<strong>Note:</strong> Users with the above User Roles can view Status and Logs Page.', 'check-email' ) ); ?>
|
77 |
+
<?php esc_html_e( 'Administrator always has access and cannot be disabled.', 'check-email' ); ?>
|
78 |
</em>
|
79 |
</p>
|
80 |
|
89 |
return array_map( 'sanitize_text_field', $roles );
|
90 |
}
|
91 |
|
92 |
+
public function render_enable_logs_settings( $args ) {
|
93 |
+
$option = $this->get_value();
|
94 |
+
$enable_logs = $option[ $args['id'] ];
|
95 |
|
96 |
+
$field_name = $this->section->option_name . '[' . $args['id'] . ']';
|
97 |
+
?>
|
|
|
98 |
<input id="check-email-enable-logs" type="checkbox" name="<?php echo esc_attr( $field_name ); ?>" value="true" <?php checked( 'true', $enable_logs ); ?>>
|
99 |
+
<?php esc_html_e( 'Check this box if you would like to log your emails.', 'check-email' ) ?>
|
100 |
<?php
|
101 |
}
|
102 |
+
|
103 |
public function sanitize_enable_logs( $value ) {
|
104 |
return sanitize_text_field( $value );
|
105 |
}
|
106 |
+
|
107 |
public function render_remove_on_uninstall_settings( $args ) {
|
108 |
$option = $this->get_value();
|
109 |
$remove_data = $option[ $args['id'] ];
|
112 |
?>
|
113 |
|
114 |
<input type="checkbox" name="<?php echo esc_attr( $field_name ); ?>" value="true" <?php checked( 'true', $remove_data ); ?>>
|
115 |
+
<?php esc_html_e( 'Check this box if you would like to completely remove all of its data when the plugin is deleted.', 'check-email' ); ?>
|
116 |
|
117 |
<?php
|
118 |
}
|
146 |
}
|
147 |
|
148 |
public function render_enable_dashboard_widget_settings( $args ) {
|
149 |
+
$option = $this->get_value();
|
150 |
$enable_dashboard_widget = $option[ $args['id'] ];
|
151 |
|
152 |
$field_name = $this->section->option_name . '[' . $args['id'] . ']';
|
153 |
?>
|
154 |
|
155 |
<input id="check-email-enable-widget" type="checkbox" name="<?php echo esc_attr( $field_name ); ?>" value="true" <?php checked( 'true', $enable_dashboard_widget ); ?>>
|
156 |
+
<?php esc_html_e( 'Check this box if you would like to enable dashboard widget.', 'check-email' ); ?>
|
157 |
|
158 |
<?php
|
159 |
}
|
160 |
|
161 |
public function render_db_size_notification_settings( $args ) {
|
162 |
$option = $this->get_value();
|
|
|
163 |
|
164 |
+
$db_size_notification_data = $option[ $args['id'] ];
|
165 |
+
$defaults = array(
|
166 |
+
'notify' => false,
|
167 |
+
'logs_threshold' => 5000,
|
168 |
+
'admin_email' => 'dev@email.com',
|
169 |
+
);
|
170 |
+
$db_size_notification_data = wp_parse_args( $db_size_notification_data, $defaults );
|
171 |
$field_name = $this->section->option_name . '[' . $args['id'] . ']';
|
172 |
// Since we store three different fields, give each field a unique name.
|
173 |
$db_size_notification_field_name = $field_name . '[notify]';
|
174 |
$admin_email_field_name = $field_name . '[admin_email]';
|
175 |
$logs_threshold_field_name = $field_name . '[logs_threshold]';
|
176 |
|
177 |
+
|
178 |
$check_email = wpchill_check_email();
|
179 |
$logs_count = $check_email->table_manager->get_logs_count();
|
180 |
|
181 |
$admin_email_input_field = sprintf(
|
182 |
+
'<input type="email" name="%1$s" value="%2$s" size="35" />',
|
183 |
+
esc_attr( $admin_email_field_name ),
|
184 |
+
empty( $db_size_notification_data['admin_email'] ) ? get_option( 'admin_email', '' ) : esc_attr( $db_size_notification_data['admin_email'] )
|
185 |
+
);
|
186 |
|
187 |
+
$logs_threshold_input_field = sprintf(
|
188 |
+
'<input type="number" name="%1$s" placeholder="5000" value="%2$s" min="0" max="99999999" />',
|
189 |
esc_attr( $logs_threshold_field_name ),
|
190 |
empty( $db_size_notification_data['logs_threshold'] ) ? '' : esc_attr( $db_size_notification_data['logs_threshold'] )
|
191 |
);
|
192 |
?>
|
193 |
|
194 |
+
<input id="check-email-enable-db-notifications" type="checkbox" name="<?php echo esc_attr( $db_size_notification_field_name ); ?>" value="true" <?php !isset( $db_size_notification_data['notify'] ) ? false :
|
195 |
+
checked( 'true', $db_size_notification_data['notify'] ); ?> />
|
196 |
<?php
|
197 |
// The values within each field are already escaped.
|
198 |
+
// phpcs:disable
|
199 |
+
printf(
|
200 |
+
esc_html__( 'Notify %1$s if there are more than %2$s logs.', 'check-email' ),
|
201 |
$admin_email_input_field,
|
202 |
$logs_threshold_input_field
|
203 |
);
|
204 |
+
// phpcs:enable
|
205 |
?>
|
206 |
+
<p>
|
207 |
+
<em>
|
208 |
+
<?php
|
209 |
+
printf(
|
210 |
+
esc_html__( '%1$s There are %2$s email logs currently logged in the database.', 'check-email' ),
|
211 |
+
'<strong>' . esc_html__( 'Note', 'check-email' ) . ':</strong>',
|
212 |
+
'<strong>' . esc_html( $logs_count ) . '</strong>'
|
213 |
+
);
|
214 |
+
?>
|
215 |
+
</em>
|
216 |
+
</p>
|
217 |
<?php if ( ! empty( $db_size_notification_data['threshold_email_last_sent'] ) ) : ?>
|
218 |
+
<p>
|
219 |
+
<?php
|
220 |
+
printf(
|
221 |
+
esc_html__( 'Last notification email was sent on %1$s. Click %2$s button to reset sending the notification.', 'check-email' ),
|
222 |
+
'<strong>' . esc_html( get_date_from_gmt( date( 'Y-m-d H:i:s', $db_size_notification_data['threshold_email_last_sent'] ), \CheckEmail\Util\wp_chill_check_email_get_user_defined_date_format() ) ) . '</strong>',
|
223 |
'<b>Save</b>'
|
224 |
+
);
|
225 |
+
?>
|
226 |
+
</p>
|
227 |
+
<?php
|
228 |
endif;
|
229 |
}
|
230 |
|
273 |
|
274 |
return $db_size_notification_data;
|
275 |
}
|
276 |
+
|
277 |
public function verify_email_log_threshold() {
|
278 |
$cron_hook = 'check_email_trigger_notify_email_when_log_threshold_met';
|
279 |
if ( ! wp_next_scheduled( $cron_hook ) ) {
|
296 |
}
|
297 |
|
298 |
public function trigger_threshold_met_notification_email() {
|
299 |
+
$check_email = wpchill_check_email();
|
300 |
+
$logs_count = absint( $check_email->table_manager->get_logs_count() );
|
301 |
|
302 |
$setting_data = $this->get_value();
|
303 |
|
332 |
$this->register_threshold_met_admin_notice();
|
333 |
|
334 |
if ( $is_notification_enabled && is_email( $admin_email ) ) {
|
335 |
+
$subject = sprintf( esc_html__( 'Check & Log Email: Your log threshold of %s has been met', 'check-email' ), $logs_threshold );
|
336 |
$message = <<<EOT
|
337 |
<p>This email is generated by the Check & Log Email plugin.</p>
|
338 |
<p>Your log threshold of $logs_threshold has been met. You may manually delete the logs to keep your database table in size.</p>
|
354 |
public function register_threshold_met_admin_notice() {
|
355 |
add_action( 'admin_notices', array( $this, 'render_log_threshold_met_notice' ) );
|
356 |
}
|
357 |
+
|
358 |
public function render_log_threshold_met_notice() {
|
359 |
+
$check_email = wpchill_check_email();
|
360 |
$logs_count = absint( $check_email->table_manager->get_logs_count() );
|
361 |
+
$notice_message = sprintf(
|
362 |
+
esc_html__( 'Currently there are %1$s logged, which is more than the threshold. You can delete some logs or increase the threshold.', 'check-email' ),
|
363 |
+
$logs_count . esc_html(_n( ' email log', ' email logs', $logs_count, 'check-email' ))
|
364 |
+
);
|
365 |
?>
|
366 |
+
<div class="notice notice-warning is-dismissible">
|
367 |
+
<p><?php echo wp_kses_post( $notice_message ); ?></p>
|
368 |
+
</div>
|
369 |
<?php
|
370 |
}
|
371 |
|
include/Core/UI/Setting/Check_Email_Log_Setting_Field.php
CHANGED
@@ -12,5 +12,5 @@ class Check_Email_Log_Setting_Field {
|
|
12 |
public $id;
|
13 |
public $title;
|
14 |
public $callback;
|
15 |
-
public $args = array();
|
16 |
}
|
12 |
public $id;
|
13 |
public $title;
|
14 |
public $callback;
|
15 |
+
public $args = array();
|
16 |
}
|
include/Core/UI/list_table/Check_Email_Log_List_Table.php
CHANGED
@@ -10,7 +10,7 @@ if ( ! class_exists( 'WP_List_Table' ) ) {
|
|
10 |
* Table to display Check Email Logs.
|
11 |
*/
|
12 |
class Check_Email_Log_List_Table extends \WP_List_Table {
|
13 |
-
|
14 |
protected $page;
|
15 |
|
16 |
public function __construct( $page, $args = array() ) {
|
@@ -31,17 +31,18 @@ class Check_Email_Log_List_Table extends \WP_List_Table {
|
|
31 |
'cb' => '<input type="checkbox" />',
|
32 |
);
|
33 |
|
34 |
-
foreach ( array( 'sent_date', 'result', 'to_email', 'subject' ) as $column ) {
|
35 |
$columns[ $column ] = Util\wp_chill_check_email_get_column_label( $column );
|
36 |
}
|
37 |
|
38 |
return apply_filters( 'check_email_manage_log_columns', $columns );
|
39 |
}
|
40 |
-
|
41 |
protected function get_sortable_columns() {
|
42 |
$sortable_columns = array(
|
43 |
'sent_date' => array( 'sent_date', true ), // true means it's already sorted.
|
44 |
'to_email' => array( 'to_email', false ),
|
|
|
45 |
'subject' => array( 'subject', false ),
|
46 |
);
|
47 |
|
@@ -55,7 +56,7 @@ class Check_Email_Log_List_Table extends \WP_List_Table {
|
|
55 |
|
56 |
protected function column_sent_date( $item ) {
|
57 |
$email_date = mysql2date(
|
58 |
-
sprintf(
|
59 |
$item->sent_date
|
60 |
);
|
61 |
|
@@ -73,13 +74,13 @@ class Check_Email_Log_List_Table extends \WP_List_Table {
|
|
73 |
|
74 |
$actions['view-content'] = sprintf( '<a href="%1$s" class="thickbox" title="%2$s">%3$s</a>',
|
75 |
esc_url( $content_ajax_url ),
|
76 |
-
|
77 |
-
|
78 |
);
|
79 |
|
80 |
$delete_url = add_query_arg(
|
81 |
array(
|
82 |
-
'page' => $_REQUEST['page'],
|
83 |
'action' => 'check-email-log-list-delete',
|
84 |
$this->_args['singular'] => $item->id,
|
85 |
)
|
@@ -88,7 +89,7 @@ class Check_Email_Log_List_Table extends \WP_List_Table {
|
|
88 |
|
89 |
$actions['delete'] = sprintf( '<a href="%s">%s</a>',
|
90 |
esc_url( $delete_url ),
|
91 |
-
|
92 |
);
|
93 |
|
94 |
$actions = apply_filters( 'check_email_row_actions', $actions, $item );
|
@@ -107,6 +108,27 @@ class Check_Email_Log_List_Table extends \WP_List_Table {
|
|
107 |
return $email;
|
108 |
}
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
protected function column_subject( $item ) {
|
111 |
return esc_html( $item->subject );
|
112 |
}
|
@@ -120,7 +142,7 @@ class Check_Email_Log_List_Table extends \WP_List_Table {
|
|
120 |
}
|
121 |
|
122 |
protected function column_result( $item ) {
|
123 |
-
|
124 |
if ( is_null( $item->result ) ) {
|
125 |
return '';
|
126 |
}
|
@@ -144,8 +166,8 @@ class Check_Email_Log_List_Table extends \WP_List_Table {
|
|
144 |
|
145 |
protected function get_bulk_actions() {
|
146 |
$actions = array(
|
147 |
-
'check-email-log-list-delete' =>
|
148 |
-
'check-email-log-list-delete-all' =>
|
149 |
);
|
150 |
$actions = apply_filters( 'el_bulk_actions', $actions );
|
151 |
|
@@ -172,27 +194,27 @@ class Check_Email_Log_List_Table extends \WP_List_Table {
|
|
172 |
}
|
173 |
|
174 |
public function no_items() {
|
175 |
-
|
176 |
}
|
177 |
|
178 |
public function search_box( $text, $input_id ) {
|
179 |
$input_text_id = $input_id . '-search-input';
|
180 |
$input_date_id = $input_id . '-search-date-input';
|
181 |
-
$input_date_val = ( ! empty( $_REQUEST['d'] ) ) ? sanitize_text_field( $_REQUEST['d'] ) : '';
|
182 |
|
183 |
if ( ! empty( $_REQUEST['orderby'] ) )
|
184 |
-
echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
|
185 |
if ( ! empty( $_REQUEST['order'] ) )
|
186 |
-
echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
|
187 |
if ( ! empty( $_REQUEST['post_mime_type'] ) )
|
188 |
-
echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '" />';
|
189 |
if ( ! empty( $_REQUEST['detached'] ) )
|
190 |
-
echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '" />';
|
191 |
?>
|
192 |
<p class="search-box">
|
193 |
-
<label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label>
|
194 |
-
<input type="search" id="<?php echo esc_attr( $input_date_id ); ?>" name="d" value="<?php echo $input_date_val; ?>" placeholder="<?php
|
195 |
-
<input type="search" id="<?php echo esc_attr( $input_text_id ); ?>" name="s" value="<?php _admin_search_query(); ?>" placeholder="<?php
|
196 |
<?php submit_button( $text, '', '', false, array( 'id' => 'search-submit' ) ); ?>
|
197 |
</p>
|
198 |
<?php
|
10 |
* Table to display Check Email Logs.
|
11 |
*/
|
12 |
class Check_Email_Log_List_Table extends \WP_List_Table {
|
13 |
+
|
14 |
protected $page;
|
15 |
|
16 |
public function __construct( $page, $args = array() ) {
|
31 |
'cb' => '<input type="checkbox" />',
|
32 |
);
|
33 |
|
34 |
+
foreach ( array( 'sent_date', 'result', 'to_email', 'from_email', 'subject' ) as $column ) {
|
35 |
$columns[ $column ] = Util\wp_chill_check_email_get_column_label( $column );
|
36 |
}
|
37 |
|
38 |
return apply_filters( 'check_email_manage_log_columns', $columns );
|
39 |
}
|
40 |
+
|
41 |
protected function get_sortable_columns() {
|
42 |
$sortable_columns = array(
|
43 |
'sent_date' => array( 'sent_date', true ), // true means it's already sorted.
|
44 |
'to_email' => array( 'to_email', false ),
|
45 |
+
'from_email'=> array( 'from_email', false ),
|
46 |
'subject' => array( 'subject', false ),
|
47 |
);
|
48 |
|
56 |
|
57 |
protected function column_sent_date( $item ) {
|
58 |
$email_date = mysql2date(
|
59 |
+
sprintf( esc_html__( '%s @ %s', 'check-email' ), get_option( 'date_format', 'F j, Y' ), 'g:i:s a' ),
|
60 |
$item->sent_date
|
61 |
);
|
62 |
|
74 |
|
75 |
$actions['view-content'] = sprintf( '<a href="%1$s" class="thickbox" title="%2$s">%3$s</a>',
|
76 |
esc_url( $content_ajax_url ),
|
77 |
+
esc_html__( 'Email Content', 'check-email' ),
|
78 |
+
esc_html__( 'View Content', 'check-email' )
|
79 |
);
|
80 |
|
81 |
$delete_url = add_query_arg(
|
82 |
array(
|
83 |
+
'page' => ( isset( $_REQUEST['page'] ) ) ? sanitize_text_field( wp_unslash($_REQUEST['page']) ) : '',
|
84 |
'action' => 'check-email-log-list-delete',
|
85 |
$this->_args['singular'] => $item->id,
|
86 |
)
|
89 |
|
90 |
$actions['delete'] = sprintf( '<a href="%s">%s</a>',
|
91 |
esc_url( $delete_url ),
|
92 |
+
esc_html__( 'Delete', 'check-email' )
|
93 |
);
|
94 |
|
95 |
$actions = apply_filters( 'check_email_row_actions', $actions, $item );
|
108 |
return $email;
|
109 |
}
|
110 |
|
111 |
+
protected function column_from_email( $item ) {
|
112 |
+
$from = '';
|
113 |
+
if (isset($item->headers) && !empty($item->headers)) {
|
114 |
+
|
115 |
+
if ( function_exists('imap_rfc822_parse_headers' ) ) {
|
116 |
+
|
117 |
+
$headers = imap_rfc822_parse_headers($item->headers);
|
118 |
+
if (isset($headers->fromaddress) && !empty($headers->fromaddress)) {
|
119 |
+
$from = $headers->fromaddress;
|
120 |
+
}
|
121 |
+
}
|
122 |
+
else {
|
123 |
+
$find_from = substr($item->headers, strpos($item->headers, 'From') + 5 );
|
124 |
+
echo esc_html( $find_from );
|
125 |
+
|
126 |
+
}
|
127 |
+
}
|
128 |
+
$email = apply_filters( 'check_email_log_list_column_from_email', esc_html( $from ) );
|
129 |
+
return $email;
|
130 |
+
}
|
131 |
+
|
132 |
protected function column_subject( $item ) {
|
133 |
return esc_html( $item->subject );
|
134 |
}
|
142 |
}
|
143 |
|
144 |
protected function column_result( $item ) {
|
145 |
+
|
146 |
if ( is_null( $item->result ) ) {
|
147 |
return '';
|
148 |
}
|
166 |
|
167 |
protected function get_bulk_actions() {
|
168 |
$actions = array(
|
169 |
+
'check-email-log-list-delete' => esc_html__( 'Delete', 'check-email' ),
|
170 |
+
'check-email-log-list-delete-all' => esc_html__( 'Delete All Logs', 'check-email' ),
|
171 |
);
|
172 |
$actions = apply_filters( 'el_bulk_actions', $actions );
|
173 |
|
194 |
}
|
195 |
|
196 |
public function no_items() {
|
197 |
+
esc_html_e( 'Your email log is empty', 'check-email' );
|
198 |
}
|
199 |
|
200 |
public function search_box( $text, $input_id ) {
|
201 |
$input_text_id = $input_id . '-search-input';
|
202 |
$input_date_id = $input_id . '-search-date-input';
|
203 |
+
$input_date_val = ( ! empty( $_REQUEST['d'] ) ) ? sanitize_text_field( wp_unslash($_REQUEST['d']) ) : '';
|
204 |
|
205 |
if ( ! empty( $_REQUEST['orderby'] ) )
|
206 |
+
echo '<input type="hidden" name="orderby" value="' . esc_attr( sanitize_text_field( wp_unslash($_REQUEST['orderby']) ) ) . '" />';
|
207 |
if ( ! empty( $_REQUEST['order'] ) )
|
208 |
+
echo '<input type="hidden" name="order" value="' . esc_attr( sanitize_text_field( wp_unslash($_REQUEST['order']) ) ) . '" />';
|
209 |
if ( ! empty( $_REQUEST['post_mime_type'] ) )
|
210 |
+
echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( sanitize_text_field( wp_unslash($_REQUEST['post_mime_type']) ) ) . '" />';
|
211 |
if ( ! empty( $_REQUEST['detached'] ) )
|
212 |
+
echo '<input type="hidden" name="detached" value="' . esc_attr( sanitize_text_field( wp_unslash($_REQUEST['detached']) ) ) . '" />';
|
213 |
?>
|
214 |
<p class="search-box">
|
215 |
+
<label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo esc_html( $text ); ?>:</label>
|
216 |
+
<input type="search" id="<?php echo esc_attr( $input_date_id ); ?>" name="d" value="<?php echo esc_attr( $input_date_val ); ?>" placeholder="<?php esc_attr_e( 'Search by date', 'check-email' ); ?>" />
|
217 |
+
<input type="search" id="<?php echo esc_attr( $input_text_id ); ?>" name="s" value="<?php _admin_search_query(); ?>" placeholder="<?php esc_attr_e( 'Search by term', 'check-email' ); ?>" />
|
218 |
<?php submit_button( $text, '', '', false, array( 'id' => 'search-submit' ) ); ?>
|
219 |
</p>
|
220 |
<?php
|
include/Util/helper.php
CHANGED
@@ -133,18 +133,19 @@ function wp_chill_check_email_get_column_label( $column_name ) {
|
|
133 |
|
134 |
function wp_chill_check_email_get_column_label_map() {
|
135 |
$labels = array(
|
136 |
-
'id' =>
|
137 |
-
'to_email' =>
|
138 |
-
'
|
139 |
-
'
|
140 |
-
'
|
141 |
-
'
|
142 |
-
'
|
143 |
-
'
|
144 |
-
'
|
145 |
-
'
|
146 |
-
'
|
147 |
-
'
|
|
|
148 |
);
|
149 |
|
150 |
return apply_filters( 'check_email_db_column_labels', $labels );
|
133 |
|
134 |
function wp_chill_check_email_get_column_label_map() {
|
135 |
$labels = array(
|
136 |
+
'id' => esc_html__( 'ID', 'check-email' ),
|
137 |
+
'to_email' => esc_html__( 'To', 'check-email' ),
|
138 |
+
'from_email' => esc_html__( 'From', 'check-email' ),
|
139 |
+
'subject' => esc_html__( 'Subject', 'check-email' ),
|
140 |
+
'message' => esc_html__( 'Message', 'check-email' ),
|
141 |
+
'attachments' => esc_html__( 'Attachment', 'check-email' ),
|
142 |
+
'sent_date' => esc_html__( 'Sent at', 'check-email' ),
|
143 |
+
'from' => esc_html__( 'From', 'check-email' ),
|
144 |
+
'cc' => esc_html__( 'CC', 'check-email' ),
|
145 |
+
'bcc' => esc_html__( 'BCC', 'check-email' ),
|
146 |
+
'reply_to' => esc_html__( 'Reply To', 'check-email' ),
|
147 |
+
'ip_address' => esc_html__( 'IP Address', 'check-email' ),
|
148 |
+
'result' => esc_html__( 'Sent Status', 'check-email' ),
|
149 |
);
|
150 |
|
151 |
return apply_filters( 'check_email_db_column_labels', $labels );
|
languages/check-email.po
ADDED
@@ -0,0 +1,444 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2021 WPChill
|
2 |
+
# This file is distributed under the GPLv3 or later.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: Check & Log Email 1.0.2\n"
|
6 |
+
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/check-email\n"
|
7 |
+
"POT-Creation-Date: 2021-05-28 09:18:41+00:00\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2021-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
+
"Language: en\n"
|
15 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
16 |
+
"X-Poedit-Country: United States\n"
|
17 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
18 |
+
"X-Poedit-KeywordsList: "
|
19 |
+
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
|
20 |
+
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
|
21 |
+
"X-Poedit-Basepath: ../\n"
|
22 |
+
"X-Poedit-SearchPath-0: .\n"
|
23 |
+
"X-Poedit-Bookmarks: \n"
|
24 |
+
"X-Textdomain-Support: yes\n"
|
25 |
+
"X-Generator: grunt-wp-i18n 1.0.3\n"
|
26 |
+
|
27 |
+
#: check-email.php:44
|
28 |
+
msgid ""
|
29 |
+
"Check & Log Email requires at least PHP 5.6 to function properly. Please "
|
30 |
+
"upgrade PHP."
|
31 |
+
msgstr ""
|
32 |
+
|
33 |
+
#: include/Core/Check_Email_Review.php:18
|
34 |
+
msgid ""
|
35 |
+
"Hi there! Stoked to see you're using Check & Log Email for a few days now - "
|
36 |
+
"hope you like it! And if you do, please consider rating it. It would mean "
|
37 |
+
"the world to us. Keep on rocking!"
|
38 |
+
msgstr ""
|
39 |
+
|
40 |
+
#: include/Core/Check_Email_Review.php:19
|
41 |
+
msgid "Rate the plugin"
|
42 |
+
msgstr ""
|
43 |
+
|
44 |
+
#: include/Core/Check_Email_Review.php:20
|
45 |
+
msgid "Remind me later"
|
46 |
+
msgstr ""
|
47 |
+
|
48 |
+
#: include/Core/Check_Email_Review.php:21
|
49 |
+
msgid "Don't show again"
|
50 |
+
msgstr ""
|
51 |
+
|
52 |
+
#: include/Core/Request/Check_Email_Log_List_Action.php:49
|
53 |
+
#: include/Util/helper.php:142 include/class-check-email-log-list-table.php:18
|
54 |
+
msgid "Sent at"
|
55 |
+
msgstr ""
|
56 |
+
|
57 |
+
#: include/Core/Request/Check_Email_Log_List_Action.php:53
|
58 |
+
#: include/Util/helper.php:137 include/class-check-email-log-list-table.php:19
|
59 |
+
msgid "To"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: include/Core/Request/Check_Email_Log_List_Action.php:57
|
63 |
+
#: include/Util/helper.php:139 include/class-check-email-log-list-table.php:21
|
64 |
+
msgid "Subject"
|
65 |
+
msgstr ""
|
66 |
+
|
67 |
+
#: include/Core/Request/Check_Email_Log_List_Action.php:61
|
68 |
+
msgid "Headers"
|
69 |
+
msgstr ""
|
70 |
+
|
71 |
+
#: include/Core/Request/Check_Email_Log_List_Action.php:73
|
72 |
+
msgid "Raw Email Content"
|
73 |
+
msgstr ""
|
74 |
+
|
75 |
+
#: include/Core/Request/Check_Email_Log_List_Action.php:74
|
76 |
+
msgid "Preview Content as HTML"
|
77 |
+
msgstr ""
|
78 |
+
|
79 |
+
#: include/Core/Request/Check_Email_Log_List_Action.php:87
|
80 |
+
msgid "Close"
|
81 |
+
msgstr ""
|
82 |
+
|
83 |
+
#: include/Core/Request/Check_Email_Log_List_Action.php:138
|
84 |
+
msgid "There was some problem in deleting the email logs"
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: include/Core/Request/Check_Email_Log_List_Action.php:142
|
88 |
+
msgid "1 email log deleted."
|
89 |
+
msgid_plural "%s email logs deleted"
|
90 |
+
msgstr[0] ""
|
91 |
+
msgstr[1] ""
|
92 |
+
|
93 |
+
#: include/Core/UI/Component/Check_Email_Dashboard_Widget.php:15
|
94 |
+
msgid "Check Email Summary"
|
95 |
+
msgstr ""
|
96 |
+
|
97 |
+
#: include/Core/UI/Component/Check_Email_Dashboard_Widget.php:29
|
98 |
+
msgid "Total number of emails logged"
|
99 |
+
msgstr ""
|
100 |
+
|
101 |
+
#: include/Core/UI/Component/Check_Email_Dashboard_Widget.php:37
|
102 |
+
msgid "<a href=\"%s\">Status</a>"
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#: include/Core/UI/Component/Check_Email_Dashboard_Widget.php:38
|
106 |
+
msgid "<a href=\"%s\">Email Logs</a>"
|
107 |
+
msgstr ""
|
108 |
|