Version Description
notification compatibility
Download this release
Release Info
Developer | petersplugins |
Plugin | 404page – your smart custom 404 error page |
Version | 11.2.2 |
Comparing to | |
See all releases |
Code changes from version 11.1.4 to 11.2.2
- 404page.php +1 -1
- inc/class-404page-admin.php +51 -4
- inc/class-404page-block-editor.php +1 -1
- inc/class-404page-classic-editor.php +1 -1
- inc/class-404page-deprecated.php +1 -1
- inc/class-404page-settings.php +1 -1
- inc/class-404page.php +61 -1
- inc/ppf/loader.php +4 -2
- inc/ppf/ppf-admin.php +155 -42
- inc/ppf/ppf-class.php +4 -4
- inc/ppf/ppf-plugin-addon.php +229 -0
- inc/ppf/ppf-plugin.php +39 -31
- inc/ppf/ppf-settings.php +23 -11
- inc/ppf/ppf-subclass.php +10 -8
- loader.php +1 -1
- readme.txt +22 -3
404page.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* Plugin Name: 404page - your smart custom 404 error page
|
10 |
* Plugin URI: https://petersplugins.com/404page/
|
11 |
* Description: Custom 404 the easy way! Set any page as custom 404 error page. No coding needed. Works with (almost) every Theme.
|
12 |
-
* Version: 11.
|
13 |
* Author: Peter Raschendorfer
|
14 |
* Author URI: https://petersplugins.com
|
15 |
* Text Domain: 404page
|
9 |
* Plugin Name: 404page - your smart custom 404 error page
|
10 |
* Plugin URI: https://petersplugins.com/404page/
|
11 |
* Description: Custom 404 the easy way! Set any page as custom 404 error page. No coding needed. Works with (almost) every Theme.
|
12 |
+
* Version: 11.2.2
|
13 |
* Author: Peter Raschendorfer
|
14 |
* Author URI: https://petersplugins.com
|
15 |
* Text Domain: 404page
|
inc/class-404page-admin.php
CHANGED
@@ -15,7 +15,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
15 |
*/
|
16 |
if ( !class_exists( 'PP_404Page_Admin' ) ) {
|
17 |
|
18 |
-
class PP_404Page_Admin extends
|
19 |
|
20 |
|
21 |
/**
|
@@ -76,6 +76,7 @@ if ( !class_exists( 'PP_404Page_Admin' ) ) {
|
|
76 |
array(
|
77 |
|
78 |
'section' => 'general',
|
|
|
79 |
'title' => esc_html__( 'General', '404page' ),
|
80 |
'fields' => array(
|
81 |
array(
|
@@ -89,6 +90,7 @@ if ( !class_exists( 'PP_404Page_Admin' ) ) {
|
|
89 |
array(
|
90 |
|
91 |
'section' => 'advanced',
|
|
|
92 |
'title' => esc_html__( 'Advanced', '404page' ),
|
93 |
'fields' => array(
|
94 |
array(
|
@@ -123,6 +125,7 @@ if ( !class_exists( 'PP_404Page_Admin' ) ) {
|
|
123 |
array(
|
124 |
|
125 |
'section' => 'videos',
|
|
|
126 |
'title' => esc_html__( 'Explainer Videos', '404page' ),
|
127 |
'html' => $this->add_videos(),
|
128 |
'nosubmit' => true
|
@@ -133,6 +136,8 @@ if ( !class_exists( 'PP_404Page_Admin' ) ) {
|
|
133 |
|
134 |
);
|
135 |
|
|
|
|
|
136 |
}
|
137 |
|
138 |
|
@@ -194,7 +199,7 @@ if ( !class_exists( 'PP_404Page_Admin' ) ) {
|
|
194 |
|
195 |
}
|
196 |
|
197 |
-
echo '</p
|
198 |
|
199 |
}
|
200 |
|
@@ -214,7 +219,45 @@ if ( !class_exists( 'PP_404Page_Admin' ) ) {
|
|
214 |
|
215 |
}
|
216 |
|
217 |
-
echo '</p
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
|
219 |
}
|
220 |
|
@@ -249,7 +292,7 @@ if ( !class_exists( 'PP_404Page_Admin' ) ) {
|
|
249 |
esc_html__( 'Send an 404 error if the page is accessed directly by its URL', '404page' ),
|
250 |
'settings_fire_404',
|
251 |
false,
|
252 |
-
'<span class="dashicons dashicons-info"></span> ' . esc_html__( 'Uncheck this if you want the selected page to be accessible.', '404page' )
|
253 |
);
|
254 |
|
255 |
}
|
@@ -398,6 +441,8 @@ if ( !class_exists( 'PP_404Page_Admin' ) ) {
|
|
398 |
wp_enqueue_style( '404pagelity', $this->core()->get_asset_url( 'css', 'lity.min.css' ) );
|
399 |
wp_enqueue_style( '404pagecss', $this->core()->get_asset_url( 'css', '404page-ui.css' ) );
|
400 |
|
|
|
|
|
401 |
}
|
402 |
|
403 |
}
|
@@ -413,6 +458,8 @@ if ( !class_exists( 'PP_404Page_Admin' ) ) {
|
|
413 |
|
414 |
wp_enqueue_script( '404page-ui', $this->core()->get_asset_url( 'js', '404page-ui.js' ), 'jquery', $this->core()->get_plugin_version(), true );
|
415 |
wp_enqueue_script( '404page-lity', $this->core()->get_asset_url( 'js', 'lity.min.js' ), 'jquery', $this->core()->get_plugin_version(), true );
|
|
|
|
|
416 |
|
417 |
}
|
418 |
|
15 |
*/
|
16 |
if ( !class_exists( 'PP_404Page_Admin' ) ) {
|
17 |
|
18 |
+
class PP_404Page_Admin extends PPF04_Admin {
|
19 |
|
20 |
|
21 |
/**
|
76 |
array(
|
77 |
|
78 |
'section' => 'general',
|
79 |
+
'order' => 10,
|
80 |
'title' => esc_html__( 'General', '404page' ),
|
81 |
'fields' => array(
|
82 |
array(
|
90 |
array(
|
91 |
|
92 |
'section' => 'advanced',
|
93 |
+
'order' => 20,
|
94 |
'title' => esc_html__( 'Advanced', '404page' ),
|
95 |
'fields' => array(
|
96 |
array(
|
125 |
array(
|
126 |
|
127 |
'section' => 'videos',
|
128 |
+
'order' => 100,
|
129 |
'title' => esc_html__( 'Explainer Videos', '404page' ),
|
130 |
'html' => $this->add_videos(),
|
131 |
'nosubmit' => true
|
136 |
|
137 |
);
|
138 |
|
139 |
+
do_action( '404page_addtional_setting_sections' );
|
140 |
+
|
141 |
}
|
142 |
|
143 |
|
199 |
|
200 |
}
|
201 |
|
202 |
+
echo '</p><br />';
|
203 |
|
204 |
}
|
205 |
|
219 |
|
220 |
}
|
221 |
|
222 |
+
echo '</p><br />';
|
223 |
+
|
224 |
+
}
|
225 |
+
|
226 |
+
|
227 |
+
// WP Super Cache
|
228 |
+
// since 11.2.0
|
229 |
+
if ( defined('WPCACHEHOME') ) {
|
230 |
+
|
231 |
+
global $cache_enabled;
|
232 |
+
|
233 |
+
// is caching active?
|
234 |
+
if ( $cache_enabled ) {
|
235 |
+
|
236 |
+
echo '<p class="pp-404page-info">';
|
237 |
+
echo esc_html__( 'WP Super Cache detected. All 404 errors are automatically excluded from caching.', '404page' );
|
238 |
+
echo '</p><br />';
|
239 |
+
|
240 |
+
}
|
241 |
+
|
242 |
+
}
|
243 |
+
|
244 |
+
|
245 |
+
// W3 Total Cache
|
246 |
+
// since 11.2.1
|
247 |
+
if ( defined( 'W3TC' ) ) {
|
248 |
+
|
249 |
+
if ( class_exists( 'W3TC\Dispatcher' ) ) {
|
250 |
+
|
251 |
+
// is caching active?
|
252 |
+
if ( W3TC\Dispatcher::config()->get_boolean( 'pgcache.enabled' ) ) {
|
253 |
+
|
254 |
+
echo '<p class="pp-404page-info">';
|
255 |
+
echo esc_html__( 'W3 Total Cache detected. All 404 errors are automatically excluded from caching.', '404page' );
|
256 |
+
echo '</p><br />';
|
257 |
+
|
258 |
+
}
|
259 |
+
|
260 |
+
}
|
261 |
|
262 |
}
|
263 |
|
292 |
esc_html__( 'Send an 404 error if the page is accessed directly by its URL', '404page' ),
|
293 |
'settings_fire_404',
|
294 |
false,
|
295 |
+
'<span class="dashicons dashicons-info"></span> ' . esc_html__( 'Uncheck this if you want the selected page to be accessible.', '404page' )
|
296 |
);
|
297 |
|
298 |
}
|
441 |
wp_enqueue_style( '404pagelity', $this->core()->get_asset_url( 'css', 'lity.min.css' ) );
|
442 |
wp_enqueue_style( '404pagecss', $this->core()->get_asset_url( 'css', '404page-ui.css' ) );
|
443 |
|
444 |
+
do_action( '404page_enqueue_css' );
|
445 |
+
|
446 |
}
|
447 |
|
448 |
}
|
458 |
|
459 |
wp_enqueue_script( '404page-ui', $this->core()->get_asset_url( 'js', '404page-ui.js' ), 'jquery', $this->core()->get_plugin_version(), true );
|
460 |
wp_enqueue_script( '404page-lity', $this->core()->get_asset_url( 'js', 'lity.min.js' ), 'jquery', $this->core()->get_plugin_version(), true );
|
461 |
+
|
462 |
+
do_action( '404page_enqueue_js' );
|
463 |
|
464 |
}
|
465 |
|
inc/class-404page-block-editor.php
CHANGED
@@ -15,7 +15,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
15 |
*/
|
16 |
if ( !class_exists( 'PP_404Page_BlockEditor' ) ) {
|
17 |
|
18 |
-
class PP_404Page_BlockEditor extends
|
19 |
|
20 |
/**
|
21 |
* Do Init
|
15 |
*/
|
16 |
if ( !class_exists( 'PP_404Page_BlockEditor' ) ) {
|
17 |
|
18 |
+
class PP_404Page_BlockEditor extends PPF04_SubClass {
|
19 |
|
20 |
/**
|
21 |
* Do Init
|
inc/class-404page-classic-editor.php
CHANGED
@@ -15,7 +15,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
15 |
*/
|
16 |
if ( !class_exists( 'PP_404Page_ClassicEditor' ) ) {
|
17 |
|
18 |
-
class PP_404Page_ClassicEditor extends
|
19 |
|
20 |
/**
|
21 |
* Do Init
|
15 |
*/
|
16 |
if ( !class_exists( 'PP_404Page_ClassicEditor' ) ) {
|
17 |
|
18 |
+
class PP_404Page_ClassicEditor extends PPF04_SubClass {
|
19 |
|
20 |
/**
|
21 |
* Do Init
|
inc/class-404page-deprecated.php
CHANGED
@@ -17,7 +17,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
17 |
*/
|
18 |
if ( !class_exists( 'PP_404Page_Deprecated' ) ) {
|
19 |
|
20 |
-
class PP_404Page_Deprecated extends
|
21 |
|
22 |
/**
|
23 |
* Do Init
|
17 |
*/
|
18 |
if ( !class_exists( 'PP_404Page_Deprecated' ) ) {
|
19 |
|
20 |
+
class PP_404Page_Deprecated extends PPF04_SubClass {
|
21 |
|
22 |
/**
|
23 |
* Do Init
|
inc/class-404page-settings.php
CHANGED
@@ -17,7 +17,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
17 |
*/
|
18 |
if ( !class_exists( 'PP_404Page_Settings' ) ) {
|
19 |
|
20 |
-
class PP_404Page_Settings extends
|
21 |
|
22 |
/**
|
23 |
* sanitize settings
|
17 |
*/
|
18 |
if ( !class_exists( 'PP_404Page_Settings' ) ) {
|
19 |
|
20 |
+
class PP_404Page_Settings extends PPF04_Settings {
|
21 |
|
22 |
/**
|
23 |
* sanitize settings
|
inc/class-404page.php
CHANGED
@@ -23,7 +23,7 @@ if ( ! defined( 'PP_404' ) ) {
|
|
23 |
if ( !class_exists( 'PP_404Page' ) ) {
|
24 |
|
25 |
|
26 |
-
class PP_404Page extends
|
27 |
|
28 |
|
29 |
/**
|
@@ -287,6 +287,8 @@ if ( !class_exists( 'PP_404Page' ) ) {
|
|
287 |
|
288 |
if ( ! $this->is_native() ) {
|
289 |
|
|
|
|
|
290 |
$wp_query = null;
|
291 |
$wp_query = new WP_Query();
|
292 |
$wp_query->query( 'page_id=' . $this->get_page_id() );
|
@@ -349,6 +351,8 @@ if ( !class_exists( 'PP_404Page' ) ) {
|
|
349 |
|
350 |
remove_action( 'pre_get_posts', array ( $this, 'exclude_404page' ) );
|
351 |
remove_filter( 'get_pages', array ( $this, 'remove_404page_from_array' ), 10, 2 );
|
|
|
|
|
352 |
|
353 |
$wp_query = null;
|
354 |
$wp_query = new WP_Query();
|
@@ -356,6 +360,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
|
|
356 |
// @since 8
|
357 |
// added suppress_filters for compatibilty with current WPML version
|
358 |
$wp_query->query( array( 'page_id' => $pageid, 'suppress_filters' => true ) );
|
|
|
359 |
|
360 |
$wp_query->the_post();
|
361 |
$this->template = get_page_template();
|
@@ -366,6 +371,8 @@ if ( !class_exists( 'PP_404Page' ) ) {
|
|
366 |
add_filter( 'body_class', array( $this, 'add_404_body_class' ) );
|
367 |
add_filter( 'template_include', array( $this, 'change_404_template' ), 999 );
|
368 |
|
|
|
|
|
369 |
$this->maybe_force_404();
|
370 |
$this->do_404page_action();
|
371 |
|
@@ -406,6 +413,46 @@ if ( !class_exists( 'PP_404Page' ) ) {
|
|
406 |
return $posts;
|
407 |
}
|
408 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
|
410 |
/**
|
411 |
* for DW Question & Answer plugin
|
@@ -1111,6 +1158,19 @@ if ( !class_exists( 'PP_404Page' ) ) {
|
|
1111 |
}
|
1112 |
|
1113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1114 |
}
|
1115 |
|
1116 |
}
|
23 |
if ( !class_exists( 'PP_404Page' ) ) {
|
24 |
|
25 |
|
26 |
+
class PP_404Page extends PPF04_Plugin {
|
27 |
|
28 |
|
29 |
/**
|
287 |
|
288 |
if ( ! $this->is_native() ) {
|
289 |
|
290 |
+
$this->disable_caching();
|
291 |
+
|
292 |
$wp_query = null;
|
293 |
$wp_query = new WP_Query();
|
294 |
$wp_query->query( 'page_id=' . $this->get_page_id() );
|
351 |
|
352 |
remove_action( 'pre_get_posts', array ( $this, 'exclude_404page' ) );
|
353 |
remove_filter( 'get_pages', array ( $this, 'remove_404page_from_array' ), 10, 2 );
|
354 |
+
|
355 |
+
$this->disable_caching();
|
356 |
|
357 |
$wp_query = null;
|
358 |
$wp_query = new WP_Query();
|
360 |
// @since 8
|
361 |
// added suppress_filters for compatibilty with current WPML version
|
362 |
$wp_query->query( array( 'page_id' => $pageid, 'suppress_filters' => true ) );
|
363 |
+
|
364 |
|
365 |
$wp_query->the_post();
|
366 |
$this->template = get_page_template();
|
371 |
add_filter( 'body_class', array( $this, 'add_404_body_class' ) );
|
372 |
add_filter( 'template_include', array( $this, 'change_404_template' ), 999 );
|
373 |
|
374 |
+
|
375 |
+
|
376 |
$this->maybe_force_404();
|
377 |
$this->do_404page_action();
|
378 |
|
413 |
return $posts;
|
414 |
}
|
415 |
|
416 |
+
/**
|
417 |
+
* disable caching for known caching plugins
|
418 |
+
*
|
419 |
+
* @since 11.2.0
|
420 |
+
*/
|
421 |
+
function disable_caching() {
|
422 |
+
|
423 |
+
// WP Super Cache
|
424 |
+
if ( defined( 'WPCACHEHOME' ) ) {
|
425 |
+
|
426 |
+
global $cache_enabled;
|
427 |
+
|
428 |
+
// is caching active?
|
429 |
+
if ( $cache_enabled ) {
|
430 |
+
|
431 |
+
define( 'DONOTCACHEPAGE', true );
|
432 |
+
|
433 |
+
}
|
434 |
+
|
435 |
+
}
|
436 |
+
|
437 |
+
|
438 |
+
// W3 Total Cache
|
439 |
+
if ( defined( 'W3TC' ) ) {
|
440 |
+
|
441 |
+
if ( class_exists( 'W3TC\Dispatcher' ) ) {
|
442 |
+
|
443 |
+
// is caching active?
|
444 |
+
if ( W3TC\Dispatcher::config()->get_boolean( 'pgcache.enabled' ) ) {
|
445 |
+
|
446 |
+
define( 'DONOTCACHEPAGE', true );
|
447 |
+
|
448 |
+
}
|
449 |
+
|
450 |
+
}
|
451 |
+
|
452 |
+
}
|
453 |
+
|
454 |
+
}
|
455 |
+
|
456 |
|
457 |
/**
|
458 |
* for DW Question & Answer plugin
|
1158 |
}
|
1159 |
|
1160 |
|
1161 |
+
/**
|
1162 |
+
* get settings class
|
1163 |
+
*
|
1164 |
+
* @since 11.3.0
|
1165 |
+
* @access public
|
1166 |
+
* @return object
|
1167 |
+
*/
|
1168 |
+
public function admin() {
|
1169 |
+
|
1170 |
+
return $this->admin;
|
1171 |
+
}
|
1172 |
+
|
1173 |
+
|
1174 |
}
|
1175 |
|
1176 |
}
|
inc/ppf/loader.php
CHANGED
@@ -3,9 +3,9 @@
|
|
3 |
/**
|
4 |
* Plugin Foundation Loader
|
5 |
*
|
6 |
-
* Peter's Plugins Foundation
|
7 |
*
|
8 |
-
* @package
|
9 |
* @author Peter Raschendorfer
|
10 |
* @license GPL2+
|
11 |
*/
|
@@ -16,4 +16,6 @@ require_once ( __DIR__ . '/ppf-plugin.php' );
|
|
16 |
require_once ( __DIR__ . '/ppf-settings.php' );
|
17 |
require_once ( __DIR__ . '/ppf-admin.php' );
|
18 |
|
|
|
|
|
19 |
?>
|
3 |
/**
|
4 |
* Plugin Foundation Loader
|
5 |
*
|
6 |
+
* Peter's Plugins Foundation 04
|
7 |
*
|
8 |
+
* @package PPF04
|
9 |
* @author Peter Raschendorfer
|
10 |
* @license GPL2+
|
11 |
*/
|
16 |
require_once ( __DIR__ . '/ppf-settings.php' );
|
17 |
require_once ( __DIR__ . '/ppf-admin.php' );
|
18 |
|
19 |
+
require_once ( __DIR__ . '/ppf-plugin-addon.php' );
|
20 |
+
|
21 |
?>
|
inc/ppf/ppf-admin.php
CHANGED
@@ -3,27 +3,39 @@
|
|
3 |
/**
|
4 |
* Admin Class
|
5 |
*
|
6 |
-
* Peter's Plugins Foundation
|
7 |
*
|
8 |
-
* @package
|
9 |
* @author Peter Raschendorfer
|
10 |
* @license GPL2+
|
11 |
*/
|
12 |
|
13 |
-
if ( !class_exists( '
|
14 |
|
15 |
|
16 |
-
abstract class
|
17 |
|
18 |
|
19 |
/**
|
20 |
* settings sections
|
21 |
*
|
22 |
* @since PPF01
|
23 |
-
* @var
|
24 |
* @access private
|
|
|
|
|
25 |
*/
|
26 |
-
private $_sections;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
|
29 |
/**
|
@@ -46,7 +58,7 @@ if ( !class_exists( 'PPF03_Admin' ) ) {
|
|
46 |
* @access private
|
47 |
*/
|
48 |
private $_my_screen_id;
|
49 |
-
|
50 |
|
51 |
/**
|
52 |
* add multiple setting sections
|
@@ -55,26 +67,72 @@ if ( !class_exists( 'PPF03_Admin' ) ) {
|
|
55 |
* @param array $sections array of setting sections to add
|
56 |
* @access public
|
57 |
* @see add_settings()
|
|
|
|
|
58 |
*/
|
59 |
public function add_setting_sections( $sections ) {
|
60 |
|
61 |
-
$this->_sections = $sections;
|
62 |
-
|
63 |
foreach( $sections as $section ) {
|
64 |
|
65 |
-
|
|
|
|
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
|
|
|
|
71 |
}
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
79 |
|
80 |
|
@@ -87,11 +145,14 @@ if ( !class_exists( 'PPF03_Admin' ) ) {
|
|
87 |
* @since PPF01
|
88 |
* @param array $settings array of settings to add
|
89 |
* string $section => ID of the section
|
|
|
|
|
90 |
* string $title => title for section (used by print_setting_sections())
|
91 |
* string $html => HTML code to add to this section
|
92 |
* array $fields => multidimensional array of fields to add
|
93 |
* string $key => key of the option array
|
94 |
* string $callback => function to call
|
|
|
95 |
* bool $nosubmit => this section should not show the submit button
|
96 |
* @access private
|
97 |
*/
|
@@ -105,7 +166,18 @@ if ( !class_exists( 'PPF03_Admin' ) ) {
|
|
105 |
|
106 |
$field_id = $this->core()->get_plugin_slug() . '-' . $field['key'];
|
107 |
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
}
|
111 |
|
@@ -375,6 +447,33 @@ if ( !class_exists( 'PPF03_Admin' ) ) {
|
|
375 |
|
376 |
}
|
377 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
if ( get_current_screen()->parent_base != 'options-general' ) {
|
379 |
|
380 |
// On Option Screens settings_errors() is called automatically
|
@@ -513,36 +612,52 @@ if ( !class_exists( 'PPF03_Admin' ) ) {
|
|
513 |
</div>
|
514 |
</div>
|
515 |
<p class="wp-clearfix"><a id="<?php echo $prefix; ?>-review-later" class="<?php echo $prefix; ?>-review-action" href="javascript:void(0);"><?php echo $content['button_later']; ?></a> <a id="<?php echo $prefix; ?>-review-close" class="<?php echo $prefix; ?>-review-action" href="javascript:void(0);"><?php echo $content['button_close']; ?></a></p>
|
516 |
-
|
517 |
-
|
518 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
519 |
display: none;
|
520 |
}
|
521 |
-
|
522 |
display: block;
|
523 |
height: 20px;
|
524 |
line-height: 20px;
|
525 |
text-decoration: none;
|
526 |
}
|
527 |
-
|
528 |
float: left;
|
529 |
position: relative;
|
530 |
padding-left: 22px;
|
531 |
}
|
532 |
-
|
533 |
margin-right: 12px;
|
534 |
}
|
535 |
-
|
536 |
font-family: dashicons;
|
537 |
font-size: 20px;
|
538 |
position: absolute;
|
539 |
left: 0;
|
540 |
top: 0;
|
541 |
}
|
542 |
-
|
543 |
content: "\f508";
|
544 |
}
|
545 |
-
|
546 |
content: "\f153";
|
547 |
}
|
548 |
</style>
|
@@ -550,36 +665,34 @@ if ( !class_exists( 'PPF03_Admin' ) ) {
|
|
550 |
<script type="text/javascript">
|
551 |
jQuery( function( $ ) {
|
552 |
|
553 |
-
$( "
|
554 |
-
$( "
|
555 |
-
$( "
|
556 |
});
|
557 |
} );
|
558 |
|
559 |
-
$( "
|
560 |
-
$( "
|
561 |
-
$( "
|
562 |
});
|
563 |
} );
|
564 |
|
565 |
-
$( "
|
566 |
|
567 |
$.post(
|
568 |
ajaxurl, {
|
569 |
-
action : "
|
570 |
command : $(this).attr( "id" ),
|
571 |
-
securekey : "
|
572 |
}
|
573 |
);
|
574 |
-
$( "
|
575 |
|
576 |
} );
|
577 |
|
578 |
} );
|
579 |
-
</script>
|
580 |
-
|
581 |
-
</div>
|
582 |
-
<?php
|
583 |
|
584 |
} );
|
585 |
|
3 |
/**
|
4 |
* Admin Class
|
5 |
*
|
6 |
+
* Peter's Plugins Foundation 04
|
7 |
*
|
8 |
+
* @package PPF04
|
9 |
* @author Peter Raschendorfer
|
10 |
* @license GPL2+
|
11 |
*/
|
12 |
|
13 |
+
if ( !class_exists( 'PPF04_Admin' ) ) {
|
14 |
|
15 |
|
16 |
+
abstract class PPF04_Admin extends PPF04_SubClass {
|
17 |
|
18 |
|
19 |
/**
|
20 |
* settings sections
|
21 |
*
|
22 |
* @since PPF01
|
23 |
+
* @var array
|
24 |
* @access private
|
25 |
+
*
|
26 |
+
* as of PPF04 we initialize an empty array
|
27 |
*/
|
28 |
+
private $_sections = array();
|
29 |
+
|
30 |
+
|
31 |
+
/**
|
32 |
+
* is setting registered?
|
33 |
+
*
|
34 |
+
* @since PPF04
|
35 |
+
* @var bool
|
36 |
+
* @access private
|
37 |
+
*/
|
38 |
+
private $_settings_registered = false;
|
39 |
|
40 |
|
41 |
/**
|
58 |
* @access private
|
59 |
*/
|
60 |
private $_my_screen_id;
|
61 |
+
|
62 |
|
63 |
/**
|
64 |
* add multiple setting sections
|
67 |
* @param array $sections array of setting sections to add
|
68 |
* @access public
|
69 |
* @see add_settings()
|
70 |
+
*
|
71 |
+
* as of PPF04 we add the sections to the _sections array to allow adding more sections
|
72 |
*/
|
73 |
public function add_setting_sections( $sections ) {
|
74 |
|
|
|
|
|
75 |
foreach( $sections as $section ) {
|
76 |
|
77 |
+
// as of PPF04 we use add_setting_section()
|
78 |
+
$this->add_setting_section( $section );
|
79 |
+
|
80 |
|
81 |
+
}
|
82 |
+
|
83 |
+
// since PPF04
|
84 |
+
$this->maybe_register_setting();
|
85 |
+
|
86 |
+
}
|
87 |
+
|
88 |
+
|
89 |
+
/**
|
90 |
+
* add a single setting section
|
91 |
+
*
|
92 |
+
* @since PPF04
|
93 |
+
* @param array $sections setting section to add
|
94 |
+
* @access public
|
95 |
+
* @see add_settings()
|
96 |
+
*/
|
97 |
+
public function add_setting_section( $section ) {
|
98 |
+
|
99 |
+
// as of PPF04 add sections to _sections array one by one
|
100 |
+
$this->_sections[] = $section;
|
101 |
+
|
102 |
+
if ( array_key_exists( 'fields', $section ) ) {
|
103 |
|
104 |
+
$this->add_settings( $section );
|
105 |
+
|
106 |
}
|
107 |
|
108 |
+
$this->maybe_register_setting();
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
|
113 |
+
/**
|
114 |
+
* register the setting
|
115 |
+
*
|
116 |
+
* @since PPF04
|
117 |
+
* @access private
|
118 |
+
*
|
119 |
+
* was part of add_setting_sections() before PPF04
|
120 |
+
*/
|
121 |
+
public function maybe_register_setting() {
|
122 |
+
|
123 |
+
if ( ! $this->_settings_registered ) {
|
124 |
+
|
125 |
+
// Register the options
|
126 |
+
// since PPF03 only if there is a settings class
|
127 |
+
// so we can use the same function also if we don't need any settings
|
128 |
+
if ( false !== $this->settings() ) {
|
129 |
+
|
130 |
+
register_setting( $this->core()->get_plugin_slug(), $this->settings()->get_option_name(), array( 'sanitize_callback' => array( $this, 'sanitize_callback' ) ) );
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
+
$this->_settings_registered = true;
|
135 |
+
|
136 |
}
|
137 |
|
138 |
|
145 |
* @since PPF01
|
146 |
* @param array $settings array of settings to add
|
147 |
* string $section => ID of the section
|
148 |
+
* int $order => sort order
|
149 |
+
* this was added in PPF04, so we check if it exists for backwards compatibility
|
150 |
* string $title => title for section (used by print_setting_sections())
|
151 |
* string $html => HTML code to add to this section
|
152 |
* array $fields => multidimensional array of fields to add
|
153 |
* string $key => key of the option array
|
154 |
* string $callback => function to call
|
155 |
+
* as of PPF04 this can be an array to enable external callbacks
|
156 |
* bool $nosubmit => this section should not show the submit button
|
157 |
* @access private
|
158 |
*/
|
166 |
|
167 |
$field_id = $this->core()->get_plugin_slug() . '-' . $field['key'];
|
168 |
|
169 |
+
// since PPF04
|
170 |
+
if ( is_array( $field['callback'] ) ) {
|
171 |
+
|
172 |
+
$callback = $field['callback'];
|
173 |
+
|
174 |
+
} else {
|
175 |
+
|
176 |
+
$callback = array( $this, $field['callback'] );
|
177 |
+
|
178 |
+
}
|
179 |
+
|
180 |
+
add_settings_field( $field_id, '' , $callback, $this->core()->get_plugin_slug(), $section_id );
|
181 |
|
182 |
}
|
183 |
|
447 |
|
448 |
}
|
449 |
|
450 |
+
|
451 |
+
// sort the sections
|
452 |
+
|
453 |
+
// see add_settings()
|
454 |
+
$sort = false;
|
455 |
+
|
456 |
+
foreach( $this->_sections as $section ) {
|
457 |
+
|
458 |
+
if ( array_key_exists( 'order', $section ) ) {
|
459 |
+
|
460 |
+
$sort = true;
|
461 |
+
break;
|
462 |
+
|
463 |
+
}
|
464 |
+
}
|
465 |
+
|
466 |
+
if ( $sort ) {
|
467 |
+
|
468 |
+
usort( $this->_sections, function( $a, $b ) {
|
469 |
+
return $a['order'] - $b['order'];
|
470 |
+
|
471 |
+
} );
|
472 |
+
|
473 |
+
}
|
474 |
+
|
475 |
+
// end of sort
|
476 |
+
|
477 |
if ( get_current_screen()->parent_base != 'options-general' ) {
|
478 |
|
479 |
// On Option Screens settings_errors() is called automatically
|
612 |
</div>
|
613 |
</div>
|
614 |
<p class="wp-clearfix"><a id="<?php echo $prefix; ?>-review-later" class="<?php echo $prefix; ?>-review-action" href="javascript:void(0);"><?php echo $content['button_later']; ?></a> <a id="<?php echo $prefix; ?>-review-close" class="<?php echo $prefix; ?>-review-action" href="javascript:void(0);"><?php echo $content['button_close']; ?></a></p>
|
615 |
+
</div>
|
616 |
+
<?php
|
617 |
+
|
618 |
+
} );
|
619 |
+
|
620 |
+
|
621 |
+
// Since PPF04 we add CSS and JS to footer for compatibility reasons
|
622 |
+
|
623 |
+
add_action( 'admin_print_footer_scripts', function() use( $content, $links, $prefix, $nonce ) {
|
624 |
+
|
625 |
+
// show notice only on certain pages
|
626 |
+
// it's not possible to check this earlier, because we need the id of the current screen for that
|
627 |
+
if ( ! in_array( get_current_screen()->id, array( 'dashboard', 'themes', 'plugins', 'options-general' , $this->get_screen_id() ) ) ) {
|
628 |
+
return;
|
629 |
+
}
|
630 |
+
|
631 |
+
echo '
|
632 |
+
<style type="text/css">
|
633 |
+
#' . $prefix . '-review-step-like, #' . $prefix . '-review-step-dislike {
|
634 |
display: none;
|
635 |
}
|
636 |
+
#' . $prefix . 'review-later, #' . $prefix . '-review-close, #' . $prefix . '-review-later:before, #' . $prefix . '-review-close:before {
|
637 |
display: block;
|
638 |
height: 20px;
|
639 |
line-height: 20px;
|
640 |
text-decoration: none;
|
641 |
}
|
642 |
+
#' . $prefix . '-review-later, #' . $prefix . '-review-close {
|
643 |
float: left;
|
644 |
position: relative;
|
645 |
padding-left: 22px;
|
646 |
}
|
647 |
+
#' . $prefix . '-review-later {
|
648 |
margin-right: 12px;
|
649 |
}
|
650 |
+
#' . $prefix . '-review-later:before, #' . $prefix . '-review-close:before {
|
651 |
font-family: dashicons;
|
652 |
font-size: 20px;
|
653 |
position: absolute;
|
654 |
left: 0;
|
655 |
top: 0;
|
656 |
}
|
657 |
+
#' . $prefix . '-review-later:before {
|
658 |
content: "\f508";
|
659 |
}
|
660 |
+
#' . $prefix . '-review-close:before {
|
661 |
content: "\f153";
|
662 |
}
|
663 |
</style>
|
665 |
<script type="text/javascript">
|
666 |
jQuery( function( $ ) {
|
667 |
|
668 |
+
$( "#' . $prefix . '-review-happy" ).click( function() {
|
669 |
+
$( "#' . $prefix . '-review-step-1" ).fadeOut( 400, function() {
|
670 |
+
$( "#' . $prefix . '-review-step-like" ).fadeIn();
|
671 |
});
|
672 |
} );
|
673 |
|
674 |
+
$( "#' . $prefix . '-review-unhappy" ).click( function() {
|
675 |
+
$( "#' . $prefix . '-review-step-1" ).fadeOut( 400, function() {
|
676 |
+
$( "#' . $prefix . '-review-step-dislike" ).fadeIn();
|
677 |
});
|
678 |
} );
|
679 |
|
680 |
+
$( ".' . $prefix . '-review-action" ).click( function() {
|
681 |
|
682 |
$.post(
|
683 |
ajaxurl, {
|
684 |
+
action : "' . $prefix . '-review-action",
|
685 |
command : $(this).attr( "id" ),
|
686 |
+
securekey : "' . $nonce .'"
|
687 |
}
|
688 |
);
|
689 |
+
$( "#' . $prefix . '-review-notice" ).fadeOut();
|
690 |
|
691 |
} );
|
692 |
|
693 |
} );
|
694 |
+
</script>';
|
695 |
+
|
|
|
|
|
696 |
|
697 |
} );
|
698 |
|
inc/ppf/ppf-class.php
CHANGED
@@ -3,9 +3,9 @@
|
|
3 |
/**
|
4 |
* Base Class
|
5 |
*
|
6 |
-
* Peter's Plugins Foundation
|
7 |
*
|
8 |
-
* @package
|
9 |
* @author Peter Raschendorfer
|
10 |
* @license GPL2+
|
11 |
*/
|
@@ -19,10 +19,10 @@
|
|
19 |
}
|
20 |
|
21 |
|
22 |
-
if ( !class_exists( '
|
23 |
|
24 |
|
25 |
-
abstract class
|
26 |
|
27 |
|
28 |
/**
|
3 |
/**
|
4 |
* Base Class
|
5 |
*
|
6 |
+
* Peter's Plugins Foundation 04
|
7 |
*
|
8 |
+
* @package PPF04
|
9 |
* @author Peter Raschendorfer
|
10 |
* @license GPL2+
|
11 |
*/
|
19 |
}
|
20 |
|
21 |
|
22 |
+
if ( !class_exists( 'PPF04_Class' ) ) {
|
23 |
|
24 |
|
25 |
+
abstract class PPF04_Class {
|
26 |
|
27 |
|
28 |
/**
|
inc/ppf/ppf-plugin-addon.php
ADDED
@@ -0,0 +1,229 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Plugin Addon Base Class
|
5 |
+
*
|
6 |
+
* Peter's Plugins Foundation 04
|
7 |
+
*
|
8 |
+
* @package PPF04
|
9 |
+
* @author Peter Raschendorfer
|
10 |
+
* @license GPL2+
|
11 |
+
*/
|
12 |
+
|
13 |
+
|
14 |
+
if ( !class_exists( 'PPF04_Plugin_Addon' ) ) {
|
15 |
+
|
16 |
+
abstract class PPF04_Plugin_Addon extends PPF04_Plugin {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Base Plugin Name
|
20 |
+
*
|
21 |
+
* @since PPF04
|
22 |
+
* @var string
|
23 |
+
* @access protected
|
24 |
+
*/
|
25 |
+
protected $base_plugin_name;
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Base Plugin Function
|
30 |
+
*
|
31 |
+
* @since PPF04
|
32 |
+
* @var string
|
33 |
+
* @access protected
|
34 |
+
*/
|
35 |
+
protected $base_plugin_function;
|
36 |
+
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Base Plugin Min Required Version
|
40 |
+
*
|
41 |
+
* @since PPF04
|
42 |
+
* @var string
|
43 |
+
* @access protected
|
44 |
+
*/
|
45 |
+
protected $base_plugin_min_version;
|
46 |
+
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Init the Class
|
50 |
+
*
|
51 |
+
* @since PPF04
|
52 |
+
* same as PPFxx_Plugin plus
|
53 |
+
* @type string $base_plugin_name Name of Base Plugin
|
54 |
+
* @type string $base_plugin_function Function to access Base Plugin
|
55 |
+
* @type string $base_plugin_min_version Minimal required version of Base Plugin
|
56 |
+
*/
|
57 |
+
public function __construct( $settings ) {
|
58 |
+
|
59 |
+
$this->plugin_file = $settings['file'];
|
60 |
+
$this->plugin_slug = $settings['slug'];
|
61 |
+
$this->plugin_name = $settings['name'];
|
62 |
+
$this->plugin_shortname = $settings['shortname'];
|
63 |
+
$this->plugin_version = $settings['version'];
|
64 |
+
|
65 |
+
$this->base_plugin_name = $settings['base_plugin_name'];
|
66 |
+
$this->base_plugin_function = $settings['base_plugin_function'];
|
67 |
+
$this->base_plugin_min_version = $settings['base_plugin_min_version'];
|
68 |
+
|
69 |
+
$this->_data_key = str_replace( '-', '_', $settings['slug'] ) . '_data';
|
70 |
+
$this->data_load();
|
71 |
+
|
72 |
+
$this->addon_check();
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
/**
|
78 |
+
* get Base Plugin Name
|
79 |
+
*
|
80 |
+
* @since PPF04
|
81 |
+
* @access public
|
82 |
+
* @return string
|
83 |
+
*/
|
84 |
+
public function get_base_plugin_name() {
|
85 |
+
|
86 |
+
return $this->base_plugin_name;
|
87 |
+
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
+
/**
|
92 |
+
* get Base Plugin Function
|
93 |
+
*
|
94 |
+
* @since PPF04
|
95 |
+
* @access public
|
96 |
+
* @return string
|
97 |
+
*/
|
98 |
+
public function get_base_plugin_function() {
|
99 |
+
|
100 |
+
return $this->base_plugin_function;
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
|
105 |
+
/**
|
106 |
+
* get Base Plugin minimum required version^
|
107 |
+
*
|
108 |
+
* @since PPF04
|
109 |
+
* @access public
|
110 |
+
* @return string
|
111 |
+
*/
|
112 |
+
public function get_base_plugin_min_version() {
|
113 |
+
|
114 |
+
return $this->base_plugin_min_version;
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
/**
|
120 |
+
* check if base plugin exists and has required minimum version
|
121 |
+
*
|
122 |
+
* @since PPF04
|
123 |
+
* @access private
|
124 |
+
*/
|
125 |
+
private function addon_check() {
|
126 |
+
|
127 |
+
// we need to place all the stuff in plugins_loaded to ensure the base plugin is loaded
|
128 |
+
|
129 |
+
add_action( 'plugins_loaded', function() {
|
130 |
+
|
131 |
+
$this->plugin_install_update();
|
132 |
+
|
133 |
+
$this->plugin_init();
|
134 |
+
|
135 |
+
if ( ! $this->base_exists() ) {
|
136 |
+
|
137 |
+
add_action('admin_notices', array( $this, 'admin_notice_base_plugin_not_found' ) );
|
138 |
+
|
139 |
+
} elseif ( version_compare( $this->get_base_plugin_min_version(), $this->call_base()->get_plugin_version(), '>' ) ) {
|
140 |
+
|
141 |
+
add_action('admin_notices', array( $this, 'admin_notice_base_plugin_version_insufficient' ) );
|
142 |
+
|
143 |
+
} else {
|
144 |
+
|
145 |
+
$this->addon_init();
|
146 |
+
|
147 |
+
}
|
148 |
+
|
149 |
+
} );
|
150 |
+
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
|
155 |
+
/**
|
156 |
+
* call base plugin
|
157 |
+
*
|
158 |
+
* @since PPF04
|
159 |
+
*/
|
160 |
+
public function call_base() {
|
161 |
+
|
162 |
+
$base = $this->get_base_plugin_function();
|
163 |
+
|
164 |
+
if ( function_exists( $base ) ) {
|
165 |
+
|
166 |
+
return $base();
|
167 |
+
|
168 |
+
}
|
169 |
+
|
170 |
+
return false;
|
171 |
+
|
172 |
+
}
|
173 |
+
|
174 |
+
|
175 |
+
/**
|
176 |
+
* check if base function exists
|
177 |
+
*
|
178 |
+
* @since PPF04
|
179 |
+
*/
|
180 |
+
public function base_exists() {
|
181 |
+
|
182 |
+
$base = $this->get_base_plugin_function();
|
183 |
+
|
184 |
+
if ( function_exists( $base ) ) {
|
185 |
+
|
186 |
+
return true;
|
187 |
+
|
188 |
+
}
|
189 |
+
|
190 |
+
return false;
|
191 |
+
|
192 |
+
}
|
193 |
+
|
194 |
+
|
195 |
+
/**
|
196 |
+
* addon init
|
197 |
+
*
|
198 |
+
* force to be defined
|
199 |
+
*
|
200 |
+
* @since PPF04
|
201 |
+
*/
|
202 |
+
abstract public function addon_init();
|
203 |
+
|
204 |
+
|
205 |
+
/**
|
206 |
+
* add admin notice if base plugin not found
|
207 |
+
*
|
208 |
+
* force to be defined
|
209 |
+
*
|
210 |
+
* @since PPF04
|
211 |
+
*/
|
212 |
+
abstract public function admin_notice_base_plugin_not_found();
|
213 |
+
|
214 |
+
|
215 |
+
/**
|
216 |
+
* add admin notice if base plugin version insufficient
|
217 |
+
*
|
218 |
+
* force to be defined
|
219 |
+
*
|
220 |
+
* @since PPF04
|
221 |
+
*/
|
222 |
+
abstract public function admin_notice_base_plugin_version_insufficient();
|
223 |
+
|
224 |
+
|
225 |
+
}
|
226 |
+
|
227 |
+
}
|
228 |
+
|
229 |
+
?>
|
inc/ppf/ppf-plugin.php
CHANGED
@@ -3,17 +3,17 @@
|
|
3 |
/**
|
4 |
* Plugin Base Class
|
5 |
*
|
6 |
-
* Peter's Plugins Foundation
|
7 |
*
|
8 |
-
* @package
|
9 |
* @author Peter Raschendorfer
|
10 |
* @license GPL2+
|
11 |
*/
|
12 |
|
13 |
|
14 |
-
if ( !class_exists( '
|
15 |
|
16 |
-
abstract class
|
17 |
|
18 |
/**
|
19 |
* Instances
|
@@ -32,9 +32,10 @@ if ( !class_exists( 'PPF03_Plugin' ) ) {
|
|
32 |
*
|
33 |
* @since PPF01
|
34 |
* @var string
|
35 |
-
* @access
|
|
|
36 |
*/
|
37 |
-
|
38 |
|
39 |
|
40 |
/**
|
@@ -42,9 +43,10 @@ if ( !class_exists( 'PPF03_Plugin' ) ) {
|
|
42 |
*
|
43 |
* @since PPF01
|
44 |
* @var string
|
45 |
-
* @access
|
|
|
46 |
*/
|
47 |
-
|
48 |
|
49 |
|
50 |
/**
|
@@ -52,9 +54,10 @@ if ( !class_exists( 'PPF03_Plugin' ) ) {
|
|
52 |
*
|
53 |
* @since PPF01
|
54 |
* @var string
|
55 |
-
* @access
|
|
|
56 |
*/
|
57 |
-
|
58 |
|
59 |
|
60 |
/**
|
@@ -62,9 +65,10 @@ if ( !class_exists( 'PPF03_Plugin' ) ) {
|
|
62 |
*
|
63 |
* @since PPF01
|
64 |
* @var string
|
65 |
-
* @access
|
|
|
66 |
*/
|
67 |
-
|
68 |
|
69 |
|
70 |
/**
|
@@ -72,9 +76,10 @@ if ( !class_exists( 'PPF03_Plugin' ) ) {
|
|
72 |
*
|
73 |
* @since PPF01
|
74 |
* @var string
|
75 |
-
* @access
|
|
|
76 |
*/
|
77 |
-
|
78 |
|
79 |
|
80 |
/**
|
@@ -82,9 +87,10 @@ if ( !class_exists( 'PPF03_Plugin' ) ) {
|
|
82 |
*
|
83 |
* @since PPF01
|
84 |
* @var int
|
85 |
-
* @access
|
|
|
86 |
*/
|
87 |
-
|
88 |
|
89 |
|
90 |
/**
|
@@ -92,9 +98,10 @@ if ( !class_exists( 'PPF03_Plugin' ) ) {
|
|
92 |
*
|
93 |
* @since PPF01
|
94 |
* @var string
|
95 |
-
* @access
|
|
|
96 |
*/
|
97 |
-
|
98 |
|
99 |
|
100 |
/**
|
@@ -102,9 +109,10 @@ if ( !class_exists( 'PPF03_Plugin' ) ) {
|
|
102 |
*
|
103 |
* @since PPF01
|
104 |
* @var array
|
105 |
-
* @access
|
|
|
106 |
*/
|
107 |
-
|
108 |
|
109 |
|
110 |
/**
|
@@ -112,9 +120,10 @@ if ( !class_exists( 'PPF03_Plugin' ) ) {
|
|
112 |
*
|
113 |
* @since PPF01
|
114 |
* @var object
|
115 |
-
* @access
|
|
|
116 |
*/
|
117 |
-
|
118 |
|
119 |
|
120 |
/**
|
@@ -174,17 +183,16 @@ if ( !class_exists( 'PPF03_Plugin' ) ) {
|
|
174 |
* }
|
175 |
* @return singleton
|
176 |
*/
|
177 |
-
final public static function getInstance( $settings )
|
178 |
-
|
179 |
-
|
180 |
$calledClass = get_called_class();
|
181 |
|
182 |
-
if ( !isset(
|
183 |
{
|
184 |
-
|
185 |
}
|
186 |
|
187 |
-
return
|
188 |
}
|
189 |
|
190 |
|
@@ -402,9 +410,9 @@ if ( !class_exists( 'PPF03_Plugin' ) ) {
|
|
402 |
* do plugin install or update
|
403 |
*
|
404 |
* @since PPF01
|
405 |
-
* @access private
|
406 |
*/
|
407 |
-
|
408 |
|
409 |
$version = $this->data_get( 'current_version' );
|
410 |
|
@@ -475,7 +483,7 @@ if ( !class_exists( 'PPF03_Plugin' ) ) {
|
|
475 |
*/
|
476 |
public function data_get( $key ) {
|
477 |
|
478 |
-
if ( array_key_exists( $key, $this->_data ) ) {
|
479 |
|
480 |
return $this->_data[$key];
|
481 |
|
3 |
/**
|
4 |
* Plugin Base Class
|
5 |
*
|
6 |
+
* Peter's Plugins Foundation 04
|
7 |
*
|
8 |
+
* @package PPF04
|
9 |
* @author Peter Raschendorfer
|
10 |
* @license GPL2+
|
11 |
*/
|
12 |
|
13 |
|
14 |
+
if ( !class_exists( 'PPF04_Plugin' ) ) {
|
15 |
|
16 |
+
abstract class PPF04_Plugin extends PPF04_Class {
|
17 |
|
18 |
/**
|
19 |
* Instances
|
32 |
*
|
33 |
* @since PPF01
|
34 |
* @var string
|
35 |
+
* @access protected
|
36 |
+
* was private prior to PPF04
|
37 |
*/
|
38 |
+
protected $plugin_name;
|
39 |
|
40 |
|
41 |
/**
|
43 |
*
|
44 |
* @since PPF01
|
45 |
* @var string
|
46 |
+
* @access protected
|
47 |
+
* was private prior to PPF04
|
48 |
*/
|
49 |
+
protected $plugin_shortname;
|
50 |
|
51 |
|
52 |
/**
|
54 |
*
|
55 |
* @since PPF01
|
56 |
* @var string
|
57 |
+
* @access protected
|
58 |
+
* was private prior to PPF04
|
59 |
*/
|
60 |
+
protected $plugin_file;
|
61 |
|
62 |
|
63 |
/**
|
65 |
*
|
66 |
* @since PPF01
|
67 |
* @var string
|
68 |
+
* @access protected
|
69 |
+
* was private prior to PPF04
|
70 |
*/
|
71 |
+
protected $plugin_dir;
|
72 |
|
73 |
|
74 |
/**
|
76 |
*
|
77 |
* @since PPF01
|
78 |
* @var string
|
79 |
+
* @access protected
|
80 |
+
* was private prior to PPF04
|
81 |
*/
|
82 |
+
protected $plugin_slug;
|
83 |
|
84 |
|
85 |
/**
|
87 |
*
|
88 |
* @since PPF01
|
89 |
* @var int
|
90 |
+
* @access protected
|
91 |
+
* was private prior to PPF04
|
92 |
*/
|
93 |
+
protected $plugin_version;
|
94 |
|
95 |
|
96 |
/**
|
98 |
*
|
99 |
* @since PPF01
|
100 |
* @var string
|
101 |
+
* @access protected
|
102 |
+
* was private prior to PPF04
|
103 |
*/
|
104 |
+
protected $_data_key;
|
105 |
|
106 |
|
107 |
/**
|
109 |
*
|
110 |
* @since PPF01
|
111 |
* @var array
|
112 |
+
* @access protected
|
113 |
+
* was private prior to PPF04
|
114 |
*/
|
115 |
+
protected $_data;
|
116 |
|
117 |
|
118 |
/**
|
120 |
*
|
121 |
* @since PPF01
|
122 |
* @var object
|
123 |
+
* @access protected
|
124 |
+
* was private prior to PPF04
|
125 |
*/
|
126 |
+
protected $settings;
|
127 |
|
128 |
|
129 |
/**
|
183 |
* }
|
184 |
* @return singleton
|
185 |
*/
|
186 |
+
final public static function getInstance( $settings ) {
|
187 |
+
|
|
|
188 |
$calledClass = get_called_class();
|
189 |
|
190 |
+
if ( !isset( self::$_instances[$calledClass] ) )
|
191 |
{
|
192 |
+
self::$_instances[$calledClass] = new $calledClass( $settings );
|
193 |
}
|
194 |
|
195 |
+
return self::$_instances[$calledClass];
|
196 |
}
|
197 |
|
198 |
|
410 |
* do plugin install or update
|
411 |
*
|
412 |
* @since PPF01
|
413 |
+
* @access protected (since PPF04, was private before)
|
414 |
*/
|
415 |
+
protected function plugin_install_update() {
|
416 |
|
417 |
$version = $this->data_get( 'current_version' );
|
418 |
|
483 |
*/
|
484 |
public function data_get( $key ) {
|
485 |
|
486 |
+
if ( is_array( $this->_data ) && array_key_exists( $key, $this->_data ) ) {
|
487 |
|
488 |
return $this->_data[$key];
|
489 |
|
inc/ppf/ppf-settings.php
CHANGED
@@ -3,26 +3,27 @@
|
|
3 |
/**
|
4 |
* Settings Class
|
5 |
*
|
6 |
-
* Peter's Plugins Foundation
|
7 |
*
|
8 |
-
* @package
|
9 |
* @author Peter Raschendorfer
|
10 |
* @license GPL2+
|
11 |
*/
|
12 |
|
13 |
-
if ( !class_exists( '
|
14 |
|
15 |
|
16 |
-
abstract class
|
17 |
|
18 |
/**
|
19 |
* name of settings in databse (meta_key)
|
20 |
*
|
21 |
* @since PPF01
|
22 |
* @var string
|
23 |
-
* @access
|
|
|
24 |
*/
|
25 |
-
|
26 |
|
27 |
|
28 |
/**
|
@@ -30,9 +31,10 @@ if ( !class_exists( 'PPF03_Settings' ) ) {
|
|
30 |
*
|
31 |
* @since PPF01
|
32 |
* @var array
|
33 |
-
* @access
|
|
|
34 |
*/
|
35 |
-
|
36 |
|
37 |
|
38 |
/**
|
@@ -40,9 +42,10 @@ if ( !class_exists( 'PPF03_Settings' ) ) {
|
|
40 |
*
|
41 |
* @since PPF01
|
42 |
* @var array
|
43 |
-
* @access
|
|
|
44 |
*/
|
45 |
-
|
46 |
|
47 |
|
48 |
/**
|
@@ -126,7 +129,16 @@ if ( !class_exists( 'PPF03_Settings' ) ) {
|
|
126 |
*/
|
127 |
public function get( $key ) {
|
128 |
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
}
|
132 |
|
3 |
/**
|
4 |
* Settings Class
|
5 |
*
|
6 |
+
* Peter's Plugins Foundation 04
|
7 |
*
|
8 |
+
* @package PPF04
|
9 |
* @author Peter Raschendorfer
|
10 |
* @license GPL2+
|
11 |
*/
|
12 |
|
13 |
+
if ( !class_exists( 'PPF04_Settings' ) ) {
|
14 |
|
15 |
|
16 |
+
abstract class PPF04_Settings extends PPF04_SubClass {
|
17 |
|
18 |
/**
|
19 |
* name of settings in databse (meta_key)
|
20 |
*
|
21 |
* @since PPF01
|
22 |
* @var string
|
23 |
+
* @access protected
|
24 |
+
* was private prior to PPF04
|
25 |
*/
|
26 |
+
protected $_key;
|
27 |
|
28 |
|
29 |
/**
|
31 |
*
|
32 |
* @since PPF01
|
33 |
* @var array
|
34 |
+
* @access protected
|
35 |
+
* was private prior to PPF04
|
36 |
*/
|
37 |
+
protected $_settings;
|
38 |
|
39 |
|
40 |
/**
|
42 |
*
|
43 |
* @since PPF01
|
44 |
* @var array
|
45 |
+
* @access protected
|
46 |
+
* was private prior to PPF04
|
47 |
*/
|
48 |
+
protected $_defaults;
|
49 |
|
50 |
|
51 |
/**
|
129 |
*/
|
130 |
public function get( $key ) {
|
131 |
|
132 |
+
// as of PPF04 we check if the key exists
|
133 |
+
if ( array_key_exists( $key, $this->_settings ) ) {
|
134 |
+
|
135 |
+
return $this->_settings[$key];
|
136 |
+
|
137 |
+
} else {
|
138 |
+
|
139 |
+
return null;
|
140 |
+
|
141 |
+
}
|
142 |
|
143 |
}
|
144 |
|
inc/ppf/ppf-subclass.php
CHANGED
@@ -3,26 +3,27 @@
|
|
3 |
/**
|
4 |
* Plugin Base Sub-Class
|
5 |
*
|
6 |
-
* Peter's Plugins Foundation
|
7 |
*
|
8 |
-
* @package
|
9 |
* @author Peter Raschendorfer
|
10 |
* @license GPL2+
|
11 |
*/
|
12 |
|
13 |
-
if ( !class_exists( '
|
14 |
|
15 |
|
16 |
-
abstract class
|
17 |
|
18 |
/**
|
19 |
* reference to core class
|
20 |
*
|
21 |
* @since PPF01
|
22 |
* @var object
|
23 |
-
* @access
|
|
|
24 |
*/
|
25 |
-
|
26 |
|
27 |
|
28 |
/**
|
@@ -30,9 +31,10 @@ if ( !class_exists( 'PPF03_SubClass' ) ) {
|
|
30 |
*
|
31 |
* @since PPF01
|
32 |
* @var object
|
33 |
-
* @access
|
|
|
34 |
*/
|
35 |
-
|
36 |
|
37 |
|
38 |
/**
|
3 |
/**
|
4 |
* Plugin Base Sub-Class
|
5 |
*
|
6 |
+
* Peter's Plugins Foundation 04
|
7 |
*
|
8 |
+
* @package PPF04
|
9 |
* @author Peter Raschendorfer
|
10 |
* @license GPL2+
|
11 |
*/
|
12 |
|
13 |
+
if ( !class_exists( 'PPF04_SubClass' ) ) {
|
14 |
|
15 |
|
16 |
+
abstract class PPF04_SubClass extends PPF04_Class {
|
17 |
|
18 |
/**
|
19 |
* reference to core class
|
20 |
*
|
21 |
* @since PPF01
|
22 |
* @var object
|
23 |
+
* @access protected
|
24 |
+
* was private prior to PPF04
|
25 |
*/
|
26 |
+
protected $_core;
|
27 |
|
28 |
|
29 |
/**
|
31 |
*
|
32 |
* @since PPF01
|
33 |
* @var object
|
34 |
+
* @access protected
|
35 |
+
* was private prior to PPF04
|
36 |
*/
|
37 |
+
protected $_settings;
|
38 |
|
39 |
|
40 |
/**
|
loader.php
CHANGED
@@ -42,7 +42,7 @@ function pp_404page() {
|
|
42 |
'slug' => pathinfo( dirname( __FILE__ ) . '/404page.php', PATHINFO_FILENAME ),
|
43 |
'name' => '404page - your smart custom 404 error page',
|
44 |
'shortname' => '404page',
|
45 |
-
'version' => '11.
|
46 |
) );
|
47 |
|
48 |
}
|
42 |
'slug' => pathinfo( dirname( __FILE__ ) . '/404page.php', PATHINFO_FILENAME ),
|
43 |
'name' => '404page - your smart custom 404 error page',
|
44 |
'shortname' => '404page',
|
45 |
+
'version' => '11.2.2'
|
46 |
) );
|
47 |
|
48 |
}
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: petersplugins
|
3 |
Tags: page, 404, error, error page, 404 page, page not found, page not found error, 404 error page, missing, broken link, template, 404 link, seo, custom 404, custom 404 page, custom 404 error, custom 404 error page, customize 404, customize 404 page, customize 404 error page, classicpress
|
4 |
Requires at least: 4.0
|
5 |
-
Tested up to: 5.
|
6 |
-
Stable tag: 11.
|
7 |
Requires PHP: 5.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -75,7 +75,7 @@ The only requirement for this plugin is that you change the Permalink Structure
|
|
75 |
* [Twenty Sixteen](https://wordpress.org/themes/twentysixteen/)
|
76 |
* [Twenty Seventeen](https://wordpress.org/themes/twentyseventeen/)
|
77 |
* [Twenty Nineteen](https://wordpress.org/themes/twentynineteen/)
|
78 |
-
* [Twenty Twenty]
|
79 |
* [Vantage](https://wordpress.org/themes/vantage/)
|
80 |
* [Virtue](https://wordpress.org/themes/virtue/)
|
81 |
* [Zerif Lite](http://themeisle.com/themes/zerif-lite/)
|
@@ -171,6 +171,16 @@ Please use the [Support Forum](https://wordpress.org/support/plugin/404page).
|
|
171 |
|
172 |
== Changelog ==
|
173 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
= 11.1.4 (2019-12-29) =
|
175 |
* urgent bug fix for PPF03
|
176 |
|
@@ -338,6 +348,15 @@ Please use the [Support Forum](https://wordpress.org/support/plugin/404page).
|
|
338 |
|
339 |
== Upgrade Notice ==
|
340 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
= 11.1.4 =
|
342 |
urgent bug fix for PPF03
|
343 |
|
2 |
Contributors: petersplugins
|
3 |
Tags: page, 404, error, error page, 404 page, page not found, page not found error, 404 error page, missing, broken link, template, 404 link, seo, custom 404, custom 404 page, custom 404 error, custom 404 error page, customize 404, customize 404 page, customize 404 error page, classicpress
|
4 |
Requires at least: 4.0
|
5 |
+
Tested up to: 5.4
|
6 |
+
Stable tag: 11.2.2
|
7 |
Requires PHP: 5.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
75 |
* [Twenty Sixteen](https://wordpress.org/themes/twentysixteen/)
|
76 |
* [Twenty Seventeen](https://wordpress.org/themes/twentyseventeen/)
|
77 |
* [Twenty Nineteen](https://wordpress.org/themes/twentynineteen/)
|
78 |
+
* [Twenty Twenty](https://wordpress.org/themes/twentytwenty/)
|
79 |
* [Vantage](https://wordpress.org/themes/vantage/)
|
80 |
* [Virtue](https://wordpress.org/themes/virtue/)
|
81 |
* [Zerif Lite](http://themeisle.com/themes/zerif-lite/)
|
171 |
|
172 |
== Changelog ==
|
173 |
|
174 |
+
= 11.2.2 (2020-03-28) =
|
175 |
+
* changes to the notification for hopefully better compatibility
|
176 |
+
* Plugin Foundation swtiched to PPF04
|
177 |
+
|
178 |
+
= 11.2.1 (2020-01-04) =
|
179 |
+
* if W3 Total Cache is installed and caching is active URLs that result in an 404 error are automatically excluded from caching
|
180 |
+
|
181 |
+
= 11.2.0 (2020-01-01) =
|
182 |
+
* if WP Super Cache is installed and caching is active URLs that result in an 404 error are automatically excluded from caching
|
183 |
+
|
184 |
= 11.1.4 (2019-12-29) =
|
185 |
* urgent bug fix for PPF03
|
186 |
|
348 |
|
349 |
== Upgrade Notice ==
|
350 |
|
351 |
+
= 11.2.2 =
|
352 |
+
notification compatibility
|
353 |
+
|
354 |
+
= 11.2.1 =
|
355 |
+
if W3 Total Cache is installed and caching is active URLs that result in an 404 error are automatically excluded from caching
|
356 |
+
|
357 |
+
= 11.2.0 =
|
358 |
+
if WP Super Cache is installed and caching is active URLs that result in an 404 error are automatically excluded from caching
|
359 |
+
|
360 |
= 11.1.4 =
|
361 |
urgent bug fix for PPF03
|
362 |
|