PluginProbe
WP Debugging / 2.9.2
WP Debugging v2.9.2
2.12.6 2.12.5 trunk 2.10.0 2.10.1 2.10.2 2.11.0 2.11.1 2.11.10 2.11.11 2.11.12 2.11.13 2.11.14 2.11.15 2.11.16 2.11.17 2.11.18 2.11.19 2.11.2 2.11.20 2.11.21 2.11.22 2.11.23 2.11.24 2.11.3 All 59 releases
← All changes | src/Settings.php +22 -37 2.10.02.9.2 View file →
@@ -39,15 +39,8 @@
39 39 */
40 40 protected $defined_constants;
41 41
42 42 /**
43 - * Holds config args for WPConfigTransformer.
44 - *
45 - * @var array
46 - */
47 - protected static $config_args;
48 -
49 - /**
50 43 * Constructor.
51 44 *
52 45 * @param array $options Plugin options.
53 46 * @param string $config_path Path to config file.
@@ -57,20 +50,8 @@
57 50 public function __construct( $options, $config_path, $defined_constants ) {
58 51 self::$options = $options;
59 52 self::$config_path = $config_path;
60 53 $this->defined_constants = $defined_constants;
61 - self::$config_args = [ 'normalize' => true ];
62 -
63 - if ( false === strpos( file_get_contents( self::$config_path ), "/* That's all, stop editing!" ) ) {
64 - preg_match( '@\$table_prefix = (.*);@', file_get_contents( self::$config_path ), $matches );
65 - self::$config_args = array_merge(
66 - self::$config_args,
67 - [
68 - 'anchor' => "$matches[0]",
69 - 'placement' => 'after',
70 - ]
71 - );
72 - }
73 54 }
74 55
75 56 /**
76 57 * Load hooks for settings.
@@ -127,9 +108,9 @@
127 108 ? wp_unslash( $_POST['wp-debugging'] )
128 109 : [];
129 110 // phpcs:enable
130 111
131 - $options = $this->sanitize( $options );
112 + $options = self::sanitize( $options );
132 113 $this->update_constants( self::$options, $options );
133 114 $filtered_options = array_filter(
134 115 self::$options,
135 116 function ( $e ) {
@@ -173,13 +154,16 @@
173 154 $added = [];
174 155 try {
175 156 $config_transformer = new \WPConfigTransformer( self::$config_path );
176 157 foreach ( $add as $constant => $config ) {
177 - $value = 'wp_debug_display' === $constant ? 'false' : 'true';
178 - $value = isset( $config['value'] ) ? $config['value'] : $value;
179 - $raw = isset( $config['raw'] ) ? $config['raw'] : true;
180 - self::$config_args = array_merge( self::$config_args, [ 'raw' => $raw ] );
181 - $config_transformer->update( 'constant', strtoupper( $constant ), $value, self::$config_args );
158 + $value = 'wp_debug_display' === $constant ? 'false' : 'true';
159 + $value = isset( $config['value'] ) ? $config['value'] : $value;
160 + $raw = isset( $config['raw'] ) ? $config['raw'] : true;
161 + $config_args = [
162 + 'raw' => $raw,
163 + 'normalize' => true,
164 + ];
165 + $config_transformer->update( 'constant', strtoupper( $constant ), $value, $config_args );
182 166 $added[ $constant ] = $value;
183 167 }
184 168
185 169 return $added;
@@ -340,20 +324,21 @@
340 324 'title' => esc_html__( 'Set WP_DEBUG_DISPLAY to false, default is true.', 'wp-debugging' ),
341 325 ]
342 326 );
343 327
344 - add_settings_field(
345 - 'wp_disable_fatal_error_handler',
346 - null,
347 - [ $this, 'checkbox_setting' ],
348 - 'wp_debugging',
349 - 'wp_debugging',
350 - [
351 - 'id' => 'wp_disable_fatal_error_handler',
352 - 'title' => esc_html__( 'Set WP_DISABLE_FATAL_ERROR_HANDLER to true.', 'wp-debugging' ),
353 - 'class' => version_compare( get_bloginfo( 'version' ), '5.2', '>=' ) ? '' : 'hidden',
354 - ]
355 - );
328 + if ( version_compare( get_bloginfo( 'version' ), '5.2-beta', '>=' ) ) {
329 + add_settings_field(
330 + 'wp_disable_fatal_error_handler',
331 + null,
332 + [ $this, 'checkbox_setting' ],
333 + 'wp_debugging',
334 + 'wp_debugging',
335 + [
336 + 'id' => 'wp_disable_fatal_error_handler',
337 + 'title' => esc_html__( 'Set WP_DISABLE_FATAL_ERROR_HANDLER to true.', 'wp-debugging' ),
338 + ]
339 + );
340 + }
356 341 }
357 342
358 343 /**
359 344 * Print settings section information.