@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | namespace WP_PHP_Console; |
| 16 | 16 | |
| 17 | -defined( 'ABSPATH' ) or exit; |
|
| 17 | +defined('ABSPATH') or exit; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * WP PHP Console admin handler. |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | self::output_admin_notices(); |
| 36 | 36 | |
| 37 | 37 | // init settings page |
| 38 | - if ( ! defined( 'DOING_AJAX' ) ) { |
|
| 38 | + if ( ! defined('DOING_AJAX')) { |
|
| 39 | 39 | new Admin\SettingsPage(); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -49,18 +49,18 @@ discard block |
||
| 49 | 49 | private static function output_admin_notices() { |
| 50 | 50 | |
| 51 | 51 | // display admin notice and abort if no password has been set |
| 52 | - add_action( 'all_admin_notices', static function() { |
|
| 52 | + add_action('all_admin_notices', static function() { |
|
| 53 | 53 | |
| 54 | - if ( ! Settings::has_eval_terminal_password() ) : |
|
| 54 | + if ( ! Settings::has_eval_terminal_password()) : |
|
| 55 | 55 | |
| 56 | 56 | ?> |
| 57 | 57 | <div class="notice notice-warning"> |
| 58 | 58 | <p> |
| 59 | 59 | <?php printf( |
| 60 | 60 | /* translators: Placeholders: %1$s - WP PHP Console name, %2$s - opening HTML <a> link tag; %3$s closing HTML </a> link tag */ |
| 61 | - __( '%1$s: Please remember to %2$sset a password%3$s if you want to enable the terminal.', 'wp-php-console' ), |
|
| 62 | - '<strong>' . Plugin::NAME . '</strong>', |
|
| 63 | - '<a href="' . esc_url( admin_url( 'options-general.php?page=wp_php_console' ) ) .'">', |
|
| 61 | + __('%1$s: Please remember to %2$sset a password%3$s if you want to enable the terminal.', 'wp-php-console'), |
|
| 62 | + '<strong>'.Plugin::NAME.'</strong>', |
|
| 63 | + '<a href="'.esc_url(admin_url('options-general.php?page=wp_php_console')).'">', |
|
| 64 | 64 | '</a>' |
| 65 | 65 | ); ?> |
| 66 | 66 | </p> |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | endif; |
| 71 | 71 | |
| 72 | - }, -1000 ); |
|
| 72 | + }, -1000); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | private static function add_plugin_page_row_action_links() { |
| 82 | 82 | |
| 83 | - add_filter( 'plugin_action_links_wp-php-console/wp-php-console.php', static function( $actions ) { |
|
| 83 | + add_filter('plugin_action_links_wp-php-console/wp-php-console.php', static function($actions) { |
|
| 84 | 84 | |
| 85 | - return array_merge( [ |
|
| 86 | - '<a href="' . esc_url( admin_url( 'options-general.php?page=' . str_replace( '-', '_', Plugin::ID ) ) ) . '">' . esc_html__( 'Settings', 'wp-php-console' ) . '</a>', |
|
| 87 | - '<a href="' . esc_url( Plugin::get_wp_php_console_repository_url() ) . '">' . esc_html__( 'GitHub', 'wp-php-console' ) . '</a>', |
|
| 88 | - '<a href="' . esc_url( Plugin::get_support_page_url() ) . '">' . esc_html__( 'Support', 'wp-php-console' ) . '</a>', |
|
| 89 | - '<a href="' . esc_url( Plugin::get_reviews_page_url() ) . '">' . esc_html__( 'Review', 'wp-php-console' ) . '</a>', |
|
| 90 | - ], $actions ); |
|
| 85 | + return array_merge([ |
|
| 86 | + '<a href="'.esc_url(admin_url('options-general.php?page='.str_replace('-', '_', Plugin::ID))).'">'.esc_html__('Settings', 'wp-php-console').'</a>', |
|
| 87 | + '<a href="'.esc_url(Plugin::get_wp_php_console_repository_url()).'">'.esc_html__('GitHub', 'wp-php-console').'</a>', |
|
| 88 | + '<a href="'.esc_url(Plugin::get_support_page_url()).'">'.esc_html__('Support', 'wp-php-console').'</a>', |
|
| 89 | + '<a href="'.esc_url(Plugin::get_reviews_page_url()).'">'.esc_html__('Review', 'wp-php-console').'</a>', |
|
| 90 | + ], $actions); |
|
| 91 | 91 | |
| 92 | 92 | } ); |
| 93 | 93 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | use WP_PHP_Console\Plugin; |
| 18 | 18 | use WP_PHP_Console\Settings; |
| 19 | 19 | |
| 20 | -defined( 'ABSPATH' ) or exit; |
|
| 20 | +defined('ABSPATH') or exit; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * WP PHP Console settings page handler. |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function __construct() { |
| 46 | 46 | |
| 47 | - $this->page_id = str_replace( '-', '_', Plugin::ID ); |
|
| 47 | + $this->page_id = str_replace('-', '_', Plugin::ID); |
|
| 48 | 48 | $this->option_key = Settings::get_settings_key(); |
| 49 | 49 | $this->options = Settings::get_settings(); |
| 50 | 50 | |
| 51 | - add_action( 'admin_menu', function() { $this->register_settings_page(); } ); |
|
| 52 | - add_action( 'admin_init', function() { $this->register_settings(); } ); |
|
| 51 | + add_action('admin_menu', function() { $this->register_settings_page(); } ); |
|
| 52 | + add_action('admin_init', function() { $this->register_settings(); } ); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | Plugin::NAME, |
| 66 | 66 | 'manage_options', |
| 67 | 67 | $this->page_id, |
| 68 | - [ $this, 'output_settings_page' ] |
|
| 68 | + [$this, 'output_settings_page'] |
|
| 69 | 69 | ); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -80,19 +80,19 @@ discard block |
||
| 80 | 80 | register_setting( |
| 81 | 81 | $this->option_key, |
| 82 | 82 | $this->option_key, |
| 83 | - [ $this, 'sanitize_field' ] |
|
| 83 | + [$this, 'sanitize_field'] |
|
| 84 | 84 | ); |
| 85 | 85 | |
| 86 | 86 | add_settings_section( |
| 87 | 87 | $this->option_key, |
| 88 | - __( 'Settings', 'wp-php-console' ), |
|
| 89 | - [ $this, 'output_settings_instructions' ], |
|
| 88 | + __('Settings', 'wp-php-console'), |
|
| 89 | + [$this, 'output_settings_instructions'], |
|
| 90 | 90 | $this->page_id |
| 91 | 91 | ); |
| 92 | 92 | |
| 93 | 93 | $settings_fields = [ |
| 94 | 94 | 'password' => [ |
| 95 | - 'label' => esc_html__( 'Password', 'wp-php-console' ), |
|
| 95 | + 'label' => esc_html__('Password', 'wp-php-console'), |
|
| 96 | 96 | 'args' => [ |
| 97 | 97 | 'id' => 'password', |
| 98 | 98 | 'type' => 'password', |
@@ -100,35 +100,35 @@ discard block |
||
| 100 | 100 | ] |
| 101 | 101 | ], |
| 102 | 102 | 'ssl' => [ |
| 103 | - 'label' => esc_html__( 'Allow only on SSL', 'wp-php-console' ), |
|
| 103 | + 'label' => esc_html__('Allow only on SSL', 'wp-php-console'), |
|
| 104 | 104 | 'args' => [ |
| 105 | 105 | 'id' => 'ssl', |
| 106 | 106 | 'type' => 'checkbox', |
| 107 | 107 | ] |
| 108 | 108 | ], |
| 109 | 109 | 'ip' => [ |
| 110 | - 'label' => esc_html__( 'Allowed IP Masks', 'wp-php-console' ), |
|
| 110 | + 'label' => esc_html__('Allowed IP Masks', 'wp-php-console'), |
|
| 111 | 111 | 'args' => [ |
| 112 | 112 | 'id' => 'ip', |
| 113 | 113 | 'type' => 'text', |
| 114 | 114 | ] |
| 115 | 115 | ], |
| 116 | 116 | 'register' => [ |
| 117 | - 'label' => esc_html__( 'Register PC Class', 'wp-php-console' ), |
|
| 117 | + 'label' => esc_html__('Register PC Class', 'wp-php-console'), |
|
| 118 | 118 | 'args' => [ |
| 119 | 119 | 'id' => 'register', |
| 120 | 120 | 'type' => 'checkbox', |
| 121 | 121 | ] |
| 122 | 122 | ], |
| 123 | 123 | 'stack' => [ |
| 124 | - 'label' => esc_html__( 'Show Call Stack', 'wp-php-console' ), |
|
| 124 | + 'label' => esc_html__('Show Call Stack', 'wp-php-console'), |
|
| 125 | 125 | 'args' => [ |
| 126 | 126 | 'id' => 'stack', |
| 127 | 127 | 'type' => 'checkbox', |
| 128 | 128 | ] |
| 129 | 129 | ], |
| 130 | 130 | 'short' => [ |
| 131 | - 'label' => esc_html__( 'Short Path Names', 'wp-php-console' ), |
|
| 131 | + 'label' => esc_html__('Short Path Names', 'wp-php-console'), |
|
| 132 | 132 | 'args' => [ |
| 133 | 133 | 'id' => 'short', |
| 134 | 134 | 'type' => 'checkbox', |
@@ -136,11 +136,11 @@ discard block |
||
| 136 | 136 | ], |
| 137 | 137 | ]; |
| 138 | 138 | |
| 139 | - foreach ( $settings_fields as $key => $field ) { |
|
| 139 | + foreach ($settings_fields as $key => $field) { |
|
| 140 | 140 | add_settings_field( |
| 141 | - $this->page_id . '['. $key . ']', |
|
| 141 | + $this->page_id.'['.$key.']', |
|
| 142 | 142 | $field['label'], |
| 143 | - [ $this, 'output_input_field' ], |
|
| 143 | + [$this, 'output_input_field'], |
|
| 144 | 144 | $this->page_id, |
| 145 | 145 | $this->option_key, |
| 146 | 146 | $field['args'] |
@@ -163,39 +163,39 @@ discard block |
||
| 163 | 163 | ?> |
| 164 | 164 | <p><?php printf( |
| 165 | 165 | /* translators: Placeholder: %s refers to the PHP Console library, pointing to its GitHub repository */ |
| 166 | - _x( 'This plugin allows you to use %s within your WordPress installation for testing, debugging and development purposes.', 'PHP Console, the PHP Library', 'wp-php-console' ), |
|
| 167 | - '<a href="' . esc_url( Plugin::get_php_console_repository_url() ) . '" target="_blank">PHP Console</a>' |
|
| 166 | + _x('This plugin allows you to use %s within your WordPress installation for testing, debugging and development purposes.', 'PHP Console, the PHP Library', 'wp-php-console'), |
|
| 167 | + '<a href="'.esc_url(Plugin::get_php_console_repository_url()).'" target="_blank">PHP Console</a>' |
|
| 168 | 168 | ); |
| 169 | 169 | ?></p> |
| 170 | - <h4><?php esc_html_e( 'Usage instructions:', 'wp-php-console' ); ?></h4> |
|
| 170 | + <h4><?php esc_html_e('Usage instructions:', 'wp-php-console'); ?></h4> |
|
| 171 | 171 | <ol> |
| 172 | 172 | <?php |
| 173 | 173 | |
| 174 | 174 | $instructions = [ |
| 175 | 175 | sprintf( |
| 176 | 176 | /* translators: Placeholder: %s - the Google Chrome PHP Console extension download link */ |
| 177 | - _x( 'Make sure you have downloaded and installed the %s.', 'PHP Console, the Chrome Extension', 'wp-php-console' ), |
|
| 177 | + _x('Make sure you have downloaded and installed the %s.', 'PHP Console, the Chrome Extension', 'wp-php-console'), |
|
| 178 | 178 | /* translators: Placeholder: %s - PHP Console extension name */ |
| 179 | - '<a href="' . esc_url( Plugin::get_php_console_chrome_extension_web_store_url() ) . '" target="_blank">' . sprintf( __( '%s extension for Google Chrome', 'wp-php-console' ), 'PHP Console' ) . '</a>' |
|
| 179 | + '<a href="'.esc_url(Plugin::get_php_console_chrome_extension_web_store_url()).'" target="_blank">'.sprintf(__('%s extension for Google Chrome', 'wp-php-console'), 'PHP Console').'</a>' |
|
| 180 | 180 | ), |
| 181 | 181 | sprintf( |
| 182 | 182 | /* translators: Placeholders: %1$s - opening PHP <a> link tag, %2$s - closing PHP </a> link tag */ |
| 183 | - __( 'If the Chrome extension is unavailable from the web store, you may %1$sdownload and install it from the source%2$s.', 'wp-php-console' ), |
|
| 184 | - '<a href="' . esc_url( Plugin::get_php_console_chrome_extension_repository_url() ) . '" target="_blank">', |
|
| 183 | + __('If the Chrome extension is unavailable from the web store, you may %1$sdownload and install it from the source%2$s.', 'wp-php-console'), |
|
| 184 | + '<a href="'.esc_url(Plugin::get_php_console_chrome_extension_repository_url()).'" target="_blank">', |
|
| 185 | 185 | '</a>' |
| 186 | 186 | ), |
| 187 | - esc_html__( 'Set a password for the eval terminal in the options below and hit "Save Changes".', 'wp-php-console' ), |
|
| 188 | - esc_html__( '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' ), |
|
| 189 | - esc_html__( 'From the eval terminal you can execute any PHP or WordPress specific function, including functions from your plugins and active theme.', 'wp-php-console' ), |
|
| 187 | + esc_html__('Set a password for the eval terminal in the options below and hit "Save Changes".', 'wp-php-console'), |
|
| 188 | + esc_html__('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'), |
|
| 189 | + esc_html__('From the eval terminal you can execute any PHP or WordPress specific function, including functions from your plugins and active theme.', 'wp-php-console'), |
|
| 190 | 190 | sprintf( |
| 191 | 191 | /* translators: Placeholders: %1$s - PHP code snippet example, %2$s - Chrome javascript console shortcut */ |
| 192 | - __( 'In your PHP code, you can call PHP Console debug statements like %1$s to display PHP variables in the browser\'s JavaScript-console (e.g. %2$s) and optionally filter selected tags through the browser\'s Remote PHP Eval Terminal screen\'s "Ignore Debug options".', 'wp-php-console' ), |
|
| 192 | + __('In your PHP code, you can call PHP Console debug statements like %1$s to display PHP variables in the browser\'s JavaScript-console (e.g. %2$s) and optionally filter selected tags through the browser\'s Remote PHP Eval Terminal screen\'s "Ignore Debug options".', 'wp-php-console'), |
|
| 193 | 193 | '<code>debug($var, $tag)</code>', |
| 194 | 194 | '<code>CTRL+SHIFT+J</code>' |
| 195 | 195 | ), |
| 196 | 196 | ]; |
| 197 | 197 | |
| 198 | - foreach ( $instructions as $list_item ) : |
|
| 198 | + foreach ($instructions as $list_item) : |
|
| 199 | 199 | ?><li><?php echo $list_item; ?></li><?php |
| 200 | 200 | endforeach; |
| 201 | 201 | |
@@ -214,9 +214,9 @@ discard block |
||
| 214 | 214 | * @param array $field field arguments |
| 215 | 215 | * @return string |
| 216 | 216 | */ |
| 217 | - private function get_field_id( array $field ) { |
|
| 217 | + private function get_field_id(array $field) { |
|
| 218 | 218 | |
| 219 | - return $this->page_id . '-' . $field['id']; |
|
| 219 | + return $this->page_id.'-'.$field['id']; |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | |
@@ -228,9 +228,9 @@ discard block |
||
| 228 | 228 | * @param array $field field arguments |
| 229 | 229 | * @return string |
| 230 | 230 | */ |
| 231 | - private function get_field_name( array $field ) { |
|
| 231 | + private function get_field_name(array $field) { |
|
| 232 | 232 | |
| 233 | - return str_replace( '-', '_', $this->page_id . '[' . $field['id'] . ']' ); |
|
| 233 | + return str_replace('-', '_', $this->page_id.'['.$field['id'].']'); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | |
@@ -242,9 +242,9 @@ discard block |
||
| 242 | 242 | * @param array $field field arguments |
| 243 | 243 | * @return int|string|bool |
| 244 | 244 | */ |
| 245 | - private function get_field_value( array $field ) { |
|
| 245 | + private function get_field_value(array $field) { |
|
| 246 | 246 | |
| 247 | - return $this->options[ $field['id'] ]; |
|
| 247 | + return $this->options[$field['id']]; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
@@ -257,19 +257,19 @@ discard block |
||
| 257 | 257 | * |
| 258 | 258 | * @param array $args |
| 259 | 259 | */ |
| 260 | - public function output_input_field( array $args = [] ) { |
|
| 260 | + public function output_input_field(array $args = []) { |
|
| 261 | 261 | |
| 262 | - if ( empty( $args ) ) { |
|
| 262 | + if (empty($args)) { |
|
| 263 | 263 | return; |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - switch ( $args['type'] ) { |
|
| 266 | + switch ($args['type']) { |
|
| 267 | 267 | case 'password' : |
| 268 | 268 | case 'text' : |
| 269 | - $this->output_input_text_field( $args ); |
|
| 269 | + $this->output_input_text_field($args); |
|
| 270 | 270 | break; |
| 271 | 271 | case 'checkbox' : |
| 272 | - $this->output_checkbox_field( $args ); |
|
| 272 | + $this->output_checkbox_field($args); |
|
| 273 | 273 | break; |
| 274 | 274 | } |
| 275 | 275 | } |
@@ -282,23 +282,23 @@ discard block |
||
| 282 | 282 | * |
| 283 | 283 | * @param array $args |
| 284 | 284 | */ |
| 285 | - private function output_input_text_field( $args = [] ) { |
|
| 285 | + private function output_input_text_field($args = []) { |
|
| 286 | 286 | |
| 287 | 287 | ?> |
| 288 | 288 | <label> |
| 289 | 289 | <input |
| 290 | - type="<?php echo isset( $args['type'] ) ? esc_attr( $args['type'] ) : 'text'; ?>" |
|
| 291 | - id="<?php echo esc_attr( $this->get_field_id( $args ) ); ?>" |
|
| 292 | - name="<?php echo esc_attr( $this->get_field_name( $args ) ); ?>" |
|
| 293 | - value="<?php echo esc_attr( $this->get_field_value( $args ) ); ?>" |
|
| 290 | + type="<?php echo isset($args['type']) ? esc_attr($args['type']) : 'text'; ?>" |
|
| 291 | + id="<?php echo esc_attr($this->get_field_id($args)); ?>" |
|
| 292 | + name="<?php echo esc_attr($this->get_field_name($args)); ?>" |
|
| 293 | + value="<?php echo esc_attr($this->get_field_value($args)); ?>" |
|
| 294 | 294 | > |
| 295 | - <?php if ( ! empty( $args['required'] ) ) : ?> |
|
| 296 | - <span style="color:red;" title="<?php esc_attr_e( 'Required', 'wp-php-console' ); ?>">*</span> |
|
| 295 | + <?php if ( ! empty($args['required'])) : ?> |
|
| 296 | + <span style="color:red;" title="<?php esc_attr_e('Required', 'wp-php-console'); ?>">*</span> |
|
| 297 | 297 | <?php endif; ?> |
| 298 | 298 | </label> |
| 299 | 299 | <?php |
| 300 | 300 | |
| 301 | - switch ( $args['id'] ) : |
|
| 301 | + switch ($args['id']) : |
|
| 302 | 302 | |
| 303 | 303 | case 'ip' : |
| 304 | 304 | $this->output_ip_field_instructions(); |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | private function output_password_field_instructions() { |
| 321 | 321 | |
| 322 | 322 | ?> |
| 323 | - <p class="description"><?php esc_html_e( 'The password for the eval terminal. If empty, the connector will not work.', 'wp-php-console' ); ?></p> |
|
| 323 | + <p class="description"><?php esc_html_e('The password for the eval terminal. If empty, the connector will not work.', 'wp-php-console'); ?></p> |
|
| 324 | 324 | <?php |
| 325 | 325 | } |
| 326 | 326 | |
@@ -333,17 +333,17 @@ discard block |
||
| 333 | 333 | private function output_ip_field_instructions() { |
| 334 | 334 | |
| 335 | 335 | ?> |
| 336 | - <p class="description"><?php esc_html_e( 'You may specify any of the following, to give access to specific IPs to the eval terminal:', 'wp-php-console' ); ?></p> |
|
| 336 | + <p class="description"><?php esc_html_e('You may specify any of the following, to give access to specific IPs to the eval terminal:', 'wp-php-console'); ?></p> |
|
| 337 | 337 | <ol> |
| 338 | 338 | <li><span class="description"><?php printf( |
| 339 | 339 | /* translators: Placeholders: %1$s - a single IP address, %2$s link to Varying Vagrant Vagrants project repository */ |
| 340 | - __( 'An IP address (for example %1$s, %2$s default IP address).', 'wp-php-console' ), |
|
| 340 | + __('An IP address (for example %1$s, %2$s default IP address).', 'wp-php-console'), |
|
| 341 | 341 | '<code>192.168.50.4</code>', |
| 342 | 342 | '<a href="https://github.com/Varying-Vagrant-Vagrants/VVV">Varying Vagrant Vagrants</a>' |
| 343 | 343 | ); ?></span></li> |
| 344 | 344 | <li><span class="description"><?php printf( |
| 345 | 345 | /* translators: Placeholders: %1$s a range of IP addresses, %2$s - comma separated IP addresses */ |
| 346 | - __( 'A range of addresses (%1$s) or multiple addresses, comma separated (%2$s).', 'wp-php-console' ), |
|
| 346 | + __('A range of addresses (%1$s) or multiple addresses, comma separated (%2$s).', 'wp-php-console'), |
|
| 347 | 347 | '<code>192.168.*.*</code>', |
| 348 | 348 | '<code>192.168.10.25,192.168.10.28</code>' |
| 349 | 349 | ); ?></span></li> |
@@ -359,23 +359,23 @@ discard block |
||
| 359 | 359 | * |
| 360 | 360 | * @param array $args |
| 361 | 361 | */ |
| 362 | - public function output_checkbox_field( array $args = [] ) { |
|
| 362 | + public function output_checkbox_field(array $args = []) { |
|
| 363 | 363 | |
| 364 | - $field_id = esc_attr( $this->get_field_id( $args ) ); |
|
| 364 | + $field_id = esc_attr($this->get_field_id($args)); |
|
| 365 | 365 | |
| 366 | 366 | ?> |
| 367 | 367 | <label> |
| 368 | 368 | <input |
| 369 | 369 | type="checkbox" |
| 370 | 370 | id="<?php echo $field_id; ?>" |
| 371 | - name="<?php echo esc_attr( $this->get_field_name( $args ) ); ?>" |
|
| 371 | + name="<?php echo esc_attr($this->get_field_name($args)); ?>" |
|
| 372 | 372 | value="1" |
| 373 | - <?php checked( (bool) $this->get_field_value( $args ) ); ?> |
|
| 374 | - ><?php esc_html_e( 'Yes', 'wp-php-console' ); ?> |
|
| 373 | + <?php checked((bool) $this->get_field_value($args)); ?> |
|
| 374 | + ><?php esc_html_e('Yes', 'wp-php-console'); ?> |
|
| 375 | 375 | </label> |
| 376 | 376 | <?php |
| 377 | 377 | |
| 378 | - switch ( $args['id'] ) : |
|
| 378 | + switch ($args['id']) : |
|
| 379 | 379 | |
| 380 | 380 | case 'register' : |
| 381 | 381 | $this->output_register_pc_class_field_instructions(); |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | private function output_ssl_field_instructions() { |
| 406 | 406 | |
| 407 | 407 | ?> |
| 408 | - <p class="description"><?php esc_html_e( 'Enable this option if you want the eval terminal to work only on a SSL connection.', 'wp-php-console' ); ?></p> |
|
| 408 | + <p class="description"><?php esc_html_e('Enable this option if you want the eval terminal to work only on a SSL connection.', 'wp-php-console'); ?></p> |
|
| 409 | 409 | <?php |
| 410 | 410 | } |
| 411 | 411 | |
@@ -419,11 +419,11 @@ discard block |
||
| 419 | 419 | |
| 420 | 420 | ?> |
| 421 | 421 | <p class="description"><?php |
| 422 | - esc_html_e( 'Enable to register PC class in the global namespace.', 'wp-php-console' ); |
|
| 422 | + esc_html_e('Enable to register PC class in the global namespace.', 'wp-php-console'); |
|
| 423 | 423 | echo '<br>'; |
| 424 | 424 | printf( |
| 425 | 425 | /* translators: Placeholders: %1$s, %2$s and %3$s are PHP code snippets examples */ |
| 426 | - __( 'Allows to write %1$s or %2$s instructions in PHP to inspect %3$s in the JavaScript console.', 'wp-php-console' ), |
|
| 426 | + __('Allows to write %1$s or %2$s instructions in PHP to inspect %3$s in the JavaScript console.', 'wp-php-console'), |
|
| 427 | 427 | '<code>PC::debug($var, $tag)</code>', |
| 428 | 428 | '<code>PC::magic_tag($var)</code>', |
| 429 | 429 | '<code>$var</code>' |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | private function output_show_call_stack_field_instructions() { |
| 441 | 441 | |
| 442 | 442 | ?> |
| 443 | - <p class="description"><?php esc_html_e( 'Enable to see the full call stack when PHP Console writes to the browser JavaScript console.', 'wp-php-console' ); ?></p> |
|
| 443 | + <p class="description"><?php esc_html_e('Enable to see the full call stack when PHP Console writes to the browser JavaScript console.', 'wp-php-console'); ?></p> |
|
| 444 | 444 | <?php |
| 445 | 445 | } |
| 446 | 446 | |
@@ -454,11 +454,11 @@ discard block |
||
| 454 | 454 | |
| 455 | 455 | ?> |
| 456 | 456 | <p class="description"><?php |
| 457 | - esc_html_e( 'Enable to shorten the length of PHP Console error sources and traces paths in browser JavaScript console for better readability.', 'wp-php-console' ); |
|
| 457 | + esc_html_e('Enable to shorten the length of PHP Console error sources and traces paths in browser JavaScript console for better readability.', 'wp-php-console'); |
|
| 458 | 458 | echo '<br>'; |
| 459 | 459 | printf( |
| 460 | 460 | /* translators: Placeholders: %1$s - long server path, %2$s - shortened server path */ |
| 461 | - __( 'Paths like %1$s will be displayed as %2$s', 'wp-php-console' ), |
|
| 461 | + __('Paths like %1$s will be displayed as %2$s', 'wp-php-console'), |
|
| 462 | 462 | '<code>/server/path/to/document/root/WP/wp-admin/admin.php:31</code>', |
| 463 | 463 | '<code>/WP/wp-admin/admin.php:31</code>' |
| 464 | 464 | ); ?></p> |
@@ -476,24 +476,24 @@ discard block |
||
| 476 | 476 | * @param array $option user input |
| 477 | 477 | * @return array sanitized input |
| 478 | 478 | */ |
| 479 | - public function sanitize_field( $option ) { |
|
| 479 | + public function sanitize_field($option) { |
|
| 480 | 480 | |
| 481 | - $input = wp_parse_args( $option, [ |
|
| 481 | + $input = wp_parse_args($option, [ |
|
| 482 | 482 | 'ip' => '', |
| 483 | 483 | 'password' => '', |
| 484 | 484 | 'register' => false, |
| 485 | 485 | 'short' => false, |
| 486 | 486 | 'ssl' => false, |
| 487 | 487 | 'stack' => false, |
| 488 | - ] ); |
|
| 488 | + ]); |
|
| 489 | 489 | |
| 490 | 490 | return [ |
| 491 | - 'ip' => sanitize_text_field( $input['ip'] ), |
|
| 492 | - 'password' => sanitize_text_field( $input['password'] ), |
|
| 493 | - 'register' => ! empty( $input['register'] ), |
|
| 494 | - 'short' => ! empty( $input['short'] ), |
|
| 495 | - 'ssl' => ! empty( $input['ssl'] ), |
|
| 496 | - 'stack' => ! empty( $input['stack'] ), |
|
| 491 | + 'ip' => sanitize_text_field($input['ip']), |
|
| 492 | + 'password' => sanitize_text_field($input['password']), |
|
| 493 | + 'register' => ! empty($input['register']), |
|
| 494 | + 'short' => ! empty($input['short']), |
|
| 495 | + 'ssl' => ! empty($input['ssl']), |
|
| 496 | + 'stack' => ! empty($input['stack']), |
|
| 497 | 497 | ]; |
| 498 | 498 | } |
| 499 | 499 | |
@@ -514,9 +514,9 @@ discard block |
||
| 514 | 514 | <form method="post" action="options.php"> |
| 515 | 515 | <?php |
| 516 | 516 | |
| 517 | - settings_fields( $this->option_key ); |
|
| 517 | + settings_fields($this->option_key); |
|
| 518 | 518 | |
| 519 | - do_settings_sections( $this->page_id ); |
|
| 519 | + do_settings_sections($this->page_id); |
|
| 520 | 520 | |
| 521 | 521 | submit_button(); |
| 522 | 522 | |