Changeset 42343 for trunk/src/wp-admin/plugins.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/plugins.php (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/plugins.php
r42201 r42343 10 10 require_once( dirname( __FILE__ ) . '/admin.php' ); 11 11 12 if ( ! current_user_can( 'activate_plugins') )12 if ( ! current_user_can( 'activate_plugins' ) ) { 13 13 wp_die( __( 'Sorry, you are not allowed to manage plugins for this site.' ) ); 14 15 $wp_list_table = _get_list_table('WP_Plugins_List_Table'); 16 $pagenum = $wp_list_table->get_pagenum(); 14 } 15 16 $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); 17 $pagenum = $wp_list_table->get_pagenum(); 17 18 18 19 $action = $wp_list_table->current_action(); 19 20 20 $plugin = isset( $_REQUEST['plugin']) ? wp_unslash( $_REQUEST['plugin'] ) : '';21 $s = isset($_REQUEST['s']) ? urlencode( wp_unslash( $_REQUEST['s'] ) ) : '';21 $plugin = isset( $_REQUEST['plugin'] ) ? wp_unslash( $_REQUEST['plugin'] ) : ''; 22 $s = isset( $_REQUEST['s'] ) ? urlencode( wp_unslash( $_REQUEST['s'] ) ) : ''; 22 23 23 24 // Clean up request URI from temporary args for screen options/paging uri's to work as expected. 24 $_SERVER['REQUEST_URI'] = remove_query_arg( array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']);25 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce' ), $_SERVER['REQUEST_URI'] ); 25 26 26 27 wp_enqueue_script( 'updates' ); … … 35 36 36 37 if ( is_multisite() && ! is_network_admin() && is_network_only_plugin( $plugin ) ) { 37 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s") );38 exit; 39 } 40 41 check_admin_referer( 'activate-plugin_' . $plugin);42 43 $result = activate_plugin( $plugin, self_admin_url('plugins.php?error=true&plugin=' . urlencode( $plugin ) ), is_network_admin() );38 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ); 39 exit; 40 } 41 42 check_admin_referer( 'activate-plugin_' . $plugin ); 43 44 $result = activate_plugin( $plugin, self_admin_url( 'plugins.php?error=true&plugin=' . urlencode( $plugin ) ), is_network_admin() ); 44 45 if ( is_wp_error( $result ) ) { 45 46 if ( 'unexpected_output' == $result->get_error_code() ) { 46 $redirect = self_admin_url( 'plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . urlencode( $plugin ) . "&plugin_status=$status&paged=$page&s=$s");47 wp_redirect( add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect));47 $redirect = self_admin_url( 'plugins.php?error=true&charsout=' . strlen( $result->get_error_data() ) . '&plugin=' . urlencode( $plugin ) . "&plugin_status=$status&paged=$page&s=$s" ); 48 wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-activation-error_' . $plugin ), $redirect ) ); 48 49 exit; 49 50 } else { 50 wp_die( $result);51 wp_die( $result ); 51 52 } 52 53 } … … 62 63 } 63 64 64 if ( isset( $_GET['from']) && 'import' == $_GET['from'] ) {65 wp_redirect( self_admin_url( "import.php?import=" . str_replace('-importer', '', dirname($plugin))) ); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix66 } else if ( isset($_GET['from']) && 'press-this' == $_GET['from'] ) {67 wp_redirect( self_admin_url( "press-this.php") );68 } else { 69 wp_redirect( self_admin_url( "plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s") ); // overrides the ?error=true one above65 if ( isset( $_GET['from'] ) && 'import' == $_GET['from'] ) { 66 wp_redirect( self_admin_url( 'import.php?import=' . str_replace( '-importer', '', dirname( $plugin ) ) ) ); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix 67 } elseif ( isset( $_GET['from'] ) && 'press-this' == $_GET['from'] ) { 68 wp_redirect( self_admin_url( 'press-this.php' ) ); 69 } else { 70 wp_redirect( self_admin_url( "plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s" ) ); // overrides the ?error=true one above 70 71 } 71 72 exit; 72 73 73 74 case 'activate-selected': 74 if ( ! current_user_can('activate_plugins') ) 75 wp_die(__('Sorry, you are not allowed to activate plugins for this site.')); 76 77 check_admin_referer('bulk-plugins'); 75 if ( ! current_user_can( 'activate_plugins' ) ) { 76 wp_die( __( 'Sorry, you are not allowed to activate plugins for this site.' ) ); 77 } 78 79 check_admin_referer( 'bulk-plugins' ); 78 80 79 81 $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array(); … … 99 101 } 100 102 101 if ( empty( $plugins) ) {102 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s") );103 exit; 104 } 105 106 activate_plugins( $plugins, self_admin_url('plugins.php?error=true'), is_network_admin() );103 if ( empty( $plugins ) ) { 104 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ); 105 exit; 106 } 107 108 activate_plugins( $plugins, self_admin_url( 'plugins.php?error=true' ), is_network_admin() ); 107 109 108 110 if ( ! is_network_admin() ) { 109 $recent = (array) get_option( 'recently_activated' );110 } else { 111 $recent = (array) get_site_option( 'recently_activated' );111 $recent = (array) get_option( 'recently_activated' ); 112 } else { 113 $recent = (array) get_site_option( 'recently_activated' ); 112 114 } 113 115 … … 122 124 } 123 125 124 wp_redirect( self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s") ); 125 exit; 126 127 case 'update-selected' : 128 126 wp_redirect( self_admin_url( "plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s" ) ); 127 exit; 128 129 case 'update-selected': 129 130 check_admin_referer( 'bulk-plugins' ); 130 131 131 if ( isset( $_GET['plugins'] ) ) 132 if ( isset( $_GET['plugins'] ) ) { 132 133 $plugins = explode( ',', wp_unslash( $_GET['plugins'] ) ); 133 elseif ( isset( $_POST['checked'] ) )134 } elseif ( isset( $_POST['checked'] ) ) { 134 135 $plugins = (array) wp_unslash( $_POST['checked'] ); 135 else136 } else { 136 137 $plugins = array(); 137 138 $title = __( 'Update Plugins' ); 138 } 139 140 $title = __( 'Update Plugins' ); 139 141 $parent_file = 'plugins.php'; 140 142 141 143 wp_enqueue_script( 'updates' ); 142 require_once( ABSPATH . 'wp-admin/admin-header.php');144 require_once( ABSPATH . 'wp-admin/admin-header.php' ); 143 145 144 146 echo '<div class="wrap">'; 145 147 echo '<h1>' . esc_html( $title ) . '</h1>'; 146 148 147 $url = self_admin_url( 'update.php?action=update-selected&plugins=' . urlencode( join(',', $plugins) ));148 $url = wp_nonce_url( $url, 'bulk-update-plugins');149 $url = self_admin_url( 'update.php?action=update-selected&plugins=' . urlencode( join( ',', $plugins ) ) ); 150 $url = wp_nonce_url( $url, 'bulk-update-plugins' ); 149 151 150 152 echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>"; 151 153 echo '</div>'; 152 require_once( ABSPATH . 'wp-admin/admin-footer.php');154 require_once( ABSPATH . 'wp-admin/admin-footer.php' ); 153 155 exit; 154 156 … … 158 160 } 159 161 160 check_admin_referer('plugin-activation-error_' . $plugin); 161 162 $valid = validate_plugin($plugin); 163 if ( is_wp_error($valid) ) 164 wp_die($valid); 162 check_admin_referer( 'plugin-activation-error_' . $plugin ); 163 164 $valid = validate_plugin( $plugin ); 165 if ( is_wp_error( $valid ) ) { 166 wp_die( $valid ); 167 } 165 168 166 169 if ( ! WP_DEBUG ) { … … 168 171 } 169 172 170 @ini_set( 'display_errors', true); //Ensure that Fatal errors are displayed.173 @ini_set( 'display_errors', true ); //Ensure that Fatal errors are displayed. 171 174 // Go back to "sandbox" scope so we get the same errors as before 172 175 plugin_sandbox_scrape( $plugin ); … … 180 183 } 181 184 182 check_admin_referer( 'deactivate-plugin_' . $plugin);185 check_admin_referer( 'deactivate-plugin_' . $plugin ); 183 186 184 187 if ( ! is_network_admin() && is_plugin_active_for_network( $plugin ) ) { 185 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s") );188 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ); 186 189 exit; 187 190 } … … 195 198 } 196 199 197 if ( headers_sent() ) 200 if ( headers_sent() ) { 198 201 echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />"; 199 else 200 wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") ); 202 } else { 203 wp_redirect( self_admin_url( "plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) ); 204 } 201 205 exit; 202 206 203 207 case 'deactivate-selected': 204 208 if ( ! current_user_can( 'deactivate_plugins' ) ) { 205 wp_die( __('Sorry, you are not allowed to deactivate plugins for this site.'));206 } 207 208 check_admin_referer( 'bulk-plugins');209 wp_die( __( 'Sorry, you are not allowed to deactivate plugins for this site.' ) ); 210 } 211 212 check_admin_referer( 'bulk-plugins' ); 209 213 210 214 $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array(); … … 222 226 } 223 227 } 224 225 } 226 if ( empty($plugins) ) { 227 wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); 228 } 229 if ( empty( $plugins ) ) { 230 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ); 228 231 exit; 229 232 } … … 242 245 } 243 246 244 wp_redirect( self_admin_url( "plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s") );247 wp_redirect( self_admin_url( "plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s" ) ); 245 248 exit; 246 249 247 250 case 'delete-selected': 248 if ( ! current_user_can( 'delete_plugins') ) {249 wp_die( __('Sorry, you are not allowed to delete plugins for this site.'));250 } 251 252 check_admin_referer( 'bulk-plugins');251 if ( ! current_user_can( 'delete_plugins' ) ) { 252 wp_die( __( 'Sorry, you are not allowed to delete plugins for this site.' ) ); 253 } 254 255 check_admin_referer( 'bulk-plugins' ); 253 256 254 257 //$_POST = from the plugin form; $_GET = from the FTP details screen. 255 258 $plugins = isset( $_REQUEST['checked'] ) ? (array) wp_unslash( $_REQUEST['checked'] ) : array(); 256 259 if ( empty( $plugins ) ) { 257 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s") );258 exit; 259 } 260 261 $plugins = array_filter( $plugins, 'is_plugin_inactive'); // Do not allow to delete Activated plugins.260 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ); 261 exit; 262 } 263 264 $plugins = array_filter( $plugins, 'is_plugin_inactive' ); // Do not allow to delete Activated plugins. 262 265 if ( empty( $plugins ) ) { 263 266 wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s" ) ); … … 269 272 $invalid_plugin_files = array_filter( $plugins, 'validate_file' ); 270 273 if ( $invalid_plugin_files ) { 271 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s") );272 exit; 273 } 274 275 include( ABSPATH . 'wp-admin/update.php');274 wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ); 275 exit; 276 } 277 278 include( ABSPATH . 'wp-admin/update.php' ); 276 279 277 280 $parent_file = 'plugins.php'; 278 281 279 if ( ! isset( $_REQUEST['verify-delete']) ) {280 wp_enqueue_script( 'jquery');281 require_once( ABSPATH . 'wp-admin/admin-header.php');282 if ( ! isset( $_REQUEST['verify-delete'] ) ) { 283 wp_enqueue_script( 'jquery' ); 284 require_once( ABSPATH . 'wp-admin/admin-header.php' ); 282 285 ?> 283 286 <div class="wrap"> 284 287 <?php 285 $plugin_info = array();288 $plugin_info = array(); 286 289 $have_non_network_plugins = false; 287 foreach ( (array) $plugins as $plugin ) { 288 $plugin_slug = dirname( $plugin ); 289 290 if ( '.' == $plugin_slug ) { 291 if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) { 292 $plugin_info[ $plugin ] = $data; 293 $plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); 294 if ( ! $plugin_info[ $plugin ]['Network'] ) { 290 foreach ( (array) $plugins as $plugin ) { 291 $plugin_slug = dirname( $plugin ); 292 293 if ( '.' == $plugin_slug ) { 294 if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) { 295 $plugin_info[ $plugin ] = $data; 296 $plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); 297 if ( ! $plugin_info[ $plugin ]['Network'] ) { 298 $have_non_network_plugins = true; 299 } 300 } 301 } else { 302 // Get plugins list from that folder. 303 if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) { 304 foreach ( $folder_plugins as $plugin_file => $data ) { 305 $plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data ); 306 $plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); 307 if ( ! $plugin_info[ $plugin_file ]['Network'] ) { 295 308 $have_non_network_plugins = true; 296 }297 }298 } else {299 // Get plugins list from that folder.300 if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) {301 foreach ( $folder_plugins as $plugin_file => $data ) {302 $plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data );303 $plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );304 if ( ! $plugin_info[ $plugin_file ]['Network'] ) {305 $have_non_network_plugins = true;306 }307 309 } 308 310 } 309 311 } 310 312 } 313 } 311 314 $plugins_to_delete = count( $plugin_info ); 312 315 ?> … … 317 320 <?php endif; ?> 318 321 <p><?php _e( 'You are about to remove the following plugin:' ); ?></p> 319 <?php else : ?>322 <?php else : ?> 320 323 <h1><?php _e( 'Delete Plugins' ); ?></h1> 321 324 <?php if ( $have_non_network_plugins && is_network_admin() ) : ?> … … 334 337 } else { 335 338 /* translators: 1: plugin name, 2: plugin author */ 336 echo '<li>', sprintf( _x( '%1$s by %2$s', 'plugin' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] ) . '</em>', '</li>';339 echo '<li>', sprintf( _x( '%1$s by %2$s', 'plugin' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] ) . '</em>', '</li>'; 337 340 } 338 341 } 339 342 ?> 340 343 </ul> 341 <p><?php 342 if ( $data_to_delete ) 343 _e('Are you sure you wish to delete these files and data?'); 344 else 345 _e('Are you sure you wish to delete these files?'); 346 ?></p> 347 <form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;"> 344 <p> 345 <?php 346 if ( $data_to_delete ) { 347 _e( 'Are you sure you wish to delete these files and data?' ); 348 } else { 349 _e( 'Are you sure you wish to delete these files?' ); 350 } 351 ?> 352 </p> 353 <form method="post" action="<?php echo esc_url( $_SERVER['REQUEST_URI'] ); ?>" style="display:inline;"> 348 354 <input type="hidden" name="verify-delete" value="1" /> 349 355 <input type="hidden" name="action" value="delete-selected" /> 350 356 <?php 351 foreach ( (array) $plugins as $plugin ) {352 echo '<input type="hidden" name="checked[]" value="' . esc_attr( $plugin ) . '" />';353 }357 foreach ( (array) $plugins as $plugin ) { 358 echo '<input type="hidden" name="checked[]" value="' . esc_attr( $plugin ) . '" />'; 359 } 354 360 ?> 355 <?php wp_nonce_field( 'bulk-plugins')?>361 <?php wp_nonce_field( 'bulk-plugins' ); ?> 356 362 <?php submit_button( $data_to_delete ? __( 'Yes, delete these files and data' ) : __( 'Yes, delete these files' ), '', 'submit', false ); ?> 357 363 </form> … … 364 370 </div> 365 371 <?php 366 require_once( ABSPATH . 'wp-admin/admin-footer.php');372 require_once( ABSPATH . 'wp-admin/admin-footer.php' ); 367 373 exit; 368 374 } else { … … 372 378 $delete_result = delete_plugins( $plugins ); 373 379 374 set_transient( 'plugins_delete_result_' . $user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length375 wp_redirect( self_admin_url( "plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s") );380 set_transient( 'plugins_delete_result_' . $user_ID, $delete_result ); //Store the result in a cache rather than a URL param due to object type & length 381 wp_redirect( self_admin_url( "plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s" ) ); 376 382 exit; 377 383 … … 386 392 default: 387 393 if ( isset( $_POST['checked'] ) ) { 388 check_admin_referer( 'bulk-plugins');389 $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array();394 check_admin_referer( 'bulk-plugins' ); 395 $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array(); 390 396 $sendback = wp_get_referer(); 391 397 … … 397 403 break; 398 404 } 399 400 405 } 401 406 402 407 $wp_list_table->prepare_items(); 403 408 404 wp_enqueue_script( 'plugin-install');409 wp_enqueue_script( 'plugin-install' ); 405 410 add_thickbox(); 406 411 407 412 add_screen_option( 'per_page', array( 'default' => 999 ) ); 408 413 409 get_current_screen()->add_help_tab( array( 410 'id' => 'overview', 411 'title' => __('Overview'), 412 'content' => 413 '<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>' . 414 '<p>' . __( 'The search for installed plugins will search for terms in their name, description, or author.' ) . ' <span id="live-search-desc" class="hide-if-no-js">' . __( 'The search results will be updated as you type.' ) . '</span></p>' . 415 '<p>' . sprintf( 416 /* translators: %s: WordPress Plugin Directory URL */ 417 __( 'If you would like to see more plugins to choose from, click on the “Add New” button and you will be able to browse or search for additional plugins from the <a href="%s">WordPress Plugin Directory</a>. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ), 418 __( 'https://wordpress.org/plugins/' ) 419 ) . '</p>' 420 ) ); 421 get_current_screen()->add_help_tab( array( 422 'id' => 'compatibility-problems', 423 'title' => __('Troubleshooting'), 424 'content' => 425 '<p>' . __('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin’s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.') . '</p>' . 426 '<p>' . sprintf( 427 /* translators: WP_PLUGIN_DIR constant value */ 428 __( 'If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.' ), 429 '<code>' . WP_PLUGIN_DIR . '</code>' 430 ) . '</p>' 431 ) ); 414 get_current_screen()->add_help_tab( 415 array( 416 'id' => 'overview', 417 'title' => __( 'Overview' ), 418 'content' => 419 '<p>' . __( 'Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.' ) . '</p>' . 420 '<p>' . __( 'The search for installed plugins will search for terms in their name, description, or author.' ) . ' <span id="live-search-desc" class="hide-if-no-js">' . __( 'The search results will be updated as you type.' ) . '</span></p>' . 421 '<p>' . sprintf( 422 /* translators: %s: WordPress Plugin Directory URL */ 423 __( 'If you would like to see more plugins to choose from, click on the “Add New” button and you will be able to browse or search for additional plugins from the <a href="%s">WordPress Plugin Directory</a>. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ), 424 __( 'https://wordpress.org/plugins/' ) 425 ) . '</p>', 426 ) 427 ); 428 get_current_screen()->add_help_tab( 429 array( 430 'id' => 'compatibility-problems', 431 'title' => __( 'Troubleshooting' ), 432 'content' => 433 '<p>' . __( 'Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin’s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.' ) . '</p>' . 434 '<p>' . sprintf( 435 /* translators: WP_PLUGIN_DIR constant value */ 436 __( 'If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.' ), 437 '<code>' . WP_PLUGIN_DIR . '</code>' 438 ) . '</p>', 439 ) 440 ); 432 441 433 442 get_current_screen()->set_help_sidebar( 434 '<p><strong>' . __( 'For more information:') . '</strong></p>' .435 '<p>' . __( '<a href="https://codex.wordpress.org/Managing_Plugins#Plugin_Management">Documentation on Managing Plugins</a>') . '</p>' .436 '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'443 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 444 '<p>' . __( '<a href="https://codex.wordpress.org/Managing_Plugins#Plugin_Management">Documentation on Managing Plugins</a>' ) . '</p>' . 445 '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>' 437 446 ); 438 447 439 get_current_screen()->set_screen_reader_content( array( 440 'heading_views' => __( 'Filter plugins list' ), 441 'heading_pagination' => __( 'Plugins list navigation' ), 442 'heading_list' => __( 'Plugins list' ), 443 ) ); 444 445 $title = __('Plugins'); 448 get_current_screen()->set_screen_reader_content( 449 array( 450 'heading_views' => __( 'Filter plugins list' ), 451 'heading_pagination' => __( 'Plugins list navigation' ), 452 'heading_list' => __( 'Plugins list' ), 453 ) 454 ); 455 456 $title = __( 'Plugins' ); 446 457 $parent_file = 'plugins.php'; 447 458 448 require_once( ABSPATH . 'wp-admin/admin-header.php');459 require_once( ABSPATH . 'wp-admin/admin-header.php' ); 449 460 450 461 $invalid = validate_active_plugins(); … … 456 467 __( 'The plugin %1$s has been <strong>deactivated</strong> due to an error: %2$s' ), 457 468 '<code>' . esc_html( $plugin_file ) . '</code>', 458 $error->get_error_message() ); 469 $error->get_error_message() 470 ); 459 471 echo '</p></div>'; 460 472 } … … 462 474 ?> 463 475 464 <?php if ( isset($_GET['error']) ) : 465 466 if ( isset( $_GET['main'] ) ) 476 <?php 477 if ( isset( $_GET['error'] ) ) : 478 479 if ( isset( $_GET['main'] ) ) { 467 480 $errmsg = __( 'You cannot delete a plugin while it is active on the main site.' ); 468 elseif ( isset($_GET['charsout']) ) 469 $errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']); 470 else 471 $errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.'); 481 } elseif ( isset( $_GET['charsout'] ) ) { 482 $errmsg = sprintf( __( 'The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.' ), $_GET['charsout'] ); 483 } else { 484 $errmsg = __( 'Plugin could not be activated because it triggered a <strong>fatal error</strong>.' ); 485 } 472 486 ?> 473 487 <div id="message" class="error"><p><?php echo $errmsg; ?></p> 474 488 <?php 475 if ( ! isset( $_GET['main'] ) && ! isset( $_GET['charsout'] ) && wp_verify_nonce( $_GET['_error_nonce'], 'plugin-activation-error_' . $plugin ) ) { 476 $iframe_url = add_query_arg( array( 489 if ( ! isset( $_GET['main'] ) && ! isset( $_GET['charsout'] ) && wp_verify_nonce( $_GET['_error_nonce'], 'plugin-activation-error_' . $plugin ) ) { 490 $iframe_url = add_query_arg( 491 array( 477 492 'action' => 'error_scrape', 478 493 'plugin' => urlencode( $plugin ), 479 494 '_wpnonce' => urlencode( $_GET['_error_nonce'] ), 480 ), admin_url( 'plugins.php' ) ); 481 ?> 482 <iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url( $iframe_url ); ?>"></iframe> 495 ), admin_url( 'plugins.php' ) 496 ); 497 ?> 498 <iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url( $iframe_url ); ?>"></iframe> 483 499 <?php 484 }500 } 485 501 ?> 486 502 </div> 487 <?php elseif ( isset($_GET['deleted']) ) : 503 <?php 504 elseif ( isset( $_GET['deleted'] ) ) : 488 505 $delete_result = get_transient( 'plugins_delete_result_' . $user_ID ); 489 506 // Delete it once we're done. 490 507 delete_transient( 'plugins_delete_result_' . $user_ID ); 491 508 492 if ( is_wp_error($delete_result) ) : ?> 493 <div id="message" class="error notice is-dismissible"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div> 509 if ( is_wp_error( $delete_result ) ) : 510 ?> 511 <div id="message" class="error notice is-dismissible"><p><?php printf( __( 'Plugin could not be deleted due to an error: %s' ), $delete_result->get_error_message() ); ?></p></div> 494 512 <?php else : ?> 495 513 <div id="message" class="updated notice is-dismissible"> … … 505 523 </div> 506 524 <?php endif; ?> 507 <?php elseif ( isset( $_GET['activate']) ) : ?>508 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin <strong>activated</strong>.')?></p></div>509 <?php elseif ( isset($_GET['activate-multi'])) : ?>510 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins <strong>activated</strong>.'); ?></p></div>511 <?php elseif ( isset( $_GET['deactivate']) ) : ?>512 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin <strong>deactivated</strong>.')?></p></div>513 <?php elseif ( isset($_GET['deactivate-multi'])) : ?>514 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins <strong>deactivated</strong>.'); ?></p></div>525 <?php elseif ( isset( $_GET['activate'] ) ) : ?> 526 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin <strong>activated</strong>.' ); ?></p></div> 527 <?php elseif ( isset( $_GET['activate-multi'] ) ) : ?> 528 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins <strong>activated</strong>.' ); ?></p></div> 529 <?php elseif ( isset( $_GET['deactivate'] ) ) : ?> 530 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin <strong>deactivated</strong>.' ); ?></p></div> 531 <?php elseif ( isset( $_GET['deactivate-multi'] ) ) : ?> 532 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins <strong>deactivated</strong>.' ); ?></p></div> 515 533 <?php elseif ( 'update-selected' == $action ) : ?> 516 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'All selected plugins are up to date.'); ?></p></div>534 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'All selected plugins are up to date.' ); ?></p></div> 517 535 <?php endif; ?> 518 536 519 537 <div class="wrap"> 520 <h1 class="wp-heading-inline"><?php 538 <h1 class="wp-heading-inline"> 539 <?php 521 540 echo esc_html( $title ); 522 ?></h1> 523 524 <?php 525 if ( ( ! is_multisite() || is_network_admin() ) && current_user_can('install_plugins') ) { ?> 541 ?> 542 </h1> 543 544 <?php 545 if ( ( ! is_multisite() || is_network_admin() ) && current_user_can( 'install_plugins' ) ) { 546 ?> 526 547 <a href="<?php echo self_admin_url( 'plugin-install.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'plugin' ); ?></a> 527 548 <?php … … 560 581 <form method="post" id="bulk-action-form"> 561 582 562 <input type="hidden" name="plugin_status" value="<?php echo esc_attr( $status)?>" />563 <input type="hidden" name="paged" value="<?php echo esc_attr( $page)?>" />583 <input type="hidden" name="plugin_status" value="<?php echo esc_attr( $status ); ?>" /> 584 <input type="hidden" name="paged" value="<?php echo esc_attr( $page ); ?>" /> 564 585 565 586 <?php $wp_list_table->display(); ?> … … 574 595 wp_print_update_row_templates(); 575 596 576 include( ABSPATH . 'wp-admin/admin-footer.php');597 include( ABSPATH . 'wp-admin/admin-footer.php' );
Note: See TracChangeset
for help on using the changeset viewer.