C:\xampp\htdocs\landing\wp-content\plugins\hummingbird-performance\core\class-module.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
<?php
/**
 * Abstract class that define every module in WP Hummingbird
 *
 * @package Hummingbird\Core
 */

namespace Hummingbird\Core;

use 
Hummingbird\WP_Hummingbird;

if ( ! 
defined'ABSPATH' ) ) {
    exit;
}

/**
 * Class Module
 */
abstract class Module {

    
/**
     * Module slug name
     *
     * @var string
     */
    
protected $slug '';

    
/**
     * Module constructor.
     *
     * @param string $slug  Module slug.
     */
    
public function __construct$slug ) {
        
$this->slug $slug;
        
$this->init();
    }

    
/**
     * Return true if the module is activated
     *
     * @return Boolean
     */
    
public function is_active() {
        
$slug $this->get_slug();

        
/**
         * Filters the activation of a module
         *
         * @usedby wphb_uptime_module_status()
         * @usedby wphb_minify_module_status()
         *
         * @param boolean $active if the module is active or not
         */
        
return apply_filters"wp_hummingbird_is_active_module_$slug"true );
    }

    
/**
     * Checks if user is on the page of a specific module.
     *
     * @since 1.8.1
     *
     * @param bool $dashboard  If set, function will return true when user is either on module page
     *                         or on dashboard page.
     *
     * @return bool
     */
    
public function is_on_page$dashboard false ) {
        
$slug $this->get_slug();
        
$page get_current_screen()->id;

        
// Asset optimization module has a different slug rather than the page id.
        
if ( 'minify' === $slug ) {
            
$slug 'minification';
        }

        
// Check if on dashboard page.
        
if ( $dashboard && preg_match'/^(toplevel_page_wphb)/'$page ) ) {
            return 
true;
        }

        
// Check if on module page.
        
if ( preg_match"/(wphb-{$slug})/"$page ) ) {
            return 
true;
        }

        return 
false;
    }

    
/**
     * Return the module slug name
     *
     * @return string
     */
    
public function get_slug() {
        return 
$this->slug;
    }

    
/**
     * Initializes the module. Always executed even if the module is deactivated.
     *
     * Do not use __construct in subclasses, use init() instead
     */
    
abstract public function init();

    
/**
     * Execute the module actions. It must be defined in subclasses. Executed when module is active.
     */
    
abstract public function run();

    
/**
     * Clear the module cache.
     *
     * @since 1.7.1
     * @return mixed
     */
    
abstract public function clear_cache();

    
/**
     * Return the options array for this module
     *
     * @since  1.8
     *
     * @return array List of options
     */
    
public function get_options() {
        return 
Settings::get_settings$this->get_slug() );
    }

    
/**
     * Update the settings for the module.
     *
     * @since  1.8
     *
     * @param array $options List of settings.
     */
    
public function update_options$options ) {
        
Settings::update_settings$options$this->get_slug() );
    }

    
/**
     * Log via the logger.
     *
     * @since 1.9.2
     *
     * @param mixed $msg  Message to log.
     */
    
public function log$msg ) {
        
WP_Hummingbird::get_instance()->core->logger->log$msg$this->get_slug() );
    }

}
x

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