C:\xampp\htdocs\landing\wp-content\plugins\better-wp-security\core\lib\storage.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
<?php

final class ITSEC_Storage {
    private 
$option 'itsec-storage';

    private static 
$instance false;
    private 
$changed false;
    private 
$cache;
    private 
$shutdown_done false;

    private function 
__construct() {
        
$this->load();

        
register_shutdown_function( array( $this'shutdown' ) );
        
add_action'shutdown', array( $this'shutdown' ), -10 );

        
add_action'itsec-lib-clear-caches', array( $this'save' ), -20 );
        
add_action'itsec-lib-clear-caches', array( $this'load' ), -10 );
    }

    private static function 
get_instance() {
        if ( 
false === self::$instance ) {
            
self::$instance = new self();
        }

        return 
self::$instance;
    }

    public static function 
get$name ) {
        
$data self::get_instance();

        if ( isset( 
$data->cache[$name] ) ) {
            return 
$data->cache[$name];
        }

        return 
null;
    }

    public static function 
get_all() {
        
$data self::get_instance();

        return 
$data->cache;
    }

    public static function 
set$name$value ) {
        
$data self::get_instance();
        
$data->cache[$name] = $value;
        
$data->changed true;

        if ( 
$data->shutdown_done ) {
            
self::save();
        }
    }

    public static function 
set_all$value ) {
        
$data self::get_instance();
        
$data->cache $value;
        
$data->changed true;

        if ( 
$data->shutdown_done ) {
            
self::save();
        }
    }

    public static function 
save() {
        
$data self::get_instance();

        if ( ! 
$data->changed ) {
            return 
true;
        }

        
$data->changed false;

        if ( 
is_multisite() ) {
            return 
update_site_option$data->option$data->cache );
        } else {
            return 
update_option$data->option$data->cache );
        }
    }

    public static function 
reload() {
        
$data self::get_instance();
        
$data->load();
    }

    public function 
load() {
        
$this->cache get_site_option$this->option );

        if ( ! 
is_array$this->cache ) ) {
            
$this->cache = array();
        }
    }

    public function 
shutdown() {
        
self::save();

        
$this->shutdown_done true;
    }
}
x

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