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. git-svn-id: http://svn.automattic.com/wordpress/trunk@16000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b23df1e46b
commit
afc867fe64
|
@ -211,6 +211,11 @@ add_action( 'wp_footer', 'wp_print_footer_scripts' );
|
|||
add_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
|
||||
add_action( 'template_redirect', 'wp_shortlink_header', 11, 0 );
|
||||
|
||||
// Login actions
|
||||
add_action( 'login_head', 'wp_enqueue_scripts', 1 );
|
||||
add_action( 'login_head', 'wp_print_head_scripts', 9 );
|
||||
add_action( 'login_footer', 'wp_print_footer_scripts' );
|
||||
|
||||
// Feed Generator Tags
|
||||
foreach ( array( 'rss2_head', 'commentsrss2_head', 'rss_head', 'rdf_header', 'atom_head', 'comments_atom_head', 'opml_head', 'app_head' ) as $action ) {
|
||||
add_action( $action, 'the_generator' );
|
||||
|
|
|
@ -239,6 +239,22 @@ function wp_default_scripts( &$scripts ) {
|
|||
$scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), '0.9.1' );
|
||||
$scripts->add_data( 'imgareaselect', 'group', 1 );
|
||||
|
||||
$scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20101027' );
|
||||
$scripts->add_data( 'password-strength-meter', 'group', 1 );
|
||||
$scripts->localize( 'password-strength-meter', 'pwsL10n', array(
|
||||
'empty' => __('Strength indicator'),
|
||||
'short' => __('Very weak'),
|
||||
'bad' => __('Weak'),
|
||||
/* translators: password strength */
|
||||
'good' => _x('Medium', 'password strength'),
|
||||
'strong' => __('Strong'),
|
||||
'mismatch' => __('Mismatch'),
|
||||
'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};'
|
||||
) );
|
||||
|
||||
$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter' ), '20100925' );
|
||||
$scripts->add_data( 'user-profile', 'group', 1 );
|
||||
|
||||
if ( is_admin() ) {
|
||||
$scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ), '20090102' );
|
||||
$scripts->add_data( 'ajaxcat', 'group', 1 );
|
||||
|
@ -262,22 +278,6 @@ function wp_default_scripts( &$scripts ) {
|
|||
$scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' );
|
||||
$scripts->add_data( 'admin-custom-fields', 'group', 1 );
|
||||
|
||||
$scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20101027' );
|
||||
$scripts->add_data( 'password-strength-meter', 'group', 1 );
|
||||
$scripts->localize( 'password-strength-meter', 'pwsL10n', array(
|
||||
'empty' => __('Strength indicator'),
|
||||
'short' => __('Very weak'),
|
||||
'bad' => __('Weak'),
|
||||
/* translators: password strength */
|
||||
'good' => _x('Medium', 'password strength'),
|
||||
'strong' => __('Strong'),
|
||||
'mismatch' => __('Mismatch'),
|
||||
'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};'
|
||||
) );
|
||||
|
||||
$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter' ), '20100925' );
|
||||
$scripts->add_data( 'user-profile', 'group', 1 );
|
||||
|
||||
$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'list-table', 'jquery-ui-resizable', 'quicktags'), '20100818' );
|
||||
$scripts->add_data( 'admin-comments', 'group', 1 );
|
||||
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
|
||||
|
|
30
wp-login.php
30
wp-login.php
|
@ -134,7 +134,7 @@ if(typeof wpOnload=='function')wpOnload();
|
|||
}
|
||||
?>
|
||||
<p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('← Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
|
||||
|
||||
<?php do_action('login_footer'); ?>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
|
@ -334,29 +334,6 @@ function register_new_user( $user_login, $user_email ) {
|
|||
return $user_id;
|
||||
}
|
||||
|
||||
// TODO: Eliminate duplicated code from wp_default_scripts()
|
||||
function load_password_strength_meter() {
|
||||
if ( !$guessurl = site_url() )
|
||||
$guessurl = wp_guess_url();
|
||||
|
||||
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
|
||||
|
||||
wp_enqueue_script( 'user-profile', $guessurl . "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter' ), '20100925' );
|
||||
wp_enqueue_script( 'password-strength-meter', $guessurl . "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20101027' );
|
||||
wp_localize_script( 'password-strength-meter', 'pwsL10n', array(
|
||||
'empty' => __('Strength indicator'),
|
||||
'short' => __('Very weak'),
|
||||
'bad' => __('Weak'),
|
||||
/* translators: password strength */
|
||||
'good' => _x('Medium', 'password strength'),
|
||||
'strong' => __('Strong'),
|
||||
'mismatch' => __('Mismatch'),
|
||||
'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};'
|
||||
) );
|
||||
|
||||
wp_print_scripts( array('user-profile') );
|
||||
}
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
|
@ -468,9 +445,10 @@ case 'rp' :
|
|||
exit;
|
||||
}
|
||||
|
||||
login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Enter your new password below.') . '</p>', $errors );
|
||||
wp_enqueue_script('utils');
|
||||
wp_enqueue_script('user-profile');
|
||||
|
||||
load_password_strength_meter();
|
||||
login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Enter your new password below.') . '</p>', $errors );
|
||||
|
||||
?>
|
||||
<form name="resetpassform" id="resetpassform" action="<?php echo site_url('wp-login.php?action=resetpass&key=' . urlencode($_GET['key']) . '&login=' . urlencode($_GET['login']), 'login_post') ?>" method="post">
|
||||
|
|
Loading…
Reference in New Issue