[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Install plugin administration panel. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 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'] ) ) { 10 define( 'IFRAME_REQUEST', true ); 11 } 12 13 /** 14 * WordPress Administration Bootstrap. 15 */ 16 require_once __DIR__ . '/admin.php'; 17 18 if ( ! current_user_can( 'install_plugins' ) ) { 19 wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) ); 20 } 21 22 if ( is_multisite() && ! is_network_admin() ) { 23 wp_redirect( network_admin_url( 'plugin-install.php' ) ); 24 exit; 25 } 26 27 $wp_list_table = _get_list_table( 'WP_Plugin_Install_List_Table' ); 28 $pagenum = $wp_list_table->get_pagenum(); 29 30 if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { 31 $location = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); 32 33 if ( ! empty( $_REQUEST['paged'] ) ) { 34 $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); 35 } 36 37 wp_redirect( $location ); 38 exit; 39 } 40 41 $wp_list_table->prepare_items(); 42 43 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 44 45 if ( $pagenum > $total_pages && $total_pages > 0 ) { 46 wp_redirect( add_query_arg( 'paged', $total_pages ) ); 47 exit; 48 } 49 50 // Used in the HTML title tag. 51 $title = __( 'Add Plugins' ); 52 $parent_file = 'plugins.php'; 53 54 wp_enqueue_script( 'plugin-install' ); 55 if ( 'plugin-information' !== $tab ) { 56 add_thickbox(); 57 } 58 59 $body_id = $tab; 60 61 wp_enqueue_script( 'updates' ); 62 63 /** 64 * Fires before each tab on the Install Plugins screen is loaded. 65 * 66 * The dynamic portion of the hook name, `$tab`, allows for targeting 67 * individual tabs. 68 * 69 * Possible hook names include: 70 * 71 * - `install_plugins_pre_beta` 72 * - `install_plugins_pre_favorites` 73 * - `install_plugins_pre_featured` 74 * - `install_plugins_pre_plugin-information` 75 * - `install_plugins_pre_popular` 76 * - `install_plugins_pre_recommended` 77 * - `install_plugins_pre_search` 78 * - `install_plugins_pre_upload` 79 * 80 * @since 2.7.0 81 */ 82 do_action( "install_plugins_pre_{$tab}" ); 83 84 /* 85 * Call the pre upload action on every non-upload plugin installation screen 86 * because the form is always displayed on these screens. 87 */ 88 if ( 'upload' !== $tab ) { 89 /** This action is documented in wp-admin/plugin-install.php */ 90 do_action( 'install_plugins_pre_upload' ); 91 } 92 93 get_current_screen()->add_help_tab( 94 array( 95 'id' => 'overview', 96 'title' => __( 'Overview' ), 97 'content' => 98 '<p>' . sprintf( 99 /* translators: %s: https://wordpress.org/plugins/ */ 100 __( '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.' ), 101 __( 'https://wordpress.org/plugins/' ) 102 ) . '</p>' . 103 '<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>', 104 105 ) 106 ); 107 get_current_screen()->add_help_tab( 108 array( 109 'id' => 'adding-plugins', 110 'title' => __( 'Adding Plugins' ), 111 'content' => 112 '<p>' . __( 'If you know what you are 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>' . 113 '<p>' . __( 'If you just want to get an idea of what’s available, you can browse Featured and Popular plugins by using the links above the plugins list. These sections rotate regularly.' ) . '</p>' . 114 '<p>' . __( 'You can also browse a user’s favorite plugins, by using the Favorites link above the plugins list and entering their WordPress.org username.' ) . '</p>' . 115 '<p>' . __( 'If you want to install a plugin that you’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>', 116 ) 117 ); 118 119 get_current_screen()->set_help_sidebar( 120 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 121 '<p>' . __( '<a href="https://wordpress.org/documentation/article/plugins-add-new-screen/">Documentation on Installing Plugins</a>' ) . '</p>' . 122 '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>' 123 ); 124 125 get_current_screen()->set_screen_reader_content( 126 array( 127 'heading_views' => __( 'Filter plugins list' ), 128 'heading_pagination' => __( 'Plugins list navigation' ), 129 'heading_list' => __( 'Plugins list' ), 130 ) 131 ); 132 133 /** 134 * WordPress Administration Template Header. 135 */ 136 require_once ABSPATH . 'wp-admin/admin-header.php'; 137 138 WP_Plugin_Dependencies::initialize(); 139 WP_Plugin_Dependencies::display_admin_notice_for_unmet_dependencies(); 140 WP_Plugin_Dependencies::display_admin_notice_for_circular_dependencies(); 141 ?> 142 <div class="wrap <?php echo esc_attr( "plugin-install-tab-$tab" ); ?>"> 143 <h1 class="wp-heading-inline"> 144 <?php 145 echo esc_html( $title ); 146 ?> 147 </h1> 148 149 <?php 150 if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_plugins' ) ) { 151 printf( 152 ' <a href="%s" class="upload-view-toggle page-title-action"><span class="upload">%s</span><span class="browse">%s</span></a>', 153 ( 'upload' === $tab ) ? self_admin_url( 'plugin-install.php' ) : self_admin_url( 'plugin-install.php?tab=upload' ), 154 __( 'Upload Plugin' ), 155 __( 'Browse Plugins' ) 156 ); 157 } 158 ?> 159 160 <hr class="wp-header-end"> 161 162 <?php 163 /* 164 * Output the upload plugin form on every non-upload plugin installation screen, so it can be 165 * displayed via JavaScript rather then opening up the devoted upload plugin page. 166 */ 167 if ( 'upload' !== $tab ) { 168 ?> 169 <div class="upload-plugin-wrap"> 170 <?php 171 /** This action is documented in wp-admin/plugin-install.php */ 172 do_action( 'install_plugins_upload' ); 173 ?> 174 </div> 175 <?php 176 $wp_list_table->views(); 177 } 178 179 /** 180 * Fires after the plugins list table in each tab of the Install Plugins screen. 181 * 182 * The dynamic portion of the hook name, `$tab`, allows for targeting 183 * individual tabs. 184 * 185 * Possible hook names include: 186 * 187 * - `install_plugins_beta` 188 * - `install_plugins_favorites` 189 * - `install_plugins_featured` 190 * - `install_plugins_plugin-information` 191 * - `install_plugins_popular` 192 * - `install_plugins_recommended` 193 * - `install_plugins_search` 194 * - `install_plugins_upload` 195 * 196 * @since 2.7.0 197 * 198 * @param int $paged The current page number of the plugins list table. 199 */ 200 do_action( "install_plugins_{$tab}", $paged ); 201 ?> 202 203 <span class="spinner"></span> 204 </div> 205 206 <?php 207 wp_print_request_filesystem_credentials_modal(); 208 wp_print_admin_notice_templates(); 209 210 /** 211 * WordPress Administration Template Footer. 212 */ 213 require_once ABSPATH . 'wp-admin/admin-footer.php';
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Thu Nov 21 08:20:01 2024 | Cross-referenced by PHPXref |