本文整理汇总了PHP中Util_Environment::site_path方法的典型用法代码示例。如果您正苦于以下问题:PHP Util_Environment::site_path方法的具体用法?PHP Util_Environment::site_path怎么用?PHP Util_Environment::site_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util_Environment
的用法示例。
在下文中一共展示了Util_Environment::site_path方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_pgcache_rules_core_path
/**
* Returns path of pagecache core rules file
*
* @return string
*/
public static function get_pgcache_rules_core_path()
{
switch (true) {
case Util_Environment::is_apache():
case Util_Environment::is_litespeed():
return Util_Environment::site_path() . '.htaccess';
case Util_Environment::is_nginx():
return Util_Rule::get_nginx_rules_path();
}
return false;
}
示例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: url_to_docroot_filename
/**
* Normalizes file name for minify
* Relative to document root!
*
* @param string $file
* @return string
*/
public static function url_to_docroot_filename($url)
{
$data = array('home_url' => get_home_url(), 'url' => $url);
$data = apply_filters('w3tc_url_to_docroot_filename', $data);
$home_url = $data['home_url'];
$normalized_url = $data['url'];
$normalized_url = Util_Environment::remove_query_all($normalized_url);
// cut protocol
$normalized_url = preg_replace('~^http(s)?://~', '//', $normalized_url);
$home_url = preg_replace('~^http(s)?://~', '//', $home_url);
if (substr($normalized_url, 0, strlen($home_url)) != $home_url) {
// not a home url, return unchanged since cant be
// converted to filename
return $url;
} else {
$path_relative_to_home = str_replace($home_url, '', $normalized_url);
$home = set_url_scheme(get_option('home'), 'http');
$siteurl = set_url_scheme(get_option('siteurl'), 'http');
$home_path = rtrim(Util_Environment::site_path(), '/');
// adjust home_path if site is not is home
if (!empty($home) && 0 !== strcasecmp($home, $siteurl)) {
// $siteurl - $home
$wp_path_rel_to_home = rtrim(str_ireplace($home, '', $siteurl), '/');
if (substr($home_path, -strlen($wp_path_rel_to_home)) == $wp_path_rel_to_home) {
$home_path = substr($home_path, 0, -strlen($wp_path_rel_to_home));
}
}
// common encoded characters
$path_relative_to_home = str_replace('%20', ' ', $path_relative_to_home);
$full_filename = $home_path . DIRECTORY_SEPARATOR . trim($path_relative_to_home, DIRECTORY_SEPARATOR);
$docroot = Util_Environment::document_root();
if (substr($full_filename, 0, strlen($docroot)) == $docroot) {
$docroot_filename = substr($full_filename, strlen($docroot));
} else {
$docroot_filename = $path_relative_to_home;
}
}
// sometimes urls (coming from other plugins/themes)
// contain multiple "/" like "my-folder//myfile.js" which
// fails to recognize by filesystem, while url is accessible
$docroot_filename = str_replace('//', DIRECTORY_SEPARATOR, $docroot_filename);
return ltrim($docroot_filename, DIRECTORY_SEPARATOR);
}
示例4: disable_maintenance_mode
/**
* Deletes maintenance mode file
*/
public static function disable_maintenance_mode()
{
Util_WpFile::delete_file(Util_Environment::site_path() . '/.maintenance');
}