@@ -7,8 +7,8 @@ |
||
| 7 | 7 | * @package WP_PHP_Console |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
| 10 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
| 11 | 11 | exit; // If uninstall not called from WordPress, then exit. |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -delete_option( 'wp_php_console' ); |
|
| 14 | +delete_option('wp_php_console'); |
|
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * Domain Path: /languages |
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | -if ( ! defined( 'WPINC' ) ) { |
|
| 19 | +if ( ! defined('WPINC')) { |
|
| 20 | 20 | exit; |
| 21 | 21 | } |
| 22 | 22 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | |
| 46 | 46 | // Composer fallback for PHP < 5.3.0. |
| 47 | -if ( version_compare( PHP_VERSION, '5.3.0' ) === -1 ) { |
|
| 47 | +if (version_compare(PHP_VERSION, '5.3.0') === -1) { |
|
| 48 | 48 | include_once 'vendor/autoload_52.php'; |
| 49 | 49 | } else { |
| 50 | 50 | include_once 'vendor/autoload.php'; |
@@ -57,13 +57,13 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | $this_plugin_checks = new WP_Requirements( |
| 59 | 59 | 'WP PHP Console', |
| 60 | - plugin_basename( __FILE__ ), |
|
| 60 | + plugin_basename(__FILE__), |
|
| 61 | 61 | array( |
| 62 | 62 | 'PHP' => '5.4.0', |
| 63 | 63 | ) |
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | -if ( $this_plugin_checks->pass() === false ) { |
|
| 66 | +if ($this_plugin_checks->pass() === false) { |
|
| 67 | 67 | // Stop. |
| 68 | 68 | $this_plugin_checks->halt(); |
| 69 | 69 | return; |
@@ -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 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $this->options = $this->get_options(); |
| 74 | 74 | |
| 75 | 75 | // Bail out if PHP Console can't be found |
| 76 | - if ( ! class_exists( 'PhpConsole\Connector' ) ) { |
|
| 76 | + if ( ! class_exists('PhpConsole\Connector')) { |
|
| 77 | 77 | return; |
| 78 | 78 | } |
| 79 | 79 | |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | $this->apply_options(); |
| 85 | 85 | |
| 86 | 86 | // Translations |
| 87 | - add_action( 'plugins_loaded', array( $this, 'set_locale' ) ); |
|
| 87 | + add_action('plugins_loaded', array($this, 'set_locale')); |
|
| 88 | 88 | |
| 89 | 89 | // Admin menu |
| 90 | - add_action( 'admin_menu', array( $this, 'register_settings_page' ) ); |
|
| 90 | + add_action('admin_menu', array($this, 'register_settings_page')); |
|
| 91 | 91 | |
| 92 | 92 | // Delay further PHP Console initialisation to have more context during Remote PHP execution |
| 93 | - add_action( 'wp_loaded', array( $this, 'init' ) ); |
|
| 93 | + add_action('wp_loaded', array($this, 'init')); |
|
| 94 | 94 | |
| 95 | 95 | } |
| 96 | 96 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | load_plugin_textdomain( |
| 106 | 106 | $this->plugin_slug, |
| 107 | 107 | false, |
| 108 | - dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
|
| 108 | + dirname(plugin_basename(__FILE__)).'/languages/' ); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | |
@@ -120,15 +120,15 @@ discard block |
||
| 120 | 120 | // so all temporary data will be stored in $_SESSION. |
| 121 | 121 | // But there is some problem with frameworks like WordPress that override PHP session handler. |
| 122 | 122 | // PHP Console has alternative storage drivers for this - we will write to a temporary file: |
| 123 | - $phpcdir = dirname( __FILE__ ) . '/tmp'; |
|
| 124 | - $make_dir = wp_mkdir_p( $phpcdir ); |
|
| 123 | + $phpcdir = dirname(__FILE__).'/tmp'; |
|
| 124 | + $make_dir = wp_mkdir_p($phpcdir); |
|
| 125 | 125 | |
| 126 | - if ( $make_dir === true ) { |
|
| 126 | + if ($make_dir === true) { |
|
| 127 | 127 | |
| 128 | 128 | try { |
| 129 | - $storage = new PhpConsole\Storage\File( $phpcdir . '/' . md5( __FILE__ ) . '_pc.data' ); |
|
| 130 | - PhpConsole\Connector::setPostponeStorage( $storage ); |
|
| 131 | - } catch( \Exception $e ) { |
|
| 129 | + $storage = new PhpConsole\Storage\File($phpcdir.'/'.md5(__FILE__).'_pc.data'); |
|
| 130 | + PhpConsole\Connector::setPostponeStorage($storage); |
|
| 131 | + } catch (\Exception $e) { |
|
| 132 | 132 | // TODO $storage is under DOCUMENT_ROOT - it's insecure but did not find another solution in WP |
| 133 | 133 | // $this->print_notice_exception( $e ); |
| 134 | 134 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * @return array |
| 149 | 149 | */ |
| 150 | 150 | protected function get_options() { |
| 151 | - return get_option( 'wp_php_console', array() ); |
|
| 151 | + return get_option('wp_php_console', array()); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
@@ -160,26 +160,26 @@ discard block |
||
| 160 | 160 | private function apply_options() { |
| 161 | 161 | |
| 162 | 162 | // Apply 'register' option to PHP Console |
| 163 | - if ( ! empty( $this->options['register'] ) && ! class_exists( 'PC', false ) ) { |
|
| 163 | + if ( ! empty($this->options['register']) && ! class_exists('PC', false)) { |
|
| 164 | 164 | // Only if PC not registered yet |
| 165 | 165 | try { |
| 166 | 166 | PhpConsole\Helper::register(); |
| 167 | - } catch( \Exception $e ) { |
|
| 168 | - $this->print_notice_exception( $e ); |
|
| 167 | + } catch (\Exception $e) { |
|
| 168 | + $this->print_notice_exception($e); |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // Apply 'stack' option to PHP Console |
| 173 | - if ( ! empty( $this->options['stack'] ) ) { |
|
| 173 | + if ( ! empty($this->options['stack'])) { |
|
| 174 | 174 | $connector->getDebugDispatcher()->detectTraceAndSource = true; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | // Apply 'short' option to PHP Console |
| 178 | - if ( ! empty( $this->options['short'] ) ) { |
|
| 178 | + if ( ! empty($this->options['short'])) { |
|
| 179 | 179 | try { |
| 180 | - $connector->setSourcesBasePath( $_SERVER['DOCUMENT_ROOT'] ); |
|
| 181 | - } catch ( \Exception $e ) { |
|
| 182 | - $this->print_notice_exception( $e ); |
|
| 180 | + $connector->setSourcesBasePath($_SERVER['DOCUMENT_ROOT']); |
|
| 181 | + } catch (\Exception $e) { |
|
| 182 | + $this->print_notice_exception($e); |
|
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
@@ -194,78 +194,78 @@ discard block |
||
| 194 | 194 | public function init() { |
| 195 | 195 | |
| 196 | 196 | // Display admin notice and abort if no password has been set |
| 197 | - $password = isset( $this->options['password'] ) ? $this->options['password'] : ''; |
|
| 198 | - if ( ! $password ) { |
|
| 199 | - add_action( 'admin_notices', array( $this, 'password_notice' ) ); |
|
| 197 | + $password = isset($this->options['password']) ? $this->options['password'] : ''; |
|
| 198 | + if ( ! $password) { |
|
| 199 | + add_action('admin_notices', array($this, 'password_notice')); |
|
| 200 | 200 | return; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | // Selectively remove slashes added by WordPress as expected by PhpConsole |
| 204 | - if ( isset( $_POST[PhpConsole\Connector::POST_VAR_NAME] ) ) { |
|
| 205 | - $_POST[ PhpConsole\Connector::POST_VAR_NAME ] = stripslashes_deep( $_POST[ PhpConsole\Connector::POST_VAR_NAME ] ); |
|
| 204 | + if (isset($_POST[PhpConsole\Connector::POST_VAR_NAME])) { |
|
| 205 | + $_POST[PhpConsole\Connector::POST_VAR_NAME] = stripslashes_deep($_POST[PhpConsole\Connector::POST_VAR_NAME]); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | $connector = PhpConsole\Connector::getInstance(); |
| 209 | 209 | |
| 210 | 210 | try { |
| 211 | - $connector->setPassword( $password ); |
|
| 212 | - } catch ( \Exception $e ) { |
|
| 213 | - $this->print_notice_exception( $e ); |
|
| 211 | + $connector->setPassword($password); |
|
| 212 | + } catch (\Exception $e) { |
|
| 213 | + $this->print_notice_exception($e); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | // PhpConsole instance |
| 217 | 217 | $handler = PhpConsole\Handler::getInstance(); |
| 218 | 218 | |
| 219 | - if ( PhpConsole\Handler::getInstance()->isStarted() !== true ) { |
|
| 219 | + if (PhpConsole\Handler::getInstance()->isStarted() !== true) { |
|
| 220 | 220 | try { |
| 221 | 221 | $handler->start(); |
| 222 | - } catch( \Exception $e ) { |
|
| 223 | - $this->print_notice_exception( $e ); |
|
| 222 | + } catch (\Exception $e) { |
|
| 223 | + $this->print_notice_exception($e); |
|
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | // Enable SSL-only mode |
| 228 | - $enableSslOnlyMode = isset( $this->options['ssl'] ) ? ( ! empty( $this->options['ssl'] ) ? $this->options['ssl'] : '' ) : ''; |
|
| 228 | + $enableSslOnlyMode = isset($this->options['ssl']) ? ( ! empty($this->options['ssl']) ? $this->options['ssl'] : '') : ''; |
|
| 229 | 229 | |
| 230 | - if ( $enableSslOnlyMode ) { |
|
| 230 | + if ($enableSslOnlyMode) { |
|
| 231 | 231 | $connector->enableSslOnlyMode(); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | // Restrict IP addresses |
| 235 | - $allowedIpMasks = isset( $this->options['ip'] ) ? ( ! empty( $this->options['ip'] ) ? explode( ',', $this->options['ip'] ) : '' ) : ''; |
|
| 235 | + $allowedIpMasks = isset($this->options['ip']) ? ( ! empty($this->options['ip']) ? explode(',', $this->options['ip']) : '') : ''; |
|
| 236 | 236 | |
| 237 | - if ( is_array( $allowedIpMasks ) && ! empty( $allowedIpMasks ) ) { |
|
| 238 | - $connector->setAllowedIpMasks( (array) $allowedIpMasks ); |
|
| 237 | + if (is_array($allowedIpMasks) && ! empty($allowedIpMasks)) { |
|
| 238 | + $connector->setAllowedIpMasks((array) $allowedIpMasks); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | $evalProvider = $connector->getEvalDispatcher()->getEvalProvider(); |
| 242 | 242 | |
| 243 | 243 | try { |
| 244 | - $evalProvider->addSharedVar( 'uri', $_SERVER['REQUEST_URI'] ); |
|
| 245 | - } catch ( \Exception $e ) { |
|
| 246 | - $this->print_notice_exception( $e ); |
|
| 244 | + $evalProvider->addSharedVar('uri', $_SERVER['REQUEST_URI']); |
|
| 245 | + } catch (\Exception $e) { |
|
| 246 | + $this->print_notice_exception($e); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | try { |
| 250 | - $evalProvider->addSharedVarReference( 'post', $_POST ); |
|
| 251 | - } catch ( \Exception $e ) { |
|
| 252 | - $this->print_notice_exception( $e ); |
|
| 250 | + $evalProvider->addSharedVarReference('post', $_POST); |
|
| 251 | + } catch (\Exception $e) { |
|
| 252 | + $this->print_notice_exception($e); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - $openBaseDirs = array( ABSPATH, get_template_directory() ); |
|
| 255 | + $openBaseDirs = array(ABSPATH, get_template_directory()); |
|
| 256 | 256 | |
| 257 | 257 | try { |
| 258 | - $evalProvider->addSharedVarReference( 'dirs', $openBaseDirs ); |
|
| 259 | - } catch ( \Exception $e ) { |
|
| 260 | - $this->print_notice_exception( $e ); |
|
| 258 | + $evalProvider->addSharedVarReference('dirs', $openBaseDirs); |
|
| 259 | + } catch (\Exception $e) { |
|
| 260 | + $this->print_notice_exception($e); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - $evalProvider->setOpenBaseDirs( $openBaseDirs ); |
|
| 263 | + $evalProvider->setOpenBaseDirs($openBaseDirs); |
|
| 264 | 264 | |
| 265 | 265 | try { |
| 266 | 266 | $connector->startEvalRequestsListener(); |
| 267 | - } catch ( \Exception $e ) { |
|
| 268 | - $this->print_notice_exception( $e ); |
|
| 267 | + } catch (\Exception $e) { |
|
| 268 | + $this->print_notice_exception($e); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | } |
@@ -278,13 +278,13 @@ discard block |
||
| 278 | 278 | * @param \Exception $e Exception object |
| 279 | 279 | * @return void |
| 280 | 280 | */ |
| 281 | - public function print_notice_exception( \Exception $e ) { |
|
| 281 | + public function print_notice_exception(\Exception $e) { |
|
| 282 | 282 | |
| 283 | - add_action( 'admin_notices', function() use ( $e ) { |
|
| 283 | + add_action('admin_notices', function() use ($e) { |
|
| 284 | 284 | |
| 285 | 285 | ?> |
| 286 | 286 | <div class="error"> |
| 287 | - <p><?php printf( '%1$s: %2$s', $this->plugin_name, $e->getMessage() ); ?></p> |
|
| 287 | + <p><?php printf('%1$s: %2$s', $this->plugin_name, $e->getMessage()); ?></p> |
|
| 288 | 288 | </div> |
| 289 | 289 | <?php |
| 290 | 290 | |
@@ -305,10 +305,10 @@ discard block |
||
| 305 | 305 | <div class="update-nag"> |
| 306 | 306 | <?php |
| 307 | 307 | |
| 308 | - $settings_page = esc_url( admin_url( 'options-general.php?page=wp-php-console' ) ); |
|
| 308 | + $settings_page = esc_url(admin_url('options-general.php?page=wp-php-console')); |
|
| 309 | 309 | |
| 310 | 310 | /* translators: Placeholders: %1$s - opening HTML <a> link tag; %2$s closing HTML </a> link tag */ |
| 311 | - 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>' ); |
|
| 311 | + 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>'); |
|
| 312 | 312 | |
| 313 | 313 | ?> |
| 314 | 314 | </div> |
@@ -325,14 +325,14 @@ discard block |
||
| 325 | 325 | public function register_settings_page() { |
| 326 | 326 | |
| 327 | 327 | add_options_page( |
| 328 | - __( 'WP PHP Console', 'wp-php-console' ), |
|
| 329 | - __( 'WP PHP Console', 'wp-php-console' ), |
|
| 328 | + __('WP PHP Console', 'wp-php-console'), |
|
| 329 | + __('WP PHP Console', 'wp-php-console'), |
|
| 330 | 330 | 'manage_options', |
| 331 | 331 | $this->plugin_slug, |
| 332 | - array( $this, 'settings_page' ) |
|
| 332 | + array($this, 'settings_page') |
|
| 333 | 333 | ); |
| 334 | 334 | |
| 335 | - add_action( 'admin_init', array( $this, 'register_settings' ) ); |
|
| 335 | + add_action('admin_init', array($this, 'register_settings')); |
|
| 336 | 336 | |
| 337 | 337 | } |
| 338 | 338 | |
@@ -347,60 +347,60 @@ discard block |
||
| 347 | 347 | register_setting( |
| 348 | 348 | 'wp_php_console', |
| 349 | 349 | 'wp_php_console', |
| 350 | - array( $this, 'sanitize_field' ) |
|
| 350 | + array($this, 'sanitize_field') |
|
| 351 | 351 | ); |
| 352 | 352 | |
| 353 | 353 | add_settings_section( |
| 354 | 354 | 'wp_php_console', |
| 355 | - __( 'Settings', 'wp-php-console' ), |
|
| 356 | - array( $this, 'settings_info' ), |
|
| 355 | + __('Settings', 'wp-php-console'), |
|
| 356 | + array($this, 'settings_info'), |
|
| 357 | 357 | $this->plugin_slug |
| 358 | 358 | ); |
| 359 | 359 | |
| 360 | 360 | add_settings_field( |
| 361 | 361 | 'password', |
| 362 | - __( 'Password', 'wp-php-console' ), |
|
| 363 | - array( $this, 'password_field' ), |
|
| 362 | + __('Password', 'wp-php-console'), |
|
| 363 | + array($this, 'password_field'), |
|
| 364 | 364 | $this->plugin_slug, |
| 365 | 365 | 'wp_php_console' |
| 366 | 366 | ); |
| 367 | 367 | |
| 368 | 368 | add_settings_field( |
| 369 | 369 | 'ssl', |
| 370 | - __( 'Allow only on SSL', 'wp-php-console' ), |
|
| 371 | - array( $this, 'ssl_field' ), |
|
| 370 | + __('Allow only on SSL', 'wp-php-console'), |
|
| 371 | + array($this, 'ssl_field'), |
|
| 372 | 372 | $this->plugin_slug, |
| 373 | 373 | 'wp_php_console' |
| 374 | 374 | ); |
| 375 | 375 | |
| 376 | 376 | add_settings_field( |
| 377 | 377 | 'ip', |
| 378 | - __( 'Allowed IP Masks', 'wp-php-console' ), |
|
| 379 | - array( $this, 'ip_field' ), |
|
| 378 | + __('Allowed IP Masks', 'wp-php-console'), |
|
| 379 | + array($this, 'ip_field'), |
|
| 380 | 380 | $this->plugin_slug, |
| 381 | 381 | 'wp_php_console' |
| 382 | 382 | ); |
| 383 | 383 | |
| 384 | 384 | add_settings_field( |
| 385 | 385 | 'register', |
| 386 | - __( 'Register PC Class ', 'wp-php-console' ), |
|
| 387 | - array( $this, 'register_field' ), |
|
| 386 | + __('Register PC Class ', 'wp-php-console'), |
|
| 387 | + array($this, 'register_field'), |
|
| 388 | 388 | $this->plugin_slug, |
| 389 | 389 | 'wp_php_console' |
| 390 | 390 | ); |
| 391 | 391 | |
| 392 | 392 | add_settings_field( |
| 393 | 393 | 'stack', |
| 394 | - __( 'Show Call Stack', 'wp-php-console' ), |
|
| 395 | - array( $this, 'stack_field' ), |
|
| 394 | + __('Show Call Stack', 'wp-php-console'), |
|
| 395 | + array($this, 'stack_field'), |
|
| 396 | 396 | $this->plugin_slug, |
| 397 | 397 | 'wp_php_console' |
| 398 | 398 | ); |
| 399 | 399 | |
| 400 | 400 | add_settings_field( |
| 401 | 401 | 'short', |
| 402 | - __( 'Short Path Names', 'wp-php-console' ), |
|
| 403 | - array( $this, 'short_field' ), |
|
| 402 | + __('Short Path Names', 'wp-php-console'), |
|
| 403 | + array($this, 'short_field'), |
|
| 404 | 404 | $this->plugin_slug, |
| 405 | 405 | 'wp_php_console' |
| 406 | 406 | ); |
@@ -415,13 +415,13 @@ discard block |
||
| 415 | 415 | */ |
| 416 | 416 | public function password_field() { |
| 417 | 417 | |
| 418 | - printf ( |
|
| 418 | + printf( |
|
| 419 | 419 | '<input type="password" id="wp-php-console-password" name="wp_php_console[password]" value="%s" />', |
| 420 | - isset( $this->options['password'] ) ? esc_attr( $this->options['password'] ) : '' |
|
| 420 | + isset($this->options['password']) ? esc_attr($this->options['password']) : '' |
|
| 421 | 421 | ); |
| 422 | - echo '<label for="wp-php-console-ip">' . esc_html__( 'Required', 'wp-php-console' ) . '</label>'; |
|
| 422 | + echo '<label for="wp-php-console-ip">'.esc_html__('Required', 'wp-php-console').'</label>'; |
|
| 423 | 423 | echo '<br />'; |
| 424 | - echo '<small class="description">' . esc_html__( 'The password for the eval terminal. If empty, the plugin will not work.', 'wp-php-console' ) . '</small>'; |
|
| 424 | + echo '<small class="description">'.esc_html__('The password for the eval terminal. If empty, the plugin will not work.', 'wp-php-console').'</small>'; |
|
| 425 | 425 | |
| 426 | 426 | } |
| 427 | 427 | |
@@ -433,15 +433,15 @@ discard block |
||
| 433 | 433 | */ |
| 434 | 434 | public function ssl_field() { |
| 435 | 435 | |
| 436 | - $ssl = isset( $this->options['ssl'] ) ? esc_attr( $this->options['ssl']) : ''; |
|
| 436 | + $ssl = isset($this->options['ssl']) ? esc_attr($this->options['ssl']) : ''; |
|
| 437 | 437 | |
| 438 | - printf ( |
|
| 438 | + printf( |
|
| 439 | 439 | '<input type="checkbox" id="wp-php-console-ssl" name="wp_php_console[ssl]" value="1" %s /> ', |
| 440 | 440 | $ssl ? 'checked="checked"' : '' |
| 441 | 441 | ); |
| 442 | - echo '<label for="wp-php-console-ssl">' . esc_html__( 'Yes', 'wp-php-console' ) . '</label>'; |
|
| 442 | + echo '<label for="wp-php-console-ssl">'.esc_html__('Yes', 'wp-php-console').'</label>'; |
|
| 443 | 443 | echo '<br />'; |
| 444 | - 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>'; |
|
| 444 | + 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>'; |
|
| 445 | 445 | |
| 446 | 446 | } |
| 447 | 447 | |
@@ -453,14 +453,14 @@ discard block |
||
| 453 | 453 | */ |
| 454 | 454 | public function ip_field() { |
| 455 | 455 | |
| 456 | - printf ( |
|
| 456 | + printf( |
|
| 457 | 457 | '<input type="text" class="regular-text" id="wp-php-console-ip" name="wp_php_console[ip]" value="%s" /> ', |
| 458 | - isset( $this->options['ip'] ) ? esc_attr( $this->options['ip']) : '' |
|
| 458 | + isset($this->options['ip']) ? esc_attr($this->options['ip']) : '' |
|
| 459 | 459 | ); |
| 460 | - echo '<label for="wp-php-console-ip">' . esc_html__( 'IP addresses (optional)', 'wp-php-console' ) . '</label>'; |
|
| 460 | + echo '<label for="wp-php-console-ip">'.esc_html__('IP addresses (optional)', 'wp-php-console').'</label>'; |
|
| 461 | 461 | echo '<br />'; |
| 462 | 462 | /* translators: VVV Varying Vagrant Vagrants default IP address */ |
| 463 | - 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>' ); |
|
| 463 | + 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>'); |
|
| 464 | 464 | |
| 465 | 465 | } |
| 466 | 466 | |
@@ -472,15 +472,15 @@ discard block |
||
| 472 | 472 | */ |
| 473 | 473 | public function register_field() { |
| 474 | 474 | |
| 475 | - $register = ! empty( $this->options['register'] ); |
|
| 475 | + $register = ! empty($this->options['register']); |
|
| 476 | 476 | |
| 477 | - printf ( |
|
| 477 | + printf( |
|
| 478 | 478 | '<input type="checkbox" id="wp-php-console-register" name="wp_php_console[register]" value="1" %s /> ', |
| 479 | 479 | $register ? 'checked="checked"' : '' |
| 480 | 480 | ); |
| 481 | - echo '<label for="wp-php-console-register">' . esc_html__( 'Yes', 'wp-php-console' ) . '</label>'; |
|
| 481 | + echo '<label for="wp-php-console-register">'.esc_html__('Yes', 'wp-php-console').'</label>'; |
|
| 482 | 482 | echo '<br />'; |
| 483 | - 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>'; |
|
| 483 | + 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>'; |
|
| 484 | 484 | |
| 485 | 485 | } |
| 486 | 486 | |
@@ -492,15 +492,15 @@ discard block |
||
| 492 | 492 | */ |
| 493 | 493 | public function stack_field() { |
| 494 | 494 | |
| 495 | - $stack = ! empty( $this->options['stack'] ); |
|
| 495 | + $stack = ! empty($this->options['stack']); |
|
| 496 | 496 | |
| 497 | - printf ( |
|
| 497 | + printf( |
|
| 498 | 498 | '<input type="checkbox" id="wp-php-console-stack" name="wp_php_console[stack]" value="1" %s /> ', |
| 499 | 499 | $stack ? 'checked="checked"' : '' |
| 500 | 500 | ); |
| 501 | - echo '<label for="wp-php-console-stack">' . esc_html__( 'Yes', 'wp-php-console' ) . '</label>'; |
|
| 501 | + echo '<label for="wp-php-console-stack">'.esc_html__('Yes', 'wp-php-console').'</label>'; |
|
| 502 | 502 | echo '<br />'; |
| 503 | - 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>'; |
|
| 503 | + 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>'; |
|
| 504 | 504 | |
| 505 | 505 | } |
| 506 | 506 | |
@@ -512,15 +512,15 @@ discard block |
||
| 512 | 512 | */ |
| 513 | 513 | public function short_field() { |
| 514 | 514 | |
| 515 | - $short = ! empty( $this->options['short'] ); |
|
| 515 | + $short = ! empty($this->options['short']); |
|
| 516 | 516 | |
| 517 | - printf ( |
|
| 517 | + printf( |
|
| 518 | 518 | '<input type="checkbox" id="wp-php-console-short" name="wp_php_console[short]" value="1" %s /> ', |
| 519 | 519 | $short ? 'checked="checked"' : '' |
| 520 | 520 | ); |
| 521 | - echo '<label for="wp-php-console-short">' . esc_html__( 'Yes', 'wp-php-console' ) . '</label>'; |
|
| 521 | + echo '<label for="wp-php-console-short">'.esc_html__('Yes', 'wp-php-console').'</label>'; |
|
| 522 | 522 | echo '<br />'; |
| 523 | - 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>'; |
|
| 523 | + 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>'; |
|
| 524 | 524 | |
| 525 | 525 | } |
| 526 | 526 | |
@@ -532,25 +532,25 @@ discard block |
||
| 532 | 532 | * @param string $input user input |
| 533 | 533 | * @return array sanitized inputs |
| 534 | 534 | */ |
| 535 | - public function sanitize_field( $input ) { |
|
| 535 | + public function sanitize_field($input) { |
|
| 536 | 536 | |
| 537 | 537 | $sanitized_input = array(); |
| 538 | 538 | |
| 539 | - if ( isset( $input['password'] ) ) { |
|
| 540 | - $sanitized_input['password'] = sanitize_text_field( $input['password'] ); |
|
| 539 | + if (isset($input['password'])) { |
|
| 540 | + $sanitized_input['password'] = sanitize_text_field($input['password']); |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | - if ( isset( $input['ssl'] ) ) { |
|
| 544 | - $sanitized_input['ssl'] = ! empty( $input['ssl'] ) ? 1 : ''; |
|
| 543 | + if (isset($input['ssl'])) { |
|
| 544 | + $sanitized_input['ssl'] = ! empty($input['ssl']) ? 1 : ''; |
|
| 545 | 545 | } |
| 546 | 546 | |
| 547 | - if ( isset( $input['ip'] ) ) { |
|
| 548 | - $sanitized_input['ip'] = sanitize_text_field( $input['ip'] ); |
|
| 547 | + if (isset($input['ip'])) { |
|
| 548 | + $sanitized_input['ip'] = sanitize_text_field($input['ip']); |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | - $sanitized_input['register'] = empty( $input['register'] ) ? '' : 1; |
|
| 552 | - $sanitized_input['stack'] = empty( $input['stack'] ) ? '' : 1; |
|
| 553 | - $sanitized_input['short'] = empty( $input['short'] ) ? '' : 1; |
|
| 551 | + $sanitized_input['register'] = empty($input['register']) ? '' : 1; |
|
| 552 | + $sanitized_input['stack'] = empty($input['stack']) ? '' : 1; |
|
| 553 | + $sanitized_input['short'] = empty($input['short']) ? '' : 1; |
|
| 554 | 554 | |
| 555 | 555 | return $sanitized_input; |
| 556 | 556 | } |
@@ -565,12 +565,12 @@ discard block |
||
| 565 | 565 | |
| 566 | 566 | ?> |
| 567 | 567 | <div class="wrap"> |
| 568 | - <h2><?php esc_html_e( 'WP PHP Console', 'wp-php-console' ); ?></h2> |
|
| 568 | + <h2><?php esc_html_e('WP PHP Console', 'wp-php-console'); ?></h2> |
|
| 569 | 569 | <hr /> |
| 570 | 570 | <form method="post" action="options.php"> |
| 571 | 571 | <?php |
| 572 | - settings_fields( 'wp_php_console' ); |
|
| 573 | - do_settings_sections( $this->plugin_slug ); |
|
| 572 | + settings_fields('wp_php_console'); |
|
| 573 | + do_settings_sections($this->plugin_slug); |
|
| 574 | 574 | submit_button(); |
| 575 | 575 | ?> |
| 576 | 576 | </form> |
@@ -590,14 +590,14 @@ discard block |
||
| 590 | 590 | |
| 591 | 591 | ?> |
| 592 | 592 | <p><?php /* translators: %s refers to 'PHP Console' Chrome extension, will print download link for the Chrome extension */ |
| 593 | - 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> |
|
| 593 | + 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> |
|
| 594 | 594 | <ol> |
| 595 | 595 | <li><?php /* translators: Install PHP Console extension for Google Chrome download link */ |
| 596 | - 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> |
|
| 597 | - <li><?php _e( 'Set a password for the eval terminal in the options below and hit <code>save changes</code>.', 'wp-php-console' ); ?></li> |
|
| 598 | - <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> |
|
| 599 | - <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> |
|
| 600 | - <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> |
|
| 596 | + 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> |
|
| 597 | + <li><?php _e('Set a password for the eval terminal in the options below and hit <code>save changes</code>.', 'wp-php-console'); ?></li> |
|
| 598 | + <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> |
|
| 599 | + <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> |
|
| 600 | + <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> |
|
| 601 | 601 | </ol> |
| 602 | 602 | <?php |
| 603 | 603 | |