removed sync protocols; added server ip to HTML debug comment

This commit is contained in:
Peter Molnar 2013-06-28 10:24:52 +01:00
parent 50e13c227e
commit 381687b8bf
4 changed files with 2 additions and 27 deletions

View file

@ -106,6 +106,7 @@ What's fixed:
**Dropped functions**
* there's no info log on/off anymore, it's triggered when WP_DEBUG is active
* sync protocols has been removed for two reasons: this has to be done by other systems and causes issues in special cases
**For Devs**

View file

@ -289,30 +289,13 @@ function wp_ffpc_callback( $buffer ) {
if ( get_option ( 'default_ping_status' ) == 'open' )
$meta['pingback'] = get_bloginfo('pingback_url');
/* sync all http and https requests if enabled */
if ( isset( $config['sync_protocols'] ) && $config['sync_protocols'] == '1' ) {
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' )
$_SERVER['HTTPS'] = 'on';
if ( isset($_SERVER['HTTPS']) && ( ( strtolower($_SERVER['HTTPS']) == 'on' ) || ( $_SERVER['HTTPS'] == '1' ) ) ) {
$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 );
}
/* add generation info is option is set, but only to HTML */
if ( $wp_ffpc_config['generate_time'] == '1' && stripos($buffer, '</body>') ) {
global $wp_ffpc_gentime;
$mtime = explode ( " ", microtime() );
$wp_ffpc_gentime = ( $mtime[1] + $mtime[0] )- $wp_ffpc_gentime;
$insertion = "\n<!-- \nWP-FFPC \n\tcache engine: ". $wp_ffpc_config['cache_type'] ."\n\tpage generation time: ". round( $wp_ffpc_gentime, 3 ) ." seconds\n\tgeneraton UNIX timestamp: ". time() . "\n\tgeneraton date: ". date( 'c' ) . "\n-->\n";
$insertion = "\n<!-- \nWP-FFPC \n\tcache engine: ". $wp_ffpc_config['cache_type'] ."\n\tpage generation time: ". round( $wp_ffpc_gentime, 3 ) ." seconds\n\tgeneraton UNIX timestamp: ". time() . "\n\tgeneraton date: ". date( 'c' ) . "\n\tserver: ". $_SERVER['SERVER_ADDR'] . "\n-->\n";
$index = stripos( $buffer , '</body>' );
$buffer = substr_replace( $buffer, $insertion, $index, 0);

View file

@ -533,14 +533,6 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
<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 protocols", $this->plugin_constant); ?></label>
</dt>
<dd>
<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', $this->plugin_constant); ?></span>
</dd>
</dl>
</fieldset>

View file

@ -43,7 +43,6 @@ $wp_ffpc_defaults = array (
'nocache_single' => false,
'nocache_page' => false,
'nocache_cookies' => false,
'sync_protocols' => false,
'persistent' => false,
'response_header' => false,
'generate_time' => false,