WordPress 4.5
[autoinstalls/wordpress.git] / wp-admin / network / themes.php
index 2b77f188fb448002eacd9cf0a92c48a08c6fe271..fbc2aa033c64a726c37b12850f10460d617a56b6 100644 (file)
@@ -53,7 +53,7 @@ if ( $action ) {
                                wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) );
                                exit;
                        }
-                       foreach( (array) $themes as $theme )
+                       foreach ( (array) $themes as $theme )
                                $allowed_themes[ $theme ] = true;
                        update_site_option( 'allowedthemes', $allowed_themes );
                        wp_safe_redirect( add_query_arg( 'enabled', count( $themes ), $referer ) );
@@ -65,7 +65,7 @@ if ( $action ) {
                                wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) );
                                exit;
                        }
-                       foreach( (array) $themes as $theme )
+                       foreach ( (array) $themes as $theme )
                                unset( $allowed_themes[ $theme ] );
                        update_site_option( 'allowedthemes', $allowed_themes );
                        wp_safe_redirect( add_query_arg( 'disabled', count( $themes ), $referer ) );
@@ -86,7 +86,7 @@ if ( $action ) {
                        require_once(ABSPATH . 'wp-admin/admin-header.php');
 
                        echo '<div class="wrap">';
-                       echo '<h2>' . esc_html( $title ) . '</h2>';
+                       echo '<h1>' . esc_html( $title ) . '</h1>';
 
                        $url = self_admin_url('update.php?action=update-selected-themes&amp;themes=' . urlencode( join(',', $themes) ));
                        $url = wp_nonce_url($url, 'bulk-update-themes');
@@ -116,27 +116,9 @@ if ( $action ) {
                                exit;
                        }
 
-                       $files_to_delete = $theme_info = array();
-                       $theme_translations = wp_get_installed_translations( 'themes' );
+                       $theme_info = array();
                        foreach ( $themes as $key => $theme ) {
                                $theme_info[ $theme ] = wp_get_theme( $theme );
-
-                               // Locate all the files in that folder.
-                               $files = list_files( $theme_info[ $theme ]->get_stylesheet_directory() );
-                               if ( $files ) {
-                                       $files_to_delete = array_merge( $files_to_delete, $files );
-                               }
-
-                               // Add translation files.
-                               $theme_slug = $theme_info[ $theme ]->get_stylesheet();
-                               if ( ! empty( $theme_translations[ $theme_slug ] ) ) {
-                                       $translations = $theme_translations[ $theme_slug ];
-
-                                       foreach ( $translations as $translation => $data ) {
-                                               $files_to_delete[] = $theme_slug . '-' . $translation . '.po';
-                                               $files_to_delete[] = $theme_slug . '-' . $translation . '.mo';
-                                       }
-                               }
                        }
 
                        include(ABSPATH . 'wp-admin/update.php');
@@ -150,19 +132,23 @@ if ( $action ) {
                                ?>
                        <div class="wrap">
                                <?php if ( 1 == $themes_to_delete ) : ?>
-                                       <h2><?php _e( 'Delete Theme' ); ?></h2>
+                                       <h1><?php _e( 'Delete Theme' ); ?></h1>
                                        <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This theme may be active on other sites in the network.' ); ?></p></div>
                                        <p><?php _e( 'You are about to remove the following theme:' ); ?></p>
                                <?php else : ?>
-                                       <h2><?php _e( 'Delete Themes' ); ?></h2>
+                                       <h1><?php _e( 'Delete Themes' ); ?></h1>
                                        <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These themes may be active on other sites in the network.' ); ?></p></div>
                                        <p><?php _e( 'You are about to remove the following themes:' ); ?></p>
                                <?php endif; ?>
                                        <ul class="ul-disc">
                                        <?php
                                                foreach ( $theme_info as $theme ) {
-                                                       /* translators: 1: theme name, 2: theme author */
-                                                       echo '<li>', sprintf( __('<strong>%1$s</strong> by <em>%2$s</em>' ), $theme->display('Name'), $theme->display('Author') ), '</li>';
+                                                       echo '<li>' . sprintf(
+                                                               /* translators: 1: theme name, 2: theme author */
+                                                               _x( '%1$s by %2$s', 'theme' ),
+                                                               '<strong>' . $theme->display( 'Name' ) . '</strong>',
+                                                               '<em>' . $theme->display( 'Author' ) . '</em>'
+                                                       ) . '</li>';
                                                }
                                        ?>
                                        </ul>
@@ -182,9 +168,9 @@ if ( $action ) {
                                                wp_nonce_field( 'bulk-themes' );
 
                                                if ( 1 == $themes_to_delete ) {
-                                                       submit_button( __( 'Yes, Delete this theme' ), 'button', 'submit', false );
+                                                       submit_button( __( 'Yes, delete this theme' ), 'button', 'submit', false );
                                                } else {
-                                                       submit_button( __( 'Yes, Delete these themes' ), 'button', 'submit', false );
+                                                       submit_button( __( 'Yes, delete these themes' ), 'button', 'submit', false );
                                                }
                                        ?>
                                </form>
@@ -192,19 +178,8 @@ if ( $action ) {
                                $referer = wp_get_referer();
                                ?>
                                <form method="post" action="<?php echo $referer ? esc_url( $referer ) : ''; ?>" style="display:inline;">
-                                       <?php submit_button( __( 'No, Return me to the theme list' ), 'button', 'submit', false ); ?>
+                                       <?php submit_button( __( 'No, return me to the theme list' ), 'button', 'submit', false ); ?>
                                </form>
-
-                               <p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php _e('Click to view entire list of files which will be deleted'); ?></a></p>
-                               <div id="files-list" style="display:none;">
-                                       <ul class="code">
-                                       <?php
-                                               foreach ( (array) $files_to_delete as $file ) {
-                                                       echo '<li>' . esc_html( str_replace( WP_CONTENT_DIR . '/themes', '', $file ) ) . '</li>';
-                                               }
-                                       ?>
-                                       </ul>
-                               </div>
                        </div>
                                <?php
                                require_once(ABSPATH . 'wp-admin/admin-footer.php');
@@ -251,6 +226,12 @@ get_current_screen()->set_help_sidebar(
        '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
 );
 
+get_current_screen()->set_screen_reader_content( array(
+       'heading_views'      => __( 'Filter themes list' ),
+       'heading_pagination' => __( 'Themes list navigation' ),
+       'heading_list'       => __( 'Themes list' ),
+) );
+
 $title = __('Themes');
 $parent_file = 'themes.php';
 
@@ -261,10 +242,13 @@ require_once(ABSPATH . 'wp-admin/admin-header.php');
 ?>
 
 <div class="wrap">
-<h2><?php echo esc_html( $title ); if ( current_user_can('install_themes') ) { ?> <a href="theme-install.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'theme'); ?></a><?php }
-if ( $s )
-       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $s ) ); ?>
-</h2>
+<h1><?php echo esc_html( $title ); if ( current_user_can('install_themes') ) { ?> <a href="theme-install.php" class="page-title-action"><?php echo esc_html_x('Add New', 'theme'); ?></a><?php }
+if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
+       /* translators: %s: search keywords */
+       printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $s ) );
+}
+?>
+</h1>
 
 <?php
 if ( isset( $_GET['enabled'] ) ) {
@@ -307,7 +291,7 @@ if ( isset( $_GET['enabled'] ) ) {
 $wp_list_table->views();
 
 if ( 'broken' == $status )
-       echo '<p class="clear">' . __('The following themes are installed but incomplete. Themes must have a stylesheet and a template.') . '</p>';
+       echo '<p class="clear">' . __( 'The following themes are installed but incomplete.' ) . '</p>';
 ?>
 
 <form method="post">