` tags in the buffer to determine if a specific * script (e.g., wp-google-maps JavaScript) needs to be preloaded. If a preload URL is set, it * injects a `` tag for preloading the script. * * @param array $data { * Array of data passed to the mutator. * * @type string $buffer The HTML buffer to modify. * @type bool $modified Whether the buffer has been modified. * } * * @return array Modified data with updated buffer and modified flag. */ public function w3tc_lazyload_mutator_before( $data ) { $buffer = $data['buffer']; $buffer = preg_replace_callback( '~(]+>)~i', array( $this, 'tag_script' ), $buffer ); if ( ! empty( $this->preload_url ) ) { $preload_html = ''; $buffer = preg_replace( '~]*)*>~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; } /** * Callback function to process `