3 * Defines constants and global variables that can be overridden, generally in wp-config.php.
6 * @subpackage Multisite
11 * Defines Multisite upload constants.
15 function ms_upload_constants( ) {
19 // Base uploads dir relative to ABSPATH
20 if ( !defined( 'UPLOADBLOGSDIR' ) )
21 define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
24 if ( !defined( 'UPLOADS' ) ) {
25 // Uploads dir relative to ABSPATH
26 define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
27 if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR )
28 define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" );
33 * Defines Multisite cookie constants.
37 function ms_cookie_constants( ) {
43 if ( !defined( 'COOKIEPATH' ) )
44 define( 'COOKIEPATH', $current_site->path );
49 if ( !defined( 'SITECOOKIEPATH' ) )
50 define( 'SITECOOKIEPATH', $current_site->path );
55 if ( !defined( 'ADMIN_COOKIE_PATH' ) ) {
56 if( !is_subdomain_install() ) {
57 define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH );
59 define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
66 if ( !defined('COOKIE_DOMAIN') && is_subdomain_install() ) {
67 if ( !empty( $current_site->cookie_domain ) )
68 define('COOKIE_DOMAIN', '.' . $current_site->cookie_domain);
70 define('COOKIE_DOMAIN', '.' . $current_site->domain);
75 * Defines Multisite file constants.
79 function ms_file_constants( ) {
81 * Optional support for X-Sendfile header
84 if ( !defined( 'WPMU_SENDFILE' ) )
85 define( 'WPMU_SENDFILE', false );
88 * Optional support for X-Accel-Redirect header
91 if ( !defined( 'WPMU_ACCEL_REDIRECT' ) )
92 define( 'WPMU_ACCEL_REDIRECT', false );
96 * Defines Multisite subdomain constants and handles warnings and notices.
98 * VHOST is deprecated in favor of SUBDOMAIN_INSTALL, which is a bool.
100 * On first call, the constants are checked and defined. On second call,
101 * we will have translations loaded and can trigger warnings easily.
105 function ms_subdomain_constants() {
106 static $error = null;
107 static $error_warn = false;
109 if ( false === $error )
113 $vhost_deprecated = __( 'The constant <code>VHOST</code> <strong>is deprecated</strong>. Use the boolean constant <code>SUBDOMAIN_INSTALL</code> in wp-config.php to enable a subdomain configuration. Use is_subdomain_install() to check whether a subdomain configuration is enabled.' );
115 trigger_error( __( '<strong>Conflicting values for the constants VHOST and SUBDOMAIN_INSTALL.</strong> The value of SUBDOMAIN_INSTALL will be assumed to be your subdomain configuration setting.' ) . ' ' . $vhost_deprecated, E_USER_WARNING );
117 _deprecated_argument( 'define()', '3.0', $vhost_deprecated );
122 if ( defined( 'SUBDOMAIN_INSTALL' ) && defined( 'VHOST' ) ) {
123 if ( SUBDOMAIN_INSTALL == ( 'yes' == VHOST ) ) {
126 $error = $error_warn = true;
128 } elseif ( defined( 'SUBDOMAIN_INSTALL' ) ) {
129 define( 'VHOST', SUBDOMAIN_INSTALL ? 'yes' : 'no' );
130 } elseif ( defined( 'VHOST' ) ) {
132 define( 'SUBDOMAIN_INSTALL', 'yes' == VHOST );
134 define( 'SUBDOMAIN_INSTALL', false );
135 define( 'VHOST', 'no' );
138 add_action( 'init', 'ms_subdomain_constants' );