Ticket #58484: patch.58484.20231019.7.diff
| File patch.58484.20231019.7.diff, 3.9 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..2873ca4a4a 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 * @since 6.5.0 27 * 28 * @param string $constant_name The name of the constant to be checked. 29 * @return string If the constant is not defined at all, it will return "Undefined" 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 false boolean it will return "Defined as boolean with value false." 32 * If the constant is defined as NULL, it will return "Defined as NULL" 33 * If the constant is defined as empty, it will return "Defined as an empty string.". 34 * Otherwise it is the value as defined. 35 */ 36 private static function get_define_info( $constant_name ) { 37 if ( ! defined( $constant_name ) ) { 38 return __( 'Undefined' ); 39 } 40 41 $value = constant( $constant_name ); 42 43 if ( true === $value ) { 44 // Translators: %s is always replaced with the PHP boolean named "true" 45 return sprintf( __ ( 'Defined as boolean with value %s.' ), 'true' ); 46 } 47 48 49 if ( false === $value ) { 50 // Translators: %s is always replaced with the PHP boolean named "false" 51 return sprintf( __ ( 'Defined as boolean with value %s.' ), 'false' ); 52 } 53 if ( NULL === $value ) { 54 // Translators: %s is always replaced with the PHP type named "NULL" 55 return sprintf( __ ( 'Defined as %s.' ), 'NULL' ); 56 } 57 if ( '' === $value ) { 58 return __( 'Defined as an empty string.' ); 59 } 60 61 return $value; 62 } 63 23 64 /** 24 65 * Static function for generating site debug data when required. 25 66 * … … class WP_Debug_Data { 236 277 $compress_css_debug = 'undefined'; 237 278 } 238 279 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 280 $info['wp-constants'] = array( 247 281 'label' => __( 'WordPress Constants' ), 248 282 'description' => __( 'These settings alter where and how parts of WordPress are loaded.' ), … … class WP_Debug_Data { 254 288 ), 255 289 'WP_HOME' => array( 256 290 'label' => 'WP_HOME', 257 'value' => ( defined( 'WP_HOME' ) ? WP_HOME : __( 'Undefined' )),258 'debug' => ( defined( 'WP_HOME' ) ? WP_HOME : 'undefined' ),291 'value' => self::get_define_info( 'WP_HOME' ), 292 'debug' => self::get_define_info( 'WP_HOME' ), 259 293 ), 260 294 'WP_SITEURL' => array( 261 295 'label' => 'WP_SITEURL', 262 'value' => ( defined( 'WP_SITEURL' ) ? WP_SITEURL : __( 'Undefined' )),263 'debug' => ( defined( 'WP_SITEURL' ) ? WP_SITEURL : 'undefined' ),296 'value' => self::get_define_info( 'WP_SITEURL' ), 297 'debug' => self::get_define_info( 'WP_SITEURL' ), 264 298 ), 265 299 'WP_CONTENT_DIR' => array( 266 300 'label' => 'WP_CONTENT_DIR', … … class WP_Debug_Data { 330 364 ), 331 365 'DB_CHARSET' => array( 332 366 'label' => 'DB_CHARSET', 333 'value' => ( defined( 'DB_CHARSET' ) ? DB_CHARSET : __( 'Undefined' )),334 'debug' => ( defined( 'DB_CHARSET' ) ? DB_CHARSET : 'undefined' ),367 'value' => self::get_define_info( 'DB_CHARSET' ), 368 'debug' => self::get_define_info( 'DB_CHARSET' ), 335 369 ), 336 370 'DB_COLLATE' => array( 337 371 'label' => 'DB_COLLATE', 338 'value' => ( defined( 'DB_COLLATE' ) ? DB_COLLATE : __( 'Undefined' )),339 'debug' => ( defined( 'DB_COLLATE' ) ? DB_COLLATE : 'undefined' ),372 'value' => self::get_define_info( 'DB_COLLATE' ), 373 'debug' => self::get_define_info( 'DB_COLLATE' ), 340 374 ), 341 375 ), 342 376 );