diff --git a/wp-common b/wp-common index fe3a3c9..c4fb20b 160000 --- a/wp-common +++ b/wp-common @@ -1 +1 @@ -Subproject commit fe3a3c9c52091f21924de59d379442201e8a059a +Subproject commit c4fb20b46ce51d157a0ccd0d60f73273d4547fef diff --git a/wp-ffpc-class.php b/wp-ffpc-class.php index f4d620e..48f9413 100644 --- a/wp-ffpc-class.php +++ b/wp-ffpc-class.php @@ -67,6 +67,9 @@ if ( ! class_exists( 'WP_FFPC' ) ) { private $shell_possibilities = array (); private $backend = NULL; private $scheduled = false; + private $errors = array(); + private $warnings = array(); + private $notices = array(); /** * init hook function runs before admin panel hook, themeing and options read @@ -95,6 +98,15 @@ if ( ! class_exists( 'WP_FFPC' ) ) { //$this->shell_possibilities = array ( 'shell_exec' ); $disabled_functions = array_map('trim', explode(',', ini_get('disable_functions') ) ); + $this->notices = array ( + ); + + $this->warnings = array ( + ); + + $this->errors = array ( + ); + foreach ( $this->shell_possibilities as $possible ) { if ( function_exists ($possible) && ! ( ini_get('safe_mode') || in_array( $possible, $disabled_functions ) ) ) { /* set shell function */ @@ -259,6 +271,30 @@ if ( ! class_exists( 'WP_FFPC' ) ) { } } + /** + * + */ + public function plugin_admin_help($contextual_help, $screen_id ) { + + /* add our page only if the screenid is correct */ + if ( strpos( $screen_id, $this->plugin_settings_page ) ) { + $contextual_help = __('

Please visit the official support forum of the plugin for help.

', $this->plugin_constant ); + + /* [TODO] give detailed information on errors & troubleshooting + get_current_screen()->add_help_tab( array( + 'id' => $this->plugin_constant . '-issues', + 'title' => __( 'Troubleshooting' ), + 'content' => __( '

List of errors, possible reasons and solutions

+
E#
+ ' ) + ) ); + */ + + } + + return $contextual_help; + } + /** * admin panel, the admin page displayed for plugin settings */ @@ -442,7 +478,7 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
- If you are caching with nginx, you should update your nginx configuration and reload nginx after changing this value.', $this->plugin_constant); ?> + WARNING: changing this will result the previous cache to becomes invalid!
If you are caching with nginx, you should update your nginx configuration and reload nginx after changing this value.', $this->plugin_constant); ?>
@@ -450,7 +486,7 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
- plugin_constant); ?> + WARNING: changing this will result the previous cache to becomes invalid!', $this->plugin_constant); ?>
@@ -458,7 +494,7 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
- use the guide below to change it. Changing this requires changes in the nginx configuration and restarting nginx, if nginx memcached is in use.', $this->plugin_constant); ?> + use the guide below to change it.
WARNING: changing this will result the previous cache to becomes invalid!
If you are caching with nginx, you should update your nginx configuration and reload nginx after changing this value.', $this->plugin_constant); ?>
list_uri_vars as $uri => $desc ) { echo '
'. $uri .'
'. $desc .'
'; @@ -564,7 +600,7 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
- If you are caching with nginx, you should update your nginx configuration and reload nginx after changing this value.', $this->plugin_constant); ?> + If you are caching with nginx, you should update your nginx configuration and reload nginx after changing this value.', $this->plugin_constant); ?>
@@ -1081,6 +1117,29 @@ if ( ! class_exists( 'WP_FFPC' ) ) { } } + /** + * display predefined message based on code + * + */ + private function message ( $code, $type, $echo = true ) { + switch ( $type ) { + case 'notice': + $a = $this->notices; + break; + case 'warning': + $a = $this->warnings; + break; + default: + $a = $this->errors; + break; + } + + $r = isset ( $a[ $code ] ) ? $a[ $code ] : ''; + + if ( $echo ) echo $r; + else return $r; + } + } }