Broken Link Checker - Version 0.3.5

Version Description

Download this release

Release Info

Developer whiteshadow
Plugin Icon 128x128 Broken Link Checker
Version 0.3.5
Comparing to
See all releases

Code changes from version 0.3.4 to 0.3.5

Files changed (2) hide show
  1. broken-link-checker.php +48 -21
  2. readme.txt +2 -2
broken-link-checker.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Broken Link Checker
4
  Plugin URI: http://w-shadow.com/blog/2007/08/05/broken-link-checker-for-wordpress/
5
  Description: Checks your posts for broken links and missing images and notifies you on the dashboard if any are found.
6
- Version: 0.3.4
7
  Author: Janis Elsts
8
  Author URI: http://w-shadow.com/blog/
9
  */
@@ -20,19 +20,36 @@ class ws_broken_link_checker {
20
  var $options_name='wsblc_options';
21
  var $postdata_name;
22
  var $linkdata_name;
23
- var $version='0.3.4';
24
  var $myfile='';
25
  var $myfolder='';
26
  var $mybasename='';
27
  var $siteurl;
 
28
 
29
-
30
  function ws_broken_link_checker() {
31
  global $wpdb;
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  $this->postdata_name=$wpdb->prefix . "blc_postdata";
34
  $this->linkdata_name=$wpdb->prefix . "blc_linkdata";
35
- $this->options=get_option($this->options_name);
36
  $this->siteurl = get_option('siteurl');
37
 
38
  $my_file = str_replace('\\', '/',__FILE__);
@@ -280,20 +297,7 @@ class ws_broken_link_checker {
280
  function activation(){
281
  global $wpdb;
282
 
283
- //set default options
284
- $defaults = array(
285
- 'version' => $this->version,
286
- 'max_work_session' => 27,
287
- 'check_treshold' => 72,
288
- 'mark_broken_links' => true,
289
- 'broken_link_css' => ".broken_link, a.broken_link {\n\ttext-decoration: line-through;\n}",
290
- 'exclusion_list' => array(),
291
- );
292
-
293
- if(!is_array($this->options)){
294
- $this->options = array();
295
- };
296
- $this->options = array_merge($defaults, $this->options);
297
  update_option($this->options_name, $this->options);
298
 
299
  require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
@@ -366,6 +370,8 @@ class ws_broken_link_checker {
366
 
367
  $this->options['mark_broken_links'] = !empty($_POST['mark_broken_links']);
368
 
 
 
369
  $this->options['exclusion_list']=array_filter(preg_split('/[\s,\r\n]+/',
370
  $_POST['exclusion_list']));
371
 
@@ -459,6 +465,19 @@ class ws_broken_link_checker {
459
  </td>
460
  </tr>
461
 
 
 
 
 
 
 
 
 
 
 
 
 
 
462
  </table>
463
 
464
  <p class="submit"><input type="submit" name="Submit" value="Update Options &raquo;" /></p>
@@ -494,7 +513,7 @@ class ws_broken_link_checker {
494
  <th scope="col">Link Text</th>
495
  <th scope="col">URL</th>
496
 
497
- <th scope="col" colspan='4'>Action</th>
498
 
499
  </tr>
500
  </thead>
@@ -512,8 +531,16 @@ class ws_broken_link_checker {
512
  <td><a href='$link->url'>".$this->mytruncate($link->url)."</a></td>
513
  <td><a href='".($link->guid)."' class='edit'>View</a></td>
514
 
515
- <td><a href='post.php?action=edit&amp;post=$link->post_id' class='edit'>Edit Post</a></td>
516
- <td><a href='javascript:void(0);' class='delete' id='discard_button-$link->id'
 
 
 
 
 
 
 
 
517
  onclick='discardLinkMessage($link->id);return false;' );' title='Discard This Message'>Discard</a></td>
518
 
519
  <td><a href='javascript:void(0);' class='delete' id='unlink_button-$link->id'
3
  Plugin Name: Broken Link Checker
4
  Plugin URI: http://w-shadow.com/blog/2007/08/05/broken-link-checker-for-wordpress/
5
  Description: Checks your posts for broken links and missing images and notifies you on the dashboard if any are found.
6
+ Version: 0.3.5
7
  Author: Janis Elsts
8
  Author URI: http://w-shadow.com/blog/
9
  */
20
  var $options_name='wsblc_options';
21
  var $postdata_name;
22
  var $linkdata_name;
23
+ var $version='0.3.5';
24
  var $myfile='';
25
  var $myfolder='';
26
  var $mybasename='';
27
  var $siteurl;
28
+ var $defaults;
29
 
 
30
  function ws_broken_link_checker() {
31
  global $wpdb;
32
 
33
+ //set default options
34
+ $this->defaults = array(
35
+ 'version' => $this->version,
36
+ 'max_work_session' => 27,
37
+ 'check_treshold' => 72,
38
+ 'mark_broken_links' => true,
39
+ 'broken_link_css' => ".broken_link, a.broken_link {\n\ttext-decoration: line-through;\n}",
40
+ 'exclusion_list' => array(),
41
+ 'delete_post_button' => false
42
+ );
43
+ //load options
44
+ $this->options=get_option($this->options_name);
45
+ if(!is_array($this->options)){
46
+ $this->options = $this->defaults;
47
+ } else {
48
+ $this->options = array_merge($this->defaults, $this->options);
49
+ }
50
+
51
  $this->postdata_name=$wpdb->prefix . "blc_postdata";
52
  $this->linkdata_name=$wpdb->prefix . "blc_linkdata";
 
53
  $this->siteurl = get_option('siteurl');
54
 
55
  $my_file = str_replace('\\', '/',__FILE__);
297
  function activation(){
298
  global $wpdb;
299
 
300
+ //option default were already set in the constructor
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  update_option($this->options_name, $this->options);
302
 
303
  require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
370
 
371
  $this->options['mark_broken_links'] = !empty($_POST['mark_broken_links']);
372
 
373
+ $this->options['delete_post_button'] = !empty($_POST['delete_post_button']);
374
+
375
  $this->options['exclusion_list']=array_filter(preg_split('/[\s,\r\n]+/',
376
  $_POST['exclusion_list']));
377
 
465
  </td>
466
  </tr>
467
 
468
+ <tr valign="top">
469
+ <th scope="row">"Delete Post" option:</th>
470
+ <td>
471
+
472
+ <input type="checkbox" name="delete_post_button" id="delete_post_button"
473
+ <?php if ($this->options['delete_post_button']) echo " checked='checked'"; ?>/>
474
+ <label for='delete_post_button'>
475
+ Display a "Delete Post" link in every row at the broken link list
476
+ (<em>Manage -&gt; Broken Links</em>). Not recommended.</label>
477
+
478
+ </td>
479
+ </tr>
480
+
481
  </table>
482
 
483
  <p class="submit"><input type="submit" name="Submit" value="Update Options &raquo;" /></p>
513
  <th scope="col">Link Text</th>
514
  <th scope="col">URL</th>
515
 
516
+ <th scope="col" colspan='<?php echo ($this->options['delete_post_button'])?'5':'4';x ?>'>Action</th>
517
 
518
  </tr>
519
  </thead>
531
  <td><a href='$link->url'>".$this->mytruncate($link->url)."</a></td>
532
  <td><a href='".($link->guid)."' class='edit'>View</a></td>
533
 
534
+ <td><a href='post.php?action=edit&amp;post=$link->post_id' class='edit'>Edit Post</a></td>";
535
+
536
+ //the ""Delete Post"" button - optional
537
+ if ($this->options['delete_post_button']){
538
+ $deletion_url = "post.php?action=delete&post=$link->post_id";
539
+ $deletion_url = wp_nonce_url($deletion_url, "delete-post_$link->post_id");
540
+ echo "<td><a href='$deletion_url'>Delete Post</a></td>";
541
+ }
542
+
543
+ echo "<td><a href='javascript:void(0);' class='delete' id='discard_button-$link->id'
544
  onclick='discardLinkMessage($link->id);return false;' );' title='Discard This Message'>Discard</a></td>
545
 
546
  <td><a href='javascript:void(0);' class='delete' id='unlink_button-$link->id'
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.3
6
- Stable tag: 0.3.4
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.5
6
+ Stable tag: 0.3.5
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