404page – your smart custom 404 error page - Version 11.2.0

Version Description

if WP Super Cache is installed and caching is active URLs that result in an 404 error are automatically excluded from caching

Download this release

Release Info

Developer petersplugins
Plugin Icon 128x128 404page – your smart custom 404 error page
Version 11.2.0
Comparing to
See all releases

Code changes from version 11.1.3 to 11.2.0

404page.php CHANGED
@@ -9,7 +9,7 @@
9
  * Plugin Name: 404page - your smart custom 404 error page
10
  * Plugin URI: https://petersplugins.com/404page/
11
  * Description: Custom 404 the easy way! Set any page as custom 404 error page. No coding needed. Works with (almost) every Theme.
12
- * Version: 11.1.3
13
  * Author: Peter Raschendorfer
14
  * Author URI: https://petersplugins.com
15
  * Text Domain: 404page
9
  * Plugin Name: 404page - your smart custom 404 error page
10
  * Plugin URI: https://petersplugins.com/404page/
11
  * Description: Custom 404 the easy way! Set any page as custom 404 error page. No coding needed. Works with (almost) every Theme.
12
+ * Version: 11.2.0
13
  * Author: Peter Raschendorfer
14
  * Author URI: https://petersplugins.com
15
  * Text Domain: 404page
inc/class-404page-admin.php CHANGED
@@ -15,7 +15,7 @@ if ( ! defined( 'WPINC' ) ) {
15
  */
16
  if ( !class_exists( 'PP_404Page_Admin' ) ) {
17
 
18
- class PP_404Page_Admin extends PPF02_Admin {
19
 
20
 
21
  /**
@@ -194,7 +194,7 @@ if ( !class_exists( 'PP_404Page_Admin' ) ) {
194
 
195
  }
196
 
197
- echo '</p>';
198
 
199
  }
200
 
@@ -214,7 +214,26 @@ if ( !class_exists( 'PP_404Page_Admin' ) ) {
214
 
215
  }
216
 
217
- echo '</p>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
 
219
  }
220
 
@@ -249,7 +268,7 @@ if ( !class_exists( 'PP_404Page_Admin' ) ) {
249
  esc_html__( 'Send an 404 error if the page is accessed directly by its URL', '404page' ),
250
  'settings_fire_404',
251
  false,
252
- '<span class="dashicons dashicons-info"></span>&nbsp;' . esc_html__( 'Uncheck this if you want the selected page to be accessible.', '404page' ) . ( function_exists( 'wpsupercache_activate' ) ? '<br /><span class="dashicons dashicons-warning"></span>&nbsp;<strong>' . esc_html__( 'WP Super Cache Plugin detected', '404page' ) . '</strong>. ' . __ ( 'If the page you selected as 404 error page is in cache, always a HTTP code 200 is sent. To avoid this and send a HTTP code 404 you have to exlcude this page from caching', '404page' ) . ' (<a href="' . admin_url( 'options-general.php?page=wpsupercache&tab=settings#rejecturi' ) . '">' . esc_html__( 'Click here', '404page' ) . '</a>).<br />(<a href="' . esc_url( 'https://petersplugins.com/' . $this->core()->get_plugin_slug() . '/manual/#wp_super_cache' ) . '">' . esc_html__( 'Read more', '404page' ) . '</a>)' : '' )
253
  );
254
 
255
  }
15
  */
16
  if ( !class_exists( 'PP_404Page_Admin' ) ) {
17
 
18
+ class PP_404Page_Admin extends PPF03_Admin {
19
 
20
 
21
  /**
194
 
195
  }
196
 
197
+ echo '</p><br />';
198
 
199
  }
200
 
214
 
215
  }
216
 
217
+ echo '</p><br />';
218
+
219
+ }
220
+
221
+
222
+ // WP Super Cache
223
+ // since 11.2.0
224
+ // WP Super Cache
225
+ if ( defined('WPCACHEHOME') ) {
226
+
227
+ global $cache_enabled;
228
+
229
+ // is caching active?
230
+ if ( $cache_enabled ) {
231
+
232
+ echo '<p class="pp-404page-info">';
233
+ echo esc_html__( 'WP Super Cache detected. All 404 errors are automatically excluded from caching.', '404page' );
234
+ echo '</p><br />';
235
+
236
+ }
237
 
238
  }
239
 
268
  esc_html__( 'Send an 404 error if the page is accessed directly by its URL', '404page' ),
269
  'settings_fire_404',
270
  false,
271
+ '<span class="dashicons dashicons-info"></span>&nbsp;' . esc_html__( 'Uncheck this if you want the selected page to be accessible.', '404page' )
272
  );
273
 
274
  }
inc/class-404page-block-editor.php CHANGED
@@ -15,7 +15,7 @@ if ( ! defined( 'WPINC' ) ) {
15
  */
16
  if ( !class_exists( 'PP_404Page_BlockEditor' ) ) {
17
 
18
- class PP_404Page_BlockEditor extends PPF02_SubClass {
19
 
20
  /**
21
  * Do Init
15
  */
16
  if ( !class_exists( 'PP_404Page_BlockEditor' ) ) {
17
 
18
+ class PP_404Page_BlockEditor extends PPF03_SubClass {
19
 
20
  /**
21
  * Do Init
inc/class-404page-classic-editor.php CHANGED
@@ -15,7 +15,7 @@ if ( ! defined( 'WPINC' ) ) {
15
  */
16
  if ( !class_exists( 'PP_404Page_ClassicEditor' ) ) {
17
 
18
- class PP_404Page_ClassicEditor extends PPF02_SubClass {
19
 
20
  /**
21
  * Do Init
15
  */
16
  if ( !class_exists( 'PP_404Page_ClassicEditor' ) ) {
17
 
18
+ class PP_404Page_ClassicEditor extends PPF03_SubClass {
19
 
20
  /**
21
  * Do Init
inc/class-404page-deprecated.php CHANGED
@@ -17,7 +17,7 @@ if ( ! defined( 'WPINC' ) ) {
17
  */
18
  if ( !class_exists( 'PP_404Page_Deprecated' ) ) {
19
 
20
- class PP_404Page_Deprecated extends PPF02_SubClass {
21
 
22
  /**
23
  * Do Init
17
  */
18
  if ( !class_exists( 'PP_404Page_Deprecated' ) ) {
19
 
20
+ class PP_404Page_Deprecated extends PPF03_SubClass {
21
 
22
  /**
23
  * Do Init
inc/class-404page-settings.php CHANGED
@@ -17,7 +17,7 @@ if ( ! defined( 'WPINC' ) ) {
17
  */
18
  if ( !class_exists( 'PP_404Page_Settings' ) ) {
19
 
20
- class PP_404Page_Settings extends PPF02_Settings {
21
 
22
  /**
23
  * sanitize settings
17
  */
18
  if ( !class_exists( 'PP_404Page_Settings' ) ) {
19
 
20
+ class PP_404Page_Settings extends PPF03_Settings {
21
 
22
  /**
23
  * sanitize settings
inc/class-404page.php CHANGED
@@ -23,7 +23,7 @@ if ( ! defined( 'PP_404' ) ) {
23
  if ( !class_exists( 'PP_404Page' ) ) {
24
 
25
 
26
- class PP_404Page extends PPF02_Plugin {
27
 
28
 
29
  /**
@@ -287,6 +287,8 @@ if ( !class_exists( 'PP_404Page' ) ) {
287
 
288
  if ( ! $this->is_native() ) {
289
 
 
 
290
  $wp_query = null;
291
  $wp_query = new WP_Query();
292
  $wp_query->query( 'page_id=' . $this->get_page_id() );
@@ -349,6 +351,8 @@ if ( !class_exists( 'PP_404Page' ) ) {
349
 
350
  remove_action( 'pre_get_posts', array ( $this, 'exclude_404page' ) );
351
  remove_filter( 'get_pages', array ( $this, 'remove_404page_from_array' ), 10, 2 );
 
 
352
 
353
  $wp_query = null;
354
  $wp_query = new WP_Query();
@@ -356,6 +360,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
356
  // @since 8
357
  // added suppress_filters for compatibilty with current WPML version
358
  $wp_query->query( array( 'page_id' => $pageid, 'suppress_filters' => true ) );
 
359
 
360
  $wp_query->the_post();
361
  $this->template = get_page_template();
@@ -366,6 +371,8 @@ if ( !class_exists( 'PP_404Page' ) ) {
366
  add_filter( 'body_class', array( $this, 'add_404_body_class' ) );
367
  add_filter( 'template_include', array( $this, 'change_404_template' ), 999 );
368
 
 
 
369
  $this->maybe_force_404();
370
  $this->do_404page_action();
371
 
@@ -406,6 +413,29 @@ if ( !class_exists( 'PP_404Page' ) ) {
406
  return $posts;
407
  }
408
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
 
410
  /**
411
  * for DW Question & Answer plugin
23
  if ( !class_exists( 'PP_404Page' ) ) {
24
 
25
 
26
+ class PP_404Page extends PPF03_Plugin {
27
 
28
 
29
  /**
287
 
288
  if ( ! $this->is_native() ) {
289
 
290
+ $this->disable_caching();
291
+
292
  $wp_query = null;
293
  $wp_query = new WP_Query();
294
  $wp_query->query( 'page_id=' . $this->get_page_id() );
351
 
352
  remove_action( 'pre_get_posts', array ( $this, 'exclude_404page' ) );
353
  remove_filter( 'get_pages', array ( $this, 'remove_404page_from_array' ), 10, 2 );
354
+
355
+ $this->disable_caching();
356
 
357
  $wp_query = null;
358
  $wp_query = new WP_Query();
360
  // @since 8
361
  // added suppress_filters for compatibilty with current WPML version
362
  $wp_query->query( array( 'page_id' => $pageid, 'suppress_filters' => true ) );
363
+
364
 
365
  $wp_query->the_post();
366
  $this->template = get_page_template();
371
  add_filter( 'body_class', array( $this, 'add_404_body_class' ) );
372
  add_filter( 'template_include', array( $this, 'change_404_template' ), 999 );
373
 
374
+
375
+
376
  $this->maybe_force_404();
377
  $this->do_404page_action();
378
 
413
  return $posts;
414
  }
415
 
416
+ /**
417
+ * disable caching for known caching plugins
418
+ *
419
+ * @since 11.2.0
420
+ */
421
+ function disable_caching() {
422
+
423
+ // WP Super Cache
424
+ if ( defined('WPCACHEHOME') ) {
425
+
426
+ global $cache_enabled;
427
+
428
+ // is caching active?
429
+ if ( $cache_enabled ) {
430
+
431
+ define( 'DONOTCACHEPAGE', true );
432
+
433
+ }
434
+
435
+ }
436
+
437
+ }
438
+
439
 
440
  /**
441
  * for DW Question & Answer plugin
inc/ppf/ppf-plugin-addon.php ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Plugin Addon Base Class
5
+ *
6
+ * Peter's Plugins Foundation 04
7
+ *
8
+ * @package PPF04
9
+ * @author Peter Raschendorfer
10
+ * @license GPL2+
11
+ */
12
+
13
+
14
+ if ( !class_exists( 'PPF04_Plugin_Addon' ) ) {
15
+
16
+ abstract class PPF04_Plugin_Addon extends PPF04_Plugin {
17
+
18
+ /**
19
+ * Base Plugin Name
20
+ *
21
+ * @since PPF04
22
+ * @var string
23
+ * @access private
24
+ */
25
+ private $base_plugin_name;
26
+
27
+
28
+ /**
29
+ * Base Plugin Function
30
+ *
31
+ * @since PPF04
32
+ * @var string
33
+ * @access private
34
+ */
35
+ private $base_plugin_function;
36
+
37
+
38
+ /**
39
+ * Base Plugin Min Required Version
40
+ *
41
+ * @since PPF04
42
+ * @var string
43
+ * @access private
44
+ */
45
+ private $base_plugin_min_version;
46
+
47
+
48
+ /**
49
+ * Settings Class ( if the plugin uses settings )
50
+ *
51
+ * @since PPF01
52
+ * @var object
53
+ * @access private
54
+ */
55
+ private $settings;
56
+
57
+
58
+ /**
59
+ * Init the Class
60
+ *
61
+ * @since PPF04
62
+ * same as PPFxx_Plugin plus
63
+ * @type string $base_plugin_name Name of Base Plugin
64
+ * @type string $base_plugin_function Function to access Base Plugin
65
+ * @type string $base_plugin_min_version Minimal required version of Base Plugin
66
+ */
67
+ public function __construct( $settings ) {
68
+
69
+ $this->plugin_file = $settings['file'];
70
+ $this->plugin_slug = $settings['slug'];
71
+ $this->plugin_name = $settings['name'];
72
+ $this->plugin_shortname = $settings['shortname'];
73
+ $this->plugin_version = $settings['version'];
74
+
75
+ $this->base_plugin_name = $settings['base_plugin_name'];
76
+ $this->base_plugin_function = $settings['base_plugin_function'];
77
+ $this->base_plugin_min_version = $settings['base_plugin_min_version'];
78
+
79
+ $this->_data_key = str_replace( '-', '_', $settings['slug'] ) . '_data';
80
+ $this->data_load();
81
+
82
+ $this->plugin_file = $settings['file'];
83
+
84
+ $this->addon_check();
85
+
86
+ }
87
+
88
+
89
+ /**
90
+ * get Base Plugin Name
91
+ *
92
+ * @since PPF04
93
+ * @access public
94
+ * @return string
95
+ */
96
+ public function get_base_plugin_name() {
97
+
98
+ return $this->base_plugin_name;
99
+
100
+ }
101
+
102
+
103
+ /**
104
+ * get Base Plugin Function
105
+ *
106
+ * @since PPF04
107
+ * @access public
108
+ * @return string
109
+ */
110
+ public function get_base_plugin_function() {
111
+
112
+ return $this->base_plugin_function;
113
+
114
+ }
115
+
116
+
117
+ /**
118
+ * get Base Plugin minimum required version^
119
+ *
120
+ * @since PPF04
121
+ * @access public
122
+ * @return string
123
+ */
124
+ public function get_base_plugin_min_version() {
125
+
126
+ return $this->base_plugin_min_version;
127
+
128
+ }
129
+
130
+
131
+ /**
132
+ * check if base plugin exists and has required minimum version
133
+ *
134
+ * @since PPF04
135
+ * @access private
136
+ */
137
+ private function addon_check() {
138
+
139
+ // we need to place all the stuff in plugins_loaded to ensure the base plugin is loaded
140
+
141
+ add_action( 'plugins_loaded', function() {
142
+
143
+ $this->plugin_install_update();
144
+
145
+ $this->plugin_init();
146
+
147
+ $base = $this->get_base_plugin_function();
148
+
149
+ if ( ! function_exists( $base ) ) {
150
+
151
+ add_action('admin_notices', array( $this, 'admin_notice_base_plugin_not_found' ) );
152
+
153
+ } elseif ( version_compare( $this->get_base_plugin_min_version(), $base()->get_plugin_version(), '>' ) ) {
154
+
155
+ add_action('admin_notices', array( $this, 'admin_notice_base_plugin_version_insufficient' ) );
156
+
157
+ } else {
158
+
159
+ $this->addon_init();
160
+
161
+ }
162
+
163
+ } );
164
+
165
+
166
+ }
167
+
168
+
169
+ /**
170
+ * addon init
171
+ *
172
+ * force to be defined
173
+ *
174
+ * @since PPF04
175
+ */
176
+ abstract public function addon_init();
177
+
178
+
179
+ /**
180
+ * add admin notice if base plugin not found
181
+ *
182
+ * force to be defined
183
+ *
184
+ * @since PPF04
185
+ */
186
+ abstract public function admin_notice_base_plugin_not_found();
187
+
188
+
189
+ /**
190
+ * add admin notice if base plugin version insufficient
191
+ *
192
+ * force to be defined
193
+ *
194
+ * @since PPF04
195
+ */
196
+ abstract public function admin_notice_base_plugin_version_insufficient();
197
+
198
+
199
+ }
200
+
201
+ }
202
+
203
+ ?>
loader.php CHANGED
@@ -42,7 +42,7 @@ function pp_404page() {
42
  'slug' => pathinfo( dirname( __FILE__ ) . '/404page.php', PATHINFO_FILENAME ),
43
  'name' => '404page - your smart custom 404 error page',
44
  'shortname' => '404page',
45
- 'version' => '11.1.3'
46
  ) );
47
 
48
  }
42
  'slug' => pathinfo( dirname( __FILE__ ) . '/404page.php', PATHINFO_FILENAME ),
43
  'name' => '404page - your smart custom 404 error page',
44
  'shortname' => '404page',
45
+ 'version' => '11.2.0'
46
  ) );
47
 
48
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: petersplugins
3
  Tags: page, 404, error, error page, 404 page, page not found, page not found error, 404 error page, missing, broken link, template, 404 link, seo, custom 404, custom 404 page, custom 404 error, custom 404 error page, customize 404, customize 404 page, customize 404 error page, classicpress
4
  Requires at least: 4.0
5
  Tested up to: 5.3
6
- Stable tag: 11.1.3
7
  Requires PHP: 5.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -75,7 +75,7 @@ The only requirement for this plugin is that you change the Permalink Structure
75
  * [Twenty Sixteen](https://wordpress.org/themes/twentysixteen/)
76
  * [Twenty Seventeen](https://wordpress.org/themes/twentyseventeen/)
77
  * [Twenty Nineteen](https://wordpress.org/themes/twentynineteen/)
78
- * [Twenty Twenty]
79
  * [Vantage](https://wordpress.org/themes/vantage/)
80
  * [Virtue](https://wordpress.org/themes/virtue/)
81
  * [Zerif Lite](http://themeisle.com/themes/zerif-lite/)
@@ -171,6 +171,12 @@ Please use the [Support Forum](https://wordpress.org/support/plugin/404page).
171
 
172
  == Changelog ==
173
 
 
 
 
 
 
 
174
  = 11.1.3 (2019-12-29) =
175
  * Plugin Foundation updated to PPF03, no functional changes
176
 
@@ -335,6 +341,12 @@ Please use the [Support Forum](https://wordpress.org/support/plugin/404page).
335
 
336
  == Upgrade Notice ==
337
 
 
 
 
 
 
 
338
  = 11.1.3 =
339
  Plugin Foundation updated to PPF03
340
 
3
  Tags: page, 404, error, error page, 404 page, page not found, page not found error, 404 error page, missing, broken link, template, 404 link, seo, custom 404, custom 404 page, custom 404 error, custom 404 error page, customize 404, customize 404 page, customize 404 error page, classicpress
4
  Requires at least: 4.0
5
  Tested up to: 5.3
6
+ Stable tag: 11.2.0
7
  Requires PHP: 5.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
75
  * [Twenty Sixteen](https://wordpress.org/themes/twentysixteen/)
76
  * [Twenty Seventeen](https://wordpress.org/themes/twentyseventeen/)
77
  * [Twenty Nineteen](https://wordpress.org/themes/twentynineteen/)
78
+ * [Twenty Twenty](https://wordpress.org/themes/twentytwenty/)
79
  * [Vantage](https://wordpress.org/themes/vantage/)
80
  * [Virtue](https://wordpress.org/themes/virtue/)
81
  * [Zerif Lite](http://themeisle.com/themes/zerif-lite/)
171
 
172
  == Changelog ==
173
 
174
+ = 11.2.0 (2020-01-01) =
175
+ * if WP Super Cache is installed and caching is active URLs that result in an 404 error are automatically excluded from caching
176
+
177
+ = 11.1.4 (2019-12-29) =
178
+ * urgent bug fix for PPF03
179
+
180
  = 11.1.3 (2019-12-29) =
181
  * Plugin Foundation updated to PPF03, no functional changes
182
 
341
 
342
  == Upgrade Notice ==
343
 
344
+ = 11.2.0 =
345
+ if WP Super Cache is installed and caching is active URLs that result in an 404 error are automatically excluded from caching
346
+
347
+ = 11.1.4 =
348
+ urgent bug fix for PPF03
349
+
350
  = 11.1.3 =
351
  Plugin Foundation updated to PPF03
352