WordPress.org

Make WordPress Core

Changeset 11388


Ignore:
Timestamp:
05/18/2009 08:29:26 PM (9 years ago)
Author:
azaozz
Message:

Clean the cache-manifests, make $manifest_version and $tinymce_version global vars accessible from the manifest

Location:
trunk
Files:
6 edited

Legend:

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

    r11076 r11388  
    1616/** Set ABSPATH for execution */
    1717define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' );
    18 define( 'WPINC', 'wp-includes' );
    1918
    2019require(ABSPATH . '/wp-admin/includes/manifest.php');
    2120
    22 $man_version = '';
    23 
    24 $files = get_manifest($man_version);
    25 
    26 $man_version = md5($man_version);
     21$files = get_manifest();
    2722
    2823header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
     
    3227header( 'Content-Type: text/cache-manifest; charset=UTF-8' );
    3328?>
    34 CACHE MANIFEST 
    35 # 
    36 # Version: <?php echo $man_version; ?>_20080710
    37 # 
     29CACHE MANIFEST
     30#
     31# Version: <?php echo $man_version; ?>
     32#
    3833<?php
    3934foreach ( $files as $file ) {
     
    4338    // If ver is set but ignoreQuery is not, output file with ver tacked on
    4439    else
    45         echo $file[0] . '?ver=' . $file[1] . "\n";
     40        echo $file[0] . '?' . $file[1] . "\n";
    4641}
    4742
  • trunk/wp-admin/gears-manifest.php

    r11076 r11388  
    1616/** Set ABSPATH for execution */
    1717define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' );
    18 define( 'WPINC', 'wp-includes' );
    1918
    2019require(ABSPATH . '/wp-admin/includes/manifest.php');
    2120
    22 $man_version = '';
    23 
    24 $files = get_manifest($man_version);
    25 
    26 $man_version = md5($man_version);
     21$files = get_manifest();
    2722
    2823header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
     
    3429{
    3530"betaManifestVersion" : 1,
    36 "version" : "<?php echo $man_version; ?>_20081201",
     31"version" : "<?php echo $man_version; ?>",
    3732"entries" : [
    3833<?php
     
    4540    // If ver is set but ignoreQuery is not, output file with ver tacked on
    4641    elseif ( !isset($file[2]) )
    47         $entries .= '{ "url" : "' . $file[0] . '?ver=' . $file[1] . '" },' . "\n";
     42        $entries .= '{ "url" : "' . $file[0] . '?' . $file[1] . '" },' . "\n";
    4843    // Output url, src, and ignoreQuery
    4944    else
    50         $entries .= '{ "url" : "' . $file[0] . '", "src" : "' . $file[0] . '?ver=' . $file[1] . '", "ignoreQuery" : true },' . "\n";
     45        $entries .= '{ "url" : "' . $file[0] . '", "src" : "' . $file[0] . '?' . $file[1] . '", "ignoreQuery" : true },' . "\n";
    5146}
    5247
  • trunk/wp-admin/includes/manifest.php

    r11204 r11388  
    33if ( !defined('ABSPATH') )
    44    exit;
    5 /**
    6  * @ignore
    7  */
    8 function __() {}
    9 
    10 /**
    11  * @ignore
    12  */
    13 function _c() {}
    14 
    15 /**
    16  * @ignore
    17  */
    18 function _x() {}
    19 
    20 
    21 /**
    22  * @ignore
    23  */
    24 function add_filter() {}
    25 
    26 /**
    27  * @ignore
    28  */
    29 function esc_attr() {}
    30 
    31 /**
    32  * @ignore
    33  */
    34 function attribute_escape() {}
    35 
    36 /**
    37  * @ignore
    38  */
    39 function apply_filters() {}
    40 
    41 /**
    42  * @ignore
    43  */
    44 function get_option() {}
    45 
    46 /**
    47  * @ignore
    48  */
    49 function is_lighttpd_before_150() {}
    50 
    51 /**
    52  * @ignore
    53  */
    54 function add_action() {}
    55 
    56 /**
    57  * @ignore
    58  */
    59 function do_action_ref_array() {}
    60 
    61 /**
    62  * @ignore
    63  */
    64 function get_bloginfo() {}
    65 
    66 /**
    67  * @ignore
    68  */
    69 function is_admin() {return true;}
    70 
    71 /**
    72  * @ignore
    73  */
    74 function site_url() {}
    75 
    76 /**
    77  * @ignore
    78  */
    79 function admin_url() {}
    80 
    81 /**
    82  * @ignore
    83  */
    84 function wp_guess_url() {}
    85 
    86 require(ABSPATH . '/wp-includes/script-loader.php');
    87 require(ABSPATH . '/wp-includes/version.php');
     5
     6require(ABSPATH . 'wp-includes/version.php');
     7
     8$man_version = md5( $tinymce_version . $manifest_version );
     9$mce_ver = "ver=$tinymce_version";
    8810
    8911/**
     
    9214 * Array format: file, version (optional), bool (whether to use src and set ignoreQuery)
    9315 */
    94 
    95 $wp_scripts = new WP_Scripts();
    96 wp_default_scripts($wp_scripts);
    97 
    98 $wp_styles = new WP_Styles();
    99 wp_default_styles($wp_styles);
    100 
    101 function &get_manifest(&$man_ver) {
    102     global $wp_scripts, $wp_styles, $wp_version;
    103 
    104     $files = array();
    105     foreach ( $wp_scripts->registered as $script ) {
    106         if ( empty($script->src) ) continue;
    107         $ver = empty($script->ver) ? $wp_version : $script->ver;
    108         if ( 'editor' == $script->handle ) $mce_ver = $script->ver;
    109         $src = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $script->src );
    110         $files[] = array($src, $ver);
    111         $man_ver .= $ver;
    112     }
    113 
    114     foreach ( $wp_styles->registered as $style ) {
    115         if ( empty($style->src) ) continue;
    116 
    117         $ver = empty($style->ver) ? $wp_version : $style->ver;
    118         $src = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $style->src );
    119         if ( 'colors' == $style->handle ) $src = 'css/colors-classic.css';
    120         $files[] = array($src, $ver);
    121          $man_ver .= $ver;
    122 
    123         if ( isset($style->extra['rtl']) && $style->extra['rtl'] ) {
    124             if ( is_bool( $style->extra['rtl'] ) )
    125                 $rtl_href = str_replace( '.css', '-rtl.css', $src );
    126             else
    127                 $rtl_href = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $style->extra['rtl'] );
    128 
    129             $files[] = array($rtl_href, $ver);
    130              $man_ver .= $ver;
    131         }
    132     }
    133 
    134     $images = array(
     16function &get_manifest() {
     17    global $mce_ver;
     18
     19    $files = array(
    13520        array('images/align-center.png'),
    13621        array('images/align-left.png'),
     
    20489    );
    20590
    206     $files = array_merge($files, $images);
    207 
    20891    if ( @is_file('../wp-includes/js/tinymce/tiny_mce.js') ) :
    20992    $mce = array(
    210         array('../wp-includes/js/tinymce/wp-tinymce.php', $mce_ver, true),
     93        array('../wp-includes/js/tinymce/wp-tinymce.php', 'c=1&' . $mce_ver, true),
     94        array('../wp-includes/js/tinymce/wp-tinymce.php', 'c=0&' . $mce_ver, true),
     95
    21196        array('../wp-includes/js/tinymce/tiny_mce.js', $mce_ver, true),
    21297        array('../wp-includes/js/tinymce/langs/wp-langs-en.js', $mce_ver, true),
  • trunk/wp-admin/includes/post.php

    r11383 r11388  
    11521152 * Adds the TinyMCE editor used on the Write and Edit screens.
    11531153 *
    1154  * Has option to output a trimmed down version used in Press This.
    1155  *
    11561154 * @package WordPress
    11571155 * @since 2.7
     1156 *
     1157 * TinyMCE is loaded separately from other Javascript by using wp-tinymce.php. It outputs concatenated
     1158 * and optionaly pre-compressed version of the core and all default plugins. Additional plugins are loaded
     1159 * directly by TinyMCE using non-blocking method. Custom plugins can be refreshed by adding a query string
     1160 * to the URL when queueing them with the mce_external_plugins filter.
     1161 *
     1162 * @param bool $teeny optional Output a trimmed down version used in Press This.
    11581163 */
    11591164function wp_tiny_mce( $teeny = false ) {
    1160     global $concatenate_scripts, $compress_scripts;
     1165    global $concatenate_scripts, $compress_scripts, $tinymce_version;
    11611166
    11621167    if ( ! user_can_richedit() )
     
    13351340    $language = $initArray['language'];
    13361341    $zip = $compress_scripts ? 1 : 0;
    1337     $ver = apply_filters('tiny_mce_version', '323');
     1342   
     1343    /**
     1344     * Deprecated
     1345     * 
     1346     * The tiny_mce_version filter is not needed since external plugins are loaded directly by TinyMCE.
     1347     * These plugins can be refreshed by appending query string to the URL passed to mce_external_plugins filter.
     1348     * If the plugin has a popup dialog, a query string can be added to the button action that opens it (in the plugin's code). 
     1349     */
     1350    $version = apply_filters('tiny_mce_version', '');
     1351    $version = 'ver=' . $tinymce_version . $version;
    13381352
    13391353    if ( 'en' != $language )
     
    13511365    base : "<?php echo $baseurl; ?>",
    13521366    suffix : "",
    1353     query : "ver=<?php echo $ver; ?>",
     1367    query : "<?php echo $version; ?>",
    13541368    mceInit : {<?php echo $mce_options; ?>},
    13551369    load_ext : function(url,lang){var sl=tinymce.ScriptLoader;sl.markDone(url+'/langs/'+lang+'.js');sl.markDone(url+'/langs/'+lang+'_dlg.js');}
     
    13601374<?php
    13611375    if ( $concatenate_scripts )
    1362         echo "<script type='text/javascript' src='$baseurl/wp-tinymce.php?c=$zip&amp;ver=$ver'></script>\n";
     1376        echo "<script type='text/javascript' src='$baseurl/wp-tinymce.php?c=$zip&amp;$version'></script>\n";
    13631377    else
    1364         echo "<script type='text/javascript' src='$baseurl/tiny_mce.js?ver=$ver'></script>\n";
     1378        echo "<script type='text/javascript' src='$baseurl/tiny_mce.js?$version'></script>\n";
    13651379
    13661380    if ( 'en' != $language && isset($lang) )
    13671381        echo "<script type='text/javascript'>\n$lang\n</script>\n";
    13681382    else
    1369         echo "<script type='text/javascript' src='$baseurl/langs/wp-langs-en.js?ver=$ver'></script>\n";
     1383        echo "<script type='text/javascript' src='$baseurl/langs/wp-langs-en.js?$version'></script>\n";
    13701384?>
    13711385
  • trunk/wp-includes/script-loader.php

    r11378 r11388  
    99 *
    1010 * Several constants are used to manage the loading, concatenating and compression of scripts and CSS:
    11  * define('SCRIPT_DEBUG', true); loads the develppment (non-minified) versions of all scripts
    12  * define('CONCATENATE_SCRIPTS', false); disables both compression and cancatenating,
     11 * define('SCRIPT_DEBUG', true); loads the development (non-minified) versions of all scripts and disables compression and concatenation
     12 * define('CONCATENATE_SCRIPTS', false); disables compression and concatenation,
    1313 * define('COMPRESS_SCRIPTS', false); disables compression of scripts,
    1414 * define('COMPRESS_CSS', false); disables compression of CSS,
     
    8787    $scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' );
    8888
    89     // Modify this version when tinyMCE plugins are changed.
    90     function mce_version() {
    91         return '20090503';
    92     }
    93     add_filter( 'tiny_mce_version', 'mce_version' );
    94 
    95     $scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", false, mce_version() );
     89    $scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", false, '20090503' );
    9690
    9791    $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');
  • trunk/wp-includes/version.php

    r11383 r11388  
    1818$wp_db_version = 10851;
    1919
    20 ?>
     20/**
     21 * Holds the TinyMCE version
     22 *
     23 * @global string $tinymce_version
     24 */
     25$tinymce_version = '323';
     26
     27/**
     28 * Holds the cache manifest version
     29 *
     30 * @global string $manifest_version
     31 */
     32$manifest_version = '20090517';
Note: See TracChangeset for help on using the changeset viewer.