Add logs to the mobile detect
This commit is contained in:
parent
65b7f20ed2
commit
cd968726fb
3 changed files with 1213 additions and 1206 deletions
|
@ -149,10 +149,16 @@ if ( $wp_ffpc_backend->status() === false ) {
|
|||
/* include the mobile detect */
|
||||
include_once ('backends/mobile-detect.php');
|
||||
$mobile_detect = new Mobile_Detect;
|
||||
$wp_ffpc_keys = array();
|
||||
|
||||
/* verify if mobile device (phones or tablets). */
|
||||
$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']);
|
||||
if($mobile_detect->isMobile()){
|
||||
__wp_ffpc_debug__('Set the ffpc keys to the mobile version');
|
||||
$wp_ffpc_keys = array ( 'meta' => $wp_ffpc_config['prefix_meta_mobile'], 'data' => $wp_ffpc_config['prefix_data_mobile'] );
|
||||
} else {
|
||||
__wp_ffpc_debug__('Set the ffpc keys to the desktop version');
|
||||
$wp_ffpc_keys = array( 'meta' => $wp_ffpc_config['prefix_meta'], 'data' => $wp_ffpc_config['prefix_data'] );
|
||||
}
|
||||
|
||||
$wp_ffpc_values = array();
|
||||
|
||||
|
@ -267,7 +273,7 @@ if ( isset($wp_ffpc_config['generate_time']) && $wp_ffpc_config['generate_time']
|
|||
$mtime = explode ( " ", microtime() );
|
||||
$wp_ffpc_gentime = ( $mtime[1] + $mtime[0] ) - $wp_ffpc_gentime;
|
||||
|
||||
$insertion = "\n<!-- WP-FFPC cache output stats\n\tcache engine: ". $wp_ffpc_config['cache_type'] ."\n\tUNIX timestamp: ". time() . "\n\tdate: ". date( 'c' ) . "\n\tfrom server: ". $_SERVER['SERVER_ADDR'] . " -->\n";
|
||||
$insertion = "\n<!-- \n\tCache Engine: ". $wp_ffpc_config['cache_type'] ."\n\tDate: ". date( 'c' ) . " -->\n";
|
||||
$index = stripos( $wp_ffpc_values['data'] , '</body>' );
|
||||
|
||||
$wp_ffpc_values['data'] = substr_replace( $wp_ffpc_values['data'], $insertion, $index, 0);
|
||||
|
@ -471,6 +477,7 @@ function wp_ffpc_callback( $buffer ) {
|
|||
|
||||
/* verify the device type to output into the generation stats */
|
||||
$device_type = $mobile_detect -> isMobile() ? 'mobile': 'desktop';
|
||||
__wp_ffpc_debug__('The device type is: ' . $device_type);
|
||||
|
||||
$mtime = explode ( " ", microtime() );
|
||||
$wp_ffpc_gentime = ( $mtime[1] + $mtime[0] )- $wp_ffpc_gentime;
|
||||
|
|
|
@ -4,12 +4,12 @@ defined('ABSPATH') or die("Walk away.");
|
|||
|
||||
if ( ! class_exists( 'WP_FFPC' ) ) :
|
||||
|
||||
/* get the plugin abstract class*/
|
||||
include_once ( dirname(__FILE__) . '/wp-ffpc-abstract.php' );
|
||||
/* get the common functions class*/
|
||||
include_once ( dirname(__FILE__) .'/wp-ffpc-backend.php' );
|
||||
/* get the plugin abstract class*/
|
||||
include_once ( dirname(__FILE__) . '/wp-ffpc-abstract.php' );
|
||||
/* get the common functions class*/
|
||||
include_once ( dirname(__FILE__) .'/wp-ffpc-backend.php' );
|
||||
|
||||
/**
|
||||
/**
|
||||
* main wp-ffpc class
|
||||
*
|
||||
* @var string $acache_worker advanced cache "worker" file, bundled with the plugin
|
||||
|
@ -24,7 +24,7 @@ include_once ( dirname(__FILE__) .'/wp-ffpc-backend.php' );
|
|||
* @var array $shell_possibilities List of possible precache worker callers
|
||||
[TODO] finish list of vars
|
||||
*/
|
||||
class WP_FFPC extends WP_FFPC_ABSTRACT {
|
||||
class WP_FFPC extends WP_FFPC_ABSTRACT {
|
||||
const host_separator = ',';
|
||||
const port_separator = ':';
|
||||
const donation_id_key = 'hosted_button_id=';
|
||||
|
@ -621,7 +621,7 @@ class WP_FFPC extends WP_FFPC_ABSTRACT {
|
|||
<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']; ?>" />
|
||||
<input type="text" name="prefix_data_mobile" id="prefix_data_mobile" 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>
|
||||
|
||||
|
@ -637,7 +637,7 @@ class WP_FFPC extends WP_FFPC_ABSTRACT {
|
|||
<label for="prefix_meta"><?php _e('Mobile meta prefix', 'wp-ffpc'); ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" name="prefix_meta" id="prefix_meta" value="<?php echo $this->options['prefix_meta_mobile']; ?>" />
|
||||
<input type="text" name="prefix_meta_mobile" id="prefix_meta_mobile" 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>
|
||||
|
||||
|
@ -1382,6 +1382,6 @@ class WP_FFPC extends WP_FFPC_ABSTRACT {
|
|||
return $this->backend;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Plugin Name: WP-FFPC
|
||||
Plugin URI: https://github.com/petermolnar/wp-ffpc
|
||||
Description: WordPress in-memory full page cache plugin
|
||||
Version: 1.11.1
|
||||
Version: 1.12.0
|
||||
Author: Peter Molnar <hello@petermolnar.eu>
|
||||
Author URI: http://petermolnar.eu/
|
||||
License: GPLv3
|
||||
|
|
Loading…
Reference in a new issue