Install: Only enqueue scripts when necessary.

Props flixos90 for initial patch.
Fixes #34700.
Built from https://develop.svn.wordpress.org/trunk@36176


git-svn-id: http://core.svn.wordpress.org/trunk@36143 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2016-01-05 16:42:29 +00:00
parent 0929025aea
commit c9d7fb9b28
2 changed files with 16 additions and 7 deletions

View File

@ -261,10 +261,12 @@ if ( ! empty( $_REQUEST['language'] ) ) {
$language = $GLOBALS['wp_local_package'];
}
$scripts_to_print = array( 'jquery' );
switch($step) {
case 0: // Step 0
if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {
$scripts_to_print[] = 'language-chooser';
display_header( 'language-chooser' );
echo '<form id="setup" method="post" action="?step=1">';
wp_install_language_form( $languages );
@ -283,6 +285,8 @@ switch($step) {
}
}
$scripts_to_print[] = 'user-profile';
display_header();
?>
<h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1>
@ -305,6 +309,8 @@ switch($step) {
if ( ! empty( $wpdb->error ) )
wp_die( $wpdb->error->get_error_message() );
$scripts_to_print[] = 'user-profile';
display_header();
// Fill in the data we gathered
$weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : '';
@ -368,12 +374,15 @@ switch($step) {
}
break;
}
if ( !wp_is_mobile() ) {
?>
if ( ! wp_is_mobile() ) {
?>
<script type="text/javascript">var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script>
<?php } ?>
<?php wp_print_scripts( 'user-profile' ); ?>
<?php wp_print_scripts( 'language-chooser' ); ?>
<?php
}
wp_print_scripts( $scripts_to_print );
?>
<script type="text/javascript">
jQuery( function( $ ) {
$( '.hide-if-no-js' ).removeClass( 'hide-if-no-js' );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-alpha-36175';
$wp_version = '4.5-alpha-36176';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.