136
|
1 |
<?php |
|
2 |
/** |
|
3 |
* Install plugin administration panel. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
|
|
9 |
/** WordPress Administration Bootstrap */ |
|
10 |
require_once('admin.php'); |
|
11 |
|
|
12 |
if ( ! current_user_can('install_plugins') ) |
|
13 |
wp_die(__('You do not have sufficient permissions to install plugins on this blog.')); |
|
14 |
|
|
15 |
include(ABSPATH . 'wp-admin/includes/plugin-install.php'); |
|
16 |
|
|
17 |
$title = __('Install Plugins'); |
|
18 |
$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; |
|
45 |
|
|
46 |
wp_enqueue_style( 'plugin-install' ); |
|
47 |
wp_enqueue_script( 'plugin-install' ); |
|
48 |
if ( 'plugin-information' != $tab ) |
|
49 |
add_thickbox(); |
|
50 |
|
|
51 |
$body_id = $tab; |
|
52 |
|
|
53 |
do_action('install_plugins_pre_' . $tab); //Used to override the general interface, Eg, install or plugin information. |
|
54 |
|
|
55 |
include('admin-header.php'); |
|
56 |
?> |
|
57 |
<div class="wrap"> |
|
58 |
<?php screen_icon(); ?> |
|
59 |
<h2><?php echo esc_html( $title ); ?></h2> |
|
60 |
|
|
61 |
<ul class="subsubsub"> |
|
62 |
<?php |
|
63 |
$display_tabs = array(); |
|
64 |
foreach ( (array)$tabs as $action => $text ) { |
|
65 |
$sep = ( end($tabs) != $text ) ? ' | ' : ''; |
|
66 |
$class = ( $action == $tab ) ? ' class="current"' : ''; |
|
67 |
$href = admin_url('plugin-install.php?tab=' . $action); |
|
68 |
echo "\t\t<li><a href='$href'$class>$text</a>$sep</li>\n"; |
|
69 |
} |
|
70 |
?> |
|
71 |
</ul> |
|
72 |
<br class="clear" /> |
|
73 |
<?php do_action('install_plugins_' . $tab, $paged); ?> |
|
74 |
</div> |
|
75 |
<?php |
|
76 |
include('admin-footer.php'); |