Changeset 45667 for trunk/src/wp-includes/functions.php
- Timestamp:
- 07/25/2019 12:47:53 AM (7 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/functions.php (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r45611 r45667 3081 3081 */ 3082 3082 function _default_wp_die_handler( $message, $title = '', $args = array() ) { 3083 list( $message, $title, $ r) = _wp_die_process_input( $message, $title, $args );3083 list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); 3084 3084 3085 3085 if ( is_string( $message ) ) { 3086 if ( ! empty( $ r['additional_errors'] ) ) {3086 if ( ! empty( $parsed_args['additional_errors'] ) ) { 3087 3087 $message = array_merge( 3088 3088 array( $message ), 3089 wp_list_pluck( $ r['additional_errors'], 'message' )3089 wp_list_pluck( $parsed_args['additional_errors'], 'message' ) 3090 3090 ); 3091 3091 $message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $message ) . "</li>\n\t</ul>"; … … 3097 3097 $have_gettext = function_exists( '__' ); 3098 3098 3099 if ( ! empty( $ r['link_url'] ) && ! empty( $r['link_text'] ) ) {3100 $link_url = $ r['link_url'];3099 if ( ! empty( $parsed_args['link_url'] ) && ! empty( $parsed_args['link_text'] ) ) { 3100 $link_url = $parsed_args['link_url']; 3101 3101 if ( function_exists( 'esc_url' ) ) { 3102 3102 $link_url = esc_url( $link_url ); 3103 3103 } 3104 $link_text = $ r['link_text'];3104 $link_text = $parsed_args['link_text']; 3105 3105 $message .= "\n<p><a href='{$link_url}'>{$link_text}</a></p>"; 3106 3106 } 3107 3107 3108 if ( isset( $ r['back_link'] ) && $r['back_link'] ) {3108 if ( isset( $parsed_args['back_link'] ) && $parsed_args['back_link'] ) { 3109 3109 $back_text = $have_gettext ? __( '« Back' ) : '« Back'; 3110 3110 $message .= "\n<p><a href='javascript:history.back()'>$back_text</a></p>"; … … 3114 3114 if ( ! headers_sent() ) { 3115 3115 header( 'Content-Type: text/html; charset=utf-8' ); 3116 status_header( $ r['response'] );3116 status_header( $parsed_args['response'] ); 3117 3117 nocache_headers(); 3118 3118 } 3119 3119 3120 $text_direction = $ r['text_direction'];3120 $text_direction = $parsed_args['text_direction']; 3121 3121 if ( function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) { 3122 3122 $dir_attr = get_language_attributes(); … … 3259 3259 </html> 3260 3260 <?php 3261 if ( $ r['exit'] ) {3261 if ( $parsed_args['exit'] ) { 3262 3262 die(); 3263 3263 } … … 3283 3283 ); 3284 3284 3285 list( $message, $title, $ r) = _wp_die_process_input( $message, $title, $args );3285 list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); 3286 3286 3287 3287 if ( ! headers_sent() ) { 3288 3288 // This is intentional. For backward-compatibility, support passing null here. 3289 3289 if ( null !== $args['response'] ) { 3290 status_header( $ r['response'] );3290 status_header( $parsed_args['response'] ); 3291 3291 } 3292 3292 nocache_headers(); … … 3299 3299 } 3300 3300 3301 if ( $ r['exit'] ) {3301 if ( $parsed_args['exit'] ) { 3302 3302 die( $message ); 3303 3303 } … … 3319 3319 */ 3320 3320 function _json_wp_die_handler( $message, $title = '', $args = array() ) { 3321 list( $message, $title, $ r) = _wp_die_process_input( $message, $title, $args );3321 list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); 3322 3322 3323 3323 $data = array( 3324 'code' => $ r['code'],3324 'code' => $parsed_args['code'], 3325 3325 'message' => $message, 3326 3326 'data' => array( 3327 'status' => $ r['response'],3327 'status' => $parsed_args['response'], 3328 3328 ), 3329 'additional_errors' => $ r['additional_errors'],3329 'additional_errors' => $parsed_args['additional_errors'], 3330 3330 ); 3331 3331 3332 3332 if ( ! headers_sent() ) { 3333 3333 header( 'Content-Type: application/json; charset=utf-8' ); 3334 if ( null !== $ r['response'] ) {3335 status_header( $ r['response'] );3334 if ( null !== $parsed_args['response'] ) { 3335 status_header( $parsed_args['response'] ); 3336 3336 } 3337 3337 nocache_headers(); … … 3339 3339 3340 3340 echo wp_json_encode( $data ); 3341 if ( $ r['exit'] ) {3341 if ( $parsed_args['exit'] ) { 3342 3342 die(); 3343 3343 } … … 3357 3357 */ 3358 3358 function _jsonp_wp_die_handler( $message, $title = '', $args = array() ) { 3359 list( $message, $title, $ r) = _wp_die_process_input( $message, $title, $args );3359 list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); 3360 3360 3361 3361 $data = array( 3362 'code' => $ r['code'],3362 'code' => $parsed_args['code'], 3363 3363 'message' => $message, 3364 3364 'data' => array( 3365 'status' => $ r['response'],3365 'status' => $parsed_args['response'], 3366 3366 ), 3367 'additional_errors' => $ r['additional_errors'],3367 'additional_errors' => $parsed_args['additional_errors'], 3368 3368 ); 3369 3369 … … 3372 3372 header( 'X-Content-Type-Options: nosniff' ); 3373 3373 header( 'X-Robots-Tag: noindex' ); 3374 if ( null !== $ r['response'] ) {3375 status_header( $ r['response'] );3374 if ( null !== $parsed_args['response'] ) { 3375 status_header( $parsed_args['response'] ); 3376 3376 } 3377 3377 nocache_headers(); … … 3381 3381 $jsonp_callback = $_GET['_jsonp']; 3382 3382 echo '/**/' . $jsonp_callback . '(' . $result . ')'; 3383 if ( $ r['exit'] ) {3383 if ( $parsed_args['exit'] ) { 3384 3384 die(); 3385 3385 } … … 3403 3403 global $wp_xmlrpc_server; 3404 3404 3405 list( $message, $title, $ r) = _wp_die_process_input( $message, $title, $args );3405 list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); 3406 3406 3407 3407 if ( ! headers_sent() ) { … … 3410 3410 3411 3411 if ( $wp_xmlrpc_server ) { 3412 $error = new IXR_Error( $ r['response'], $message );3412 $error = new IXR_Error( $parsed_args['response'], $message ); 3413 3413 $wp_xmlrpc_server->output( $error->getXml() ); 3414 3414 } 3415 if ( $ r['exit'] ) {3415 if ( $parsed_args['exit'] ) { 3416 3416 die(); 3417 3417 } … … 3431 3431 */ 3432 3432 function _xml_wp_die_handler( $message, $title = '', $args = array() ) { 3433 list( $message, $title, $ r) = _wp_die_process_input( $message, $title, $args );3433 list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); 3434 3434 3435 3435 $message = htmlspecialchars( $message ); … … 3438 3438 $xml = <<<EOD 3439 3439 <error> 3440 <code>{$ r['code']}</code>3440 <code>{$parsed_args['code']}</code> 3441 3441 <title><![CDATA[{$title}]]></title> 3442 3442 <message><![CDATA[{$message}]]></message> 3443 3443 <data> 3444 <status>{$ r['response']}</status>3444 <status>{$parsed_args['response']}</status> 3445 3445 </data> 3446 3446 </error> … … 3450 3450 if ( ! headers_sent() ) { 3451 3451 header( 'Content-Type: text/xml; charset=utf-8' ); 3452 if ( null !== $ r['response'] ) {3453 status_header( $ r['response'] );3452 if ( null !== $parsed_args['response'] ) { 3453 status_header( $parsed_args['response'] ); 3454 3454 } 3455 3455 nocache_headers(); … … 3457 3457 3458 3458 echo $xml; 3459 if ( $ r['exit'] ) {3459 if ( $parsed_args['exit'] ) { 3460 3460 die(); 3461 3461 } … … 3476 3476 */ 3477 3477 function _scalar_wp_die_handler( $message = '', $title = '', $args = array() ) { 3478 list( $message, $title, $ r) = _wp_die_process_input( $message, $title, $args );3479 3480 if ( $ r['exit'] ) {3478 list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args ); 3479 3480 if ( $parsed_args['exit'] ) { 3481 3481 if ( is_scalar( $message ) ) { 3482 3482 die( (string) $message ); … … 4108 4108 function wp_parse_args( $args, $defaults = '' ) { 4109 4109 if ( is_object( $args ) ) { 4110 $ r= get_object_vars( $args );4110 $parsed_args = get_object_vars( $args ); 4111 4111 } elseif ( is_array( $args ) ) { 4112 $ r=& $args;4112 $parsed_args =& $args; 4113 4113 } else { 4114 wp_parse_str( $args, $ r);4114 wp_parse_str( $args, $parsed_args ); 4115 4115 } 4116 4116 4117 4117 if ( is_array( $defaults ) ) { 4118 return array_merge( $defaults, $ r);4119 } 4120 return $ r;4118 return array_merge( $defaults, $parsed_args ); 4119 } 4120 return $parsed_args; 4121 4121 } 4122 4122
Note: See TracChangeset
for help on using the changeset viewer.