| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 3.1.13 Free | |
| 4 | + * @version 2.1.37 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2026 FirePlugins All Rights Reserved | |
| 8 | + * @copyright Copyright © 2025 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\UsageTracking; |
| @@ -23,9 +23,9 @@ | ||
| 23 | 23 | private $pluginData = []; |
| 24 | 24 | |
| 25 | 25 | public function __construct() |
| 26 | 26 | { |
| 27 | - $this->settings = get_option('firebox_settings', []); | |
| 27 | + $this->settings = get_option('firebox_sttings', []); | |
| 28 | 28 | $this->pluginData = new PluginData(); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function getData() |
| @@ -32,9 +32,8 @@ | ||
| 32 | 32 | { |
| 33 | 33 | global $wpdb; |
| 34 | 34 | |
| 35 | 35 | $theme_data = wp_get_theme(); |
| 36 | - $database_version = $wpdb->db_version(); | |
| 37 | 36 | |
| 38 | 37 | $payload = [ |
| 39 | 38 | // Generic Data |
| 40 | 39 | 'url' => home_url(), |
| @@ -40,11 +39,10 @@ | ||
| 40 | 39 | 'url' => home_url(), |
| 41 | 40 | 'email' => get_option('admin_email'), |
| 42 | 41 | 'php_version' => PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION, |
| 43 | 42 | 'wp_version' => get_bloginfo('version'), |
| 44 | - 'database_type' => $this->getDatabaseType($database_version), | |
| 45 | - 'database_driver' => $this->getDatabaseDriver(), | |
| 46 | - 'database_version' => $database_version, | |
| 43 | + 'database_type' => $this->getDatabaseType(), | |
| 44 | + 'database_version' => $wpdb->db_version(), | |
| 47 | 45 | 'server_version' => isset($_SERVER['SERVER_SOFTWARE']) ? sanitize_text_field(wp_unslash($_SERVER['SERVER_SOFTWARE'])) : '', |
| 48 | 46 | 'is_debug' => defined('WP_DEBUG') && WP_DEBUG, |
| 49 | 47 | 'is_ssl' => is_ssl(), |
| 50 | 48 | 'is_multisite' => is_multisite(), |
| @@ -56,35 +54,25 @@ | ||
| 56 | 54 | 'active_plugins' => $this->get_active_plugins(), |
| 57 | 55 | 'theme_name' => $theme_data->get('Name'), |
| 58 | 56 | 'theme_version' => $theme_data->get('Version'), |
| 59 | 57 | 'locale' => get_locale(), |
| 60 | - 'timezone_offset' => wp_timezone_string(), | |
| 58 | + 'timezone_offset' => wp_timezone_string(), | |
| 61 | 59 | // FireBox Specific Data |
| 62 | 60 | 'firebox_version' => FBOX_VERSION, |
| 63 | - 'firebox_license_key' => \FireBox\Core\Helpers\License::getKey(), | |
| 61 | + 'firebox_license_key' => get_option('firebox_license_key', ''), | |
| 64 | 62 | 'firebox_license_type' => FBOX_LICENSE_TYPE, |
| 65 | - 'firebox_license_plan' => FBOX_LICENSE_PLAN, | |
| 66 | - 'firebox_license_status' => \FireBox\Core\Helpers\License::getStatus(), | |
| 63 | + 'firebox_license_status' => get_option('firebox_license_status', ''), | |
| 67 | 64 | 'firebox_is_pro' => FBOX_LICENSE_TYPE === 'pro', |
| 68 | - 'firebox_connected_integrations' => $this->getConnectedIntegrations(), | |
| 69 | 65 | 'firebox_views' => $this->pluginData->getViews(), |
| 70 | 66 | 'firebox_dimensions' => $this->pluginData->getDimensionsData(), |
| 71 | 67 | 'firebox_campaigns_published' => $this->pluginData->getCampaigns('publish'), |
| 72 | 68 | 'firebox_campaigns_draft' => $this->pluginData->getCampaigns('draft'), |
| 73 | 69 | 'firebox_campaigns_trash' => $this->pluginData->getCampaigns('trash'), |
| 74 | - 'firebox_ttf_draft_sec' => $this->pluginData->getTimeToFirstCampaignDraft(), | |
| 75 | - 'firebox_ttf_publish_sec' => $this->pluginData->getTimeToFirstCampaignPublish(), | |
| 76 | 70 | 'firebox_submissions' => $this->pluginData->getSubmissions(), |
| 77 | - 'firebox_view_through_revenue' => $this->pluginData->getViewThroughRevenue(), | |
| 78 | - 'firebox_click_through_revenue' => $this->pluginData->getClickThroughRevenue(), | |
| 79 | 71 | 'firebox_classic_campaigns' => $this->pluginData->getTotalsBySetting('mode', 'popup'), |
| 80 | - 'firebox_mode_slide_in' => $this->pluginData->getTotalsBySetting('mode', 'slide-in'), | |
| 81 | - 'firebox_mode_fullscreen' => $this->pluginData->getTotalsBySetting('mode', 'fullscreen'), | |
| 82 | - 'firebox_mode_stickybar' => $this->pluginData->getTotalsBySetting('mode', 'stickybar'), | |
| 83 | 72 | 'firebox_pageslide_campaigns' => $this->pluginData->getTotalsBySetting('mode', 'pageslide'), |
| 84 | - 'firebox_mode_floating' => $this->pluginData->getTotalsBySetting('mode', 'floating'), | |
| 85 | - 'firebox_mode_sidebar' => $this->pluginData->getTotalsBySetting('mode', 'sidebar'), | |
| 86 | 73 | 'firebox_embed_campaigns' => $this->pluginData->getTotalsBySetting('mode', 'embed'), |
| 74 | + 'firebox_campaigns_pageready' => $this->pluginData->getTotalsBySetting('triggermethod', 'pageready'), | |
| 87 | 75 | 'firebox_campaigns_pageload' => $this->pluginData->getTotalsBySetting('triggermethod', 'pageload'), |
| 88 | 76 | 'firebox_campaigns_scroll_depth' => $this->pluginData->getTotalsBySetting('triggermethod', 'pageheight'), |
| 89 | 77 | 'firebox_campaigns_element_visibility' => $this->pluginData->getTotalsBySetting('triggermethod', 'element'), |
| 90 | 78 | 'firebox_campaigns_exit_intent' => $this->pluginData->getTotalsBySetting('triggermethod', 'userleave'), |
| @@ -103,11 +91,11 @@ | ||
| 103 | 91 | 'firebox_cookie_never' => $this->pluginData->getTotalsBySetting('assign_cookietype', 'never'), |
| 104 | 92 | 'firebox_cookie_ever' => $this->pluginData->getTotalsBySetting('assign_cookietype', 'ever'), |
| 105 | 93 | 'firebox_cookie_session' => $this->pluginData->getTotalsBySetting('assign_cookietype', 'session'), |
| 106 | 94 | 'firebox_cookie_custom' => $this->pluginData->getTotalsBySetting('assign_cookietype', 'custom'), |
| 107 | - 'firebox_auto_close' => $this->pluginData->getTotalsBySetting('box_auto_close', 'boolean'), | |
| 108 | - 'firebox_auto_focus' => $this->pluginData->getTotalsBySetting('autofocus', 'boolean'), | |
| 109 | - 'firebox_close_with_esc' => $this->pluginData->getTotalsBySetting('close_on_esc', 'boolean'), | |
| 95 | + 'firebox_auto_close' => $this->pluginData->getTotalsBySetting('box_auto_close', 'yes'), | |
| 96 | + 'firebox_auto_focus' => $this->pluginData->getTotalsBySetting('autofocus', '1'), | |
| 97 | + 'firebox_close_with_esc' => $this->pluginData->getTotalsBySetting('close_on_esc', '1'), | |
| 110 | 98 | 'firebox_display_conditions_all' => $this->pluginData->getTotalsBySetting('display_conditions_type', 'all'), |
| 111 | 99 | 'firebox_display_conditions_mirror' => $this->pluginData->getTotalsBySetting('display_conditions_type', 'mirror'), |
| 112 | 100 | 'firebox_display_conditions_custom' => $this->pluginData->getTotalsBySetting('display_conditions_type', 'custom'), |
| 113 | 101 | 'firebox_campaigns_with_sound' => $this->pluginData->getTotalsBySetting('opening_sound.source', 'cond:not:none'), |
| @@ -169,10 +157,10 @@ | ||
| 169 | 157 | 'firebox_php_scripts_on_close' => $this->pluginData->getTotalsBySetting('phpscripts.close', 'cond:not:empty'), |
| 170 | 158 | 'firebox_php_scripts_on_form_success' => $this->pluginData->getTotalsBySetting('phpscripts.formsuccess', 'cond:not:empty'), |
| 171 | 159 | 'firebox_custom_css' => $this->pluginData->getTotalsBySetting('customcss', 'cond:not:empty'), |
| 172 | 160 | 'firebox_custom_javascript' => $this->pluginData->getTotalsBySetting('customcode', 'cond:not:empty'), |
| 173 | - 'firebox_test_mode' => $this->pluginData->getTotalsBySetting('testmode', 'boolean'), | |
| 174 | - 'firebox_prevent_page_scrollling' => $this->pluginData->getTotalsBySetting('preventpagescroll', 'boolean'), | |
| 161 | + 'firebox_test_mode' => $this->pluginData->getTotalsBySetting('testmode', '1'), | |
| 162 | + 'firebox_prevent_page_scrollling' => $this->pluginData->getTotalsBySetting('preventpagescroll', '1'), | |
| 175 | 163 | 'firebox_settings' => $this->getSettings() |
| 176 | 164 | ]; |
| 177 | 165 | |
| 178 | 166 | return $payload; |
| @@ -177,38 +165,10 @@ | ||
| 177 | 165 | |
| 178 | 166 | return $payload; |
| 179 | 167 | } |
| 180 | 168 | |
| 181 | - private function getDatabaseType($database_version = '') | |
| 169 | + private function getDatabaseType() | |
| 182 | 170 | { |
| 183 | - $database_version = strtolower(trim((string) $database_version)); | |
| 184 | - $database_driver = strtolower((string) $this->getDatabaseDriver()); | |
| 185 | - | |
| 186 | - if (strpos($database_version, 'mariadb') !== false || strpos($database_driver, 'mariadb') !== false) | |
| 187 | - { | |
| 188 | - return 'MariaDB'; | |
| 189 | - } | |
| 190 | - | |
| 191 | - if ( | |
| 192 | - strpos($database_driver, 'mysql') !== false || | |
| 193 | - strpos($database_driver, 'mysqli') !== false || | |
| 194 | - strpos($database_driver, 'pdo_mysql') !== false || | |
| 195 | - strpos($database_driver, 'pdo\\mysql') !== false | |
| 196 | - ) | |
| 197 | - { | |
| 198 | - return 'MySQL'; | |
| 199 | - } | |
| 200 | - | |
| 201 | - if ($database_version !== '') | |
| 202 | - { | |
| 203 | - return 'MySQL'; | |
| 204 | - } | |
| 205 | - | |
| 206 | - return 'Unknown'; | |
| 207 | - } | |
| 208 | - | |
| 209 | - private function getDatabaseDriver() | |
| 210 | - { | |
| 211 | 171 | global $wpdb; |
| 212 | 172 | |
| 213 | 173 | if (is_object($wpdb->dbh)) |
| 214 | 174 | { |
| @@ -223,74 +183,42 @@ | ||
| 223 | 183 | |
| 224 | 184 | return $extension; |
| 225 | 185 | } |
| 226 | 186 | |
| 227 | - private function getSettings() | |
| 228 | - { | |
| 229 | - $excluded_keys = [ | |
| 230 | - 'api_key', | |
| 231 | - 'geo_license_key', | |
| 232 | - 'license_key', | |
| 233 | - 'cloudflare_turnstile_site_key', | |
| 234 | - 'cloudflare_turnstile_secret_key', | |
| 235 | - 'recaptcha_v2_checkbox_site_key', | |
| 236 | - 'recaptcha_v2_checkbox_secret_key', | |
| 237 | - 'recaptcha_v2_invisible_site_key', | |
| 238 | - 'recaptcha_v2_invisible_secret_key', | |
| 239 | - 'recaptcha_v3_site_key', | |
| 240 | - 'recaptcha_v3_secret_key', | |
| 241 | - 'hcaptcha_site_key', | |
| 242 | - 'hcaptcha_secret_key', | |
| 243 | - 'openai_api_key', | |
| 244 | - 'stripe_test_secret_key', | |
| 245 | - 'stripe_test_publishable_key', | |
| 246 | - 'stripe_live_secret_key', | |
| 247 | - 'stripe_live_publishable_key', | |
| 248 | - 'stripe_webhooks_secret_test', | |
| 249 | - 'stripe_webhooks_secret_live', | |
| 250 | - 'stripe_webhooks_id_test', | |
| 251 | - 'stripe_webhooks_id_live', | |
| 252 | - ]; | |
| 253 | - | |
| 254 | - $excluded_keys = array_merge( | |
| 255 | - $excluded_keys, | |
| 256 | - \FireBox\Core\Helpers\Integrations::getSettingsKeys() | |
| 257 | - ); | |
| 258 | - | |
| 187 | + private function getSettings() | |
| 188 | + { | |
| 259 | 189 | return array_diff_key( |
| 260 | - $this->settings, | |
| 261 | - array_flip($excluded_keys) | |
| 190 | + get_option('firebox_settings', []), | |
| 191 | + array_flip( | |
| 192 | + [ | |
| 193 | + 'api_key', | |
| 194 | + 'geo_license_key', | |
| 195 | + 'license_key', | |
| 196 | + 'cloudflare_turnstile_site_key', | |
| 197 | + 'cloudflare_turnstile_secret_key', | |
| 198 | + 'recaptcha_v2_checkbox_site_key', | |
| 199 | + 'recaptcha_v2_checkbox_secret_key', | |
| 200 | + 'recaptcha_v2_invisible_site_key', | |
| 201 | + 'recaptcha_v2_invisible_secret_key', | |
| 202 | + 'recaptcha_v3_site_key', | |
| 203 | + 'recaptcha_v3_secret_key', | |
| 204 | + 'hcaptcha_site_key', | |
| 205 | + 'hcaptcha_secret_key', | |
| 206 | + 'openai_api_key', | |
| 207 | + 'stripe_test_secret_key', | |
| 208 | + 'stripe_test_publishable_key', | |
| 209 | + 'stripe_live_secret_key', | |
| 210 | + 'stripe_live_publishable_key', | |
| 211 | + 'stripe_webhooks_secret_test', | |
| 212 | + 'stripe_webhooks_secret_live', | |
| 213 | + 'stripe_webhooks_id_test', | |
| 214 | + 'stripe_webhooks_id_live', | |
| 215 | + ] | |
| 216 | + ) | |
| 262 | 217 | ); |
| 263 | 218 | } |
| 264 | 219 | |
| 265 | 220 | /** |
| 266 | - * Returns currently connected integrations. | |
| 267 | - * | |
| 268 | - * @return array | |
| 269 | - */ | |
| 270 | - private function getConnectedIntegrations() | |
| 271 | - { | |
| 272 | - $connected_integrations = []; | |
| 273 | - $integrations = \FireBox\Core\Helpers\Integrations::getSettingsManagedIntegrations(); | |
| 274 | - if (!is_array($integrations)) | |
| 275 | - { | |
| 276 | - return $connected_integrations; | |
| 277 | - } | |
| 278 | - | |
| 279 | - foreach ($integrations as $integration) | |
| 280 | - { | |
| 281 | - if (!is_array($integration) || empty($integration['slug']) || empty($integration['connected'])) | |
| 282 | - { | |
| 283 | - continue; | |
| 284 | - } | |
| 285 | - | |
| 286 | - $connected_integrations[] = (string) $integration['slug']; | |
| 287 | - } | |
| 288 | - | |
| 289 | - return $connected_integrations; | |
| 290 | - } | |
| 291 | - | |
| 292 | - /** | |
| 293 | 221 | * Determines whether the plugin is active for the entire network. |
| 294 | 222 | * |
| 295 | 223 | * @return bool |
| 296 | 224 | */ |
| @@ -363,5 +291,5 @@ | ||
| 363 | 291 | public function get_user_agent() |
| 364 | 292 | { |
| 365 | 293 | return 'FireBox/' . FBOX_VERSION . '; ' . get_bloginfo('url'); |
| 366 | 294 | } |
| 367 | -} | |
| 295 | +} | |