Changeset 21823 for trunk/wp-includes/functions.php
- Timestamp:
- 09/11/2012 10:22:20 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r21822 r21823 1433 1433 */ 1434 1434 function wp_upload_dir( $time = null ) { 1435 global $_wp_switched;1436 1435 $siteurl = get_option( 'siteurl' ); 1437 $upload_path = get_option( 'upload_path' ); 1438 $upload_path = trim($upload_path); 1439 $main_override = is_multisite() && defined( 'MULTISITE' ) && is_main_site(); 1440 if ( empty($upload_path) ) { 1436 $upload_path = trim( get_option( 'upload_path' ) ); 1437 1438 if ( empty( $upload_path ) || 'wp-content/uploads' == $upload_path ) { 1441 1439 $dir = WP_CONTENT_DIR . '/uploads'; 1440 } elseif ( 0 !== strpos( $upload_path, ABSPATH ) ) { 1441 // $dir is absolute, $upload_path is (maybe) relative to ABSPATH 1442 $dir = path_join( ABSPATH, $upload_path ); 1442 1443 } else { 1443 1444 $dir = $upload_path; 1444 if ( 'wp-content/uploads' == $upload_path ) {1445 $dir = WP_CONTENT_DIR . '/uploads';1446 } elseif ( 0 !== strpos($dir, ABSPATH) ) {1447 // $dir is absolute, $upload_path is (maybe) relative to ABSPATH1448 $dir = path_join( ABSPATH, $dir );1449 }1450 1445 } 1451 1446 … … 1457 1452 } 1458 1453 1459 if ( defined( 'UPLOADS') && ! $main_override && ! $_wp_switched) {1454 if ( defined( 'UPLOADS' ) ) { 1460 1455 $dir = ABSPATH . UPLOADS; 1461 1456 $url = trailingslashit( $siteurl ) . UPLOADS; 1462 1457 } 1463 1458 1464 if ( is_multisite() && ! $main_override && ! $_wp_switched ) { 1465 if ( defined( 'BLOGUPLOADDIR' ) ) 1466 $dir = untrailingslashit(BLOGUPLOADDIR); 1467 $url = str_replace( UPLOADS, 'files', $url ); 1459 // Multisite (if not the main site in a post-MU network) 1460 if ( is_multisite() && ! ( is_main_site() && defined( 'MULTISITE' ) ) ) { 1461 if ( ! get_site_option( 'ms_files_rewriting' ) ) { 1462 // Append sites/%d if we're not on the main site (for post-MU networks). 1463 $ms_dir = '/sites/' . get_current_blog_id(); 1464 $dir .= $ms_dir; 1465 $url .= $ms_dir; 1466 } elseif ( ! ms_is_switched() ) { 1467 // Handle the old-form ms-files.php rewriting if the network still has that enabled. 1468 if ( defined( 'BLOGUPLOADDIR' ) ) 1469 $dir = untrailingslashit( BLOGUPLOADDIR ); 1470 $url = str_replace( UPLOADS, 'files', $url ); 1471 } 1468 1472 } 1469 1473
Note: See TracChangeset
for help on using the changeset viewer.