All 404 Redirect to Homepage - Version 2.1

Version Description

  • Bug Fixed
Download this release

Release Info

Developer osamaesh
Plugin Icon 128x128 All 404 Redirect to Homepage
Version 2.1
Comparing to
See all releases

Code changes from version 1.21 to 2.1

all-404-redirect-to-homepage.php CHANGED
@@ -3,8 +3,8 @@
3
  Plugin Name: All 404 Redirect to Homepage
4
  Plugin URI: http://www.clogica.com
5
  Description: a plugin to redirect 404 pages to home page or any custom page
6
- Author: Fakhri Alsadi
7
- Version: 1.21
8
  Author URI: http://www.clogica.com
9
  */
10
 
3
  Plugin Name: All 404 Redirect to Homepage
4
  Plugin URI: http://www.clogica.com
5
  Description: a plugin to redirect 404 pages to home page or any custom page
6
+ Author: wp-buy
7
+ Version: 2.1
8
  Author URI: http://www.clogica.com
9
  */
10
 
cf_dropdown.php CHANGED
@@ -3,10 +3,10 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
  if(!class_exists('p404redirect_dropdown')){
4
  class p404redirect_dropdown{
5
 
6
- private $name='drop';
7
- private $options='';
8
- private $class='';
9
- private $onchange='';
10
 
11
  public function __construct($str,$class='',$onchange='')
12
  {
@@ -22,20 +22,33 @@ public function __construct($str,$class='',$onchange='')
22
 
23
  public function add($name,$value)
24
  {
25
- $this->options=$this->options. "<option value='$value'>$name</option>";
 
 
 
26
  }
27
 
28
  public function dropdown_print()
29
  {
30
- if($this->onchange == '')
31
- echo "<select size='1' name='" . $this->name. "' id='" . $this->name. "' >" . $this->options . "</select>";
32
- else
33
- echo "<select size='1' name='" . $this->name. "' id='" . $this->name. "' onchange='" . $this->onchange . "' >" . $this->options . "</select>";
 
 
 
 
 
 
 
 
34
  }
35
 
36
  public function select($str)
37
  {
38
- echo "<script>document.getElementById('" . $this->name . "').value='".$str."'</script>";
 
 
39
  }
40
 
41
  public function data_bind($tbl,$name="name",$id="id",$where="",$order="",$limit="")
3
  if(!class_exists('p404redirect_dropdown')){
4
  class p404redirect_dropdown{
5
 
6
+ private $name = 'drop';
7
+ private $options = array();
8
+ private $class = '';
9
+ private $onchange = '';
10
 
11
  public function __construct($str,$class='',$onchange='')
12
  {
22
 
23
  public function add($name,$value)
24
  {
25
+ $this->options[] = array(
26
+ 'key'=>esc_html($value),
27
+ 'name'=>esc_html($name)
28
+ );
29
  }
30
 
31
  public function dropdown_print()
32
  {
33
+ ?>
34
+ <select size='1' name='<?php esc_attr_e($this->name);?>' <?php if($this->onchange != ''){?> onchange='<?php esc_attr_e($this->onchange);?>' <?php } ?> id='<?php esc_attr_e($this->name);?>'>
35
+ <?php
36
+ foreach($this->options as $options){
37
+ ?>
38
+ <option value="<?php esc_html_e($options['key']);?>"><?php esc_html_e($options['name']);?></option>
39
+ <?php
40
+ }
41
+ ?>
42
+ </select>
43
+ <?php
44
+
45
  }
46
 
47
  public function select($str)
48
  {
49
+ ?>
50
+ <script>document.getElementById('<?php echo esc_js($this->name);?>').value='<?php echo esc_js($str);?>'</script>
51
+ <?php
52
  }
53
 
54
  public function data_bind($tbl,$name="name",$id="id",$where="",$order="",$limit="")
functions.php CHANGED
@@ -11,9 +11,9 @@ function P404REDIRECT_after_plugin_row($plugin_file, $plugin_data, $status)
11
  {
12
  $class_name = $plugin_data['TextDomain']; // $plugin_data is an array retrived by default when you action this function after_plugin_row
13
 
14
- echo '<tr id="' .$class_name. '-plugin-update-tr" class="plugin-update-tr active">';
15
  echo '<td colspan="3" class="plugin-update">';
16
- echo '<div id="' .$class_name. '-upgradeMsg" class="update-message" style="background:#FFF8E5; padding-left:10px; border-left:#FFB900 solid 4px" >';
17
 
18
  echo '<span style="color:red">Have many broken links?</span>.<br />keep track of 404 errors using our powerfull <a target="_blank" href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin#404pluginspage">SEO Redirection Plugin</a> to show and fix all broken links & 404 errors that occur on your site. or ';
19
 
@@ -25,7 +25,7 @@ function P404REDIRECT_after_plugin_row($plugin_file, $plugin_data, $status)
25
  ?>
26
  <script type="text/javascript">
27
  jQuery(document).ready(function() {
28
- var row = jQuery('#<?php echo $class_name;?>-plugin-update-tr').closest('tr').prev();
29
  jQuery(row).addClass('update');
30
 
31
  jQuery("#HideMe").click(function(){
@@ -37,7 +37,7 @@ function P404REDIRECT_after_plugin_row($plugin_file, $plugin_data, $status)
37
  },
38
  success: function(data, textStatus, XMLHttpRequest){
39
 
40
- jQuery("#<?php echo $class_name;?>-upgradeMsg").hide();
41
 
42
  },
43
  error: function(MLHttpRequest, textStatus, errorThrown){
@@ -50,7 +50,7 @@ function P404REDIRECT_after_plugin_row($plugin_file, $plugin_data, $status)
50
  </script>
51
  <?php
52
  }
53
-
54
  function P404REDIRECT_get_current_URL()
55
  {
56
  $prt = $_SERVER['SERVER_PORT'];
@@ -72,48 +72,7 @@ function P404REDIRECT_get_current_URL()
72
 
73
  }
74
 
75
- //----------------------------------------------------
76
-
77
-
78
- function P404REDIRECT_get_current_parameters($remove_parameter="")
79
- {
80
-
81
- if($_SERVER['QUERY_STRING']!='')
82
- {
83
- $qry = '?' . urldecode($_SERVER['QUERY_STRING']);
84
-
85
- if(is_array($remove_parameter))
86
- {
87
- for($i=0;$i<count($remove_parameter);$i++)
88
- {
89
- if(array_key_exists($remove_parameter[$i],$_GET)){
90
- $string_remove = '&' . $remove_parameter[$i] . "=" . filter_var($_GET[$remove_parameter[$i]], FILTER_SANITIZE_URL);
91
- $qry=str_replace($string_remove,"",$qry);
92
- $string_remove = '?' . $remove_parameter[$i] . "=" . filter_var($_GET[$remove_parameter[$i]], FILTER_SANITIZE_URL);
93
- $qry=str_replace($string_remove,"",$qry);
94
- }
95
- }
96
-
97
- }else{
98
- if($remove_parameter!='')
99
- {
100
- if(array_key_exists($remove_parameter,$_GET)){
101
- $string_remove = '&' . $remove_parameter . "=" . filter_var($_GET[$remove_parameter], FILTER_SANITIZE_URL);
102
- $qry=str_replace($string_remove,"",$qry);
103
- $string_remove = '?' . $remove_parameter . "=" . filter_var($_GET[$remove_parameter], FILTER_SANITIZE_URL);
104
- $qry=str_replace($string_remove,"",$qry);
105
- }
106
- }
107
- }
108
-
109
- return strip_tags(filter_var($qry, FILTER_SANITIZE_URL));
110
- }else
111
- {
112
- return "";
113
- }
114
- }
115
-
116
- //-----------------------------------------------------
117
 
118
  function P404REDIRECT_init_my_options()
119
  {
@@ -193,38 +152,35 @@ function P404REDIRECT_get_my_options()
193
  }
194
 
195
  //----------------------------------------------------
196
-
197
  function P404REDIRECT_option_msg($msg)
198
  {
199
- echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
200
  }
201
 
202
  //----------------------------------------------------
203
-
204
  function P404REDIRECT_info_option_msg($msg)
205
  {
206
- echo '<div id="message" class="updated"><p><div class="info_icon"></div> ' . $msg . '</p></div>';
207
  }
208
 
209
  //----------------------------------------------------
210
-
211
  function P404REDIRECT_warning_option_msg($msg)
212
  {
213
- echo '<div id="message" class="error"><p><div class="warning_icon"></div> ' . $msg . '</p></div>';
214
  }
215
 
216
  //----------------------------------------------------
217
 
218
  function P404REDIRECT_success_option_msg($msg)
219
  {
220
- echo '<div id="message" class="updated"><p><div class="success_icon"></div> ' . $msg . '</p></div>';
221
  }
222
 
223
  //----------------------------------------------------
224
 
225
  function P404REDIRECT_failure_option_msg($msg)
226
  {
227
- echo '<div id="message" class="error"><p><div class="failure_icon"></div> ' . $msg . '</p></div>';
228
  }
229
 
230
 
11
  {
12
  $class_name = $plugin_data['TextDomain']; // $plugin_data is an array retrived by default when you action this function after_plugin_row
13
 
14
+ echo '<tr id="' .esc_attr($class_name). '-plugin-update-tr" class="plugin-update-tr active">';
15
  echo '<td colspan="3" class="plugin-update">';
16
+ echo '<div id="' .esc_attr($class_name). '-upgradeMsg" class="update-message" style="background:#FFF8E5; padding-left:10px; border-left:#FFB900 solid 4px" >';
17
 
18
  echo '<span style="color:red">Have many broken links?</span>.<br />keep track of 404 errors using our powerfull <a target="_blank" href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin#404pluginspage">SEO Redirection Plugin</a> to show and fix all broken links & 404 errors that occur on your site. or ';
19
 
25
  ?>
26
  <script type="text/javascript">
27
  jQuery(document).ready(function() {
28
+ var row = jQuery('#<?php echo esc_attr($class_name);?>-plugin-update-tr').closest('tr').prev();
29
  jQuery(row).addClass('update');
30
 
31
  jQuery("#HideMe").click(function(){
37
  },
38
  success: function(data, textStatus, XMLHttpRequest){
39
 
40
+ jQuery("#<?php echo esc_attr($class_name);?>-upgradeMsg").hide();
41
 
42
  },
43
  error: function(MLHttpRequest, textStatus, errorThrown){
50
  </script>
51
  <?php
52
  }
53
+
54
  function P404REDIRECT_get_current_URL()
55
  {
56
  $prt = $_SERVER['SERVER_PORT'];
72
 
73
  }
74
 
75
+ //----------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
  function P404REDIRECT_init_my_options()
78
  {
152
  }
153
 
154
  //----------------------------------------------------
 
155
  function P404REDIRECT_option_msg($msg)
156
  {
157
+ echo '<div id="message" class="updated"><p>' . esc_attr($msg) . '</p></div>';
158
  }
159
 
160
  //----------------------------------------------------
 
161
  function P404REDIRECT_info_option_msg($msg)
162
  {
163
+ echo '<div id="message" class="updated"><p><div class="info_icon"></div> ' . esc_attr($msg) . '</p></div>';
164
  }
165
 
166
  //----------------------------------------------------
 
167
  function P404REDIRECT_warning_option_msg($msg)
168
  {
169
+ echo '<div id="message" class="error"><p><div class="warning_icon"></div> ' . esc_attr($msg) . '</p></div>';
170
  }
171
 
172
  //----------------------------------------------------
173
 
174
  function P404REDIRECT_success_option_msg($msg)
175
  {
176
+ echo '<div id="message" class="updated"><p><div class="success_icon"></div> ' . esc_attr($msg) . '</p></div>';
177
  }
178
 
179
  //----------------------------------------------------
180
 
181
  function P404REDIRECT_failure_option_msg($msg)
182
  {
183
+ echo '<div id="message" class="error"><p><div class="failure_icon"></div> ' . esc_attr($msg) . '</p></div>';
184
  }
185
 
186
 
option_page.php CHANGED
@@ -76,7 +76,7 @@ if($tab == "options"){
76
  <br/><br/>
77
 
78
  Redirect all 404 pages to:
79
- <input type="text" name="redirect_to" id="redirect_to" size="30" value="<?php echo $options['p404_redirect_to']?>">
80
 
81
  <br/>
82
  <input type="hidden" id="_wpnonce" name="_wpnonce" value="<?php echo $nonce = wp_create_nonce('p404home_nounce'); ?>" />
@@ -89,7 +89,7 @@ if($tab == "options"){
89
  <div>
90
 
91
  <hr/>
92
- <b style="color:red"><?php echo P404REDIRECT_read_option_value('links',0);?></b> URLs redirected since the plugin install in <?php echo P404REDIRECT_read_option_value('install_date',date("Y-m-d h:i a"));?>
93
  <hr/>
94
  <b>Latest 20 URLs Redirected: </b><br/><br/>
95
 
@@ -130,18 +130,6 @@ if(count($links)==0){
130
  }
131
  // ---- End of Tabs ----------------
132
  ?>
133
-
134
  <br/>
135
  <b style="color:red">Have many broken links?</b> keep track of 404 errors using our powerfull <a target="_blank" href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin#404-options-page">SEO Redirection Plugin</a> with an advanced <b>404 Manager</b> and set many rules to handle 404 links
136
-
137
- </div></div></div>
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
76
  <br/><br/>
77
 
78
  Redirect all 404 pages to:
79
+ <input type="text" name="redirect_to" id="redirect_to" size="30" value="<?php echo esc_attr($options['p404_redirect_to']);?>">
80
 
81
  <br/>
82
  <input type="hidden" id="_wpnonce" name="_wpnonce" value="<?php echo $nonce = wp_create_nonce('p404home_nounce'); ?>" />
89
  <div>
90
 
91
  <hr/>
92
+ <b style="color:red"><?php echo esc_attr(P404REDIRECT_read_option_value('links',0));?></b> URLs redirected since the plugin install in <?php echo esc_attr(P404REDIRECT_read_option_value('install_date',date("Y-m-d h:i a")));?>
93
  <hr/>
94
  <b>Latest 20 URLs Redirected: </b><br/><br/>
95
 
130
  }
131
  // ---- End of Tabs ----------------
132
  ?>
 
133
  <br/>
134
  <b style="color:red">Have many broken links?</b> keep track of 404 errors using our powerfull <a target="_blank" href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin#404-options-page">SEO Redirection Plugin</a> with an advanced <b>404 Manager</b> and set many rules to handle 404 links
135
+ </div></div></div>
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === All 404 Redirect to Homepage ===
2
- Contributors: fakhris
3
  Tags: 404 error, redirection, homepage, redirection, https, automatic redirection, 404 link,redirect, soft 404, redirected, 301 seo redirect, post redirect plugin, broken links, fix 404
4
  Requires at least: 3.5
5
  Tested up to: 5.8
6
- Stable tag: 1.21
7
 
8
  By using this smart plugin, you can fix all 404 error links by redirecting them to homepage using the SEO 301 redirection. Improve your visibility in search engines now..
9
 
@@ -33,6 +33,9 @@ Extract the zip file and just drop the contents in the wp-content/plugins/ direc
33
 
34
 
35
  == Changelog ==
 
 
 
36
  = 1.21 =
37
  * Bug Fixed
38
 
1
  === All 404 Redirect to Homepage ===
2
+ Contributors: wp-buy, osama.esh
3
  Tags: 404 error, redirection, homepage, redirection, https, automatic redirection, 404 link,redirect, soft 404, redirected, 301 seo redirect, post redirect plugin, broken links, fix 404
4
  Requires at least: 3.5
5
  Tested up to: 5.8
6
+ Stable tag: 2.1
7
 
8
  By using this smart plugin, you can fix all 404 error links by redirecting them to homepage using the SEO 301 redirection. Improve your visibility in search engines now..
9
 
33
 
34
 
35
  == Changelog ==
36
+ = 2.1 =
37
+ * Bug Fixed
38
+
39
  = 1.21 =
40
  * Bug Fixed
41