$this->mark_as_synched(); } function edit_link($field_name, $parser, $new_url, $old_url = '', $old_raw_url = '') { return new WP_Error('container_not_found', sprintf(__("I don't know how to edit a '%s' [%d].", 'broken-link-checker'), $this->container_type, $this->container_id)); } function unlink($field_name, $parser, $url, $raw_url = '') { return new WP_Error('container_not_found', sprintf(__("I don't know how to edit a '%s' [%d].", 'broken-link-checker'), $this->container_type, $this->container_id)); } function ui_get_source($container_field, $context = 'display') { return sprintf('<em>Unknown source %s[%d]:%s</em>', $this->container_type, $this->container_id, $container_field); } } /** * A dummy manager class. * * @package Broken Link Checker * @access public */ class blcDummyManager extends blcContainerManager { var $container_class_name = 'blcDummyContainer'; function resynch($forced = false) { //Do nothing. } } blc_register_container('dummy', 'blcDummyManager');
* @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 message to display after $n bookmarks have been deleted. * * @param int $n Number of deleted bookmarks. * @return string The delete confirmation message. */ function ui_bulk_delete_message($n) { return sprintf(_n("%d blogroll link deleted", "%d blogroll links deleted", $n, 'broken-link-checker'), $n); } } blc_register_container('blogroll', 'blcBookmarkManager');
} else { $link['class'] = 'broken_link'; } } //Nofollow the link (unless it's already nofollow'ed) if ($this->_conf->options['nofollow_broken_links']) { if (isset($link['rel'])) { $relations = explode(' ', $link['rel']); if (!in_array('nofollow', $relations)) { $relations[] = 'nofollow'; $link['rel'] = implode(' ', $relations); } } else { $link['rel'] = 'nofollow'; } } return $link; } /** * A hook for the 'wp_head' action. Outputs the user-defined broken link CSS. * * @return void */ function hook_wp_head() { $conf = blc_get_configuration(); echo '<style type="text/css">', $conf->options['broken_link_css'], '</style>'; } } blc_register_container('post', 'blcPostContainerManager');
*/ function get_containers($containers, $purpose = '', $load_wrapped_objects = false) { global $wpdb; $containers = $this->make_containers($containers); //Preload comment data if it is likely to be useful later $preload = $load_wrapped_objects || in_array($purpose, array(BLC_FOR_DISPLAY, BLC_FOR_PARSING)); if ($preload) { $comment_ids = array(); foreach ($containers as $container) { $comment_ids[] = $container->container_id; } //There's no WP function for retrieving multiple comments by their IDs, //so we query the DB directly. $q = "SELECT * FROM {$wpdb->comments} WHERE comment_ID IN (" . implode(', ', $comment_ids) . ")"; $comments = $wpdb->get_results($q); foreach ($comments as $comment) { //Cache the comment in the internal WP object cache $comment = get_comment($comment); //Attach it to the container $key = $this->container_type . '|' . $comment->comment_ID; if (isset($containers[$key])) { $containers[$key]->wrapped_object = $comment; } } } return $containers; } } blc_register_container('comment', 'blcCommentManager');
* * @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(); } /** * Get the message to display after $n posts have been deleted. * * @see blcPostContainer::ui_bulk_delete_message() * * @param int $n Number of deleted posts. * @return string A delete confirmation message, e.g. "5 posts were moved to the trash" */ function ui_bulk_delete_message($n) { //This is identical if (function_exists('wp_trash_post') && EMPTY_TRASH_DAYS) { $delete_msg = _n("%d post moved to the trash", "%d posts moved to the trash", $n, 'broken-link-checker'); } else { $delete_msg = _n("%d post deleted", "%d posts deleted", $n, 'broken-link-checker'); } return sprintf($delete_msg, $n); } } blc_register_container('custom_field', 'blcPostMetaManager');