Make WordPress Core

Changeset 7981


Ignore:
Timestamp:
05/22/2008 03:27:28 PM (16 years ago)
Author:
ryan
Message:

Use style loader for gears manifest. Props azaozz. fixes #7015

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/gears-manifest.php

    r7961 r7981  
    22
    33define( 'ABSPATH', dirname(dirname(__FILE__)) );
     4define( 'WPINC', '/wp-includes' );
    45
    56function __() {}
     
    910function get_option() {}
    1011function is_lighttpd_before_150() {}
     12function add_action() {}
     13function do_action_ref_array() {}
     14function get_bloginfo() {}
    1115function is_admin() {return true;}
    1216
    1317require(ABSPATH . '/wp-includes/script-loader.php');
     18require(ABSPATH . '/wp-includes/version.php');
    1419
    1520$wp_scripts = new WP_Scripts();
    16 
    17 $default_js = $version = '';
    18 foreach ( $wp_scripts->scripts as $script ) {
     21wp_default_scripts($wp_scripts);
     22
     23$wp_styles = new WP_Styles();
     24wp_default_styles($wp_styles);
     25
     26$get_lang = file_exists( ABSPATH . '/wp-config.php') ? file( ABSPATH . '/wp-config.php' ) : file( dirname(ABSPATH) . '/wp-config.php' );
     27
     28if ( is_array($get_lang) ) {
     29    foreach ( $get_lang as $val ) {
     30        if ( strpos( $val, "'WPLANG'" ) !== false ) {
     31            eval( $val );
     32            break;
     33        }
     34    }
     35}
     36
     37if ( defined('WPLANG') && '' != WPLANG ) {
     38    if ( file_exists(ABSPATH . '/wp-content/languages') && @is_dir(ABSPATH . '/wp-content/languages') )
     39        $langdir = '/wp-content/languages/';
     40    else
     41        $langdir = '/wp-includes/languages/';
     42   
     43    $locale_file = ABSPATH . $langdir . WPLANG . '.php';
     44    if ( is_readable($locale_file) )
     45        include_once($locale_file);
     46}
     47
     48$rtl = ( isset($text_direction) && 'rtl' == $text_direction ) ? true : false;
     49
     50$defaults = $man_version = '';
     51foreach ( $wp_scripts->registered as $script ) {
    1952    if ( empty($script->src) || strpos($script->src, 'tiny_mce_config.php') ) continue;
    20     $src = str_replace( '/wp-admin/', '', $script->src );
    21     $src = str_replace( '/wp-includes/', '../wp-includes/', $src );
    22     $default_js .= '{ "url" : "' . $src . '?ver=' . $script->ver . '" },' . "\n";
    23     $version .= $script->ver;
    24 }
    25 
    26 $version = md5($version);
     53    $ver = empty($script->ver) ? $wp_version : $script->ver;
     54    $src = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $script->src );
     55    $defaults .= '{ "url" : "' . $src . '?ver=' . $ver . '" },' . "\n";
     56    $man_version .= $ver;
     57}
     58
     59foreach ( $wp_styles->registered as $style ) {
     60    if ( empty($style->src) ) continue;
     61
     62    $ver = empty($style->ver) ? $wp_version : $style->ver;
     63    $src = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $style->src );
     64    if ( 'colors' == $style->handle ) $src = 'css/colors-classic.css';
     65    $defaults .= '{ "url" : "' . $src . '?ver=' . $ver . '" },' . "\n";
     66
     67    if ( $rtl && isset($style->extra['rtl']) && $style->extra['rtl'] ) {
     68        if ( is_bool( $style->extra['rtl'] ) )
     69            $rtl_href = str_replace( '.css', '-rtl.css', $src );
     70        else
     71            $rtl_href = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $style->extra['rtl'] );
     72
     73        $defaults .= '{ "url" : "' . $rtl_href . '?ver=' . $ver . '" },' . "\n";
     74    }
     75    $man_version .= $ver;
     76}
     77
     78$man_version = md5($man_version);
    2779
    2880header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
     
    3082header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
    3183header( 'Pragma: no-cache' );
    32 header( 'Content-Type: application/x-javascript; charset=UTF-8' ); // application/json text/plain ?
     84header( 'Content-Type: application/x-javascript; charset=UTF-8' );
    3385?>
    3486{
    3587"betaManifestVersion" : 1,
    36 "version" : "<?php echo $version; ?>_20080520",
     88"version" : "<?php echo $man_version; ?>_20080522",
    3789"entries" : [
    38 <?php echo $default_js; ?>
    39 
    40 { "url" : "wp-admin.css?version=2.6-bleeding" },
    41 { "url" : "rtl.css?version=2.6-bleeding" },
    42 { "url" : "../wp-includes/js/thickbox/thickbox.css?version=2.6-bleeding" },
    43 { "url" : "css/colors-classic-rtl.css?version=2.6-bleeding" },
    44 { "url" : "css/colors-classic.css?version=2.6-bleeding" },
    45 { "url" : "css/colors-fresh-rtl.css?version=2.6-bleeding" },
    46 { "url" : "css/colors-fresh.css?version=2.6-bleeding" },
    47 { "url" : "css/dashboard-rtl.css?version=2.6-bleeding" },
    48 { "url" : "css/dashboard.css?version=2.6-bleeding" },
    49 { "url" : "css/global.css?version=2.6-bleeding" },
    50 { "url" : "css/global-rtl.css?version=2.6-bleeding" },
    51 { "url" : "css/ie-rtl.css?version=2.6-bleeding" },
    52 { "url" : "css/ie.css?version=2.6-bleeding" },
    53 { "url" : "css/install-rtl.css?version=2.6-bleeding" },
    54 { "url" : "css/install.css?version=2.6-bleeding" },
    55 { "url" : "css/login-rtl.css?version=2.6-bleeding" },
    56 { "url" : "css/login.css?version=2.6-bleeding" },
    57 { "url" : "css/media-rtl.css?version=2.6-bleeding" },
    58 { "url" : "css/media.css?version=2.6-bleeding" },
    59 { "url" : "css/press-this.css?version=2.6-bleeding" },
    60 { "url" : "css/theme-editor-rtl.css?version=2.6-bleeding" },
    61 { "url" : "css/theme-editor.css?version=2.6-bleeding" },
    62 { "url" : "css/upload-rtl.css?version=2.6-bleeding" },
    63 { "url" : "css/widgets-rtl.css?version=2.6-bleeding" },
    64 { "url" : "css/widgets.css?version=2.6-bleeding" },
     90<?php echo $defaults; ?>
    6591
    6692{ "url" : "images/align-center.png" },
     
    6894{ "url" : "images/align-none.png" },
    6995{ "url" : "images/align-right.png" },
     96{ "url" : "images/browse-happy.gif" },
    7097{ "url" : "images/bubble_bg.gif" },
    7198{ "url" : "images/comment-grey-bubble.png" },
     
    76103{ "url" : "images/date-button.gif" },
    77104{ "url" : "images/fade-butt.png" },
     105{ "url" : "images/gear.png" },
    78106{ "url" : "images/logo-ghost.png" },
    79107{ "url" : "images/logo-login.gif" },
     108{ "url" : "images/logo.gif" },
    80109{ "url" : "images/media-button-gallery.gif" },
    81110{ "url" : "images/media-button-image.gif" },
     
    84113{ "url" : "images/media-button-video.gif" },
    85114{ "url" : "images/media-buttons.gif" },
     115{ "url" : "images/tab.png" },
    86116{ "url" : "images/tail.gif" },
    87117{ "url" : "images/toggle-arrow-rtl.gif" },
     
    89119{ "url" : "images/wordpress-logo.png" },
    90120{ "url" : "images/xit.gif" },
     121
    91122{ "url" : "../wp-includes/images/crystal/archive.png" },
    92123{ "url" : "../wp-includes/images/crystal/audio.png" },
  • trunk/wp-includes/general-template.php

    r7979 r7981  
    11591159}
    11601160
     1161/**
     1162 * Enqueues the default ThickBox js and css.
     1163 * If any of the settings need to be changed, this can be done with another js file
     1164 * similar to media-upload.js and theme-preview.js. That file should require array('thickbox')
     1165 * to ensure it is loaded after.
     1166 */
    11611167function add_thickbox() {
    11621168    wp_enqueue_script( 'thickbox' );
    1163     add_action( 'admin_print_scripts', 'add_thickbox_css' );
    1164 }
    1165 
    1166 function add_thickbox_css() {
    1167     wp_admin_css( 'css/thickbox' );
     1169    wp_enqueue_style( 'thickbox' );
    11681170}
    11691171
  • trunk/wp-includes/script-loader.php

    r7979 r7981  
    159159        ) );
    160160        $scripts->add( 'admin-gallery', '/wp-admin/js/gallery.js', array( 'jquery-ui-sortable' ), '20080520' );
    161         $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', false, '20080430' );
     161        $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', array( 'thickbox' ), '20080430' );
    162162        $scripts->localize( 'upload', 'uploadL10n', array(
    163163            'browseTitle' => attribute_escape(__('Browse your files')),
Note: See TracChangeset for help on using the changeset viewer.