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


PHP w3_is_nginx函数代码示例

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


在下文中一共展示了w3_is_nginx函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:25,代码来源:rule_cut.php

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

示例3: 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

示例4: 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

示例5: _get_page_key

 /**
  * Returns page key
  *
  * @param string $mobile_group
  * @param string $referrer_group
  * @param string $encryption
  * @param string $compression
  * @param string $content_type
  * @param string $request_uri
  * @return string
  */
 function _get_page_key($mobile_group = '', $referrer_group = '', $encryption = '', $compression = '', $content_type = '', $request_uri = '')
 {
     if ($request_uri) {
         $key = substr($request_uri, strtolower(substr($request_uri, 0, 8)) == 'https' ? 8 : 7);
     } else {
         $key = $this->_request_host . $this->_request_uri;
     }
     // replace fragment
     $key = preg_replace('~#.*$~', '', $key);
     if ($this->_enhanced_mode) {
         // URL decode
         $key = urldecode($key);
         // replace double slashes
         $key = preg_replace('~[/\\\\]+~', '/', $key);
         // replace query string
         $key = preg_replace('~\\?.*$~', '', $key);
         // replace index.php
         $key = str_replace('/index.php', '/', $key);
         // trim slash
         $key = ltrim($key, '/');
         if ($key && substr($key, -1) != '/') {
             $key .= '/';
         }
         $key .= '_index';
     } else {
         if ($this->_check_query_string()) {
             // replace query string
             $key = preg_replace('~\\?.*$~', '', $key);
         }
         $key = md5($key);
     }
     /**
      * Append mobile group
      */
     if ($mobile_group) {
         $key .= '_' . $mobile_group;
     }
     /**
      * Append referrer group
      */
     if ($referrer_group) {
         $key .= '_' . $referrer_group;
     }
     /**
      * Append encryption
      */
     if ($encryption) {
         $key .= '_' . $encryption;
     }
     if (w3_is_preview_mode()) {
         $key .= '_preview';
     }
     if ($this->_enhanced_mode) {
         /**
          * Append HTML extension.
          * For nginx - we create .xml cache entries and redirect to them
          */
         if (w3_is_nginx() && substr($content_type, 0, 8) == 'text/xml' && $this->_config->get_boolean('pgcache.cache.nginx_handle_xml')) {
             $key .= '.xml';
         } else {
             $key .= '.html';
         }
     }
     /**
      * Append compression
      */
     if ($compression) {
         $key .= '_' . $compression;
     }
     return $key;
 }
开发者ID:easinewe,项目名称:Avec2016,代码行数:82,代码来源:PgCache.php

示例6: w3_add_rules

/**
 * @param SelfTestExceptions $exs
 * @param string $path
 * @param string $rules
 * @param string $start
 * @param string $end
 * @param array $order
 */
function w3_add_rules($exs, $path, $rules, $start, $end, $order)
{
    $data = @file_get_contents($path);
    if ($data === false) {
        $data = '';
    }
    $rules_missing = !empty($rules) && strstr(w3_clean_rules($data), w3_clean_rules($rules)) === false;
    if (!$rules_missing) {
        return;
    }
    $replace_start = strpos($data, $start);
    $replace_end = strpos($data, $end);
    if ($replace_start !== false && $replace_end !== false && $replace_start < $replace_end) {
        $replace_length = $replace_end - $replace_start + strlen($end) + 1;
    } else {
        $replace_start = false;
        $replace_length = 0;
        $search = $order;
        foreach ($search as $string => $length) {
            $replace_start = strpos($data, $string);
            if ($replace_start !== false) {
                $replace_start += $length;
                break;
            }
        }
    }
    if ($replace_start !== false) {
        $data = w3_trim_rules(substr_replace($data, $rules, $replace_start, $replace_length));
    } else {
        $data = w3_trim_rules($data . $rules);
    }
    if (strpos($path, W3TC_CACHE_DIR) === false || w3_is_nginx()) {
        try {
            w3_wp_write_to_file($path, $data);
        } catch (FilesystemOperationException $ex) {
            if ($replace_start !== false) {
                $exs->push(new FilesystemModifyException($ex->getMessage(), $ex->credentials_form(), sprintf(__('Edit file <strong>%s
                        </strong> and replace all lines between and including <strong>%s</strong> and
                        <strong>%s</strong> markers with:', 'w3-total-caceh'), $path, $start, $end), $path, $rules));
            } else {
                $exs->push(new FilesystemModifyException($ex->getMessage(), $ex->credentials_form(), sprintf(__('Edit file <strong>%s</strong> and add the following rules
                                above the WordPress directives:', 'w3-total-cache'), $path), $path, $rules));
            }
        }
    } else {
        if (!@file_exists(dirname($path))) {
            w3_mkdir_from(dirname($path), W3TC_CACHE_DIR);
        }
        if (!@file_put_contents($path, $data)) {
            try {
                w3_wp_delete_folder(dirname($path), '', $_SERVER['REQUEST_URI']);
            } catch (FilesystemOperationException $ex) {
                $exs->push($ex);
            }
        }
    }
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:65,代码来源:rule.php

示例7: canonical_generated_by

 /**
  * Checks whether canonical should be generated or not by browsercache plugin
  * @param W3_Config $config
  * @param boolean $cdnftp
  * @return string|null
  */
 public function canonical_generated_by($config, $cdnftp = false)
 {
     if (!$this->_should_canonical_be_generated($config, $cdnftp)) {
         return null;
     }
     if (w3_is_nginx()) {
         // in nginx - browsercache generates canonical if its enabled,
         // since it does not allow multiple location tags
         if ($config->get_boolean('browsercache.enabled')) {
             return 'browsercache';
         }
     }
     if ($config->get_boolean('cdn.enabled')) {
         return 'cdn';
     }
     return null;
 }
开发者ID:Supreme007,项目名称:bestilblomster,代码行数:23,代码来源:Dispatcher.php

示例8: remove_rules_cache_multisite_nginx_with_message

 /**
  * @return array
  */
 function remove_rules_cache_multisite_nginx_with_message()
 {
     $ftp_form = null;
     $errors = array();
     $errors_short_form = array();
     if (w3_is_multisite() && w3_is_nginx() && $this->check_rules_cache()) {
         try {
             $this->remove_rules_cache();
         } catch (Exception $e) {
             $errors[] = sprintf('To fully disable Page Cache Disc: Enhanced for Network Sites rules need to be removed. To remove them manually, 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_pgcache_rules_core_path(), W3TC_MARKER_BEGIN_PGCACHE_CACHE, W3TC_MARKER_END_PGCACHE_CACHE);
             $errors_short_form[] = sprintf('Edit file (<strong>%s</strong>) and remove all lines between and including <strong>%s</strong> and <strong>%s</strong> markers inclusive.', w3_get_pgcache_rules_core_path(), W3TC_MARKER_BEGIN_PGCACHE_CACHE, W3TC_MARKER_END_PGCACHE_CACHE);
             if (!isset($ftp_form) && $e instanceof FilesystemCredentialException) {
                 $ftp_form = $e->ftp_form();
             }
         }
     }
     return array('errors' => $errors, 'ftp_form' => $ftp_form, 'errors_short_form' => $errors_short_form);
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:21,代码来源:PgCacheAdmin.php

示例9: 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

示例10: w3_get_cdn_rules_path

/**
 * Returns path of minify rules file
 *
 * @return string
 */
function w3_get_cdn_rules_path()
{
    switch (true) {
        case w3_is_apache():
        case w3_is_litespeed():
            return '.htaccess';
        case w3_is_nginx():
            return 'nginx.conf';
    }
    return false;
}
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:16,代码来源:rule.php

示例11: _e

?>
            <input type="submit" name="w3tc_save_options" class="w3tc-button-save button-primary" value="<?php 
_e('Save all settings', 'w3-total-cache');
?>
" />
        </p>
        <?php 
echo $this->postbox_footer();
?>

        <?php 
echo $this->postbox_header(__('Media &amp; Other Files', 'w3-total-cache'), '', 'media');
?>
        <table class="form-table">
            <?php 
if (!w3_is_nginx()) {
    ?>
            <tr>
                <th colspan="2">
                    <?php 
    $this->checkbox('browsercache.other.last_modified');
    ?>
 <?php 
    w3_e_config_label('browsercache.other.last_modified');
    ?>
</label>
                    <br /><span class="description"><?php 
    _e('Set the Last-Modified header to enable 304 Not Modified response.', 'w3-total-cache');
    ?>
</span>
                </th>
开发者ID:easinewe,项目名称:Avec2016,代码行数:31,代码来源:browsercache.php

示例12: esc_textarea

    ?>
 disabled="disabled"<?php 
}
?>
><?php 
echo esc_textarea(implode("\r\n", $this->_config->get_array('pgcache.cache.headers')));
?>
</textarea><br />
                    <span class="description"><?php 
_e('Specify additional page headers to cache.', 'w3-total-cache');
?>
</span>
                </td>
            </tr>
            <?php 
if (w3_is_nginx() && $this->_config->get_string('pgcache.engine') == 'file_generic') {
    ?>
            <tr>
                <th><label><?php 
    _e('Handle <acronym title="Extensible Markup Language">XML</acronym> mime type', 'w3-total-cache');
    ?>
</label></th>
                <td>
                    <?php 
    $this->checkbox('pgcache.cache.nginx_handle_xml', true);
    ?>
 <?php 
    _e('Handle XML mime type', 'w3-total-cache');
    ?>
</label><br />
                    <span class="description"><?php 
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:31,代码来源:pgcache.php

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

示例14: _should_browsercache_generate_canonical

 /**
  * Checks whether canonical should be generated or not
  * @param boolean $cdnftp
  * @return bool
  */
 private function _should_browsercache_generate_canonical($cdnftp = false)
 {
     return $this->_canonical_generation_general_check($cdnftp) && w3_is_nginx();
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:9,代码来源:Dispatcher.php

示例15: 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


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