Make WordPress Core

Ticket #15782: garyc40-15782.patch

File garyc40-15782.patch, 9.2 KB (added by garyc40, 14 years ago)

there's a patch for that

  • wp-admin/admin-header.php

    diff --git wp-admin/admin-header.php wp-admin/admin-header.php
    index 916b219..6ac2a75 100644
    if ( is_multisite() ) 
    4747wp_enqueue_script('utils');
    4848
    4949$admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
    50 ?>
    51 <script type="text/javascript">
    52 //<![CDATA[
    53 addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
    54 var userSettings = {
    55                 'url': '<?php echo SITECOOKIEPATH; ?>',
    56                 'uid': '<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>',
    57                 'time':'<?php echo time() ?>'
    58         },
    59         ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>',
    60         pagenow = '<?php echo $current_screen->id; ?>',
    61         typenow = '<?php if ( isset($current_screen->post_type) ) echo $current_screen->post_type; ?>',
    62         adminpage = '<?php echo $admin_body_class; ?>',
    63         thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
    64         decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
    65         isRtl = <?php echo (int) is_rtl(); ?>;
    66 //]]>
    67 </script>
    68 <?php
    6950
    7051if ( in_array( $pagenow, array('post.php', 'post-new.php') ) ) {
    7152        add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
  • wp-admin/includes/media.php

    diff --git wp-admin/includes/media.php wp-admin/includes/media.php
    index 33e7867..326b8d8 100644
    if ( ( is_array( $content_func ) && ! empty( $content_func[1] ) && 0 === strpos( 
    315315        || ( ! is_array( $content_func ) && 0 === strpos( $content_func, 'media' ) ) )
    316316        wp_enqueue_style( 'media' );
    317317wp_enqueue_style( 'ie' );
    318 ?>
    319 <script type="text/javascript">
    320 //<![CDATA[
    321 addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
    322 var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?>','uid':'<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>','time':'<?php echo time(); ?>'};
    323 var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup',
    324 isRtl = <?php echo (int) is_rtl(); ?>;
    325 //]]>
    326 </script>
    327 <?php
     318
    328319do_action('admin_enqueue_scripts', 'media-upload-popup');
    329320do_action('admin_print_styles-media-upload-popup');
    330321do_action('admin_print_styles');
  • wp-admin/includes/template.php

    diff --git wp-admin/includes/template.php wp-admin/includes/template.php
    index b221e78..4b89c98 100644
    wp_enqueue_style( 'global' ); 
    15491549if ( ! $limit_styles )
    15501550        wp_enqueue_style( 'wp-admin' );
    15511551wp_enqueue_style( 'colors' );
    1552 ?>
    1553 <script type="text/javascript">
    1554 //<![CDATA[
    1555 addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
    1556 function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();}
    1557 var userSettings = {
    1558                 'url': '<?php echo SITECOOKIEPATH; ?>',
    1559                 'uid': '<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>',
    1560                 'time':'<?php echo time() ?>'
    1561         },
    1562         ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>',
    1563         pagenow = '<?php echo $current_screen->id; ?>',
    1564         typenow = '<?php if ( isset($current_screen->post_type) ) echo $current_screen->post_type; ?>',
    1565         adminpage = '<?php echo $admin_body_class; ?>',
    1566         thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
    1567         decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
    1568         isRtl = <?php echo (int) is_rtl(); ?>;
    1569 //]]>
    1570 </script>
    1571 <?php
    15721552do_action('admin_enqueue_scripts', $hook_suffix);
    15731553do_action("admin_print_styles-$hook_suffix");
    15741554do_action('admin_print_styles');
  • wp-admin/press-this.php

    diff --git wp-admin/press-this.php wp-admin/press-this.php
    index 1d826a8..988ed67 100644
    die; 
    316316        wp_enqueue_script( 'post' );
    317317        wp_enqueue_script( 'editor' );
    318318?>
    319 <script type="text/javascript">
    320 //<![CDATA[
    321 addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
    322 var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?>','uid':'<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>','time':'<?php echo time() ?>'};
    323 var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = 'press-this', isRtl = <?php echo (int) is_rtl(); ?>;
    324 var photostorage = false;
    325 //]]>
    326 </script>
    327 
     319<?php admin_script_init( '', array( 'pagenow' => 'press-this', 'photostorage' => false ) ) ?>
    328320<?php
    329321        do_action('admin_print_styles');
    330322        do_action('admin_print_scripts');
  • wp-includes/functions.wp-scripts.php

    diff --git wp-includes/functions.wp-scripts.php wp-includes/functions.wp-scripts.php
    index af2055d..bf842c8 100644
    function wp_script_is( $handle, $list = 'queue' ) { 
    144144                return true;
    145145
    146146        return $query;
    147 }
     147}
     148 No newline at end of file
  • wp-includes/script-loader.php

    diff --git wp-includes/script-loader.php wp-includes/script-loader.php
    index ddfcaeb..b69ed5c 100644
    function print_admin_styles() { 
    775775        return $wp_styles->done;
    776776}
    777777
     778function admin_addLoadEvent() {
     779        ?>
     780        addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
     781        <?php
     782}
     783
     784function admin_script_globals() {
     785        $current_screen = get_current_screen();
     786        $current_user = wp_get_current_user();
     787        ?>
     788        function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();}
     789        var userSettings = {
     790                        'url': '<?php echo SITECOOKIEPATH; ?>',
     791                        'uid': '<?php echo $current_user->ID; ?>',
     792                        'time':'<?php echo time() ?>'
     793                },
     794                ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>',
     795                pagenow = '<?php echo $current_screen->id; ?>',
     796                typenow = '<?php if ( isset($current_screen->post_type) ) echo $current_screen->post_type; ?>',
     797                adminpage = '<?php echo $admin_body_class; ?>',
     798                thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
     799                decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
     800                isRtl = <?php echo (int) is_rtl(); ?>;
     801        <?php
     802}
     803
     804function admin_script_init( $hook_suffix = '', $set_globals = array() ) {
     805        global $wp_locale;
     806        $current_user = wp_get_current_user();
     807        $current_screen = get_current_screen();
     808        $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
     809        $defaults = array(
     810                'userSettings' => array(
     811                        'url' => SITECOOKIEPATH,
     812                        'uid' => $current_user->ID,
     813                        'time' => time(),
     814                ),
     815                'ajaxurl' => admin_url( 'admin-ajax.php' ),
     816                'adminpage' => $admin_body_class,
     817                'thousandsSeparator' => addslashes( $wp_locale->number_format['thousands_sep'] ),
     818                'decimalPoint' => addslashes( $wp_locale->number_format['decimal_point'] ),
     819                'isRtl' => (int) is_rtl(),
     820        );
     821       
     822        if ( $current_screen ) {
     823                $defaults['pagenow'] = $current_screen->id;
     824                if ( isset( $current_screen->post_type ) ) {
     825                        $defaults['typenow'] = $current_screen->post_type;
     826                }
     827        }
     828       
     829        $globals = wp_parse_args( $set_globals, $defaults );
     830       
     831        ?>
     832        <script type="text/javascript">
     833        //<![CDATA[
     834        <?php admin_addLoadEvent(); ?>
     835        function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();}
     836        <?php
     837                $outputs = array();
     838                echo 'var ';
     839                foreach ( $globals as $name => $value ) {
     840                        $value = json_encode( $value );
     841                       
     842                        $outputs[] = "{$name} = {$value}";
     843                }
     844               
     845                echo implode( ",\n\t", $outputs ) . ";\n";
     846        ?>
     847        //]]>
     848        </script>
     849        <?php
     850}
     851
    778852function script_concat_settings() {
    779853        global $concatenate_scripts, $compress_scripts, $compress_css;
    780854
    add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' ); 
    805879
    806880add_action( 'wp_default_styles', 'wp_default_styles' );
    807881add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 );
     882
     883add_action( 'admin_enqueue_scripts', 'admin_script_init', 1, 1 );
     884 No newline at end of file
  • wp-login.php

    diff --git wp-login.php wp-login.php
    index 0ae7b85..2e85f81 100644
    function wp_shake_js() { 
    146146                return;
    147147?>
    148148<script type="text/javascript">
    149 addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
     149<?php admin_addLoadEvent(); ?>
    150150function s(id,pos){g(id).left=pos+'px';}
    151151function g(id){return document.getElementById(id).style;}
    152152function shake(id,a,d){c=a.shift();s(id,c);if(a.length>0){setTimeout(function(){shake(id,a,d);},d);}else{try{g(id).position='static';wp_attempt_focus();}catch(e){}}}