From 3fe3b3652ad58d64bb167fc0393b3f5e98b33c3a Mon Sep 17 00:00:00 2001 From: Eric van der Vlist Date: Fri, 3 Jun 2011 19:35:18 +0200 Subject: [PATCH] Checking that the Broken Link Checker plugin is installed. --- wordpress/plugins/owark/owark.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/wordpress/plugins/owark/owark.php b/wordpress/plugins/owark/owark.php index fd213cc..d24d232 100644 --- a/wordpress/plugins/owark/owark.php +++ b/wordpress/plugins/owark/owark.php @@ -79,6 +79,8 @@ if (!class_exists("Owark")) { */ function sanity_checks(){ + // Install or upgrade tables if needed + $installed_ver = get_option( "owark_db_version" ); if ($installed_ver != $this->version) { global $wpdb; @@ -98,6 +100,24 @@ if (!class_exists("Owark")) { $this->notices = "

The owark table has been installed or upgraded to version {$this->version}

"; } + // Check that the broken link checker is installed + + $blc = 'not-found'; + foreach(get_plugins() as $plugin_file => $plugin_data) { + if ($plugin_data['Title'] == 'Broken Link Checker') { + if (is_plugin_active($plugin_file)) { + $blc = 'active'; + } else { + $blc = 'inactive'; + } + } + } + + if ($blc == 'inactive') { + $this->notices = $this->notices . "

Please activate the Broken Link Checker so that the Open Web Archive can be fully functional.

"; + } else if ($blc == 'not-found') { + $this->notices = $this->notices . "

The Open Web Archive relies on the Broken Link Checker. Please install this plugin!

"; + } if ($this->notices != '') { add_action('admin_notices', array($this, 'admin_notices'));