Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r15135 r17322  
    66 * @subpackage Administration
    77 */
     8// TODO route this pages via a specific iframe handler instead of the do_action below
     9if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) )
     10    define( 'IFRAME_REQUEST', true );
    811
    912/** WordPress Administration Bootstrap */
     
    1316    wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
    1417
    15 include(ABSPATH . 'wp-admin/includes/plugin-install.php');
     18if ( 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' );
     27if ( $pagenum > $total_pages && $total_pages > 0 ) {
     28    wp_redirect( add_query_arg( 'paged', $total_pages ) );
     29    exit;
     30}
    1631
    1732$title = __('Install Plugins');
    1833$parent_file = 'plugins.php';
    19 
    20 wp_reset_vars( array('tab', 'paged') );
    21 
    22 //These are the tabs which are shown on the page,
    23 $tabs = array();
    24 $tabs['dashboard'] = __('Search');
    25 if ( '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.
    39 if ( empty($tab) || ( ! isset($tabs[ $tab ]) && ! in_array($tab, (array)$nonmenu_tabs) ) ) {
    40     $tab_actions = array_keys($tabs);
    41     $tab = $tab_actions[0];
    42 }
    43 if ( empty($paged) )
    44     $paged = 1;
    4534
    4635wp_enqueue_style( 'plugin-install' );
     
    6352);
    6453
    65 include('./admin-header.php');
     54include(ABSPATH . 'wp-admin/admin-header.php');
    6655?>
    6756<div class="wrap">
     
    6958<h2><?php echo esc_html( $title ); ?></h2>
    7059
    71     <ul class="subsubsub">
    72 <?php
    73 $display_tabs = array();
    74 foreach ( (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); ?>
     60<?php $wp_list_table->views(); ?>
     61
     62<br class="clear" />
     63<?php do_action('install_plugins_' . $tab, $paged); ?>
    8464</div>
    8565<?php
    86 include('./admin-footer.php');
     66include(ABSPATH . 'wp-admin/admin-footer.php');
     67
Note: See TracChangeset for help on using the changeset viewer.