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

Version Description

fixed two bugs, plus further enhancements

Download this release

Release Info

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

Code changes from version 3.0 to 3.1

404page.php CHANGED
@@ -9,7 +9,7 @@
9
  * Plugin Name: 404page - your smart custom 404 error page
10
  * Plugin URI: http://petersplugins.com/free-wordpress-plugins/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: 3.0
13
  * Author: Peter Raschendorfer
14
  * Author URI: http://petersplugins.com
15
  * Text Domain: 404page
9
  * Plugin Name: 404page - your smart custom 404 error page
10
  * Plugin URI: http://petersplugins.com/free-wordpress-plugins/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: 3.1
13
  * Author: Peter Raschendorfer
14
  * Author URI: http://petersplugins.com
15
  * Text Domain: 404page
assets/css/404page-ui.css CHANGED
@@ -1,26 +1,30 @@
 
 
 
 
1
  #pp-404page-settings .form-table th, .form-table td {
2
  display: block;
3
  width: auto;
4
  }
5
 
6
  #pp-404page-settings .form-table th {
7
- padding: 20px 10px 0 0;
 
8
  }
9
 
10
  #pp-404page-settings .form-table td {
11
- padding: 6px 10px 0 0;
 
12
  }
13
 
14
- #pp-seetings-advanced .form-table th {
15
- display: none;
 
 
16
  }
17
 
18
- #pp-seetings-advanced .form-table td p:first-child {
19
- font-weight: 600;
20
- }
21
-
22
- #pp-seetings-advanced .form-table td p:last-child {
23
- padding: 0 0 20px 40px;
24
  }
25
 
26
  .ui-accordion .ui-accordion-header {
@@ -38,42 +42,47 @@
38
  content: "\f460";
39
  }
40
 
41
- .ui-accordion-content {
42
- padding-left: 30px;
43
- }
44
-
45
  #pp-404page-settings input[type="checkbox"] {
46
- display: none;
47
  }
48
 
49
  #pp-404page-settings input[type="checkbox"] + label.check {
50
- display: inline-block;
51
- border: 2px solid #DDD;
52
- box-shadow: 0px 0px 5px 0px rgba(42,42,42,.75);
53
- border-style:solid;
54
- border-radius:5px;
55
- width: 30px;
56
- height: 30px;
57
- line-height: 30px;
58
- text-align: center;
59
- font-family: dashicons;
60
- font-size: 2em;
61
- margin-right: 10px;
62
  }
63
 
64
  #pp-404page-settings input[type="checkbox"]:disabled + label.check {
65
  background-color: #DDD;
66
- cursor: not-allowed;
67
  }
68
 
69
- #pp-404page-settings input[type="checkbox"] + label.check:before {
70
- content: "";
 
 
 
 
 
 
 
 
71
  }
72
 
73
- #pp-404page-settings input[type="checkbox"]:enabled:checked + label.check:before {
74
- content: "\f147";
75
  }
76
 
 
 
 
 
77
 
78
 
79
  #pp-seetings-advanced>div {
@@ -81,12 +90,11 @@
81
  }
82
 
83
  #pp-404page-settings select {
84
- border: 2px solid #DDD;
85
- box-shadow: 0px 0px 5px 0px rgba(42,42,42,.75);
86
- border-style:solid;
87
  border-radius:5px;
88
  height: 40px;
89
  line-height: 40px;
 
90
  }
91
 
92
  #pp-404page-settings .dashicons-warning, #pp-404page-settings input[type="checkbox"] + label.check.warning:before {
1
+ #pp-404page-settings h1 {
2
+ margin-bottom: 40px;
3
+ }
4
+
5
  #pp-404page-settings .form-table th, .form-table td {
6
  display: block;
7
  width: auto;
8
  }
9
 
10
  #pp-404page-settings .form-table th {
11
+ padding: 0;
12
+ font-weight: normal;
13
  }
14
 
15
  #pp-404page-settings .form-table td {
16
+ padding: 0;
17
+ margin-bottom: 20px;
18
  }
19
 
20
+ #pp-404page-settings .form-table td p {
21
+ padding: 0;
22
+ line-height: 1.2;
23
+ margin-bottom: 20px;
24
  }
25
 
26
+ #pp-seetings-advanced .form-table th {
27
+ display: none;
 
 
 
 
28
  }
29
 
30
  .ui-accordion .ui-accordion-header {
42
  content: "\f460";
43
  }
44
 
 
 
 
 
45
  #pp-404page-settings input[type="checkbox"] {
46
+ display: none;
47
  }
48
 
49
  #pp-404page-settings input[type="checkbox"] + label.check {
50
+ cursor: pointer;
51
+ text-indent: -9999px;
52
+ width: 80px;
53
+ height: 40px;
54
+ background: grey;
55
+ display: block;
56
+ border-radius: 40px;
57
+ position: relative;
58
+ float: left;
59
+ margin-right: 40px;
 
 
60
  }
61
 
62
  #pp-404page-settings input[type="checkbox"]:disabled + label.check {
63
  background-color: #DDD;
 
64
  }
65
 
66
+ #pp-404page-settings input[type="checkbox"] + label.check:after {
67
+ content: '';
68
+ position: absolute;
69
+ top: 5px;
70
+ left: 5px;
71
+ width: 30px;
72
+ height: 30px;
73
+ background: #fff;
74
+ border-radius: 30px;
75
+ transition: 0.3s;
76
  }
77
 
78
+ #pp-404page-settings input[type="checkbox"]:enabled:checked + label.check {
79
+ background: #104060;
80
  }
81
 
82
+ #pp-404page-settings input[type="checkbox"]:enabled:checked + label.check:after {
83
+ left: calc(100% - 5px);
84
+ transform: translateX(-100%);
85
+ }
86
 
87
 
88
  #pp-seetings-advanced>div {
90
  }
91
 
92
  #pp-404page-settings select {
93
+ border: 1px solid #104060;
 
 
94
  border-radius:5px;
95
  height: 40px;
96
  line-height: 40px;
97
+ margin: 5px 0;
98
  }
99
 
100
  #pp-404page-settings .dashicons-warning, #pp-404page-settings input[type="checkbox"] + label.check.warning:before {
assets/js/404page.js CHANGED
@@ -1,11 +1,13 @@
1
  jQuery(document).ready(function($) {
2
- $( '#pp-404page-admin-notice-1' ).on( 'click', '.notice-dismiss', function ( event ) {
 
3
  event.preventDefault();
4
  data = {
5
  action: 'pp_404page_dismiss_admin_notice',
6
- pp_404page_dismiss_admin_notice: pp_404page_remove.pp_404page_dismiss_admin_notice_number
7
  };
8
  $.post( ajaxurl, data );
9
  return false;
10
  });
 
11
  });
1
  jQuery(document).ready(function($) {
2
+
3
+ $( '.pp-404page-admin-notice' ).on( 'click', '.notice-dismiss', function ( event ) {
4
  event.preventDefault();
5
  data = {
6
  action: 'pp_404page_dismiss_admin_notice',
7
+ pp_404page_dismiss_admin_notice: $( this ).parent().attr( 'id' )
8
  };
9
  $.post( ajaxurl, data );
10
  return false;
11
  });
12
+
13
  });
inc/class-404page.php CHANGED
@@ -44,7 +44,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
44
  $this->_file = $file;
45
  $this->plugin_name = '404page';
46
  $this->plugin_slug = '404page';
47
- $this->version = '3.0';
48
  $this->get_settings();
49
  $this->load();
50
  }
@@ -146,6 +146,8 @@ if ( !class_exists( 'PP_404Page' ) ) {
146
 
147
  // Customizr Compatibility Mode
148
 
 
 
149
  add_filter( 'tc_404_header_content', array( $this, 'show404title_customizr_mode' ), 999 );
150
  add_filter( 'tc_404_content', array( $this, 'show404_customizr_mode' ), 999 );
151
  add_filter( 'tc_404_selectors', array( $this, 'show404articleselectors_customizr_mode' ), 999 );
@@ -247,6 +249,12 @@ if ( !class_exists( 'PP_404Page' ) ) {
247
  $curpageid = apply_filters( 'wpml_object_id', $curpageid, 'page', $sitepress->get_default_language() );
248
  $pageid = apply_filters( 'wpml_object_id', $pageid, 'page', $sitepress->get_default_language() );
249
 
 
 
 
 
 
 
250
  }
251
 
252
  if ( $pageid == $curpageid ) {
@@ -317,10 +325,49 @@ if ( !class_exists( 'PP_404Page' ) ) {
317
 
318
 
319
  /**
320
- * add class error404 to the body classes
321
  */
322
  function add_404_body_class( $classes ) {
323
- $classes[] = 'error404';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
  return $classes;
325
  }
326
 
@@ -480,8 +527,8 @@ if ( !class_exists( 'PP_404Page' ) ) {
480
  function admin_hide() {
481
 
482
  echo '<p><input type="checkbox" id="404page_hide" name="404page_hide" value="1"' . checked( true, $this->settings['404page_hide'], false ) . '/>';
483
- echo '<label for="404page_hide" class="check"></label>' . __( 'Hide the selected page from the Pages list', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_hide_page"></a></p>';
484
- echo '<p><span class="dashicons dashicons-info"></span>&nbsp;' . __( 'For Administrators the page is always visible.', '404page' ) . '</p>';
485
 
486
  }
487
 
@@ -492,15 +539,17 @@ if ( !class_exists( 'PP_404Page' ) ) {
492
  function admin_fire404() {
493
 
494
  echo '<p><input type="checkbox" id="404page_fire_error" name="404page_fire_error" value="1"' . checked( true, $this->settings['404page_fire_error'], false ) . '/>';
495
- echo '<label for="404page_fire_error" class="check"></label>' . __( 'Send an 404 error if the page is accessed directly by its URL', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_fire_404"></a></p>';
496
- echo '<p><span class="dashicons dashicons-info"></span>&nbsp;' . __( 'Uncheck this if you want the selected page to be accessible.', '404page' ) . '</p>';
497
 
498
  if ( function_exists( 'wpsupercache_activate' ) ) {
499
 
500
- echo '<p><span class="dashicons dashicons-warning"></span>&nbsp;<strong>' . __( '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' ) . '">' . __( 'Click here', '404page' ) . '</a>).<br />(<a href="' . $this->dc_url . '/#wp_super_cache">' . __( 'Read more', '404page' ) . '</a>)</p>';
501
 
502
  }
503
 
 
 
504
  }
505
 
506
 
@@ -510,8 +559,8 @@ if ( !class_exists( 'PP_404Page' ) ) {
510
  function admin_force404() {
511
 
512
  echo '<p><input type="checkbox" id="404page_force_error" name="404page_force_error" value="1"' . checked( true, $this->settings['404page_force_error'], false ) . '/>';
513
- echo '<label for="404page_force_error" class="check warning"></label>' . __( 'Force 404 error after loading page', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_force_404"></a></p>';
514
- echo '<p><span class="dashicons dashicons-warning"></span>&nbsp;' . __( 'Generally this is not needed. It is not recommended to activate this option, unless it is necessary. Please note that this may cause problems with your theme.', '404page' ) . '</p>';
515
 
516
  }
517
 
@@ -522,8 +571,8 @@ if ( !class_exists( 'PP_404Page' ) ) {
522
  function admin_noguess() {
523
 
524
  echo '<p><input type="checkbox" id="404page_no_url_guessing" name="404page_no_url_guessing" value="1"' . checked( true, $this->settings['404page_no_url_guessing'], false ) . '/>';
525
- echo '<label for="404page_no_url_guessing" class="check warning"></label>' . __( 'Disable URL autocorrection guessing', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_stop_guessing"></a></p>';
526
- echo '<p><span class="dashicons dashicons-warning"></span>&nbsp;' . __( 'This stops WordPress from URL autocorrection guessing. Only activate, if you are sure about the consequences.', '404page' ) . '</p>';
527
 
528
  }
529
 
@@ -543,8 +592,8 @@ if ( !class_exists( 'PP_404Page' ) ) {
543
  }
544
 
545
  echo '<p><input type="checkbox" id="404page_method" name="404page_method" value="CMP"' . checked( 'CMP', $this->settings['404page_method'], false ) . $dis . '/>';
546
- echo '<label for="404page_method" class="check"></label>' . __( 'Activate Compatibility Mode', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_operating_method"></a></p>';
547
- echo '<p><span class="dashicons dashicons-info"></span>&nbsp;';
548
 
549
  if ( $this->settings['404page_native'] ) {
550
 
@@ -567,7 +616,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
567
 
568
  }
569
 
570
- echo '</p>';
571
 
572
  }
573
 
@@ -634,15 +683,21 @@ if ( !class_exists( 'PP_404Page' ) ) {
634
  */
635
  function remove_404page_from_array( $pages, $r ) {
636
 
637
- for ( $i = 0; $i < sizeof( $pages ); $i++ ) {
638
 
639
- if ( $pages[$i]->ID == $this->settings['404page_page_id'] ) {
640
-
641
- unset( $pages[$i] );
642
- break;
 
 
 
 
 
 
643
 
644
  }
645
-
646
  }
647
 
648
  return array_values( $pages );
@@ -678,8 +733,6 @@ if ( !class_exists( 'PP_404Page' ) ) {
678
  function admin_js() {
679
 
680
  wp_enqueue_script( '404pagejs', plugins_url( 'assets/js/404page.js', $this->_file ), 'jquery', $this->version, true );
681
-
682
- wp_localize_script( '404pagejs', 'pp_404page_remove', array( 'pp_404page_dismiss_admin_notice_number' => 'pp-404page-admin-notice-1' ) );
683
 
684
  if ( get_current_screen()->id == $this->admin_handle ) {
685
 
@@ -730,12 +783,27 @@ if ( !class_exists( 'PP_404Page' ) ) {
730
  // invite to follow me
731
  if ( current_user_can( 'manage_options' ) && get_user_meta( get_current_user_id(), 'pp-404page-admin-notice-1', true ) != 'dismissed' ) {
732
  ?>
733
- <div class="notice is-dismissible" id="pp-404page-admin-notice-1">
734
  <p><img src="<?php echo plugins_url( 'assets/pluginicon.png', $this->_file ); ?>" style="width: 48px; height: 48px; float: left; margin-right: 20px" /><strong><?php _e( 'Do you like the 404page plugin?', '404page' ); ?></strong><br /><?php _e( 'Follow me:', '404page' ); ?> <a class="dashicons dashicons-googleplus" href="http://g.petersplugins.com/" title="<?php _e( 'Authors Google+ Page', '404page' ); ?>"></a> <a class="dashicons dashicons-facebook-alt" href="http://f.petersplugins.com/" title="<?php _e( 'Authors facebook Page', '404page' ); ?>"></a><div class="clear"></div></p>
735
  </div>
736
  <?php
737
  }
738
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
739
  }
740
 
741
 
@@ -840,7 +908,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
840
 
841
 
842
  /**
843
- * get the id of the 404 page in the current language if WPML is active
844
  */
845
  private function get_page_id() {
846
 
@@ -853,6 +921,14 @@ if ( !class_exists( 'PP_404Page' ) ) {
853
  // WPML is active
854
  $pageid = apply_filters( 'wpml_object_id', $pageid, 'page', true );
855
 
 
 
 
 
 
 
 
 
856
  }
857
 
858
  }
44
  $this->_file = $file;
45
  $this->plugin_name = '404page';
46
  $this->plugin_slug = '404page';
47
+ $this->version = '3.1';
48
  $this->get_settings();
49
  $this->load();
50
  }
146
 
147
  // Customizr Compatibility Mode
148
 
149
+ // @since 3.1
150
+ add_filter( 'body_class', array( $this, 'add_404_body_class_customizr_mode' ) );
151
  add_filter( 'tc_404_header_content', array( $this, 'show404title_customizr_mode' ), 999 );
152
  add_filter( 'tc_404_content', array( $this, 'show404_customizr_mode' ), 999 );
153
  add_filter( 'tc_404_selectors', array( $this, 'show404articleselectors_customizr_mode' ), 999 );
249
  $curpageid = apply_filters( 'wpml_object_id', $curpageid, 'page', $sitepress->get_default_language() );
250
  $pageid = apply_filters( 'wpml_object_id', $pageid, 'page', $sitepress->get_default_language() );
251
 
252
+ } elseif ( defined( 'POLYLANG_VERSION' ) ) {
253
+
254
+ // Polylang is active - get the post ID of the default language
255
+ $curpageid = pll_get_post( $curpageid, pll_default_language() );
256
+ $pageid = pll_get_post( $pageid, pll_default_language() );
257
+
258
  }
259
 
260
  if ( $pageid == $curpageid ) {
325
 
326
 
327
  /**
328
+ * add body classes
329
  */
330
  function add_404_body_class( $classes ) {
331
+
332
+ // as of v 3.1 we first check if the class error404 already exists
333
+ if ( ! in_array( 'error404', $classes ) ) {
334
+
335
+ $classes[] = 'error404';
336
+
337
+ }
338
+
339
+ // debug class
340
+ // @since 3.1
341
+ $debug_class = 'pp404-';
342
+ if ( $this->settings['404page_native'] ) {
343
+ $debug_class .= 'native';
344
+ } elseif ( defined( 'CUSTOMIZR_VER' ) ) {
345
+ $debug_class .= 'customizr';
346
+ } elseif ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
347
+ $debug_class .= 'wpml';
348
+ } elseif ( $this->settings['404page_method'] != 'STD' ) {
349
+ $debug_class .= 'wpml';
350
+ } else {
351
+ $debug_class .= 'std';
352
+ }
353
+ $classes[] = $debug_class;
354
+
355
+ return $classes;
356
+ }
357
+
358
+
359
+ /**
360
+ * add body classes customizr mode
361
+ * @since 3.1
362
+ */
363
+ function add_404_body_class_customizr_mode( $classes ) {
364
+
365
+ if ( is_404() ) {
366
+
367
+ $classes = $this->add_404_body_class( $classes );
368
+
369
+ }
370
+
371
  return $classes;
372
  }
373
 
527
  function admin_hide() {
528
 
529
  echo '<p><input type="checkbox" id="404page_hide" name="404page_hide" value="1"' . checked( true, $this->settings['404page_hide'], false ) . '/>';
530
+ echo '<label for="404page_hide" class="check"></label>' . __( 'Hide the selected page from the Pages list', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_hide_page"></a><br />';
531
+ echo '<span class="dashicons dashicons-info"></span>&nbsp;' . __( 'For Administrators the page is always visible.', '404page' ) . '</p><div class="clear"></div>';
532
 
533
  }
534
 
539
  function admin_fire404() {
540
 
541
  echo '<p><input type="checkbox" id="404page_fire_error" name="404page_fire_error" value="1"' . checked( true, $this->settings['404page_fire_error'], false ) . '/>';
542
+ echo '<label for="404page_fire_error" class="check"></label>' . __( 'Send an 404 error if the page is accessed directly by its URL', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_fire_404"></a><br />';
543
+ echo '<span class="dashicons dashicons-info"></span>&nbsp;' . __( 'Uncheck this if you want the selected page to be accessible.', '404page' );
544
 
545
  if ( function_exists( 'wpsupercache_activate' ) ) {
546
 
547
+ echo '<br /><span class="dashicons dashicons-warning"></span>&nbsp;<strong>' . __( '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' ) . '">' . __( 'Click here', '404page' ) . '</a>).<br />(<a href="' . $this->dc_url . '/#wp_super_cache">' . __( 'Read more', '404page' ) . '</a>)';
548
 
549
  }
550
 
551
+ echo '</p><div class="clear"></div>';
552
+
553
  }
554
 
555
 
559
  function admin_force404() {
560
 
561
  echo '<p><input type="checkbox" id="404page_force_error" name="404page_force_error" value="1"' . checked( true, $this->settings['404page_force_error'], false ) . '/>';
562
+ echo '<label for="404page_force_error" class="check warning"></label>' . __( 'Force 404 error after loading page', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_force_404"></a><br />';
563
+ echo '<span class="dashicons dashicons-warning"></span>&nbsp;' . __( 'Generally this is not needed. It is not recommended to activate this option, unless it is necessary. Please note that this may cause problems with your theme.', '404page' ) . '</p><div class="clear"></div>';
564
 
565
  }
566
 
571
  function admin_noguess() {
572
 
573
  echo '<p><input type="checkbox" id="404page_no_url_guessing" name="404page_no_url_guessing" value="1"' . checked( true, $this->settings['404page_no_url_guessing'], false ) . '/>';
574
+ echo '<label for="404page_no_url_guessing" class="check warning"></label>' . __( 'Disable URL autocorrection guessing', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_stop_guessing"></a><br />';
575
+ echo '<span class="dashicons dashicons-warning"></span>&nbsp;' . __( 'This stops WordPress from URL autocorrection guessing. Only activate, if you are sure about the consequences.', '404page' ) . '</p><div class="clear"></div>';
576
 
577
  }
578
 
592
  }
593
 
594
  echo '<p><input type="checkbox" id="404page_method" name="404page_method" value="CMP"' . checked( 'CMP', $this->settings['404page_method'], false ) . $dis . '/>';
595
+ echo '<label for="404page_method" class="check"></label>' . __( 'Activate Compatibility Mode', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_operating_method"></a><br />';
596
+ echo '<span class="dashicons dashicons-info"></span>&nbsp;';
597
 
598
  if ( $this->settings['404page_native'] ) {
599
 
616
 
617
  }
618
 
619
+ echo '</p><div class="clear"></div>';
620
 
621
  }
622
 
683
  */
684
  function remove_404page_from_array( $pages, $r ) {
685
 
686
+ $pageid = $this->get_page_id();
687
 
688
+ if ( $pageid > 0 ) {
689
+
690
+ for ( $i = 0; $i < sizeof( $pages ); $i++ ) {
691
+
692
+ if ( $pages[$i]->ID == $pageid ) {
693
+
694
+ unset( $pages[$i] );
695
+ break;
696
+
697
+ }
698
 
699
  }
700
+
701
  }
702
 
703
  return array_values( $pages );
733
  function admin_js() {
734
 
735
  wp_enqueue_script( '404pagejs', plugins_url( 'assets/js/404page.js', $this->_file ), 'jquery', $this->version, true );
 
 
736
 
737
  if ( get_current_screen()->id == $this->admin_handle ) {
738
 
783
  // invite to follow me
784
  if ( current_user_can( 'manage_options' ) && get_user_meta( get_current_user_id(), 'pp-404page-admin-notice-1', true ) != 'dismissed' ) {
785
  ?>
786
+ <div class="notice is-dismissible pp-404page-admin-notice" id="pp-404page-admin-notice-1">
787
  <p><img src="<?php echo plugins_url( 'assets/pluginicon.png', $this->_file ); ?>" style="width: 48px; height: 48px; float: left; margin-right: 20px" /><strong><?php _e( 'Do you like the 404page plugin?', '404page' ); ?></strong><br /><?php _e( 'Follow me:', '404page' ); ?> <a class="dashicons dashicons-googleplus" href="http://g.petersplugins.com/" title="<?php _e( 'Authors Google+ Page', '404page' ); ?>"></a> <a class="dashicons dashicons-facebook-alt" href="http://f.petersplugins.com/" title="<?php _e( 'Authors facebook Page', '404page' ); ?>"></a><div class="clear"></div></p>
788
  </div>
789
  <?php
790
  }
791
 
792
+ // ask for rating
793
+ // in 30 days at the earliest
794
+ if ( ! get_option( 'pp-404page-admin-notice-2-start' ) ) {
795
+ update_option( 'pp-404page-admin-notice-2-start', time() + 30 * 24 * 60 * 60 );
796
+ }
797
+ if ( get_option( 'pp-404page-admin-notice-2-start' ) <= time() ) {
798
+ if ( current_user_can( 'manage_options' ) && get_user_meta( get_current_user_id(), 'pp-404page-admin-notice-2', true ) != 'dismissed' ) {
799
+ ?>
800
+ <div class="notice is-dismissible pp-404page-admin-notice" id="pp-404page-admin-notice-2">
801
+ <p><img src="<?php echo plugins_url( 'assets/pluginicon.png', $this->_file ); ?>" style="width: 48px; height: 48px; float: left; margin-right: 20px" /><?php _e( 'If you like the 404page plugin please support my work with giving it a good rating so that other users know it is helpful for you. Thanks.', '404page' ); ?><br /><a href="https://wordpress.org/support/plugin/<?php echo $this->plugin_slug; ?>/reviews/#new-post" title="<?php _e( 'Please rate plugin', '404page' ); ?>"><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></a><div class="clear"></div></p>
802
+ </div>
803
+ <?php
804
+ }
805
+ }
806
+
807
  }
808
 
809
 
908
 
909
 
910
  /**
911
+ * get the id of the 404 page in the current language if WPML or Polylang is active
912
  */
913
  private function get_page_id() {
914
 
921
  // WPML is active
922
  $pageid = apply_filters( 'wpml_object_id', $pageid, 'page', true );
923
 
924
+ } elseif ( defined( 'POLYLANG_VERSION' ) ) {
925
+
926
+ // Polylang is active
927
+ $translatedpageid = pll_get_post( $pageid );
928
+ if ( !empty( $translatedpageid ) && 'publish' == get_post_status( $translatedpageid ) ) {
929
+ $pageid = $translatedpageid;
930
+ }
931
+
932
  }
933
 
934
  }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === 404page - your smart custom 404 error page ===
2
- Contributors: petersplugins, smartware.cc
3
  Donate link: http://petersplugins.com/make-a-donation/
4
  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
5
  Requires at least: 3.0
6
  Tested up to: 4.8
7
- Stable tag: 3.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -12,56 +12,26 @@ Custom 404 the easy way! Set any page as custom 404 error page. No coding needed
12
 
13
  == Description ==
14
 
15
- This Plugin allows you to create your custom 404 page just like any other page using the WordPress Page Editor.
16
 
17
- = Usage =
18
-
19
- Create your custom 404 page just like any other page. Then go to 'Appearance' -> '404 Error Page' and select the created page as your custom 404 error page. That's it!
20
-
21
- = Why you should choose this plugin =
22
-
23
- * Different from other similar plugins the 404page plugin **does not create redirects**. That’s **quite important** because a correct code 404 is delivered which tells search engines that the page does not exist and has to be removed from the index. A redirect would result in a HTTP code 301 or 302 and the URL would remain in the search index.
24
- * Different from other similar plugins the 404page plugin **does not create additional server requests**.
25
-
26
- = Watch the video (outdated version, new version will be created as soon as possible) =
27
-
28
- https://www.youtube.com/watch?v=VTL07Lf0IsY
29
-
30
- = Need more information? =
31
-
32
- See [Plugin Homepage](http://petersplugins.com/free-wordpress-plugins/404page/) and [Plugin Doc](http://petersplugins.com/docs/404page/).
33
-
34
- == Screenshots ==
35
-
36
- 1. Create your costom 404 Error Page as a normal WordPress Page
37
- 2. Set the created Page as 404 Error Page
38
- 3. Advanced Settings
39
- 4. Advanced Settings with WPML plugin installed (Compatibility Mode is not available, because the 404page plugin automatically switches to WMPL mode)
40
 
41
- = Do you like the 404page Plugin? =
 
 
42
 
43
- Thanks, I appreciate that. You don’t need to make a donation. No money, no beer, no coffee. Please, just [tell the world that you like what I’m doing](http://petersplugins.com/make-a-donation/)! And that’s all.
44
 
45
- = More plugins from Peter =
46
-
47
- * **[hashtagger](https://wordpress.org/plugins/hashtagger/)** - Use hashtags in WordPress
48
- * **[smart Archive Page Remove](https://wordpress.org/plugins/smart-archive-page-remove/)** - Completely remove unwated Archive Pages from your Blog
49
- * **[smart User Slug Hider](https://wordpress.org/plugins/smart-user-slug-hider/)** - Hide usernames in author pages URLs to enhance security
50
- * [See all](https://profiles.wordpress.org/petersplugins/#content-plugins)
51
-
52
- == Frequently Asked Questions ==
53
-
54
- = Are there any requirements? =
55
-
56
- To enable the WordPress 404 error handling you have to set the Permalink Structure ('Settings' -> 'Permalinks') to anything else but 'Default'. Otherwise 404 errors are handled by the webserver and not by WordPress.
57
 
58
- = Are 404 errors redirected? =
59
 
60
- No, there is no redirection! The chosen page is delivered as a 'real' 404 error page. This results in a HTTP 404 code and not in 301 or 302, which is important for Search Engines to tell them, that the page does not exist and should be deleted from the index.
 
61
 
62
- = Is it possible to add custom CSS to the 404 page? =
63
 
64
- The 404page plugin adds a CSS class `error404` to the `<body>` tag which can be used for extra styling.
65
 
66
  == Compatibility ==
67
 
@@ -115,8 +85,44 @@ The plugin adds an action hook 404page_after_404 which you can use to add extra
115
  = Native Support =
116
  If you are a theme developer you can add native support for the 404page plugin to your theme for full control. [Read more](http://petersplugins.com/docs/404page/#theme_native_support).
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  == Changelog ==
119
 
 
 
 
 
 
 
 
 
120
  = 3.0 (2017-07-05) =
121
  * new feature to force 404 error after loading page
122
  * new feature to disable URL autocorrection guessing
@@ -190,6 +196,9 @@ If you are a theme developer you can add native support for the 404page plugin t
190
 
191
  == Upgrade Notice ==
192
 
 
 
 
193
  = 3.0 =
194
  new features added to force 404 error after loading page and to disable URL autocorrection guessing, plus further enhancements
195
 
1
  === 404page - your smart custom 404 error page ===
2
+ Contributors: petersplugins
3
  Donate link: http://petersplugins.com/make-a-donation/
4
  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
5
  Requires at least: 3.0
6
  Tested up to: 4.8
7
+ Stable tag: 3.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
12
 
13
  == Description ==
14
 
15
+ <strong>The 404page plugin is the most used plugin to create a customized 404 error page in WordPress.</strong>
16
 
17
+ It allows you to easily create your own 404 error page without any effort and it works with almost every theme.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
+ <blockquote>
20
+ If you like this plugin please do me favor and leave a review here on wordpress.org so that other people know it is helpful for you. Thanks!
21
+ </blockquote>
22
 
23
+ [youtube https://youtu.be/HygoFMwdIuY]
24
 
25
+ = Usage =
 
 
 
 
 
 
 
 
 
 
 
26
 
27
+ Create your custom 404 error page just like any other page using the WordPress Page Editor. Then go to 'Appearance' -> '404 Error Page' and select the created page as your custom 404 error page. That's it!
28
 
29
+ * Different from other similar plugins the 404page plugin **does not create redirects**. That’s **quite important** because a correct code 404 is delivered which tells search engines that the page does not exist and has to be removed from the index. A redirect would result in a HTTP code 301 or 302 and the URL would remain in the search index.
30
+ * Different from other similar plugins the 404page plugin **does not create additional server requests**.
31
 
32
+ = Docs & Support =
33
 
34
+ More detailed information about the 404page plugin can be found in the [Plugin Manual](http://petersplugins.com/docs/404page/). For support check the [Support Forum](https://wordpress.org/support/plugin/404page).
35
 
36
  == Compatibility ==
37
 
85
  = Native Support =
86
  If you are a theme developer you can add native support for the 404page plugin to your theme for full control. [Read more](http://petersplugins.com/docs/404page/#theme_native_support).
87
 
88
+ = More plugins from Peter =
89
+
90
+ * **[hashtagger](https://wordpress.org/plugins/hashtagger/)** - Use hashtags in WordPress
91
+ * **[smart Archive Page Remove](https://wordpress.org/plugins/smart-archive-page-remove/)** - Completely remove unwated Archive Pages from your Blog
92
+ * **[smart User Slug Hider](https://wordpress.org/plugins/smart-user-slug-hider/)** - Hide usernames in author pages URLs to enhance security
93
+ * [See all](https://profiles.wordpress.org/petersplugins/#content-plugins)
94
+
95
+ == Screenshots ==
96
+
97
+ 1. Create your costom 404 Error Page as a normal WordPress Page
98
+ 2. Set the created Page as 404 Error Page
99
+ 3. Advanced Settings
100
+ 4. Advanced Settings with WPML plugin installed (Compatibility Mode is not available, because the 404page plugin automatically switches to WMPL mode)
101
+
102
+ == Frequently Asked Questions ==
103
+
104
+ = Are there any requirements? =
105
+
106
+ To enable the WordPress 404 error handling you have to set the Permalink Structure ('Settings' -> 'Permalinks') to anything else but 'Default'. Otherwise 404 errors are handled by the webserver and not by WordPress.
107
+
108
+ = Are 404 errors redirected? =
109
+
110
+ No, there is no redirection! The chosen page is delivered as a 'real' 404 error page. This results in a HTTP 404 code and not in 301 or 302, which is important for Search Engines to tell them, that the page does not exist and should be deleted from the index.
111
+
112
+ = Is it possible to add custom CSS to the 404 page? =
113
+
114
+ The 404page plugin adds a CSS class `error404` to the `<body>` tag which can be used for extra styling.
115
+
116
  == Changelog ==
117
 
118
+ = 3.1 (2017-07-24) =
119
+ * bugfix for Polylang ([See Topic](https://wordpress.org/support/topic/3-0-breaks-polylang-support/))
120
+ * bugfix for CLI ([See Topic](https://wordpress.org/support/topic/uninstall-php-from-cli-failed/))
121
+ * add debug class to body tag
122
+ * also add body classes for Customizr theme
123
+ * do not add error404 class if already exists
124
+ * further redesign admin interface
125
+
126
  = 3.0 (2017-07-05) =
127
  * new feature to force 404 error after loading page
128
  * new feature to disable URL autocorrection guessing
196
 
197
  == Upgrade Notice ==
198
 
199
+ = 3.1 =
200
+ fixed two bugs, plus further enhancements
201
+
202
  = 3.0 =
203
  new features added to force 404 error after loading page and to disable URL autocorrection guessing, plus further enhancements
204
 
uninstall.php CHANGED
@@ -17,8 +17,11 @@ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) || ! WP_UNINSTALL_PLUGIN || dirname( WP_
17
  }
18
 
19
 
20
- // Load plugin file and start uninstall
21
- include_once plugin_dir_path( __FILE__ ) . '404page.php';
 
 
 
22
  $pp_404page->uninstall();
23
 
24
  ?>
17
  }
18
 
19
 
20
+ /**
21
+ * Load core plugin class and run uninstall
22
+ */
23
+ require_once( plugin_dir_path( __FILE__ ) . '/inc/class-404page.php' );
24
+ $pp_404page = new PP_404Page( __FILE__ );
25
  $pp_404page->uninstall();
26
 
27
  ?>