web/wp-admin/plugin-install.php
author Anthony Ly <anthonyly.com@gmail.com>
Mon, 19 Nov 2012 18:26:13 +0100
changeset 194 32102edaa81b
parent 136 bde1974c263b
child 204 09a1c134465b
permissions -rw-r--r--
MAJ wordpress et ajout de plugin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
136
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     1
<?php
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     2
/**
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     3
 * Install plugin administration panel.
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     4
 *
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     5
 * @package WordPress
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     6
 * @subpackage Administration
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     7
 */
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
     8
// TODO route this pages via a specific iframe handler instead of the do_action below
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
     9
if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) )
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    10
	define( 'IFRAME_REQUEST', true );
136
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    11
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    12
/** WordPress Administration Bootstrap */
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    13
require_once('./admin.php');
136
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    14
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    15
if ( ! current_user_can('install_plugins') )
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    16
	wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
136
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    17
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    18
if ( is_multisite() && ! is_network_admin() ) {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    19
	wp_redirect( network_admin_url( 'plugin-install.php' ) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    20
	exit();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    21
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    22
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    23
$wp_list_table = _get_list_table('WP_Plugin_Install_List_Table');
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    24
$pagenum = $wp_list_table->get_pagenum();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    25
$wp_list_table->prepare_items();
136
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    26
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    27
$title = __('Install Plugins');
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    28
$parent_file = 'plugins.php';
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    29
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    30
wp_enqueue_script( 'plugin-install' );
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    31
if ( 'plugin-information' != $tab )
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    32
	add_thickbox();
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    33
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    34
$body_id = $tab;
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    35
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    36
do_action('install_plugins_pre_' . $tab); //Used to override the general interface, Eg, install or plugin information.
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    37
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    38
get_current_screen()->add_help_tab( array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    39
'id'		=> 'overview',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    40
'title'		=> __('Overview'),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    41
'content'	=>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    42
	'<p>' . sprintf(__('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from the core WordPress application by thousands of developers all over the world. All plugins in the official <a href="%s" target="_blank">WordPress.org Plugin Directory</a> are compatible with the license WordPress uses. You can find new plugins to install by searching or browsing the Directory right here in your own Plugins section.'), 'http://wordpress.org/extend/plugins/') . '</p>'
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    43
) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    44
get_current_screen()->add_help_tab( array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    45
'id'		=> 'adding-plugins',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    46
'title'		=> __('Adding Plugins'),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    47
'content'	=>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    48
	'<p>' . __('If you know what you&#8217;re looking for, Search is your best bet. The Search screen has options to search the WordPress.org Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting a popular tags. Tags in larger type mean more plugins have been labeled with that tag.') . '</p>' .
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    49
	'<p>' . __('If you just want to get an idea of what&#8217;s available, you can browse Featured, Popular, and Newest plugins by using the links in the upper left of the screen. These sections rotate regularly.') . '</p>' .
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    50
	'<p>' . __('If you want to install a plugin that you&#8217;ve downloaded elsewhere, click the Upload in the upper left. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.') . '</p>'
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    51
) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    52
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    53
get_current_screen()->set_help_sidebar(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    54
	'<p><strong>' . __('For more information:') . '</strong></p>' .
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    55
	'<p>' . __('<a href="http://codex.wordpress.org/Plugins_Add_New_Screen" target="_blank">Documentation on Installing Plugins</a>') . '</p>' .
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    56
	'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    57
);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    58
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    59
include(ABSPATH . 'wp-admin/admin-header.php');
136
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    60
?>
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    61
<div class="wrap">
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    62
<?php screen_icon(); ?>
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    63
<h2><?php echo esc_html( $title ); ?></h2>
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    64
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    65
<?php $wp_list_table->views(); ?>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    66
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    67
<br class="clear" />
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    68
<?php do_action('install_plugins_' . $tab, $paged); ?>
136
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    69
</div>
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    70
<?php
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    71
include(ABSPATH . 'wp-admin/admin-footer.php');