From 99ed0380cd68fc4ab3bc06619652189806f6a901 Mon Sep 17 00:00:00 2001 From: Peter Molnar Date: Mon, 25 Mar 2013 13:11:49 +0000 Subject: [PATCH] v 1.1, bugfix, html comment functionality --- readme.txt | 8 +++++++- wp-ffpc-acache.php | 19 +++++++++++++++++-- wp-ffpc-class.php | 8 ++++++++ wp-ffpc.php | 3 ++- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/readme.txt b/readme.txt index 1fda9de..8ef7ca2 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i Tags: cache, page cache, full page cache, nginx, memcached, apc, speed, fast Requires at least: 3.0 Tested up to: 3.5.1 -Stable tag: 1.0 +Stable tag: 1.1 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -78,6 +78,12 @@ In order to make contributions a lot easier, I've moved the plugin development t == Changelog == += 1.1 = +*2013.03.25* + +* bugfix on backend status check +* validate working cache "noob" mode added ( option HTML comment with engine & generation time info ), feature request by rafaelmagic ( http://wordpress.org/support/profile/rafaelmagic ) + = 1.0 = *2013.03.22* diff --git a/wp-ffpc-acache.php b/wp-ffpc-acache.php index cd2f6d2..60a0ea6 100644 --- a/wp-ffpc-acache.php +++ b/wp-ffpc-acache.php @@ -66,6 +66,7 @@ if ( $wp_ffpc_config['cache_loggedin'] == 0 ) { $wp_ffpc_redirect = null; $wp_ffpc_backend = new WP_FFPC_Backend( $wp_ffpc_config ); +$wp_ffpc_gentime = 0; if ( $wp_ffpc_backend->status() === false ) return false; @@ -146,6 +147,10 @@ die(); * */ function wp_ffpc_start( ) { + global $wp_ffpc_gentime; + $mtime = explode ( " ", microtime() ); + $wp_ffpc_gentime = $mtime[1] + $mtime[0]; + /* start object "colleting" and pass it the the actual storer function */ ob_start('wp_ffpc_callback'); } @@ -245,8 +250,7 @@ function wp_ffpc_callback( $buffer ) { $meta['pingback'] = get_bloginfo('pingback_url'); /* sync all http and https requests if enabled */ - if ( $config['sync_protocols'] == '1' ) - { + if ( $config['sync_protocols'] == '1' ) { if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) $_SERVER['HTTPS'] = 'on'; @@ -262,6 +266,17 @@ function wp_ffpc_callback( $buffer ) { $buffer = str_replace ( $sync_from, $sync_to, $buffer ); } + if ( $wp_ffpc_config['generate_time'] == '1' ) { + global $wp_ffpc_gentime; + $mtime = explode ( " ", microtime() ); + $wp_ffpc_gentime = ( $mtime[1] + $mtime[0] )- $wp_ffpc_gentime; + + $insertion = "\n"; + $index = stripos( $buffer , '' ); + + $buffer = substr_replace( $buffer, $insertion, $index, 0); + } + $wp_ffpc_backend->set ( $wp_ffpc_backend->key ( 'meta' ) , $meta ); $wp_ffpc_backend->set ( $wp_ffpc_backend->key ( 'data' ) , $buffer ); diff --git a/wp-ffpc-class.php b/wp-ffpc-class.php index 945d54e..47a4ecc 100644 --- a/wp-ffpc-class.php +++ b/wp-ffpc-class.php @@ -365,6 +365,14 @@ if ( ! class_exists( 'WP_FFPC' ) ) { plugin_constant); ?> +
+ +
+
+ options['generate_time'],true); ?> /> + tag.', $this->plugin_constant); ?> +
+
diff --git a/wp-ffpc.php b/wp-ffpc.php index bcf992c..6008330 100644 --- a/wp-ffpc.php +++ b/wp-ffpc.php @@ -3,7 +3,7 @@ Plugin Name: WP-FFPC Plugin URI: http://petermolnar.eu/wordpress/wp-ffpc Description: WordPress cache plugin for memcached & nginx - unbeatable speed -Version: 1.0 +Version: 1.1 Author: Peter Molnar Author URI: http://petermolnar.eu/ License: GPLv3 @@ -46,6 +46,7 @@ $wp_ffpc_defaults = array ( 'sync_protocols' => false, 'persistent' => false, 'response_header' => false, + 'generate_time' => false, ); $wp_ffpc = new WP_FFPC ( 'wp-ffpc', '1.0', 'WP-FFPC', $wp_ffpc_defaults, 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XU3DG7LLA76WC' );