wp/wp-admin/load-styles.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
     1 <?php
     1 <?php
     2 
     2 
     3 /*
     3 /*
     4  * Disable error reporting.
     4  * The error_reporting() function can be disabled in php.ini. On systems where that is the case,
     5  *
     5  * it's best to add a dummy function to the wp-config.php file, but as this call to the function
     6  * Set this to error_reporting( -1 ) for debugging.
     6  * is run prior to wp-config.php loading, it is wrapped in a function_exists() check.
     7  */
     7  */
     8 error_reporting( 0 );
     8 if ( function_exists( 'error_reporting' ) ) {
       
     9 	/*
       
    10 	 * Disable error reporting.
       
    11 	 *
       
    12 	 * Set this to error_reporting( -1 ) for debugging.
       
    13 	 */
       
    14 	error_reporting( 0 );
       
    15 }
     9 
    16 
    10 // Set ABSPATH for execution.
    17 // Set ABSPATH for execution.
    11 if ( ! defined( 'ABSPATH' ) ) {
    18 if ( ! defined( 'ABSPATH' ) ) {
    12 	define( 'ABSPATH', dirname( __DIR__ ) . '/' );
    19 	define( 'ABSPATH', dirname( __DIR__ ) . '/' );
    13 }
    20 }
    46 $out            = '';
    53 $out            = '';
    47 
    54 
    48 $wp_styles = new WP_Styles();
    55 $wp_styles = new WP_Styles();
    49 wp_default_styles( $wp_styles );
    56 wp_default_styles( $wp_styles );
    50 
    57 
    51 $etag = "WP:{$wp_version};";
    58 $etag = $wp_styles->get_etag( $load );
    52 
       
    53 foreach ( $load as $handle ) {
       
    54 	if ( ! array_key_exists( $handle, $wp_styles->registered ) ) {
       
    55 		continue;
       
    56 	}
       
    57 
       
    58 	$ver   = $wp_styles->registered[ $handle ]->ver ? $wp_styles->registered[ $handle ]->ver : $wp_version;
       
    59 	$etag .= "{$handle}:{$ver};";
       
    60 }
       
    61 
       
    62 /*
       
    63  * This is not intended to be cryptographically secure, just a fast way to get
       
    64  * a fixed length string based on the script versions. As this file does not
       
    65  * load the full WordPress environment, it is not possible to use the salted
       
    66  * wp_hash() function.
       
    67  */
       
    68 $etag = 'W/"' . md5( $etag ) . '"';
       
    69 
    59 
    70 if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $etag ) {
    60 if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $etag ) {
    71 	header( "$protocol 304 Not Modified" );
    61 	header( "$protocol 304 Not Modified" );
    72 	exit;
    62 	exit;
    73 }
    63 }