WordPress.org

Make WordPress Core

Ticket #26886: 26886.diff

File 26886.diff, 2.7 KB (added by dd32, 5 years ago)
  • wp-includes/script-loader.php

     
    853853
    854854        $zip = $compress_scripts ? 1 : 0;
    855855        if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP )
    856856                $zip = 'gzip';
    857857
    858858        if ( $concat = trim( $wp_scripts->concat, ', ' ) ) {
    859859
    860860                if ( !empty($wp_scripts->print_code) ) {
    861861                        echo "\n<script type='text/javascript'>\n";
    862862                        echo "/* <![CDATA[ */\n"; // not needed in HTML 5
    863863                        echo $wp_scripts->print_code;
    864864                        echo "/* ]]> */\n";
    865865                        echo "</script>\n";
    866866                }
    867867
    868                 $concat = str_split( $concat, 128 );
     868                $concat = str_split( $concat, 40 );
    869869                $concat = 'load%5B%5D=' . implode( '&load%5B%5D=', $concat );
    870870
    871871                $src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&" . $concat . '&ver=' . $wp_scripts->default_version;
    872872                echo "<script type='text/javascript' src='" . esc_attr($src) . "'></script>\n";
    873873        }
    874874
    875875        if ( !empty($wp_scripts->print_html) )
    876876                echo $wp_scripts->print_html;
    877877}
    878878
    879879/**
    880880 * Prints the script queue in the HTML head on the front end.
    881881 *
    882882 * Postpones the scripts that were queued for the footer.
    883883 * wp_print_footer_scripts() is called in the footer to print these scripts.
  • wp-admin/load-scripts.php

     
    131131$force_gzip = ( $compress && 'gzip' == $_GET['c'] );
    132132$expires_offset = 31536000; // 1 year
    133133$out = '';
    134134
    135135$wp_scripts = new WP_Scripts();
    136136wp_default_scripts($wp_scripts);
    137137
    138138foreach( $load as $handle ) {
    139139        if ( !array_key_exists($handle, $wp_scripts->registered) )
    140140                continue;
    141141
    142142        $path = ABSPATH . $wp_scripts->registered[$handle]->src;
    143143        $out .= get_file($path) . "\n";
    144144}
    145145
     146$out = 'alert("Load="+' . json_encode( $load ) . '+"\n\nGET[\'load\']="+' . json_encode( $_GET['load'] ) . ');';
     147
    146148header('Content-Type: application/javascript; charset=UTF-8');
    147149header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
    148150header("Cache-Control: public, max-age=$expires_offset");
    149151
    150152if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
    151153        header('Vary: Accept-Encoding'); // Handle proxies
    152154        if ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
    153155                header('Content-Encoding: deflate');
    154156                $out = gzdeflate( $out, 3 );
    155157        } elseif ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) {
    156158                header('Content-Encoding: gzip');
    157159                $out = gzencode( $out, 3 );
    158160        }
    159161}
    160162