本文整理汇总了PHP中w3_get_domain函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_get_domain函数的具体用法?PHP w3_get_domain怎么用?PHP w3_get_domain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了w3_get_domain函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_imported_legacy_config_keys
/**
* Reads legacy config file
* @param int $blog_id
* @param bool $force_master
* @return array
*/
public function get_imported_legacy_config_keys($blog_id, $force_master = false)
{
$suffix = '';
if ($force_master) {
} else {
if ($blog_id > 0) {
if (w3_is_network()) {
if (w3_is_subdomain_install()) {
$suffix = '-' . w3_get_domain(w3_get_host());
} else {
// try subdir blog
$request_uri = rtrim($_SERVER['REQUEST_URI'], '/');
$site_home_uri = w3_get_base_path();
if (substr($request_uri, 0, strlen($site_home_uri)) == $site_home_uri) {
$request_path_in_wp = '/' . substr($request_uri, strlen($site_home_uri));
$n = strpos($request_path_in_wp, '/', 1);
if ($n === false) {
$blog_path_in_wp = substr($request_path_in_wp, 1);
} else {
$blog_path_in_wp = substr($request_path_in_wp, 1, $n - 1);
}
$suffix = '-' . ($blog_path_in_wp != 'wp-admin' ? $blog_path_in_wp . '.' : '') . w3_get_domain(w3_get_host());
}
}
}
}
}
$filename = WP_CONTENT_DIR . '/w3-total-cache-config' . $suffix . '.php';
$legacy_config = W3_ConfigData::get_array_from_file($filename);
if (is_array($legacy_config) && isset($legacy_config['pgcache.engine']) && $legacy_config['pgcache.engine'] == 'file_pgcache') {
$legacy_config['pgcache.engine'] = 'file_generic';
}
return $legacy_config;
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:40,代码来源:ConfigCompatibility.php
示例2: cleanup_local
function cleanup_local()
{
$engine = $this->_config->get_string('pgcache.engine');
switch ($engine) {
case 'file':
w3_require_once(W3TC_LIB_W3_DIR . '/Cache/File/Cleaner.php');
$w3_cache_file_cleaner = new W3_Cache_File_Cleaner(array('cache_dir' => w3_cache_blog_dir('page'), 'clean_timelimit' => $this->_config->get_integer('timelimit.cache_gc')));
$w3_cache_file_cleaner->clean();
break;
case 'file_generic':
w3_require_once(W3TC_LIB_W3_DIR . '/Cache/File/Cleaner/Generic.php');
if (w3_get_blog_id() == 0) {
$flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR;
} else {
$flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR . '/' . w3_get_domain(w3_get_host());
}
$w3_cache_file_cleaner_generic = new W3_Cache_File_Cleaner_Generic(array('exclude' => array('.htaccess'), 'cache_dir' => $flush_dir, 'expire' => $this->_config->get_integer('browsercache.html.lifetime'), 'clean_timelimit' => $this->_config->get_integer('timelimit.cache_gc')));
$w3_cache_file_cleaner_generic->clean();
break;
}
}
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:21,代码来源:PgCacheAdmin.php
示例3: _flush_based_on_regex
/**
* Flush cache based on regex
* @param string $regex
*/
private function _flush_based_on_regex($regex)
{
if (w3_is_multisite() && !w3_is_subdomain_install()) {
$domain = w3_get_home_url();
$parsed = parse_url($domain);
$host = $parsed['host'];
$path = trim($parsed['path'], '/');
$flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR . '/' . $host . '/' . $path;
} else {
$flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR . '/' . w3_get_domain(w3_get_host());
}
$dir = @opendir($flush_dir);
if ($dir) {
while (($entry = @readdir($dir)) !== false) {
if ($entry == '.' || $entry == '..') {
continue;
}
if (preg_match('/' . $regex . '/', basename($entry))) {
w3_rmdir($flush_dir . DIRECTORY_SEPARATOR . $entry);
}
}
@closedir($dir);
}
}
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:28,代码来源:Generic.php
示例4: _send_notification
/**
* Send E-mail notification when error occurred
*
* @return boolean
*/
function _send_notification()
{
$from_email = 'wordpress@' . w3_get_domain($_SERVER['SERVER_NAME']);
$from_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$to_name = $to_email = get_option('admin_email');
$body = @file_get_contents(W3TC_INC_DIR . '/email/minify_error_notification.php');
$headers = array(sprintf('From: "%s" <%s>', addslashes($from_name), $from_email), sprintf('Reply-To: "%s" <%s>', addslashes($to_name), $to_email), 'Content-Type: text/html; charset=UTF-8');
@set_time_limit($this->_config->get_integer('timelimit.email_send'));
$result = @wp_mail($to_email, 'W3 Total Cache Error Notification', $body, implode("\n", $headers));
return $result;
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:16,代码来源:Minify.php
示例5: w3_parse_path
/**
* Parses path
*
* @param string $path
* @return mixed
*/
function w3_parse_path($path)
{
$path = str_replace(array('%BLOG_ID%', '%POST_ID%', '%BLOGNAME%', '%HOST%', '%DOMAIN%', '%BASE_PATH%'), array(isset($GLOBALS['blog_id']) ? (int) $GLOBALS['blog_id'] : 0, isset($GLOBALS['post_id']) ? (int) $GLOBALS['post_id'] : 0, w3_get_blogname(), w3_get_host(), w3_get_domain(w3_get_host()), trim(w3_get_base_path(), '/')), $path);
return $path;
}
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:11,代码来源:define.php
示例6: action_support_request
//.........这里部分代码省略.........
}
}
}
}
$data = array();
if (!empty($wp_login) && !empty($wp_password)) {
$data['WP Admin login'] = $wp_login;
$data['WP Admin password'] = $wp_password;
}
if (!empty($ftp_host) && !empty($ftp_login) && !empty($ftp_password)) {
$data['SSH / FTP host'] = $ftp_host;
$data['SSH / FTP login'] = $ftp_login;
$data['SSH / FTP password'] = $ftp_password;
}
/**
* Store request data for future access
*/
if (count($data)) {
$hash = md5(microtime());
$request_data = get_option('w3tc_request_data', array());
$request_data[$hash] = $data;
update_option('w3tc_request_data', $request_data);
$request_data_url = sprintf('%s/w3tc_request_data/%s', w3_get_home_url(), $hash);
} else {
$request_data_url = '';
}
$nonce = wp_create_nonce('w3tc_support_request');
if (is_network_admin()) {
update_site_option('w3tc_support_request', $nonce);
} else {
update_option('w3tc_support_request', $nonce);
}
$file_access = WP_PLUGIN_URL . '/' . dirname(W3TC_FILE) . '/pub/files.php';
if (w3_get_domain(w3_get_home_url()) != w3_get_domain(w3_get_site_url())) {
$file_access = str_replace(w3_get_domain(w3_get_home_url()), w3_get_domain(w3_get_site_url()), $file_access);
}
$post['file_access'] = $file_access;
$post['nonce'] = $nonce;
$post['request_data_url'] = $request_data_url;
$post['ip'] = $_SERVER['REMOTE_ADDR'];
$post['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
$post['version'] = W3TC_VERSION;
$post['plugin'] = 'W3 Total Cache';
$post['request_id'] = $request_id;
$license_level = 'community';
if (w3_is_pro($this->_config)) {
$license_level = 'pro';
} elseif (w3_is_enterprise($this->_config)) {
$license_level = 'enterprise';
}
$post['license_level'] = $license_level;
$unset = array('wp_login', 'wp_password', 'ftp_host', 'ftp_login', 'ftp_password');
foreach ($unset as $key) {
unset($post[$key]);
}
foreach ($attachments as $attachment) {
if (is_network_admin()) {
update_site_option('attachment_' . md5($attachment), $attachment);
} else {
update_option('attachment_' . md5($attachment), $attachment);
}
}
$post = array_merge($post, array('files' => $attachments));
if (defined('W3_SUPPORT_DEBUG') && W3_SUPPORT_DEBUG) {
$data = sprintf("[%s] Post support request\n", date('r'));
foreach ($post as $key => $value) {
开发者ID:easinewe,项目名称:Avec2016,代码行数:67,代码来源:SupportActionsAdmin.php
示例7: _get_cache
/**
* Returns cache object
*
* @return W3_Cache_Base
*/
function _get_cache()
{
static $cache = array();
if (!isset($cache[0])) {
$engine = $this->_config->get_string('pgcache.engine');
switch ($engine) {
case 'memcached':
$engineConfig = array('servers' => $this->_config->get_array('pgcache.memcached.servers'), 'persistant' => $this->_config->get_boolean('pgcache.memcached.persistant'));
break;
case 'file':
$engineConfig = array('section' => 'page', 'flush_parent' => w3_get_blog_id() == 0, 'locking' => $this->_config->get_boolean('pgcache.file.locking'), 'flush_timelimit' => $this->_config->get_integer('timelimit.cache_flush'));
break;
case 'file_generic':
if (w3_get_blog_id() == 0) {
$flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR;
} else {
$flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR . '/' . w3_get_domain(w3_get_host());
}
$engineConfig = array('exclude' => array('.htaccess'), 'expire' => $this->_lifetime, 'cache_dir' => W3TC_CACHE_PAGE_ENHANCED_DIR, 'locking' => $this->_config->get_boolean('pgcache.file.locking'), 'flush_timelimit' => $this->_config->get_integer('timelimit.cache_flush'), 'flush_dir' => $flush_dir);
break;
default:
$engineConfig = array();
}
$engineConfig['use_expired_data'] = true;
$engineConfig['module'] = 'pgcache';
$engineConfig['host'] = w3_get_host();
$engineConfig['instance_id'] = w3_get_instance_id();
w3_require_once(W3TC_LIB_W3_DIR . '/Cache.php');
$cache[0] = W3_Cache::instance($engine, $engineConfig);
}
return $cache[0];
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:37,代码来源:PgCache.php
示例8: w3_get_blogname
/**
* Detect WPMU blogname
*
* @return string
*/
function w3_get_blogname()
{
static $blogname = null;
if ($blogname === null) {
if (w3_is_wpmu()) {
$domain = w3_get_domain($_SERVER['HTTP_HOST']);
if (w3_is_vhost()) {
$blogname = $domain;
} else {
$uri = $_SERVER['REQUEST_URI'];
$site_path = w3_get_site_path();
if ($site_path != '' && strpos($uri, $site_path) === 0) {
$uri = substr_replace($uri, '/', 0, strlen($site_path));
}
$blogname = w3_get_blogname_from_uri($uri);
if ($blogname != '') {
$blogname = $blogname . '.' . $domain;
} else {
$blogname = $domain;
}
}
} else {
$blogname = '';
}
}
return $blogname;
}
开发者ID:alx,项目名称:SBek-Arak,代码行数:32,代码来源:define.php
示例9: print_script
function print_script()
{
?>
<script type="text/javascript">
var w3_use_network_link = <?php
echo is_network_admin() || w3_is_multisite() && w3_force_master() ? 'true' : 'false';
?>
;
function w3tc_start_minify_try_solve() {
var testUrl = '<?php
echo w3_filename_to_url(w3_cache_blog_dir('minify') . '/', w3_get_domain(w3_get_home_url()) != w3_get_domain(w3_get_site_url()));
?>
';
w3tc_filename_auto_solve(testUrl);
}
</script>
<?php
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:18,代码来源:MinifyAdmin.php
示例10: _import_legacy_config
/**
* Reads legacy config file
*
* @param object $compiled_config
* @return array
*/
private function _import_legacy_config($compiled_config)
{
$suffix = '';
if ($this->_blog_id > 0) {
if (w3_is_network()) {
if (w3_is_subdomain_install()) {
$suffix = '-' . w3_get_domain(w3_get_host());
} else {
// try subdir blog
$request_uri = rtrim($_SERVER['REQUEST_URI'], '/');
$site_home_uri = w3_get_base_path();
if (substr($request_uri, 0, strlen($site_home_uri)) == $site_home_uri) {
$request_path_in_wp = '/' . substr($request_uri, strlen($site_home_uri));
$n = strpos($request_path_in_wp, '/', 1);
if ($n === false) {
$blog_path_in_wp = substr($request_path_in_wp, 1);
} else {
$blog_path_in_wp = substr($request_path_in_wp, 1, $n - 1);
}
$suffix = '-' . ($blog_path_in_wp != 'wp-admin' ? $blog_path_in_wp . '.' : '') . w3_get_domain(w3_get_host());
}
}
}
}
$filename = WP_CONTENT_DIR . '/w3-total-cache-config' . $suffix . '.php';
return $compiled_config->get_array_from_file($filename);
}
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:33,代码来源:ConfigWriter.php
示例11: ob_callback
/**
* OB Callback
*
* @param string $buffer
* @return string
*/
function ob_callback(&$buffer)
{
if ($buffer != '' && w3_is_xml($buffer)) {
if ($this->can_cdn2($buffer)) {
$regexps = array();
$site_path = w3_get_site_path();
$domain_url_regexp = w3_get_domain_url_regexp();
$site_domain_url_regexp = false;
if ($domain_url_regexp != w3_get_url_regexp(w3_get_domain(w3_get_site_url()))) {
$site_domain_url_regexp = w3_get_url_regexp(w3_get_domain(w3_get_site_url()));
}
if ($this->_config->get_boolean('cdn.uploads.enable')) {
w3_require_once(W3TC_INC_DIR . '/functions/http.php');
$upload_info = w3_upload_info();
if ($upload_info) {
$baseurl = $upload_info['baseurl'];
if (defined('DOMAIN_MAPPING') && DOMAIN_MAPPING) {
$parsed = @parse_url($upload_info['baseurl']);
$baseurl = home_url() . $parsed['path'];
}
$regexps = $this->make_uploads_regexes($domain_url_regexp, $baseurl, $upload_info, $regexps);
if ($site_domain_url_regexp) {
$regexps = $this->make_uploads_regexes($site_domain_url_regexp, $baseurl, $upload_info, $regexps);
}
}
}
if ($this->_config->get_boolean('cdn.includes.enable')) {
$mask = $this->_config->get_string('cdn.includes.files');
if ($mask != '') {
$regexps[] = '~(["\'(])\\s*((' . $domain_url_regexp . ')?(' . w3_preg_quote($site_path . WPINC) . '/(' . $this->get_regexp_by_mask($mask) . ')))~';
if ($site_domain_url_regexp) {
$regexps[] = '~(["\'(])\\s*((' . $site_domain_url_regexp . ')?(' . w3_preg_quote($site_path . WPINC) . '/(' . $this->get_regexp_by_mask($mask) . ')))~';
}
}
}
if ($this->_config->get_boolean('cdn.theme.enable')) {
$theme_dir = preg_replace('~' . $domain_url_regexp . '~i', '', get_theme_root_uri());
$mask = $this->_config->get_string('cdn.theme.files');
if ($mask != '') {
$regexps[] = '~(["\'(])\\s*((' . $domain_url_regexp . ')?(' . w3_preg_quote($theme_dir) . '/(' . $this->get_regexp_by_mask($mask) . ')))~';
if ($site_domain_url_regexp) {
$theme_dir2 = preg_replace('~' . $site_domain_url_regexp . '~i', '', get_theme_root_uri());
$regexps[] = '~(["\'(])\\s*((' . $site_domain_url_regexp . ')?(' . w3_preg_quote($theme_dir) . '/(' . $this->get_regexp_by_mask($mask) . ')))~';
$regexps[] = '~(["\'(])\\s*((' . $site_domain_url_regexp . ')?(' . w3_preg_quote($theme_dir2) . '/(' . $this->get_regexp_by_mask($mask) . ')))~';
}
}
}
if ($this->_config->get_boolean('cdn.custom.enable')) {
$masks = $this->_config->get_array('cdn.custom.files');
$masks = array_map(array($this, '_replace_folder_placeholders'), $masks);
$masks = array_map('w3_parse_path', $masks);
if (count($masks)) {
$mask_regexps = array();
foreach ($masks as $mask) {
if ($mask != '') {
$mask = w3_normalize_file($mask);
$mask_regexps[] = $this->get_regexp_by_mask($mask);
}
}
$regexps[] = '~(["\'(])\\s*((' . $domain_url_regexp . ')?(' . w3_preg_quote($site_path) . '(' . implode('|', $mask_regexps) . ')))~i';
if ($site_domain_url_regexp) {
$regexps[] = '~(["\'(])\\s*((' . $site_domain_url_regexp . ')?(' . w3_preg_quote($site_path) . '(' . implode('|', $mask_regexps) . ')))~i';
}
}
}
foreach ($regexps as $regexp) {
$buffer = preg_replace_callback($regexp, array(&$this, 'link_replace_callback'), $buffer);
}
if ($this->_config->get_boolean('cdn.minify.enable')) {
if ($this->_config->get_boolean('minify.auto')) {
$regexp = '~(["\'(])\\s*' . $this->_minify_url_regexp('/[a-zA-Z0-9-_]+\\.(css|js)') . '~U';
if (w3_is_cdn_mirror($this->_config->get_string('cdn.engine'))) {
$processor = 'link_replace_callback';
} else {
$processor = 'minify_auto_pushcdn_link_replace_callback';
}
} else {
$regexp = '~(["\'(])\\s*' . $this->_minify_url_regexp('/[a-z0-9]+/.+\\.include(-(footer|body))?(-nb)?\\.[a-f0-9]+\\.(css|js)') . '~U';
$processor = 'link_replace_callback';
}
$buffer = preg_replace_callback($regexp, array(&$this, $processor), $buffer);
}
}
if ($this->_config->get_boolean('cdn.debug')) {
$buffer .= "\r\n\r\n" . $this->get_debug_info();
}
}
return $buffer;
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:95,代码来源:Cdn.php
示例12: w3_get_blog_id
/**
* Returns blog ID
*
* @return string
*/
function w3_get_blog_id()
{
static $id = null;
if ($id === null) {
$wpmu = false;
if (defined('VHOST')) {
$wpmu = true;
} else {
$wpmu = file_exists(ABSPATH . 'wpmu-settings.php');
}
if ($wpmu) {
if (defined('VHOST') && VHOST === 'yes') {
$id = w3_get_domain($_SERVER['HTTP_HOST']);
} else {
if (defined('PATH_CURRENT_SITE')) {
$base = PATH_CURRENT_SITE;
} elseif (isset($GLOBALS['base'])) {
$base = $GLOBALS['base'];
} else {
$base = '/';
}
if (empty($base)) {
$base = '/';
}
$id = strtolower($_SERVER['REQUEST_URI']);
if (strpos($id, $base) === 0) {
$id = substr_replace($id, '', 0, strlen($base));
}
if ($pos = strpos($id, '/')) {
$id = substr($id, 0, $pos);
}
if ($pos = strpos($id, '?')) {
$id = substr($id, 0, $pos);
}
if ($id != '') {
$id = trim($id, '/');
if (in_array($id, array('page', 'comments', 'blog', 'wp-admin', 'wp-includes', 'wp-content', 'files', 'feed')) || is_file($id)) {
$id = '';
} else {
$id = $id . '.' . w3_get_domain($_SERVER['HTTP_HOST']);
}
}
}
}
}
return $id;
}
开发者ID:TheReaCompany,项目名称:pooplog,代码行数:52,代码来源:define.php
注:本文中的w3_get_domain函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论