wp/wp-admin/includes/theme-install.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
    55 	$type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
    55 	$type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
    56 	$term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : '';
    56 	$term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : '';
    57 	if ( ! $type_selector )
    57 	if ( ! $type_selector )
    58 		echo '<p class="install-help">' . __( 'Search for themes by keyword.' ) . '</p>';
    58 		echo '<p class="install-help">' . __( 'Search for themes by keyword.' ) . '</p>';
    59 	?>
    59 	?>
    60 <form id="search-themes" method="get" action="">
    60 <form id="search-themes" method="get">
    61 	<input type="hidden" name="tab" value="search" />
    61 	<input type="hidden" name="tab" value="search" />
    62 	<?php if ( $type_selector ) : ?>
    62 	<?php if ( $type_selector ) : ?>
    63 	<label class="screen-reader-text" for="typeselector"><?php _e('Type of search'); ?></label>
    63 	<label class="screen-reader-text" for="typeselector"><?php _e('Type of search'); ?></label>
    64 	<select	name="type" id="typeselector">
    64 	<select	name="type" id="typeselector">
    65 	<option value="term" <?php selected('term', $type) ?>><?php _e('Keyword'); ?></option>
    65 	<option value="term" <?php selected('term', $type) ?>><?php _e('Keyword'); ?></option>
    97 	install_theme_search_form( false );
    97 	install_theme_search_form( false );
    98 ?>
    98 ?>
    99 <h4><?php _e('Feature Filter') ?></h4>
    99 <h4><?php _e('Feature Filter') ?></h4>
   100 <p class="install-help"><?php _e( 'Find a theme based on specific features.' ); ?></p>
   100 <p class="install-help"><?php _e( 'Find a theme based on specific features.' ); ?></p>
   101 
   101 
   102 <form method="get" action="">
   102 <form method="get">
   103 	<input type="hidden" name="tab" value="search" />
   103 	<input type="hidden" name="tab" value="search" />
   104 	<?php
   104 	<?php
   105 	$feature_list = get_theme_feature_list();
   105 	$feature_list = get_theme_feature_list();
   106 	echo '<div class="feature-filter">';
   106 	echo '<div class="feature-filter">';
   107 
   107 
   130 <br class="clear" />
   130 <br class="clear" />
   131 <?php submit_button( __( 'Find Themes' ), 'button', 'search' ); ?>
   131 <?php submit_button( __( 'Find Themes' ), 'button', 'search' ); ?>
   132 </form>
   132 </form>
   133 <?php
   133 <?php
   134 }
   134 }
   135 add_action('install_themes_dashboard', 'install_themes_dashboard');
   135 // add_action('install_themes_dashboard', 'install_themes_dashboard');
   136 
   136 
   137 function install_themes_upload($page = 1) {
   137 function install_themes_upload() {
   138 ?>
   138 ?>
   139 <h4><?php _e('Install a theme in .zip format'); ?></h4>
       
   140 <p class="install-help"><?php _e('If you have a theme in a .zip format, you may install it by uploading it here.'); ?></p>
   139 <p class="install-help"><?php _e('If you have a theme in a .zip format, you may install it by uploading it here.'); ?></p>
   141 <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url('update.php?action=upload-theme'); ?>">
   140 <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url('update.php?action=upload-theme'); ?>">
   142 	<?php wp_nonce_field( 'theme-upload'); ?>
   141 	<?php wp_nonce_field( 'theme-upload'); ?>
   143 	<input type="file" name="themezip" />
   142 	<input type="file" name="themezip" />
   144 	<?php submit_button( __( 'Install Now' ), 'button', 'install-theme-submit', false ); ?>
   143 	<?php submit_button( __( 'Install Now' ), 'button', 'install-theme-submit', false ); ?>
   145 </form>
   144 </form>
   146 	<?php
   145 	<?php
   147 }
   146 }
   148 add_action('install_themes_upload', 'install_themes_upload', 10, 1);
   147 // add_action('install_themes_upload', 'install_themes_upload', 10, 0);
   149 
   148 
   150 /**
   149 /**
   151  * Prints a theme on the Install Themes pages.
   150  * Prints a theme on the Install Themes pages.
   152  *
   151  *
   153  * @deprecated 3.4.0
   152  * @deprecated 3.4.0
   154  */
   153  */
   155 function display_theme( $theme ) {
   154 function display_theme( $theme ) {
   156 	_deprecated_function( __FUNCTION__, '3.4' );
   155 	_deprecated_function( __FUNCTION__, '3.4' );
   157 	global $wp_list_table;
   156 	global $wp_list_table;
       
   157 	if ( ! isset( $wp_list_table ) ) {
       
   158 		$wp_list_table = _get_list_table('WP_Theme_Install_List_Table');
       
   159 	}
       
   160 	$wp_list_table->prepare_items();
   158 	$wp_list_table->single_row( $theme );
   161 	$wp_list_table->single_row( $theme );
   159 }
   162 }
   160 
   163 
   161 /**
   164 /**
   162  * Display theme content based on theme list.
   165  * Display theme content based on theme list.
   164  * @since 2.8.0
   167  * @since 2.8.0
   165  */
   168  */
   166 function display_themes() {
   169 function display_themes() {
   167 	global $wp_list_table;
   170 	global $wp_list_table;
   168 
   171 
       
   172 	if ( ! isset( $wp_list_table ) ) {
       
   173 		$wp_list_table = _get_list_table('WP_Theme_Install_List_Table');
       
   174 	}
       
   175 	$wp_list_table->prepare_items();
   169 	$wp_list_table->display();
   176 	$wp_list_table->display();
   170 }
   177 
   171 add_action('install_themes_search', 'display_themes');
   178 }
   172 add_action('install_themes_featured', 'display_themes');
   179 // add_action('install_themes_search', 'display_themes');
   173 add_action('install_themes_new', 'display_themes');
   180 // add_action('install_themes_featured', 'display_themes');
   174 add_action('install_themes_updated', 'display_themes');
   181 // add_action('install_themes_new', 'display_themes');
       
   182 // add_action('install_themes_updated', 'display_themes');
   175 
   183 
   176 /**
   184 /**
   177  * Display theme information in dialog box form.
   185  * Display theme information in dialog box form.
   178  *
   186  *
   179  * @since 2.8.0
   187  * @since 2.8.0
   180  */
   188  */
   181 function install_theme_information() {
   189 function install_theme_information() {
   182 	global $tab, $themes_allowedtags, $wp_list_table;
   190 	global $wp_list_table;
   183 
   191 
   184 	$theme = themes_api( 'theme_information', array( 'slug' => wp_unslash( $_REQUEST['theme'] ) ) );
   192 	$theme = themes_api( 'theme_information', array( 'slug' => wp_unslash( $_REQUEST['theme'] ) ) );
   185 
   193 
   186 	if ( is_wp_error( $theme ) )
   194 	if ( is_wp_error( $theme ) )
   187 		wp_die( $theme );
   195 		wp_die( $theme );
   188 
   196 
   189 	iframe_header( __('Theme Install') );
   197 	iframe_header( __('Theme Install') );
       
   198 	if ( ! isset( $wp_list_table ) ) {
       
   199 		$wp_list_table = _get_list_table('WP_Theme_Install_List_Table');
       
   200 	}
   190 	$wp_list_table->theme_installer_single( $theme );
   201 	$wp_list_table->theme_installer_single( $theme );
   191 	iframe_footer();
   202 	iframe_footer();
   192 	exit;
   203 	exit;
   193 }
   204 }
   194 add_action('install_themes_pre_theme-information', 'install_theme_information');
   205 add_action('install_themes_pre_theme-information', 'install_theme_information');