/** * Retrieve a list of links matching some criteria. * * The function argument should be an associative array describing the criteria. * The supported keys are : * 'offset' - Skip the first X results. Default is 0. * 'max_results' - The maximum number of links to return. Defaults to returning all results. * 'link_ids' - Retrieve only links with these IDs. This should either be a comma-separated list or an array. * 's_link_text' - Link text must match this keyphrase (performs a fulltext search). * 's_link_url' - Link URL must contain this string. You can use "*" as a wildcard. * 's_parser_type' - Filter links by the type of link parser that was used to find them. * 's_container_type' - Filter links by where they were found, e.g. 'post'. * 's_container_id' - Find links that belong to a container with this ID (should be used together with s_container_type). * 's_link_type' - Either parser type or container type must match this. * 's_http_code' - Filter by HTTP code. Example : 201,400-410,500 * 's_filter' - Use a built-in filter. Available filters : 'broken', 'redirects', 'all' * 'where_expr' - Advanced. Lets you directly specify a part of the WHERE clause. * 'load_instances' - Pre-load all link instance data for each link. Default is false. * 'load_containers' - Pre-load container data for each instance. Default is false. * 'load_wrapped_objects' - Pre-load wrapped object data (e.g. posts, comments, etc) for each container. Default is false. * 'count_only' - Only return the number of results (int), not the whole result set. 'offset' and 'max_results' will be ignored if this is set. Default is false. * 'purpose' - An optional code indicating how the links will be used. * 'include_invalid' - Include links that have no instances and links that only have instances that reference not-loaded containers or parsers. Defaults to false. * * All keys are optional. * * @uses blcLinkQuery::get_links(); * * @param array $params * @return int|blcLink[] Either an array of blcLink objects, or the number of results for the query. */ function blc_get_links($params = null) { $instance = blcLinkQuery::getInstance(); return $instance->get_links($params); }
} ?> " class="text ui-widget-content" /> <label for="s_filter"><?php _e('Link status', 'broken-link-checker'); ?> </label> <select name="s_filter" id="s_filter"> <?php if (!empty($search_params['s_filter'])) { $search_subfilter = $search_params['s_filter']; } else { $search_subfilter = 'all'; } $linkQuery = blcLinkQuery::getInstance(); foreach ($linkQuery->native_filters as $filter => $data) { $selected = $search_subfilter == $filter ? ' selected="selected"' : ''; printf('<option value="%s"%s>%s</option>', $filter, $selected, $data['name']); } ?> </select> <label for="s_link_type"><?php _e('Link type', 'broken-link-checker'); ?> </label> <select name="s_link_type" id="s_link_type"> <option value=""><?php _e('Any', 'broken-link-checker'); ?>
/** * Returns an array with various status information about the plugin. Array key reference: * check_threshold - date/time; links checked before this threshold should be checked again. * recheck_threshold - date/time; broken links checked before this threshold should be re-checked. * known_links - the number of detected unique URLs (a misleading name, yes). * known_instances - the number of detected link instances, i.e. actual link elements in posts and other places. * broken_links - the number of detected broken links. * unchecked_links - the number of URLs that need to be checked ASAP; based on check_threshold and recheck_threshold. * * @return array */ function get_status() { global $wpdb; $blc_link_query = blcLinkQuery::getInstance(); $check_threshold = date('Y-m-d H:i:s', strtotime('-' . $this->conf->options['check_threshold'] . ' hours')); $recheck_threshold = date('Y-m-d H:i:s', time() - $this->conf->options['recheck_threshold']); $known_links = blc_get_links(array('count_only' => true)); $known_instances = blc_get_usable_instance_count(); $broken_links = $blc_link_query->get_filter_links('broken', array('count_only' => true)); $unchecked_links = $this->get_links_to_check(0, true); return array('check_threshold' => $check_threshold, 'recheck_threshold' => $recheck_threshold, 'known_links' => $known_links, 'known_instances' => $known_instances, 'broken_links' => $broken_links, 'unchecked_links' => $unchecked_links); }
function sync_data($strategy = "") { $information = array(); $data = array(); $blc_link_query = blcLinkQuery::getInstance(); $data['broken'] = $blc_link_query->get_filter_links('broken', array('count_only' => true)); $data['redirects'] = $blc_link_query->get_filter_links('redirects', array('count_only' => true)); $data['dismissed'] = $blc_link_query->get_filter_links('dismissed', array('count_only' => true)); $data['all'] = $blc_link_query->get_filter_links('all', array('count_only' => true)); $data['link_data'] = self::sync_link_data(); $information['data'] = $data; return $information; }