Check Email - Version 0.6.0

Version Description

Download this release

Release Info

Developer giucu91
Plugin Icon wp plugin Check Email
Version 0.6.0
Comparing to
See all releases

Code changes from version 0.5.7 to 0.6.0

Files changed (4) hide show
  1. check-email.php +234 -214
  2. class-check-email-review.php +155 -0
  3. plugin-register.class.php +0 -86
  4. readme.txt +45 -46
check-email.php CHANGED
@@ -1,215 +1,235 @@
1
- <?php
2
- /*
3
- Plugin Name: Check Email
4
- Plugin URI: http://www.stillbreathing.co.uk/wordpress/check-email/
5
- Description: Check email allows you to test if your WordPress installation is sending emails correctly.
6
- Text Domain: check-email
7
- Version: 0.5.7
8
- Author: Chris Taylor
9
- Author URI: http://www.stillbreathing.co.uk
10
- */
11
-
12
- // Plugin Register from http://wordpress.org/extend/plugins/plugin-register/
13
- require_once( "plugin-register.class.php" );
14
- $register = new Plugin_Register();
15
- $register->file = __FILE__;
16
- $register->slug = "checkemail";
17
- $register->name = "Check Email";
18
- $register->version = "0.5.7";
19
- $register->developer = "Chris Taylor";
20
- $register->homepage = "http://www.stillbreathing.co.uk";
21
- $register->Register();
22
-
23
- // add the admin menu option
24
- add_action( 'admin_menu', 'checkemail_add_admin' );
25
- function checkemail_add_admin() {
26
- add_submenu_page( 'tools.php', __("Check Email", "check-email"), __("Check Email", "check-email"), 'edit_users', 'checkemail', 'checkemail' );
27
- }
28
-
29
- // add the JavaScript
30
- add_action( 'admin_head', 'checkemail_add_js' );
31
- function checkemail_add_js() {
32
- if ( isset( $_GET["page"] ) && $_GET["page"] == "checkemail" ) {
33
- echo '
34
- <script type="text/javascript">
35
- jQuery(document).ready(function(){
36
- jQuery(".checkemail-hide").hide();
37
- jQuery("#checkemail_autoheaders,#checkemail_customheaders").bind("change", function(){
38
- if (jQuery("#checkemail_autoheaders").is(":checked")){
39
- jQuery("#customheaders").hide();
40
- jQuery("#autoheaders").show();
41
- }
42
- if (jQuery("#checkemail_customheaders").is(":checked")){
43
- jQuery("#autoheaders").hide();
44
- jQuery("#customheaders").show();
45
- }
46
- });
47
- });
48
- </script>
49
- ';
50
- }
51
- }
52
- // add the CSS
53
- add_action( 'admin_head', 'checkemail_add_css' );
54
- function checkemail_add_css() {
55
- if ( isset( $_GET["page"] ) && $_GET["page"] == "checkemail" ) {
56
- echo '
57
- <style type="text/css">
58
- #checkemail label {
59
- width: 16em;
60
- float: left;
61
- }
62
- #checkemail .text {
63
- width: 30em;
64
- }
65
- #checkemail p, #checkemail pre {
66
- clear: left;
67
- }
68
- </style>
69
- ';
70
- }
71
- }
72
-
73
- // load the check email admin page
74
- function checkemail() {
75
- global $current_user;
76
-
77
- $from_email = apply_filters( 'wp_mail_from', $current_user->user_email );
78
- $from_name = apply_filters( 'wp_mail_from_name', $from_name );
79
-
80
- echo '
81
- <div id="checkemail" class="wrap">
82
- ';
83
-
84
- if ( isset( $_POST["checkemail_to"]) && $_POST["checkemail_to"] != "" )
85
- {
86
- $nonce = $_REQUEST['_wpnonce'];
87
- if ( wp_verify_nonce( $nonce, 'checkemail' ) ) {
88
- $headers = checkemail_send( $_POST["checkemail_to"], $_POST["checkemail_headers"] );
89
- echo '<div class="updated"><p>' . __( 'The test email has been sent by WordPress. Please note this does NOT mean it has been delivered. See <a href="http://codex.wordpress.org/Function_Reference/wp_mail">wp_mail in the Codex</a> for more information. The headers sent were:', "check-email" ) . '</p><pre>' . str_replace( chr( 10 ), '\n' . "\n", str_replace( chr( 13 ), '\r', $headers ) ) . '</pre></div>';
90
- } else {
91
- echo '<div class="updated"><p>' . __( 'Security check failed', "check-email" ) . '</p></div>';
92
- }
93
- }
94
-
95
- echo '
96
- <h2>' . __( "Check Email" ) . '</h2>
97
-
98
- <h3>' . __( "Current mail settings", "check-email" ) . '</h3>
99
- <p>' . __( "SendMail path (UNIX):", "check-email" ) . ' ' . ini_get("sendmail_path") . '</p>
100
- <p>' . __( "SMTP server (Windows):", "check-email" ) . ' ' . ini_get("SMTP") . '</p>
101
- <p>' . __( "SMTP port (Windows):", "check-email" ) . ' ' . ini_get("smtp_port") . '</p>
102
- <p>' . __( "Add X header:", "check-email" ) . ' ' . ini_get("mail.add_x_header") . '</p>
103
-
104
- <h3>' . __( "Send a test email", "check-email" ) . '</h3>
105
- <form action="tools.php?page=checkemail" method="post">
106
- <p><label for="checkemail_to">' . __( "Send test email to:", "check-email" ) . '</label>
107
- <input type="text" name="checkemail_to" id="checkemail_to" class="text"';
108
- if ( isset( $_POST["checkemail_to"] ) ) {
109
- echo ' value="' . esc_attr( $_POST["checkemail_to"] ) . '"';
110
- }
111
- echo ' /></p>
112
- <p><label for="checkemail_autoheaders">' . __( "Use standard headers", "check-email" ) . '</label>
113
- <input type="radio" id="checkemail_autoheaders" name="checkemail_headers" value="auto"';
114
- if ( !isset($_POST["checkemail_headers"]) || $_POST["checkemail_headers"] == "auto" ){
115
- echo ' checked="checked"';
116
- }
117
- echo ' /></p>
118
- <pre id="autoheaders"';
119
- if ( isset($_POST["checkemail_headers"]) && $_POST["checkemail_headers"] == "custom" ){
120
- echo ' class="checkemail-hide"';
121
- }
122
- echo '>MIME-Version: 1.0
123
- From: ' . $from_email . '
124
- Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . '"</pre>
125
- <p><label for="checkemail_customheaders">' . __( "Use custom headers", "check-email" ) . '</label>
126
- <input type="radio" id="checkemail_customheaders" name="checkemail_headers" value="custom"';
127
- if ( isset($_POST["checkemail_headers"]) && $_POST["checkemail_headers"] == "custom" ){
128
- echo ' checked="checked"';
129
- }
130
- echo ' /></p>
131
- <div id="customheaders"';
132
- if ( !isset($_POST["checkemail_headers"]) || $_POST["checkemail_headers"] == "auto" ){
133
- echo ' class="checkemail-hide"';
134
- }
135
- echo '>
136
- <p>' . __( "Set your custom headers below", "check-email" ) . '</p>
137
- <p><label for="checkemail_mime">' . __( "MIME Version", "check-email" ) . '</label>
138
- <input type="text" name="checkemail_mime" id="checkemail_mime" value="';
139
- if ( isset( $_POST["checkemail_mime"] ) ) {
140
- echo esc_attr( $_POST["checkemail_mime"] );
141
- } else {
142
- echo '1.0';
143
- }
144
- echo '" /></p>
145
- <p><label for="checkemail_type">' . __( "Content type", "check-email" ) . '</label>
146
- <input type="text" name="checkemail_type" id="checkemail_type" value="';
147
- if ( isset( $_POST["checkemail_type"] ) ) {
148
- echo esc_attr( $_POST["checkemail_type"] );
149
- } else {
150
- echo 'text/html; charset=iso-8859-1';
151
- }
152
- echo '" class="text" /></p>
153
- <p><label for="checkemail_from">' . __( "From", "check-email" ) . '</label>
154
- <input type="text" name="checkemail_from" id="checkemail_from" value="';
155
- if ( isset( $_POST["checkemail_from"] ) ) {
156
- echo esc_attr( $_POST["checkemail_from"] );
157
- } else {
158
- echo $from_email;
159
- }
160
- echo '" class="text" /></p>
161
- <p><label for="checkemail_cc">' . __( "CC", "check-email" ) . '</label>
162
- <textarea name="checkemail_cc" id="checkemail_cc" cols="30" rows="4" class="text">';
163
- if ( isset( $_POST["checkemail_cc"] ) ) {
164
- echo esc_textarea( $_POST["checkemail_cc"] );
165
- }
166
- echo '</textarea></p>
167
- <p><label for="checkemail_break_n">' . __( "Header line break type", "check-email" ) . '</label>
168
- <input type="radio" name="checkemail_break" id="checkemail_break_n" value="\n"';
169
- if ( !isset( $_POST["checkemail_break"] ) || $_POST["checkemail_break"] == '\n' ) {
170
- echo ' checked="checked"';
171
- }
172
- echo ' /> \n
173
- <input type="radio" name="checkemail_break" id="checkemail_break_rn" value="\r\n"';
174
- if ( isset( $_POST["checkemail_break"] ) && $_POST["checkemail_break"] == '\r\n' ) {
175
- echo ' checked="checked"';
176
- }
177
- echo ' /> \r\n</p>
178
- </div>
179
- <p><label for="checkemail_go" class="checkemail-hide">' . __( "Send", "check-email" ) . '</label>
180
- <input type="submit" name="checkemail_go" id="checkemail_go" class="button-primary" value="' . __( "Send test email", "check-email" ) . '" /></p>
181
- ';
182
- wp_nonce_field( 'checkemail' );
183
- echo '</form>
184
-
185
- </div>
186
- ';
187
-
188
- }
189
-
190
- // send a test email
191
- function checkemail_send($to, $headers = "auto") {
192
- global $current_user;
193
-
194
- $from_email = apply_filters( 'wp_mail_from', $current_user->user_email );
195
- $from_name = apply_filters( 'wp_mail_from_name', $from_name );
196
-
197
- if ( $headers == "auto" ) {
198
- $headers = "MIME-Version: 1.0\r\n" .
199
- "From: " . $from_email . "\r\n" .
200
- "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\r\n";
201
- } else {
202
- $break = chr( 10 );
203
- if ( stripslashes( $_POST["checkemail_break"] ) == '\r\n' ) {
204
- $break = chr( 13 ) . chr( 10 );
205
- }
206
- $headers = "MIME-Version: " . trim( $_POST["checkemail_mime"] ) . $break .
207
- "From: " . trim( $_POST["checkemail_from"] ) . $break .
208
- "Cc: " . trim( $_POST["checkemail_cc"] ) . $break .
209
- "Content-Type: " . trim( $_POST["checkemail_type"] ) . $break;
210
- }
211
- $title = __( sprintf( "Test email from %s ", get_bloginfo("url") ), "check-email" );
212
- $body = __( sprintf( 'This test email proves that your WordPress installation at %1$s can send emails.\n\nSent: %2$s', get_bloginfo( "url" ), date( "r" ) ), "check-email" );
213
- wp_mail( $to, $title, $body, $headers );
214
- return $headers;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  }
1
+ <?php
2
+ /*
3
+ * Plugin Name: Check Email
4
+ * Description: Check email allows you to test if your WordPress installation is sending emails correctly.
5
+ * Author: MachoThemes
6
+ * Version: 0.6.0
7
+ * Author URI: https://www.machothemes.com/
8
+ * License: GPLv3 or later
9
+ * License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
+ * Requires PHP: 5.6
11
+ * Text Domain: check-email
12
+ * Domain Path: /languages
13
+ *
14
+ * Copyright 2015-2017 Chris Taylor chris@stillbreathing.co.uk
15
+ * Copyright 2017-2019 MachoThemes office@machothemes.com
16
+ *
17
+ * Original Plugin URI: https://modula.greentreelabs.net/
18
+ * Original Author URI: https://greentreelabs.net
19
+ * Original Author: https://profiles.wordpress.org/greentreelabs/
20
+ *
21
+ * NOTE:
22
+ * Chris Taylor transferred ownership rights on: 2020-06-19 07:52:03 GMT when ownership was handed over to MachoThemes
23
+ * The MachoThemes ownership period started on: 2020-06-19 07:52:03 GMT
24
+ *
25
+ * This program is free software; you can redistribute it and/or modify
26
+ * it under the terms of the GNU General Public License, version 3, as
27
+ * published by the Free Software Foundation.
28
+ *
29
+ * This program is distributed in the hope that it will be useful,
30
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
31
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32
+ * GNU General Public License for more details.
33
+ *
34
+ * You should have received a copy of the GNU General Public License
35
+ * along with this program; if not, write to the Free software
36
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
37
+ */
38
+
39
+ require_once( "class-check-email-review.php" );
40
+
41
+ // add the admin menu option
42
+ add_action( 'admin_menu', 'checkemail_add_admin' );
43
+ function checkemail_add_admin() {
44
+ add_submenu_page( 'tools.php', __("Check Email", "check-email"), __("Check Email", "check-email"), 'edit_users', 'checkemail', 'checkemail' );
45
+ }
46
+
47
+ // add the JavaScript
48
+ add_action( 'admin_head', 'checkemail_add_js' );
49
+ function checkemail_add_js() {
50
+ if ( isset( $_GET["page"] ) && $_GET["page"] == "checkemail" ) {
51
+ echo '
52
+ <script type="text/javascript">
53
+ jQuery(document).ready(function(){
54
+ jQuery(".checkemail-hide").hide();
55
+ jQuery("#checkemail_autoheaders,#checkemail_customheaders").bind("change", function(){
56
+ if (jQuery("#checkemail_autoheaders").is(":checked")){
57
+ jQuery("#customheaders").hide();
58
+ jQuery("#autoheaders").show();
59
+ }
60
+ if (jQuery("#checkemail_customheaders").is(":checked")){
61
+ jQuery("#autoheaders").hide();
62
+ jQuery("#customheaders").show();
63
+ }
64
+ });
65
+ });
66
+ </script>
67
+ ';
68
+ }
69
+ }
70
+ // add the CSS
71
+ add_action( 'admin_head', 'checkemail_add_css' );
72
+ function checkemail_add_css() {
73
+ if ( isset( $_GET["page"] ) && $_GET["page"] == "checkemail" ) {
74
+ echo '
75
+ <style type="text/css">
76
+ #checkemail label {
77
+ width: 16em;
78
+ float: left;
79
+ }
80
+ #checkemail .text {
81
+ width: 30em;
82
+ }
83
+ #checkemail p, #checkemail pre {
84
+ clear: left;
85
+ }
86
+ </style>
87
+ ';
88
+ }
89
+ }
90
+
91
+ // load the check email admin page
92
+ function checkemail() {
93
+ global $current_user;
94
+ $from_name = '';
95
+
96
+ $from_email = apply_filters( 'wp_mail_from', $current_user->user_email );
97
+ $from_name = apply_filters( 'wp_mail_from_name', $from_name );
98
+
99
+ echo '
100
+ <div id="checkemail" class="wrap">
101
+ ';
102
+
103
+ if ( isset( $_POST["checkemail_to"]) && $_POST["checkemail_to"] != "" )
104
+ {
105
+ $nonce = $_REQUEST['_wpnonce'];
106
+ if ( wp_verify_nonce( $nonce, 'checkemail' ) ) {
107
+ $headers = checkemail_send( $_POST["checkemail_to"], $_POST["checkemail_headers"] );
108
+ echo '<div class="updated"><p>' . __( 'The test email has been sent by WordPress. Please note this does NOT mean it has been delivered. See <a href="http://codex.wordpress.org/Function_Reference/wp_mail">wp_mail in the Codex</a> for more information. The headers sent were:', "check-email" ) . '</p><pre>' . str_replace( chr( 10 ), '\n' . "\n", str_replace( chr( 13 ), '\r', $headers ) ) . '</pre></div>';
109
+ } else {
110
+ echo '<div class="updated"><p>' . __( 'Security check failed', "check-email" ) . '</p></div>';
111
+ }
112
+ }
113
+
114
+ echo '
115
+ <h2>' . __( "Check Email" ) . '</h2>
116
+
117
+ <h3>' . __( "Current mail settings", "check-email" ) . '</h3>
118
+ <p>' . __( "SendMail path (UNIX):", "check-email" ) . ' ' . ini_get("sendmail_path") . '</p>
119
+ <p>' . __( "SMTP server (Windows):", "check-email" ) . ' ' . ini_get("SMTP") . '</p>
120
+ <p>' . __( "SMTP port (Windows):", "check-email" ) . ' ' . ini_get("smtp_port") . '</p>
121
+ <p>' . __( "Add X header:", "check-email" ) . ' ' . ini_get("mail.add_x_header") . '</p>
122
+
123
+ <h3>' . __( "Send a test email", "check-email" ) . '</h3>
124
+ <form action="tools.php?page=checkemail" method="post">
125
+ <p><label for="checkemail_to">' . __( "Send test email to:", "check-email" ) . '</label>
126
+ <input type="text" name="checkemail_to" id="checkemail_to" class="text"';
127
+ if ( isset( $_POST["checkemail_to"] ) ) {
128
+ echo ' value="' . esc_attr( $_POST["checkemail_to"] ) . '"';
129
+ }
130
+ echo ' /></p>
131
+ <p><label for="checkemail_autoheaders">' . __( "Use standard headers", "check-email" ) . '</label>
132
+ <input type="radio" id="checkemail_autoheaders" name="checkemail_headers" value="auto"';
133
+ if ( !isset($_POST["checkemail_headers"]) || $_POST["checkemail_headers"] == "auto" ){
134
+ echo ' checked="checked"';
135
+ }
136
+ echo ' /></p>
137
+ <pre id="autoheaders"';
138
+ if ( isset($_POST["checkemail_headers"]) && $_POST["checkemail_headers"] == "custom" ){
139
+ echo ' class="checkemail-hide"';
140
+ }
141
+ echo '>MIME-Version: 1.0
142
+ From: ' . $from_email . '
143
+ Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . '"</pre>
144
+ <p><label for="checkemail_customheaders">' . __( "Use custom headers", "check-email" ) . '</label>
145
+ <input type="radio" id="checkemail_customheaders" name="checkemail_headers" value="custom"';
146
+ if ( isset($_POST["checkemail_headers"]) && $_POST["checkemail_headers"] == "custom" ){
147
+ echo ' checked="checked"';
148
+ }
149
+ echo ' /></p>
150
+ <div id="customheaders"';
151
+ if ( !isset($_POST["checkemail_headers"]) || $_POST["checkemail_headers"] == "auto" ){
152
+ echo ' class="checkemail-hide"';
153
+ }
154
+ echo '>
155
+ <p>' . __( "Set your custom headers below", "check-email" ) . '</p>
156
+ <p><label for="checkemail_mime">' . __( "MIME Version", "check-email" ) . '</label>
157
+ <input type="text" name="checkemail_mime" id="checkemail_mime" value="';
158
+ if ( isset( $_POST["checkemail_mime"] ) ) {
159
+ echo esc_attr( $_POST["checkemail_mime"] );
160
+ } else {
161
+ echo '1.0';
162
+ }
163
+ echo '" /></p>
164
+ <p><label for="checkemail_type">' . __( "Content type", "check-email" ) . '</label>
165
+ <input type="text" name="checkemail_type" id="checkemail_type" value="';
166
+ if ( isset( $_POST["checkemail_type"] ) ) {
167
+ echo esc_attr( $_POST["checkemail_type"] );
168
+ } else {
169
+ echo 'text/html; charset=iso-8859-1';
170
+ }
171
+ echo '" class="text" /></p>
172
+ <p><label for="checkemail_from">' . __( "From", "check-email" ) . '</label>
173
+ <input type="text" name="checkemail_from" id="checkemail_from" value="';
174
+ if ( isset( $_POST["checkemail_from"] ) ) {
175
+ echo esc_attr( $_POST["checkemail_from"] );
176
+ } else {
177
+ echo $from_email;
178
+ }
179
+ echo '" class="text" /></p>
180
+ <p><label for="checkemail_cc">' . __( "CC", "check-email" ) . '</label>
181
+ <textarea name="checkemail_cc" id="checkemail_cc" cols="30" rows="4" class="text">';
182
+ if ( isset( $_POST["checkemail_cc"] ) ) {
183
+ echo esc_textarea( $_POST["checkemail_cc"] );
184
+ }
185
+ echo '</textarea></p>
186
+ <p><label for="checkemail_break_n">' . __( "Header line break type", "check-email" ) . '</label>
187
+ <input type="radio" name="checkemail_break" id="checkemail_break_n" value="\n"';
188
+ if ( !isset( $_POST["checkemail_break"] ) || $_POST["checkemail_break"] == '\n' ) {
189
+ echo ' checked="checked"';
190
+ }
191
+ echo ' /> \n
192
+ <input type="radio" name="checkemail_break" id="checkemail_break_rn" value="\r\n"';
193
+ if ( isset( $_POST["checkemail_break"] ) && $_POST["checkemail_break"] == '\r\n' ) {
194
+ echo ' checked="checked"';
195
+ }
196
+ echo ' /> \r\n</p>
197
+ </div>
198
+ <p><label for="checkemail_go" class="checkemail-hide">' . __( "Send", "check-email" ) . '</label>
199
+ <input type="submit" name="checkemail_go" id="checkemail_go" class="button-primary" value="' . __( "Send test email", "check-email" ) . '" /></p>
200
+ ';
201
+ wp_nonce_field( 'checkemail' );
202
+ echo '</form>
203
+
204
+ </div>
205
+ ';
206
+
207
+ }
208
+
209
+ // send a test email
210
+ function checkemail_send($to, $headers = "auto") {
211
+ global $current_user;
212
+ $from_name = '';
213
+
214
+ $from_email = apply_filters( 'wp_mail_from', $current_user->user_email );
215
+ $from_name = apply_filters( 'wp_mail_from_name', $from_name );
216
+
217
+ if ( $headers == "auto" ) {
218
+ $headers = "MIME-Version: 1.0\r\n" .
219
+ "From: " . $from_email . "\r\n" .
220
+ "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\r\n";
221
+ } else {
222
+ $break = chr( 10 );
223
+ if ( stripslashes( $_POST["checkemail_break"] ) == '\r\n' ) {
224
+ $break = chr( 13 ) . chr( 10 );
225
+ }
226
+ $headers = "MIME-Version: " . trim( $_POST["checkemail_mime"] ) . $break .
227
+ "From: " . trim( $_POST["checkemail_from"] ) . $break .
228
+ "Cc: " . trim( $_POST["checkemail_cc"] ) . $break .
229
+ "Content-Type: " . trim( $_POST["checkemail_type"] ) . $break;
230
+ }
231
+ $title = __( sprintf( "Test email from %s ", get_bloginfo("url") ), "check-email" );
232
+ $body = __( sprintf( 'This test email proves that your WordPress installation at %1$s can send emails.\n\nSent: %2$s', get_bloginfo( "url" ), date( "r" ) ), "check-email" );
233
+ wp_mail( $to, $title, $body, $headers );
234
+ return $headers;
235
  }
class-check-email-review.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Check_Email_Review {
4
+
5
+ private $value;
6
+ private $messages;
7
+ private $link = 'https://wordpress.org/support/plugin/%s/reviews/#new-post';
8
+ private $slug = 'check-email';
9
+
10
+ function __construct() {
11
+
12
+ $this->messages = array(
13
+ 'notice' => esc_html__( "Hi there! Stoked to see you're using Check Email for a few days now - hope you like it! And if you do, please consider rating it. It would mean the world to us. Keep on rocking!", 'check-email' ),
14
+ 'rate' => esc_html__( 'Rate the plugin', 'check-email' ),
15
+ 'rated' => esc_html__( 'Remind me later', 'check-email' ),
16
+ 'no_rate' => esc_html__( 'Don\'t show again', 'check-email' ),
17
+ );
18
+
19
+ if ( isset( $args['messages'] ) ) {
20
+ $this->messages = wp_parse_args( $args['messages'], $this->messages );
21
+ }
22
+
23
+ add_action( 'init', array( $this, 'init' ) );
24
+
25
+ }
26
+
27
+ public function init() {
28
+ if ( ! is_admin() ) {
29
+ return;
30
+ }
31
+
32
+ $this->value = $this->value();
33
+
34
+ if ( $this->check() ) {
35
+ add_action( 'admin_notices', array( $this, 'five_star_wp_rate_notice' ) );
36
+ add_action( 'wp_ajax_epsilon_check-email_review', array( $this, 'ajax' ) );
37
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
38
+ add_action( 'admin_print_footer_scripts', array( $this, 'ajax_script' ) );
39
+ }
40
+
41
+ }
42
+
43
+ private function check() {
44
+
45
+ if ( ! current_user_can('manage_options') ) {
46
+ return false;
47
+ }
48
+
49
+ return( time() > $this->value );
50
+
51
+ }
52
+
53
+ private function value() {
54
+
55
+ $value = get_option( 'check-email-rate-time', false );
56
+
57
+ if ( $value ) {
58
+ return $value;
59
+ }
60
+
61
+ $value = time() + DAY_IN_SECONDS;
62
+ update_option( 'check-email-rate-time', $value );
63
+
64
+ return $value;
65
+
66
+ }
67
+
68
+ public function five_star_wp_rate_notice() {
69
+ $url = sprintf( $this->link, $this->slug );
70
+
71
+ ?>
72
+ <div id="<?php echo esc_attr($this->slug) ?>-epsilon-review-notice" class="notice notice-success is-dismissible" style="margin-top:30px;">
73
+ <p><?php echo sprintf( esc_html( $this->messages['notice'] ), $this->value ) ; ?></p>
74
+ <p class="actions">
75
+ <a id="epsilon-rate" href="<?php echo esc_url( $url ) ?>" target="_blank" class="button button-primary epsilon-review-button">
76
+ <?php echo esc_html( $this->messages['rate'] ); ?>
77
+ </a>
78
+ <a id="epsilon-later" href="#" style="margin-left:10px" class="epsilon-review-button"><?php echo esc_html( $this->messages['rated'] ); ?></a>
79
+ <a id="epsilon-no-rate" href="#" style="margin-left:10px" class="epsilon-review-button"><?php echo esc_html( $this->messages['no_rate'] ); ?></a>
80
+ </p>
81
+ </div>
82
+ <?php
83
+ }
84
+
85
+ public function ajax() {
86
+
87
+ check_ajax_referer( 'epsilon-check-email-review', 'security' );
88
+
89
+ if ( ! isset( $_POST['check'] ) ) {
90
+ wp_die( 'ok' );
91
+ }
92
+
93
+ $time = get_option( 'check-email-rate-time' );
94
+
95
+ if ( 'epsilon-rate' == $_POST['check'] ) {
96
+ $time = time() + YEAR_IN_SECONDS * 5;
97
+ }elseif ( 'epsilon-later' == $_POST['check'] ) {
98
+ $time = time() + WEEK_IN_SECONDS;
99
+ }elseif ( 'epsilon-no-rate' == $_POST['check'] ) {
100
+ $time = time() + YEAR_IN_SECONDS * 5;
101
+ }
102
+
103
+ update_option( 'check-email-rate-time', $time );
104
+ wp_die( 'ok' );
105
+
106
+ }
107
+
108
+ public function enqueue() {
109
+ wp_enqueue_script( 'jquery' );
110
+ }
111
+
112
+ public function ajax_script() {
113
+
114
+ $ajax_nonce = wp_create_nonce( "epsilon-check-email-review" );
115
+
116
+ ?>
117
+
118
+ <script type="text/javascript">
119
+ jQuery( document ).ready( function( $ ){
120
+
121
+ $( '.epsilon-review-button' ).click( function( evt ){
122
+ var href = $(this).attr('href'),
123
+ id = $(this).attr('id');
124
+
125
+ if ( 'epsilon-rate' != id ) {
126
+ evt.preventDefault();
127
+ }
128
+
129
+ var data = {
130
+ action: 'epsilon_check-email_review',
131
+ security: '<?php echo $ajax_nonce; ?>',
132
+ check: id
133
+ };
134
+
135
+ if ( 'epsilon-rated' === id ) {
136
+ data['epsilon-review'] = 1;
137
+ }
138
+
139
+ $.post( '<?php echo admin_url( 'admin-ajax.php' ) ?>', data, function( response ) {
140
+ $( '#<?php echo $this->slug ?>-epsilon-review-notice' ).slideUp( 'fast', function() {
141
+ $( this ).remove();
142
+ } );
143
+ });
144
+
145
+ } );
146
+
147
+ });
148
+ </script>
149
+
150
+ <?php
151
+ }
152
+ }
153
+
154
+ new Check_Email_Review();
155
+
plugin-register.class.php DELETED
@@ -1,86 +0,0 @@
1
- <?php
2
- /*
3
- Include this file at the end of your plugin, then create a new instance of the Plugin_Register class. Here's some sample code:
4
-
5
- // include the Plugin_Register class
6
- require_once( "plugin-register.class.php" );
7
-
8
- // create a new instance of the Plugin_Register class
9
- $register = new Plugin_Register(); // leave this as it is
10
- $register->file = __FILE__; // leave this as it is
11
- $register->slug = "pluginregister"; // create a unique slug for your plugin (normally the plugin name in lowercase, with no spaces or special characters works fine)
12
- $register->name = "Plugin Register"; // the full name of your plugin (this will be displayed in your statistics)
13
- $register->version = "1.0"; // the version of your plugin (this will be displayed in your statistics)
14
- $register->developer = "Chris Taylor"; // your name
15
- $register->homepage = "http://www.stillbreathing.co.uk"; // your Wordpress website where Plugin Register is installed (no trailing slash)
16
-
17
- // the next two lines are optional
18
- // 'register_plugin' is the message you want to be displayed when someone has activated this plugin. The %1 is replaced by the correct URL to register the plugin (the %1 MUST be the HREF attribute of an <a> element)
19
- $register->register_message = 'Hey! Thanks! <a href="%1">Register the plugin here</a>.';
20
- // 'thanks_message' is the message you want to display after someone has registered your plugin
21
- $register->thanks_message = "That's great, thanks a million.";
22
-
23
- $register->Plugin_Register(); // leave this as it is
24
- */
25
- if ( !class_exists( "Plugin_Register" ) ) {
26
- class Plugin_Register {
27
- var $slug = "";
28
- var $developer = "the developer";
29
- var $version = "";
30
- var $homepage = "#";
31
- var $name = "";
32
- var $file = "";
33
- var $register_message = "";
34
- var $thanks_message = "";
35
- function Register() {
36
- @session_start();
37
- register_activation_hook( $this->file, array( $this, "Activated" ) );
38
- add_action( "admin_notices", array( $this, "Registration" ) );
39
- }
40
- function Activated() {
41
- if ( $this->slug != "" && $this->name != "" && $this->version != "" ) {
42
- $_SESSION["activated_plugin"] = $this->slug;
43
- }
44
- }
45
- function Registration() {
46
- if ( isset( $_SESSION["activated_plugin"] ) && $_SESSION["activated_plugin"] == $this->slug ) {
47
- $_SESSION["activated_plugin"] = "";
48
- echo '
49
- <div id="message" class="updated fade">
50
- <p style="line-height:1.4em">
51
- ';
52
- if ( $this->register_message == "" || strpos( $this->register_message, "%1" ) === false ) {
53
- echo '
54
- <strong>Please consider <a href="plugins.php?paged=' . @$_GET["paged"] . '&amp;' . $this->slug . '=register">registering your use of ' . $this->name . '</a></strong> to tell <a href="' . $this->homepage . '">' . $this->developer . ' (the plugin maker)</a> you are using it. This sends only your site name and URL to ' . $this->developer . ' so they know where their plugin is being used. No other data is sent.';
55
-
56
- } else {
57
- echo str_replace( "%1", "plugins.php?paged=" . @$_GET["paged"] . "&amp;" . $this->slug . "=register", $this->register_message );
58
- }
59
- echo '
60
- </p>
61
- </div>';
62
- }
63
- if ( isset( $_GET[$this->slug] ) && $_GET[$this->slug] == "register" ) {
64
- $site = get_option( "blogname" );
65
- $url = get_option( "siteurl" );
66
- $register_url = trim( $this->homepage, "/" ) . "/?plugin=" . urlencode( $this->name ) . "&version=" . urlencode( $this->version ) . "&site=" . urlencode( $site ) . "&url=" . urlencode( $url );
67
- wp_remote_fopen( $register_url );
68
- echo '
69
- <div id="message" class="updated fade">
70
- <p>';
71
- if ( $this->thanks_message == "" ) {
72
- echo '
73
- <strong>Thank you for registering ' . $this->name . '.</strong>
74
- ';
75
- } else {
76
- echo $this->thanks_message;
77
- }
78
- echo '
79
- </p>
80
- </div>
81
- ';
82
- }
83
- }
84
- }
85
- }
86
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,47 +1,46 @@
1
- === Check Email ===
2
- Contributors: mrwiblog
3
- Donate link: http://www.stillbreathing.co.uk/donate/
4
- Tags: check, test, email, smtp, pop, send, delivery
5
- Requires at least: 2.7
6
- Tested up to: 5.3.2
7
- Stable tag: 0.5.7
8
-
9
- Check email allows you to test if your WordPress installation is sending emails correctly by sending a test email to an address of your choice. Allows overriding of email headers and carbon copying to another address.
10
-
11
- == Description ==
12
-
13
- Don't know if your WordPress installation is sending emails? Use this simple plugin to find out. It will send a simple test email to an email address of your choice, and to help troubleshoot any problems you can also override the custom headers wth your own values.
14
-
15
- The link to access the tool is in the "Tools" menu.
16
-
17
- == Installation ==
18
-
19
- Install the plugin from the plugin repository and activate.
20
-
21
- == Frequently Asked Questions ==
22
-
23
- = How do I use it? =
24
-
25
- The link to access the tool is in the "Tools" menu.
26
-
27
- = Why did you write this plugin? =
28
-
29
- Someone using one of my other plugins had trouble with emails not being sent. I knocked this together to help him (and anyone else).
30
-
31
- == Changelog ==
32
-
33
- 0.5.7 Added support for the wp_mail_from filter
34
- 0.5.6 Tested with WordPress 5.1.1
35
- 0.5.5 Fixed typo (sorry sorry sorry)
36
- 0.5.4 Added FAQ about the location of the tool in the WordPress admin area
37
- 0.5.3 Fixed deprecation error messages. Tested with 4.7.2.
38
- 0.5.2 Fixed un-encoded output related to XSS bug
39
- 0.5.1 Properly fixed XSS vulnerability (apologies)
40
- 0.5 Fixed XSS vulnerability found by Antonis Manaras
41
- 0.4 Added more information from php.ini, fixed incorrect textdomains
42
- 0.3 Moved the page to the Tools menu
43
- 0.2 Now displays SMTP server name
44
- 0.1.3 Fixed version number
45
- 0.1.2 Fixed bug in Plugin Register caused by latest version of WordPress
46
- 0.1.1 Fixed typo in plugin name
47
  0.1 Initial version
1
+ === Check Email ===
2
+ Contributors: machothemes, silkalns, giucu91
3
+ Tags: check, test, email, smtp, pop, send, delivery
4
+ Requires at least: 2.7
5
+ Tested up to: 5.4
6
+ Stable tag: 0.6.0
7
+
8
+ Check email allows you to test if your WordPress installation is sending emails correctly by sending a test email to an address of your choice. Allows overriding of email headers and carbon copying to another address.
9
+
10
+ == Description ==
11
+
12
+ Don't know if your WordPress installation is sending emails? Use this simple plugin to find out. It will send a simple test email to an email address of your choice, and to help troubleshoot any problems you can also override the custom headers wth your own values.
13
+
14
+ The link to access the tool is in the "Tools" menu.
15
+
16
+ == Installation ==
17
+
18
+ Install the plugin from the plugin repository and activate.
19
+
20
+ == Frequently Asked Questions ==
21
+
22
+ = How do I use it? =
23
+
24
+ The link to access the tool is in the "Tools" menu.
25
+
26
+ = Why did you write this plugin? =
27
+
28
+ Someone using one of my other plugins had trouble with emails not being sent. I knocked this together to help him (and anyone else).
29
+
30
+ == Changelog ==
31
+ 0.6.0 Fixed loopback error.
32
+ 0.5.7 Added support for the wp_mail_from filter
33
+ 0.5.6 Tested with WordPress 5.1.1
34
+ 0.5.5 Fixed typo (sorry sorry sorry)
35
+ 0.5.4 Added FAQ about the location of the tool in the WordPress admin area
36
+ 0.5.3 Fixed deprecation error messages. Tested with 4.7.2.
37
+ 0.5.2 Fixed un-encoded output related to XSS bug
38
+ 0.5.1 Properly fixed XSS vulnerability (apologies)
39
+ 0.5 Fixed XSS vulnerability found by Antonis Manaras
40
+ 0.4 Added more information from php.ini, fixed incorrect textdomains
41
+ 0.3 Moved the page to the Tools menu
42
+ 0.2 Now displays SMTP server name
43
+ 0.1.3 Fixed version number
44
+ 0.1.2 Fixed bug in Plugin Register caused by latest version of WordPress
45
+ 0.1.1 Fixed typo in plugin name
 
46
  0.1 Initial version