WordPress.org

Make WordPress Core

Changeset 9184


Ignore:
Timestamp:
10/15/2008 03:56:14 PM (13 years ago)
Author:
ryan
Message:

Localize user-settings JIT to avoid warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/script-loader.php

    r9166 r9184  
    3636 */
    3737function wp_default_scripts( &$scripts ) {
    38     global $current_user;
    39 
    4038    if (!$guessurl = site_url())
    4139        $guessurl = wp_guess_url();
    4240
    43     $userid = isset($current_user) ? $current_user->ID : 0;
    4441    $scripts->base_url = $guessurl;
    4542    $scripts->default_version = get_bloginfo( 'version' );
     
    264261
    265262        $scripts->add( 'user-settings', '/wp-admin/js/user-settings.js', array(), '20080829' );
    266         $scripts->localize( 'user-settings', 'userSettings', array(
    267             'url' => SITECOOKIEPATH,
    268             'uid' => $userid,
    269             'time' => time()
    270         ) );
    271263
    272264        $scripts->add( 'posts', '/wp-admin/js/posts.js', array('columns', 'settings-box'), '20080925' );
     
    379371 */
    380372function wp_just_in_time_script_localization() {
     373    global $current_user;
     374
    381375    wp_localize_script( 'autosave', 'autosaveL10n', array(
    382376        'autosaveInterval' => AUTOSAVE_INTERVAL,
     
    385379        'requestFile' => admin_url('admin-ajax.php'),
    386380        'savingText' => __('Saving Draft…')
     381    ) );
     382
     383    $userid = isset($current_user) ? $current_user->ID : 0;
     384    wp_localize_script( 'user-settings', 'userSettings', array(
     385        'url' => SITECOOKIEPATH,
     386        'uid' => $userid,
     387        'time' => time()
    387388    ) );
    388389}
Note: See TracChangeset for help on using the changeset viewer.