Edit File by line
/home/zeestwma/ceyloniy.../wp-inclu...
File: ms-settings.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Used to set up and fix common variables and include
[2] Fix | Delete
* the Multisite procedural and class library.
[3] Fix | Delete
*
[4] Fix | Delete
* Allows for some configuration in wp-config.php (see ms-default-constants.php)
[5] Fix | Delete
*
[6] Fix | Delete
* @package WordPress
[7] Fix | Delete
* @subpackage Multisite
[8] Fix | Delete
* @since 3.0.0
[9] Fix | Delete
*/
[10] Fix | Delete
[11] Fix | Delete
// Don't load directly.
[12] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[13] Fix | Delete
die( '-1' );
[14] Fix | Delete
}
[15] Fix | Delete
[16] Fix | Delete
/**
[17] Fix | Delete
* Objects representing the current network and current site.
[18] Fix | Delete
*
[19] Fix | Delete
* These may be populated through a custom `sunrise.php`. If not, then this
[20] Fix | Delete
* file will attempt to populate them based on the current request.
[21] Fix | Delete
*
[22] Fix | Delete
* @since 3.0.0
[23] Fix | Delete
*
[24] Fix | Delete
* @global WP_Network $current_site The current network.
[25] Fix | Delete
* @global object $current_blog The current site.
[26] Fix | Delete
* @global string $domain Deprecated. The domain of the site found on load.
[27] Fix | Delete
* Use `get_site()->domain` instead.
[28] Fix | Delete
* @global string $path Deprecated. The path of the site found on load.
[29] Fix | Delete
* Use `get_site()->path` instead.
[30] Fix | Delete
* @global int $site_id Deprecated. The ID of the network found on load.
[31] Fix | Delete
* Use `get_current_network_id()` instead.
[32] Fix | Delete
* @global bool $public Deprecated. Whether the site found on load is public.
[33] Fix | Delete
* Use `get_site()->public` instead.
[34] Fix | Delete
*/
[35] Fix | Delete
global $current_site, $current_blog, $domain, $path, $site_id, $public;
[36] Fix | Delete
[37] Fix | Delete
/** WP_Network class */
[38] Fix | Delete
require_once ABSPATH . WPINC . '/class-wp-network.php';
[39] Fix | Delete
[40] Fix | Delete
/** WP_Site class */
[41] Fix | Delete
require_once ABSPATH . WPINC . '/class-wp-site.php';
[42] Fix | Delete
[43] Fix | Delete
/** Multisite loader */
[44] Fix | Delete
require_once ABSPATH . WPINC . '/ms-load.php';
[45] Fix | Delete
[46] Fix | Delete
/** Default Multisite constants */
[47] Fix | Delete
require_once ABSPATH . WPINC . '/ms-default-constants.php';
[48] Fix | Delete
[49] Fix | Delete
if ( defined( 'SUNRISE' ) ) {
[50] Fix | Delete
include_once WP_CONTENT_DIR . '/sunrise.php';
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
/** Check for and define SUBDOMAIN_INSTALL and the deprecated VHOST constant. */
[54] Fix | Delete
ms_subdomain_constants();
[55] Fix | Delete
[56] Fix | Delete
// This block will process a request if the current network or current site objects
[57] Fix | Delete
// have not been populated in the global scope through something like `sunrise.php`.
[58] Fix | Delete
if ( ! isset( $current_site ) || ! isset( $current_blog ) ) {
[59] Fix | Delete
[60] Fix | Delete
$domain = strtolower( stripslashes( $_SERVER['HTTP_HOST'] ?? '' ) );
[61] Fix | Delete
if ( str_ends_with( $domain, ':80' ) ) {
[62] Fix | Delete
$domain = substr( $domain, 0, -3 );
[63] Fix | Delete
$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 );
[64] Fix | Delete
} elseif ( str_ends_with( $domain, ':443' ) ) {
[65] Fix | Delete
$domain = substr( $domain, 0, -4 );
[66] Fix | Delete
$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 );
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
$path = stripslashes( $_SERVER['REQUEST_URI'] );
[70] Fix | Delete
if ( is_admin() ) {
[71] Fix | Delete
$path = preg_replace( '#(.*)/wp-admin/.*#', '$1/', $path );
[72] Fix | Delete
}
[73] Fix | Delete
list( $path ) = explode( '?', $path );
[74] Fix | Delete
[75] Fix | Delete
$bootstrap_result = ms_load_current_site_and_network( $domain, $path, is_subdomain_install() );
[76] Fix | Delete
[77] Fix | Delete
if ( true === $bootstrap_result ) {
[78] Fix | Delete
// `$current_blog` and `$current_site` are now populated.
[79] Fix | Delete
} elseif ( false === $bootstrap_result ) {
[80] Fix | Delete
ms_not_installed( $domain, $path );
[81] Fix | Delete
} else {
[82] Fix | Delete
header( 'Location: ' . $bootstrap_result );
[83] Fix | Delete
exit;
[84] Fix | Delete
}
[85] Fix | Delete
unset( $bootstrap_result );
[86] Fix | Delete
[87] Fix | Delete
$blog_id = $current_blog->blog_id;
[88] Fix | Delete
$public = $current_blog->public;
[89] Fix | Delete
[90] Fix | Delete
if ( empty( $current_blog->site_id ) ) {
[91] Fix | Delete
// This dates to [MU134] and shouldn't be relevant anymore,
[92] Fix | Delete
// but it could be possible for arguments passed to insert_blog() etc.
[93] Fix | Delete
$current_blog->site_id = 1;
[94] Fix | Delete
}
[95] Fix | Delete
[96] Fix | Delete
$site_id = $current_blog->site_id;
[97] Fix | Delete
wp_load_core_site_options( $site_id );
[98] Fix | Delete
}
[99] Fix | Delete
[100] Fix | Delete
$wpdb->set_prefix( $table_prefix, false ); // $table_prefix can be set in sunrise.php.
[101] Fix | Delete
$wpdb->set_blog_id( $current_blog->blog_id, $current_blog->site_id );
[102] Fix | Delete
$table_prefix = $wpdb->get_blog_prefix();
[103] Fix | Delete
$_wp_switched_stack = array();
[104] Fix | Delete
$switched = false;
[105] Fix | Delete
[106] Fix | Delete
// Need to init cache again after blog_id is set.
[107] Fix | Delete
wp_start_object_cache();
[108] Fix | Delete
[109] Fix | Delete
if ( ! $current_site instanceof WP_Network ) {
[110] Fix | Delete
$current_site = new WP_Network( $current_site );
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
if ( ! $current_blog instanceof WP_Site ) {
[114] Fix | Delete
$current_blog = new WP_Site( $current_blog );
[115] Fix | Delete
}
[116] Fix | Delete
[117] Fix | Delete
// Define upload directory constants.
[118] Fix | Delete
ms_upload_constants();
[119] Fix | Delete
[120] Fix | Delete
/**
[121] Fix | Delete
* Fires after the current site and network have been detected and loaded
[122] Fix | Delete
* in multisite's bootstrap.
[123] Fix | Delete
*
[124] Fix | Delete
* @since 4.6.0
[125] Fix | Delete
*/
[126] Fix | Delete
do_action( 'ms_loaded' );
[127] Fix | Delete
[128] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function