HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.2.34
System: Linux atalantini.com 3.10.0-1127.13.1.el7.x86_64 #1 SMP Tue Jun 23 15:46:38 UTC 2020 x86_64
User: root (0)
PHP: 7.2.34
Disabled: NONE
Upload Files
File: //opt/plugins/w3-total-cache/UserExperience_LazyLoad_GoogleMaps_WPGoogleMapPlugin.php
<?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)'.
			'}});';
	}
}