/** * Returns allow-origin rules * * @param bool $cdnftp * @return string */ public static function allow_origin($cdnftp = false) { switch (true) { case Util_Environment::is_apache(): case Util_Environment::is_litespeed(): $r = "<IfModule mod_headers.c>\n"; $r .= " Header set Access-Control-Allow-Origin \"*\"\n"; $r .= "</IfModule>\n"; if (!$cdnftp) { return $r; } else { return "<FilesMatch \"\\.(ttf|ttc|otf|eot|woff|woff2|font.css)\$\">\n" . $r . "</FilesMatch>\n"; } } return ''; }
/** * Generates directives for file cache dir * * @param Config $config * @return string */ private function rules_cache_generate($config) { switch (true) { case Util_Environment::is_apache(): case Util_Environment::is_litespeed(): return $this->rules_cache_generate_apache($config); case Util_Environment::is_nginx(): return $this->rules_cache_generate_nginx($config); } return ''; }
/** * Generate rules related to prevent for media 404 error by WP * * @param Config $config * @return string */ private function rules_no404wp_generate($config) { switch (true) { case Util_Environment::is_apache(): case Util_Environment::is_litespeed(): return $this->rules_no404wp_generate_apache($config); } return false; }
/** * Generates rules for WP dir * * @param Config $config * @return string */ private static function rules_generate($config) { switch (true) { case Util_Environment::is_apache(): case Util_Environment::is_litespeed(): return self::rules_generate_apache($config); case Util_Environment::is_nginx(): return self::rules_generate_nginx($config); } return ''; }
/** * Returns true if we can check rules * * @return bool */ public static function can_check_rules() { return Util_Environment::is_apache() || Util_Environment::is_litespeed() || Util_Environment::is_nginx(); }