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


PHP Util_Environment::is_apache方法代码示例

本文整理汇总了PHP中Util_Environment::is_apache方法的典型用法代码示例。如果您正苦于以下问题:PHP Util_Environment::is_apache方法的具体用法?PHP Util_Environment::is_apache怎么用?PHP Util_Environment::is_apache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Util_Environment的用法示例。


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

示例1: allow_origin

 /**
  * 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 '';
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:22,代码来源:Util_RuleSnippet.php

示例2: set

 /**
  * Sets data
  *
  * @param string  $key
  * @param string  $var
  * @param int     $expire
  * @param string  $group  Used to differentiate between groups of cache values
  * @return boolean
  */
 function set($key, $var, $expire = 0, $group = '')
 {
     $key = $this->get_item_key($key);
     $sub_path = $this->_get_path($key);
     $path = $this->_cache_dir . '/' . $sub_path;
     $dir = dirname($path);
     if (!@is_dir($dir)) {
         if (!Util_File::mkdir_from($dir, W3TC_CACHE_DIR)) {
             return false;
         }
     }
     $tmppath = $path . '.' . getmypid();
     $fp = @fopen($tmppath, '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);
     if (@filesize($tmppath) > 0) {
         @unlink($path);
         @rename($tmppath, $path);
     }
     @unlink($tmppath);
     $old_entry_path = $path . '.old';
     @unlink($old_entry_path);
     if (Util_Environment::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:developmentDM2,项目名称:Whohaha,代码行数:48,代码来源:Cache_File_Generic.php

示例3: rules_cache_generate

 /**
  * 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 '';
 }
开发者ID:eduardodomingos,项目名称:eduardodomingos.com,代码行数:17,代码来源:Minify_Environment.php

示例4: rules_generate

 /**
  * 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 '';
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:17,代码来源:Extension_FeedBurner_Environment.php

示例5: _e

    ?>
</code>
            <?php 
} else {
    ?>
            <code><?php 
    _e('Not available', 'w3-total-cache');
    ?>
</code>
            <?php 
}
?>
        </li>

        <?php 
if (Util_Environment::is_apache()) {
    $apache_modules = function_exists('apache_get_modules') ? apache_get_modules() : false;
    $modules = array('mod_deflate', 'mod_env', 'mod_expires', 'mod_filter', 'mod_ext_filter', 'mod_headers', 'mod_mime', 'mod_rewrite', 'mod_setenvif');
    ?>
            <?php 
    foreach ($modules as $module) {
        ?>
                <li>
                    <?php 
        echo $module;
        ?>
:
                    <?php 
        if ($apache_modules) {
            ?>
                        <?php 
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:31,代码来源:self_test.php

示例6: rules_no404wp_generate

 /**
  * 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;
 }
开发者ID:eduardodomingos,项目名称:eduardodomingos.com,代码行数:15,代码来源:BrowserCache_Environment.php

示例7: 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()
 {
     $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_ok = version_compare($php_version, '5.2', '>') && version_compare($php_version, '5.5', '<');
     $supported_string = __('Supported', 'w3-total-cache');
     $verified[__('PHP version', 'w3-total-cache')] = $php_version_ok ? $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" target="_blank">
         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_check = false;
     $ws_name = $_SERVER['SERVER_SOFTWARE'];
     $ws_version = '';
     if (sizeof($server) > 1) {
         $ws_name = $server[0];
         $ws_version = $server[1];
         if (sizeof($version = explode('.', $ws_version)) > 1) {
             $ws_version = sprintf('%d.%d', $version[0], $version[1]);
         }
     }
     switch (true) {
         case Util_Environment::is_apache():
             if ($ws_version) {
                 $ws_check = version_compare($ws_version, '2.2', '>=') || version_compare($ws_version, '2.4', '>=');
             }
             break;
         case Util_Environment::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" target="_blank">
                                     NewRelic Requirements</a>');
     return $verified;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:93,代码来源:Extension_NewRelic_Service.php

示例8: can_check_rules

 /**
  * 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();
 }
开发者ID:eduardodomingos,项目名称:eduardodomingos.com,代码行数:9,代码来源:Util_Rule.php


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