Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-admin/includes
File: schema.php
if ( is_multisite() ) {
[1000] Fix | Delete
if ( get_network( $network_id ) ) {
[1001] Fix | Delete
$errors->add( 'siteid_exists', __( 'The network already exists.' ) );
[1002] Fix | Delete
}
[1003] Fix | Delete
} else {
[1004] Fix | Delete
if ( $network_id === (int) $wpdb->get_var(
[1005] Fix | Delete
$wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id )
[1006] Fix | Delete
) ) {
[1007] Fix | Delete
$errors->add( 'siteid_exists', __( 'The network already exists.' ) );
[1008] Fix | Delete
}
[1009] Fix | Delete
}
[1010] Fix | Delete
[1011] Fix | Delete
if ( ! is_email( $email ) ) {
[1012] Fix | Delete
$errors->add( 'invalid_email', __( 'You must provide a valid email address.' ) );
[1013] Fix | Delete
}
[1014] Fix | Delete
[1015] Fix | Delete
if ( $errors->has_errors() ) {
[1016] Fix | Delete
return $errors;
[1017] Fix | Delete
}
[1018] Fix | Delete
[1019] Fix | Delete
if ( 1 === $network_id ) {
[1020] Fix | Delete
$wpdb->insert(
[1021] Fix | Delete
$wpdb->site,
[1022] Fix | Delete
array(
[1023] Fix | Delete
'domain' => $domain,
[1024] Fix | Delete
'path' => $path,
[1025] Fix | Delete
)
[1026] Fix | Delete
);
[1027] Fix | Delete
$network_id = $wpdb->insert_id;
[1028] Fix | Delete
} else {
[1029] Fix | Delete
$wpdb->insert(
[1030] Fix | Delete
$wpdb->site,
[1031] Fix | Delete
array(
[1032] Fix | Delete
'domain' => $domain,
[1033] Fix | Delete
'path' => $path,
[1034] Fix | Delete
'id' => $network_id,
[1035] Fix | Delete
)
[1036] Fix | Delete
);
[1037] Fix | Delete
}
[1038] Fix | Delete
[1039] Fix | Delete
populate_network_meta(
[1040] Fix | Delete
$network_id,
[1041] Fix | Delete
array(
[1042] Fix | Delete
'admin_email' => $email,
[1043] Fix | Delete
'site_name' => $site_name,
[1044] Fix | Delete
'subdomain_install' => $subdomain_install,
[1045] Fix | Delete
)
[1046] Fix | Delete
);
[1047] Fix | Delete
[1048] Fix | Delete
/*
[1049] Fix | Delete
* When upgrading from single to multisite, assume the current site will
[1050] Fix | Delete
* become the main site of the network. When using populate_network()
[1051] Fix | Delete
* to create another network in an existing multisite environment, skip
[1052] Fix | Delete
* these steps since the main site of the new network has not yet been
[1053] Fix | Delete
* created.
[1054] Fix | Delete
*/
[1055] Fix | Delete
if ( ! is_multisite() ) {
[1056] Fix | Delete
$current_site = new stdClass();
[1057] Fix | Delete
$current_site->domain = $domain;
[1058] Fix | Delete
$current_site->path = $path;
[1059] Fix | Delete
$current_site->site_name = ucfirst( $domain );
[1060] Fix | Delete
$wpdb->insert(
[1061] Fix | Delete
$wpdb->blogs,
[1062] Fix | Delete
array(
[1063] Fix | Delete
'site_id' => $network_id,
[1064] Fix | Delete
'blog_id' => 1,
[1065] Fix | Delete
'domain' => $domain,
[1066] Fix | Delete
'path' => $path,
[1067] Fix | Delete
'registered' => current_time( 'mysql' ),
[1068] Fix | Delete
)
[1069] Fix | Delete
);
[1070] Fix | Delete
$current_site->blog_id = $wpdb->insert_id;
[1071] Fix | Delete
[1072] Fix | Delete
$site_user_id = (int) $wpdb->get_var(
[1073] Fix | Delete
$wpdb->prepare(
[1074] Fix | Delete
"SELECT meta_value
[1075] Fix | Delete
FROM $wpdb->sitemeta
[1076] Fix | Delete
WHERE meta_key = %s AND site_id = %d",
[1077] Fix | Delete
'admin_user_id',
[1078] Fix | Delete
$network_id
[1079] Fix | Delete
)
[1080] Fix | Delete
);
[1081] Fix | Delete
[1082] Fix | Delete
update_user_meta( $site_user_id, 'source_domain', $domain );
[1083] Fix | Delete
update_user_meta( $site_user_id, 'primary_blog', $current_site->blog_id );
[1084] Fix | Delete
[1085] Fix | Delete
// Unable to use update_network_option() while populating the network.
[1086] Fix | Delete
$wpdb->insert(
[1087] Fix | Delete
$wpdb->sitemeta,
[1088] Fix | Delete
array(
[1089] Fix | Delete
'site_id' => $network_id,
[1090] Fix | Delete
'meta_key' => 'main_site',
[1091] Fix | Delete
'meta_value' => $current_site->blog_id,
[1092] Fix | Delete
)
[1093] Fix | Delete
);
[1094] Fix | Delete
[1095] Fix | Delete
if ( $subdomain_install ) {
[1096] Fix | Delete
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
[1097] Fix | Delete
} else {
[1098] Fix | Delete
$wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' );
[1099] Fix | Delete
}
[1100] Fix | Delete
[1101] Fix | Delete
flush_rewrite_rules();
[1102] Fix | Delete
[1103] Fix | Delete
if ( ! $subdomain_install ) {
[1104] Fix | Delete
return true;
[1105] Fix | Delete
}
[1106] Fix | Delete
[1107] Fix | Delete
$vhost_ok = false;
[1108] Fix | Delete
$errstr = '';
[1109] Fix | Delete
$hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname!
[1110] Fix | Delete
$page = wp_remote_get(
[1111] Fix | Delete
'http://' . $hostname,
[1112] Fix | Delete
array(
[1113] Fix | Delete
'timeout' => 5,
[1114] Fix | Delete
'httpversion' => '1.1',
[1115] Fix | Delete
)
[1116] Fix | Delete
);
[1117] Fix | Delete
if ( is_wp_error( $page ) ) {
[1118] Fix | Delete
$errstr = $page->get_error_message();
[1119] Fix | Delete
} elseif ( 200 === wp_remote_retrieve_response_code( $page ) ) {
[1120] Fix | Delete
$vhost_ok = true;
[1121] Fix | Delete
}
[1122] Fix | Delete
[1123] Fix | Delete
if ( ! $vhost_ok ) {
[1124] Fix | Delete
$msg = '<p><strong>' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</strong></p>';
[1125] Fix | Delete
[1126] Fix | Delete
$msg .= '<p>' . sprintf(
[1127] Fix | Delete
/* translators: %s: Host name. */
[1128] Fix | Delete
__( 'The installer attempted to contact a random hostname (%s) on your domain.' ),
[1129] Fix | Delete
'<code>' . $hostname . '</code>'
[1130] Fix | Delete
);
[1131] Fix | Delete
if ( ! empty( $errstr ) ) {
[1132] Fix | Delete
/* translators: %s: Error message. */
[1133] Fix | Delete
$msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '<code>' . $errstr . '</code>' );
[1134] Fix | Delete
}
[1135] Fix | Delete
$msg .= '</p>';
[1136] Fix | Delete
[1137] Fix | Delete
$msg .= '<p>' . sprintf(
[1138] Fix | Delete
/* translators: %s: Asterisk symbol (*). */
[1139] Fix | Delete
__( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a %s hostname record pointing at your web server in your DNS configuration tool.' ),
[1140] Fix | Delete
'<code>*</code>'
[1141] Fix | Delete
) . '</p>';
[1142] Fix | Delete
[1143] Fix | Delete
$msg .= '<p>' . __( 'You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.' ) . '</p>';
[1144] Fix | Delete
[1145] Fix | Delete
return new WP_Error( 'no_wildcard_dns', $msg );
[1146] Fix | Delete
}
[1147] Fix | Delete
}
[1148] Fix | Delete
[1149] Fix | Delete
return true;
[1150] Fix | Delete
}
[1151] Fix | Delete
[1152] Fix | Delete
/**
[1153] Fix | Delete
* Creates WordPress network meta and sets the default values.
[1154] Fix | Delete
*
[1155] Fix | Delete
* @since 5.1.0
[1156] Fix | Delete
*
[1157] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[1158] Fix | Delete
* @global int $wp_db_version WordPress database version.
[1159] Fix | Delete
*
[1160] Fix | Delete
* @param int $network_id Network ID to populate meta for.
[1161] Fix | Delete
* @param array $meta Optional. Custom meta $key => $value pairs to use. Default empty array.
[1162] Fix | Delete
*/
[1163] Fix | Delete
function populate_network_meta( $network_id, array $meta = array() ) {
[1164] Fix | Delete
global $wpdb, $wp_db_version;
[1165] Fix | Delete
[1166] Fix | Delete
$network_id = (int) $network_id;
[1167] Fix | Delete
[1168] Fix | Delete
$email = ! empty( $meta['admin_email'] ) ? $meta['admin_email'] : '';
[1169] Fix | Delete
$subdomain_install = isset( $meta['subdomain_install'] ) ? (int) $meta['subdomain_install'] : 0;
[1170] Fix | Delete
[1171] Fix | Delete
// If a user with the provided email does not exist, default to the current user as the new network admin.
[1172] Fix | Delete
$site_user = ! empty( $email ) ? get_user_by( 'email', $email ) : false;
[1173] Fix | Delete
if ( false === $site_user ) {
[1174] Fix | Delete
$site_user = wp_get_current_user();
[1175] Fix | Delete
}
[1176] Fix | Delete
[1177] Fix | Delete
if ( empty( $email ) ) {
[1178] Fix | Delete
$email = $site_user->user_email;
[1179] Fix | Delete
}
[1180] Fix | Delete
[1181] Fix | Delete
$template = get_option( 'template' );
[1182] Fix | Delete
$stylesheet = get_option( 'stylesheet' );
[1183] Fix | Delete
$allowed_themes = array( $stylesheet => true );
[1184] Fix | Delete
[1185] Fix | Delete
if ( $template !== $stylesheet ) {
[1186] Fix | Delete
$allowed_themes[ $template ] = true;
[1187] Fix | Delete
}
[1188] Fix | Delete
[1189] Fix | Delete
if ( WP_DEFAULT_THEME !== $stylesheet && WP_DEFAULT_THEME !== $template ) {
[1190] Fix | Delete
$allowed_themes[ WP_DEFAULT_THEME ] = true;
[1191] Fix | Delete
}
[1192] Fix | Delete
[1193] Fix | Delete
// If WP_DEFAULT_THEME doesn't exist, also include the latest core default theme.
[1194] Fix | Delete
if ( ! wp_get_theme( WP_DEFAULT_THEME )->exists() ) {
[1195] Fix | Delete
$core_default = WP_Theme::get_core_default_theme();
[1196] Fix | Delete
if ( $core_default ) {
[1197] Fix | Delete
$allowed_themes[ $core_default->get_stylesheet() ] = true;
[1198] Fix | Delete
}
[1199] Fix | Delete
}
[1200] Fix | Delete
[1201] Fix | Delete
if ( function_exists( 'clean_network_cache' ) ) {
[1202] Fix | Delete
clean_network_cache( $network_id );
[1203] Fix | Delete
} else {
[1204] Fix | Delete
wp_cache_delete( $network_id, 'networks' );
[1205] Fix | Delete
}
[1206] Fix | Delete
[1207] Fix | Delete
if ( ! is_multisite() ) {
[1208] Fix | Delete
$site_admins = array( $site_user->user_login );
[1209] Fix | Delete
$users = get_users(
[1210] Fix | Delete
array(
[1211] Fix | Delete
'fields' => array( 'user_login' ),
[1212] Fix | Delete
'role' => 'administrator',
[1213] Fix | Delete
)
[1214] Fix | Delete
);
[1215] Fix | Delete
if ( $users ) {
[1216] Fix | Delete
foreach ( $users as $user ) {
[1217] Fix | Delete
$site_admins[] = $user->user_login;
[1218] Fix | Delete
}
[1219] Fix | Delete
[1220] Fix | Delete
$site_admins = array_unique( $site_admins );
[1221] Fix | Delete
}
[1222] Fix | Delete
} else {
[1223] Fix | Delete
$site_admins = get_site_option( 'site_admins' );
[1224] Fix | Delete
}
[1225] Fix | Delete
[1226] Fix | Delete
/* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */
[1227] Fix | Delete
$welcome_email = __(
[1228] Fix | Delete
'Howdy USERNAME,
[1229] Fix | Delete
[1230] Fix | Delete
Your new SITE_NAME site has been successfully set up at:
[1231] Fix | Delete
BLOG_URL
[1232] Fix | Delete
[1233] Fix | Delete
You can log in to the administrator account with the following information:
[1234] Fix | Delete
[1235] Fix | Delete
Username: USERNAME
[1236] Fix | Delete
Password: PASSWORD
[1237] Fix | Delete
Log in here: BLOG_URLwp-login.php
[1238] Fix | Delete
[1239] Fix | Delete
We hope you enjoy your new site. Thanks!
[1240] Fix | Delete
[1241] Fix | Delete
--The Team @ SITE_NAME'
[1242] Fix | Delete
);
[1243] Fix | Delete
[1244] Fix | Delete
$allowed_file_types = array();
[1245] Fix | Delete
$all_mime_types = get_allowed_mime_types();
[1246] Fix | Delete
[1247] Fix | Delete
foreach ( $all_mime_types as $ext => $mime ) {
[1248] Fix | Delete
array_push( $allowed_file_types, ...explode( '|', $ext ) );
[1249] Fix | Delete
}
[1250] Fix | Delete
$upload_filetypes = array_unique( $allowed_file_types );
[1251] Fix | Delete
[1252] Fix | Delete
$sitemeta = array(
[1253] Fix | Delete
'site_name' => __( 'My Network' ),
[1254] Fix | Delete
'admin_email' => $email,
[1255] Fix | Delete
'admin_user_id' => $site_user->ID,
[1256] Fix | Delete
'registration' => 'none',
[1257] Fix | Delete
'upload_filetypes' => implode( ' ', $upload_filetypes ),
[1258] Fix | Delete
'blog_upload_space' => 100,
[1259] Fix | Delete
'fileupload_maxk' => 1500,
[1260] Fix | Delete
'site_admins' => $site_admins,
[1261] Fix | Delete
'allowedthemes' => $allowed_themes,
[1262] Fix | Delete
'illegal_names' => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ),
[1263] Fix | Delete
'wpmu_upgrade_site' => $wp_db_version,
[1264] Fix | Delete
'welcome_email' => $welcome_email,
[1265] Fix | Delete
/* translators: %s: Site link. */
[1266] Fix | Delete
'first_post' => __( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ),
[1267] Fix | Delete
// @todo - Network admins should have a method of editing the network siteurl (used for cookie hash).
[1268] Fix | Delete
'siteurl' => get_option( 'siteurl' ) . '/',
[1269] Fix | Delete
'add_new_users' => '0',
[1270] Fix | Delete
'upload_space_check_disabled' => is_multisite() ? get_site_option( 'upload_space_check_disabled' ) : '1',
[1271] Fix | Delete
'subdomain_install' => $subdomain_install,
[1272] Fix | Delete
'ms_files_rewriting' => is_multisite() ? get_site_option( 'ms_files_rewriting' ) : '0',
[1273] Fix | Delete
'user_count' => get_site_option( 'user_count' ),
[1274] Fix | Delete
'initial_db_version' => get_option( 'initial_db_version' ),
[1275] Fix | Delete
'active_sitewide_plugins' => array(),
[1276] Fix | Delete
'WPLANG' => get_locale(),
[1277] Fix | Delete
);
[1278] Fix | Delete
if ( ! $subdomain_install ) {
[1279] Fix | Delete
$sitemeta['illegal_names'][] = 'blog';
[1280] Fix | Delete
}
[1281] Fix | Delete
[1282] Fix | Delete
$sitemeta = wp_parse_args( $meta, $sitemeta );
[1283] Fix | Delete
[1284] Fix | Delete
/**
[1285] Fix | Delete
* Filters meta for a network on creation.
[1286] Fix | Delete
*
[1287] Fix | Delete
* @since 3.7.0
[1288] Fix | Delete
*
[1289] Fix | Delete
* @param array $sitemeta Associative array of network meta keys and values to be inserted.
[1290] Fix | Delete
* @param int $network_id ID of network to populate.
[1291] Fix | Delete
*/
[1292] Fix | Delete
$sitemeta = apply_filters( 'populate_network_meta', $sitemeta, $network_id );
[1293] Fix | Delete
[1294] Fix | Delete
$insert = '';
[1295] Fix | Delete
foreach ( $sitemeta as $meta_key => $meta_value ) {
[1296] Fix | Delete
if ( is_array( $meta_value ) ) {
[1297] Fix | Delete
$meta_value = serialize( $meta_value );
[1298] Fix | Delete
}
[1299] Fix | Delete
if ( ! empty( $insert ) ) {
[1300] Fix | Delete
$insert .= ', ';
[1301] Fix | Delete
}
[1302] Fix | Delete
$insert .= $wpdb->prepare( '( %d, %s, %s)', $network_id, $meta_key, $meta_value );
[1303] Fix | Delete
}
[1304] Fix | Delete
$wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
[1305] Fix | Delete
}
[1306] Fix | Delete
[1307] Fix | Delete
/**
[1308] Fix | Delete
* Creates WordPress site meta and sets the default values.
[1309] Fix | Delete
*
[1310] Fix | Delete
* @since 5.1.0
[1311] Fix | Delete
*
[1312] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[1313] Fix | Delete
*
[1314] Fix | Delete
* @param int $site_id Site ID to populate meta for.
[1315] Fix | Delete
* @param array $meta Optional. Custom meta $key => $value pairs to use. Default empty array.
[1316] Fix | Delete
*/
[1317] Fix | Delete
function populate_site_meta( $site_id, array $meta = array() ) {
[1318] Fix | Delete
global $wpdb;
[1319] Fix | Delete
[1320] Fix | Delete
$site_id = (int) $site_id;
[1321] Fix | Delete
[1322] Fix | Delete
if ( ! is_site_meta_supported() ) {
[1323] Fix | Delete
return;
[1324] Fix | Delete
}
[1325] Fix | Delete
[1326] Fix | Delete
if ( empty( $meta ) ) {
[1327] Fix | Delete
return;
[1328] Fix | Delete
}
[1329] Fix | Delete
[1330] Fix | Delete
/**
[1331] Fix | Delete
* Filters meta for a site on creation.
[1332] Fix | Delete
*
[1333] Fix | Delete
* @since 5.2.0
[1334] Fix | Delete
*
[1335] Fix | Delete
* @param array $meta Associative array of site meta keys and values to be inserted.
[1336] Fix | Delete
* @param int $site_id ID of site to populate.
[1337] Fix | Delete
*/
[1338] Fix | Delete
$site_meta = apply_filters( 'populate_site_meta', $meta, $site_id );
[1339] Fix | Delete
[1340] Fix | Delete
$insert = '';
[1341] Fix | Delete
foreach ( $site_meta as $meta_key => $meta_value ) {
[1342] Fix | Delete
if ( is_array( $meta_value ) ) {
[1343] Fix | Delete
$meta_value = serialize( $meta_value );
[1344] Fix | Delete
}
[1345] Fix | Delete
if ( ! empty( $insert ) ) {
[1346] Fix | Delete
$insert .= ', ';
[1347] Fix | Delete
}
[1348] Fix | Delete
$insert .= $wpdb->prepare( '( %d, %s, %s)', $site_id, $meta_key, $meta_value );
[1349] Fix | Delete
}
[1350] Fix | Delete
[1351] Fix | Delete
$wpdb->query( "INSERT INTO $wpdb->blogmeta ( blog_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
[1352] Fix | Delete
[1353] Fix | Delete
wp_cache_delete( $site_id, 'blog_meta' );
[1354] Fix | Delete
wp_cache_set_sites_last_changed();
[1355] Fix | Delete
}
[1356] Fix | Delete
[1357] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function