$value) { switch ($key) { case 'atec_WPMC_settings': $atec_wpmc_settings=(array) $value; break; case 'atec_WPMC_extensions': $atec_wpmc_extensions=(array) $value; $atec_wpmc_extensions['redis']=(array) $atec_wpmc_extensions['redis']??[]; $atec_wpmc_extensions['memcached']=(array) $atec_wpmc_extensions['memcached']??[]; break; } } $type=$atec_wpmc_settings['type']??''; $atec_mu_wpmc_args = str_replace(['/','?'],['_','#'],$atec_mu_wpmc_args); if (!defined('WP_PLUGIN_DIR')) define('WP_PLUGIN_DIR',WP_CONTENT_DIR.'/plugins'); require_once(WP_CONTENT_DIR.'/plugins/mega-cache/includes/atec-wpmc-pcache-get.php'); $arr = atec_wpmc_getCache($type,$atec_wpmc_settings['salt']??'',$atec_mu_wpmc_args,true); if (!empty($arr)) { $charset=$atec_wpmc_settings['charset']??'UTF-8'; @header('Content-Type: text/html; charset='.$charset); @header('X-Cache-Enabled: TRUE'); @header('X-Cache-Type: Mega Cache ('.$type.')'); //@header('Content-Type: '.($isFeed?'application/rss+xml':'text/html')); // @codingStandardsIgnoreStart // wp_unslash() is not available at this point – so using stripslashes. if (str_contains(stripslashes($_SERVER['HTTP_ACCEPT_ENCODING']??''), 'gzip') && $arr[0]) // @codingStandardsIgnoreEnd { // @codingStandardsIgnoreStart // If zlib.output is not disabled, gzip content will be gziped again, and output will result in an encoding error. // Block ends with exit() – so no other script will be envolved. $zlib='zlib.output_compression'; $ini=ini_get($zlib); if ($ini==1 || strtolower($ini)=='on') ini_set($zlib,'Off'); // @codingStandardsIgnoreEnd header('Vary: Accept-Encoding'); header("Content-Encoding: gzip"); @header('X-Cache: HIT/GZIP'); /* As discussed with review team, GZIP content can not be sanitized/escaped as that would corrupt the content. */ // @codingStandardsIgnoreStart echo $arr[1]; // @codingStandardsIgnoreEnd } else { @header('X-Cache: HIT'); if ($arr[0] && function_exists('gzdecode')) $arr[1] = gzdecode($arr[1]); /* As discussed with review team, GZIP content can not be sanitized/escaped as that would corrupt the content. */ // @codingStandardsIgnoreStart echo $arr[1]; // @codingStandardsIgnoreEnd } if ($log) atec_mu_wpmc_log(true); exit(200); } if ($log) add_action('shutdown', function() { atec_mu_wpmc_log(false); }); } ?>