TinyMCE wpView: show an error when no items are found while parsing a audio/video/playlist shortcode. Props avryl, fixes #29114.

Built from https://develop.svn.wordpress.org/trunk@29546


git-svn-id: http://core.svn.wordpress.org/trunk@29322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-08-19 23:23:16 +00:00
parent 342a8ce6a6
commit bb862e8221
1 changed files with 10 additions and 1 deletions

View File

@ -2715,7 +2715,16 @@ function wp_ajax_parse_media_shortcode() {
wp_send_json_error();
}
if ( empty( $_POST['shortcode'] ) || ! current_user_can( 'edit_post', $post->ID ) ) {
wp_send_json_error();
}
setup_postdata( $post );
$shortcode = do_shortcode( wp_unslash( $_REQUEST['shortcode'] ) );
if ( empty( $shortcode ) ) {
wp_send_json_error( array( 'statusText' => __( 'No items found.' ) ) );
}
ob_start();
@ -2724,7 +2733,7 @@ function wp_ajax_parse_media_shortcode() {
printf( '<link rel="stylesheet" href="%s"/>', $style );
}
echo do_shortcode( wp_unslash( $_REQUEST['shortcode'] ) );
echo $shortcode;
if ( ! empty( $wp_scripts ) ) {
$wp_scripts->done = array();