-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsite-speed-monitor.php
More file actions
141 lines (114 loc) · 3.34 KB
/
Copy pathsite-speed-monitor.php
File metadata and controls
141 lines (114 loc) · 3.34 KB
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
<?php
/*
* Plugin Name: Site Speed Monitor
* Plugin URI: https://wordpress.org/plugins/site-speed-monitor/
* Description: Site Speed Monitor allows you to monitor your website load times using the WebPageTest.org API.
* Author: Code Parrots
* Author URI: https://www.codeparrots.com
* Version: 1.0.0
* Text Domain: site-speed-monitor
* Domain Path: /languages/
* License: GPL v2 or later
*/
/**
* Site Speed Monitor lets you test and view your website speed using https://www.webpagetest.org/
*
* LICENSE
* This file is part of Site Speed Monitor.
*
* Site Speed Monitor is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @package Site Speed Monitor
* @author Code Parrots <info@codeparrots.com> & Evan Herman <evan.m.herman@gmail.com>
* @copyright Copyright 2013-2017 Code Parrots, 2013-2017 Evan Herman
* @license http://www.gnu.org/licenses/gpl.txt GPL 2.0
* @link https://wordpress.org/plugins/site-speed-monitor/
* @since 1.0.0
*/
if ( ! class_exists( 'Site_Speed_Monitor' ) ) {
final class Site_Speed_Monitor {
/**
* Plugin version
*
* @var string
*
* @since 1.0.0
*/
public static $version = '1.0.0';
/**
* Minimum PHP version
*
* @var string
*/
private $php_min_version = '5.6';
/**
* Plugin assets URL
*
* @var string
*/
public static $assets_url;
/**
* Plugin file
*
* @var string
*/
public static $plugin_file;
/**
* Class constructor
*
* @param string $cur_php_version
*
* @since 1.0.0
*/
public function __construct( $php_version = PHP_VERSION ) {
add_action( 'plugins_loaded', [ $this, 'i18n' ] );
if ( version_compare( $php_version, $this->php_min_version, '<' ) ) {
add_action( 'shutdown', array( $this, 'notice' ) );
return;
}
static::$assets_url = plugin_dir_url( __FILE__ ) . 'assets';
static::$plugin_file = plugin_basename( __FILE__ );
require_once __DIR__ . '/includes/autoload.php';
}
/**
* Run using the 'init' action.
*/
public function i18n() {
load_plugin_textdomain(
'site-speed-monitor',
false,
dirname( self::$plugin_file ) . '/languages'
);
}
/**
* Display minimum PHP version notice.
*
* @action shutdown
*
* @since 1.0.0
*/
public function notice() {
printf(
'<div class="notice notice-warning"><p>%s</p></div>',
sprintf(
/* translators: Minimum PHP version for speed test to run. */
esc_html__( 'Site Speed Monitor requires PHP version %s or higher. Please deactivate the plugin and contact your system administrator to upgrade.', 'contact-widgets' ),
esc_html( $this->php_min_version )
)
);
}
}
new Site_Speed_Monitor;
} // End if().