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-inclu...
File: ms-functions.php
'spam' => 0,
[2500] Fix | Delete
'deleted' => 0,
[2501] Fix | Delete
'archived' => 0,
[2502] Fix | Delete
'count' => true,
[2503] Fix | Delete
'update_site_meta_cache' => false,
[2504] Fix | Delete
)
[2505] Fix | Delete
);
[2506] Fix | Delete
[2507] Fix | Delete
update_network_option( $network_id, 'blog_count', $count );
[2508] Fix | Delete
}
[2509] Fix | Delete
[2510] Fix | Delete
/**
[2511] Fix | Delete
* Updates the network-wide user count.
[2512] Fix | Delete
*
[2513] Fix | Delete
* @since 3.7.0
[2514] Fix | Delete
* @since 4.8.0 The `$network_id` parameter has been added.
[2515] Fix | Delete
* @since 6.0.0 This function is now a wrapper for wp_update_user_counts().
[2516] Fix | Delete
*
[2517] Fix | Delete
* @param int|null $network_id ID of the network. Default is the current network.
[2518] Fix | Delete
*/
[2519] Fix | Delete
function wp_update_network_user_counts( $network_id = null ) {
[2520] Fix | Delete
wp_update_user_counts( $network_id );
[2521] Fix | Delete
}
[2522] Fix | Delete
[2523] Fix | Delete
/**
[2524] Fix | Delete
* Returns the space used by the current site.
[2525] Fix | Delete
*
[2526] Fix | Delete
* @since 3.5.0
[2527] Fix | Delete
*
[2528] Fix | Delete
* @return int Used space in megabytes.
[2529] Fix | Delete
*/
[2530] Fix | Delete
function get_space_used() {
[2531] Fix | Delete
/**
[2532] Fix | Delete
* Filters the amount of storage space used by the current site, in megabytes.
[2533] Fix | Delete
*
[2534] Fix | Delete
* @since 3.5.0
[2535] Fix | Delete
*
[2536] Fix | Delete
* @param int|false $space_used The amount of used space, in megabytes. Default false.
[2537] Fix | Delete
*/
[2538] Fix | Delete
$space_used = apply_filters( 'pre_get_space_used', false );
[2539] Fix | Delete
[2540] Fix | Delete
if ( false === $space_used ) {
[2541] Fix | Delete
$upload_dir = wp_upload_dir();
[2542] Fix | Delete
$space_used = get_dirsize( $upload_dir['basedir'] ) / MB_IN_BYTES;
[2543] Fix | Delete
}
[2544] Fix | Delete
[2545] Fix | Delete
return $space_used;
[2546] Fix | Delete
}
[2547] Fix | Delete
[2548] Fix | Delete
/**
[2549] Fix | Delete
* Returns the upload quota for the current blog.
[2550] Fix | Delete
*
[2551] Fix | Delete
* @since MU (3.0.0)
[2552] Fix | Delete
*
[2553] Fix | Delete
* @return int Quota in megabytes.
[2554] Fix | Delete
*/
[2555] Fix | Delete
function get_space_allowed() {
[2556] Fix | Delete
$space_allowed = get_option( 'blog_upload_space' );
[2557] Fix | Delete
[2558] Fix | Delete
if ( ! is_numeric( $space_allowed ) ) {
[2559] Fix | Delete
$space_allowed = get_site_option( 'blog_upload_space' );
[2560] Fix | Delete
}
[2561] Fix | Delete
[2562] Fix | Delete
if ( ! is_numeric( $space_allowed ) ) {
[2563] Fix | Delete
$space_allowed = 100;
[2564] Fix | Delete
}
[2565] Fix | Delete
[2566] Fix | Delete
/**
[2567] Fix | Delete
* Filters the upload quota for the current site.
[2568] Fix | Delete
*
[2569] Fix | Delete
* @since 3.7.0
[2570] Fix | Delete
*
[2571] Fix | Delete
* @param int $space_allowed Upload quota in megabytes for the current blog.
[2572] Fix | Delete
*/
[2573] Fix | Delete
return apply_filters( 'get_space_allowed', $space_allowed );
[2574] Fix | Delete
}
[2575] Fix | Delete
[2576] Fix | Delete
/**
[2577] Fix | Delete
* Determines if there is any upload space left in the current blog's quota.
[2578] Fix | Delete
*
[2579] Fix | Delete
* @since 3.0.0
[2580] Fix | Delete
*
[2581] Fix | Delete
* @return int of upload space available in bytes.
[2582] Fix | Delete
*/
[2583] Fix | Delete
function get_upload_space_available() {
[2584] Fix | Delete
$allowed = get_space_allowed();
[2585] Fix | Delete
if ( $allowed < 0 ) {
[2586] Fix | Delete
$allowed = 0;
[2587] Fix | Delete
}
[2588] Fix | Delete
$space_allowed = $allowed * MB_IN_BYTES;
[2589] Fix | Delete
if ( get_site_option( 'upload_space_check_disabled' ) ) {
[2590] Fix | Delete
return $space_allowed;
[2591] Fix | Delete
}
[2592] Fix | Delete
[2593] Fix | Delete
$space_used = get_space_used() * MB_IN_BYTES;
[2594] Fix | Delete
[2595] Fix | Delete
if ( ( $space_allowed - $space_used ) <= 0 ) {
[2596] Fix | Delete
return 0;
[2597] Fix | Delete
}
[2598] Fix | Delete
[2599] Fix | Delete
return $space_allowed - $space_used;
[2600] Fix | Delete
}
[2601] Fix | Delete
[2602] Fix | Delete
/**
[2603] Fix | Delete
* Determines if there is any upload space left in the current blog's quota.
[2604] Fix | Delete
*
[2605] Fix | Delete
* @since 3.0.0
[2606] Fix | Delete
* @return bool True if space is available, false otherwise.
[2607] Fix | Delete
*/
[2608] Fix | Delete
function is_upload_space_available() {
[2609] Fix | Delete
if ( get_site_option( 'upload_space_check_disabled' ) ) {
[2610] Fix | Delete
return true;
[2611] Fix | Delete
}
[2612] Fix | Delete
[2613] Fix | Delete
return (bool) get_upload_space_available();
[2614] Fix | Delete
}
[2615] Fix | Delete
[2616] Fix | Delete
/**
[2617] Fix | Delete
* Filters the maximum upload file size allowed, in bytes.
[2618] Fix | Delete
*
[2619] Fix | Delete
* @since 3.0.0
[2620] Fix | Delete
*
[2621] Fix | Delete
* @param int $size Upload size limit in bytes.
[2622] Fix | Delete
* @return int Upload size limit in bytes.
[2623] Fix | Delete
*/
[2624] Fix | Delete
function upload_size_limit_filter( $size ) {
[2625] Fix | Delete
$fileupload_maxk = (int) get_site_option( 'fileupload_maxk', 1500 );
[2626] Fix | Delete
$max_fileupload_in_bytes = KB_IN_BYTES * $fileupload_maxk;
[2627] Fix | Delete
[2628] Fix | Delete
if ( get_site_option( 'upload_space_check_disabled' ) ) {
[2629] Fix | Delete
return min( $size, $max_fileupload_in_bytes );
[2630] Fix | Delete
}
[2631] Fix | Delete
[2632] Fix | Delete
return min( $size, $max_fileupload_in_bytes, get_upload_space_available() );
[2633] Fix | Delete
}
[2634] Fix | Delete
[2635] Fix | Delete
/**
[2636] Fix | Delete
* Determines whether or not we have a large network.
[2637] Fix | Delete
*
[2638] Fix | Delete
* The default criteria for a large network is either more than 10,000 users or more than 10,000 sites.
[2639] Fix | Delete
* Plugins can alter this criteria using the {@see 'wp_is_large_network'} filter.
[2640] Fix | Delete
*
[2641] Fix | Delete
* @since 3.3.0
[2642] Fix | Delete
* @since 4.8.0 The `$network_id` parameter has been added.
[2643] Fix | Delete
*
[2644] Fix | Delete
* @param string $using 'sites' or 'users'. Default is 'sites'.
[2645] Fix | Delete
* @param int|null $network_id ID of the network. Default is the current network.
[2646] Fix | Delete
* @return bool True if the network meets the criteria for large. False otherwise.
[2647] Fix | Delete
*/
[2648] Fix | Delete
function wp_is_large_network( $using = 'sites', $network_id = null ) {
[2649] Fix | Delete
$network_id = (int) $network_id;
[2650] Fix | Delete
if ( ! $network_id ) {
[2651] Fix | Delete
$network_id = get_current_network_id();
[2652] Fix | Delete
}
[2653] Fix | Delete
[2654] Fix | Delete
if ( 'users' === $using ) {
[2655] Fix | Delete
$count = get_user_count( $network_id );
[2656] Fix | Delete
[2657] Fix | Delete
$is_large_network = wp_is_large_user_count( $network_id );
[2658] Fix | Delete
[2659] Fix | Delete
/**
[2660] Fix | Delete
* Filters whether the network is considered large.
[2661] Fix | Delete
*
[2662] Fix | Delete
* @since 3.3.0
[2663] Fix | Delete
* @since 4.8.0 The `$network_id` parameter has been added.
[2664] Fix | Delete
*
[2665] Fix | Delete
* @param bool $is_large_network Whether the network has more than 10000 users or sites.
[2666] Fix | Delete
* @param string $component The component to count. Accepts 'users', or 'sites'.
[2667] Fix | Delete
* @param int $count The count of items for the component.
[2668] Fix | Delete
* @param int $network_id The ID of the network being checked.
[2669] Fix | Delete
*/
[2670] Fix | Delete
return apply_filters( 'wp_is_large_network', $is_large_network, 'users', $count, $network_id );
[2671] Fix | Delete
}
[2672] Fix | Delete
[2673] Fix | Delete
$count = get_blog_count( $network_id );
[2674] Fix | Delete
[2675] Fix | Delete
/** This filter is documented in wp-includes/ms-functions.php */
[2676] Fix | Delete
return apply_filters( 'wp_is_large_network', $count > 10000, 'sites', $count, $network_id );
[2677] Fix | Delete
}
[2678] Fix | Delete
[2679] Fix | Delete
/**
[2680] Fix | Delete
* Retrieves a list of reserved site on a sub-directory Multisite installation.
[2681] Fix | Delete
*
[2682] Fix | Delete
* @since 4.4.0
[2683] Fix | Delete
*
[2684] Fix | Delete
* @return string[] Array of reserved names.
[2685] Fix | Delete
*/
[2686] Fix | Delete
function get_subdirectory_reserved_names() {
[2687] Fix | Delete
$names = array(
[2688] Fix | Delete
'page',
[2689] Fix | Delete
'comments',
[2690] Fix | Delete
'blog',
[2691] Fix | Delete
'files',
[2692] Fix | Delete
'feed',
[2693] Fix | Delete
'wp-admin',
[2694] Fix | Delete
'wp-content',
[2695] Fix | Delete
'wp-includes',
[2696] Fix | Delete
'wp-json',
[2697] Fix | Delete
'embed',
[2698] Fix | Delete
);
[2699] Fix | Delete
[2700] Fix | Delete
/**
[2701] Fix | Delete
* Filters reserved site names on a sub-directory Multisite installation.
[2702] Fix | Delete
*
[2703] Fix | Delete
* @since 3.0.0
[2704] Fix | Delete
* @since 4.4.0 'wp-admin', 'wp-content', 'wp-includes', 'wp-json', and 'embed' were added
[2705] Fix | Delete
* to the reserved names list.
[2706] Fix | Delete
*
[2707] Fix | Delete
* @param string[] $subdirectory_reserved_names Array of reserved names.
[2708] Fix | Delete
*/
[2709] Fix | Delete
return apply_filters( 'subdirectory_reserved_names', $names );
[2710] Fix | Delete
}
[2711] Fix | Delete
[2712] Fix | Delete
/**
[2713] Fix | Delete
* Sends a confirmation request email when a change of network admin email address is attempted.
[2714] Fix | Delete
*
[2715] Fix | Delete
* The new network admin address will not become active until confirmed.
[2716] Fix | Delete
*
[2717] Fix | Delete
* @since 4.9.0
[2718] Fix | Delete
*
[2719] Fix | Delete
* @param string $old_value The old network admin email address.
[2720] Fix | Delete
* @param string $value The proposed new network admin email address.
[2721] Fix | Delete
*/
[2722] Fix | Delete
function update_network_option_new_admin_email( $old_value, $value ) {
[2723] Fix | Delete
if ( get_site_option( 'admin_email' ) === $value || ! is_email( $value ) ) {
[2724] Fix | Delete
return;
[2725] Fix | Delete
}
[2726] Fix | Delete
[2727] Fix | Delete
$hash = md5( $value . time() . mt_rand() );
[2728] Fix | Delete
$new_admin_email = array(
[2729] Fix | Delete
'hash' => $hash,
[2730] Fix | Delete
'newemail' => $value,
[2731] Fix | Delete
);
[2732] Fix | Delete
update_site_option( 'network_admin_hash', $new_admin_email );
[2733] Fix | Delete
[2734] Fix | Delete
$switched_locale = switch_to_user_locale( get_current_user_id() );
[2735] Fix | Delete
[2736] Fix | Delete
/* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
[2737] Fix | Delete
$email_text = __(
[2738] Fix | Delete
'Howdy ###USERNAME###,
[2739] Fix | Delete
[2740] Fix | Delete
You recently requested to have the network admin email address on
[2741] Fix | Delete
your network changed.
[2742] Fix | Delete
[2743] Fix | Delete
If this is correct, please click on the following link to change it:
[2744] Fix | Delete
###ADMIN_URL###
[2745] Fix | Delete
[2746] Fix | Delete
You can safely ignore and delete this email if you do not want to
[2747] Fix | Delete
take this action.
[2748] Fix | Delete
[2749] Fix | Delete
This email has been sent to ###EMAIL###
[2750] Fix | Delete
[2751] Fix | Delete
Regards,
[2752] Fix | Delete
All at ###SITENAME###
[2753] Fix | Delete
###SITEURL###'
[2754] Fix | Delete
);
[2755] Fix | Delete
[2756] Fix | Delete
/**
[2757] Fix | Delete
* Filters the text of the email sent when a change of network admin email address is attempted.
[2758] Fix | Delete
*
[2759] Fix | Delete
* The following strings have a special meaning and will get replaced dynamically:
[2760] Fix | Delete
* ###USERNAME### The current user's username.
[2761] Fix | Delete
* ###ADMIN_URL### The link to click on to confirm the email change.
[2762] Fix | Delete
* ###EMAIL### The proposed new network admin email address.
[2763] Fix | Delete
* ###SITENAME### The name of the network.
[2764] Fix | Delete
* ###SITEURL### The URL to the network.
[2765] Fix | Delete
*
[2766] Fix | Delete
* @since 4.9.0
[2767] Fix | Delete
*
[2768] Fix | Delete
* @param string $email_text Text in the email.
[2769] Fix | Delete
* @param array $new_admin_email {
[2770] Fix | Delete
* Data relating to the new network admin email address.
[2771] Fix | Delete
*
[2772] Fix | Delete
* @type string $hash The secure hash used in the confirmation link URL.
[2773] Fix | Delete
* @type string $newemail The proposed new network admin email address.
[2774] Fix | Delete
* }
[2775] Fix | Delete
*/
[2776] Fix | Delete
$content = apply_filters( 'new_network_admin_email_content', $email_text, $new_admin_email );
[2777] Fix | Delete
[2778] Fix | Delete
$current_user = wp_get_current_user();
[2779] Fix | Delete
$content = str_replace( '###USERNAME###', $current_user->user_login, $content );
[2780] Fix | Delete
$content = str_replace( '###ADMIN_URL###', esc_url( network_admin_url( 'settings.php?network_admin_hash=' . $hash ) ), $content );
[2781] Fix | Delete
$content = str_replace( '###EMAIL###', $value, $content );
[2782] Fix | Delete
$content = str_replace( '###SITENAME###', wp_specialchars_decode( get_site_option( 'site_name' ), ENT_QUOTES ), $content );
[2783] Fix | Delete
$content = str_replace( '###SITEURL###', network_home_url(), $content );
[2784] Fix | Delete
[2785] Fix | Delete
wp_mail(
[2786] Fix | Delete
$value,
[2787] Fix | Delete
sprintf(
[2788] Fix | Delete
/* translators: Email change notification email subject. %s: Network title. */
[2789] Fix | Delete
__( '[%s] Network Admin Email Change Request' ),
[2790] Fix | Delete
wp_specialchars_decode( get_site_option( 'site_name' ), ENT_QUOTES )
[2791] Fix | Delete
),
[2792] Fix | Delete
$content
[2793] Fix | Delete
);
[2794] Fix | Delete
[2795] Fix | Delete
if ( $switched_locale ) {
[2796] Fix | Delete
restore_previous_locale();
[2797] Fix | Delete
}
[2798] Fix | Delete
}
[2799] Fix | Delete
[2800] Fix | Delete
/**
[2801] Fix | Delete
* Sends an email to the old network admin email address when the network admin email address changes.
[2802] Fix | Delete
*
[2803] Fix | Delete
* @since 4.9.0
[2804] Fix | Delete
*
[2805] Fix | Delete
* @param string $option_name The relevant database option name.
[2806] Fix | Delete
* @param string $new_email The new network admin email address.
[2807] Fix | Delete
* @param string $old_email The old network admin email address.
[2808] Fix | Delete
* @param int $network_id ID of the network.
[2809] Fix | Delete
*/
[2810] Fix | Delete
function wp_network_admin_email_change_notification( $option_name, $new_email, $old_email, $network_id ) {
[2811] Fix | Delete
$send = true;
[2812] Fix | Delete
[2813] Fix | Delete
// Don't send the notification to the default 'admin_email' value.
[2814] Fix | Delete
if ( 'you@example.com' === $old_email ) {
[2815] Fix | Delete
$send = false;
[2816] Fix | Delete
}
[2817] Fix | Delete
[2818] Fix | Delete
/**
[2819] Fix | Delete
* Filters whether to send the network admin email change notification email.
[2820] Fix | Delete
*
[2821] Fix | Delete
* @since 4.9.0
[2822] Fix | Delete
*
[2823] Fix | Delete
* @param bool $send Whether to send the email notification.
[2824] Fix | Delete
* @param string $old_email The old network admin email address.
[2825] Fix | Delete
* @param string $new_email The new network admin email address.
[2826] Fix | Delete
* @param int $network_id ID of the network.
[2827] Fix | Delete
*/
[2828] Fix | Delete
$send = apply_filters( 'send_network_admin_email_change_email', $send, $old_email, $new_email, $network_id );
[2829] Fix | Delete
[2830] Fix | Delete
if ( ! $send ) {
[2831] Fix | Delete
return;
[2832] Fix | Delete
}
[2833] Fix | Delete
[2834] Fix | Delete
/* translators: Do not translate OLD_EMAIL, NEW_EMAIL, SITENAME, SITEURL: those are placeholders. */
[2835] Fix | Delete
$email_change_text = __(
[2836] Fix | Delete
'Hi,
[2837] Fix | Delete
[2838] Fix | Delete
This notice confirms that the network admin email address was changed on ###SITENAME###.
[2839] Fix | Delete
[2840] Fix | Delete
The new network admin email address is ###NEW_EMAIL###.
[2841] Fix | Delete
[2842] Fix | Delete
This email has been sent to ###OLD_EMAIL###
[2843] Fix | Delete
[2844] Fix | Delete
Regards,
[2845] Fix | Delete
All at ###SITENAME###
[2846] Fix | Delete
###SITEURL###'
[2847] Fix | Delete
);
[2848] Fix | Delete
[2849] Fix | Delete
$email_change_email = array(
[2850] Fix | Delete
'to' => $old_email,
[2851] Fix | Delete
/* translators: Network admin email change notification email subject. %s: Network title. */
[2852] Fix | Delete
'subject' => __( '[%s] Network Admin Email Changed' ),
[2853] Fix | Delete
'message' => $email_change_text,
[2854] Fix | Delete
'headers' => '',
[2855] Fix | Delete
);
[2856] Fix | Delete
// Get network name.
[2857] Fix | Delete
$network_name = wp_specialchars_decode( get_site_option( 'site_name' ), ENT_QUOTES );
[2858] Fix | Delete
[2859] Fix | Delete
/**
[2860] Fix | Delete
* Filters the contents of the email notification sent when the network admin email address is changed.
[2861] Fix | Delete
*
[2862] Fix | Delete
* @since 4.9.0
[2863] Fix | Delete
*
[2864] Fix | Delete
* @param array $email_change_email {
[2865] Fix | Delete
* Used to build wp_mail().
[2866] Fix | Delete
*
[2867] Fix | Delete
* @type string $to The intended recipient.
[2868] Fix | Delete
* @type string $subject The subject of the email.
[2869] Fix | Delete
* @type string $message The content of the email.
[2870] Fix | Delete
* The following strings have a special meaning and will get replaced dynamically:
[2871] Fix | Delete
* - ###OLD_EMAIL### The old network admin email address.
[2872] Fix | Delete
* - ###NEW_EMAIL### The new network admin email address.
[2873] Fix | Delete
* - ###SITENAME### The name of the network.
[2874] Fix | Delete
* - ###SITEURL### The URL to the site.
[2875] Fix | Delete
* @type string $headers Headers.
[2876] Fix | Delete
* }
[2877] Fix | Delete
* @param string $old_email The old network admin email address.
[2878] Fix | Delete
* @param string $new_email The new network admin email address.
[2879] Fix | Delete
* @param int $network_id ID of the network.
[2880] Fix | Delete
*/
[2881] Fix | Delete
$email_change_email = apply_filters( 'network_admin_email_change_email', $email_change_email, $old_email, $new_email, $network_id );
[2882] Fix | Delete
[2883] Fix | Delete
$email_change_email['message'] = str_replace( '###OLD_EMAIL###', $old_email, $email_change_email['message'] );
[2884] Fix | Delete
$email_change_email['message'] = str_replace( '###NEW_EMAIL###', $new_email, $email_change_email['message'] );
[2885] Fix | Delete
$email_change_email['message'] = str_replace( '###SITENAME###', $network_name, $email_change_email['message'] );
[2886] Fix | Delete
$email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] );
[2887] Fix | Delete
[2888] Fix | Delete
wp_mail(
[2889] Fix | Delete
$email_change_email['to'],
[2890] Fix | Delete
sprintf(
[2891] Fix | Delete
$email_change_email['subject'],
[2892] Fix | Delete
$network_name
[2893] Fix | Delete
),
[2894] Fix | Delete
$email_change_email['message'],
[2895] Fix | Delete
$email_change_email['headers']
[2896] Fix | Delete
);
[2897] Fix | Delete
}
[2898] Fix | Delete
[2899] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function