本文整理匯總了PHP中is_main_network函數的典型用法代碼示例。如果您正苦於以下問題:PHP is_main_network函數的具體用法?PHP is_main_network怎麽用?PHP is_main_network使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了is_main_network函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: wp_schedule_update_global_counts
function wp_schedule_update_global_counts()
{
if (!is_main_network() || !is_main_site()) {
return;
}
if (!wp_next_scheduled('update_global_counts') && !wp_installing()) {
wp_schedule_event(time(), 'twicedaily', 'update_global_counts');
}
}
示例2: path
/**
* Gets the cache folder for Bladerunner.
*/
public static function path()
{
$result = wp_upload_dir()['basedir'];
if (is_multisite() && !(is_main_network() && is_main_site() && defined('MULTISITE'))) {
$result = realpath($result . '/../..');
}
$result .= '/.cache';
$result = realpath($result);
return apply_filters('bladerunner/cache/path', $result);
}
示例3: bootstrap
/**
* Attach SSO functions into WordPress.
*/
function bootstrap()
{
// We never need this for the main network
if (is_main_network()) {
return;
}
add_filter('mercator.sso.main_domain_network', __NAMESPACE__ . '\\get_main_network');
add_filter('mercator.sso.is_main_domain', __NAMESPACE__ . '\\correct_for_subdomain_networks', 10, 3);
add_filter('mercator.sso.main_site_for_actions', __NAMESPACE__ . '\\set_main_site_for_actions');
add_action('muplugins_loaded', __NAMESPACE__ . '\\initialize_cookie_domain', 11);
}
示例4: delete_transients
public static function delete_transients()
{
global $_wp_using_ext_object_cache;
if ($_wp_using_ext_object_cache) {
return 0;
}
global $wpdb;
$records = 0;
// Delete transients from options table
$records .= self::delete_transients_single_site();
// Delete transients from multisite, if configured as such
if (is_multisite() && is_main_network()) {
$records .= self::delete_transients_multisite();
}
return $records;
}
示例5: delete_file
function delete_file($file_name)
{
$url_parts = parse_url($file_name);
if (false !== stripos($url_parts['path'], constant('LOCAL_UPLOADS'))) {
$file_uri = substr($url_parts['path'], stripos($url_parts['path'], constant('LOCAL_UPLOADS')) + strlen(constant('LOCAL_UPLOADS')));
} else {
$file_uri = '/' . $url_parts['path'];
}
$headers = array('X-Client-Site-ID: ' . constant('FILES_CLIENT_SITE_ID'), 'X-Access-Token: ' . constant('FILES_ACCESS_TOKEN'));
$service_url = $this->get_files_service_hostname() . '/' . $this->get_upload_path();
if (is_multisite() && !(is_main_network() && is_main_site())) {
$service_url .= '/sites/' . get_current_blog_id();
}
$ch = curl_init($service_url . $file_uri);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if (200 != $http_code) {
error_log(sprintf(__('Error deleting the file from the remote servers: Code %d'), $http_code));
return;
}
// We successfully deleted the file, purge the file from the caches
$invalidation_url = get_site_url() . '/' . $this->get_upload_path();
if (is_multisite() && !(is_main_network() && is_main_site())) {
$invalidation_url .= '/sites/' . get_current_blog_id();
}
$invalidation_url .= $file_uri;
$this->purge_file_cache($invalidation_url, 'PURGE');
}
示例6: wp_should_upgrade_global_tables
/**
* Determine if global tables should be upgraded.
*
* This function performs a series of checks to ensure the environment allows
* for the safe upgrading of global WordPress database tables. It is necessary
* because global tables will commonly grow to millions of rows on large
* installations, and the ability to control their upgrade routines can be
* critical to the operation of large networks.
*
* In a future iteration, this function may use `wp_is_large_network()` to more-
* intelligently prevent global table upgrades. Until then, we make sure
* WordPress is on the main site of the main network, to avoid running queries
* more than once in multi-site or multi-network environments.
*
* @since 4.3.0
*
* @return bool Whether to run the upgrade routines on global tables.
*/
function wp_should_upgrade_global_tables()
{
// Return false early if explicitly not upgrading
if (defined('DO_NOT_UPGRADE_GLOBAL_TABLES')) {
return false;
}
// Assume global tables should be upgraded
$should_upgrade = true;
// Set to false if not on main network (does not matter if not multi-network)
if (!is_main_network()) {
$should_upgrade = false;
}
// Set to false if not on main site of current network (does not matter if not multi-site)
if (!is_main_site()) {
$should_upgrade = false;
}
/**
* Filter if upgrade routines should be run on global tables.
*
* @param bool $should_upgrade Whether to run the upgrade routines on global tables.
*/
return apply_filters('wp_should_upgrade_global_tables', $should_upgrade);
}
示例7: get_dynamic_prefix
/**
* Get the prefix path for the files. Ignores WP media library
* year month subdirectory setting and just uses S3 setting
*
* @param string $time
*
* @return string
*/
function get_dynamic_prefix($time = null)
{
$prefix = '';
$subdir = '';
// If multisite (and if not the main site in a post-MU network)
if (is_multisite() && !(is_main_network() && is_main_site() && defined('MULTISITE'))) {
if (!get_site_option('ms_files_rewriting')) {
/*
* If ms-files rewriting is disabled (networks created post-3.5), it is fairly
* straightforward: Append sites/%d if we're not on the main site (for post-MU
* networks). (The extra directory prevents a four-digit ID from conflicting with
* a year-based directory for the main site. But if a MU-era network has disabled
* ms-files rewriting manually, they don't need the extra directory, as they never
* had wp-content/uploads for the main site.)
*/
if (defined('MULTISITE')) {
$prefix = '/sites/' . get_current_blog_id();
} else {
$prefix = '/' . get_current_blog_id();
}
} elseif (defined('UPLOADS') && !ms_is_switched()) {
/*
* Handle the old-form ms-files.php rewriting if the network still has that enabled.
* When ms-files rewriting is enabled, then we only listen to UPLOADS when:
* 1) We are not on the main site in a post-MU network, as wp-content/uploads is used
* there, and
* 2) We are not switched, as ms_upload_constants() hardcodes these constants to reflect
* the original blog ID.
*
* Rather than UPLOADS, we actually use BLOGUPLOADDIR if it is set, as it is absolute.
* (And it will be set, see ms_upload_constants().) Otherwise, UPLOADS can be used, as
* as it is relative to ABSPATH. For the final piece: when UPLOADS is used with ms-files
* rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
*/
if (defined('BLOGUPLOADDIR')) {
$prefix = untrailingslashit(BLOGUPLOADDIR);
} else {
$prefix = ABSPATH . UPLOADS;
}
}
}
if ($this->get_setting('use-yearmonth-folders')) {
$subdir = $this->get_year_month_directory_name($time);
$prefix .= $subdir;
}
// support legacy MS installs (<3.5 since upgraded) for subsites
if (is_multisite() && !(is_main_network() && is_main_site()) && false === strpos($prefix, 'sites/')) {
$details = get_blog_details(get_current_blog_id());
$legacy_ms_prefix = 'sites/' . $details->blog_id . '/';
$legacy_ms_prefix = apply_filters('as3cf_legacy_ms_subsite_prefix', $legacy_ms_prefix, $details);
$prefix = '/' . trailingslashit(ltrim($legacy_ms_prefix, '/')) . ltrim($subdir, '/');
}
return $prefix;
}
示例8: sp_get_upload_info
function sp_get_upload_info()
{
$siteurl = get_option('siteurl');
$upload_path = trim(get_option('upload_path'));
if (empty($upload_path) || 'wp-content/uploads' == $upload_path) {
$dir = WP_CONTENT_DIR . '/uploads';
} elseif (0 !== strpos($upload_path, ABSPATH)) {
# $dir is absolute, $upload_path is (maybe) relative to ABSPATH
$dir = path_join(ABSPATH, $upload_path);
} else {
$dir = $upload_path;
}
if (!($url = get_option('upload_url_path'))) {
if (empty($upload_path) || 'wp-content/uploads' == $upload_path || $upload_path == $dir) {
$url = WP_CONTENT_URL . '/uploads';
} else {
$url = trailingslashit($siteurl) . $upload_path;
}
}
/*
* Honor the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
* We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
*/
if (defined('UPLOADS') && !(is_multisite() && get_site_option('ms_files_rewriting'))) {
$dir = ABSPATH . UPLOADS;
$url = trailingslashit($siteurl) . UPLOADS;
}
# If multisite (and if not the main site in a post-MU network)
if (is_multisite() && !(is_main_network() && is_main_site() && defined('MULTISITE'))) {
if (!get_site_option('ms_files_rewriting')) {
/*
* If ms-files rewriting is disabled (networks created post-3.5), it is fairly
* straightforward: Append sites/%d if we're not on the main site (for post-MU
* networks). (The extra directory prevents a four-digit ID from conflicting with
* a year-based directory for the main site. But if a MU-era network has disabled
* ms-files rewriting manually, they don't need the extra directory, as they never
* had wp-content/uploads for the main site.)
*/
if (defined('MULTISITE')) {
$ms_dir = '/sites/' . get_current_blog_id();
} else {
$ms_dir = '/' . get_current_blog_id();
}
$dir .= $ms_dir;
$url .= $ms_dir;
} elseif (defined('UPLOADS') && !ms_is_switched()) {
/*
* Handle the old-form ms-files.php rewriting if the network still has that enabled.
* When ms-files rewriting is enabled, then we only listen to UPLOADS when:
* 1) We are not on the main site in a post-MU network, as wp-content/uploads is used
* there, and
* 2) We are not switched, as ms_upload_constants() hardcodes these constants to reflect
* the original blog ID.
*
* Rather than UPLOADS, we actually use BLOGUPLOADDIR if it is set, as it is absolute.
* (And it will be set, see ms_upload_constants().) Otherwise, UPLOADS can be used, as
* as it is relative to ABSPATH. For the final piece: when UPLOADS is used with ms-files
* rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
*/
if (defined('BLOGUPLOADDIR')) {
$dir = untrailingslashit(BLOGUPLOADDIR);
} else {
$dir = ABSPATH . UPLOADS;
}
$url = trailingslashit($siteurl) . 'files';
}
}
$uploads = array('basedir' => $dir, 'baseurl' => $url);
return $uploads;
}
示例9: wp_upload_dir
/**
* Get an array containing the current upload directory's path and url.
*
* Checks the 'upload_path' option, which should be from the web root folder,
* and if it isn't empty it will be used. If it is empty, then the path will be
* 'WP_CONTENT_DIR/uploads'. If the 'UPLOADS' constant is defined, then it will
* override the 'upload_path' option and 'WP_CONTENT_DIR/uploads' path.
*
* The upload URL path is set either by the 'upload_url_path' option or by using
* the 'WP_CONTENT_URL' constant and appending '/uploads' to the path.
*
* If the 'uploads_use_yearmonth_folders' is set to true (checkbox if checked in
* the administration settings panel), then the time will be used. The format
* will be year first and then month.
*
* If the path couldn't be created, then an error will be returned with the key
* 'error' containing the error message. The error suggests that the parent
* directory is not writable by the server.
*
* On success, the returned array will have many indices:
* 'path' - base directory and sub directory or full path to upload directory.
* 'url' - base url and sub directory or absolute URL to upload directory.
* 'subdir' - sub directory if uploads use year/month folders option is on.
* 'basedir' - path without subdir.
* 'baseurl' - URL path without subdir.
* 'error' - set to false.
*
* @since 2.0.0
*
* @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
* @return array See above for description.
*/
function wp_upload_dir($time = null)
{
$siteurl = get_option('siteurl');
$upload_path = trim(get_option('upload_path'));
if (empty($upload_path) || 'wp-content/uploads' == $upload_path) {
$dir = WP_CONTENT_DIR . '/uploads';
} elseif (0 !== strpos($upload_path, ABSPATH)) {
// $dir is absolute, $upload_path is (maybe) relative to ABSPATH
$dir = path_join(ABSPATH, $upload_path);
} else {
$dir = $upload_path;
}
if (!($url = get_option('upload_url_path'))) {
if (empty($upload_path) || 'wp-content/uploads' == $upload_path || $upload_path == $dir) {
$url = WP_CONTENT_URL . '/uploads';
} else {
$url = trailingslashit($siteurl) . $upload_path;
}
}
/*
* Honor the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
* We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
*/
if (defined('UPLOADS') && !(is_multisite() && get_site_option('ms_files_rewriting'))) {
$dir = ABSPATH . UPLOADS;
$url = trailingslashit($siteurl) . UPLOADS;
}
// If multisite (and if not the main site in a post-MU network)
if (is_multisite() && !(is_main_network() && is_main_site() && defined('MULTISITE'))) {
if (!get_site_option('ms_files_rewriting')) {
/*
* If ms-files rewriting is disabled (networks created post-3.5), it is fairly
* straightforward: Append sites/%d if we're not on the main site (for post-MU
* networks). (The extra directory prevents a four-digit ID from conflicting with
* a year-based directory for the main site. But if a MU-era network has disabled
* ms-files rewriting manually, they don't need the extra directory, as they never
* had wp-content/uploads for the main site.)
*/
if (defined('MULTISITE')) {
$ms_dir = '/sites/' . get_current_blog_id();
} else {
$ms_dir = '/' . get_current_blog_id();
}
$dir .= $ms_dir;
$url .= $ms_dir;
} elseif (defined('UPLOADS') && !ms_is_switched()) {
/*
* Handle the old-form ms-files.php rewriting if the network still has that enabled.
* When ms-files rewriting is enabled, then we only listen to UPLOADS when:
* 1) We are not on the main site in a post-MU network, as wp-content/uploads is used
* there, and
* 2) We are not switched, as ms_upload_constants() hardcodes these constants to reflect
* the original blog ID.
*
* Rather than UPLOADS, we actually use BLOGUPLOADDIR if it is set, as it is absolute.
* (And it will be set, see ms_upload_constants().) Otherwise, UPLOADS can be used, as
* as it is relative to ABSPATH. For the final piece: when UPLOADS is used with ms-files
* rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
*/
if (defined('BLOGUPLOADDIR')) {
$dir = untrailingslashit(BLOGUPLOADDIR);
} else {
$dir = ABSPATH . UPLOADS;
}
$url = trailingslashit($siteurl) . 'files';
}
}
$basedir = $dir;
//.........這裏部分代碼省略.........
示例10: run
/**
* Kicks off the background update process, looping through all pending updates.
*
* @since 3.7.0
*/
public function run()
{
global $wpdb, $wp_version;
if ($this->is_disabled()) {
return;
}
if (!is_main_network() || !is_main_site()) {
return;
}
$lock_name = 'auto_updater.lock';
// Try to lock
$lock_result = $wpdb->query($wpdb->prepare("INSERT IGNORE INTO `{$wpdb->options}` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_name, time()));
if (!$lock_result) {
$lock_result = get_option($lock_name);
// If we couldn't create a lock, and there isn't a lock, bail
if (!$lock_result) {
return;
}
// Check to see if the lock is still valid
if ($lock_result > time() - HOUR_IN_SECONDS) {
return;
}
}
// Update the lock, as by this point we've definitely got a lock, just need to fire the actions
update_option($lock_name, time());
// Don't automatically run these thins, as we'll handle it ourselves
remove_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20);
remove_action('upgrader_process_complete', 'wp_version_check');
remove_action('upgrader_process_complete', 'wp_update_plugins');
remove_action('upgrader_process_complete', 'wp_update_themes');
// Next, Plugins
wp_update_plugins();
// Check for Plugin updates
$plugin_updates = get_site_transient('update_plugins');
if ($plugin_updates && !empty($plugin_updates->response)) {
foreach ($plugin_updates->response as $plugin) {
$this->update('plugin', $plugin);
}
// Force refresh of plugin update information
wp_clean_plugins_cache();
}
// Next, those themes we all love
wp_update_themes();
// Check for Theme updates
$theme_updates = get_site_transient('update_themes');
if ($theme_updates && !empty($theme_updates->response)) {
foreach ($theme_updates->response as $theme) {
$this->update('theme', (object) $theme);
}
// Force refresh of theme update information
wp_clean_themes_cache();
}
// Next, Process any core update
wp_version_check();
// Check for Core updates
$core_update = find_core_auto_update();
if ($core_update) {
$this->update('core', $core_update);
}
// Clean up, and check for any pending translations
// (Core_Upgrader checks for core updates)
$theme_stats = array();
if (isset($this->update_results['theme'])) {
foreach ($this->update_results['theme'] as $upgrade) {
$theme_stats[$upgrade->item->theme] = true === $upgrade->result;
}
}
wp_update_themes($theme_stats);
// Check for Theme updates
$plugin_stats = array();
if (isset($this->update_results['plugin'])) {
foreach ($this->update_results['plugin'] as $upgrade) {
$plugin_stats[$upgrade->item->plugin] = true === $upgrade->result;
}
}
wp_update_plugins($plugin_stats);
// Check for Plugin updates
// Finally, Process any new translations
$language_updates = wp_get_translation_updates();
if ($language_updates) {
foreach ($language_updates as $update) {
$this->update('translation', $update);
}
// Clear existing caches
wp_clean_update_cache();
wp_version_check();
// check for Core updates
wp_update_themes();
// Check for Theme updates
wp_update_plugins();
// Check for Plugin updates
}
// Send debugging email to all development installs.
if (!empty($this->update_results)) {
$development_version = false !== strpos($wp_version, '-');
//.........這裏部分代碼省略.........
示例11: can_delete
/**
* Can the current user delete this network?
*
* @since 2.0.0
*
* @param WP_Network $network
*
* @return boolean
*/
private function can_delete($network)
{
// Bail if main network
if (is_main_network($network->id)) {
return false;
}
// Can't delete current network
if (get_current_network_id() === $network->id) {
return false;
}
// Bail if user cannot delete network
if (!current_user_can('delete_network', $network->id)) {
return false;
}
// Assume true (if you're already on this screen)
return true;
}
示例12: psts_note
/**
* Add Custom messages in admin footer
*
*/
function psts_note() {
global $current_screen;
//Add for sites screen
if ( is_main_network() && 'sites-network' == $current_screen->base ) {
?>
<p><strong>* </strong>
=> <?php _e( "The original Level doesn't exist, it might have been removed.", 'psts' ); ?></p><?php
}
}
示例13: pluginRun
public function pluginRun()
{
@ini_set('memory_limit', '256M');
require_once Xpandbuddy::$pathName . '/library/Cron.php';
require_once Xpandbuddy::$pathName . '/library/Sender.php';
//dropbox
add_action('wp_ajax_get_authorization_code', array('Xpandbuddy_Sender', 'getAuthorizationCode'));
add_action('wp_ajax_get_google_code', array('Xpandbuddy_Sender', 'getGoogleCode'));
add_action('wp_ajax_get_google_token', array('Xpandbuddy_Sender', 'getGoogleToken'));
add_action('wp_ajax_get_access_token', array('Xpandbuddy_Sender', 'getAccessToken'));
add_action('wp_ajax_check_backup_size', array('Xpandbuddy', 'checkBackupSize'));
add_action('wp_ajax_activate_multiusers', array('Xpandbuddy', 'activateMultiusers'));
add_action('wp_ajax_submit_clone', array('Xpandbuddy', 'runStepByStepBackup'));
add_action('wp_ajax_send_backup', array('Xpandbuddy_Sender', 'sendBackupFileAction'));
add_action('wp_ajax_set_start_date', array('Xpandbuddy', 'setStartDate'));
add_action('wp_ajax_get_local_dirs', array('Xpandbuddy_Sender', 'ajaxGetDirsTree'));
add_action('wp_ajax_ftp_connect', array('Xpandbuddy_Sender', 'getFtpConnect'));
if (is_admin() && isset($_GET['page']) && strpos($_GET['page'], 'xpandbuddy') !== false && isset($_GET['code'])) {
echo 'This is Authorization Code: ' . $_GET['code'];
exit;
}
//end dropbox
/*/ Update plugin {
global $wp_filter;
$priority=30;
if( isset( $wp_filter['plugins_api'] ) ){
foreach( array_keys( $wp_filter['plugins_api'] ) as $_priority ){
if( $_priority >= $priority ){
$priority=$_priority+1;
}
}
}
add_filter('pre_set_site_transient_update_plugins', array( 'Xpandbuddy', 'updatePlugin' ) );
add_filter('plugins_api', array( 'Xpandbuddy', 'pluginApiCall' ), $priority, 3);
self::pluginUpdateCall();
// } Update plugin */
require_once Xpandbuddy::$pathName . '/library/Options.php';
$_arrayOptions = Xpandbuddy_Options::get();
if (!isset($_arrayOptions['homeurl_hash']) || $_arrayOptions['homeurl_hash'] != md5(home_url())) {
add_action('init', array('Xpandbuddy', 'updateRewrite'));
$_arrayOptions['homeurl_hash'] = md5(home_url());
Xpandbuddy_Options::set($_arrayOptions);
}
self::getJson();
if (is_multisite()) {
if (isset($_arrayOptions['flg_active_miltisite']) && $_arrayOptions['flg_active_miltisite'] == true && is_main_network()) {
add_action('admin_menu', array('Xpandbuddy', 'registerMenu'));
}
if (is_main_network()) {
add_action('network_admin_menu', array('Xpandbuddy', 'registerMenu'));
}
//echo get_current_blog_id()." ".(int)is_main_site()." ".(int)is_main_network();
} else {
add_action('admin_menu', array('Xpandbuddy', 'registerMenu'));
}
// WP-CRON {
add_filter('cron_schedules', array('Xpandbuddy_Cron', 'schedules'));
if (!wp_next_scheduled('blogcloncron_event')) {
wp_schedule_event(time(), 'blogcloncron_update', 'blogcloncron_event');
}
add_action('blogcloncron_event', array('Xpandbuddy_Cron', 'run'));
// }
if (!is_admin() || is_admin() && (isset($_GET['page']) && strpos($_GET['page'], 'xpandbuddy') === false || !isset($_GET['page']))) {
return;
}
add_action('init', array('Xpandbuddy', 'disableEmojis'));
self::get();
if (!isset(self::$_options['db_version'])) {
self::install();
} else {
self::updateDb();
}
add_action('admin_enqueue_scripts', array('Xpandbuddy', 'initialize'));
}
示例14: pre_schema_upgrade
/**
* Runs before the schema is upgraded.
*
* @since 2.9.0
*/
function pre_schema_upgrade()
{
global $wp_current_db_version, $wpdb;
// Unused in Project Nami.
// To be removed.
// Multisite schema upgrades.
if ($wp_current_db_version < 25448 && is_multisite() && !defined('DO_NOT_UPGRADE_GLOBAL_TABLES') && is_main_network()) {
// Upgrade verions prior to 3.7
if ($wp_current_db_version < 25179) {
// New primary key for signups.
$wpdb->query("ALTER TABLE {$wpdb->signups} ADD signup_id INT NOT NULL IDENTITY(1,1)");
}
}
if ($wp_current_db_version < 30133) {
// dbDelta() can recreate but can't drop the index.
$wpdb->query("ALTER TABLE {$wpdb->terms} DROP INDEX slug");
}
}
示例15: get_dynamic_prefix
/**
* Get the prefix path for the files
*
* @param string $time
*
* @return string
*/
function get_dynamic_prefix($time = null)
{
$prefix = '';
if ($this->get_setting('use-yearmonth-folders')) {
$uploads = wp_upload_dir($time);
$prefix = str_replace($this->get_base_upload_path(), '', $uploads['path']);
}
// support legacy MS installs (<3.5 since upgraded) for subsites
if (is_multisite() && !(is_main_network() && is_main_site()) && false === strpos($prefix, 'sites/')) {
$details = get_blog_details(get_current_blog_id());
$legacy_ms_prefix = 'sites/' . $details->blog_id . '/';
$legacy_ms_prefix = apply_filters('as3cf_legacy_ms_subsite_prefix', $legacy_ms_prefix, $details);
$prefix = '/' . trailingslashit(ltrim($legacy_ms_prefix, '/')) . ltrim($prefix, '/');
}
return $prefix;
}