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

Version Description

(2016-04-22) = * introduction of selectable Operating Methods * several changes to Compatibility Mode for improved WPML and bbPress compatibility plus compatibility with Page Builder by SiteOrigin * Polylang compatibility * automatic switch to Compatibility Mode if WPML, bbPress, Polylang or Page Builder by SiteOrigin is detected * completely new Customizr Compatibility Mode (automatically enabled if Customizr is detected) * firing an 404 error in case of directly accessing the 404 error page can now be deactivated * WP Super Cache support * option to hide the 404 error page from the Pages list * 404 error test * plugin expandable by action * delete all settings on uninstall

Download this release

Release Info

Developer smartware.cc
Plugin Icon 128x128 404page – your smart custom 404 error page
Version 2.1
Comparing to
See all releases

Code changes from version 2.0 to 2.1

Files changed (4) hide show
  1. 404page.js +13 -2
  2. 404page.php +353 -40
  3. readme.txt +58 -7
  4. uninstall.php +12 -0
404page.js CHANGED
@@ -1,9 +1,20 @@
1
  jQuery(document).ready(function($) {
2
  jQuery( '#select404page' ).change(function() {
3
- jQuery( '#edit_404_page' ).prop( 'disabled', !( jQuery( '#select404page' ).val() == jQuery( '#404page_current_value').text() != 0 ) );
4
  });
5
  jQuery( '#select404page' ).trigger( 'change' );
6
  jQuery( '#edit_404_page' ).click(function() {
7
- window.location.replace( jQuery( '#404page_edit_link' ).text() );
 
 
 
 
 
 
 
 
 
 
 
8
  });
9
  });
1
  jQuery(document).ready(function($) {
2
  jQuery( '#select404page' ).change(function() {
3
+ jQuery( '#edit_404_page, #test_404_page' ).prop( 'disabled', !( jQuery( '#select404page' ).val() == jQuery( '#404page_current_value').text() != 0 ) );
4
  });
5
  jQuery( '#select404page' ).trigger( 'change' );
6
  jQuery( '#edit_404_page' ).click(function() {
7
+ window.location.href = jQuery( '#404page_edit_link' ).text();
8
+ });
9
+ jQuery( '#test_404_page' ).click(function() {
10
+ window.location.href = jQuery( '#404page_test_link' ).text();
11
+ });
12
+ jQuery( '#404page_admin_notice .notice-dismiss' ).click( function() {
13
+ jQuery.ajax({
14
+ url: ajaxurl,
15
+ data: {
16
+ action: '404page_dismiss_admin_notice'
17
+ }
18
+ });
19
  });
20
  });
404page.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
- Plugin Name: 404page
4
  Plugin URI: http://smartware.cc/free-wordpress-plugins/404page/
5
  Description: Custom 404 the easy way! Set any page as custom 404 error page. No coding needed. Works with (almost) every Theme.
6
- Version: 2.0
7
  Author: smartware.cc, Peter's Plugins
8
  Author URI: http://smartware.cc
9
  Text Domain: 404page
@@ -26,10 +26,6 @@ License: GPL2
26
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
  */
28
 
29
-
30
- /* As of Version 2.0 the 404page Plugin no longer uses the 404_template filter, because this does not work with WPML, bbPress and Customizr */
31
- /* The posts_results filter is the only solution that works for all of them */
32
-
33
  if ( ! defined( 'WPINC' ) ) {
34
  die;
35
  }
@@ -38,12 +34,17 @@ class Smart404Page {
38
  public $plugin_name;
39
  public $plugin_slug;
40
  public $version;
 
 
 
41
  public $settings;
 
 
42
 
43
  public function __construct() {
44
  $this->plugin_name = '404page';
45
  $this->plugin_slug = '404page';
46
- $this->version = '2.0';
47
  $this->get_settings();
48
  $this->init();
49
  }
@@ -52,55 +53,171 @@ class Smart404Page {
52
  private function get_settings() {
53
  $this->settings = array();
54
  $this->settings['404page_page_id'] = $this->get_404page_id();
 
 
 
55
  }
56
-
 
57
  private function init() {
58
 
 
 
59
  if ( !is_admin() ) {
60
- add_filter( 'posts_results', array( $this, 'show404' ), 999 );
 
 
61
  } else {
 
62
  add_action( 'admin_init', array( $this, 'admin_init' ) );
63
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
64
  add_action( 'admin_head', array( $this, 'admin_css' ) );
65
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'add_settings_link' ) );
 
 
 
 
 
 
 
 
 
 
66
  }
67
 
68
  }
69
 
70
- // redirect 404 page - compatibility mode - introduced in version 2.0
71
- function show404( $posts ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  global $wp_query;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  // remove the filter so we handle only the first query - no custom queries
74
- remove_filter( 'posts_results', array( $this, 'show404' ), 999 );
 
75
  $pageid = $this->settings['404page_page_id'];
76
  if ( 0 != $pageid ) {
77
  if ( empty( $posts ) && is_main_query() && !is_robots() && !is_home() && !is_feed() && !is_search() &&( !defined('DOING_AJAX') || !DOING_AJAX ) ) {
78
- // show the 404 page
 
79
  if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
 
80
  // WPML is active
81
  $pageid = apply_filters( 'wpml_object_id', $pageid, 'page', true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  }
83
- $posts[] = get_post( $pageid );
84
  add_action( 'wp', array( $this, 'do_404_header' ) );
85
  add_filter( 'body_class', array( $this, 'add_404_body_class' ) );
 
 
 
 
 
86
  } elseif ( 1 == count( $posts ) && 'page' == $posts[0]->post_type ) {
 
87
  // Do a 404 if the 404 page is opened directly
88
- $curpageid = $posts[0]->ID;
89
- if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
90
- // WPML is active - get the post ID of the default language
91
- global $sitepress;
92
- $curpageid = apply_filters( 'wpml_object_id', $curpageid, 'page', $sitepress->get_default_language() );
93
- $pageid = apply_filters( 'wpml_object_id', $pageid, 'page', $sitepress->get_default_language() );
94
- }
95
- if ( $pageid == $curpageid ) {
96
- add_action( 'wp', array( $this, 'do_404_header' ) );
97
- add_filter( 'body_class', array( $this, 'add_404_body_class' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  }
 
99
  }
100
  }
101
  return $posts;
102
  }
103
 
 
 
 
 
 
 
 
 
 
 
104
  function do_404_header() {
105
  // remove the action so we handle only the first query - no custom queries
106
  remove_action( 'wp', array( $this, 'do_404_header' ) );
@@ -108,23 +225,52 @@ class Smart404Page {
108
  nocache_headers();
109
  }
110
 
 
111
  function add_404_body_class( $classes ) {
112
- // adds the error404 class to the body classes
113
  $classes[] = 'error404';
114
  return $classes;
115
  }
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  // init the admin section
118
  function admin_init() {
 
 
 
119
  load_plugin_textdomain( '404page' );
120
  add_settings_section( '404page-settings', null, null, '404page_settings_section' );
121
  register_setting( '404page_settings', '404page_page_id' );
122
- add_settings_field( '404page_settings_404page', __( 'Page to be displayed as 404 page', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="http://smartware.cc/docs/404page/"></a>' , array( $this, 'admin_404page' ), '404page_settings_section', '404page-settings', array( 'label_for' => '404page_page_id' ) );
 
 
 
 
 
 
123
  }
124
 
125
  // add css
126
  function admin_css() {
127
- echo '<style type="text/css">#select404page" {width: 100%}</style>';
 
 
 
 
128
  }
129
 
130
  // handle the settings field page id
@@ -133,12 +279,70 @@ class Smart404Page {
133
  echo '<div class="error form-invalid" style="line-height: 3em">' . __( 'The page you have selected as 404 page does not exist anymore. Please choose another page.', '404page' ) . '</div>';
134
  }
135
  wp_dropdown_pages( array( 'name' => '404page_page_id', 'id' => 'select404page', 'echo' => 1, 'show_option_none' => __( '&mdash; NONE (WP default 404 page) &mdash;', '404page'), 'option_none_value' => '0', 'selected' => $this->settings['404page_page_id'] ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  }
137
 
138
  // adds the options page to admin menu
139
  function admin_menu() {
140
  $page_handle = add_theme_page ( __( '404 Error Page', "404page" ), __( '404 Error Page', '404page' ), 'manage_options', '404pagesettings', array( $this, 'admin_page' ) );
141
- add_action( 'admin_print_scripts-' . $page_handle, array( $this, 'admin_js' ) );
142
  }
143
 
144
  // adds javascript to the 404page settings page
@@ -151,12 +355,13 @@ class Smart404Page {
151
  if ( !current_user_can( 'manage_options' ) ) {
152
  wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
153
  }
154
- ?>
155
  <div class="wrap">
156
  <?php screen_icon(); ?>
157
- <h2 style="min-height: 32px; line-height: 32px; padding-left: 40px; background-image: url(<?php echo plugins_url( 'pluginicon.png', __FILE__ ); ?>); background-repeat: no-repeat; background-position: left center"><a href="http://smartware.cc/free-wordpress-plugins/hashtagger/">404page</a> <?php echo __( 'Settings', '404page' ); ?></h2>
 
158
  <hr />
159
- <p>Plugin Version: <?php echo $this->version; ?></p>
160
  <div id="poststuff">
161
  <div id="post-body" class="metabox-holder columns-2">
162
  <div id="post-body-content">
@@ -164,14 +369,11 @@ class Smart404Page {
164
  <form method="post" action="options.php">
165
  <div class="postbox">
166
  <div class="inside">
167
- <?php
168
  settings_fields( '404page_settings' );
169
- do_settings_sections( '404page_settings_section' );
170
  submit_button();
171
  ?>
172
- <p class="submit"><input type="button" name="edit_404_page" id="edit_404_page" class="button secondary" value="<?php _e( 'Edit Page', '404page' ); ?>"></p>
173
- <div id="404page_current_value" style="display: none"><?php echo $this->get_404page_id(); ?></div>
174
- <div id="404page_edit_link" style="display: none"><?php echo get_edit_post_link( $this->get_404page_id() ); ?></div>
175
  </div>
176
  </div>
177
  </form>
@@ -185,6 +387,57 @@ class Smart404Page {
185
  <?php
186
  }
187
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  // returns the id of the 404 page if one is defined, returns 0 if none is defined, returns -1 if the defined page id does not exist
189
  private function get_404page_id() {
190
  $pageid = get_option( '404page_page_id', 0 );
@@ -197,6 +450,31 @@ class Smart404Page {
197
  return $pageid;
198
  }
199
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  // show meta boxes
201
  function show_meta_boxes() {
202
  ?>
@@ -206,8 +484,8 @@ class Smart404Page {
206
  <h3><span><?php _e( 'Like this Plugin?', '404page' ); ?></span></h3>
207
  <div class="inside">
208
  <ul>
209
- <li><div class="dashicons dashicons-wordpress"></div>&nbsp;&nbsp;<a href="https://wordpress.org/plugins/<?php echo $this->plugin_slug; ?>/"><?php _e( 'Please rate the plugin', '404page' ); ?></a></li>
210
- <li><div class="dashicons dashicons-admin-home"></div>&nbsp;&nbsp;<a href="http://smartware.cc/free-wordpress-plugins/<?php echo $this->plugin_slug; ?>/"><?php _e( 'Plugin homepage', '404page'); ?></a></li>
211
  <li><div class="dashicons dashicons-admin-home"></div>&nbsp;&nbsp;<a href="http://smartware.cc/"><?php _e( 'Author homepage', '404page' );?></a></li>
212
  <li><div class="dashicons dashicons-googleplus"></div>&nbsp;&nbsp;<a href="http://g.smartware.cc/"><?php _e( 'Authors Google+ Page', '404page' ); ?></a></li>
213
  <li><div class="dashicons dashicons-facebook-alt"></div>&nbsp;&nbsp;<a href="http://f.smartware.cc/"><?php _e( 'Authors facebook Page', '404page' ); ?></a></li>
@@ -218,13 +496,20 @@ class Smart404Page {
218
  <h3><span><?php _e( 'Need help?', '404page' ); ?></span></h3>
219
  <div class="inside">
220
  <ul>
221
- <li><div class="dashicons dashicons-book-alt"></div>&nbsp;&nbsp;<a href="http://smartware.cc/docs/<?php echo $this->plugin_slug; ?>/"><?php _e( 'Take a look at the Plugin Doc', '404page' ); ?></a></li>
222
- <li><div class="dashicons dashicons-wordpress"></div>&nbsp;&nbsp;<a href="http://wordpress.org/plugins/<?php echo $this->plugin_slug; ?>/faq/"><?php _e( 'Take a look at the FAQ section', '404page' ); ?></a></li>
223
  <li><div class="dashicons dashicons-wordpress"></div>&nbsp;&nbsp;<a href="http://wordpress.org/support/plugin/<?php echo $this->plugin_slug; ?>/"><?php _e( 'Take a look at the Support section', '404page'); ?></a></li>
224
  <li><div class="dashicons dashicons-admin-comments"></div>&nbsp;&nbsp;<a href="http://smartware.cc/contact/"><?php _e( 'Feel free to contact the Author', '404page' ); ?></a></li>
225
  </ul>
226
  </div>
227
  </div>
 
 
 
 
 
 
 
228
  </div>
229
  </div>
230
  <?php
@@ -234,6 +519,34 @@ class Smart404Page {
234
  function add_settings_link( $links ) {
235
  return array_merge( $links, array( '<a href="' . admin_url( 'themes.php?page=404pagesettings' ) . '">' . __( 'Settings', '404page' ) . '</a>') );
236
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
 
238
  }
239
 
1
  <?php
2
  /*
3
+ Plugin Name: 404page - your smart custom 404 error page
4
  Plugin URI: http://smartware.cc/free-wordpress-plugins/404page/
5
  Description: Custom 404 the easy way! Set any page as custom 404 error page. No coding needed. Works with (almost) every Theme.
6
+ Version: 2.1
7
  Author: smartware.cc, Peter's Plugins
8
  Author URI: http://smartware.cc
9
  Text Domain: 404page
26
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
  */
28
 
 
 
 
 
29
  if ( ! defined( 'WPINC' ) ) {
30
  die;
31
  }
34
  public $plugin_name;
35
  public $plugin_slug;
36
  public $version;
37
+ private $wp_url;
38
+ private $my_url;
39
+ private $dc_url;
40
  public $settings;
41
+ private $template;
42
+ private $postid;
43
 
44
  public function __construct() {
45
  $this->plugin_name = '404page';
46
  $this->plugin_slug = '404page';
47
+ $this->version = '2.1';
48
  $this->get_settings();
49
  $this->init();
50
  }
53
  private function get_settings() {
54
  $this->settings = array();
55
  $this->settings['404page_page_id'] = $this->get_404page_id();
56
+ $this->settings['404page_hide'] = $this->get_404page_hide();
57
+ $this->settings['404page_fire_error'] = $this->get_404page_fire_error();
58
+ $this->settings['404page_method'] = $this->get_404page_method();
59
  }
60
+
61
+ // do plugin init
62
  private function init() {
63
 
64
+ register_activation_hook( __FILE__, array( $this, 'init_admin_notice' ) );
65
+
66
  if ( !is_admin() ) {
67
+
68
+ add_action( 'init', array( $this, 'set_mode' ) );
69
+
70
  } else {
71
+
72
  add_action( 'admin_init', array( $this, 'admin_init' ) );
73
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
74
  add_action( 'admin_head', array( $this, 'admin_css' ) );
75
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'add_settings_link' ) );
76
+
77
+ if ( $this->settings['404page_hide'] and $this->settings['404page_page_id'] > 0 ) {
78
+ add_action( 'pre_get_posts' ,array ( $this, 'exclude_404page' ) );
79
+ }
80
+
81
+ if ( 'NOT_DISMISSED' == get_option( '404page_notice_dismissed', 'NOT_DISMISSED' ) ) {
82
+ add_action( 'admin_notices', array( $this, 'admin_notice' ) );
83
+ add_action( 'wp_ajax_nopriv_404page_dismiss_admin_notice', array( $this, 'dismiss_admin_notice' ) );
84
+ add_action( 'wp_ajax_404page_dismiss_admin_notice', array( $this, 'dismiss_admin_notice' ) );
85
+ }
86
  }
87
 
88
  }
89
 
90
+ // init filters
91
+ function set_mode() {
92
+
93
+ if ( defined( 'CUSTOMIZR_VER' ) ) {
94
+
95
+ // Customizr Compatibility Mode
96
+
97
+ add_filter( 'tc_404_header_content', array( $this, 'show404title_customizr_mode' ), 999 );
98
+ add_filter( 'tc_404_content', array( $this, 'show404_customizr_mode' ), 999 );
99
+ add_filter( 'tc_404_selectors', array( $this, 'show404articleselectors_customizr_mode' ), 999 );
100
+
101
+ } else {
102
+
103
+ if ( $this->settings['404page_method'] != 'STD' ) {
104
+
105
+ // Compatibility Mode
106
+ add_filter( 'posts_results', array( $this, 'show404_compatiblity_mode' ), 999 );
107
+
108
+ } else {
109
+
110
+ // Standard Mode
111
+ add_filter( '404_template', array( $this, 'show404_standard_mode' ), 999 );
112
+ if ( $this->settings['404page_fire_error'] ) {
113
+ add_action( 'template_redirect', array( $this, 'do_404_header_standard_mode' ) );
114
+ }
115
+
116
+ }
117
+ }
118
+
119
+ }
120
+
121
+ // show 404 page - Standard Mode
122
+ function show404_standard_mode( $template ) {
123
+
124
  global $wp_query;
125
+ $pageid = $this->settings['404page_page_id'];
126
+ if ( $pageid > 0 ) {
127
+ $wp_query = null;
128
+ $wp_query = new WP_Query();
129
+ $wp_query->query( 'page_id=' . $pageid );
130
+ $wp_query->the_post();
131
+ $template = get_page_template();
132
+ rewind_posts();
133
+ add_filter( 'body_class', array( $this, 'add_404_body_class' ) );
134
+ $this->do_404page_action();
135
+ }
136
+ return $template;
137
+
138
+ }
139
+
140
+ // show 404 page - Compatibility Mode
141
+ function show404_compatiblity_mode( $posts ) {
142
+
143
  // remove the filter so we handle only the first query - no custom queries
144
+ remove_filter( 'posts_results', array( $this, 'show404_compatiblity_mode' ), 999 );
145
+
146
  $pageid = $this->settings['404page_page_id'];
147
  if ( 0 != $pageid ) {
148
  if ( empty( $posts ) && is_main_query() && !is_robots() && !is_home() && !is_feed() && !is_search() &&( !defined('DOING_AJAX') || !DOING_AJAX ) ) {
149
+ // we need to get the 404 page
150
+
151
  if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
152
+
153
  // WPML is active
154
  $pageid = apply_filters( 'wpml_object_id', $pageid, 'page', true );
155
+
156
+ } elseif ( defined( 'POLYLANG_VERSION' ) ) {
157
+
158
+ // Polylang is active
159
+ $translatedpageid = pll_get_post( $pageid );
160
+ if ( !empty( $translatedpageid ) && 'publish' == get_post_status( $translatedpageid ) ) {
161
+ $pageid = $translatedpageid;
162
+ }
163
+ }
164
+
165
+ // as of v2.1 we do not alter the posts argument here because this does not work with SiteOrigin's Page Builder Plugin, template_include filter introduced
166
+ $this->postid = $pageid;
167
+ $this->template = get_page_template_slug( $pageid );
168
+ if ( $this->template == '' ) {
169
+ $this->template = get_page_template();
170
  }
 
171
  add_action( 'wp', array( $this, 'do_404_header' ) );
172
  add_filter( 'body_class', array( $this, 'add_404_body_class' ) );
173
+
174
+ $posts[] = get_post( $pageid );
175
+
176
+ $this->do_404page_action();
177
+
178
  } elseif ( 1 == count( $posts ) && 'page' == $posts[0]->post_type ) {
179
+
180
  // Do a 404 if the 404 page is opened directly
181
+ if ( $this->settings['404page_fire_error'] ) {
182
+ $curpageid = $posts[0]->ID;
183
+
184
+ if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
185
+
186
+ // WPML is active - get the post ID of the default language
187
+ global $sitepress;
188
+ $curpageid = apply_filters( 'wpml_object_id', $curpageid, 'page', $sitepress->get_default_language() );
189
+ $pageid = apply_filters( 'wpml_object_id', $pageid, 'page', $sitepress->get_default_language() );
190
+
191
+ } elseif ( defined( 'POLYLANG_VERSION' ) ) {
192
+
193
+ // Polylang is active - get the post ID of the default language
194
+ $curpageid = pll_get_post( $curpageid, pll_default_language() );
195
+ $pageid = pll_get_post( $pageid, pll_default_language() );
196
+
197
+ }
198
+
199
+ if ( $pageid == $curpageid ) {
200
+ add_action( 'wp', array( $this, 'do_404_header' ) );
201
+ add_filter( 'body_class', array( $this, 'add_404_body_class' ) );
202
+ $this->do_404page_action();
203
+ }
204
  }
205
+
206
  }
207
  }
208
  return $posts;
209
  }
210
 
211
+ // send a 404 HTTP header - Standard Mode
212
+ function do_404_header_standard_mode() {
213
+ if ( is_page() && get_the_ID() == $this->settings['404page_page_id'] && !is_404() ) {
214
+ status_header( 404 );
215
+ nocache_headers();
216
+ $this->do_404page_action();
217
+ }
218
+ }
219
+
220
+ // send a 404 HTTP header - Compatibility Mode
221
  function do_404_header() {
222
  // remove the action so we handle only the first query - no custom queries
223
  remove_action( 'wp', array( $this, 'do_404_header' ) );
225
  nocache_headers();
226
  }
227
 
228
+ // adds the error404 class to the body classes
229
  function add_404_body_class( $classes ) {
 
230
  $classes[] = 'error404';
231
  return $classes;
232
  }
233
 
234
+ // show title - Customizr Compatibility Mode
235
+ function show404title_customizr_mode( $title ) {
236
+ return '<h1 class="entry-title">' . get_the_title( $this->settings['404page_page_id'] ) . '</h1>';
237
+ }
238
+
239
+ // show content - Customizr Compatibility Mode
240
+ function show404_customizr_mode( $content ) {
241
+ return '<div class="entry-content">' . apply_filters( 'the_content', get_post_field( 'post_content', $this->settings['404page_page_id'] ) ) . '</div>';
242
+ $this->do_404page_action();
243
+ }
244
+
245
+ // change article selectors - Customizr Compatibility Mode
246
+ function show404articleselectors_customizr_mode( $selectors ) {
247
+ return 'id="post-' . $this->settings['404page_page_id'] . '" ' . 'class="' . join( ' ', get_post_class( 'row-fluid', $this->settings['404page_page_id'] ) ) . '"';
248
+ }
249
+
250
  // init the admin section
251
  function admin_init() {
252
+ $this->wp_url = 'https://wordpress.org/plugins/' . $this->plugin_slug;
253
+ $this->my_url = 'http://smartware.cc/free-wordpress-plugins/' . $this->plugin_slug;
254
+ $this->dc_url = 'http://smartware.cc/docs/' . $this->plugin_slug;
255
  load_plugin_textdomain( '404page' );
256
  add_settings_section( '404page-settings', null, null, '404page_settings_section' );
257
  register_setting( '404page_settings', '404page_page_id' );
258
+ register_setting( '404page_settings', '404page_hide' );
259
+ register_setting( '404page_settings', '404page_method' );
260
+ register_setting( '404page_settings', '404page_fire_error' );
261
+ add_settings_field( '404page_settings_404page', __( 'Page to be displayed as 404 page', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_select_page"></a>' , array( $this, 'admin_404page' ), '404page_settings_section', '404page-settings', array( 'label_for' => '404page_page_id' ) );
262
+ add_settings_field( '404page_settings_hide', __( 'Hide 404 page', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_hide_page"></a>' , array( $this, 'admin_hide' ), '404page_settings_section', '404page-settings', array( 'label_for' => '404page_hide' ) );
263
+ add_settings_field( '404page_settings_fire', __( 'Fire 404 error', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_fire_404"></a>' , array( $this, 'admin_fire404' ), '404page_settings_section', '404page-settings', array( 'label_for' => '404page_fire_error' ) );
264
+ add_settings_field( '404page_settings_method', __( 'Operating Method', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_operating_method"></a>' , array( $this, 'admin_method' ), '404page_settings_section', '404page-settings', array( 'label_for' => '404page_method' ) );
265
  }
266
 
267
  // add css
268
  function admin_css() {
269
+ echo '<style type="text/css">#select404page {width: 100%; }';
270
+ if ( $this->settings['404page_page_id'] > 0 ) {
271
+ echo ' #the-list #post-' . $this->settings['404page_page_id'] . ' .column-title {min-height: 32px; background-position: left top; background-repeat: no-repeat; background-image: url(' . plugins_url( 'pluginicon.png', __FILE__ ) . '); padding-left: 40px;}';
272
+ }
273
+ echo '</style>';
274
  }
275
 
276
  // handle the settings field page id
279
  echo '<div class="error form-invalid" style="line-height: 3em">' . __( 'The page you have selected as 404 page does not exist anymore. Please choose another page.', '404page' ) . '</div>';
280
  }
281
  wp_dropdown_pages( array( 'name' => '404page_page_id', 'id' => 'select404page', 'echo' => 1, 'show_option_none' => __( '&mdash; NONE (WP default 404 page) &mdash;', '404page'), 'option_none_value' => '0', 'selected' => $this->settings['404page_page_id'] ) );
282
+ echo '<div id="404page_edit_link" style="display: none">' . get_edit_post_link( $this->get_404page_id() ) . '</div>';
283
+ echo '<div id="404page_test_link" style="display: none">' . get_site_url() . '/' . md5( rand() ) . '/' . md5( rand() ) . '/' . md5( rand() ) . '</div>';
284
+ echo '<div id="404page_current_value" style="display: none">' . $this->get_404page_id() . '</div>';
285
+ echo '<p class="submit"><input type="button" name="edit_404_page" id="edit_404_page" class="button secondary" value="' . __( 'Edit Page', '404page' ) . '" />&nbsp;<input type="button" name="test_404_page" id="test_404_page" class="button secondary" value="' . __( 'Test 404 error', '404page' ) . '" /></p>';
286
+ }
287
+
288
+ // handle the settings field hide
289
+ function admin_hide() {
290
+ echo '<p><input type="checkbox" id="404page_hide" name="404page_hide" value="1"' . checked( true, $this->settings['404page_hide'], false ) . '/>';
291
+ echo '<label for="404page_hide">' . __( 'Hide the selected page from the Pages list', '404page' ) . '</label></p>';
292
+ echo '<p><span class="dashicons dashicons-info"></span>&nbsp;' . __( 'For Administrators the page is always visible.', '404page' ) . '</p>';
293
+ }
294
+
295
+ // handle the settings field fire 404 error
296
+ function admin_fire404() {
297
+ echo '<p><input type="checkbox" id="404page_fire_error" name="404page_fire_error" value="1"' . checked( true, $this->settings['404page_fire_error'], false ) . '/>';
298
+ echo '<label for="404page_fire_error">' . __( 'Send an 404 error if the page is accessed directly by its URL', '404page' ) . '</label></p>';
299
+ echo '<p><span class="dashicons dashicons-info"></span>&nbsp;' . __( 'Uncheck this if you want the selected page to be accessible.', '404page' ) . '</p>';
300
+ if ( function_exists( 'wpsupercache_activate' ) ) {
301
+ 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>';
302
+ }
303
+ }
304
+
305
+ // handle the settings field method
306
+ function admin_method() {
307
+ if ( defined( 'CUSTOMIZR_VER' ) || defined( 'ICL_SITEPRESS_VERSION' ) || defined( 'POLYLANG_VERSION' ) || defined( 'SITEORIGIN_PANELS_VERSION' ) || class_exists( 'bbPress' ) ) {
308
+ $dis = ' disabled="disabled"';
309
+ } else {
310
+ $dis = '';
311
+ }
312
+ echo '<p><input type="radio" id="404page_settings_method_standard" name="404page_method" value="STD"' . checked( 'STD', $this->settings['404page_method'], false ) . $dis . ' />';
313
+ echo '<label for="404page_settings_method_standard">' . __( 'Standard Mode', '404page' ) . '</label></p>';
314
+
315
+ echo '<p><input type="radio" id="404page_settings_method_compatibility" name="404page_method" value="CMP"' . checked( 'CMP', $this->settings['404page_method'], false ) . $dis . '/>';
316
+ echo '<label for="404page_settings_method_compatibility">' . __( 'Compatibility Mode', '404page' ) . '</label></p>';
317
+
318
+ if ( defined( 'CUSTOMIZR_VER' ) ) {
319
+ echo '<p><span class="dashicons dashicons-warning"></span>&nbsp;' . __( 'Customizr Theme detected. The 404page Plugin works in Customizr Compatibility Mode.', '404page' ) . ' (<a href="' . $this->dc_url . '/#customizr_mode">' . __( 'Read more', '404page' ) . '</a>)</p>';
320
+ } elseif ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
321
+ echo '<p><span class="dashicons dashicons-warning"></span>&nbsp;' . __( 'WPML Plugin detected. Operating Method set to Compatibility Mode automatically.', '404page' ) . ' (<a href="' . $this->dc_url . '/#compatibilty_mode">' . __( 'Read more', '404page' ) . '</a>)</p>';
322
+ } elseif ( defined( 'POLYLANG_VERSION' ) ) {
323
+ echo '<p><span class="dashicons dashicons-warning"></span>&nbsp;' . __( 'Polylang Plugin detected. Operating Method set to Compatibility Mode automatically.', '404page' ) . ' (<a href="' . $this->dc_url . '/#compatibilty_mode">' . __( 'Read more', '404page' ) . '</a>)</p>';
324
+ } elseif ( defined( 'SITEORIGIN_PANELS_VERSION' ) ) {
325
+ echo '<p><span class="dashicons dashicons-warning"></span>&nbsp;' . __( 'Page Builder by SiteOrigin Plugin detected. Operating Method set to Compatibility Mode automatically.', '404page' ) . ' (<a href="' . $this->dc_url . '/#compatibilty_mode">' . __( 'Read more', '404page' ) . '</a>)</p>';
326
+ } elseif ( class_exists( 'bbPress' ) ) {
327
+ echo '<p><span class="dashicons dashicons-warning"></span>&nbsp;' . __( 'bbPress Plugin detected. Operating Method set to Compatibility Mode automatically.', '404page' ) . ' (<a href="' . $this->dc_url . '/#compatibilty_mode">' . __( 'Read more', '404page' ) . '</a>)</p>';
328
+ } else {
329
+ echo '<p><span class="dashicons dashicons-info"></span>&nbsp;' . __( 'Standard Mode uses the WordPress Template System and should work in most cases. If the 404page plugin does not work properly, probably you are using a theme or plugin that modifies the WordPress Template System. In this case the Compatibility Mode maybe can fix the problem, although it cannot be guaranteed that every possible configuration can be handled by Compatibility Mode. Standard Mode is the recommended method, only switch to Compatibility Mode if you have any problems.', '404page' ) . '</p>';
330
+ }
331
+ }
332
+
333
+ // this function hides the selected page from the list of pages
334
+ function exclude_404page( $query ) {
335
+ global $pagenow;
336
+ if( 'edit.php' == $pagenow && ( get_query_var( 'post_type' ) && 'page' == get_query_var( 'post_type' ) ) && !current_user_can( 'create_users' ) ) {
337
+ $query->set( 'post__not_in', array( $this->settings['404page_page_id'] ) );
338
+ }
339
+ return $query;
340
  }
341
 
342
  // adds the options page to admin menu
343
  function admin_menu() {
344
  $page_handle = add_theme_page ( __( '404 Error Page', "404page" ), __( '404 Error Page', '404page' ), 'manage_options', '404pagesettings', array( $this, 'admin_page' ) );
345
+ add_action( 'admin_print_scripts', array( $this, 'admin_js' ) );
346
  }
347
 
348
  // adds javascript to the 404page settings page
355
  if ( !current_user_can( 'manage_options' ) ) {
356
  wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
357
  }
358
+ ?>
359
  <div class="wrap">
360
  <?php screen_icon(); ?>
361
+ <h2 style="min-height: 32px; line-height: 32px; padding-left: 40px; background-image: url(<?php echo plugins_url( 'pluginicon.png', __FILE__ ); ?>); background-repeat: no-repeat; background-position: left center"><a href="' . $this->my_url . '">404page</a> <?php echo __( 'Settings', '404page' ); ?></h2>
362
+ <?php settings_errors(); ?>
363
  <hr />
364
+ <p>Plugin Version: <?php echo $this->version; ?> <a class="dashicons dashicons-editor-help" href="<?php echo $this->wp_url; ?>/changelog/"></a></p>
365
  <div id="poststuff">
366
  <div id="post-body" class="metabox-holder columns-2">
367
  <div id="post-body-content">
369
  <form method="post" action="options.php">
370
  <div class="postbox">
371
  <div class="inside">
372
+ <?php
373
  settings_fields( '404page_settings' );
374
+ do_settings_sections( '404page_settings_section' );
375
  submit_button();
376
  ?>
 
 
 
377
  </div>
378
  </div>
379
  </form>
387
  <?php
388
  }
389
 
390
+ // show a dismissible notice
391
+ function admin_notice() {
392
+ if ( current_user_can( 'manage_options' ) ) {
393
+ echo '<div class="notice notice-info is-dismissible" id="404page_admin_notice"><p><strong>404page Plugin:</strong> ';
394
+ if ( defined( 'CUSTOMIZR_VER' ) ) {
395
+ // Customizr Theme
396
+ _e( 'Customizr Theme detected. The 404page Plugin works in Customizr Compatibility Mode.', '404page' );
397
+ } elseif ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
398
+ // WPML
399
+ _e( 'WPML Plugin detected. Operating Method is set to Compatibility Mode automatically to make the 404page Plugin work with WPML.', '404page' );
400
+ } elseif ( defined( 'POLYLANG_VERSION' ) ) {
401
+ // Polylang
402
+ _e( 'Polylang Plugin detected. Operating Method is set to Compatibility Mode automatically to make the 404page Plugin work with Polylang.', '404page' );
403
+ } elseif ( defined( 'SITEORIGIN_PANELS_VERSION' ) ) {
404
+ // Page Builder by SiteOrigin
405
+ _e( 'Page Builder by SiteOrigin Plugin detected. Operating Method is set to Compatibility Mode automatically to make the 404page Plugin work with Page Builder by SiteOrigin.', '404page' );
406
+ } elseif ( class_exists( 'bbPress' ) ) {
407
+ // bbPress
408
+ _e( 'bbPress Plugin detected. Operating Method is set to Compatibility Mode automatically to make the 404page Plugin work with bbPress.', '404page' );
409
+ } elseif ( function_exists( 'wpsupercache_activate' ) ) {
410
+ // WP Super Cache
411
+ _e( 'WP Super Cache Plugin detected. Please check Settings!', '404page' );
412
+ } else {
413
+ _e( 'Please check Operating Method.', '404page' );
414
+ }
415
+ echo '<br /><a href="' . admin_url( 'themes.php?page=404pagesettings' ) . '">' . __( 'Settings', '404page' ) . '</a>';
416
+ echo '</p></div>';
417
+ }
418
+ }
419
+
420
+ // dismiss the notice (AJAX)
421
+ function dismiss_admin_notice() {
422
+ update_option( '404page_notice_dismissed', 'DISMISSED' );
423
+ }
424
+
425
+ // Reset dismiss state for notice on plugin activation
426
+ function init_admin_notice( $network_wide ) {
427
+ global $wpdb;
428
+ if ( is_multisite() && $network_wide ) {
429
+ $current_blog = $wpdb->blogid;
430
+ $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
431
+ foreach ( $blog_ids as $blog_id ) {
432
+ switch_to_blog( $blog_id );
433
+ delete_option( '404page_notice_dismissed' );
434
+ }
435
+ switch_to_blog( $current_blog );
436
+ } else {
437
+ delete_option( '404page_notice_dismissed' );
438
+ }
439
+ }
440
+
441
  // returns the id of the 404 page if one is defined, returns 0 if none is defined, returns -1 if the defined page id does not exist
442
  private function get_404page_id() {
443
  $pageid = get_option( '404page_page_id', 0 );
450
  return $pageid;
451
  }
452
 
453
+ // returns the selected method
454
+ private function get_404page_method() {
455
+ if ( defined( 'ICL_SITEPRESS_VERSION' ) || defined( 'POLYLANG_VERSION' ) || defined( 'SITEORIGIN_PANELS_VERSION' ) || class_exists( 'bbPress' ) ) {
456
+ // WPML or bbPress is active
457
+ return 'CMP';
458
+ } else {
459
+ return get_option( '404page_method', 'STD' );
460
+ }
461
+ }
462
+
463
+ // should we hide the selected 404 page from the page list?
464
+ private function get_404page_hide() {
465
+ return (bool)get_option( '404page_hide', false );
466
+ }
467
+
468
+ // should we fire an 404 error if the selected page is accessed directly?
469
+ private function get_404page_fire_error() {
470
+ return (bool)get_option( '404page_fire_error', true );
471
+ }
472
+
473
+ // make plugin expandable
474
+ function do_404page_action() {
475
+ do_action( '404page_after_404' );
476
+ }
477
+
478
  // show meta boxes
479
  function show_meta_boxes() {
480
  ?>
484
  <h3><span><?php _e( 'Like this Plugin?', '404page' ); ?></span></h3>
485
  <div class="inside">
486
  <ul>
487
+ <li><div class="dashicons dashicons-wordpress"></div>&nbsp;&nbsp;<a href="<?php echo $this->wp_url; ?>/"><?php _e( 'Please rate the plugin', '404page' ); ?></a></li>
488
+ <li><div class="dashicons dashicons-admin-home"></div>&nbsp;&nbsp;<a href="<?php echo $this->my_url; ?>/"><?php _e( 'Plugin homepage', '404page'); ?></a></li>
489
  <li><div class="dashicons dashicons-admin-home"></div>&nbsp;&nbsp;<a href="http://smartware.cc/"><?php _e( 'Author homepage', '404page' );?></a></li>
490
  <li><div class="dashicons dashicons-googleplus"></div>&nbsp;&nbsp;<a href="http://g.smartware.cc/"><?php _e( 'Authors Google+ Page', '404page' ); ?></a></li>
491
  <li><div class="dashicons dashicons-facebook-alt"></div>&nbsp;&nbsp;<a href="http://f.smartware.cc/"><?php _e( 'Authors facebook Page', '404page' ); ?></a></li>
496
  <h3><span><?php _e( 'Need help?', '404page' ); ?></span></h3>
497
  <div class="inside">
498
  <ul>
499
+ <li><div class="dashicons dashicons-book-alt"></div>&nbsp;&nbsp;<a href="<?php echo $this->dc_url; ?>"><?php _e( 'Take a look at the Plugin Doc', '404page' ); ?></a></li>
500
+ <li><div class="dashicons dashicons-wordpress"></div>&nbsp;&nbsp;<a href="<?php echo $this->wp_url; ?>/faq/"><?php _e( 'Take a look at the FAQ section', '404page' ); ?></a></li>
501
  <li><div class="dashicons dashicons-wordpress"></div>&nbsp;&nbsp;<a href="http://wordpress.org/support/plugin/<?php echo $this->plugin_slug; ?>/"><?php _e( 'Take a look at the Support section', '404page'); ?></a></li>
502
  <li><div class="dashicons dashicons-admin-comments"></div>&nbsp;&nbsp;<a href="http://smartware.cc/contact/"><?php _e( 'Feel free to contact the Author', '404page' ); ?></a></li>
503
  </ul>
504
  </div>
505
  </div>
506
+ <div class="postbox">
507
+ <h3><span><?php _e( 'Translate this Plugin', '404page' ); ?></span></h3>
508
+ <div class="inside">
509
+ <p><?php _e( 'It would be great if you\'d support the 404page Plugin by adding a new translation or keeping an existing one up to date!', '404page' ); ?></p>
510
+ <p><a href="https://translate.wordpress.org/projects/wp-plugins/<?php echo $this->plugin_slug; ?>"><?php _e( 'Translate online', '404page' ); ?></a></p>
511
+ </div>
512
+ </div>
513
  </div>
514
  </div>
515
  <?php
519
  function add_settings_link( $links ) {
520
  return array_merge( $links, array( '<a href="' . admin_url( 'themes.php?page=404pagesettings' ) . '">' . __( 'Settings', '404page' ) . '</a>') );
521
  }
522
+
523
+ // uninstall plugin
524
+ function uninstall() {
525
+ if( is_multisite() ) {
526
+ $this->uninstall_network();
527
+ } else {
528
+ $this->uninstall_single();
529
+ }
530
+ }
531
+
532
+ // uninstall network wide
533
+ function uninstall_network() {
534
+ global $wpdb;
535
+ $activeblog = $wpdb->blogid;
536
+ $blogids = $wpdb->get_col( esc_sql( 'SELECT blog_id FROM ' . $wpdb->blogs ) );
537
+ foreach ($blogids as $blogid) {
538
+ switch_to_blog( $blogid );
539
+ $this->uninstall_single();
540
+ }
541
+ switch_to_blog( $activeblog );
542
+ }
543
+
544
+ // uninstall single blog
545
+ function uninstall_single() {
546
+ foreach ( $this->settings as $key => $value) {
547
+ delete_option( $key );
548
+ }
549
+ }
550
 
551
  }
552
 
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === 404page ===
2
  Contributors: smartware.cc, petersplugins
3
  Donate link:http://smartware.cc/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.4
7
- Stable tag: 2.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -16,9 +16,8 @@ Custom 404 the easy way! Set any page as custom 404 error page. No coding needed
16
 
17
  **See also [Plugin Homepage](http://smartware.cc/free-wordpress-plugins/404page/) and [Plugin Doc](http://smartware.cc/docs/404page/)**
18
 
19
- = Version 2.0 Update Notice =
20
- * The settings page was moved from 'Settings' to 'Appearance' menu.
21
- * Version 2.0 is more or less a completely new development. This was necessary to solve several compatibility issues. 404page now works with the [WPML WordPress Multilingual Plugin](https://wpml.org/), the [bbPress Forum Plugin](https://wordpress.org/plugins/bbpress/) and the [Customizr Theme](https://wordpress.org/themes/customizr/). [Read more](http://smartware.cc/blog/2016/02/23/the-404page-plugin-now-works-with-wpml-and-other-enhancements/).
22
 
23
  https://www.youtube.com/watch?v=VTL07Lf0IsY
24
 
@@ -71,6 +70,9 @@ To enable the WordPress 404 error handling you have to set the Permalink Structu
71
 
72
  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.
73
 
 
 
 
74
  == Screenshots ==
75
 
76
  1. Create your 404 Page as a normal WordPress Page
@@ -79,6 +81,19 @@ No, there is no redirection! The chosen page is delivered as a 'real' 404 error
79
 
80
  == Changelog ==
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  = 2.0 (2016-03-08) =
83
  * WPML compatibility
84
  * bbPress compatibility
@@ -114,4 +129,40 @@ No, there is no redirection! The chosen page is delivered as a 'real' 404 error
114
  Version 2.0 is more or less a completely new development and a big step forward. [Read more](http://smartware.cc/blog/2016/02/23/the-404page-plugin-now-works-with-wpml-and-other-enhancements/)
115
 
116
  = 1.4 =
117
- Editing of the 404 page is now possible directly from settings page. Portuguese translation added.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === 404page - your smart custom 404 error page ===
2
  Contributors: smartware.cc, petersplugins
3
  Donate link:http://smartware.cc/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.5
7
+ Stable tag: 2.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
16
 
17
  **See also [Plugin Homepage](http://smartware.cc/free-wordpress-plugins/404page/) and [Plugin Doc](http://smartware.cc/docs/404page/)**
18
 
19
+ = Version 2.1 Update Notice =
20
+ Please take a look at the [release notes](http://smartware.cc/blog/2016/04/22/404page-is-now-officially-wpml-approved-and-much-more/).
 
21
 
22
  https://www.youtube.com/watch?v=VTL07Lf0IsY
23
 
70
 
71
  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.
72
 
73
+ = What about PHP Version 7? =
74
+ The plugin works smoothly with PHP 7.
75
+
76
  == Screenshots ==
77
 
78
  1. Create your 404 Page as a normal WordPress Page
81
 
82
  == Changelog ==
83
 
84
+ = 2.1 (2016-04-22) =
85
+ * introduction of selectable Operating Methods
86
+ * several changes to Compatibility Mode for improved WPML and bbPress compatibility plus compatibility with Page Builder by SiteOrigin
87
+ * Polylang compatibility
88
+ * automatic switch to Compatibility Mode if WPML, bbPress, Polylang or Page Builder by SiteOrigin is detected
89
+ * completely new Customizr Compatibility Mode (automatically enabled if Customizr is detected)
90
+ * firing an 404 error in case of directly accessing the 404 error page can now be deactivated
91
+ * WP Super Cache support
92
+ * option to hide the 404 error page from the Pages list
93
+ * 404 error test
94
+ * plugin expandable by action
95
+ * delete all settings on uninstall
96
+
97
  = 2.0 (2016-03-08) =
98
  * WPML compatibility
99
  * bbPress compatibility
129
  Version 2.0 is more or less a completely new development and a big step forward. [Read more](http://smartware.cc/blog/2016/02/23/the-404page-plugin-now-works-with-wpml-and-other-enhancements/)
130
 
131
  = 1.4 =
132
+ Editing of the 404 page is now possible directly from settings page. Portuguese translation added.
133
+
134
+ == Compatibility ==
135
+
136
+ = The 404page plugin was sucessfully tested by the author with the following themes =
137
+ * [Athena](https://wordpress.org/themes/athena/)
138
+ * [Customizr](https://wordpress.org/themes/customizr/) (Read more about [Customizr Compatibility Mode](http://smartware.cc/docs/404page/#settings_operating_method))
139
+ * [evolve](https://wordpress.org/themes/evolve/)
140
+ * [GeneratePress](https://wordpress.org/themes/generatepress/)
141
+ * [Graphene](https://wordpress.org/themes/graphene/)
142
+ * [Hemingway](https://wordpress.org/themes/hemingway/)
143
+ * [Hueman](https://wordpress.org/themes/hueman/)
144
+ * [Responsive](https://wordpress.org/themes/responsive/)
145
+ * [Spacious](https://wordpress.org/themes/spacious/)
146
+ * [Sparkling](https://wordpress.org/themes/sparkling/)
147
+ * [Sydney](https://wordpress.org/themes/sydney/)
148
+ * [Twenty Ten](https://wordpress.org/themes/twentyten/)
149
+ * [Twenty Eleven](https://wordpress.org/themes/twentyeleven/)
150
+ * [Twenty Twelve](https://wordpress.org/themes/twentytwelve/)
151
+ * [Twenty Thirteen](https://wordpress.org/themes/twentythirteen/)
152
+ * [Twenty Fourteen](https://wordpress.org/themes/twentyfourteen/)
153
+ * [Twenty Fifteen](https://wordpress.org/themes/twentyfifteen/)
154
+ * [Twenty Sixteen](https://wordpress.org/themes/twentysixteen/)
155
+ * [Vantage](https://wordpress.org/themes/vantage/)
156
+ * [Virtue](https://wordpress.org/themes/virtue/)
157
+ * [Zerif Lite](https://wordpress.org/themes/zerif-lite/)
158
+
159
+ = The 404page plugin was sucessfully tested by the author with the following plugins =
160
+ * [bbPress](https://wordpress.org/plugins/bbpress/)(Read more about [Compatibility Mode](http://smartware.cc/docs/404page/#settings_operating_method))
161
+ * [BuddyPress](https://wordpress.org/plugins/buddypress/)
162
+ * [hashtagger](https://wordpress.org/plugins/hashtagger/)
163
+ * [Page Builder by SiteOrigin](https://wordpress.org/plugins/siteorigin-panels/)(Read more about [Compatibility Mode](http://smartware.cc/docs/404page/#settings_operating_method))
164
+ * [Polylang](https://wordpress.org/plugins/polylang/)(Read more about [Polylang Compatibility](http://smartware.cc/docs/404page/#settings_operating_method))
165
+ * [User Submitted Posts](https://wordpress.org/plugins/user-submitted-posts/)
166
+ * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
167
+ * [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/)(Read more about [WP Super Cache Compatibility](http://smartware.cc/docs/404page/#wp_super_cache)
168
+ * [WPML WordPress Multilingual Plugin](https://wpml.org/)([officially approved by WPML team](https://wpml.org/plugin/404page/))(Read more about [WPML Compatibility](http://smartware.cc/docs/404page/#settings_operating_method)
uninstall.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // 404page uninstall
3
+
4
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) || ! WP_UNINSTALL_PLUGIN || dirname( WP_UNINSTALL_PLUGIN ) != dirname( plugin_basename( __FILE__ ) ) ) {
5
+ status_header( 404 );
6
+ exit;
7
+ }
8
+
9
+ include_once plugin_dir_path( __FILE__ ) . '404page.php';
10
+
11
+ $smart404page->uninstall();
12
+ ?>