Permalink
Browse files

Add ajax endpoint for preview

  • Loading branch information...
1 parent e7f45d0 commit 5aee5858a0fb58f078a65e1b482d7ead719177f3 @nb nb committed Aug 15, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 liveblog.php
View
@@ -89,6 +89,7 @@ private static function add_actions() {
//add_action( 'wp_head', array( __CLASS__, 'wp_head' ) );
add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueue_scripts' ) );
add_action( 'wp_ajax_liveblog_insert_entry', array( __CLASS__, 'ajax_insert_entry' ) );
+ add_action( 'wp_ajax_liveblog_preview_entry', array( __CLASS__, 'ajax_preview_entry' ) );
}
/**
@@ -400,6 +401,15 @@ public static function ajax_insert_entry() {
) );
}
+ function ajax_preview_entry() {
+ self::ajax_current_user_can_edit_liveblog();
+ self::ajax_check_nonce();
+ $entry_content = isset( $_REQUEST['entry_content'] ) ? $_REQUEST['entry_content'] : '';
+ $entry_content = wp_filter_post_kses( $entry_content );
+ $entry_content = WPCOM_Liveblog_Entry::render_content( $entry_content );
+ self::json_return( array( 'html' => $entry_content ) );
+ }
+
/** Comment Methods *******************************************************/
/**

0 comments on commit 5aee585

Please sign in to comment.