本文整理汇总了PHP中w3_is_litespeed函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_is_litespeed函数的具体用法?PHP w3_is_litespeed怎么用?PHP w3_is_litespeed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了w3_is_litespeed函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: w3_get_pgcache_rules_cache_path
/**
* Returns path of pgcache cache rules file
* Moved to separate file to not load rule.php for each disk enhanced request
*
* @return string
*/
function w3_get_pgcache_rules_cache_path()
{
switch (true) {
case w3_is_apache():
case w3_is_litespeed():
if (w3_is_network()) {
$url = w3_get_home_url();
$match = null;
if (preg_match('~http(s)?://(.+?)(/)?$~', $url, $match)) {
$home_path = $match[2];
return W3TC_CACHE_PAGE_ENHANCED_DIR . '/' . $home_path . '/.htaccess';
}
}
return W3TC_CACHE_PAGE_ENHANCED_DIR . '/.htaccess';
case w3_is_nginx():
return w3_get_nginx_rules_path();
}
return false;
}
示例2: allow_origin
/**
* Returns allow-origin rules
*
* @param bool $cdnftp
* @return string
*/
public function allow_origin($cdnftp = false)
{
switch (true) {
case w3_is_apache():
case w3_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|font.css)\$\">\n" . $r . "</FilesMatch>\n";
}
case w3_is_nginx():
$r = " add_header Access-Control-Allow-Origin \"*\";\n";
if (!$cdnftp) {
return $r;
} else {
return "location ~ \\.(ttf|ttc|otf|eot|woff|font.css)\$ {\n" . $r . "}\n";
}
}
return '';
}
示例3: generate_rules_no404wp
/**
* Generate rules related to prevent for media 404 error by WP
*
* @return string
*/
function generate_rules_no404wp()
{
switch (true) {
case w3_is_apache():
case w3_is_litespeed():
return $this->generate_rules_no404wp_apache();
case w3_is_nginx():
return $this->generate_rules_no404wp_nginx();
}
return false;
}
示例4: w3_can_check_rules
/**
* Returns true if we can check rules
*
* @return bool
*/
function w3_can_check_rules()
{
return w3_is_apache() || w3_is_litespeed() || w3_is_nginx();
}
示例5: write_multiste_subfolder_rewrite_test_rules_apache
/**
* Write rules to handle multisite subfolder rewrite test
*/
function write_multiste_subfolder_rewrite_test_rules_apache()
{
if (!(w3_is_apache() || w3_is_litespeed())) {
return;
}
w3_require_once(W3TC_INC_DIR . '/functions/activation.php');
$path = w3_get_home_root() . '/.htaccess';
if (file_exists($path)) {
$data = @file_get_contents($path);
if ($data === false) {
w3_throw_on_read_error($path);
}
} else {
$data = '';
}
$replace_start = strpos($data, W3TC_MARKER_BEGIN_MINIFY_CACHE);
$replace_end = strpos($data, W3TC_MARKER_END_MINIFY_CACHE);
if ($replace_start !== false && $replace_end !== false && $replace_start < $replace_end) {
$replace_length = $replace_end - $replace_start + strlen(W3TC_MARKER_END_MINIFY_CACHE) + 1;
} else {
$replace_start = false;
$replace_length = 0;
$search = array(W3TC_MARKER_BEGIN_PGCACHE_CACHE => 0, W3TC_MARKER_BEGIN_BROWSERCACHE_CACHE => 0, W3TC_MARKER_BEGIN_MINIFY_CORE => 0, W3TC_MARKER_BEGIN_PGCACHE_CORE => 0, W3TC_MARKER_BEGIN_BROWSERCACHE_NO404WP => 0, W3TC_MARKER_BEGIN_WORDPRESS => 0);
foreach ($search as $string => $length) {
$replace_start = strpos($data, $string);
if ($replace_start !== false) {
$replace_start += $length;
break;
}
}
}
$rule = $this->generate_multisite_subfolder_rewrite_test_rules_apache();
if ($replace_start !== false) {
$data = w3_trim_rules(substr_replace($data, $rule, $replace_start, $replace_length));
} else {
$data = w3_trim_rules($data . $rule);
}
if (!@file_put_contents($path, $data)) {
w3_throw_on_write_error($path);
}
}
示例6: rules_cache_generate
/**
* Generates directives for file cache dir
*
* @param W3_Config $config
* @return string
*/
public function rules_cache_generate($config)
{
switch (true) {
case w3_is_apache():
case w3_is_litespeed():
return $this->rules_cache_generate_apache($config);
case w3_is_nginx():
return $this->rules_cache_generate_nginx($config);
}
return '';
}
示例7: rules_no404wp_generate
/**
* Generate rules related to prevent for media 404 error by WP
*
* @param W3_Config $config
* @return string
*/
private function rules_no404wp_generate($config)
{
switch (true) {
case w3_is_apache():
case w3_is_litespeed():
return $this->rules_no404wp_generate_apache($config);
case w3_is_nginx():
return $this->rules_no404wp_generate_nginx($config);
}
return false;
}
示例8: generate_rules
/**
* Returns rules
*
* @param bool $cdnftp
* @return string
*/
function generate_rules($cdnftp = false)
{
switch (true) {
case w3_is_apache():
case w3_is_litespeed():
return $this->generate_rules_apache($cdnftp);
case w3_is_nginx():
return $this->generate_rules_nginx($cdnftp);
}
return false;
}
示例9: w3_can_modify_rules
/**
* Returns true if we can modify rules
*
* @param string $path
* @return boolean
*/
function w3_can_modify_rules($path)
{
if (w3_is_network()) {
if (w3_is_apache() || w3_is_litespeed() || w3_is_nginx()) {
switch ($path) {
case w3_get_pgcache_rules_cache_path():
case w3_get_minify_rules_core_path():
case w3_get_minify_rules_cache_path():
return true;
}
}
return false;
}
return true;
}
示例10: generate_rules_core
/**
* Generates rules
*
* @return string
*/
function generate_rules_core()
{
switch (true) {
case w3_is_apache():
case w3_is_litespeed():
return $this->generate_rules_core_apache();
}
return false;
}
示例11: options
//.........这里部分代码省略.........
/**
* Check for minify availability
*/
if ($this->_config->get_boolean('minify.enabled')) {
$minify_rule_error = '';
if ($this->_config->get_boolean('minify.rewrite') && $this->_config->get_boolean('config.check') && w3_can_check_rules()) {
$w3_plugin_minify = w3_instance('W3_Plugin_MinifyAdmin');
if ($w3_plugin_minify->check_rules_core()) {
if (!$this->test_rewrite_minify() && (!w3_is_multisite() || w3_is_multisite() && w3_get_blog_id() != 0)) {
$this->_errors[] = 'It appears Minify <acronym title="Uniform Resource Locator">URL</acronym> rewriting is not working. If using apache, verify that the server configuration allows .htaccess. Or if using nginx verify all configuration files are included in the main configuration fail (and that you have reloaded / restarted nginx).';
}
if ($w3_plugin_minify->check_rules_has_legacy()) {
$this->_rule_errors[] = array(sprintf('Edit the configuration file (<strong>%s</strong>) and ' . 'remove all lines between and including <strong>%s</strong> and ' . '<strong>%s</strong> markers inclusive.', w3_get_minify_rules_core_path(), W3TC_MARKER_BEGIN_MINIFY_LEGACY, W3TC_MARKER_END_MINIFY_LEGACY), 'minify_remove_rules_legacy');
}
} else {
if ($w3_plugin_minify->check_rules_has_core()) {
$minify_rule_error = sprintf('replace the content of ' . 'the server configuration file <strong>%s</strong> between %s and ' . '%s markers inclusive', w3_get_minify_rules_core_path(), W3TC_MARKER_BEGIN_MINIFY_CORE, W3TC_MARKER_END_MINIFY_CORE);
} elseif ($w3_plugin_minify->check_rules_has_legacy()) {
$minify_rule_error = sprintf('replace the content of ' . 'the server configuration file <strong>%s</strong> between %s and ' . '%s markers inclusive', w3_get_minify_rules_core_path(), W3TC_MARKER_BEGIN_MINIFY_LEGACY, W3TC_MARKER_END_MINIFY_LEGACY);
} else {
$minify_rule_error = sprintf('add the following rules ' . 'into the server configuration file (<strong>%s</strong>) of the site', w3_get_minify_rules_core_path());
}
$minify_rule_content = $w3_plugin_minify->generate_rules_core();
}
if ($this->_config->get_string('minify.engine') == 'file' && !$w3_plugin_minify->check_rules_cache()) {
if ($minify_rule_error == '') {
$minify_rule_error = sprintf('add the following rules ' . 'into the server configuration file (<strong>%s</strong>) of the ' . 'site', w3_get_minify_rules_cache_path());
}
$minify_rule_content .= $w3_plugin_minify->generate_rules_cache();
}
if ($minify_rule_error != '' && w3_get_blog_id() == 0) {
$this->_rule_errors[] = array(sprintf('To enable Minify, ' . $minify_rule_error . ' %s <textarea class="w3tc-rules" cols="120" rows="10" ' . 'readonly="readonly">%s</textarea>.', $this->button('view code', '', 'w3tc-show-rules'), htmlspecialchars($minify_rule_content)), 'minify_write_rules');
}
if ((w3_is_apache() || w3_is_litespeed()) && w3_is_network() && !w3_is_subdomain_install() && !$w3_plugin_minify->check_multisite_subfolder_test_rules_cache_apache()) {
$minify_rule_test = sprintf('To enable Minify Rewrite Test, add the following rules ' . 'into the server configuration file (<strong>%s</strong>) of the ' . 'site', w3_get_document_root() . '/.htaccess');
$minify_test_rule_content = $w3_plugin_minify->generate_multisite_subfolder_rewrite_test_rules_apache();
$this->_rule_errors[] = array(sprintf($minify_rule_test . ' %s <textarea class="w3tc-rules" cols="120" rows="10" ' . 'readonly="readonly">%s</textarea>.', $this->button('view code', '', 'w3tc-show-rules'), htmlspecialchars($minify_test_rule_content)), 'minify_write_test_rules');
}
}
/**
* Minifiers availability error handling
*/
$minifiers_errors = array();
if ($this->_config->get_string('minify.js.engine') == 'yuijs') {
$path_java = $this->_config->get_string('minify.yuijs.path.java');
$path_jar = $this->_config->get_string('minify.yuijs.path.jar');
if (!file_exists($path_java)) {
$minifiers_errors[] = sprintf('YUI Compressor (JS): JAVA executable path was not found. The default minifier JSMin will be used instead.');
} elseif (!file_exists($path_jar)) {
$minifiers_errors[] = sprintf('YUI Compressor (JS): JAR file path was not found. The default minifier JSMin will be used instead.');
}
}
if ($this->_config->get_string('minify.css.engine') == 'yuicss') {
$path_java = $this->_config->get_string('minify.yuicss.path.java');
$path_jar = $this->_config->get_string('minify.yuicss.path.jar');
if (!file_exists($path_java)) {
$minifiers_errors[] = sprintf('YUI Compressor (CSS): JAVA executable path was not found. The default CSS minifier will be used instead.');
} elseif (!file_exists($path_jar)) {
$minifiers_errors[] = sprintf('YUI Compressor (CSS): JAR file path was not found. The default CSS minifier will be used instead.');
}
}
if ($this->_config->get_string('minify.js.engine') == 'ccjs') {
$path_java = $this->_config->get_string('minify.ccjs.path.java');
$path_jar = $this->_config->get_string('minify.ccjs.path.jar');
if (!file_exists($path_java)) {
$minifiers_errors[] = sprintf('Closure Compiler: JAVA executable path was not found. The default minifier JSMin will be used instead.');