Version Description
Download this release
Release Info
Developer | whiteshadow |
Plugin | Broken Link Checker |
Version | 0.9.4.3 |
Comparing to | |
See all releases |
Code changes from version 0.9.4.2 to 0.9.4.3
- broken-link-checker.php +2 -3
- core.php +17 -85
- includes/admin/links-page-js.php +1 -15
- includes/admin/search-form.php +1 -1
- includes/containers.php +8 -13
- includes/instances.php +6 -6
- includes/links.php +4 -4
- includes/parsers.php +5 -5
- readme.txt +1 -18
broken-link-checker.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: Broken Link Checker
|
5 |
Plugin URI: http://w-shadow.com/blog/2007/08/05/broken-link-checker-for-wordpress/
|
6 |
Description: Checks your blog for broken links and missing images and notifies you on the dashboard if any are found.
|
7 |
-
Version: 0.9.4.
|
8 |
Author: Janis Elsts
|
9 |
Author URI: http://w-shadow.com/blog/
|
10 |
Text Domain: broken-link-checker
|
@@ -86,8 +86,7 @@ $blc_config_manager = new blcConfigurationManager(
|
|
86 |
'custom_fields' => array(), //List of custom fields that can contain URLs and should be checked.
|
87 |
'check_comment_links' => true, //Whether to check links found in comments
|
88 |
|
89 |
-
'autoexpand_widget' => true, //Autoexpand the Dashboard widget if broken links are detected
|
90 |
-
'show_link_count_bubble' => true, //Display a notification bubble in the menu when broken links are found
|
91 |
|
92 |
'need_resynch' => false, //[Internal flag] True if there are unparsed items.
|
93 |
'current_db_version' => 0, //The currently set-up version of the plugin's tables
|
4 |
Plugin Name: Broken Link Checker
|
5 |
Plugin URI: http://w-shadow.com/blog/2007/08/05/broken-link-checker-for-wordpress/
|
6 |
Description: Checks your blog for broken links and missing images and notifies you on the dashboard if any are found.
|
7 |
+
Version: 0.9.4.1
|
8 |
Author: Janis Elsts
|
9 |
Author URI: http://w-shadow.com/blog/
|
10 |
Text Domain: broken-link-checker
|
86 |
'custom_fields' => array(), //List of custom fields that can contain URLs and should be checked.
|
87 |
'check_comment_links' => true, //Whether to check links found in comments
|
88 |
|
89 |
+
'autoexpand_widget' => true, //Autoexpand the Dashboard widget if broken links are detected
|
|
|
90 |
|
91 |
'need_resynch' => false, //[Internal flag] True if there are unparsed items.
|
92 |
'current_db_version' => 0, //The currently set-up version of the plugin's tables
|
core.php
CHANGED
@@ -527,8 +527,7 @@ EOD;
|
|
527 |
|
528 |
PRIMARY KEY (`instance_id`),
|
529 |
KEY `link_id` (`link_id`),
|
530 |
-
KEY `source_id` (`container_type
|
531 |
-
KEY `parser_type` (`parser_type`)
|
532 |
) {$charset_collate};
|
533 |
EOT;
|
534 |
if ( $wpdb->query($q) === false ){
|
@@ -664,12 +663,6 @@ EOZ;
|
|
664 |
$this->optimize_database();
|
665 |
}
|
666 |
|
667 |
-
/**
|
668 |
-
* Create the plugin's menu items and enqueue their scripts and CSS.
|
669 |
-
* Callback for the 'admin_menu' action.
|
670 |
-
*
|
671 |
-
* @return void
|
672 |
-
*/
|
673 |
function admin_menu(){
|
674 |
if (current_user_can('manage_options'))
|
675 |
add_filter('plugin_action_links', array(&$this, 'plugin_action_links'), 10, 2);
|
@@ -681,24 +674,9 @@ EOZ;
|
|
681 |
'link-checker-settings',array(&$this, 'options_page')
|
682 |
);
|
683 |
|
684 |
-
$menu_title = __('Broken Links', 'broken-link-checker');
|
685 |
-
if ( $this->conf->options['show_link_count_bubble'] ){
|
686 |
-
//To make it easier to notice when broken links appear, display the current number of
|
687 |
-
//broken links in a little bubble notification in the "Broken Links" menu.
|
688 |
-
//(Similar to how the number of plugin updates and unmoderated comments is displayed).
|
689 |
-
$blc_link_query = & blcLinkQuery::getInstance();
|
690 |
-
$broken_links = $blc_link_query->get_filter_links('broken', array('count_only' => true));
|
691 |
-
if ( $broken_links > 0 ){
|
692 |
-
//TODO: Appropriating existing CSS classes for my own purposes is hacky. Fix eventually.
|
693 |
-
$menu_title .= sprintf(
|
694 |
-
' <span class="update-plugins"><span class="update-count blc-menu-bubble">%d</span></span>',
|
695 |
-
$broken_links
|
696 |
-
);
|
697 |
-
}
|
698 |
-
}
|
699 |
$links_page_hook = add_management_page(
|
700 |
__('View Broken Links', 'broken-link-checker'),
|
701 |
-
|
702 |
'edit_others_posts',
|
703 |
'view-broken-links',array(&$this, 'links_page')
|
704 |
);
|
@@ -854,7 +832,7 @@ EOZ;
|
|
854 |
}
|
855 |
$this->conf->options['send_email_notifications'] = $email_notifications;
|
856 |
|
857 |
-
//
|
858 |
$old_setting = $this->conf->options['check_comment_links'];
|
859 |
$this->conf->options['check_comment_links'] = !empty($_POST['check_comment_links']);
|
860 |
//If comment link checking was just turned on we need to load the comment manager
|
@@ -862,7 +840,7 @@ EOZ;
|
|
862 |
//TODO: More elegant handling of freshly enabled/disabled container types
|
863 |
if ( !$old_setting && $this->conf->options['check_comment_links'] ){
|
864 |
include $blc_directory . '/includes/containers/comment.php';
|
865 |
-
$containerRegistry =
|
866 |
$comment_manager = $containerRegistry->get_manager('comment');
|
867 |
if ( $comment_manager ){
|
868 |
$comment_manager->resynch();
|
@@ -881,7 +859,7 @@ EOZ;
|
|
881 |
inefficient.
|
882 |
*/
|
883 |
if ( ( count($diff1) > 0 ) || ( count($diff2) > 0 ) ){
|
884 |
-
$containerRegistry =
|
885 |
$manager = $containerRegistry->get_manager('custom_field');
|
886 |
if ( !is_null($manager) ){
|
887 |
$manager->resynch();
|
@@ -1292,7 +1270,7 @@ EOZ;
|
|
1292 |
|
1293 |
function links_page(){
|
1294 |
global $wpdb, $blclog;
|
1295 |
-
$blc_link_query =
|
1296 |
|
1297 |
//Sanity check : Make sure the plugin's tables are all set up.
|
1298 |
if ( $this->db_version != $this->conf->options['current_db_version'] ) {
|
@@ -1412,12 +1390,11 @@ EOZ;
|
|
1412 |
<script type='text/javascript'>
|
1413 |
var blc_current_filter = '<?php echo $filter_id; ?>';
|
1414 |
var blc_is_broken_filter = <?php
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
echo $is_broken_filter ? 'true' : 'false';
|
1421 |
?>;
|
1422 |
</script>
|
1423 |
|
@@ -1717,7 +1694,7 @@ EOZ;
|
|
1717 |
$msg_class = 'error';
|
1718 |
} else {
|
1719 |
//Save the new filter
|
1720 |
-
$blc_link_query =
|
1721 |
$filter_id = $blc_link_query->create_custom_filter($_POST['name'], $_POST['params']);
|
1722 |
|
1723 |
if ( $filter_id ){
|
@@ -1753,7 +1730,7 @@ EOZ;
|
|
1753 |
$msg_class = 'error';
|
1754 |
} else {
|
1755 |
//Try to delete the filter
|
1756 |
-
$blc_link_query =
|
1757 |
if ( $blc_link_query->delete_custom_filter($_POST['filter_id']) ){
|
1758 |
//Success
|
1759 |
$message = __('Filter deleted', 'broken-link-checker');
|
@@ -1904,7 +1881,7 @@ EOZ;
|
|
1904 |
* @return array Confirmation message and its CSS class.
|
1905 |
*/
|
1906 |
function do_bulk_delete_sources($selected_links){
|
1907 |
-
$blc_container_registry =
|
1908 |
|
1909 |
$message = '';
|
1910 |
$msg_class = 'updated';
|
@@ -2484,12 +2461,12 @@ EOZ;
|
|
2484 |
|
2485 |
//Only check links that have at least one valid instance (i.e. an instance exists and
|
2486 |
//it corresponds to one of the currently loaded container/parser types).
|
2487 |
-
$containerRegistry =
|
2488 |
$loaded_containers = array_keys($containerRegistry->get_registered_containers());
|
2489 |
$loaded_containers = array_map(array(&$wpdb, 'escape'), $loaded_containers);
|
2490 |
$loaded_containers = "'" . implode("', '", $loaded_containers) . "'";
|
2491 |
|
2492 |
-
$parserRegistry =
|
2493 |
$loaded_parsers = array_keys($parserRegistry->get_registered_parsers());
|
2494 |
$loaded_parsers = array_map(array(&$wpdb, 'escape'), $loaded_parsers);
|
2495 |
$loaded_parsers = "'" . implode("', '", $loaded_parsers) . "'";
|
@@ -2670,7 +2647,7 @@ EOZ;
|
|
2670 |
*/
|
2671 |
function get_status(){
|
2672 |
global $wpdb;
|
2673 |
-
$blc_link_query =
|
2674 |
|
2675 |
$check_threshold=date('Y-m-d H:i:s', strtotime('-'.$this->conf->options['check_threshold'].' hours'));
|
2676 |
$recheck_threshold=date('Y-m-d H:i:s', time() - $this->conf->options['recheck_threshold']);
|
@@ -3216,51 +3193,6 @@ EOZ;
|
|
3216 |
'value' => sprintf(__('%s seconds'), ini_get('max_execution_time')),
|
3217 |
);
|
3218 |
|
3219 |
-
//Resynch flag.
|
3220 |
-
$debug['Resynch. flag'] = array(
|
3221 |
-
'state' => 'ok',
|
3222 |
-
'value' => sprintf('%d', $this->conf->options['need_resynch']),
|
3223 |
-
);
|
3224 |
-
|
3225 |
-
//Synch records
|
3226 |
-
$synch_records = intval($wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}blc_synch"));
|
3227 |
-
$data = array(
|
3228 |
-
'state' => 'ok',
|
3229 |
-
'value' => sprintf('%d', $synch_records),
|
3230 |
-
);
|
3231 |
-
if ( $synch_records == 0 ){
|
3232 |
-
$data['state'] = 'warning';
|
3233 |
-
$data['message'] = __('If this value is zero even after several page reloads you have probably encountered a bug.', 'broken-link-checker');
|
3234 |
-
}
|
3235 |
-
$debug['Synch. records'] = $data;
|
3236 |
-
|
3237 |
-
//Total links and instances (including invalid ones)
|
3238 |
-
$all_links = intval($wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}blc_links"));
|
3239 |
-
$all_instances = intval($wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}blc_instances"));
|
3240 |
-
|
3241 |
-
//Show the number of unparsed containers. Useful for debugging. For performance,
|
3242 |
-
//this is only shown when we have no links/instances yet.
|
3243 |
-
if( ($all_links == 0) && ($all_instances == 0) ){
|
3244 |
-
$unparsed_items = intval($wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}blc_synch WHERE synched=0"));
|
3245 |
-
$debug['Unparsed items'] = array(
|
3246 |
-
'state' => 'warning',
|
3247 |
-
'value' => $unparsed_items,
|
3248 |
-
);
|
3249 |
-
}
|
3250 |
-
|
3251 |
-
//Links & instances
|
3252 |
-
if ( ($all_links > 0) && ($all_instances > 0) ){
|
3253 |
-
$debug['Link records'] = array(
|
3254 |
-
'state' => 'ok',
|
3255 |
-
'value' => sprintf('%d (%d)', $all_links, $all_instances),
|
3256 |
-
);
|
3257 |
-
} else {
|
3258 |
-
$debug['Link records'] = array(
|
3259 |
-
'state' => 'warning',
|
3260 |
-
'value' => sprintf('%d (%d)', $all_links, $all_instances),
|
3261 |
-
);
|
3262 |
-
}
|
3263 |
-
|
3264 |
return $debug;
|
3265 |
}
|
3266 |
|
527 |
|
528 |
PRIMARY KEY (`instance_id`),
|
529 |
KEY `link_id` (`link_id`),
|
530 |
+
KEY `source_id` (`container_id`,`container_type`)
|
|
|
531 |
) {$charset_collate};
|
532 |
EOT;
|
533 |
if ( $wpdb->query($q) === false ){
|
663 |
$this->optimize_database();
|
664 |
}
|
665 |
|
|
|
|
|
|
|
|
|
|
|
|
|
666 |
function admin_menu(){
|
667 |
if (current_user_can('manage_options'))
|
668 |
add_filter('plugin_action_links', array(&$this, 'plugin_action_links'), 10, 2);
|
674 |
'link-checker-settings',array(&$this, 'options_page')
|
675 |
);
|
676 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
677 |
$links_page_hook = add_management_page(
|
678 |
__('View Broken Links', 'broken-link-checker'),
|
679 |
+
__('Broken Links', 'broken-link-checker'),
|
680 |
'edit_others_posts',
|
681 |
'view-broken-links',array(&$this, 'links_page')
|
682 |
);
|
832 |
}
|
833 |
$this->conf->options['send_email_notifications'] = $email_notifications;
|
834 |
|
835 |
+
//Commen link checking on/off
|
836 |
$old_setting = $this->conf->options['check_comment_links'];
|
837 |
$this->conf->options['check_comment_links'] = !empty($_POST['check_comment_links']);
|
838 |
//If comment link checking was just turned on we need to load the comment manager
|
840 |
//TODO: More elegant handling of freshly enabled/disabled container types
|
841 |
if ( !$old_setting && $this->conf->options['check_comment_links'] ){
|
842 |
include $blc_directory . '/includes/containers/comment.php';
|
843 |
+
$containerRegistry = blcContainerRegistry::getInstance();
|
844 |
$comment_manager = $containerRegistry->get_manager('comment');
|
845 |
if ( $comment_manager ){
|
846 |
$comment_manager->resynch();
|
859 |
inefficient.
|
860 |
*/
|
861 |
if ( ( count($diff1) > 0 ) || ( count($diff2) > 0 ) ){
|
862 |
+
$containerRegistry = blcContainerRegistry::getInstance();
|
863 |
$manager = $containerRegistry->get_manager('custom_field');
|
864 |
if ( !is_null($manager) ){
|
865 |
$manager->resynch();
|
1270 |
|
1271 |
function links_page(){
|
1272 |
global $wpdb, $blclog;
|
1273 |
+
$blc_link_query = blcLinkQuery::getInstance();
|
1274 |
|
1275 |
//Sanity check : Make sure the plugin's tables are all set up.
|
1276 |
if ( $this->db_version != $this->conf->options['current_db_version'] ) {
|
1390 |
<script type='text/javascript'>
|
1391 |
var blc_current_filter = '<?php echo $filter_id; ?>';
|
1392 |
var blc_is_broken_filter = <?php
|
1393 |
+
if ( ($filter_id == 'broken') || ( isset($current_filter['params']['s_filter']) && ($current_filter['params']['s_filter'] = 'broken') ) ){
|
1394 |
+
echo 'true';
|
1395 |
+
} else {
|
1396 |
+
echo 'false';
|
1397 |
+
}
|
|
|
1398 |
?>;
|
1399 |
</script>
|
1400 |
|
1694 |
$msg_class = 'error';
|
1695 |
} else {
|
1696 |
//Save the new filter
|
1697 |
+
$blc_link_query = blcLinkQuery::getInstance();
|
1698 |
$filter_id = $blc_link_query->create_custom_filter($_POST['name'], $_POST['params']);
|
1699 |
|
1700 |
if ( $filter_id ){
|
1730 |
$msg_class = 'error';
|
1731 |
} else {
|
1732 |
//Try to delete the filter
|
1733 |
+
$blc_link_query = blcLinkQuery::getInstance();
|
1734 |
if ( $blc_link_query->delete_custom_filter($_POST['filter_id']) ){
|
1735 |
//Success
|
1736 |
$message = __('Filter deleted', 'broken-link-checker');
|
1881 |
* @return array Confirmation message and its CSS class.
|
1882 |
*/
|
1883 |
function do_bulk_delete_sources($selected_links){
|
1884 |
+
$blc_container_registry = blcContainerRegistry::getInstance();
|
1885 |
|
1886 |
$message = '';
|
1887 |
$msg_class = 'updated';
|
2461 |
|
2462 |
//Only check links that have at least one valid instance (i.e. an instance exists and
|
2463 |
//it corresponds to one of the currently loaded container/parser types).
|
2464 |
+
$containerRegistry = blcContainerRegistry::getInstance();
|
2465 |
$loaded_containers = array_keys($containerRegistry->get_registered_containers());
|
2466 |
$loaded_containers = array_map(array(&$wpdb, 'escape'), $loaded_containers);
|
2467 |
$loaded_containers = "'" . implode("', '", $loaded_containers) . "'";
|
2468 |
|
2469 |
+
$parserRegistry = blcParserRegistry::getInstance();
|
2470 |
$loaded_parsers = array_keys($parserRegistry->get_registered_parsers());
|
2471 |
$loaded_parsers = array_map(array(&$wpdb, 'escape'), $loaded_parsers);
|
2472 |
$loaded_parsers = "'" . implode("', '", $loaded_parsers) . "'";
|
2647 |
*/
|
2648 |
function get_status(){
|
2649 |
global $wpdb;
|
2650 |
+
$blc_link_query = blcLinkQuery::getInstance();
|
2651 |
|
2652 |
$check_threshold=date('Y-m-d H:i:s', strtotime('-'.$this->conf->options['check_threshold'].' hours'));
|
2653 |
$recheck_threshold=date('Y-m-d H:i:s', time() - $this->conf->options['recheck_threshold']);
|
3193 |
'value' => sprintf(__('%s seconds'), ini_get('max_execution_time')),
|
3194 |
);
|
3195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3196 |
return $debug;
|
3197 |
}
|
3198 |
|
includes/admin/links-page-js.php
CHANGED
@@ -1,23 +1,9 @@
|
|
1 |
<script type='text/javascript'>
|
2 |
|
3 |
function alterLinkCounter(factor){
|
4 |
-
|
5 |
cnt = cnt + factor;
|
6 |
jQuery('.current-link-count').html(cnt);
|
7 |
-
|
8 |
-
if ( blc_is_broken_filter ){
|
9 |
-
//Update the broken link count displayed beside the "Broken Links" menu
|
10 |
-
var menuBubble = jQuery('span.blc-menu-bubble');
|
11 |
-
if ( menuBubble.length > 0 ){
|
12 |
-
cnt = parseInt(menuBubble.eq(0).html());
|
13 |
-
cnt = cnt + factor;
|
14 |
-
if ( cnt > 0 ){
|
15 |
-
menuBubble.html(cnt);
|
16 |
-
} else {
|
17 |
-
menuBubble.parent().hide();
|
18 |
-
}
|
19 |
-
}
|
20 |
-
}
|
21 |
}
|
22 |
|
23 |
function replaceLinkId(old_id, new_id){
|
1 |
<script type='text/javascript'>
|
2 |
|
3 |
function alterLinkCounter(factor){
|
4 |
+
cnt = parseInt(jQuery('.current-link-count').eq(0).html());
|
5 |
cnt = cnt + factor;
|
6 |
jQuery('.current-link-count').html(cnt);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
}
|
8 |
|
9 |
function replaceLinkId(old_id, new_id){
|
includes/admin/search-form.php
CHANGED
@@ -54,7 +54,7 @@
|
|
54 |
$search_subfilter = $filter_id;
|
55 |
}
|
56 |
|
57 |
-
$linkQuery =
|
58 |
foreach ($linkQuery->native_filters as $filter => $data){
|
59 |
$selected = ($search_subfilter == $filter)?' selected="selected"':'';
|
60 |
printf('<option value="%s"%s>%s</option>', $filter, $selected, $data['name']);
|
54 |
$search_subfilter = $filter_id;
|
55 |
}
|
56 |
|
57 |
+
$linkQuery = blcLinkQuery::getInstance();
|
58 |
foreach ($linkQuery->native_filters as $filter => $data){
|
59 |
$selected = ($search_subfilter == $filter)?' selected="selected"':'';
|
60 |
printf('<option value="%s"%s>%s</option>', $filter, $selected, $data['name']);
|
includes/containers.php
CHANGED
@@ -35,12 +35,7 @@ class blcContainerRegistry {
|
|
35 |
$this->__construct();
|
36 |
}
|
37 |
|
38 |
-
|
39 |
-
* Return a singleton instance of this class.
|
40 |
-
*
|
41 |
-
* @return blcContainerRegistry
|
42 |
-
*/
|
43 |
-
function &getInstance(){
|
44 |
static $instance = null;
|
45 |
if ( is_null($instance) ){
|
46 |
$instance = new blcContainerRegistry;
|
@@ -289,7 +284,7 @@ class blcContainerRegistry {
|
|
289 |
}
|
290 |
|
291 |
//Init the container registry & make it global
|
292 |
-
$GLOBALS['blc_container_registry'] =
|
293 |
|
294 |
|
295 |
|
@@ -839,7 +834,7 @@ class blcContainerManager {
|
|
839 |
* @return bool True if the container was successfully registered, false otherwise.
|
840 |
*/
|
841 |
function blc_register_container( $container_type, $manager_class ){
|
842 |
-
$instance =
|
843 |
return $instance->register_container($container_type, $manager_class);
|
844 |
}
|
845 |
|
@@ -850,7 +845,7 @@ function blc_register_container( $container_type, $manager_class ){
|
|
850 |
* @return blcContainer|null Returns null if the container type is unrecognized.
|
851 |
*/
|
852 |
function blc_get_container($container){
|
853 |
-
$instance =
|
854 |
return $instance->get_container($container);
|
855 |
}
|
856 |
|
@@ -878,7 +873,7 @@ function blc_get_container($container){
|
|
878 |
* @return array of blcContainer indexed by 'container_type|container_id'
|
879 |
*/
|
880 |
function blc_get_containers( $containers, $purpose = '', $load_wrapped_objects = false ){
|
881 |
-
$instance =
|
882 |
return $instance->get_containers($containers, $purpose, '', $load_wrapped_objects);
|
883 |
}
|
884 |
|
@@ -889,7 +884,7 @@ function blc_get_containers( $containers, $purpose = '', $load_wrapped_objects =
|
|
889 |
* @return array of blcContainer
|
890 |
*/
|
891 |
function blc_get_unsynched_containers($max_results = 0){
|
892 |
-
$instance =
|
893 |
return $instance->get_unsynched_containers($max_results);
|
894 |
}
|
895 |
|
@@ -901,7 +896,7 @@ function blc_get_unsynched_containers($max_results = 0){
|
|
901 |
* @return void
|
902 |
*/
|
903 |
function blc_resynch_containers($forced = false){
|
904 |
-
$instance =
|
905 |
$instance->resynch($forced);
|
906 |
}
|
907 |
|
@@ -913,7 +908,7 @@ function blc_resynch_containers($forced = false){
|
|
913 |
function blc_cleanup_containers(){
|
914 |
global $wpdb;
|
915 |
|
916 |
-
$containerRegistry =
|
917 |
$loaded_containers = array_keys($containerRegistry->get_registered_containers());
|
918 |
$loaded_containers = array_map(array(&$wpdb, 'escape'), $loaded_containers);
|
919 |
$loaded_containers = "'" . implode("', '", $loaded_containers) . "'";
|
35 |
$this->__construct();
|
36 |
}
|
37 |
|
38 |
+
function getInstance(){
|
|
|
|
|
|
|
|
|
|
|
39 |
static $instance = null;
|
40 |
if ( is_null($instance) ){
|
41 |
$instance = new blcContainerRegistry;
|
284 |
}
|
285 |
|
286 |
//Init the container registry & make it global
|
287 |
+
$GLOBALS['blc_container_registry'] = blcContainerRegistry::getInstance();
|
288 |
|
289 |
|
290 |
|
834 |
* @return bool True if the container was successfully registered, false otherwise.
|
835 |
*/
|
836 |
function blc_register_container( $container_type, $manager_class ){
|
837 |
+
$instance = blcContainerRegistry::getInstance();
|
838 |
return $instance->register_container($container_type, $manager_class);
|
839 |
}
|
840 |
|
845 |
* @return blcContainer|null Returns null if the container type is unrecognized.
|
846 |
*/
|
847 |
function blc_get_container($container){
|
848 |
+
$instance = blcContainerRegistry::getInstance();
|
849 |
return $instance->get_container($container);
|
850 |
}
|
851 |
|
873 |
* @return array of blcContainer indexed by 'container_type|container_id'
|
874 |
*/
|
875 |
function blc_get_containers( $containers, $purpose = '', $load_wrapped_objects = false ){
|
876 |
+
$instance = blcContainerRegistry::getInstance();
|
877 |
return $instance->get_containers($containers, $purpose, '', $load_wrapped_objects);
|
878 |
}
|
879 |
|
884 |
* @return array of blcContainer
|
885 |
*/
|
886 |
function blc_get_unsynched_containers($max_results = 0){
|
887 |
+
$instance = blcContainerRegistry::getInstance();
|
888 |
return $instance->get_unsynched_containers($max_results);
|
889 |
}
|
890 |
|
896 |
* @return void
|
897 |
*/
|
898 |
function blc_resynch_containers($forced = false){
|
899 |
+
$instance = blcContainerRegistry::getInstance();
|
900 |
$instance->resynch($forced);
|
901 |
}
|
902 |
|
908 |
function blc_cleanup_containers(){
|
909 |
global $wpdb;
|
910 |
|
911 |
+
$containerRegistry = blcContainerRegistry::getInstance();
|
912 |
$loaded_containers = array_keys($containerRegistry->get_registered_containers());
|
913 |
$loaded_containers = array_map(array(&$wpdb, 'escape'), $loaded_containers);
|
914 |
$loaded_containers = "'" . implode("', '", $loaded_containers) . "'";
|
includes/instances.php
CHANGED
@@ -482,9 +482,9 @@ function blc_get_instances( $link_ids, $purpose = '', $load_containers = false,
|
|
482 |
|
483 |
//Skip instances that reference containers or parsers that aren't currently loaded
|
484 |
if ( !$include_invalid ){
|
485 |
-
$containerRegistry =
|
486 |
$loaded_containers = array_keys($containerRegistry->get_registered_containers());
|
487 |
-
$parserRegistry =
|
488 |
$loaded_parsers = array_keys($parserRegistry->get_registered_parsers());
|
489 |
|
490 |
$loaded_containers = array_map(array(&$wpdb, 'escape'), $loaded_containers);
|
@@ -550,9 +550,9 @@ function blc_get_usable_instance_count(){
|
|
550 |
$q = "SELECT COUNT(instance_id) FROM {$wpdb->prefix}blc_instances WHERE 1";
|
551 |
|
552 |
//Skip instances that reference containers or parsers that aren't currently loaded
|
553 |
-
$containerRegistry =
|
554 |
$loaded_containers = array_keys($containerRegistry->get_registered_containers());
|
555 |
-
$parserRegistry =
|
556 |
$loaded_parsers = array_keys($parserRegistry->get_registered_parsers());
|
557 |
|
558 |
$loaded_containers = array_map(array(&$wpdb, 'escape'), $loaded_containers);
|
@@ -581,9 +581,9 @@ function blc_cleanup_instances(){
|
|
581 |
synch.container_id IS NULL";
|
582 |
$rez = $wpdb->query($q);
|
583 |
|
584 |
-
$containerRegistry =
|
585 |
$loaded_containers = array_keys($containerRegistry->get_registered_containers());
|
586 |
-
$parserRegistry =
|
587 |
$loaded_parsers = array_keys($parserRegistry->get_registered_parsers());
|
588 |
|
589 |
$loaded_containers = array_map(array(&$wpdb, 'escape'), $loaded_containers);
|
482 |
|
483 |
//Skip instances that reference containers or parsers that aren't currently loaded
|
484 |
if ( !$include_invalid ){
|
485 |
+
$containerRegistry = blcContainerRegistry::getInstance();
|
486 |
$loaded_containers = array_keys($containerRegistry->get_registered_containers());
|
487 |
+
$parserRegistry = blcParserRegistry::getInstance();
|
488 |
$loaded_parsers = array_keys($parserRegistry->get_registered_parsers());
|
489 |
|
490 |
$loaded_containers = array_map(array(&$wpdb, 'escape'), $loaded_containers);
|
550 |
$q = "SELECT COUNT(instance_id) FROM {$wpdb->prefix}blc_instances WHERE 1";
|
551 |
|
552 |
//Skip instances that reference containers or parsers that aren't currently loaded
|
553 |
+
$containerRegistry = blcContainerRegistry::getInstance();
|
554 |
$loaded_containers = array_keys($containerRegistry->get_registered_containers());
|
555 |
+
$parserRegistry = blcParserRegistry::getInstance();
|
556 |
$loaded_parsers = array_keys($parserRegistry->get_registered_parsers());
|
557 |
|
558 |
$loaded_containers = array_map(array(&$wpdb, 'escape'), $loaded_containers);
|
581 |
synch.container_id IS NULL";
|
582 |
$rez = $wpdb->query($q);
|
583 |
|
584 |
+
$containerRegistry = blcContainerRegistry::getInstance();
|
585 |
$loaded_containers = array_keys($containerRegistry->get_registered_containers());
|
586 |
+
$parserRegistry = blcParserRegistry::getInstance();
|
587 |
$loaded_parsers = array_keys($parserRegistry->get_registered_parsers());
|
588 |
|
589 |
$loaded_containers = array_map(array(&$wpdb, 'escape'), $loaded_containers);
|
includes/links.php
CHANGED
@@ -823,7 +823,7 @@ class blcLinkQuery {
|
|
823 |
$this->__construct();
|
824 |
}
|
825 |
|
826 |
-
function
|
827 |
static $instance = null;
|
828 |
if ( is_null($instance) ){
|
829 |
$instance = new blcLinkQuery;
|
@@ -1011,9 +1011,9 @@ class blcLinkQuery {
|
|
1011 |
if ( empty($params['include_invalid']) ){
|
1012 |
$join_instances = true;
|
1013 |
|
1014 |
-
$containerRegistry =
|
1015 |
$loaded_containers = array_keys($containerRegistry->get_registered_containers());
|
1016 |
-
$parserRegistry =
|
1017 |
$loaded_parsers = array_keys($parserRegistry->get_registered_parsers());
|
1018 |
|
1019 |
if ( empty($s_parser_type) ){
|
@@ -1379,7 +1379,7 @@ class blcLinkQuery {
|
|
1379 |
* @return int|array Either an array of blcLink objects, or the number of results for the query.
|
1380 |
*/
|
1381 |
function blc_get_links($params = null){
|
1382 |
-
$instance =
|
1383 |
return $instance->get_links($params, $purpose);
|
1384 |
}
|
1385 |
|
823 |
$this->__construct();
|
824 |
}
|
825 |
|
826 |
+
function getInstance(){
|
827 |
static $instance = null;
|
828 |
if ( is_null($instance) ){
|
829 |
$instance = new blcLinkQuery;
|
1011 |
if ( empty($params['include_invalid']) ){
|
1012 |
$join_instances = true;
|
1013 |
|
1014 |
+
$containerRegistry = blcContainerRegistry::getInstance();
|
1015 |
$loaded_containers = array_keys($containerRegistry->get_registered_containers());
|
1016 |
+
$parserRegistry = blcParserRegistry::getInstance();
|
1017 |
$loaded_parsers = array_keys($parserRegistry->get_registered_parsers());
|
1018 |
|
1019 |
if ( empty($s_parser_type) ){
|
1379 |
* @return int|array Either an array of blcLink objects, or the number of results for the query.
|
1380 |
*/
|
1381 |
function blc_get_links($params = null){
|
1382 |
+
$instance = blcLinkQuery::getInstance();
|
1383 |
return $instance->get_links($params, $purpose);
|
1384 |
}
|
1385 |
|
includes/parsers.php
CHANGED
@@ -20,7 +20,7 @@ class blcParserRegistry {
|
|
20 |
*
|
21 |
* @return blcParserRegistry
|
22 |
*/
|
23 |
-
function
|
24 |
static $instance = null;
|
25 |
if ( is_null($instance) ){
|
26 |
$instance = new blcParserRegistry;
|
@@ -92,7 +92,7 @@ class blcParserRegistry {
|
|
92 |
}
|
93 |
|
94 |
//Create the parser registry singleton.
|
95 |
-
$GLOBALS['blc_parser_registry'] =
|
96 |
|
97 |
|
98 |
/**
|
@@ -343,7 +343,7 @@ class blcParser {
|
|
343 |
* @return bool
|
344 |
*/
|
345 |
function blc_register_parser( $parser_type, $class_name ) {
|
346 |
-
$instance =
|
347 |
return $instance->register_parser($parser_type, $class_name);
|
348 |
}
|
349 |
|
@@ -356,7 +356,7 @@ function blc_register_parser( $parser_type, $class_name ) {
|
|
356 |
* @return blcParser|null
|
357 |
*/
|
358 |
function blc_get_parser( $parser_type ){
|
359 |
-
$instance =
|
360 |
return $instance->get_parser($parser_type);
|
361 |
}
|
362 |
|
@@ -370,7 +370,7 @@ function blc_get_parser( $parser_type ){
|
|
370 |
* @return array of blcParser
|
371 |
*/
|
372 |
function blc_get_parsers( $format, $container_type ){
|
373 |
-
$instance =
|
374 |
return $instance->get_parsers($format, $container_type);
|
375 |
}
|
376 |
|
20 |
*
|
21 |
* @return blcParserRegistry
|
22 |
*/
|
23 |
+
function getInstance(){
|
24 |
static $instance = null;
|
25 |
if ( is_null($instance) ){
|
26 |
$instance = new blcParserRegistry;
|
92 |
}
|
93 |
|
94 |
//Create the parser registry singleton.
|
95 |
+
$GLOBALS['blc_parser_registry'] = blcParserRegistry::getInstance();
|
96 |
|
97 |
|
98 |
/**
|
343 |
* @return bool
|
344 |
*/
|
345 |
function blc_register_parser( $parser_type, $class_name ) {
|
346 |
+
$instance = blcParserRegistry::getInstance();
|
347 |
return $instance->register_parser($parser_type, $class_name);
|
348 |
}
|
349 |
|
356 |
* @return blcParser|null
|
357 |
*/
|
358 |
function blc_get_parser( $parser_type ){
|
359 |
+
$instance = blcParserRegistry::getInstance();
|
360 |
return $instance->get_parser($parser_type);
|
361 |
}
|
362 |
|
370 |
* @return array of blcParser
|
371 |
*/
|
372 |
function blc_get_parsers( $format, $container_type ){
|
373 |
+
$instance = blcParserRegistry::getInstance();
|
374 |
return $instance->get_parsers($format, $container_type);
|
375 |
}
|
376 |
|
readme.txt
CHANGED
@@ -1,10 +1,9 @@
|
|
1 |
=== Broken Link Checker ===
|
2 |
Contributors: whiteshadow
|
3 |
-
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A6P9S6CE3SRSW
|
4 |
Tags: links, broken, maintenance, blogroll, custom fields, admin, comments, posts
|
5 |
Requires at least: 2.9.0
|
6 |
Tested up to: 3.0
|
7 |
-
Stable tag: 0.9.4.
|
8 |
|
9 |
This plugin will check your posts, comments and other places for broken links and missing images and notify you if any are found.
|
10 |
|
@@ -79,18 +78,6 @@ To upgrade your installation
|
|
79 |
|
80 |
*This is an automatically generated changelog*
|
81 |
|
82 |
-
= 0.9.4.2 =
|
83 |
-
* Added more debugging data to the "Show debug info" table.
|
84 |
-
* Added missing indexes to the instance table.
|
85 |
-
* Yet more PHP4 compatibility fixes.
|
86 |
-
* Added a notification bubble with the current number of broken links to the Tools -> Broken Links menu item.
|
87 |
-
|
88 |
-
= 0.9.4.1 =
|
89 |
-
* Fixed PHP 4 incompatibilities introduced in the previous release.
|
90 |
-
* Fixed bulk unlink.
|
91 |
-
* Updated Italian translation.
|
92 |
-
* Updated Danish translation.
|
93 |
-
|
94 |
= 0.9.4 =
|
95 |
* Fixed missing post and comment edit links in email notifications.
|
96 |
* Updated Danish translation.
|
@@ -418,7 +405,3 @@ To upgrade your installation
|
|
418 |
= 0.1 =
|
419 |
* *There are no release notes for this version*
|
420 |
|
421 |
-
== Upgrade Notice ==
|
422 |
-
|
423 |
-
= 0.9.4.2 =
|
424 |
-
Fixes a major PHP4 compatibility problem introduced in version 0.9.4 and adds a notification bubble with the current broken link count to the "Broken Links" menu.
|
1 |
=== Broken Link Checker ===
|
2 |
Contributors: whiteshadow
|
|
|
3 |
Tags: links, broken, maintenance, blogroll, custom fields, admin, comments, posts
|
4 |
Requires at least: 2.9.0
|
5 |
Tested up to: 3.0
|
6 |
+
Stable tag: 0.9.4.1
|
7 |
|
8 |
This plugin will check your posts, comments and other places for broken links and missing images and notify you if any are found.
|
9 |
|
78 |
|
79 |
*This is an automatically generated changelog*
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
= 0.9.4 =
|
82 |
* Fixed missing post and comment edit links in email notifications.
|
83 |
* Updated Danish translation.
|
405 |
= 0.1 =
|
406 |
* *There are no release notes for this version*
|
407 |
|
|
|
|
|
|
|
|