17 */ |
17 */ |
18 function ms_upload_constants() { |
18 function ms_upload_constants() { |
19 // This filter is attached in ms-default-filters.php but that file is not included during SHORTINIT. |
19 // This filter is attached in ms-default-filters.php but that file is not included during SHORTINIT. |
20 add_filter( 'default_site_option_ms_files_rewriting', '__return_true' ); |
20 add_filter( 'default_site_option_ms_files_rewriting', '__return_true' ); |
21 |
21 |
22 if ( ! get_site_option( 'ms_files_rewriting' ) ) |
22 if ( ! get_site_option( 'ms_files_rewriting' ) ) { |
23 return; |
23 return; |
|
24 } |
24 |
25 |
25 // Base uploads dir relative to ABSPATH |
26 // Base uploads dir relative to ABSPATH |
26 if ( !defined( 'UPLOADBLOGSDIR' ) ) |
27 if ( ! defined( 'UPLOADBLOGSDIR' ) ) { |
27 define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' ); |
28 define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' ); |
|
29 } |
28 |
30 |
29 // Note, the main site in a post-MU network uses wp-content/uploads. |
31 // Note, the main site in a post-MU network uses wp-content/uploads. |
30 // This is handled in wp_upload_dir() by ignoring UPLOADS for this case. |
32 // This is handled in wp_upload_dir() by ignoring UPLOADS for this case. |
31 if ( ! defined( 'UPLOADS' ) ) { |
33 if ( ! defined( 'UPLOADS' ) ) { |
32 $site_id = get_current_blog_id(); |
34 $site_id = get_current_blog_id(); |
33 |
35 |
34 define( 'UPLOADS', UPLOADBLOGSDIR . '/' . $site_id . '/files/' ); |
36 define( 'UPLOADS', UPLOADBLOGSDIR . '/' . $site_id . '/files/' ); |
35 |
37 |
36 // Uploads dir relative to ABSPATH |
38 // Uploads dir relative to ABSPATH |
37 if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) ) |
39 if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) ) { |
38 define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . '/blogs.dir/' . $site_id . '/files/' ); |
40 define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . '/blogs.dir/' . $site_id . '/files/' ); |
|
41 } |
39 } |
42 } |
40 } |
43 } |
41 |
44 |
42 /** |
45 /** |
43 * Defines Multisite cookie constants. |
46 * Defines Multisite cookie constants. |
44 * |
47 * |
45 * @since 3.0.0 |
48 * @since 3.0.0 |
46 */ |
49 */ |
47 function ms_cookie_constants( ) { |
50 function ms_cookie_constants() { |
48 $current_network = get_network(); |
51 $current_network = get_network(); |
49 |
52 |
50 /** |
53 /** |
51 * @since 1.2.0 |
54 * @since 1.2.0 |
52 */ |
55 */ |
53 if ( !defined( 'COOKIEPATH' ) ) |
56 if ( ! defined( 'COOKIEPATH' ) ) { |
54 define( 'COOKIEPATH', $current_network->path ); |
57 define( 'COOKIEPATH', $current_network->path ); |
|
58 } |
55 |
59 |
56 /** |
60 /** |
57 * @since 1.5.0 |
61 * @since 1.5.0 |
58 */ |
62 */ |
59 if ( !defined( 'SITECOOKIEPATH' ) ) |
63 if ( ! defined( 'SITECOOKIEPATH' ) ) { |
60 define( 'SITECOOKIEPATH', $current_network->path ); |
64 define( 'SITECOOKIEPATH', $current_network->path ); |
|
65 } |
61 |
66 |
62 /** |
67 /** |
63 * @since 2.6.0 |
68 * @since 2.6.0 |
64 */ |
69 */ |
65 if ( !defined( 'ADMIN_COOKIE_PATH' ) ) { |
70 if ( ! defined( 'ADMIN_COOKIE_PATH' ) ) { |
66 if ( ! is_subdomain_install() || trim( parse_url( get_option( 'siteurl' ), PHP_URL_PATH ), '/' ) ) { |
71 if ( ! is_subdomain_install() || trim( parse_url( get_option( 'siteurl' ), PHP_URL_PATH ), '/' ) ) { |
67 define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH ); |
72 define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH ); |
68 } else { |
73 } else { |
69 define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' ); |
74 define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' ); |
70 } |
75 } |
71 } |
76 } |
72 |
77 |
73 /** |
78 /** |
74 * @since 2.0.0 |
79 * @since 2.0.0 |
75 */ |
80 */ |
76 if ( !defined('COOKIE_DOMAIN') && is_subdomain_install() ) { |
81 if ( ! defined( 'COOKIE_DOMAIN' ) && is_subdomain_install() ) { |
77 if ( !empty( $current_network->cookie_domain ) ) |
82 if ( ! empty( $current_network->cookie_domain ) ) { |
78 define('COOKIE_DOMAIN', '.' . $current_network->cookie_domain); |
83 define( 'COOKIE_DOMAIN', '.' . $current_network->cookie_domain ); |
79 else |
84 } else { |
80 define('COOKIE_DOMAIN', '.' . $current_network->domain); |
85 define( 'COOKIE_DOMAIN', '.' . $current_network->domain ); |
|
86 } |
81 } |
87 } |
82 } |
88 } |
83 |
89 |
84 /** |
90 /** |
85 * Defines Multisite file constants. |
91 * Defines Multisite file constants. |
90 * @since 3.0.0 |
96 * @since 3.0.0 |
91 */ |
97 */ |
92 function ms_file_constants() { |
98 function ms_file_constants() { |
93 /** |
99 /** |
94 * Optional support for X-Sendfile header |
100 * Optional support for X-Sendfile header |
|
101 * |
95 * @since 3.0.0 |
102 * @since 3.0.0 |
96 */ |
103 */ |
97 if ( !defined( 'WPMU_SENDFILE' ) ) |
104 if ( ! defined( 'WPMU_SENDFILE' ) ) { |
98 define( 'WPMU_SENDFILE', false ); |
105 define( 'WPMU_SENDFILE', false ); |
|
106 } |
99 |
107 |
100 /** |
108 /** |
101 * Optional support for X-Accel-Redirect header |
109 * Optional support for X-Accel-Redirect header |
|
110 * |
102 * @since 3.0.0 |
111 * @since 3.0.0 |
103 */ |
112 */ |
104 if ( !defined( 'WPMU_ACCEL_REDIRECT' ) ) |
113 if ( ! defined( 'WPMU_ACCEL_REDIRECT' ) ) { |
105 define( 'WPMU_ACCEL_REDIRECT', false ); |
114 define( 'WPMU_ACCEL_REDIRECT', false ); |
|
115 } |
106 } |
116 } |
107 |
117 |
108 /** |
118 /** |
109 * Defines Multisite subdomain constants and handles warnings and notices. |
119 * Defines Multisite subdomain constants and handles warnings and notices. |
110 * |
120 * |