mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-26 00:04:28 +00:00
Split the script queue in head and footer part, concatenate and compress the default js and css, first run, see #8628
git-svn-id: https://develop.svn.wordpress.org/trunk@10357 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -35,22 +35,29 @@ require( ABSPATH . WPINC . '/functions.wp-styles.php' );
|
||||
* @param object $scripts WP_Scripts object.
|
||||
*/
|
||||
function wp_default_scripts( &$scripts ) {
|
||||
if (!$guessurl = site_url())
|
||||
|
||||
if ( !$guessurl = site_url() )
|
||||
$guessurl = wp_guess_url();
|
||||
|
||||
$scripts->base_url = $guessurl;
|
||||
$scripts->content_url = WP_CONTENT_URL;
|
||||
$scripts->default_version = get_bloginfo( 'version' );
|
||||
$scripts->default_dirs = array('/wp-admin/js/', '/wp-includes/js/');
|
||||
|
||||
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
|
||||
|
||||
|
||||
$scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' );
|
||||
|
||||
|
||||
$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090106' );
|
||||
$scripts->add_data( 'common', 'group', 1 );
|
||||
$scripts->localize( 'common', 'commonL10n', array(
|
||||
'warnDelete' => __("You are about to delete the selected items.\n 'Cancel' to stop, 'OK' to delete."),
|
||||
'l10n_print_after' => 'try{convertEntities(commonL10n);}catch(e){};'
|
||||
) );
|
||||
|
||||
$scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", false, '1.6.1' );
|
||||
$scripts->add_data( 'sack', 'group', 1 );
|
||||
|
||||
$scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", false, '20090102' );
|
||||
$scripts->localize( 'quicktags', 'quicktagsL10n', array(
|
||||
@@ -79,6 +86,7 @@ function wp_default_scripts( &$scripts ) {
|
||||
$scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');
|
||||
|
||||
$scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), '20090102' );
|
||||
$scripts->add_data( 'wp-ajax-response', 'group', 1 );
|
||||
$scripts->localize( 'wp-ajax-response', 'wpAjax', array(
|
||||
'noPerm' => __('You do not have permission to do that.'),
|
||||
'broken' => __('An unidentified error has occurred.'),
|
||||
@@ -86,8 +94,10 @@ function wp_default_scripts( &$scripts ) {
|
||||
) );
|
||||
|
||||
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20090106' );
|
||||
$scripts->add_data( 'autosave', 'group', 1 );
|
||||
|
||||
$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20090102' );
|
||||
$scripts->add_data( 'wp-lists', 'group', 1 );
|
||||
$scripts->localize( 'wp-lists', 'wpListL10n', array(
|
||||
'url' => admin_url('admin-ajax.php')
|
||||
) );
|
||||
@@ -104,14 +114,48 @@ function wp_default_scripts( &$scripts ) {
|
||||
$scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118');
|
||||
|
||||
$scripts->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.3b2');
|
||||
|
||||
$scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.5.2' );
|
||||
$scripts->add_data( 'jquery-ui-core', 'group', 1 );
|
||||
|
||||
$scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.5.2' );
|
||||
$scripts->add_data( 'jquery-ui-tabs', 'group', 1 );
|
||||
|
||||
$scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.5.2c' );
|
||||
$scripts->add_data( 'jquery-ui-sortable', 'group', 1 );
|
||||
|
||||
$scripts->add( 'jquery-ui-draggable', '/wp-includes/js/jquery/ui.draggable.js', array('jquery-ui-core'), '1.5.2' );
|
||||
$scripts->add_data( 'jquery-ui-draggable', 'group', 1 );
|
||||
|
||||
$scripts->add( 'jquery-ui-resizable', '/wp-includes/js/jquery/ui.resizable.js', array('jquery-ui-core'), '1.5.2' );
|
||||
$scripts->add_data( 'jquery-ui-resizable', 'group', 1 );
|
||||
|
||||
$scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.5.2' );
|
||||
$scripts->add_data( 'jquery-ui-dialog', 'group', 1 );
|
||||
|
||||
$scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '2.02m');
|
||||
$scripts->add_data( 'jquery-form', 'group', 1 );
|
||||
|
||||
$scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color$suffix.js", array('jquery'), '2.0-4561m');
|
||||
$scripts->add_data( 'jquery-color', 'group', 1 );
|
||||
|
||||
$scripts->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' );
|
||||
|
||||
$scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1bm');
|
||||
$scripts->add_data( 'suggest', 'group', 1 );
|
||||
|
||||
$scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20m');
|
||||
$scripts->add_data( 'schedule', 'group', 1 );
|
||||
|
||||
$scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array('jquery'), '0.0.2m' );
|
||||
$scripts->add_data( 'jquery-hotkeys', 'group', 1 );
|
||||
|
||||
$scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), '20090102' );
|
||||
$scripts->add_data( 'jquery-table-hotkeys', 'group', 1 );
|
||||
|
||||
$scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20080430m');
|
||||
$scripts->add_data( 'thickbox', 'group', 1 );
|
||||
|
||||
|
||||
if ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) {
|
||||
$scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.2.0-20081031');
|
||||
@@ -144,23 +188,17 @@ function wp_default_scripts( &$scripts ) {
|
||||
'deleted' => __('Deleted'),
|
||||
'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};'
|
||||
) );
|
||||
|
||||
|
||||
$scripts->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.2.0-20081031');
|
||||
$scripts->localize( 'swfupload-degrade', 'uploadDegradeOptions', array(
|
||||
'is_lighttpd_before_150' => is_lighttpd_before_150(),
|
||||
) );
|
||||
|
||||
$scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.5.2' );
|
||||
$scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.5.2' );
|
||||
$scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.5.2c' );
|
||||
$scripts->add( 'jquery-ui-draggable', '/wp-includes/js/jquery/ui.draggable.js', array('jquery-ui-core'), '1.5.2' );
|
||||
$scripts->add( 'jquery-ui-resizable', '/wp-includes/js/jquery/ui.resizable.js', array('jquery-ui-core'), '1.5.2' );
|
||||
$scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.5.2' );
|
||||
|
||||
$scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", false, '20090102');
|
||||
|
||||
if ( is_admin() ) {
|
||||
$scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ), '20090102' );
|
||||
$scripts->add_data( 'ajaxcat', 'group', 1 );
|
||||
$scripts->localize( 'ajaxcat', 'catL10n', array(
|
||||
'add' => attribute_escape(__('Add')),
|
||||
'how' => __('Separate multiple categories with commas.'),
|
||||
@@ -168,12 +206,16 @@ function wp_default_scripts( &$scripts ) {
|
||||
) );
|
||||
|
||||
$scripts->add( 'admin-categories', "/wp-admin/js/categories$suffix.js", array('wp-lists'), '20090102' );
|
||||
$scripts->add_data( 'admin-categories', 'group', 1 );
|
||||
|
||||
$scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('wp-lists'), '20090102' );
|
||||
$scripts->add_data( 'admin-tags', 'group', 1 );
|
||||
|
||||
$scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' );
|
||||
$scripts->add_data( 'admin-custom-fields', 'group', 1 );
|
||||
|
||||
$scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20090102' );
|
||||
$scripts->add_data( 'password-strength-meter', 'group', 1 );
|
||||
$scripts->localize( 'password-strength-meter', 'pwsL10n', array(
|
||||
'empty' => __('Strength indicator'),
|
||||
'short' => __('Very weak'),
|
||||
@@ -184,6 +226,7 @@ function wp_default_scripts( &$scripts ) {
|
||||
) );
|
||||
|
||||
$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090112' );
|
||||
$scripts->add_data( 'admin-comments', 'group', 1 );
|
||||
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
|
||||
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
|
||||
'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last'])
|
||||
@@ -192,11 +235,13 @@ function wp_default_scripts( &$scripts ) {
|
||||
$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", false, '3517m' );
|
||||
|
||||
$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20090102' );
|
||||
$scripts->add_data( 'postbox', 'group', 1 );
|
||||
$scripts->localize( 'postbox', 'postboxL10n', array(
|
||||
'requestFile' => admin_url('admin-ajax.php')
|
||||
) );
|
||||
|
||||
$scripts->add( 'slug', "/wp-admin/js/slug$suffix.js", array('jquery'), '20090102' );
|
||||
$scripts->add_data( 'slug', 'group', 1 );
|
||||
$scripts->localize( 'slug', 'slugL10n', array(
|
||||
'requestFile' => admin_url('admin-ajax.php'),
|
||||
'save' => __('Save'),
|
||||
@@ -205,6 +250,7 @@ function wp_default_scripts( &$scripts ) {
|
||||
) );
|
||||
|
||||
$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20090102' );
|
||||
$scripts->add_data( 'post', 'group', 1 );
|
||||
$scripts->localize( 'post', 'postL10n', array(
|
||||
'tagsUsed' => __('Tags used on this post:'),
|
||||
'add' => attribute_escape(__('Add')),
|
||||
@@ -232,6 +278,7 @@ function wp_default_scripts( &$scripts ) {
|
||||
) );
|
||||
|
||||
$scripts->add( 'page', "/wp-admin/js/page$suffix.js", array('jquery', 'slug', 'wp-lists', 'postbox'), '20090102' );
|
||||
$scripts->add_data( 'page', 'group', 1 );
|
||||
$scripts->localize( 'page', 'postL10n', array(
|
||||
'cancel' => __('Cancel'),
|
||||
'edit' => __('Edit'),
|
||||
@@ -254,8 +301,10 @@ function wp_default_scripts( &$scripts ) {
|
||||
) );
|
||||
|
||||
$scripts->add( 'link', "/wp-admin/js/link$suffix.js", array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20090102' );
|
||||
$scripts->add_data( 'link', 'group', 1 );
|
||||
|
||||
$scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array('jquery'), '20090102' );
|
||||
$scripts->add_data( 'comment', 'group', 1 );
|
||||
$scripts->localize( 'comment', 'commentL10n', array(
|
||||
'cancel' => __('Cancel'),
|
||||
'edit' => __('Edit'),
|
||||
@@ -265,6 +314,7 @@ function wp_default_scripts( &$scripts ) {
|
||||
$scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ), '20090102' );
|
||||
|
||||
$scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox' ), '20090102' );
|
||||
$scripts->add_data( 'media-upload', 'group', 1 );
|
||||
|
||||
$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'interface' ), '20090106' );
|
||||
$scripts->localize( 'admin-widgets', 'widgetsL10n', array(
|
||||
@@ -277,6 +327,7 @@ function wp_default_scripts( &$scripts ) {
|
||||
));
|
||||
|
||||
$scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), '20090102' );
|
||||
$scripts->add_data( 'word-count', 'group', 1 );
|
||||
$scripts->localize( 'word-count', 'wordCountL10n', array(
|
||||
'count' => __('Word count: %d'),
|
||||
'l10n_print_after' => 'try{convertEntities(wordCountL10n);}catch(e){};'
|
||||
@@ -290,8 +341,10 @@ function wp_default_scripts( &$scripts ) {
|
||||
));
|
||||
|
||||
$scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20090102' );
|
||||
$scripts->add_data( 'theme-preview', 'group', 1 );
|
||||
|
||||
$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'jquery-form', 'suggest' ), '20090102' );
|
||||
$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery-form', 'suggest' ), '20090102' );
|
||||
$scripts->add_data( 'inline-edit-post', 'group', 1 );
|
||||
$scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
|
||||
'error' => __('Error while saving the changes.'),
|
||||
'ntdeltitle' => __('Remove From Bulk Edit'),
|
||||
@@ -299,23 +352,31 @@ function wp_default_scripts( &$scripts ) {
|
||||
'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
|
||||
) );
|
||||
|
||||
$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'jquery-form' ), '20090109' );
|
||||
$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery-form' ), '20090109' );
|
||||
$scripts->add_data( 'inline-edit-tax', 'group', 1 );
|
||||
$scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
|
||||
'error' => __('Error while saving the changes.'),
|
||||
'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
|
||||
) );
|
||||
|
||||
$scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'thickbox', 'jquery' ), '20090102' );
|
||||
$scripts->add_data( 'plugin-install', 'group', 1 );
|
||||
$scripts->localize( 'plugin-install', 'plugininstallL10n', array(
|
||||
'plugin_information' => __('Plugin Information:'),
|
||||
'l10n_print_after' => 'try{convertEntities(plugininstallL10n);}catch(e){};'
|
||||
) );
|
||||
|
||||
$scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' );
|
||||
$scripts->add_data( 'farbtastic', 'group', 1 );
|
||||
|
||||
$scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20090102' );
|
||||
$scripts->add_data( 'dashboard', 'group', 1 );
|
||||
|
||||
$scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '20090102' );
|
||||
$scripts->add_data( 'hoverIntent', 'group', 1 );
|
||||
|
||||
$scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery-ui-draggable', 'jquery-ui-resizable' ), '20090113' );
|
||||
$scripts->add_data( 'media', 'group', 1 );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -340,9 +401,12 @@ function wp_default_styles( &$styles ) {
|
||||
// then it assigns $guess_url to wp_guess_url(). Strange format, but it works.
|
||||
if ( ! $guessurl = site_url() )
|
||||
$guessurl = wp_guess_url();
|
||||
|
||||
$styles->base_url = $guessurl;
|
||||
$styles->content_url = WP_CONTENT_URL;
|
||||
$styles->default_version = get_bloginfo( 'version' );
|
||||
$styles->text_direction = 'rtl' == get_bloginfo( 'text_direction' ) ? 'rtl' : 'ltr';
|
||||
$styles->default_dirs = array('/wp-admin/');
|
||||
|
||||
$rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' );
|
||||
|
||||
@@ -384,10 +448,10 @@ function wp_default_styles( &$styles ) {
|
||||
* @return array Reordered array, if needed.
|
||||
*/
|
||||
function wp_prototype_before_jquery( $js_array ) {
|
||||
if ( false === $jquery = array_search( 'jquery', $js_array ) )
|
||||
if ( false === $jquery = array_search( 'jquery', $js_array, true ) )
|
||||
return $js_array;
|
||||
|
||||
if ( false === $prototype = array_search( 'prototype', $js_array ) )
|
||||
if ( false === $prototype = array_search( 'prototype', $js_array, true ) )
|
||||
return $js_array;
|
||||
|
||||
if ( $prototype < $jquery )
|
||||
@@ -461,6 +525,128 @@ function wp_style_loader_src( $src, $handle ) {
|
||||
return $src;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the script queue in the HTML head.
|
||||
*
|
||||
* Postpones the scripts that were queued for the footer.
|
||||
* wp_print_footer_scripts() has to be called in the footer to print these scripts.
|
||||
*
|
||||
* @since unknown
|
||||
* @see wp_print_scripts()
|
||||
*/
|
||||
function wp_print_head_scripts() {
|
||||
do_action( 'wp_print_scripts' );
|
||||
global $wp_scripts, $concatenate_scripts, $compress_scripts;
|
||||
|
||||
if ( !is_a($wp_scripts, 'WP_Scripts') )
|
||||
$wp_scripts = new WP_Scripts();
|
||||
|
||||
if ( ! isset($concatenate_scripts) )
|
||||
script_concat_settings();
|
||||
|
||||
$wp_scripts->do_concat = $concatenate_scripts;
|
||||
$wp_scripts->do_head_items();
|
||||
|
||||
_pring_scripts();
|
||||
|
||||
$wp_scripts->do_concat = false;
|
||||
return $wp_scripts->done;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the scripts that were queued for the footer.
|
||||
*
|
||||
* @since unknown
|
||||
*/
|
||||
function wp_print_footer_scripts() {
|
||||
global $wp_scripts, $concatenate_scripts;
|
||||
|
||||
if ( !is_a($wp_scripts, 'WP_Scripts') )
|
||||
return array(); // No need to run if not instantiated.
|
||||
|
||||
if ( ! isset($concatenate_scripts) )
|
||||
script_concat_settings();
|
||||
|
||||
$wp_scripts->do_concat = $concatenate_scripts;
|
||||
$wp_scripts->do_footer_items();
|
||||
|
||||
_pring_scripts();
|
||||
|
||||
$wp_scripts->do_concat = false;
|
||||
return $wp_scripts->done;
|
||||
}
|
||||
|
||||
function _pring_scripts() {
|
||||
global $wp_scripts, $compress_scripts;
|
||||
|
||||
$zip = $compress_scripts ? 1 : 0;
|
||||
|
||||
if ( !empty($wp_scripts->concat) ) {
|
||||
|
||||
if ( !empty($wp_scripts->print_code) ) {
|
||||
echo "<script type='text/javascript'>\n";
|
||||
echo "/* <![CDATA[ */\n";
|
||||
echo $wp_scripts->print_code;
|
||||
echo "/* ]]> */\n";
|
||||
echo "</script>\n";
|
||||
$wp_scripts->print_code = '';
|
||||
}
|
||||
|
||||
$ver = md5($wp_scripts->concat_version);
|
||||
$src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&load=" . rtrim($wp_scripts->concat, ',') . "&ver=$ver";
|
||||
echo "<script type='text/javascript' src='$src'></script>\n";
|
||||
$wp_scripts->concat = $wp_scripts->concat_version = '';
|
||||
}
|
||||
|
||||
if ( !empty($wp_scripts->print_html) ) {
|
||||
echo $wp_scripts->print_html;
|
||||
$wp_scripts->print_html = '';
|
||||
}
|
||||
}
|
||||
|
||||
function wp_print_admin_styles() {
|
||||
global $wp_styles, $concatenate_scripts, $compress_scripts;
|
||||
|
||||
if ( !is_a($wp_styles, 'WP_Styles') )
|
||||
$wp_styles = new WP_Styles();
|
||||
|
||||
if ( ! isset($concatenate_scripts) )
|
||||
script_concat_settings();
|
||||
|
||||
$wp_styles->do_concat = $concatenate_scripts;
|
||||
$zip = $compress_scripts ? 1 : 0;
|
||||
|
||||
$wp_styles->do_items(false);
|
||||
|
||||
if ( !empty($wp_styles->concat) ) {
|
||||
$ver = md5($wp_styles->concat_version);
|
||||
$rtl = 'rtl' === $wp_styles->text_direction ? 1 : 0;
|
||||
$href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&rtl={$rtl}&load=" . rtrim($wp_styles->concat, ',') . "&ver=$ver";
|
||||
echo "<link rel='stylesheet' href='$href' type='text/css' media='all' />\n";
|
||||
$wp_styles->concat = $wp_styles->concat_version = '';
|
||||
}
|
||||
|
||||
if ( !empty($wp_styles->print_html) ) {
|
||||
echo $wp_styles->print_html;
|
||||
$wp_styles->print_html = '';
|
||||
}
|
||||
|
||||
$wp_styles->do_concat = false;
|
||||
return $wp_styles->done;
|
||||
}
|
||||
|
||||
function script_concat_settings() {
|
||||
global $concatenate_scripts, $compress_scripts;
|
||||
|
||||
$concatenate_scripts = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true;
|
||||
if ( $concatenate_scripts && -1 == get_option('concatenate_scripts') )
|
||||
$concatenate_scripts = false;
|
||||
|
||||
$compress_scripts = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true;
|
||||
if ( $compress_scripts && ! get_option('can_compress_scripts') )
|
||||
$compress_scripts = false;
|
||||
}
|
||||
|
||||
add_action( 'wp_default_scripts', 'wp_default_scripts' );
|
||||
add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' );
|
||||
add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
|
||||
|
||||
Reference in New Issue
Block a user