Change the meta conditional and add to the panel

This commit is contained in:
Glaydston Veloso 2016-11-09 13:04:19 +01:00
parent 5fcd580d3d
commit 510dd9ea25
2 changed files with 24 additions and 10 deletions

View file

@ -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, '</body>') ) {
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 ) {

View file

@ -617,6 +617,14 @@ class WP_FFPC extends WP_FFPC_ABSTRACT {
<span class="description"><?php _e('Prefix for HTML content keys, can be used in nginx.<br /><strong>WARNING</strong>: changing this will result the previous cache to becomes invalid!<br />If you are caching with nginx, you should update your nginx configuration and reload nginx after changing this value.', 'wp-ffpc'); ?></span>
</dd>
<dt>
<label for="prefix_data"><?php _e('Mobile Data prefix', 'wp-ffpc'); ?></label>
</dt>
<dd>
<input type="text" name="prefix_data" id="prefix_data" value="<?php echo $this->options['prefix_data_mobile']; ?>" />
<span class="description"><?php _e('Prefix for HTML content keys, can be used in nginx.<br /><strong>WARNING</strong>: changing this will result the previous cache to becomes invalid!<br />If you are caching with nginx, you should update your nginx configuration and reload nginx after changing this value.', 'wp-ffpc'); ?></span>
</dd>
<dt>
<label for="prefix_meta"><?php _e('Meta prefix', 'wp-ffpc'); ?></label>
</dt>
@ -625,6 +633,14 @@ class WP_FFPC extends WP_FFPC_ABSTRACT {
<span class="description"><?php _e('Prefix for meta content keys, used only with PHP processing.<br /><strong>WARNING</strong>: changing this will result the previous cache to becomes invalid!', 'wp-ffpc'); ?></span>
</dd>
<dt>
<label for="prefix_meta"><?php _e('Mobile eta prefix', 'wp-ffpc'); ?></label>
</dt>
<dd>
<input type="text" name="prefix_meta" id="prefix_meta" value="<?php echo $this->options['prefix_meta_mobile']; ?>" />
<span class="description"><?php _e('Prefix for meta content keys, used only with PHP processing.<br /><strong>WARNING</strong>: changing this will result the previous cache to becomes invalid!', 'wp-ffpc'); ?></span>
</dd>
<dt>
<label for="key"><?php _e('Key scheme', 'wp-ffpc'); ?></label>
</dt>