| @@ -1,16 +1,17 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 1.0.0 Free | |
| 4 | + * @version 2.1.14 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 | */ |
| @@ -166,9 +150,15 @@ | ||
| 166 | 150 | * @var Log |
| 167 | 151 | */ |
| 168 | 152 | public $log; |
| 169 | 153 | |
| 170 | - | |
| 154 | + /** | |
| 155 | + * PHP Scripts | |
| 156 | + * | |
| 157 | + * @var PHPScripts | |
| 158 | + */ | |
| 159 | + public $phpscripts; | |
| 160 | + #PRO-END | |
| 171 | 161 | |
| 172 | 162 | /** |
| 173 | 163 | * Translations |
| 174 | 164 | * |
| @@ -180,10 +170,10 @@ | ||
| 180 | 170 | * Tables used by Hook |
| 181 | 171 | * |
| 182 | 172 | * @var array |
| 183 | 173 | */ |
| 184 | - private $hook_data = [ | |
| 185 | - 'tables' => [ 'firebox_logs' ], | |
| 174 | + public $hook_data = [ | |
| 175 | + 'tables' => [ 'firebox_logs', 'firebox_logs_details', 'firebox_submissions', 'firebox_submission_meta' ], | |
| 186 | 176 | 'activation' => FBOX_PLUGIN_DIR . 'Inc/Core/Admin/sql/firebox.sql', |
| 187 | 177 | 'uninstall' => FBOX_PLUGIN_DIR . 'Inc/Core/Admin/sql/uninstall.firebox.sql' |
| 188 | 178 | ]; |
| 189 | 179 | |
| @@ -246,8 +236,11 @@ | ||
| 246 | 236 | |
| 247 | 237 | // Admin |
| 248 | 238 | $this->admin = new Admin(); |
| 249 | 239 | |
| 240 | + // Library | |
| 241 | + $this->library = new Library(); | |
| 242 | + | |
| 250 | 243 | // Metaboxes |
| 251 | 244 | $this->metaboxes_manager = new MetaboxManager(); |
| 252 | 245 | $this->plugin_metaboxes = new PluginMetaboxes(); |
| 253 | 246 | $this->metaboxes_manager->init(); |
| @@ -268,20 +261,10 @@ | ||
| 268 | 261 | |
| 269 | 262 | // show rate reminder after user has activated the plugin |
| 270 | 263 | add_action('activated_plugin', [$this, 'set_rate_reminder']); |
| 271 | 264 | |
| 272 | - // adds plugin translation class to the framework set of translate classes | |
| 273 | - add_filter('fpframework/set_translation_paths', [$this, 'setTranslationsPaths']); | |
| 274 | - | |
| 275 | 265 | // Widgets |
| 276 | 266 | $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 | 267 | } |
| 285 | 268 | |
| 286 | 269 | /** |
| 287 | 270 | * Set rate reminder transient on plugin activation. |
| @@ -322,9 +305,9 @@ | ||
| 322 | 305 | * @return void |
| 323 | 306 | */ |
| 324 | 307 | public function loadTextdomain() |
| 325 | 308 | { |
| 326 | - load_plugin_textdomain( 'firebox', false, FBOX_PLUGIN_DIR . 'languages/' ); | |
| 309 | + load_plugin_textdomain('firebox', false, FBOX_PLUGIN_DIR . 'languages/'); | |
| 327 | 310 | } |
| 328 | 311 | |
| 329 | 312 | /** |
| 330 | 313 | * Initializes all Common components used by front-end and back-end. |
| @@ -334,14 +317,11 @@ | ||
| 334 | 317 | private function initCommons() |
| 335 | 318 | { |
| 336 | 319 | new AdminBarMenu(); |
| 337 | 320 | |
| 338 | - // Library | |
| 339 | - $this->library = new Library(); | |
| 321 | + // Tables | |
| 322 | + $this->tables = new Tables(); | |
| 340 | 323 | |
| 341 | - // Models | |
| 342 | - $this->models = new Models(); | |
| 343 | - | |
| 344 | 324 | // Shortcodes |
| 345 | 325 | $this->shortcodes = new Shortcodes(); |
| 346 | 326 | |
| 347 | 327 | // Log |
| @@ -347,9 +327,11 @@ | ||
| 347 | 327 | // Log |
| 348 | 328 | $this->log = new Log(); |
| 349 | 329 | |
| 350 | 330 | // REST API |
| 351 | - $this->api = new RESTAPI(); | |
| 331 | + new RESTAPI(); | |
| 332 | + | |
| 333 | + | |
| 352 | 334 | |
| 353 | 335 | // Custom Post Types |
| 354 | 336 | $this->cpts = new Cpts(); |
| 355 | 337 | $this->cpts->init(); |
| @@ -356,14 +338,14 @@ | ||
| 356 | 338 | |
| 357 | 339 | // Renderer |
| 358 | 340 | $this->renderer = new Renderer(FBOX_LAYOUTS_DIR); |
| 359 | 341 | |
| 342 | + // Box | |
| 343 | + $this->box = new Box(); | |
| 344 | + | |
| 360 | 345 | // Boxes |
| 361 | 346 | $this->boxes = new Boxes(); |
| 362 | 347 | |
| 363 | - // FPGeo IP | |
| 364 | - $this->fpgeoip = new FPGeoIP(); | |
| 365 | - | |
| 366 | 348 | // Helper |
| 367 | 349 | $this->helper = new HelperMiddleware(); |
| 368 | 350 | |
| 369 | 351 | // Gutenberg Blocks |
| @@ -368,24 +350,16 @@ | ||
| 368 | 350 | |
| 369 | 351 | // Gutenberg Blocks |
| 370 | 352 | $this->blocks = new Blocks(); |
| 371 | 353 | |
| 354 | + // Forms AJAX | |
| 355 | + new \FireBox\Core\Form\Ajax(); | |
| 356 | + | |
| 357 | + // Analytics AJAX | |
| 358 | + new \FireBox\Core\Analytics\Ajax(); | |
| 359 | + | |
| 372 | 360 | // Track |
| 373 | 361 | $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 | 362 | } |
| 389 | 363 | |
| 390 | 364 | /** |
| 391 | 365 | * Initializes FireBox Plugin with the required components |