public function __construct($blog_id = null) { if (!is_null($blog_id)) { $this->_blog_id = $blog_id; $this->_is_master = $this->_blog_id == 0; } else { if (Util_Environment::is_using_master_config()) { $this->_blog_id = 0; } else { $this->_blog_id = Util_Environment::blog_id(); } $this->_is_master = Util_Environment::blog_id() == 0; } $this->_preview = Util_Environment::is_preview_mode(); $this->load(); }
/** * Convert local uri path to CDN type specific path * * @param unknown $local_uri_path * @return string */ function uri_to_cdn_uri($local_uri) { $local_uri = ltrim($local_uri, '/'); $remote_uri = $local_uri; if (Util_Environment::is_wpmu() && defined('DOMAIN_MAPPING') && DOMAIN_MAPPING) { $remote_uri = str_replace(site_url(), '', $local_uri); } $engine = $this->_config->get_string('cdn.engine'); if (Cdn_Util::is_engine_mirror($engine)) { if (Util_Environment::is_wpmu() && strpos($local_uri, 'files') === 0) { $upload_dir = Util_Environment::wp_upload_dir(); $remote_uri = $this->abspath_to_relative_path(dirname($upload_dir['basedir'])) . '/' . $local_uri; } } elseif (Util_Environment::is_wpmu() && !Util_Environment::is_wpmu_subdomain() && Util_Environment::is_using_master_config() && Cdn_Util::is_engine_push($engine)) { // in common config files are uploaded for network home url // so mirror will not contain /subblog/ path in uri $home = trim(home_url('', 'relative'), '/') . '/'; $network_home = trim(network_home_url('', 'relative'), '/') . '/'; if ($home != $network_home && substr($local_uri, 0, strlen($home)) == $home) { $remote_uri = $network_home . substr($local_uri, strlen($home)); } } return ltrim($remote_uri, '/'); }
<?php namespace W3TC; if (!defined('W3TC')) { die; } // when separate config is used - each blog has own uploads // so nothing to upload from network admin $upload_blogfiles_enabled = $cdn_mirror || !is_network_admin() || !Util_Environment::is_using_master_config(); include W3TC_INC_DIR . '/options/common/header.php'; ?> <p id="w3tc-options-menu"> <?php _e('Jump to:', 'w3-total-cache'); ?> <a href="#toplevel_page_w3tc_general"><?php _e('Main Menu', 'w3-total-cache'); ?> </a> | <a href="#general"><?php _e('General', 'w3-total-cache'); ?> </a> | <a href="#configuration"><?php _e('Configuration', 'w3-total-cache'); ?> </a> | <a href="#advanced"><?php _e('Advanced', 'w3-total-cache'); ?>
public static function cache_blog_minify_dir() { // when minify manual used with a shared config - shared // minify urls has to be used too, since CDN upload is possible // only from network admin if (Util_Environment::is_wpmu() && Util_Environment::is_using_master_config() && !Dispatcher::config()->get_boolean('minify.auto')) { $path = Util_Environment::cache_blog_dir('minify', 0); } else { $path = Util_Environment::cache_blog_dir('minify'); } return $path; }