Broken Link Checker - Version 0.2.4

Version Description

Download this release

Release Info

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

Code changes from version 0.2.3 to 0.2.4

Files changed (3) hide show
  1. broken-link-checker.php +2 -2
  2. readme.txt +1 -1
  3. wsblc_ajax.php +27 -4
broken-link-checker.php CHANGED
@@ -3,7 +3,7 @@
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
  */
@@ -20,7 +20,7 @@ class 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='';
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.4
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.2.4';
24
  var $myfile='';
25
  var $myfolder='';
26
  var $mybasename='';
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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
 
3
  Tags: links, broken, maintenance
4
  Requires at least: 2.0.2
5
  Tested up to: 2.3.1
6
+ Stable tag: 0.2.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
 
wsblc_ajax.php CHANGED
@@ -5,7 +5,7 @@
5
  require_once("../../../wp-config.php");
6
  require_once("../../../wp-includes/wp-db.php");
7
 
8
- error_reporting(E_ALL);
9
 
10
  $execution_start_time=microtime(true);
11
 
@@ -14,8 +14,10 @@
14
  return microtime(true)-$execution_start_time;
15
  }
16
 
17
- @set_time_limit(0);
18
- @ignore_user_abort(true);
 
 
19
 
20
  $url_pattern='/(<a[\s]+[^>]*href\s*=\s*[\"\']?)([^\'\" >]+)([\'\"]+[^<>]*>)((?sU).*)(<\/a>)/i';
21
 
@@ -26,6 +28,18 @@
26
  $siteurl=get_option('siteurl');
27
  $max_execution_time=isset($options['max_work_session'])?intval($options['max_work_session']):27;
28
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  $check_treshold=date('Y-m-d H:i:s', strtotime('-'.$options['check_treshold'].' hours'));
30
  $recheck_treshold=date('Y-m-d H:i:s', strtotime('-20 minutes'));
31
 
@@ -226,11 +240,13 @@
226
  curl_setopt($ch, CURLOPT_TIMEOUT, 25);
227
 
228
  curl_setopt($ch, CURLOPT_FAILONERROR, false);
229
-
 
230
  if($parts['scheme']=='https'){
231
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
232
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
233
  } else {
 
234
  curl_setopt($ch, CURLOPT_NOBODY, true);
235
  }
236
  curl_setopt($ch, CURLOPT_HEADER, true);
@@ -238,6 +254,13 @@
238
  $response = curl_exec($ch);
239
  $code=intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
240
 
 
 
 
 
 
 
 
241
  curl_close($ch);
242
 
243
  return (($code>=200) && ($code<400));
5
  require_once("../../../wp-config.php");
6
  require_once("../../../wp-includes/wp-db.php");
7
 
8
+ //error_reporting(E_ALL);
9
 
10
  $execution_start_time=microtime(true);
11
 
14
  return microtime(true)-$execution_start_time;
15
  }
16
 
17
+
18
+ if(!is_object($ws_link_checker)) {
19
+ die('Fatal error : undefined object; plugin may not be active.');
20
+ };
21
 
22
  $url_pattern='/(<a[\s]+[^>]*href\s*=\s*[\"\']?)([^\'\" >]+)([\'\"]+[^<>]*>)((?sU).*)(<\/a>)/i';
23
 
28
  $siteurl=get_option('siteurl');
29
  $max_execution_time=isset($options['max_work_session'])?intval($options['max_work_session']):27;
30
 
31
+ // Check for safe mode
32
+ if( ini_get('safe_mode') ){
33
+ // Do it the safe mode way
34
+ $t=ini_get('max_execution_time');
35
+ if ($t && ($t < $max_execution_time))
36
+ $max_execution_time = $t-1;
37
+ } else {
38
+ // Do it the regular way
39
+ @set_time_limit(0);
40
+ }
41
+ @ignore_user_abort(true);
42
+
43
  $check_treshold=date('Y-m-d H:i:s', strtotime('-'.$options['check_treshold'].' hours'));
44
  $recheck_treshold=date('Y-m-d H:i:s', strtotime('-20 minutes'));
45
 
240
  curl_setopt($ch, CURLOPT_TIMEOUT, 25);
241
 
242
  curl_setopt($ch, CURLOPT_FAILONERROR, false);
243
+
244
+ $nobody=false;
245
  if($parts['scheme']=='https'){
246
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
247
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
248
  } else {
249
+ $nobody=true;
250
  curl_setopt($ch, CURLOPT_NOBODY, true);
251
  }
252
  curl_setopt($ch, CURLOPT_HEADER, true);
254
  $response = curl_exec($ch);
255
  $code=intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
256
 
257
+ if ( (($code<200) || ($code>=400)) && $nobody) {
258
+ curl_setopt($ch, CURLOPT_NOBODY, false);
259
+ curl_setopt($ch, CURLOPT_HTTPGET, true);
260
+ $response = curl_exec($ch);
261
+ $code=intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
262
+ }
263
+
264
  curl_close($ch);
265
 
266
  return (($code>=200) && ($code<400));