PluginProbe ʕ •ᴥ•ʔ
Check & Log Email – Easy Email Testing & Mail logging / 2.0.6
Check & Log Email – Easy Email Testing & Mail logging v2.0.6
2.0.15 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 2.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.13.1 2.0.13.2 2.0.14 2.0.2 2.0.3 2.0.4 2.0.5 2.0.5.1 2.0.6 2.0.7 2.0.8 2.0.9 trunk 0.5.7 0.6.0 0.6.1 0.6.2 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.12.1 1.0.13 1.0.13.1 1.0.2 1.0.3
check-email / include / Core / UI / Page / Check_Email_Analyzer.php
check-email / include / Core / UI / Page Last commit date
partials 1 year ago Check_Email_Analyzer.php 1 year ago Check_Email_BasePage.php 1 year ago Check_Email_Dashboard.php 1 year ago Check_Email_Error_Tracker_list.php 1 year ago Check_Email_Log_List_Page.php 1 year ago Check_Email_Settings_Page.php 1 year ago Check_Email_Status_Page.php 1 year ago Check_Email_Wizard_Page.php 1 year ago
Check_Email_Analyzer.php
459 lines
1 <?php
2
3 namespace CheckEmail\Core\UI\Page;
4
5 defined('ABSPATH') || exit; // Exit if accessed directly.
6
7 class Check_Email_Analyzer extends Check_Email_BasePage {
8
9 /**
10 * Page slug.
11 */
12 const PAGE_SLUG = 'spam-analyzer';
13 const DASHBOARD_SLUG = 'check-email-dashboard';
14
15
16
17 /**
18 * Specify additional hooks.
19 *
20 * @inheritdoc
21 */
22 public function load()
23 {
24 parent::load();
25 add_action('admin_enqueue_scripts', array($this, 'checkemail_assets'));
26 add_action('init', array($this, 'checkmail_load_table'));
27 }
28 public function register_page() {
29 $this->page = add_submenu_page(
30 Check_Email_Status_Page::PAGE_SLUG,
31 esc_html__('Spam Analyzer', 'check-email'),
32 esc_html__('Spam Analyzer', 'check-email'),
33 'manage_check_email',
34 self::PAGE_SLUG,
35 array($this, 'render_page'),
36 2
37 );
38 }
39 public function checkmail_load_table() {
40 if (function_exists('ck_mail_create_spam_analyzer_table') ) {
41 ck_mail_create_spam_analyzer_table();
42 }
43 }
44
45 public function render_page() {
46 ?>
47 <div class="wrap">
48 <?php
49 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information but only loading it inside the admin_init hook.
50 if (isset($_GET['view-detail'])) {
51 $current_user = wp_get_current_user();
52 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- not processing data
53 $detail_id = sanitize_text_field( wp_unslash( $_GET['view-detail'] ) );
54 global $wpdb;
55 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
56 $table_name = $wpdb->prefix . 'check_email_spam_analyzer';
57 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
58 $results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$table_name} WHERE ID = %d", $detail_id ), ARRAY_A );
59
60 $wrong_icon_svg = '<svg viewBox="0 0 32 32" height="50px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <title>cross-circle</title> <desc>Created with Sketch Beta.</desc> <defs> </defs> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <g id="Icon-Set-Filled" sketch:type="MSLayerGroup" transform="translate(-570.000000, -1089.000000)" fill="#fa0000"> <path d="M591.657,1109.24 C592.048,1109.63 592.048,1110.27 591.657,1110.66 C591.267,1111.05 590.633,1111.05 590.242,1110.66 L586.006,1106.42 L581.74,1110.69 C581.346,1111.08 580.708,1111.08 580.314,1110.69 C579.921,1110.29 579.921,1109.65 580.314,1109.26 L584.58,1104.99 L580.344,1100.76 C579.953,1100.37 579.953,1099.73 580.344,1099.34 C580.733,1098.95 581.367,1098.95 581.758,1099.34 L585.994,1103.58 L590.292,1099.28 C590.686,1098.89 591.323,1098.89 591.717,1099.28 C592.11,1099.68 592.11,1100.31 591.717,1100.71 L587.42,1105.01 L591.657,1109.24 L591.657,1109.24 Z M586,1089 C577.163,1089 570,1096.16 570,1105 C570,1113.84 577.163,1121 586,1121 C594.837,1121 602,1113.84 602,1105 C602,1096.16 594.837,1089 586,1089 L586,1089 Z" id="cross-circle" sketch:type="MSShapeGroup"> </path> </g> </g> </g></svg>';
61
62 $yes_icon_svg = '<svg viewBox="0 0 32 32" height="50px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <title>checkmark-circle</title> <desc>Created with Sketch Beta.</desc> <defs> </defs> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <g id="Icon-Set-Filled" sketch:type="MSLayerGroup" transform="translate(-102.000000, -1141.000000)" fill="#038608"> <path d="M124.393,1151.43 C124.393,1151.43 117.335,1163.73 117.213,1163.84 C116.81,1164.22 116.177,1164.2 115.8,1163.8 L111.228,1159.58 C110.85,1159.18 110.871,1158.54 111.274,1158.17 C111.677,1157.79 112.31,1157.81 112.688,1158.21 L116.266,1161.51 L122.661,1150.43 C122.937,1149.96 123.548,1149.79 124.027,1150.07 C124.505,1150.34 124.669,1150.96 124.393,1151.43 L124.393,1151.43 Z M118,1141 C109.164,1141 102,1148.16 102,1157 C102,1165.84 109.164,1173 118,1173 C126.836,1173 134,1165.84 134,1157 C134,1148.16 126.836,1141 118,1141 L118,1141 Z" id="checkmark-circle" sketch:type="MSShapeGroup"> </path> </g> </g> </g></svg>';
63
64
65 $warning_icon_svg = '<svg viewBox="0 0 16 16" height="50px" xmlns="http://www.w3.org/2000/svg" fill="none"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path fill="#f9bc39" fill-rule="evenodd" d="M0 8a8 8 0 1116 0A8 8 0 010 8zm8-4a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 018 4zm0 6a1 1 0 100 2h.007a1 1 0 100-2H8z" clip-rule="evenodd"></path></g></svg>';
66
67 if (!empty($results)) {
68 $results = $results[0];
69 $final_score = $results['final_score'];
70 $html_content = json_decode($results['html_content'],true);
71 $spam_assassin = json_decode($results['spam_assassin'],true);
72 $authenticated = json_decode($results['authenticated'],true);
73 $block_listed = json_decode($results['block_listed'],true);
74 $broken_links = json_decode($results['broken_links'],true);
75
76 if ($spam_assassin['spam_final_score'] > 1.5) {
77 $spam_icon = $yes_icon_svg;
78 $spam_text = esc_html__("SpamAssassin likes you", 'check-email');
79 } else if ($spam_assassin['spam_final_score'] > 0 && $spam_assassin['spam_final_score'] <= 1.5) {
80 $spam_icon = $warning_icon_svg;
81 $spam_text = esc_html__("SpamAssassin warned you to", 'check-email').' <strong>'.esc_html__("improve", 'check-email').'</strong> '.esc_html__("your spam score", 'check-email');
82 } else{
83 $spam_icon = $wrong_icon_svg;
84 $spam_text = esc_html__("SpamAssassin", 'check-email')." <strong>don't</strong> ".esc_html__("likes you", 'check-email');
85 }
86
87 if ($authenticated['auth_final_score'] > 1.5) {
88 $auth_icon = $yes_icon_svg;
89 $auth_text = esc_html__("You're properly authenticated", 'check-email');
90 } else if ($authenticated['auth_final_score'] > 0 && $authenticated['auth_final_score'] <= 1.5) {
91 $auth_icon = $warning_icon_svg;
92 $auth_text = esc_html__("You're", 'check-email').'<strong> '.esc_html__("not", 'check-email').' </strong>'.esc_html__("properly authenticated need some improvement", 'check-email');
93 } else{
94 $auth_icon = $wrong_icon_svg;
95 $auth_text = esc_html__("You're", 'check-email').'<strong> '.esc_html__("not", 'check-email').'</strong> '.esc_html__("properly authenticated", 'check-email');
96 }
97
98 if ($block_listed['block_final_score'] > 1.5) {
99 $block_icon = $yes_icon_svg;
100 $block_text = esc_html__("You're not", 'check-email').'<strong> '.esc_html__("blocklisted", 'check-email').' </strong>';
101 } else if ($block_listed['block_final_score'] > 0 && $block_listed['block_final_score'] <= 1.5) {
102 $block_icon = $warning_icon_svg;
103 $block_text = esc_html__("You're", 'check-email').'<strong> '.esc_html__("blocklisted", 'check-email').' </strong>'.esc_html__(" need some improvement", 'check-email');
104 } else{
105 $block_icon = $wrong_icon_svg;
106 $block_text = esc_html__("You're", 'check-email').'<strong> '.esc_html__("blocklisted", 'check-email').' </strong>';
107 }
108
109 if ($broken_links['link_final_score'] == 2.5) {
110 $link_icon = $yes_icon_svg;
111 $link_text = esc_html__("No broken links", 'check-email');
112 } else{
113 $link_icon = $wrong_icon_svg;
114 $link_text = '<strong> '.esc_html__("Found", 'check-email').' </strong>'.esc_html__("broken links", 'check-email');
115 }
116 $final_score_text = esc_html__('Wow! Perfect', 'check-email');
117 if ($final_score == 10) {
118 $final_score_text = esc_html__("Hey you need to improve", 'check-email');
119 $final_score_color = "#038608";
120 }else if ($final_score == 9) {
121 $final_score_text = esc_html__("Good", 'check-email');
122 $final_score_color = "#038608";
123 }else if ($final_score < 9 && $final_score > 5) {
124 $final_score_text = esc_html__("Need Improvement", 'check-email');
125 $final_score_color = "#f9bc39";
126 } else if ($final_score <= 5) {
127 $final_score_text = esc_html__("Need Fixing Urgently", 'check-email');
128 $final_score_color = "#fa0000";
129 }
130 ?>
131 <div class="ck_banner">
132 <h1><?php esc_html_e('Email Spam Testing of your mail for accurate delivery', 'check-email'); ?></h1>
133 <h2 class="ck_score_cls" id="ck_score_text"> <?php echo esc_html($final_score_text); ?></h2>
134 <div class="ck_score ck_score_cls" style="background-color:<?php echo esc_html($final_score_color); ?>"><?php echo esc_html($final_score) ?> / 10</div>
135 <div class="ck_loader" id="ck_loader"></div>
136 <p class="ck_sub"><?php esc_html_e('One of its kind FREE tool in WordPress', 'check-email'); ?></p>
137 <p class="ck_fun-fact"><?php esc_html_e("Fun fact: Did you know that 70% of the emails don't get visibility because of the wrong configuration.", 'check-email'); ?></p>
138 </div>
139 <div id="ck_email_analyze_result" style="margin-top:50px;">
140 <div class="ck-accordion">
141 <div class="ck-accordion-header" onclick="ck_toggleAccordion(this)">
142 <div class="ck_icon_with_text">
143 <span class=""><?php
144 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
145 echo $yes_icon_svg; ?></span>
146 <span class="ck_header_span"><?php esc_html_e('Click here to view your message', 'check-email'); ?></span>
147 </div>
148 </div>
149 <div class="ck-accordion-content">
150 <p><strong><?php esc_html_e('From', 'check-email'); ?> : </strong><?php echo esc_html($html_content['from']); ?></p>
151 <p><strong><?php esc_html_e('Email', 'check-email'); ?> : </strong><?php echo esc_html($html_content['email']); ?></p>
152 <p><strong><?php esc_html_e('Subject', 'check-email'); ?> : </strong><?php echo esc_html($html_content['subject']); ?></p>
153 <p><strong><?php esc_html_e('Date', 'check-email'); ?> : </strong><?php echo esc_html($html_content['date']); ?></p>
154
155 <!-- Child Accordion -->
156 <div class="ck-child-accordion">
157 <div class="ck-child-accordion-header" onclick="ck_toggleAccordion(this)">
158 <?php esc_html_e('HTML version', 'check-email'); ?>
159 </div>
160 <div class="ck-child-accordion-content">
161 <p><?php
162 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
163 echo $html_content['body']; ?></p>
164 </div>
165 </div>
166 <div class="ck-child-accordion">
167 <div class="ck-child-accordion-header" onclick="ck_toggleAccordion(this)">
168 <?php esc_html_e('Text version', 'check-email'); ?>
169 </div>
170 <div class="ck-child-accordion-content">
171 <p><pre><?php
172 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
173 echo $html_content['body']; ?></pre></p>
174 </div>
175 </div>
176 <div class="ck-child-accordion">
177 <div class="ck-child-accordion-header" onclick="ck_toggleAccordion(this)">
178 <?php esc_html_e('Source', 'check-email'); ?>
179 </div>
180 <div class="ck-child-accordion-content">
181 <p><pre><?php echo
182 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
183 $html_content['source']; ?></pre></p>
184 </div>
185 </div>
186 </div>
187 </div>
188
189 <div class="ck-accordion">
190 <div class="ck-accordion-header" onclick="ck_toggleAccordion(this)">
191 <div class="ck_icon_with_text">
192 <span class=""><?php
193 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
194 echo $spam_icon; ?></span>
195 <span class="ck_header_span"><?php echo
196 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
197 $spam_text; ?></span><span class="ck_score_span"><?php esc_html_e('Score', 'check-email'); ?> : <?php echo $spam_assassin['data']['score']; ?></span>
198 </div>
199 </div>
200 <div class="ck-accordion-content">
201 <p><i><?php esc_html_e('The famous spam filter SpamAssassin.', 'check-email'); ?> </i> <strong><?php esc_html_e('Score', 'check-email'); ?>:<?php echo esc_html($spam_assassin['data']['score']); ?></strong></p>
202 <p><i><?php esc_html_e('A score below -5 is considered spam.', 'check-email'); ?></i></p><hr/><p><pre><?php
203 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
204 echo $spam_assassin['data']['report']; ?></pre></p>
205 </div>
206 </div>
207 <div class="ck-accordion">
208 <div class="ck-accordion-header" onclick="ck_toggleAccordion(this)">
209 <div class="ck_icon_with_text"><span class=""><?php
210 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
211 echo $yes_icon_svg ; ?></span>
212 <span class="ck_header_span"><?php esc_html_e('Email validation result', 'check-email'); ?></span>
213 </div>
214 </div>
215 <div class="ck-accordion-content">
216 <?php
217 $email_result = ck_email_verify( $current_user->user_email);
218 if ($email_result['email_valid']) {
219 ?>
220 <div class="ck-card">
221 <h4><?php esc_html_e('Format', 'check-email'); ?> <span class="ck-status"><?php esc_html_e('Valid', 'check-email'); ?></span></h4>
222 <p><?php esc_html_e('This email address has the correct format and is not gibberish.', 'check-email'); ?></p>
223 </div>
224 <?php
225 }else{
226 ?> <div class="ck-card">
227 <h4><?php esc_html_e('Format', 'check-email'); ?> <span class="ck-status" style="background-color:pink;color:red;"><?php esc_html_e('Invalid', 'check-email'); ?></span></h4>
228 <p><?php esc_html_e('This email address is not correct.', 'check-email'); ?></p>
229 </div>
230 <?php
231 }
232 if ($email_result['email_valid']) {
233 ?>
234 <div class="ck-card">
235 <h4><?php esc_html_e('Type', 'check-email'); ?> <span class="ck-status" style="background-color: #cce5ff; color: #004085;"><?php esc_html_e('Professional', 'check-email'); ?></span></h4>
236 <p><?php esc_html_e('The domain name is not used for webmails or for creating temporary email addresses.', 'check-email'); ?></p>
237 </div>
238 <?php
239 }
240 if ($email_result['dns_valid']) {
241 ?>
242 <div class="ck-card">
243 <h4><?php esc_html_e('Server status', 'check-email'); ?> <span class="ck-status"><?php esc_html_e('Valid', 'check-email'); ?></span></h4>
244 <p><?php esc_html_e('MX records are present for the domain and we can connect to the SMTP server these MX records point to.', 'check-email'); ?></p>
245 </div>
246 <?php
247 }else{
248 ?>
249 <div class="ck-card">
250 <h4><?php esc_html_e('Server status <span class="ck-status" style="background-color:pink;color:red">Invalid', 'check-email'); ?></span></h4>
251 <p><?php esc_html_e('MX records are not present for the domain, or we cannot connect to the SMTP server', 'check-email'); ?></p>
252 </div>
253 <?php
254 }
255 if ($email_result['dns_valid']) {
256 ?>
257 <div class="ck-card">
258 <h4><?php esc_html_e('Email status', 'check-email'); ?><span class="ck-status"><?php esc_html_e('Valid', 'check-email'); ?></span></h4>
259 <p><?php esc_html_e('This email address exists and can receive emails.', 'check-email'); ?></p>
260 </div>
261 <?php
262 }else{
263 ?>
264 <div class="ck-card">
265 <h4><?php esc_html_e('Email status', 'check-email'); ?><span class="ck-status" style="background-color:pink;color:red"><?php esc_html_e('Invalid', 'check-email'); ?></span></h4>
266 <p><?php esc_html_e('This email address can not receive emails.', 'check-email'); ?></p>
267 </div>
268 <?php
269 } ?>
270 </div>
271 </div>
272 <div class="ck-accordion">
273 <div class="ck-accordion-header" onclick="ck_toggleAccordion(this)">
274 <div class="ck_icon_with_text">
275 <span class=""><?php
276 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
277 echo $auth_icon; ?></span>
278 <span class="ck_header_span"><?php
279 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
280 echo $auth_text;
281 ?></span>
282 </div>
283 </div>
284 <div class="ck-accordion-content">
285 <?php
286 $vulns = [];
287 foreach ($authenticated['data'] as $key => $value) {
288 $style = '';
289 if( ! $value['status'] ){
290 $vulns[] = $key;
291 $style ='background-color:pink;color:red;';
292 }
293 ?>
294 <div class="ck-card">
295 <h4><span class="ck-status" style="<?php echo esc_attr($style); ?>"><?php echo esc_html($key); ?></span></h4>
296 <p style="color:blue; overflow-wrap:break-word;"><?php echo esc_html($value['message']); ?></p>
297 </div>
298 <?php
299 }
300 if($vulns){
301 ?>
302 <div class="ck-card">
303 <h4>
304 <?php esc_html_e('Summary', 'check-email'); ?>
305 <?php
306 foreach ($vulns as $key => $vuln) {
307 ?><span class="ck-status" style="background-color:pink;color:red;"><?php echo esc_html($vuln); ?></span>
308 <?php
309 }
310 ?></h4>
311 <p style="color:red; overflow-wrap: break-word;"><strong><?php esc_html_e('Vulnerabilities detected', 'check-email'); ?> :</strong><?php esc_html_e('Recommendation: Address the identified vulnerabilities to improve DNS security.', 'check-email'); ?></p>
312 </div>
313 <?php
314 }
315 ?>
316 </div>
317 </div>
318
319 <div class="ck-accordion">
320 <div class="ck-accordion-header" onclick="ck_toggleAccordion(this)">
321 <div class="ck_icon_with_text">
322 <span class=""><?php
323 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
324 echo $block_icon; ?></span>
325 <span class="ck_header_span"><?php
326 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
327 echo $block_text; ?></span>
328 </div>
329 </div>
330 <div class="ck-accordion-content"><i><strong><?php esc_html_e('Matches your server IP address', 'check-email'); ?> <?php
331 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated
332 echo esc_html(sanitize_text_field( wp_unslash($_SERVER['SERVER_ADDR']) ) ); ?> <?php esc_html_e('against 24 of the most common IPv4 blocklists.', 'check-email'); ?></strong></i><hr/>
333 <?php
334 $vulns = [];
335 foreach ($block_listed['data'] as $key => $value) {
336 if ( $value['status']) { ?>
337 <div class="ck-card" style="display:inline-flex; margin:5px; padding:5px; width:30%;"><h4><span class="ck-status" style="color:red; background-color:pink;"><?php esc_html_e('Listed', 'check-email'); ?> : <?php echo esc_html($value['ip']); ?></span></h4></div>
338 <?php
339 }else{ ?>
340 <div class="ck-card" style="margin:5px; padding:5px;display:inline-flex; width:30%;">
341 <h4>
342 <span class="ck-status" style="color:green;"><?php esc_html_e('Not Listed', 'check-email'); ?> : <?php echo esc_html($value['ip']); ?></span>
343 </h4>
344 </div>
345 <?php
346 }
347 } ?>
348 </div>
349 </div>
350
351 <div class="ck-accordion">
352 <div class="ck-accordion-header" onclick="ck_toggleAccordion(this)">
353 <div class="ck_icon_with_text">
354 <span class=""><?php
355 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
356 echo $link_icon; ?></span>
357 <span class="ck_header_span"><?php
358 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
359 echo $link_text; ?></span>
360 </div>
361 </div>
362 <div class="ck-accordion-content"><i><strong><?php esc_html_e('Checks if your email contains broken links.', 'check-email'); ?></strong></i><hr/>
363 <?php
364 $vulns = [];
365 foreach ($broken_links['data'] as $key => $value) {
366 ?>
367 <p><strong><?php esc_html_e('Status', 'check-email'); ?>: <?php echo esc_html($value['status']); ?></strong> <?php echo esc_html($value['link']); ?></p>
368 <?php
369 }
370 ?>
371 </div>
372 </div>
373 </div>
374 <?php
375 } else {
376 echo '<p>' . esc_html__('Details not found.', 'check-email') . '</p>';
377 }
378 } else {
379
380 $current_user = wp_get_current_user();
381 global $wpdb;
382 $table_name = $wpdb->prefix . 'check_email_spam_analyzer';
383 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
384 $results = $wpdb->get_results( "SELECT * FROM {$table_name}", ARRAY_A );
385 ?>
386 <div class="ck_banner">
387 <h1><?php esc_html_e('Email Spam Testing of your mail for accurate delivery', 'check-email'); ?></h1>
388 <button class="ck_button" id="ck_email_analyze"><?php esc_html_e('Check My Email Spam Score', 'check-email'); ?></button>
389 <h2 class="ck_score_cls" style="display:none;" id="ck_score_text"></h2>
390 <div class="ck_score ck_score_cls" style="display:none;"></div>
391 <div class="ck_loader" id="ck_loader"></div>
392 <p class="ck_sub"><?php esc_html_e('One of its kind FREE tool in WordPress', 'check-email'); ?></p>
393 <p class="ck_fun-fact"><?php esc_html_e("Fun fact: Did you know that 70% of the emails don't get visibility because of the wrong configuration.", 'check-email'); ?></p>
394 </div>
395 <div id="ck_email_analyze_result" style="margin-top:50px;"></div>
396 <div class="wp-table-wrapper" style="overflow-x:auto; margin: 20px 0;">
397 <h1><?php esc_html_e('Previous Spam Score', 'check-email'); ?></h1>
398 <table style="width: 100%; border-collapse: collapse; border: 1px solid #ddd; text-align: center;">
399 <thead>
400 <tr style="background-color: #f9f9f9;">
401 <th style="padding: 10px; border: 1px solid #ddd;"><?php esc_html_e('Score', 'check-email'); ?></th>
402 <th style="padding: 10px; border: 1px solid #ddd;"><?php esc_html_e('Date', 'check-email'); ?></th>
403 <th style="padding: 10px; border: 1px solid #ddd;"><?php esc_html_e('Action', 'check-email'); ?></th>
404 </tr>
405 </thead>
406 <tbody>
407 <?php
408 if (!empty($results)) {
409 foreach ($results as $key => $value) {
410 $timestamp = strtotime($value['test_date']);
411 ?>
412 <tr>
413 <td style="padding: 10px; border: 1px solid #ddd;"><?php echo esc_html($value['final_score']); ?></td>
414 <td style="padding: 10px; border: 1px solid #ddd;"><?php echo esc_html(gmdate('d M Y, g A', $timestamp)); ?></td>
415 <td style="padding: 10px; border: 1px solid #ddd;">
416 <a href="<?php echo esc_url(add_query_arg('view-detail', $value['id'])); ?>" class="button"><?php esc_html_e('View Details', 'check-email'); ?></a>
417 </td>
418 </tr>
419 <?php
420 }
421 } else {
422 ?>
423 <tr>
424 <td style="padding: 10px; border: 1px solid #ddd;" colspan="3"><?php esc_html_e('No score found', 'check-email'); ?></td>
425 </tr>
426 <?php
427 }
428 ?>
429 </tbody>
430 </table>
431 </div>
432 <?php
433 }
434 ?>
435 <script>
436 function ck_toggleAccordion(element) {
437 const accordion = element.parentElement;
438 accordion.classList.toggle('active');
439 }
440 </script>
441 </div>
442 <?php
443 }
444
445
446 public function checkemail_assets() {
447 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
448 $check_email = wpchill_check_email();
449 $plugin_dir_url = plugin_dir_url($check_email->get_plugin_file());
450 wp_enqueue_style('checkemail-css', $plugin_dir_url . 'assets/css/admin/checkemail' . $suffix . '.css', array(), $check_email->get_version());
451 wp_enqueue_script('checkemail', $plugin_dir_url . 'assets/js/admin/checkemail' . $suffix . '.js', array('jquery', 'updates'), $check_email->get_version(), true);
452
453 $data['ajax_url'] = admin_url('admin-ajax.php');
454 $data['ck_mail_security_nonce'] = wp_create_nonce('ck_mail_security_nonce');
455
456 wp_localize_script('checkemail', 'checkemail_data', $data);
457 }
458 }
459