WordPress.org

Make WordPress Core

Ticket #26600: 26600.9.patch

File 26600.9.patch, 10.8 KB (added by afercia, 6 years ago)
  • src/wp-admin/css/themes.css

     
    11411141        font-size: 18px;
    11421142        font-style: normal;
    11431143        margin: 0;
    1144         padding: 100px 0 0;
     1144        padding: 0;
    11451145        text-align: center;
    11461146        display: none;
    11471147}
  • src/wp-admin/js/theme.js

     
    7979
    8080                // Render and append
    8181                this.view.render();
    82                 this.$el.find( '.themes' ).remove();
    83                 this.$el.append( this.view.el ).addClass( 'rendered' );
     82                this.$el.empty().append( this.view.el ).addClass( 'rendered' );
    8483                this.$el.append( '<br class="clear"/>' );
    8584        },
    8685
     
    157156                // Useful for resetting the views when you clean the input
    158157                if ( this.terms === '' ) {
    159158                        this.reset( themes.data.themes );
     159                        $( 'body' ).removeClass( 'no-results' );
    160160                }
    161161
    162162                // Trigger an 'update' event
     
    831831        // The theme count element
    832832        count: $( '.wp-core-ui .theme-count' ),
    833833
     834        // The live themes count
     835        liveThemeCount: 0,
     836
    834837        initialize: function( options ) {
    835838                var self = this;
    836839
     
    854857                this.listenTo( self.collection, 'query:success', function( count ) {
    855858                        if ( _.isNumber( count ) ) {
    856859                                self.count.text( count );
     860                                self.announceSearchResults( count );
    857861                        } else {
    858862                                self.count.text( self.collection.length );
     863                                self.announceSearchResults( self.collection.length );
    859864                        }
    860865                });
    861866
     
    926931                }
    927932
    928933                // Display a live theme count for the collection
    929                 this.count.text( this.collection.count ? this.collection.count : this.collection.length );
     934                this.liveThemeCount = this.collection.count ? this.collection.count : this.collection.length;
     935                this.count.text( this.liveThemeCount );
     936
     937                this.announceSearchResults( this.liveThemeCount );
    930938        },
    931939
    932940        // Iterates through each instance of the collection
     
    10781086                        self.theme.trigger( 'theme:expand', previousModel.cid );
    10791087
    10801088                }
     1089        },
     1090
     1091        // Dispatch audible search results feedback message
     1092        announceSearchResults: function( count ) {
     1093                if ( 0 === count ) {
     1094                        wp.a11y.speak( l10n.noThemesFound );
     1095                } else {
     1096                        wp.a11y.speak( l10n.themesFound.replace( '%d', count ) );
     1097                }
    10811098        }
    10821099});
    10831100
     
    10911108
    10921109        attributes: {
    10931110                placeholder: l10n.searchPlaceholder,
    1094                 type: 'search'
     1111                type: 'search',
     1112                'aria-describedby': 'live-search-desc'
    10951113        },
    10961114
    10971115        events: {
    1098                 'input':  'search',
    1099                 'keyup':  'search',
    1100                 'change': 'search',
    1101                 'search': 'search',
    1102                 'blur':   'pushState'
     1116                'input': 'search',
     1117                'keyup': 'search',
     1118                'blur': 'pushState'
    11031119        },
    11041120
    11051121        initialize: function( options ) {
     
    11121128
    11131129        },
    11141130
    1115         // Runs a search on the theme collection.
    11161131        search: function( event ) {
    1117                 var options = {};
    1118 
    11191132                // Clear on escape.
    11201133                if ( event.type === 'keyup' && event.which === 27 ) {
    11211134                        event.target.value = '';
    11221135                }
    11231136
    1124                 // Lose input focus when pressing enter
    1125                 if ( event.which === 13 ) {
    1126                         this.$el.trigger( 'blur' );
    1127                 }
     1137                /**
     1138                 * Since doSearch is debounced, it will only run when user input comes to a rest
     1139                 */
     1140                this.doSearch( event );
     1141        },
    11281142
     1143        // Runs a search on the theme collection.
     1144        doSearch: _.debounce( function( event ) {
     1145                var options = {};
     1146
    11291147                this.collection.doSearch( event.target.value );
    11301148
    11311149                // if search is initiated and key is not return
     
    11411159                } else {
    11421160                        themes.router.navigate( themes.router.baseUrl( '' ) );
    11431161                }
    1144         },
     1162        }, 500 ),
    11451163
    11461164        pushState: function( event ) {
    11471165                var url = themes.router.baseUrl( '' );
     
    12521270themes.view.InstallerSearch =  themes.view.Search.extend({
    12531271
    12541272        events: {
     1273                'input': 'search',
    12551274                'keyup': 'search'
    12561275        },
    12571276
     
    13051324
    13061325                // Set route
    13071326                themes.router.navigate( themes.router.baseUrl( themes.router.searchPath + value ), { replace: true } );
    1308         }, 300 )
     1327        }, 500 )
    13091328});
    13101329
    13111330themes.view.Installer = themes.view.Appearance.extend({
  • src/wp-admin/theme-install.php

     
    4444        ),
    4545        'l10n' => array(
    4646                'addNew' => __( 'Add New Theme' ),
    47                 'search'  => __( 'Search Themes' ),
     47                'search' => __( 'Search Themes' ),
    4848                'searchPlaceholder' => __( 'Search themes...' ), // placeholder (no ellipsis)
    4949                'upload' => __( 'Upload Theme' ),
    5050                'back'   => __( 'Back' ),
    51                 'error'  => __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' )
     51                'error'  => __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ),
     52                'themesFound'   => __( 'Number of Themes found: %d' ),
     53                'noThemesFound' => __( 'No themes found. Try a different search.' ),
    5254        ),
    5355        'installedThemes' => array_keys( $installed_themes ),
    5456) );
     
    7072
    7173$help_overview =
    7274        '<p>' . sprintf(__('You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.'), 'https://wordpress.org/themes/') . '</p>' .
    73         '<p>' . __('You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter. Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.') . '</p>' .
     75        '<p>' . __( 'You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span> ' . __( 'Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.' ) . '</p>' .
    7476        '<p>' . __('You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme&#8217;s folder via FTP into your <code>/wp-content/themes</code> directory.') . '</p>';
    7577
    7678get_current_screen()->add_help_tab( array(
     
    166168                        </div>
    167169                </div>
    168170        </div>
    169         <div class="theme-browser content-filterable" aria-live="polite">
    170                 <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
    171         </div>
     171        <div class="theme-browser content-filterable"></div>
    172172        <div class="theme-install-overlay wp-full-overlay expanded"></div>
     173
     174        <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
    173175        <span class="spinner"></span>
    174176
    175177        <br class="clear" />
  • src/wp-admin/themes.php

     
    4747                '<ul><li>' . __( 'Hover or tap to see Activate and Live Preview buttons' ) . '</li>' .
    4848                '<li>' . __( 'Click on the theme to see the theme name, version, author, description, tags, and the Delete link' ) . '</li>' .
    4949                '<li>' . __( 'Click Customize for the current theme or Live Preview for any other theme to see a live preview' ) . '</li></ul>' .
    50                 '<p>' . __( 'The current theme is displayed highlighted as the first theme.' ) . '</p>';
     50                '<p>' . __( 'The current theme is displayed highlighted as the first theme.' ) . '</p>' .
     51                '<p>' . __( 'The search for installed themes will search for terms in their name, description, author, or tag.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>';
    5152
    5253        get_current_screen()->add_help_tab( array(
    5354                'id'      => 'overview',
     
    107108                'adminUrl'      => parse_url( admin_url(), PHP_URL_PATH ),
    108109        ),
    109110        'l10n' => array(
    110                 'addNew' => __( 'Add New Theme' ),
    111                 'search'  => __( 'Search Installed Themes' ),
     111                'addNew'            => __( 'Add New Theme' ),
     112                'search'            => __( 'Search Installed Themes' ),
    112113                'searchPlaceholder' => __( 'Search installed themes...' ), // placeholder (no ellipsis)
     114                'themesFound'       => __( 'Number of Themes found: %d' ),
     115                'noThemesFound'     => __( 'No themes found. Try a different search.' ),
    113116        ),
    114117) );
    115118
     
    198201
    199202?>
    200203
    201 <div class="theme-browser" aria-live="polite">
     204<div class="theme-browser">
    202205        <div class="themes">
    203206
    204207<?php
     
    255258<?php endforeach; ?>
    256259        <br class="clear" />
    257260        </div>
    258         <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
    259261</div>
    260262<div class="theme-overlay"></div>
    261263
     264<p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
     265
    262266<?php
    263267// List broken themes, if any.
    264268if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) {
  • src/wp-admin/update.php

     
    201201                if ( ! current_user_can('install_themes') )
    202202                        wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
    203203
    204                 include_once( ABSPATH . 'wp-admin/includes/theme-install.php' ); //for themes_api..
     204                include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); //for themes_api..
    205205
    206206                check_admin_referer( 'install-theme_' . $theme );
    207207                $api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth.
  • src/wp-includes/script-loader.php

     
    499499
    500500                $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 );
    501501
    502                 $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone' ), false, 1 );
     502                $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y' ), false, 1 );
    503503
    504504                $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), false, 1 );
    505505                did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(