PluginProbe ʕ •ᴥ•ʔ
Aruba HiSpeed Cache / 3.0.15
Aruba HiSpeed Cache v3.0.15
3.0.15 3.0.14 3.0.13 1.2.4 1.2.5 1.2.6 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.16 2.0.17 2.0.18 2.0.19 2.0.20 2.0.21 2.0.22 2.0.23 2.0.24 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3
aruba-hispeed-cache / src / AHSC_HtmlOptimizer.php
aruba-hispeed-cache / src Last commit date
APC 3 days ago Events 3 days ago Purger 3 days ago assets 3 days ago AHSC_Apc.php 3 days ago AHSC_Check.php 3 days ago AHSC_Config.php 3 days ago AHSC_Dboptimization.php 3 days ago AHSC_Functions.php 3 days ago AHSC_HtmlOptimizer.php 5 months ago AHSC_Lazyload.php 3 days ago AHSC_Preconnect.php 5 months ago AHSC_Static.php 4 months ago AHSC_Version.php 5 months ago AHSC_Warmer.php 3 days ago AHSC_XmlRPC.php 5 months ago index.php 5 months ago
AHSC_HtmlOptimizer.php
31 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit;
3
4 if ( isset( AHSC_CONSTANT['ARUBA_HISPEED_CACHE_OPTIONS']['ahsc_html_optimizer'] ) &&
5 AHSC_CONSTANT['ARUBA_HISPEED_CACHE_OPTIONS']['ahsc_html_optimizer'] ) {
6
7 add_action('template_redirect', 'ahsc_output_buffer_start');
8
9 }
10
11 function ahsc_output_buffer_start() {
12 if(!is_admin()) {
13 if(!is_customize_preview()) {
14 ob_start( "ahsc_minify_html_fast" );
15 }
16 }
17
18 }
19
20 function ahsc_minify_html_fast($html) {
21 $html = (string) $html;
22
23 $html = trim(preg_replace_callback(
24 '#<(script|style|pre|textarea)\b[^>]*>.*?</\1>(*SKIP)(*F)|\s{2,}|>\s+|\s+<#is',
25 fn($m) => preg_match('/^>\s+$/', $m[0]) ? '>' :
26 (preg_match('/^\s+</', $m[0]) ? '<' : ' '),
27 $html
28 ));
29
30 return trim($html);
31 }