Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/litespee.../src
File: htaccess.cls.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* The htaccess rewrite rule operation class
[3] Fix | Delete
*
[4] Fix | Delete
*
[5] Fix | Delete
* @since 1.0.0
[6] Fix | Delete
* @package LiteSpeed
[7] Fix | Delete
* @subpackage LiteSpeed/inc
[8] Fix | Delete
* @author LiteSpeed Technologies <info@litespeedtech.com>
[9] Fix | Delete
*/
[10] Fix | Delete
[11] Fix | Delete
namespace LiteSpeed;
[12] Fix | Delete
[13] Fix | Delete
defined('WPINC') || exit();
[14] Fix | Delete
[15] Fix | Delete
class Htaccess extends Root
[16] Fix | Delete
{
[17] Fix | Delete
private $frontend_htaccess = null;
[18] Fix | Delete
private $_default_frontend_htaccess = null;
[19] Fix | Delete
private $backend_htaccess = null;
[20] Fix | Delete
private $_default_backend_htaccess = null;
[21] Fix | Delete
private $theme_htaccess = null; // Not used yet
[22] Fix | Delete
private $frontend_htaccess_readable = false;
[23] Fix | Delete
private $frontend_htaccess_writable = false;
[24] Fix | Delete
private $backend_htaccess_readable = false;
[25] Fix | Delete
private $backend_htaccess_writable = false;
[26] Fix | Delete
private $theme_htaccess_readable = false;
[27] Fix | Delete
private $theme_htaccess_writable = false;
[28] Fix | Delete
private $__rewrite_on;
[29] Fix | Delete
[30] Fix | Delete
const LS_MODULE_START = '<IfModule LiteSpeed>';
[31] Fix | Delete
const EXPIRES_MODULE_START = '<IfModule mod_expires.c>';
[32] Fix | Delete
const LS_MODULE_END = '</IfModule>';
[33] Fix | Delete
const LS_MODULE_REWRITE_START = '<IfModule mod_rewrite.c>';
[34] Fix | Delete
const REWRITE_ON = 'RewriteEngine on';
[35] Fix | Delete
const LS_MODULE_DONOTEDIT = '## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##';
[36] Fix | Delete
const MARKER = 'LSCACHE';
[37] Fix | Delete
const MARKER_NONLS = 'NON_LSCACHE';
[38] Fix | Delete
const MARKER_LOGIN_COOKIE = '### marker LOGIN COOKIE';
[39] Fix | Delete
const MARKER_ASYNC = '### marker ASYNC';
[40] Fix | Delete
const MARKER_CRAWLER = '### marker CRAWLER';
[41] Fix | Delete
const MARKER_MOBILE = '### marker MOBILE';
[42] Fix | Delete
const MARKER_NOCACHE_COOKIES = '### marker NOCACHE COOKIES';
[43] Fix | Delete
const MARKER_NOCACHE_USER_AGENTS = '### marker NOCACHE USER AGENTS';
[44] Fix | Delete
const MARKER_CACHE_RESOURCE = '### marker CACHE RESOURCE';
[45] Fix | Delete
const MARKER_BROWSER_CACHE = '### marker BROWSER CACHE';
[46] Fix | Delete
const MARKER_MINIFY = '### marker MINIFY';
[47] Fix | Delete
const MARKER_CORS = '### marker CORS';
[48] Fix | Delete
const MARKER_WEBP = '### marker WEBP';
[49] Fix | Delete
const MARKER_DROPQS = '### marker DROPQS';
[50] Fix | Delete
const MARKER_START = ' start ###';
[51] Fix | Delete
const MARKER_END = ' end ###';
[52] Fix | Delete
[53] Fix | Delete
const RW_PATTERN_RES = '/.*/[^/]*(responsive|css|js|dynamic|loader|fonts)\.php';
[54] Fix | Delete
[55] Fix | Delete
/**
[56] Fix | Delete
* Initialize the class and set its properties.
[57] Fix | Delete
*
[58] Fix | Delete
* @since 1.0.7
[59] Fix | Delete
*/
[60] Fix | Delete
public function __construct()
[61] Fix | Delete
{
[62] Fix | Delete
$this->_path_set();
[63] Fix | Delete
$this->_default_frontend_htaccess = $this->frontend_htaccess;
[64] Fix | Delete
$this->_default_backend_htaccess = $this->backend_htaccess;
[65] Fix | Delete
[66] Fix | Delete
$frontend_htaccess = defined('LITESPEED_CFG_HTACCESS') ? LITESPEED_CFG_HTACCESS : false;
[67] Fix | Delete
if ($frontend_htaccess && substr($frontend_htaccess, -10) === '/.htaccess') {
[68] Fix | Delete
$this->frontend_htaccess = $frontend_htaccess;
[69] Fix | Delete
}
[70] Fix | Delete
$backend_htaccess = defined('LITESPEED_CFG_HTACCESS_BACKEND') ? LITESPEED_CFG_HTACCESS_BACKEND : false;
[71] Fix | Delete
if ($backend_htaccess && substr($backend_htaccess, -10) === '/.htaccess') {
[72] Fix | Delete
$this->backend_htaccess = $backend_htaccess;
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
// Filter for frontend&backend htaccess path
[76] Fix | Delete
$this->frontend_htaccess = apply_filters('litespeed_frontend_htaccess', $this->frontend_htaccess);
[77] Fix | Delete
$this->backend_htaccess = apply_filters('litespeed_backend_htaccess', $this->backend_htaccess);
[78] Fix | Delete
[79] Fix | Delete
clearstatcache();
[80] Fix | Delete
[81] Fix | Delete
// frontend .htaccess privilege
[82] Fix | Delete
$test_permissions = file_exists($this->frontend_htaccess) ? $this->frontend_htaccess : dirname($this->frontend_htaccess);
[83] Fix | Delete
if (is_readable($test_permissions)) {
[84] Fix | Delete
$this->frontend_htaccess_readable = true;
[85] Fix | Delete
}
[86] Fix | Delete
if (is_writable($test_permissions)) {
[87] Fix | Delete
$this->frontend_htaccess_writable = true;
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
$this->__rewrite_on = array(
[91] Fix | Delete
self::REWRITE_ON,
[92] Fix | Delete
'CacheLookup on',
[93] Fix | Delete
'RewriteRule .* - [E=Cache-Control:no-autoflush]',
[94] Fix | Delete
// "RewriteRule \.object-cache\.ini - [F,L]",
[95] Fix | Delete
'RewriteRule ' . preg_quote(self::CONF_FILE) . ' - [F,L]',
[96] Fix | Delete
);
[97] Fix | Delete
[98] Fix | Delete
// backend .htaccess privilege
[99] Fix | Delete
if ($this->frontend_htaccess === $this->backend_htaccess) {
[100] Fix | Delete
$this->backend_htaccess_readable = $this->frontend_htaccess_readable;
[101] Fix | Delete
$this->backend_htaccess_writable = $this->frontend_htaccess_writable;
[102] Fix | Delete
} else {
[103] Fix | Delete
$test_permissions = file_exists($this->backend_htaccess) ? $this->backend_htaccess : dirname($this->backend_htaccess);
[104] Fix | Delete
if (is_readable($test_permissions)) {
[105] Fix | Delete
$this->backend_htaccess_readable = true;
[106] Fix | Delete
}
[107] Fix | Delete
if (is_writable($test_permissions)) {
[108] Fix | Delete
$this->backend_htaccess_writable = true;
[109] Fix | Delete
}
[110] Fix | Delete
}
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
/**
[114] Fix | Delete
* Get if htaccess file is readable
[115] Fix | Delete
*
[116] Fix | Delete
* @since 1.1.0
[117] Fix | Delete
* @return string
[118] Fix | Delete
*/
[119] Fix | Delete
private function _readable($kind = 'frontend')
[120] Fix | Delete
{
[121] Fix | Delete
if ($kind === 'frontend') {
[122] Fix | Delete
return $this->frontend_htaccess_readable;
[123] Fix | Delete
}
[124] Fix | Delete
if ($kind === 'backend') {
[125] Fix | Delete
return $this->backend_htaccess_readable;
[126] Fix | Delete
}
[127] Fix | Delete
}
[128] Fix | Delete
[129] Fix | Delete
/**
[130] Fix | Delete
* Get if htaccess file is writable
[131] Fix | Delete
*
[132] Fix | Delete
* @since 1.1.0
[133] Fix | Delete
* @return string
[134] Fix | Delete
*/
[135] Fix | Delete
public function writable($kind = 'frontend')
[136] Fix | Delete
{
[137] Fix | Delete
if ($kind === 'frontend') {
[138] Fix | Delete
return $this->frontend_htaccess_writable;
[139] Fix | Delete
}
[140] Fix | Delete
if ($kind === 'backend') {
[141] Fix | Delete
return $this->backend_htaccess_writable;
[142] Fix | Delete
}
[143] Fix | Delete
}
[144] Fix | Delete
[145] Fix | Delete
/**
[146] Fix | Delete
* Get frontend htaccess path
[147] Fix | Delete
*
[148] Fix | Delete
* @since 1.1.0
[149] Fix | Delete
* @return string
[150] Fix | Delete
*/
[151] Fix | Delete
public static function get_frontend_htaccess($show_default = false)
[152] Fix | Delete
{
[153] Fix | Delete
if ($show_default) {
[154] Fix | Delete
return self::cls()->_default_frontend_htaccess;
[155] Fix | Delete
}
[156] Fix | Delete
return self::cls()->frontend_htaccess;
[157] Fix | Delete
}
[158] Fix | Delete
[159] Fix | Delete
/**
[160] Fix | Delete
* Get backend htaccess path
[161] Fix | Delete
*
[162] Fix | Delete
* @since 1.1.0
[163] Fix | Delete
* @return string
[164] Fix | Delete
*/
[165] Fix | Delete
public static function get_backend_htaccess($show_default = false)
[166] Fix | Delete
{
[167] Fix | Delete
if ($show_default) {
[168] Fix | Delete
return self::cls()->_default_backend_htaccess;
[169] Fix | Delete
}
[170] Fix | Delete
return self::cls()->backend_htaccess;
[171] Fix | Delete
}
[172] Fix | Delete
[173] Fix | Delete
/**
[174] Fix | Delete
* Check to see if .htaccess exists starting at $start_path and going up directories until it hits DOCUMENT_ROOT.
[175] Fix | Delete
*
[176] Fix | Delete
* As dirname() strips the ending '/', paths passed in must exclude the final '/'
[177] Fix | Delete
*
[178] Fix | Delete
* @since 1.0.11
[179] Fix | Delete
* @access private
[180] Fix | Delete
*/
[181] Fix | Delete
private function _htaccess_search($start_path)
[182] Fix | Delete
{
[183] Fix | Delete
while (!file_exists($start_path . '/.htaccess')) {
[184] Fix | Delete
if ($start_path === '/' || !$start_path) {
[185] Fix | Delete
return false;
[186] Fix | Delete
}
[187] Fix | Delete
[188] Fix | Delete
if (!empty($_SERVER['DOCUMENT_ROOT']) && wp_normalize_path($start_path) === wp_normalize_path($_SERVER['DOCUMENT_ROOT'])) {
[189] Fix | Delete
return false;
[190] Fix | Delete
}
[191] Fix | Delete
[192] Fix | Delete
if (dirname($start_path) === $start_path) {
[193] Fix | Delete
return false;
[194] Fix | Delete
}
[195] Fix | Delete
[196] Fix | Delete
$start_path = dirname($start_path);
[197] Fix | Delete
}
[198] Fix | Delete
[199] Fix | Delete
return $start_path;
[200] Fix | Delete
}
[201] Fix | Delete
[202] Fix | Delete
/**
[203] Fix | Delete
* Set the path class variables.
[204] Fix | Delete
*
[205] Fix | Delete
* @since 1.0.11
[206] Fix | Delete
* @access private
[207] Fix | Delete
*/
[208] Fix | Delete
private function _path_set()
[209] Fix | Delete
{
[210] Fix | Delete
$frontend = Router::frontend_path();
[211] Fix | Delete
$frontend_htaccess_search = $this->_htaccess_search($frontend); // The existing .htaccess path to be used for frontend .htaccess
[212] Fix | Delete
$this->frontend_htaccess = ($frontend_htaccess_search ?: $frontend) . '/.htaccess';
[213] Fix | Delete
[214] Fix | Delete
$backend = realpath(ABSPATH); // /home/user/public_html/backend/
[215] Fix | Delete
if ($frontend == $backend) {
[216] Fix | Delete
$this->backend_htaccess = $this->frontend_htaccess;
[217] Fix | Delete
return;
[218] Fix | Delete
}
[219] Fix | Delete
[220] Fix | Delete
// Backend is a different path
[221] Fix | Delete
$backend_htaccess_search = $this->_htaccess_search($backend);
[222] Fix | Delete
// Found affected .htaccess
[223] Fix | Delete
if ($backend_htaccess_search) {
[224] Fix | Delete
$this->backend_htaccess = $backend_htaccess_search . '/.htaccess';
[225] Fix | Delete
return;
[226] Fix | Delete
}
[227] Fix | Delete
[228] Fix | Delete
// Frontend path is the parent of backend path
[229] Fix | Delete
if (stripos($backend, $frontend . '/') === 0) {
[230] Fix | Delete
// backend use frontend htaccess
[231] Fix | Delete
$this->backend_htaccess = $this->frontend_htaccess;
[232] Fix | Delete
return;
[233] Fix | Delete
}
[234] Fix | Delete
[235] Fix | Delete
$this->backend_htaccess = $backend . '/.htaccess';
[236] Fix | Delete
}
[237] Fix | Delete
[238] Fix | Delete
/**
[239] Fix | Delete
* Get corresponding htaccess path
[240] Fix | Delete
*
[241] Fix | Delete
* @since 1.1.0
[242] Fix | Delete
* @param string $kind Frontend or backend
[243] Fix | Delete
* @return string Path
[244] Fix | Delete
*/
[245] Fix | Delete
public function htaccess_path($kind = 'frontend')
[246] Fix | Delete
{
[247] Fix | Delete
switch ($kind) {
[248] Fix | Delete
case 'backend':
[249] Fix | Delete
$path = $this->backend_htaccess;
[250] Fix | Delete
break;
[251] Fix | Delete
[252] Fix | Delete
case 'frontend':
[253] Fix | Delete
default:
[254] Fix | Delete
$path = $this->frontend_htaccess;
[255] Fix | Delete
break;
[256] Fix | Delete
}
[257] Fix | Delete
return $path;
[258] Fix | Delete
}
[259] Fix | Delete
[260] Fix | Delete
/**
[261] Fix | Delete
* Get the content of the rules file.
[262] Fix | Delete
*
[263] Fix | Delete
* NOTE: will throw error if failed
[264] Fix | Delete
*
[265] Fix | Delete
* @since 1.0.4
[266] Fix | Delete
* @since 2.9 Used exception for failed reading
[267] Fix | Delete
* @access public
[268] Fix | Delete
*/
[269] Fix | Delete
public function htaccess_read($kind = 'frontend')
[270] Fix | Delete
{
[271] Fix | Delete
$path = $this->htaccess_path($kind);
[272] Fix | Delete
[273] Fix | Delete
if (!$path || !file_exists($path)) {
[274] Fix | Delete
return "\n";
[275] Fix | Delete
}
[276] Fix | Delete
[277] Fix | Delete
if (!$this->_readable($kind)) {
[278] Fix | Delete
Error::t('HTA_R');
[279] Fix | Delete
}
[280] Fix | Delete
[281] Fix | Delete
$content = File::read($path);
[282] Fix | Delete
if ($content === false) {
[283] Fix | Delete
Error::t('HTA_GET');
[284] Fix | Delete
}
[285] Fix | Delete
[286] Fix | Delete
// Remove ^M characters.
[287] Fix | Delete
$content = str_ireplace("\x0D", '', $content);
[288] Fix | Delete
return $content;
[289] Fix | Delete
}
[290] Fix | Delete
[291] Fix | Delete
/**
[292] Fix | Delete
* Try to backup the .htaccess file if we didn't save one before.
[293] Fix | Delete
*
[294] Fix | Delete
* NOTE: will throw error if failed
[295] Fix | Delete
*
[296] Fix | Delete
* @since 1.0.10
[297] Fix | Delete
* @access private
[298] Fix | Delete
*/
[299] Fix | Delete
private function _htaccess_backup($kind = 'frontend')
[300] Fix | Delete
{
[301] Fix | Delete
$path = $this->htaccess_path($kind);
[302] Fix | Delete
[303] Fix | Delete
if (!file_exists($path)) {
[304] Fix | Delete
return;
[305] Fix | Delete
}
[306] Fix | Delete
[307] Fix | Delete
if (file_exists($path . '.bk')) {
[308] Fix | Delete
return;
[309] Fix | Delete
}
[310] Fix | Delete
[311] Fix | Delete
$res = copy($path, $path . '.bk');
[312] Fix | Delete
[313] Fix | Delete
// Failed to backup, abort
[314] Fix | Delete
if (!$res) {
[315] Fix | Delete
Error::t('HTA_BK');
[316] Fix | Delete
}
[317] Fix | Delete
}
[318] Fix | Delete
[319] Fix | Delete
/**
[320] Fix | Delete
* Get mobile view rule from htaccess file
[321] Fix | Delete
*
[322] Fix | Delete
* NOTE: will throw error if failed
[323] Fix | Delete
*
[324] Fix | Delete
* @since 1.1.0
[325] Fix | Delete
*/
[326] Fix | Delete
public function current_mobile_agents()
[327] Fix | Delete
{
[328] Fix | Delete
$rules = $this->_get_rule_by(self::MARKER_MOBILE);
[329] Fix | Delete
if (!isset($rules[0])) {
[330] Fix | Delete
Error::t('HTA_DNF', self::MARKER_MOBILE);
[331] Fix | Delete
}
[332] Fix | Delete
[333] Fix | Delete
$rule = trim($rules[0]);
[334] Fix | Delete
// 'RewriteCond %{HTTP_USER_AGENT} ' . Utility::arr2regex( $cfg[ $id ], true ) . ' [NC]';
[335] Fix | Delete
$match = substr($rule, strlen('RewriteCond %{HTTP_USER_AGENT} '), -strlen(' [NC]'));
[336] Fix | Delete
[337] Fix | Delete
if (!$match) {
[338] Fix | Delete
Error::t('HTA_DNF', __('Mobile Agent Rules', 'litespeed-cache'));
[339] Fix | Delete
}
[340] Fix | Delete
[341] Fix | Delete
return $match;
[342] Fix | Delete
}
[343] Fix | Delete
[344] Fix | Delete
/**
[345] Fix | Delete
* Parse rewrites rule from the .htaccess file.
[346] Fix | Delete
*
[347] Fix | Delete
* NOTE: will throw error if failed
[348] Fix | Delete
*
[349] Fix | Delete
* @since 1.1.0
[350] Fix | Delete
* @access public
[351] Fix | Delete
*/
[352] Fix | Delete
public function current_login_cookie($kind = 'frontend')
[353] Fix | Delete
{
[354] Fix | Delete
$rule = $this->_get_rule_by(self::MARKER_LOGIN_COOKIE, $kind);
[355] Fix | Delete
[356] Fix | Delete
if (!$rule) {
[357] Fix | Delete
Error::t('HTA_DNF', self::MARKER_LOGIN_COOKIE);
[358] Fix | Delete
}
[359] Fix | Delete
[360] Fix | Delete
if (strpos($rule, 'RewriteRule .? - [E=') !== 0) {
[361] Fix | Delete
Error::t('HTA_LOGIN_COOKIE_INVALID');
[362] Fix | Delete
}
[363] Fix | Delete
[364] Fix | Delete
$rule_cookie = substr($rule, strlen('RewriteRule .? - [E='), -1);
[365] Fix | Delete
[366] Fix | Delete
if (LITESPEED_SERVER_TYPE === 'LITESPEED_SERVER_OLS') {
[367] Fix | Delete
$rule_cookie = trim($rule_cookie, '"');
[368] Fix | Delete
}
[369] Fix | Delete
[370] Fix | Delete
// Drop `Cache-Vary:`
[371] Fix | Delete
$rule_cookie = substr($rule_cookie, strlen('Cache-Vary:'));
[372] Fix | Delete
[373] Fix | Delete
return $rule_cookie;
[374] Fix | Delete
}
[375] Fix | Delete
[376] Fix | Delete
/**
[377] Fix | Delete
* Get rewrite rules based on the marker
[378] Fix | Delete
*
[379] Fix | Delete
* @since 2.0
[380] Fix | Delete
* @access private
[381] Fix | Delete
*/
[382] Fix | Delete
private function _get_rule_by($cond, $kind = 'frontend')
[383] Fix | Delete
{
[384] Fix | Delete
clearstatcache();
[385] Fix | Delete
$path = $this->htaccess_path($kind);
[386] Fix | Delete
if (!$this->_readable($kind)) {
[387] Fix | Delete
return false;
[388] Fix | Delete
}
[389] Fix | Delete
[390] Fix | Delete
$rules = File::extract_from_markers($path, self::MARKER);
[391] Fix | Delete
if (!in_array($cond . self::MARKER_START, $rules) || !in_array($cond . self::MARKER_END, $rules)) {
[392] Fix | Delete
return false;
[393] Fix | Delete
}
[394] Fix | Delete
[395] Fix | Delete
$key_start = array_search($cond . self::MARKER_START, $rules);
[396] Fix | Delete
$key_end = array_search($cond . self::MARKER_END, $rules);
[397] Fix | Delete
if ($key_start === false || $key_end === false) {
[398] Fix | Delete
return false;
[399] Fix | Delete
}
[400] Fix | Delete
[401] Fix | Delete
$results = array_slice($rules, $key_start + 1, $key_end - $key_start - 1);
[402] Fix | Delete
if (!$results) {
[403] Fix | Delete
return false;
[404] Fix | Delete
}
[405] Fix | Delete
[406] Fix | Delete
if (count($results) == 1) {
[407] Fix | Delete
return trim($results[0]);
[408] Fix | Delete
}
[409] Fix | Delete
[410] Fix | Delete
return array_filter($results);
[411] Fix | Delete
}
[412] Fix | Delete
[413] Fix | Delete
/**
[414] Fix | Delete
* Generate browser cache rules
[415] Fix | Delete
*
[416] Fix | Delete
* @since 1.3
[417] Fix | Delete
* @access private
[418] Fix | Delete
* @return array Rules set
[419] Fix | Delete
*/
[420] Fix | Delete
private function _browser_cache_rules($cfg)
[421] Fix | Delete
{
[422] Fix | Delete
/**
[423] Fix | Delete
* Add ttl setting
[424] Fix | Delete
* @since 1.6.3
[425] Fix | Delete
*/
[426] Fix | Delete
$id = Base::O_CACHE_TTL_BROWSER;
[427] Fix | Delete
$ttl = $cfg[$id];
[428] Fix | Delete
$rules = array(
[429] Fix | Delete
self::EXPIRES_MODULE_START,
[430] Fix | Delete
// '<FilesMatch "\.(pdf|ico|svg|xml|jpg|jpeg|png|gif|webp|ogg|mp4|webm|js|css|woff|woff2|ttf|eot)(\.gz)?$">',
[431] Fix | Delete
'ExpiresActive on',
[432] Fix | Delete
'ExpiresByType application/pdf A' . $ttl,
[433] Fix | Delete
'ExpiresByType image/x-icon A' . $ttl,
[434] Fix | Delete
'ExpiresByType image/vnd.microsoft.icon A' . $ttl,
[435] Fix | Delete
'ExpiresByType image/svg+xml A' . $ttl,
[436] Fix | Delete
'',
[437] Fix | Delete
'ExpiresByType image/jpg A' . $ttl,
[438] Fix | Delete
'ExpiresByType image/jpeg A' . $ttl,
[439] Fix | Delete
'ExpiresByType image/png A' . $ttl,
[440] Fix | Delete
'ExpiresByType image/gif A' . $ttl,
[441] Fix | Delete
'ExpiresByType image/webp A' . $ttl,
[442] Fix | Delete
'',
[443] Fix | Delete
'ExpiresByType video/ogg A' . $ttl,
[444] Fix | Delete
'ExpiresByType audio/ogg A' . $ttl,
[445] Fix | Delete
'ExpiresByType video/mp4 A' . $ttl,
[446] Fix | Delete
'ExpiresByType video/webm A' . $ttl,
[447] Fix | Delete
'',
[448] Fix | Delete
'ExpiresByType text/css A' . $ttl,
[449] Fix | Delete
'ExpiresByType text/javascript A' . $ttl,
[450] Fix | Delete
'ExpiresByType application/javascript A' . $ttl,
[451] Fix | Delete
'ExpiresByType application/x-javascript A' . $ttl,
[452] Fix | Delete
'',
[453] Fix | Delete
'ExpiresByType application/x-font-ttf A' . $ttl,
[454] Fix | Delete
'ExpiresByType application/x-font-woff A' . $ttl,
[455] Fix | Delete
'ExpiresByType application/font-woff A' . $ttl,
[456] Fix | Delete
'ExpiresByType application/font-woff2 A' . $ttl,
[457] Fix | Delete
'ExpiresByType application/vnd.ms-fontobject A' . $ttl,
[458] Fix | Delete
'ExpiresByType font/ttf A' . $ttl,
[459] Fix | Delete
'ExpiresByType font/otf A' . $ttl,
[460] Fix | Delete
'ExpiresByType font/woff A' . $ttl,
[461] Fix | Delete
'ExpiresByType font/woff2 A' . $ttl,
[462] Fix | Delete
'',
[463] Fix | Delete
// '</FilesMatch>',
[464] Fix | Delete
self::LS_MODULE_END,
[465] Fix | Delete
);
[466] Fix | Delete
return $rules;
[467] Fix | Delete
}
[468] Fix | Delete
[469] Fix | Delete
/**
[470] Fix | Delete
* Generate CORS rules for fonts
[471] Fix | Delete
*
[472] Fix | Delete
* @since 1.5
[473] Fix | Delete
* @access private
[474] Fix | Delete
* @return array Rules set
[475] Fix | Delete
*/
[476] Fix | Delete
private function _cors_rules()
[477] Fix | Delete
{
[478] Fix | Delete
return array(
[479] Fix | Delete
'<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font\.css)$">',
[480] Fix | Delete
'<IfModule mod_headers.c>',
[481] Fix | Delete
'Header set Access-Control-Allow-Origin "*"',
[482] Fix | Delete
'</IfModule>',
[483] Fix | Delete
'</FilesMatch>',
[484] Fix | Delete
);
[485] Fix | Delete
}
[486] Fix | Delete
[487] Fix | Delete
/**
[488] Fix | Delete
* Generate rewrite rules based on settings
[489] Fix | Delete
*
[490] Fix | Delete
* @since 1.3
[491] Fix | Delete
* @access private
[492] Fix | Delete
* @param array $cfg The settings to be used for rewrite rule
[493] Fix | Delete
* @return array Rules array
[494] Fix | Delete
*/
[495] Fix | Delete
private function _generate_rules($cfg)
[496] Fix | Delete
{
[497] Fix | Delete
$new_rules = array();
[498] Fix | Delete
$new_rules_nonls = array();
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function