Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/theme-install.php

    r17322 r15160  
    77 */
    88
    9 if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'theme-information' == $_GET['tab'] ) )
    10     define( 'IFRAME_REQUEST', true );
    11 
    129/** WordPress Administration Bootstrap */
    1310require_once('./admin.php');
    1411
    1512if ( ! current_user_can('install_themes') )
    16     wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
     13    wp_die(__('You do not have sufficient permissions to install themes on this site.'));
    1714
    18 if ( is_multisite() && ! is_network_admin() ) {
    19     wp_redirect( network_admin_url( 'theme-install.php' ) );
    20     exit();
    21 }
    22 
    23 $wp_list_table = _get_list_table('WP_Theme_Install_List_Table');
    24 $pagenum = $wp_list_table->get_pagenum();
    25 $wp_list_table->prepare_items();
    26 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
    27 if ( $pagenum > $total_pages && $total_pages > 0 ) {
    28     wp_redirect( add_query_arg( 'paged', $total_pages ) );
    29     exit;
    30 }
     15include(ABSPATH . 'wp-admin/includes/theme-install.php');
    3116
    3217$title = __('Install Themes');
    3318$parent_file = 'themes.php';
    34 if ( !is_network_admin() )
    35     $submenu_file = 'themes.php';
     19$submenu_file = 'themes.php';
    3620
     21wp_reset_vars( array('tab', 'paged') );
    3722wp_enqueue_style( 'theme-install' );
    3823wp_enqueue_script( 'theme-install' );
     
    4025add_thickbox();
    4126wp_enqueue_script( 'theme-preview' );
     27
     28//These are the tabs which are shown on the page,
     29$tabs = array();
     30$tabs['dashboard'] = __('Search');
     31if ( 'search' == $tab )
     32    $tabs['search'] = __('Search Results');
     33$tabs['upload'] = __('Upload');
     34$tabs['featured'] = _x('Featured','Theme Installer');
     35//$tabs['popular']  = _x('Popular','Theme Installer');
     36$tabs['new']      = _x('Newest','Theme Installer');
     37$tabs['updated']  = _x('Recently Updated','Theme Installer');
     38
     39$nonmenu_tabs = array('theme-information'); //Valid actions to perform which do not have a Menu item.
     40
     41$tabs = apply_filters('install_themes_tabs', $tabs );
     42$nonmenu_tabs = apply_filters('install_themes_nonmenu_tabs', $nonmenu_tabs);
     43
     44//If a non-valid menu tab has been selected, And its not a non-menu action.
     45if ( empty($tab) || ( ! isset($tabs[ $tab ]) && ! in_array($tab, (array)$nonmenu_tabs) ) ) {
     46    $tab_actions = array_keys($tabs);
     47    $tab = $tab_actions[0];
     48}
     49if ( empty($paged) )
     50    $paged = 1;
    4251
    4352$body_id = $tab;
     
    5362add_contextual_help($current_screen, $help);
    5463
    55 include(ABSPATH . 'wp-admin/admin-header.php');
     64include('./admin-header.php');
    5665?>
    5766<div class="wrap">
     67<?php screen_icon(); ?>
     68<h2><a href="themes.php" class="nav-tab"><?php echo esc_html_x('Manage Themes', 'theme'); ?></a><a href="theme-install.php" class="nav-tab nav-tab-active"><?php echo esc_html( $title ); ?></a></h2>
     69
     70    <ul class="subsubsub">
    5871<?php
    59 screen_icon();
    60 
    61 if ( is_network_admin() ) : ?>
    62 <h2><?php echo esc_html( $title ); ?></h2>
    63 <?php else : ?>
    64 <h2 class="nav-tab-wrapper"><a href="themes.php" class="nav-tab"><?php echo esc_html_x('Manage Themes', 'theme'); ?></a><a href="theme-install.php" class="nav-tab nav-tab-active"><?php echo esc_html( $title ); ?></a></h2>
    65 
    66 <?php
    67 endif;
    68 
    69 $wp_list_table->views(); ?>
    70 
    71 <br class="clear" />
    72 <?php do_action('install_themes_' . $tab, $paged); ?>
     72$display_tabs = array();
     73foreach ( (array)$tabs as $action => $text ) {
     74    $sep = ( end($tabs) != $text ) ? ' | ' : '';
     75    $class = ( $action == $tab ) ? ' class="current"' : '';
     76    $href = admin_url('theme-install.php?tab='. $action);
     77    echo "\t\t<li><a href='$href'$class>$text</a>$sep</li>\n";
     78}
     79?>
     80    </ul>
     81    <br class="clear" />
     82    <?php do_action('install_themes_' . $tab, $paged); ?>
    7383</div>
    7484<?php
    75 include(ABSPATH . 'wp-admin/admin-footer.php');
    76 
     85include('./admin-footer.php');
Note: See TracChangeset for help on using the changeset viewer.