Ticket #58484: patch.58484.20231019.6.diff
| File patch.58484.20231019.6.diff, 4.0 KB (added by , 3 years ago) |
|---|
-
src/wp-admin/includes/class-wp-debug-data.php
diff --git a/src/wp-admin/includes/class-wp-debug-data.php b/src/wp-admin/includes/class-wp-debug-data.php index d83c873768..0a623a6454 100644
a b class WP_Debug_Data { 20 20 wp_update_themes(); 21 21 } 22 22 23 /* 24 * Helper function to determine the true value of a constant. 25 * 26 * @param string $constant_name The name of the constant to be checked. 27 * @return string The actual value of the defined constant if it is defined as a true value 28 * If the constant is defined as empty, it will return "Defined as an empty string.". 29 * If the constant is as a false boolean it will return "Defined as boolean with value false." 30 * If the constant is as a true boolean it will return "Defined as boolean with value true." 31 * If the constant is as a true boolean it will return "Defined as boolean with value true." 32 * If the constant is defined as NULL, it will return "Defined as NULL" 33 * If the constant is not defined at all, it will return "Undefined" 34 */ 35 private static function get_define_info( $constant_name ) { 36 if ( ! defined( $constant_name ) ) { 37 return __( 'Undefined' ); 38 } 39 40 $value = constant( $constant_name ); 41 if ( $value === true ) { 42 // Translators: %s is always replaced with the PHP boolean named "true" 43 return sprintf( __ ( 'Defined as boolean with value %s.' ), 'true' ); 44 } 45 46 47 if ( $value === false ) { 48 // Translators: %s is always replaced with the PHP boolean named "false" 49 return sprintf( __ ( 'Defined as boolean with value %s.' ), 'false' ); 50 } 51 if ( $value === NULL ) { 52 // Translators: %s is always replaced with the PHP type named "NULL" 53 return sprintf( __ ( 'Defined as %s.' ), 'NULL' ); 54 } 55 if ( $value === '' ) { 56 return __( 'Defined as an empty string.' ); 57 } 58 59 return $value; 60 } 61 23 62 /** 24 63 * Static function for generating site debug data when required. 25 64 * … … class WP_Debug_Data { 236 275 $compress_css_debug = 'undefined'; 237 276 } 238 277 239 // Check WP_ENVIRONMENT_TYPE.240 if ( defined( 'WP_ENVIRONMENT_TYPE' ) && WP_ENVIRONMENT_TYPE ) {241 $wp_environment_type = WP_ENVIRONMENT_TYPE;242 } else {243 $wp_environment_type = __( 'Undefined' );244 }245 246 278 $info['wp-constants'] = array( 247 279 'label' => __( 'WordPress Constants' ), 248 280 'description' => __( 'These settings alter where and how parts of WordPress are loaded.' ), … … class WP_Debug_Data { 254 286 ), 255 287 'WP_HOME' => array( 256 288 'label' => 'WP_HOME', 257 'value' => ( defined( 'WP_HOME' ) ? WP_HOME : __( 'Undefined' )),258 'debug' => ( defined( 'WP_HOME' ) ? WP_HOME : 'undefined' ),289 'value' => self::get_define_info( 'WP_HOME' ), 290 'debug' => self::get_define_info( 'WP_HOME' ), 259 291 ), 260 292 'WP_SITEURL' => array( 261 293 'label' => 'WP_SITEURL', 262 'value' => ( defined( 'WP_SITEURL' ) ? WP_SITEURL : __( 'Undefined' )),263 'debug' => ( defined( 'WP_SITEURL' ) ? WP_SITEURL : 'undefined' ),294 'value' => self::get_define_info( 'WP_SITEURL' ), 295 'debug' => self::get_define_info( 'WP_SITEURL' ), 264 296 ), 265 297 'WP_CONTENT_DIR' => array( 266 298 'label' => 'WP_CONTENT_DIR', … … class WP_Debug_Data { 330 362 ), 331 363 'DB_CHARSET' => array( 332 364 'label' => 'DB_CHARSET', 333 'value' => ( defined( 'DB_CHARSET' ) ? DB_CHARSET : __( 'Undefined' )),334 'debug' => ( defined( 'DB_CHARSET' ) ? DB_CHARSET : 'undefined' ),365 'value' => self::get_define_info( 'DB_CHARSET' ), 366 'debug' => self::get_define_info( 'DB_CHARSET' ), 335 367 ), 336 368 'DB_COLLATE' => array( 337 369 'label' => 'DB_COLLATE', 338 'value' => ( defined( 'DB_COLLATE' ) ? DB_COLLATE : __( 'Undefined' )),339 'debug' => ( defined( 'DB_COLLATE' ) ? DB_COLLATE : 'undefined' ),370 'value' => self::get_define_info( 'DB_COLLATE' ), 371 'debug' => self::get_define_info( 'DB_COLLATE' ), 340 372 ), 341 373 ), 342 374 );