First pass at wpview logic for the [embed] shortcode. URLs on a their own line are parsed as well. The toolbar will appear with the "remove" button when the view is clicked. Edit has not been implemented yet.

Props avryl, wonderboymusic.
See #28195.


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


git-svn-id: http://core.svn.wordpress.org/trunk@28186 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor
2014-05-10 23:36:18 +00:00
parent 9098b45e53
commit f22beb987c
10 changed files with 119 additions and 25 deletions

View File

@@ -58,7 +58,7 @@ $core_actions_post = array(
'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment',
'query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor',
'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'get-revision-diffs',
'save-user-color-scheme', 'update-widget', 'query-themes',
'save-user-color-scheme', 'update-widget', 'query-themes', 'filter-content'
);
// Register core Ajax calls.

View File

@@ -2506,3 +2506,24 @@ function wp_ajax_query_themes() {
wp_send_json_success( $api );
}
/**
* Apply `the_content` filters to a string based on the post ID.
*
* @since 4.0.0
*/
function wp_ajax_filter_content() {
global $post;
if ( ! $post = get_post( (int) $_REQUEST['post_ID'] ) ) {
wp_send_json_error();
}
if ( ! current_user_can( 'read_post', $post->ID ) ) {
wp_send_json_error();
}
setup_postdata( $post );
wp_send_json_success( apply_filters( 'the_content', wp_unslash( $_POST['content'] ) ) );
}