/** * When a bookmark is deleted, remove the related DB records. * * @param int $link_id * @return void */ function hook_delete_link($link_id) { //Get the container object. $container = blc_get_container(array($this->container_type, $link_id)); //Get the link(s) associated with it. $links = $container->get_links(); //Remove synch. record & instance records. $container->delete(); //Clean up links associated with this bookmark (there's probably only one) $link_ids = array(); foreach ($links as $link) { $link_ids[] = $link->link_id; } blc_cleanup_links($link_ids); }
/** * Get the container object associated with this link instance * * @return blcContainer|null */ function get_container() { if (is_null($this->_container)) { $this->_container = blc_get_container(array($this->container_type, $this->container_id)); } return $this->_container; }
/** * When a post is saved or modified, mark it as unparsed. * * @param int $post_id * @return void */ function post_saved($post_id) { //Get the container $args = array($this->container_type, intval($post_id)); $post_container = blc_get_container($args); //Get the post $post = $post_container->get_wrapped_object(); //Only check links in posts, not revisions and attachments if ($post->post_type != 'post' && $post->post_type != 'page') { return; } //Only check published posts if ($post->post_status != 'publish') { return; } $post_container->mark_as_unsynched(); }
function hook_comment_status($new_status, $old_status, $comment) { $container = blc_get_container(array($this->container_type, $comment->comment_ID)); if ($new_status == 'approved') { $container->mark_as_unsynched(); } else { $container->delete(); blc_cleanup_links(); } }
/** * When a post is restored, mark all of its custom fields as unparsed. * Called via the 'untrashed_post' action. * * @param int $post_id * @return void */ function post_untrashed($post_id) { //Get the associated container object $container = blc_get_container(array($this->container_type, intval($post_id))); $container->mark_as_unsynched(); }