Make WordPress Core

Ticket #33528: 33528.diff

File 33528.diff, 2.7 KB (added by DrewAPicture, 10 years ago)
  • src/wp-admin/network/site-new.php

     
    1010/** Load WordPress Administration Bootstrap */
    1111require_once( dirname( __FILE__ ) . '/admin.php' );
    1212
     13/** WordPress Translation Install API */
     14require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
     15
    1316if ( ! is_multisite() )
    1417        wp_die( __( 'Multisite support is not enabled.' ) );
    1518
     
    5154
    5255        $title = $blog['title'];
    5356
     57        $meta = array(
     58                'public' => 1
     59        );
     60
     61        // Handle translation install for the new site.
     62        if ( ! empty( $_POST['WPLANG'] ) && wp_can_install_language_pack() ) {  // @todo: Skip if already installed
     63                $language = wp_download_language_pack( $_POST['WPLANG'] );
     64                if ( $language ) {
     65                        $meta['WPLANG'] = wp_unslash( $language );
     66                }
     67        }
     68
    5469        if ( empty( $domain ) )
    5570                wp_die( __( 'Missing or invalid site address.' ) );
    5671
     
    8398        }
    8499
    85100        $wpdb->hide_errors();
    86         $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), $current_site->id );
     101        $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , $meta, $current_site->id );
    87102        $wpdb->show_errors();
    88103        if ( ! is_wp_error( $id ) ) {
    89104                if ( ! is_super_admin( $user_id ) && !get_user_option( 'primary_blog', $user_id ) ) {
     
    155170                        <th scope="row"><label for="site-title"><?php _e( 'Site Title' ) ?></label></th>
    156171                        <td><input name="blog[title]" type="text" class="regular-text" id="site-title" /></td>
    157172                </tr>
     173                <?php
     174                $languages    = get_available_languages();
     175                $translations = wp_get_available_translations();
     176                if ( ! empty( $languages ) || ! empty( $translations ) ) :
     177                        ?>
     178                        <tr class="form-field form-required">
     179                                <th scope="row"><label for="WPLANG"><?php _e( 'Site Language' ); ?></label></th>
     180                                <td>
     181                                        <?php
     182                                        // Network default.
     183                                        $lang = get_site_option( 'WPLANG' );
     184
     185                                        // Use English if the default isn't available.
     186                                        if ( ! in_array( $lang, $languages ) ) {
     187                                                $lang = '';
     188                                        }
     189
     190                                        wp_dropdown_languages( array(
     191                                                'name'         => 'WPLANG',
     192                                                'id'           => 'WPLANG',
     193                                                'selected'     => $lang,
     194                                                'languages'    => $languages,
     195                                                'translations' => $translations,
     196                                                'show_available_translations' => wp_can_install_language_pack(),
     197                                        ) );
     198                                        ?>
     199                                </td>
     200                        </tr>
     201                <?php endif; // Languages. ?>
    158202                <tr class="form-field form-required">
    159203                        <th scope="row"><label for="admin-email"><?php _e( 'Admin Email' ) ?></label></th>
    160204                        <td><input name="blog[email]" type="email" class="regular-text wp-suggest-user" id="admin-email" data-autocomplete-type="search" data-autocomplete-field="user_email" /></td>