Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r17322 r15135  
    66 * @subpackage Administration
    77 */
    8 // TODO route this pages via a specific iframe handler instead of the do_action below
    9 if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) )
    10     define( 'IFRAME_REQUEST', true );
    118
    129/** WordPress Administration Bootstrap */
     
    1613    wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
    1714
    18 if ( is_multisite() && ! is_network_admin() ) {
    19     wp_redirect( network_admin_url( 'plugin-install.php' ) );
    20     exit();
    21 }
    22 
    23 $wp_list_table = _get_list_table('WP_Plugin_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/plugin-install.php');
    3116
    3217$title = __('Install Plugins');
    3318$parent_file = 'plugins.php';
     19
     20wp_reset_vars( array('tab', 'paged') );
     21
     22//These are the tabs which are shown on the page,
     23$tabs = array();
     24$tabs['dashboard'] = __('Search');
     25if ( 'search' == $tab )
     26    $tabs['search'] = __('Search Results');
     27$tabs['upload'] = __('Upload');
     28$tabs['featured'] = _x('Featured','Plugin Installer');
     29$tabs['popular']  = _x('Popular','Plugin Installer');
     30$tabs['new']      = _x('Newest','Plugin Installer');
     31$tabs['updated']  = _x('Recently Updated','Plugin Installer');
     32
     33$nonmenu_tabs = array('plugin-information'); //Valid actions to perform which do not have a Menu item.
     34
     35$tabs = apply_filters('install_plugins_tabs', $tabs );
     36$nonmenu_tabs = apply_filters('install_plugins_nonmenu_tabs', $nonmenu_tabs);
     37
     38//If a non-valid menu tab has been selected, And its not a non-menu action.
     39if ( empty($tab) || ( ! isset($tabs[ $tab ]) && ! in_array($tab, (array)$nonmenu_tabs) ) ) {
     40    $tab_actions = array_keys($tabs);
     41    $tab = $tab_actions[0];
     42}
     43if ( empty($paged) )
     44    $paged = 1;
    3445
    3546wp_enqueue_style( 'plugin-install' );
     
    5263);
    5364
    54 include(ABSPATH . 'wp-admin/admin-header.php');
     65include('./admin-header.php');
    5566?>
    5667<div class="wrap">
     
    5869<h2><?php echo esc_html( $title ); ?></h2>
    5970
    60 <?php $wp_list_table->views(); ?>
    61 
    62 <br class="clear" />
    63 <?php do_action('install_plugins_' . $tab, $paged); ?>
     71    <ul class="subsubsub">
     72<?php
     73$display_tabs = array();
     74foreach ( (array)$tabs as $action => $text ) {
     75    $sep = ( end($tabs) != $text ) ? ' | ' : '';
     76    $class = ( $action == $tab ) ? ' class="current"' : '';
     77    $href = admin_url('plugin-install.php?tab=' . $action);
     78    echo "\t\t<li><a href='$href'$class>$text</a>$sep</li>\n";
     79}
     80?>
     81    </ul>
     82    <br class="clear" />
     83    <?php do_action('install_plugins_' . $tab, $paged); ?>
    6484</div>
    6585<?php
    66 include(ABSPATH . 'wp-admin/admin-footer.php');
    67 
     86include('./admin-footer.php');
Note: See TracChangeset for help on using the changeset viewer.