/** * 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 } }