wp-multibyte-patch
Last commit date
ext
6 months ago
includes
1 year ago
languages
13 years ago
readme.txt
3 weeks ago
wp-multibyte-patch.php
6 months ago
wplink.php
6 years ago
wpmp-config-sample-ja.php
5 years ago
wpmp-load.php
12 years ago
wplink.php
61 lines
| 1 | <?php |
| 2 | |
| 3 | error_reporting( 0 ); |
| 4 | |
| 5 | function get_file( $path = null ) { |
| 6 | if ( function_exists( 'realpath' ) ) |
| 7 | $path = realpath( $path ); |
| 8 | |
| 9 | if ( ! $path || ! is_file( $path ) ) |
| 10 | return false; |
| 11 | |
| 12 | return @file_get_contents( $path ); |
| 13 | } |
| 14 | |
| 15 | $etag = isset( $_GET['ver'] ) ? md5( $_GET['ver'] ) : false; |
| 16 | |
| 17 | if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && $_SERVER['HTTP_IF_NONE_MATCH'] === $etag ) { |
| 18 | $protocol = $_SERVER['SERVER_PROTOCOL']; |
| 19 | |
| 20 | if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) |
| 21 | $protocol = 'HTTP/1.0'; |
| 22 | |
| 23 | header( "$protocol 304 Not Modified" ); |
| 24 | |
| 25 | exit; |
| 26 | } |
| 27 | |
| 28 | $expires_offset = 31536000; // 1 year |
| 29 | |
| 30 | if( $etag ) |
| 31 | header( "Etag: $etag" ); |
| 32 | |
| 33 | header( 'Content-Type: application/javascript; charset=UTF-8' ); |
| 34 | header( 'Vary: Accept-Encoding' ); |
| 35 | header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expires_offset ) . ' GMT' ); |
| 36 | header( "Cache-Control: public, max-age=$expires_offset" ); |
| 37 | |
| 38 | $debug_suffix = isset( $_GET['sd'] ) ? '' : '.min'; |
| 39 | $file = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . "/wp-includes/js/wplink{$debug_suffix}.js"; |
| 40 | $out = get_file( $file ); |
| 41 | |
| 42 | if( ! $out ) |
| 43 | exit; |
| 44 | |
| 45 | if( isset( $_GET['sd'] ) ) |
| 46 | echo str_replace( 'search.length > 2', 'search.length > 1', $out ); |
| 47 | else |
| 48 | echo str_replace( |
| 49 | array( |
| 50 | '(2<t.length){if', |
| 51 | '.length>2){if', |
| 52 | ), |
| 53 | array( |
| 54 | '(1<t.length){if', |
| 55 | '.length>1){if', |
| 56 | ), |
| 57 | $out |
| 58 | ); |
| 59 | |
| 60 | exit; |
| 61 |