Ticket #13909: 13909.2.patch
File 13909.2.patch, 4.8 KB (added by , 14 years ago) |
---|
-
wp-includes/default-filters.php
### Eclipse Workspace Patch 1.0 #P wordpress
253 253 add_action( 'admin_init', 'register_admin_color_schemes', 1); 254 254 add_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' ); 255 255 256 // HTTP Redirect Hypertext 257 add_action( 'redirect_hypertext', 'wp_redirect_hypertext', 10, 3 ); 258 256 259 ?> -
wp-includes/pluggable.php
869 869 * 870 870 * @param string $location The path to redirect to 871 871 * @param int $status Status code to use 872 * @param bool $hyptertext Should a Hypertext Fragment be used? 872 873 * @return bool False if $location is not set 873 874 */ 874 function wp_redirect( $location, $status = 302) {875 function wp_redirect( $location, $status = 302, $hypertext = true ) { 875 876 global $is_IIS; 876 877 877 $location = apply_filters('wp_redirect', $location, $status); 878 $status = apply_filters('wp_redirect_status', $status, $location); 878 $location = apply_filters( 'wp_redirect', $location, $status ); 879 $status = (int) apply_filters( 'wp_redirect_status', $status, $location ); 880 $hypertext = apply_filters( 'wp_redirect_hypertext', $hypertext, $status, $location); 879 881 880 882 if ( !$location ) // allows the wp_redirect filter to cancel a redirect 881 883 return false; 884 885 if ( 3 != (int) ($status/100) ) // Handle HTTP redirect status 3xx only 886 return false; 882 887 883 $location = wp_sanitize_redirect( $location);888 $location = wp_sanitize_redirect( $location ); 884 889 885 890 if ( $is_IIS ) { 886 header( "Refresh: 0;url=$location");891 header( "Refresh: 0;url=$location" ); 887 892 } else { 888 893 if ( php_sapi_name() != 'cgi-fcgi' ) 889 status_header( $status); // This causes problems on IIS and some FastCGI setups890 header( "Location: $location", true, $status);894 status_header( $status ); // This causes problems on IIS and some FastCGI setups 895 header( "Location: $location", true, $status ); 891 896 } 897 898 // output a hypertext fragment? - sometimes wordpress needs to ignore the 899 // HTTP 1.1 suggestion to output a hypertext fragment on redirects, e.g. with 900 // plugin activation checks. 901 if ( !$hypertext ) 902 return; 903 904 // hyptertext should be output for certain methods / stati only 905 $method = $_SERVER['REQUEST_METHOD']; 906 $html = ('HEAD' !== $method) && (301 === $status || 302 === $status || 303 === $status || 307 === $status); 907 908 if ( !$html ) 909 return; 910 911 $hypertext = sprintf( '%s %s: <a href="%s">%s</a>', $status, esc_html( get_status_header_desc( $status ) ), esc_attr( $location ), esc_html( $location ) ); 912 $hypertext = apply_filters( 'redirect_hypertext', $hypertext, $location, $status ); 913 914 echo $hypertext; 892 915 } 893 916 endif; 894 917 918 if ( !function_exists('wp_redirect_hypertext') ) : 919 /** 920 * Generate a Hypertext Fragment for a HTTP Redirect 921 * 922 * @since 3.1 923 * 924 * @param 925 * @return hypertext fragment 926 */ 927 function wp_redirect_hypertext($hypertext, $location, $status) { 928 $version = $GLOBALS['wp_version']; 929 list($link, $title, $description, $charset) = array_map('get_bloginfo', array('wpurl', 'name', 'description', 'charset')); 930 931 $homepage = sprintf('<a href="%s">%s - %s</a>', esc_attr( $link ), esc_html( $title ), esc_html( $description ) ); 932 933 ob_start(); 934 ?> 935 <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=<?php echo $charset; ?>"> 936 <TITLE><?php echo $status; ?> Moved</TITLE></HEAD><BODY> 937 <H1><?php echo $status; ?> <?php echo get_status_header_desc( $status ); ?></H1> 938 The document has moved 939 <A HREF="<?php echo esc_attr( $location ); ?>">here</A>. 940 <HR> 941 <address>WordPress/<?php echo esc_html( $version ); ?> at <?php echo $homepage; ?>.</address> 942 </BODY></HTML> 943 <?php 944 return ob_get_clean(); 945 } 946 endif; 947 895 948 if ( !function_exists('wp_sanitize_redirect') ) : 896 949 /** 897 950 * Sanitizes a URL for use in a redirect. -
wp-admin/includes/plugin.php
479 479 480 480 if ( !in_array($plugin, $current) ) { 481 481 if ( !empty($redirect) ) 482 wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect) ); // we'll override this later if the plugin can be included without fatal error482 wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect), 302, false); // we'll override this later if the plugin can be included without fatal error 483 483 ob_start(); 484 484 include(WP_PLUGIN_DIR . '/' . $plugin); 485 485 do_action( 'activate_plugin', trim( $plugin) );