equal
deleted
inserted
replaced
43 $wp_scripts = new WP_Scripts(); |
43 $wp_scripts = new WP_Scripts(); |
44 wp_default_scripts( $wp_scripts ); |
44 wp_default_scripts( $wp_scripts ); |
45 wp_default_packages_vendor( $wp_scripts ); |
45 wp_default_packages_vendor( $wp_scripts ); |
46 wp_default_packages_scripts( $wp_scripts ); |
46 wp_default_packages_scripts( $wp_scripts ); |
47 |
47 |
48 if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) { |
48 $etag = "WP:{$wp_version};"; |
|
49 |
|
50 foreach ( $load as $handle ) { |
|
51 if ( ! array_key_exists( $handle, $wp_scripts->registered ) ) { |
|
52 continue; |
|
53 } |
|
54 |
|
55 $ver = $wp_scripts->registered[ $handle ]->ver ? $wp_scripts->registered[ $handle ]->ver : $wp_version; |
|
56 $etag .= "{$handle}:{$ver};"; |
|
57 } |
|
58 |
|
59 /* |
|
60 * This is not intended to be cryptographically secure, just a fast way to get |
|
61 * a fixed length string based on the script versions. As this file does not |
|
62 * load the full WordPress environment, it is not possible to use the salted |
|
63 * wp_hash() function. |
|
64 */ |
|
65 $etag = 'W/"' . md5( $etag ) . '"'; |
|
66 |
|
67 if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $etag ) { |
49 header( "$protocol 304 Not Modified" ); |
68 header( "$protocol 304 Not Modified" ); |
50 exit; |
69 exit; |
51 } |
70 } |
52 |
71 |
53 foreach ( $load as $handle ) { |
72 foreach ( $load as $handle ) { |
57 |
76 |
58 $path = ABSPATH . $wp_scripts->registered[ $handle ]->src; |
77 $path = ABSPATH . $wp_scripts->registered[ $handle ]->src; |
59 $out .= get_file( $path ) . "\n"; |
78 $out .= get_file( $path ) . "\n"; |
60 } |
79 } |
61 |
80 |
62 header( "Etag: $wp_version" ); |
81 header( "Etag: $etag" ); |
63 header( 'Content-Type: application/javascript; charset=UTF-8' ); |
82 header( 'Content-Type: application/javascript; charset=UTF-8' ); |
64 header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expires_offset ) . ' GMT' ); |
83 header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expires_offset ) . ' GMT' ); |
65 header( "Cache-Control: public, max-age=$expires_offset" ); |
84 header( "Cache-Control: public, max-age=$expires_offset" ); |
66 |
85 |
67 echo $out; |
86 echo $out; |