| @@ -1,16 +1,17 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 1.0.2 Free | |
| 4 | + * @version 2.1.4 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 © 2024 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; |
| @@ -23,12 +23,10 @@ | ||
| 23 | 23 | use FireBox\Core\Admin\Admin; |
| 24 | 24 | use FireBox\Core\Admin\Includes\Library; |
| 25 | 25 | use FireBox\Core\Admin\Includes\Metaboxes as PluginMetaboxes; |
| 26 | 26 | use FireBox\Core\Admin\Includes\Cpts\Cpts; |
| 27 | - | |
| 28 | - use FireBox\Core\Admin\Analytics\Overview\Overview as AnalyticsOverview; | |
| 29 | 27 | use FireBox\Core\Admin\Menu\PluginMenu; |
| 30 | - use FireBox\Core\Admin\Maintenance; | |
| 28 | + use FireBox\Core\FB\Box; | |
| 31 | 29 | use FireBox\Core\FB\Boxes; |
| 32 | 30 | use FireBox\Core\FB\Log; |
| 33 | 31 | use FireBox\Core\FB\Track; |
| 34 | 32 | use FireBox\Core\Shortcodes\Shortcodes; |
| @@ -55,13 +53,13 @@ | ||
| 55 | 53 | */ |
| 56 | 54 | public $library; |
| 57 | 55 | |
| 58 | 56 | /** |
| 59 | - * Models | |
| 57 | + * Tables | |
| 60 | 58 | * |
| 61 | - * @var Models | |
| 59 | + * @var Tables | |
| 62 | 60 | */ |
| 63 | - public $models; | |
| 61 | + public $tables; | |
| 64 | 62 | |
| 65 | 63 | /** |
| 66 | 64 | * Custom Post Types |
| 67 | 65 | * |
| @@ -90,13 +88,13 @@ | ||
| 90 | 88 | */ |
| 91 | 89 | public $metaboxes_manager; |
| 92 | 90 | |
| 93 | 91 | /** |
| 94 | - * Maintenance | |
| 92 | + * Box | |
| 95 | 93 | * |
| 96 | - * @var Maintenance | |
| 94 | + * @var Box | |
| 97 | 95 | */ |
| 98 | - public $maintenance; | |
| 96 | + public $box; | |
| 99 | 97 | |
| 100 | 98 | /** |
| 101 | 99 | * Boxes |
| 102 | 100 | * |
| @@ -111,22 +109,8 @@ | ||
| 111 | 109 | */ |
| 112 | 110 | public $menu; |
| 113 | 111 | |
| 114 | 112 | /** |
| 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 | 113 | * Helper Classes |
| 130 | 114 | * |
| 131 | 115 | * @var HelperMiddleware |
| 132 | 116 | */ |
| @@ -165,11 +149,10 @@ | ||
| 165 | 149 | * |
| 166 | 150 | * @var Log |
| 167 | 151 | */ |
| 168 | 152 | public $log; |
| 153 | + #PRO-END | |
| 169 | 154 | |
| 170 | - | |
| 171 | - | |
| 172 | 155 | /** |
| 173 | 156 | * Translations |
| 174 | 157 | * |
| 175 | 158 | * @var Translations |
| @@ -180,10 +163,10 @@ | ||
| 180 | 163 | * Tables used by Hook |
| 181 | 164 | * |
| 182 | 165 | * @var array |
| 183 | 166 | */ |
| 184 | - private $hook_data = [ | |
| 185 | - 'tables' => [ 'firebox_logs' ], | |
| 167 | + public $hook_data = [ | |
| 168 | + 'tables' => [ 'firebox_logs', 'firebox_logs_details', 'firebox_submissions', 'firebox_submission_meta' ], | |
| 186 | 169 | 'activation' => FBOX_PLUGIN_DIR . 'Inc/Core/Admin/sql/firebox.sql', |
| 187 | 170 | 'uninstall' => FBOX_PLUGIN_DIR . 'Inc/Core/Admin/sql/uninstall.firebox.sql' |
| 188 | 171 | ]; |
| 189 | 172 | |
| @@ -246,8 +229,11 @@ | ||
| 246 | 229 | |
| 247 | 230 | // Admin |
| 248 | 231 | $this->admin = new Admin(); |
| 249 | 232 | |
| 233 | + // Library | |
| 234 | + $this->library = new Library(); | |
| 235 | + | |
| 250 | 236 | // Metaboxes |
| 251 | 237 | $this->metaboxes_manager = new MetaboxManager(); |
| 252 | 238 | $this->plugin_metaboxes = new PluginMetaboxes(); |
| 253 | 239 | $this->metaboxes_manager->init(); |
| @@ -268,20 +254,10 @@ | ||
| 268 | 254 | |
| 269 | 255 | // show rate reminder after user has activated the plugin |
| 270 | 256 | add_action('activated_plugin', [$this, 'set_rate_reminder']); |
| 271 | 257 | |
| 272 | - // adds plugin translation class to the framework set of translate classes | |
| 273 | - add_filter('fpframework/set_translation_paths', [$this, 'setTranslationsPaths']); | |
| 274 | - | |
| 275 | 258 | // Widgets |
| 276 | 259 | $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 | 260 | } |
| 285 | 261 | |
| 286 | 262 | /** |
| 287 | 263 | * Set rate reminder transient on plugin activation. |
| @@ -334,14 +310,11 @@ | ||
| 334 | 310 | private function initCommons() |
| 335 | 311 | { |
| 336 | 312 | new AdminBarMenu(); |
| 337 | 313 | |
| 338 | - // Library | |
| 339 | - $this->library = new Library(); | |
| 314 | + // Tables | |
| 315 | + $this->tables = new Tables(); | |
| 340 | 316 | |
| 341 | - // Models | |
| 342 | - $this->models = new Models(); | |
| 343 | - | |
| 344 | 317 | // Shortcodes |
| 345 | 318 | $this->shortcodes = new Shortcodes(); |
| 346 | 319 | |
| 347 | 320 | // Log |
| @@ -347,9 +320,10 @@ | ||
| 347 | 320 | // Log |
| 348 | 321 | $this->log = new Log(); |
| 349 | 322 | |
| 350 | 323 | // REST API |
| 351 | - $this->api = new RESTAPI(); | |
| 324 | + new RESTAPI(); | |
| 325 | + | |
| 352 | 326 | |
| 353 | 327 | // Custom Post Types |
| 354 | 328 | $this->cpts = new Cpts(); |
| 355 | 329 | $this->cpts->init(); |
| @@ -356,14 +330,14 @@ | ||
| 356 | 330 | |
| 357 | 331 | // Renderer |
| 358 | 332 | $this->renderer = new Renderer(FBOX_LAYOUTS_DIR); |
| 359 | 333 | |
| 334 | + // Box | |
| 335 | + $this->box = new Box(); | |
| 336 | + | |
| 360 | 337 | // Boxes |
| 361 | 338 | $this->boxes = new Boxes(); |
| 362 | 339 | |
| 363 | - // FPGeo IP | |
| 364 | - $this->fpgeoip = new FPGeoIP(); | |
| 365 | - | |
| 366 | 340 | // Helper |
| 367 | 341 | $this->helper = new HelperMiddleware(); |
| 368 | 342 | |
| 369 | 343 | // Gutenberg Blocks |
| @@ -368,24 +342,16 @@ | ||
| 368 | 342 | |
| 369 | 343 | // Gutenberg Blocks |
| 370 | 344 | $this->blocks = new Blocks(); |
| 371 | 345 | |
| 346 | + // Forms AJAX | |
| 347 | + new \FireBox\Core\Form\Ajax(); | |
| 348 | + | |
| 349 | + // Analytics AJAX | |
| 350 | + new \FireBox\Core\Analytics\Ajax(); | |
| 351 | + | |
| 372 | 352 | // Track |
| 373 | 353 | $this->track = new Track(); |
| 374 | - | |
| 375 | - // Initialize Analytics | |
| 376 | - global $wpdb; | |
| 377 | - $analytics_configuration = [ | |
| 378 | - 'boxes_table' => $wpdb->prefix . 'posts', | |
| 379 | - 'logs_table' => firebox()->models->boxlog->getFullTableName(), | |
| 380 | - 'logs_details_table' => firebox()->models->boxlogdetails->getFullTableName(), | |
| 381 | - 'nonce_value' => wp_create_nonce('fb-analytics-nonce'), | |
| 382 | - ]; | |
| 383 | - | |
| 384 | - | |
| 385 | - | |
| 386 | - // Initialize Analytics Overview | |
| 387 | - $this->analytics_overview = new AnalyticsOverview($analytics_configuration); | |
| 388 | 354 | } |
| 389 | 355 | |
| 390 | 356 | /** |
| 391 | 357 | * Initializes FireBox Plugin with the required components |