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

Version Description

fixed compatibility issue with latest WPML version

Download this release

Release Info

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

Code changes from version 7 to 8

404page.php CHANGED
@@ -9,7 +9,7 @@
9
* Plugin Name: 404page - your smart custom 404 error page
10
* Plugin URI: https://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: 7
13
* Author: Peter Raschendorfer
14
* Author URI: https://petersplugins.com
15
* Text Domain: 404page
@@ -37,38 +37,32 @@ require_once( plugin_dir_path( __FILE__ ) . '/loader.php' );
37
38
// this function can be used by a theme to check if there's an active custom 404 page
39
function pp_404_is_active() {
40
- global $pp_404page;
41
- return $pp_404page->pp_404_is_active();
42
}
43
44
// this function can be used by a theme to activate native support
45
function pp_404_set_native_support() {
46
- global $pp_404page;
47
- $pp_404page->pp_404_set_native_support();
48
}
49
50
// this function can be used by a theme to get the title of the custom 404 page in native support
51
function pp_404_get_the_title() {
52
- global $pp_404page;
53
- return $pp_404page->pp_404_get_the_title();
54
}
55
56
// this function can be used by a theme to print out the title of the custom 404 page in native support
57
function pp_404_the_title() {
58
- global $pp_404page;
59
- $pp_404page->pp_404_the_title();
60
}
61
62
// this function can be used by a theme to get the content of the custom 404 page in native support
63
function pp_404_get_the_content() {
64
- global $pp_404page;
65
- return $pp_404page->pp_404_get_the_content();
66
}
67
68
// this function can be used by a theme to print out the content of the custom 404 page in native support
69
function pp_404_the_content() {
70
- global $pp_404page;
71
- return $pp_404page->pp_404_the_content();
72
}
73
74
?>
9
* Plugin Name: 404page - your smart custom 404 error page
10
* Plugin URI: https://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: 8
13
* Author: Peter Raschendorfer
14
* Author URI: https://petersplugins.com
15
* Text Domain: 404page
37
38
// this function can be used by a theme to check if there's an active custom 404 page
39
function pp_404_is_active() {
40
+ return pp_404page()->pp_404_is_active();
41
}
42
43
// this function can be used by a theme to activate native support
44
function pp_404_set_native_support() {
45
+ pp_404page()->pp_404_set_native_support();
46
}
47
48
// this function can be used by a theme to get the title of the custom 404 page in native support
49
function pp_404_get_the_title() {
50
+ return pp_404page()->pp_404_get_the_title();
51
}
52
53
// this function can be used by a theme to print out the title of the custom 404 page in native support
54
function pp_404_the_title() {
55
+ pp_404page()->pp_404_the_title();
56
}
57
58
// this function can be used by a theme to get the content of the custom 404 page in native support
59
function pp_404_get_the_content() {
60
+ return pp_404page()->pp_404_get_the_content();
61
}
62
63
// this function can be used by a theme to print out the content of the custom 404 page in native support
64
function pp_404_the_content() {
65
+ return pp_404page()->pp_404_the_content();
66
}
67
68
?>
assets/css/404page-ui.css CHANGED
@@ -106,6 +106,7 @@ body:not(.rtl) #pp-404page-settings input[type="checkbox"]:enabled:checked + lab
106
margin: 0 12px 12px 0;
107
width: 300px;
108
float: left;
109
}
110
111
#pp-404page-videos a div {
@@ -135,4 +136,22 @@ body:not(.rtl) #pp-404page-settings input[type="checkbox"]:enabled:checked + lab
135
136
#pp-404page-videos a:hover div:after, #pp-404page-videos a:focus div:after {
137
opacity: 0.8;
138
}
106
margin: 0 12px 12px 0;
107
width: 300px;
108
float: left;
109
+ line-height: 1;
110
}
111
112
#pp-404page-videos a div {
136
137
#pp-404page-videos a:hover div:after, #pp-404page-videos a:focus div:after {
138
opacity: 0.8;
139
+ }
140
+
141
+
142
+ /* Some changes for Lity to overlay Admin Bar */
143
+ .lity, .lity-wrap {
144
+ z-index: 999990;
145
+ }
146
+ .lity-loader {
147
+ z-index: 999991;
148
+ }
149
+ .lity-container {
150
+ z-index: 999992;
151
+ }
152
+ .lity-content {
153
+ z-index: 999993;
154
+ }
155
+ .lity-close {
156
+ z-index: 999994;
157
}
assets/css/lity.min.css ADDED
@@ -0,0 +1,3 @@
1
+ /*! Lity - v2.3.1 - 2018-04-20
2
+ * http://sorgalla.com/lity/
3
+ * Copyright (c) 2015-2018 Jan Sorgalla; Licensed MIT */.lity{z-index:9990;position:fixed;top:0;right:0;bottom:0;left:0;white-space:nowrap;background:#0b0b0b;background:rgba(0,0,0,0.9);outline:none !important;opacity:0;-webkit-transition:opacity .3s ease;-o-transition:opacity .3s ease;transition:opacity .3s ease}.lity.lity-opened{opacity:1}.lity.lity-closed{opacity:0}.lity *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.lity-wrap{z-index:9990;position:fixed;top:0;right:0;bottom:0;left:0;text-align:center;outline:none !important}.lity-wrap:before{content:'';display:inline-block;height:100%;vertical-align:middle;margin-right:-0.25em}.lity-loader{z-index:9991;color:#fff;position:absolute;top:50%;margin-top:-0.8em;width:100%;text-align:center;font-size:14px;font-family:Arial,Helvetica,sans-serif;opacity:0;-webkit-transition:opacity .3s ease;-o-transition:opacity .3s ease;transition:opacity .3s ease}.lity-loading .lity-loader{opacity:1}.lity-container{z-index:9992;position:relative;text-align:left;vertical-align:middle;display:inline-block;white-space:normal;max-width:100%;max-height:100%;outline:none !important}.lity-content{z-index:9993;width:100%;-webkit-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1);-webkit-transition:-webkit-transform .3s ease;transition:-webkit-transform .3s ease;-o-transition:-o-transform .3s ease;transition:transform .3s ease;transition:transform .3s ease, -webkit-transform .3s ease, -o-transform .3s ease}.lity-loading .lity-content,.lity-closed .lity-content{-webkit-transform:scale(.8);-ms-transform:scale(.8);-o-transform:scale(.8);transform:scale(.8)}.lity-content:after{content:'';position:absolute;left:0;top:0;bottom:0;display:block;right:0;width:auto;height:auto;z-index:-1;-webkit-box-shadow:0 0 8px rgba(0,0,0,0.6);box-shadow:0 0 8px rgba(0,0,0,0.6)}.lity-close{z-index:9994;width:35px;height:35px;position:fixed;right:0;top:0;-webkit-appearance:none;cursor:pointer;text-decoration:none;text-align:center;padding:0;color:#fff;font-style:normal;font-size:35px;font-family:Arial,Baskerville,monospace;line-height:35px;text-shadow:0 1px 2px rgba(0,0,0,0.6);border:0;background:none;outline:none;-webkit-box-shadow:none;box-shadow:none}.lity-close::-moz-focus-inner{border:0;padding:0}.lity-close:hover,.lity-close:focus,.lity-close:active,.lity-close:visited{text-decoration:none;text-align:center;padding:0;color:#fff;font-style:normal;font-size:35px;font-family:Arial,Baskerville,monospace;line-height:35px;text-shadow:0 1px 2px rgba(0,0,0,0.6);border:0;background:none;outline:none;-webkit-box-shadow:none;box-shadow:none}.lity-close:active{top:1px}.lity-image img{max-width:100%;display:block;line-height:0;border:0}.lity-iframe .lity-container,.lity-youtube .lity-container,.lity-vimeo .lity-container,.lity-facebookvideo .lity-container,.lity-googlemaps .lity-container{width:100%;max-width:964px}.lity-iframe-container{width:100%;height:0;padding-top:56.25%;overflow:auto;pointer-events:auto;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-overflow-scrolling:touch}.lity-iframe-container iframe{position:absolute;display:block;top:0;left:0;width:100%;height:100%;-webkit-box-shadow:0 0 8px rgba(0,0,0,0.6);box-shadow:0 0 8px rgba(0,0,0,0.6);background:#000}.lity-hide{display:none}
assets/img/pluginicon.png CHANGED
Binary file
assets/img/videos/404page_advanced_410_trashed_objects.png ADDED
Binary file
assets/img/videos/404page_advanced_compatibility_mode.png ADDED
Binary file
assets/js/lity.min.js ADDED
@@ -0,0 +1,5 @@
1
+ /*! Lity - v2.3.1 - 2018-04-20
2
+ * http://sorgalla.com/lity/
3
+ * Copyright (c) 2015-2018 Jan Sorgalla; Licensed MIT */
4
+
5
+ !function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(c){return b(a,c)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=b(a,require("jquery")):a.lity=b(a,a.jQuery||a.Zepto)}("undefined"!=typeof window?window:this,function(a,b){"use strict";function c(a){var b=B();return N&&a.length?(a.one(N,b.resolve),setTimeout(b.resolve,500)):b.resolve(),b.promise()}function d(a,c,d){if(1===arguments.length)return b.extend({},a);if("string"==typeof c){if(void 0===d)return void 0===a[c]?null:a[c];a[c]=d}else b.extend(a,c);return this}function e(a){for(var b,c=decodeURI(a.split("#")[0]).split("&"),d={},e=0,f=c.length;e<f;e++)c[e]&&(b=c[e].split("="),d[b[0]]=b[1]);return d}function f(a,c){return a+(a.indexOf("?")>-1?"&":"?")+b.param(c)}function g(a,b){var c=a.indexOf("#");return-1===c?b:(c>0&&(a=a.substr(c)),b+a)}function h(a){return b('<span class="lity-error"/>').append(a)}function i(a,c){var d=c.opener()&&c.opener().data("lity-desc")||"Image with no description",e=b('<img src="'+a+'" alt="'+d+'"/>'),f=B(),g=function(){f.reject(h("Failed loading image"))};return e.on("load",function(){if(0===this.naturalWidth)return g();f.resolve(e)}).on("error",g),f.promise()}function j(a,c){var d,e,f;try{d=b(a)}catch(a){return!1}return!!d.length&&(e=b('<i style="display:none !important"/>'),f=d.hasClass("lity-hide"),c.element().one("lity:remove",function(){e.before(d).remove(),f&&!d.closest(".lity-content").length&&d.addClass("lity-hide")}),d.removeClass("lity-hide").after(e))}function k(a){var c=J.exec(a);return!!c&&o(g(a,f("https://www.youtube"+(c[2]||"")+".com/embed/"+c[4],b.extend({autoplay:1},e(c[5]||"")))))}function l(a){var c=K.exec(a);return!!c&&o(g(a,f("https://player.vimeo.com/video/"+c[3],b.extend({autoplay:1},e(c[4]||"")))))}function m(a){var c=M.exec(a);return!!c&&(0!==a.indexOf("http")&&(a="https:"+a),o(g(a,f("https://www.facebook.com/plugins/video.php?href="+a,b.extend({autoplay:1},e(c[4]||""))))))}function n(a){var b=L.exec(a);return!!b&&o(g(a,f("https://www.google."+b[3]+"/maps?"+b[6],{output:b[6].indexOf("layer=c")>0?"svembed":"embed"})))}function o(a){return'<div class="lity-iframe-container"><iframe frameborder="0" allowfullscreen src="'+a+'"/></div>'}function p(){return z.documentElement.clientHeight?z.documentElement.clientHeight:Math.round(A.height())}function q(a){var b=v();b&&(27===a.keyCode&&b.options("esc")&&b.close(),9===a.keyCode&&r(a,b))}function r(a,b){var c=b.element().find(G),d=c.index(z.activeElement);a.shiftKey&&d<=0?(c.get(c.length-1).focus(),a.preventDefault()):a.shiftKey||d!==c.length-1||(c.get(0).focus(),a.preventDefault())}function s(){b.each(D,function(a,b){b.resize()})}function t(a){1===D.unshift(a)&&(C.addClass("lity-active"),A.on({resize:s,keydown:q})),b("body > *").not(a.element()).addClass("lity-hidden").each(function(){var a=b(this);void 0===a.data(F)&&a.data(F,a.attr(E)||null)}).attr(E,"true")}function u(a){var c;a.element().attr(E,"true"),1===D.length&&(C.removeClass("lity-active"),A.off({resize:s,keydown:q})),D=b.grep(D,function(b){return a!==b}),c=D.length?D[0].element():b(".lity-hidden"),c.removeClass("lity-hidden").each(function(){var a=b(this),c=a.data(F);c?a.attr(E,c):a.removeAttr(E),a.removeData(F)})}function v(){return 0===D.length?null:D[0]}function w(a,c,d,e){var f,g="inline",h=b.extend({},d);return e&&h[e]?(f=h[e](a,c),g=e):(b.each(["inline","iframe"],function(a,b){delete h[b],h[b]=d[b]}),b.each(h,function(b,d){return!d||(!(!d.test||d.test(a,c))||(f=d(a,c),!1!==f?(g=b,!1):void 0))})),{handler:g,content:f||""}}function x(a,e,f,g){function h(a){k=b(a).css("max-height",p()+"px"),j.find(".lity-loader").each(function(){var a=b(this);c(a).always(function(){a.remove()})}),j.removeClass("lity-loading").find(".lity-content").empty().append(k),m=!0,k.trigger("lity:ready",[l])}var i,j,k,l=this,m=!1,n=!1;e=b.extend({},H,e),j=b(e.template),l.element=function(){return j},l.opener=function(){return f},l.options=b.proxy(d,l,e),l.handlers=b.proxy(d,l,e.handlers),l.resize=function(){m&&!n&&k.css("max-height",p()+"px").trigger("lity:resize",[l])},l.close=function(){if(m&&!n){n=!0,u(l);var a=B();if(g&&(z.activeElement===j[0]||b.contains(j[0],z.activeElement)))try{g.focus()}catch(a){}return k.trigger("lity:close",[l]),j.removeClass("lity-opened").addClass("lity-closed"),c(k.add(j)).always(function(){k.trigger("lity:remove",[l]),j.remove(),j=void 0,a.resolve()}),a.promise()}},i=w(a,l,e.handlers,e.handler),j.attr(E,"false").addClass("lity-loading lity-opened lity-"+i.handler).appendTo("body").focus().on("click","[data-lity-close]",function(a){b(a.target).is("[data-lity-close]")&&l.close()}).trigger("lity:open",[l]),t(l),b.when(i.content).always(h)}function y(a,c,d){a.preventDefault?(a.preventDefault(),d=b(this),a=d.data("lity-target")||d.attr("href")||d.attr("src")):d=b(d);var e=new x(a,b.extend({},d.data("lity-options")||d.data("lity"),c),d,z.activeElement);if(!a.preventDefault)return e}var z=a.document,A=b(a),B=b.Deferred,C=b("html"),D=[],E="aria-hidden",F="lity-"+E,G='a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,[contenteditable],[tabindex]:not([tabindex^="-"])',H={esc:!0,handler:null,handlers:{image:i,inline:j,youtube:k,vimeo:l,googlemaps:n,facebookvideo:m,iframe:o},template:'<div class="lity" role="dialog" aria-label="Dialog Window (Press escape to close)" tabindex="-1"><div class="lity-wrap" data-lity-close role="document"><div class="lity-loader" aria-hidden="true">Loading...</div><div class="lity-container"><div class="lity-content"></div><button class="lity-close" type="button" aria-label="Close (Press escape to close)" data-lity-close>&times;</button></div></div></div>'},I=/(^data:image\/)|(\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?)(\?\S*)?$)/i,J=/(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i,K=/(vimeo(pro)?.com)\/(?:[^\d]+)?(\d+)\??(.*)?#x2F;,L=/((maps|www)\.)?google\.([^\/\?]+)\/?((maps\/?)?\?)(.*)/i,M=/(facebook\.com)\/([a-z0-9_-]*)\/videos\/([0-9]*)(.*)?#x2F;i,N=function(){var a=z.createElement("div"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return b[c];return!1}();return i.test=function(a){return I.test(a)},y.version="2.3.1",y.options=b.proxy(d,y,H),y.handlers=b.proxy(d,y,H.handlers),y.current=v,b(z).on("click.lity","[data-lity]",y),y});
inc/admin/404page-admin-page.php ADDED
@@ -0,0 +1,69 @@
1
+ <div class="wrap pp-admin-page-wrapper" id="pp-404page-settings">
2
+ <h1>
3
+ <span><?php echo $this->get_plugin_name(); ?></span>
4
+ <nav>
5
+ <?php $this->show_nav_icons( array(
6
+ array(
7
+ 'link' => 'https://wordpress.org/support/plugin/' . $this->get_plugin_slug() . '/reviews/',
8
+ 'title' => __( 'Please rate Plugin', '404page' ),
9
+ 'icon' => 'dashicons-star-filled'
10
+ ),
11
+ array(
12
+ 'link' => 'https://wordpress.org/plugins/' . $this->get_plugin_slug(),
13
+ 'title' => __( 'WordPress.org Plugin Page', '404page' ),
14
+ 'icon' => 'dashicons-wordpress'
15
+ ),
16
+ array(
17
+ 'link' => 'https://petersplugins.com/docs/' . $this->get_plugin_slug(),
18
+ 'title' => __( 'Plugin Doc', '404page' ),
19
+ 'icon' => 'dashicons-book-alt'
20
+ ),
21
+ array(
22
+ 'link' => 'https://wordpress.org/support/plugin/' . $this->get_plugin_slug(),
23
+ 'title' => __( 'Support', '404page' ),
24
+ 'icon' => 'dashicons-editor-help'
25
+ ),
26
+ array(
27
+ 'link' => 'https://petersplugins.com/',
28
+ 'title' => __( 'Authors Website', '404page' ),
29
+ 'icon' => 'dashicons-admin-home'
30
+ ),
31
+ array(
32
+ 'link' => 'https://www.facebook.com/petersplugins/',
33
+ 'title' => __( 'Authors Facebook Page', '404page' ),
34
+ 'icon' => 'dashicons-facebook-alt'
35
+ )
36
+
37
+ ) ); ?>
38
+ </nav>
39
+ </h1>
40
+ <?php settings_errors(); ?>
41
+
42
+ <div class="postbox">
43
+ <div class="inside">
44
+
45
+ <form method="POST" action="options.php">
46
+
47
+ <h2><?php _e( 'General', '404page' ); ?></h2>
48
+ <?php settings_fields( '404page_settings' ); ?>
49
+ <?php do_settings_sections( '404page_settings_section' ); ?>
50
+ <div id="pp-settings-advanced">
51
+ <h2><?php _e( 'Advanced', '404page' ); ?></h2>
52
+ <?php do_settings_sections( '404page_settings_section_advanced' ); ?>
53
+ </div>
54
+ <?php submit_button(); ?>
55
+
56
+ </form>
57
+
58
+ </div>
59
+ </div>
60
+
61
+ <div class="postbox">
62
+ <div class="inside">
63
+ <div id="pp-404page-videos">
64
+ <h2><?php _e( 'Watch the Explainer Videos', '404page' ); ?></h2>
65
+ <?php $this->show_videos(); ?>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ </div>
inc/admin/index.php ADDED
@@ -0,0 +1 @@
1
+ <?php // Silence is golden
inc/class-404page.php CHANGED
@@ -24,33 +24,167 @@ if ( !class_exists( 'PP_404Page' ) ) {
24
25
26
class PP_404Page {
27
- public $plugin_name;
28
- public $plugin_slug;
29
- public $version;
30
- private $_file;
31
- private $wp_url;
32
- private $my_url;
33
- private $dc_url;
34
private $settings;
35
private $template;
36
private $postid;
37
private $admin_handle;
38
39
/**
40
- * here we go
41
*/
42
- public function __construct( $settings ) {
43
-
44
- $this->_file = $settings['file'];
45
- $this->plugin_slug = $settings['slug'];
46
- $this->plugin_name = $settings['name'];
47
- $this->version = $settings['version'];
48
49
$this->get_settings();
50
$this->load();
51
}
52
53
54
/**
55
* get all settings
56
* except 404page_method
@@ -71,10 +205,6 @@ if ( !class_exists( 'PP_404Page' ) ) {
71
*/
72
private function load() {
73
74
- $this->wp_url = 'https://wordpress.org/plugins/' . $this->plugin_slug;
75
- $this->my_url = 'https://petersplugins.com/free-wordpress-plugins/' . $this->plugin_slug;
76
- $this->dc_url = 'https://petersplugins.com/docs/' . $this->plugin_slug;
77
-
78
add_action( 'init', array( $this, 'add_text_domain' ) );
79
add_action( 'init', array( $this, 'init' ) );
80
@@ -121,7 +251,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
121
add_action( 'admin_init', array( $this, 'admin_init' ) );
122
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
123
add_action( 'admin_head', array( $this, 'admin_style' ) );
124
- add_filter( 'plugin_action_links_' . plugin_basename( $this->_file ), array( $this, 'add_settings_links' ) );
125
add_action( 'admin_enqueue_scripts', array( $this, 'admin_js' ) );
126
add_action( 'admin_enqueue_scripts', array( $this, 'admin_css' ) );
127
@@ -254,7 +384,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
254
* Compatibility Mode
255
*/
256
function show404_compatiblity_mode( $posts ) {
257
-
258
// remove the filter so we handle only the first query - no custom queries
259
remove_filter( 'the_posts', array( $this, 'show404_compatiblity_mode' ), 999 );
260
@@ -274,6 +404,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
274
275
$pageid = $this->get_page_id();
276
if ( ! $this->settings->get_native() ) {
277
if ( empty( $posts ) && is_main_query() && !is_robots() && !is_home() && !is_feed() && !is_search() && !is_archive() && ( !defined('DOING_AJAX') || !DOING_AJAX ) ) {
278
279
// 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
@@ -289,12 +420,15 @@ if ( !class_exists( 'PP_404Page' ) ) {
289
global $wp_query;
290
$wp_query = null;
291
$wp_query = new WP_Query();
292
- $wp_query->query( 'page_id=' . $pageid );
293
- $wp_query->the_post();
294
295
$this->template = get_page_template();
296
$posts = $wp_query->posts;
297
- $wp_query->rewind_posts();
298
299
add_action( 'wp', array( $this, 'do_404_header' ) );
300
add_filter( 'body_class', array( $this, 'add_404_body_class' ) );
@@ -484,7 +618,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
484
*/
485
function show404articleselectors_customizr_mode( $selectors ) {
486
if ( ! $this->settings->get_native() ) {
487
- return 'id="post-' . $this->get_page_id() . '" ' . 'class="' . join( ' ', get_post_class( 'row-fluid', $this->get_page_id() ) ) . '"';
488
} else {
489
return $selectors;
490
}
@@ -569,7 +703,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
569
register_setting( '404page_settings', '404page_force_error' );
570
register_setting( '404page_settings', '404page_no_url_guessing' );
571
register_setting( '404page_settings', '404page_http410_if_trashed' );
572
- 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' ) );
573
add_settings_field( '404page_settings_hide', '' , array( $this, 'admin_hide' ), '404page_settings_section_advanced', '404page-settings', array( 'label_for' => '404page_hide' ) );
574
add_settings_field( '404page_settings_fire', '' , array( $this, 'admin_fire404' ), '404page_settings_section_advanced', '404page-settings', array( 'label_for' => '404page_fire_error' ) );
575
add_settings_field( '404page_settings_force', '' , array( $this, 'admin_force404' ), '404page_settings_section_advanced', '404page-settings', array( 'label_for' => '404page_force_error' ) );
@@ -645,7 +779,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
645
function admin_hide() {
646
647
echo '<p><input type="checkbox" id="404page_hide" name="404page_hide" value="1"' . checked( true, $this->settings->get_hide(), false ) . '/>';
648
- 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 />';
649
echo '<span class="dashicons dashicons-info"></span>&nbsp;' . __( 'For Administrators the page is always visible.', '404page' ) . '</p><div class="clear"></div>';
650
651
}
@@ -657,12 +791,12 @@ if ( !class_exists( 'PP_404Page' ) ) {
657
function admin_fire404() {
658
659
echo '<p><input type="checkbox" id="404page_fire_error" name="404page_fire_error" value="1"' . checked( true, $this->settings->get_fire_error(), false ) . '/>';
660
- 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 />';
661
echo '<span class="dashicons dashicons-info"></span>&nbsp;' . __( 'Uncheck this if you want the selected page to be accessible.', '404page' );
662
663
if ( function_exists( 'wpsupercache_activate' ) ) {
664
665
- 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>)';
666
667
}
668
@@ -677,7 +811,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
677
function admin_force404() {
678
679
echo '<p><input type="checkbox" id="404page_force_error" name="404page_force_error" value="1"' . checked( true, $this->settings->get_force_error(), false ) . '/>';
680
- 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>&nbsp;<a class="dashicons dashicons-video-alt3" href="https://youtu.be/09OOCbFLfnI"></a><br />';
681
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>';
682
683
}
@@ -689,7 +823,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
689
function admin_noguess() {
690
691
echo '<p><input type="checkbox" id="404page_no_url_guessing" name="404page_no_url_guessing" value="1"' . checked( true, $this->settings->get_no_url_guessing(), false ) . '/>';
692
- 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>&nbsp;<a class="dashicons dashicons-video-alt3" href="https://youtu.be/H0EdtFcAGl4"></a><br />';
693
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>';
694
695
}
@@ -702,7 +836,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
702
function admin_http410() {
703
704
echo '<p><input type="checkbox" id="404page_http410_if_trashed" name="404page_http410_if_trashed" value="1"' . checked( true, $this->settings->get_http410_if_trashed(), false ) . '/>';
705
- echo '<label for="404page_http410_if_trashed" class="check"></label>' . __( 'Send an HTTP 410 error instead of HTTP 404 in case the requested object is in trash', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="' . $this->dc_url . '/#settings_maybe_send_http410"></a><br />';
706
echo '<span class="dashicons dashicons-info"></span>&nbsp;' . __( 'Check this if you want to inform search engines that the resource requested is no longer available and will not be available again so it can be removed from the search index immediately.', '404page' );
707
708
}
@@ -723,23 +857,23 @@ if ( !class_exists( 'PP_404Page' ) ) {
723
}
724
725
echo '<p><input type="checkbox" id="404page_method" name="404page_method" value="CMP"' . checked( 'CMP', $this->settings->get_method(), false ) . $dis . '/>';
726
- 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 />';
727
echo '<span class="dashicons dashicons-info"></span>&nbsp;';
728
729
if ( $this->settings->get_native() ) {
730
731
_e( 'This setting is not available because the Theme you are using natively supports the 404page plugin.', '404page' );
732
- echo ' (<a href="' . $this->dc_url . '/#native_mode">' . __( 'Read more', '404page' ) . '</a>)';
733
734
} elseif ( defined( 'CUSTOMIZR_VER' ) ) {
735
736
_e( 'This setting is not availbe because the 404page Plugin works in Customizr Compatibility Mode.', '404page' );
737
- echo ' (<a href="' . $this->dc_url . '/#special_modes">' . __( 'Read more', '404page' ) . '</a>)';
738
739
} elseif ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
740
741
_e( 'This setting is not availbe because the 404page Plugin works in WPML Mode.', '404page' );
742
- echo ' (<a href="' . $this->dc_url . '/#special_modes">' . __( 'Read more', '404page' ) . '</a>)';
743
744
} else {
745
@@ -1033,7 +1167,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
1033
* create the menu entry
1034
*/
1035
function admin_menu() {
1036
- $this->admin_handle = add_theme_page ( __( '404 Error Page', "404page" ), __( '404 Error Page', '404page' ), 'manage_options', '404pagesettings', array( $this, 'admin_page' ) );
1037
}
1038
1039
@@ -1044,6 +1178,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
1044
1045
if ( get_current_screen()->id == $this->admin_handle ) {
1046
1047
wp_enqueue_style( 'pp-admin-page', $this->get_asset_file( 'css', 'pp-admin-page.css' ) );
1048
wp_enqueue_style( '404pagecss', $this->get_asset_file( 'css', '404page-ui.css' ) );
1049
@@ -1057,11 +1192,12 @@ if ( !class_exists( 'PP_404Page' ) ) {
1057
*/
1058
function admin_js() {
1059
1060
- wp_enqueue_script( '404pagejs', $this->get_asset_file( 'js', '404page.js' ), 'jquery', $this->version, true );
1061
1062
if ( get_current_screen()->id == $this->admin_handle ) {
1063
1064
- wp_enqueue_script( '404page-ui', $this->get_asset_file( 'js', '404page-ui.js' ), 'jquery', $this->version, true );
1065
1066
}
1067
@@ -1071,75 +1207,16 @@ if ( !class_exists( 'PP_404Page' ) ) {
1071
/**
1072
* show admin page
1073
*/
1074
- function admin_page() {
1075
1076
if ( !current_user_can( 'manage_options' ) ) {
1077
1078
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
1079
1080
}
1081
- ?>
1082
- <div class="wrap pp-admin-page-wrapper" id="pp-404page-settings">
1083
- <h1>
1084
- <span><?php echo $this->plugin_name; ?></span>
1085
- <nav>
1086
- <?php $this->show_nav_icons( array(
1087
- array(
1088
- 'link' => 'https://wordpress.org/support/plugin/' . $this->plugin_slug . '/reviews/',
1089
- 'title' => __( 'Please rate Plugin', '404page' ),
1090
- 'icon' => 'dashicons-star-filled'
1091
- ),
1092
- array(
1093
- 'link' => $this->wp_url,
1094
- 'title' => __( 'WordPress.org Plugin Page', '404page' ),
1095
- 'icon' => 'dashicons-wordpress'
1096
- ),
1097
- array(
1098
- 'link' => $this->dc_url,
1099
- 'title' => __( 'Plugin Doc', '404page' ),
1100
- 'icon' => 'dashicons-book-alt'
1101
- ),
1102
- array(
1103
- 'link' => 'https://wordpress.org/support/plugin/' . $this->plugin_slug,
1104
- 'title' => __( 'Support', '404page' ),
1105
- 'icon' => 'dashicons-editor-help'
1106
- ),
1107
- array(
1108
- 'link' => 'https://petersplugins.com/',
1109
- 'title' => __( 'Authors Website', '404page' ),
1110
- 'icon' => 'dashicons-admin-home'
1111
- ),
1112
- array(
1113
- 'link' => 'https://plus.google.com/+petersplugins',
1114
- 'title' => __( 'Authors Google+ Page', '404page' ),
1115
- 'icon' => 'dashicons-googleplus'
1116
- ),
1117
- array(
1118
- 'link' => 'https://www.facebook.com/petersplugins/',
1119
- 'title' => __( 'Authors Facebook Page', '404page' ),
1120
- 'icon' => 'dashicons-facebook-alt'
1121
- )
1122
-
1123
- ) ); ?>
1124
- </nav>
1125
- </h1>
1126
- <?php settings_errors(); ?>
1127
- <form method="post" action="options.php">
1128
- <h3><?php _e( 'General', '404page' ); ?></h3>
1129
- <?php settings_fields( '404page_settings' ); ?>
1130
- <?php do_settings_sections( '404page_settings_section' ); ?>
1131
- <div id="pp-settings-advanced">
1132
- <h3><?php _e( 'Advanced', '404page' ); ?></h3>
1133
- <?php do_settings_sections( '404page_settings_section_advanced' ); ?>
1134
- </div>
1135
- <?php submit_button(); ?>
1136
- <div id="pp-404page-videos">
1137
- <h3><?php _e( 'Helpful YouTube Videos', '404page' ); ?></h3>
1138
- <?php $this->show_videos(); ?>
1139
- </div>
1140
- </form>
1141
- </div>
1142
- <?php
1143
}
1144
1145
@@ -1163,6 +1240,16 @@ if ( !class_exists( 'PP_404Page' ) ) {
1163
*/
1164
function admin_notices() {
1165
1166
// invite to follow me
1167
if ( current_user_can( 'manage_options' ) && get_user_meta( get_current_user_id(), 'pp-404page-admin-notice-1', true ) != 'dismissed' ) {
1168
?>
@@ -1430,7 +1517,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
1430
*/
1431
private function get_asset_file( $dir, $file ) {
1432
1433
- return plugins_url( 'assets/' . $dir . '/' . $file, $this->_file );
1434
1435
}
1436
@@ -1447,12 +1534,14 @@ if ( !class_exists( 'PP_404Page' ) ) {
1447
array( 'id' => 'HygoFMwdIuY', 'title' => 'A brief introduction', 'img' => '404page-brief-intro' ),
1448
array( 'id' => '9rL9LbYiSJk', 'title' => 'A quick Overview over the Advanced Settings', 'img' => '404page-advanced-settings-quick-overview' ),
1449
array( 'id' => '09OOCbFLfnI', 'title' => 'The Advanced Setting "Force 404 error after loading page" explained', 'img' => '404page_advanced_force_404' ),
1450
- array( 'id' => 'H0EdtFcAGl4', 'title' => 'The Advanced Setting "Disable URL Autocorrecton Guessing" explained', 'img' => '404page_advanced_url_guessing' )
1451
);
1452
1453
foreach( $videos as $video ) {
1454
1455
- echo '<a href="https://youtu.be/' . $video['id'] . '" title="' . $video['title'] . '"><div><img src="' . $this->get_asset_file( 'img/videos', $video['img'] . '.png' ) . '" title="' . $video['title'] . '" alt="' . $video['title'] . '"></div></a>';
1456
1457
}
1458
24
25
26
class PP_404Page {
27
+
28
+ /**
29
+ * Instance
30
+ *
31
+ * @since 8
32
+ * @var singleton
33
+ * @access protected
34
+ */
35
+ protected static $_instance = null;
36
+
37
+
38
+ /**
39
+ * Plugin Main File Path and Name
40
+ *
41
+ * @since 8
42
+ * @var string
43
+ * @access private
44
+ * was $_file before
45
+ */
46
+
47
+
48
+ /**
49
+ * Plugin Name
50
+ *
51
+ * @since 1
52
+ * @var string
53
+ * @access private
54
+ */
55
+ private $plugin_name;
56
+
57
+
58
+ /**
59
+ * Plugin Slug
60
+ *
61
+ * @since 1
62
+ * @var string
63
+ * @access private
64
+ */
65
+ private $plugin_slug;
66
+
67
+
68
+ /**
69
+ * Plugin Version
70
+ *
71
+ * @since 8
72
+ * @var int
73
+ * @access private
74
+ * was $version before
75
+ */
76
+ private $plugin_version;
77
+
78
+
79
private $settings;
80
private $template;
81
private $postid;
82
private $admin_handle;
83
84
+
85
/**
86
+ * Init the Class
87
+ *
88
+ * @since 1
89
+ * @see getInstance
90
*/
91
+ protected function __construct( $settings ) {
92
+
93
+ $this->plugin_file = $settings['file'];
94
+ $this->plugin_slug = $settings['slug'];
95
+ $this->plugin_name = $settings['name'];
96
+ $this->plugin_version = $settings['version'];
97
98
$this->get_settings();
99
$this->load();
100
}
101
102
103
+ /**
104
+ * Prevent Cloning
105
+ *
106
+ * @since 3
107
+ */
108
+ protected function __clone() {}
109
+
110
+
111
+ /**
112
+ * Get the Instance
113
+ *
114
+ * @since 8
115
+ * @param array $settings {
116
+ * @type string $file Plugin Main File Path and Name
117
+ * @type string $slug Plugin Slug
118
+ * @type string $name Plugin Name
119
+ * @type int $version Plugin Verion
120
+ * }
121
+ * @return singleton
122
+ */
123
+ public static function getInstance( $settings ) {
124
+
125
+ if ( null === self::$_instance ) {
126
+
127
+ self::$_instance = new self( $settings );
128
+
129
+ }
130
+
131
+ return self::$_instance;
132
+
133
+ }
134
+
135
+
136
+ /**
137
+ * get plugin file
138
+ *
139
+ * @since 8
140
+ * @access public
141
+ */
142
+ public function get_plugin_file() {
143
+
144
+ return $this->plugin_file;
145
+
146
+ }
147
+
148
+
149
+ /**
150
+ * get plugin slug
151
+ *
152
+ * @since 8
153
+ * @access public
154
+ */
155
+ public function get_plugin_slug() {
156
+
157
+ return $this->plugin_slug;
158
+
159
+ }
160
+
161
+
162
+ /**
163
+ * get plugin name
164
+ *
165
+ * @since 8
166
+ * @access public
167
+ */
168
+ public function get_plugin_name() {
169
+
170
+ return $this->plugin_name;
171
+
172
+ }
173
+
174
+
175
+ /**
176
+ * get plugin version
177
+ *
178
+ * @since 8
179
+ * @access public
180
+ */
181
+ public function get_plugin_version() {
182
+
183
+ return $this->plugin_version;
184
+
185
+ }
186
+
187
+
188
/**
189
* get all settings
190
* except 404page_method
205
*/
206
private function load() {
207
208
add_action( 'init', array( $this, 'add_text_domain' ) );
209
add_action( 'init', array( $this, 'init' ) );
210
251
add_action( 'admin_init', array( $this, 'admin_init' ) );
252
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
253
add_action( 'admin_head', array( $this, 'admin_style' ) );
254
+ add_filter( 'plugin_action_links_' . plugin_basename( $this->get_plugin_file() ), array( $this, 'add_settings_links' ) );
255
add_action( 'admin_enqueue_scripts', array( $this, 'admin_js' ) );
256
add_action( 'admin_enqueue_scripts', array( $this, 'admin_css' ) );
257
384
* Compatibility Mode
385
*/
386
function show404_compatiblity_mode( $posts ) {
387
+
388
// remove the filter so we handle only the first query - no custom queries
389
remove_filter( 'the_posts', array( $this, 'show404_compatiblity_mode' ), 999 );
390
404
405
$pageid = $this->get_page_id();
406
if ( ! $this->settings->get_native() ) {
407
+
408
if ( empty( $posts ) && is_main_query() && !is_robots() && !is_home() && !is_feed() && !is_search() && !is_archive() && ( !defined('DOING_AJAX') || !DOING_AJAX ) ) {
409
410
// 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
420
global $wp_query;
421
$wp_query = null;
422
$wp_query = new WP_Query();
423
+
424
+ // @since 8
425
+ // added suppress_filters for compatibilty with current WPML version
426
+ $wp_query->query( array( 'page_id' => $pageid, 'suppress_filters' => true ) );
427
428
+ $wp_query->the_post();
429
$this->template = get_page_template();
430
$posts = $wp_query->posts;
431
+ $wp_query->rewind_posts();
432
433
add_action( 'wp', array( $this, 'do_404_header' ) );
434
add_filter( 'body_class', array( $this, 'add_404_body_class' ) );
618
*/
619
function show404articleselectors_customizr_mode( $selectors ) {
620
if ( ! $this->settings->get_native() ) {
621
+ return 'id="post-' . $this->get_page_id() . '" class="' . join( ' ', get_post_class( 'row-fluid', $this->get_page_id() ) ) . '"';
622
} else {
623
return $selectors;
624
}
703
register_setting( '404page_settings', '404page_force_error' );
704
register_setting( '404page_settings', '404page_no_url_guessing' );
705
register_setting( '404page_settings', '404page_http410_if_trashed' );
706
+ add_settings_field( '404page_settings_404page', __( 'Page to be displayed as 404 page', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="https://petersplugins.com/docs/' . $this->get_plugin_slug() . '/#settings_select_page"></a>' , array( $this, 'admin_404page' ), '404page_settings_section', '404page-settings', array( 'label_for' => '404page_page_id' ) );
707
add_settings_field( '404page_settings_hide', '' , array( $this, 'admin_hide' ), '404page_settings_section_advanced', '404page-settings', array( 'label_for' => '404page_hide' ) );
708
add_settings_field( '404page_settings_fire', '' , array( $this, 'admin_fire404' ), '404page_settings_section_advanced', '404page-settings', array( 'label_for' => '404page_fire_error' ) );
709
add_settings_field( '404page_settings_force', '' , array( $this, 'admin_force404' ), '404page_settings_section_advanced', '404page-settings', array( 'label_for' => '404page_force_error' ) );
779
function admin_hide() {
780
781
echo '<p><input type="checkbox" id="404page_hide" name="404page_hide" value="1"' . checked( true, $this->settings->get_hide(), false ) . '/>';
782
+ 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="https://petersplugins.com/docs/' . $this->get_plugin_slug() . '/#settings_hide_page"></a><br />';
783
echo '<span class="dashicons dashicons-info"></span>&nbsp;' . __( 'For Administrators the page is always visible.', '404page' ) . '</p><div class="clear"></div>';
784
785
}
791
function admin_fire404() {
792
793
echo '<p><input type="checkbox" id="404page_fire_error" name="404page_fire_error" value="1"' . checked( true, $this->settings->get_fire_error(), false ) . '/>';
794
+ 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="https://petersplugins.com/docs/' . $this->get_plugin_slug() . '/#settings_fire_404"></a><br />';
795
echo '<span class="dashicons dashicons-info"></span>&nbsp;' . __( 'Uncheck this if you want the selected page to be accessible.', '404page' );
796
797
if ( function_exists( 'wpsupercache_activate' ) ) {
798
799
+ 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="https://petersplugins.com/docs/' . $this->get_plugin_slug() . '/#wp_super_cache">' . __( 'Read more', '404page' ) . '</a>)';
800
801
}
802
811
function admin_force404() {
812
813
echo '<p><input type="checkbox" id="404page_force_error" name="404page_force_error" value="1"' . checked( true, $this->settings->get_force_error(), false ) . '/>';
814
+ 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="https://petersplugins.com/docs/' . $this->get_plugin_slug() . '/#settings_force_404"></a>&nbsp;<a class="dashicons dashicons-video-alt3" href="https://youtu.be/09OOCbFLfnI" data-lity></a><br />';
815
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>';
816
817
}
823
function admin_noguess() {
824
825
echo '<p><input type="checkbox" id="404page_no_url_guessing" name="404page_no_url_guessing" value="1"' . checked( true, $this->settings->get_no_url_guessing(), false ) . '/>';
826
+ echo '<label for="404page_no_url_guessing" class="check warning"></label>' . __( 'Disable URL autocorrection guessing', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="https://petersplugins.com/docs/' . $this->get_plugin_slug() . '/#settings_stop_guessing"></a>&nbsp;<a class="dashicons dashicons-video-alt3" href="https://youtu.be/H0EdtFcAGl4" data-lity></a><br />';
827
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>';
828
829
}
836
function admin_http410() {
837
838
echo '<p><input type="checkbox" id="404page_http410_if_trashed" name="404page_http410_if_trashed" value="1"' . checked( true, $this->settings->get_http410_if_trashed(), false ) . '/>';
839
+ echo '<label for="404page_http410_if_trashed" class="check"></label>' . __( 'Send an HTTP 410 error instead of HTTP 404 in case the requested object is in trash', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="https://petersplugins.com/docs/' . $this->get_plugin_slug() . '/#settings_maybe_send_http410"></a>&nbsp;<a class="dashicons dashicons-video-alt3" href="https://youtu.be/O5xPM0BMZxM" data-lity></a><br />';
840
echo '<span class="dashicons dashicons-info"></span>&nbsp;' . __( 'Check this if you want to inform search engines that the resource requested is no longer available and will not be available again so it can be removed from the search index immediately.', '404page' );
841
842
}
857
}
858
859
echo '<p><input type="checkbox" id="404page_method" name="404page_method" value="CMP"' . checked( 'CMP', $this->settings->get_method(), false ) . $dis . '/>';
860
+ echo '<label for="404page_method" class="check"></label>' . __( 'Activate Compatibility Mode', '404page' ) . '&nbsp;<a class="dashicons dashicons-editor-help" href="https://petersplugins.com/docs/' . $this->get_plugin_slug() . '/#settings_operating_method"></a>&nbsp;<a class="dashicons dashicons-video-alt3" href="https://youtu.be/wqSepDyQeqY" data-lity></a><br />';
861
echo '<span class="dashicons dashicons-info"></span>&nbsp;';
862
863
if ( $this->settings->get_native() ) {
864
865
_e( 'This setting is not available because the Theme you are using natively supports the 404page plugin.', '404page' );
866
+ echo ' (<a href="https://petersplugins.com/docs/' . $this->get_plugin_slug() . '/#native_mode">' . __( 'Read more', '404page' ) . '</a>)';
867
868
} elseif ( defined( 'CUSTOMIZR_VER' ) ) {
869
870
_e( 'This setting is not availbe because the 404page Plugin works in Customizr Compatibility Mode.', '404page' );
871
+ echo ' (<a href="https://petersplugins.com/docs/' . $this->get_plugin_slug() . '/#special_modes">' . __( 'Read more', '404page' ) . '</a>)';
872
873
} elseif ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
874
875
_e( 'This setting is not availbe because the 404page Plugin works in WPML Mode.', '404page' );
876
+ echo ' (<a href="https://petersplugins.com/docs/' . $this->get_plugin_slug() . '/#special_modes">' . __( 'Read more', '404page' ) . '</a>)';
877
878
} else {
879
1167
* create the menu entry
1168
*/
1169
function admin_menu() {
1170
+ $this->admin_handle = add_theme_page ( __( '404 Error Page', "404page" ), __( '404 Error Page', '404page' ), 'manage_options', '404pagesettings', array( $this, 'show_admin' ) );
1171
}
1172
1173
1178
1179
if ( get_current_screen()->id == $this->admin_handle ) {
1180
1181
+ wp_enqueue_style( '404pagelity', $this->get_asset_file( 'css', 'lity.min.css' ) );
1182
wp_enqueue_style( 'pp-admin-page', $this->get_asset_file( 'css', 'pp-admin-page.css' ) );
1183
wp_enqueue_style( '404pagecss', $this->get_asset_file( 'css', '404page-ui.css' ) );
1184
1192
*/
1193
function admin_js() {
1194
1195
+ wp_enqueue_script( '404pagejs', $this->get_asset_file( 'js', '404page.js' ), 'jquery', $this->get_plugin_version(), true );
1196
1197
if ( get_current_screen()->id == $this->admin_handle ) {
1198
1199
+ wp_enqueue_script( '404page-ui', $this->get_asset_file( 'js', '404page-ui.js' ), 'jquery', $this->get_plugin_version(), true );
1200
+ wp_enqueue_script( '404page-lity', $this->get_asset_file( 'js', 'lity.min.js' ), 'jquery', $this->get_plugin_version(), true );
1201
1202
}
1203
1207
/**
1208
* show admin page
1209
*/
1210
+ function show_admin() {
1211
1212
if ( !current_user_can( 'manage_options' ) ) {
1213
1214
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
1215
1216
}
1217
+
1218
+ require_once( plugin_dir_path( $this->get_plugin_file() ) . '/inc/admin/404page-admin-page.php' );
1219
+
1220
}
1221
1222
1240
*/
1241
function admin_notices() {
1242
1243
+ // @since 8
1244
+ // show update notice
1245
+ if ( current_user_can( 'manage_options' ) && get_user_meta( get_current_user_id(), 'pp-404page-update-notice-v8', true ) != 'dismissed' ) {
1246
+ ?>
1247
+ <div class="notice is-dismissible pp-404page-admin-notice" id="pp-404page-update-notice-v8">
1248
+ <p><img src="<?php echo $this->get_asset_file( 'img', '/pluginicon.png' ); ?>" style="width: 48px; height: 48px; float: left; margin-right: 20px" /><strong><?php _e( '404page Version 8 Update Notice', '404page' ); ?></strong><br /><?php _e( 'Whats new? A compatibility issue with the current version of WPML has been fixed. This change may also fix or prevent compatibility issues with further plugins.', '404page' ); ?><div class="clear"></div></p>
1249
+ </div>
1250
+ <?php
1251
+ }
1252
+
1253
// invite to follow me
1254
if ( current_user_can( 'manage_options' ) && get_user_meta( get_current_user_id(), 'pp-404page-admin-notice-1', true ) != 'dismissed' ) {
1255
?>
1517
*/
1518
private function get_asset_file( $dir, $file ) {
1519
1520
+ return plugins_url( 'assets/' . $dir . '/' . $file, $this->get_plugin_file() );
1521
1522
}
1523
1534
array( 'id' => 'HygoFMwdIuY', 'title' => 'A brief introduction', 'img' => '404page-brief-intro' ),
1535
array( 'id' => '9rL9LbYiSJk', 'title' => 'A quick Overview over the Advanced Settings', 'img' => '404page-advanced-settings-quick-overview' ),
1536
array( 'id' => '09OOCbFLfnI', 'title' => 'The Advanced Setting "Force 404 error after loading page" explained', 'img' => '404page_advanced_force_404' ),
1537
+ array( 'id' => 'H0EdtFcAGl4', 'title' => 'The Advanced Setting "Disable URL Autocorrecton Guessing" explained', 'img' => '404page_advanced_url_guessing' ),
1538
+ array( 'id' => 'O5xPM0BMZxM', 'title' => 'Send HTTP Status Code 410 for trashed objects', 'img' => '404page_advanced_410_trashed_objects' ),
1539
+ array( 'id' => 'wqSepDyQeqY', 'title' => 'Compatibility Mode explained', 'img' => '404page_advanced_compatibility_mode' )
1540
);
1541
1542
foreach( $videos as $video ) {
1543
1544
+ echo '<a href="https://youtu.be/' . $video['id'] . '" title="' . $video['title'] . '" data-lity><div><img src="' . $this->get_asset_file( 'img/videos', $video['img'] . '.png' ) . '" title="' . $video['title'] . '" alt="' . $video['title'] . '"></div></a>';
1545
1546
}
1547
loader.php CHANGED
@@ -19,15 +19,27 @@ if ( ! defined( 'WPINC' ) ) {
19
require_once( plugin_dir_path( __FILE__ ) . '/inc/class-404page.php' );
20
require_once( plugin_dir_path( __FILE__ ) . '/inc/class-404page-settings.php' );
21
22
/**
23
- * Run plugin
24
*/
25
- $pp_404page = new PP_404Page( array(
26
- 'file' => dirname( __FILE__ ) . '/404page.php',
27
- 'slug' => pathinfo( dirname( __FILE__ ) . '/404page.php', PATHINFO_FILENAME ),
28
- 'name' => '404page - your smart custom 404 error page',
29
- 'version' => '7'
30
- )
31
- );
32
33
?>
19
require_once( plugin_dir_path( __FILE__ ) . '/inc/class-404page.php' );
20
require_once( plugin_dir_path( __FILE__ ) . '/inc/class-404page-settings.php' );
21
22
+
23
/**
24
+ * Main Function
25
*/
26
+ function pp_404page() {
27
+
28
+ return PP_404Page::getInstance( array(
29
+ 'file' => dirname( __FILE__ ) . '/404page.php',
30
+ 'slug' => pathinfo( dirname( __FILE__ ) . '/404page.php', PATHINFO_FILENAME ),
31
+ 'name' => '404page - your smart custom 404 error page',
32
+ 'version' => '8 BETA'
33
+ ) );
34
+
35
+ }
36
+
37
+
38
+
39
+ /**
40
+ * Run the plugin
41
+ */
42
+ pp_404page();
43
+
44
45
?>
readme.txt CHANGED
@@ -2,20 +2,22 @@
2
Contributors: petersplugins
3
Donate link: https://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: 5.0
7
- Stable tag: 7
8
Requires PHP: 5.4
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
12
- Custom 404 the easy way! Set any page as custom 404 error page. No coding needed. Works with (almost) every Theme.
13
14
== Description ==
15
16
<strong>With 80,000+ active installations the [404page](https://petersplugins.com/free-wordpress-plugins/404page/) plugin is the most used plugin to create a customized 404 error page in WordPress.</strong>
17
18
- It allows you to easily create your own 404 error page without any effort and it works with almost every theme.
19
20
<strong>If you like this plugin</strong> please do me favor and leave a review here on wordpress.org so that other people know it is helpful for you. Thanks!
21
@@ -45,9 +47,13 @@ The only requirement for this plugin is that you change the Permalink Structure
45
46
[A quick Overview over the Advanced Settings](https://youtu.be/9rL9LbYiSJk=)
47
48
- [The Advanced Setting "Force 404 error after loading page" explained](https://youtu.be/09OOCbFLfnI)
49
50
- [The Advanced Setting "Disable URL Autocorrecton Guessing" explained](https://youtu.be/H0EdtFcAGl4)
51
52
== Plugin Privacy Information ==
53
@@ -83,8 +89,6 @@ The only requirement for this plugin is that you change the Permalink Structure
83
* [Virtue](https://wordpress.org/themes/virtue/)
84
* [Zerif Lite](http://themeisle.com/themes/zerif-lite/)
85
86
- **Note**: The [Enfold](https://themeforest.net/item/enfold-responsive-multipurpose-theme/4519990?ref=petersplugins) Theme is no longer supported because the Theme now has its own custom 404 error page feature.
87
-
88
= The 404page plugin was sucessfully tested by the author with the following starter themes =
89
* [Bones](http://themble.com/bones/)
90
* [JointsWP](http://jointswp.com/)
@@ -119,7 +123,6 @@ If you are a theme developer you can add native support for the 404page plugin t
119
120
== Stay up to date ==
121
122
- [Follow me on Google+](https://plus.google.com/+petersplugins)
123
[Follow me on Facebook](https://www.facebook.com/petersplugins/)
124
[YouTube Channel](https://www.youtube.com/channel/UCDnOjy99A7Oeq2dTWxqWEIA)
125
@@ -149,6 +152,11 @@ Please use the [Support Forum](https://wordpress.org/support/plugin/404page).
149
150
== Changelog ==
151
152
= 7 (2018-07-16) =
153
* corrected wrong image path
154
* added video links to admin page
@@ -253,6 +261,9 @@ Please use the [Support Forum](https://wordpress.org/support/plugin/404page).
253
254
== Upgrade Notice ==
255
256
= 7 =
257
corrected wrong image path, added video links
258
2
Contributors: petersplugins
3
Donate link: https://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: 4.0
6
Tested up to: 5.0
7
+ Stable tag: 8
8
Requires PHP: 5.4
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
12
+ Create your custom 404 error page the easy way! No coding. Works with most Themes.
13
14
== Description ==
15
16
<strong>With 80,000+ active installations the [404page](https://petersplugins.com/free-wordpress-plugins/404page/) plugin is the most used plugin to create a customized 404 error page in WordPress.</strong>
17
18
+ Bringing visitors to your website takes time and effort. Every visitor is important. The default 404 error page of most themes do not provide any information on what to find on your site. A first tme visitor, who does not know you, is left in a dead end and leaves your website. Set up a helpful custom 404 error page to keep him on your site.
19
+
20
+ This handy plugin allows you to easily create your own 404 error page without any effort and it works with almost every theme.
21
22
<strong>If you like this plugin</strong> please do me favor and leave a review here on wordpress.org so that other people know it is helpful for you. Thanks!
23
47
48
[A quick Overview over the Advanced Settings](https://youtu.be/9rL9LbYiSJk=)
49
50
+ ["Force 404 error after loading page" explained](https://youtu.be/09OOCbFLfnI)
51
+
52
+ ["Disable URL Autocorrecton Guessing" explained](https://youtu.be/H0EdtFcAGl4)
53
54
+ ["Send HTTP Status Code 410 for trashed objects" explained](https://youtu.be/O5xPM0BMZxM)
55
+
56
+ ["Compatibility Mode" explained](https://youtu.be/wqSepDyQeqY)
57
58
== Plugin Privacy Information ==
59
89
* [Virtue](https://wordpress.org/themes/virtue/)
90
* [Zerif Lite](http://themeisle.com/themes/zerif-lite/)
91
92
= The 404page plugin was sucessfully tested by the author with the following starter themes =
93
* [Bones](http://themble.com/bones/)
94
* [JointsWP](http://jointswp.com/)
123
124
== Stay up to date ==
125
126
[Follow me on Facebook](https://www.facebook.com/petersplugins/)
127
[YouTube Channel](https://www.youtube.com/channel/UCDnOjy99A7Oeq2dTWxqWEIA)
128
152
153
== Changelog ==
154
155
+ = 8 (2019-01-11) =
156
+ * fixed compatibility issue with latest WPML version
157
+ * code improvement
158
+ * UI improvements
159
+
160
= 7 (2018-07-16) =
161
* corrected wrong image path
162
* added video links to admin page
261
262
== Upgrade Notice ==
263
264
+ = 8 =
265
+ fixed compatibility issue with latest WPML version
266
+
267
= 7 =
268
corrected wrong image path, added video links
269
uninstall.php CHANGED
@@ -26,6 +26,6 @@ require_once( plugin_dir_path( __FILE__ ) . '/loader.php' );
26
/**
27
* Run Uninstaller
28
*/
29
- $pp_404page->uninstall();
30
31
?>
26
/**
27
* Run Uninstaller
28
*/
29
+ pp_404page()->uninstall();
30
31
?>