Allow plugin activation even if plugin generates extra output. Make warning more informative. fixes #13585

git-svn-id: https://develop.svn.wordpress.org/trunk@15017 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2010-05-28 00:18:00 +00:00
parent 28c54a5e20
commit dca1da7a1c
2 changed files with 7 additions and 8 deletions

View File

@@ -482,10 +482,6 @@ function activate_plugin( $plugin, $redirect = '', $network_wide = false) {
wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error
ob_start();
include(WP_PLUGIN_DIR . '/' . $plugin);
if ( ob_get_length() > 0 ) {
$output = ob_get_clean();
return new WP_Error('unexpected_output', __('The plugin generated unexpected output.'), $output);
}
do_action( 'activate_plugin', trim( $plugin) );
if ( $network_wide ) {
$current[$plugin] = time();
@@ -497,6 +493,10 @@ function activate_plugin( $plugin, $redirect = '', $network_wide = false) {
}
do_action( 'activate_' . trim( $plugin ) );
do_action( 'activated_plugin', trim( $plugin) );
if ( ob_get_length() > 0 ) {
$output = ob_get_clean();
return new WP_Error('unexpected_output', __('The plugin generated unexpected output.'), $output);
}
ob_end_clean();
}