| @@ -1,16 +1,17 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 1.0.2 Free | |
| 4 | + * @version 2.0.6 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,11 @@ | ||
| 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 | + use FireBox\Core\FB\Box; | |
| 31 | 32 | use FireBox\Core\FB\Boxes; |
| 32 | 33 | use FireBox\Core\FB\Log; |
| 33 | 34 | use FireBox\Core\FB\Track; |
| 34 | 35 | use FireBox\Core\Shortcodes\Shortcodes; |
| @@ -55,13 +56,13 @@ | ||
| 55 | 56 | */ |
| 56 | 57 | public $library; |
| 57 | 58 | |
| 58 | 59 | /** |
| 59 | - * Models | |
| 60 | + * Tables | |
| 60 | 61 | * |
| 61 | - * @var Models | |
| 62 | + * @var Tables | |
| 62 | 63 | */ |
| 63 | - public $models; | |
| 64 | + public $tables; | |
| 64 | 65 | |
| 65 | 66 | /** |
| 66 | 67 | * Custom Post Types |
| 67 | 68 | * |
| @@ -90,13 +91,13 @@ | ||
| 90 | 91 | */ |
| 91 | 92 | public $metaboxes_manager; |
| 92 | 93 | |
| 93 | 94 | /** |
| 94 | - * Maintenance | |
| 95 | + * Box | |
| 95 | 96 | * |
| 96 | - * @var Maintenance | |
| 97 | + * @var Box | |
| 97 | 98 | */ |
| 98 | - public $maintenance; | |
| 99 | + public $box; | |
| 99 | 100 | |
| 100 | 101 | /** |
| 101 | 102 | * Boxes |
| 102 | 103 | * |
| @@ -111,22 +112,8 @@ | ||
| 111 | 112 | */ |
| 112 | 113 | public $menu; |
| 113 | 114 | |
| 114 | 115 | /** |
| 115 | - * The geolocation class | |
| 116 | - * | |
| 117 | - * @var GeoIP | |
| 118 | - */ | |
| 119 | - public $fpgeoip; | |
| 120 | - | |
| 121 | - /** | |
| 122 | - * The REST API. | |
| 123 | - * | |
| 124 | - * @var RESTAPI | |
| 125 | - */ | |
| 126 | - public $api; | |
| 127 | - | |
| 128 | - /** | |
| 129 | 116 | * Helper Classes |
| 130 | 117 | * |
| 131 | 118 | * @var HelperMiddleware |
| 132 | 119 | */ |
| @@ -166,8 +153,15 @@ | ||
| 166 | 153 | * @var Log |
| 167 | 154 | */ |
| 168 | 155 | public $log; |
| 169 | 156 | |
| 157 | + /** | |
| 158 | + * Analytics configuration. | |
| 159 | + * | |
| 160 | + * @var array | |
| 161 | + */ | |
| 162 | + public $analytics_configuration; | |
| 163 | + | |
| 170 | 164 | |
| 171 | 165 | |
| 172 | 166 | /** |
| 173 | 167 | * Translations |
| @@ -180,10 +174,10 @@ | ||
| 180 | 174 | * Tables used by Hook |
| 181 | 175 | * |
| 182 | 176 | * @var array |
| 183 | 177 | */ |
| 184 | - private $hook_data = [ | |
| 185 | - 'tables' => [ 'firebox_logs' ], | |
| 178 | + public $hook_data = [ | |
| 179 | + 'tables' => [ 'firebox_logs', 'firebox_logs_details', 'firebox_submissions', 'firebox_submission_meta' ], | |
| 186 | 180 | 'activation' => FBOX_PLUGIN_DIR . 'Inc/Core/Admin/sql/firebox.sql', |
| 187 | 181 | 'uninstall' => FBOX_PLUGIN_DIR . 'Inc/Core/Admin/sql/uninstall.firebox.sql' |
| 188 | 182 | ]; |
| 189 | 183 | |
| @@ -246,8 +240,11 @@ | ||
| 246 | 240 | |
| 247 | 241 | // Admin |
| 248 | 242 | $this->admin = new Admin(); |
| 249 | 243 | |
| 244 | + // Library | |
| 245 | + $this->library = new Library(); | |
| 246 | + | |
| 250 | 247 | // Metaboxes |
| 251 | 248 | $this->metaboxes_manager = new MetaboxManager(); |
| 252 | 249 | $this->plugin_metaboxes = new PluginMetaboxes(); |
| 253 | 250 | $this->metaboxes_manager->init(); |
| @@ -268,20 +265,10 @@ | ||
| 268 | 265 | |
| 269 | 266 | // show rate reminder after user has activated the plugin |
| 270 | 267 | add_action('activated_plugin', [$this, 'set_rate_reminder']); |
| 271 | 268 | |
| 272 | - // adds plugin translation class to the framework set of translate classes | |
| 273 | - add_filter('fpframework/set_translation_paths', [$this, 'setTranslationsPaths']); | |
| 274 | - | |
| 275 | 269 | // Widgets |
| 276 | 270 | $this->widgets = new Widgets(); |
| 277 | - | |
| 278 | - if (is_admin()) | |
| 279 | - { | |
| 280 | - // Run Activation/Deactivation procedures | |
| 281 | - $this->maintenance = new Maintenance($this->hook_data); | |
| 282 | - $this->maintenance->init(); | |
| 283 | - } | |
| 284 | 271 | } |
| 285 | 272 | |
| 286 | 273 | /** |
| 287 | 274 | * Set rate reminder transient on plugin activation. |
| @@ -334,14 +321,11 @@ | ||
| 334 | 321 | private function initCommons() |
| 335 | 322 | { |
| 336 | 323 | new AdminBarMenu(); |
| 337 | 324 | |
| 338 | - // Library | |
| 339 | - $this->library = new Library(); | |
| 325 | + // Tables | |
| 326 | + $this->tables = new Tables(); | |
| 340 | 327 | |
| 341 | - // Models | |
| 342 | - $this->models = new Models(); | |
| 343 | - | |
| 344 | 328 | // Shortcodes |
| 345 | 329 | $this->shortcodes = new Shortcodes(); |
| 346 | 330 | |
| 347 | 331 | // Log |
| @@ -347,9 +331,10 @@ | ||
| 347 | 331 | // Log |
| 348 | 332 | $this->log = new Log(); |
| 349 | 333 | |
| 350 | 334 | // REST API |
| 351 | - $this->api = new RESTAPI(); | |
| 335 | + new RESTAPI(); | |
| 336 | + | |
| 352 | 337 | |
| 353 | 338 | // Custom Post Types |
| 354 | 339 | $this->cpts = new Cpts(); |
| 355 | 340 | $this->cpts->init(); |
| @@ -356,14 +341,14 @@ | ||
| 356 | 341 | |
| 357 | 342 | // Renderer |
| 358 | 343 | $this->renderer = new Renderer(FBOX_LAYOUTS_DIR); |
| 359 | 344 | |
| 345 | + // Box | |
| 346 | + $this->box = new Box(); | |
| 347 | + | |
| 360 | 348 | // Boxes |
| 361 | 349 | $this->boxes = new Boxes(); |
| 362 | 350 | |
| 363 | - // FPGeo IP | |
| 364 | - $this->fpgeoip = new FPGeoIP(); | |
| 365 | - | |
| 366 | 351 | // Helper |
| 367 | 352 | $this->helper = new HelperMiddleware(); |
| 368 | 353 | |
| 369 | 354 | // Gutenberg Blocks |
| @@ -368,24 +353,30 @@ | ||
| 368 | 353 | |
| 369 | 354 | // Gutenberg Blocks |
| 370 | 355 | $this->blocks = new Blocks(); |
| 371 | 356 | |
| 357 | + new \FireBox\Core\Form\Ajax(); | |
| 358 | + | |
| 372 | 359 | // Track |
| 373 | 360 | $this->track = new Track(); |
| 374 | 361 | |
| 375 | 362 | // Initialize Analytics |
| 376 | 363 | global $wpdb; |
| 377 | - $analytics_configuration = [ | |
| 364 | + $this->analytics_configuration = [ | |
| 378 | 365 | 'boxes_table' => $wpdb->prefix . 'posts', |
| 379 | - 'logs_table' => firebox()->models->boxlog->getFullTableName(), | |
| 380 | - 'logs_details_table' => firebox()->models->boxlogdetails->getFullTableName(), | |
| 366 | + 'logs_table' => firebox()->tables->boxlog->getFullTableName(), | |
| 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', | |
| 381 | 371 | 'nonce_value' => wp_create_nonce('fb-analytics-nonce'), |
| 382 | 372 | ]; |
| 373 | + | |
| 383 | 374 | |
| 384 | 375 | |
| 385 | - | |
| 386 | 376 | // Initialize Analytics Overview |
| 387 | - $this->analytics_overview = new AnalyticsOverview($analytics_configuration); | |
| 377 | + $this->analytics_overview = new AnalyticsOverview(); | |
| 378 | + $this->analytics_overview_ajax = new AnalyticsOverviewAjax(); | |
| 388 | 379 | } |
| 389 | 380 | |
| 390 | 381 | /** |
| 391 | 382 | * Initializes FireBox Plugin with the required components |