@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | use PhpConsole; |
12 | 12 | |
13 | -if ( ! defined( 'WPINC' ) ) { |
|
13 | +if ( ! defined('WPINC')) { |
|
14 | 14 | exit; // Exit if accessed directly |
15 | 15 | } |
16 | 16 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $this->options = $this->get_options(); |
83 | 83 | |
84 | 84 | // Bail out if PHP Console can't be found |
85 | - if ( ! class_exists( 'PhpConsole\Connector' ) ) { |
|
85 | + if ( ! class_exists('PhpConsole\Connector')) { |
|
86 | 86 | return; |
87 | 87 | } |
88 | 88 | |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | $this->apply_options(); |
94 | 94 | |
95 | 95 | // Translations |
96 | - add_action( 'plugins_loaded', array( $this, 'set_locale' ) ); |
|
96 | + add_action('plugins_loaded', array($this, 'set_locale')); |
|
97 | 97 | |
98 | 98 | // Admin menu |
99 | - add_action( 'admin_menu', array( $this, 'register_settings_page' ) ); |
|
99 | + add_action('admin_menu', array($this, 'register_settings_page')); |
|
100 | 100 | |
101 | 101 | // Delay further PHP Console initialisation to have more context during Remote PHP execution |
102 | - add_action( 'wp_loaded', array( $this, 'init' ) ); |
|
102 | + add_action('wp_loaded', array($this, 'init')); |
|
103 | 103 | |
104 | 104 | } |
105 | 105 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | load_plugin_textdomain( |
115 | 115 | $this->plugin_slug, |
116 | 116 | false, |
117 | - dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
|
117 | + dirname(plugin_basename(__FILE__)).'/languages/' ); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -129,15 +129,15 @@ discard block |
||
129 | 129 | // so all temporary data will be stored in $_SESSION. |
130 | 130 | // But there is some problem with frameworks like WordPress that override PHP session handler. |
131 | 131 | // PHP Console has alternative storage drivers for this - we will write to a temporary file: |
132 | - $phpcdir = dirname( __FILE__ ) . '/tmp'; |
|
133 | - $make_dir = wp_mkdir_p( $phpcdir ); |
|
132 | + $phpcdir = dirname(__FILE__).'/tmp'; |
|
133 | + $make_dir = wp_mkdir_p($phpcdir); |
|
134 | 134 | |
135 | - if ( $make_dir === true ) { |
|
135 | + if ($make_dir === true) { |
|
136 | 136 | |
137 | 137 | try { |
138 | - $storage = new PhpConsole\Storage\File( $phpcdir . '/' . md5( __FILE__ ) . '_pc.data' ); |
|
139 | - PhpConsole\Connector::setPostponeStorage( $storage ); |
|
140 | - } catch( \Exception $e ) { |
|
138 | + $storage = new PhpConsole\Storage\File($phpcdir.'/'.md5(__FILE__).'_pc.data'); |
|
139 | + PhpConsole\Connector::setPostponeStorage($storage); |
|
140 | + } catch (\Exception $e) { |
|
141 | 141 | // TODO $storage is under DOCUMENT_ROOT - it's insecure but did not find another solution in WP |
142 | 142 | // $this->print_notice_exception( $e ); |
143 | 143 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @return array |
158 | 158 | */ |
159 | 159 | protected function get_options() { |
160 | - return get_option( 'wp_php_console', array() ); |
|
160 | + return get_option('wp_php_console', array()); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | |
@@ -169,26 +169,26 @@ discard block |
||
169 | 169 | private function apply_options() { |
170 | 170 | |
171 | 171 | // Apply 'register' option to PHP Console |
172 | - if ( ! empty( $this->options['register'] ) && ! class_exists( 'PC', false ) ) { |
|
172 | + if ( ! empty($this->options['register']) && ! class_exists('PC', false)) { |
|
173 | 173 | // Only if PC not registered yet |
174 | 174 | try { |
175 | 175 | PhpConsole\Helper::register(); |
176 | - } catch( \Exception $e ) { |
|
177 | - $this->print_notice_exception( $e ); |
|
176 | + } catch (\Exception $e) { |
|
177 | + $this->print_notice_exception($e); |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
181 | 181 | // Apply 'stack' option to PHP Console |
182 | - if ( ! empty( $this->options['stack'] ) ) { |
|
182 | + if ( ! empty($this->options['stack'])) { |
|
183 | 183 | $this->connector->getDebugDispatcher()->detectTraceAndSource = true; |
184 | 184 | } |
185 | 185 | |
186 | 186 | // Apply 'short' option to PHP Console |
187 | - if ( ! empty( $this->options['short'] ) ) { |
|
187 | + if ( ! empty($this->options['short'])) { |
|
188 | 188 | try { |
189 | - $this->connector->setSourcesBasePath( $_SERVER['DOCUMENT_ROOT'] ); |
|
190 | - } catch ( \Exception $e ) { |
|
191 | - $this->print_notice_exception( $e ); |
|
189 | + $this->connector->setSourcesBasePath($_SERVER['DOCUMENT_ROOT']); |
|
190 | + } catch (\Exception $e) { |
|
191 | + $this->print_notice_exception($e); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
@@ -203,78 +203,78 @@ discard block |
||
203 | 203 | public function init() { |
204 | 204 | |
205 | 205 | // Display admin notice and abort if no password has been set |
206 | - $password = isset( $this->options['password'] ) ? $this->options['password'] : ''; |
|
207 | - if ( ! $password ) { |
|
208 | - add_action( 'admin_notices', array( $this, 'password_notice' ) ); |
|
206 | + $password = isset($this->options['password']) ? $this->options['password'] : ''; |
|
207 | + if ( ! $password) { |
|
208 | + add_action('admin_notices', array($this, 'password_notice')); |
|
209 | 209 | return; |
210 | 210 | } |
211 | 211 | |
212 | 212 | // Selectively remove slashes added by WordPress as expected by PhpConsole |
213 | - if ( isset( $_POST[PhpConsole\Connector::POST_VAR_NAME] ) ) { |
|
214 | - $_POST[ PhpConsole\Connector::POST_VAR_NAME ] = stripslashes_deep( $_POST[ PhpConsole\Connector::POST_VAR_NAME ] ); |
|
213 | + if (isset($_POST[PhpConsole\Connector::POST_VAR_NAME])) { |
|
214 | + $_POST[PhpConsole\Connector::POST_VAR_NAME] = stripslashes_deep($_POST[PhpConsole\Connector::POST_VAR_NAME]); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | $this->connector = PhpConsole\Connector::getInstance(); |
218 | 218 | |
219 | 219 | try { |
220 | - $this->connector->setPassword( $password ); |
|
221 | - } catch ( \Exception $e ) { |
|
222 | - $this->print_notice_exception( $e ); |
|
220 | + $this->connector->setPassword($password); |
|
221 | + } catch (\Exception $e) { |
|
222 | + $this->print_notice_exception($e); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | // PhpConsole instance |
226 | 226 | $handler = PhpConsole\Handler::getInstance(); |
227 | 227 | |
228 | - if ( PhpConsole\Handler::getInstance()->isStarted() !== true ) { |
|
228 | + if (PhpConsole\Handler::getInstance()->isStarted() !== true) { |
|
229 | 229 | try { |
230 | 230 | $handler->start(); |
231 | - } catch( \Exception $e ) { |
|
232 | - $this->print_notice_exception( $e ); |
|
231 | + } catch (\Exception $e) { |
|
232 | + $this->print_notice_exception($e); |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | 236 | // Enable SSL-only mode |
237 | - $enableSslOnlyMode = isset( $this->options['ssl'] ) ? ( ! empty( $this->options['ssl'] ) ? $this->options['ssl'] : '' ) : ''; |
|
237 | + $enableSslOnlyMode = isset($this->options['ssl']) ? ( ! empty($this->options['ssl']) ? $this->options['ssl'] : '') : ''; |
|
238 | 238 | |
239 | - if ( $enableSslOnlyMode ) { |
|
239 | + if ($enableSslOnlyMode) { |
|
240 | 240 | $this->connector->enableSslOnlyMode(); |
241 | 241 | } |
242 | 242 | |
243 | 243 | // Restrict IP addresses |
244 | - $allowedIpMasks = isset( $this->options['ip'] ) ? ( ! empty( $this->options['ip'] ) ? explode( ',', $this->options['ip'] ) : '' ) : ''; |
|
244 | + $allowedIpMasks = isset($this->options['ip']) ? ( ! empty($this->options['ip']) ? explode(',', $this->options['ip']) : '') : ''; |
|
245 | 245 | |
246 | - if ( is_array( $allowedIpMasks ) && ! empty( $allowedIpMasks ) ) { |
|
247 | - $this->connector->setAllowedIpMasks( (array) $allowedIpMasks ); |
|
246 | + if (is_array($allowedIpMasks) && ! empty($allowedIpMasks)) { |
|
247 | + $this->connector->setAllowedIpMasks((array) $allowedIpMasks); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | $evalProvider = $this->connector->getEvalDispatcher()->getEvalProvider(); |
251 | 251 | |
252 | 252 | try { |
253 | - $evalProvider->addSharedVar( 'uri', $_SERVER['REQUEST_URI'] ); |
|
254 | - } catch ( \Exception $e ) { |
|
255 | - $this->print_notice_exception( $e ); |
|
253 | + $evalProvider->addSharedVar('uri', $_SERVER['REQUEST_URI']); |
|
254 | + } catch (\Exception $e) { |
|
255 | + $this->print_notice_exception($e); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | try { |
259 | - $evalProvider->addSharedVarReference( 'post', $_POST ); |
|
260 | - } catch ( \Exception $e ) { |
|
261 | - $this->print_notice_exception( $e ); |
|
259 | + $evalProvider->addSharedVarReference('post', $_POST); |
|
260 | + } catch (\Exception $e) { |
|
261 | + $this->print_notice_exception($e); |
|
262 | 262 | } |
263 | 263 | |
264 | - $openBaseDirs = array( ABSPATH, get_template_directory() ); |
|
264 | + $openBaseDirs = array(ABSPATH, get_template_directory()); |
|
265 | 265 | |
266 | 266 | try { |
267 | - $evalProvider->addSharedVarReference( 'dirs', $openBaseDirs ); |
|
268 | - } catch ( \Exception $e ) { |
|
269 | - $this->print_notice_exception( $e ); |
|
267 | + $evalProvider->addSharedVarReference('dirs', $openBaseDirs); |
|
268 | + } catch (\Exception $e) { |
|
269 | + $this->print_notice_exception($e); |
|
270 | 270 | } |
271 | 271 | |
272 | - $evalProvider->setOpenBaseDirs( $openBaseDirs ); |
|
272 | + $evalProvider->setOpenBaseDirs($openBaseDirs); |
|
273 | 273 | |
274 | 274 | try { |
275 | 275 | $this->connector->startEvalRequestsListener(); |
276 | - } catch ( \Exception $e ) { |
|
277 | - $this->print_notice_exception( $e ); |
|
276 | + } catch (\Exception $e) { |
|
277 | + $this->print_notice_exception($e); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | } |
@@ -287,13 +287,13 @@ discard block |
||
287 | 287 | * @param \Exception $e Exception object |
288 | 288 | * @return void |
289 | 289 | */ |
290 | - public function print_notice_exception( \Exception $e ) { |
|
290 | + public function print_notice_exception(\Exception $e) { |
|
291 | 291 | |
292 | - add_action( 'admin_notices', function() use ( $e ) { |
|
292 | + add_action('admin_notices', function() use ($e) { |
|
293 | 293 | |
294 | 294 | ?> |
295 | 295 | <div class="error"> |
296 | - <p><?php printf( '%1$s: %2$s', $this->plugin_name, $e->getMessage() ); ?></p> |
|
296 | + <p><?php printf('%1$s: %2$s', $this->plugin_name, $e->getMessage()); ?></p> |
|
297 | 297 | </div> |
298 | 298 | <?php |
299 | 299 | |
@@ -314,10 +314,10 @@ discard block |
||
314 | 314 | <div class="update-nag"> |
315 | 315 | <?php |
316 | 316 | |
317 | - $settings_page = esc_url( admin_url( 'options-general.php?page=wp-php-console' ) ); |
|
317 | + $settings_page = esc_url(admin_url('options-general.php?page=wp-php-console')); |
|
318 | 318 | |
319 | 319 | /* translators: Placeholders: %1$s - opening HTML <a> link tag; %2$s closing HTML </a> link tag */ |
320 | - printf( $this->plugin_name . ': ' . __( 'Please remember to %1$s set a password %2$s if you want to enable terminal.', 'wp-php-console' ), '<a href="' . $settings_page .'">', '</a>' ); |
|
320 | + printf($this->plugin_name.': '.__('Please remember to %1$s set a password %2$s if you want to enable terminal.', 'wp-php-console'), '<a href="'.$settings_page.'">', '</a>'); |
|
321 | 321 | |
322 | 322 | ?> |
323 | 323 | </div> |
@@ -334,14 +334,14 @@ discard block |
||
334 | 334 | public function register_settings_page() { |
335 | 335 | |
336 | 336 | add_options_page( |
337 | - __( 'WP PHP Console', 'wp-php-console' ), |
|
338 | - __( 'WP PHP Console', 'wp-php-console' ), |
|
337 | + __('WP PHP Console', 'wp-php-console'), |
|
338 | + __('WP PHP Console', 'wp-php-console'), |
|
339 | 339 | 'manage_options', |
340 | 340 | $this->plugin_slug, |
341 | - array( $this, 'settings_page' ) |
|
341 | + array($this, 'settings_page') |
|
342 | 342 | ); |
343 | 343 | |
344 | - add_action( 'admin_init', array( $this, 'register_settings' ) ); |
|
344 | + add_action('admin_init', array($this, 'register_settings')); |
|
345 | 345 | |
346 | 346 | } |
347 | 347 | |
@@ -356,60 +356,60 @@ discard block |
||
356 | 356 | register_setting( |
357 | 357 | 'wp_php_console', |
358 | 358 | 'wp_php_console', |
359 | - array( $this, 'sanitize_field' ) |
|
359 | + array($this, 'sanitize_field') |
|
360 | 360 | ); |
361 | 361 | |
362 | 362 | add_settings_section( |
363 | 363 | 'wp_php_console', |
364 | - __( 'Settings', 'wp-php-console' ), |
|
365 | - array( $this, 'settings_info' ), |
|
364 | + __('Settings', 'wp-php-console'), |
|
365 | + array($this, 'settings_info'), |
|
366 | 366 | $this->plugin_slug |
367 | 367 | ); |
368 | 368 | |
369 | 369 | add_settings_field( |
370 | 370 | 'password', |
371 | - __( 'Password', 'wp-php-console' ), |
|
372 | - array( $this, 'password_field' ), |
|
371 | + __('Password', 'wp-php-console'), |
|
372 | + array($this, 'password_field'), |
|
373 | 373 | $this->plugin_slug, |
374 | 374 | 'wp_php_console' |
375 | 375 | ); |
376 | 376 | |
377 | 377 | add_settings_field( |
378 | 378 | 'ssl', |
379 | - __( 'Allow only on SSL', 'wp-php-console' ), |
|
380 | - array( $this, 'ssl_field' ), |
|
379 | + __('Allow only on SSL', 'wp-php-console'), |
|
380 | + array($this, 'ssl_field'), |
|
381 | 381 | $this->plugin_slug, |
382 | 382 | 'wp_php_console' |
383 | 383 | ); |
384 | 384 | |
385 | 385 | add_settings_field( |
386 | 386 | 'ip', |
387 | - __( 'Allowed IP Masks', 'wp-php-console' ), |
|
388 | - array( $this, 'ip_field' ), |
|
387 | + __('Allowed IP Masks', 'wp-php-console'), |
|
388 | + array($this, 'ip_field'), |
|
389 | 389 | $this->plugin_slug, |
390 | 390 | 'wp_php_console' |
391 | 391 | ); |
392 | 392 | |
393 | 393 | add_settings_field( |
394 | 394 | 'register', |
395 | - __( 'Register PC Class ', 'wp-php-console' ), |
|
396 | - array( $this, 'register_field' ), |
|
395 | + __('Register PC Class ', 'wp-php-console'), |
|
396 | + array($this, 'register_field'), |
|
397 | 397 | $this->plugin_slug, |
398 | 398 | 'wp_php_console' |
399 | 399 | ); |
400 | 400 | |
401 | 401 | add_settings_field( |
402 | 402 | 'stack', |
403 | - __( 'Show Call Stack', 'wp-php-console' ), |
|
404 | - array( $this, 'stack_field' ), |
|
403 | + __('Show Call Stack', 'wp-php-console'), |
|
404 | + array($this, 'stack_field'), |
|
405 | 405 | $this->plugin_slug, |
406 | 406 | 'wp_php_console' |
407 | 407 | ); |
408 | 408 | |
409 | 409 | add_settings_field( |
410 | 410 | 'short', |
411 | - __( 'Short Path Names', 'wp-php-console' ), |
|
412 | - array( $this, 'short_field' ), |
|
411 | + __('Short Path Names', 'wp-php-console'), |
|
412 | + array($this, 'short_field'), |
|
413 | 413 | $this->plugin_slug, |
414 | 414 | 'wp_php_console' |
415 | 415 | ); |
@@ -424,13 +424,13 @@ discard block |
||
424 | 424 | */ |
425 | 425 | public function password_field() { |
426 | 426 | |
427 | - printf ( |
|
427 | + printf( |
|
428 | 428 | '<input type="password" id="wp-php-console-password" name="wp_php_console[password]" value="%s" />', |
429 | - isset( $this->options['password'] ) ? esc_attr( $this->options['password'] ) : '' |
|
429 | + isset($this->options['password']) ? esc_attr($this->options['password']) : '' |
|
430 | 430 | ); |
431 | - echo '<label for="wp-php-console-ip">' . esc_html__( 'Required', 'wp-php-console' ) . '</label>'; |
|
431 | + echo '<label for="wp-php-console-ip">'.esc_html__('Required', 'wp-php-console').'</label>'; |
|
432 | 432 | echo '<br />'; |
433 | - echo '<small class="description">' . esc_html__( 'The password for the eval terminal. If empty, the plugin will not work.', 'wp-php-console' ) . '</small>'; |
|
433 | + echo '<small class="description">'.esc_html__('The password for the eval terminal. If empty, the plugin will not work.', 'wp-php-console').'</small>'; |
|
434 | 434 | |
435 | 435 | } |
436 | 436 | |
@@ -442,15 +442,15 @@ discard block |
||
442 | 442 | */ |
443 | 443 | public function ssl_field() { |
444 | 444 | |
445 | - $ssl = isset( $this->options['ssl'] ) ? esc_attr( $this->options['ssl']) : ''; |
|
445 | + $ssl = isset($this->options['ssl']) ? esc_attr($this->options['ssl']) : ''; |
|
446 | 446 | |
447 | - printf ( |
|
447 | + printf( |
|
448 | 448 | '<input type="checkbox" id="wp-php-console-ssl" name="wp_php_console[ssl]" value="1" %s /> ', |
449 | 449 | $ssl ? 'checked="checked"' : '' |
450 | 450 | ); |
451 | - echo '<label for="wp-php-console-ssl">' . esc_html__( 'Yes', 'wp-php-console' ) . '</label>'; |
|
451 | + echo '<label for="wp-php-console-ssl">'.esc_html__('Yes', 'wp-php-console').'</label>'; |
|
452 | 452 | echo '<br />'; |
453 | - echo '<small class="description">' . esc_html__( 'Tick this option if you want the eval terminal to work only on a SSL connection.', 'wp-php-console' ) . '</small>'; |
|
453 | + echo '<small class="description">'.esc_html__('Tick this option if you want the eval terminal to work only on a SSL connection.', 'wp-php-console').'</small>'; |
|
454 | 454 | |
455 | 455 | } |
456 | 456 | |
@@ -462,14 +462,14 @@ discard block |
||
462 | 462 | */ |
463 | 463 | public function ip_field() { |
464 | 464 | |
465 | - printf ( |
|
465 | + printf( |
|
466 | 466 | '<input type="text" class="regular-text" id="wp-php-console-ip" name="wp_php_console[ip]" value="%s" /> ', |
467 | - isset( $this->options['ip'] ) ? esc_attr( $this->options['ip']) : '' |
|
467 | + isset($this->options['ip']) ? esc_attr($this->options['ip']) : '' |
|
468 | 468 | ); |
469 | - echo '<label for="wp-php-console-ip">' . esc_html__( 'IP addresses (optional)', 'wp-php-console' ) . '</label>'; |
|
469 | + echo '<label for="wp-php-console-ip">'.esc_html__('IP addresses (optional)', 'wp-php-console').'</label>'; |
|
470 | 470 | echo '<br />'; |
471 | 471 | /* translators: VVV Varying Vagrant Vagrants default IP address */ |
472 | - printf ( __( '<small class="description">' . __( 'You may specify an IP address (e.g. <code>192.168.50.4</code>, %s default IP address), a range of addresses (<code>192.168.*.*</code>) or multiple addresses, comma separated (<code>192.168.10.25,192.168.10.28</code>) to grant access to the eval terminal.', 'wp-php-console' ) . '</small>' ), '<a href="https://github.com/Varying-Vagrant-Vagrants/VVV">Varying Vagrant Vagrants</a>' ); |
|
472 | + printf(__('<small class="description">'.__('You may specify an IP address (e.g. <code>192.168.50.4</code>, %s default IP address), a range of addresses (<code>192.168.*.*</code>) or multiple addresses, comma separated (<code>192.168.10.25,192.168.10.28</code>) to grant access to the eval terminal.', 'wp-php-console').'</small>'), '<a href="https://github.com/Varying-Vagrant-Vagrants/VVV">Varying Vagrant Vagrants</a>'); |
|
473 | 473 | |
474 | 474 | } |
475 | 475 | |
@@ -481,15 +481,15 @@ discard block |
||
481 | 481 | */ |
482 | 482 | public function register_field() { |
483 | 483 | |
484 | - $register = ! empty( $this->options['register'] ); |
|
484 | + $register = ! empty($this->options['register']); |
|
485 | 485 | |
486 | - printf ( |
|
486 | + printf( |
|
487 | 487 | '<input type="checkbox" id="wp-php-console-register" name="wp_php_console[register]" value="1" %s /> ', |
488 | 488 | $register ? 'checked="checked"' : '' |
489 | 489 | ); |
490 | - echo '<label for="wp-php-console-register">' . esc_html__( 'Yes', 'wp-php-console' ) . '</label>'; |
|
490 | + echo '<label for="wp-php-console-register">'.esc_html__('Yes', 'wp-php-console').'</label>'; |
|
491 | 491 | echo '<br />'; |
492 | - echo '<small class="description">' . __( 'Choose to register PC in the global namespace. Allows to write <code>PC::debug($var, $tag)</code> or <code>PC::magic_tag($var)</code> instructions in PHP to inspect <code>$var</code> in the JavaScript console.', 'wp-php-console' ) . '</small>'; |
|
492 | + echo '<small class="description">'.__('Choose to register PC in the global namespace. Allows to write <code>PC::debug($var, $tag)</code> or <code>PC::magic_tag($var)</code> instructions in PHP to inspect <code>$var</code> in the JavaScript console.', 'wp-php-console').'</small>'; |
|
493 | 493 | |
494 | 494 | } |
495 | 495 | |
@@ -501,15 +501,15 @@ discard block |
||
501 | 501 | */ |
502 | 502 | public function stack_field() { |
503 | 503 | |
504 | - $stack = ! empty( $this->options['stack'] ); |
|
504 | + $stack = ! empty($this->options['stack']); |
|
505 | 505 | |
506 | - printf ( |
|
506 | + printf( |
|
507 | 507 | '<input type="checkbox" id="wp-php-console-stack" name="wp_php_console[stack]" value="1" %s /> ', |
508 | 508 | $stack ? 'checked="checked"' : '' |
509 | 509 | ); |
510 | - echo '<label for="wp-php-console-stack">' . esc_html__( 'Yes', 'wp-php-console' ) . '</label>'; |
|
510 | + echo '<label for="wp-php-console-stack">'.esc_html__('Yes', 'wp-php-console').'</label>'; |
|
511 | 511 | echo '<br />'; |
512 | - echo '<small class="description">' . __( "Choose to also see the call stack when PHP Console writes to the browser's JavaScript-console.", 'wp-php-console' ) . '</small>'; |
|
512 | + echo '<small class="description">'.__("Choose to also see the call stack when PHP Console writes to the browser's JavaScript-console.", 'wp-php-console').'</small>'; |
|
513 | 513 | |
514 | 514 | } |
515 | 515 | |
@@ -521,15 +521,15 @@ discard block |
||
521 | 521 | */ |
522 | 522 | public function short_field() { |
523 | 523 | |
524 | - $short = ! empty( $this->options['short'] ); |
|
524 | + $short = ! empty($this->options['short']); |
|
525 | 525 | |
526 | - printf ( |
|
526 | + printf( |
|
527 | 527 | '<input type="checkbox" id="wp-php-console-short" name="wp_php_console[short]" value="1" %s /> ', |
528 | 528 | $short ? 'checked="checked"' : '' |
529 | 529 | ); |
530 | - echo '<label for="wp-php-console-short">' . esc_html__( 'Yes', 'wp-php-console' ) . '</label>'; |
|
530 | + echo '<label for="wp-php-console-short">'.esc_html__('Yes', 'wp-php-console').'</label>'; |
|
531 | 531 | echo '<br />'; |
532 | - echo '<small class="description">' . __( "Choose to shorten PHP Console error sources and traces paths in browser's JavaScript-console. Paths like <code>/server/path/to/document/root/WP/wp-admin/admin.php:31</code> will be displayed as <code>/W/wp-admin/admin.php:31</code>", 'wp-php-console' ) . '</small>'; |
|
532 | + echo '<small class="description">'.__("Choose to shorten PHP Console error sources and traces paths in browser's JavaScript-console. Paths like <code>/server/path/to/document/root/WP/wp-admin/admin.php:31</code> will be displayed as <code>/W/wp-admin/admin.php:31</code>", 'wp-php-console').'</small>'; |
|
533 | 533 | |
534 | 534 | } |
535 | 535 | |
@@ -541,25 +541,25 @@ discard block |
||
541 | 541 | * @param string $input user input |
542 | 542 | * @return array sanitized inputs |
543 | 543 | */ |
544 | - public function sanitize_field( $input ) { |
|
544 | + public function sanitize_field($input) { |
|
545 | 545 | |
546 | 546 | $sanitized_input = array(); |
547 | 547 | |
548 | - if ( isset( $input['password'] ) ) { |
|
549 | - $sanitized_input['password'] = sanitize_text_field( $input['password'] ); |
|
548 | + if (isset($input['password'])) { |
|
549 | + $sanitized_input['password'] = sanitize_text_field($input['password']); |
|
550 | 550 | } |
551 | 551 | |
552 | - if ( isset( $input['ssl'] ) ) { |
|
553 | - $sanitized_input['ssl'] = ! empty( $input['ssl'] ) ? 1 : ''; |
|
552 | + if (isset($input['ssl'])) { |
|
553 | + $sanitized_input['ssl'] = ! empty($input['ssl']) ? 1 : ''; |
|
554 | 554 | } |
555 | 555 | |
556 | - if ( isset( $input['ip'] ) ) { |
|
557 | - $sanitized_input['ip'] = sanitize_text_field( $input['ip'] ); |
|
556 | + if (isset($input['ip'])) { |
|
557 | + $sanitized_input['ip'] = sanitize_text_field($input['ip']); |
|
558 | 558 | } |
559 | 559 | |
560 | - $sanitized_input['register'] = empty( $input['register'] ) ? '' : 1; |
|
561 | - $sanitized_input['stack'] = empty( $input['stack'] ) ? '' : 1; |
|
562 | - $sanitized_input['short'] = empty( $input['short'] ) ? '' : 1; |
|
560 | + $sanitized_input['register'] = empty($input['register']) ? '' : 1; |
|
561 | + $sanitized_input['stack'] = empty($input['stack']) ? '' : 1; |
|
562 | + $sanitized_input['short'] = empty($input['short']) ? '' : 1; |
|
563 | 563 | |
564 | 564 | return $sanitized_input; |
565 | 565 | } |
@@ -574,12 +574,12 @@ discard block |
||
574 | 574 | |
575 | 575 | ?> |
576 | 576 | <div class="wrap"> |
577 | - <h2><?php esc_html_e( 'WP PHP Console', 'wp-php-console' ); ?></h2> |
|
577 | + <h2><?php esc_html_e('WP PHP Console', 'wp-php-console'); ?></h2> |
|
578 | 578 | <hr /> |
579 | 579 | <form method="post" action="options.php"> |
580 | 580 | <?php |
581 | - settings_fields( 'wp_php_console' ); |
|
582 | - do_settings_sections( $this->plugin_slug ); |
|
581 | + settings_fields('wp_php_console'); |
|
582 | + do_settings_sections($this->plugin_slug); |
|
583 | 583 | submit_button(); |
584 | 584 | ?> |
585 | 585 | </form> |
@@ -599,14 +599,14 @@ discard block |
||
599 | 599 | |
600 | 600 | ?> |
601 | 601 | <p><?php /* translators: %s refers to 'PHP Console' Chrome extension, will print download link for the Chrome extension */ |
602 | - printf( _x( 'This plugin allows you to use %s within your WordPress installation for testing, debugging and development purposes.<br/>Usage instructions:', 'PHP Console, the Chrome Extension', 'wp-php-console' ), '<a href="https://github.com/barbushin/php-console" target="_blank">PHP Console</a>' ); ?></p> |
|
602 | + printf(_x('This plugin allows you to use %s within your WordPress installation for testing, debugging and development purposes.<br/>Usage instructions:', 'PHP Console, the Chrome Extension', 'wp-php-console'), '<a href="https://github.com/barbushin/php-console" target="_blank">PHP Console</a>'); ?></p> |
|
603 | 603 | <ol> |
604 | 604 | <li><?php /* translators: Install PHP Console extension for Google Chrome download link */ |
605 | - printf( _x( 'Make sure you have downloaded and installed %s.', 'PHP Console, the Chrome Extension', 'wp-php-console' ), '<a target="_blank" href="https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef">PHP Console extension for Google Chrome</a>' ); ?></li> |
|
606 | - <li><?php _e( 'Set a password for the eval terminal in the options below and hit <code>save changes</code>.', 'wp-php-console' ); ?></li> |
|
607 | - <li><?php _e( 'Reload any page of your installation and click on the key icon in your Chrome browser address bar, enter your password and access the terminal.', 'wp-php-console' ); ?></li> |
|
608 | - <li><?php _e( 'From the eval terminal you can execute any PHP or WordPress specific function, including functions from your plugins and active theme.', 'wp-php-console' ); ?></li> |
|
609 | - <li><?php _e( "In your PHP code, you can call PHP Console debug statements like <code>debug($var, $tag)</code> to display PHP variables in the browser's JavaScript-console (<code>Ctrl Shift J </code>) and optionally filter selected tags through the browser's Remote PHP Eval Terminal screen's Ignore Debug options.", 'wp-php-console' ); ?></li> |
|
605 | + printf(_x('Make sure you have downloaded and installed %s.', 'PHP Console, the Chrome Extension', 'wp-php-console'), '<a target="_blank" href="https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef">PHP Console extension for Google Chrome</a>'); ?></li> |
|
606 | + <li><?php _e('Set a password for the eval terminal in the options below and hit <code>save changes</code>.', 'wp-php-console'); ?></li> |
|
607 | + <li><?php _e('Reload any page of your installation and click on the key icon in your Chrome browser address bar, enter your password and access the terminal.', 'wp-php-console'); ?></li> |
|
608 | + <li><?php _e('From the eval terminal you can execute any PHP or WordPress specific function, including functions from your plugins and active theme.', 'wp-php-console'); ?></li> |
|
609 | + <li><?php _e("In your PHP code, you can call PHP Console debug statements like <code>debug($var, $tag)</code> to display PHP variables in the browser's JavaScript-console (<code>Ctrl Shift J </code>) and optionally filter selected tags through the browser's Remote PHP Eval Terminal screen's Ignore Debug options.", 'wp-php-console'); ?></li> |
|
610 | 610 | </ol> |
611 | 611 | <?php |
612 | 612 |