From 510dd9ea2507cf73d36cb7ccc8987ecd3e6a3b79 Mon Sep 17 00:00:00 2001 From: Glaydston Veloso Date: Wed, 9 Nov 2016 13:04:19 +0100 Subject: [PATCH] Change the meta conditional and add to the panel --- wp-ffpc-acache.php | 18 ++++++++---------- wp-ffpc-class.php | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/wp-ffpc-acache.php b/wp-ffpc-acache.php index 8c36335..c07c004 100644 --- a/wp-ffpc-acache.php +++ b/wp-ffpc-acache.php @@ -149,13 +149,10 @@ if ( $wp_ffpc_backend->status() === false ) { /* include the mobile detect */ include_once ('backends/mobile-detect.php'); $mobile_detect = new Mobile_Detect; - /* verify if mobile device (phones or tablets). */ -if ($mobile_detect->isMobile() ) { - $wp_ffpc_keys = array ( 'meta' => $wp_ffpc_config['prefix_meta']. 'mobile_', 'data' => $wp_ffpc_config['prefix_data']. 'mobile_' ); -} else { - $wp_ffpc_keys = array ( 'meta' => $wp_ffpc_config['prefix_meta'], 'data' => $wp_ffpc_config['prefix_data']); -} +$wp_ffpc_keys = ($mobile_detect->isMobile() ? + array ( 'meta' => $wp_ffpc_config['prefix_meta_mobile'], 'data' => $wp_ffpc_config['prefix_data_mobile'] ) : + array ( 'meta' => $wp_ffpc_config['prefix_meta'], 'data' => $wp_ffpc_config['prefix_data']); $wp_ffpc_values = array(); @@ -320,6 +317,8 @@ function wp_ffpc_callback( $buffer ) { global $wp_ffpc_backend; /* check is it's a redirect */ global $wp_ffpc_redirect; + /* check is it's a mobile version*/ + global $mobile_detect; /* no is_home = error, WordPress functions are not availabe */ if (!function_exists('is_home')) @@ -468,8 +467,7 @@ function wp_ffpc_callback( $buffer ) { /* add generation info is option is set, but only to HTML */ if ( $wp_ffpc_config['generate_time'] == '1' && stripos($buffer, '') ) { - global $wp_ffpc_gentime, - $mobile_detect; + global $wp_ffpc_gentime; /* verify the device type to output into the generation stats */ $device_type = $mobile_detect -> isMobile() ? 'mobile': 'desktop'; @@ -496,10 +494,10 @@ function wp_ffpc_callback( $buffer ) { */ $to_store = apply_filters( 'wp-ffpc-to-store', $to_store ); - $prefix_meta = $wp_ffpc_backend->key ( $wp_ffpc_config['prefix_meta'] ); + $prefix_meta = ($mobile_detect -> isMobile())? $wp_ffpc_backend->key ( $wp_ffpc_config['prefix_meta_mobile'] ): $wp_ffpc_backend->key ( $wp_ffpc_config['prefix_meta'] ); $wp_ffpc_backend->set ( $prefix_meta, $meta ); - $prefix_data = $wp_ffpc_backend->key ( $wp_ffpc_config['prefix_data'] ); + $prefix_data = ($mobile_detect -> isMobile())? $wp_ffpc_backend->key ( $wp_ffpc_config['prefix_data_mobile'] ): $wp_ffpc_backend->key ( $wp_ffpc_config['prefix_data'] ); $wp_ffpc_backend->set ( $prefix_data , $to_store ); if ( !empty( $meta['status'] ) && $meta['status'] == 404 ) { diff --git a/wp-ffpc-class.php b/wp-ffpc-class.php index 1c3b40c..4c13205 100644 --- a/wp-ffpc-class.php +++ b/wp-ffpc-class.php @@ -617,6 +617,14 @@ class WP_FFPC extends WP_FFPC_ABSTRACT { 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.', 'wp-ffpc'); ?>
+
+ +
+
+ + 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.', 'wp-ffpc'); ?>
+
+
@@ -625,6 +633,14 @@ class WP_FFPC extends WP_FFPC_ABSTRACT { WARNING: changing this will result the previous cache to becomes invalid!', 'wp-ffpc'); ?> +
+ +
+
+ + WARNING: changing this will result the previous cache to becomes invalid!', 'wp-ffpc'); ?> +
+