Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions src/wp-admin/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,12 @@
$errmsg = __( 'Plugin could not be activated because it triggered a <strong>fatal error</strong>.' );
}

$error_notice_args = array(
'id' => 'message',
'additional_classes' => array( 'error' ),
);
$allowed_html = wp_kses_allowed_html( 'post' );

if ( ! isset( $_GET['main'] ) && ! isset( $_GET['charsout'] )
&& isset( $_GET['_error_nonce'] ) && wp_verify_nonce( $_GET['_error_nonce'], 'plugin-activation-error_' . $plugin )
) {
Expand All @@ -703,16 +709,21 @@
);

$errmsg .= '<iframe style="border:0" width="100%" height="70px" src="' . esc_url( $iframe_url ) . '"></iframe>';

// wp_kses_post() strips iframes, so allow this one when sanitizing this notice only.
$allowed_html['iframe'] = array(
'src' => true,
'style' => true,
'width' => true,
'height' => true,
);
}

wp_admin_notice(
$errmsg,
array(
'id' => 'message',
'additional_classes' => array( 'error' ),
)
);
/** This action is documented in wp-includes/functions.php */
do_action( 'wp_admin_notice', $errmsg, $error_notice_args );

// Same as wp_admin_notice(), but sanitized with the allowed HTML above instead of wp_kses_post().
echo wp_kses( wp_get_admin_notice( $errmsg, $error_notice_args ), $allowed_html );
} elseif ( isset( $_GET['deleted'] ) ) {
$delete_result = get_option( 'plugins_delete_result_' . $user_ID );
// Delete it once we're done.
Expand Down
Loading