Version Description
- Fixed a PHP 5.2 compatibility issue
Download this release
Release Info
Developer | freediver |
Plugin | Broken Link Checker |
Version | 1.11.5 |
Comparing to | |
See all releases |
Code changes from version 1.11.4 to 1.11.5
- broken-link-checker.php +1 -1
- core/core.php +2 -2
- modules/containers/acf_field.php +68 -49
- modules/containers/custom_field.php +1 -1
- modules/parsers/acf_field.php +4 -4
- readme.txt +4 -1
broken-link-checker.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Broken Link Checker
|
4 |
Plugin URI: https://wordpress.org/plugins/broken-link-checker/
|
5 |
Description: Checks your blog for broken links and missing images and notifies you on the dashboard if any are found.
|
6 |
-
Version: 1.11.
|
7 |
Author: Janis Elsts, Vladimir Prelovac
|
8 |
Text Domain: broken-link-checker
|
9 |
*/
|
3 |
Plugin Name: Broken Link Checker
|
4 |
Plugin URI: https://wordpress.org/plugins/broken-link-checker/
|
5 |
Description: Checks your blog for broken links and missing images and notifies you on the dashboard if any are found.
|
6 |
+
Version: 1.11.5
|
7 |
Author: Janis Elsts, Vladimir Prelovac
|
8 |
Text Domain: broken-link-checker
|
9 |
*/
|
core/core.php
CHANGED
@@ -106,10 +106,10 @@ class wsBrokenLinkChecker {
|
|
106 |
*/
|
107 |
function cron_add_every_10_minutes( $schedules ) {
|
108 |
// Adds once weekly to the existing schedules.
|
109 |
-
$schedules['10min'] =
|
110 |
'interval' => 600,
|
111 |
'display' => __('Every 10 minutes')
|
112 |
-
|
113 |
|
114 |
return $schedules;
|
115 |
}
|
106 |
*/
|
107 |
function cron_add_every_10_minutes( $schedules ) {
|
108 |
// Adds once weekly to the existing schedules.
|
109 |
+
$schedules['10min'] = array(
|
110 |
'interval' => 600,
|
111 |
'display' => __('Every 10 minutes')
|
112 |
+
);
|
113 |
|
114 |
return $schedules;
|
115 |
}
|
modules/containers/acf_field.php
CHANGED
@@ -239,7 +239,7 @@ class blcAcfMeta extends blcContainer {
|
|
239 |
function ui_get_action_links($container_field) {
|
240 |
// error_log(print_r('ui_get_action_links', true));
|
241 |
|
242 |
-
$actions =
|
243 |
if (!post_type_exists(get_post_type($this->container_id))) {
|
244 |
return $actions;
|
245 |
}
|
@@ -366,21 +366,61 @@ class blcAcfMeta extends blcContainer {
|
|
366 |
}
|
367 |
}
|
368 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
369 |
class blcAcfMetaManager extends blcContainerManager {
|
370 |
|
371 |
var $container_class_name = 'blcAcfMeta';
|
372 |
|
373 |
-
protected $selected_fields =
|
374 |
|
375 |
function init() {
|
376 |
parent::init();
|
377 |
|
378 |
//Figure out which custom fields we're interested in.
|
379 |
if (is_array($this->plugin_conf->options['acf_fields'])) {
|
380 |
-
$prefix_formats =
|
381 |
'html' => 'html',
|
382 |
'acf_field' => 'acf_field',
|
383 |
-
|
384 |
foreach ($this->plugin_conf->options['acf_fields'] as $meta_name) {
|
385 |
//The user can add an optional "format:" prefix to specify the format of the custom field.
|
386 |
$parts = explode(':', $meta_name, 2);
|
@@ -394,14 +434,14 @@ class blcAcfMetaManager extends blcContainerManager {
|
|
394 |
}
|
395 |
|
396 |
//Intercept 2.9+ style metadata modification actions
|
397 |
-
add_action("acf/save_post",
|
398 |
|
399 |
//When a post is deleted, also delete the custom field container associated with it.
|
400 |
-
add_action('delete_post',
|
401 |
-
add_action('trash_post',
|
402 |
|
403 |
//Re-parse custom fields when a post is restored from trash
|
404 |
-
add_action('untrashed_post',
|
405 |
|
406 |
}
|
407 |
|
@@ -414,6 +454,13 @@ class blcAcfMetaManager extends blcContainerManager {
|
|
414 |
return $this->selected_fields;
|
415 |
}
|
416 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
/**
|
418 |
* Instantiate multiple containers of the container type managed by this class.
|
419 |
*
|
@@ -440,25 +487,20 @@ class blcAcfMetaManager extends blcContainerManager {
|
|
440 |
don't need to actually store the results anywhere in the container object().
|
441 |
*/
|
442 |
|
443 |
-
$preload = $load_wrapped_objects || in_array($purpose,
|
444 |
if ($preload) {
|
445 |
-
$post_ids =
|
446 |
foreach ($containers as $container) {
|
447 |
$post_ids[] = $container->container_id;
|
448 |
}
|
449 |
|
450 |
-
$args =
|
451 |
get_posts($args);
|
452 |
}
|
453 |
|
454 |
$selected_fields = $this->selected_fields;
|
455 |
|
456 |
-
$html_fields = array_filter($selected_fields,
|
457 |
-
if ($value == 'html') {
|
458 |
-
return true;
|
459 |
-
}
|
460 |
-
return false;
|
461 |
-
});
|
462 |
|
463 |
$url_fields = array_keys(array_diff($selected_fields, $html_fields));
|
464 |
$html_fields = array_keys($html_fields);
|
@@ -466,7 +508,7 @@ class blcAcfMetaManager extends blcContainerManager {
|
|
466 |
foreach ($containers as $key => $container) {
|
467 |
|
468 |
$meta = get_metadata('post', $container->container_id);
|
469 |
-
$fields =
|
470 |
|
471 |
foreach ($meta as $field => $value) {
|
472 |
|
@@ -517,7 +559,7 @@ class blcAcfMetaManager extends blcContainerManager {
|
|
517 |
global $blclog;
|
518 |
|
519 |
//Only check custom fields on selected post types. By default, that's "post" and "page".
|
520 |
-
$post_types =
|
521 |
if (class_exists('blcPostTypeOverlord')) {
|
522 |
$overlord = blcPostTypeOverlord::getInstance();
|
523 |
$post_types = array_merge($post_types, $overlord->enabled_post_types);
|
@@ -604,48 +646,25 @@ class blcAcfMetaManager extends blcContainerManager {
|
|
604 |
|
605 |
$selected_fields = $this->selected_fields;
|
606 |
|
607 |
-
$html_fields = array_filter($selected_fields,
|
608 |
-
if ($value == 'html') {
|
609 |
-
return true;
|
610 |
-
}
|
611 |
-
|
612 |
-
return false;
|
613 |
-
});
|
614 |
|
615 |
$url_fields = array_keys(array_diff($selected_fields, $html_fields));
|
616 |
|
617 |
$html_fields = array_keys($html_fields);
|
618 |
$selected_fields = array_keys($selected_fields);
|
619 |
|
620 |
-
$keys =
|
621 |
$fields = $_POST['acf'];
|
622 |
|
623 |
-
|
624 |
|
625 |
-
|
626 |
-
|
627 |
-
if (is_array($key)) {
|
628 |
-
$key = $key[ count($key) - 1 ];
|
629 |
-
}
|
630 |
-
|
631 |
-
if (in_array($key, $url_fields)) {
|
632 |
-
if (!filter_var($item, FILTER_VALIDATE_URL) === false) {
|
633 |
-
$keys[] = $key;
|
634 |
-
}
|
635 |
-
}
|
636 |
-
|
637 |
-
if (in_array($key, $html_fields)) {
|
638 |
-
if ($item != '') {
|
639 |
-
$keys[] = $key;
|
640 |
-
}
|
641 |
-
}
|
642 |
-
});
|
643 |
|
644 |
if (empty($keys)) {
|
645 |
return;
|
646 |
}
|
647 |
|
648 |
-
$container = blcContainerHelper::get_container(
|
649 |
$container->mark_as_unsynched();
|
650 |
|
651 |
}
|
@@ -660,7 +679,7 @@ class blcAcfMetaManager extends blcContainerManager {
|
|
660 |
function post_deleted($post_id) {
|
661 |
//Get the associated container object
|
662 |
|
663 |
-
$container = blcContainerHelper::get_container(
|
664 |
|
665 |
if ($container != null) {
|
666 |
//Delete it
|
@@ -680,7 +699,7 @@ class blcAcfMetaManager extends blcContainerManager {
|
|
680 |
*/
|
681 |
function post_untrashed($post_id) {
|
682 |
//Get the associated container object
|
683 |
-
$container = blcContainerHelper::get_container(
|
684 |
$container->mark_as_unsynched();
|
685 |
}
|
686 |
|
239 |
function ui_get_action_links($container_field) {
|
240 |
// error_log(print_r('ui_get_action_links', true));
|
241 |
|
242 |
+
$actions = array();
|
243 |
if (!post_type_exists(get_post_type($this->container_id))) {
|
244 |
return $actions;
|
245 |
}
|
366 |
}
|
367 |
}
|
368 |
|
369 |
+
class blcAcfExtractedFieldWalker
|
370 |
+
{
|
371 |
+
private $keys;
|
372 |
+
|
373 |
+
private $selected_fields;
|
374 |
+
|
375 |
+
private $url_fields;
|
376 |
+
|
377 |
+
private $html_fields;
|
378 |
+
|
379 |
+
public function __construct(&$keys, $selected_fields, $url_fields, $html_fields)
|
380 |
+
{
|
381 |
+
$this->keys = $keys;
|
382 |
+
$this->selected_fields = $selected_fields;
|
383 |
+
$this->url_fields = $url_fields;
|
384 |
+
$this->html_fields = $html_fields;
|
385 |
+
}
|
386 |
+
|
387 |
+
public function walk_function($item, $key)
|
388 |
+
{
|
389 |
+
$key = explode('|', str_replace('_field', '|field', $key));
|
390 |
+
|
391 |
+
if (is_array($key)) {
|
392 |
+
$key = $key[count($key) - 1];
|
393 |
+
}
|
394 |
+
|
395 |
+
if (in_array($key, $this->url_fields)) {
|
396 |
+
if (!filter_var($item, FILTER_VALIDATE_URL) === false) {
|
397 |
+
$this->keys[] = $key;
|
398 |
+
}
|
399 |
+
}
|
400 |
+
|
401 |
+
if (in_array($key, $this->html_fields)) {
|
402 |
+
if ($item != '') {
|
403 |
+
$this->keys[] = $key;
|
404 |
+
}
|
405 |
+
}
|
406 |
+
}
|
407 |
+
}
|
408 |
+
|
409 |
class blcAcfMetaManager extends blcContainerManager {
|
410 |
|
411 |
var $container_class_name = 'blcAcfMeta';
|
412 |
|
413 |
+
protected $selected_fields = array();
|
414 |
|
415 |
function init() {
|
416 |
parent::init();
|
417 |
|
418 |
//Figure out which custom fields we're interested in.
|
419 |
if (is_array($this->plugin_conf->options['acf_fields'])) {
|
420 |
+
$prefix_formats = array(
|
421 |
'html' => 'html',
|
422 |
'acf_field' => 'acf_field',
|
423 |
+
);
|
424 |
foreach ($this->plugin_conf->options['acf_fields'] as $meta_name) {
|
425 |
//The user can add an optional "format:" prefix to specify the format of the custom field.
|
426 |
$parts = explode(':', $meta_name, 2);
|
434 |
}
|
435 |
|
436 |
//Intercept 2.9+ style metadata modification actions
|
437 |
+
add_action("acf/save_post", array($this, 'acf_save'), 10, 4);
|
438 |
|
439 |
//When a post is deleted, also delete the custom field container associated with it.
|
440 |
+
add_action('delete_post', array($this, 'post_deleted'));
|
441 |
+
add_action('trash_post', array($this, 'post_deleted'));
|
442 |
|
443 |
//Re-parse custom fields when a post is restored from trash
|
444 |
+
add_action('untrashed_post', array($this, 'post_untrashed'));
|
445 |
|
446 |
}
|
447 |
|
454 |
return $this->selected_fields;
|
455 |
}
|
456 |
|
457 |
+
function filterHtmlExtract($value) {
|
458 |
+
if ($value == 'html') {
|
459 |
+
return true;
|
460 |
+
}
|
461 |
+
return false;
|
462 |
+
}
|
463 |
+
|
464 |
/**
|
465 |
* Instantiate multiple containers of the container type managed by this class.
|
466 |
*
|
487 |
don't need to actually store the results anywhere in the container object().
|
488 |
*/
|
489 |
|
490 |
+
$preload = $load_wrapped_objects || in_array($purpose, array(BLC_FOR_DISPLAY));
|
491 |
if ($preload) {
|
492 |
+
$post_ids = array();
|
493 |
foreach ($containers as $container) {
|
494 |
$post_ids[] = $container->container_id;
|
495 |
}
|
496 |
|
497 |
+
$args = array('include' => implode(',', $post_ids));
|
498 |
get_posts($args);
|
499 |
}
|
500 |
|
501 |
$selected_fields = $this->selected_fields;
|
502 |
|
503 |
+
$html_fields = array_filter($selected_fields, array($this, 'filterHtmlExtract'));
|
|
|
|
|
|
|
|
|
|
|
504 |
|
505 |
$url_fields = array_keys(array_diff($selected_fields, $html_fields));
|
506 |
$html_fields = array_keys($html_fields);
|
508 |
foreach ($containers as $key => $container) {
|
509 |
|
510 |
$meta = get_metadata('post', $container->container_id);
|
511 |
+
$fields = array();
|
512 |
|
513 |
foreach ($meta as $field => $value) {
|
514 |
|
559 |
global $blclog;
|
560 |
|
561 |
//Only check custom fields on selected post types. By default, that's "post" and "page".
|
562 |
+
$post_types = array('post', 'page');
|
563 |
if (class_exists('blcPostTypeOverlord')) {
|
564 |
$overlord = blcPostTypeOverlord::getInstance();
|
565 |
$post_types = array_merge($post_types, $overlord->enabled_post_types);
|
646 |
|
647 |
$selected_fields = $this->selected_fields;
|
648 |
|
649 |
+
$html_fields = array_filter($selected_fields, array($this, 'filterHtmlExtract'));
|
|
|
|
|
|
|
|
|
|
|
|
|
650 |
|
651 |
$url_fields = array_keys(array_diff($selected_fields, $html_fields));
|
652 |
|
653 |
$html_fields = array_keys($html_fields);
|
654 |
$selected_fields = array_keys($selected_fields);
|
655 |
|
656 |
+
$keys = array();
|
657 |
$fields = $_POST['acf'];
|
658 |
|
659 |
+
$acfWalk = new blcAcfExtractedFieldWalker($keys, $selected_fields, $url_fields, $html_fields);
|
660 |
|
661 |
+
array_walk_recursive($fields, array($acfWalk, 'walk_function'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
662 |
|
663 |
if (empty($keys)) {
|
664 |
return;
|
665 |
}
|
666 |
|
667 |
+
$container = blcContainerHelper::get_container(array($this->container_type, $post_id));
|
668 |
$container->mark_as_unsynched();
|
669 |
|
670 |
}
|
679 |
function post_deleted($post_id) {
|
680 |
//Get the associated container object
|
681 |
|
682 |
+
$container = blcContainerHelper::get_container(array($this->container_type, intval($post_id)));
|
683 |
|
684 |
if ($container != null) {
|
685 |
//Delete it
|
699 |
*/
|
700 |
function post_untrashed($post_id) {
|
701 |
//Get the associated container object
|
702 |
+
$container = blcContainerHelper::get_container(array($this->container_type, intval($post_id)));
|
703 |
$container->mark_as_unsynched();
|
704 |
}
|
705 |
|
modules/containers/custom_field.php
CHANGED
@@ -591,7 +591,7 @@ class blcPostMetaManager extends blcContainerManager {
|
|
591 |
function post_deleted($post_id){
|
592 |
//Get the associated container object
|
593 |
|
594 |
-
$container = blcContainerHelper::get_container(
|
595 |
if ($container != null) {
|
596 |
//Delete it
|
597 |
$container->delete();
|
591 |
function post_deleted($post_id){
|
592 |
//Get the associated container object
|
593 |
|
594 |
+
$container = blcContainerHelper::get_container(array($this->container_type, intval($post_id)));
|
595 |
if ($container != null) {
|
596 |
//Delete it
|
597 |
$container->delete();
|
modules/parsers/acf_field.php
CHANGED
@@ -16,8 +16,8 @@ ModuleHidden: true
|
|
16 |
|
17 |
class blcACFParser extends blcParser {
|
18 |
|
19 |
-
var $supported_formats =
|
20 |
-
var $supported_containers =
|
21 |
|
22 |
/**
|
23 |
* Parse a acf value.
|
@@ -28,10 +28,10 @@ class blcACFParser extends blcParser {
|
|
28 |
* @return array An array of new blcLinkInstance objects.
|
29 |
*/
|
30 |
function parse($content, $base_url = '', $default_link_text = ''){
|
31 |
-
$instances =
|
32 |
|
33 |
if ( !is_array($content) ){
|
34 |
-
$content =
|
35 |
}
|
36 |
|
37 |
foreach($content as $value){
|
16 |
|
17 |
class blcACFParser extends blcParser {
|
18 |
|
19 |
+
var $supported_formats = array('acf_field');
|
20 |
+
var $supported_containers = array();
|
21 |
|
22 |
/**
|
23 |
* Parse a acf value.
|
28 |
* @return array An array of new blcLinkInstance objects.
|
29 |
*/
|
30 |
function parse($content, $base_url = '', $default_link_text = ''){
|
31 |
+
$instances = array();
|
32 |
|
33 |
if ( !is_array($content) ){
|
34 |
+
$content = array($content);
|
35 |
}
|
36 |
|
37 |
foreach($content as $value){
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link:
|
|
4 |
Tags: links, broken, maintenance, blogroll, custom fields, admin, comments, posts
|
5 |
Requires at least: 3.2
|
6 |
Tested up to: 4.8
|
7 |
-
Stable tag: 1.11.
|
8 |
|
9 |
This plugin will check your posts, comments and other content for broken links and missing images, and notify you if any are found.
|
10 |
|
@@ -101,6 +101,9 @@ To upgrade your installation
|
|
101 |
|
102 |
== Changelog ==
|
103 |
|
|
|
|
|
|
|
104 |
= 1.11.4 =
|
105 |
* Fixed a few more PHP 7.x/5.6 compatibility issues
|
106 |
|
4 |
Tags: links, broken, maintenance, blogroll, custom fields, admin, comments, posts
|
5 |
Requires at least: 3.2
|
6 |
Tested up to: 4.8
|
7 |
+
Stable tag: 1.11.5
|
8 |
|
9 |
This plugin will check your posts, comments and other content for broken links and missing images, and notify you if any are found.
|
10 |
|
101 |
|
102 |
== Changelog ==
|
103 |
|
104 |
+
= 1.11.5 =
|
105 |
+
* Fixed a PHP 5.2 compatibility issue
|
106 |
+
|
107 |
= 1.11.4 =
|
108 |
* Fixed a few more PHP 7.x/5.6 compatibility issues
|
109 |
|