IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 626 | 626 | $primary_blog_id = (int) $active_blog->blog_id; |
| 627 | 627 | } |
| 628 | 628 | |
| | 629 | $site_state = get_site_state(); |
| | 630 | |
| 629 | 631 | foreach ( $blogs as $blog ) { |
| 630 | 632 | // Don't include blogs that aren't hosted at this site. |
| 631 | 633 | if ( $blog->site_id != get_current_network_id() ) |
| … |
… |
|
| 646 | 648 | 'blogName' => get_option( 'blogname' ), |
| 647 | 649 | 'xmlrpc' => site_url( 'xmlrpc.php', 'rpc' ), |
| 648 | 650 | ); |
| 649 | | |
| 650 | | restore_current_blog(); |
| 651 | 651 | } |
| | 652 | |
| | 653 | restore_site_state( $site_state ); |
| 652 | 654 | |
| 653 | 655 | return $struct; |
| 654 | 656 | } |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| | 1 | <?php |
| | 2 | /** |
| | 3 | * Site API: WP_Site_State class |
| | 4 | * |
| | 5 | * @package WordPress |
| | 6 | * @subpackage Multisite |
| | 7 | * @since 4.8.0 |
| | 8 | */ |
| | 9 | |
| | 10 | /** |
| | 11 | * Core class used for storing and restoring site states. |
| | 12 | * |
| | 13 | * @since 4.8.0 |
| | 14 | */ |
| | 15 | class WP_Site_State { |
| | 16 | |
| | 17 | /** |
| | 18 | * @var int |
| | 19 | */ |
| | 20 | private $site_id; |
| | 21 | |
| | 22 | /** |
| | 23 | * @var array |
| | 24 | */ |
| | 25 | private $stack; |
| | 26 | |
| | 27 | /** |
| | 28 | * Constructor. Sets up the properties. |
| | 29 | * |
| | 30 | * @since 4.8.0 |
| | 31 | * |
| | 32 | * @global array $_wp_switched_stack |
| | 33 | */ |
| | 34 | public function __construct() { |
| | 35 | $this->site_id = get_current_blog_id(); |
| | 36 | $this->stack = $GLOBALS['_wp_switched_stack']; |
| | 37 | } |
| | 38 | |
| | 39 | /** |
| | 40 | * Restores the stored site state. |
| | 41 | * |
| | 42 | * @since 4.8.0 |
| | 43 | * |
| | 44 | * @global array $_wp_switched_stack |
| | 45 | * @global bool $switched |
| | 46 | * |
| | 47 | * @return int The current site ID. |
| | 48 | */ |
| | 49 | public function restore() { |
| | 50 | switch_to_blog( $this->site_id ); |
| | 51 | $GLOBALS['_wp_switched_stack'] = $this->stack; |
| | 52 | $GLOBALS['switched'] = ! empty( $this->stack ); |
| | 53 | |
| | 54 | return get_current_blog_id(); |
| | 55 | } |
| | 56 | } |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 218 | 218 | $blogs = get_blogs_of_user( $id ); |
| 219 | 219 | |
| 220 | 220 | if ( ! empty( $blogs ) ) { |
| | 221 | $site_state = get_site_state(); |
| | 222 | |
| 221 | 223 | foreach ( $blogs as $blog ) { |
| 222 | 224 | switch_to_blog( $blog->userblog_id ); |
| 223 | 225 | remove_user_from_blog( $id, $blog->userblog_id ); |
| … |
… |
|
| 234 | 236 | foreach ( $link_ids as $link_id ) |
| 235 | 237 | wp_delete_link( $link_id ); |
| 236 | 238 | } |
| 237 | | |
| 238 | | restore_current_blog(); |
| 239 | 239 | } |
| | 240 | |
| | 241 | restore_site_state( $site_state ); |
| 240 | 242 | } |
| 241 | 243 | |
| 242 | 244 | $meta = $wpdb->get_col( $wpdb->prepare( "SELECT umeta_id FROM $wpdb->usermeta WHERE user_id = %d", $id ) ); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 556 | 556 | |
| 557 | 557 | return $network; |
| 558 | 558 | } |
| | 559 | |
| | 560 | /** |
| | 561 | * Returns a new object holding the current site state. |
| | 562 | * |
| | 563 | * @since 4.8.0 |
| | 564 | * |
| | 565 | * @return WP_Site_State A new site state object. |
| | 566 | */ |
| | 567 | function get_site_state() { |
| | 568 | return new WP_Site_State(); |
| | 569 | } |
| | 570 | |
| | 571 | /** |
| | 572 | * Restores the given site state. |
| | 573 | * |
| | 574 | * @since 4.8.0 |
| | 575 | * |
| | 576 | * @param WP_Site_State $site_state The object holding the site state to be restored. |
| | 577 | * |
| | 578 | * @return int The current site ID. |
| | 579 | */ |
| | 580 | function restore_site_state( WP_Site_State $site_state ) { |
| | 581 | return $site_state->restore(); |
| | 582 | } |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 490 | 490 | ), |
| 491 | 491 | ) ); |
| 492 | 492 | |
| | 493 | $site_state = get_site_state(); |
| | 494 | |
| 493 | 495 | foreach ( (array) $wp_admin_bar->user->blogs as $blog ) { |
| 494 | 496 | switch_to_blog( $blog->userblog_id ); |
| 495 | 497 | |
| … |
… |
|
| 541 | 543 | 'title' => __( 'Visit Site' ), |
| 542 | 544 | 'href' => home_url( '/' ), |
| 543 | 545 | ) ); |
| 544 | | |
| 545 | | restore_current_blog(); |
| 546 | 546 | } |
| | 547 | |
| | 548 | restore_site_state( $site_state ); |
| 547 | 549 | } |
| 548 | 550 | |
| 549 | 551 | /** |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 28 | 28 | /** WP_Site class */ |
| 29 | 29 | require_once( ABSPATH . WPINC . '/class-wp-site.php' ); |
| 30 | 30 | |
| | 31 | /** WP_Site_State class */ |
| | 32 | require_once( ABSPATH . WPINC . '/class-wp-site-state.php' ); |
| | 33 | |
| 31 | 34 | /** Multisite loader */ |
| 32 | 35 | require_once( ABSPATH . WPINC . '/ms-load.php' ); |
| 33 | 36 | |