Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/themify-.../themify
File: class-themify-enqueue.php
?>
[500] Fix | Delete
<!--googleoff:all-->
[501] Fix | Delete
<!--noindex-->
[502] Fix | Delete
<!--noptimize-->
[503] Fix | Delete
<script id="tf_vars" data-no-optimize="1" data-noptimize="1" data-no-minify="1" data-cfasync="false" defer="defer" src="data:text/javascript;base64,<?php echo base64_encode($inline_js)?>"></script>
[504] Fix | Delete
<!--/noptimize-->
[505] Fix | Delete
<!--/noindex-->
[506] Fix | Delete
<!--googleon:all-->
[507] Fix | Delete
<?php
[508] Fix | Delete
$wp_scripts->registered['themify-main-script']->extra['data'] = $inline_js=self::$wc_data=null;
[509] Fix | Delete
do_action('tf_load_styles');
[510] Fix | Delete
self::$isFooter = true;
[511] Fix | Delete
}
[512] Fix | Delete
else {
[513] Fix | Delete
self::loadIcons();
[514] Fix | Delete
}
[515] Fix | Delete
self::$localiztion = array();
[516] Fix | Delete
}
[517] Fix | Delete
[518] Fix | Delete
/**
[519] Fix | Delete
* Copy of WP_Scripts::localize() except it uses JSON_UNESCAPED_SLASHES
[520] Fix | Delete
*
[521] Fix | Delete
* @documented in wp-includes/class.wp.scripts.php
[522] Fix | Delete
*/
[523] Fix | Delete
public static function localize_script(string $handle,string $object_name,array $l10n) {
[524] Fix | Delete
global $wp_scripts;
[525] Fix | Delete
[526] Fix | Delete
if ('jquery' === $handle) {
[527] Fix | Delete
$handle = 'jquery-core';
[528] Fix | Delete
}
[529] Fix | Delete
[530] Fix | Delete
if (is_array($l10n) && isset($l10n['l10n_print_after'])) { // back compat, preserve the code in 'l10n_print_after' if present.
[531] Fix | Delete
$after = $l10n['l10n_print_after'];
[532] Fix | Delete
unset($l10n['l10n_print_after']);
[533] Fix | Delete
}
[534] Fix | Delete
[535] Fix | Delete
foreach ((array) $l10n as $key => $value) {
[536] Fix | Delete
if (!is_scalar($value)) {
[537] Fix | Delete
continue;
[538] Fix | Delete
}
[539] Fix | Delete
[540] Fix | Delete
$l10n[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
[541] Fix | Delete
}
[542] Fix | Delete
[543] Fix | Delete
$script = "var $object_name = " . wp_json_encode($l10n, JSON_UNESCAPED_SLASHES) . ';';
[544] Fix | Delete
[545] Fix | Delete
if (!empty($after)) {
[546] Fix | Delete
$script .= "\n$after;";
[547] Fix | Delete
}
[548] Fix | Delete
[549] Fix | Delete
$data = $wp_scripts->get_data($handle, 'data');
[550] Fix | Delete
[551] Fix | Delete
if (!empty($data)) {
[552] Fix | Delete
$script = "$data\n$script";
[553] Fix | Delete
}
[554] Fix | Delete
[555] Fix | Delete
return $wp_scripts->add_data($handle, 'data', $script);
[556] Fix | Delete
}
[557] Fix | Delete
[558] Fix | Delete
public static function before_footer() {
[559] Fix | Delete
if (themify_is_woocommerce_active()) {
[560] Fix | Delete
remove_action('wp_footer', 'wc_no_js');
[561] Fix | Delete
}
[562] Fix | Delete
if (self::$themeVersion !== null && !is_admin()) {
[563] Fix | Delete
self::add_css('theme-style', THEME_URI . '/style.css', null, self::$themeVersion);
[564] Fix | Delete
if (self::$mediaMaxWidth !== false) {
[565] Fix | Delete
self::add_css('themify-media-queries', THEME_URI . '/media-queries.css', null, self::$themeVersion, '(max-width:' . self::$mediaMaxWidth . 'px)');
[566] Fix | Delete
}
[567] Fix | Delete
if (isset(self::$theme_css_support['wc'])) {
[568] Fix | Delete
self::add_css('tf_theme_wc', THEME_URI . '/styles/wc/woocommerce.css', null, self::$themeVersion);
[569] Fix | Delete
if (isset(self::$theme_css_support['wc_single_product']) && (isset(self::$wc_shortcode_type['product']) || is_product())) {
[570] Fix | Delete
self::loadThemeWCStyleModule('single/product');
[571] Fix | Delete
}
[572] Fix | Delete
if ((isset(self::$theme_css_support['wc_account']) || isset(self::$theme_css_support['wc_register_form'])) && (isset(self::$wc_shortcode_type['account']) || is_account_page())) {
[573] Fix | Delete
if (is_user_logged_in()) {
[574] Fix | Delete
if(isset(self::$theme_css_support['wc_account'])){
[575] Fix | Delete
self::loadThemeWCStyleModule('pages/account');
[576] Fix | Delete
}
[577] Fix | Delete
} elseif(isset(self::$theme_css_support['wc_register_form'])) {
[578] Fix | Delete
self::loadThemeWCStyleModule('pages/register-form');
[579] Fix | Delete
}
[580] Fix | Delete
}
[581] Fix | Delete
if (isset(self::$theme_css_support['wc_checkout']) && (isset(self::$wc_shortcode_type['checkout']) || is_checkout())) {
[582] Fix | Delete
self::loadThemeWCStyleModule('pages/checkout');
[583] Fix | Delete
}
[584] Fix | Delete
if (isset(self::$theme_css_support['wc_cart']) && is_cart()) {
[585] Fix | Delete
self::loadThemeWCStyleModule('pages/cart');
[586] Fix | Delete
}
[587] Fix | Delete
}
[588] Fix | Delete
self::$wc_shortcode_type = null;
[589] Fix | Delete
if (function_exists('themify_theme_enqueue_footer')) {
[590] Fix | Delete
themify_theme_enqueue_footer();
[591] Fix | Delete
}
[592] Fix | Delete
if (is_rtl() && isset(self::$theme_css_support['rtl'])) {
[593] Fix | Delete
self::add_css('theme-style-rtl', THEME_URI . '/rtl.css', null, self::$themeVersion);
[594] Fix | Delete
}
[595] Fix | Delete
themify_enqueue_framework_assets();
[596] Fix | Delete
// Themify child base styling
[597] Fix | Delete
if (is_child_theme()) {
[598] Fix | Delete
$modified = filemtime(get_stylesheet_directory() . '/style.css');
[599] Fix | Delete
if ($modified === false) {
[600] Fix | Delete
$modified = '';
[601] Fix | Delete
}
[602] Fix | Delete
self::add_css('theme-style-child', get_stylesheet_uri(), null, self::$themeVersion . $modified);
[603] Fix | Delete
}
[604] Fix | Delete
// User stylesheet
[605] Fix | Delete
$custom_css = get_template_directory() . '/custom_style.css';
[606] Fix | Delete
if (is_file($custom_css)) {
[607] Fix | Delete
$modified = filemtime($custom_css);
[608] Fix | Delete
if ($modified === false) {
[609] Fix | Delete
$modified = '';
[610] Fix | Delete
}
[611] Fix | Delete
self::add_css('custom-style', THEME_URI . '/custom_style.css', null, THEMIFY_VERSION . $modified);
[612] Fix | Delete
}
[613] Fix | Delete
unset($custom_css);
[614] Fix | Delete
if (is_admin_bar_showing() && is_file(self::$THEME_CSS_MODULES_DIR . 'admin-bar.css')) {
[615] Fix | Delete
self::loadThemeStyleModule('admin-bar', false, true);
[616] Fix | Delete
}
[617] Fix | Delete
if (class_exists('Themify_Builder',false) && Themify_Builder_Model::is_front_builder_activate() === true && is_file(self::$THEME_CSS_MODULES_DIR . 'builder-active.css')) {
[618] Fix | Delete
self::loadThemeStyleModule('builder-active', false, true);
[619] Fix | Delete
}
[620] Fix | Delete
}
[621] Fix | Delete
}
[622] Fix | Delete
[623] Fix | Delete
public static function wp_footer() {
[624] Fix | Delete
if (!empty(self::$css['in_footer'])) {
[625] Fix | Delete
foreach (self::$css['in_footer'] as $k => $v) {
[626] Fix | Delete
$m = isset($v['m']) ? ' media="' . $v['m'] . '"' : '';
[627] Fix | Delete
$href = $v['s'];
[628] Fix | Delete
if (!empty($v['v'])) {
[629] Fix | Delete
$href .= strpos($href, '?') === false ? '?' : '&';
[630] Fix | Delete
$href .= 'ver=' . $v['v'];
[631] Fix | Delete
}
[632] Fix | Delete
?>
[633] Fix | Delete
<link rel="preload" href="<?php echo $href ?>" as="style"<?php echo $m ?>><link id="<?php echo $k ?>-css" rel="stylesheet" href="<?php echo $href ?>"<?php echo $m ?>>
[634] Fix | Delete
<?php
[635] Fix | Delete
}
[636] Fix | Delete
}
[637] Fix | Delete
if (self::$themeVersion !== null) {
[638] Fix | Delete
echo "\n\n", themify_get('setting-footer_html', '', true);
[639] Fix | Delete
}
[640] Fix | Delete
add_action('shutdown',array(__CLASS__,'buffer_end'),-99999999);
[641] Fix | Delete
}
[642] Fix | Delete
[643] Fix | Delete
public static function buffer_end():void{
[644] Fix | Delete
ob_end_flush();
[645] Fix | Delete
}
[646] Fix | Delete
[647] Fix | Delete
private static function getBuffer(string $body):string{
[648] Fix | Delete
$key = '';
[649] Fix | Delete
$exist = $hasFonts = false;
[650] Fix | Delete
self::$css = apply_filters('themify_main_concate', self::$css);
[651] Fix | Delete
self::$css['mobile_concate'] = apply_filters('themify_mobile_concate', self::$css['mobile_concate']);
[652] Fix | Delete
foreach (self::$css as $k => $v) {
[653] Fix | Delete
if ($k !== 'in_footer' && $k !== 'mobile_concate') {
[654] Fix | Delete
$key .= $k . $v['v'];
[655] Fix | Delete
}
[656] Fix | Delete
}
[657] Fix | Delete
$output = '';
[658] Fix | Delete
if ($key !== '') {
[659] Fix | Delete
if (isset(self::$css['woocommerce-general']) && strpos($body, 'star-rating') !== false) {
[660] Fix | Delete
self::addPreLoadMedia(dirname(self::$css['woocommerce-general']['s'],2) . '/fonts/star.woff', 'preload', 'font', null, null, 'high');
[661] Fix | Delete
}
[662] Fix | Delete
$isDevMode=themify_is_dev_mode() && (!class_exists('Themify_Builder_Model',false) || !Themify_Builder_Model::is_front_builder_activate());
[663] Fix | Delete
if(self::$concateFile===null){
[664] Fix | Delete
$isDevMode=true;
[665] Fix | Delete
$exist=false;
[666] Fix | Delete
$key='';
[667] Fix | Delete
}
[668] Fix | Delete
else{
[669] Fix | Delete
$key .= implode('', array_keys(self::$css['mobile_concate']));
[670] Fix | Delete
$key = crc32($key);
[671] Fix | Delete
self::$concateFile .= 'themify-' . $key . '.css';
[672] Fix | Delete
$exist = Themify_Filesystem::is_file(self::$concateFile);
[673] Fix | Delete
$regenerate = false;
[674] Fix | Delete
if ($exist === true) {
[675] Fix | Delete
$regenerate = !apply_filters('themify_concate_css', !$isDevMode, self::$concateFile); //opposite logic for backward compatibility
[676] Fix | Delete
$isDeleted = Themify_Filesystem::is_file(self::$concateFile . 'del');
[677] Fix | Delete
$regenerate = $regenerate === true || $isDeleted === true;
[678] Fix | Delete
if ($regenerate === true) {
[679] Fix | Delete
if ($isDeleted === true) {
[680] Fix | Delete
Themify_Filesystem::delete(self::$concateFile . 'del','f');
[681] Fix | Delete
}
[682] Fix | Delete
$exist = false;
[683] Fix | Delete
}
[684] Fix | Delete
unset($isDeleted);
[685] Fix | Delete
}
[686] Fix | Delete
}
[687] Fix | Delete
if ($exist === false) {
[688] Fix | Delete
if (!isset($str)) {
[689] Fix | Delete
$str = '';
[690] Fix | Delete
}
[691] Fix | Delete
// Add theme and fw version
[692] Fix | Delete
$theme_name = '';
[693] Fix | Delete
$replace = array(THEMIFY_URI, home_url());
[694] Fix | Delete
if (self::$themeVersion !== null) {
[695] Fix | Delete
$theme = wp_get_theme();
[696] Fix | Delete
$theme_name = (is_child_theme() ? $theme->parent()->Name : $theme->display('Name')) . ' ' . self::$themeVersion . ' ';
[697] Fix | Delete
$replace[] = THEME_URI;
[698] Fix | Delete
$theme = null;
[699] Fix | Delete
}
[700] Fix | Delete
$str = PHP_EOL . '/* ' . $theme_name . 'framework ' . THEMIFY_VERSION . ' */' . $str . PHP_EOL;
[701] Fix | Delete
$str = '@charset "UTF-8";' . $str;
[702] Fix | Delete
unset($theme_name);
[703] Fix | Delete
if($isDevMode===true && self::$themeVersion!==null && (self::$concateFile===null || themify_is_concate_disabled())){
[704] Fix | Delete
$key='';
[705] Fix | Delete
}
[706] Fix | Delete
foreach (self::$css as $k => $v) {
[707] Fix | Delete
if ($k !== 'in_footer' && $k !== 'mobile_concate') {
[708] Fix | Delete
$content = $key !== ''? Themify_Filesystem::get_file_content($v['s']) : null;
[709] Fix | Delete
if (!empty($content)) {
[710] Fix | Delete
$dir = dirname($v['s']);
[711] Fix | Delete
$content = strtr($content,
[712] Fix | Delete
array(
[713] Fix | Delete
'@charset "UTF-8";'=>'',
[714] Fix | Delete
'..'=>dirname($dir),
[715] Fix | Delete
"url('fonts/"=>"url({'$dir}/fonts/",
[716] Fix | Delete
"url('images/"=>"url('{$dir}/images/",
[717] Fix | Delete
"url(fonts/"=>"url({$dir}/fonts/",
[718] Fix | Delete
"url(images/"=>"url({$dir}/images/"
[719] Fix | Delete
));
[720] Fix | Delete
if ($k === 'woocommerce-general') {
[721] Fix | Delete
$content = str_replace('@font-face{', '@font-face{font-display:swap;', $content);
[722] Fix | Delete
}
[723] Fix | Delete
if (isset($v['m'])) {
[724] Fix | Delete
$content = '@media ' . $v['m'] . '{' . PHP_EOL . $content . PHP_EOL . '}';
[725] Fix | Delete
}
[726] Fix | Delete
$str .= PHP_EOL . '/*' . str_replace($replace, '', $v['s']) . '*/' . PHP_EOL . $content;
[727] Fix | Delete
}
[728] Fix | Delete
elseif (!Themify_Filesystem::get_file_content($v['s'], true)) {
[729] Fix | Delete
$key = $str = '';
[730] Fix | Delete
}
[731] Fix | Delete
if (isset(self::$preLoadMedia[$k])) {
[732] Fix | Delete
unset(self::$preLoadMedia[$k]);
[733] Fix | Delete
}
[734] Fix | Delete
$media = isset($v['m'])?' media="'.$v['m'].'"':'';
[735] Fix | Delete
$output .= '<link rel="preload" href="' . $v['s'] . '?ver=' . $v['v'] . '" as="style"'.$media.'>' . "\n" . '<link id="' . $k . '-css" rel="stylesheet" href="' . $v['s'] . '?ver=' . $v['v'] . '"'.$media.'>' . "\n";
[736] Fix | Delete
}
[737] Fix | Delete
}
[738] Fix | Delete
unset($content);
[739] Fix | Delete
if (!empty(self::$css['mobile_concate'])) {
[740] Fix | Delete
$media = 'screen and (max-width:' . self::$mobileMenuActive . 'px)';
[741] Fix | Delete
$mobileStr = PHP_EOL . '/* START MOBILE MENU CSS */' . PHP_EOL . '@media ' . $media . '{';
[742] Fix | Delete
foreach (self::$css['mobile_concate'] as $k => $v) {
[743] Fix | Delete
$content = $key !== '' ? Themify_Filesystem::get_file_content($v) : null;
[744] Fix | Delete
if (!empty($content)) {
[745] Fix | Delete
$mobileStr .= PHP_EOL . '/*' . str_replace($replace, '', $v) . '*/' . PHP_EOL . trim($content);
[746] Fix | Delete
} else {
[747] Fix | Delete
$mobileStr = $key = '';
[748] Fix | Delete
}
[749] Fix | Delete
if (isset(self::$preLoadMedia[$k])) {
[750] Fix | Delete
unset(self::$preLoadMedia[$k]);
[751] Fix | Delete
}
[752] Fix | Delete
$output .= '<link rel="preload" href="' . $v . '?ver=' . self::$themeVersion . '" media="' . $media . '" as="style"><link id="tf-mobile-' . $k . '-css" rel="stylesheet" href="' . $v . '?ver=' . self::$themeVersion . '" media="' . $media . '">';
[753] Fix | Delete
}
[754] Fix | Delete
unset(self::$css['mobile_concate'], $content);
[755] Fix | Delete
if ($mobileStr !== '') {
[756] Fix | Delete
$mobileStr .= PHP_EOL . '}' . PHP_EOL . '/* END MOBILE MENU CSS */';
[757] Fix | Delete
$str .= $mobileStr;
[758] Fix | Delete
unset($mobileStr);
[759] Fix | Delete
}
[760] Fix | Delete
}
[761] Fix | Delete
if ($key !== '' && (empty(self::$concateFile) || (($regenerate === true || !Themify_Filesystem::is_file(self::$concateFile))))) {
[762] Fix | Delete
if(!file_put_contents(self::$concateFile.'tmp', $str) || Themify_Filesystem::rename(self::$concateFile.'tmp',self::$concateFile)===false){//tmp file need because file_put_contents isn't atomic(another process can read not ready file),locking file(LOCK_EX) is slow,that is why we are using rename(it is atomic)
[763] Fix | Delete
$key = '';
[764] Fix | Delete
Themify_Filesystem::delete(self::$concateFile.'tmp','f');
[765] Fix | Delete
}
[766] Fix | Delete
}
[767] Fix | Delete
unset($str, $replace);
[768] Fix | Delete
}
[769] Fix | Delete
}
[770] Fix | Delete
if ( true === apply_filters( 'themify_enable_lazyload', true ) ) {
[771] Fix | Delete
$body = themify_make_lazy($body);
[772] Fix | Delete
}
[773] Fix | Delete
$path = self::getPreLoad();
[774] Fix | Delete
if (self::$disableGoogleFontsLoad === null) {
[775] Fix | Delete
$path.= self::loadGoogleFonts();
[776] Fix | Delete
}
[777] Fix | Delete
if ($key !== '') {
[778] Fix | Delete
$upload_dir = themify_upload_dir();
[779] Fix | Delete
$href = str_replace($upload_dir['basedir'], $upload_dir['baseurl'], self::$concateFile);
[780] Fix | Delete
unset($upload_dir);
[781] Fix | Delete
$path .= '<link rel="preload" fetchpriority="high" href="' . $href . '" as="style"><link fetchpriority="high" id="themify_concate-css" rel="stylesheet" href="' . $href . '">';
[782] Fix | Delete
} else {
[783] Fix | Delete
$path .= $output.'<style id="themify_concate-css"></style>';//need when dev mode is enabled
[784] Fix | Delete
}
[785] Fix | Delete
unset($output);
[786] Fix | Delete
self::$concateFile = null;
[787] Fix | Delete
if (strpos($body, 'fonts.googleapis.com') !== false) {
[788] Fix | Delete
$path .= '<link rel="dns-prefetch" href="https://fonts.gstatic.com">';
[789] Fix | Delete
}
[790] Fix | Delete
if (strpos($body, '//www.youtube.com/embed') !== false) {
[791] Fix | Delete
$path .= '<link rel="preconnect" href="https://www.youtube.com">';
[792] Fix | Delete
}
[793] Fix | Delete
if (strpos($body, '//player.vimeo.com/video') !== false) {
[794] Fix | Delete
$path .= '<link rel="preconnect" href="https://player.vimeo.com">';
[795] Fix | Delete
}
[796] Fix | Delete
if (themify_get('setting-ga_m_id', '', true) !== '' || strpos($body, 'googletagmanager.com') !== false) {
[797] Fix | Delete
$path .= '<link rel="preconnect" href="https://www.google-analytics.com">';
[798] Fix | Delete
}
[799] Fix | Delete
if (self::$themeVersion !== null && ($custom_css = themify_get('setting-custom_css', false, true))) {
[800] Fix | Delete
$path.='<!--custom css:start--><style>'. $custom_css.'</style><!--custom css:end-->';
[801] Fix | Delete
}
[802] Fix | Delete
self::$css = self::$googleFonts = self::$preLoadMedia = $rep=array();
[803] Fix | Delete
if(strpos($body,'<!--tf_svg_holder-->')!==false){
[804] Fix | Delete
$rep['<!--tf_svg_holder-->']=self::loadIcons(false);
[805] Fix | Delete
}
[806] Fix | Delete
else{
[807] Fix | Delete
$rep['</body>']=self::loadIcons(false).'</body>';
[808] Fix | Delete
}
[809] Fix | Delete
if(strpos($body,'<!--tf_css_position-->')!==false){
[810] Fix | Delete
$rep['<!--tf_css_position-->']=$path;
[811] Fix | Delete
}
[812] Fix | Delete
else{
[813] Fix | Delete
$rep['</head>']=$path.'</head>';
[814] Fix | Delete
}
[815] Fix | Delete
return strtr($body,$rep);
[816] Fix | Delete
}
[817] Fix | Delete
[818] Fix | Delete
public static function loadIcons(bool $echo = true) {
[819] Fix | Delete
$fonts = Themify_Icon_Font::get_used_icons();
[820] Fix | Delete
$svg = '<svg id="tf_svg" style="display:none"><defs>';
[821] Fix | Delete
if (!empty($fonts)) {
[822] Fix | Delete
$st = '';
[823] Fix | Delete
[824] Fix | Delete
foreach ($fonts as $k => $v) {
[825] Fix | Delete
$w = isset($v['vw']) ? $v['vw'] : '32';
[826] Fix | Delete
$h = isset($v['vh']) ? $v['vh'] : '32';
[827] Fix | Delete
$p = isset($v['is_fontello']) ? ' transform="matrix(1 0 0 -1 0 ' . $h . ')"' : '';
[828] Fix | Delete
$svg .= '<symbol id="tf-' . $k . '" viewBox="0 0 ' . $w . ' ' . $h . '"><path d="' . $v['p'] . '"' . $p . '/></symbol>';
[829] Fix | Delete
if (isset($v['w'])) {
[830] Fix | Delete
$st .= '.tf_fa.tf-' . $k . '{width:' . $v['w'] . 'em}';
[831] Fix | Delete
}
[832] Fix | Delete
}
[833] Fix | Delete
if ($st !== '') {
[834] Fix | Delete
$svg .= '<style id="tf_fonts_style">' . $st . '</style>';
[835] Fix | Delete
$st = null;
[836] Fix | Delete
}
[837] Fix | Delete
}
[838] Fix | Delete
$svg .= '</defs></svg>';
[839] Fix | Delete
$fonts = null;
[840] Fix | Delete
if ($echo === false) {
[841] Fix | Delete
return $svg;
[842] Fix | Delete
}
[843] Fix | Delete
echo $svg;
[844] Fix | Delete
}
[845] Fix | Delete
[846] Fix | Delete
private static function get_webp_support():string {
[847] Fix | Delete
return PHP_EOL . '#BEGIN_WEBP_OUTPUT_BY_THEMIFY
[848] Fix | Delete
<IfModule mod_rewrite.c>
[849] Fix | Delete
RewriteEngine On
[850] Fix | Delete
# serves a .webp image instead of jpg/png
[851] Fix | Delete
RewriteCond %{HTTP_ACCEPT} image/webp
[852] Fix | Delete
RewriteCond %{REQUEST_FILENAME} ^(.+)\.(jpe?g|jpg|png|gif)$
[853] Fix | Delete
RewriteCond %1\.webp -f
[854] Fix | Delete
RewriteRule ^(.+)\.(jpe?g|jpg|png|gif)$ $1.webp [T=image/webp,E=accept:1]
[855] Fix | Delete
</IfModule>
[856] Fix | Delete
<IfModule mod_headers.c>
[857] Fix | Delete
Header append Vary Accept env=REQUEST_image
[858] Fix | Delete
</IfModule>
[859] Fix | Delete
<IfModule mod_mime.c>
[860] Fix | Delete
AddType image/webp .webp
[861] Fix | Delete
</IfModule>
[862] Fix | Delete
#END_WEBP_OUTPUT_BY_THEMIFY
[863] Fix | Delete
' . PHP_EOL;
[864] Fix | Delete
}
[865] Fix | Delete
[866] Fix | Delete
private static function get_gzip_htaccess():string {
[867] Fix | Delete
return PHP_EOL . '#BEGIN_GZIP_OUTPUT_BY_THEMIFY
[868] Fix | Delete
<IfModule mod_rewrite.c>
[869] Fix | Delete
<Files *.js.gz>
[870] Fix | Delete
AddType "text/javascript" .gz
[871] Fix | Delete
AddEncoding gzip .gz
[872] Fix | Delete
</Files>
[873] Fix | Delete
<Files *.css.gz>
[874] Fix | Delete
AddType "text/css" .gz
[875] Fix | Delete
AddEncoding gzip .gz
[876] Fix | Delete
</Files>
[877] Fix | Delete
<Files *.svg.gz>
[878] Fix | Delete
AddType "image/svg+xml" .gz
[879] Fix | Delete
AddEncoding gzip .gz
[880] Fix | Delete
</Files>
[881] Fix | Delete
<Files *.json.gz>
[882] Fix | Delete
AddType "application/json" .gz
[883] Fix | Delete
AddEncoding gzip .gz
[884] Fix | Delete
</Files>
[885] Fix | Delete
# Serve pre-compressed gzip assets
[886] Fix | Delete
RewriteCond %{HTTP:Accept-Encoding} gzip
[887] Fix | Delete
RewriteCond %{REQUEST_FILENAME}.gz -f
[888] Fix | Delete
RewriteRule ^(.*)$ $1.gz [QSA,L]
[889] Fix | Delete
</IfModule>
[890] Fix | Delete
#END_GZIP_OUTPUT_BY_THEMIFY
[891] Fix | Delete
' . PHP_EOL;
[892] Fix | Delete
}
[893] Fix | Delete
[894] Fix | Delete
private static function get_mod_rewrite():string {
[895] Fix | Delete
return PHP_EOL . '#BEGIN_GZIP_COMPRESSION_BY_THEMIFY
[896] Fix | Delete
<IfModule mod_deflate.c>
[897] Fix | Delete
#add content typing
[898] Fix | Delete
AddType application/x-gzip .gz .tgz
[899] Fix | Delete
AddEncoding x-gzip .gz .tgz
[900] Fix | Delete
# Insert filters
[901] Fix | Delete
AddOutputFilterByType DEFLATE text/plain
[902] Fix | Delete
AddOutputFilterByType DEFLATE text/html
[903] Fix | Delete
AddOutputFilterByType DEFLATE text/xml
[904] Fix | Delete
AddOutputFilterByType DEFLATE text/css
[905] Fix | Delete
AddOutputFilterByType DEFLATE application/xml
[906] Fix | Delete
AddOutputFilterByType DEFLATE application/xhtml+xml
[907] Fix | Delete
AddOutputFilterByType DEFLATE application/rss+xml
[908] Fix | Delete
AddOutputFilterByType DEFLATE application/javascript
[909] Fix | Delete
AddOutputFilterByType DEFLATE application/x-javascript
[910] Fix | Delete
AddOutputFilterByType DEFLATE application/x-httpd-php
[911] Fix | Delete
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
[912] Fix | Delete
AddOutputFilterByType DEFLATE image/svg+xml
[913] Fix | Delete
AddOutputFilterByType DEFLATE image/svg
[914] Fix | Delete
<IfModule mod_headers.c>
[915] Fix | Delete
# Make sure proxies don\'t deliver the wrong content
[916] Fix | Delete
Header append Vary User-Agent env=!dont-vary
[917] Fix | Delete
</IfModule>
[918] Fix | Delete
</IfModule>
[919] Fix | Delete
# END GZIP COMPRESSION
[920] Fix | Delete
## EXPIRES CACHING ##
[921] Fix | Delete
<IfModule mod_expires.c>
[922] Fix | Delete
ExpiresActive On
[923] Fix | Delete
ExpiresByType image/jpg "access plus 1 year"
[924] Fix | Delete
ExpiresByType image/jpeg "access plus 1 year"
[925] Fix | Delete
ExpiresByType image/gif "access plus 1 year"
[926] Fix | Delete
ExpiresByType image/png "access plus 1 year"
[927] Fix | Delete
ExpiresByType image/webp "access plus 1 year"
[928] Fix | Delete
ExpiresByType image/apng "access plus 1 year"
[929] Fix | Delete
ExpiresByType image/svg+xml "access plus 1 year"
[930] Fix | Delete
ExpiresByType image/svg "access plus 1 year"
[931] Fix | Delete
ExpiresByType image/ico "access plus 1 year"
[932] Fix | Delete
ExpiresByType image/x-icon "access plus 1 year"
[933] Fix | Delete
ExpiresByType application/gzip "access plus 1 year"
[934] Fix | Delete
ExpiresByType text/css "access plus 1 year"
[935] Fix | Delete
ExpiresByType text/x-component "access plus 1 year"
[936] Fix | Delete
ExpiresByType text/javascript "access plus 1 year"
[937] Fix | Delete
ExpiresByType text/x-javascript "access plus 1 year"
[938] Fix | Delete
ExpiresByType application/pdf "access plus 1 month"
[939] Fix | Delete
ExpiresByType application/javascript "access plus 1 year"
[940] Fix | Delete
ExpiresByType application/x-javascript "access plus 1 year"
[941] Fix | Delete
ExpiresByType application/json "access plus 1 year"
[942] Fix | Delete
ExpiresByType application/ld+json "access plus 1 year"
[943] Fix | Delete
ExpiresByType application/xml "access plus 0 seconds"
[944] Fix | Delete
ExpiresByType text/xml "access plus 0 seconds"
[945] Fix | Delete
ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
[946] Fix | Delete
ExpiresByType text/cache-manifest "access plus 0 seconds"
[947] Fix | Delete
ExpiresByType audio/ogg "access plus 4 months"
[948] Fix | Delete
ExpiresByType audio/mp3 "access plus 4 months"
[949] Fix | Delete
ExpiresByType video/mp4 "access plus 4 months"
[950] Fix | Delete
ExpiresByType video/ogg "access plus 4 months"
[951] Fix | Delete
ExpiresByType video/webm "access plus 4 months"
[952] Fix | Delete
ExpiresByType application/atom+xml "access plus 1 day"
[953] Fix | Delete
ExpiresByType application/rss+xml "access plus 1 day"
[954] Fix | Delete
ExpiresByType application/font-woff "access plus 1 year"
[955] Fix | Delete
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
[956] Fix | Delete
ExpiresByType application/x-font-ttf "access plus 1 year"
[957] Fix | Delete
ExpiresByType font/opentype "access plus 1 year"
[958] Fix | Delete
ExpiresByType font/woff "access plus 1 year"
[959] Fix | Delete
ExpiresByType font/woff2 "access plus 1 year"
[960] Fix | Delete
ExpiresByType font/application/x-font-woff2 "access plus 1 year"
[961] Fix | Delete
ExpiresByType application/font-woff2 "access plus 1 year"
[962] Fix | Delete
</IfModule>
[963] Fix | Delete
#Alternative caching using Apache`s "mod_headers", if it`s installed.
[964] Fix | Delete
#Caching of common files - ENABLED
[965] Fix | Delete
<IfModule mod_headers.c>
[966] Fix | Delete
<FilesMatch "\.(pdf|xls|rar|zip|tgz|tar|html|txt)$">
[967] Fix | Delete
Header set Cache-Control "max-age=2628000, public"
[968] Fix | Delete
</FilesMatch>
[969] Fix | Delete
<FilesMatch "\.(jpg|jpeg|gif|png|webp|apng|svg|js|mjs|css|mp3|ogg|mpe?g|avi|gz|woff|woff2|eot|ttf|mp4|doc|ico|ogv|svgz|otf|rss|ppt|mid|midi|wav|bmp|rtf|json|jsonld)$">
[970] Fix | Delete
Header set Cache-Control "max-age=31536000, public"
[971] Fix | Delete
</FilesMatch>
[972] Fix | Delete
# Set Keep Alive Header
[973] Fix | Delete
Header set Connection keep-alive
[974] Fix | Delete
</IfModule>
[975] Fix | Delete
[976] Fix | Delete
<IfModule mod_gzip.c>
[977] Fix | Delete
mod_gzip_on Yes
[978] Fix | Delete
mod_gzip_dechunk Yes
[979] Fix | Delete
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
[980] Fix | Delete
mod_gzip_item_include handler ^cgi-script$
[981] Fix | Delete
mod_gzip_item_include mime ^text/.*
[982] Fix | Delete
mod_gzip_item_include mime ^application/x-javascript.*
[983] Fix | Delete
mod_gzip_item_exclude mime ^image/.*
[984] Fix | Delete
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
[985] Fix | Delete
</IfModule>
[986] Fix | Delete
[987] Fix | Delete
# If your server don`t support ETags deactivate with "None" (and remove header)
[988] Fix | Delete
<IfModule mod_expires.c>
[989] Fix | Delete
<IfModule mod_headers.c>
[990] Fix | Delete
Header unset ETag
[991] Fix | Delete
</IfModule>
[992] Fix | Delete
FileETag None
[993] Fix | Delete
</IfModule>
[994] Fix | Delete
## EXPIRES CACHING ##
[995] Fix | Delete
#END_GZIP_COMPRESSION_BY_THEMIFY' . PHP_EOL;
[996] Fix | Delete
}
[997] Fix | Delete
[998] Fix | Delete
public static function rewrite_htaccess($gzip = false, $webp = false,$browser=false) {
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function