Version Description
Download this release
Release Info
Developer | whiteshadow |
Plugin | Broken Link Checker |
Version | 0.5.6 |
Comparing to | |
See all releases |
Code changes from version 0.5.5 to 0.5.6
- broken-link-checker.php +4 -3
- readme.txt +1 -1
- utility-class.php +5 -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.
|
7 |
Author: Janis Elsts
|
8 |
Author URI: http://w-shadow.com/blog/
|
9 |
*/
|
@@ -1398,6 +1398,7 @@ jQuery(function($){
|
|
1398 |
function parse_post($content, $post_id){
|
1399 |
//remove all <code></code> blocks first
|
1400 |
$content = preg_replace('/<code>.+?<\/code>/i', ' ', $content);
|
|
|
1401 |
|
1402 |
//Find links
|
1403 |
if(preg_match_all(blcUtility::link_pattern(), $content, $matches, PREG_SET_ORDER)){
|
@@ -1406,7 +1407,7 @@ jQuery(function($){
|
|
1406 |
$text = strip_tags( $link[5] );
|
1407 |
//FB::log($url, "Found link");
|
1408 |
|
1409 |
-
$url = blcUtility::normalize_url($url);
|
1410 |
//Skip invalid links
|
1411 |
if ( !$url || (strlen($url)<6) ) continue;
|
1412 |
|
@@ -1423,7 +1424,7 @@ jQuery(function($){
|
|
1423 |
$url = $img[3];
|
1424 |
//FB::log($url, "Found image");
|
1425 |
|
1426 |
-
$url = blcUtility::normalize_url($url);
|
1427 |
if ( !$url || (strlen($url)<6) ) continue; //skip invalid URLs
|
1428 |
|
1429 |
//Create or load the link
|
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.6
|
7 |
Author: Janis Elsts
|
8 |
Author URI: http://w-shadow.com/blog/
|
9 |
*/
|
1398 |
function parse_post($content, $post_id){
|
1399 |
//remove all <code></code> blocks first
|
1400 |
$content = preg_replace('/<code>.+?<\/code>/i', ' ', $content);
|
1401 |
+
$permalink = get_permalink( $post_id );
|
1402 |
|
1403 |
//Find links
|
1404 |
if(preg_match_all(blcUtility::link_pattern(), $content, $matches, PREG_SET_ORDER)){
|
1407 |
$text = strip_tags( $link[5] );
|
1408 |
//FB::log($url, "Found link");
|
1409 |
|
1410 |
+
$url = blcUtility::normalize_url($url, $permalink);
|
1411 |
//Skip invalid links
|
1412 |
if ( !$url || (strlen($url)<6) ) continue;
|
1413 |
|
1424 |
$url = $img[3];
|
1425 |
//FB::log($url, "Found image");
|
1426 |
|
1427 |
+
$url = blcUtility::normalize_url($url, $permalink);
|
1428 |
if ( !$url || (strlen($url)<6) ) continue; //skip invalid URLs
|
1429 |
|
1430 |
//Create or load the link
|
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.
|
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.6
|
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
@@ -39,9 +39,10 @@ class blcUtility {
|
|
39 |
* blcUtility::normalize_url()
|
40 |
*
|
41 |
* @param string $url
|
|
|
42 |
* @return string A normalized URL or FALSE if the URL is invalid
|
43 |
*/
|
44 |
-
function normalize_url($url){
|
45 |
$parts=@parse_url($url);
|
46 |
if(!$parts) return false;
|
47 |
|
@@ -64,9 +65,10 @@ class blcUtility {
|
|
64 |
$url=trim($url);
|
65 |
|
66 |
if($url=='') return false;
|
67 |
-
|
68 |
// turn relative URLs into absolute URLs
|
69 |
-
$
|
|
|
70 |
return $url;
|
71 |
}
|
72 |
|
39 |
* blcUtility::normalize_url()
|
40 |
*
|
41 |
* @param string $url
|
42 |
+
* @params string $base_url (Optional) The base URL is used to convert a relative URL to a fully-qualified one
|
43 |
* @return string A normalized URL or FALSE if the URL is invalid
|
44 |
*/
|
45 |
+
function normalize_url($url, $base_url = ''){
|
46 |
$parts=@parse_url($url);
|
47 |
if(!$parts) return false;
|
48 |
|
65 |
$url=trim($url);
|
66 |
|
67 |
if($url=='') return false;
|
68 |
+
|
69 |
// turn relative URLs into absolute URLs
|
70 |
+
if ( empty($base_url) ) $base_url = get_option('siteurl');
|
71 |
+
$url = blcUtility::relative2absolute( $base_url, $url);
|
72 |
return $url;
|
73 |
}
|
74 |
|