Пример #1
0
 public function __construct()
 {
     $this->liveblog_client_id = $this->set_client_cookie();
     add_action('publish_liveblog_entry', array($this, 'publish_entry'), 100, 2);
     add_action('delete_post', array($this, 'delete_entry'));
     add_action('trash_post', array($this, 'delete_entry'));
     if (LiveBlogging_Setting_Comments::is_enabled()) {
         add_action('edit_comment', array($this, 'publish_comments'));
         add_action('comment_post', array($this, 'publish_comments'));
         add_action('wp_set_comment_status', array($this, 'publish_comments'));
     }
 }
Пример #2
0
 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;
 }