Version Description
Download this release
Release Info
Developer | whiteshadow |
Plugin | Broken Link Checker |
Version | 0.2.3 |
Comparing to | |
See all releases |
Code changes from version 0.2.2.1 to 0.2.3
- broken-link-checker.php +36 -4
- readme.txt +2 -2
broken-link-checker.php
CHANGED
@@ -3,13 +3,14 @@
|
|
3 |
Plugin Name: Broken Link Checker
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/broken-link-checker/
|
5 |
Description: Checks your posts for broken links and missing images and notifies you on the dashboard if any are found.
|
6 |
-
Version: 0.2.
|
7 |
Author: Janis Elsts
|
8 |
Author URI: http://w-shadow.com/blog/
|
9 |
*/
|
10 |
|
11 |
/*
|
12 |
Created by Janis Elsts (email : whiteshadow@w-shadow.com)
|
|
|
13 |
*/
|
14 |
|
15 |
if (!class_exists('ws_broken_link_checker')) {
|
@@ -19,7 +20,7 @@ class ws_broken_link_checker {
|
|
19 |
var $options_name='wsblc_options';
|
20 |
var $postdata_name;
|
21 |
var $linkdata_name;
|
22 |
-
var $version='0.2';
|
23 |
var $myfile='';
|
24 |
var $myfolder='';
|
25 |
var $mybasename='';
|
@@ -109,6 +110,8 @@ class ws_broken_link_checker {
|
|
109 |
function sync_posts_to_db(){
|
110 |
global $wpdb;
|
111 |
|
|
|
|
|
112 |
$sql="INSERT INTO ".$this->postdata_name."( post_id, last_check )
|
113 |
SELECT id, '00-00-0000 00:00:00'
|
114 |
FROM $wpdb->posts b
|
@@ -116,10 +119,33 @@ class ws_broken_link_checker {
|
|
116 |
SELECT post_id
|
117 |
FROM ".$this->postdata_name." a
|
118 |
WHERE a.post_id = b.id
|
119 |
-
)";
|
|
|
|
|
|
|
|
|
|
|
120 |
$wpdb->query($sql);
|
121 |
}
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
function activation(){
|
124 |
global $wpdb;
|
125 |
|
@@ -183,6 +209,10 @@ class ws_broken_link_checker {
|
|
183 |
|
184 |
$this->options = get_option('wsblc_options');
|
185 |
$reminder = '';
|
|
|
|
|
|
|
|
|
186 |
if (isset($_GET['updated']) && ($_GET['updated'] == 'true')) {
|
187 |
if(isset($_POST['Submit'])) {
|
188 |
|
@@ -228,7 +258,9 @@ class ws_broken_link_checker {
|
|
228 |
frequency: 10,
|
229 |
decay: 2
|
230 |
});
|
231 |
-
</script>
|
|
|
|
|
232 |
</td>
|
233 |
</tr>
|
234 |
|
3 |
Plugin Name: Broken Link Checker
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/broken-link-checker/
|
5 |
Description: Checks your posts for broken links and missing images and notifies you on the dashboard if any are found.
|
6 |
+
Version: 0.2.3
|
7 |
Author: Janis Elsts
|
8 |
Author URI: http://w-shadow.com/blog/
|
9 |
*/
|
10 |
|
11 |
/*
|
12 |
Created by Janis Elsts (email : whiteshadow@w-shadow.com)
|
13 |
+
MySQL 4.0 compatibility by Jeroen (www.yukka.eu)
|
14 |
*/
|
15 |
|
16 |
if (!class_exists('ws_broken_link_checker')) {
|
20 |
var $options_name='wsblc_options';
|
21 |
var $postdata_name;
|
22 |
var $linkdata_name;
|
23 |
+
var $version='0.2.3';
|
24 |
var $myfile='';
|
25 |
var $myfolder='';
|
26 |
var $mybasename='';
|
110 |
function sync_posts_to_db(){
|
111 |
global $wpdb;
|
112 |
|
113 |
+
/* JHS: This query does not work on mySQL 4.0 (4.0 does not support subqueries).
|
114 |
+
// However, this one is faster, so I'll leave it here (forward compatibility)
|
115 |
$sql="INSERT INTO ".$this->postdata_name."( post_id, last_check )
|
116 |
SELECT id, '00-00-0000 00:00:00'
|
117 |
FROM $wpdb->posts b
|
119 |
SELECT post_id
|
120 |
FROM ".$this->postdata_name." a
|
121 |
WHERE a.post_id = b.id
|
122 |
+
)"; */
|
123 |
+
//JHS: This one also works on mySQL 4.0:
|
124 |
+
$sql="INSERT INTO ".$this->postdata_name."(post_id, last_check)
|
125 |
+
SELECT ".$wpdb->posts.".id, '00-00-0000 00:00:00' FROM ".$wpdb->posts."
|
126 |
+
LEFT JOIN ".$this->postdata_name." ON ".$wpdb->posts.".id=".$this->postdata_name.".post_id
|
127 |
+
WHERE ".$this->postdata_name.".post_id IS NULL";
|
128 |
$wpdb->query($sql);
|
129 |
}
|
130 |
|
131 |
+
//JHS: Clears all blc tables and initiates a new fresh recheck
|
132 |
+
function recheck_all_posts(){
|
133 |
+
global $wpdb;
|
134 |
+
|
135 |
+
//Empty blc_linkdata
|
136 |
+
$sql="TRUNCATE TABLE ".$this->linkdata_name;
|
137 |
+
$wpdb->query($sql);
|
138 |
+
|
139 |
+
//Empty table [aggressive approach]
|
140 |
+
$sql="TRUNCATE TABLE ".$this->postdata_name;
|
141 |
+
//Reset all dates to zero [less aggressive approach, I like the above one better, it's cleaner ;)]
|
142 |
+
//$sql="UPDATE $this->postdata_name SET last_check='00-00-0000 00:00:00' WHERE 1";
|
143 |
+
|
144 |
+
$wpdb->query($sql);
|
145 |
+
|
146 |
+
$this->sync_posts_to_db();
|
147 |
+
}
|
148 |
+
|
149 |
function activation(){
|
150 |
global $wpdb;
|
151 |
|
209 |
|
210 |
$this->options = get_option('wsblc_options');
|
211 |
$reminder = '';
|
212 |
+
//JHS: recheck all posts if asked for:
|
213 |
+
if (isset($_GET['recheck']) && ($_GET['recheck'] == 'true')) {
|
214 |
+
$this->recheck_all_posts();
|
215 |
+
}
|
216 |
if (isset($_GET['updated']) && ($_GET['updated'] == 'true')) {
|
217 |
if(isset($_POST['Submit'])) {
|
218 |
|
258 |
frequency: 10,
|
259 |
decay: 2
|
260 |
});
|
261 |
+
</script>
|
262 |
+
<?php //JHS: Recheck all posts link: ?>
|
263 |
+
<p><input class="button" type="button" name="recheckbutton" value="Re-check all pages" onclick="location.replace('<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo plugin_basename(__FILE__); ?>&recheck=true')" /></p>
|
264 |
</td>
|
265 |
</tr>
|
266 |
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: whiteshadow
|
3 |
Tags: links, broken, maintenance
|
4 |
Requires at least: 2.0.2
|
5 |
-
Tested up to: 2.3
|
6 |
-
Stable tag: 0.2.
|
7 |
|
8 |
This plugin will check your posts for broken links and missing images in background and notify you on the dashboard if any are found.
|
9 |
|
2 |
Contributors: whiteshadow
|
3 |
Tags: links, broken, maintenance
|
4 |
Requires at least: 2.0.2
|
5 |
+
Tested up to: 2.3.1
|
6 |
+
Stable tag: 0.2.3
|
7 |
|
8 |
This plugin will check your posts for broken links and missing images in background and notify you on the dashboard if any are found.
|
9 |
|