Make WordPress Core


Ignore:
Timestamp:
10/07/2015 05:11:01 PM (9 years ago)
Author:
jeremyfelt
Message:

Revert [34778], continue using _site_option() for the current network.

The _network_option() parameter order will be changing to accept $network_id first. The _site_option() functions will remain in use throughout core as our way of retrieving a network option for the current network.

See #28290.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-functions.php

    r34854 r34912  
    101101 */
    102102function get_user_count() {
    103     return get_network_option( 'user_count' );
     103    return get_site_option( 'user_count' );
    104104}
    105105
     
    118118        _deprecated_argument( __FUNCTION__, '3.1' );
    119119
    120     return get_network_option( 'blog_count' );
     120    return get_site_option( 'blog_count' );
    121121}
    122122
     
    345345 */
    346346function is_email_address_unsafe( $user_email ) {
    347     $banned_names = get_network_option( 'banned_email_domains' );
     347    $banned_names = get_site_option( 'banned_email_domains' );
    348348    if ( $banned_names && ! is_array( $banned_names ) )
    349349        $banned_names = explode( "\n", $banned_names );
     
    423423        $errors->add('user_name', __( 'Please enter a username.' ) );
    424424
    425     $illegal_names = get_network_option( 'illegal_names' );
     425    $illegal_names = get_site_option( 'illegal_names' );
    426426    if ( ! is_array( $illegal_names ) ) {
    427427        $illegal_names = array(  'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
    428         add_network_option( 'illegal_names', $illegal_names );
     428        add_site_option( 'illegal_names', $illegal_names );
    429429    }
    430430    if ( in_array( $user_name, $illegal_names ) )
     
    451451        $errors->add('user_email', __( 'Please enter a valid email address.' ) );
    452452
    453     $limited_email_domains = get_network_option( 'limited_email_domains' );
     453    $limited_email_domains = get_site_option( 'limited_email_domains' );
    454454    if ( is_array( $limited_email_domains ) && ! empty( $limited_email_domains ) ) {
    455455        $emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) );
     
    545545
    546546    $errors = new WP_Error();
    547     $illegal_names = get_network_option( 'illegal_names' );
     547    $illegal_names = get_site_option( 'illegal_names' );
    548548    if ( $illegal_names == false ) {
    549549        $illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
    550         add_network_option( 'illegal_names', $illegal_names );
     550        add_site_option( 'illegal_names', $illegal_names );
    551551    }
    552552
     
    790790
    791791    $activate_url = esc_url($activate_url);
    792     $admin_email = get_network_option( 'admin_email' );
     792    $admin_email = get_site_option( 'admin_email' );
    793793    if ( $admin_email == '' )
    794794        $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    795     $from_name = get_network_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_network_option( 'site_name' ) );
     795    $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    796796    $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    797797    $message = sprintf(
     
    883883
    884884    // Send email with activation link.
    885     $admin_email = get_network_option( 'admin_email' );
     885    $admin_email = get_site_option( 'admin_email' );
    886886    if ( $admin_email == '' )
    887887        $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    888     $from_name = get_network_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_network_option( 'site_name' ) );
     888    $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    889889    $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    890890    $message = sprintf(
     
    11251125    }
    11261126
    1127     add_option( 'WPLANG', get_network_option( 'WPLANG' ) );
     1127    add_option( 'WPLANG', get_site_option( 'WPLANG' ) );
    11281128    update_option( 'blog_public', (int) $meta['public'] );
    11291129
     
    11611161 */
    11621162function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {
    1163     if ( get_network_option( 'registrationnotification' ) != 'yes' )
     1163    if ( get_site_option( 'registrationnotification' ) != 'yes' )
    11641164        return false;
    11651165
    1166     $email = get_network_option( 'admin_email' );
     1166    $email = get_site_option( 'admin_email' );
    11671167    if ( is_email($email) == false )
    11681168        return false;
     
    12061206 */
    12071207function newuser_notify_siteadmin( $user_id ) {
    1208     if ( get_network_option( 'registrationnotification' ) != 'yes' )
     1208    if ( get_site_option( 'registrationnotification' ) != 'yes' )
    12091209        return false;
    12101210
    1211     $email = get_network_option( 'admin_email' );
     1211    $email = get_site_option( 'admin_email' );
    12121212
    12131213    if ( is_email($email) == false )
     
    13451345    update_option( 'home', $url );
    13461346
    1347     if ( get_network_option( 'ms_files_rewriting' ) )
     1347    if ( get_site_option( 'ms_files_rewriting' ) )
    13481348        update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" );
    13491349    else
     
    14211421        return false;
    14221422
    1423     $welcome_email = get_network_option( 'welcome_email' );
     1423    $welcome_email = get_site_option( 'welcome_email' );
    14241424    if ( $welcome_email == false ) {
    14251425        /* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */
     
    14641464     */
    14651465    $welcome_email = apply_filters( 'update_welcome_email', $welcome_email, $blog_id, $user_id, $password, $title, $meta );
    1466     $admin_email = get_network_option( 'admin_email' );
     1466    $admin_email = get_site_option( 'admin_email' );
    14671467
    14681468    if ( $admin_email == '' )
    14691469        $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    14701470
    1471     $from_name = get_network_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_network_option( 'site_name' ) );
     1471    $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    14721472    $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    14731473    $message = $welcome_email;
     
    15201520        return false;
    15211521
    1522     $welcome_email = get_network_option( 'welcome_user_email' );
     1522    $welcome_email = get_site_option( 'welcome_user_email' );
    15231523
    15241524    $user = get_userdata( $user_id );
     
    15421542    $welcome_email = str_replace( 'LOGINLINK', wp_login_url(), $welcome_email );
    15431543
    1544     $admin_email = get_network_option( 'admin_email' );
     1544    $admin_email = get_site_option( 'admin_email' );
    15451545
    15461546    if ( $admin_email == '' )
    15471547        $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    15481548
    1549     $from_name = get_network_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_network_option( 'site_name' ) );
     1549    $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    15501550    $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    15511551    $message = $welcome_email;
     
    17191719 */
    17201720function check_upload_mimes( $mimes ) {
    1721     $site_exts = explode( ' ', get_network_option( 'upload_filetypes', 'jpg jpeg png gif' ) );
     1721    $site_exts = explode( ' ', get_site_option( 'upload_filetypes', 'jpg jpeg png gif' ) );
    17221722    $site_mimes = array();
    17231723    foreach ( $site_exts as $ext ) {
     
    18601860 */
    18611861function upload_is_file_too_big( $upload ) {
    1862     if ( ! is_array( $upload ) || defined( 'WP_IMPORTING' ) || get_network_option( 'upload_space_check_disabled' ) )
     1862    if ( ! is_array( $upload ) || defined( 'WP_IMPORTING' ) || get_site_option( 'upload_space_check_disabled' ) )
    18631863        return $upload;
    18641864
    1865     if ( strlen( $upload['bits'] )  > ( 1024 * get_network_option( 'fileupload_maxk', 1500 ) ) )
    1866         return sprintf( __( 'This file is too big. Files must be less than %d KB in size.' ) . '<br />', get_network_option( 'fileupload_maxk', 1500 ) );
     1865    if ( strlen( $upload['bits'] )  > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) )
     1866        return sprintf( __( 'This file is too big. Files must be less than %d KB in size.' ) . '<br />', get_site_option( 'fileupload_maxk', 1500 ));
    18671867
    18681868    return $upload;
     
    20772077 */
    20782078function users_can_register_signup_filter() {
    2079     $registration = get_network_option( 'registration' );
     2079    $registration = get_site_option('registration');
    20802080    return ( $registration == 'all' || $registration == 'user' );
    20812081}
     
    21062106
    21072107--The Team @ SITE_NAME' );
    2108         update_network_option( 'welcome_user_email', $text );
     2108        update_site_option( 'welcome_user_email', $text );
    21092109    }
    21102110    return $text;
     
    22322232
    22332233    $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(blog_id) as c FROM $wpdb->blogs WHERE site_id = %d AND spam = '0' AND deleted = '0' and archived = '0'", $wpdb->siteid) );
    2234     update_network_option( 'blog_count', $count );
     2234    update_site_option( 'blog_count', $count );
    22352235}
    22362236
     
    22462246
    22472247    $count = $wpdb->get_var( "SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'" );
    2248     update_network_option( 'user_count', $count );
     2248    update_site_option( 'user_count', $count );
    22492249}
    22502250
     
    22842284
    22852285    if ( ! is_numeric( $space_allowed ) )
    2286         $space_allowed = get_network_option( 'blog_upload_space' );
     2286        $space_allowed = get_site_option( 'blog_upload_space' );
    22872287
    22882288    if ( empty( $space_allowed ) || ! is_numeric( $space_allowed ) )
     
    23122312    }
    23132313    $space_allowed = $allowed * 1024 * 1024;
    2314     if ( get_network_option( 'upload_space_check_disabled' ) )
     2314    if ( get_site_option( 'upload_space_check_disabled' ) )
    23152315        return $space_allowed;
    23162316
     
    23302330 */
    23312331function is_upload_space_available() {
    2332     if ( get_network_option( 'upload_space_check_disabled' ) )
     2332    if ( get_site_option( 'upload_space_check_disabled' ) )
    23332333        return true;
    23342334
     
    23422342 */
    23432343function upload_size_limit_filter( $size ) {
    2344     $fileupload_maxk = 1024 * get_network_option( 'fileupload_maxk', 1500 );
    2345     if ( get_network_option( 'upload_space_check_disabled' ) )
     2344    $fileupload_maxk = 1024 * get_site_option( 'fileupload_maxk', 1500 );
     2345    if ( get_site_option( 'upload_space_check_disabled' ) )
    23462346        return min( $size, $fileupload_maxk );
    23472347
Note: See TracChangeset for help on using the changeset viewer.