diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-admin/includes/class-wp-themes-list-table.php --- a/wp/wp-admin/includes/class-wp-themes-list-table.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-admin/includes/class-wp-themes-list-table.php Tue Dec 15 13:49:49 2020 +0100 @@ -97,24 +97,41 @@ $blog_id = get_current_blog_id(); if ( is_multisite() ) { if ( current_user_can( 'install_themes' ) && current_user_can( 'manage_network_themes' ) ) { - printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to enable or install more themes.' ), network_admin_url( 'site-themes.php?id=' . $blog_id ), network_admin_url( 'theme-install.php' ) ); + printf( + /* translators: 1: URL to Themes tab on Edit Site screen, 2: URL to Add Themes screen. */ + __( 'You only have one theme enabled for this site right now. Visit the Network Admin to enable or install more themes.' ), + network_admin_url( 'site-themes.php?id=' . $blog_id ), + network_admin_url( 'theme-install.php' ) + ); return; } elseif ( current_user_can( 'manage_network_themes' ) ) { - printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to enable more themes.' ), network_admin_url( 'site-themes.php?id=' . $blog_id ) ); + printf( + /* translators: %s: URL to Themes tab on Edit Site screen. */ + __( 'You only have one theme enabled for this site right now. Visit the Network Admin to enable more themes.' ), + network_admin_url( 'site-themes.php?id=' . $blog_id ) + ); return; } // Else, fallthrough. install_themes doesn't help if you can't enable it. } else { if ( current_user_can( 'install_themes' ) ) { - printf( __( 'You only have one theme installed right now. Live a little! You can choose from over 1,000 free themes in the WordPress Theme Directory at any time: just click on the Install Themes tab above.' ), admin_url( 'theme-install.php' ) ); + printf( + /* translators: %s: URL to Add Themes screen. */ + __( 'You only have one theme installed right now. Live a little! You can choose from over 1,000 free themes in the WordPress Theme Directory at any time: just click on the Install Themes tab above.' ), + admin_url( 'theme-install.php' ) + ); return; } } // Fallthrough. - printf( __( 'Only the current theme is available to you. Contact the %s administrator for information about accessing additional themes.' ), get_site_option( 'site_name' ) ); + printf( + /* translators: %s: Network title. */ + __( 'Only the current theme is available to you. Contact the %s administrator for information about accessing additional themes.' ), + get_site_option( 'site_name' ) + ); } /** @@ -134,6 +151,11 @@ } /** + * Displays the themes table. + * + * Overrides the parent display() method to provide a different container. + * + * @since 3.1.0 */ public function display() { wp_nonce_field( 'fetch-list-' . get_class( $this ), '_ajax_fetch_list_nonce' ); @@ -186,43 +208,61 @@ $activate_link = wp_nonce_url( 'themes.php?action=activate&template=' . urlencode( $template ) . '&stylesheet=' . urlencode( $stylesheet ), 'switch-theme_' . $stylesheet ); $actions = array(); - $actions['activate'] = '' . __( 'Activate' ) . ''; + $actions['activate'] = sprintf( + '%s', + $activate_link, + /* translators: %s: Theme name. */ + esc_attr( sprintf( _x( 'Activate “%s”', 'theme' ), $title ) ), + __( 'Activate' ) + ); if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { - $actions['preview'] .= ' '; + $actions['preview'] .= sprintf( + ' ', + wp_customize_url( $stylesheet ), + __( 'Live Preview' ) + ); } if ( ! is_multisite() && current_user_can( 'delete_themes' ) ) { - $actions['delete'] = '' . __( 'Delete' ) . ''; + $actions['delete'] = sprintf( + '%s', + wp_nonce_url( 'themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet ), + /* translators: %s: Theme name. */ + esc_js( sprintf( __( "You are about to delete this theme '%s'\n 'Cancel' to stop, 'OK' to delete." ), $title ) ), + __( 'Delete' ) + ); } /** This filter is documented in wp-admin/includes/class-wp-ms-themes-list-table.php */ $actions = apply_filters( 'theme_action_links', $actions, $theme, 'all' ); /** This filter is documented in wp-admin/includes/class-wp-ms-themes-list-table.php */ - $actions = apply_filters( "theme_action_links_$stylesheet", $actions, $theme, 'all' ); + $actions = apply_filters( "theme_action_links_{$stylesheet}", $actions, $theme, 'all' ); $delete_action = isset( $actions['delete'] ) ? '
' . __( 'This child theme requires its parent theme, %2$s.' ) . '
', __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ), $theme->parent()->display( 'Name' ) @@ -260,16 +300,16 @@ * @return bool */ public function search_theme( $theme ) { - // Search the features + // Search the features. foreach ( $this->features as $word ) { - if ( ! in_array( $word, $theme->get( 'Tags' ) ) ) { + if ( ! in_array( $word, $theme->get( 'Tags' ), true ) ) { return false; } } - // Match all phrases + // Match all phrases. foreach ( $this->search_terms as $word ) { - if ( in_array( $word, $theme->get( 'Tags' ) ) ) { + if ( in_array( $word, $theme->get( 'Tags' ), true ) ) { continue; }