Edit File by line
/home/barbar84/www/wp-inclu...
File: ms-default-constants.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Defines constants and global variables that can be overridden, generally in wp-config.php.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Multisite
[5] Fix | Delete
* @since 3.0.0
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* Defines Multisite upload constants.
[10] Fix | Delete
*
[11] Fix | Delete
* Exists for backward compatibility with legacy file-serving through
[12] Fix | Delete
* wp-includes/ms-files.php (wp-content/blogs.php in MU).
[13] Fix | Delete
*
[14] Fix | Delete
* @since 3.0.0
[15] Fix | Delete
*/
[16] Fix | Delete
function ms_upload_constants() {
[17] Fix | Delete
// This filter is attached in ms-default-filters.php but that file is not included during SHORTINIT.
[18] Fix | Delete
add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );
[19] Fix | Delete
[20] Fix | Delete
if ( ! get_site_option( 'ms_files_rewriting' ) ) {
[21] Fix | Delete
return;
[22] Fix | Delete
}
[23] Fix | Delete
[24] Fix | Delete
// Base uploads dir relative to ABSPATH.
[25] Fix | Delete
if ( ! defined( 'UPLOADBLOGSDIR' ) ) {
[26] Fix | Delete
define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
// Note, the main site in a post-MU network uses wp-content/uploads.
[30] Fix | Delete
// This is handled in wp_upload_dir() by ignoring UPLOADS for this case.
[31] Fix | Delete
if ( ! defined( 'UPLOADS' ) ) {
[32] Fix | Delete
$site_id = get_current_blog_id();
[33] Fix | Delete
[34] Fix | Delete
define( 'UPLOADS', UPLOADBLOGSDIR . '/' . $site_id . '/files/' );
[35] Fix | Delete
[36] Fix | Delete
// Uploads dir relative to ABSPATH.
[37] Fix | Delete
if ( 'wp-content/blogs.dir' === UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) ) {
[38] Fix | Delete
define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . '/blogs.dir/' . $site_id . '/files/' );
[39] Fix | Delete
}
[40] Fix | Delete
}
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
/**
[44] Fix | Delete
* Defines Multisite cookie constants.
[45] Fix | Delete
*
[46] Fix | Delete
* @since 3.0.0
[47] Fix | Delete
*/
[48] Fix | Delete
function ms_cookie_constants() {
[49] Fix | Delete
$current_network = get_network();
[50] Fix | Delete
[51] Fix | Delete
/**
[52] Fix | Delete
* @since 1.2.0
[53] Fix | Delete
*/
[54] Fix | Delete
if ( ! defined( 'COOKIEPATH' ) ) {
[55] Fix | Delete
define( 'COOKIEPATH', $current_network->path );
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
/**
[59] Fix | Delete
* @since 1.5.0
[60] Fix | Delete
*/
[61] Fix | Delete
if ( ! defined( 'SITECOOKIEPATH' ) ) {
[62] Fix | Delete
define( 'SITECOOKIEPATH', $current_network->path );
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
/**
[66] Fix | Delete
* @since 2.6.0
[67] Fix | Delete
*/
[68] Fix | Delete
if ( ! defined( 'ADMIN_COOKIE_PATH' ) ) {
[69] Fix | Delete
if ( ! is_subdomain_install() || trim( parse_url( get_option( 'siteurl' ), PHP_URL_PATH ), '/' ) ) {
[70] Fix | Delete
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH );
[71] Fix | Delete
} else {
[72] Fix | Delete
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
[73] Fix | Delete
}
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
/**
[77] Fix | Delete
* @since 2.0.0
[78] Fix | Delete
*/
[79] Fix | Delete
if ( ! defined( 'COOKIE_DOMAIN' ) && is_subdomain_install() ) {
[80] Fix | Delete
if ( ! empty( $current_network->cookie_domain ) ) {
[81] Fix | Delete
define( 'COOKIE_DOMAIN', '.' . $current_network->cookie_domain );
[82] Fix | Delete
} else {
[83] Fix | Delete
define( 'COOKIE_DOMAIN', '.' . $current_network->domain );
[84] Fix | Delete
}
[85] Fix | Delete
}
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
/**
[89] Fix | Delete
* Defines Multisite file constants.
[90] Fix | Delete
*
[91] Fix | Delete
* Exists for backward compatibility with legacy file-serving through
[92] Fix | Delete
* wp-includes/ms-files.php (wp-content/blogs.php in MU).
[93] Fix | Delete
*
[94] Fix | Delete
* @since 3.0.0
[95] Fix | Delete
*/
[96] Fix | Delete
function ms_file_constants() {
[97] Fix | Delete
/**
[98] Fix | Delete
* Optional support for X-Sendfile header
[99] Fix | Delete
*
[100] Fix | Delete
* @since 3.0.0
[101] Fix | Delete
*/
[102] Fix | Delete
if ( ! defined( 'WPMU_SENDFILE' ) ) {
[103] Fix | Delete
define( 'WPMU_SENDFILE', false );
[104] Fix | Delete
}
[105] Fix | Delete
[106] Fix | Delete
/**
[107] Fix | Delete
* Optional support for X-Accel-Redirect header
[108] Fix | Delete
*
[109] Fix | Delete
* @since 3.0.0
[110] Fix | Delete
*/
[111] Fix | Delete
if ( ! defined( 'WPMU_ACCEL_REDIRECT' ) ) {
[112] Fix | Delete
define( 'WPMU_ACCEL_REDIRECT', false );
[113] Fix | Delete
}
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
/**
[117] Fix | Delete
* Defines Multisite subdomain constants and handles warnings and notices.
[118] Fix | Delete
*
[119] Fix | Delete
* VHOST is deprecated in favor of SUBDOMAIN_INSTALL, which is a bool.
[120] Fix | Delete
*
[121] Fix | Delete
* On first call, the constants are checked and defined. On second call,
[122] Fix | Delete
* we will have translations loaded and can trigger warnings easily.
[123] Fix | Delete
*
[124] Fix | Delete
* @since 3.0.0
[125] Fix | Delete
*/
[126] Fix | Delete
function ms_subdomain_constants() {
[127] Fix | Delete
static $subdomain_error = null;
[128] Fix | Delete
static $subdomain_error_warn = null;
[129] Fix | Delete
[130] Fix | Delete
if ( false === $subdomain_error ) {
[131] Fix | Delete
return;
[132] Fix | Delete
}
[133] Fix | Delete
[134] Fix | Delete
if ( $subdomain_error ) {
[135] Fix | Delete
$vhost_deprecated = sprintf(
[136] Fix | Delete
/* translators: 1: VHOST, 2: SUBDOMAIN_INSTALL, 3: wp-config.php, 4: is_subdomain_install() */
[137] Fix | Delete
__( 'The constant %1$s <strong>is deprecated</strong>. Use the boolean constant %2$s in %3$s to enable a subdomain configuration. Use %4$s to check whether a subdomain configuration is enabled.' ),
[138] Fix | Delete
'<code>VHOST</code>',
[139] Fix | Delete
'<code>SUBDOMAIN_INSTALL</code>',
[140] Fix | Delete
'<code>wp-config.php</code>',
[141] Fix | Delete
'<code>is_subdomain_install()</code>'
[142] Fix | Delete
);
[143] Fix | Delete
if ( $subdomain_error_warn ) {
[144] Fix | Delete
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 );
[145] Fix | Delete
} else {
[146] Fix | Delete
_deprecated_argument( 'define()', '3.0.0', $vhost_deprecated );
[147] Fix | Delete
}
[148] Fix | Delete
return;
[149] Fix | Delete
}
[150] Fix | Delete
[151] Fix | Delete
if ( defined( 'SUBDOMAIN_INSTALL' ) && defined( 'VHOST' ) ) {
[152] Fix | Delete
$subdomain_error = true;
[153] Fix | Delete
if ( SUBDOMAIN_INSTALL !== ( 'yes' === VHOST ) ) {
[154] Fix | Delete
$subdomain_error_warn = true;
[155] Fix | Delete
}
[156] Fix | Delete
} elseif ( defined( 'SUBDOMAIN_INSTALL' ) ) {
[157] Fix | Delete
$subdomain_error = false;
[158] Fix | Delete
define( 'VHOST', SUBDOMAIN_INSTALL ? 'yes' : 'no' );
[159] Fix | Delete
} elseif ( defined( 'VHOST' ) ) {
[160] Fix | Delete
$subdomain_error = true;
[161] Fix | Delete
define( 'SUBDOMAIN_INSTALL', 'yes' === VHOST );
[162] Fix | Delete
} else {
[163] Fix | Delete
$subdomain_error = false;
[164] Fix | Delete
define( 'SUBDOMAIN_INSTALL', false );
[165] Fix | Delete
define( 'VHOST', 'no' );
[166] Fix | Delete
}
[167] Fix | Delete
}
[168] Fix | Delete
[169] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function