C:\xampp\htdocs\landing\wp-content\plugins\better-wp-security\core\modules\file-change\logs.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php

final class ITSEC_File_Change_Logs {
    public function 
__construct() {
        
add_filter'itsec_logs_prepare_file_change_entry_for_list_display', array( $this'filter_entry_for_list_display' ), 10);
        
add_filter'itsec_logs_prepare_file_change_entry_for_details_display', array( $this'filter_entry_for_details_display' ), 10);
        
add_filter'itsec_highlighted_log_file-change-report_notice_title', array( $this'filter_highlight_title' ), 10);
        
add_filter'itsec_highlighted_log_file-change-report_notice_message', array( $this'filter_highlight_message' ), 10);
    }

    public function 
filter_entry_for_list_display$entry$code$code_data ) {
        
$entry['module_display'] = esc_html__'File Change''better-wp-security' );

        if ( 
'scan' === $code && 'process-start' === $entry['type'] ) {
            
$entry['description'] = esc_html__'Scan Performance''better-wp-security' );
        } elseif ( 
'no-changes-found' === $code ) {
            
$entry['description'] = esc_html__'No Changes Found''better-wp-security' );
        } elseif ( 
'changes-found' === $code ) {
            if ( isset( 
$code_data[0] ) ) {
                
$entry['description'] = sprintfesc_html__'%1$d Added, %2$d Removed, %3$d Changed''better-wp-security' ), $code_data[0], $code_data[1], $code_data[2] );
            } else {
                
$entry['description'] = esc_html__'Changes Found''better-wp-security' );
            }
        } elseif ( 
'skipping-recovery' === $code ) {
            
$code_specific = isset( $code_data[0] ) ? $code_data[0] : '';

            if ( 
'no-lock' === $code_specific ) {
                
$entry['description'] = esc_html__'Skipping Recovery: No Lock''better-wp-security' );
            } elseif ( 
'empty-storage' === $code_specific ) {
                
$entry['description'] = esc_html__'Skipping Recovery: No Lock''better-wp-security' );
            } else {
                
$entry['description'] = esc_html__'Skipping Recovery''better-wp-security' );
            }
        } elseif ( 
'attempting-recovery' === $code ) {
            if ( array( 
'no-job-step' ) === $code_data ) {
                
$entry['description'] = esc_html__'Attempting Recovery: Invalid Job''better-wp-security' );
            } else {
                
$entry['description'] = esc_html__'Attempting Recovery''better-wp-security' );
            }
        } elseif ( 
'recovery-failed-no-step' === $code ) {
            
$entry['description'] = esc_html__'Recovery Failed: No Step''better-wp-security' );
        } elseif ( 
'recovery-failed-too-many-retries' === $code ) {
            
$entry['description'] = esc_html__'Recovery Failed: Retry Limit''better-wp-security' );
        } elseif ( 
'recovery-failed-first-loop' === $code ) {
            
$entry['description'] = esc_html__'Recovery Failed: First Loop''better-wp-security' );
        } elseif ( 
'recovery-scheduled' === $code ) {
            
$entry['description'] = esc_html__'Recovery Scheduled''better-wp-security' );
        } elseif ( 
'file-scan-aborted' === $code ) {
            if ( ! empty( 
$code_data[0] ) ) {
                if ( 
$user get_userdata$code_data[0] ) ) {
                    
$by $user->display_name;
                } else {
                    
$by "#{$code_data[0]}";
                }

                
$entry['description'] = sprintfesc_html__'Scan Cancelled by %s''better-wp-security' ), $by );
            } else {
                
$entry['description'] = esc_html__'Scan Failed''better-wp-security' );
            }
        } elseif ( 
'rescheduling' === $code ) {
            if ( isset( 
$code_data[0] ) && 'no-lock' === $code_data[0] ) {
                
$entry['description'] = esc_html__'Rescheduling: No Lock''better-wp-security' );
            } else {
                
$entry['description'] = esc_html__'Rescheduling''better-wp-security' );
            }
        }

        
$entry['remote_ip'] = '';

        return 
$entry;
    }

    public function 
filter_entry_for_details_display$details$entry$code$code_data ) {
        
$entry $this->filter_entry_for_list_display$entry$code$code_data );

        
$details['module']['content']      = $entry['module_display'];
        
$details['description']['content'] = $entry['description'];

        if ( 
'changes-found' === $code || 'no-changes-found' === $code ) {
            
$details['memory'] = array(
                
'header'  => esc_html__'Memory Used''better-wp-security' ),
                
'content' => sprintfesc_html_x'%s MB''Megabytes of memory used''better-wp-security' ), $entry['data']['memory'] ),
            );

            if ( ! empty( 
$entry['data']['memory_peak'] ) ) {
                
$details['memory_total'] = array(
                    
'header'  => esc_html__'Total Memory''better-wp-security' ),
                    
'content' => sprintfesc_html_x'%s MB''Megabytes of memory used''better-wp-security' ), $entry['data']['memory_peak'] ),
                );
            }

            
$types = array(
                
'added'   => esc_html__'Added''better-wp-security' ),
                
'removed' => esc_html__'Removed''better-wp-security' ),
                
'changed' => esc_html__'Changed''better-wp-security' ),
            );

            foreach ( 
$types as $type => $header ) {
                
$details$type ] = array(
                    
'header'  => $header,
                    
'content' => '<pre>' implode"\n"array_keys$entry['data'][ $type ] ) ) . '</pre>',
                );
            }
        }

        unset( 
$details['host'] );

        return 
$details;
    }

    public function 
filter_highlight_title$title$entry ) {
        return 
esc_html__'iThemes Security noticed file changes in your WordPress site.''better-wp-security' );
    }

    public function 
filter_highlight_message$title$entry ) {
        return 
sprintf(
            
esc_html__'Please %1$sreview the logs%2$s to make sure your system has not been compromised.''better-wp-security' ),
            
'<a href="{{ $view }}">',
            
'</a>'
        
);
    }
}

new 
ITSEC_File_Change_Logs();
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586