| @@ -1,16 +1,17 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 1.0.4 Free | |
| 4 | + * @version 2.1.0 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; |
| @@ -23,12 +23,9 @@ | ||
| 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; | |
| 31 | 28 | use FireBox\Core\FB\Box; |
| 32 | 29 | use FireBox\Core\FB\Boxes; |
| 33 | 30 | use FireBox\Core\FB\Log; |
| 34 | 31 | use FireBox\Core\FB\Track; |
| @@ -91,15 +88,8 @@ | ||
| 91 | 88 | */ |
| 92 | 89 | public $metaboxes_manager; |
| 93 | 90 | |
| 94 | 91 | /** |
| 95 | - * Maintenance | |
| 96 | - * | |
| 97 | - * @var Maintenance | |
| 98 | - */ | |
| 99 | - public $maintenance; | |
| 100 | - | |
| 101 | - /** | |
| 102 | 92 | * Box |
| 103 | 93 | * |
| 104 | 94 | * @var Box |
| 105 | 95 | */ |
| @@ -119,22 +109,8 @@ | ||
| 119 | 109 | */ |
| 120 | 110 | public $menu; |
| 121 | 111 | |
| 122 | 112 | /** |
| 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 | 113 | * Helper Classes |
| 138 | 114 | * |
| 139 | 115 | * @var HelperMiddleware |
| 140 | 116 | */ |
| @@ -173,11 +149,10 @@ | ||
| 173 | 149 | * |
| 174 | 150 | * @var Log |
| 175 | 151 | */ |
| 176 | 152 | public $log; |
| 153 | + #PRO-END | |
| 177 | 154 | |
| 178 | - | |
| 179 | - | |
| 180 | 155 | /** |
| 181 | 156 | * Translations |
| 182 | 157 | * |
| 183 | 158 | * @var Translations |
| @@ -188,10 +163,10 @@ | ||
| 188 | 163 | * Tables used by Hook |
| 189 | 164 | * |
| 190 | 165 | * @var array |
| 191 | 166 | */ |
| 192 | - private $hook_data = [ | |
| 193 | - 'tables' => [ 'firebox_logs' ], | |
| 167 | + public $hook_data = [ | |
| 168 | + 'tables' => [ 'firebox_logs', 'firebox_logs_details', 'firebox_submissions', 'firebox_submission_meta' ], | |
| 194 | 169 | 'activation' => FBOX_PLUGIN_DIR . 'Inc/Core/Admin/sql/firebox.sql', |
| 195 | 170 | 'uninstall' => FBOX_PLUGIN_DIR . 'Inc/Core/Admin/sql/uninstall.firebox.sql' |
| 196 | 171 | ]; |
| 197 | 172 | |
| @@ -254,8 +229,11 @@ | ||
| 254 | 229 | |
| 255 | 230 | // Admin |
| 256 | 231 | $this->admin = new Admin(); |
| 257 | 232 | |
| 233 | + // Library | |
| 234 | + $this->library = new Library(); | |
| 235 | + | |
| 258 | 236 | // Metaboxes |
| 259 | 237 | $this->metaboxes_manager = new MetaboxManager(); |
| 260 | 238 | $this->plugin_metaboxes = new PluginMetaboxes(); |
| 261 | 239 | $this->metaboxes_manager->init(); |
| @@ -276,20 +254,10 @@ | ||
| 276 | 254 | |
| 277 | 255 | // show rate reminder after user has activated the plugin |
| 278 | 256 | add_action('activated_plugin', [$this, 'set_rate_reminder']); |
| 279 | 257 | |
| 280 | - // adds plugin translation class to the framework set of translate classes | |
| 281 | - add_filter('fpframework/set_translation_paths', [$this, 'setTranslationsPaths']); | |
| 282 | - | |
| 283 | 258 | // Widgets |
| 284 | 259 | $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 | 260 | } |
| 293 | 261 | |
| 294 | 262 | /** |
| 295 | 263 | * Set rate reminder transient on plugin activation. |
| @@ -342,11 +310,8 @@ | ||
| 342 | 310 | private function initCommons() |
| 343 | 311 | { |
| 344 | 312 | new AdminBarMenu(); |
| 345 | 313 | |
| 346 | - // Library | |
| 347 | - $this->library = new Library(); | |
| 348 | - | |
| 349 | 314 | // Tables |
| 350 | 315 | $this->tables = new Tables(); |
| 351 | 316 | |
| 352 | 317 | // Shortcodes |
| @@ -355,9 +320,10 @@ | ||
| 355 | 320 | // Log |
| 356 | 321 | $this->log = new Log(); |
| 357 | 322 | |
| 358 | 323 | // REST API |
| 359 | - $this->api = new RESTAPI(); | |
| 324 | + new RESTAPI(); | |
| 325 | + | |
| 360 | 326 | |
| 361 | 327 | // Custom Post Types |
| 362 | 328 | $this->cpts = new Cpts(); |
| 363 | 329 | $this->cpts->init(); |
| @@ -370,11 +336,8 @@ | ||
| 370 | 336 | |
| 371 | 337 | // Boxes |
| 372 | 338 | $this->boxes = new Boxes(); |
| 373 | 339 | |
| 374 | - // FPGeo IP | |
| 375 | - $this->fpgeoip = new FPGeoIP(); | |
| 376 | - | |
| 377 | 340 | // Helper |
| 378 | 341 | $this->helper = new HelperMiddleware(); |
| 379 | 342 | |
| 380 | 343 | // Gutenberg Blocks |
| @@ -379,24 +342,16 @@ | ||
| 379 | 342 | |
| 380 | 343 | // Gutenberg Blocks |
| 381 | 344 | $this->blocks = new Blocks(); |
| 382 | 345 | |
| 346 | + // Forms AJAX | |
| 347 | + new \FireBox\Core\Form\Ajax(); | |
| 348 | + | |
| 349 | + // Analytics AJAX | |
| 350 | + new \FireBox\Core\Analytics\Ajax(); | |
| 351 | + | |
| 383 | 352 | // Track |
| 384 | 353 | $this->track = new Track(); |
| 385 | - | |
| 386 | - // Initialize Analytics | |
| 387 | - global $wpdb; | |
| 388 | - $analytics_configuration = [ | |
| 389 | - 'boxes_table' => $wpdb->prefix . 'posts', | |
| 390 | - 'logs_table' => firebox()->tables->boxlog->getFullTableName(), | |
| 391 | - 'logs_details_table' => firebox()->tables->boxlogdetails->getFullTableName(), | |
| 392 | - 'nonce_value' => wp_create_nonce('fb-analytics-nonce'), | |
| 393 | - ]; | |
| 394 | - | |
| 395 | - | |
| 396 | - | |
| 397 | - // Initialize Analytics Overview | |
| 398 | - $this->analytics_overview = new AnalyticsOverview($analytics_configuration); | |
| 399 | 354 | } |
| 400 | 355 | |
| 401 | 356 | /** |
| 402 | 357 | * Initializes FireBox Plugin with the required components |