wp/wp-includes/ms-default-constants.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
    43  * Defines Multisite cookie constants.
    43  * Defines Multisite cookie constants.
    44  *
    44  *
    45  * @since 3.0.0
    45  * @since 3.0.0
    46  */
    46  */
    47 function ms_cookie_constants(  ) {
    47 function ms_cookie_constants(  ) {
    48 	global $current_site;
    48 	$current_site = get_current_site();
    49 
    49 
    50 	/**
    50 	/**
    51 	 * @since 1.2.0
    51 	 * @since 1.2.0
    52 	 */
    52 	 */
    53 	if ( !defined( 'COOKIEPATH' ) )
    53 	if ( !defined( 'COOKIEPATH' ) )
   114  * we will have translations loaded and can trigger warnings easily.
   114  * we will have translations loaded and can trigger warnings easily.
   115  *
   115  *
   116  * @since 3.0.0
   116  * @since 3.0.0
   117  */
   117  */
   118 function ms_subdomain_constants() {
   118 function ms_subdomain_constants() {
   119 	static $error = null;
   119 	static $subdomain_error = null;
   120 	static $error_warn = false;
   120 	static $subdomain_error_warn = null;
   121 
   121 
   122 	if ( false === $error )
   122 	if ( false === $subdomain_error ) {
   123 		return;
   123 		return;
       
   124 	}
   124 
   125 
   125 	if ( $error ) {
   126 	if ( $subdomain_error ) {
   126 		$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.' );
   127 		$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.' );
   127 		if ( $error_warn ) {
   128 		if ( $subdomain_error_warn ) {
   128 			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 );
   129 			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 );
   129 		} else {
   130 		} else {
   130 	 		_deprecated_argument( 'define()', '3.0', $vhost_deprecated );
   131 	 		_deprecated_argument( 'define()', '3.0', $vhost_deprecated );
   131 		}
   132 		}
   132 		return;
   133 		return;
   133 	}
   134 	}
   134 
   135 
   135 	if ( defined( 'SUBDOMAIN_INSTALL' ) && defined( 'VHOST' ) ) {
   136 	if ( defined( 'SUBDOMAIN_INSTALL' ) && defined( 'VHOST' ) ) {
   136 		if ( SUBDOMAIN_INSTALL == ( 'yes' == VHOST ) ) {
   137 		$subdomain_error = true;
   137 			$error = true;
   138 		if ( SUBDOMAIN_INSTALL !== ( 'yes' == VHOST ) ) {
   138 		} else {
   139 			$subdomain_error_warn = true;
   139 			$error = $error_warn = true;
       
   140 		}
   140 		}
   141 	} elseif ( defined( 'SUBDOMAIN_INSTALL' ) ) {
   141 	} elseif ( defined( 'SUBDOMAIN_INSTALL' ) ) {
       
   142 		$subdomain_error = false;
   142 		define( 'VHOST', SUBDOMAIN_INSTALL ? 'yes' : 'no' );
   143 		define( 'VHOST', SUBDOMAIN_INSTALL ? 'yes' : 'no' );
   143 	} elseif ( defined( 'VHOST' ) ) {
   144 	} elseif ( defined( 'VHOST' ) ) {
   144 		$error = true;
   145 		$subdomain_error = true;
   145 		define( 'SUBDOMAIN_INSTALL', 'yes' == VHOST );
   146 		define( 'SUBDOMAIN_INSTALL', 'yes' == VHOST );
   146 	} else {
   147 	} else {
       
   148 		$subdomain_error = false;
   147 		define( 'SUBDOMAIN_INSTALL', false );
   149 		define( 'SUBDOMAIN_INSTALL', false );
   148 		define( 'VHOST', 'no' );
   150 		define( 'VHOST', 'no' );
   149 	}
   151 	}
   150 }
   152 }
   151 add_action( 'init', 'ms_subdomain_constants' );
   153 add_action( 'init', 'ms_subdomain_constants' );