v 1.1, bugfix, html comment functionality

This commit is contained in:
Peter Molnar 2013-03-25 13:11:49 +00:00
parent 42792e9b8a
commit 99ed0380cd
4 changed files with 34 additions and 4 deletions

View file

@ -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*

View file

@ -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 = "<!-- \nWP-FFPC \n\tcache engine: ". $wp_ffpc_config['cache_type'] ."\n\tpage generation time: ". round( $wp_ffpc_gentime, 3 ) ." seconds\n-->\n";
$index = stripos( $buffer , '</body>' );
$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 );

View file

@ -365,6 +365,14 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
<span class="description"><?php _e('Add X-Cache-Engine HTTP header to HTTP responses.', $this->plugin_constant); ?></span>
</dd>
<dt>
<label for="generate_time"><?php _e("Add HTML debug comment", $this->plugin_constant); ?></label>
</dt>
<dd>
<input type="checkbox" name="generate_time" id="generate_time" value="1" <?php checked($this->options['generate_time'],true); ?> />
<span class="description"><?php _e('Adds comment string including plugin name, cache engine and page generation time to every generated entry before closing <body> tag.', $this->plugin_constant); ?></span>
</dd>
<dt>
<label for="sync_protocols"><?php _e("Enable sync protocolls", $this->plugin_constant); ?></label>
</dt>

View file

@ -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 <hello@petermolnar.eu>
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' );