PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.0
Adminify – White Label, Admin Menu Editor, Login Customizer v4.0
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
adminify / Inc / Classes / Multisite_Helper.php

Multisite_Helper.php in Adminify – White Label, Admin Menu Editor, Login Customizer 4.0, at Inc/Classes/Multisite_Helper.php

83 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPAdminify\Inc\Classes;
4
5 // no direct access allowed
6 if ( ! defined( 'ABSPATH' ) ) {
7 exit;
8 }
9
10 /**
11 * @package WPAdminify
12 * Multisite Helper
13 *
14 * @author Jewel Theme <support@jeweltheme.com>
15 */
16
17 class Multisite_Helper {
18
19 public function is_network_active() {
20 if ( ! function_exists( 'is_plugin_active_for_network' ) || ! function_exists( 'is_plugin_active' ) ) {
21 require_once ABSPATH . '/wp-admin/includes/plugin.php';
22 }
23
24 return ( is_plugin_active_for_network( 'adminify/adminify.php' ) ? true : false );
25 }
26
27 /**
28 * Check Multisite Supports
29 *
30 * @return void
31 */
32 public function is_multisite_supported() {
33 return ( $this->is_network_active() && apply_filters( 'wp_adminify_ms_support', false ) ? true : false );
34 }
35
36 /**
37 * Check if it needed to switch blog
38 *
39 * @return void
40 */
41 public function needs_to_switch_blog() {
42 if ( ! $this->is_multisite_supported() ) {
43 return false;
44 }
45
46 global $blueprint;
47
48 if ( empty( $blueprint ) || get_current_blog_id() === $blueprint ) {
49 return false;
50 }
51
52 return true;
53 }
54
55 /**
56 * Construct array of excluded sites
57 *
58 * @return array The array of excluded sites.
59 */
60 public function get_excluded_sites() {
61 global $blueprint;
62
63 $array = [];
64
65 // Include blueprint site if it is defined.
66 if ( ! empty( $blueprint ) ) {
67 $array[] = $blueprint;
68 }
69
70 if ( get_site_option( 'wp_adminify_multisite_exclude' ) ) {
71 $excluded_sites = get_site_option( 'wp_adminify_multisite_exclude' );
72 $excluded_sites = str_replace( ' ', '', $excluded_sites );
73 $excluded_sites = explode( ',', $excluded_sites );
74 } else {
75 $excluded_sites = [];
76 }
77
78 $excluded_sites = array_merge( $array, $excluded_sites );
79
80 return $excluded_sites;
81 }
82 }
83