ui tabs; sync protocols; bugfix git-svn-id: http://plugins.svn.wordpress.org/wp-ffpc/trunk@676435 b8457f37-d9ea-0310-8a92-e5e31aec5664
@@ -257,17 +257,20 @@
/* sync all http and https requests if enabled */ if ( !empty($wp_ffpc_config['sync_protocols']) ) { - $sync_from = 'https://' . $_SERVER['SERVER_NAME']; - $sync_to = 'http://' . $_SERVER['SERVER_NAME']; - if ( !empty( $_SERVER['HTTPS'] ) ) { $sync_from = 'http://' . $_SERVER['SERVER_NAME']; $sync_to = 'https://' . $_SERVER['SERVER_NAME']; } + else + { + $sync_from = 'https://' . $_SERVER['SERVER_NAME']; + $sync_to = 'http://' . $_SERVER['SERVER_NAME']; + } + $buffer = str_replace ( $sync_from, $sync_to, $buffer ); } - + /* set meta */ wp_ffpc_set ( $wp_ffpc_meta_key, $wp_ffpc_meta );@@ -286,7 +289,7 @@ wp_ffpc_set ( $wp_ffpc_data_key, $buffer, $compress );
/* vital for nginx, make no problem at other places */ header("HTTP/1.1 200 OK"); - + /* echoes HTML out */ return $buffer; }
@@ -17,7 +17,7 @@ font-weight:bold;
padding:0; margin:0; font-size:130%; - padding-top:3em; + padding-top:0em; } .default {@@ -51,3 +51,25 @@
.ok-msg { color: #009900; } + +.ui-tabs-nav { + list-style-type: none; +} + +.ui-tabs-nav a { + outline: 0; + text-decoration: none; + font-size: 120%; +} + + +.ui-state-default { + display: inline-block; + width: auto; + padding: 0.5em 2em 0.5em 2em; +} + +.ui-tabs-selected, +.ui-state-active { + background-color: #ccc; +}
@@ -9,7 +9,7 @@
Fast Full Page Cache, backend can be memcached or APC == Description == -WP-FFPC is a full page cache plugin for WordPress. It can use APC or a memcached server as backend. +WP-FFPC is a full page cache plugin for WordPress. It can use APC or a memcached server as backend. The naming stands for Fast Full Page Cache. PHP has two extension for communication with a memcached server, named Memcache and Memcached. The plugin can utilize both, however, the recommended is memcached.@@ -42,7 +42,8 @@ == Installation ==
1. Upload contents of `wp-ffpc.zip` to the `/wp-content/plugins/` directory 2. Enable WordPress cache by adding `define('WP_CACHE',true);` in wp-config.php 3. Activate the plugin through the `Plugins` menu in WordPress (please use network wide activation if used in a WordPress Network) -4. Fine tune the settings in `Settings` -> `wp-ffpc` menu in WordPress. For WordPress Network, please visit the Network Admin panel, the options will be available at WP-FFPC menu entry. +4. Fine tune the settings in `Settings` -> `wp-ffpc` menu in WordPress. +For WordPress Network, please visit the Network Admin panel, the options will be available under Network Admin Settings page, in WP-FFPC menu entry. == Frequently Asked Questions ==@@ -55,6 +56,13 @@ You have to remove the default yum package, named `php-pecl-memcache` and install `Memcache` with PECL.
== Changelog == += 0.5 = +2013.03.04 + +* long-running %3C really fixed ( version 0.4.3 was dead end ) by the help of Mark Costlow <cheeks@swcp.com> +* UI cleanup + tabs +* WP-FFPC options moved from global under Settings ( of either network or site ) + = 0.4.3 = 2013.03.03@@ -75,9 +83,6 @@ = 0.4.1 =
2012.08.16 * storage key extended with scheme ( http; https; etc. ), the miss caused problems when https request server CSS and JS files via http. - -KNOWN ISSUES - = 0.4 = 2012.08.06
@@ -83,11 +83,14 @@
/* status, 0 = nothing happened*/ var $status = 0; + var $network = false; + /** * constructor * */ function __construct() { + $this->check_for_network(); /* register options */ $this->get_options();@@ -115,6 +118,10 @@ /* add admin styling */
if( is_admin() ) { wp_enqueue_style( WP_FFPC_PARAM . '.admin.css' , WP_FFPC_URL . '/css/'. WP_FFPC_PARAM .'.admin.css', false, '0.1'); + //wp_enqueue_script("jquery-ui-g","https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js"); + //wp_enqueue_script ( "jquery"); + //wp_enqueue_script ( "jquery-ui-core"); + wp_enqueue_script ( "jquery-ui-tabs" ); } /* on activation */@@ -126,9 +133,10 @@
/* on uninstall */ register_uninstall_hook(__FILE__ , array( $this , 'uninstall') ); + /* init plugin in the admin section */ /* if multisite, admin page will be on network admin section */ - if ( MULTISITE ) + if ( $this->network ) add_action('network_admin_menu', array( $this , 'admin_init') ); /* not network, will be in simple admin menu */ else@@ -159,7 +167,8 @@ $this->status = 1;
header("Location: admin.php?page=" . WP_FFPC_OPTIONS_PAGE . "&saved=true"); } - add_menu_page('Edit WP-FFPC options', __('WP-FFPC', WP_FFPC_PARAM ), 10, WP_FFPC_OPTIONS_PAGE , array ( $this , 'admin_panel' ) ); + add_submenu_page('settings.php', 'Edit WP-FFPC options', __('WP-FFPC', WP_FFPC_PARAM ), 10, WP_FFPC_OPTIONS_PAGE , array ( $this , 'admin_panel' ) ); + //add_menu_page('Edit WP-FFPC options', __('WP-FFPC', WP_FFPC_PARAM ), 10, WP_FFPC_OPTIONS_PAGE , array ( $this , 'admin_panel' ) ); } /**@@ -187,6 +196,12 @@ * the admin panel itself
*/ ?> + <script> + jQuery(document).ready(function($) { + jQuery( "#wp-ffpc-settings" ).tabs(); + }); + </script> + <div class="wrap"> <?php if ( !WP_CACHE ) : ?>@@ -219,13 +234,20 @@ </strong></p></div>
<?php endif; ?> <h2><?php _e( 'WP-FFPC settings', WP_FFPC_PARAM ) ; ?></h2> - <form method="post" action="#"> + <form method="post" action="#" id="wp-ffpc-settings"> + + <ul> + <li><a href="#wp-ffpc-type"><?php _e( 'Cache type', WP_FFPC_PARAM ); ?></a></li> + <li><a href="#wp-ffpc-debug"><?php _e( 'Debug & in-depth', WP_FFPC_PARAM ); ?></a></li> + <li><a href="#wp-ffpc-exceptions"><?php _e( 'Cache exceptions', WP_FFPC_PARAM ); ?></a></li> + <li><a href="#wp-ffpc-apc"><?php _e( 'APC', WP_FFPC_PARAM ); ?></a></li> + <li><a href="#wp-ffpc-memcached"><?php _e( 'Memcache(d)', WP_FFPC_PARAM ); ?></a></li> + <li><a href="#wp-ffpc-nginx"><?php _e( 'nginx', WP_FFPC_PARAM ); ?></a></li> + </ul> - <fieldset> - <legend><?php _e( 'Global settings', WP_FFPC_PARAM ); ?></legend> + <fieldset id="wp-ffpc-type"> + <legend><?php _e( 'Set cache type', WP_FFPC_PARAM ); ?></legend> <dl> - <div class="grid50"> - <dt> <label for="cache_type"><?php _e('Select backend', WP_FFPC_PARAM); ?></label> </dt>@@ -283,7 +305,12 @@ <input type="text" name="prefix_meta" id="prefix_meta" value="<?php echo $this->options['prefix_meta']; ?>" />
<span class="description"><?php _e('Prefix for meta content keys, used only with PHP processing.', WP_FFPC_PARAM); ?></span> <span class="default"><?php _e('Default ', WP_FFPC_PARAM); ?>: <?php echo $this->defaults['prefix_meta']; ?></span> </dd> + </dl> + </fieldset> + <fieldset id="wp-ffpc-debug"> + <legend><?php _e( 'Debug & in-depth settings', WP_FFPC_PARAM ); ?></legend> + <dl> <dt> <label for="debug"><?php _e("Enable debug mode", WP_FFPC_PARAM); ?></label> </dt>@@ -319,10 +346,12 @@ <input type="checkbox" name="sync_protocols" id="sync_protocols" value="1" <?php checked($this->options['sync_protocols'],true); ?> />
<span class="description"><?php _e('Enable to replace every protocol to the same as in the request for site\'s domain', WP_FFPC_PARAM); ?></span> <span class="default"><?php _e('Default ', WP_FFPC_PARAM); ?>: <?php $this->print_bool( $this->defaults['sync_protocols']); ?></span> </dd> + </dl> + </fieldset> - </div> - - <div class="grid50"> + <fieldset id="wp-ffpc-exceptions"> + <legend><?php _e( 'Set cache excepions', WP_FFPC_PARAM ); ?></legend> + <dl> <dt> <label for="cache_loggedin"><?php _e('Enable cache for logged in users', WP_FFPC_PARAM); ?></label> </dt>@@ -376,15 +405,28 @@ <input type="checkbox" name="nocache_page" id="nocache_page" value="1" <?php checked($this->options['nocache_page'],true); ?> />
<span class="description"><?php _e('Exclude pages from caching.', WP_FFPC_PARAM); ?></span> <span class="default"><?php _e('Default ', WP_FFPC_PARAM); ?>: <?php $this->print_bool( $this->defaults['nocache_page']); ?></span> </dd> - </div> + </dl> + </fieldset> + + <fieldset id="wp-ffpc-apc"> + <legend><?php _e('Settings for APC', WP_FFPC_PARAM); ?></legend> + <dl> + + <dt> + <label for="apc_compress"><?php _e("Compress entries", WP_FFPC_PARAM); ?></label> + </dt> + <dd> + <input type="checkbox" name="apc_compress" id="apc_compress" value="1" <?php checked($this->options['apc_compress'],true); ?> /> + <span class="description"><?php _e('Try to compress APC entries. Requires PHP ZLIB.', WP_FFPC_PARAM); ?></span> + <span class="default"><?php _e('Default ', WP_FFPC_PARAM); ?>: <?php $this->print_bool( $this->defaults['apc_compress']); ?></span> + </dd> + </dl> </fieldset> - <fieldset class="grid50"> + <fieldset id="wp-ffpc-memcached"> <legend><?php _e('Settings for memcached backend', WP_FFPC_PARAM); ?></legend> - <dl> - <dt> <label for="host"><?php _e('Host', WP_FFPC_PARAM); ?></label> </dt>@@ -402,30 +444,10 @@ <input type="number" name="port" id="port" value="<?php echo $this->options['port']; ?>" />
<span class="description"><?php _e('Port for memcached server', WP_FFPC_PARAM); ?></span> <span class="default"><?php _e('Default ', WP_FFPC_PARAM); ?>: <?php echo $this->defaults['port']; ?></span> </dd> - </dl> </fieldset> - <fieldset class="grid50"> - <legend><?php _e('Settings for APC', WP_FFPC_PARAM); ?></legend> - <dl> - - <dt> - <label for="apc_compress"><?php _e("Compress entries", WP_FFPC_PARAM); ?></label> - </dt> - <dd> - <input type="checkbox" name="apc_compress" id="apc_compress" value="1" <?php checked($this->options['apc_compress'],true); ?> /> - <span class="description"><?php _e('Try to compress APC entries. Requires PHP ZLIB.', WP_FFPC_PARAM); ?></span> - <span class="default"><?php _e('Default ', WP_FFPC_PARAM); ?>: <?php $this->print_bool( $this->defaults['apc_compress']); ?></span> - </dd> - - </dl> - </fieldset> - - - <?php if ( $this->options['cache_type'] == 'memcache' || $this->options['cache_type'] == 'memcached' ) : ?> - - <fieldset> + <fieldset id="wp-ffpc-nginx"> <legend><?php _e('Sample config for nginx to utilize the data entries', WP_FFPC_PARAM); ?></legend> <?php $search = array( 'DATAPREFIX', 'MEMCACHEDHOST', 'MEMCACHEDPORT');@@ -436,8 +458,6 @@
?> <pre><?php echo $nginx; ?></pre> </fieldset> - - <?php endif; ?> <p class="clearcolumns"><input class="button-primary" type="submit" name="<?php echo WP_FFPC_PARAM; ?>-save" id="<?php echo WP_FFPC_PARAM; ?>-save" value="Save Changes" /></p> </form>@@ -469,6 +489,19 @@ );
$this->print_select_options ( $e , $current , $returntext ); + } + + /** + * see if we are using network-wide setup or not + * + */ + function check_for_network( ) { + if ( is_multisite() ) { + $plugins = get_site_option( 'active_sitewide_plugins'); + if ( isset($plugins['wp-ffpc/wp-ffpc.php']) ) { + $this->network = true; + } + } } /**@@ -648,7 +681,7 @@ $update = $_POST[$name];
if (strlen($update)!=0 && !is_numeric($update)) $update = stripslashes($update); } - elseif ( ( empty($_POST[$name]) && is_bool ($this->defaults[$name]) ) || is_int( $update ) ) + elseif ( ( empty($_POST[$name]) && is_bool ($this->defaults[$name]) ) || is_int( $this->defaults[$name] ) ) { $update = 0; }