/** * Run on_post_edit actions against the parent post. This is primarily to trigger W3TC's clear page cache. * Only needs to run if polling is disabled, since polling updates the post content via ajax. */ public static function mark_parent_post_as_edited($data) { if (LiveBlogging_LiveBlogEntry::is_being_edited() && !LiveBlogging_Setting_UpdateMethod::is_enabled()) { $parent_post_id = (int) $_POST['live_blogging_entry_post']; do_action('edit_post', $parent_post_id, get_post($parent_post_id)); } return $data; }
/** * Overloading a filter to remove the "Post saved" message */ public function remove_post_saved_message($messages) { if (LiveBlogging_LiveBlogEntry::is_being_edited()) { if (isset($_GET['message']) && 6 == $_GET['message']) { unset($_GET['message']); } } return $messages; }
public function render_chatbox_js() { if (LiveBlogging_LiveBlogEntry::is_being_edited()) { ?> <script type="text/javascript">/*<![CDATA[ */ jQuery(document).ready(function () { // Add title to New Entry box jQuery("div#quicktags").html("<h3 class=\"hndle\"><span>New Entry</span></h3>"); // Allow image uploads jQuery("form#post").attr("enctype", "multipart/form-data"); // Publish the post on image upload click jQuery("input#quick-image-upload").click(function () { jQuery("input#publish").click(); return false; }); // Get current posts (default entry) live_blogging_update_chatbox(); }); function get_selected_liveblog_post_id() { var liveblog_selector = document.getElementById("live_blogging_entry_post"); return liveblog_selector.options[liveblog_selector.selectedIndex].value; } function live_blogging_update_chatbox() { jQuery.post( "<?php echo esc_js(admin_url('admin-ajax.php')); ?> ", { action: "live_blogging_update_chatbox", liveblog_id: get_selected_liveblog_post_id() }, function (response) { var entries = JSON.parse(response); jQuery("#live_blogging_chatbox").find(".inside").html(entries) }, 'application/json' ); setTimeout(live_blogging_update_chatbox, 10000); } /*]]>*/</script> <?php } }
public function render_custom_column($column_name, $post_ID) { switch ($column_name) { case 'liveblog': $blog = LiveBlogging_LiveBlogEntry::live_blogs_for_entry_id($post_ID); if (!empty($blog)) { ?> <a href="post.php?post=<?php echo esc_attr($blog->post_id()); ?> &action=edit"> <?php echo esc_html($blog->name()); ?> </a><?php } break; } }
public function publish_entry($id, $entry) { $post = new LiveBlogging_LiveBlogPost($id); $entry = new LiveBlogging_LiveBlogEntry($entry); $liveblogs = $post->get_liveblogs(); if (isset($_POST['live_blogging_entry_post'])) { $liveblogs[] = new LiveBlogging_LiveBlog($_POST['live_blogging_entry_post']); } $entries_to_submit = array(); foreach ($liveblogs as $liveblog) { $message_body = array('liveblog' => $liveblog->post_id(), 'id' => $id, 'type' => 'entry', 'html' => $entry->build_body()); $entries_to_submit[] = 'ADDMESSAGE ' . get_option('liveblogging_id') . '-liveblog-' . $liveblog->post_id() . ' ' . addslashes(json_encode($message_body)); } $this->run_meteor_command($entries_to_submit); }