Пример #1
0
    private function get_posts($liveblog_id, $liveblog_sort = 'DESC')
    {
        $liveblog = new LiveBlogging_LiveBlogPost(intval($liveblog_id));
        $liveblog_entries = $liveblog->get_liveblog_entries();
        if (!empty($liveblog_entries)) {
            ?>
			<div class="liveblog-entries">
				<?php 
            foreach ($liveblog_entries as $liveblog_entry) {
                ?>
					<div id="liveblog-entry-<?php 
                echo esc_attr($liveblog_entry->id);
                ?>
">
						<?php 
                $liveblog_entry->body();
                ?>
					</div>
				<?php 
            }
            ?>
			</div>
		<?php 
        }
    }
Пример #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;
 }
Пример #3
0
 /**
  * Attempts to figure out which liveblog the user wants to use - either the one sent in the last save, or
  * one of the ones associated with this page (there should only be 1)
  *
  * @return int
  */
 private function guess_default_liveblog_id()
 {
     if (isset($_GET['live_blogging_entry_post'])) {
         return $_GET['live_blogging_entry_post'];
     } else {
         $associated_liveblogs = LiveBlogging_LiveBlogPost::get_liveblogs_for_current_post();
         if (!empty($associated_liveblogs)) {
             return $associated_liveblogs[0];
         } else {
             return 0;
         }
     }
 }
Пример #4
0
 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))));
 }