PluginProbe
Easy Basic Authentication – Add basic auth to site or admin area / 3.0
Easy Basic Authentication – Add basic auth to site or admin area v3.0
trunk 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4 1.4.1 1.5 1.5.1 1.5.2 1.5.3 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.7 1.7.1 1.8 1.8.1 1.9 All 50 releases
← All changes | class/easy-basic-authentication-emailalert-class.php +14 -11 1.73.0 View file →
@@ -10,31 +10,34 @@
10 10 public function is_enabled() {
11 11 return get_option( 'basic_auth_plugin_alert_enable' )&&filter_var(get_option( 'basic_auth_plugin_alertemail' ), FILTER_VALIDATE_EMAIL);
12 12 }
13 13
14 - public function sendAlert($access){
14 + public function sendAlert($access) {
15 15 $to = get_option('basic_auth_plugin_alertemail');
16 16 $subject = __('Access Attempt', 'easy-basic-authentication');
17 +
17 18 $message = '<html><body>';
18 - $message .= '<p>' . __('Hi', 'easy-basic-authentication') . '</p>';
19 + $message .= '<p>' . __('Hi', 'easy-basic-authentication') . ',</p>';
19 20 $message .= '<p>' . __('New access attempt detected:', 'easy-basic-authentication') . '</p>';
20 - $message .= '<p><ul>
21 - <li>ip: '.esc_attr($access['REMOTE_ADDR']).'</li>
22 - <li>browser: '.esc_attr($access['HTTP_USER_AGENT']).'</li>
23 - <li>request_uri: '.esc_attr($access['REQUEST_URI']).'</li>
24 - </ul></p>';
21 + $message .= '<ul style="list-style-type: none; padding-left: 0;">';
22 + $message .= '<li><strong>' . __('IP:', 'easy-basic-authentication') . '</strong> ' . esc_attr($access['REMOTE_ADDR']) . '</li>';
23 + $message .= '<li><strong>' . __('Browser:', 'easy-basic-authentication') . '</strong> ' . esc_attr($access['HTTP_USER_AGENT']) . '</li>';
24 + $message .= '<li><strong>' . __('Request URI:', 'easy-basic-authentication') . '</strong> ' . esc_attr($access['REQUEST_URI']) . '</li>';
25 + $message .= '</ul>';
25 26 $message .= '<p>' . __('All text of the call:', 'easy-basic-authentication') . '</p>';
26 - $message .= '<p style="font-size: 0.8em">' . wp_json_encode($access) . '</p>';
27 + $message .= '<pre style="font-size: 0.8em; background-color: #f8f8f8; padding: 10px;">' . esc_html(wp_json_encode($access, JSON_PRETTY_PRINT)) . '</pre>';
27 28 $message .= '<p>' . __('You are receiving this email because you have installed Easy Basic Authentication on your website and enabled the email alert option.', 'easy-basic-authentication') . '</p>';
28 29 $message .= '</body></html>';
29 -
30 +
30 31 $site_email = get_option('admin_email');
31 -
32 +
32 33 $headers = array(
33 34 'Content-Type: text/html; charset=UTF-8',
34 35 'From: ' . $site_email,
35 36 );
36 -
37 +
38 + // Invio dell'email
37 39 wp_mail($to, $subject, $message, $headers);
38 40 }
41 +
39 42
40 43 }