404 to 301 - Version 3.1.1

Version Description

(15/11/2021) = ** Improvements**

  • Security checks and improvements.
Download this release

Release Info

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

Code changes from version 3.1.0 to 3.1.1

404-to-301.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: 404 to 301 - Redirect, Log and Notify 404 Errors
4
  * Plugin URI: https://duckdev.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: 3.1.0
7
  * Author: Joel James
8
  * Author URI: https://duckdev.com/
9
  * Donate link: https://paypal.me/JoelCJ
@@ -44,7 +44,7 @@ define( 'JJ4T3_URL', plugin_dir_url( __FILE__ ) );
44
  // Define plugin base file.
45
  define( 'JJ4T3_BASE_FILE', __FILE__ );
46
  // Define plugin version.
47
- define( 'JJ4T3_VERSION', '3.1.0' );
48
  // Define plugin version.
49
  define( 'JJ4T3_DB_VERSION', '11.0' );
50
  // Define plugin log table.
3
  * Plugin Name: 404 to 301 - Redirect, Log and Notify 404 Errors
4
  * Plugin URI: https://duckdev.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: 3.1.1
7
  * Author: Joel James
8
  * Author URI: https://duckdev.com/
9
  * Donate link: https://paypal.me/JoelCJ
44
  // Define plugin base file.
45
  define( 'JJ4T3_BASE_FILE', __FILE__ );
46
  // Define plugin version.
47
+ define( 'JJ4T3_VERSION', '3.1.1' );
48
  // Define plugin version.
49
  define( 'JJ4T3_DB_VERSION', '11.0' );
50
  // Define plugin log table.
assets/css/admin.min.css CHANGED
@@ -1 +1,86 @@
1
  .jj4t3-url-p{color:#e53531!important}.jj4t3-fixed-height{height:120px;margin-bottom:20px;overflow:auto;padding:0 20px 0 0}.jj4t3-notice{padding:10px}.jj4t3-p-desc{font-size:13px!important}.jj4t3-h2{font-size:23px;line-height:29px;font-weight:700!important}h2 .subtitle a{text-decoration:none}.jj4t3-hide{display:none}.jj4t3-handle{cursor:default!important}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  .jj4t3-url-p{color:#e53531!important}.jj4t3-fixed-height{height:120px;margin-bottom:20px;overflow:auto;padding:0 20px 0 0}.jj4t3-notice{padding:10px}.jj4t3-p-desc{font-size:13px!important}.jj4t3-h2{font-size:23px;line-height:29px;font-weight:700!important}h2 .subtitle a{text-decoration:none}.jj4t3-hide{display:none}.jj4t3-handle{cursor:default!important}
2
+ ts;
3
+ /******/ }
4
+ /******/ // Create a new module (and put it into the cache)
5
+ /******/ var module = installedModules[moduleId] = {
6
+ /******/ i: moduleId,
7
+ /******/ l: false,
8
+ /******/ exports: {}
9
+ /******/ };
10
+ /******/
11
+ /******/ // Execute the module function
12
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
13
+ /******/
14
+ /******/ // Flag the module as loaded
15
+ /******/ module.l = true;
16
+ /******/
17
+ /******/ // Return the exports of the module
18
+ /******/ return module.exports;
19
+ /******/ }
20
+ /******/
21
+ /******/
22
+ /******/ // expose the modules object (__webpack_modules__)
23
+ /******/ __webpack_require__.m = modules;
24
+ /******/
25
+ /******/ // expose the module cache
26
+ /******/ __webpack_require__.c = installedModules;
27
+ /******/
28
+ /******/ // define getter function for harmony exports
29
+ /******/ __webpack_require__.d = function(exports, name, getter) {
30
+ /******/ if(!__webpack_require__.o(exports, name)) {
31
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
32
+ /******/ }
33
+ /******/ };
34
+ /******/
35
+ /******/ // define __esModule on exports
36
+ /******/ __webpack_require__.r = function(exports) {
37
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
38
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
39
+ /******/ }
40
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
41
+ /******/ };
42
+ /******/
43
+ /******/ // create a fake namespace object
44
+ /******/ // mode & 1: value is a module id, require it
45
+ /******/ // mode & 2: merge all properties of value into the ns
46
+ /******/ // mode & 4: return value when already ns object
47
+ /******/ // mode & 8|1: behave like require
48
+ /******/ __webpack_require__.t = function(value, mode) {
49
+ /******/ if(mode & 1) value = __webpack_require__(value);
50
+ /******/ if(mode & 8) return value;
51
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
52
+ /******/ var ns = Object.create(null);
53
+ /******/ __webpack_require__.r(ns);
54
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
55
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
56
+ /******/ return ns;
57
+ /******/ };
58
+ /******/
59
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
60
+ /******/ __webpack_require__.n = function(module) {
61
+ /******/ var getter = module && module.__esModule ?
62
+ /******/ function getDefault() { return module['default']; } :
63
+ /******/ function getModuleExports() { return module; };
64
+ /******/ __webpack_require__.d(getter, 'a', getter);
65
+ /******/ return getter;
66
+ /******/ };
67
+ /******/
68
+ /******/ // Object.prototype.hasOwnProperty.call
69
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
70
+ /******/
71
+ /******/ // __webpack_public_path__
72
+ /******/ __webpack_require__.p = "";
73
+ /******/
74
+ /******/
75
+ /******/ // Load entry module and return exports
76
+ /******/ return __webpack_require__(__webpack_require__.s = 0);
77
+ /******/ })
78
+ /************************************************************************/
79
+ /******/ ([
80
+ /* 0 */
81
+ /***/ (function(module, exports, __webpack_require__) {
82
+
83
+ // extracted by mini-css-extract-plugin
84
+
85
+ /***/ })
86
+ /******/ ]);
includes/admin/class-jj4t3-admin.php CHANGED
@@ -8,12 +8,12 @@ defined( 'ABSPATH' ) or exit;
8
  *
9
  * Register all hooks related to admin area of the website.
10
  *
11
- * @category Core
12
- * @package JJ4T3
13
- * @subpackage Admin
14
  * @author Joel James <mail@cjoel.com>
15
  * @license http://www.gnu.org/licenses/ GNU General Public License
 
16
  * @link https://duckdev.com/products/404-to-301/
 
 
17
  */
18
  class JJ4T3_Admin {
19
 
@@ -87,19 +87,24 @@ class JJ4T3_Admin {
87
  * @return void
88
  */
89
  public function styles() {
90
-
91
  global $pagenow;
92
 
93
- // Use minified assets if SCRIPT_DEBUG is turned off.
94
- $file = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? 'assets/src/css/admin.css' : 'assets/css/admin.min.css';
95
-
96
- if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && in_array( $_GET['page'], array(
97
  'jj4t3-settings',
98
  'jj4t3-logs',
99
- ) )
 
 
100
  ) {
101
-
102
- wp_enqueue_style( JJ4T3_NAME, JJ4T3_URL . $file, array(), JJ4T3_VERSION, 'all' );
 
 
 
 
 
103
  }
104
  }
105
 
@@ -113,27 +118,32 @@ class JJ4T3_Admin {
113
  * @since 2.0.0
114
  * @access public
115
  *
116
- * @uses wp_enqueue_script To register script.
117
- * @uses wp_localize_script To translate strings in js.
118
- *
119
  * @global string $pagenow Current page.
120
  *
 
 
 
121
  * @return void
122
  */
123
  public function scripts() {
124
-
125
  global $pagenow;
126
 
127
- // Use minified scripts if SCRIPT_DEBUG is turned off.
128
- $file = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? 'assets/src/js/admin.js' : 'assets/js/admin.min.js';
129
-
130
- if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && in_array( $_GET['page'], array(
131
  'jj4t3-settings',
132
  'jj4t3-logs',
133
- ) )
 
 
134
  ) {
135
-
136
- wp_enqueue_script( JJ4T3_NAME, JJ4T3_URL . $file, array( 'jquery' ), JJ4T3_VERSION, false );
 
 
 
 
 
137
 
138
  // Strings to translate in js.
139
  $strings = array( 'redirect' => esc_html__( 'Custom Redirect', '404-to-301' ) );
@@ -160,19 +170,34 @@ class JJ4T3_Admin {
160
  public function admin_menu() {
161
 
162
  // Main menu for error logs list.
163
- $hook = add_menu_page( __( '404 Error Logs', '404-to-301' ), __( '404 Errors', '404-to-301' ), JJ4T3_ACCESS, 'jj4t3-logs', array(
164
- $this,
165
- 'error_list',
166
- ), 'dashicons-redo', 90 );
 
 
 
 
 
 
 
 
167
 
168
  // Render screen options on listing table.
169
  add_action( "load-$hook", array( $this, 'screen_option' ) );
170
 
171
  // 404 to 301 settings menu.
172
- add_submenu_page( 'jj4t3-logs', __( '404 to 301 Settings', '404-to-301' ), __( '404 Settings', '404-to-301' ), JJ4T3_ACCESS, 'jj4t3-settings', array(
173
- $this,
174
- 'admin_page',
175
- ) );
 
 
 
 
 
 
 
176
 
177
  /**
178
  * Action hook to register new submenu item.
@@ -232,7 +257,8 @@ class JJ4T3_Admin {
232
  <div id="post-body" class="metabox-holder">
233
  <div id="post-body-content">
234
  <div class="meta-box-sortables ui-sortable">
235
- <?php $this->list_table->prepare_items();
 
236
  /**
237
  * Action hook to add something above listing page.
238
  *
@@ -354,7 +380,7 @@ class JJ4T3_Admin {
354
  $plugin_file = basename( '404-to-301.php' );
355
 
356
  if ( basename( $file ) === $plugin_file ) {
357
- $settings_link = '<a href="admin.php?page=jj4t3-settings">' . __( 'Settings', '404-to-301' ) . '</a>';
358
  $settings_link .= ' | <a href="admin.php?page=jj4t3-logs">' . __( 'Logs', '404-to-301' ) . '</a>';
359
 
360
  // Add quick links to plugins listing page.
@@ -406,11 +432,14 @@ class JJ4T3_Admin {
406
  global $pagenow;
407
 
408
  // Only on our page.
409
- if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && in_array( $_GET['page'], array(
 
 
410
  'jj4t3-settings',
411
  'jj4t3-logs',
412
  'jj4t3-logs-addons',
413
- ) )
 
414
  ) {
415
  // Only for admins.
416
  if ( ! current_user_can( 'manage_options' ) ) {
@@ -432,11 +461,15 @@ class JJ4T3_Admin {
432
  if ( (int) $notice_time <= time() && ! $dismissed ) {
433
  ?>
434
  <div class="notice notice-success">
435
- <p><?php printf( __( 'Hey %1$s, I noticed you\'ve been using %2$s404 to 301%3$s for more than 1 week – that’s awesome! Could you please do me a BIG favor and give it a 5-star rating on WordPress? Just to help us spread the word and boost our motivation.', '404-to-301' ),
 
 
 
436
  empty( $current_user->display_name ) ? __( 'there', '404-to-301' ) : ucwords( $current_user->display_name ),
437
  '<strong>',
438
  '</strong>'
439
- ); ?>
 
440
  </p>
441
  <p>
442
  <a href="https://wordpress.org/support/plugin/404-to-301/reviews/#new-post" target="_blank"><?php esc_html_e( 'Ok, you deserve it', '404-to-301' ); ?></a>
8
  *
9
  * Register all hooks related to admin area of the website.
10
  *
 
 
 
11
  * @author Joel James <mail@cjoel.com>
12
  * @license http://www.gnu.org/licenses/ GNU General Public License
13
+ * @category Core
14
  * @link https://duckdev.com/products/404-to-301/
15
+ * @package JJ4T3
16
+ * @subpackage Admin
17
  */
18
  class JJ4T3_Admin {
19
 
87
  * @return void
88
  */
89
  public function styles() {
 
90
  global $pagenow;
91
 
92
+ if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && in_array(
93
+ $_GET['page'],
94
+ array(
 
95
  'jj4t3-settings',
96
  'jj4t3-logs',
97
+ ),
98
+ true
99
+ )
100
  ) {
101
+ wp_enqueue_style(
102
+ JJ4T3_NAME,
103
+ JJ4T3_URL . 'assets/css/admin.min.css',
104
+ array(),
105
+ JJ4T3_VERSION,
106
+ 'all'
107
+ );
108
  }
109
  }
110
 
118
  * @since 2.0.0
119
  * @access public
120
  *
 
 
 
121
  * @global string $pagenow Current page.
122
  *
123
+ * @uses wp_localize_script To translate strings in js.
124
+ *
125
+ * @uses wp_enqueue_script To register script.
126
  * @return void
127
  */
128
  public function scripts() {
 
129
  global $pagenow;
130
 
131
+ if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && in_array(
132
+ $_GET['page'],
133
+ array(
 
134
  'jj4t3-settings',
135
  'jj4t3-logs',
136
+ ),
137
+ true
138
+ )
139
  ) {
140
+ wp_enqueue_script(
141
+ JJ4T3_NAME,
142
+ JJ4T3_URL . 'assets/js/admin.min.js',
143
+ array( 'jquery' ),
144
+ JJ4T3_VERSION,
145
+ false
146
+ );
147
 
148
  // Strings to translate in js.
149
  $strings = array( 'redirect' => esc_html__( 'Custom Redirect', '404-to-301' ) );
170
  public function admin_menu() {
171
 
172
  // Main menu for error logs list.
173
+ $hook = add_menu_page(
174
+ __( '404 Error Logs', '404-to-301' ),
175
+ __( '404 Errors', '404-to-301' ),
176
+ JJ4T3_ACCESS,
177
+ 'jj4t3-logs',
178
+ array(
179
+ $this,
180
+ 'error_list',
181
+ ),
182
+ 'dashicons-redo',
183
+ 90
184
+ );
185
 
186
  // Render screen options on listing table.
187
  add_action( "load-$hook", array( $this, 'screen_option' ) );
188
 
189
  // 404 to 301 settings menu.
190
+ add_submenu_page(
191
+ 'jj4t3-logs',
192
+ __( '404 to 301 Settings', '404-to-301' ),
193
+ __( '404 Settings', '404-to-301' ),
194
+ JJ4T3_ACCESS,
195
+ 'jj4t3-settings',
196
+ array(
197
+ $this,
198
+ 'admin_page',
199
+ )
200
+ );
201
 
202
  /**
203
  * Action hook to register new submenu item.
257
  <div id="post-body" class="metabox-holder">
258
  <div id="post-body-content">
259
  <div class="meta-box-sortables ui-sortable">
260
+ <?php
261
+ $this->list_table->prepare_items();
262
  /**
263
  * Action hook to add something above listing page.
264
  *
380
  $plugin_file = basename( '404-to-301.php' );
381
 
382
  if ( basename( $file ) === $plugin_file ) {
383
+ $settings_link = '<a href="admin.php?page=jj4t3-settings">' . __( 'Settings', '404-to-301' ) . '</a>';
384
  $settings_link .= ' | <a href="admin.php?page=jj4t3-logs">' . __( 'Logs', '404-to-301' ) . '</a>';
385
 
386
  // Add quick links to plugins listing page.
432
  global $pagenow;
433
 
434
  // Only on our page.
435
+ if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && in_array(
436
+ $_GET['page'],
437
+ array(
438
  'jj4t3-settings',
439
  'jj4t3-logs',
440
  'jj4t3-logs-addons',
441
+ )
442
+ )
443
  ) {
444
  // Only for admins.
445
  if ( ! current_user_can( 'manage_options' ) ) {
461
  if ( (int) $notice_time <= time() && ! $dismissed ) {
462
  ?>
463
  <div class="notice notice-success">
464
+ <p>
465
+ <?php
466
+ printf(
467
+ __( 'Hey %1$s, I noticed you\'ve been using %2$s404 to 301%3$s for more than 1 week – that’s awesome! Could you please do me a BIG favor and give it a 5-star rating on WordPress? Just to help us spread the word and boost our motivation.', '404-to-301' ),
468
  empty( $current_user->display_name ) ? __( 'there', '404-to-301' ) : ucwords( $current_user->display_name ),
469
  '<strong>',
470
  '</strong>'
471
+ );
472
+ ?>
473
  </p>
474
  <p>
475
  <a href="https://wordpress.org/support/plugin/404-to-301/reviews/#new-post" target="_blank"><?php esc_html_e( 'Ok, you deserve it', '404-to-301' ); ?></a>
includes/admin/class-jj4t3-log-listing.php CHANGED
@@ -40,7 +40,6 @@ class JJ4T3_Log_Listing extends WP_List_Table {
40
  * @access public
41
  */
42
  public function __construct() {
43
-
44
  parent::__construct(
45
  array(
46
  'singular' => __( '404 Error Log', '404-to-301' ),
@@ -66,7 +65,6 @@ class JJ4T3_Log_Listing extends WP_List_Table {
66
  * @global object $wpdb WP DB object
67
  */
68
  public function prepare_items() {
69
-
70
  $this->_column_headers = $this->get_column_info();
71
 
72
  // Execute bulk actions.
@@ -123,7 +121,6 @@ class JJ4T3_Log_Listing extends WP_List_Table {
123
  * @return array
124
  */
125
  private function get_error_logs( $per_page = 20, $page_number = 1 ) {
126
-
127
  global $wpdb;
128
 
129
  // Current offset.
@@ -141,7 +138,12 @@ class JJ4T3_Log_Listing extends WP_List_Table {
141
  $order = $this->get_order();
142
 
143
  // Get error logs.
144
- $result = $wpdb->get_results( $wpdb->prepare( "SELECT *" . $count . " FROM " . JJ4T3_TABLE . " WHERE status != 0 " . $groupby_query . " ORDER BY %s %s LIMIT %d OFFSET %d", array( $orderby, $order, $per_page, $offset ) ), 'ARRAY_A' );
 
 
 
 
 
145
 
146
  /**
147
  * Filter to alter the error logs listing data result.
@@ -169,7 +171,6 @@ class JJ4T3_Log_Listing extends WP_List_Table {
169
  * @return string Filtered column name.
170
  */
171
  private function get_order_by() {
172
-
173
  /**
174
  * Filter to alter the log listing orderby param.
175
  *
@@ -195,8 +196,8 @@ class JJ4T3_Log_Listing extends WP_List_Table {
195
  $allowed_columns = array_intersect( $allowed_columns, array_keys( jj4t3_log_columns() ) );
196
 
197
  // Check if given column is allowed.
198
- if ( in_array( $orderby, $allowed_columns ) ) {
199
- return esc_sql( $orderby );
200
  }
201
 
202
  return 'date';
@@ -216,9 +217,8 @@ class JJ4T3_Log_Listing extends WP_List_Table {
216
  * @return string Filtered column name.
217
  */
218
  private function get_order() {
219
-
220
  // Get order column name from request.
221
- $order = jj4t3_from_request( 'order', 'DESC' ) == 'asc' ? 'ASC' : 'DESC';
222
 
223
  /**
224
  * Filter to alter the log listing order param.
@@ -243,7 +243,6 @@ class JJ4T3_Log_Listing extends WP_List_Table {
243
  * @access private
244
  */
245
  private function set_groupby() {
246
-
247
  /**
248
  * Filter to alter the allowed group by values.
249
  *
@@ -263,7 +262,7 @@ class JJ4T3_Log_Listing extends WP_List_Table {
263
  $group_by = jj4t3_from_request( 'group_by_top', '' );
264
 
265
  // Verify if the group by value is allowed.
266
- if ( ! in_array( $group_by, $allowed_values ) ) {
267
  return;
268
  }
269
 
@@ -291,13 +290,12 @@ class JJ4T3_Log_Listing extends WP_List_Table {
291
  * @return int Total count.
292
  */
293
  private function total_logs() {
294
-
295
  global $wpdb;
296
 
297
  if ( empty( $this->group_by ) ) {
298
  $total = $wpdb->get_var( "SELECT COUNT(id) FROM " . JJ4T3_TABLE );
299
  } else {
300
- $total = $total = $wpdb->get_var( "SELECT COUNT(DISTINCT " . $this->group_by . ") FROM " . JJ4T3_TABLE );
301
  }
302
 
303
  /**
@@ -319,10 +317,9 @@ class JJ4T3_Log_Listing extends WP_List_Table {
319
  * @since 2.0.0
320
  * @access public
321
  *
322
- * @return array $columns Array of cloumn titles.
323
  */
324
  public function get_columns() {
325
-
326
  $columns = array(
327
  'cb' => '<input type="checkbox" style="width: 5%;" />',
328
  'date' => __( 'Date', '404-to-301' ),
@@ -357,7 +354,6 @@ class JJ4T3_Log_Listing extends WP_List_Table {
357
  * @return array Array of columns to enable sorting.
358
  */
359
  protected function get_sortable_columns() {
360
-
361
  $columns = array(
362
  'date' => array( 'date', true ),
363
  'url' => array( 'url', false ),
@@ -388,13 +384,16 @@ class JJ4T3_Log_Listing extends WP_List_Table {
388
  * @return void
389
  */
390
  public function no_items() {
 
 
 
391
 
392
  /**
393
  * Filter hook to change no items message.
394
  *
395
  * @since 3.0.0
396
  */
397
- _e( apply_filters( 'jj4t3_log_list_no_items_message', __( 'Ah! You are so clean that you still got ZERO errors.', '404-to-301' ) ) );
398
  }
399
 
400
  /**
@@ -404,16 +403,15 @@ class JJ4T3_Log_Listing extends WP_List_Table {
404
  * for switch, printing the whole array.
405
  * Registering filter - "jj4t3_log_list_column_default".
406
  *
407
- * @param array $item Column data
408
- * @param string $column_name Column name
409
  *
410
  * @since 2.0.0
411
  * @access protected
412
  *
413
- * @return array
414
  */
415
  protected function column_default( $item, $column_name ) {
416
-
417
  $columns = array_keys( jj4t3_log_columns() );
418
 
419
  /**
@@ -426,12 +424,11 @@ class JJ4T3_Log_Listing extends WP_List_Table {
426
  $columns = apply_filters( 'jj4t3_log_list_column_default', $columns );
427
 
428
  // If current column is allowed.
429
- if ( in_array( $column_name, $columns ) ) {
430
  return $item[ $column_name ];
431
  }
432
 
433
- // Show the whole array for troubleshooting purposes.
434
- return print_r( $item, true );
435
  }
436
 
437
  /**
@@ -440,15 +437,14 @@ class JJ4T3_Log_Listing extends WP_List_Table {
440
  * This function is used to add new checkbox for all entries in
441
  * the listing table. We use this checkbox to perform bulk actions.
442
  *
443
- * @param array $item Column data
444
  *
445
  * @since 2.1.0
446
  * @access public
447
  *
448
  * @return string
449
  */
450
- function column_cb( $item ) {
451
-
452
  return sprintf( '<input type="checkbox" name="bulk-delete[]" value="%s"/>', $item['id'] );
453
  }
454
 
@@ -459,18 +455,17 @@ class JJ4T3_Log_Listing extends WP_List_Table {
459
  * We can change styles, texts etc. using this function.
460
  * Registering filter - "jj4t3_log_list_date_column".
461
  *
462
- * @param array $item Column data
463
  *
464
  * @since 2.0.0
465
  * @access public
466
  *
467
  * @return string
468
  */
469
- function column_date( $item ) {
470
-
471
  $delete_nonce = wp_create_nonce( 'bulk-' . $this->_args['plural'] );
472
 
473
- $title = mysql2date( "j M Y, g:i a", $item['date'] );
474
 
475
  $confirm = __( 'Are you sure you want to delete this item?', '404-to-301' );
476
 
@@ -491,15 +486,14 @@ class JJ4T3_Log_Listing extends WP_List_Table {
491
  * We can change styles, texts etc. using this function.
492
  * Registering filter - "jj4t3_log_list_url_column".
493
  *
494
- * @param array $item Column data
495
  *
496
  * @since 2.0.0
497
  * @access public
498
  *
499
  * @return string URL column html content
500
  */
501
- function column_url( $item ) {
502
-
503
  // Get default text if empty value.
504
  $url = $this->get_empty_content( $item['url'] );
505
  if ( ! $url ) {
@@ -523,15 +517,14 @@ class JJ4T3_Log_Listing extends WP_List_Table {
523
  * We can change styles, texts etc. using this function.
524
  * Registering filter - "jj4t3_log_list_ref_column".
525
  *
526
- * @param array $item Column data
527
  *
528
  * @since 2.0.0
529
  * @access public
530
  *
531
  * @return string Ref column html content.
532
  */
533
- function column_ref( $item ) {
534
-
535
  // Get default text if empty value.
536
  $ref = $this->get_empty_content( $item['ref'] );
537
  if ( ! $ref ) {
@@ -553,15 +546,14 @@ class JJ4T3_Log_Listing extends WP_List_Table {
553
  * We can change styles, texts etc. using this function.
554
  * Registering filter - "jj4t3_log_list_ua_column".
555
  *
556
- * @param array $item Column data
557
  *
558
  * @since 2.0.9
559
  * @access public
560
  *
561
  * @return string User Agent column html content
562
  */
563
- function column_ua( $item ) {
564
-
565
  // Sanitize text content.
566
  $ua = sanitize_text_field( $item['ua'] );
567
 
@@ -580,15 +572,14 @@ class JJ4T3_Log_Listing extends WP_List_Table {
580
  * We can change styles, texts etc. using this function.
581
  * Registering filter - "jj4t3_log_list_ip_column".
582
  *
583
- * @param array $item Column data
584
  *
585
  * @since 2.0.9
586
  * @access public
587
  *
588
  * @return string IP column html content.
589
  */
590
- function column_ip( $item ) {
591
-
592
  // Get default text if empty value.
593
  $ip = $this->get_empty_content( $item['ip'] );
594
  if ( ! $ip ) {
@@ -608,15 +599,14 @@ class JJ4T3_Log_Listing extends WP_List_Table {
608
  *
609
  * This function is used to modify the column data for custom redirect in listing table.
610
  *
611
- * @param array $item Column data
612
  *
613
  * @since 2.0.9
614
  * @access public
615
  *
616
  * @return string HTML content for redirect column.
617
  */
618
- function column_redirect( $item ) {
619
-
620
  // Link for redirect.
621
  $link = esc_url( $item['redirect'] );
622
 
@@ -641,10 +631,9 @@ class JJ4T3_Log_Listing extends WP_List_Table {
641
  * @since 3.0.0
642
  * @access private
643
  *
644
- * @return string|boolean
645
  */
646
  private function get_group_content( $content, $column, $item ) {
647
-
648
  $count_text = '';
649
  // Check if current column name is grouped.
650
  // Add count text then.
@@ -669,7 +658,6 @@ class JJ4T3_Log_Listing extends WP_List_Table {
669
  * @return string|boolean
670
  */
671
  private function get_empty_content( $value ) {
672
-
673
  // Get default error text.
674
  if ( strtolower( $value ) === 'n/a' || empty( $value ) ) {
675
  return '<span class="jj4t3-url-p">n/a</span>';
@@ -691,7 +679,6 @@ class JJ4T3_Log_Listing extends WP_List_Table {
691
  * @return array $actions Options to be added to the action select box.
692
  */
693
  public function get_bulk_actions() {
694
-
695
  $actions = array(
696
  'bulk_delete' => __( 'Delete Selected', '404-to-301' ),
697
  'bulk_clean' => __( 'Delete All', '404-to-301' ),
@@ -720,8 +707,7 @@ class JJ4T3_Log_Listing extends WP_List_Table {
720
  * @return void
721
  */
722
  public function extra_tablenav( $which ) {
723
-
724
- if ( $this->has_items() && 'top' == $which ) {
725
 
726
  // This filter is already documented above.
727
  $allowed_values = apply_filters( 'jj4t3_log_list_groupby_allowed', array( 'url', 'ref', 'ip', 'ua' ) );
@@ -732,7 +718,7 @@ class JJ4T3_Log_Listing extends WP_List_Table {
732
  // Add dropdown.
733
  echo '<div class="alignleft actions bulkactions">';
734
  echo '<select name="group_by_top" class="404_group_by">';
735
- echo '<option value="">' . __( 'Group by', '404-to-301' ) . '</option>';
736
  foreach ( $column_names as $column ) {
737
  echo '<option value="' . $column . '" ' . selected( $column, $this->group_by ) . '>' . esc_attr( $available_columns[ $column ] ) . '</option>';
738
  }
@@ -760,7 +746,7 @@ class JJ4T3_Log_Listing extends WP_List_Table {
760
  * @access private
761
  * @uses check_admin_referer() For security check.
762
  *
763
- * @return void|boolean
764
  */
765
  private function process_actions() {
766
  // Get current action.
@@ -770,7 +756,7 @@ class JJ4T3_Log_Listing extends WP_List_Table {
770
  $allowed_actions = array_keys( $this->get_bulk_actions() );
771
 
772
  // Verify only allowed actions are passed.
773
- if ( ! in_array( $action, $allowed_actions ) && 'delete' !== $action ) {
774
  return false;
775
  }
776
 
@@ -781,7 +767,7 @@ class JJ4T3_Log_Listing extends WP_List_Table {
781
  return false;
782
  }
783
 
784
- // IDs of log entires to process.
785
  $ids = jj4t3_from_request( 'bulk-delete', true );
786
 
787
  // Run custom bulk actions.
@@ -883,7 +869,6 @@ class JJ4T3_Log_Listing extends WP_List_Table {
883
  * @return string
884
  */
885
  public static function set_screen( $status, $option, $value ) {
886
-
887
  return $value;
888
  }
889
 
@@ -897,7 +882,6 @@ class JJ4T3_Log_Listing extends WP_List_Table {
897
  * @return void
898
  */
899
  public static function open_redirect() {
900
-
901
  // Yes, security check is a must when you alter something.
902
  check_ajax_referer( 'jj4t3_redirect_nonce', 'nonce' );
903
 
@@ -961,7 +945,6 @@ class JJ4T3_Log_Listing extends WP_List_Table {
961
  * @return void
962
  */
963
  public static function save_redirect() {
964
-
965
  // Yes, security check is a must when you alter something.
966
  check_ajax_referer( 'jj4t3_redirect_nonce', 'jj4t3_redirect_nonce' );
967
 
@@ -1021,5 +1004,4 @@ class JJ4T3_Log_Listing extends WP_List_Table {
1021
  include_once JJ4T3_DIR . 'includes/admin/views/custom-redirect.php';
1022
  }
1023
  }
1024
-
1025
  }
40
  * @access public
41
  */
42
  public function __construct() {
 
43
  parent::__construct(
44
  array(
45
  'singular' => __( '404 Error Log', '404-to-301' ),
65
  * @global object $wpdb WP DB object
66
  */
67
  public function prepare_items() {
 
68
  $this->_column_headers = $this->get_column_info();
69
 
70
  // Execute bulk actions.
121
  * @return array
122
  */
123
  private function get_error_logs( $per_page = 20, $page_number = 1 ) {
 
124
  global $wpdb;
125
 
126
  // Current offset.
138
  $order = $this->get_order();
139
 
140
  // Get error logs.
141
+ $result = $wpdb->get_results(
142
+ $wpdb->prepare(
143
+ "SELECT *{$count} FROM " . JJ4T3_TABLE . " WHERE status != 0 $groupby_query ORDER BY $orderby $order LIMIT %d OFFSET %d",
144
+ array( $per_page, $offset ) ),
145
+ 'ARRAY_A'
146
+ );
147
 
148
  /**
149
  * Filter to alter the error logs listing data result.
171
  * @return string Filtered column name.
172
  */
173
  private function get_order_by() {
 
174
  /**
175
  * Filter to alter the log listing orderby param.
176
  *
196
  $allowed_columns = array_intersect( $allowed_columns, array_keys( jj4t3_log_columns() ) );
197
 
198
  // Check if given column is allowed.
199
+ if ( in_array( $orderby, $allowed_columns, true ) ) {
200
+ return sanitize_sql_orderby( $orderby );
201
  }
202
 
203
  return 'date';
217
  * @return string Filtered column name.
218
  */
219
  private function get_order() {
 
220
  // Get order column name from request.
221
+ $order = jj4t3_from_request( 'order', 'DESC' ) === 'asc' ? 'ASC' : 'DESC';
222
 
223
  /**
224
  * Filter to alter the log listing order param.
243
  * @access private
244
  */
245
  private function set_groupby() {
 
246
  /**
247
  * Filter to alter the allowed group by values.
248
  *
262
  $group_by = jj4t3_from_request( 'group_by_top', '' );
263
 
264
  // Verify if the group by value is allowed.
265
+ if ( ! in_array( $group_by, $allowed_values, true ) ) {
266
  return;
267
  }
268
 
290
  * @return int Total count.
291
  */
292
  private function total_logs() {
 
293
  global $wpdb;
294
 
295
  if ( empty( $this->group_by ) ) {
296
  $total = $wpdb->get_var( "SELECT COUNT(id) FROM " . JJ4T3_TABLE );
297
  } else {
298
+ $total = $wpdb->get_var( "SELECT COUNT(DISTINCT " . $this->group_by . ") FROM " . JJ4T3_TABLE );
299
  }
300
 
301
  /**
317
  * @since 2.0.0
318
  * @access public
319
  *
320
+ * @return array $columns Array of column titles.
321
  */
322
  public function get_columns() {
 
323
  $columns = array(
324
  'cb' => '<input type="checkbox" style="width: 5%;" />',
325
  'date' => __( 'Date', '404-to-301' ),
354
  * @return array Array of columns to enable sorting.
355
  */
356
  protected function get_sortable_columns() {
 
357
  $columns = array(
358
  'date' => array( 'date', true ),
359
  'url' => array( 'url', false ),
384
  * @return void
385
  */
386
  public function no_items() {
387
+ $message = __( 'Ah! You are so clean that you still got ZERO errors.', '404-to-301' );
388
+
389
+ $message = apply_filters( 'jj4t3_log_list_no_items_message', $message );
390
 
391
  /**
392
  * Filter hook to change no items message.
393
  *
394
  * @since 3.0.0
395
  */
396
+ echo esc_html( $message );
397
  }
398
 
399
  /**
403
  * for switch, printing the whole array.
404
  * Registering filter - "jj4t3_log_list_column_default".
405
  *
406
+ * @param array $item Column data.
407
+ * @param string $column_name Column name.
408
  *
409
  * @since 2.0.0
410
  * @access protected
411
  *
412
+ * @return string
413
  */
414
  protected function column_default( $item, $column_name ) {
 
415
  $columns = array_keys( jj4t3_log_columns() );
416
 
417
  /**
424
  $columns = apply_filters( 'jj4t3_log_list_column_default', $columns );
425
 
426
  // If current column is allowed.
427
+ if ( in_array( $column_name, $columns, true ) ) {
428
  return $item[ $column_name ];
429
  }
430
 
431
+ return '';
 
432
  }
433
 
434
  /**
437
  * This function is used to add new checkbox for all entries in
438
  * the listing table. We use this checkbox to perform bulk actions.
439
  *
440
+ * @param array $item Column data.
441
  *
442
  * @since 2.1.0
443
  * @access public
444
  *
445
  * @return string
446
  */
447
+ public function column_cb( $item ) {
 
448
  return sprintf( '<input type="checkbox" name="bulk-delete[]" value="%s"/>', $item['id'] );
449
  }
450
 
455
  * We can change styles, texts etc. using this function.
456
  * Registering filter - "jj4t3_log_list_date_column".
457
  *
458
+ * @param array $item Column data.
459
  *
460
  * @since 2.0.0
461
  * @access public
462
  *
463
  * @return string
464
  */
465
+ public function column_date( $item ) {
 
466
  $delete_nonce = wp_create_nonce( 'bulk-' . $this->_args['plural'] );
467
 
468
+ $title = mysql2date( 'j M Y, g:i a', $item['date'] );
469
 
470
  $confirm = __( 'Are you sure you want to delete this item?', '404-to-301' );
471
 
486
  * We can change styles, texts etc. using this function.
487
  * Registering filter - "jj4t3_log_list_url_column".
488
  *
489
+ * @param array $item Column data.
490
  *
491
  * @since 2.0.0
492
  * @access public
493
  *
494
  * @return string URL column html content
495
  */
496
+ public function column_url( $item ) {
 
497
  // Get default text if empty value.
498
  $url = $this->get_empty_content( $item['url'] );
499
  if ( ! $url ) {
517
  * We can change styles, texts etc. using this function.
518
  * Registering filter - "jj4t3_log_list_ref_column".
519
  *
520
+ * @param array $item Column data.
521
  *
522
  * @since 2.0.0
523
  * @access public
524
  *
525
  * @return string Ref column html content.
526
  */
527
+ public function column_ref( $item ) {
 
528
  // Get default text if empty value.
529
  $ref = $this->get_empty_content( $item['ref'] );
530
  if ( ! $ref ) {
546
  * We can change styles, texts etc. using this function.
547
  * Registering filter - "jj4t3_log_list_ua_column".
548
  *
549
+ * @param array $item Column data.
550
  *
551
  * @since 2.0.9
552
  * @access public
553
  *
554
  * @return string User Agent column html content
555
  */
556
+ public function column_ua( $item ) {
 
557
  // Sanitize text content.
558
  $ua = sanitize_text_field( $item['ua'] );
559
 
572
  * We can change styles, texts etc. using this function.
573
  * Registering filter - "jj4t3_log_list_ip_column".
574
  *
575
+ * @param array $item Column data.
576
  *
577
  * @since 2.0.9
578
  * @access public
579
  *
580
  * @return string IP column html content.
581
  */
582
+ public function column_ip( $item ) {
 
583
  // Get default text if empty value.
584
  $ip = $this->get_empty_content( $item['ip'] );
585
  if ( ! $ip ) {
599
  *
600
  * This function is used to modify the column data for custom redirect in listing table.
601
  *
602
+ * @param array $item Column data.
603
  *
604
  * @since 2.0.9
605
  * @access public
606
  *
607
  * @return string HTML content for redirect column.
608
  */
609
+ public function column_redirect( $item ) {
 
610
  // Link for redirect.
611
  $link = esc_url( $item['redirect'] );
612
 
631
  * @since 3.0.0
632
  * @access private
633
  *
634
+ * @return string
635
  */
636
  private function get_group_content( $content, $column, $item ) {
 
637
  $count_text = '';
638
  // Check if current column name is grouped.
639
  // Add count text then.
658
  * @return string|boolean
659
  */
660
  private function get_empty_content( $value ) {
 
661
  // Get default error text.
662
  if ( strtolower( $value ) === 'n/a' || empty( $value ) ) {
663
  return '<span class="jj4t3-url-p">n/a</span>';
679
  * @return array $actions Options to be added to the action select box.
680
  */
681
  public function get_bulk_actions() {
 
682
  $actions = array(
683
  'bulk_delete' => __( 'Delete Selected', '404-to-301' ),
684
  'bulk_clean' => __( 'Delete All', '404-to-301' ),
707
  * @return void
708
  */
709
  public function extra_tablenav( $which ) {
710
+ if ( $this->has_items() && 'top' === $which ) {
 
711
 
712
  // This filter is already documented above.
713
  $allowed_values = apply_filters( 'jj4t3_log_list_groupby_allowed', array( 'url', 'ref', 'ip', 'ua' ) );
718
  // Add dropdown.
719
  echo '<div class="alignleft actions bulkactions">';
720
  echo '<select name="group_by_top" class="404_group_by">';
721
+ echo '<option value="">' . esc_html__( 'Group by', '404-to-301' ) . '</option>';
722
  foreach ( $column_names as $column ) {
723
  echo '<option value="' . $column . '" ' . selected( $column, $this->group_by ) . '>' . esc_attr( $available_columns[ $column ] ) . '</option>';
724
  }
746
  * @access private
747
  * @uses check_admin_referer() For security check.
748
  *
749
+ * @return bool
750
  */
751
  private function process_actions() {
752
  // Get current action.
756
  $allowed_actions = array_keys( $this->get_bulk_actions() );
757
 
758
  // Verify only allowed actions are passed.
759
+ if ( ! in_array( $action, $allowed_actions, true ) && 'delete' !== $action ) {
760
  return false;
761
  }
762
 
767
  return false;
768
  }
769
 
770
+ // IDs of log entries to process.
771
  $ids = jj4t3_from_request( 'bulk-delete', true );
772
 
773
  // Run custom bulk actions.
869
  * @return string
870
  */
871
  public static function set_screen( $status, $option, $value ) {
 
872
  return $value;
873
  }
874
 
882
  * @return void
883
  */
884
  public static function open_redirect() {
 
885
  // Yes, security check is a must when you alter something.
886
  check_ajax_referer( 'jj4t3_redirect_nonce', 'nonce' );
887
 
945
  * @return void
946
  */
947
  public static function save_redirect() {
 
948
  // Yes, security check is a must when you alter something.
949
  check_ajax_referer( 'jj4t3_redirect_nonce', 'jj4t3_redirect_nonce' );
950
 
1004
  include_once JJ4T3_DIR . 'includes/admin/views/custom-redirect.php';
1005
  }
1006
  }
 
1007
  }
includes/admin/views/settings.php CHANGED
@@ -1,97 +1,98 @@
1
  <?php
2
 
3
  // If this file is called directly, abort.
4
- defined( 'ABSPATH' ) or exit; ?>
 
5
 
6
  <form method="post" action="options.php">
7
  <?php settings_fields( 'i4t3_gnrl_options' ); ?>
8
  <?php $options = get_option( 'i4t3_gnrl_options' ); ?>
9
- <?php $cp_style = ( $options['redirect_to'] !== 'page' ) ? 'jj4t3-hide' : '' ?>
10
- <?php $cl_style = ( $options['redirect_to'] !== 'link' ) ? 'jj4t3-hide' : '' ?>
11
- <?php $cl_style = ( ! in_array( $options['redirect_to'], array( 'link', 'page', '0' ) ) ) ? '' : $cl_style; ?>
12
  <table class="form-table">
13
  <tbody>
14
- <?php $statuses = jj4t3_redirect_statuses(); ?>
15
- <?php if ( !empty( $statuses ) ) : ?>
16
- <tr>
17
- <th><?php _e( 'Redirect type', '404-to-301' ); ?></th>
18
- <td>
19
- <select name='i4t3_gnrl_options[redirect_type]'>
20
- <?php foreach ( $statuses as $status => $label ) : ?>
21
- <option value='<?php echo $status; ?>' <?php selected( $options['redirect_type'], $status ); ?>><?php echo $label; ?></option>
22
- <?php endforeach; ?>
23
- </select>
24
- <p class="description jj4t3-p-desc"><a target="_blank" href="https://moz.com/learn/seo/redirection"><strong><?php _e( 'Learn more', '404-to-301' ); ?></strong></a> <?php _e( 'about these redirect types', '404-to-301' ); ?>
25
- </p>
26
- </td>
27
- </tr>
28
- <?php endif; ?>
29
  <tr>
30
- <th><?php _e( 'Redirect to', '404-to-301' ); ?></th>
31
  <td>
32
- <select name='i4t3_gnrl_options[redirect_to]' id='jj4t3_redirect_to'>
33
- <option value='page' <?php selected( $options['redirect_to'], 'page' ); ?>><?php _e( 'Existing Page', '404-to-301' ); ?></option>
34
- <option value='link' <?php selected( $options['redirect_to'], 'link' ); ?>><?php _e( 'Custom URL', '404-to-301' ); ?></option>
35
- <option value='0' <?php selected( $options['redirect_to'], 0 ); ?>><?php _e( 'No Redirect', '404-to-301' ); ?></option>
36
  </select>
37
- <p class="description jj4t3-p-desc"><strong><?php _e( 'Existing Page', '404-to-301' ); ?>:</strong> <?php _e( 'Select any WordPress page as a 404 page', '404-to-301' ); ?>.</p>
38
- <p class="description jj4t3-p-desc"><strong><?php _e( 'Custom URL', '404-to-301' ); ?>:</strong> <?php _e( 'Redirect 404 requests to a specific URL', '404-to-301' ); ?>.</p>
39
- <p class="description jj4t3-p-desc"><strong><?php _e( 'No Redirect', '404-to-301' ); ?>:</strong> <?php _e( 'To disable redirect', '404-to-301' ); ?>.</p>
40
- <p class="description jj4t3-p-desc"><strong><?php _e( 'You can override this by setting individual custom redirects from error logs list.', '404-to-301' ); ?></strong></p>
41
- </td>
42
- </tr>
43
- <tr id="custom_page" class="<?php echo $cp_style; ?>">
44
- <th><?php _e( 'Select the page', '404-to-301' ); ?></th>
45
- <td>
46
- <?php wp_dropdown_pages( array( 'name' => 'i4t3_gnrl_options[redirect_page]', 'selected' => $options['redirect_page'] ) ); ?>
47
- <p class="description jj4t3-p-desc"><?php _e( 'The default 404 page will be replaced by the page you choose in this list.', '404-to-301' ); ?></p>
48
- <p class="description jj4t3-p-desc"><?php printf( __( 'You can <a href="%s" target="_blank">create a custom 404</a> page and assign that page here.', '404-to-301' ), admin_url( 'post-new.php?post_type=page' ) ); ?></p>
49
- </td>
50
- </tr>
51
- <tr id="custom_url" class="<?php echo $cl_style; ?>">
52
- <th><?php _e( 'Custom URL', '404-to-301' ); ?></th>
53
- <td>
54
- <input type="url" size="40" placeholder="<?php echo home_url(); ?>" name="i4t3_gnrl_options[redirect_link]" value="<?php echo $options['redirect_link']; ?>">
55
- <p class="description jj4t3-p-desc"><?php _e( 'Enter any url (including http://)', '404-to-301' ); ?></p>
56
- </td>
57
- </tr>
58
- <tr>
59
- <th><?php _e( 'Log 404 Errors', '404-to-301' ); ?></th>
60
- <td>
61
- <input type="checkbox" name="i4t3_gnrl_options[redirect_log]" value="1" <?php checked( jj4t3_get_option( 'redirect_log' ), 1 ); ?> />
62
- <p class="description jj4t3-p-desc"><?php _e( 'Enable/Disable Logging', '404-to-301' ); ?></p>
63
- </td>
64
- </tr>
65
- <tr>
66
- <th><?php _e( 'Email notifications', '404-to-301' ); ?></th>
67
- <td>
68
- <input type="checkbox" name="i4t3_gnrl_options[email_notify]" value="1" <?php checked( jj4t3_get_option( 'email_notify' ), 1 ); ?> />
69
- <p class="description jj4t3-p-desc"><?php _e( 'If you check this, an email will be sent on every 404 log on the admin email account.', '404-to-301' ); ?></p>
70
- </td>
71
- </tr>
72
- <tr>
73
- <th><?php _e( 'Disable URL guessing', '404-to-301' ); ?></th>
74
- <td>
75
- <input type="checkbox" name="i4t3_gnrl_options[disable_guessing]" value="1" <?php checked( jj4t3_get_option( 'disable_guessing' ), 0 ); ?> />
76
- <p class="description jj4t3-p-desc"><?php printf( __( 'If you disable URL guessing, it will stop WordPress from autocorrecting incorrect URLs. %1$sLearn more%2$s about canonical redirect.', '404-to-301' ), '<a href="https://developer.wordpress.org/reference/functions/redirect_canonical/" target="_blank">', '</a>' ); ?></p>
77
- </td>
78
- </tr>
79
- <tr>
80
- <th><?php _e( 'Email address', '404-to-301' ); ?></th>
81
- <td>
82
- <?php $notify_address = ( isset( $options['email_notify_address'] ) ) ? $options['email_notify_address'] : get_option( 'admin_email' ); ?>
83
- <input type="email" placeholder="<?php echo get_option( 'admin_email' ); ?>" name="i4t3_gnrl_options[email_notify_address]" value="<?php echo $notify_address; ?>">
84
- <p class="description jj4t3-p-desc"><?php _e( 'Change the recipient email address for error log notifications.', '404-to-301' ); ?></p>
85
- </td>
86
- </tr>
87
- <tr>
88
- <th><?php _e( 'Exclude paths', '404-to-301' ); ?></th>
89
- <td>
90
- <textarea rows="5" cols="50" placeholder="wp-content/plugins/abc-plugin/css/" name="i4t3_gnrl_options[exclude_paths]"><?php echo $options['exclude_paths']; ?></textarea>
91
- <p class="description jj4t3-p-desc"><?php _e( 'If you want to exclude few paths from error logs, enter here. One per line.', '404-to-301' ); ?></p>
92
  </td>
93
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  </tbody>
95
  </table>
96
  <?php submit_button( __( 'Save settings', '404-to-301' ) ); ?>
97
- </form><!-- /.form -->
1
  <?php
2
 
3
  // If this file is called directly, abort.
4
+ defined( 'ABSPATH' ) || exit;
5
+ ?>
6
 
7
  <form method="post" action="options.php">
8
  <?php settings_fields( 'i4t3_gnrl_options' ); ?>
9
  <?php $options = get_option( 'i4t3_gnrl_options' ); ?>
10
+ <?php $cp_style = 'page' !== $options['redirect_to'] ? 'jj4t3-hide' : ''; ?>
11
+ <?php $cl_style = 'link' !== $options['redirect_to'] ? 'jj4t3-hide' : ''; ?>
12
+ <?php $cl_style = ! in_array( $options['redirect_to'], array( 'link', 'page', '0' ), true ) ? '' : $cl_style; ?>
13
  <table class="form-table">
14
  <tbody>
15
+ <?php $statuses = jj4t3_redirect_statuses(); ?>
16
+ <?php if ( ! empty( $statuses ) ) : ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  <tr>
18
+ <th><?php esc_html_e( 'Redirect type', '404-to-301' ); ?></th>
19
  <td>
20
+ <select name='i4t3_gnrl_options[redirect_type]'>
21
+ <?php foreach ( $statuses as $status => $label ) : ?>
22
+ <option value='<?php echo esc_attr( $status ); ?>' <?php selected( $options['redirect_type'], $status ); ?>><?php echo esc_attr( $label ); ?></option>
23
+ <?php endforeach; ?>
24
  </select>
25
+ <p class="description jj4t3-p-desc"><a target="_blank" href="https://moz.com/learn/seo/redirection"><strong><?php esc_html_e( 'Learn more', '404-to-301' ); ?></strong></a> <?php esc_html_e( 'about these redirect types', '404-to-301' ); ?>
26
+ </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  </td>
28
  </tr>
29
+ <?php endif; ?>
30
+ <tr>
31
+ <th><?php esc_html_e( 'Redirect to', '404-to-301' ); ?></th>
32
+ <td>
33
+ <select name='i4t3_gnrl_options[redirect_to]' id='jj4t3_redirect_to'>
34
+ <option value='page' <?php selected( $options['redirect_to'], 'page' ); ?>><?php esc_html_e( 'Existing Page', '404-to-301' ); ?></option>
35
+ <option value='link' <?php selected( $options['redirect_to'], 'link' ); ?>><?php esc_html_e( 'Custom URL', '404-to-301' ); ?></option>
36
+ <option value='0' <?php selected( $options['redirect_to'], 0 ); ?>><?php esc_html_e( 'No Redirect', '404-to-301' ); ?></option>
37
+ </select>
38
+ <p class="description jj4t3-p-desc"><strong><?php esc_html_e( 'Existing Page', '404-to-301' ); ?>:</strong> <?php esc_html_e( 'Select any WordPress page as a 404 page', '404-to-301' ); ?>.</p>
39
+ <p class="description jj4t3-p-desc"><strong><?php esc_html_e( 'Custom URL', '404-to-301' ); ?>:</strong> <?php esc_html_e( 'Redirect 404 requests to a specific URL', '404-to-301' ); ?>.</p>
40
+ <p class="description jj4t3-p-desc"><strong><?php esc_html_e( 'No Redirect', '404-to-301' ); ?>:</strong> <?php esc_html_e( 'To disable redirect', '404-to-301' ); ?>.</p>
41
+ <p class="description jj4t3-p-desc"><strong><?php esc_html_e( 'You can override this by setting individual custom redirects from error logs list.', '404-to-301' ); ?></strong></p>
42
+ </td>
43
+ </tr>
44
+ <tr id="custom_page" class="<?php echo esc_attr( $cp_style ); ?>">
45
+ <th><?php esc_html_e( 'Select the page', '404-to-301' ); ?></th>
46
+ <td>
47
+ <?php wp_dropdown_pages( array( 'name' => 'i4t3_gnrl_options[redirect_page]', 'selected' => $options['redirect_page'] ) ); ?>
48
+ <p class="description jj4t3-p-desc"><?php esc_html_e( 'The default 404 page will be replaced by the page you choose in this list.', '404-to-301' ); ?></p>
49
+ <p class="description jj4t3-p-desc"><?php printf( __( 'You can <a href="%s" target="_blank">create a custom 404</a> page and assign that page here.', '404-to-301' ), admin_url( 'post-new.php?post_type=page' ) ); ?></p>
50
+ </td>
51
+ </tr>
52
+ <tr id="custom_url" class="<?php echo esc_attr( $cl_style ); ?>">
53
+ <th><?php esc_html_e( 'Custom URL', '404-to-301' ); ?></th>
54
+ <td>
55
+ <input type="url" size="40" placeholder="<?php echo home_url(); ?>" name="i4t3_gnrl_options[redirect_link]" value="<?php echo esc_url( $options['redirect_link'] ); ?>">
56
+ <p class="description jj4t3-p-desc"><?php esc_html_e( 'Enter any url (including http://)', '404-to-301' ); ?></p>
57
+ </td>
58
+ </tr>
59
+ <tr>
60
+ <th><?php esc_html_e( 'Log 404 Errors', '404-to-301' ); ?></th>
61
+ <td>
62
+ <input type="checkbox" name="i4t3_gnrl_options[redirect_log]" value="1" <?php checked( jj4t3_get_option( 'redirect_log' ), 1 ); ?> />
63
+ <p class="description jj4t3-p-desc"><?php esc_html_e( 'Enable/Disable Logging', '404-to-301' ); ?></p>
64
+ </td>
65
+ </tr>
66
+ <tr>
67
+ <th><?php esc_html_e( 'Email notifications', '404-to-301' ); ?></th>
68
+ <td>
69
+ <input type="checkbox" name="i4t3_gnrl_options[email_notify]" value="1" <?php checked( jj4t3_get_option( 'email_notify' ), 1 ); ?> />
70
+ <p class="description jj4t3-p-desc"><?php esc_html_e( 'If you check this, an email will be sent on every 404 log on the admin email account.', '404-to-301' ); ?></p>
71
+ </td>
72
+ </tr>
73
+ <tr>
74
+ <th><?php esc_html_e( 'Disable URL guessing', '404-to-301' ); ?></th>
75
+ <td>
76
+ <input type="checkbox" name="i4t3_gnrl_options[disable_guessing]" value="1" <?php checked( jj4t3_get_option( 'disable_guessing' ), 0 ); ?> />
77
+ <p class="description jj4t3-p-desc"><?php printf( __( 'If you disable URL guessing, it will stop WordPress from autocorrecting incorrect URLs. %1$sLearn more%2$s about canonical redirect.', '404-to-301' ), '<a href="https://developer.wordpress.org/reference/functions/redirect_canonical/" target="_blank">', '</a>' ); ?></p>
78
+ </td>
79
+ </tr>
80
+ <tr>
81
+ <th><?php esc_html_e( 'Email address', '404-to-301' ); ?></th>
82
+ <td>
83
+ <?php $notify_address = ( isset( $options['email_notify_address'] ) ) ? $options['email_notify_address'] : get_option( 'admin_email' ); ?>
84
+ <input type="email" placeholder="<?php echo get_option( 'admin_email' ); ?>" name="i4t3_gnrl_options[email_notify_address]" value="<?php echo esc_html( $notify_address ); ?>">
85
+ <p class="description jj4t3-p-desc"><?php esc_html_e( 'Change the recipient email address for error log notifications.', '404-to-301' ); ?></p>
86
+ </td>
87
+ </tr>
88
+ <tr>
89
+ <th><?php esc_html_e( 'Exclude paths', '404-to-301' ); ?></th>
90
+ <td>
91
+ <textarea rows="5" cols="50" placeholder="wp-content/plugins/abc-plugin/css/" name="i4t3_gnrl_options[exclude_paths]"><?php echo esc_html( $options['exclude_paths'] ); ?></textarea>
92
+ <p class="description jj4t3-p-desc"><?php esc_html_e( 'If you want to exclude few paths from error logs, enter here. One per line.', '404-to-301' ); ?></p>
93
+ </td>
94
+ </tr>
95
  </tbody>
96
  </table>
97
  <?php submit_button( __( 'Save settings', '404-to-301' ) ); ?>
98
+ </form><!-- /.form -->
includes/functions/jj4t3-general-functions.php CHANGED
@@ -367,9 +367,9 @@ function jj4t3_from_request( $key = '', $default = '' ) {
367
 
368
  // Trim output.
369
  if ( is_string( $_REQUEST[ $key ] ) ) { // phpcs:ignore
370
- return trim( $_REQUEST[ $key ] ); // phpcs:ignore
371
  } elseif ( is_array( $_REQUEST[ $key ] ) ) { // phpcs:ignore
372
- return array_map( 'trim', $_REQUEST[ $key ] ); // phpcs:ignore
373
  }
374
 
375
  return $default;
367
 
368
  // Trim output.
369
  if ( is_string( $_REQUEST[ $key ] ) ) { // phpcs:ignore
370
+ return sanitize_text_field( $_REQUEST[ $key ] ); // phpcs:ignore
371
  } elseif ( is_array( $_REQUEST[ $key ] ) ) { // phpcs:ignore
372
+ return array_map( 'sanitize_text_field', $_REQUEST[ $key ] ); // phpcs:ignore
373
  }
374
 
375
  return $default;
languages/404-to-301.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: 404 to 301 - Redirect, Log and Notify 404 Errors 3.1.0\n"
6
  "Report-Msgid-Bugs-To: https://duckdev.com/products/404-to-301/\n"
7
- "POT-Creation-Date: 2021-10-18 05:32:30+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -24,45 +24,45 @@ msgstr ""
24
  "X-Textdomain-Support: yes\n"
25
  "X-Generator: grunt-wp-i18n 1.0.3\n"
26
 
27
- #: includes/admin/class-jj4t3-admin.php:139
28
  msgid "Custom Redirect"
29
  msgstr ""
30
 
31
- #: includes/admin/class-jj4t3-admin.php:163
32
- #: includes/admin/class-jj4t3-admin.php:230
33
- #: includes/admin/class-jj4t3-log-listing.php:47
34
  msgid "404 Error Logs"
35
  msgstr ""
36
 
37
- #: includes/admin/class-jj4t3-admin.php:163
38
  msgid "404 Errors"
39
  msgstr ""
40
 
41
- #: includes/admin/class-jj4t3-admin.php:172
42
  msgid "404 to 301 Settings"
43
  msgstr ""
44
 
45
- #: includes/admin/class-jj4t3-admin.php:172
46
  msgid "404 Settings"
47
  msgstr ""
48
 
49
- #: includes/admin/class-jj4t3-admin.php:204
50
  msgid "Error Logs"
51
  msgstr ""
52
 
53
- #: includes/admin/class-jj4t3-admin.php:288 includes/admin/views/admin.php:21
54
  msgid "404 to 301"
55
  msgstr ""
56
 
57
- #: includes/admin/class-jj4t3-admin.php:357 includes/admin/views/admin.php:27
58
  msgid "Settings"
59
  msgstr ""
60
 
61
- #: includes/admin/class-jj4t3-admin.php:358
62
  msgid "Logs"
63
  msgstr ""
64
 
65
- #: includes/admin/class-jj4t3-admin.php:435
66
  msgid ""
67
  "Hey %1$s, I noticed you've been using %2$s404 to 301%3$s for more than 1 "
68
  "week – that’s awesome! Could you please do me a BIG favor and give it a "
@@ -70,93 +70,97 @@ msgid ""
70
  "motivation."
71
  msgstr ""
72
 
73
- #: includes/admin/class-jj4t3-admin.php:436
74
  msgid "there"
75
  msgstr ""
76
 
77
- #: includes/admin/class-jj4t3-admin.php:442
78
  msgid "Ok, you deserve it"
79
  msgstr ""
80
 
81
- #: includes/admin/class-jj4t3-admin.php:445
82
  msgid "Nope, maybe later"
83
  msgstr ""
84
 
85
- #: includes/admin/class-jj4t3-admin.php:448
86
  msgid "I already did"
87
  msgstr ""
88
 
89
- #: includes/admin/class-jj4t3-log-listing.php:46
90
  msgid "404 Error Log"
91
  msgstr ""
92
 
93
- #: includes/admin/class-jj4t3-log-listing.php:328
94
  #: includes/functions/jj4t3-general-functions.php:317
95
  msgid "Date"
96
  msgstr ""
97
 
98
- #: includes/admin/class-jj4t3-log-listing.php:329
99
  #: includes/functions/jj4t3-general-functions.php:318
100
  #: includes/public/class-jj4t3-404-email.php:193
101
  msgid "404 Path"
102
  msgstr ""
103
 
104
- #: includes/admin/class-jj4t3-log-listing.php:330
105
  #: includes/functions/jj4t3-general-functions.php:319
106
  msgid "From"
107
  msgstr ""
108
 
109
- #: includes/admin/class-jj4t3-log-listing.php:331
110
  #: includes/functions/jj4t3-general-functions.php:320
111
  #: includes/public/class-jj4t3-404-email.php:198
112
  msgid "IP Address"
113
  msgstr ""
114
 
115
- #: includes/admin/class-jj4t3-log-listing.php:332
116
  #: includes/functions/jj4t3-general-functions.php:321
117
  msgid "User Agent"
118
  msgstr ""
119
 
120
- #: includes/admin/class-jj4t3-log-listing.php:333
121
  msgid "Customization"
122
  msgstr ""
123
 
124
- #: includes/admin/class-jj4t3-log-listing.php:475
 
 
 
 
125
  msgid "Are you sure you want to delete this item?"
126
  msgstr ""
127
 
128
- #: includes/admin/class-jj4t3-log-listing.php:477
129
  msgid "Delete"
130
  msgstr ""
131
 
132
- #: includes/admin/class-jj4t3-log-listing.php:624
133
  #: includes/admin/views/custom-redirect.php:18
134
  #: includes/admin/views/custom-redirect.php:26
135
  #: includes/admin/views/custom-redirect.php:34
136
  msgid "Default"
137
  msgstr ""
138
 
139
- #: includes/admin/class-jj4t3-log-listing.php:626
140
  msgid "Customize"
141
  msgstr ""
142
 
143
- #: includes/admin/class-jj4t3-log-listing.php:696
144
  msgid "Delete Selected"
145
  msgstr ""
146
 
147
- #: includes/admin/class-jj4t3-log-listing.php:697
148
  msgid "Delete All"
149
  msgstr ""
150
 
151
- #: includes/admin/class-jj4t3-log-listing.php:698
152
  msgid "Delete All (Keep redirects)"
153
  msgstr ""
154
 
155
- #: includes/admin/class-jj4t3-log-listing.php:735
156
  msgid "Group by"
157
  msgstr ""
158
 
159
- #: includes/admin/class-jj4t3-log-listing.php:740
160
  msgid "Apply"
161
  msgstr ""
162
 
@@ -194,7 +198,7 @@ msgid "Email alert"
194
  msgstr ""
195
 
196
  #: includes/admin/views/custom-redirect.php:40
197
- #: includes/admin/views/settings.php:30
198
  msgid "Redirect to"
199
  msgstr ""
200
 
@@ -206,7 +210,7 @@ msgid ""
206
  msgstr ""
207
 
208
  #: includes/admin/views/custom-redirect.php:52
209
- #: includes/admin/views/settings.php:17
210
  msgid "Redirect type"
211
  msgstr ""
212
 
@@ -218,108 +222,108 @@ msgstr ""
218
  msgid "Save Redirect"
219
  msgstr ""
220
 
221
- #: includes/admin/views/settings.php:24
222
  msgid "Learn more"
223
  msgstr ""
224
 
225
- #: includes/admin/views/settings.php:24
226
  msgid "about these redirect types"
227
  msgstr ""
228
 
229
- #: includes/admin/views/settings.php:33 includes/admin/views/settings.php:37
230
  msgid "Existing Page"
231
  msgstr ""
232
 
233
- #: includes/admin/views/settings.php:34 includes/admin/views/settings.php:38
234
- #: includes/admin/views/settings.php:52
235
  msgid "Custom URL"
236
  msgstr ""
237
 
238
- #: includes/admin/views/settings.php:35 includes/admin/views/settings.php:39
239
  msgid "No Redirect"
240
  msgstr ""
241
 
242
- #: includes/admin/views/settings.php:37
243
  msgid "Select any WordPress page as a 404 page"
244
  msgstr ""
245
 
246
- #: includes/admin/views/settings.php:38
247
  msgid "Redirect 404 requests to a specific URL"
248
  msgstr ""
249
 
250
- #: includes/admin/views/settings.php:39
251
  msgid "To disable redirect"
252
  msgstr ""
253
 
254
- #: includes/admin/views/settings.php:40
255
  msgid ""
256
  "You can override this by setting individual custom redirects from error "
257
  "logs list."
258
  msgstr ""
259
 
260
- #: includes/admin/views/settings.php:44
261
  msgid "Select the page"
262
  msgstr ""
263
 
264
- #: includes/admin/views/settings.php:47
265
  msgid "The default 404 page will be replaced by the page you choose in this list."
266
  msgstr ""
267
 
268
- #: includes/admin/views/settings.php:48
269
  msgid ""
270
  "You can <a href=\"%s\" target=\"_blank\">create a custom 404</a> page and "
271
  "assign that page here."
272
  msgstr ""
273
 
274
- #: includes/admin/views/settings.php:55
275
  msgid "Enter any url (including http://)"
276
  msgstr ""
277
 
278
- #: includes/admin/views/settings.php:59
279
  msgid "Log 404 Errors"
280
  msgstr ""
281
 
282
- #: includes/admin/views/settings.php:62
283
  msgid "Enable/Disable Logging"
284
  msgstr ""
285
 
286
- #: includes/admin/views/settings.php:66
287
  msgid "Email notifications"
288
  msgstr ""
289
 
290
- #: includes/admin/views/settings.php:69
291
  msgid ""
292
  "If you check this, an email will be sent on every 404 log on the admin "
293
  "email account."
294
  msgstr ""
295
 
296
- #: includes/admin/views/settings.php:73
297
  msgid "Disable URL guessing"
298
  msgstr ""
299
 
300
- #: includes/admin/views/settings.php:76
301
  msgid ""
302
  "If you disable URL guessing, it will stop WordPress from autocorrecting "
303
  "incorrect URLs. %1$sLearn more%2$s about canonical redirect."
304
  msgstr ""
305
 
306
- #: includes/admin/views/settings.php:80
307
  msgid "Email address"
308
  msgstr ""
309
 
310
- #: includes/admin/views/settings.php:84
311
  msgid "Change the recipient email address for error log notifications."
312
  msgstr ""
313
 
314
- #: includes/admin/views/settings.php:88
315
  msgid "Exclude paths"
316
  msgstr ""
317
 
318
- #: includes/admin/views/settings.php:91
319
  msgid "If you want to exclude few paths from error logs, enter here. One per line."
320
  msgstr ""
321
 
322
- #: includes/admin/views/settings.php:96
323
  msgid "Save settings"
324
  msgstr ""
325
 
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: 404 to 301 - Redirect, Log and Notify 404 Errors 3.1.1\n"
6
  "Report-Msgid-Bugs-To: https://duckdev.com/products/404-to-301/\n"
7
+ "POT-Creation-Date: 2021-11-15 07:07:12+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
24
  "X-Textdomain-Support: yes\n"
25
  "X-Generator: grunt-wp-i18n 1.0.3\n"
26
 
27
+ #: includes/admin/class-jj4t3-admin.php:149
28
  msgid "Custom Redirect"
29
  msgstr ""
30
 
31
+ #: includes/admin/class-jj4t3-admin.php:174
32
+ #: includes/admin/class-jj4t3-admin.php:255
33
+ #: includes/admin/class-jj4t3-log-listing.php:46
34
  msgid "404 Error Logs"
35
  msgstr ""
36
 
37
+ #: includes/admin/class-jj4t3-admin.php:175
38
  msgid "404 Errors"
39
  msgstr ""
40
 
41
+ #: includes/admin/class-jj4t3-admin.php:192
42
  msgid "404 to 301 Settings"
43
  msgstr ""
44
 
45
+ #: includes/admin/class-jj4t3-admin.php:193
46
  msgid "404 Settings"
47
  msgstr ""
48
 
49
+ #: includes/admin/class-jj4t3-admin.php:229
50
  msgid "Error Logs"
51
  msgstr ""
52
 
53
+ #: includes/admin/class-jj4t3-admin.php:314 includes/admin/views/admin.php:21
54
  msgid "404 to 301"
55
  msgstr ""
56
 
57
+ #: includes/admin/class-jj4t3-admin.php:383 includes/admin/views/admin.php:27
58
  msgid "Settings"
59
  msgstr ""
60
 
61
+ #: includes/admin/class-jj4t3-admin.php:384
62
  msgid "Logs"
63
  msgstr ""
64
 
65
+ #: includes/admin/class-jj4t3-admin.php:467
66
  msgid ""
67
  "Hey %1$s, I noticed you've been using %2$s404 to 301%3$s for more than 1 "
68
  "week – that’s awesome! Could you please do me a BIG favor and give it a "
70
  "motivation."
71
  msgstr ""
72
 
73
+ #: includes/admin/class-jj4t3-admin.php:468
74
  msgid "there"
75
  msgstr ""
76
 
77
+ #: includes/admin/class-jj4t3-admin.php:475
78
  msgid "Ok, you deserve it"
79
  msgstr ""
80
 
81
+ #: includes/admin/class-jj4t3-admin.php:478
82
  msgid "Nope, maybe later"
83
  msgstr ""
84
 
85
+ #: includes/admin/class-jj4t3-admin.php:481
86
  msgid "I already did"
87
  msgstr ""
88
 
89
+ #: includes/admin/class-jj4t3-log-listing.php:45
90
  msgid "404 Error Log"
91
  msgstr ""
92
 
93
+ #: includes/admin/class-jj4t3-log-listing.php:325
94
  #: includes/functions/jj4t3-general-functions.php:317
95
  msgid "Date"
96
  msgstr ""
97
 
98
+ #: includes/admin/class-jj4t3-log-listing.php:326
99
  #: includes/functions/jj4t3-general-functions.php:318
100
  #: includes/public/class-jj4t3-404-email.php:193
101
  msgid "404 Path"
102
  msgstr ""
103
 
104
+ #: includes/admin/class-jj4t3-log-listing.php:327
105
  #: includes/functions/jj4t3-general-functions.php:319
106
  msgid "From"
107
  msgstr ""
108
 
109
+ #: includes/admin/class-jj4t3-log-listing.php:328
110
  #: includes/functions/jj4t3-general-functions.php:320
111
  #: includes/public/class-jj4t3-404-email.php:198
112
  msgid "IP Address"
113
  msgstr ""
114
 
115
+ #: includes/admin/class-jj4t3-log-listing.php:329
116
  #: includes/functions/jj4t3-general-functions.php:321
117
  msgid "User Agent"
118
  msgstr ""
119
 
120
+ #: includes/admin/class-jj4t3-log-listing.php:330
121
  msgid "Customization"
122
  msgstr ""
123
 
124
+ #: includes/admin/class-jj4t3-log-listing.php:387
125
+ msgid "Ah! You are so clean that you still got ZERO errors."
126
+ msgstr ""
127
+
128
+ #: includes/admin/class-jj4t3-log-listing.php:470
129
  msgid "Are you sure you want to delete this item?"
130
  msgstr ""
131
 
132
+ #: includes/admin/class-jj4t3-log-listing.php:472
133
  msgid "Delete"
134
  msgstr ""
135
 
136
+ #: includes/admin/class-jj4t3-log-listing.php:614
137
  #: includes/admin/views/custom-redirect.php:18
138
  #: includes/admin/views/custom-redirect.php:26
139
  #: includes/admin/views/custom-redirect.php:34
140
  msgid "Default"
141
  msgstr ""
142
 
143
+ #: includes/admin/class-jj4t3-log-listing.php:616
144
  msgid "Customize"
145
  msgstr ""
146
 
147
+ #: includes/admin/class-jj4t3-log-listing.php:683
148
  msgid "Delete Selected"
149
  msgstr ""
150
 
151
+ #: includes/admin/class-jj4t3-log-listing.php:684
152
  msgid "Delete All"
153
  msgstr ""
154
 
155
+ #: includes/admin/class-jj4t3-log-listing.php:685
156
  msgid "Delete All (Keep redirects)"
157
  msgstr ""
158
 
159
+ #: includes/admin/class-jj4t3-log-listing.php:721
160
  msgid "Group by"
161
  msgstr ""
162
 
163
+ #: includes/admin/class-jj4t3-log-listing.php:726
164
  msgid "Apply"
165
  msgstr ""
166
 
198
  msgstr ""
199
 
200
  #: includes/admin/views/custom-redirect.php:40
201
+ #: includes/admin/views/settings.php:31
202
  msgid "Redirect to"
203
  msgstr ""
204
 
210
  msgstr ""
211
 
212
  #: includes/admin/views/custom-redirect.php:52
213
+ #: includes/admin/views/settings.php:18
214
  msgid "Redirect type"
215
  msgstr ""
216
 
222
  msgid "Save Redirect"
223
  msgstr ""
224
 
225
+ #: includes/admin/views/settings.php:25
226
  msgid "Learn more"
227
  msgstr ""
228
 
229
+ #: includes/admin/views/settings.php:25
230
  msgid "about these redirect types"
231
  msgstr ""
232
 
233
+ #: includes/admin/views/settings.php:34 includes/admin/views/settings.php:38
234
  msgid "Existing Page"
235
  msgstr ""
236
 
237
+ #: includes/admin/views/settings.php:35 includes/admin/views/settings.php:39
238
+ #: includes/admin/views/settings.php:53
239
  msgid "Custom URL"
240
  msgstr ""
241
 
242
+ #: includes/admin/views/settings.php:36 includes/admin/views/settings.php:40
243
  msgid "No Redirect"
244
  msgstr ""
245
 
246
+ #: includes/admin/views/settings.php:38
247
  msgid "Select any WordPress page as a 404 page"
248
  msgstr ""
249
 
250
+ #: includes/admin/views/settings.php:39
251
  msgid "Redirect 404 requests to a specific URL"
252
  msgstr ""
253
 
254
+ #: includes/admin/views/settings.php:40
255
  msgid "To disable redirect"
256
  msgstr ""
257
 
258
+ #: includes/admin/views/settings.php:41
259
  msgid ""
260
  "You can override this by setting individual custom redirects from error "
261
  "logs list."
262
  msgstr ""
263
 
264
+ #: includes/admin/views/settings.php:45
265
  msgid "Select the page"
266
  msgstr ""
267
 
268
+ #: includes/admin/views/settings.php:48
269
  msgid "The default 404 page will be replaced by the page you choose in this list."
270
  msgstr ""
271
 
272
+ #: includes/admin/views/settings.php:49
273
  msgid ""
274
  "You can <a href=\"%s\" target=\"_blank\">create a custom 404</a> page and "
275
  "assign that page here."
276
  msgstr ""
277
 
278
+ #: includes/admin/views/settings.php:56
279
  msgid "Enter any url (including http://)"
280
  msgstr ""
281
 
282
+ #: includes/admin/views/settings.php:60
283
  msgid "Log 404 Errors"
284
  msgstr ""
285
 
286
+ #: includes/admin/views/settings.php:63
287
  msgid "Enable/Disable Logging"
288
  msgstr ""
289
 
290
+ #: includes/admin/views/settings.php:67
291
  msgid "Email notifications"
292
  msgstr ""
293
 
294
+ #: includes/admin/views/settings.php:70
295
  msgid ""
296
  "If you check this, an email will be sent on every 404 log on the admin "
297
  "email account."
298
  msgstr ""
299
 
300
+ #: includes/admin/views/settings.php:74
301
  msgid "Disable URL guessing"
302
  msgstr ""
303
 
304
+ #: includes/admin/views/settings.php:77
305
  msgid ""
306
  "If you disable URL guessing, it will stop WordPress from autocorrecting "
307
  "incorrect URLs. %1$sLearn more%2$s about canonical redirect."
308
  msgstr ""
309
 
310
+ #: includes/admin/views/settings.php:81
311
  msgid "Email address"
312
  msgstr ""
313
 
314
+ #: includes/admin/views/settings.php:85
315
  msgid "Change the recipient email address for error log notifications."
316
  msgstr ""
317
 
318
+ #: includes/admin/views/settings.php:89
319
  msgid "Exclude paths"
320
  msgstr ""
321
 
322
+ #: includes/admin/views/settings.php:92
323
  msgid "If you want to exclude few paths from error logs, enter here. One per line."
324
  msgstr ""
325
 
326
+ #: includes/admin/views/settings.php:97
327
  msgid "Save settings"
328
  msgstr ""
329
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: joelcj91,duckdev
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.me/JoelCJ
5
  Requires at least: 3.5
6
- Tested up to: 5.8
7
- Stable tag: 3.1.0
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -128,6 +128,11 @@ Bug reports for 404 to 301 are always welcome. [Report here](https://duckdev.com
128
 
129
  == Changelog ==
130
 
 
 
 
 
 
131
  = 3.1.0 (18/10/2021) =
132
  **👌 Improvements**
133
 
@@ -445,8 +450,7 @@ Bug reports for 404 to 301 are always welcome. [Report here](https://duckdev.com
445
 
446
  == Upgrade Notice ==
447
 
448
- = 3.1.0 (18/10/2021) =
449
  **👌 Improvements**
450
 
451
- * Tested with WP 5.8.
452
- * Added sanitization.
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.me/JoelCJ
5
  Requires at least: 3.5
6
+ Tested up to: 5.9
7
+ Stable tag: 3.1.1
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
128
 
129
  == Changelog ==
130
 
131
+ = 3.1.1 (15/11/2021) =
132
+ **👌 Improvements**
133
+
134
+ * Security checks and improvements.
135
+
136
  = 3.1.0 (18/10/2021) =
137
  **👌 Improvements**
138
 
450
 
451
  == Upgrade Notice ==
452
 
453
+ = 3.1.1 (15/11/2021) =
454
  **👌 Improvements**
455
 
456
+ * Security checks and improvements.