1 | <?php |
||
16 | class SimCal_WP_Requirements { |
||
|
|||
17 | |||
18 | /** |
||
19 | * Plugin name. |
||
20 | * |
||
21 | * @access private |
||
22 | * @var string |
||
23 | */ |
||
24 | private $name = ''; |
||
25 | |||
26 | /** |
||
27 | * Plugin main file. |
||
28 | * |
||
29 | * plugin_basename( __FILE__ ) |
||
30 | * |
||
31 | * @access private |
||
32 | * @var string |
||
33 | */ |
||
34 | private $plugin = ''; |
||
35 | |||
36 | /** |
||
37 | * WordPress. |
||
38 | * |
||
39 | * @access private |
||
40 | * @var bool |
||
41 | */ |
||
42 | private $wp = true; |
||
43 | |||
44 | /** |
||
45 | * PHP. |
||
46 | * |
||
47 | * @access private |
||
48 | * @var bool |
||
49 | */ |
||
50 | private $php = true; |
||
51 | |||
52 | /** |
||
53 | * PHP Extensions. |
||
54 | * |
||
55 | * @access private |
||
56 | * @var bool |
||
57 | */ |
||
58 | private $extensions = true; |
||
59 | |||
60 | /** |
||
61 | * Requirements to check. |
||
62 | * |
||
63 | * @access private |
||
64 | * @var array |
||
65 | */ |
||
66 | private $requirements = array(); |
||
67 | |||
68 | /** |
||
69 | * Results failures. |
||
70 | * |
||
71 | * Associative array with requirements results. |
||
72 | * |
||
73 | * @access private |
||
74 | * @var array |
||
75 | */ |
||
76 | private $failures = array(); |
||
77 | |||
78 | /** |
||
79 | * Admin notice. |
||
80 | * |
||
81 | * @access private |
||
82 | * @var string |
||
83 | */ |
||
84 | private $notice = ''; |
||
85 | |||
86 | /** |
||
87 | * Run checks. |
||
88 | * |
||
89 | * @param string $name The plugin name. |
||
90 | * @param string $plugin Output of `plugin_basename( __FILE__ )`. |
||
91 | * @param array $requirements Associative array with requirements. |
||
92 | */ |
||
93 | public function __construct( $name, $plugin, $requirements ) { |
||
155 | |||
156 | /** |
||
157 | * Get requirements results. |
||
158 | * |
||
159 | * @return array |
||
160 | */ |
||
161 | public function failures() { |
||
164 | |||
165 | /** |
||
166 | * Check if versions check pass. |
||
167 | * |
||
168 | * @return bool |
||
169 | */ |
||
170 | public function pass() { |
||
180 | |||
181 | /** |
||
182 | * Notice message. |
||
183 | * |
||
184 | * @param string $message An additional message. |
||
185 | * |
||
186 | * @return string |
||
187 | */ |
||
188 | public function get_notice( $message = '' ) { |
||
232 | |||
233 | /** |
||
234 | * Print notice. |
||
235 | */ |
||
236 | public function print_notice() { |
||
239 | |||
240 | /** |
||
241 | * Deactivate plugin. |
||
242 | */ |
||
243 | public function deactivate_plugin() { |
||
248 | |||
249 | /** |
||
250 | * Deactivate plugin and display admin notice. |
||
251 | * |
||
252 | * @param string $message An additional message in notice. |
||
253 | */ |
||
254 | public function halt( $message = '' ) { |
||
268 | |||
269 | } |
||
270 | |||
272 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.