PluginProbe ʕ •ᴥ•ʔ
Aruba HiSpeed Cache / 2.0.13
Aruba HiSpeed Cache v2.0.13
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_Static.php
aruba-hispeed-cache / src Last commit date
Events 2 years ago Purger 2 years ago AHSC_Check.php 1 year ago AHSC_Config.php 1 year ago AHSC_Functions.php 1 year ago AHSC_Static.php 1 year ago AHSC_Version.php 2 years ago AHSC_Warmer.php 2 years ago index.php 2 years ago
AHSC_Static.php
124 lines
1 <?php
2 if(array_key_exists('ahsc_static_cache',AHSC_CONSTANT['ARUBA_HISPEED_CACHE_OPTIONS'])){
3 if(isset(AHSC_CONSTANT['ARUBA_HISPEED_CACHE_OPTIONS']['ahsc_static_cache'])){
4 if(AHSC_CONSTANT['ARUBA_HISPEED_CACHE_OPTIONS']['ahsc_static_cache']){
5 add_action( 'admin_init', 'AHSC_edit_htaccess' );
6 }else{
7 add_action( 'admin_init', 'AHSC_remove_htaccess' );
8 }
9 }
10 }
11 $AHSC_marker='AHSC_RULES';
12
13 $AHSC_rules=array(
14 '<IfModule mod_expires.c>',
15 'ExpiresActive on',
16 'ExpiresDefault "access plus 1 month"',
17 '# CSS',
18 'ExpiresByType text/css "access plus 1 year"',
19 '# Data interchange',
20 'ExpiresByType application/json "access plus 0 seconds"',
21 'ExpiresByType application/xml "access plus 0 seconds"',
22 'ExpiresByType text/xml "access plus 0 seconds"',
23 '# Favicon (cannot be renamed!)',
24 'ExpiresByType image/x-icon "access plus 1 week"',
25 '# HTML components (HTCs)',
26 'ExpiresByType text/x-component "access plus 1 month"',
27 //'# HTML',
28 //'ExpiresByType text/html "access plus 0 seconds"',
29 '# JavaScript',
30 'ExpiresByType application/javascript "access plus 1 year"',
31 '# Manifest files',
32 'ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"',
33 'ExpiresByType text/cache-manifest "access plus 0 seconds"',
34 '# Media',
35 'ExpiresByType audio/ogg "access plus 1 month"',
36 'ExpiresByType image/gif "access plus 1 month"',
37 'ExpiresByType image/jpeg "access plus 1 month"',
38 'ExpiresByType image/png "access plus 1 month"',
39 'ExpiresByType image/webp "access plus 1 month"',
40 'ExpiresByType video/mp4 "access plus 1 month"',
41 'ExpiresByType video/ogg "access plus 1 month"',
42 'ExpiresByType video/webm "access plus 1 month"',
43 '# Web feeds',
44 'ExpiresByType application/atom+xml "access plus 1 hour"',
45 'ExpiresByType application/rss+xml "access plus 1 hour"',
46 '# Web fonts',
47 'ExpiresByType application/font-woff2 "access plus 1 month"',
48 'ExpiresByType application/font-woff "access plus 1 month"',
49 'ExpiresByType application/vnd.ms-fontobject "access plus 1 month"',
50 'ExpiresByType application/x-font-ttf "access plus 1 month"',
51 'ExpiresByType font/opentype "access plus 1 month"',
52 'ExpiresByType image/svg+xml "access plus 1 month"',
53 '</IfModule>',
54 '# Set the cache-control max-age',
55 '# 1 year',
56 '<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|webp|woff2|woff|ttf)$">',
57 'Header set Cache-Control "max-age=31449600, public"',
58 '</FilesMatch>',
59 '# 2 DAYS',
60 '<FilesMatch ".(xml|txt)$">',
61 'Header set Cache-Control "max-age=172800, public, must-revalidate"',
62 '</FilesMatch>',
63 '# 4 HOURS',
64 '<FilesMatch ".(html|htm)$">',
65 'Header set Cache-Control "max-age=14400, must-revalidate"',
66 '</FilesMatch>',
67 '<IfModule mod_deflate.c>',
68 '# Compress HTML, CSS, JavaScript, Text, XML and fonts',
69 'AddOutputFilterByType DEFLATE application/javascript',
70 'AddOutputFilterByType DEFLATE application/rss+xml',
71 'AddOutputFilterByType DEFLATE application/vnd.ms-fontobject',
72 'AddOutputFilterByType DEFLATE application/x-font',
73 'AddOutputFilterByType DEFLATE application/x-font-opentype',
74 'AddOutputFilterByType DEFLATE application/x-font-otf',
75 'AddOutputFilterByType DEFLATE application/x-font-truetype',
76 'AddOutputFilterByType DEFLATE application/x-font-ttf',
77 'AddOutputFilterByType DEFLATE application/x-javascript',
78 'AddOutputFilterByType DEFLATE application/xhtml+xml',
79 'AddOutputFilterByType DEFLATE application/xml',
80 'AddOutputFilterByType DEFLATE font/opentype',
81 'AddOutputFilterByType DEFLATE font/otf',
82 'AddOutputFilterByType DEFLATE font/ttf',
83 'AddOutputFilterByType DEFLATE image/svg+xml',
84 'AddOutputFilterByType DEFLATE image/x-icon',
85 'AddOutputFilterByType DEFLATE text/css',
86 'AddOutputFilterByType DEFLATE text/html',
87 'AddOutputFilterByType DEFLATE text/javascript',
88 'AddOutputFilterByType DEFLATE text/plain',
89 'AddOutputFilterByType DEFLATE text/xml',
90 '# Remove browser bugs (only needed for really old browsers)',
91 'BrowserMatch ^Mozilla/4 gzip-only-text/html',
92 'BrowserMatch ^Mozilla/4\.0[678] no-gzip',
93 'BrowserMatch \bMSIE !no-gzip !gzip-only-text/html',
94 'Header append Vary User-Agent',
95 '</IfModule>'
96 );
97
98 /**
99 * ADD directives from .htaccess file
100 */
101 function AHSC_edit_htaccess(){
102 if ( ! is_multisite() ) {
103 global $AHSC_rules,$AHSC_marker;
104 require_once( ABSPATH . 'wp-admin/includes/file.php' );
105
106 $home_path = get_home_path();
107 $htaccess_location = $home_path . '.htaccess';
108
109 insert_with_markers( $htaccess_location, $AHSC_marker, $AHSC_rules );
110 }
111
112 }
113
114 /**
115 * REMOVE directives from .htaccess file
116 */
117 function AHSC_remove_htaccess() {
118 if ( ! is_multisite() ) {
119 global $AHSC_marker;
120 $htaccess = get_home_path() . '.htaccess';
121 insert_with_markers( $htaccess, $AHSC_marker, array() );
122 }
123
124 }