wp/wp-admin/plugin-install.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 19 3d72ae0968f4
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
     3  * Install plugin administration panel.
     3  * Install plugin administration panel.
     4  *
     4  *
     5  * @package WordPress
     5  * @package WordPress
     6  * @subpackage Administration
     6  * @subpackage Administration
     7  */
     7  */
     8 // TODO route this pages via a specific iframe handler instead of the do_action below
     8 // TODO: Route this page via a specific iframe handler instead of the do_action below.
     9 if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) ) {
     9 if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' === $_GET['tab'] ) ) {
    10 	define( 'IFRAME_REQUEST', true );
    10 	define( 'IFRAME_REQUEST', true );
    11 }
    11 }
    12 
    12 
    13 /**
    13 /**
    14  * WordPress Administration Bootstrap.
    14  * WordPress Administration Bootstrap.
    15  */
    15  */
    16 require_once( dirname( __FILE__ ) . '/admin.php' );
    16 require_once __DIR__ . '/admin.php';
    17 
    17 
    18 if ( ! current_user_can( 'install_plugins' ) ) {
    18 if ( ! current_user_can( 'install_plugins' ) ) {
    19 	wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
    19 	wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
    20 }
    20 }
    21 
    21 
    22 if ( is_multisite() && ! is_network_admin() ) {
    22 if ( is_multisite() && ! is_network_admin() ) {
    23 	wp_redirect( network_admin_url( 'plugin-install.php' ) );
    23 	wp_redirect( network_admin_url( 'plugin-install.php' ) );
    24 	exit();
    24 	exit;
    25 }
    25 }
    26 
    26 
    27 $wp_list_table = _get_list_table( 'WP_Plugin_Install_List_Table' );
    27 $wp_list_table = _get_list_table( 'WP_Plugin_Install_List_Table' );
    28 $pagenum       = $wp_list_table->get_pagenum();
    28 $pagenum       = $wp_list_table->get_pagenum();
    29 
    29 
    81 get_current_screen()->add_help_tab(
    81 get_current_screen()->add_help_tab(
    82 	array(
    82 	array(
    83 		'id'      => 'overview',
    83 		'id'      => 'overview',
    84 		'title'   => __( 'Overview' ),
    84 		'title'   => __( 'Overview' ),
    85 		'content' =>
    85 		'content' =>
    86 				 '<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">WordPress Plugin Directory</a> are compatible with the license WordPress uses.' ), __( 'https://wordpress.org/plugins/' ) ) . '</p>' .
    86 				'<p>' . sprintf(
    87 				 '<p>' . __( 'You can find new plugins to install by searching or browsing the directory right here in your own Plugins section.' ) . ' <span id="live-search-desc" class="hide-if-no-js">' . __( 'The search results will be updated as you type.' ) . '</span></p>',
    87 					/* translators: %s: https://wordpress.org/plugins/ */
       
    88 					__( '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">WordPress Plugin Directory</a> are compatible with the license WordPress uses.' ),
       
    89 					__( 'https://wordpress.org/plugins/' )
       
    90 				) . '</p>' .
       
    91 				'<p>' . __( 'You can find new plugins to install by searching or browsing the directory right here in your own Plugins section.' ) . ' <span id="live-search-desc" class="hide-if-no-js">' . __( 'The search results will be updated as you type.' ) . '</span></p>',
    88 
    92 
    89 	)
    93 	)
    90 );
    94 );
    91 get_current_screen()->add_help_tab(
    95 get_current_screen()->add_help_tab(
    92 	array(
    96 	array(
    93 		'id'      => 'adding-plugins',
    97 		'id'      => 'adding-plugins',
    94 		'title'   => __( 'Adding Plugins' ),
    98 		'title'   => __( 'Adding Plugins' ),
    95 		'content' =>
    99 		'content' =>
    96 				 '<p>' . __( 'If you know what you&#8217;re looking for, Search is your best bet. The Search screen has options to search the WordPress 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>' .
   100 				'<p>' . __( 'If you know what you&#8217;re looking for, Search is your best bet. The Search screen has options to search the WordPress 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>' .
    97 				 '<p>' . __( 'If you just want to get an idea of what&#8217;s available, you can browse Featured and Popular plugins by using the links above the plugins list. These sections rotate regularly.' ) . '</p>' .
   101 				'<p>' . __( 'If you just want to get an idea of what&#8217;s available, you can browse Featured and Popular plugins by using the links above the plugins list. These sections rotate regularly.' ) . '</p>' .
    98 				 '<p>' . __( 'You can also browse a user&#8217;s favorite plugins, by using the Favorites link above the plugins list and entering their WordPress.org username.' ) . '</p>' .
   102 				'<p>' . __( 'You can also browse a user&#8217;s favorite plugins, by using the Favorites link above the plugins list and entering their WordPress.org username.' ) . '</p>' .
    99 				 '<p>' . __( 'If you want to install a plugin that you&#8217;ve downloaded elsewhere, click the Upload Plugin button above the plugins list. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.' ) . '</p>',
   103 				'<p>' . __( 'If you want to install a plugin that you&#8217;ve downloaded elsewhere, click the Upload Plugin button above the plugins list. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.' ) . '</p>',
   100 	)
   104 	)
   101 );
   105 );
   102 
   106 
   103 get_current_screen()->set_help_sidebar(
   107 get_current_screen()->set_help_sidebar(
   104 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   108 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   105 	'<p>' . __( '<a href="https://codex.wordpress.org/Plugins_Add_New_Screen">Documentation on Installing Plugins</a>' ) . '</p>' .
   109 	'<p>' . __( '<a href="https://wordpress.org/support/article/plugins-add-new-screen/">Documentation on Installing Plugins</a>' ) . '</p>' .
   106 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
   110 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
   107 );
   111 );
   108 
   112 
   109 get_current_screen()->set_screen_reader_content(
   113 get_current_screen()->set_screen_reader_content(
   110 	array(
   114 	array(
   115 );
   119 );
   116 
   120 
   117 /**
   121 /**
   118  * WordPress Administration Template Header.
   122  * WordPress Administration Template Header.
   119  */
   123  */
   120 include( ABSPATH . 'wp-admin/admin-header.php' );
   124 require_once ABSPATH . 'wp-admin/admin-header.php';
   121 ?>
   125 ?>
   122 <div class="wrap <?php echo esc_attr( "plugin-install-tab-$tab" ); ?>">
   126 <div class="wrap <?php echo esc_attr( "plugin-install-tab-$tab" ); ?>">
   123 <h1 class="wp-heading-inline">
   127 <h1 class="wp-heading-inline">
   124 <?php
   128 <?php
   125 echo esc_html( $title );
   129 echo esc_html( $title );
   152 		do_action( 'install_plugins_upload' );
   156 		do_action( 'install_plugins_upload' );
   153 		?>
   157 		?>
   154 	</div>
   158 	</div>
   155 	<?php
   159 	<?php
   156 	$wp_list_table->views();
   160 	$wp_list_table->views();
   157 	echo '<br class="clear" />';
       
   158 }
   161 }
   159 
   162 
   160 /**
   163 /**
   161  * Fires after the plugins list table in each tab of the Install Plugins screen.
   164  * Fires after the plugins list table in each tab of the Install Plugins screen.
   162  *
   165  *
   178 wp_print_admin_notice_templates();
   181 wp_print_admin_notice_templates();
   179 
   182 
   180 /**
   183 /**
   181  * WordPress Administration Template Footer.
   184  * WordPress Administration Template Footer.
   182  */
   185  */
   183 include( ABSPATH . 'wp-admin/admin-footer.php' );
   186 require_once ABSPATH . 'wp-admin/admin-footer.php';