PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 1.0.4
Adminify – White Label, Admin Menu Editor, Login Customizer v1.0.4
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 1.0.4, at Inc/classes/Multisite_Helper.php

87 lines 1.9 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')) exit;
7
8 /**
9 * @package WPAdminify
10 * Multisite Helper
11 *
12 * @author Jewel Theme <support@jeweltheme.com>
13 */
14
15 class Multisite_Helper
16 {
17 public function is_network_active()
18 {
19 if (!function_exists('is_plugin_active_for_network') || !function_exists('is_plugin_active')) {
20 require_once ABSPATH . '/wp-admin/includes/plugin.php';
21 }
22
23 return (is_plugin_active_for_network('adminify/adminify.php') ? true : false);
24 }
25
26 /**
27 * Check Multisite Supports
28 *
29 * @return void
30 */
31 public function is_multisite_supported()
32 {
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 {
43
44 if (!$this->is_multisite_supported()) {
45 return false;
46 }
47
48 global $blueprint;
49
50 if (empty($blueprint) || get_current_blog_id() === $blueprint) {
51 return false;
52 }
53
54 return true;
55 }
56
57 /**
58 * Construct array of excluded sites
59 *
60 * @return array The array of excluded sites.
61 */
62 public function get_excluded_sites()
63 {
64
65 global $blueprint;
66
67 $array = array();
68
69 // Include blueprint site if it is defined.
70 if (!empty($blueprint)) {
71 $array[] = $blueprint;
72 }
73
74 if (get_site_option('wp_adminify_multisite_exclude')) {
75 $excluded_sites = get_site_option('wp_adminify_multisite_exclude');
76 $excluded_sites = str_replace(' ', '', $excluded_sites);
77 $excluded_sites = explode(',', $excluded_sites);
78 } else {
79 $excluded_sites = array();
80 }
81
82 $excluded_sites = array_merge($array, $excluded_sites);
83
84 return $excluded_sites;
85 }
86 }
87