PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backups, Restore, Migration & Clone / 4.11.1
WP STAGING – WordPress Backups, Restore, Migration & Clone v4.11.1
4.11.2 4.11.1 4.11.0 4.10.0 4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.1 trunk 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.10.0 3.2.0 3.3.1 3.3.2 3.3.3 3.4.1 3.4.3 3.5.0 3.6.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.8.0
wp-staging / Framework / Utils / PluginInfo.php
wp-staging / Framework / Utils Last commit date
Cache 1 week ago DBPermissions.php 1 week ago DataEncoder.php 1 week ago DatabaseOptions.php 1 week ago Env.php 1 week ago Escape.php 1 week ago Glob.php 1 week ago Hooks.php 1 week ago Math.php 1 week ago PluginInfo.php 1 week ago Sanitize.php 1 week ago ServerVars.php 1 week ago SlashMode.php 1 week ago Strings.php 1 week ago Times.php 1 week ago Urls.php 1 week ago Version.php 1 week ago WpDefaultDirectories.php 1 week ago
PluginInfo.php
117 lines
1 <?php
2
3 namespace WPStaging\Framework\Utils;
4
5 class PluginInfo
6 {
7
8 const FILTER_STYLESHEET_DIRECTORY = 'stylesheet_directory';
9
10
11 const FILTER_TEMPLATE_DIRECTORY = 'template_directory';
12
13
14
15
16
17
18
19
20
21 public function canShowAdminMenu(): bool
22 {
23 if (!defined('WPSTGPRO_VERSION')) {
24 return true;
25 }
26
27 if (defined('WPSTG_REQUIRE_FREE') && !WPSTG_REQUIRE_FREE) {
28 return true;
29 }
30
31 if (wpstgIsFreeActiveInNetworkOrCurrentSite()) {
32 return true;
33 }
34
35 if (wpstgIsFreeVersionCompatible()) {
36 return true;
37 }
38
39 return false;
40 }
41
42
43
44
45 public function getAllActivePluginsInSubsites(): array
46 {
47 if (!is_multisite()) {
48 return [];
49 }
50
51 $activePlugins = [];
52 $sites = get_sites();
53
54 foreach ($sites as $site) {
55 switch_to_blog($site->blog_id);
56
57 $activeForCurrent = (array) get_option('active_plugins', []);
58 $activeWithPath = array_map(
59 function ($plugin) {
60 return trailingslashit(WP_PLUGIN_DIR) . $plugin;
61 },
62 $activeForCurrent
63 );
64
65 $activePlugins = array_merge($activePlugins, $activeWithPath);
66
67 restore_current_blog();
68 }
69
70 return array_unique($activePlugins);
71 }
72
73
74
75
76 public function getAllActiveThemesInSubsites(): array
77 {
78 if (!is_multisite()) {
79 return [];
80 }
81
82 $activeThemes = [];
83 $sites = get_sites();
84
85 remove_all_filters(self::FILTER_STYLESHEET_DIRECTORY);
86 remove_all_filters(self::FILTER_TEMPLATE_DIRECTORY);
87
88 foreach ($sites as $site) {
89 switch_to_blog($site->blog_id);
90
91 $activeThemes[] = get_stylesheet_directory();
92 $activeThemes[] = get_template_directory();
93
94 restore_current_blog();
95 }
96
97 return array_unique($activeThemes);
98 }
99
100
101
102
103
104 public function getActiveThemes(): array
105 {
106 $activeThemes = [];
107
108 remove_all_filters(self::FILTER_STYLESHEET_DIRECTORY);
109 remove_all_filters(self::FILTER_TEMPLATE_DIRECTORY);
110
111 $activeThemes[] = get_stylesheet_directory();
112 $activeThemes[] = get_template_directory();
113
114 return array_unique($activeThemes);
115 }
116 }
117