本文整理汇总了PHP中Util_Environment::host_port方法的典型用法代码示例。如果您正苦于以下问题:PHP Util_Environment::host_port方法的具体用法?PHP Util_Environment::host_port怎么用?PHP Util_Environment::host_port使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util_Environment
的用法示例。
在下文中一共展示了Util_Environment::host_port方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _get_origin
/**
* Returns origin
*
* @return string
*/
function _get_origin()
{
if ($this->type == W3TC_CDN_CF_TYPE_S3) {
$origin = sprintf('%s.s3.amazonaws.com', $this->_config['bucket']);
} else {
$origin = Util_Environment::host_port();
}
return $origin;
}
示例2: get_server_info
/**
* Returns server info
*
* @return array
*/
private function get_server_info()
{
global $wp_version, $wp_db_version, $wpdb;
$wordpress_plugins = get_plugins();
$wordpress_plugins_active = array();
foreach ($wordpress_plugins as $wordpress_plugin_file => $wordpress_plugin) {
if (is_plugin_active($wordpress_plugin_file)) {
$wordpress_plugins_active[$wordpress_plugin_file] = $wordpress_plugin;
}
}
$mysql_version = $wpdb->get_var('SELECT VERSION()');
$mysql_variables_result = (array) $wpdb->get_results('SHOW VARIABLES', ARRAY_N);
$mysql_variables = array();
foreach ($mysql_variables_result as $mysql_variables_row) {
$mysql_variables[$mysql_variables_row[0]] = $mysql_variables_row[1];
}
$server_info = array('w3tc' => array('version' => W3TC_VERSION, 'server' => !empty($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'Unknown', 'dir' => W3TC_DIR, 'cache_dir' => W3TC_CACHE_DIR, 'blog_id' => Util_Environment::blog_id(), 'home_domain_root_url' => Util_Environment::home_domain_root_url(), 'home_url_maybe_https' => Util_Environment::home_url_maybe_https(), 'site_path' => Util_Environment::site_path(), 'document_root' => Util_Environment::document_root(), 'site_root' => Util_Environment::site_root(), 'site_url_uri' => Util_Environment::site_url_uri(), 'home_url_host' => Util_Environment::home_url_host(), 'home_url_uri' => Util_Environment::home_url_uri(), 'network_home_url_uri' => Util_Environment::network_home_url_uri(), 'host_port' => Util_Environment::host_port(), 'host' => Util_Environment::host(), 'wp_config_path' => Util_Environment::wp_config_path()), 'wp' => array('version' => $wp_version, 'db_version' => $wp_db_version, 'abspath' => ABSPATH, 'home' => get_option('home'), 'siteurl' => get_option('siteurl'), 'email' => get_option('admin_email'), 'upload_info' => (array) Util_Http::upload_info(), 'theme' => Util_Theme::get_current_theme(), 'wp_cache' => defined('WP_CACHE') && WP_CACHE ? 'true' : 'false', 'plugins' => $wordpress_plugins_active), 'mysql' => array('version' => $mysql_version, 'variables' => $mysql_variables));
return $server_info;
}
示例3: host
public static function host()
{
$host_port = Util_Environment::host_port();
$pos = strpos($host_port, ':');
if ($pos === false) {
return $host_port;
}
return substr($host_port, 0, $pos);
}
示例4: init
/**
* Init action
*
* @return void
*/
function init()
{
// Load plugin text domain
load_plugin_textdomain(W3TC_TEXT_DOMAIN, null, plugin_basename(W3TC_DIR) . '/languages/');
if (is_multisite() && !is_network_admin()) {
global $w3_current_blog_id, $current_blog;
if ($w3_current_blog_id != $current_blog->blog_id && !isset($GLOBALS['w3tc_blogmap_register_new_item'])) {
$url = Util_Environment::host_port() . $_SERVER['REQUEST_URI'];
$pos = strpos($url, '?');
if ($pos !== false) {
$url = substr($url, 0, $pos);
}
$GLOBALS['w3tc_blogmap_register_new_item'] = $url;
}
}
if (isset($GLOBALS['w3tc_blogmap_register_new_item'])) {
$do_redirect = false;
// true value is a sign to just generate config cache
if ($GLOBALS['w3tc_blogmap_register_new_item'] != 'cache_options') {
if (Util_Environment::is_wpmu_subdomain()) {
$blog_home_url = $GLOBALS['w3tc_blogmap_register_new_item'];
} else {
$home_url = rtrim(get_home_url(), '/');
if (substr($home_url, 0, 7) == 'http://') {
$home_url = substr($home_url, 7);
} else {
if (substr($home_url, 0, 8) == 'https://') {
$home_url = substr($home_url, 8);
}
}
if (substr($GLOBALS['w3tc_blogmap_register_new_item'], 0, strlen($home_url)) == $home_url) {
$blog_home_url = $home_url;
} else {
$blog_home_url = $GLOBALS['w3tc_blogmap_register_new_item'];
}
}
$do_redirect = Util_WpmuBlogmap::register_new_item($blog_home_url, $this->_config);
// reset cache of blog_id
global $w3_current_blog_id;
$w3_current_blog_id = null;
// change config to actual blog, it was master before
$this->_config = new Config();
// fix environment, potentially it's first request to a specific blog
$environment = Dispatcher::component('Root_Environment');
$environment->fix_on_event($this->_config, 'first_frontend', $this->_config);
}
// need to repeat request processing, since we was not able to realize
// blog_id before so we are running with master config now.
// redirect to the same url causes "redirect loop" error in browser,
// so need to redirect to something a bit different
if ($do_redirect) {
if (strpos($_SERVER['REQUEST_URI'], '?') === false) {
Util_Environment::redirect_temp($_SERVER['REQUEST_URI'] . '?repeat=w3tc');
} else {
if (strpos($_SERVER['REQUEST_URI'], 'repeat=w3tc') === false) {
Util_Environment::redirect_temp($_SERVER['REQUEST_URI'] . '&repeat=w3tc');
}
}
}
}
/**
* Check for rewrite test request
*/
$rewrite_test = Util_Request::get_boolean('w3tc_rewrite_test');
if ($rewrite_test) {
echo 'OK';
exit;
}
$admin_bar = false;
if (function_exists('is_admin_bar_showing')) {
$admin_bar = is_admin_bar_showing();
}
if ($admin_bar) {
add_action('wp_print_scripts', array($this, 'popup_script'));
}
// dont add system stuff to search results
if (isset($_GET['repeat']) && $_GET['repeat'] == 'w3tc' || Util_Environment::is_preview_mode()) {
header('X-Robots-Tag: noindex');
}
}
示例5: esc_attr
Util_Ui::sealing_disabled('cdn.');
?>
type="password" name="cdn__cf2__secret" value="<?php
echo esc_attr($this->_config->get_string('cdn.cf2.secret'));
?>
" size="60" />
</td>
</tr>
<tr>
<th><?php
_e('Origin:', 'w3-total-cache');
?>
</th>
<td>
<?php
echo Util_Environment::host_port();
?>
<input id="cdn_create_container"
<?php
Util_Ui::sealing_disabled('cdn.');
?>
class="button {type: 'cf2', nonce: '<?php
echo wp_create_nonce('w3tc');
?>
'}" type="button" value="<?php
_e('Create distribution', 'w3-total-cache');
?>
" />
<span id="cdn_create_container_status" class="w3tc-status w3tc-process"></span>
</td>
</tr>