Broken Link Checker - Version 0.5.5

Version Description

Download this release

Release Info

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

Code changes from version 0.5.4 to 0.5.5

Files changed (4) hide show
  1. broken-link-checker.php +1 -1
  2. link-classes.php +1 -1
  3. readme.txt +1 -1
  4. utility-class.php +19 -3
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.5.4
7
  Author: Janis Elsts
8
  Author URI: http://w-shadow.com/blog/
9
  */
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.5.5
7
  Author: Janis Elsts
8
  Author URI: http://w-shadow.com/blog/
9
  */
link-classes.php CHANGED
@@ -145,7 +145,7 @@ class blcLink {
145
  //******* Use CURL if available ***********
146
  if ( function_exists('curl_init') ) {
147
  $ch = curl_init();
148
- curl_setopt($ch, CURLOPT_URL, $url);
149
  //Masquerade as Internet explorer
150
  curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
151
  //Add a semi-plausible referer header to avoid tripping up some bot traps
145
  //******* Use CURL if available ***********
146
  if ( function_exists('curl_init') ) {
147
  $ch = curl_init();
148
+ curl_setopt($ch, CURLOPT_URL, blcUtility::urlencodefix($url));
149
  //Masquerade as Internet explorer
150
  curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
151
  //Add a semi-plausible referer header to avoid tripping up some bot traps
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: whiteshadow
3
  Tags: links, broken, maintenance, blogroll, custom fields, admin
4
  Requires at least: 2.7.0
5
  Tested up to: 2.9
6
- Stable tag: 0.5.4
7
 
8
  This plugin will check your posts, custom fields and the blogroll for broken links and missing images and notify you on the dashboard if any are found.
9
 
3
  Tags: links, broken, maintenance, blogroll, custom fields, admin
4
  Requires at least: 2.7.0
5
  Tested up to: 2.9
6
+ Stable tag: 0.5.5
7
 
8
  This plugin will check your posts, custom fields and the blogroll for broken links and missing images and notify you on the dashboard if any are found.
9
 
utility-class.php CHANGED
@@ -12,7 +12,7 @@ if (!function_exists('json_encode')){
12
  require 'JSON.php';
13
  }
14
 
15
- //Backwards fompatible json_encode.
16
  function json_encode($data) {
17
  $json = new Services_JSON();
18
  return( $json->encode($data) );
@@ -26,13 +26,13 @@ class blcUtility {
26
  //A regxp for images
27
  function img_pattern(){
28
  // \1 \2 \3 URL \4
29
- return '/(<img[\s]+[^>]*src\s*=\s*)([\"\']?)([^\'\">]+)\2([^<>]*>)/i';
30
  }
31
 
32
  //A regexp for links
33
  function link_pattern(){
34
  // \1 \2 \3 URL \4 \5 Text \6
35
- return '/(<a[\s]+[^>]*href\s*=\s*)([\"\']+)([^\'\">]+)\2([^<>]*>)((?sU).*)(<\/a>)/i';
36
  }
37
 
38
  /**
@@ -132,6 +132,22 @@ class blcUtility {
132
 
133
  return $url;
134
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
 
136
  }//class
137
 
12
  require 'JSON.php';
13
  }
14
 
15
+ //Backwards compatible json_encode.
16
  function json_encode($data) {
17
  $json = new Services_JSON();
18
  return( $json->encode($data) );
26
  //A regxp for images
27
  function img_pattern(){
28
  // \1 \2 \3 URL \4
29
+ return '/(<img[\s]+[^>]*src\s*=\s*)([\"\'])([^\2>]+?)\2([^<>]*>)/i';
30
  }
31
 
32
  //A regexp for links
33
  function link_pattern(){
34
  // \1 \2 \3 URL \4 \5 Text \6
35
+ return '/(<a[\s]+[^>]*href\s*=\s*)([\"\'])([^\2>]+?)\2([^<>]*>)((?sU).*)(<\/a>)/i';
36
  }
37
 
38
  /**
132
 
133
  return $url;
134
  }
135
+
136
+
137
+ /**
138
+ * blcUtility::urlencodefix()
139
+ * Takes an URL and replaces spaces and some other non-alphanumeric characters with their urlencoded equivalents.
140
+ *
141
+ * @param string $str
142
+ * @return string
143
+ */
144
+ function urlencodefix($url){
145
+ return preg_replace_callback(
146
+ '|[^a-z0-9\+\-\/\\#:.=?&%@]|i',
147
+ create_function('$str','return rawurlencode($str[0]);'),
148
+ $url
149
+ );
150
+ }
151
 
152
  }//class
153