Changeset 41721 for trunk/src/wp-includes/load.php
- Timestamp:
- 10/04/2017 12:19:16 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/load.php
r40992 r41721 1113 1113 return apply_filters( 'file_mod_allowed', ! defined( 'DISALLOW_FILE_MODS' ) || ! DISALLOW_FILE_MODS, $context ); 1114 1114 } 1115 1116 /** 1117 * Start scraping edited file errors. 1118 * 1119 * @since 4.9.0 1120 */ 1121 function wp_start_scraping_edited_file_errors() { 1122 if ( ! isset( $_REQUEST['wp_scrape_key'] ) || ! isset( $_REQUEST['wp_scrape_nonce'] ) ) { 1123 return; 1124 } 1125 $key = substr( sanitize_key( wp_unslash( $_REQUEST['wp_scrape_key'] ) ), 0, 32 ); 1126 $nonce = wp_unslash( $_REQUEST['wp_scrape_nonce'] ); 1127 1128 if ( get_transient( 'scrape_key_' . $key ) !== $nonce ) { 1129 echo "###### begin_scraped_error:$key ######"; 1130 echo wp_json_encode( array( 1131 'code' => 'scrape_nonce_failure', 1132 'message' => __( 'Scrape nonce check failed. Please try again.' ), 1133 ) ); 1134 die(); 1135 } 1136 register_shutdown_function( 'wp_finalize_scraping_edited_file_errors', $key ); 1137 } 1138 1139 /** 1140 * Finalize scraping for edited file errors. 1141 * 1142 * @since 4.9.0 1143 * 1144 * @param string $scrape_key Scrape key. 1145 */ 1146 function wp_finalize_scraping_edited_file_errors( $scrape_key ) { 1147 $error = error_get_last(); 1148 if ( empty( $error ) ) { 1149 return; 1150 } 1151 if ( ! in_array( $error['type'], array( E_CORE_ERROR, E_COMPILE_ERROR, E_ERROR, E_PARSE, E_USER_ERROR, E_RECOVERABLE_ERROR ), true ) ) { 1152 return; 1153 } 1154 $error = str_replace( ABSPATH, '', $error ); 1155 echo "###### begin_scraped_error:$scrape_key ######"; 1156 echo wp_json_encode( $error ); 1157 }
Note: See TracChangeset
for help on using the changeset viewer.