@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | use PhpConsole; |
18 | 18 | |
19 | -defined( 'ABSPATH' ) or exit; |
|
19 | +defined('ABSPATH') or exit; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * WP PHP Console main class. |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | */ |
62 | 62 | private function set_debug_mode() { |
63 | 63 | |
64 | - @error_reporting( E_ALL ); |
|
64 | + @error_reporting(E_ALL); |
|
65 | 65 | |
66 | - foreach ( [ 'WP_DEBUG', 'WP_DEBUG_LOG', 'WP_DEBUG_DISPLAY', ] as $wp_debug_constant ) { |
|
67 | - if ( ! defined( $wp_debug_constant ) ) { |
|
68 | - define ( $wp_debug_constant, true ); |
|
66 | + foreach (['WP_DEBUG', 'WP_DEBUG_LOG', 'WP_DEBUG_DISPLAY', ] as $wp_debug_constant) { |
|
67 | + if ( ! defined($wp_debug_constant)) { |
|
68 | + define($wp_debug_constant, true); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | load_plugin_textdomain( |
95 | 95 | 'wp-php-console', |
96 | 96 | false, |
97 | - dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' |
|
97 | + dirname(dirname(plugin_basename(__FILE__))).'/languages/' |
|
98 | 98 | ); |
99 | 99 | } |
100 | 100 | |
@@ -106,19 +106,19 @@ discard block |
||
106 | 106 | */ |
107 | 107 | private function set_admin() { |
108 | 108 | |
109 | - if ( is_admin() ) { |
|
109 | + if (is_admin()) { |
|
110 | 110 | |
111 | - add_filter( 'plugin_action_links_wp-php-console/wp-php-console.php', static function( $actions ) { |
|
112 | - return array_merge( [ |
|
113 | - '<a href="' . esc_url( self::get_settings_page_url() ) . '">' . esc_html__( 'Settings', 'wp-php-console' ) . '</a>', |
|
114 | - '<a href="' . esc_url( self::get_project_page_url() ) . '">' . esc_html__( 'GitHub', 'wp-php-console' ) . '</a>', |
|
115 | - '<a href="' . esc_url( self::get_support_page_url() ) . '">' . esc_html__( 'Support', 'wp-php-console' ) . '</a>', |
|
116 | - '<a href="' . esc_url( self::get_reviews_page_url() ) . '">' . esc_html__( 'Review', 'wp-php-console' ) . '</a>', |
|
117 | - ], $actions ); |
|
111 | + add_filter('plugin_action_links_wp-php-console/wp-php-console.php', static function($actions) { |
|
112 | + return array_merge([ |
|
113 | + '<a href="'.esc_url(self::get_settings_page_url()).'">'.esc_html__('Settings', 'wp-php-console').'</a>', |
|
114 | + '<a href="'.esc_url(self::get_project_page_url()).'">'.esc_html__('GitHub', 'wp-php-console').'</a>', |
|
115 | + '<a href="'.esc_url(self::get_support_page_url()).'">'.esc_html__('Support', 'wp-php-console').'</a>', |
|
116 | + '<a href="'.esc_url(self::get_reviews_page_url()).'">'.esc_html__('Review', 'wp-php-console').'</a>', |
|
117 | + ], $actions); |
|
118 | 118 | } ); |
119 | 119 | |
120 | - if ( ! defined( 'DOING_AJAX' ) ) { |
|
121 | - new Settings( $this->options ); |
|
120 | + if ( ! defined('DOING_AJAX')) { |
|
121 | + new Settings($this->options); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | } |
@@ -132,16 +132,16 @@ discard block |
||
132 | 132 | private function set_hooks() { |
133 | 133 | |
134 | 134 | // bail out if PHP Console can't be found |
135 | - if ( ! class_exists( 'PhpConsole\Connector' ) ) { |
|
135 | + if ( ! class_exists('PhpConsole\Connector')) { |
|
136 | 136 | return; |
137 | 137 | } |
138 | 138 | |
139 | 139 | // handle translations |
140 | - add_action( 'plugins_loaded', [ $this, 'set_locale' ] ); |
|
140 | + add_action('plugins_loaded', [$this, 'set_locale']); |
|
141 | 141 | // connect to PHP Console |
142 | - add_action( 'init', [ $this, 'connect' ], -1000 ); |
|
142 | + add_action('init', [$this, 'connect'], -1000); |
|
143 | 143 | // delay further PHP Console initialisation to have more context during Remote PHP execution |
144 | - add_action( 'wp_loaded', [ $this, 'init' ], -1000 ); |
|
144 | + add_action('wp_loaded', [$this, 'init'], -1000); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | |
@@ -158,27 +158,27 @@ discard block |
||
158 | 158 | public function connect() { |
159 | 159 | |
160 | 160 | // workaround for avoiding headers already sent warnings |
161 | - @error_reporting( E_ALL & ~E_WARNING ); |
|
161 | + @error_reporting(E_ALL & ~E_WARNING); |
|
162 | 162 | |
163 | - if ( ! @session_id() ) { |
|
163 | + if ( ! @session_id()) { |
|
164 | 164 | @session_start(); |
165 | 165 | } |
166 | 166 | |
167 | 167 | $connected = true; |
168 | 168 | |
169 | - if ( ! $this->connector instanceof PhpConsole\Connector ) { |
|
169 | + if ( ! $this->connector instanceof PhpConsole\Connector) { |
|
170 | 170 | try { |
171 | 171 | $this->connector = PhpConsole\Connector::getInstance(); |
172 | - } catch ( \Exception $e ) { |
|
172 | + } catch (\Exception $e) { |
|
173 | 173 | $connected = false; |
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | 177 | // restore error reporting |
178 | - @error_reporting( E_ALL ); |
|
178 | + @error_reporting(E_ALL); |
|
179 | 179 | |
180 | 180 | // apply PHP Console options |
181 | - if ( $connected ) { |
|
181 | + if ($connected) { |
|
182 | 182 | $this->apply_options(); |
183 | 183 | } |
184 | 184 | } |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | */ |
194 | 194 | private function get_options() { |
195 | 195 | |
196 | - $options = get_option( 'wp_php_console', [] ); |
|
196 | + $options = get_option('wp_php_console', []); |
|
197 | 197 | |
198 | - return wp_parse_args( $options, [ |
|
198 | + return wp_parse_args($options, [ |
|
199 | 199 | 'ip' => '', |
200 | 200 | 'password' => '', |
201 | 201 | 'register' => false, |
202 | 202 | 'short' => false, |
203 | 203 | 'ssl' => false, |
204 | 204 | 'stack' => false, |
205 | - ] ); |
|
205 | + ]); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -214,31 +214,31 @@ discard block |
||
214 | 214 | private function apply_options() { |
215 | 215 | |
216 | 216 | // bail out if not connected yet to PHP Console |
217 | - if ( ! $this->connector instanceof PhpConsole\Connector ) { |
|
217 | + if ( ! $this->connector instanceof PhpConsole\Connector) { |
|
218 | 218 | return; |
219 | 219 | } |
220 | 220 | |
221 | 221 | // apply 'register' option to PHP Console... |
222 | - if ( true === $this->options['register'] && ! class_exists( 'PC', false ) ) { |
|
222 | + if (true === $this->options['register'] && ! class_exists('PC', false)) { |
|
223 | 223 | // ...only if PC not registered yet |
224 | 224 | try { |
225 | 225 | PhpConsole\Helper::register(); |
226 | - } catch( \Exception $e ) { |
|
227 | - $this->print_notice_exception( $e ); |
|
226 | + } catch (\Exception $e) { |
|
227 | + $this->print_notice_exception($e); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
231 | 231 | // apply 'stack' option to PHP Console |
232 | - if ( true === $this->options['stack'] ) { |
|
232 | + if (true === $this->options['stack']) { |
|
233 | 233 | $this->connector->getDebugDispatcher()->detectTraceAndSource = true; |
234 | 234 | } |
235 | 235 | |
236 | 236 | // apply 'short' option to PHP Console |
237 | - if ( true === $this->options['short'] ) { |
|
237 | + if (true === $this->options['short']) { |
|
238 | 238 | try { |
239 | - $this->connector->setSourcesBasePath( $_SERVER['DOCUMENT_ROOT'] ); |
|
240 | - } catch ( \Exception $e ) { |
|
241 | - $this->print_notice_exception( $e ); |
|
239 | + $this->connector->setSourcesBasePath($_SERVER['DOCUMENT_ROOT']); |
|
240 | + } catch (\Exception $e) { |
|
241 | + $this->print_notice_exception($e); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | } |
@@ -254,100 +254,100 @@ discard block |
||
254 | 254 | public function init() { |
255 | 255 | |
256 | 256 | // get PHP Console extension password |
257 | - $password = trim( $this->options['password'] ); |
|
257 | + $password = trim($this->options['password']); |
|
258 | 258 | |
259 | - if ( empty( $password ) ) { |
|
259 | + if (empty($password)) { |
|
260 | 260 | |
261 | 261 | // display admin notice and abort if no password has been set |
262 | - add_action( 'admin_notices', [ $this, 'password_notice' ] ); |
|
262 | + add_action('admin_notices', [$this, 'password_notice']); |
|
263 | 263 | return; |
264 | 264 | } |
265 | 265 | |
266 | 266 | // selectively remove slashes added by WordPress as expected by PHP Console |
267 | - if ( array_key_exists( PhpConsole\Connector::POST_VAR_NAME, $_POST ) ) { |
|
268 | - $_POST[ PhpConsole\Connector::POST_VAR_NAME ] = stripslashes_deep( $_POST[ PhpConsole\Connector::POST_VAR_NAME ] ); |
|
267 | + if (array_key_exists(PhpConsole\Connector::POST_VAR_NAME, $_POST)) { |
|
268 | + $_POST[PhpConsole\Connector::POST_VAR_NAME] = stripslashes_deep($_POST[PhpConsole\Connector::POST_VAR_NAME]); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | // get PHP Console instance if wasn't set yet |
272 | - if ( ! $this->connector instanceof PhpConsole\Connector ) { |
|
272 | + if ( ! $this->connector instanceof PhpConsole\Connector) { |
|
273 | 273 | |
274 | 274 | // workaround for avoiding headers already sent warnings |
275 | - @error_reporting( E_ALL & ~E_WARNING ); |
|
275 | + @error_reporting(E_ALL & ~E_WARNING); |
|
276 | 276 | |
277 | 277 | try { |
278 | 278 | $this->connector = PhpConsole\Connector::getInstance(); |
279 | 279 | $connected = true; |
280 | - } catch ( \Exception $e ) { |
|
280 | + } catch (\Exception $e) { |
|
281 | 281 | $connected = false; |
282 | 282 | } |
283 | 283 | |
284 | 284 | // restore error reporting |
285 | - @error_reporting( E_ALL ); |
|
285 | + @error_reporting(E_ALL); |
|
286 | 286 | |
287 | - if ( ! $connected ) { |
|
287 | + if ( ! $connected) { |
|
288 | 288 | return; |
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
292 | 292 | // set PHP Console password |
293 | 293 | try { |
294 | - $this->connector->setPassword( $password ); |
|
295 | - } catch ( \Exception $e ) { |
|
296 | - $this->print_notice_exception( $e ); |
|
294 | + $this->connector->setPassword($password); |
|
295 | + } catch (\Exception $e) { |
|
296 | + $this->print_notice_exception($e); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | // get PHP Console handler instance |
300 | 300 | $handler = PhpConsole\Handler::getInstance(); |
301 | 301 | |
302 | - if ( true !== PhpConsole\Handler::getInstance()->isStarted() ) { |
|
302 | + if (true !== PhpConsole\Handler::getInstance()->isStarted()) { |
|
303 | 303 | try { |
304 | 304 | $handler->start(); |
305 | - } catch( \Exception $e ) { |
|
306 | - $this->print_notice_exception( $e ); |
|
305 | + } catch (\Exception $e) { |
|
306 | + $this->print_notice_exception($e); |
|
307 | 307 | return; |
308 | 308 | } |
309 | 309 | } |
310 | 310 | |
311 | 311 | // enable SSL-only mode |
312 | - if ( true === $this->options['ssl'] ) { |
|
312 | + if (true === $this->options['ssl']) { |
|
313 | 313 | $this->connector->enableSslOnlyMode(); |
314 | 314 | } |
315 | 315 | |
316 | 316 | // restrict IP addresses |
317 | - $allowedIpMasks = ! empty( $this->options['ip'] ) ? explode( ',', $this->options['ip'] ) : ''; |
|
317 | + $allowedIpMasks = ! empty($this->options['ip']) ? explode(',', $this->options['ip']) : ''; |
|
318 | 318 | |
319 | - if ( is_array( $allowedIpMasks ) && count( $allowedIpMasks ) > 0 ) { |
|
320 | - $this->connector->setAllowedIpMasks( $allowedIpMasks ); |
|
319 | + if (is_array($allowedIpMasks) && count($allowedIpMasks) > 0) { |
|
320 | + $this->connector->setAllowedIpMasks($allowedIpMasks); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | $evalProvider = $this->connector->getEvalDispatcher()->getEvalProvider(); |
324 | 324 | |
325 | 325 | try { |
326 | - $evalProvider->addSharedVar( 'uri', $_SERVER['REQUEST_URI'] ); |
|
327 | - } catch ( \Exception $e ) { |
|
328 | - $this->print_notice_exception( $e ); |
|
326 | + $evalProvider->addSharedVar('uri', $_SERVER['REQUEST_URI']); |
|
327 | + } catch (\Exception $e) { |
|
328 | + $this->print_notice_exception($e); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | try { |
332 | - $evalProvider->addSharedVarReference( 'post', $_POST ); |
|
333 | - } catch ( \Exception $e ) { |
|
334 | - $this->print_notice_exception( $e ); |
|
332 | + $evalProvider->addSharedVarReference('post', $_POST); |
|
333 | + } catch (\Exception $e) { |
|
334 | + $this->print_notice_exception($e); |
|
335 | 335 | } |
336 | 336 | |
337 | - $openBaseDirs = [ ABSPATH, get_template_directory() ]; |
|
337 | + $openBaseDirs = [ABSPATH, get_template_directory()]; |
|
338 | 338 | |
339 | 339 | try { |
340 | - $evalProvider->addSharedVarReference( 'dirs', $openBaseDirs ); |
|
341 | - } catch ( \Exception $e ) { |
|
342 | - $this->print_notice_exception( $e ); |
|
340 | + $evalProvider->addSharedVarReference('dirs', $openBaseDirs); |
|
341 | + } catch (\Exception $e) { |
|
342 | + $this->print_notice_exception($e); |
|
343 | 343 | } |
344 | 344 | |
345 | - $evalProvider->setOpenBaseDirs( $openBaseDirs ); |
|
345 | + $evalProvider->setOpenBaseDirs($openBaseDirs); |
|
346 | 346 | |
347 | 347 | try { |
348 | 348 | $this->connector->startEvalRequestsListener(); |
349 | - } catch ( \Exception $e ) { |
|
350 | - $this->print_notice_exception( $e ); |
|
349 | + } catch (\Exception $e) { |
|
350 | + $this->print_notice_exception($e); |
|
351 | 351 | } |
352 | 352 | } |
353 | 353 | |
@@ -359,13 +359,13 @@ discard block |
||
359 | 359 | * |
360 | 360 | * @param \Exception $e Exception object |
361 | 361 | */ |
362 | - public function print_notice_exception( \Exception $e ) { |
|
362 | + public function print_notice_exception(\Exception $e) { |
|
363 | 363 | |
364 | - add_action( 'admin_notices', static function() use ( $e ) { |
|
364 | + add_action('admin_notices', static function() use ($e) { |
|
365 | 365 | |
366 | 366 | ?> |
367 | 367 | <div class="error"> |
368 | - <p><?php printf( '%1$s: %2$s', self::NAME, $e->getMessage() ); ?></p> |
|
368 | + <p><?php printf('%1$s: %2$s', self::NAME, $e->getMessage()); ?></p> |
|
369 | 369 | </div> |
370 | 370 | <?php |
371 | 371 | |
@@ -388,9 +388,9 @@ discard block |
||
388 | 388 | <div class="update-nag"> |
389 | 389 | <p><?php printf( |
390 | 390 | /* translators: Placeholders: %1$s - WP PHP Console name, %2$s - opening HTML <a> link tag; %3$s closing HTML </a> link tag */ |
391 | - __( '%1$s: Please remember to %2$sset a password%3$s if you want to enable the terminal.', 'wp-php-console' ), |
|
392 | - '<strong>' . self::NAME . '</strong>', |
|
393 | - '<a href="' . esc_url( admin_url( 'options-general.php?page=wp-php-console' ) ) .'">', |
|
391 | + __('%1$s: Please remember to %2$sset a password%3$s if you want to enable the terminal.', 'wp-php-console'), |
|
392 | + '<strong>'.self::NAME.'</strong>', |
|
393 | + '<a href="'.esc_url(admin_url('options-general.php?page=wp-php-console')).'">', |
|
394 | 394 | '</a>' |
395 | 395 | ); ?></p> |
396 | 396 | </div> |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | */ |
408 | 408 | public static function get_plugin_path() { |
409 | 409 | |
410 | - return untrailingslashit( dirname( __DIR__ ) ); |
|
410 | + return untrailingslashit(dirname(__DIR__)); |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | */ |
419 | 419 | public static function get_plugin_vendor_path() { |
420 | 420 | |
421 | - return self::get_plugin_path() . '/vendor'; |
|
421 | + return self::get_plugin_path().'/vendor'; |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | */ |
484 | 484 | public static function get_settings_page_url() { |
485 | 485 | |
486 | - return admin_url( 'options-general.php?page=wp-php-console' ); |
|
486 | + return admin_url('options-general.php?page=wp-php-console'); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | */ |
497 | 497 | public static function is_settings_page() { |
498 | 498 | |
499 | - return is_admin() && isset( $_GET['page'] ) && 'page' === 'wp-php-console'; |
|
499 | + return is_admin() && isset($_GET['page']) && 'page' === 'wp-php-console'; |
|
500 | 500 | } |
501 | 501 | |
502 | 502 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * at this URL: http://www.gnu.org/licenses/gpl-3.0.html |
41 | 41 | */ |
42 | 42 | |
43 | -defined( 'ABSPATH' ) or exit; |
|
43 | +defined('ABSPATH') or exit; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * WP PHP Console loader. |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | */ |
75 | 75 | protected function __construct() { |
76 | 76 | |
77 | - register_activation_hook( __FILE__, array( $this, 'activation_check' ) ); |
|
77 | + register_activation_hook(__FILE__, array($this, 'activation_check')); |
|
78 | 78 | |
79 | - add_action( 'admin_init', array( $this, 'check_environment' ) ); |
|
80 | - add_action( 'admin_init', array( $this, 'add_plugin_notices' ) ); |
|
81 | - add_action( 'admin_notices', array( $this, 'admin_notices' ), 15 ); |
|
79 | + add_action('admin_init', array($this, 'check_environment')); |
|
80 | + add_action('admin_init', array($this, 'add_plugin_notices')); |
|
81 | + add_action('admin_notices', array($this, 'admin_notices'), 15); |
|
82 | 82 | |
83 | 83 | // if the environment check fails, initialize the plugin |
84 | - if ( $this->is_environment_compatible() && $this->is_wp_compatible() ) { |
|
84 | + if ($this->is_environment_compatible() && $this->is_wp_compatible()) { |
|
85 | 85 | $this->init_plugin(); |
86 | 86 | } |
87 | 87 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function __clone() { |
96 | 96 | |
97 | - _doing_it_wrong( __FUNCTION__, sprintf( 'You cannot clone instances of %s.', get_class( $this ) ), '1.5.4' ); |
|
97 | + _doing_it_wrong(__FUNCTION__, sprintf('You cannot clone instances of %s.', get_class($this)), '1.5.4'); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function __wakeup() { |
107 | 107 | |
108 | - _doing_it_wrong( __FUNCTION__, sprintf( 'You cannot unserialize instances of %s.', get_class( $this ) ), '1.5.4' ); |
|
108 | + _doing_it_wrong(__FUNCTION__, sprintf('You cannot unserialize instances of %s.', get_class($this)), '1.5.4'); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | private function init_plugin() { |
120 | 120 | |
121 | 121 | // autoload plugin and vendor files |
122 | - $loader = require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; |
|
122 | + $loader = require_once plugin_dir_path(__FILE__).'vendor/autoload.php'; |
|
123 | 123 | |
124 | 124 | // register plugin namespace with autoloader |
125 | - $loader->addPsr4( 'WP_PHP_Console\\', __DIR__ . '/src' ); |
|
125 | + $loader->addPsr4('WP_PHP_Console\\', __DIR__.'/src'); |
|
126 | 126 | |
127 | - require_once plugin_dir_path( __FILE__ ) . 'src/Functions.php'; |
|
127 | + require_once plugin_dir_path(__FILE__).'src/Functions.php'; |
|
128 | 128 | |
129 | 129 | wp_php_console(); |
130 | 130 | } |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function activation_check() { |
143 | 143 | |
144 | - if ( ! $this->is_environment_compatible() ) { |
|
144 | + if ( ! $this->is_environment_compatible()) { |
|
145 | 145 | |
146 | 146 | $this->deactivate_plugin(); |
147 | 147 | |
148 | - wp_die( self::PLUGIN_NAME . ' could not be activated. ' . $this->get_environment_message() ); |
|
148 | + wp_die(self::PLUGIN_NAME.' could not be activated. '.$this->get_environment_message()); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function check_environment() { |
161 | 161 | |
162 | - if ( ! $this->is_environment_compatible() && is_plugin_active( plugin_basename( __FILE__ ) ) ) { |
|
162 | + if ( ! $this->is_environment_compatible() && is_plugin_active(plugin_basename(__FILE__))) { |
|
163 | 163 | |
164 | 164 | $this->deactivate_plugin(); |
165 | 165 | |
166 | - $this->add_admin_notice( 'bad_environment', 'error', self::PLUGIN_NAME . ' has been deactivated. ' . $this->get_environment_message() ); |
|
166 | + $this->add_admin_notice('bad_environment', 'error', self::PLUGIN_NAME.' has been deactivated. '.$this->get_environment_message()); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -177,14 +177,14 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function add_plugin_notices() { |
179 | 179 | |
180 | - if ( ! $this->is_wp_compatible() ) { |
|
180 | + if ( ! $this->is_wp_compatible()) { |
|
181 | 181 | |
182 | - $this->add_admin_notice( 'update_wordpress', 'error', sprintf( |
|
182 | + $this->add_admin_notice('update_wordpress', 'error', sprintf( |
|
183 | 183 | '%s requires WordPress version %s or higher. Please %supdate WordPress »%s', |
184 | - '<strong>' . self::PLUGIN_NAME . '</strong>', |
|
184 | + '<strong>'.self::PLUGIN_NAME.'</strong>', |
|
185 | 185 | self::MINIMUM_WP_VERSION, |
186 | - '<a href="' . esc_url( admin_url( 'update-core.php' ) ) . '">', '</a>' |
|
187 | - ) ); |
|
186 | + '<a href="'.esc_url(admin_url('update-core.php')).'">', '</a>' |
|
187 | + )); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | private function is_wp_compatible() { |
200 | 200 | global $wp_version; |
201 | 201 | |
202 | - return version_compare( $wp_version, self::MINIMUM_WP_VERSION, '>=' ); |
|
202 | + return version_compare($wp_version, self::MINIMUM_WP_VERSION, '>='); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | |
@@ -210,10 +210,10 @@ discard block |
||
210 | 210 | */ |
211 | 211 | private function deactivate_plugin() { |
212 | 212 | |
213 | - deactivate_plugins( plugin_basename( __FILE__ ) ); |
|
213 | + deactivate_plugins(plugin_basename(__FILE__)); |
|
214 | 214 | |
215 | - if ( isset( $_GET['activate'] ) ) { |
|
216 | - unset( $_GET['activate'] ); |
|
215 | + if (isset($_GET['activate'])) { |
|
216 | + unset($_GET['activate']); |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | * @param string $class CSS class |
228 | 228 | * @param string $message message content |
229 | 229 | */ |
230 | - private function add_admin_notice( $slug, $class, $message ) { |
|
230 | + private function add_admin_notice($slug, $class, $message) { |
|
231 | 231 | |
232 | - $this->notices[ $slug ] = array( |
|
232 | + $this->notices[$slug] = array( |
|
233 | 233 | 'class' => $class, |
234 | 234 | 'message' => $message |
235 | 235 | ); |
@@ -245,11 +245,11 @@ discard block |
||
245 | 245 | */ |
246 | 246 | public function admin_notices() { |
247 | 247 | |
248 | - foreach ( (array) $this->notices as $notice_key => $notice ) : |
|
248 | + foreach ((array) $this->notices as $notice_key => $notice) : |
|
249 | 249 | |
250 | 250 | ?> |
251 | - <div class="<?php echo esc_attr( $notice['class'] ); ?>"> |
|
252 | - <p><?php echo wp_kses( $notice['message'], array( 'a' => array( 'href' => array() ) ) ); ?></p> |
|
251 | + <div class="<?php echo esc_attr($notice['class']); ?>"> |
|
252 | + <p><?php echo wp_kses($notice['message'], array('a' => array('href' => array()))); ?></p> |
|
253 | 253 | </div> |
254 | 254 | <?php |
255 | 255 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | */ |
267 | 267 | private function is_environment_compatible() { |
268 | 268 | |
269 | - return version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '>=' ); |
|
269 | + return version_compare(PHP_VERSION, self::MINIMUM_PHP_VERSION, '>='); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | */ |
280 | 280 | private function get_environment_message() { |
281 | 281 | |
282 | - return sprintf( 'The minimum PHP version required for this plugin is %1$s. You are running %2$s.', self::MINIMUM_PHP_VERSION, PHP_VERSION ); |
|
282 | + return sprintf('The minimum PHP version required for this plugin is %1$s. You are running %2$s.', self::MINIMUM_PHP_VERSION, PHP_VERSION); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public static function instance() { |
296 | 296 | |
297 | - if ( null === self::$instance ) { |
|
297 | + if (null === self::$instance) { |
|
298 | 298 | self::$instance = new self(); |
299 | 299 | } |
300 | 300 |