= 1.11.1 =

* exclude cache for WooCommerce
* fix load textdomain
* add Italian (it_IT) translation
This commit is contained in:
Gabriele Lauricella 2016-04-21 17:32:26 +02:00
parent d09fa5828b
commit ee76a2a9d8
5 changed files with 640 additions and 591 deletions

1176
readme.txt

File diff suppressed because it is too large Load diff

View file

@ -114,6 +114,7 @@ abstract class WP_FFPC_ABSTRACT {
add_action( 'init', array(&$this,'plugin_init')); add_action( 'init', array(&$this,'plugin_init'));
add_action( 'admin_enqueue_scripts', array(&$this,'enqueue_admin_css_js')); add_action( 'admin_enqueue_scripts', array(&$this,'enqueue_admin_css_js'));
add_action( 'plugins_loaded', array(&$this,'plugin_load_textdomain'));
} }
@ -170,6 +171,13 @@ abstract class WP_FFPC_ABSTRACT {
/* setup plugin, plugin specific setup functions that need options */ /* setup plugin, plugin specific setup functions that need options */
$this->plugin_post_init(); $this->plugin_post_init();
} }
/**
* admin panel, load plugin textdomain
*/
public function plugin_load_textdomain() {
load_plugin_textdomain( 'wp-ffpc', false , dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
/** /**

View file

@ -69,6 +69,16 @@ else {
return false; return false;
} }
/* no cache for WooCommerce URL patterns */
if ( isset($wp_ffpc_config['nocache_woocommerce']) && !empty($wp_ffpc_config['nocache_woocommerce']) &&
isset($wp_ffpc_config['nocache_woocommerce_url']) && trim($wp_ffpc_config['nocache_woocommerce_url']) ) {
$pattern = sprintf('#%s#', trim($wp_ffpc_config['nocache_woocommerce_url']));
if ( preg_match($pattern, $wp_ffpc_uri) ) {
__wp_ffpc_debug__ ( "Cache exception based on WooCommenrce URL regex pattern matched, skipping");
return false;
}
}
/* no cache for uri with query strings, things usually go bad that way */ /* no cache for uri with query strings, things usually go bad that way */
if ( isset($wp_ffpc_config['nocache_dyn']) && !empty($wp_ffpc_config['nocache_dyn']) && stripos($wp_ffpc_uri, '?') !== false ) { if ( isset($wp_ffpc_config['nocache_dyn']) && !empty($wp_ffpc_config['nocache_dyn']) && stripos($wp_ffpc_uri, '?') !== false ) {
__wp_ffpc_debug__ ( 'Dynamic url cache is disabled ( url with "?" ), skipping'); __wp_ffpc_debug__ ( 'Dynamic url cache is disabled ( url with "?" ), skipping');

View file

@ -408,6 +408,18 @@ class WP_FFPC extends WP_FFPC_ABSTRACT {
if( ! function_exists( 'current_user_can' ) || ! current_user_can( 'manage_options' ) ){ if( ! function_exists( 'current_user_can' ) || ! current_user_can( 'manage_options' ) ){
die( ); die( );
} }
/* woo_commenrce page url */
if ( class_exists( 'WooCommerce' ) ) {
$page_wc_checkout=str_replace( home_url(), '', wc_get_page_permalink( 'checkout' ) );
$page_wc_myaccount=str_replace( home_url(), '', wc_get_page_permalink( 'myaccount' ) );
$page_wc_cart=str_replace( home_url(), '', wc_get_page_permalink( 'cart' ) );
$this->options['nocache_woocommerce_url'] = '^'.$page_wc_checkout.'|^'.$page_wc_myaccount.'|^'.$page_wc_cart;
} else {
$this->options['nocache_woocommerce_url'] = '';
}
?> ?>
<div class="wrap"> <div class="wrap">
@ -689,12 +701,13 @@ class WP_FFPC extends WP_FFPC_ABSTRACT {
<table style="width:100%"> <table style="width:100%">
<thead> <thead>
<tr> <tr>
<th style="width:16%; text-align:left"><label for="nocache_home"><?php _e("Exclude home", 'wp-ffpc'); ?></label></th> <th style="width:13%; text-align:left"><label for="nocache_home"><?php _e("Exclude home", 'wp-ffpc'); ?></label></th>
<th style="width:16%; text-align:left"><label for="nocache_feed"><?php _e("Exclude feeds", 'wp-ffpc'); ?></label></th> <th style="width:13%; text-align:left"><label for="nocache_feed"><?php _e("Exclude feeds", 'wp-ffpc'); ?></label></th>
<th style="width:16%; text-align:left"><label for="nocache_archive"><?php _e("Exclude archives", 'wp-ffpc'); ?></label></th> <th style="width:13%; text-align:left"><label for="nocache_archive"><?php _e("Exclude archives", 'wp-ffpc'); ?></label></th>
<th style="width:16%; text-align:left"><label for="nocache_page"><?php _e("Exclude pages", 'wp-ffpc'); ?></label></th> <th style="width:13%; text-align:left"><label for="nocache_page"><?php _e("Exclude pages", 'wp-ffpc'); ?></label></th>
<th style="width:16%; text-align:left"><label for="nocache_single"><?php _e("Exclude singulars", 'wp-ffpc'); ?></label></th> <th style="width:13%; text-align:left"><label for="nocache_single"><?php _e("Exclude singulars", 'wp-ffpc'); ?></label></th>
<th style="width:17%; text-align:left"><label for="nocache_dyn"><?php _e("Dynamic requests", 'wp-ffpc'); ?></label></th> <th style="width:17%; text-align:left"><label for="nocache_dyn"><?php _e("Dynamic requests", 'wp-ffpc'); ?></label></th>
<th style="width:18%; text-align:left"><label for="nocache_woocommerce"><?php _e("WooCommerce", 'wp-ffpc'); ?></label></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -723,6 +736,12 @@ class WP_FFPC extends WP_FFPC_ABSTRACT {
<input type="checkbox" name="nocache_dyn" id="nocache_dyn" value="1" <?php checked($this->options['nocache_dyn'],true); ?> /> <input type="checkbox" name="nocache_dyn" id="nocache_dyn" value="1" <?php checked($this->options['nocache_dyn'],true); ?> />
<span class="description"><?php _e('Exclude every URL with "?" in it.', 'wp-ffpc'); ?></span> <span class="description"><?php _e('Exclude every URL with "?" in it.', 'wp-ffpc'); ?></span>
</td> </td>
<td>
<input type="hidden" name="nocache_woocommerce_url" id="nocache_woocommerce_url" value="<?php if(isset( $this->options['nocache_woocommerce_url'] ) ) echo $this->options['nocache_woocommerce_url']; ?>" />
<input type="checkbox" name="nocache_woocommerce" id="nocache_woocommerce" value="1" <?php checked($this->options['nocache_woocommerce'],true); ?> />
<span class="description"><?php _e('Exclude dynamic WooCommerce page.', 'wp-ffpc');?>
<?php if(isset( $this->options['nocache_woocommerce_url'] ) ) echo "<br />Url:".$this->options['nocache_woocommerce_url']; ?></span>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -771,7 +790,7 @@ class WP_FFPC extends WP_FFPC_ABSTRACT {
<?php _e('List of backends, with the following syntax: <br />- in case of TCP based connections, list the servers as host1:port1,host2:port2,... . Do not add trailing , and always separate host and port with : .<br />- for a unix socket enter: unix://[socket_path]', 'wp-ffpc'); ?></span> <?php _e('List of backends, with the following syntax: <br />- in case of TCP based connections, list the servers as host1:port1,host2:port2,... . Do not add trailing , and always separate host and port with : .<br />- for a unix socket enter: unix://[socket_path]', 'wp-ffpc'); ?></span>
</dd> </dd>
<h3><?php _e('Authentication ( only for SASL enabled Memcached or Redis')?></h3> <h3><?php _e('Authentication ( only for SASL enabled Memcached or Redis)')?></h3>
<?php <?php
if ( ! ini_get('memcached.use_sasl') && ( !empty( $this->options['authuser'] ) || !empty( $this->options['authpass'] ) ) ) { ?> if ( ! ini_get('memcached.use_sasl') && ( !empty( $this->options['authuser'] ) || !empty( $this->options['authpass'] ) ) ) { ?>
<div class="error"><p><strong><?php _e( 'WARNING: you\'ve entered username and/or password for memcached authentication ( or your browser\'s autocomplete did ) which will not work unless you enable memcached sasl in the PHP settings: add `memcached.use_sasl=1` to php.ini' , 'wp-ffpc') ?></strong></p></div> <div class="error"><p><strong><?php _e( 'WARNING: you\'ve entered username and/or password for memcached authentication ( or your browser\'s autocomplete did ) which will not work unless you enable memcached sasl in the PHP settings: add `memcached.use_sasl=1` to php.ini' , 'wp-ffpc') ?></strong></p></div>

View file

@ -3,10 +3,12 @@
Plugin Name: WP-FFPC Plugin Name: WP-FFPC
Plugin URI: https://github.com/petermolnar/wp-ffpc Plugin URI: https://github.com/petermolnar/wp-ffpc
Description: WordPress in-memory full page cache plugin Description: WordPress in-memory full page cache plugin
Version: 1.11.0 Version: 1.11.1
Author: Peter Molnar <hello@petermolnar.eu> Author: Peter Molnar <hello@petermolnar.eu>
Author URI: http://petermolnar.eu/ Author URI: http://petermolnar.eu/
License: GPLv3 License: GPLv3
Text Domain: wp-ffpc
Domain Path: /languages/
*/ */
/* Copyright 2010-2014 Peter Molnar ( hello@petermolnar.eu ) /* Copyright 2010-2014 Peter Molnar ( hello@petermolnar.eu )
@ -54,6 +56,8 @@ $wp_ffpc_defaults = array (
'nocache_page' => false, 'nocache_page' => false,
'nocache_cookies' => false, 'nocache_cookies' => false,
'nocache_dyn' => true, 'nocache_dyn' => true,
'nocache_woocommerce' => true,
'nocache_woocommerce_url' => '',
'nocache_url' => '^/wp-', 'nocache_url' => '^/wp-',
'nocache_comment' => '', 'nocache_comment' => '',
'response_header' => false, 'response_header' => false,