404 to 301 - Version 3.0.8

Version Description

(12/06/2021) = ** Improvements**

  • Tested with WP 5.7.
  • Add capability checks for ajax actions - Thanks Jerome.
  • Improve query preparations - Thanks Jerome.
Download this release

Release Info

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

Code changes from version 3.0.7 to 3.0.8

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.0.7
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.0.7' );
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.0.8
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.0.8' );
48
  // Define plugin version.
49
  define( 'JJ4T3_DB_VERSION', '11.0' );
50
  // Define plugin log table.
assets/css/admin.min.css CHANGED
@@ -1,86 +1 @@
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
- /******/ ]);
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}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/class-jj4t3-log-listing.php CHANGED
@@ -897,6 +897,11 @@ class JJ4T3_Log_Listing extends WP_List_Table {
897
  // Yes, security check is a must when you alter something.
898
  check_ajax_referer( 'jj4t3_redirect_nonce', 'nonce' );
899
 
 
 
 
 
 
900
  // Verify if the 404 value is found.
901
  if ( empty( $_POST['url_404'] ) ) {
902
  wp_die();
@@ -907,7 +912,7 @@ class JJ4T3_Log_Listing extends WP_List_Table {
907
  global $wpdb;
908
 
909
  // Get custom redirect value from db, if exist.
910
- $result = $wpdb->get_row( $wpdb->prepare( "SELECT redirect, options FROM " . JJ4T3_TABLE . " WHERE url = '%s' AND redirect IS NOT NULL LIMIT 0,1", esc_url( $url_404 ) ), 'OBJECT' );
911
 
912
  // Get custom redirect type and url.
913
  $url = empty( $result->redirect ) ? '' : esc_url( $result->redirect );
@@ -956,6 +961,11 @@ class JJ4T3_Log_Listing extends WP_List_Table {
956
  // Yes, security check is a must when you alter something.
957
  check_ajax_referer( 'jj4t3_redirect_nonce', 'jj4t3_redirect_nonce' );
958
 
 
 
 
 
 
959
  // Custom options for the 404 path.
960
  $options = maybe_serialize(
961
  array(
@@ -988,7 +998,7 @@ class JJ4T3_Log_Listing extends WP_List_Table {
988
  do_action( 'jj4t3_log_list_custom_redirect_save', $url_404, $url );
989
 
990
  // Run update query and set custom redirect.
991
- $wpdb->query( $wpdb->prepare( "UPDATE " . JJ4T3_TABLE . " SET redirect = '%s', options = '%s' WHERE url = '%s'", $url, $options, $url_404 ) );
992
 
993
  // Die ajax request.
994
  wp_die();
@@ -1003,8 +1013,9 @@ class JJ4T3_Log_Listing extends WP_List_Table {
1003
  * @return void
1004
  */
1005
  public static function get_redirect_content() {
1006
-
1007
- include_once JJ4T3_DIR . 'includes/admin/views/custom-redirect.php';
 
1008
  }
1009
 
1010
  }
897
  // Yes, security check is a must when you alter something.
898
  check_ajax_referer( 'jj4t3_redirect_nonce', 'nonce' );
899
 
900
+ // The user should have the capability.
901
+ if ( ! current_user_can( JJ4T3_ACCESS ) ) {
902
+ wp_die();
903
+ }
904
+
905
  // Verify if the 404 value is found.
906
  if ( empty( $_POST['url_404'] ) ) {
907
  wp_die();
912
  global $wpdb;
913
 
914
  // Get custom redirect value from db, if exist.
915
+ $result = $wpdb->get_row( $wpdb->prepare( "SELECT redirect, options FROM " . JJ4T3_TABLE . " WHERE url = %s AND redirect IS NOT NULL LIMIT 0,1", esc_url( $url_404 ) ), 'OBJECT' );
916
 
917
  // Get custom redirect type and url.
918
  $url = empty( $result->redirect ) ? '' : esc_url( $result->redirect );
961
  // Yes, security check is a must when you alter something.
962
  check_ajax_referer( 'jj4t3_redirect_nonce', 'jj4t3_redirect_nonce' );
963
 
964
+ // The user should have the capability.
965
+ if ( ! current_user_can( JJ4T3_ACCESS ) ) {
966
+ wp_die();
967
+ }
968
+
969
  // Custom options for the 404 path.
970
  $options = maybe_serialize(
971
  array(
998
  do_action( 'jj4t3_log_list_custom_redirect_save', $url_404, $url );
999
 
1000
  // Run update query and set custom redirect.
1001
+ $wpdb->query( $wpdb->prepare( "UPDATE " . JJ4T3_TABLE . " SET redirect = %s, options = %s WHERE url = %s", $url, $options, $url_404 ) );
1002
 
1003
  // Die ajax request.
1004
  wp_die();
1013
  * @return void
1014
  */
1015
  public static function get_redirect_content() {
1016
+ if ( current_user_can( JJ4T3_ACCESS ) ) {
1017
+ include_once JJ4T3_DIR . 'includes/admin/views/custom-redirect.php';
1018
+ }
1019
  }
1020
 
1021
  }
includes/class-jj4t3-activator-deactivator-uninstaller.php CHANGED
@@ -30,8 +30,6 @@ class JJ4T3_Activator_Deactivator_Uninstaller {
30
  * @return void
31
  */
32
  public static function activate() {
33
- error_log('activated');
34
-
35
  // Default settings for our plugin.
36
  $options = array(
37
  'redirect_type' => '301',
30
  * @return void
31
  */
32
  public static function activate() {
 
 
33
  // Default settings for our plugin.
34
  $options = array(
35
  'redirect_type' => '301',
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.0.7\n"
6
  "Report-Msgid-Bugs-To: https://duckdev.com/products/404-to-301/\n"
7
- "POT-Creation-Date: 2021-01-28 06:10:51+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
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.0.8\n"
6
  "Report-Msgid-Bugs-To: https://duckdev.com/products/404-to-301/\n"
7
+ "POT-Creation-Date: 2021-06-12 06:45:43+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
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.7
7
- Stable tag: 3.0.7
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -19,6 +19,16 @@ If you care about your website, you should take steps to avoid 404 errors as it
19
 
20
  *Handling 404 errors in your site should be easy. With this plugin, it finally is.*
21
 
 
 
 
 
 
 
 
 
 
 
22
  404 to 301 is a simple but amazing plugin which handles all 404 errors for you. It will redirect all 404 errors to any page that you set, using 301 (or any other) status. That means no more 404 errors! Even in Google webmaster tool you are safe!
23
  You will not see any 404 error reports in your webmaster tool dashboard.
24
 
@@ -118,6 +128,13 @@ Bug reports for 404 to 301 are always welcome. [Report here](https://duckdev.com
118
 
119
  == Changelog ==
120
 
 
 
 
 
 
 
 
121
  = 3.0.7 (28/01/2021) =
122
  **🐛 Bug Fixes**
123
 
@@ -417,8 +434,9 @@ Bug reports for 404 to 301 are always welcome. [Report here](https://duckdev.com
417
 
418
  == Upgrade Notice ==
419
 
420
- = 3.0.7 (28/01/2021) =
421
- **🐛 Bug Fixes**
422
 
423
- * Activation hook was not being executed.
424
- * Table creation failed in new installations.
 
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.0.8
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
19
 
20
  *Handling 404 errors in your site should be easy. With this plugin, it finally is.*
21
 
22
+ > #### 404 to 301 Log Manager - Add-on is now available!
23
+ >
24
+ > - Instead of instant email alerts, get **hourly, twice daily, daily, twice weekly, weekly** alerts.<br />
25
+ > - Limit the amount of emails sent out based on error logs count.<br />
26
+ > - **PDF file** attachment of error logs will be delivered through the email.<br />
27
+ > - **Automatically clear** old error logs based on time period.<br />
28
+ > - Get email alerts to multiple email recipients.<br />
29
+ >
30
+ > [Get this add-on now](https://duckdev.com/products/404-to-301-log-manager/) | [See Docs](https://duckdev.com/support/docs/404-to-301-log-manager/)
31
+
32
  404 to 301 is a simple but amazing plugin which handles all 404 errors for you. It will redirect all 404 errors to any page that you set, using 301 (or any other) status. That means no more 404 errors! Even in Google webmaster tool you are safe!
33
  You will not see any 404 error reports in your webmaster tool dashboard.
34
 
128
 
129
  == Changelog ==
130
 
131
+ = 3.0.8 (12/06/2021) =
132
+ **👌 Improvements**
133
+
134
+ * Tested with WP 5.7.
135
+ * Add capability checks for ajax actions - Thanks [Jerome](https://secure.nintechnet.com/).
136
+ * Improve query preparations - Thanks [Jerome](https://secure.nintechnet.com/).
137
+
138
  = 3.0.7 (28/01/2021) =
139
  **🐛 Bug Fixes**
140
 
434
 
435
  == Upgrade Notice ==
436
 
437
+ = 3.0.8 (12/06/2021) =
438
+ **👌 Improvements**
439
 
440
+ * Tested with WP 5.7.
441
+ * Add capability checks for ajax actions - Thanks [Jerome](https://secure.nintechnet.com/).
442
+ * Improve query preparations - Thanks [Jerome](https://secure.nintechnet.com/).