Code is Poetry.

WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


Built from https://develop.svn.wordpress.org/trunk@42343


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast
2017-11-30 23:11:00 +00:00
parent 62be7ad218
commit aaf99e6913
610 changed files with 55731 additions and 43711 deletions

View File

@@ -19,12 +19,14 @@ function ms_upload_constants() {
// This filter is attached in ms-default-filters.php but that file is not included during SHORTINIT.
add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );
if ( ! get_site_option( 'ms_files_rewriting' ) )
if ( ! get_site_option( 'ms_files_rewriting' ) ) {
return;
}
// Base uploads dir relative to ABSPATH
if ( !defined( 'UPLOADBLOGSDIR' ) )
if ( ! defined( 'UPLOADBLOGSDIR' ) ) {
define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
}
// Note, the main site in a post-MU network uses wp-content/uploads.
// This is handled in wp_upload_dir() by ignoring UPLOADS for this case.
@@ -34,8 +36,9 @@ function ms_upload_constants() {
define( 'UPLOADS', UPLOADBLOGSDIR . '/' . $site_id . '/files/' );
// Uploads dir relative to ABSPATH
if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) )
if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) ) {
define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . '/blogs.dir/' . $site_id . '/files/' );
}
}
}
@@ -44,25 +47,27 @@ function ms_upload_constants() {
*
* @since 3.0.0
*/
function ms_cookie_constants( ) {
function ms_cookie_constants() {
$current_network = get_network();
/**
* @since 1.2.0
*/
if ( !defined( 'COOKIEPATH' ) )
if ( ! defined( 'COOKIEPATH' ) ) {
define( 'COOKIEPATH', $current_network->path );
}
/**
* @since 1.5.0
*/
if ( !defined( 'SITECOOKIEPATH' ) )
if ( ! defined( 'SITECOOKIEPATH' ) ) {
define( 'SITECOOKIEPATH', $current_network->path );
}
/**
* @since 2.6.0
*/
if ( !defined( 'ADMIN_COOKIE_PATH' ) ) {
if ( ! defined( 'ADMIN_COOKIE_PATH' ) ) {
if ( ! is_subdomain_install() || trim( parse_url( get_option( 'siteurl' ), PHP_URL_PATH ), '/' ) ) {
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH );
} else {
@@ -73,11 +78,12 @@ function ms_cookie_constants( ) {
/**
* @since 2.0.0
*/
if ( !defined('COOKIE_DOMAIN') && is_subdomain_install() ) {
if ( !empty( $current_network->cookie_domain ) )
define('COOKIE_DOMAIN', '.' . $current_network->cookie_domain);
else
define('COOKIE_DOMAIN', '.' . $current_network->domain);
if ( ! defined( 'COOKIE_DOMAIN' ) && is_subdomain_install() ) {
if ( ! empty( $current_network->cookie_domain ) ) {
define( 'COOKIE_DOMAIN', '.' . $current_network->cookie_domain );
} else {
define( 'COOKIE_DOMAIN', '.' . $current_network->domain );
}
}
}
@@ -92,17 +98,21 @@ function ms_cookie_constants( ) {
function ms_file_constants() {
/**
* Optional support for X-Sendfile header
*
* @since 3.0.0
*/
if ( !defined( 'WPMU_SENDFILE' ) )
if ( ! defined( 'WPMU_SENDFILE' ) ) {
define( 'WPMU_SENDFILE', false );
}
/**
* Optional support for X-Accel-Redirect header
*
* @since 3.0.0
*/
if ( !defined( 'WPMU_ACCEL_REDIRECT' ) )
if ( ! defined( 'WPMU_ACCEL_REDIRECT' ) ) {
define( 'WPMU_ACCEL_REDIRECT', false );
}
}
/**
@@ -119,7 +129,7 @@ function ms_file_constants() {
* @staticvar bool $subdomain_error_warn
*/
function ms_subdomain_constants() {
static $subdomain_error = null;
static $subdomain_error = null;
static $subdomain_error_warn = null;
if ( false === $subdomain_error ) {
@@ -138,7 +148,7 @@ function ms_subdomain_constants() {
if ( $subdomain_error_warn ) {
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 );
} else {
_deprecated_argument( 'define()', '3.0.0', $vhost_deprecated );
_deprecated_argument( 'define()', '3.0.0', $vhost_deprecated );
}
return;
}