当前位置: 首页>>代码示例>>PHP>>正文


PHP w3_is_apache函数代码示例

本文整理汇总了PHP中w3_is_apache函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_is_apache函数的具体用法?PHP w3_is_apache怎么用?PHP w3_is_apache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了w3_is_apache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: set

 /**
  * Sets data
  *
  * @param string $key
  * @param string $var
  * @param int $expire
  * @return boolean
  */
 function set($key, $var, $expire = 0)
 {
     $key = $this->get_item_key($key);
     $sub_path = $this->_get_path($key);
     $path = $this->_cache_dir . '/' . $sub_path;
     $sub_dir = dirname($sub_path);
     $dir = dirname($path);
     if (!@is_dir($dir)) {
         if (!w3_mkdir_from($dir, W3TC_CACHE_DIR)) {
             return false;
         }
     }
     $fp = @fopen($path, 'w');
     if (!$fp) {
         return false;
     }
     if ($this->_locking) {
         @flock($fp, LOCK_EX);
     }
     @fputs($fp, $var['content']);
     @fclose($fp);
     if ($this->_locking) {
         @flock($fp, LOCK_UN);
     }
     // some hostings create files with restrictive permissions
     // not allowing apache to read it later
     @chmod($path, 0644);
     $old_entry_path = $path . '.old';
     @unlink($old_entry_path);
     if (w3_is_apache() && isset($var['headers']) && isset($var['headers']['Content-Type']) && substr($var['headers']['Content-Type'], 0, 8) == 'text/xml') {
         file_put_contents(dirname($path) . '/.htaccess', "<IfModule mod_mime.c>\n" . "    RemoveType .html_gzip\n" . "    AddType text/xml .html_gzip\n" . "    RemoveType .html\n" . "    AddType text/xml .html\n" . "</IfModule>");
     }
     return true;
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:42,代码来源:Generic.php

示例2: 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;
}
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:25,代码来源:rule_cut.php

示例3: 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 '';
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:29,代码来源:SharedRules.php

示例4: 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;
 }
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:16,代码来源:BrowserCacheAdmin.php

示例5: 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();
}
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:9,代码来源:define.php

示例6: 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);
     }
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:44,代码来源:MinifyAdmin.php

示例7: 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 '';
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:17,代码来源:PgCacheAdminEnvironment.php

示例8: 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()) {
            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;
}
开发者ID:niko-lgdcom,项目名称:archives,代码行数:21,代码来源:define.php

示例9: 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;
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:17,代码来源:BrowserCacheAdminEnvironment.php

示例10: 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;
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:17,代码来源:CdnAdmin.php

示例11: array

    ?>

            <code>Available</code>
            <?php 
} else {
    ?>

            <code>Not available</code>
            <?php 
}
?>

        </li>

        <?php 
if (w3_is_apache()) {
    $apache_modules = function_exists('apache_get_modules') ? apache_get_modules() : false;
    $modules = array('mod_deflate', 'mod_env', 'mod_expires', 'mod_headers', 'mod_mime', 'mod_rewrite', 'mod_setenvif');
    ?>

            <?php 
    foreach ($modules as $module) {
        ?>

                <li>
                    <?php 
        echo $module;
        ?>
:
                    <?php 
        if ($apache_modules) {
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:31,代码来源:self_test.php

示例12: generate_rules_cache

 /**
  * Generates rules
  *
  * @return string
  */
 function generate_rules_cache()
 {
     switch (true) {
         case w3_is_apache():
             return $this->generate_rules_cache_apache();
         case w3_is_nginx():
             return $this->generate_rules_cache_nginx();
     }
     return false;
 }
开发者ID:niko-lgdcom,项目名称:archives,代码行数:15,代码来源:Minify.php

示例13: 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;
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:14,代码来源:NewRelicAdmin.php

示例14: verify_compatibility

 /**
  * Checks if the platform running WP is supported by New Relic.
  * The verifications is based on https://newrelic.com/docs/php/new-relic-for-php
  * @return array
  */
 function verify_compatibility()
 {
     $supported_string = __('Supported', 'w3-total-cache');
     $php_versions = array('5.2.x', '5.3.x', '5.4.x');
     $verified = array();
     $version = explode('.', PHP_VERSION);
     $php_version = sprintf('%s.%s.%s', $version[0], $version[1], $version[2]);
     $php_version_check = version_compare($php_version, '5.2', '>') && version_compare($php_version, '5.5', '<');
     $verified[__('PHP version', 'w3-total-cache')] = $php_version_check ? $supported_string : sprintf(__('Not supported: %s. Supported versions are %s.', 'w3-total-cache'), $php_version, implode(', ', $php_versions));
     $os_name = php_uname('s');
     switch ($os_name) {
         case 'Linux':
             /**
              * Any other version of Linux with kernel 2.6.13 or later
              * (2.6.26 and later highly recommended) and glibc 2.5 or later
              */
             $version = explode('.', php_uname('r'));
             $os_version = sprintf('%d.%d.%d', $version[0], $version[1], $version[2]);
             $os_check = version_compare($os_version, '2.6.13', '>=');
             break;
         case 'FreeBSD':
             /**
              * You must enable the linkthr build option so that the New Relic agent will not cause your PHP to hang.
              */
             $version = explode('.', php_uname('r'));
             $os_version = sprintf('%d.%d', $version[0], $version[1]);
             $os_check = version_compare($os_version, '7.3', '>=');
             break;
         case 'MacOS/X':
             /**
              * MacOS/X configurations do not use the standard /etc/init.d/newrelic-daemon script.
              * Instead, they use /usr/bin/newrelic-daemon-service in the same way; for example:
              * /usr/bin/newrelic-daemon-service restart.
              */
             $version = explode('.', php_uname('r'));
             $os_version = sprintf('%d.%d', $version[0], $version[1]);
             $os_check = version_compare($os_version, '10.5', '>=');
             break;
         case 'Open Solaris':
             /**
              * snv_134b or later
              */
             $version = explode('.', php_uname('r'));
             $os_version = sprintf('%d', $version[0]);
             $os_check = version_compare($os_version, '10', '==');
             break;
         default:
             $os_check = false;
             $os_name = php_uname();
             $os_version = '';
     }
     $verified[__('Operating System', 'w3-total-cache')] = $os_check ? $supported_string : sprintf(__('Not Supported. %s %s See %s page.', 'w3-total-cache'), $os_name, $os_version, '<a href="https://newrelic.com/docs/php/new-relic-for-php#requirements">
                                     NewRelic requirements</a>');
     /**
      * Apache 2.2 or 2.4 via mod_php
      * Or any web server that supports FastCGI using php-fpm
      */
     $server = explode('/', $_SERVER['SERVER_SOFTWARE']);
     $ws_name = $server[0];
     $version = explode('.', $server[1]);
     $ws_version = sprintf('%d.%d', $version[0], $version[1]);
     switch (true) {
         case w3_is_apache():
             $ws_check = version_compare($ws_version, '2.2', '>=') || version_compare($ws_version, '2.4', '>=');
             break;
         case w3_is_nginx():
             $ws_check = php_sapi_name() == 'fpm-fcgi';
             $ws_name .= php_sapi_name();
             break;
         default:
             $ws_check = php_sapi_name() == 'fpm-fcgi';
             $ws_name = $_SERVER['SERVER_SOFTWARE'];
             $ws_version = '';
     }
     $verified[__('Web Server', 'w3-total-cache')] = $ws_check ? $supported_string : sprintf(__('Not Supported. %s %s See %s page.', 'w3-total-cache'), $ws_name, $ws_version, '<a href="https://newrelic.com/docs/php/new-relic-for-php#requirements">
                                     NewRelic requirements</a>');
     return $verified;
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:83,代码来源:NewRelicService.php

示例15: 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.');
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:67,代码来源:TotalCacheAdmin.php


注:本文中的w3_is_apache函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。