Changeset 38457
- Timestamp:
- 08/31/2016 04:55:01 AM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-themes-list-table.php
r38028 r38457 92 92 } 93 93 94 $blog_id = get_current_blog_id(); 94 95 if ( is_multisite() ) { 95 96 if ( current_user_can( 'install_themes' ) && current_user_can( 'manage_network_themes' ) ) { 96 printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to <a href="%1$s">enable</a> or <a href="%2$s">install</a> more themes.' ), network_admin_url( 'site-themes.php?id=' . $ GLOBALS['blog_id']), network_admin_url( 'theme-install.php' ) );97 printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to <a href="%1$s">enable</a> or <a href="%2$s">install</a> more themes.' ), network_admin_url( 'site-themes.php?id=' . $blog_id ), network_admin_url( 'theme-install.php' ) ); 97 98 98 99 return; 99 100 } elseif ( current_user_can( 'manage_network_themes' ) ) { 100 printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to <a href="%1$s">enable</a> more themes.' ), network_admin_url( 'site-themes.php?id=' . $ GLOBALS['blog_id']) );101 printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to <a href="%1$s">enable</a> more themes.' ), network_admin_url( 'site-themes.php?id=' . $blog_id ) ); 101 102 102 103 return; -
trunk/src/wp-includes/cache.php
r38335 r38457 730 730 * 731 731 * @since 2.0.8 732 *733 * @global int $blog_id Global blog ID.734 732 */ 735 733 public function __construct() { 736 global $blog_id;737 738 734 $this->multisite = is_multisite(); 739 $this->blog_prefix = $this->multisite ? $blog_id. ':' : '';735 $this->blog_prefix = $this->multisite ? get_current_blog_id() . ':' : ''; 740 736 741 737 -
trunk/src/wp-includes/class-wp-user-query.php
r38275 r38457 105 105 public static function fill_query_vars( $args ) { 106 106 $defaults = array( 107 'blog_id' => $GLOBALS['blog_id'],107 'blog_id' => get_current_blog_id(), 108 108 'role' => '', 109 109 'role__in' => array(), -
trunk/src/wp-includes/deprecated.php
r38343 r38457 2358 2358 * 2359 2359 * @global wpdb $wpdb WordPress database abstraction object. 2360 * @global int $blog_id The site ID of the site for those that use more than one site.2361 2360 * 2362 2361 * @param int $id Site ID. … … 2366 2365 _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); 2367 2366 2368 global $wpdb, $blog_id; 2369 if ( empty($id) ) 2370 $id = (int) $blog_id; 2367 global $wpdb; 2368 if ( empty( $id ) ) { 2369 $id = get_current_blog_id(); 2370 } 2371 2371 $blog_prefix = $wpdb->get_blog_prefix($id); 2372 2372 $users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" ); -
trunk/src/wp-includes/load.php
r38431 r38457 471 471 * @since 3.0.0 472 472 * @access private 473 *474 * @global int $blog_id Blog ID.475 473 */ 476 474 function wp_start_object_cache() { 477 global $blog_id;478 479 475 $first_init = false; 480 476 if ( ! function_exists( 'wp_cache_init' ) ) { 481 477 if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { 482 478 require_once ( WP_CONTENT_DIR . '/object-cache.php' ); 483 if ( function_exists( 'wp_cache_init' ) ) 479 if ( function_exists( 'wp_cache_init' ) ) { 484 480 wp_using_ext_object_cache( true ); 481 } 485 482 } 486 483 … … 496 493 } 497 494 498 if ( ! wp_using_ext_object_cache() ) 495 if ( ! wp_using_ext_object_cache() ) { 499 496 require_once ( ABSPATH . WPINC . '/cache.php' ); 497 } 500 498 501 499 /* … … 504 502 * have changed and it may need to update keys and cleanup caches. 505 503 */ 506 if ( ! $first_init && function_exists( 'wp_cache_switch_to_blog' ) ) 507 wp_cache_switch_to_blog( $blog_id);508 elseif ( function_exists( 'wp_cache_init' ) )504 if ( ! $first_init && function_exists( 'wp_cache_switch_to_blog' ) ) { 505 wp_cache_switch_to_blog( get_current_blog_id() ); 506 } elseif ( function_exists( 'wp_cache_init' ) ) { 509 507 wp_cache_init(); 508 } 510 509 511 510 if ( function_exists( 'wp_cache_add_global_groups' ) ) { -
trunk/src/wp-includes/ms-blogs.php
r38388 r38457 767 767 global $wpdb; 768 768 769 if ( empty( $new_blog ) ) 770 $new_blog = $GLOBALS['blog_id']; 771 772 $GLOBALS['_wp_switched_stack'][] = $GLOBALS['blog_id']; 769 $blog_id = get_current_blog_id(); 770 if ( empty( $new_blog ) ) { 771 $new_blog = $blog_id; 772 } 773 774 $GLOBALS['_wp_switched_stack'][] = $blog_id; 773 775 774 776 /* … … 777 779 * the extra unnecessary work 778 780 */ 779 if ( $new_blog == $ GLOBALS['blog_id']) {781 if ( $new_blog == $blog_id ) { 780 782 /** 781 783 * Fires when the blog is switched. … … 793 795 $wpdb->set_blog_id( $new_blog ); 794 796 $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix(); 795 $prev_blog_id = $ GLOBALS['blog_id'];797 $prev_blog_id = $blog_id; 796 798 $GLOBALS['blog_id'] = $new_blog; 797 799 … … 801 803 global $wp_object_cache; 802 804 803 if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) ) 805 if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) ) { 804 806 $global_groups = $wp_object_cache->global_groups; 805 else807 } else { 806 808 $global_groups = false; 807 809 } 808 810 wp_cache_init(); 809 811 … … 849 851 global $wpdb; 850 852 851 if ( empty( $GLOBALS['_wp_switched_stack'] ) ) 853 if ( empty( $GLOBALS['_wp_switched_stack'] ) ) { 852 854 return false; 855 } 853 856 854 857 $blog = array_pop( $GLOBALS['_wp_switched_stack'] ); 855 856 if ( $GLOBALS['blog_id'] == $blog ) { 858 $blog_id = get_current_blog_id(); 859 860 if ( $blog_id == $blog ) { 857 861 /** This filter is documented in wp-includes/ms-blogs.php */ 858 862 do_action( 'switch_blog', $blog, $blog ); … … 863 867 864 868 $wpdb->set_blog_id( $blog ); 865 $prev_blog_id = $ GLOBALS['blog_id'];869 $prev_blog_id = $blog_id; 866 870 $GLOBALS['blog_id'] = $blog; 867 871 $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix(); … … 872 876 global $wp_object_cache; 873 877 874 if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) ) 878 if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) ) { 875 879 $global_groups = $wp_object_cache->global_groups; 876 else880 } else { 877 881 $global_groups = false; 882 } 878 883 879 884 wp_cache_init(); -
trunk/src/wp-includes/ms-functions.php
r38388 r38457 1967 1967 * @since MU 1968 1968 * 1969 * @global int $blog_id1970 *1971 1969 * @param array $details 1972 1970 * @return true|WP_Error|void 1973 1971 */ 1974 1972 function add_existing_user_to_blog( $details = false ) { 1975 global $blog_id;1976 1977 1973 if ( is_array( $details ) ) { 1974 $blog_id = get_current_blog_id(); 1978 1975 $result = add_user_to_blog( $blog_id, $details[ 'user_id' ], $details[ 'role' ] ); 1979 1976 /** -
trunk/src/wp-includes/user.php
r38406 r38457 965 965 * @since 2.3.0 966 966 * @since 4.5.0 Added the 'display_name_with_login' value for 'show'. 967 *968 * @global int $blog_id969 967 * 970 968 * @param array|string $args { … … 1017 1015 'show' => 'display_name', 'echo' => 1, 1018 1016 'selected' => 0, 'name' => 'user', 'class' => '', 'id' => '', 1019 'blog_id' => $GLOBALS['blog_id'], 'who' => '', 'include_selected' => false,1017 'blog_id' => get_current_blog_id(), 'who' => '', 'include_selected' => false, 1020 1018 'option_none_value' => -1 1021 1019 );
Note: See TracChangeset
for help on using the changeset viewer.