Ticket #28195: 28195.14.patch
File 28195.14.patch, 3.0 KB (added by , 10 years ago) |
---|
-
src/wp-admin/includes/ajax-actions.php
2530 2530 wp_send_json_error(); 2531 2531 } 2532 2532 2533 if ( ! current_user_can( 'read_post', $post->ID ) ) {2533 if ( empty( $_POST['shortcode'] ) || ! current_user_can( 'read_post', $post->ID ) ) { 2534 2534 wp_send_json_error(); 2535 2535 } 2536 2536 2537 2537 setup_postdata( $post ); 2538 2538 2539 $parsed = $wp_embed->run_shortcode( $_POST['content'] ); 2539 // If the URL cannot be embedded, return eror message with call wp_send_json_error() 2540 add_filter( 'embed_maybe_make_link', '_wpview_embed_error', 20, 2 ); 2541 2542 $parsed = $wp_embed->run_shortcode( $_POST['shortcode'] ); 2540 2543 $parsed = do_shortcode( $parsed ); 2541 2544 2542 2545 wp_send_json_success( $parsed ); -
src/wp-admin/includes/misc.php
824 824 } 825 825 // Run later as we have to set DOING_AUTOSAVE for back-compat 826 826 add_filter( 'heartbeat_received', 'heartbeat_autosave', 500, 2 ); 827 828 /** 829 * Send error message when an URL cannot be embedded. Used in wp_ajax_parse_embed(). 830 * 831 * @access private 832 * @since 4.0 833 */ 834 function _wpview_embed_error( $output, $url ) { 835 wp_send_json_error( array( 836 'message' => sprintf( __( '%s failed to embed.' ), esc_url( $url ) ), 837 ) ); 838 } -
src/wp-includes/js/mce-view.js
719 719 wp.ajax.send( 'parse-embed', { 720 720 data: { 721 721 post_ID: $( '#post_ID' ).val(), 722 content: this.shortcode 722 type: self.type, 723 shortcode: this.shortcode 723 724 } 724 725 } ) 725 . done( function( content) {726 .always( function() { 726 727 self.fetching = false; 727 728 if ( content.substring( 0, ( '<a href' ).length ) === '<a href' ) { 728 } ) 729 .done( function( response ) { 730 if ( response ) { 731 self.parsed = response; 732 self.setHtml( response ); 733 } 734 } ) 735 .fail( function( response ) { 736 if ( response && response.message ) { 729 737 if ( self.type === 'embed' ) { 730 self.setError( self.original + ' failed to embed.', 'admin-media' );738 self.setError( response.message, 'admin-media' ); 731 739 } else { 732 self.setContent( self.original, null, true );740 self.setContent( '<p>' + self.original + '</p>', null, true ); 733 741 } 734 } else { 735 self.parsed = content; 736 self.setHtml( content ); 742 } else if ( response && response.statusText ) { 743 self.setError( response.statusText, 'admin-media' ); 737 744 } 738 } )739 .fail( function() {740 self.fetching = false;741 self.setError( self.original + ' failed to embed due to a server error.', 'admin-media' );742 745 } ); 743 746 }, 744 747 /* jshint scripturl: true */