PluginProbe
Easy Basic Authentication – Add basic auth to site or admin area / 2
Easy Basic Authentication – Add basic auth to site or admin area v2
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 +11 -14 trunk2 View file →
@@ -10,34 +10,31 @@
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 -
18 17 $message = '<html><body>';
19 - $message .= '<p>' . __('Hi', 'easy-basic-authentication') . ',</p>';
18 + $message .= '<p>' . __('Hi', 'easy-basic-authentication') . '</p>';
20 19 $message .= '<p>' . __('New access attempt detected:', 'easy-basic-authentication') . '</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>';
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>';
26 25 $message .= '<p>' . __('All text of the call:', 'easy-basic-authentication') . '</p>';
27 - $message .= '<pre style="font-size: 0.8em; background-color: #f8f8f8; padding: 10px;">' . esc_html(wp_json_encode($access, JSON_PRETTY_PRINT)) . '</pre>';
26 + $message .= '<p style="font-size: 0.8em">' . wp_json_encode($access) . '</p>';
28 27 $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>';
29 28 $message .= '</body></html>';
30 -
29 +
31 30 $site_email = get_option('admin_email');
32 -
31 +
33 32 $headers = array(
34 33 'Content-Type: text/html; charset=UTF-8',
35 34 'From: ' . $site_email,
36 35 );
37 -
38 - // Invio dell'email
36 +
39 37 wp_mail($to, $subject, $message, $headers);
40 38 }
41 -
42 39
43 40 }