<?php /** * List Table API: WP_Theme_Install_List_Table class * * @package WordPress * @subpackage Administration * @since 3.1.0 */
/** * Core class used to implement displaying themes to install in a list table. * * @since 3.1.0 * * @see WP_Themes_List_Table */ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
public $features = array();
/** * @return bool */ public function ajax_user_can() { return current_user_can( 'install_themes' ); }
/** * @global array $tabs * @global string $tab * @global int $paged * @global string $type * @global array $theme_field_defaults */ public function prepare_items() { require ABSPATH . 'wp-admin/includes/theme-install.php';
global $tabs, $tab, $paged, $type, $theme_field_defaults;
// These are the tabs which are shown on the page, $tabs = array(); $tabs['dashboard'] = __( 'Search' ); if ( 'search' === $tab ) { $tabs['search'] = __( 'Search Results' ); } $tabs['upload'] = _x( 'Upload', 'noun' ); $tabs['featured'] = _x( 'Featured', 'themes' ); //$tabs['popular'] = _x( 'Popular', 'themes' ); $tabs['new'] = _x( 'Latest', 'themes' ); $tabs['updated'] = _x( 'Recently Updated', 'themes' );
$nonmenu_tabs = array( 'theme-information' ); // Valid actions to perform which do not have a Menu item.
/** This filter is documented in wp-admin/theme-install.php */ $tabs = apply_filters( 'install_themes_tabs', $tabs );
/** * Filters tabs not associated with a menu item on the Install Themes screen. * * @since 2.8.0 * * @param string[] $nonmenu_tabs The tabs that don't have a menu item on * the Install Themes screen. */ $nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs );
// If a non-valid menu tab has been selected, And it's not a non-menu action. if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs, true ) ) ) { $tab = key( $tabs ); }
/** * Filters the install action links for a theme in the Install Themes list table. * * @since 3.4.0 * * @param string[] $actions An array of theme action links. Defaults are * links to Install Now, Preview, and Details. * @param stdClass $theme An object that contains theme data returned by the * WordPress.org API. */ $actions = apply_filters( 'theme_install_actions', $actions, $theme );
/** * Prints the wrapper for the theme installer with a provided theme's data. * Used to make the theme installer work for no-js. * * @param stdClass $theme A WordPress.org Theme API object. */ public function theme_installer_single( $theme ) { ?> <div id="theme-installer" class="wp-full-overlay single-theme"> <div class="wp-full-overlay-sidebar"> <?php $this->install_theme_info( $theme ); ?> </div> <div class="wp-full-overlay-main"> <iframe src="<?php echo esc_url( $theme->preview_url ); ?>"></iframe> </div> </div> <?php }
/** * Prints the info for a theme (to be used in the theme installer modal). * * @global array $themes_allowedtags * * @param stdClass $theme A WordPress.org Theme API object. */ public function install_theme_info( $theme ) { global $themes_allowedtags;
/** * Send required variables to JavaScript land * * @since 3.4.0 * * @global string $tab Current tab within Themes->Install screen * @global string $type Type of search. * * @param array $extra_args Unused. */ public function _js_vars( $extra_args = array() ) { global $tab, $type; parent::_js_vars( compact( 'tab', 'type' ) ); }
/** * Checks to see if the theme is already installed. * * @since 3.4.0 * * @param stdClass $theme A WordPress.org Theme API object. * @return string Theme status. */ private function _get_theme_status( $theme ) { $status = 'install';