public function handle_ajax() { header('Content-Type: application/json'); $liveblog_id = intval($_POST['liveblog_id']); $liveblog = new LiveBlogging_LiveBlogPost($liveblog_id); $response = array(); foreach ($liveblog->get_liveblog_entries() as $entry) { $response[] = array('liveblog' => $liveblog_id, 'id' => $entry->id, 'type' => 'entry', 'html' => $entry->build_body()); } foreach (get_post_meta($liveblog_id, '_liveblogging_deleted') as $deleted) { $response[] = array('liveblog' => $liveblog_id, 'id' => $deleted, 'type' => 'delete-entry'); } if (LiveBlogging_Setting_Comments::is_enabled()) { $liveblog = new LiveBlogging_LiveBlogPost($liveblog_id); $response[] = array('liveblog' => $liveblog_id, 'type' => 'comments', 'html' => $liveblog->build_comments_html()); } echo json_encode($response); die; }
public function publish_comments($id) { $comment = get_comment($id); $liveblog = new LiveBlogging_LiveBlogPost($comment->comment_post_ID); $message_body = array('liveblog' => $comment->comment_post_ID, 'type' => 'comments', 'html' => $liveblog->build_comments_html()); $this->run_meteor_command(array('ADDMESSAGE ' . get_option('liveblogging_id') . '-liveblog-' . $comment->comment_post_ID . ' ' . addslashes(json_encode($message_body)))); }