本文整理汇总了PHP中Util_Environment::is_nginx方法的典型用法代码示例。如果您正苦于以下问题:PHP Util_Environment::is_nginx方法的具体用法?PHP Util_Environment::is_nginx怎么用?PHP Util_Environment::is_nginx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util_Environment
的用法示例。
在下文中一共展示了Util_Environment::is_nginx方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canonical
/**
* Returns canonical rules
*
* @param bool $cdnftp
* @return string
*/
public static function canonical($cdnftp = false)
{
$rules = '';
$mime_types = self::_get_other_types();
$extensions = array_keys($mime_types);
switch (true) {
case Util_Environment::is_apache():
case Util_Environment::is_litespeed():
$extensions_lowercase = array_map('strtolower', $extensions);
$extensions_uppercase = array_map('strtoupper', $extensions);
$rules .= "<FilesMatch \"\\.(" . implode('|', array_merge($extensions_lowercase, $extensions_uppercase)) . ")\$\">\n";
$rules .= self::canonical_without_location($cdnftp, '');
$rules .= "</FilesMatch>\n";
break;
case Util_Environment::is_nginx():
$rules .= "location ~ \\.(" . implode('|', $extensions) . ")\$ {\n";
$rules .= self::canonical_without_location($cdnftp, '');
$rules .= "}\n";
break;
}
return $rules;
}
示例2: 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 '';
}
示例3: 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 (Util_Environment::is_nginx() && $this->_config->get_string('pgcache.engine') == 'file_generic') {
?>
<tr>
<th><label><?php
Util_Ui::e_config_label('pgcache.cache.nginx_handle_xml');
?>
</label></th>
<td>
<?php
$this->checkbox('pgcache.cache.nginx_handle_xml', true);
?>
<?php
Util_Ui::e_config_label('pgcache.cache.nginx_handle_xml');
?>
</label><br />
<span class="description"><?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 '';
}
示例5:
</tr>
</table>
<?php
Util_Ui::button_config_save('browsercache_html_xml');
?>
<?php
Util_Ui::postbox_footer();
?>
<?php
Util_Ui::postbox_header(__('Media & Other Files', 'w3-total-cache'), '', 'media');
?>
<table class="form-table">
<?php
if (!Util_Environment::is_nginx()) {
?>
<tr>
<th colspan="2">
<?php
$this->checkbox('browsercache.other.last_modified');
?>
<?php
Util_Ui::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>
示例6: 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;
}
示例7: canonical_generated_by
/**
* Checks whether canonical should be generated or not by browsercache plugin
*
* @param Config $config
* @param boolean $cdnftp
* @return string|null
*/
public static function canonical_generated_by($config, $cdnftp = false)
{
if (!self::_should_canonical_be_generated($config, $cdnftp)) {
return null;
}
if (Util_Environment::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;
}
示例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();
}
示例9: _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_url = '')
{
if ($request_url) {
$parts = parse_url($request_url);
$key = $parts['host'] . (isset($parts['path']) ? $parts['path'] : '') . (isset($parts['query']) ? '?' . $parts['query'] : '');
} else {
$key = $this->_request_host . $this->_request_uri;
}
// replace fragment
$key = preg_replace('~#.*$~', '', $key);
$key = strtolower($key);
// host/uri in different cases means the same page in wp
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 (Util_Environment::is_preview_mode()) {
$key .= '_preview';
}
if ($this->_enhanced_mode) {
/**
* Append HTML extension.
* For nginx - we create .xml cache entries and redirect to them
*/
if (Util_Environment::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;
}