Changeset 28754
- Timestamp:
- 06/15/2014 10:52:45 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r28587 r28754 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 } … … 2537 2537 setup_postdata( $post ); 2538 2538 2539 $parsed = $wp_embed->run_shortcode( $_POST['content'] ); 2539 // If the URL cannot be embedded, return an eror message with 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 -
trunk/src/wp-admin/includes/misc.php
r28746 r28754 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 } -
trunk/src/wp-includes/js/mce-view.js
r28752 r28754 719 719 wp.ajax.send( 'parse-embed', { 720 720 data: { 721 post_ID: $( '#post_ID' ).val() ,722 content: this.shortcode721 post_ID: $( '#post_ID' ).val() || 0, 722 shortcode: this.shortcode 723 723 } 724 724 } ) 725 . done( function( content) {725 .always( function() { 726 726 self.fetching = false; 727 728 if ( content.substring( 0, ( '<a href' ).length ) === '<a href' ) { 727 } ) 728 .done( function( response ) { 729 if ( response ) { 730 self.parsed = response; 731 self.setHtml( response ); 732 } 733 } ) 734 .fail( function( response ) { 735 if ( response && response.message ) { 729 736 if ( self.type === 'embed' ) { 730 self.setError( self.original + ' failed to embed.', 'admin-media' );737 self.setError( response.message, 'admin-media' ); 731 738 } else { 732 self.setContent( self.original, null, true );739 self.setContent( '<p>' + self.original + '</p>', null, true ); 733 740 } 734 } else { 735 self.parsed = content; 736 self.setHtml( content ); 737 } 738 } ) 739 .fail( function() { 740 self.fetching = false; 741 self.setError( self.original + ' failed to embed due to a server error.', 'admin-media' ); 741 } else if ( response && response.statusText ) { 742 self.setError( response.statusText, 'admin-media' ); 743 } 742 744 } ); 743 745 }, -
trunk/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css
r28684 r28754 307 307 .wpview-error { 308 308 border: 1px solid #dedede; 309 padding: 20px 0; 310 margin: 0; 309 padding: 1em 0; 310 margin: 0; 311 word-wrap: break-word; 311 312 } 312 313
Note: See TracChangeset
for help on using the changeset viewer.