Link Juice Keeper - Version 1.2.3

Version Description

  • Marked as compatible with WP 3.2.x
Download this release

Release Info

Developer sirzooro
Plugin Icon 128x128 Link Juice Keeper
Version 1.2.3
Comparing to
See all releases

Code changes from version 1.2.2 to 1.2.3

Files changed (3) hide show
  1. link-juice-keeper.php +42 -40
  2. readme.html +6 -2
  3. readme.txt +5 -2
link-juice-keeper.php CHANGED
@@ -4,16 +4,16 @@ Plugin Name: Link Juice Keeper
4
  Plugin URI: http://www.poradnik-webmastera.com/projekty/link_juice_keeper/
5
  Description: This plugin helps you to keep the link juice by redirecting all non-existing URLs which normally return a 404 error to the front blog page using 301 redirect.
6
  Author: Daniel Frużyński
7
- Version: 1.2.2
8
  Author URI: http://www.poradnik-webmastera.com/
 
9
  */
10
 
11
- /* Copyright 2009 Daniel Frużyński (email : daniel [A-T] poradnik-webmastera.com)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
- it under the terms of the GNU General Public License as published by
15
- the Free Software Foundation; either version 2 of the License, or
16
- (at your option) any later version.
17
 
18
  This program is distributed in the hope that it will be useful,
19
  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,46 +26,48 @@ Author URI: http://www.poradnik-webmastera.com/
26
  */
27
 
28
 
29
- if ( !class_exists( 'LinkJuiceKeeper' ) ) {
30
- class LinkJuiceKeeper {
31
- // Constructor
32
- function LinkJuiceKeeper() {
33
-
34
- //add_action( 'init', array( &$this, 'init' ) );
35
-
36
- add_filter( 'status_header', array( &$this, 'status_header' ), 100, 2 );
37
- }
38
 
39
- /*// Initialise plugin
40
- function init() {
41
- if ( function_exists( 'load_plugin_textdomain' ) ) {
42
- load_plugin_textdomain( 'link-juice-keeper', PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)) );
43
- }
44
- }*/
45
 
46
- function status_header( $status_header, $header ) {
47
- if ( $header == 404 ) {
48
- // Extract root dir from blog url
49
- $root = '/';
50
- if ( preg_match( '#^http://[^/]+(/.+)$#', get_option( 'siteurl' ), $matches ) ) {
51
- $root = $matches[1];
52
- }
53
- // Make sure it ends with slash
54
- if ( $root[ strlen($root) - 1 ] != '/' ) {
55
- $root .= '/';
56
- }
57
- // Check if request is not for GWT verification file
58
- if ( strpos( $_SERVER['REQUEST_URI'], $root.'noexist_' ) !== 0 ) {
59
- wp_redirect( get_bloginfo( 'siteurl' ) , 301 );
60
- exit();
61
- }
 
 
 
 
 
 
 
 
 
62
  }
63
-
64
- return $status_header;
65
  }
 
 
66
  }
67
-
68
- $wp_link_juice_keeper = new LinkJuiceKeeper();
69
  }
70
 
 
 
 
 
71
  ?>
4
  Plugin URI: http://www.poradnik-webmastera.com/projekty/link_juice_keeper/
5
  Description: This plugin helps you to keep the link juice by redirecting all non-existing URLs which normally return a 404 error to the front blog page using 301 redirect.
6
  Author: Daniel Frużyński
7
+ Version: 1.2.3
8
  Author URI: http://www.poradnik-webmastera.com/
9
+ License: GPL2
10
  */
11
 
12
+ /* Copyright 2009,2011 Daniel Frużyński (email : daniel [A-T] poradnik-webmastera.com)
13
 
14
  This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License, version 2, as
16
+ published by the Free Software Foundation.
 
17
 
18
  This program is distributed in the hope that it will be useful,
19
  but WITHOUT ANY WARRANTY; without even the implied warranty of
26
  */
27
 
28
 
29
+ if ( !class_exists( 'LinkJuiceKeeper' ) || ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ) {
30
+
31
+ class LinkJuiceKeeper {
32
+ // Constructor
33
+ function LinkJuiceKeeper() {
 
 
 
 
34
 
35
+ //add_action( 'init', array( &$this, 'init' ) );
 
 
 
 
 
36
 
37
+ add_filter( 'status_header', array( &$this, 'status_header' ), 100, 2 );
38
+ }
39
+
40
+ /*// Initialise plugin
41
+ function init() {
42
+ if ( function_exists( 'load_plugin_textdomain' ) ) {
43
+ load_plugin_textdomain( 'link-juice-keeper', PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)) );
44
+ }
45
+ }*/
46
+
47
+ function status_header( $status_header, $header ) {
48
+ if ( $header == 404 ) {
49
+ // Extract root dir from blog url
50
+ $root = '/';
51
+ if ( preg_match( '#^http://[^/]+(/.+)$#', get_option( 'siteurl' ), $matches ) ) {
52
+ $root = $matches[1];
53
+ }
54
+ // Make sure it ends with slash
55
+ if ( $root[ strlen($root) - 1 ] != '/' ) {
56
+ $root .= '/';
57
+ }
58
+ // Check if request is not for GWT verification file
59
+ if ( strpos( $_SERVER['REQUEST_URI'], $root.'noexist_' ) !== 0 ) {
60
+ wp_redirect( get_bloginfo( 'siteurl' ) , 301 );
61
+ exit();
62
  }
 
 
63
  }
64
+
65
+ return $status_header;
66
  }
 
 
67
  }
68
 
69
+ $wp_link_juice_keeper = new LinkJuiceKeeper();
70
+
71
+ } // END
72
+
73
  ?>
readme.html CHANGED
@@ -2,10 +2,10 @@
2
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
  <head>
4
  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
5
- <title>Link Juice Keeper 1.2.2 Readme</title>
6
  </head>
7
  <body>
8
- <h1>Link Juice Keeper 1.2.2 Readme</h1>
9
  <p>This plugin helps you to keep the link juice by redirecting all non-existing URLs which normally return a 404 error to the blog front page using 301 redirect.</p>
10
  <p><b>Plugin Homepage:</b> <a href="http://www.poradnik-webmastera.com/projekty/link_juice_keeper/">Link Juice Keeper</a></p>
11
  <p><b>Plugin Homepage on WordPress.org:</b> <a href="http://wordpress.org/extend/plugins/link-juice-keeper/">Link Juice Keeper</a></p>
@@ -31,6 +31,10 @@
31
  </ol>
32
 
33
  <h2>Changelog</h2>
 
 
 
 
34
  <p>1.2.2</p>
35
  <ul>
36
  <li>Marked as compatible with WP 2.9.x</li>
2
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
  <head>
4
  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
5
+ <title>Link Juice Keeper 1.2.3 Readme</title>
6
  </head>
7
  <body>
8
+ <h1>Link Juice Keeper 1.2.3 Readme</h1>
9
  <p>This plugin helps you to keep the link juice by redirecting all non-existing URLs which normally return a 404 error to the blog front page using 301 redirect.</p>
10
  <p><b>Plugin Homepage:</b> <a href="http://www.poradnik-webmastera.com/projekty/link_juice_keeper/">Link Juice Keeper</a></p>
11
  <p><b>Plugin Homepage on WordPress.org:</b> <a href="http://wordpress.org/extend/plugins/link-juice-keeper/">Link Juice Keeper</a></p>
31
  </ol>
32
 
33
  <h2>Changelog</h2>
34
+ <p>1.2.3</p>
35
+ <ul>
36
+ <li>Marked as compatible with WP 3.2.x</li>
37
+ </ul>
38
  <p>1.2.2</p>
39
  <ul>
40
  <li>Marked as compatible with WP 2.9.x</li>
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: sirzooro
3
  Tags: google, link, links, redirect, seo
4
  Requires at least: 2.2
5
- Tested up to: 2.9.9
6
- Stable tag: 1.2.2
7
 
8
  This plugin helps you to keep the link juice by redirecting all non-existing URLs (they return error 404) to the blog front page using 301 redirect.
9
 
@@ -30,6 +30,9 @@ The only one exception are files in root blog directory with names starting with
30
 
31
  == Changelog ==
32
 
 
 
 
33
  = 1.2.2 =
34
  * Marked as compatible with WP 2.9.x
35
 
2
  Contributors: sirzooro
3
  Tags: google, link, links, redirect, seo
4
  Requires at least: 2.2
5
+ Tested up to: 3.2.9
6
+ Stable tag: 1.2.3
7
 
8
  This plugin helps you to keep the link juice by redirecting all non-existing URLs (they return error 404) to the blog front page using 301 redirect.
9
 
30
 
31
  == Changelog ==
32
 
33
+ = 1.2.3 =
34
+ * Marked as compatible with WP 3.2.x
35
+
36
  = 1.2.2 =
37
  * Marked as compatible with WP 2.9.x
38