PluginProbe ʕ •ᴥ•ʔ
Check & Log Email – Easy Email Testing & Mail logging / trunk
Check & Log Email – Easy Email Testing & Mail logging vtrunk
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 month ago Check_Email_Analyzer.php 1 month ago Check_Email_BasePage.php 1 month ago Check_Email_Dashboard.php 1 month ago Check_Email_Error_Tracker_list.php 1 month ago Check_Email_HelpSupport_Page.php 2 years ago Check_Email_Log_List_Page.php 1 month ago Check_Email_PremiumFeatures_Page.php 2 years ago Check_Email_Settings_Page.php 1 month ago Check_Email_Status_Page.php 1 month ago Check_Email_UpgradeToPro_Page.php 2 years ago Check_Email_Wizard_Page.php 1 month ago
Check_Email_Analyzer.php
468 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 add_action('admin_head', array($this,'ck_hide_annoying_notices_with_css'));
28 }
29
30 function ck_hide_annoying_notices_with_css() {
31 $screen = get_current_screen();
32 if (isset($screen->id) && $screen->id === 'check-log-email_page_spam-analyzer') {
33 echo '<style>.notice { display: none !important; }</style>';
34 }
35 }
36
37 public function register_page() {
38 $this->page = add_submenu_page(
39 Check_Email_Status_Page::PAGE_SLUG,
40 esc_html__('Spam Analyzer', 'check-email'),
41 esc_html__('Spam Analyzer', 'check-email'),
42 'manage_check_email',
43 self::PAGE_SLUG,
44 array($this, 'render_page'),
45 2
46 );
47 }
48 public function checkmail_load_table() {
49 if (function_exists('ck_mail_create_spam_analyzer_table') ) {
50 ck_mail_create_spam_analyzer_table();
51 }
52 }
53
54 public function render_page() {
55 ?>
56 <div class="wrap">
57 <?php
58 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information but only loading it inside the admin_init hook.
59 if (isset($_GET['view-detail'])) {
60 $current_user = wp_get_current_user();
61 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- not processing data
62 $detail_id = sanitize_text_field( wp_unslash( $_GET['view-detail'] ) );
63 global $wpdb;
64 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
65 $table_name = $wpdb->prefix . 'check_email_spam_analyzer';
66 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared,PluginCheck.Security.DirectDB.UnescapedDBParameter
67 $results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$table_name} WHERE ID = %d", $detail_id ), ARRAY_A );
68
69 $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>';
70
71 $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>';
72
73
74 $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>';
75
76 if (!empty($results)) {
77 $results = $results[0];
78 $final_score = $results['final_score'];
79 $html_content = json_decode($results['html_content'],true);
80 $spam_assassin = json_decode($results['spam_assassin'],true);
81 $authenticated = json_decode($results['authenticated'],true);
82 $block_listed = json_decode($results['block_listed'],true);
83 $broken_links = json_decode($results['broken_links'],true);
84
85 if ($spam_assassin['spam_final_score'] > 1.5) {
86 $spam_icon = $yes_icon_svg;
87 $spam_text = esc_html__("SpamAssassin likes you", 'check-email');
88 } else if ($spam_assassin['spam_final_score'] > 0 && $spam_assassin['spam_final_score'] <= 1.5) {
89 $spam_icon = $warning_icon_svg;
90 $spam_text = esc_html__("SpamAssassin warned you to", 'check-email').' <strong>'.esc_html__("improve", 'check-email').'</strong> '.esc_html__("your spam score", 'check-email');
91 } else{
92 $spam_icon = $wrong_icon_svg;
93 $spam_text = esc_html__("SpamAssassin", 'check-email')." <strong>don't</strong> ".esc_html__("likes you", 'check-email');
94 }
95
96 if ($authenticated['auth_final_score'] > 1.5) {
97 $auth_icon = $yes_icon_svg;
98 $auth_text = esc_html__("You're properly authenticated", 'check-email');
99 } else if ($authenticated['auth_final_score'] > 0 && $authenticated['auth_final_score'] <= 1.5) {
100 $auth_icon = $warning_icon_svg;
101 $auth_text = esc_html__("You're", 'check-email').'<strong> '.esc_html__("not", 'check-email').' </strong>'.esc_html__("properly authenticated need some improvement", 'check-email');
102 } else{
103 $auth_icon = $wrong_icon_svg;
104 $auth_text = esc_html__("You're", 'check-email').'<strong> '.esc_html__("not", 'check-email').'</strong> '.esc_html__("properly authenticated", 'check-email');
105 }
106
107 if ($block_listed['block_final_score'] > 1.5) {
108 $block_icon = $yes_icon_svg;
109 $block_text = esc_html__("You're not", 'check-email').'<strong> '.esc_html__("blocklisted", 'check-email').' </strong>';
110 } else if ($block_listed['block_final_score'] > 0 && $block_listed['block_final_score'] <= 1.5) {
111 $block_icon = $warning_icon_svg;
112 $block_text = esc_html__("You're", 'check-email').'<strong> '.esc_html__("blocklisted", 'check-email').' </strong>'.esc_html__(" need some improvement", 'check-email');
113 } else{
114 $block_icon = $wrong_icon_svg;
115 $block_text = esc_html__("You're", 'check-email').'<strong> '.esc_html__("blocklisted", 'check-email').' </strong>';
116 }
117
118 if ($broken_links['link_final_score'] == 2.5) {
119 $link_icon = $yes_icon_svg;
120 $link_text = esc_html__("No broken links", 'check-email');
121 } else{
122 $link_icon = $wrong_icon_svg;
123 $link_text = '<strong> '.esc_html__("Found", 'check-email').' </strong>'.esc_html__("broken links", 'check-email');
124 }
125 $final_score_text = esc_html__('Wow! Perfect', 'check-email');
126 if ($final_score == 10) {
127 $final_score_text = esc_html__("Hey you need to improve", 'check-email');
128 $final_score_color = "#038608";
129 }else if ($final_score == 9) {
130 $final_score_text = esc_html__("Good", 'check-email');
131 $final_score_color = "#038608";
132 }else if ($final_score < 9 && $final_score > 5) {
133 $final_score_text = esc_html__("Need Improvement", 'check-email');
134 $final_score_color = "#f9bc39";
135 } else if ($final_score <= 5) {
136 $final_score_text = esc_html__("Need Fixing Urgently", 'check-email');
137 $final_score_color = "#fa0000";
138 }
139 ?>
140 <div class="ck_banner">
141 <h1><?php esc_html_e('Email Spam Testing of your mail for accurate delivery', 'check-email'); ?></h1>
142 <h2 class="ck_score_cls" id="ck_score_text"> <?php echo esc_html($final_score_text); ?></h2>
143 <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>
144 <div class="ck_loader" id="ck_loader"></div>
145 <p class="ck_sub"><?php esc_html_e('One of its kind FREE tool in WordPress', 'check-email'); ?></p>
146 <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>
147 </div>
148 <div id="ck_email_analyze_result" style="margin-top:50px;">
149 <div class="ck-accordion">
150 <div class="ck-accordion-header" onclick="ck_toggleAccordion(this)">
151 <div class="ck_icon_with_text">
152 <span class=""><?php
153 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
154 echo $yes_icon_svg; ?></span>
155 <span class="ck_header_span"><?php esc_html_e('Click here to view your message', 'check-email'); ?></span>
156 </div>
157 </div>
158 <div class="ck-accordion-content">
159 <p><strong><?php esc_html_e('From', 'check-email'); ?> : </strong><?php echo esc_html($html_content['from']); ?></p>
160 <p><strong><?php esc_html_e('Email', 'check-email'); ?> : </strong><?php echo esc_html($html_content['email']); ?></p>
161 <p><strong><?php esc_html_e('Subject', 'check-email'); ?> : </strong><?php echo esc_html($html_content['subject']); ?></p>
162 <p><strong><?php esc_html_e('Date', 'check-email'); ?> : </strong><?php echo esc_html($html_content['date']); ?></p>
163
164 <!-- Child Accordion -->
165 <div class="ck-child-accordion">
166 <div class="ck-child-accordion-header" onclick="ck_toggleAccordion(this)">
167 <?php esc_html_e('HTML version', 'check-email'); ?>
168 </div>
169 <div class="ck-child-accordion-content">
170 <p><?php
171 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
172 echo $html_content['body']; ?></p>
173 </div>
174 </div>
175 <div class="ck-child-accordion">
176 <div class="ck-child-accordion-header" onclick="ck_toggleAccordion(this)">
177 <?php esc_html_e('Text version', 'check-email'); ?>
178 </div>
179 <div class="ck-child-accordion-content">
180 <p><pre><?php
181 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
182 echo $html_content['body']; ?></pre></p>
183 </div>
184 </div>
185 <div class="ck-child-accordion">
186 <div class="ck-child-accordion-header" onclick="ck_toggleAccordion(this)">
187 <?php esc_html_e('Source', 'check-email'); ?>
188 </div>
189 <div class="ck-child-accordion-content">
190 <p><pre><?php echo
191 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
192 $html_content['source']; ?></pre></p>
193 </div>
194 </div>
195 </div>
196 </div>
197
198 <div class="ck-accordion">
199 <div class="ck-accordion-header" onclick="ck_toggleAccordion(this)">
200 <div class="ck_icon_with_text">
201 <span class=""><?php
202 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
203 echo $spam_icon; ?></span>
204 <span class="ck_header_span"><?php echo
205 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
206 $spam_text; ?></span><span class="ck_score_span"><?php esc_html_e('Score', 'check-email'); ?> : <?php echo $spam_assassin['data']['score']; ?></span>
207 </div>
208 </div>
209 <div class="ck-accordion-content">
210 <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>
211 <p><i><?php esc_html_e('A score below -5 is considered spam.', 'check-email'); ?></i></p><hr/><p><pre><?php
212 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
213 echo $spam_assassin['data']['report']; ?></pre></p>
214 </div>
215 </div>
216 <div class="ck-accordion">
217 <div class="ck-accordion-header" onclick="ck_toggleAccordion(this)">
218 <div class="ck_icon_with_text"><span class=""><?php
219 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
220 echo $yes_icon_svg ; ?></span>
221 <span class="ck_header_span"><?php esc_html_e('Email validation result', 'check-email'); ?></span>
222 </div>
223 </div>
224 <div class="ck-accordion-content">
225 <?php
226 $email_result = ck_email_verify( $current_user->user_email);
227 if ($email_result['email_valid']) {
228 ?>
229 <div class="ck-card">
230 <h4><?php esc_html_e('Format', 'check-email'); ?> <span class="ck-status"><?php esc_html_e('Valid', 'check-email'); ?></span></h4>
231 <p><?php esc_html_e('This email address has the correct format and is not gibberish.', 'check-email'); ?></p>
232 </div>
233 <?php
234 }else{
235 ?> <div class="ck-card">
236 <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>
237 <p><?php esc_html_e('This email address is not correct.', 'check-email'); ?></p>
238 </div>
239 <?php
240 }
241 if ($email_result['email_valid']) {
242 ?>
243 <div class="ck-card">
244 <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>
245 <p><?php esc_html_e('The domain name is not used for webmails or for creating temporary email addresses.', 'check-email'); ?></p>
246 </div>
247 <?php
248 }
249 if ($email_result['dns_valid']) {
250 ?>
251 <div class="ck-card">
252 <h4><?php esc_html_e('Server status', 'check-email'); ?> <span class="ck-status"><?php esc_html_e('Valid', 'check-email'); ?></span></h4>
253 <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>
254 </div>
255 <?php
256 }else{
257 ?>
258 <div class="ck-card">
259 <h4><?php esc_html_e('Server status <span class="ck-status" style="background-color:pink;color:red">Invalid', 'check-email'); ?></span></h4>
260 <p><?php esc_html_e('MX records are not present for the domain, or we cannot connect to the SMTP server', 'check-email'); ?></p>
261 </div>
262 <?php
263 }
264 if ($email_result['dns_valid']) {
265 ?>
266 <div class="ck-card">
267 <h4><?php esc_html_e('Email status', 'check-email'); ?><span class="ck-status"><?php esc_html_e('Valid', 'check-email'); ?></span></h4>
268 <p><?php esc_html_e('This email address exists and can receive emails.', 'check-email'); ?></p>
269 </div>
270 <?php
271 }else{
272 ?>
273 <div class="ck-card">
274 <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>
275 <p><?php esc_html_e('This email address can not receive emails.', 'check-email'); ?></p>
276 </div>
277 <?php
278 } ?>
279 </div>
280 </div>
281 <div class="ck-accordion">
282 <div class="ck-accordion-header" onclick="ck_toggleAccordion(this)">
283 <div class="ck_icon_with_text">
284 <span class=""><?php
285 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
286 echo $auth_icon; ?></span>
287 <span class="ck_header_span"><?php
288 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
289 echo $auth_text;
290 ?></span>
291 </div>
292 </div>
293 <div class="ck-accordion-content">
294 <?php
295 $vulns = [];
296 foreach ($authenticated['data'] as $key => $value) {
297 $style = '';
298 if( ! $value['status'] ){
299 $vulns[] = $key;
300 $style ='background-color:pink;color:red;';
301 }
302 ?>
303 <div class="ck-card">
304 <h4><span class="ck-status" style="<?php echo esc_attr($style); ?>"><?php echo esc_html($key); ?></span></h4>
305 <p style="color:blue; overflow-wrap:break-word;"><?php echo esc_html($value['message']); ?></p>
306 </div>
307 <?php
308 }
309 if($vulns){
310 ?>
311 <div class="ck-card">
312 <h4>
313 <?php esc_html_e('Summary', 'check-email'); ?>
314 <?php
315 foreach ($vulns as $key => $vuln) {
316 ?><span class="ck-status" style="background-color:pink;color:red;"><?php echo esc_html($vuln); ?></span>
317 <?php
318 }
319 ?></h4>
320 <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>
321 </div>
322 <?php
323 }
324 ?>
325 </div>
326 </div>
327
328 <div class="ck-accordion">
329 <div class="ck-accordion-header" onclick="ck_toggleAccordion(this)">
330 <div class="ck_icon_with_text">
331 <span class=""><?php
332 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
333 echo $block_icon; ?></span>
334 <span class="ck_header_span"><?php
335 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
336 echo $block_text; ?></span>
337 </div>
338 </div>
339 <div class="ck-accordion-content"><i><strong><?php esc_html_e('Matches your server IP address', 'check-email'); ?> <?php
340 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated
341 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/>
342 <?php
343 $vulns = [];
344 foreach ($block_listed['data'] as $key => $value) {
345 if ( $value['status']) { ?>
346 <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>
347 <?php
348 }else{ ?>
349 <div class="ck-card" style="margin:5px; padding:5px;display:inline-flex; width:30%;">
350 <h4>
351 <span class="ck-status" style="color:green;"><?php esc_html_e('Not Listed', 'check-email'); ?> : <?php echo esc_html($value['ip']); ?></span>
352 </h4>
353 </div>
354 <?php
355 }
356 } ?>
357 </div>
358 </div>
359
360 <div class="ck-accordion">
361 <div class="ck-accordion-header" onclick="ck_toggleAccordion(this)">
362 <div class="ck_icon_with_text">
363 <span class=""><?php
364 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
365 echo $link_icon; ?></span>
366 <span class="ck_header_span"><?php
367 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Can not escap as its custom html var.
368 echo $link_text; ?></span>
369 </div>
370 </div>
371 <div class="ck-accordion-content"><i><strong><?php esc_html_e('Checks if your email contains broken links.', 'check-email'); ?></strong></i><hr/>
372 <?php
373 $vulns = [];
374 foreach ($broken_links['data'] as $key => $value) {
375 ?>
376 <p><strong><?php esc_html_e('Status', 'check-email'); ?>: <?php echo esc_html($value['status']); ?></strong> <?php echo esc_html($value['link']); ?></p>
377 <?php
378 }
379 ?>
380 </div>
381 </div>
382 </div>
383 <?php
384 } else {
385 echo '<p>' . esc_html__('Details not found.', 'check-email') . '</p>';
386 }
387 } else {
388
389 $current_user = wp_get_current_user();
390 global $wpdb;
391 $table_name = $wpdb->prefix . 'check_email_spam_analyzer';
392 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared,PluginCheck.Security.DirectDB.UnescapedDBParameter
393 $results = $wpdb->get_results( "SELECT * FROM {$table_name}", ARRAY_A );
394 ?>
395 <div class="ck_banner">
396 <h1><?php esc_html_e('Email Spam Testing of your mail for accurate delivery', 'check-email'); ?></h1>
397 <button class="ck_button" id="ck_email_analyze"><?php esc_html_e('Check My Email Spam Score', 'check-email'); ?></button>
398 <h2 class="ck_score_cls" style="display:none;" id="ck_score_text"></h2>
399 <div class="ck_score ck_score_cls" style="display:none;"></div>
400 <div class="ck_loader" id="ck_loader"></div>
401 <p class="ck_sub"><?php esc_html_e('One of its kind FREE tool in WordPress', 'check-email'); ?></p>
402 <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>
403 </div>
404 <div id="ck_email_analyze_result" style="margin-top:50px;"></div>
405 <div class="wp-table-wrapper" style="overflow-x:auto; margin: 20px 0;">
406 <h1><?php esc_html_e('Previous Spam Score', 'check-email'); ?></h1>
407 <table style="width: 100%; border-collapse: collapse; border: 1px solid #ddd; text-align: center;">
408 <thead>
409 <tr style="background-color: #f9f9f9;">
410 <th style="padding: 10px; border: 1px solid #ddd;"><?php esc_html_e('Score', 'check-email'); ?></th>
411 <th style="padding: 10px; border: 1px solid #ddd;"><?php esc_html_e('Date', 'check-email'); ?></th>
412 <th style="padding: 10px; border: 1px solid #ddd;"><?php esc_html_e('Action', 'check-email'); ?></th>
413 </tr>
414 </thead>
415 <tbody>
416 <?php
417 if (!empty($results)) {
418 foreach ($results as $key => $value) {
419 $timestamp = strtotime($value['test_date']);
420 ?>
421 <tr>
422 <td style="padding: 10px; border: 1px solid #ddd;"><?php echo esc_html($value['final_score']); ?></td>
423 <td style="padding: 10px; border: 1px solid #ddd;"><?php echo esc_html(gmdate('d M Y, g A', $timestamp)); ?></td>
424 <td style="padding: 10px; border: 1px solid #ddd;">
425 <a href="<?php echo esc_url(add_query_arg('view-detail', $value['id'])); ?>" class="button"><?php esc_html_e('View Details', 'check-email'); ?></a>
426 </td>
427 </tr>
428 <?php
429 }
430 } else {
431 ?>
432 <tr>
433 <td style="padding: 10px; border: 1px solid #ddd;" colspan="3"><?php esc_html_e('No score found', 'check-email'); ?></td>
434 </tr>
435 <?php
436 }
437 ?>
438 </tbody>
439 </table>
440 </div>
441 <?php
442 }
443 ?>
444 <script>
445 function ck_toggleAccordion(element) {
446 const accordion = element.parentElement;
447 accordion.classList.toggle('active');
448 }
449 </script>
450 </div>
451 <?php
452 }
453
454
455 public function checkemail_assets() {
456 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
457 $check_email = wpchill_check_email();
458 $plugin_dir_url = plugin_dir_url($check_email->get_plugin_file());
459 wp_enqueue_style('checkemail-css', $plugin_dir_url . 'assets/css/admin/checkemail' . $suffix . '.css', array(), $check_email->get_version());
460 wp_enqueue_script('checkemail', $plugin_dir_url . 'assets/js/admin/checkemail' . $suffix . '.js', array('jquery', 'updates'), $check_email->get_version(), true);
461
462 $data['ajax_url'] = admin_url('admin-ajax.php');
463 $data['ck_mail_security_nonce'] = wp_create_nonce('ck_mail_security_nonce');
464
465 wp_localize_script('checkemail', 'checkemail_data', $data);
466 }
467 }
468