equal
deleted
inserted
replaced
1 <?php |
1 <?php |
2 /** |
2 /** |
3 * Error Protection API: Functions |
3 * Error Protection API: Functions |
4 * |
4 * |
5 * @package WordPress |
5 * @package WordPress |
6 * @since 5.2.0 |
6 * @since 5.2.0 |
7 */ |
7 */ |
8 |
8 |
9 /** |
9 /** |
10 * Get the instance for storing paused plugins. |
10 * Get the instance for storing paused plugins. |
11 * |
11 * |
40 * Get a human readable description of an extension's error. |
40 * Get a human readable description of an extension's error. |
41 * |
41 * |
42 * @since 5.2.0 |
42 * @since 5.2.0 |
43 * |
43 * |
44 * @param array $error Error details {@see error_get_last()} |
44 * @param array $error Error details {@see error_get_last()} |
45 * |
|
46 * @return string Formatted error description. |
45 * @return string Formatted error description. |
47 */ |
46 */ |
48 function wp_get_extension_error_description( $error ) { |
47 function wp_get_extension_error_description( $error ) { |
49 $constants = get_defined_constants( true ); |
48 $constants = get_defined_constants( true ); |
50 $constants = isset( $constants['Core'] ) ? $constants['Core'] : $constants['internal']; |
49 $constants = isset( $constants['Core'] ) ? $constants['Core'] : $constants['internal']; |
58 |
57 |
59 if ( isset( $core_errors[ $error['type'] ] ) ) { |
58 if ( isset( $core_errors[ $error['type'] ] ) ) { |
60 $error['type'] = $core_errors[ $error['type'] ]; |
59 $error['type'] = $core_errors[ $error['type'] ]; |
61 } |
60 } |
62 |
61 |
63 /* translators: 1: error type, 2: error line number, 3: error file name, 4: error message */ |
62 /* translators: 1: Error type, 2: Error line number, 3: Error file name, 4: Error message. */ |
64 $error_message = __( 'An error of type %1$s was caused in line %2$s of the file %3$s. Error message: %4$s' ); |
63 $error_message = __( 'An error of type %1$s was caused in line %2$s of the file %3$s. Error message: %4$s' ); |
65 |
64 |
66 return sprintf( |
65 return sprintf( |
67 $error_message, |
66 $error_message, |
68 "<code>{$error['type']}</code>", |
67 "<code>{$error['type']}</code>", |