C:\xampp\htdocs\landing\wp-content\plugins\wp-optimize\includes\class-updraft-email-logger.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?php

if (!defined('ABSPATH')) die('No direct access allowed');

if (
class_exists('Updraft_Email_Logger')) return;

/**
 * Class Updraft_Email_Logger
 */
class Updraft_Email_Logger extends Updraft_Abstract_Logger {

    protected 
$allow_multiple true;

    
/**
     * Updraft_Email_Logger constructor
     */
    
public function __construct() {
    }

    
/**
     * Returns logger description
     *
     * @return string
     */
    
public function get_description() {
        return 
__('Log events to email''wp-optimize');
    }

    
/**
     * Returns list of logger options.
     *
     * @return array
     */
    
public function get_options_list() {
        return array(
            
'emails' => array(
                
__('Enter email for logs here''wp-optimize'),
                
'email'// validator
            
)
        );
    }

    
/**
     * Emergency message
     *
     * @param  string $message
     * @param  array  $context
     * @return null|void
     */
    
public function emergency($message, array $context = array()) {
        
$this->log(Updraft_Log_Levels::EMERGENCY$message$context);
    }

    
/**
     * Alert message
     *
     * @param  string $message
     * @param  array  $context
     * @return null|void
     */
    
public function alert($message, array $context = array()) {
        
$this->log(Updraft_Log_Levels::ALERT$message$context);
    }

    
/**
     * Critical message
     *
     * @param  string $message
     * @param  array  $context
     * @return null|void
     */
    
public function critical($message, array $context = array()) {
        
$this->log(Updraft_Log_Levels::CRITICAL$message$context);
    }

    
/**
     * Error message
     *
     * @param  string $message
     * @param  array  $context
     * @return null|void
     */
    
public function error($message, array $context = array()) {
        
$this->log(Updraft_Log_Levels::ERROR$message$context);
    }

    
/**
     * Warning message
     *
     * @param  string $message
     * @param  array  $context
     * @return null|void
     */
    
public function warning($message, array $context = array()) {
        
$this->log(Updraft_Log_Levels::WARNING$message$context);
    }

    
/**
     * Notice message
     *
     * @param  string $message
     * @param  array  $context
     * @return null|void
     */
    
public function notice($message, array $context = array()) {
        
$this->log(Updraft_Log_Levels::NOTICE$message$context);
    }

    
/**
     * Info message
     *
     * @param  string $message
     * @param  array  $context
     * @return null|void
     */
    
public function info($message, array $context = array()) {
        
$this->log(Updraft_Log_Levels::INFO$message$context);
    }

    
/**
     * Debug message
     *
     * @param  string $message
     * @param  array  $context
     * @return null|void
     */
    
public function debug($message, array $context = array()) {
        
$this->log(Updraft_Log_Levels::DEBUG$message$context);
    }

    
/**
     * Log message with any level
     *
     * @param  mixed  $level
     * @param  string $message
     * @param  array  $context
     * @return null|void
     */
    
public function log($level$message, array $context = array()) {

        if (!
$this->is_enabled()) return false;

        
$log WP_Optimize()->get_options()->get_option('updraft_mail_logger_log', array());

        
$message '['.Updraft_Log_Levels::to_text($level).'] : '.$this->interpolate($message$context);

        
$log[] = $message;
        
WP_Optimize()->get_options()->update_option('updraft_mail_logger_log'$log);
    }

    
/**
     * Add recipient email
     *
     * @param string $email
     */
    
public function add_email($email) {
        
$emails $this->get_option('emails', array());
        
$emails[] = $email;
        
$this->set_option('emails'$emails);
    }

    
/**
     * Return list of recipients email
     *
     * @return null
     */
    
public function get_emails() {
        return 
$this->get_option('emails'get_option('admin_email'));
    }

    
/**
     * Email and clear log
     */
    
public function flush_log() {
        
$log $this->get_log();
        if (empty(
$log)) return;

        
WP_Optimize()->get_options()->update_option('updraft_mail_logger_log', array());

        if (!
$this->is_enabled()) return;

        
$email_addresses $this->get_emails();
        
$subject $this->get_option('updraft_mail_logger_subject''Updraft Email Log');

        
$log join("\n"$log);

        
wp_mail($email_addresses$subject$log);
    }

    
/**
     * Return log messages
     *
     * @return mixed|void
     */
    
public function get_log() {
        return 
WP_Optimize()->get_options()->get_option('updraft_mail_logger_log', array());
    }
}
x

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