| @@ -1,16 +1,17 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 1.0.7 Free | |
| 4 | + * @version 2.0.12 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2021 FirePlugins All Rights Reserved | |
| 8 | + * @copyright Copyright © 2023 FirePlugins All Rights Reserved | |
| 9 | 9 | * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -namespace FireBox\Core { | |
| 12 | +namespace FireBox\Core | |
| 13 | +{ | |
| 13 | 14 | if (!defined('ABSPATH')) |
| 14 | 15 | { |
| 15 | 16 | exit; // Exit if accessed directly. |
| 16 | 17 | } |
| @@ -16,9 +17,8 @@ | ||
| 16 | 17 | } |
| 17 | 18 | |
| 18 | 19 | use FPFramework\Framework; |
| 19 | 20 | use FPFramework\Admin\Includes\MetaboxManager; |
| 20 | - use FPFramework\Libs\FPGeoIP; | |
| 21 | 21 | use FPFramework\Base\Renderer; |
| 22 | 22 | |
| 23 | 23 | use FireBox\Core\Admin\Admin; |
| 24 | 24 | use FireBox\Core\Admin\Includes\Library; |
| @@ -25,10 +25,10 @@ | ||
| 25 | 25 | use FireBox\Core\Admin\Includes\Metaboxes as PluginMetaboxes; |
| 26 | 26 | use FireBox\Core\Admin\Includes\Cpts\Cpts; |
| 27 | 27 | |
| 28 | 28 | use FireBox\Core\Admin\Analytics\Overview\Overview as AnalyticsOverview; |
| 29 | + use FireBox\Core\Admin\Analytics\Overview\Ajax as AnalyticsOverviewAjax; | |
| 29 | 30 | use FireBox\Core\Admin\Menu\PluginMenu; |
| 30 | - use FireBox\Core\Admin\Maintenance; | |
| 31 | 31 | use FireBox\Core\FB\Box; |
| 32 | 32 | use FireBox\Core\FB\Boxes; |
| 33 | 33 | use FireBox\Core\FB\Log; |
| 34 | 34 | use FireBox\Core\FB\Track; |
| @@ -91,15 +91,8 @@ | ||
| 91 | 91 | */ |
| 92 | 92 | public $metaboxes_manager; |
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | - * Maintenance | |
| 96 | - * | |
| 97 | - * @var Maintenance | |
| 98 | - */ | |
| 99 | - public $maintenance; | |
| 100 | - | |
| 101 | - /** | |
| 102 | 95 | * Box |
| 103 | 96 | * |
| 104 | 97 | * @var Box |
| 105 | 98 | */ |
| @@ -119,22 +112,8 @@ | ||
| 119 | 112 | */ |
| 120 | 113 | public $menu; |
| 121 | 114 | |
| 122 | 115 | /** |
| 123 | - * The geolocation class | |
| 124 | - * | |
| 125 | - * @var GeoIP | |
| 126 | - */ | |
| 127 | - public $fpgeoip; | |
| 128 | - | |
| 129 | - /** | |
| 130 | - * The REST API. | |
| 131 | - * | |
| 132 | - * @var RESTAPI | |
| 133 | - */ | |
| 134 | - public $api; | |
| 135 | - | |
| 136 | - /** | |
| 137 | 116 | * Helper Classes |
| 138 | 117 | * |
| 139 | 118 | * @var HelperMiddleware |
| 140 | 119 | */ |
| @@ -174,8 +153,15 @@ | ||
| 174 | 153 | * @var Log |
| 175 | 154 | */ |
| 176 | 155 | public $log; |
| 177 | 156 | |
| 157 | + /** | |
| 158 | + * Analytics configuration. | |
| 159 | + * | |
| 160 | + * @var array | |
| 161 | + */ | |
| 162 | + public $analytics_configuration; | |
| 163 | + | |
| 178 | 164 | |
| 179 | 165 | |
| 180 | 166 | /** |
| 181 | 167 | * Translations |
| @@ -188,10 +174,10 @@ | ||
| 188 | 174 | * Tables used by Hook |
| 189 | 175 | * |
| 190 | 176 | * @var array |
| 191 | 177 | */ |
| 192 | - private $hook_data = [ | |
| 193 | - 'tables' => [ 'firebox_logs' ], | |
| 178 | + public $hook_data = [ | |
| 179 | + 'tables' => [ 'firebox_logs', 'firebox_logs_details', 'firebox_submissions', 'firebox_submission_meta' ], | |
| 194 | 180 | 'activation' => FBOX_PLUGIN_DIR . 'Inc/Core/Admin/sql/firebox.sql', |
| 195 | 181 | 'uninstall' => FBOX_PLUGIN_DIR . 'Inc/Core/Admin/sql/uninstall.firebox.sql' |
| 196 | 182 | ]; |
| 197 | 183 | |
| @@ -254,8 +240,11 @@ | ||
| 254 | 240 | |
| 255 | 241 | // Admin |
| 256 | 242 | $this->admin = new Admin(); |
| 257 | 243 | |
| 244 | + // Library | |
| 245 | + $this->library = new Library(); | |
| 246 | + | |
| 258 | 247 | // Metaboxes |
| 259 | 248 | $this->metaboxes_manager = new MetaboxManager(); |
| 260 | 249 | $this->plugin_metaboxes = new PluginMetaboxes(); |
| 261 | 250 | $this->metaboxes_manager->init(); |
| @@ -276,20 +265,10 @@ | ||
| 276 | 265 | |
| 277 | 266 | // show rate reminder after user has activated the plugin |
| 278 | 267 | add_action('activated_plugin', [$this, 'set_rate_reminder']); |
| 279 | 268 | |
| 280 | - // adds plugin translation class to the framework set of translate classes | |
| 281 | - add_filter('fpframework/set_translation_paths', [$this, 'setTranslationsPaths']); | |
| 282 | - | |
| 283 | 269 | // Widgets |
| 284 | 270 | $this->widgets = new Widgets(); |
| 285 | - | |
| 286 | - if (is_admin()) | |
| 287 | - { | |
| 288 | - // Run Activation/Deactivation procedures | |
| 289 | - $this->maintenance = new Maintenance($this->hook_data); | |
| 290 | - $this->maintenance->init(); | |
| 291 | - } | |
| 292 | 271 | } |
| 293 | 272 | |
| 294 | 273 | /** |
| 295 | 274 | * Set rate reminder transient on plugin activation. |
| @@ -342,11 +321,8 @@ | ||
| 342 | 321 | private function initCommons() |
| 343 | 322 | { |
| 344 | 323 | new AdminBarMenu(); |
| 345 | 324 | |
| 346 | - // Library | |
| 347 | - $this->library = new Library(); | |
| 348 | - | |
| 349 | 325 | // Tables |
| 350 | 326 | $this->tables = new Tables(); |
| 351 | 327 | |
| 352 | 328 | // Shortcodes |
| @@ -355,9 +331,10 @@ | ||
| 355 | 331 | // Log |
| 356 | 332 | $this->log = new Log(); |
| 357 | 333 | |
| 358 | 334 | // REST API |
| 359 | - $this->api = new RESTAPI(); | |
| 335 | + new RESTAPI(); | |
| 336 | + | |
| 360 | 337 | |
| 361 | 338 | // Custom Post Types |
| 362 | 339 | $this->cpts = new Cpts(); |
| 363 | 340 | $this->cpts->init(); |
| @@ -370,11 +347,8 @@ | ||
| 370 | 347 | |
| 371 | 348 | // Boxes |
| 372 | 349 | $this->boxes = new Boxes(); |
| 373 | 350 | |
| 374 | - // FPGeo IP | |
| 375 | - $this->fpgeoip = new FPGeoIP(); | |
| 376 | - | |
| 377 | 351 | // Helper |
| 378 | 352 | $this->helper = new HelperMiddleware(); |
| 379 | 353 | |
| 380 | 354 | // Gutenberg Blocks |
| @@ -379,24 +353,30 @@ | ||
| 379 | 353 | |
| 380 | 354 | // Gutenberg Blocks |
| 381 | 355 | $this->blocks = new Blocks(); |
| 382 | 356 | |
| 357 | + new \FireBox\Core\Form\Ajax(); | |
| 358 | + | |
| 383 | 359 | // Track |
| 384 | 360 | $this->track = new Track(); |
| 385 | 361 | |
| 386 | 362 | // Initialize Analytics |
| 387 | 363 | global $wpdb; |
| 388 | - $analytics_configuration = [ | |
| 364 | + $this->analytics_configuration = [ | |
| 389 | 365 | 'boxes_table' => $wpdb->prefix . 'posts', |
| 390 | 366 | 'logs_table' => firebox()->tables->boxlog->getFullTableName(), |
| 391 | 367 | 'logs_details_table' => firebox()->tables->boxlogdetails->getFullTableName(), |
| 368 | + 'submissions_table' => firebox()->tables->submission->getFullTableName(), | |
| 369 | + 'submissions_meta_table' => firebox()->tables->submissionmeta->getFullTableName(), | |
| 370 | + 'nonce_name' => 'fb-analytics-nonce', | |
| 392 | 371 | 'nonce_value' => wp_create_nonce('fb-analytics-nonce'), |
| 393 | 372 | ]; |
| 373 | + | |
| 394 | 374 | |
| 395 | 375 | |
| 396 | - | |
| 397 | 376 | // Initialize Analytics Overview |
| 398 | - $this->analytics_overview = new AnalyticsOverview($analytics_configuration); | |
| 377 | + $this->analytics_overview = new AnalyticsOverview(); | |
| 378 | + $this->analytics_overview_ajax = new AnalyticsOverviewAjax(); | |
| 399 | 379 | } |
| 400 | 380 | |
| 401 | 381 | /** |
| 402 | 382 | * Initializes FireBox Plugin with the required components |