<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[16000] trunk:
Remove the ghetto code and use the script loader properly on the login page
.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16000">16000</a></dd>
<dt>Author</dt> <dd>westi</dd>
<dt>Date</dt> <dd>2010-10-27 06:57:10 +0000 (Wed, 27 Oct 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>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 <a href="http://trac.wordpress.org/ticket/5919">#5919</a>, <a href="http://trac.wordpress.org/ticket/15124">#15124</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesdefaultfiltersphp">trunk/wp-includes/default-filters.php</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
<li><a href="#trunkwploginphp">trunk/wp-login.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesdefaultfiltersphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/default-filters.php (15999 => 16000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/default-filters.php        2010-10-27 06:48:01 UTC (rev 15999)
+++ trunk/wp-includes/default-filters.php        2010-10-27 06:57:10 UTC (rev 16000)
</span><span class="lines">@@ -211,6 +211,11 @@
</span><span class="cx"> add_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
</span><span class="cx"> add_action( 'template_redirect', 'wp_shortlink_header', 11, 0 );
</span><span class="cx">
</span><ins>+// 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' );
+
</ins><span class="cx"> // Feed Generator Tags
</span><span class="cx"> foreach ( array( 'rss2_head', 'commentsrss2_head', 'rss_head', 'rdf_header', 'atom_head', 'comments_atom_head', 'opml_head', 'app_head' ) as $action ) {
</span><span class="cx">         add_action( $action, 'the_generator' );
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (15999 => 16000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2010-10-27 06:48:01 UTC (rev 15999)
+++ trunk/wp-includes/script-loader.php        2010-10-27 06:57:10 UTC (rev 16000)
</span><span class="lines">@@ -239,6 +239,22 @@
</span><span class="cx">         $scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), '0.9.1' );
</span><span class="cx">         $scripts->add_data( 'imgareaselect', 'group', 1 );
</span><span class="cx">
</span><ins>+        $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 );        
+        
</ins><span class="cx">         if ( is_admin() ) {
</span><span class="cx">                 $scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ), '20090102' );
</span><span class="cx">                 $scripts->add_data( 'ajaxcat', 'group', 1 );
</span><span class="lines">@@ -262,22 +278,6 @@
</span><span class="cx">                 $scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' );
</span><span class="cx">                 $scripts->add_data( 'admin-custom-fields', 'group', 1 );
</span><span class="cx">
</span><del>-                $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 );
-
</del><span class="cx">                 $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'list-table', 'jquery-ui-resizable', 'quicktags'), '20100818' );
</span><span class="cx">                 $scripts->add_data( 'admin-comments', 'group', 1 );
</span><span class="cx">                 $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
</span></span></pre></div>
<a id="trunkwploginphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-login.php (15999 => 16000)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-login.php        2010-10-27 06:48:01 UTC (rev 15999)
+++ trunk/wp-login.php        2010-10-27 06:57:10 UTC (rev 16000)
</span><span class="lines">@@ -134,7 +134,7 @@
</span><span class="cx">         }
</span><span class="cx"> ?>
</span><span class="cx"> <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>
</span><del>-
</del><ins>+<?php do_action('login_footer'); ?>
</ins><span class="cx"> </body>
</span><span class="cx"> </html>
</span><span class="cx"> <?php
</span><span class="lines">@@ -334,29 +334,6 @@
</span><span class="cx">         return $user_id;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// 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') );
-}
-
</del><span class="cx"> //
</span><span class="cx"> // Main
</span><span class="cx"> //
</span><span class="lines">@@ -468,10 +445,11 @@
</span><span class="cx">                 exit;
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+        wp_enqueue_script('utils');
+        wp_enqueue_script('user-profile');
+
</ins><span class="cx">         login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Enter your new password below.') . '</p>', $errors );
</span><span class="cx">
</span><del>-        load_password_strength_meter();
-
</del><span class="cx"> ?>
</span><span class="cx"> <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">
</span><span class="cx">         <input type="hidden" id="user_login" value="<?php echo esc_attr( $_GET['login'] ); ?>" autocomplete="off" />
</span></span></pre>
</div>
</div>
</body>
</html>