C:\xampp\htdocs\landing\wp-content\plugins\wp-optimize\includes\class-updraft-abstract-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
<?php

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

if (
class_exists('Updraft_Abstract_Logger')) return;

require_once 
'class-updraft-log-levels.php';
require_once 
'class-updraft-logger-interface.php';

/**
 * Class Updraft_Abstract_Logger
 */
abstract class Updraft_Abstract_Logger implements Updraft_Logger_Interface {

    
/**
     * True if logger enabled.
     *
     * @var bool
     */
    
protected $enabled true;

    
/**
     * True if possible to add multiple loggers.
     *
     * @var bool
     */
    
protected $allow_multiple false;

    
/**
     * Logger options.
     *
     * @var array
     */
    
protected $options = array();

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

    
/**
     * True if logger is available for use, i.e. required plugins installed.
     *
     * @return bool
     */
    
public function is_available() {
        return 
true;
    }

    
/**
     * Returns true if allow multiple.
     *
     * @return bool
     */
    
public function is_allow_multiple() {
        return 
$this->allow_multiple;
    }

    
/**
     * Returns current options in text.
     *
     * @return string
     */
    
public function get_options_text() {
        
$options_values $this->get_options_values();

        if (
array_key_exists('active'$options_values)) {
            unset(
$options_values['active']);
        }

        return 
join(', '$options_values);
    }

    
/**
     * Returns list of logger options.
     *
     * @return array
     */
    
public function get_options_list() {
        return array(
        
// 'option_name' => __('Placeholder', 'wp-optimize')
        
);
    }

    
/**
     * Returns array with options values list.
     *
     * @return array
     */
    
public function get_options_values() {
        
$options_values = array();
        
$options_list $this->get_options_list();

        if (empty(
$options_list)) return $options_values;

        foreach (
array_keys($options_list) as $option_name) {
            
$options_values[$option_name] = $this->get_option($option_name);
        }

        return 
$options_values;
    }

    
/**
     * Returns true if logger is active
     *
     * @return boolean
     */
    
public function is_enabled() {
        return 
$this->enabled;
    }

    
/**
     * Enable logger
     */
    
public function enable() {
        
$this->enabled true;
    }

    
/**
     * Disable logger
     */
    
public function disable() {
        
$this->enabled false;
    }

    
/**
     * Return option $name value
     *
     * @param  string $name    Name of the option.
     * @param  string $default Add default value.
     * @return array  An array of options.
     */
    
public function get_option($name$default '') {
        if (!
array_key_exists($name$this->options)) return $default;
        return 
$this->options[$name];
    }

    
/**
     * Set option $name value.
     *
     * @param string $name  The name of the option.
     * @param string $value The value of the option.
     */
    
public function set_option($name$value '') {
        if (
is_array($name)) {
            
$this->options array_merge($this->options$name);
        } else {
            
$this->options[$name] = $value;
        }
    }

    
/**
     * Returns logger description
     *
     * @return mixed
     */
    
public abstract function get_description();

    
/**
     * For the Logger: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
     *
     * @param  string $message
     * @param  array  $context
     * @return string
     */
    
protected function interpolate($message, array $context = array()) {
        
$replace = array();
        foreach (
$context as $key => $val) {
            
// Check that the value can be casted to string.
            
if (!is_array($val) && (!is_object($val) || method_exists($val'__toString'))) {
                
$replace['{' $key '}'] = $val;
            }
        }
        return 
strtr($message$replace);
    }
}
x

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