PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 3.1.14
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v3.1.14
3.1.14 3.1.13 3.1.12 3.1.11 3.1.10 3.1.9 3.1.8 3.1.7 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 All 123 releases
← All changes | Inc/Core/Admin/Maintenance.php +106 -11 1.0.9 → 3.1.14 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 1.0.9 Free
4 + * @version 3.1.14 Free
5 5 *
6 6 * @author FirePlugins <[email protected]>
7 7 * @link https://www.fireplugins.com
8 - * @copyright Copyright © 2021 FirePlugins All Rights Reserved
8 + * @copyright Copyright © 2026 FirePlugins All Rights Reserved
9 9 * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
10 10 */
11 11
12 12 namespace FireBox\Core\Admin;
@@ -15,11 +15,8 @@
15 15 {
16 16 exit; // Exit if accessed directly.
17 17 }
18 18
19 -use FireBox\Core\Admin\PluginActivation;
20 -use FireBox\Core\Admin\PluginUninstall;
21 -
22 19 class Maintenance
23 20 {
24 21 /**
25 22 * Hook data
@@ -39,21 +36,119 @@
39 36 * @return void
40 37 */
41 38 public function init()
42 39 {
43 - register_activation_hook( FBOX_PLUGIN_BASE_FILE, [ __CLASS__, 'activation' ] );
44 - register_uninstall_hook( FBOX_PLUGIN_BASE_FILE, [ __CLASS__, 'uninstall' ] );
40 + register_activation_hook(FBOX_PLUGIN_BASE_FILE, [__CLASS__, 'activation']);
41 + register_uninstall_hook(FBOX_PLUGIN_BASE_FILE, [__CLASS__, 'uninstall']);
42 +
43 + if (!is_multisite())
44 + {
45 + return;
46 + }
47 +
48 + // A site added to the network needs the same install every other site got.
49 + add_action('wp_initialize_site', [__CLASS__, 'onSiteInitialized'], 100, 1);
50 +
51 + // A site removed from the network takes its FireBox tables with it.
52 + add_filter('wpmu_drop_tables', [__CLASS__, 'dropTables'], 10, 2);
53 +
54 + // Drains the remaining sites of a large network activation.
55 + add_action('firebox_network_install', [__CLASS__, 'continueNetworkInstall']);
45 56 }
46 57
47 58 /**
48 59 * Runs on plugin activation
49 - *
60 + *
61 + * @param bool $network_wide Whether the plugin was network activated.
62 + *
50 63 * @return void
51 64 */
52 - public static function activation()
65 + public static function activation($network_wide = false)
53 66 {
54 - $pluginActivation = new PluginActivation(self::$hook_data);
55 - $pluginActivation->start();
67 + if (is_multisite() && $network_wide)
68 + {
69 + SiteInstaller::installNetwork();
70 + }
71 + else
72 + {
73 + SiteInstaller::installOnActivation();
74 + }
75 +
76 + // Redirect to the dashboard on first activation. Read by
77 + // Admin::redirectAfterActivation(), which skips the network admin.
78 + update_option('firebox_activation_redirect', true);
79 + }
80 +
81 + /**
82 + * Installs FireBox on a site that was just added to the network.
83 + *
84 + * @param \WP_Site $site
85 + *
86 + * @return void
87 + */
88 + public static function onSiteInitialized($site)
89 + {
90 + if (!is_multisite() || !$site instanceof \WP_Site)
91 + {
92 + return;
93 + }
94 +
95 + if (!self::isNetworkActive())
96 + {
97 + return;
98 + }
99 +
100 + switch_to_blog($site->blog_id);
101 + SiteInstaller::install();
102 + restore_current_blog();
103 + }
104 +
105 + /**
106 + * Adds the FireBox tables to the ones WordPress drops with a deleted site.
107 + *
108 + * WordPress calls this filter while switched to the site being deleted, so
109 + * $wpdb->prefix is that site's prefix.
110 + *
111 + * @param array $tables
112 + * @param int $blog_id
113 + *
114 + * @return array
115 + */
116 + public static function dropTables($tables, $blog_id)
117 + {
118 + global $wpdb;
119 +
120 + foreach (self::$hook_data['tables'] as $table)
121 + {
122 + $tables[] = $wpdb->prefix . $table;
123 + }
124 +
125 + return $tables;
126 + }
127 +
128 + /**
129 + * Installs the next batch of sites of a network activation.
130 + *
131 + * @return void
132 + */
133 + public static function continueNetworkInstall()
134 + {
135 + SiteInstaller::installNetwork();
136 + }
137 +
138 + /**
139 + * Whether FireBox is activated for the whole network.
140 + *
141 + * @return bool
142 + */
143 + private static function isNetworkActive()
144 + {
145 + if (!function_exists('is_plugin_active_for_network'))
146 + {
147 + require_once ABSPATH . 'wp-admin/includes/plugin.php';
148 + }
149 +
150 + return is_plugin_active_for_network(FBOX_PLUGIN_BASENAME);
56 151 }
57 152
58 153 /**
59 154 * Runs on plugin deactivation