Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r15160 r17322  
    77 */
    88
     9if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'theme-information' == $_GET['tab'] ) )
     10    define( 'IFRAME_REQUEST', true );
     11
    912/** WordPress Administration Bootstrap */
    1013require_once('./admin.php');
    1114
    1215if ( ! current_user_can('install_themes') )
    13     wp_die(__('You do not have sufficient permissions to install themes on this site.'));
     16    wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
    1417
    15 include(ABSPATH . 'wp-admin/includes/theme-install.php');
     18if ( 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' );
     27if ( $pagenum > $total_pages && $total_pages > 0 ) {
     28    wp_redirect( add_query_arg( 'paged', $total_pages ) );
     29    exit;
     30}
    1631
    1732$title = __('Install Themes');
    1833$parent_file = 'themes.php';
    19 $submenu_file = 'themes.php';
     34if ( !is_network_admin() )
     35    $submenu_file = 'themes.php';
    2036
    21 wp_reset_vars( array('tab', 'paged') );
    2237wp_enqueue_style( 'theme-install' );
    2338wp_enqueue_script( 'theme-install' );
     
    2540add_thickbox();
    2641wp_enqueue_script( 'theme-preview' );
    27 
    28 //These are the tabs which are shown on the page,
    29 $tabs = array();
    30 $tabs['dashboard'] = __('Search');
    31 if ( '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.
    45 if ( empty($tab) || ( ! isset($tabs[ $tab ]) && ! in_array($tab, (array)$nonmenu_tabs) ) ) {
    46     $tab_actions = array_keys($tabs);
    47     $tab = $tab_actions[0];
    48 }
    49 if ( empty($paged) )
    50     $paged = 1;
    5142
    5243$body_id = $tab;
     
    6253add_contextual_help($current_screen, $help);
    6354
    64 include('./admin-header.php');
     55include(ABSPATH . 'wp-admin/admin-header.php');
    6556?>
    6657<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>
     58<?php
     59screen_icon();
    6960
    70     <ul class="subsubsub">
     61if ( 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
    7166<?php
    72 $display_tabs = array();
    73 foreach ( (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); ?>
     67endif;
     68
     69$wp_list_table->views(); ?>
     70
     71<br class="clear" />
     72<?php do_action('install_themes_' . $tab, $paged); ?>
    8373</div>
    8474<?php
    85 include('./admin-footer.php');
     75include(ABSPATH . 'wp-admin/admin-footer.php');
     76
Note: See TracChangeset for help on using the changeset viewer.