2008-08-04 17:17:42 -04:00
< ? php
2008-08-16 03:27:34 -04:00
/**
* Install plugin administration panel .
*
* @ package WordPress
* @ subpackage Administration
*/
2010-11-06 05:41:03 -04:00
// TODO route this pages via a specific iframe handler instead of the do_action below
2010-12-01 13:53:37 -05:00
if ( ! defined ( 'IFRAME_REQUEST' ) && isset ( $_GET [ 'tab' ] ) && ( 'plugin-information' == $_GET [ 'tab' ] ) )
define ( 'IFRAME_REQUEST' , true );
2008-08-16 03:27:34 -04:00
2013-09-19 22:36:09 -04:00
/**
* WordPress Administration Bootstrap .
*/
2013-09-24 20:18:11 -04:00
require_once ( dirname ( __FILE__ ) . '/admin.php' );
2010-12-16 03:43:22 -05:00
2010-12-07 16:06:19 -05:00
if ( ! current_user_can ( 'install_plugins' ) )
wp_die ( __ ( 'You do not have sufficient permissions to install plugins on this site.' ));
2010-12-13 16:21:50 -05:00
2010-12-06 10:41:19 -05:00
if ( is_multisite () && ! is_network_admin () ) {
wp_redirect ( network_admin_url ( 'plugin-install.php' ) );
exit ();
}
2011-01-16 16:47:24 -05:00
$wp_list_table = _get_list_table ( 'WP_Plugin_Install_List_Table' );
2011-01-12 19:03:38 -05:00
$pagenum = $wp_list_table -> get_pagenum ();
2014-10-03 09:08:16 -04:00
if ( ! empty ( $_REQUEST [ '_wp_http_referer' ] ) ) {
$location = remove_query_arg ( '_wp_http_referer' , wp_unslash ( $_SERVER [ 'REQUEST_URI' ] ) );
if ( ! empty ( $_REQUEST [ 'paged' ] ) ) {
$location = add_query_arg ( 'paged' , ( int ) $_REQUEST [ 'paged' ], $location );
}
wp_redirect ( $location );
exit ;
}
2010-08-22 07:22:46 -04:00
$wp_list_table -> prepare_items ();
2008-08-04 17:17:42 -04:00
2014-10-03 09:08:16 -04:00
$total_pages = $wp_list_table -> get_pagination_arg ( 'total_pages' );
if ( $pagenum > $total_pages && $total_pages > 0 ) {
wp_redirect ( add_query_arg ( 'paged' , $total_pages ) );
exit ;
}
2014-08-26 21:32:18 -04:00
$title = __ ( 'Add Plugins' );
2008-08-04 17:17:42 -04:00
$parent_file = 'plugins.php' ;
2009-05-16 15:21:29 -04:00
wp_enqueue_script ( 'plugin-install' );
if ( 'plugin-information' != $tab )
add_thickbox ();
2008-08-04 17:17:42 -04:00
$body_id = $tab ;
2015-02-04 23:19:23 -05:00
wp_enqueue_script ( 'updates' );
2013-09-19 22:36:09 -04:00
/**
* Fires before each tab on the Install Plugins screen is loaded .
*
2014-11-30 06:42:24 -05:00
* The dynamic portion of the action hook , `$tab` , allows for targeting
2013-09-19 22:36:09 -04:00
* individual tabs , for instance 'install_plugins_pre_plugin-information' .
*
* @ since 2.7 . 0
*/
do_action ( " install_plugins_pre_ $tab " );
2008-08-04 17:17:42 -04:00
2011-11-23 19:21:39 -05:00
get_current_screen () -> add_help_tab ( array (
2011-11-30 20:24:39 -05:00
'id' => 'overview' ,
'title' => __ ( 'Overview' ),
2011-11-30 23:51:35 -05:00
'content' =>
2014-03-07 23:14:15 -05:00
'<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.' ), 'https://wordpress.org/plugins/' ) . '</p>'
2011-11-23 19:21:39 -05:00
) );
get_current_screen () -> add_help_tab ( array (
2011-11-30 20:24:39 -05:00
'id' => 'adding-plugins' ,
'title' => __ ( 'Adding Plugins' ),
2011-11-30 23:51:35 -05:00
'content' =>
2012-09-26 20:47:01 -04:00
'<p>' . __ ( 'If you know what you’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 popular tags. Tags in larger type mean more plugins have been labeled with that tag.' ) . '</p>' .
2014-08-27 00:39:17 -04:00
'<p>' . __ ( 'If you just want to get an idea of what’s available, you can browse Featured and Popular plugins by using the links in the upper left of the screen. These sections rotate regularly.' ) . '</p>' .
2012-11-17 10:11:29 -05:00
'<p>' . __ ( 'You can also browse a user’s favorite plugins, by using the Favorites link in the upper left of the screen and entering their WordPress.org username.' ) . '</p>' .
2012-09-26 20:47:01 -04:00
'<p>' . __ ( 'If you want to install a plugin that you’ve downloaded elsewhere, click the Upload link in the upper left. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.' ) . '</p>'
2011-11-23 19:21:39 -05:00
) );
2011-11-02 01:33:53 -04:00
2011-11-02 17:32:16 -04:00
get_current_screen () -> set_help_sidebar (
2011-10-07 00:57:12 -04:00
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
2015-04-12 17:29:32 -04:00
'<p>' . __ ( '<a href="https://codex.wordpress.org/Plugins_Add_New_Screen" target="_blank">Documentation on Installing Plugins</a>' ) . '</p>' .
2014-03-07 23:14:15 -05:00
'<p>' . __ ( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
2010-05-26 16:26:51 -04:00
);
2010-01-15 11:58:36 -05:00
2013-09-19 22:36:09 -04:00
/**
* WordPress Administration Template Header .
*/
2010-10-20 10:16:03 -04:00
include ( ABSPATH . 'wp-admin/admin-header.php' );
2008-08-04 17:17:42 -04:00
?>
< div class = " wrap " >
2014-07-18 00:50:15 -04:00
< h2 >
< ? php
2014-08-26 21:32:18 -04:00
echo esc_html ( $title );
if ( ! empty ( $tabs [ 'upload' ] ) && current_user_can ( 'upload_plugins' ) ) {
if ( $tab === 'upload' ) {
$href = self_admin_url ( 'plugin-install.php' );
$text = _x ( 'Browse' , 'plugins' );
} else {
$href = self_admin_url ( 'plugin-install.php?tab=upload' );
$text = __ ( 'Upload Plugin' );
}
echo ' <a href="' . $href . '" class="upload add-new-h2">' . $text . '</a>' ;
}
2014-07-18 00:50:15 -04:00
?>
</ h2 >
2008-10-17 16:02:03 -04:00
2013-09-19 22:36:09 -04:00
< ? php
2014-08-26 21:32:18 -04:00
if ( $tab !== 'upload' ) {
$wp_list_table -> views ();
echo '<br class="clear" />' ;
}
2013-09-19 22:36:09 -04:00
/**
* Fires after the plugins list table in each tab of the Install Plugins screen .
*
2014-11-30 06:42:24 -05:00
* The dynamic portion of the action hook , `$tab` , allows for targeting
2013-09-19 22:36:09 -04:00
* individual tabs , for instance 'install_plugins_plugin-information' .
*
* @ since 2.7 . 0
*
* @ param int $paged The current page number of the plugins list table .
*/
2014-11-30 06:42:24 -05:00
do_action ( " install_plugins_ $tab " , $paged ); ?>
2008-08-04 17:17:42 -04:00
</ div >
2015-03-17 23:18:27 -04:00
2015-04-12 17:29:32 -04:00
< ? php
2015-03-17 23:18:27 -04:00
wp_print_request_filesystem_credentials_modal ();
2013-09-19 22:36:09 -04:00
/**
* WordPress Administration Template Footer .
*/
2010-10-20 10:16:03 -04:00
include ( ABSPATH . 'wp-admin/admin-footer.php' );