wordpress update
Este commit está contenido en:
@@ -173,6 +173,18 @@ $keys = array(
|
|||||||
'type' => 'boolean',
|
'type' => 'boolean',
|
||||||
'default' => true
|
'default' => true
|
||||||
),
|
),
|
||||||
|
'lazyload.googlemaps.google_maps_easy' => array(
|
||||||
|
'type' => 'boolean',
|
||||||
|
'default' => false
|
||||||
|
),
|
||||||
|
'lazyload.googlemaps.wp_google_maps' => array(
|
||||||
|
'type' => 'boolean',
|
||||||
|
'default' => false
|
||||||
|
),
|
||||||
|
'lazyload.googlemaps.wp_google_map_plugin' => array(
|
||||||
|
'type' => 'boolean',
|
||||||
|
'default' => false
|
||||||
|
),
|
||||||
'lazyload.exclude' => array(
|
'lazyload.exclude' => array(
|
||||||
'type' => 'array',
|
'type' => 'array',
|
||||||
'default' => array(
|
'default' => array(
|
||||||
@@ -223,7 +235,7 @@ $keys = array(
|
|||||||
),
|
),
|
||||||
'objectcache.enabled_for_wp_admin' => array(
|
'objectcache.enabled_for_wp_admin' => array(
|
||||||
'type' => 'boolean',
|
'type' => 'boolean',
|
||||||
'default' => true
|
'default' => false,
|
||||||
),
|
),
|
||||||
'objectcache.fallback_transients' => array(
|
'objectcache.fallback_transients' => array(
|
||||||
'type' => 'boolean',
|
'type' => 'boolean',
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ Util_Ui::config_item( array(
|
|||||||
),
|
),
|
||||||
) );
|
) );
|
||||||
|
|
||||||
|
$validate_timestamps = '';
|
||||||
Util_Ui::config_item( array(
|
Util_Ui::config_item( array(
|
||||||
'key' => 'opcache.validate_timestamps',
|
'key' => 'opcache.validate_timestamps',
|
||||||
'label' => 'Validate timestamps:',
|
'label' => 'Validate timestamps:',
|
||||||
@@ -37,8 +38,7 @@ Util_Ui::config_item( array(
|
|||||||
'disabled' => true,
|
'disabled' => true,
|
||||||
'value' => $validate_timestamps,
|
'value' => $validate_timestamps,
|
||||||
'checkbox_label' => __( 'Enable', 'w3-total-cache' ),
|
'checkbox_label' => __( 'Enable', 'w3-total-cache' ),
|
||||||
'description' => __( 'Once enabled, each file request will update the cache with the latest version.'
|
'description' => __( 'Once enabled, each file request will update the cache with the latest version. When this setting is off, the Opcode Cache will not check, instead PHP must be restarted in order for setting changes to be reflected.', 'w3-total-cache' )
|
||||||
. 'When this setting is off, the Opcode Cache will not check, instead PHP must be restarted in order for setting changes to be reflected.', 'w3-total-cache' )
|
|
||||||
) );
|
) );
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
namespace W3TC;
|
||||||
|
|
||||||
|
class UserExperience_LazyLoad_GoogleMaps_GoogleMapsEasy {
|
||||||
|
private $preload_url = '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function w3tc_lazyload_mutator_before( $data ) {
|
||||||
|
$buffer = $data['buffer'];
|
||||||
|
$buffer = preg_replace_callback(
|
||||||
|
'~(<script\s[^>]+>)~i',
|
||||||
|
array( $this, 'tag_script' ), $buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( !empty( $this->preload_url ) ) {
|
||||||
|
$preload_html = '<link rel="preload" href="' . esc_url( $this->preload_url ) . '" as="script">';
|
||||||
|
|
||||||
|
$buffer = preg_replace( '~<head(\s+[^>]*)*>~Ui',
|
||||||
|
'\\0' . $preload_html, $buffer, 1 );
|
||||||
|
|
||||||
|
add_filter( 'w3tc_lazyload_on_initialized_javascript', array(
|
||||||
|
$this, 'w3tc_lazyload_on_initialized_javascript' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['buffer'] = $buffer;
|
||||||
|
$data['modified'] |= !empty( $this->preload_url );
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function tag_script( $m ) {
|
||||||
|
$script_tag = $m[0];
|
||||||
|
if ( !preg_match( '~<script\s+[^<>]*src=["\']?([^"\'> ]+)["\'> ]~is',
|
||||||
|
$script_tag, $match ) ) {
|
||||||
|
return $script_tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
$script_src = $match[1];
|
||||||
|
$script_src = Util_Environment::url_relative_to_full( $script_src );
|
||||||
|
|
||||||
|
if ( !$this->starts_with( $script_src, WP_PLUGIN_URL . '/google-maps-easy/modules/gmap/js/frontend.gmap.js' ) ) {
|
||||||
|
return $script_tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->preload_url = $script_src;
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private function starts_with( $v, $prefix ) {
|
||||||
|
return substr( $v, 0, strlen( $prefix ) ) == $prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function w3tc_lazyload_on_initialized_javascript() {
|
||||||
|
return 'window.w3tc_lazyLazy_googlemaps_wpmaps = new LazyLoad({' .
|
||||||
|
'elements_selector: ".gmp_map_opts",'.
|
||||||
|
'callback_enter: function(e){' .
|
||||||
|
|
||||||
|
// w3tc_load_js function
|
||||||
|
'function w3tc_load_js(t,n){"use strict";var o=document.getElementsByTagName("script")[0],r=document.createElement("script");return r.src=t,r.async=!0,o.parentNode.insertBefore(r,o),n&&"function"==typeof n&&(r.onload=n),r};' .
|
||||||
|
|
||||||
|
'w3tc_load_js("' . esc_url( $this->preload_url ) . '");' .
|
||||||
|
'}});';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
namespace W3TC;
|
||||||
|
|
||||||
|
class UserExperience_LazyLoad_GoogleMaps_WPGoogleMapPlugin {
|
||||||
|
public function w3tc_lazyload_mutator_before( $data ) {
|
||||||
|
$buffer = $data['buffer'];
|
||||||
|
if (strpos( $buffer, '<script>jQuery(document).ready(function($) {var map' ) === false ) {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
$buffer = str_replace(
|
||||||
|
'<script>jQuery(document).ready(function($) {var map',
|
||||||
|
'<script>window.w3tc_wpgmp_load = (function($) {var map',
|
||||||
|
$buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
add_filter( 'w3tc_lazyload_on_initialized_javascript', array(
|
||||||
|
$this, 'w3tc_lazyload_on_initialized_javascript' ) );
|
||||||
|
|
||||||
|
$data['buffer'] = $buffer;
|
||||||
|
$data['modified'] = true;
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function w3tc_lazyload_on_initialized_javascript() {
|
||||||
|
return 'window.w3tc_lazyLazy_googlemaps_wpmapplugin = new LazyLoad({' .
|
||||||
|
'elements_selector: ".wpgmp_map_container",'.
|
||||||
|
'callback_enter: function(e){' .
|
||||||
|
'window.w3tc_wpgmp_load(jQuery)'.
|
||||||
|
'}});';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
namespace W3TC;
|
||||||
|
|
||||||
|
class UserExperience_LazyLoad_GoogleMaps_WPGoogleMaps {
|
||||||
|
private $preload_url = '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function w3tc_lazyload_mutator_before( $data ) {
|
||||||
|
$buffer = $data['buffer'];
|
||||||
|
$buffer = preg_replace_callback(
|
||||||
|
'~(<script\s[^>]+>)~i',
|
||||||
|
array( $this, 'tag_script' ), $buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( !empty( $this->preload_url ) ) {
|
||||||
|
$preload_html = '<link rel="preload" href="' . esc_url( $this->preload_url ) . '" as="script">';
|
||||||
|
|
||||||
|
$buffer = preg_replace( '~<head(\s+[^>]*)*>~Ui',
|
||||||
|
'\\0' . $preload_html, $buffer, 1 );
|
||||||
|
|
||||||
|
add_filter( 'w3tc_lazyload_on_initialized_javascript', array(
|
||||||
|
$this, 'w3tc_lazyload_on_initialized_javascript' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['buffer'] = $buffer;
|
||||||
|
$data['modified'] |= !empty( $this->preload_url );
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function tag_script( $m ) {
|
||||||
|
$script_tag = $m[0];
|
||||||
|
if ( !preg_match( '~<script\s+[^<>]*src=["\']?([^"\'> ]+)["\'> ]~is',
|
||||||
|
$script_tag, $match ) ) {
|
||||||
|
return $script_tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
$script_src = $match[1];
|
||||||
|
$script_src = Util_Environment::url_relative_to_full( $script_src );
|
||||||
|
|
||||||
|
if ( !$this->starts_with( $script_src, WP_PLUGIN_URL . '/wp-google-maps/js/wpgmaps.js' ) ) {
|
||||||
|
return $script_tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->preload_url = $script_src;
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private function starts_with( $v, $prefix ) {
|
||||||
|
return substr( $v, 0, strlen( $prefix ) ) == $prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function w3tc_lazyload_on_initialized_javascript() {
|
||||||
|
return 'window.w3tc_lazyLazy_googlemaps_wpmaps = new LazyLoad({' .
|
||||||
|
'elements_selector: "#wpgmza_map",'.
|
||||||
|
'callback_enter: function(e){' .
|
||||||
|
|
||||||
|
// w3tc_load_js function
|
||||||
|
'function w3tc_load_js(t,n){"use strict";var o=document.getElementsByTagName("script")[0],r=document.createElement("script");return r.src=t,r.async=!0,o.parentNode.insertBefore(r,o),n&&"function"==typeof n&&(r.onload=n),r};' .
|
||||||
|
|
||||||
|
// hack to allow initialize-on-load script pass
|
||||||
|
'MYMAP = {init: function() {},placeMarkers: function() {}};' .
|
||||||
|
|
||||||
|
'w3tc_load_js("' . esc_url( $this->preload_url ) . '", function() {InitMap()});' .
|
||||||
|
'}});';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,6 +20,13 @@ class UserExperience_LazyLoad_Mutator {
|
|||||||
$this->excludes = apply_filters( 'w3tc_lazyload_excludes',
|
$this->excludes = apply_filters( 'w3tc_lazyload_excludes',
|
||||||
$this->config->get_array( 'lazyload.exclude' ) );
|
$this->config->get_array( 'lazyload.exclude' ) );
|
||||||
|
|
||||||
|
$r = apply_filters( 'w3tc_lazyload_mutator_before', array(
|
||||||
|
'buffer' => $buffer,
|
||||||
|
'modified' => $this->modified
|
||||||
|
) );
|
||||||
|
$buffer = $r['buffer'];
|
||||||
|
$this->modified = $r['modified'];
|
||||||
|
|
||||||
$unmutable = new UserExperience_LazyLoad_Mutator_Unmutable();
|
$unmutable = new UserExperience_LazyLoad_Mutator_Unmutable();
|
||||||
$buffer = $unmutable->remove_unmutable( $buffer );
|
$buffer = $unmutable->remove_unmutable( $buffer );
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,14 @@ namespace W3TC;
|
|||||||
if ( !defined( 'W3TC' ) )
|
if ( !defined( 'W3TC' ) )
|
||||||
die();
|
die();
|
||||||
|
|
||||||
|
$c = Dispatcher::config();
|
||||||
|
$is_pro = Util_Environment::is_w3tc_pro( $c );
|
||||||
|
|
||||||
|
$plugins = get_option( 'active_plugins' );
|
||||||
|
$is_wp_google_maps = ( in_array( 'wp-google-maps/wpGoogleMaps.php', $plugins ) );
|
||||||
|
$is_wp_google_map_plugin = ( in_array( 'wp-google-map-plugin/wp-google-map-plugin.php', $plugins ) );
|
||||||
|
$is_google_maps_easy = ( in_array( 'google-maps-easy/gmp.php', $plugins ) );
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<?php Util_Ui::postbox_header( __( 'Lazy Loading', 'w3-total-cache' ), '', 'application' ); ?>
|
<?php Util_Ui::postbox_header( __( 'Lazy Loading', 'w3-total-cache' ), '', 'application' ); ?>
|
||||||
<table class="form-table">
|
<table class="form-table">
|
||||||
@@ -44,7 +52,49 @@ if ( !defined( 'W3TC' ) )
|
|||||||
'description' => 'Use <code>inline</code> method only when your website has just a few pages'
|
'description' => 'Use <code>inline</code> method only when your website has just a few pages'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
<tr>
|
||||||
|
<th>Google Maps</th>
|
||||||
|
<td>
|
||||||
|
<?php Util_Ui::pro_wrap_maybe_start(); ?>
|
||||||
|
<p class="description w3tc-gopro-excerpt" style="padding-bottom: 10px">Lazy load google map</p>
|
||||||
|
<div>
|
||||||
|
<?php
|
||||||
|
Util_Ui::control2( Util_Ui::config_item_preprocess( array(
|
||||||
|
'key' => 'lazyload.googlemaps.wp_google_map_plugin',
|
||||||
|
'control' => 'checkbox',
|
||||||
|
'disabled' => ( $is_pro ? !$is_wp_google_map_plugin : true ),
|
||||||
|
'checkbox_label' => __( '<a href="https://wordpress.org/plugins/wp-google-map-plugin/" target="_blank">WP Google Map Plugin</a> plugin', 'w3-total-cache' ),
|
||||||
|
'label_class' => 'w3tc_no_trtd'
|
||||||
|
) ) );
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<?php
|
||||||
|
Util_Ui::control2( Util_Ui::config_item_preprocess( array(
|
||||||
|
'key' => 'lazyload.googlemaps.google_maps_easy',
|
||||||
|
'control' => 'checkbox',
|
||||||
|
'disabled' => ( $is_pro ? !$is_google_maps_easy : true ),
|
||||||
|
'checkbox_label' => __( '<a href="https://wordpress.org/plugins/google-maps-easy/" target="_blank">Google Maps Easy</a> plugin', 'w3-total-cache' ),
|
||||||
|
'label_class' => 'w3tc_no_trtd'
|
||||||
|
) ) );
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<?php
|
||||||
|
Util_Ui::control2( Util_Ui::config_item_preprocess( array(
|
||||||
|
'key' => 'lazyload.googlemaps.wp_google_maps',
|
||||||
|
'control' => 'checkbox',
|
||||||
|
'disabled' => ( $is_pro ? !$is_wp_google_maps : true ),
|
||||||
|
'checkbox_label' => __( '<a href="https://wordpress.org/plugins/wp-google-maps/" target="_blank">WP Google Maps</a> plugin', 'w3-total-cache' ),
|
||||||
|
'label_class' => 'w3tc_no_trtd'
|
||||||
|
) ) );
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php Util_Ui::pro_wrap_maybe_end( 'lazyload_googlemaps' ); ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
<?php Util_Ui::button_config_save( 'lazyload' ); ?>
|
<?php Util_Ui::button_config_save( 'lazyload' ); ?>
|
||||||
|
|||||||
@@ -16,6 +16,25 @@ class UserExperience_LazyLoad_Plugin {
|
|||||||
Util_Bus::add_ob_callback( 'lazyload', array( $this, 'ob_callback' ) );
|
Util_Bus::add_ob_callback( 'lazyload', array( $this, 'ob_callback' ) );
|
||||||
$this->metaslider_hooks();
|
$this->metaslider_hooks();
|
||||||
|
|
||||||
|
if ( $this->config->get_boolean( 'lazyload.googlemaps.google_maps_easy' ) ) {
|
||||||
|
$p = new UserExperience_LazyLoad_GoogleMaps_GoogleMapsEasy();
|
||||||
|
|
||||||
|
add_filter( 'w3tc_lazyload_mutator_before',
|
||||||
|
array( $p, 'w3tc_lazyload_mutator_before' ) );
|
||||||
|
}
|
||||||
|
if ( $this->config->get_boolean( 'lazyload.googlemaps.wp_google_maps' ) ) {
|
||||||
|
add_filter( 'w3tc_lazyload_mutator_before', array(
|
||||||
|
new UserExperience_LazyLoad_GoogleMaps_WPGoogleMaps(),
|
||||||
|
'w3tc_lazyload_mutator_before'
|
||||||
|
) );
|
||||||
|
}
|
||||||
|
if ( $this->config->get_boolean( 'lazyload.googlemaps.wp_google_map_plugin' ) ) {
|
||||||
|
$p = new UserExperience_LazyLoad_GoogleMaps_WPGoogleMapPlugin();
|
||||||
|
|
||||||
|
add_filter( 'w3tc_lazyload_mutator_before',
|
||||||
|
array( $p, 'w3tc_lazyload_mutator_before' ) );
|
||||||
|
}
|
||||||
|
|
||||||
add_filter( 'wp_get_attachment_url',
|
add_filter( 'wp_get_attachment_url',
|
||||||
array( $this, 'wp_get_attachment_url' ), 10, 2 );
|
array( $this, 'wp_get_attachment_url' ), 10, 2 );
|
||||||
add_filter( 'w3tc_footer_comment',
|
add_filter( 'w3tc_footer_comment',
|
||||||
@@ -114,22 +133,36 @@ class UserExperience_LazyLoad_Plugin {
|
|||||||
$fireEvent = 'function(t){var e;try{e=new CustomEvent("w3tc_lazyload_loaded",{detail:{e:t}})}catch(a){(e=document.createEvent("CustomEvent")).initCustomEvent("w3tc_lazyload_loaded",!1,!1,{e:t})}window.dispatchEvent(e)}';
|
$fireEvent = 'function(t){var e;try{e=new CustomEvent("w3tc_lazyload_loaded",{detail:{e:t}})}catch(a){(e=document.createEvent("CustomEvent")).initCustomEvent("w3tc_lazyload_loaded",!1,!1,{e:t})}window.dispatchEvent(e)}';
|
||||||
$config = '{elements_selector:".lazy",callback_loaded:' . $fireEvent . '}';
|
$config = '{elements_selector:".lazy",callback_loaded:' . $fireEvent . '}';
|
||||||
|
|
||||||
|
$on_initialized_javascript = apply_filters( 'w3tc_lazyload_on_initialized_javascript', '' );
|
||||||
|
|
||||||
if ( $method == 'async_head' ) {
|
if ( $method == 'async_head' ) {
|
||||||
|
$on_initialized_javascript_wrapped = '';
|
||||||
|
if ( !empty( $on_initialized_javascript ) ) {
|
||||||
|
// LazyLoad::Initialized fired just before making LazyLoad global
|
||||||
|
// so next execution cycle have it
|
||||||
|
$on_initialized_javascript_wrapped =
|
||||||
|
'window.addEventListener("LazyLoad::Initialized", function(){' .
|
||||||
|
'setTimeout(function() {' .
|
||||||
|
$on_initialized_javascript .
|
||||||
|
'}, 1);' .
|
||||||
|
'});';
|
||||||
|
}
|
||||||
|
|
||||||
$embed_script =
|
$embed_script =
|
||||||
'<script>window.w3tc_lazyload=1,window.lazyLoadOptions=' . $config . '</script>' .
|
|
||||||
'<style>img.lazy{min-height:1px}</style>' .
|
'<style>img.lazy{min-height:1px}</style>' .
|
||||||
'<script async src="' . $js_url . '"></script>';
|
'<link rel="preload" href="' . esc_url( $js_url ) . '" as="script">';
|
||||||
|
|
||||||
$buffer = preg_replace( '~<head(\s+[^>]*)*>~Ui',
|
$buffer = preg_replace( '~<head(\s+[^>]*)*>~Ui',
|
||||||
'\\0' . $embed_script, $buffer, 1 );
|
'\\0' . $embed_script, $buffer, 1 );
|
||||||
|
|
||||||
// add protection to footer if async script executed too early
|
// load lazyload in footer to make sure DOM is ready at the moment of initialization
|
||||||
$footer_script =
|
$footer_script =
|
||||||
'<script>' .
|
'<script>' .
|
||||||
'document.addEventListener("DOMContentLoaded",function() {' .
|
$on_initialized_javascript_wrapped .
|
||||||
'if (typeof LazyLoad !== "undefined") {' .
|
'window.w3tc_lazyload=1,' .
|
||||||
'window.w3tc_lazyload=new LazyLoad(window.lazyLoadOptions)' .
|
'window.lazyLoadOptions=' . $config .
|
||||||
'}})</script>';
|
'</script>' .
|
||||||
|
'<script async src="' . esc_url( $js_url ) . '"></script>';
|
||||||
$buffer = preg_replace( '~</body(\s+[^>]*)*>~Ui',
|
$buffer = preg_replace( '~</body(\s+[^>]*)*>~Ui',
|
||||||
$footer_script . '\\0', $buffer, 1 );
|
$footer_script . '\\0', $buffer, 1 );
|
||||||
|
|
||||||
@@ -138,18 +171,23 @@ class UserExperience_LazyLoad_Plugin {
|
|||||||
'<style>img.lazy{min-height:1px}</style>' .
|
'<style>img.lazy{min-height:1px}</style>' .
|
||||||
'<script>' .
|
'<script>' .
|
||||||
file_get_contents( W3TC_DIR . '/pub/js/lazyload.min.js' ) .
|
file_get_contents( W3TC_DIR . '/pub/js/lazyload.min.js' ) .
|
||||||
'window.w3tc_lazyload=new LazyLoad(' . $config . ')</script>';
|
'window.w3tc_lazyload=new LazyLoad(' . $config . ');' .
|
||||||
|
$on_initialized_javascript .
|
||||||
|
'</script>';
|
||||||
$buffer = preg_replace( '~</body(\s+[^>]*)*>~Ui',
|
$buffer = preg_replace( '~</body(\s+[^>]*)*>~Ui',
|
||||||
$footer_script . '\\0', $buffer, 1 );
|
$footer_script . '\\0', $buffer, 1 );
|
||||||
} else { // 'sync_head'
|
} else { // 'sync_head'
|
||||||
$head_script =
|
$head_script =
|
||||||
'<style>img.lazy{min-height:1px}</style>' .
|
'<style>img.lazy{min-height:1px}</style>' .
|
||||||
'<script src="' . $js_url . '"></script>';
|
'<script src="' . esc_url( $js_url ) . '"></script>';
|
||||||
$buffer = preg_replace( '~<head(\s+[^>]*)*>~Ui',
|
$buffer = preg_replace( '~<head(\s+[^>]*)*>~Ui',
|
||||||
'\\0' . $head_script, $buffer, 1 );
|
'\\0' . $head_script, $buffer, 1 );
|
||||||
|
|
||||||
$footer_script =
|
$footer_script =
|
||||||
'<script>window.w3tc_lazyload=new LazyLoad(' . $config . ')</script>';
|
'<script>' .
|
||||||
|
'window.w3tc_lazyload=new LazyLoad(' . $config . ');' .
|
||||||
|
$on_initialized_javascript .
|
||||||
|
'</script>';
|
||||||
$buffer = preg_replace( '~</body(\s+[^>]*)*>~Ui',
|
$buffer = preg_replace( '~</body(\s+[^>]*)*>~Ui',
|
||||||
$footer_script . '\\0', $buffer, 1 );
|
$footer_script . '\\0', $buffer, 1 );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,11 +182,13 @@ class Util_Environment {
|
|||||||
$result = true;
|
$result = true;
|
||||||
} else {
|
} else {
|
||||||
$blog_data = Util_WpmuBlogmap::get_current_blog_data();
|
$blog_data = Util_WpmuBlogmap::get_current_blog_data();
|
||||||
if ( is_null( $blog_data ) )
|
if ( is_null( $blog_data ) ) {
|
||||||
$result = true;
|
$result = true;
|
||||||
|
} else {
|
||||||
$result = ( $blog_data[0] == 'm' );
|
$result = ( $blog_data[0] == 'm' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@@ -332,10 +334,11 @@ class Util_Environment {
|
|||||||
|
|
||||||
|
|
||||||
$blog_data = Util_WpmuBlogmap::get_current_blog_data();
|
$blog_data = Util_WpmuBlogmap::get_current_blog_data();
|
||||||
if ( !is_null( $blog_data ) )
|
if ( !is_null( $blog_data ) ) {
|
||||||
$w3_current_blog_id = substr( $blog_data, 1 );
|
$w3_current_blog_id = substr( $blog_data, 1 );
|
||||||
else
|
} else {
|
||||||
$w3_current_blog_id = 0;
|
$w3_current_blog_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return $w3_current_blog_id;
|
return $w3_current_blog_id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -791,7 +791,10 @@ class Util_Ui {
|
|||||||
echo $a['control_after'];
|
echo $a['control_after'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( isset( $a['description'] ) ) {
|
||||||
Util_Ui::pro_wrap_description( $a['excerpt'], $a['description'], $a['control_name'] );
|
Util_Ui::pro_wrap_description( $a['excerpt'], $a['description'], $a['control_name'] );
|
||||||
|
}
|
||||||
|
|
||||||
Util_Ui::pro_wrap_maybe_end( $a['control_name'] );
|
Util_Ui::pro_wrap_maybe_end( $a['control_name'] );
|
||||||
|
|
||||||
if ( $a['label_class'] != 'w3tc_no_trtd' ) {
|
if ( $a['label_class'] != 'w3tc_no_trtd' ) {
|
||||||
@@ -802,7 +805,7 @@ class Util_Ui {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static private function config_item_preprocess( $a ) {
|
static public function config_item_preprocess( $a ) {
|
||||||
$c = Dispatcher::config();
|
$c = Dispatcher::config();
|
||||||
|
|
||||||
if ( !isset( $a['value'] ) || is_null( $a['value'] ) ) {
|
if ( !isset( $a['value'] ) || is_null( $a['value'] ) ) {
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ Util_Ui::config_overloading_button( array(
|
|||||||
'key' => 'minify.configuration_overloaded'
|
'key' => 'minify.configuration_overloaded'
|
||||||
) );
|
) );
|
||||||
?>
|
?>
|
||||||
<p><?php w3tc_e( 'minify.general.header', 'Reduce load time by decreasing the size and number of <acronym title="Cascading Style Sheet">CSS</acronym> and <acronym title="JavaScript">JS</acronym> files. Automatically remove unncessary data from <acronym title="Cascading Style Sheet">CSS</acronym>, <acronym title="JavaScript">JS</acronym>, feed, page and post <acronym title="Hypertext Markup Language">HTML</acronym>.' ) ?></p>
|
<p><?php w3tc_e( 'minify.general.header', 'Reduce load time by decreasing the size and number of <acronym title="Cascading Style Sheet">CSS</acronym> and <acronym title="JavaScript">JS</acronym> files. Automatically remove unnecessary data from <acronym title="Cascading Style Sheet">CSS</acronym>, <acronym title="JavaScript">JS</acronym>, feed, page and post <acronym title="Hypertext Markup Language">HTML</acronym>.' ) ?></p>
|
||||||
|
|
||||||
<table class="form-table">
|
<table class="form-table">
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
La diferencia del archivo ha sido suprimido porque es demasiado grande
Cargar Diff
@@ -613,6 +613,9 @@ class Minify0_Minify {
|
|||||||
if ($type === self::TYPE_CSS && false !== strpos($content, '@import')) {
|
if ($type === self::TYPE_CSS && false !== strpos($content, '@import')) {
|
||||||
$content = self::_handleCssImports($content);
|
$content = self::_handleCssImports($content);
|
||||||
}
|
}
|
||||||
|
if ( $type === self::TYPE_CSS ) {
|
||||||
|
$content = apply_filters( 'w3tc_minify_css_content', $content, null, null );
|
||||||
|
}
|
||||||
|
|
||||||
// do any post-processing (esp. for editing build URIs)
|
// do any post-processing (esp. for editing build URIs)
|
||||||
if (self::$_options['postprocessorRequire']) {
|
if (self::$_options['postprocessorRequire']) {
|
||||||
|
|||||||
@@ -377,14 +377,14 @@ class Minify_CSS_UriRewriter {
|
|||||||
}
|
}
|
||||||
// analyze URI
|
// analyze URI
|
||||||
if ( !empty($uri)
|
if ( !empty($uri)
|
||||||
&& '/' !== substr($uri, 0, 1) // root-relative
|
&& '/' !== substr($uri, 0, 1) // Root-relative (/) and protocol/non-data (//).
|
||||||
&& false === strpos($uri, '//') // protocol (non-data)
|
&& 'data:' !== substr( $uri, 0, 5 ) // Data protocol.
|
||||||
&& 0 !== strpos($uri, 'data:') // data protocol
|
&& '%' !== substr( $uri, 0, 1 ) // URL-encoded entity.
|
||||||
|
&& '#' !== substr( $uri, 0, 1 ) // URL fragment.
|
||||||
) {
|
) {
|
||||||
// URI is file-relative: rewrite depending on options
|
// URI is file-relative: rewrite depending on options
|
||||||
if (self::$_prependPath === null) {
|
if (self::$_prependPath === null) {
|
||||||
$uri = self::rewriteRelative($uri, self::$_currentDir, self::$_docRoot, self::$_symlinks);
|
$uri = self::rewriteRelative($uri, self::$_currentDir, self::$_docRoot, self::$_symlinks);
|
||||||
|
|
||||||
if (self::$_prependAbsolutePath) {
|
if (self::$_prependAbsolutePath) {
|
||||||
$prependAbsolutePath = self::$_prependAbsolutePath;
|
$prependAbsolutePath = self::$_prependAbsolutePath;
|
||||||
} elseif (self::$_prependAbsolutePathCallback) {
|
} elseif (self::$_prependAbsolutePathCallback) {
|
||||||
|
|||||||
@@ -142,11 +142,11 @@ class Minify_HTML {
|
|||||||
.'|canvas|caption|center|col(?:group)?|dd|dir|div|dl|dt|fieldset|figcaption|figure|footer|form'
|
.'|canvas|caption|center|col(?:group)?|dd|dir|div|dl|dt|fieldset|figcaption|figure|footer|form'
|
||||||
.'|frame(?:set)?|h[1-6]|head|header|hgroup|hr|html|legend|li|link|main|map|menu|meta|nav'
|
.'|frame(?:set)?|h[1-6]|head|header|hgroup|hr|html|legend|li|link|main|map|menu|meta|nav'
|
||||||
.'|ol|opt(?:group|ion)|output|p|param|section|t(?:able|body|head|d|h||r|foot|itle)'
|
.'|ol|opt(?:group|ion)|output|p|param|section|t(?:able|body|head|d|h||r|foot|itle)'
|
||||||
.'|ul|video)\\b[^>]*>)/iu', '$1', $this->_html);
|
.'|ul|video)\\b[^>]*>)/i', '$1', $this->_html);
|
||||||
|
|
||||||
// remove whitespaces outside of all elements
|
// remove whitespaces outside of all elements
|
||||||
$this->_html = preg_replace(
|
$this->_html = preg_replace(
|
||||||
'/>((\\s)(?:\\s*))?([^<]+?)((\\s)(?:\\s*))?</u'
|
'/>((\\s)(?:\\s*))?([^<]+?)((\\s)(?:\\s*))?</'
|
||||||
,'>$2$3$5<'
|
,'>$2$3$5<'
|
||||||
,$this->_html);
|
,$this->_html);
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ Contributors: boldgrid, fredericktownes, maxicusc, gidomanders, bwmarkle, harryj
|
|||||||
Tags: seo, cache, optimize, pagespeed, performance, caching, compression, maxcdn, nginx, varnish, redis, new relic, aws, amazon web services, s3, cloudfront, rackspace, cloudflare, azure, apache
|
Tags: seo, cache, optimize, pagespeed, performance, caching, compression, maxcdn, nginx, varnish, redis, new relic, aws, amazon web services, s3, cloudfront, rackspace, cloudflare, azure, apache
|
||||||
Requires at least: 3.2
|
Requires at least: 3.2
|
||||||
Tested up to: 5.4
|
Tested up to: 5.4
|
||||||
Stable tag: 0.13.3
|
Stable tag: 0.14.0
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
|
||||||
@@ -275,6 +275,15 @@ Please reach out to all of these people and support their projects if you're so
|
|||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 0.14.0 =
|
||||||
|
* Added lazy loading for Google Maps
|
||||||
|
* Added a filter w3tc_minify_css_content for minified contents
|
||||||
|
* Fixed a minify regex issue in non-Unicode websites
|
||||||
|
* Fixed a PHP notice in WPMU: accessing array offset on null
|
||||||
|
* Fixed a minify issue where embedded CSS URL fragments were converted incorrectly
|
||||||
|
* i18n improvement
|
||||||
|
* Changed default to disabled for wp-admin requests in the object cache
|
||||||
|
|
||||||
= 0.13.3 =
|
= 0.13.3 =
|
||||||
* Fixed HTML minification of img elements containing embedded SVG strings
|
* Fixed HTML minification of img elements containing embedded SVG strings
|
||||||
* Removed an identifying value for GDPR
|
* Removed an identifying value for GDPR
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ if ( !defined( 'ABSPATH' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
define( 'W3TC', true );
|
define( 'W3TC', true );
|
||||||
define( 'W3TC_VERSION', '0.13.3' );
|
define( 'W3TC_VERSION', '0.14.0' );
|
||||||
define( 'W3TC_POWERED_BY', 'W3 Total Cache' );
|
define( 'W3TC_POWERED_BY', 'W3 Total Cache' );
|
||||||
define( 'W3TC_EMAIL', 'w3tc@w3-edge.com' );
|
define( 'W3TC_EMAIL', 'w3tc@w3-edge.com' );
|
||||||
define( 'W3TC_TEXT_DOMAIN', 'w3-total-cache' );
|
define( 'W3TC_TEXT_DOMAIN', 'w3-total-cache' );
|
||||||
@@ -601,6 +601,7 @@ function w3tc_e( $key, $default_value ) {
|
|||||||
|
|
||||||
|
|
||||||
function w3tc_er( $key, $default_value ) {
|
function w3tc_er( $key, $default_value ) {
|
||||||
|
$default_value = __( $default_value , 'w3-total-cache' );
|
||||||
$v = get_site_option( 'w3tc_generic_widgetservices' );
|
$v = get_site_option( 'w3tc_generic_widgetservices' );
|
||||||
try {
|
try {
|
||||||
$v = json_decode( $v, true );
|
$v = json_decode( $v, true );
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
Plugin Name: W3 Total Cache
|
Plugin Name: W3 Total Cache
|
||||||
Description: The highest rated and most complete WordPress performance plugin. Dramatically improve the speed and user experience of your site. Add browser, page, object and database caching as well as minify and content delivery network (CDN) to WordPress.
|
Description: The highest rated and most complete WordPress performance plugin. Dramatically improve the speed and user experience of your site. Add browser, page, object and database caching as well as minify and content delivery network (CDN) to WordPress.
|
||||||
Version: 0.13.3
|
Version: 0.14.0
|
||||||
Plugin URI: https://www.boldgrid.com/totalcache/
|
Plugin URI: https://www.boldgrid.com/totalcache/
|
||||||
Author: BoldGrid
|
Author: BoldGrid
|
||||||
Author URI: https://www.boldgrid.com/
|
Author URI: https://www.boldgrid.com/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php exit; ?>{
|
<?php exit; ?>{
|
||||||
"version": "0.13.3",
|
"version": "0.14.0",
|
||||||
"cluster.messagebus.debug": false,
|
"cluster.messagebus.debug": false,
|
||||||
"cluster.messagebus.enabled": false,
|
"cluster.messagebus.enabled": false,
|
||||||
"cluster.messagebus.sns.region": "",
|
"cluster.messagebus.sns.region": "",
|
||||||
@@ -61,6 +61,9 @@
|
|||||||
"lazyload.enabled": true,
|
"lazyload.enabled": true,
|
||||||
"lazyload.process_img": true,
|
"lazyload.process_img": true,
|
||||||
"lazyload.process_background": true,
|
"lazyload.process_background": true,
|
||||||
|
"lazyload.googlemaps.google_maps_easy": false,
|
||||||
|
"lazyload.googlemaps.wp_google_maps": false,
|
||||||
|
"lazyload.googlemaps.wp_google_map_plugin": false,
|
||||||
"lazyload.exclude": [
|
"lazyload.exclude": [
|
||||||
"avia-bg-style-fixed",
|
"avia-bg-style-fixed",
|
||||||
"data-bgposition=",
|
"data-bgposition=",
|
||||||
@@ -893,5 +896,9 @@
|
|||||||
"plugin.type": "",
|
"plugin.type": "",
|
||||||
"fragmentcache": {
|
"fragmentcache": {
|
||||||
"engine": ""
|
"engine": ""
|
||||||
|
},
|
||||||
|
"pgcache.bad_behavior_path": "",
|
||||||
|
"newrelic": {
|
||||||
|
"monitoring_type": "apm"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Referencia en una nueva incidencia
Block a user