WordPress.org

Make WordPress Core

Changeset 16000


Ignore:
Timestamp:
10/27/10 06:57:10 (3 years ago)
Author:
westi
Message:

Remove the ghetto code and use the script loader properly on the login page.
Ensure that we actually have convertEntities available on the login page.
Introduce a login_footer action.
Hook in the script loader to the login_header and login_footer actions.
See #5919, #15124.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/default-filters.php

    r15964 r16000  
    211211add_action( 'wp_head',             'wp_shortlink_wp_head',          10, 0 ); 
    212212add_action( 'template_redirect',   'wp_shortlink_header',           11, 0 ); 
     213 
     214// Login actions 
     215add_action( 'login_head',          'wp_enqueue_scripts',            1     ); 
     216add_action( 'login_head',          'wp_print_head_scripts',         9     ); 
     217add_action( 'login_footer',        'wp_print_footer_scripts'              ); 
    213218 
    214219// Feed Generator Tags 
  • trunk/wp-includes/script-loader.php

    r15998 r16000  
    240240    $scripts->add_data( 'imgareaselect', 'group', 1 ); 
    241241 
     242    $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20101027' ); 
     243    $scripts->add_data( 'password-strength-meter', 'group', 1 ); 
     244    $scripts->localize( 'password-strength-meter', 'pwsL10n', array( 
     245        'empty' => __('Strength indicator'), 
     246        'short' => __('Very weak'), 
     247        'bad' => __('Weak'), 
     248        /* translators: password strength */ 
     249        'good' => _x('Medium', 'password strength'), 
     250        'strong' => __('Strong'), 
     251        'mismatch' => __('Mismatch'), 
     252        'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};' 
     253    ) ); 
     254 
     255    $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter' ), '20100925' ); 
     256    $scripts->add_data( 'user-profile', 'group', 1 );    
     257     
    242258    if ( is_admin() ) { 
    243259        $scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ), '20090102' ); 
     
    262278        $scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' ); 
    263279        $scripts->add_data( 'admin-custom-fields', 'group', 1 ); 
    264  
    265         $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20101027' ); 
    266         $scripts->add_data( 'password-strength-meter', 'group', 1 ); 
    267         $scripts->localize( 'password-strength-meter', 'pwsL10n', array( 
    268             'empty' => __('Strength indicator'), 
    269             'short' => __('Very weak'), 
    270             'bad' => __('Weak'), 
    271             /* translators: password strength */ 
    272             'good' => _x('Medium', 'password strength'), 
    273             'strong' => __('Strong'), 
    274             'mismatch' => __('Mismatch'), 
    275             'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};' 
    276         ) ); 
    277  
    278         $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter' ), '20100925' ); 
    279         $scripts->add_data( 'user-profile', 'group', 1 ); 
    280280 
    281281        $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'list-table', 'jquery-ui-resizable', 'quicktags'), '20100818' ); 
  • trunk/wp-login.php

    r15999 r16000  
    135135?> 
    136136<p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&larr; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p> 
    137  
     137<?php do_action('login_footer'); ?> 
    138138</body> 
    139139</html> 
     
    335335} 
    336336 
    337 // TODO: Eliminate duplicated code from wp_default_scripts() 
    338 function load_password_strength_meter() { 
    339     if ( !$guessurl = site_url() ) 
    340         $guessurl = wp_guess_url(); 
    341  
    342     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : ''; 
    343  
    344     wp_enqueue_script( 'user-profile', $guessurl . "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter' ), '20100925' ); 
    345     wp_enqueue_script( 'password-strength-meter', $guessurl . "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20101027' ); 
    346     wp_localize_script( 'password-strength-meter', 'pwsL10n', array( 
    347         'empty' => __('Strength indicator'), 
    348         'short' => __('Very weak'), 
    349         'bad' => __('Weak'), 
    350         /* translators: password strength */ 
    351         'good' => _x('Medium', 'password strength'), 
    352         'strong' => __('Strong'), 
    353         'mismatch' => __('Mismatch'), 
    354         'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};' 
    355     ) ); 
    356  
    357     wp_print_scripts( array('user-profile') ); 
    358 } 
    359  
    360337// 
    361338// Main 
     
    469446    } 
    470447 
     448    wp_enqueue_script('utils'); 
     449    wp_enqueue_script('user-profile'); 
     450 
    471451    login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Enter your new password below.') . '</p>', $errors ); 
    472  
    473     load_password_strength_meter(); 
    474452 
    475453?> 
Note: See TracChangeset for help on using the changeset viewer.